@intelmesh/sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/.github/scripts/compute-disttag.sh +47 -0
  2. package/.github/workflows/release.yml +206 -0
  3. package/.husky/commit-msg +1 -0
  4. package/.husky/pre-commit +2 -0
  5. package/.prettierrc +8 -0
  6. package/CLAUDE.md +37 -0
  7. package/LICENSE +21 -0
  8. package/commitlint.config.cjs +3 -0
  9. package/dist/index.d.ts +1293 -0
  10. package/dist/index.js +1651 -0
  11. package/docs/superpowers/plans/2026-04-10-release-pipeline.md +798 -0
  12. package/docs/superpowers/specs/2026-04-10-release-pipeline-design.md +309 -0
  13. package/eslint.config.mjs +38 -0
  14. package/package.json +72 -0
  15. package/src/builders/event.ts +72 -0
  16. package/src/builders/rule.ts +143 -0
  17. package/src/client/errors.ts +171 -0
  18. package/src/client/http.ts +209 -0
  19. package/src/client/intelmesh.ts +57 -0
  20. package/src/client/pagination.ts +50 -0
  21. package/src/generated/types.ts +11 -0
  22. package/src/index.ts +106 -0
  23. package/src/provision/index.ts +6 -0
  24. package/src/provision/provisioner.ts +326 -0
  25. package/src/provision/rule-builder.ts +193 -0
  26. package/src/resources/apikeys.ts +63 -0
  27. package/src/resources/audit.ts +29 -0
  28. package/src/resources/evaluations.ts +38 -0
  29. package/src/resources/events.ts +61 -0
  30. package/src/resources/lists.ts +91 -0
  31. package/src/resources/phases.ts +71 -0
  32. package/src/resources/rules.ts +98 -0
  33. package/src/resources/scopes.ts +71 -0
  34. package/src/resources/scores.ts +63 -0
  35. package/src/testkit/assertion.ts +76 -0
  36. package/src/testkit/harness.ts +252 -0
  37. package/src/testkit/index.ts +7 -0
  38. package/src/types.ts +330 -0
  39. package/tests/client/errors.test.ts +159 -0
  40. package/tests/provision/provisioner.test.ts +311 -0
  41. package/tests/scripts/compute-disttag.test.ts +178 -0
  42. package/tests/testkit/harness.test.ts +291 -0
  43. package/tsconfig.eslint.json +8 -0
  44. package/tsconfig.json +29 -0
  45. package/vitest.config.ts +14 -0
