@sonate/schemas 2.0.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.
- package/README.md +93 -0
- package/dist/index.d.ts +516 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/receipt.schema.json +501 -0
- package/dist/receipt.types.d.ts +457 -0
- package/dist/receipt.types.d.ts.map +1 -0
- package/dist/receipt.types.js +9 -0
- package/dist/receipt.types.js.map +1 -0
- package/dist/validator.d.ts +452 -0
- package/dist/validator.d.ts.map +1 -0
- package/dist/validator.js +194 -0
- package/dist/validator.js.map +1 -0
- package/package.json +57 -0
- package/src/index.ts +56 -0
- package/src/receipt.schema.json +501 -0
- package/src/receipt.types.ts +571 -0
- package/src/validator.ts +200 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonate/schemas - Schema Validator
|
|
3
|
+
* Runtime validation using AJV (JSON Schema) and Zod
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import type { TrustReceipt, VerificationResult } from './receipt.types';
|
|
7
|
+
/**
|
|
8
|
+
* Zod schema for runtime validation with better errors
|
|
9
|
+
*/
|
|
10
|
+
declare const ReceiptZodSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
version: z.ZodLiteral<"2.0.0">;
|
|
13
|
+
timestamp: z.ZodString;
|
|
14
|
+
session_id: z.ZodString;
|
|
15
|
+
agent_did: z.ZodString;
|
|
16
|
+
human_did: z.ZodString;
|
|
17
|
+
policy_version: z.ZodString;
|
|
18
|
+
mode: z.ZodEnum<["constitutional", "directive"]>;
|
|
19
|
+
interaction: z.ZodObject<{
|
|
20
|
+
prompt: z.ZodString;
|
|
21
|
+
response: z.ZodString;
|
|
22
|
+
model: z.ZodString;
|
|
23
|
+
provider: z.ZodOptional<z.ZodEnum<["openai", "anthropic", "aws-bedrock", "local"]>>;
|
|
24
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
reasoning: z.ZodOptional<z.ZodObject<{
|
|
27
|
+
thought_process: z.ZodOptional<z.ZodString>;
|
|
28
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
29
|
+
retrieved_context: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
thought_process?: string | undefined;
|
|
32
|
+
confidence?: number | undefined;
|
|
33
|
+
retrieved_context?: string[] | undefined;
|
|
34
|
+
}, {
|
|
35
|
+
thought_process?: string | undefined;
|
|
36
|
+
confidence?: number | undefined;
|
|
37
|
+
retrieved_context?: string[] | undefined;
|
|
38
|
+
}>>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
model: string;
|
|
41
|
+
prompt: string;
|
|
42
|
+
response: string;
|
|
43
|
+
provider?: "openai" | "anthropic" | "aws-bedrock" | "local" | undefined;
|
|
44
|
+
temperature?: number | undefined;
|
|
45
|
+
max_tokens?: number | undefined;
|
|
46
|
+
reasoning?: {
|
|
47
|
+
thought_process?: string | undefined;
|
|
48
|
+
confidence?: number | undefined;
|
|
49
|
+
retrieved_context?: string[] | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
}, {
|
|
52
|
+
model: string;
|
|
53
|
+
prompt: string;
|
|
54
|
+
response: string;
|
|
55
|
+
provider?: "openai" | "anthropic" | "aws-bedrock" | "local" | undefined;
|
|
56
|
+
temperature?: number | undefined;
|
|
57
|
+
max_tokens?: number | undefined;
|
|
58
|
+
reasoning?: {
|
|
59
|
+
thought_process?: string | undefined;
|
|
60
|
+
confidence?: number | undefined;
|
|
61
|
+
retrieved_context?: string[] | undefined;
|
|
62
|
+
} | undefined;
|
|
63
|
+
}>;
|
|
64
|
+
telemetry: z.ZodOptional<z.ZodObject<{
|
|
65
|
+
resonance_score: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
resonance_rm: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
trust_resonance_gap: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
resonance_input_mode: z.ZodOptional<z.ZodEnum<["paired_turns", "labeled_sections", "single_text_fallback"]>>;
|
|
69
|
+
resonance_quality: z.ZodOptional<z.ZodEnum<["STRONG", "ADVANCED", "BREAKTHROUGH"]>>;
|
|
70
|
+
bedau_index: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
coherence_score: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
truth_debt: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
volatility: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
ciq_metrics: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
clarity: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
integrity: z.ZodOptional<z.ZodNumber>;
|
|
77
|
+
quality: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
clarity?: number | undefined;
|
|
80
|
+
integrity?: number | undefined;
|
|
81
|
+
quality?: number | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
clarity?: number | undefined;
|
|
84
|
+
integrity?: number | undefined;
|
|
85
|
+
quality?: number | undefined;
|
|
86
|
+
}>>;
|
|
87
|
+
resonance_components: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
vector_alignment: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
context_continuity: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
semantic_mirroring: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
entropy_delta: z.ZodOptional<z.ZodNumber>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
vector_alignment?: number | undefined;
|
|
94
|
+
context_continuity?: number | undefined;
|
|
95
|
+
semantic_mirroring?: number | undefined;
|
|
96
|
+
entropy_delta?: number | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
vector_alignment?: number | undefined;
|
|
99
|
+
context_continuity?: number | undefined;
|
|
100
|
+
semantic_mirroring?: number | undefined;
|
|
101
|
+
entropy_delta?: number | undefined;
|
|
102
|
+
}>>;
|
|
103
|
+
resonance_stakes: z.ZodOptional<z.ZodObject<{
|
|
104
|
+
level: z.ZodOptional<z.ZodEnum<["HIGH", "MEDIUM", "LOW"]>>;
|
|
105
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
}, "strip", z.ZodTypeAny, {
|
|
107
|
+
confidence?: number | undefined;
|
|
108
|
+
level?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
confidence?: number | undefined;
|
|
111
|
+
level?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
112
|
+
}>>;
|
|
113
|
+
resonance_adversarial: z.ZodOptional<z.ZodObject<{
|
|
114
|
+
detected: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
penalty: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
keyword_density: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
ethics_bypass_score: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
}, "strip", z.ZodTypeAny, {
|
|
119
|
+
detected?: boolean | undefined;
|
|
120
|
+
penalty?: number | undefined;
|
|
121
|
+
keyword_density?: number | undefined;
|
|
122
|
+
ethics_bypass_score?: number | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
detected?: boolean | undefined;
|
|
125
|
+
penalty?: number | undefined;
|
|
126
|
+
keyword_density?: number | undefined;
|
|
127
|
+
ethics_bypass_score?: number | undefined;
|
|
128
|
+
}>>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
resonance_score?: number | undefined;
|
|
131
|
+
resonance_rm?: number | undefined;
|
|
132
|
+
trust_resonance_gap?: number | undefined;
|
|
133
|
+
resonance_input_mode?: "paired_turns" | "labeled_sections" | "single_text_fallback" | undefined;
|
|
134
|
+
resonance_quality?: "STRONG" | "ADVANCED" | "BREAKTHROUGH" | undefined;
|
|
135
|
+
bedau_index?: number | undefined;
|
|
136
|
+
coherence_score?: number | undefined;
|
|
137
|
+
truth_debt?: number | undefined;
|
|
138
|
+
volatility?: number | undefined;
|
|
139
|
+
ciq_metrics?: {
|
|
140
|
+
clarity?: number | undefined;
|
|
141
|
+
integrity?: number | undefined;
|
|
142
|
+
quality?: number | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
resonance_components?: {
|
|
145
|
+
vector_alignment?: number | undefined;
|
|
146
|
+
context_continuity?: number | undefined;
|
|
147
|
+
semantic_mirroring?: number | undefined;
|
|
148
|
+
entropy_delta?: number | undefined;
|
|
149
|
+
} | undefined;
|
|
150
|
+
resonance_stakes?: {
|
|
151
|
+
confidence?: number | undefined;
|
|
152
|
+
level?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
153
|
+
} | undefined;
|
|
154
|
+
resonance_adversarial?: {
|
|
155
|
+
detected?: boolean | undefined;
|
|
156
|
+
penalty?: number | undefined;
|
|
157
|
+
keyword_density?: number | undefined;
|
|
158
|
+
ethics_bypass_score?: number | undefined;
|
|
159
|
+
} | undefined;
|
|
160
|
+
}, {
|
|
161
|
+
resonance_score?: number | undefined;
|
|
162
|
+
resonance_rm?: number | undefined;
|
|
163
|
+
trust_resonance_gap?: number | undefined;
|
|
164
|
+
resonance_input_mode?: "paired_turns" | "labeled_sections" | "single_text_fallback" | undefined;
|
|
165
|
+
resonance_quality?: "STRONG" | "ADVANCED" | "BREAKTHROUGH" | undefined;
|
|
166
|
+
bedau_index?: number | undefined;
|
|
167
|
+
coherence_score?: number | undefined;
|
|
168
|
+
truth_debt?: number | undefined;
|
|
169
|
+
volatility?: number | undefined;
|
|
170
|
+
ciq_metrics?: {
|
|
171
|
+
clarity?: number | undefined;
|
|
172
|
+
integrity?: number | undefined;
|
|
173
|
+
quality?: number | undefined;
|
|
174
|
+
} | undefined;
|
|
175
|
+
resonance_components?: {
|
|
176
|
+
vector_alignment?: number | undefined;
|
|
177
|
+
context_continuity?: number | undefined;
|
|
178
|
+
semantic_mirroring?: number | undefined;
|
|
179
|
+
entropy_delta?: number | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
resonance_stakes?: {
|
|
182
|
+
confidence?: number | undefined;
|
|
183
|
+
level?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
resonance_adversarial?: {
|
|
186
|
+
detected?: boolean | undefined;
|
|
187
|
+
penalty?: number | undefined;
|
|
188
|
+
keyword_density?: number | undefined;
|
|
189
|
+
ethics_bypass_score?: number | undefined;
|
|
190
|
+
} | undefined;
|
|
191
|
+
}>>;
|
|
192
|
+
policy_state: z.ZodOptional<z.ZodObject<{
|
|
193
|
+
constraints_applied: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
194
|
+
violations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
195
|
+
rule: z.ZodString;
|
|
196
|
+
severity: z.ZodEnum<["warning", "violation", "critical"]>;
|
|
197
|
+
action: z.ZodEnum<["warn", "slow", "halt", "escalate"]>;
|
|
198
|
+
}, "strip", z.ZodTypeAny, {
|
|
199
|
+
severity: "warning" | "violation" | "critical";
|
|
200
|
+
rule: string;
|
|
201
|
+
action: "warn" | "escalate" | "slow" | "halt";
|
|
202
|
+
}, {
|
|
203
|
+
severity: "warning" | "violation" | "critical";
|
|
204
|
+
rule: string;
|
|
205
|
+
action: "warn" | "escalate" | "slow" | "halt";
|
|
206
|
+
}>, "many">>;
|
|
207
|
+
consent_verified: z.ZodOptional<z.ZodBoolean>;
|
|
208
|
+
override_available: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
+
}, "strip", z.ZodTypeAny, {
|
|
210
|
+
consent_verified?: boolean | undefined;
|
|
211
|
+
constraints_applied?: string[] | undefined;
|
|
212
|
+
violations?: {
|
|
213
|
+
severity: "warning" | "violation" | "critical";
|
|
214
|
+
rule: string;
|
|
215
|
+
action: "warn" | "escalate" | "slow" | "halt";
|
|
216
|
+
}[] | undefined;
|
|
217
|
+
override_available?: boolean | undefined;
|
|
218
|
+
}, {
|
|
219
|
+
consent_verified?: boolean | undefined;
|
|
220
|
+
constraints_applied?: string[] | undefined;
|
|
221
|
+
violations?: {
|
|
222
|
+
severity: "warning" | "violation" | "critical";
|
|
223
|
+
rule: string;
|
|
224
|
+
action: "warn" | "escalate" | "slow" | "halt";
|
|
225
|
+
}[] | undefined;
|
|
226
|
+
override_available?: boolean | undefined;
|
|
227
|
+
}>>;
|
|
228
|
+
chain: z.ZodObject<{
|
|
229
|
+
previous_hash: z.ZodString;
|
|
230
|
+
chain_hash: z.ZodString;
|
|
231
|
+
chain_length: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
previous_hash: string;
|
|
234
|
+
chain_hash: string;
|
|
235
|
+
chain_length?: number | undefined;
|
|
236
|
+
}, {
|
|
237
|
+
previous_hash: string;
|
|
238
|
+
chain_hash: string;
|
|
239
|
+
chain_length?: number | undefined;
|
|
240
|
+
}>;
|
|
241
|
+
signature: z.ZodObject<{
|
|
242
|
+
algorithm: z.ZodLiteral<"Ed25519">;
|
|
243
|
+
value: z.ZodString;
|
|
244
|
+
key_version: z.ZodString;
|
|
245
|
+
timestamp_signed: z.ZodOptional<z.ZodString>;
|
|
246
|
+
}, "strip", z.ZodTypeAny, {
|
|
247
|
+
algorithm: "Ed25519";
|
|
248
|
+
value: string;
|
|
249
|
+
key_version: string;
|
|
250
|
+
timestamp_signed?: string | undefined;
|
|
251
|
+
}, {
|
|
252
|
+
algorithm: "Ed25519";
|
|
253
|
+
value: string;
|
|
254
|
+
key_version: string;
|
|
255
|
+
timestamp_signed?: string | undefined;
|
|
256
|
+
}>;
|
|
257
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
258
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
259
|
+
context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
260
|
+
user_agent: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, "strip", z.ZodTypeAny, {
|
|
262
|
+
tags?: string[] | undefined;
|
|
263
|
+
context?: Record<string, any> | undefined;
|
|
264
|
+
user_agent?: string | undefined;
|
|
265
|
+
}, {
|
|
266
|
+
tags?: string[] | undefined;
|
|
267
|
+
context?: Record<string, any> | undefined;
|
|
268
|
+
user_agent?: string | undefined;
|
|
269
|
+
}>>;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
id: string;
|
|
272
|
+
version: "2.0.0";
|
|
273
|
+
timestamp: string;
|
|
274
|
+
session_id: string;
|
|
275
|
+
agent_did: string;
|
|
276
|
+
human_did: string;
|
|
277
|
+
policy_version: string;
|
|
278
|
+
mode: "constitutional" | "directive";
|
|
279
|
+
interaction: {
|
|
280
|
+
model: string;
|
|
281
|
+
prompt: string;
|
|
282
|
+
response: string;
|
|
283
|
+
provider?: "openai" | "anthropic" | "aws-bedrock" | "local" | undefined;
|
|
284
|
+
temperature?: number | undefined;
|
|
285
|
+
max_tokens?: number | undefined;
|
|
286
|
+
reasoning?: {
|
|
287
|
+
thought_process?: string | undefined;
|
|
288
|
+
confidence?: number | undefined;
|
|
289
|
+
retrieved_context?: string[] | undefined;
|
|
290
|
+
} | undefined;
|
|
291
|
+
};
|
|
292
|
+
signature: {
|
|
293
|
+
algorithm: "Ed25519";
|
|
294
|
+
value: string;
|
|
295
|
+
key_version: string;
|
|
296
|
+
timestamp_signed?: string | undefined;
|
|
297
|
+
};
|
|
298
|
+
chain: {
|
|
299
|
+
previous_hash: string;
|
|
300
|
+
chain_hash: string;
|
|
301
|
+
chain_length?: number | undefined;
|
|
302
|
+
};
|
|
303
|
+
metadata?: {
|
|
304
|
+
tags?: string[] | undefined;
|
|
305
|
+
context?: Record<string, any> | undefined;
|
|
306
|
+
user_agent?: string | undefined;
|
|
307
|
+
} | undefined;
|
|
308
|
+
telemetry?: {
|
|
309
|
+
resonance_score?: number | undefined;
|
|
310
|
+
resonance_rm?: number | undefined;
|
|
311
|
+
trust_resonance_gap?: number | undefined;
|
|
312
|
+
resonance_input_mode?: "paired_turns" | "labeled_sections" | "single_text_fallback" | undefined;
|
|
313
|
+
resonance_quality?: "STRONG" | "ADVANCED" | "BREAKTHROUGH" | undefined;
|
|
314
|
+
bedau_index?: number | undefined;
|
|
315
|
+
coherence_score?: number | undefined;
|
|
316
|
+
truth_debt?: number | undefined;
|
|
317
|
+
volatility?: number | undefined;
|
|
318
|
+
ciq_metrics?: {
|
|
319
|
+
clarity?: number | undefined;
|
|
320
|
+
integrity?: number | undefined;
|
|
321
|
+
quality?: number | undefined;
|
|
322
|
+
} | undefined;
|
|
323
|
+
resonance_components?: {
|
|
324
|
+
vector_alignment?: number | undefined;
|
|
325
|
+
context_continuity?: number | undefined;
|
|
326
|
+
semantic_mirroring?: number | undefined;
|
|
327
|
+
entropy_delta?: number | undefined;
|
|
328
|
+
} | undefined;
|
|
329
|
+
resonance_stakes?: {
|
|
330
|
+
confidence?: number | undefined;
|
|
331
|
+
level?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
332
|
+
} | undefined;
|
|
333
|
+
resonance_adversarial?: {
|
|
334
|
+
detected?: boolean | undefined;
|
|
335
|
+
penalty?: number | undefined;
|
|
336
|
+
keyword_density?: number | undefined;
|
|
337
|
+
ethics_bypass_score?: number | undefined;
|
|
338
|
+
} | undefined;
|
|
339
|
+
} | undefined;
|
|
340
|
+
policy_state?: {
|
|
341
|
+
consent_verified?: boolean | undefined;
|
|
342
|
+
constraints_applied?: string[] | undefined;
|
|
343
|
+
violations?: {
|
|
344
|
+
severity: "warning" | "violation" | "critical";
|
|
345
|
+
rule: string;
|
|
346
|
+
action: "warn" | "escalate" | "slow" | "halt";
|
|
347
|
+
}[] | undefined;
|
|
348
|
+
override_available?: boolean | undefined;
|
|
349
|
+
} | undefined;
|
|
350
|
+
}, {
|
|
351
|
+
id: string;
|
|
352
|
+
version: "2.0.0";
|
|
353
|
+
timestamp: string;
|
|
354
|
+
session_id: string;
|
|
355
|
+
agent_did: string;
|
|
356
|
+
human_did: string;
|
|
357
|
+
policy_version: string;
|
|
358
|
+
mode: "constitutional" | "directive";
|
|
359
|
+
interaction: {
|
|
360
|
+
model: string;
|
|
361
|
+
prompt: string;
|
|
362
|
+
response: string;
|
|
363
|
+
provider?: "openai" | "anthropic" | "aws-bedrock" | "local" | undefined;
|
|
364
|
+
temperature?: number | undefined;
|
|
365
|
+
max_tokens?: number | undefined;
|
|
366
|
+
reasoning?: {
|
|
367
|
+
thought_process?: string | undefined;
|
|
368
|
+
confidence?: number | undefined;
|
|
369
|
+
retrieved_context?: string[] | undefined;
|
|
370
|
+
} | undefined;
|
|
371
|
+
};
|
|
372
|
+
signature: {
|
|
373
|
+
algorithm: "Ed25519";
|
|
374
|
+
value: string;
|
|
375
|
+
key_version: string;
|
|
376
|
+
timestamp_signed?: string | undefined;
|
|
377
|
+
};
|
|
378
|
+
chain: {
|
|
379
|
+
previous_hash: string;
|
|
380
|
+
chain_hash: string;
|
|
381
|
+
chain_length?: number | undefined;
|
|
382
|
+
};
|
|
383
|
+
metadata?: {
|
|
384
|
+
tags?: string[] | undefined;
|
|
385
|
+
context?: Record<string, any> | undefined;
|
|
386
|
+
user_agent?: string | undefined;
|
|
387
|
+
} | undefined;
|
|
388
|
+
telemetry?: {
|
|
389
|
+
resonance_score?: number | undefined;
|
|
390
|
+
resonance_rm?: number | undefined;
|
|
391
|
+
trust_resonance_gap?: number | undefined;
|
|
392
|
+
resonance_input_mode?: "paired_turns" | "labeled_sections" | "single_text_fallback" | undefined;
|
|
393
|
+
resonance_quality?: "STRONG" | "ADVANCED" | "BREAKTHROUGH" | undefined;
|
|
394
|
+
bedau_index?: number | undefined;
|
|
395
|
+
coherence_score?: number | undefined;
|
|
396
|
+
truth_debt?: number | undefined;
|
|
397
|
+
volatility?: number | undefined;
|
|
398
|
+
ciq_metrics?: {
|
|
399
|
+
clarity?: number | undefined;
|
|
400
|
+
integrity?: number | undefined;
|
|
401
|
+
quality?: number | undefined;
|
|
402
|
+
} | undefined;
|
|
403
|
+
resonance_components?: {
|
|
404
|
+
vector_alignment?: number | undefined;
|
|
405
|
+
context_continuity?: number | undefined;
|
|
406
|
+
semantic_mirroring?: number | undefined;
|
|
407
|
+
entropy_delta?: number | undefined;
|
|
408
|
+
} | undefined;
|
|
409
|
+
resonance_stakes?: {
|
|
410
|
+
confidence?: number | undefined;
|
|
411
|
+
level?: "HIGH" | "MEDIUM" | "LOW" | undefined;
|
|
412
|
+
} | undefined;
|
|
413
|
+
resonance_adversarial?: {
|
|
414
|
+
detected?: boolean | undefined;
|
|
415
|
+
penalty?: number | undefined;
|
|
416
|
+
keyword_density?: number | undefined;
|
|
417
|
+
ethics_bypass_score?: number | undefined;
|
|
418
|
+
} | undefined;
|
|
419
|
+
} | undefined;
|
|
420
|
+
policy_state?: {
|
|
421
|
+
consent_verified?: boolean | undefined;
|
|
422
|
+
constraints_applied?: string[] | undefined;
|
|
423
|
+
violations?: {
|
|
424
|
+
severity: "warning" | "violation" | "critical";
|
|
425
|
+
rule: string;
|
|
426
|
+
action: "warn" | "escalate" | "slow" | "halt";
|
|
427
|
+
}[] | undefined;
|
|
428
|
+
override_available?: boolean | undefined;
|
|
429
|
+
} | undefined;
|
|
430
|
+
}>;
|
|
431
|
+
/**
|
|
432
|
+
* Validate receipt against JSON Schema
|
|
433
|
+
*/
|
|
434
|
+
export declare function validateReceiptJSON(receipt: unknown): VerificationResult;
|
|
435
|
+
/**
|
|
436
|
+
* Validate receipt using Zod (with better error messages)
|
|
437
|
+
*/
|
|
438
|
+
export declare function validateReceiptZod(receipt: unknown): ReturnType<typeof ReceiptZodSchema.safeParse>;
|
|
439
|
+
/**
|
|
440
|
+
* Check if receipt has required fields for processing
|
|
441
|
+
*/
|
|
442
|
+
export declare function isReceiptProcessable(receipt: unknown): receipt is TrustReceipt;
|
|
443
|
+
/**
|
|
444
|
+
* Export receipt validator
|
|
445
|
+
*/
|
|
446
|
+
export declare const receiptValidator: {
|
|
447
|
+
validateJSON: typeof validateReceiptJSON;
|
|
448
|
+
validateZod: typeof validateReceiptZod;
|
|
449
|
+
isProcessable: typeof isReceiptProcessable;
|
|
450
|
+
};
|
|
451
|
+
export {};
|
|
452
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAexE;;GAEG;AACH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgFpB,CAAC;AAEH;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,kBAAkB,CA4DxE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,SAAS,CAAC,CAElG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,YAAY,CAM9E;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAI5B,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @sonate/schemas - Schema Validator
|
|
4
|
+
* Runtime validation using AJV (JSON Schema) and Zod
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.receiptValidator = void 0;
|
|
11
|
+
exports.validateReceiptJSON = validateReceiptJSON;
|
|
12
|
+
exports.validateReceiptZod = validateReceiptZod;
|
|
13
|
+
exports.isReceiptProcessable = isReceiptProcessable;
|
|
14
|
+
const ajv_1 = __importDefault(require("ajv"));
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const receipt_schema_json_1 = __importDefault(require("./receipt.schema.json"));
|
|
17
|
+
/**
|
|
18
|
+
* Initialize AJV for JSON Schema validation
|
|
19
|
+
*/
|
|
20
|
+
const ajv = new ajv_1.default({
|
|
21
|
+
strict: false,
|
|
22
|
+
validateFormats: false,
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* Compile receipt schema for validation
|
|
26
|
+
*/
|
|
27
|
+
const validateReceiptSchema = ajv.compile(receipt_schema_json_1.default);
|
|
28
|
+
/**
|
|
29
|
+
* Zod schema for runtime validation with better errors
|
|
30
|
+
*/
|
|
31
|
+
const ReceiptZodSchema = zod_1.z.object({
|
|
32
|
+
id: zod_1.z.string().regex(/^[a-f0-9]{64}$/, 'Invalid receipt ID format'),
|
|
33
|
+
version: zod_1.z.literal('2.0.0'),
|
|
34
|
+
timestamp: zod_1.z.string().datetime('Invalid ISO 8601 timestamp'),
|
|
35
|
+
session_id: zod_1.z.string().min(1),
|
|
36
|
+
agent_did: zod_1.z.string().regex(/^did:(web|sonate):.+$/, 'Invalid agent DID'),
|
|
37
|
+
human_did: zod_1.z.string().regex(/^did:(web|sonate):.+$/, 'Invalid human DID'),
|
|
38
|
+
policy_version: zod_1.z.string(),
|
|
39
|
+
mode: zod_1.z.enum(['constitutional', 'directive']),
|
|
40
|
+
interaction: zod_1.z.object({
|
|
41
|
+
prompt: zod_1.z.string(),
|
|
42
|
+
response: zod_1.z.string(),
|
|
43
|
+
model: zod_1.z.string(),
|
|
44
|
+
provider: zod_1.z.enum(['openai', 'anthropic', 'aws-bedrock', 'local']).optional(),
|
|
45
|
+
temperature: zod_1.z.number().min(0).max(2).optional(),
|
|
46
|
+
max_tokens: zod_1.z.number().int().positive().optional(),
|
|
47
|
+
reasoning: zod_1.z.object({
|
|
48
|
+
thought_process: zod_1.z.string().optional(),
|
|
49
|
+
confidence: zod_1.z.number().min(0).max(1).optional(),
|
|
50
|
+
retrieved_context: zod_1.z.array(zod_1.z.string()).optional(),
|
|
51
|
+
}).optional(),
|
|
52
|
+
}),
|
|
53
|
+
telemetry: zod_1.z.object({
|
|
54
|
+
resonance_score: zod_1.z.number().min(0).max(1).optional(),
|
|
55
|
+
resonance_rm: zod_1.z.number().min(0).max(1).optional(),
|
|
56
|
+
trust_resonance_gap: zod_1.z.number().min(0).max(1).optional(),
|
|
57
|
+
resonance_input_mode: zod_1.z.enum(['paired_turns', 'labeled_sections', 'single_text_fallback']).optional(),
|
|
58
|
+
resonance_quality: zod_1.z.enum(['STRONG', 'ADVANCED', 'BREAKTHROUGH']).optional(),
|
|
59
|
+
bedau_index: zod_1.z.number().min(0).max(1).optional(),
|
|
60
|
+
coherence_score: zod_1.z.number().min(0).max(1).optional(),
|
|
61
|
+
truth_debt: zod_1.z.number().min(0).max(1).optional(),
|
|
62
|
+
volatility: zod_1.z.number().min(0).max(1).optional(),
|
|
63
|
+
ciq_metrics: zod_1.z.object({
|
|
64
|
+
clarity: zod_1.z.number().min(0).max(1).optional(),
|
|
65
|
+
integrity: zod_1.z.number().min(0).max(1).optional(),
|
|
66
|
+
quality: zod_1.z.number().min(0).max(1).optional(),
|
|
67
|
+
}).optional(),
|
|
68
|
+
resonance_components: zod_1.z.object({
|
|
69
|
+
vector_alignment: zod_1.z.number().min(0).max(1).optional(),
|
|
70
|
+
context_continuity: zod_1.z.number().min(0).max(1).optional(),
|
|
71
|
+
semantic_mirroring: zod_1.z.number().min(0).max(1).optional(),
|
|
72
|
+
entropy_delta: zod_1.z.number().min(0).max(1).optional(),
|
|
73
|
+
}).optional(),
|
|
74
|
+
resonance_stakes: zod_1.z.object({
|
|
75
|
+
level: zod_1.z.enum(['HIGH', 'MEDIUM', 'LOW']).optional(),
|
|
76
|
+
confidence: zod_1.z.number().min(0).max(1).optional(),
|
|
77
|
+
}).optional(),
|
|
78
|
+
resonance_adversarial: zod_1.z.object({
|
|
79
|
+
detected: zod_1.z.boolean().optional(),
|
|
80
|
+
penalty: zod_1.z.number().min(0).max(1).optional(),
|
|
81
|
+
keyword_density: zod_1.z.number().min(0).max(1).optional(),
|
|
82
|
+
ethics_bypass_score: zod_1.z.number().min(0).max(1).optional(),
|
|
83
|
+
}).optional(),
|
|
84
|
+
}).optional(),
|
|
85
|
+
policy_state: zod_1.z.object({
|
|
86
|
+
constraints_applied: zod_1.z.array(zod_1.z.string()).optional(),
|
|
87
|
+
violations: zod_1.z.array(zod_1.z.object({
|
|
88
|
+
rule: zod_1.z.string(),
|
|
89
|
+
severity: zod_1.z.enum(['warning', 'violation', 'critical']),
|
|
90
|
+
action: zod_1.z.enum(['warn', 'slow', 'halt', 'escalate']),
|
|
91
|
+
})).optional(),
|
|
92
|
+
consent_verified: zod_1.z.boolean().optional(),
|
|
93
|
+
override_available: zod_1.z.boolean().optional(),
|
|
94
|
+
}).optional(),
|
|
95
|
+
chain: zod_1.z.object({
|
|
96
|
+
previous_hash: zod_1.z.string().regex(/^[a-f0-9]{64}$|^GENESIS$/),
|
|
97
|
+
chain_hash: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
|
|
98
|
+
chain_length: zod_1.z.number().int().positive().optional(),
|
|
99
|
+
}),
|
|
100
|
+
signature: zod_1.z.object({
|
|
101
|
+
algorithm: zod_1.z.literal('Ed25519'),
|
|
102
|
+
value: zod_1.z.string(),
|
|
103
|
+
key_version: zod_1.z.string(),
|
|
104
|
+
timestamp_signed: zod_1.z.string().datetime().optional(),
|
|
105
|
+
}),
|
|
106
|
+
metadata: zod_1.z.object({
|
|
107
|
+
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
108
|
+
context: zod_1.z.record(zod_1.z.any()).optional(),
|
|
109
|
+
user_agent: zod_1.z.string().optional(),
|
|
110
|
+
}).optional(),
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Validate receipt against JSON Schema
|
|
114
|
+
*/
|
|
115
|
+
function validateReceiptJSON(receipt) {
|
|
116
|
+
const checks = {
|
|
117
|
+
schema_valid: false,
|
|
118
|
+
signature_valid: false,
|
|
119
|
+
chain_valid: false,
|
|
120
|
+
chain_hash_valid: false,
|
|
121
|
+
};
|
|
122
|
+
const errors = [];
|
|
123
|
+
const warnings = [];
|
|
124
|
+
try {
|
|
125
|
+
// Step 1: Validate schema
|
|
126
|
+
const valid = validateReceiptSchema(receipt);
|
|
127
|
+
if (!valid) {
|
|
128
|
+
checks.schema_valid = false;
|
|
129
|
+
errors.push('Schema validation failed');
|
|
130
|
+
if (validateReceiptSchema.errors) {
|
|
131
|
+
validateReceiptSchema.errors.forEach(err => {
|
|
132
|
+
errors.push(`${err.instancePath || 'root'}: ${err.message}`);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return { valid: false, checks, errors, warnings };
|
|
136
|
+
}
|
|
137
|
+
checks.schema_valid = true;
|
|
138
|
+
const typedReceipt = receipt;
|
|
139
|
+
// Step 2: Validate chain structure
|
|
140
|
+
if (!typedReceipt.chain?.previous_hash || !typedReceipt.chain?.chain_hash) {
|
|
141
|
+
errors.push('Invalid chain structure');
|
|
142
|
+
return { valid: false, checks, errors, warnings };
|
|
143
|
+
}
|
|
144
|
+
checks.chain_valid = true;
|
|
145
|
+
// Step 3: Verify signature structure (not crypto verification - that's separate)
|
|
146
|
+
if (!typedReceipt.signature?.value) {
|
|
147
|
+
errors.push('Invalid signature structure');
|
|
148
|
+
return { valid: false, checks, errors, warnings };
|
|
149
|
+
}
|
|
150
|
+
checks.signature_valid = true; // Crypto verification happens separately
|
|
151
|
+
// Step 4: Validate chain hash format
|
|
152
|
+
const chainHashValid = /^[a-f0-9]{64}$/.test(typedReceipt.chain.chain_hash);
|
|
153
|
+
if (!chainHashValid) {
|
|
154
|
+
errors.push('Invalid chain hash format');
|
|
155
|
+
return { valid: false, checks, errors, warnings };
|
|
156
|
+
}
|
|
157
|
+
checks.chain_hash_valid = true;
|
|
158
|
+
return {
|
|
159
|
+
valid: errors.length === 0,
|
|
160
|
+
checks,
|
|
161
|
+
errors,
|
|
162
|
+
warnings,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
errors.push(`Validation error: ${err instanceof Error ? err.message : String(err)}`);
|
|
167
|
+
return { valid: false, checks, errors, warnings };
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Validate receipt using Zod (with better error messages)
|
|
172
|
+
*/
|
|
173
|
+
function validateReceiptZod(receipt) {
|
|
174
|
+
return ReceiptZodSchema.safeParse(receipt);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Check if receipt has required fields for processing
|
|
178
|
+
*/
|
|
179
|
+
function isReceiptProcessable(receipt) {
|
|
180
|
+
if (typeof receipt !== 'object' || receipt === null) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
const result = validateReceiptJSON(receipt);
|
|
184
|
+
return result.valid && Object.values(result.checks).every(check => check);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Export receipt validator
|
|
188
|
+
*/
|
|
189
|
+
exports.receiptValidator = {
|
|
190
|
+
validateJSON: validateReceiptJSON,
|
|
191
|
+
validateZod: validateReceiptZod,
|
|
192
|
+
isProcessable: isReceiptProcessable,
|
|
193
|
+
};
|
|
194
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AA6GH,kDA4DC;AAKD,gDAEC;AAKD,oDAMC;AAzLD,8CAAsB;AACtB,6BAAwB;AAExB,gFAAkD;AAGlD;;GAEG;AACH,MAAM,GAAG,GAAG,IAAI,aAAG,CAAC;IAClB,MAAM,EAAE,KAAK;IACb,eAAe,EAAE,KAAK;CACvB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,qBAAqB,GAAG,GAAG,CAAC,OAAO,CAAC,6BAAa,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IAChC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;IACnE,OAAO,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAC3B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IAC5D,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;IACzE,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,uBAAuB,EAAE,mBAAmB,CAAC;IACzE,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE;IAC1B,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,gBA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