@behavproof/contract-registry 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,512 @@
1
+ import { type Contract, type AssuranceCheck, type AssuranceSubject, type AssuranceInputHashes } from '@behavproof/core';
2
+ export type RuntimeEnvironment = {
3
+ dependencies: any;
4
+ captureMedia: (ref: string) => Promise<void>;
5
+ effect: (scope: string, id: string, targetRef: string, operation: string, input: unknown) => Promise<unknown>;
6
+ layer: (id: string, input: unknown) => Promise<unknown>;
7
+ invocationId: () => string;
8
+ withInvocation: <T>(id: string, fn: () => Promise<T>) => Promise<T>;
9
+ };
10
+ export type RuntimeContext = {
11
+ dependencies?: unknown;
12
+ close?: () => Promise<void> | void;
13
+ };
14
+ export type RuntimeDriver = {
15
+ createContext?: (input: {
16
+ check: AssuranceCheck;
17
+ input: unknown;
18
+ harness: RuntimeEnvironment;
19
+ }) => RuntimeContext | Promise<RuntimeContext>;
20
+ };
21
+ export type AssuranceRunOptions = {
22
+ root: string;
23
+ contracts: readonly Contract[];
24
+ subject: AssuranceSubject;
25
+ inputHashes: AssuranceInputHashes;
26
+ implementationSources: readonly string[];
27
+ driver?: RuntimeDriver;
28
+ };
29
+ export declare function seededRandom(seed: string): () => number;
30
+ /** Explicit execution only. Reused processes require unchanged selected source inventories/bytes.
31
+ * Receipts establish selected export/adaptor calls, not arbitrary dependency isolation or inner-code honesty. */
32
+ export declare function runAssurance(options: AssuranceRunOptions): Promise<{
33
+ schemaVersion: 1;
34
+ reports: {
35
+ schemaVersion: 1;
36
+ contractId: string;
37
+ revisionHash: string;
38
+ subject: {
39
+ testedCommitSha: string;
40
+ sourceTreeHash: string;
41
+ };
42
+ inputHashes: Record<string, string>;
43
+ checks: ({
44
+ checkId: string;
45
+ checkHash: string;
46
+ complete: boolean;
47
+ comparisonCount: number;
48
+ method: "example";
49
+ samples: {
50
+ id: string;
51
+ input: import("zod").JSONType;
52
+ inputHash: string;
53
+ expected: import("zod").JSONType;
54
+ actual?: import("zod").JSONType | undefined;
55
+ calls: number;
56
+ receipts: {
57
+ callId: string;
58
+ targetRef: string;
59
+ implementation: string;
60
+ implementationHash: string;
61
+ variant: "baseline" | "fault";
62
+ faultId?: string | undefined;
63
+ input: import("zod").JSONType;
64
+ output?: import("zod").JSONType | undefined;
65
+ error?: string | undefined;
66
+ }[];
67
+ error?: string | undefined;
68
+ }[];
69
+ } | {
70
+ checkId: string;
71
+ checkHash: string;
72
+ complete: boolean;
73
+ comparisonCount: number;
74
+ method: "effects";
75
+ scope: string[];
76
+ window: {
77
+ settledBy: string;
78
+ durationMs: number;
79
+ };
80
+ samples: {
81
+ id: string;
82
+ input: import("zod").JSONType;
83
+ inputHash: string;
84
+ expected: import("zod").JSONType;
85
+ actual?: import("zod").JSONType | undefined;
86
+ calls: number;
87
+ receipts: {
88
+ callId: string;
89
+ targetRef: string;
90
+ implementation: string;
91
+ implementationHash: string;
92
+ variant: "baseline" | "fault";
93
+ faultId?: string | undefined;
94
+ input: import("zod").JSONType;
95
+ output?: import("zod").JSONType | undefined;
96
+ error?: string | undefined;
97
+ }[];
98
+ error?: string | undefined;
99
+ before: Record<string, import("zod").JSONType>;
100
+ after: Record<string, import("zod").JSONType>;
101
+ effects: {
102
+ eventId: string;
103
+ id: string;
104
+ scope: string;
105
+ operation: string;
106
+ targetRef: string;
107
+ callId: string;
108
+ }[];
109
+ resourceObservations: {
110
+ scope: string;
111
+ adapter: string;
112
+ adapterHash: string;
113
+ targets: string[];
114
+ callIds: string[];
115
+ elapsedMs: number;
116
+ settledBy: string;
117
+ settled: boolean;
118
+ }[];
119
+ }[];
120
+ } | {
121
+ checkId: string;
122
+ checkHash: string;
123
+ complete: boolean;
124
+ comparisonCount: number;
125
+ method: "property";
126
+ domain: import("zod").JSONType;
127
+ seed: string;
128
+ runs: number;
129
+ valid: number;
130
+ discarded: number;
131
+ samples: {
132
+ id: string;
133
+ input: import("zod").JSONType;
134
+ inputHash: string;
135
+ expected: import("zod").JSONType;
136
+ actual?: import("zod").JSONType | undefined;
137
+ calls: number;
138
+ receipts: {
139
+ callId: string;
140
+ targetRef: string;
141
+ implementation: string;
142
+ implementationHash: string;
143
+ variant: "baseline" | "fault";
144
+ faultId?: string | undefined;
145
+ input: import("zod").JSONType;
146
+ output?: import("zod").JSONType | undefined;
147
+ error?: string | undefined;
148
+ }[];
149
+ error?: string | undefined;
150
+ index: number;
151
+ discarded: boolean;
152
+ classes: string[];
153
+ }[];
154
+ counterexamples?: {
155
+ sampleId: string;
156
+ seed: string;
157
+ originalInput: import("zod").JSONType;
158
+ shrunkInput?: import("zod").JSONType | undefined;
159
+ shrunkSampleId?: string | undefined;
160
+ replay?: string | undefined;
161
+ }[] | undefined;
162
+ } | {
163
+ checkId: string;
164
+ checkHash: string;
165
+ complete: boolean;
166
+ comparisonCount: number;
167
+ method: "sequence";
168
+ seed: string;
169
+ maxSteps: number;
170
+ traces: {
171
+ id: string;
172
+ initialModel: import("zod").JSONType;
173
+ initialExpected: import("zod").JSONType;
174
+ initialActual: import("zod").JSONType;
175
+ steps: {
176
+ id: string;
177
+ input: import("zod").JSONType;
178
+ inputHash: string;
179
+ expected: import("zod").JSONType;
180
+ actual?: import("zod").JSONType | undefined;
181
+ calls: number;
182
+ receipts: {
183
+ callId: string;
184
+ targetRef: string;
185
+ implementation: string;
186
+ implementationHash: string;
187
+ variant: "baseline" | "fault";
188
+ faultId?: string | undefined;
189
+ input: import("zod").JSONType;
190
+ output?: import("zod").JSONType | undefined;
191
+ error?: string | undefined;
192
+ }[];
193
+ error?: string | undefined;
194
+ index: number;
195
+ action: string;
196
+ modelBefore: import("zod").JSONType;
197
+ modelAfter: import("zod").JSONType;
198
+ }[];
199
+ }[];
200
+ } | {
201
+ checkId: string;
202
+ checkHash: string;
203
+ complete: boolean;
204
+ comparisonCount: number;
205
+ method: "architecture";
206
+ files: {
207
+ path: string;
208
+ sha256: string;
209
+ imports: {
210
+ specifier: string;
211
+ resolved?: string | undefined;
212
+ dynamic: boolean;
213
+ supported: boolean;
214
+ }[];
215
+ }[];
216
+ rules: string[];
217
+ violations: {
218
+ ruleId: string;
219
+ file: string;
220
+ specifier: string;
221
+ }[];
222
+ unsupported: {
223
+ file: string;
224
+ reason: string;
225
+ }[];
226
+ } | {
227
+ checkId: string;
228
+ checkHash: string;
229
+ complete: boolean;
230
+ comparisonCount: number;
231
+ method: "journey";
232
+ entrypoint: string;
233
+ environment: import("zod").JSONType;
234
+ mockBoundaries: string[];
235
+ steps: {
236
+ id: string;
237
+ input: import("zod").JSONType;
238
+ inputHash: string;
239
+ expected: import("zod").JSONType;
240
+ actual?: import("zod").JSONType | undefined;
241
+ calls: number;
242
+ receipts: {
243
+ callId: string;
244
+ targetRef: string;
245
+ implementation: string;
246
+ implementationHash: string;
247
+ variant: "baseline" | "fault";
248
+ faultId?: string | undefined;
249
+ input: import("zod").JSONType;
250
+ output?: import("zod").JSONType | undefined;
251
+ error?: string | undefined;
252
+ }[];
253
+ error?: string | undefined;
254
+ action: string;
255
+ layers: {
256
+ id: string;
257
+ sourceRef: string;
258
+ observations: {
259
+ invocationId: string;
260
+ observationId: string;
261
+ targetRef: string;
262
+ mocked: boolean;
263
+ input: import("zod").JSONType;
264
+ actual: import("zod").JSONType;
265
+ }[];
266
+ }[];
267
+ }[];
268
+ media: {
269
+ ref: string;
270
+ sha256: string;
271
+ stepId: string;
272
+ }[];
273
+ })[];
274
+ faults: {
275
+ faultId: string;
276
+ checkId: string;
277
+ implementationHash: string;
278
+ observation: {
279
+ checkId: string;
280
+ checkHash: string;
281
+ complete: boolean;
282
+ comparisonCount: number;
283
+ method: "example";
284
+ samples: {
285
+ id: string;
286
+ input: import("zod").JSONType;
287
+ inputHash: string;
288
+ expected: import("zod").JSONType;
289
+ actual?: import("zod").JSONType | undefined;
290
+ calls: number;
291
+ receipts: {
292
+ callId: string;
293
+ targetRef: string;
294
+ implementation: string;
295
+ implementationHash: string;
296
+ variant: "baseline" | "fault";
297
+ faultId?: string | undefined;
298
+ input: import("zod").JSONType;
299
+ output?: import("zod").JSONType | undefined;
300
+ error?: string | undefined;
301
+ }[];
302
+ error?: string | undefined;
303
+ }[];
304
+ } | {
305
+ checkId: string;
306
+ checkHash: string;
307
+ complete: boolean;
308
+ comparisonCount: number;
309
+ method: "effects";
310
+ scope: string[];
311
+ window: {
312
+ settledBy: string;
313
+ durationMs: number;
314
+ };
315
+ samples: {
316
+ id: string;
317
+ input: import("zod").JSONType;
318
+ inputHash: string;
319
+ expected: import("zod").JSONType;
320
+ actual?: import("zod").JSONType | undefined;
321
+ calls: number;
322
+ receipts: {
323
+ callId: string;
324
+ targetRef: string;
325
+ implementation: string;
326
+ implementationHash: string;
327
+ variant: "baseline" | "fault";
328
+ faultId?: string | undefined;
329
+ input: import("zod").JSONType;
330
+ output?: import("zod").JSONType | undefined;
331
+ error?: string | undefined;
332
+ }[];
333
+ error?: string | undefined;
334
+ before: Record<string, import("zod").JSONType>;
335
+ after: Record<string, import("zod").JSONType>;
336
+ effects: {
337
+ eventId: string;
338
+ id: string;
339
+ scope: string;
340
+ operation: string;
341
+ targetRef: string;
342
+ callId: string;
343
+ }[];
344
+ resourceObservations: {
345
+ scope: string;
346
+ adapter: string;
347
+ adapterHash: string;
348
+ targets: string[];
349
+ callIds: string[];
350
+ elapsedMs: number;
351
+ settledBy: string;
352
+ settled: boolean;
353
+ }[];
354
+ }[];
355
+ } | {
356
+ checkId: string;
357
+ checkHash: string;
358
+ complete: boolean;
359
+ comparisonCount: number;
360
+ method: "property";
361
+ domain: import("zod").JSONType;
362
+ seed: string;
363
+ runs: number;
364
+ valid: number;
365
+ discarded: number;
366
+ samples: {
367
+ id: string;
368
+ input: import("zod").JSONType;
369
+ inputHash: string;
370
+ expected: import("zod").JSONType;
371
+ actual?: import("zod").JSONType | undefined;
372
+ calls: number;
373
+ receipts: {
374
+ callId: string;
375
+ targetRef: string;
376
+ implementation: string;
377
+ implementationHash: string;
378
+ variant: "baseline" | "fault";
379
+ faultId?: string | undefined;
380
+ input: import("zod").JSONType;
381
+ output?: import("zod").JSONType | undefined;
382
+ error?: string | undefined;
383
+ }[];
384
+ error?: string | undefined;
385
+ index: number;
386
+ discarded: boolean;
387
+ classes: string[];
388
+ }[];
389
+ counterexamples?: {
390
+ sampleId: string;
391
+ seed: string;
392
+ originalInput: import("zod").JSONType;
393
+ shrunkInput?: import("zod").JSONType | undefined;
394
+ shrunkSampleId?: string | undefined;
395
+ replay?: string | undefined;
396
+ }[] | undefined;
397
+ } | {
398
+ checkId: string;
399
+ checkHash: string;
400
+ complete: boolean;
401
+ comparisonCount: number;
402
+ method: "sequence";
403
+ seed: string;
404
+ maxSteps: number;
405
+ traces: {
406
+ id: string;
407
+ initialModel: import("zod").JSONType;
408
+ initialExpected: import("zod").JSONType;
409
+ initialActual: import("zod").JSONType;
410
+ steps: {
411
+ id: string;
412
+ input: import("zod").JSONType;
413
+ inputHash: string;
414
+ expected: import("zod").JSONType;
415
+ actual?: import("zod").JSONType | undefined;
416
+ calls: number;
417
+ receipts: {
418
+ callId: string;
419
+ targetRef: string;
420
+ implementation: string;
421
+ implementationHash: string;
422
+ variant: "baseline" | "fault";
423
+ faultId?: string | undefined;
424
+ input: import("zod").JSONType;
425
+ output?: import("zod").JSONType | undefined;
426
+ error?: string | undefined;
427
+ }[];
428
+ error?: string | undefined;
429
+ index: number;
430
+ action: string;
431
+ modelBefore: import("zod").JSONType;
432
+ modelAfter: import("zod").JSONType;
433
+ }[];
434
+ }[];
435
+ } | {
436
+ checkId: string;
437
+ checkHash: string;
438
+ complete: boolean;
439
+ comparisonCount: number;
440
+ method: "architecture";
441
+ files: {
442
+ path: string;
443
+ sha256: string;
444
+ imports: {
445
+ specifier: string;
446
+ resolved?: string | undefined;
447
+ dynamic: boolean;
448
+ supported: boolean;
449
+ }[];
450
+ }[];
451
+ rules: string[];
452
+ violations: {
453
+ ruleId: string;
454
+ file: string;
455
+ specifier: string;
456
+ }[];
457
+ unsupported: {
458
+ file: string;
459
+ reason: string;
460
+ }[];
461
+ } | {
462
+ checkId: string;
463
+ checkHash: string;
464
+ complete: boolean;
465
+ comparisonCount: number;
466
+ method: "journey";
467
+ entrypoint: string;
468
+ environment: import("zod").JSONType;
469
+ mockBoundaries: string[];
470
+ steps: {
471
+ id: string;
472
+ input: import("zod").JSONType;
473
+ inputHash: string;
474
+ expected: import("zod").JSONType;
475
+ actual?: import("zod").JSONType | undefined;
476
+ calls: number;
477
+ receipts: {
478
+ callId: string;
479
+ targetRef: string;
480
+ implementation: string;
481
+ implementationHash: string;
482
+ variant: "baseline" | "fault";
483
+ faultId?: string | undefined;
484
+ input: import("zod").JSONType;
485
+ output?: import("zod").JSONType | undefined;
486
+ error?: string | undefined;
487
+ }[];
488
+ error?: string | undefined;
489
+ action: string;
490
+ layers: {
491
+ id: string;
492
+ sourceRef: string;
493
+ observations: {
494
+ invocationId: string;
495
+ observationId: string;
496
+ targetRef: string;
497
+ mocked: boolean;
498
+ input: import("zod").JSONType;
499
+ actual: import("zod").JSONType;
500
+ }[];
501
+ }[];
502
+ }[];
503
+ media: {
504
+ ref: string;
505
+ sha256: string;
506
+ stepId: string;
507
+ }[];
508
+ };
509
+ }[];
510
+ }[];
511
+ }>;
512
+ //# sourceMappingURL=assurance-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assurance-runtime.d.ts","sourceRoot":"","sources":["../src/assurance-runtime.ts"],"names":[],"mappings":"AAMA,OAAO,EAA0G,KAAK,QAAQ,EAAC,KAAK,cAAc,EAAyE,KAAK,gBAAgB,EAAC,KAAK,oBAAoB,EAAqI,MAAM,kBAAkB,CAAC;AAGxa,MAAM,MAAM,kBAAkB,GAAC;IAAC,YAAY,EAAC,GAAG,CAAC;IAAA,YAAY,EAAC,CAAC,GAAG,EAAC,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAAA,MAAM,EAAC,CAAC,KAAK,EAAC,MAAM,EAAC,EAAE,EAAC,MAAM,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