@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,571 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @sonate/schemas - Receipt Types
|
|
3
|
+
* Generated from receipt.schema.json
|
|
4
|
+
*
|
|
5
|
+
* Defines the formal structure of SONATE Trust Receipts
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Constraint violation from policy enforcement
|
|
10
|
+
*/
|
|
11
|
+
export interface ConstraintViolation {
|
|
12
|
+
/** Violation ID */
|
|
13
|
+
id: string;
|
|
14
|
+
|
|
15
|
+
/** ID of constraint that triggered this violation */
|
|
16
|
+
constraint_id: string;
|
|
17
|
+
|
|
18
|
+
/** Name of constraint */
|
|
19
|
+
constraint_name: string;
|
|
20
|
+
|
|
21
|
+
/** Type of violation */
|
|
22
|
+
violation_type: 'PII_DETECTED' | 'TRUTH_DEBT_EXCEEDED' | 'COMPLIANCE_BOUNDARY_VIOLATED' | 'POLICY_CONSTRAINT_FAILED' | 'CUSTOM_VIOLATION';
|
|
23
|
+
|
|
24
|
+
/** Severity level */
|
|
25
|
+
severity: 'warn' | 'block' | 'escalate';
|
|
26
|
+
|
|
27
|
+
/** Human-readable violation message */
|
|
28
|
+
message: string;
|
|
29
|
+
|
|
30
|
+
/** Supporting evidence for violation */
|
|
31
|
+
evidence: Record<string, any>;
|
|
32
|
+
|
|
33
|
+
/** Annotation to add to receipt */
|
|
34
|
+
receipt_annotation: string;
|
|
35
|
+
|
|
36
|
+
/** When violation was detected */
|
|
37
|
+
detected_at: string;
|
|
38
|
+
|
|
39
|
+
/** Suggested remediation action */
|
|
40
|
+
remediation_suggested?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Policy enforcement action
|
|
45
|
+
*/
|
|
46
|
+
export type PolicyEnforcementAction = 'ALERT' | 'ANNOTATE' | 'BLOCK' | 'ESCALATE' | 'REQUIRE_HUMAN_REVIEW';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Interaction mode: constitutional (principle-based) or directive (instruction-based)
|
|
50
|
+
*/
|
|
51
|
+
export type InteractionMode = 'constitutional' | 'directive';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* AI provider identifier
|
|
55
|
+
*/
|
|
56
|
+
export type AIProvider = 'openai' | 'anthropic' | 'aws-bedrock' | 'local';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Violation severity level
|
|
60
|
+
*/
|
|
61
|
+
export type ViolationSeverity = 'warning' | 'violation' | 'critical';
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Action taken in response to policy violation
|
|
65
|
+
*/
|
|
66
|
+
export type PolicyAction = 'warn' | 'slow' | 'halt' | 'escalate';
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Resonance quality rating
|
|
70
|
+
*/
|
|
71
|
+
export type ResonanceQuality = 'STRONG' | 'ADVANCED' | 'BREAKTHROUGH';
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Signature algorithm
|
|
75
|
+
*/
|
|
76
|
+
export type SignatureAlgorithm = 'Ed25519';
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* AI Interaction data
|
|
80
|
+
*/
|
|
81
|
+
export interface AIInteraction {
|
|
82
|
+
/** User's input/question to the AI (omitted when content hashing is enabled) */
|
|
83
|
+
prompt?: string;
|
|
84
|
+
|
|
85
|
+
/** AI's response (omitted when content hashing is enabled) */
|
|
86
|
+
response?: string;
|
|
87
|
+
|
|
88
|
+
/** SHA-256 hash of the prompt (privacy-preserving alternative to raw content) */
|
|
89
|
+
prompt_hash?: string;
|
|
90
|
+
|
|
91
|
+
/** SHA-256 hash of the response (privacy-preserving alternative to raw content) */
|
|
92
|
+
response_hash?: string;
|
|
93
|
+
|
|
94
|
+
/** Model identifier used (e.g., 'gpt-4-turbo', 'claude-3-sonnet') */
|
|
95
|
+
model: string;
|
|
96
|
+
|
|
97
|
+
/** AI provider */
|
|
98
|
+
provider?: AIProvider;
|
|
99
|
+
|
|
100
|
+
/** Model temperature setting (0-2) */
|
|
101
|
+
temperature?: number;
|
|
102
|
+
|
|
103
|
+
/** Maximum tokens allowed */
|
|
104
|
+
max_tokens?: number;
|
|
105
|
+
|
|
106
|
+
/** Optional: Captured reasoning signals from model */
|
|
107
|
+
reasoning?: {
|
|
108
|
+
/** Internal reasoning if exposed by model */
|
|
109
|
+
thought_process?: string;
|
|
110
|
+
|
|
111
|
+
/** Model's confidence score (0-1) */
|
|
112
|
+
confidence?: number;
|
|
113
|
+
|
|
114
|
+
/** External context retrieved for this interaction */
|
|
115
|
+
retrieved_context?: string[];
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Trust and coherence metrics
|
|
121
|
+
*/
|
|
122
|
+
export interface Telemetry {
|
|
123
|
+
/** Overall trust/resonance score (0-1) */
|
|
124
|
+
resonance_score?: number;
|
|
125
|
+
|
|
126
|
+
/** Deterministic calculator resonance score (0-1) */
|
|
127
|
+
resonance_rm?: number;
|
|
128
|
+
|
|
129
|
+
/** Absolute gap between constitutional trust (normalized 0-1) and calculator R_m */
|
|
130
|
+
trust_resonance_gap?: number;
|
|
131
|
+
|
|
132
|
+
/** How the calculator constructed a comparable interaction pair */
|
|
133
|
+
resonance_input_mode?: 'paired_turns' | 'labeled_sections' | 'single_text_fallback';
|
|
134
|
+
|
|
135
|
+
/** Qualitative rating of resonance */
|
|
136
|
+
resonance_quality?: ResonanceQuality;
|
|
137
|
+
|
|
138
|
+
/** Weak emergence detection (0-1) */
|
|
139
|
+
bedau_index?: number;
|
|
140
|
+
|
|
141
|
+
/** LBC (Longitudinal Behavioral Coherence) score */
|
|
142
|
+
coherence_score?: number;
|
|
143
|
+
|
|
144
|
+
/** Measure of unverifiable claims (0-1) */
|
|
145
|
+
truth_debt?: number;
|
|
146
|
+
|
|
147
|
+
/** Behavioral volatility score (0-1) */
|
|
148
|
+
volatility?: number;
|
|
149
|
+
|
|
150
|
+
/** Clarity, Integrity, Quality scores */
|
|
151
|
+
ciq_metrics?: {
|
|
152
|
+
/** Communication clarity (0-1) */
|
|
153
|
+
clarity?: number;
|
|
154
|
+
/** Reasoning transparency (0-1) */
|
|
155
|
+
integrity?: number;
|
|
156
|
+
/** Overall value (0-1) */
|
|
157
|
+
quality?: number;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/** Calculator component breakdown (0-1 components before weighted composition) */
|
|
161
|
+
resonance_components?: {
|
|
162
|
+
vector_alignment?: number;
|
|
163
|
+
context_continuity?: number;
|
|
164
|
+
semantic_mirroring?: number;
|
|
165
|
+
entropy_delta?: number;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/** Stakes classification for the interaction */
|
|
169
|
+
resonance_stakes?: {
|
|
170
|
+
level?: 'HIGH' | 'MEDIUM' | 'LOW';
|
|
171
|
+
confidence?: number;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/** Adversarial / jailbreak detection summary */
|
|
175
|
+
resonance_adversarial?: {
|
|
176
|
+
detected?: boolean;
|
|
177
|
+
penalty?: number;
|
|
178
|
+
keyword_density?: number;
|
|
179
|
+
ethics_bypass_score?: number;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// NEW: SONATE principle scores and metrics (v2.2)
|
|
183
|
+
/** SONATE constitutional principle scores (0-10 each) */
|
|
184
|
+
sonate_principles?: {
|
|
185
|
+
CONSENT_ARCHITECTURE?: number;
|
|
186
|
+
INSPECTION_MANDATE?: number;
|
|
187
|
+
CONTINUOUS_VALIDATION?: number;
|
|
188
|
+
ETHICAL_OVERRIDE?: number;
|
|
189
|
+
RIGHT_TO_DISCONNECT?: number;
|
|
190
|
+
MORAL_RECOGNITION?: number;
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/** Overall trust score derived from weighted principles (0-100) */
|
|
194
|
+
overall_trust_score?: number;
|
|
195
|
+
|
|
196
|
+
/** Trust status from principle evaluation */
|
|
197
|
+
trust_status?: 'PASS' | 'PARTIAL' | 'FAIL';
|
|
198
|
+
|
|
199
|
+
/** Weights applied to principles for calculation */
|
|
200
|
+
principle_weights?: {
|
|
201
|
+
CONSENT_ARCHITECTURE?: number;
|
|
202
|
+
INSPECTION_MANDATE?: number;
|
|
203
|
+
CONTINUOUS_VALIDATION?: number;
|
|
204
|
+
ETHICAL_OVERRIDE?: number;
|
|
205
|
+
RIGHT_TO_DISCONNECT?: number;
|
|
206
|
+
MORAL_RECOGNITION?: number;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/** Which policy's weights were applied (standard|healthcare|finance|government|etc) */
|
|
210
|
+
weight_source?: string;
|
|
211
|
+
|
|
212
|
+
/** Policy ID reference for the weights used */
|
|
213
|
+
weight_policy_id?: string;
|
|
214
|
+
|
|
215
|
+
/** Trust kernel version that produced the canonical verdict */
|
|
216
|
+
kernel_version?: string;
|
|
217
|
+
|
|
218
|
+
/** Kernel confidence in the final constitutional verdict (0-1) */
|
|
219
|
+
kernel_confidence?: number;
|
|
220
|
+
|
|
221
|
+
/** Human-readable kernel summary */
|
|
222
|
+
kernel_summary?: string;
|
|
223
|
+
|
|
224
|
+
/** Whether the kernel recommends human review */
|
|
225
|
+
kernel_requires_human_review?: boolean;
|
|
226
|
+
|
|
227
|
+
/** Canonical governance action the kernel recommends next */
|
|
228
|
+
kernel_recommended_enforcement?: 'none' | 'alert' | 'restrict' | 'escalate' | 'block';
|
|
229
|
+
|
|
230
|
+
/** Follow-up actions the kernel recommends after enforcement selection */
|
|
231
|
+
kernel_recommended_actions?: Array<
|
|
232
|
+
| 'notify_human_reviewer'
|
|
233
|
+
| 'preserve_audit_evidence'
|
|
234
|
+
| 'block_response_delivery'
|
|
235
|
+
| 'restrict_session'
|
|
236
|
+
| 'show_crisis_resources'
|
|
237
|
+
| 'encourage_immediate_human_contact'
|
|
238
|
+
| 'alert_trust_safety_team'
|
|
239
|
+
>;
|
|
240
|
+
|
|
241
|
+
/** Deterministic trust-kernel rules that fired */
|
|
242
|
+
kernel_rules_triggered?: Array<{
|
|
243
|
+
id?: string;
|
|
244
|
+
severity?: 'info' | 'warning' | 'critical';
|
|
245
|
+
message?: string;
|
|
246
|
+
}>;
|
|
247
|
+
|
|
248
|
+
/** Relative contribution of each signal family to the final decision */
|
|
249
|
+
kernel_source_contributions?: {
|
|
250
|
+
llm_judge?: number;
|
|
251
|
+
semantic_judge?: number;
|
|
252
|
+
deterministic_policy?: number;
|
|
253
|
+
calculator?: number;
|
|
254
|
+
system_state?: number;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/** Structured kernel trace showing signed inputs, applied rules, and decision logic */
|
|
258
|
+
kernel_trace?: {
|
|
259
|
+
inputs?: {
|
|
260
|
+
prompt_hash?: string;
|
|
261
|
+
response_hash?: string;
|
|
262
|
+
transcript_window_hash?: string;
|
|
263
|
+
domain_policy_packs?: string[];
|
|
264
|
+
stakes_level?: 'HIGH' | 'MEDIUM' | 'LOW';
|
|
265
|
+
trust_alignment_gap?: number;
|
|
266
|
+
llm_status?: 'PASS' | 'PARTIAL' | 'FAIL';
|
|
267
|
+
llm_principles?: {
|
|
268
|
+
CONSENT_ARCHITECTURE?: number;
|
|
269
|
+
INSPECTION_MANDATE?: number;
|
|
270
|
+
CONTINUOUS_VALIDATION?: number;
|
|
271
|
+
ETHICAL_OVERRIDE?: number;
|
|
272
|
+
RIGHT_TO_DISCONNECT?: number;
|
|
273
|
+
MORAL_RECOGNITION?: number;
|
|
274
|
+
};
|
|
275
|
+
semantic_domain_classification?: string;
|
|
276
|
+
semantic_domain_confidence?: number;
|
|
277
|
+
semantic_stakes_level?: 'HIGH' | 'MEDIUM' | 'LOW';
|
|
278
|
+
semantic_safe_reframe?: boolean;
|
|
279
|
+
system_state_facts?: Record<string, boolean | number | string | null>;
|
|
280
|
+
};
|
|
281
|
+
rules_applied?: Array<{
|
|
282
|
+
id?: string;
|
|
283
|
+
severity?: 'info' | 'warning' | 'critical';
|
|
284
|
+
message?: string;
|
|
285
|
+
effect?: string;
|
|
286
|
+
}>;
|
|
287
|
+
decision_logic?: {
|
|
288
|
+
statements?: string[];
|
|
289
|
+
final_status?: 'PASS' | 'PARTIAL' | 'FAIL';
|
|
290
|
+
final_score?: number;
|
|
291
|
+
human_review_required?: boolean;
|
|
292
|
+
recommended_enforcement?: 'none' | 'alert' | 'restrict' | 'escalate' | 'block';
|
|
293
|
+
recommended_actions?: Array<
|
|
294
|
+
| 'notify_human_reviewer'
|
|
295
|
+
| 'preserve_audit_evidence'
|
|
296
|
+
| 'block_response_delivery'
|
|
297
|
+
| 'restrict_session'
|
|
298
|
+
| 'show_crisis_resources'
|
|
299
|
+
| 'encourage_immediate_human_contact'
|
|
300
|
+
| 'alert_trust_safety_team'
|
|
301
|
+
>;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Policy violation record
|
|
308
|
+
*/
|
|
309
|
+
export interface PolicyViolation {
|
|
310
|
+
/** Policy rule that was violated */
|
|
311
|
+
rule: string;
|
|
312
|
+
|
|
313
|
+
/** Severity level */
|
|
314
|
+
severity: ViolationSeverity;
|
|
315
|
+
|
|
316
|
+
/** Action taken in response */
|
|
317
|
+
action: PolicyAction;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* State of policy constraints at time of interaction
|
|
322
|
+
*/
|
|
323
|
+
export interface PolicyState {
|
|
324
|
+
/** Which policy constraints were active */
|
|
325
|
+
constraints_applied?: string[];
|
|
326
|
+
|
|
327
|
+
/** Any policy violations detected */
|
|
328
|
+
violations?: PolicyViolation[];
|
|
329
|
+
|
|
330
|
+
/** Was explicit user consent verified? */
|
|
331
|
+
consent_verified?: boolean;
|
|
332
|
+
|
|
333
|
+
/** Did user have option to override? */
|
|
334
|
+
override_available?: boolean;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Hash chain for immutability
|
|
339
|
+
*/
|
|
340
|
+
export interface HashChain {
|
|
341
|
+
/** Hash of previous receipt (or 'GENESIS' for first) */
|
|
342
|
+
previous_hash: string;
|
|
343
|
+
|
|
344
|
+
/** SHA-256(canonical_json + previous_hash) */
|
|
345
|
+
chain_hash: string;
|
|
346
|
+
|
|
347
|
+
/** Number of receipts in this chain */
|
|
348
|
+
chain_length?: number;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Cryptographic signature
|
|
353
|
+
*/
|
|
354
|
+
export interface DigitalSignature {
|
|
355
|
+
/** Signature algorithm used */
|
|
356
|
+
algorithm: SignatureAlgorithm;
|
|
357
|
+
|
|
358
|
+
/** Base64-encoded signature of canonical receipt */
|
|
359
|
+
value: string;
|
|
360
|
+
|
|
361
|
+
/** Which version of agent's key was used */
|
|
362
|
+
key_version: string;
|
|
363
|
+
|
|
364
|
+
/** When receipt was signed */
|
|
365
|
+
timestamp_signed?: string;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* SONATE Trust Receipt - Core Structure
|
|
370
|
+
*
|
|
371
|
+
* Represents a cryptographically signed, immutable record of an AI interaction
|
|
372
|
+
* with full audit trail, policy state, and trust metrics.
|
|
373
|
+
*
|
|
374
|
+
* @example
|
|
375
|
+
* ```typescript
|
|
376
|
+
* const receipt: TrustReceipt = {
|
|
377
|
+
* id: "abcd1234...ef5678",
|
|
378
|
+
* version: "2.0.0",
|
|
379
|
+
* timestamp: "2026-02-09T18:30:45.123Z",
|
|
380
|
+
* session_id: "session_abc123",
|
|
381
|
+
* agent_did: "did:sonate:a1b2c3d4e5f6...",
|
|
382
|
+
* human_did: "did:sonate:x9y8z7w6v5u4...",
|
|
383
|
+
* policy_version: "policy_v1.2.0",
|
|
384
|
+
* mode: "constitutional",
|
|
385
|
+
* interaction: {
|
|
386
|
+
* prompt: "What is the capital of France?",
|
|
387
|
+
* response: "Paris is the capital of France.",
|
|
388
|
+
* model: "gpt-4-turbo",
|
|
389
|
+
* provider: "openai"
|
|
390
|
+
* },
|
|
391
|
+
* signature: {
|
|
392
|
+
* algorithm: "Ed25519",
|
|
393
|
+
* value: "MEQCIDGrvmTEr7c00rpf5Z+O50Ad5Z8Xxfqfjf9Z8O50Ad5==",
|
|
394
|
+
* key_version: "key_v1"
|
|
395
|
+
* },
|
|
396
|
+
* chain_hash: "abcd1234...ef5678"
|
|
397
|
+
* };
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
export interface TrustReceipt {
|
|
401
|
+
/** Unique receipt identifier (SHA-256 hash) */
|
|
402
|
+
id: string;
|
|
403
|
+
|
|
404
|
+
/** Receipt schema version */
|
|
405
|
+
version: "2.0.0";
|
|
406
|
+
|
|
407
|
+
/** ISO 8601 timestamp of interaction */
|
|
408
|
+
timestamp: string;
|
|
409
|
+
|
|
410
|
+
/** Conversation/session identifier */
|
|
411
|
+
session_id: string;
|
|
412
|
+
|
|
413
|
+
/** DID of the AI agent */
|
|
414
|
+
agent_did: string;
|
|
415
|
+
|
|
416
|
+
/** DID of the human user */
|
|
417
|
+
human_did: string;
|
|
418
|
+
|
|
419
|
+
/** Version of policy that governed this interaction */
|
|
420
|
+
policy_version: string;
|
|
421
|
+
|
|
422
|
+
/** Governance mode */
|
|
423
|
+
mode: InteractionMode;
|
|
424
|
+
|
|
425
|
+
/** The actual AI interaction data */
|
|
426
|
+
interaction: AIInteraction;
|
|
427
|
+
|
|
428
|
+
/** Trust and coherence metrics */
|
|
429
|
+
telemetry?: Telemetry;
|
|
430
|
+
|
|
431
|
+
/** State of policy constraints */
|
|
432
|
+
policy_state?: PolicyState;
|
|
433
|
+
|
|
434
|
+
/** Hash chain for immutability */
|
|
435
|
+
chain: HashChain;
|
|
436
|
+
|
|
437
|
+
/** Cryptographic signature */
|
|
438
|
+
signature: DigitalSignature;
|
|
439
|
+
|
|
440
|
+
/** Optional metadata */
|
|
441
|
+
metadata?: {
|
|
442
|
+
/** Custom tags for categorization */
|
|
443
|
+
tags?: string[];
|
|
444
|
+
/** Application-specific context */
|
|
445
|
+
context?: Record<string, any>;
|
|
446
|
+
/** Client that generated this receipt */
|
|
447
|
+
user_agent?: string;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
/** Policy enforcement results (Phase 2) */
|
|
451
|
+
policy_enforcement?: {
|
|
452
|
+
/** List of policy IDs evaluated */
|
|
453
|
+
policies_evaluated: string[];
|
|
454
|
+
/** Constraint violations detected */
|
|
455
|
+
violations: ConstraintViolation[];
|
|
456
|
+
/** Overall policy compliance status */
|
|
457
|
+
status: 'CLEAR' | 'FLAGGED' | 'BLOCKED';
|
|
458
|
+
/** Whether human review is required */
|
|
459
|
+
human_review_required: boolean;
|
|
460
|
+
/** When policy enforcement was performed */
|
|
461
|
+
enforcement_timestamp: string;
|
|
462
|
+
/** Actions taken as result of policy enforcement */
|
|
463
|
+
actions_taken?: PolicyEnforcementAction[];
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Receipt creation input (without computed fields)
|
|
469
|
+
*/
|
|
470
|
+
export interface CreateReceiptInput {
|
|
471
|
+
session_id: string;
|
|
472
|
+
agent_did: string;
|
|
473
|
+
human_did: string;
|
|
474
|
+
policy_version: string;
|
|
475
|
+
mode: InteractionMode;
|
|
476
|
+
interaction: AIInteraction;
|
|
477
|
+
telemetry?: Telemetry;
|
|
478
|
+
policy_state?: PolicyState;
|
|
479
|
+
previous_hash?: string;
|
|
480
|
+
metadata?: {
|
|
481
|
+
tags?: string[];
|
|
482
|
+
context?: Record<string, any>;
|
|
483
|
+
user_agent?: string;
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Receipt verification result
|
|
489
|
+
*/
|
|
490
|
+
export interface VerificationResult {
|
|
491
|
+
/** Is the receipt valid? */
|
|
492
|
+
valid: boolean;
|
|
493
|
+
|
|
494
|
+
/** Specific checks performed */
|
|
495
|
+
checks: {
|
|
496
|
+
/** Schema validation passed */
|
|
497
|
+
schema_valid: boolean;
|
|
498
|
+
/** Signature verification passed */
|
|
499
|
+
signature_valid: boolean;
|
|
500
|
+
/** Chain integrity intact */
|
|
501
|
+
chain_valid: boolean;
|
|
502
|
+
/** Hash chain verified */
|
|
503
|
+
chain_hash_valid: boolean;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
/** Any errors encountered */
|
|
507
|
+
errors: string[];
|
|
508
|
+
|
|
509
|
+
/** Warnings (non-fatal issues) */
|
|
510
|
+
warnings: string[];
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Batch export format for SIEM tools
|
|
515
|
+
*/
|
|
516
|
+
export interface ReceiptExportBatch {
|
|
517
|
+
/** Export metadata */
|
|
518
|
+
metadata: {
|
|
519
|
+
/** Export timestamp */
|
|
520
|
+
exported_at: string;
|
|
521
|
+
/** Number of receipts in batch */
|
|
522
|
+
count: number;
|
|
523
|
+
/** Time range covered */
|
|
524
|
+
time_range?: {
|
|
525
|
+
start: string;
|
|
526
|
+
end: string;
|
|
527
|
+
};
|
|
528
|
+
/** Format version */
|
|
529
|
+
format_version: "1.0.0";
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
/** Receipts in batch */
|
|
533
|
+
receipts: TrustReceipt[];
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* DID (Decentralized Identifier) Structure
|
|
538
|
+
*/
|
|
539
|
+
export interface DID {
|
|
540
|
+
/** DID identifier */
|
|
541
|
+
id: string;
|
|
542
|
+
|
|
543
|
+
/** DID document */
|
|
544
|
+
document: {
|
|
545
|
+
/** Public keys associated with this DID */
|
|
546
|
+
public_keys: Array<{
|
|
547
|
+
/** Key identifier */
|
|
548
|
+
id: string;
|
|
549
|
+
/** Key type (currently Ed25519) */
|
|
550
|
+
type: "Ed25519";
|
|
551
|
+
/** Public key (base64) */
|
|
552
|
+
value: string;
|
|
553
|
+
/** When key was created */
|
|
554
|
+
created_at: string;
|
|
555
|
+
/** When key was rotated (null if current) */
|
|
556
|
+
rotated_at?: string;
|
|
557
|
+
}>;
|
|
558
|
+
|
|
559
|
+
/** Creation timestamp */
|
|
560
|
+
created_at: string;
|
|
561
|
+
|
|
562
|
+
/** Last update timestamp */
|
|
563
|
+
updated_at: string;
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
/** Current key version */
|
|
567
|
+
current_key_version: string;
|
|
568
|
+
|
|
569
|
+
/** Is DID active? */
|
|
570
|
+
active: boolean;
|
|
571
|
+
}
|