@@ -0,0 +1,1293 @@
1
+ /** Severity levels for decisions. */
2
+ type Severity = 'low' | 'medium' | 'high' | 'critical';
3
+ /** Rule flow control. */
4
+ type Flow = 'continue' | 'skip_phase' | 'halt';
5
+ /** A decision produced by rule evaluation. */
6
+ interface Decision {
7
+ readonly action: string;
8
+ readonly severity: Severity;
9
+ readonly metadata?: Readonly<Record<string, unknown>>;
10
+ }
11
+ /** Score mutation attached to rule actions. */
12
+ interface ScoreOperation {
13
+ readonly add: number;
14
+ }
15
+ /** A side-effect mutation triggered by a rule (e.g. list add/remove). */
16
+ interface ListMutation {
17
+ readonly type: string;
18
+ readonly target: string;
19
+ readonly value_path: string;
20
+ }
21
+ /** Actions triggered when a rule matches. */
22
+ interface Actions {
23
+ readonly decision?: Decision;
24
+ readonly flow?: Flow;
25
+ readonly score?: ScoreOperation;
26
+ readonly mutations?: readonly ListMutation[];
27
+ }
28
+ /** A rule definition. */
29
+ interface Rule {
30
+ readonly id: string;
31
+ readonly name: string;
32
+ readonly expression: string;
33
+ readonly applicable_when: string;
34
+ readonly phase_id: string;
35
+ readonly priority: number;
36
+ readonly enabled: boolean;
37
+ readonly dry_run: boolean;
38
+ readonly actions: Actions;
39
+ readonly current_version_id: string;
40
+ readonly created_at: string;
41
+ readonly updated_at: string;
42
+ }
43
+ /** A versioned snapshot of a rule. */
44
+ interface RuleVersion {
45
+ readonly id: string;
46
+ readonly rule_id: string;
47
+ readonly version: number;
48
+ readonly name: string;
49
+ readonly expression: string;
50
+ readonly applicable_when: string;
51
+ readonly phase_id: string;
52
+ readonly priority: number;
53
+ readonly enabled: boolean;
54
+ readonly dry_run: boolean;
55
+ readonly actions: readonly number[];
56
+ readonly created_at: string;
57
+ }
58
+ /** Payload to create a rule. */
59
+ interface CreateRuleRequest {
60
+ readonly name: string;
61
+ readonly expression: string;
62
+ readonly applicable_when: string;
63
+ readonly phase_id: string;
64
+ readonly priority: number;
65
+ readonly enabled: boolean;
66
+ readonly dry_run: boolean;
67
+ readonly actions: Actions;
68
+ }
69
+ /** Payload to update a rule. */
70
+ interface UpdateRuleRequest {
71
+ readonly name?: string;
72
+ readonly expression?: string;
73
+ readonly applicable_when?: string;
74
+ readonly phase_id?: string;
75
+ readonly priority?: number;
76
+ readonly enabled?: boolean;
77
+ readonly dry_run?: boolean;
78
+ readonly actions?: Actions;
79
+ }
80
+ /** An evaluation phase in the pipeline. */
81
+ interface Phase {
82
+ readonly id: string;
83
+ readonly name: string;
84
+ readonly position: number;
85
+ readonly applicable_when?: string;
86
+ readonly created_at: string;
87
+ }
88
+ /** Payload to create a phase. */
89
+ interface CreatePhaseRequest {
90
+ readonly name: string;
91
+ readonly position: number;
92
+ readonly applicable_when?: string;
93
+ }
94
+ /** Payload to update a phase. */
95
+ interface UpdatePhaseRequest {
96
+ readonly name?: string;
97
+ readonly position?: number;
98
+ readonly applicable_when?: string;
99
+ }
100
+ /** A scope definition for event field projection. */
101
+ interface Scope {
102
+ readonly id: string;
103
+ readonly name: string;
104
+ readonly json_path: string;
105
+ readonly created_at: string;
106
+ }
107
+ /** Payload to create a scope. */
108
+ interface CreateScopeRequest {
109
+ readonly name: string;
110
+ readonly json_path: string;
111
+ }
112
+ /** Payload to update a scope. */
113
+ interface UpdateScopeRequest {
114
+ readonly name?: string;
115
+ readonly json_path?: string;
116
+ }
117
+ /** A named list (blocklist, allowlist, etc.). */
118
+ interface List {
119
+ readonly id: string;
120
+ readonly name: string;
121
+ readonly description: string;
122
+ readonly created_at: string;
123
+ readonly updated_at: string;
124
+ }
125
+ /** Payload to create a list. */
126
+ interface CreateListRequest {
127
+ readonly name: string;
128
+ readonly description: string;
129
+ }
130
+ /** Payload to update a list. */
131
+ interface UpdateListRequest {
132
+ readonly name?: string;
133
+ readonly description?: string;
134
+ }
135
+ /** Payload to add items to a list. */
136
+ interface AddItemsRequest {
137
+ readonly values: readonly string[];
138
+ }
139
+ /** Payload to bulk-import items into a list. */
140
+ interface BulkImportRequest {
141
+ readonly values: readonly string[];
142
+ }
143
+ /** A score entry for a scope. */
144
+ interface Score {
145
+ readonly scope_name: string;
146
+ readonly scope_value: string;
147
+ readonly score: number;
148
+ }
149
+ /** Payload to set a score. */
150
+ interface SetScoreRequest {
151
+ readonly value: number;
152
+ }
153
+ /** An API key. */
154
+ interface APIKey {
155
+ readonly id: string;
156
+ readonly name: string;
157
+ readonly enabled: boolean;
158
+ readonly permissions: readonly string[];
159
+ readonly created_at: string;
160
+ readonly last_used_at?: string;
161
+ }
162
+ /** Payload to create an API key. */
163
+ interface CreateAPIKeyRequest {
164
+ readonly name: string;
165
+ readonly permissions: readonly string[];
166
+ }
167
+ /** Response after creating an API key (plain key shown once). */
168
+ interface CreateAPIKeyResponse {
169
+ readonly id: string;
170
+ readonly name: string;
171
+ readonly key: string;
172
+ readonly enabled: boolean;
173
+ readonly permissions: readonly string[];
174
+ }
175
+ /** Payload to update an API key. */
176
+ interface UpdateAPIKeyRequest {
177
+ readonly name?: string;
178
+ readonly enabled?: boolean;
179
+ readonly permissions?: readonly string[];
180
+ }
181
+ /** Payload to ingest an event. */
182
+ interface IngestRequest {
183
+ readonly event_type: string;
184
+ readonly payload: Readonly<Record<string, unknown>>;
185
+ readonly idempotency_key?: string;
186
+ }
187
+ /** Result of a synchronous event ingestion. */
188
+ interface IngestResult {
189
+ readonly event_id: string;
190
+ readonly decision: Decision;
191
+ readonly transient_score: number;
192
+ readonly duration_ms: number;
193
+ }
194
+ /** Trace of a single rule evaluation. */
195
+ interface RuleTrace {
196
+ readonly rule_id: string;
197
+ readonly rule_name: string;
198
+ readonly rule_version_id: string;
199
+ readonly matched: boolean;
200
+ readonly skipped: boolean;
201
+ readonly dry_run: boolean;
202
+ readonly decision?: Decision;
203
+ readonly flow: string;
204
+ readonly score_delta: number;
205
+ readonly duration_ms: number;
206
+ }
207
+ /** Trace of a phase evaluation. */
208
+ interface PhaseTrace {
209
+ readonly name: string;
210
+ readonly duration_ms: number;
211
+ readonly rules: readonly RuleTrace[];
212
+ }
213
+ /** Full pipeline trace. */
214
+ interface PipelineTrace {
215
+ readonly phases: readonly PhaseTrace[];
216
+ }
217
+ /** An evaluation log entry. */
218
+ interface EvaluationLog {
219
+ readonly id: string;
220
+ readonly event_id: string;
221
+ readonly event_type: string;
222
+ readonly decision: Decision;
223
+ readonly duration_ms: number;
224
+ readonly pipeline_trace: PipelineTrace;
225
+ readonly created_at: string;
226
+ }
227
+ /** A paginated response envelope. */
228
+ interface PaginatedResponse<T> {
229
+ readonly items: readonly T[];
230
+ readonly count: number;
231
+ readonly next_cursor?: string;
232
+ }
233
+ /** Common pagination parameters. */
234
+ interface PaginationParams {
235
+ readonly cursor?: string;
236
+ readonly limit?: number;
237
+ }
238
+ /** Success response envelope. */
239
+ interface SuccessResponse<T> {
240
+ readonly data: T;
241
+ }
242
+ /** Error body. */
243
+ interface ErrorBody {
244
+ readonly code: string;
245
+ readonly message: string;
246
+ }
247
+ /** Error response envelope. */
248
+ interface ErrorResponse {
249
+ readonly error: ErrorBody;
250
+ }
251
+ /** Configuration for the IntelMesh client. */
252
+ interface ClientConfig {
253
+ /** Base URL of the IntelMesh API (e.g. "https://api.intelmesh.io"). */
254
+ readonly baseUrl: string;
255
+ /** API key for authentication. */
256
+ readonly apiKey: string;
257
+ /** Optional request timeout in milliseconds (default: 30000). */
258
+ readonly timeout?: number;
259
+ /** Optional custom fetch implementation. */
260
+ readonly fetch?: typeof globalThis.fetch;
261
+ }
262
+ /** Mutation result containing the updated resource. */
263
+ interface Mutation<T> {
264
+ readonly data: T;
265
+ }
266
+
267
+ /** HTTP methods supported by the client. */
268
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'DELETE';
269
+ /** Options for a single HTTP request. */
270
+ interface RequestOptions {
271
+ readonly method: HttpMethod;
272
+ readonly path: string;
273
+ readonly body?: unknown;
274
+ readonly query?: Readonly<Record<string, string | number | undefined>>;
275
+ readonly signal?: AbortSignal;
276
+ }
277
+ /**
278
+ * Low-level HTTP client for the IntelMesh API.
279
+ * Handles authentication, serialization, and error mapping.
280
+ */
281
+ declare class HttpClient {
282
+ private readonly baseUrl;
283
+ private readonly apiKey;
284
+ private readonly timeout;
285
+ private readonly fetchFn;
286
+ constructor(config: ClientConfig);
287
+ /**
288
+ * Executes a GET request and returns the parsed data.
289
+ * @param path - The API path.
290
+ * @param query - Optional query parameters.
291
+ * @returns The response data of type T.
292
+ */
293
+ get<T>(path: string, query?: RequestOptions['query']): Promise<T>;
294
+ /**
295
+ * Executes a POST request and returns the parsed data.
296
+ * @param path - The API path.
297
+ * @param body - The request body.
298
+ * @returns The response data of type T.
299
+ */
300
+ post<T>(path: string, body: unknown): Promise<T>;
301
+ /**
302
+ * Executes a PUT request and returns the parsed data.
303
+ * @param path - The API path.
304
+ * @param body - The request body.
305
+ * @returns The response data of type T.
306
+ */
307
+ put<T>(path: string, body: unknown): Promise<T>;
308
+ /**
309
+ * Executes a DELETE request and returns the parsed data.
310
+ * @param path - The API path.
311
+ * @returns The response data of type T.
312
+ */
313
+ delete<T>(path: string): Promise<T>;
314
+ /**
315
+ * Builds the full URL with query parameters.
316
+ * @param path - The API path.
317
+ * @param query - Optional query parameters.
318
+ * @returns The full URL string.
319
+ */
320
+ private buildUrl;
321
+ /**
322
+ * Executes an HTTP request with timeout, auth, and error handling.
323
+ * @param options - The request options.
324
+ * @returns The parsed response data.
325
+ */
326
+ private request;
327
+ /**
328
+ * Calls fetch with the configured headers and body.
329
+ * @param url - The full URL.
330
+ * @param options - The request options.
331
+ * @param signal - The abort signal.
332
+ * @returns The fetch Response.
333
+ */
334
+ private executeFetch;
335
+ /**
336
+ * Parses the response and throws typed errors for non-2xx status.
337
+ * @param response - The fetch Response.
338
+ * @returns The parsed data.
339
+ */
340
+ private handleResponse;
341
+ /**
342
+ * Parses and throws an API error from the response body.
343
+ * @param status - The HTTP status code.
344
+ * @param text - The raw response body.
345
+ */
346
+ private throwApiError;
347
+ /**
348
+ * Safely parses JSON with a typed parse error.
349
+ * @param text - The raw JSON text.
350
+ * @returns The parsed JSON object.
351
+ */
352
+ private parseJson;
353
+ /**
354
+ * Wraps unexpected errors into NetworkError.
355
+ * @param error - The caught error.
356
+ * @returns A NetworkError or the original error.
357
+ */
358
+ private wrapError;
359
+ }
360
+
361
+ /**
362
+ * Resource for API key management.
363
+ */
364
+ declare class APIKeys {
365
+ private readonly http;
366
+ constructor(http: HttpClient);
367
+ /**
368
+ * Lists all API keys with cursor-based pagination.
369
+ * @param params - Optional pagination parameters.
370
+ * @returns A paginated list of API keys.
371
+ */
372
+ list(params?: PaginationParams): Promise<PaginatedResponse<APIKey>>;
373
+ /**
374
+ * Creates a new API key. The plain key is returned only at creation time.
375
+ * @param request - The API key creation payload.
376
+ * @returns The created API key with the plain key value.
377
+ */
378
+ create(request: CreateAPIKeyRequest): Promise<CreateAPIKeyResponse>;
379
+ /**
380
+ * Updates an existing API key by ID.
381
+ * @param id - The API key ID.
382
+ * @param request - The update payload.
383
+ * @returns The updated API key.
384
+ */
385
+ update(id: string, request: UpdateAPIKeyRequest): Promise<APIKey>;
386
+ /**
387
+ * Deletes an API key by ID.
388
+ * @param id - The API key ID.
389
+ */
390
+ delete(id: string): Promise<void>;
391
+ }
392
+
393
+ /**
394
+ * Resource for audit log access.
395
+ */
396
+ declare class Audit {
397
+ private readonly http;
398
+ constructor(http: HttpClient);
399
+ /**
400
+ * Lists audit logs with cursor-based pagination.
401
+ * @param params - Optional pagination parameters.
402
+ * @returns A paginated list of audit entries.
403
+ */
404
+ list(params?: PaginationParams): Promise<PaginatedResponse<EvaluationLog>>;
405
+ }
406
+
407
+ /**
408
+ * Resource for evaluation log inspection.
409
+ */
410
+ declare class Evaluations {
411
+ private readonly http;
412
+ constructor(http: HttpClient);
413
+ /**
414
+ * Lists evaluation logs with cursor-based pagination.
415
+ * @param params - Optional pagination parameters.
416
+ * @returns A paginated list of evaluation logs.
417
+ */
418
+ list(params?: PaginationParams): Promise<PaginatedResponse<EvaluationLog>>;
419
+ /**
420
+ * Retrieves a single evaluation log by ID.
421
+ * @param id - The evaluation log ID.
422
+ * @returns The evaluation log with full pipeline trace.
423
+ */
424
+ get(id: string): Promise<EvaluationLog>;
425
+ }
426
+
427
+ /**
428
+ * Resource for event ingestion operations.
429
+ */
430
+ declare class Events {
431
+ private readonly http;
432
+ constructor(http: HttpClient);
433
+ /**
434
+ * Ingests an event synchronously and returns the decision.
435
+ * @param request - The ingest request payload.
436
+ * @returns The ingestion result with decision and score.
437
+ */
438
+ ingest(request: IngestRequest): Promise<IngestResult>;
439
+ /**
440
+ * Ingests an event asynchronously (fire-and-forget with acknowledgement).
441
+ * @param request - The ingest request payload.
442
+ * @returns The event ID assigned by the server.
443
+ */
444
+ ingestAsync(request: IngestRequest): Promise<string>;
445
+ /**
446
+ * Ingests an event for storage only, without evaluation.
447
+ * @param request - The ingest request payload.
448
+ * @returns The event ID assigned by the server.
449
+ */
450
+ ingestOnly(request: IngestRequest): Promise<string>;
451
+ /**
452
+ * Simulates event evaluation without persisting (dry-run).
453
+ * @param request - The ingest request payload.
454
+ * @returns The simulated result with decision and trace.
455
+ */
456
+ simulate(request: IngestRequest): Promise<IngestResult>;
457
+ }
458
+
459
+ /**
460
+ * Resource for named list management (blocklists, allowlists, etc.).
461
+ */
462
+ declare class Lists {
463
+ private readonly http;
464
+ constructor(http: HttpClient);
465
+ /**
466
+ * Lists all named lists with cursor-based pagination.
467
+ * @param params - Optional pagination parameters.
468
+ * @returns A paginated list of named lists.
469
+ */
470
+ list(params?: PaginationParams): Promise<PaginatedResponse<List>>;
471
+ /**
472
+ * Retrieves a single list by ID.
473
+ * @param id - The list ID.
474
+ * @returns The list.
475
+ */
476
+ get(id: string): Promise<List>;
477
+ /**
478
+ * Creates a new named list.
479
+ * @param request - The list creation payload.
480
+ * @returns The created list.
481
+ */
482
+ create(request: CreateListRequest): Promise<List>;
483
+ /**
484
+ * Updates an existing list by ID.
485
+ * @param id - The list ID.
486
+ * @param request - The update payload.
487
+ * @returns The updated list.
488
+ */
489
+ update(id: string, request: UpdateListRequest): Promise<List>;
490
+ /**
491
+ * Deletes a list by ID.
492
+ * @param id - The list ID.
493
+ */
494
+ delete(id: string): Promise<void>;
495
+ /**
496
+ * Adds items to a list.
497
+ * @param listId - The list ID.
498
+ * @param request - The items to add.
499
+ */
500
+ addItems(listId: string, request: AddItemsRequest): Promise<void>;
501
+ /**
502
+ * Bulk-imports items into a list, replacing existing items.
503
+ * @param listId - The list ID.
504
+ * @param request - The items to import.
505
+ */
506
+ bulkImport(listId: string, request: BulkImportRequest): Promise<void>;
507
+ }
508
+
509
+ /**
510
+ * Resource for pipeline phase management.
511
+ */
512
+ declare class Phases {
513
+ private readonly http;
514
+ constructor(http: HttpClient);
515
+ /**
516
+ * Lists all phases with cursor-based pagination.
517
+ * @param params - Optional pagination parameters.
518
+ * @returns A paginated list of phases.
519
+ */
520
+ list(params?: PaginationParams): Promise<PaginatedResponse<Phase>>;
521
+ /**
522
+ * Retrieves a single phase by ID.
523
+ * @param id - The phase ID.
524
+ * @returns The phase.
525
+ */
526
+ get(id: string): Promise<Phase>;
527
+ /**
528
+ * Creates a new phase.
529
+ * @param request - The phase creation payload.
530
+ * @returns The created phase.
531
+ */
532
+ create(request: CreatePhaseRequest): Promise<Phase>;
533
+ /**
534
+ * Updates an existing phase by ID.
535
+ * @param id - The phase ID.
536
+ * @param request - The update payload.
537
+ * @returns The updated phase.
538
+ */
539
+ update(id: string, request: UpdatePhaseRequest): Promise<Phase>;
540
+ /**
541
+ * Deletes a phase by ID.
542
+ * @param id - The phase ID.
543
+ */
544
+ delete(id: string): Promise<void>;
545
+ }
546
+
547
+ /**
548
+ * Resource for rule management operations.
549
+ */
550
+ declare class Rules {
551
+ private readonly http;
552
+ constructor(http: HttpClient);
553
+ /**
554
+ * Lists all rules with cursor-based pagination.
555
+ * @param params - Optional pagination parameters.
556
+ * @returns A paginated list of rules.
557
+ */
558
+ list(params?: PaginationParams): Promise<PaginatedResponse<Rule>>;
559
+ /**
560
+ * Retrieves a single rule by ID.
561
+ * @param id - The rule ID.
562
+ * @returns The rule.
563
+ */
564
+ get(id: string): Promise<Rule>;
565
+ /**
566
+ * Creates a new rule.
567
+ * @param request - The rule creation payload.
568
+ * @returns The created rule.
569
+ */
570
+ create(request: CreateRuleRequest): Promise<Rule>;
571
+ /**
572
+ * Updates an existing rule by ID.
573
+ * @param id - The rule ID.
574
+ * @param request - The update payload.
575
+ * @returns The updated rule.
576
+ */
577
+ update(id: string, request: UpdateRuleRequest): Promise<Rule>;
578
+ /**
579
+ * Deletes a rule by ID.
580
+ * @param id - The rule ID.
581
+ */
582
+ delete(id: string): Promise<void>;
583
+ /**
584
+ * Lists all versions of a rule.
585
+ * @param ruleId - The rule ID.
586
+ * @param params - Optional pagination parameters.
587
+ * @returns A paginated list of rule versions.
588
+ */
589
+ listVersions(ruleId: string, params?: PaginationParams): Promise<PaginatedResponse<RuleVersion>>;
590
+ /**
591
+ * Retrieves a specific version of a rule.
592
+ * @param ruleId - The rule ID.
593
+ * @param versionId - The version ID.
594
+ * @returns The rule version.
595
+ */
596
+ getVersion(ruleId: string, versionId: string): Promise<RuleVersion>;
597
+ }
598
+
599
+ /**
600
+ * Resource for score management.
601
+ */
602
+ declare class Scores {
603
+ private readonly http;
604
+ constructor(http: HttpClient);
605
+ /**
606
+ * Retrieves a score for a specific scope name and value.
607
+ * @param scopeName - The scope name (e.g. "customer_id").
608
+ * @param scopeValue - The scope value (e.g. "12345678900").
609
+ * @returns The score entry.
610
+ */
611
+ get(scopeName: string, scopeValue: string): Promise<Score>;
612
+ /**
613
+ * Lists scores for a scope name with cursor-based pagination.
614
+ * @param scopeName - The scope name.
615
+ * @param params - Optional pagination parameters.
616
+ * @returns A paginated list of scores.
617
+ */
618
+ list(scopeName: string, params?: PaginationParams): Promise<PaginatedResponse<Score>>;
619
+ /**
620
+ * Sets a score for a specific scope name and value.
621
+ * @param scopeName - The scope name.
622
+ * @param scopeValue - The scope value.
623
+ * @param request - The score value to set.
624
+ * @returns The updated score.
625
+ */
626
+ set(scopeName: string, scopeValue: string, request: SetScoreRequest): Promise<Score>;
627
+ /**
628
+ * Resets a score to zero for a specific scope name and value.
629
+ * @param scopeName - The scope name.
630
+ * @param scopeValue - The scope value.
631
+ */
632
+ reset(scopeName: string, scopeValue: string): Promise<void>;
633
+ }
634
+
635
+ /**
636
+ * Resource for scope management.
637
+ */
638
+ declare class Scopes {
639
+ private readonly http;
640
+ constructor(http: HttpClient);
641
+ /**
642
+ * Lists all scopes with cursor-based pagination.
643
+ * @param params - Optional pagination parameters.
644
+ * @returns A paginated list of scopes.
645
+ */
646
+ list(params?: PaginationParams): Promise<PaginatedResponse<Scope>>;
647
+ /**
648
+ * Retrieves a single scope by ID.
649
+ * @param id - The scope ID.
650
+ * @returns The scope.
651
+ */
652
+ get(id: string): Promise<Scope>;
653
+ /**
654
+ * Creates a new scope.
655
+ * @param request - The scope creation payload.
656
+ * @returns The created scope.
657
+ */
658
+ create(request: CreateScopeRequest): Promise<Scope>;
659
+ /**
660
+ * Updates an existing scope by ID.
661
+ * @param id - The scope ID.
662
+ * @param request - The update payload.
663
+ * @returns The updated scope.
664
+ */
665
+ update(id: string, request: UpdateScopeRequest): Promise<Scope>;
666
+ /**
667
+ * Deletes a scope by ID.
668
+ * @param id - The scope ID.
669
+ */
670
+ delete(id: string): Promise<void>;
671
+ }
672
+
673
+ /**
674
+ * Main IntelMesh SDK client.
675
+ * Provides access to all API resources through typed sub-clients.
676
+ */
677
+ declare class IntelMesh {
678
+ /** Event ingestion and simulation. */
679
+ readonly events: Events;
680
+ /** Rule management and versioning. */
681
+ readonly rules: Rules;
682
+ /** Pipeline phase management. */
683
+ readonly phases: Phases;
684
+ /** Scope management. */
685
+ readonly scopes: Scopes;
686
+ /** Named list management. */
687
+ readonly lists: Lists;
688
+ /** Score management. */
689
+ readonly scores: Scores;
690
+ /** API key management. */
691
+ readonly apiKeys: APIKeys;
692
+ /** Evaluation log inspection. */
693
+ readonly evaluations: Evaluations;
694
+ /** Audit log access. */
695
+ readonly audit: Audit;
696
+ /**
697
+ * Creates a new IntelMesh client instance.
698
+ * @param config - Client configuration with baseUrl and apiKey.
699
+ */
700
+ constructor(config: ClientConfig);
701
+ }
702
+
703
+ /** Base error for all IntelMesh SDK errors. */
704
+ declare class IntelMeshError extends Error {
705
+ /** HTTP status code, if applicable. */
706
+ readonly status: number;
707
+ /** Machine-readable error code from the API. */
708
+ readonly code: string;
709
+ constructor(message: string, status: number, code: string);
710
+ }
711
+ /** 400 — The request was malformed or invalid. */
712
+ declare class ValidationError extends IntelMeshError {
713
+ constructor(message: string, code?: string);
714
+ }
715
+ /** 404 — The requested resource was not found. */
716
+ declare class NotFoundError extends IntelMeshError {
717
+ constructor(message: string, code?: string);
718
+ }
719
+ /** 401 — Authentication failed or missing. */
720
+ declare class UnauthorizedError extends IntelMeshError {
721
+ constructor(message: string, code?: string);
722
+ }
723
+ /** 403 — Authenticated but insufficient permissions. */
724
+ declare class ForbiddenError extends IntelMeshError {
725
+ constructor(message: string, code?: string);
726
+ }
727
+ /** 500 — Internal server error. */
728
+ declare class InternalError extends IntelMeshError {
729
+ constructor(message: string, code?: string);
730
+ }
731
+ /** 503 — Service temporarily unavailable. */
732
+ declare class UnavailableError extends IntelMeshError {
733
+ constructor(message: string, code?: string);
734
+ }
735
+ /** Network-level failure (no HTTP response received). */
736
+ declare class NetworkError extends IntelMeshError {
737
+ constructor(message: string);
738
+ }
739
+ /** Failed to parse the API response body. */
740
+ declare class ParseError extends IntelMeshError {
741
+ constructor(message: string);
742
+ }
743
+ /**
744
+ * Checks if an error is a NotFoundError.
745
+ * @param error - The error to check.
746
+ * @returns True if the error is a NotFoundError.
747
+ */
748
+ declare function isNotFound(error: unknown): error is NotFoundError;
749
+ /**
750
+ * Checks if an error is a ValidationError.
751
+ * @param error - The error to check.
752
+ * @returns True if the error is a ValidationError.
753
+ */
754
+ declare function isValidation(error: unknown): error is ValidationError;
755
+ /**
756
+ * Checks if an error is an UnauthorizedError.
757
+ * @param error - The error to check.
758
+ * @returns True if the error is an UnauthorizedError.
759
+ */
760
+ declare function isUnauthorized(error: unknown): error is UnauthorizedError;
761
+ /**
762
+ * Checks if an error is a ForbiddenError.
763
+ * @param error - The error to check.
764
+ * @returns True if the error is a ForbiddenError.
765
+ */
766
+ declare function isForbidden(error: unknown): error is ForbiddenError;
767
+ /**
768
+ * Checks if an error is a NetworkError.
769
+ * @param error - The error to check.
770
+ * @returns True if the error is a NetworkError.
771
+ */
772
+ declare function isNetwork(error: unknown): error is NetworkError;
773
+ /**
774
+ * Checks if an error is any IntelMeshError.
775
+ * @param error - The error to check.
776
+ * @returns True if the error is an IntelMeshError.
777
+ */
778
+ declare function isIntelMeshError(error: unknown): error is IntelMeshError;
779
+ /**
780
+ * Maps an HTTP status code and error body to a typed error.
781
+ * @param status - The HTTP status code.
782
+ * @param message - The error message from the API.
783
+ * @param code - The machine-readable error code from the API.
784
+ * @returns The appropriate typed error instance.
785
+ */
786
+ declare function mapStatusToError(status: number, message: string, code: string): IntelMeshError;
787
+
788
+ /** Function that fetches a single page of results. */
789
+ type PageFetcher<T> = (params: PaginationParams) => Promise<PaginatedResponse<T>>;
790
+ /**
791
+ * Creates an async iterator that automatically follows cursor pagination.
792
+ * @param fetcher - Function to fetch a single page.
793
+ * @param params - Initial pagination parameters.
794
+ * @yields {T} Individual items from paginated responses.
795
+ * @returns An async iterable of individual items.
796
+ */
797
+ declare function paginate<T>(fetcher: PageFetcher<T>, params?: PaginationParams): AsyncGenerator<T, void, undefined>;
798
+ /**
799
+ * Collects all items from an async iterator into an array.
800
+ * @param iter - The async iterable to collect from.
801
+ * @returns An array of all items.
802
+ */
803
+ declare function collectAll<T>(iter: AsyncIterable<T>): Promise<T[]>;
804
+
805
+ /**
806
+ * Fluent builder for constructing IngestRequest payloads.
807
+ */
808
+ declare class EventBuilder {
809
+ private eventType;
810
+ private idempotencyKey;
811
+ private payload;
812
+ /**
813
+ * Sets the event type.
814
+ * @param type - The event type string (e.g. "transaction.pix").
815
+ * @returns This builder for chaining.
816
+ */
817
+ type(type: string): this;
818
+ /**
819
+ * Sets the idempotency key for deduplication.
820
+ * @param key - The idempotency key.
821
+ * @returns This builder for chaining.
822
+ */
823
+ idempotency(key: string): this;
824
+ /**
825
+ * Sets a single payload field.
826
+ * @param key - The field name.
827
+ * @param value - The field value.
828
+ * @returns This builder for chaining.
829
+ */
830
+ set(key: string, value: unknown): this;
831
+ /**
832
+ * Merges multiple fields into the payload.
833
+ * @param data - Record of fields to merge.
834
+ * @returns This builder for chaining.
835
+ */
836
+ data(data: Record<string, unknown>): this;
837
+ /**
838
+ * Builds and returns the IngestRequest.
839
+ * @returns The constructed IngestRequest.
840
+ * @throws {Error} If event type is not set.
841
+ */
842
+ build(): IngestRequest;
843
+ }
844
+
845
+ /**
846
+ * Fluent builder for constructing CreateRuleRequest payloads.
847
+ */
848
+ declare class RuleBuilder {
849
+ private ruleName;
850
+ private ruleExpression;
851
+ private ruleApplicableWhen;
852
+ private rulePhaseId;
853
+ private rulePriority;
854
+ private ruleEnabled;
855
+ private ruleDryRun;
856
+ private ruleActions;
857
+ /**
858
+ * Sets the rule name.
859
+ * @param n - The rule name.
860
+ * @returns This builder for chaining.
861
+ */
862
+ name(n: string): this;
863
+ /**
864
+ * Sets the CEL expression for the rule.
865
+ * @param expr - The CEL expression.
866
+ * @returns This builder for chaining.
867
+ */
868
+ expression(expr: string): this;
869
+ /**
870
+ * Sets the condition under which this rule applies.
871
+ * @param condition - The applicable-when CEL expression.
872
+ * @returns This builder for chaining.
873
+ */
874
+ applicableWhen(condition: string): this;
875
+ /**
876
+ * Sets the phase this rule belongs to.
877
+ * @param id - The phase ID.
878
+ * @returns This builder for chaining.
879
+ */
880
+ phase(id: string): this;
881
+ /**
882
+ * Sets the rule priority (lower number = higher priority).
883
+ * @param p - The priority value.
884
+ * @returns This builder for chaining.
885
+ */
886
+ priority(p: number): this;
887
+ /**
888
+ * Sets whether the rule is enabled.
889
+ * @param value - True to enable, false to disable.
890
+ * @returns This builder for chaining.
891
+ */
892
+ enabled(value: boolean): this;
893
+ /**
894
+ * Sets whether the rule runs in dry-run mode.
895
+ * @param value - True for dry-run.
896
+ * @returns This builder for chaining.
897
+ */
898
+ dryRun(value: boolean): this;
899
+ /**
900
+ * Sets the decision action when the rule matches.
901
+ * @param action - The action string.
902
+ * @param severity - The severity level.
903
+ * @returns This builder for chaining.
904
+ */
905
+ decide(action: string, severity: Severity): this;
906
+ /**
907
+ * Sets the flow control when the rule matches.
908
+ * @param flow - The flow control value.
909
+ * @returns This builder for chaining.
910
+ */
911
+ flow(flow: Flow): this;
912
+ /**
913
+ * Sets the score delta when the rule matches.
914
+ * @param delta - The score points to add.
915
+ * @returns This builder for chaining.
916
+ */
917
+ scoreDelta(delta: number): this;
918
+ /**
919
+ * Builds and returns the CreateRuleRequest.
920
+ * @returns The constructed CreateRuleRequest.
921
+ * @throws {Error} If required fields are missing.
922
+ */
923
+ build(): CreateRuleRequest;
924
+ }
925
+
926
+ /** Internal mutation specification. */
927
+ interface MutationSpec {
928
+ readonly mutationType: string;
929
+ readonly listName: string;
930
+ readonly valuePath: string;
931
+ }
932
+ /**
933
+ * Fluent builder for constructing rules within a Provisioner.
934
+ * Returned by `Provisioner.rule()`, completed by calling `.done()`.
935
+ */
936
+ declare class ProvisionRuleBuilder {
937
+ private readonly parent;
938
+ /** @internal */ readonly ruleName: string;
939
+ /** @internal */ phaseName: string;
940
+ /** @internal */ rulePriority: number;
941
+ /** @internal */ applicable: string;
942
+ /** @internal */ expression: string;
943
+ /** @internal */ ruleDecision: Decision | undefined;
944
+ /** @internal */ ruleScore: ScoreOperation | undefined;
945
+ /** @internal */ ruleFlow: Flow | undefined;
946
+ /** @internal */ ruleMutations: MutationSpec[];
947
+ /** @internal */ isDryRun: boolean;
948
+ /**
949
+ * Constructs a new ProvisionRuleBuilder.
950
+ * @param parent
951
+ * @param name
952
+ * @internal
953
+ */
954
+ constructor(parent: Provisioner, name: string);
955
+ /**
956
+ * Sets the phase for the rule (by provisioner name, not ID).
957
+ * @param name - The phase name as registered with the provisioner.
958
+ * @returns This builder for chaining.
959
+ */
960
+ inPhase(name: string): this;
961
+ /**
962
+ * Sets the rule priority (lower number = higher priority).
963
+ * @param p - The priority value.
964
+ * @returns This builder for chaining.
965
+ */
966
+ priority(p: number): this;
967
+ /**
968
+ * Sets the applicability expression.
969
+ * @param expr - The CEL expression for applicability.
970
+ * @returns This builder for chaining.
971
+ */
972
+ applicableWhen(expr: string): this;
973
+ /**
974
+ * Sets the matching expression.
975
+ * @param expr - The CEL expression for matching.
976
+ * @returns This builder for chaining.
977
+ */
978
+ when(expr: string): this;
979
+ /**
980
+ * Sets the decision action and severity.
981
+ * @param action - The action string (e.g. "block").
982
+ * @param severity - The severity level.
983
+ * @returns This builder for chaining.
984
+ */
985
+ decide(action: string, severity: Severity): this;
986
+ /**
987
+ * Adds a score delta for the rule.
988
+ * @param delta - The score points to add.
989
+ * @returns This builder for chaining.
990
+ */
991
+ addScore(delta: number): this;
992
+ /**
993
+ * Sets flow to halt.
994
+ * @returns This builder for chaining.
995
+ */
996
+ halt(): this;
997
+ /**
998
+ * Sets flow to continue.
999
+ * @returns This builder for chaining.
1000
+ */
1001
+ continue(): this;
1002
+ /**
1003
+ * Sets flow to skip_phase.
1004
+ * @returns This builder for chaining.
1005
+ */
1006
+ skipPhase(): this;
1007
+ /**
1008
+ * Adds a list mutation to the rule.
1009
+ * @param mutType - The mutation type (e.g. "list.add").
1010
+ * @param listName - The list name.
1011
+ * @param valuePath - The value path expression.
1012
+ * @returns This builder for chaining.
1013
+ */
1014
+ mutateList(mutType: string, listName: string, valuePath: string): this;
1015
+ /**
1016
+ * Enables dry-run mode for the rule.
1017
+ * @returns This builder for chaining.
1018
+ */
1019
+ dryRun(): this;
1020
+ /**
1021
+ * Finishes building the rule and returns to the parent provisioner.
1022
+ * @returns The parent Provisioner for chaining.
1023
+ */
1024
+ done(): Provisioner;
1025
+ /**
1026
+ * Constructs the SDK Actions from the builder state.
1027
+ * @returns The Actions object for the API request.
1028
+ * @internal
1029
+ */
1030
+ buildActions(): Actions;
1031
+ }
1032
+
1033
+ /**
1034
+ * Builds and executes a declarative resource plan against the IntelMesh API.
1035
+ * Resources are created in dependency order (phases, scopes, lists, rules)
1036
+ * and torn down in reverse.
1037
+ */
1038
+ declare class Provisioner {
1039
+ private readonly client;
1040
+ private readonly steps;
1041
+ private readonly phases;
1042
+ private readonly scopes;
1043
+ private readonly lists;
1044
+ private readonly rules;
1045
+ /**
1046
+ * Creates a new Provisioner backed by the given SDK client.
1047
+ * @param client - The IntelMesh client instance.
1048
+ */
1049
+ constructor(client: IntelMesh);
1050
+ /**
1051
+ * Registers a pipeline phase to be created.
1052
+ * @param name - The phase name.
1053
+ * @param position - The phase position (execution order).
1054
+ * @returns This provisioner for chaining.
1055
+ */
1056
+ phase(name: string, position: number): this;
1057
+ /**
1058
+ * Registers a pipeline phase with an applicable_when CEL expression.
1059
+ * @param name - The phase name.
1060
+ * @param position - The phase position (execution order).
1061
+ * @param applicableWhen - CEL expression controlling when this phase runs.
1062
+ * @returns This provisioner for chaining.
1063
+ */
1064
+ phaseWithFilter(name: string, position: number, applicableWhen: string): this;
1065
+ /**
1066
+ * Registers a scope to be created.
1067
+ * @param name - The scope name.
1068
+ * @param jsonPath - The JSON path expression.
1069
+ * @returns This provisioner for chaining.
1070
+ */
1071
+ scope(name: string, jsonPath: string): this;
1072
+ /**
1073
+ * Registers a named list to be created.
1074
+ * @param name - The list name.
1075
+ * @returns This provisioner for chaining.
1076
+ */
1077
+ list(name: string): this;
1078
+ /**
1079
+ * Starts building a rule and returns a ProvisionRuleBuilder.
1080
+ * @param name - The rule name.
1081
+ * @returns A rule builder for chaining.
1082
+ */
1083
+ rule(name: string): ProvisionRuleBuilder;
1084
+ /**
1085
+ * Adds a completed rule step from the rule builder.
1086
+ * @param rb - The completed rule builder.
1087
+ * @returns This provisioner for chaining.
1088
+ * @internal
1089
+ */
1090
+ _addRuleStep(rb: ProvisionRuleBuilder): this;
1091
+ /**
1092
+ * Creates all registered resources via the API in registration order.
1093
+ * Throws on the first failure.
1094
+ */
1095
+ apply(): Promise<void>;
1096
+ /**
1097
+ * Deletes all created resources in reverse dependency order:
1098
+ * rules, lists, scopes, phases.
1099
+ * Collects errors but continues deleting; throws the first error at the end.
1100
+ */
1101
+ teardown(): Promise<void>;
1102
+ /**
1103
+ * Returns the provisioned ID for the named phase.
1104
+ * @param name - The phase name.
1105
+ * @returns The phase ID, or empty string if not found.
1106
+ */
1107
+ phaseId(name: string): string;
1108
+ /**
1109
+ * Returns the provisioned ID for the named list.
1110
+ * @param name - The list name.
1111
+ * @returns The list ID, or empty string if not found.
1112
+ */
1113
+ listId(name: string): string;
1114
+ /**
1115
+ * Returns the provisioned ID for the named scope.
1116
+ * @param name - The scope name.
1117
+ * @returns The scope ID, or empty string if not found.
1118
+ */
1119
+ scopeId(name: string): string;
1120
+ /**
1121
+ * Returns the provisioned ID for the named rule.
1122
+ * @param name - The rule name.
1123
+ * @returns The rule ID, or empty string if not found.
1124
+ */
1125
+ ruleId(name: string): string;
1126
+ /**
1127
+ * Dispatches a single step to the appropriate creator.
1128
+ * @param step
1129
+ */
1130
+ private applyStep;
1131
+ /**
1132
+ * Creates a phase and stores its ID.
1133
+ * @param step
1134
+ */
1135
+ private createPhase;
1136
+ /**
1137
+ * Creates a scope and stores its ID.
1138
+ * @param step
1139
+ */
1140
+ private createScope;
1141
+ /**
1142
+ * Creates a list and stores its ID.
1143
+ * @param step
1144
+ */
1145
+ private createList;
1146
+ /**
1147
+ * Creates a rule after resolving its phase name to an ID.
1148
+ * @param step
1149
+ */
1150
+ private createRule;
1151
+ /**
1152
+ * Deletes all resources in a map, recording errors.
1153
+ * @param ids
1154
+ * @param deleteFn
1155
+ * @param record
1156
+ */
1157
+ private deleteAll;
1158
+ }
1159
+
1160
+ /**
1161
+ * Chains assertions on the result of an event send.
1162
+ * Throws on assertion failure (suitable for test frameworks).
1163
+ */
1164
+ declare class EventAssertion {
1165
+ private readonly result;
1166
+ constructor(result: IngestResult);
1167
+ /**
1168
+ * Asserts the result has a specific decision action and severity.
1169
+ * @param action - The expected action string (e.g. "block").
1170
+ * @param severity - The expected severity level.
1171
+ * @returns This assertion for chaining.
1172
+ * @throws {Error} If the decision does not match.
1173
+ */
1174
+ expectDecision(action: string, severity: string): this;
1175
+ /**
1176
+ * Asserts the result has no decision (action is empty or undefined).
1177
+ * @returns This assertion for chaining.
1178
+ * @throws {Error} If a decision is present.
1179
+ */
1180
+ expectNoDecision(): this;
1181
+ /**
1182
+ * Asserts the transient score equals the expected value.
1183
+ * @param score - The expected score value.
1184
+ * @returns This assertion for chaining.
1185
+ * @throws {Error} If the score does not match.
1186
+ */
1187
+ expectScore(score: number): this;
1188
+ /**
1189
+ * Returns the underlying IngestResult for custom assertions.
1190
+ * @returns The raw IngestResult.
1191
+ */
1192
+ raw(): IngestResult;
1193
+ }
1194
+
1195
+ /** Configuration for the test harness. */
1196
+ interface HarnessConfig {
1197
+ /** Base URL of the IntelMesh API (e.g. "http://localhost:8080"). */
1198
+ readonly baseURL: string;
1199
+ /** Admin API key with api_keys:manage permission. */
1200
+ readonly adminKey: string;
1201
+ /** Optional request timeout in milliseconds. */
1202
+ readonly timeout?: number;
1203
+ }
1204
+ /**
1205
+ * Manages test lifecycle: ephemeral API key, provisioning, and assertions.
1206
+ * Since TypeScript does not have Go's testing.T with t.Cleanup, this uses
1207
+ * explicit setup() and cleanup() methods.
1208
+ */
1209
+ declare class Harness {
1210
+ private readonly config;
1211
+ private readonly adminClient;
1212
+ private testClient;
1213
+ private testKeyId;
1214
+ private provisioner;
1215
+ /**
1216
+ * Creates a new test harness.
1217
+ * @param config - The harness configuration.
1218
+ */
1219
+ constructor(config: HarnessConfig);
1220
+ /**
1221
+ * Creates an ephemeral API key with all permissions.
1222
+ * Must be called before sending events or provisioning.
1223
+ */
1224
+ setup(): Promise<void>;
1225
+ /**
1226
+ * Returns the test-scoped SDK client.
1227
+ * @returns The IntelMesh client using the ephemeral key.
1228
+ * @throws {Error} If setup() has not been called.
1229
+ */
1230
+ client(): IntelMesh;
1231
+ /**
1232
+ * Applies a provisioner and registers it for teardown on cleanup.
1233
+ * @param p - The provisioner to apply.
1234
+ */
1235
+ provision(p: Provisioner): Promise<void>;
1236
+ /**
1237
+ * Sends an event for synchronous evaluation.
1238
+ * @param eventType - The event type (e.g. "transaction.pix").
1239
+ * @param payload - The event payload.
1240
+ * @returns An EventAssertion for chaining assertions.
1241
+ */
1242
+ send(eventType: string, payload: Record<string, unknown>): Promise<EventAssertion>;
1243
+ /**
1244
+ * Sends an event to the simulation endpoint.
1245
+ * @param eventType - The event type.
1246
+ * @param payload - The event payload.
1247
+ * @returns An EventAssertion for chaining assertions.
1248
+ */
1249
+ sendSimulate(eventType: string, payload: Record<string, unknown>): Promise<EventAssertion>;
1250
+ /**
1251
+ * Pauses for async projectors to complete.
1252
+ * @param ms - Optional wait time in milliseconds (default 500).
1253
+ */
1254
+ waitForProjectors(ms?: number): Promise<void>;
1255
+ /**
1256
+ * Verifies that a list contains a specific value.
1257
+ * Requires a provisioner to have been applied to resolve list names.
1258
+ * @param listName - The list name (as registered with the provisioner).
1259
+ * @param value - The value to search for.
1260
+ * @throws {Error} If the list does not contain the value.
1261
+ */
1262
+ verifyListContains(listName: string, value: string): Promise<void>;
1263
+ /**
1264
+ * Verifies that a list does NOT contain a specific value.
1265
+ * Requires a provisioner to have been applied to resolve list names.
1266
+ * @param listName - The list name (as registered with the provisioner).
1267
+ * @param value - The value to search for.
1268
+ * @throws {Error} If the list contains the value.
1269
+ */
1270
+ verifyListNotContains(listName: string, value: string): Promise<void>;
1271
+ /**
1272
+ * Deletes the ephemeral API key and tears down the provisioner.
1273
+ * Should be called in afterAll or finally blocks.
1274
+ */
1275
+ cleanup(): Promise<void>;
1276
+ /**
1277
+ * Internal list verification.
1278
+ * @param listName
1279
+ * @param _value
1280
+ * @param shouldContain
1281
+ */
1282
+ private verifyList;
1283
+ }
1284
+ /**
1285
+ * Convenience wrapper that manages setup and cleanup automatically.
1286
+ * The harness is set up before the callback and cleaned up after,
1287
+ * even if the callback throws.
1288
+ * @param config - The harness configuration.
1289
+ * @param fn - The async test function receiving the harness.
1290
+ */
1291
+ declare function withHarness(config: HarnessConfig, fn: (harness: Harness) => Promise<void>): Promise<void>;
1292
+
1293
+ export { type APIKey, APIKeys, type Actions, type AddItemsRequest, Audit, type BulkImportRequest, type ClientConfig, type CreateAPIKeyRequest, type CreateAPIKeyResponse, type CreateListRequest, type CreatePhaseRequest, type CreateRuleRequest, type CreateScopeRequest, type Decision, type ErrorBody, type ErrorResponse, type EvaluationLog, Evaluations, EventAssertion, EventBuilder, Events, type Flow, ForbiddenError, Harness, type HarnessConfig, HttpClient, type IngestRequest, type IngestResult, IntelMesh, IntelMeshError, InternalError, type List, type ListMutation, Lists, type Mutation, NetworkError, NotFoundError, type PaginatedResponse, type PaginationParams, ParseError, type Phase, type PhaseTrace, Phases, type PipelineTrace, ProvisionRuleBuilder, Provisioner, type Rule, RuleBuilder, type RuleTrace, type RuleVersion, Rules, type Scope, Scopes, type Score, type ScoreOperation, Scores, type SetScoreRequest, type Severity, type SuccessResponse, UnauthorizedError, UnavailableError, type UpdateAPIKeyRequest, type UpdateListRequest, type UpdatePhaseRequest, type UpdateRuleRequest, type UpdateScopeRequest, ValidationError, collectAll, isForbidden, isIntelMeshError, isNetwork, isNotFound, isUnauthorized, isValidation, mapStatusToError, paginate, withHarness };