@longarc/mdash 3.1.1 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +86 -23
  2. package/SECURITY.md +254 -0
  3. package/dist/accountability/engine.d.ts +27 -0
  4. package/dist/accountability/engine.d.ts.map +1 -0
  5. package/dist/accountability/engine.js +148 -0
  6. package/dist/accountability/engine.js.map +1 -0
  7. package/dist/accountability/types.d.ts +46 -0
  8. package/dist/accountability/types.d.ts.map +1 -0
  9. package/dist/accountability/types.js +8 -0
  10. package/dist/accountability/types.js.map +1 -0
  11. package/dist/checkpoint/engine.d.ts +2 -2
  12. package/dist/checkpoint/engine.d.ts.map +1 -1
  13. package/dist/checkpoint/engine.js +5 -1
  14. package/dist/checkpoint/engine.js.map +1 -1
  15. package/dist/context/compose.d.ts +62 -0
  16. package/dist/context/compose.d.ts.map +1 -0
  17. package/dist/context/compose.js +286 -0
  18. package/dist/context/compose.js.map +1 -0
  19. package/dist/context/crypto/hash.d.ts +100 -0
  20. package/dist/context/crypto/hash.d.ts.map +1 -0
  21. package/dist/context/crypto/hash.js +248 -0
  22. package/dist/context/crypto/hash.js.map +1 -0
  23. package/dist/context/crypto/hmac.d.ts +80 -0
  24. package/dist/context/crypto/hmac.d.ts.map +1 -0
  25. package/dist/context/crypto/hmac.js +192 -0
  26. package/dist/context/crypto/hmac.js.map +1 -0
  27. package/dist/context/crypto/index.d.ts +7 -0
  28. package/dist/context/crypto/index.d.ts.map +1 -0
  29. package/dist/context/crypto/index.js +7 -0
  30. package/dist/context/crypto/index.js.map +1 -0
  31. package/dist/context/engine-v3.0-backup.d.ts +197 -0
  32. package/dist/context/engine-v3.0-backup.d.ts.map +1 -0
  33. package/dist/context/engine-v3.0-backup.js +392 -0
  34. package/dist/context/engine-v3.0-backup.js.map +1 -0
  35. package/dist/context/engine.d.ts +2 -2
  36. package/dist/context/engine.d.ts.map +1 -1
  37. package/dist/context/engine.js +2 -2
  38. package/dist/context/engine.js.map +1 -1
  39. package/dist/context/fragment.d.ts +99 -0
  40. package/dist/context/fragment.d.ts.map +1 -0
  41. package/dist/context/fragment.js +316 -0
  42. package/dist/context/fragment.js.map +1 -0
  43. package/dist/context/index.d.ts +99 -0
  44. package/dist/context/index.d.ts.map +1 -0
  45. package/dist/context/index.js +180 -0
  46. package/dist/context/index.js.map +1 -0
  47. package/dist/context/provenance.d.ts +80 -0
  48. package/dist/context/provenance.d.ts.map +1 -0
  49. package/dist/context/provenance.js +294 -0
  50. package/dist/context/provenance.js.map +1 -0
  51. package/dist/context/resolve.d.ts +106 -0
  52. package/dist/context/resolve.d.ts.map +1 -0
  53. package/dist/context/resolve.js +440 -0
  54. package/dist/context/resolve.js.map +1 -0
  55. package/dist/context/store.d.ts +156 -0
  56. package/dist/context/store.d.ts.map +1 -0
  57. package/dist/context/store.js +396 -0
  58. package/dist/context/store.js.map +1 -0
  59. package/dist/context/types.d.ts +463 -0
  60. package/dist/context/types.d.ts.map +1 -0
  61. package/dist/context/types.js +94 -0
  62. package/dist/context/types.js.map +1 -0
  63. package/dist/context/utils/atomic.d.ts +76 -0
  64. package/dist/context/utils/atomic.d.ts.map +1 -0
  65. package/dist/context/utils/atomic.js +159 -0
  66. package/dist/context/utils/atomic.js.map +1 -0
  67. package/dist/context/utils/credit.d.ts +65 -0
  68. package/dist/context/utils/credit.d.ts.map +1 -0
  69. package/dist/context/utils/credit.js +164 -0
  70. package/dist/context/utils/credit.js.map +1 -0
  71. package/dist/context/utils/index.d.ts +13 -0
  72. package/dist/context/utils/index.d.ts.map +1 -0
  73. package/dist/context/utils/index.js +13 -0
  74. package/dist/context/utils/index.js.map +1 -0
  75. package/dist/context/utils/utility.d.ts +63 -0
  76. package/dist/context/utils/utility.d.ts.map +1 -0
  77. package/dist/context/utils/utility.js +141 -0
  78. package/dist/context/utils/utility.js.map +1 -0
  79. package/dist/core/commitment.d.ts +26 -3
  80. package/dist/core/commitment.d.ts.map +1 -1
  81. package/dist/core/commitment.js +45 -7
  82. package/dist/core/commitment.js.map +1 -1
  83. package/dist/core/crypto.d.ts +2 -0
  84. package/dist/core/crypto.d.ts.map +1 -1
  85. package/dist/core/crypto.js +12 -0
  86. package/dist/core/crypto.js.map +1 -1
  87. package/dist/index.d.ts +11 -6
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +35 -10
  90. package/dist/index.js.map +1 -1
  91. package/dist/mcca/engine.d.ts.map +1 -1
  92. package/dist/mcca/engine.js +5 -4
  93. package/dist/mcca/engine.js.map +1 -1
  94. package/dist/physics/engine.d.ts +3 -2
  95. package/dist/physics/engine.d.ts.map +1 -1
  96. package/dist/physics/engine.js +37 -3
  97. package/dist/physics/engine.js.map +1 -1
  98. package/dist/provenance/api-handler.d.ts +45 -0
  99. package/dist/provenance/api-handler.d.ts.map +1 -0
  100. package/dist/provenance/api-handler.js +223 -0
  101. package/dist/provenance/api-handler.js.map +1 -0
  102. package/dist/provenance/api-types.d.ts +108 -0
  103. package/dist/provenance/api-types.d.ts.map +1 -0
  104. package/dist/provenance/api-types.js +9 -0
  105. package/dist/provenance/api-types.js.map +1 -0
  106. package/dist/provenance/index.d.ts +6 -0
  107. package/dist/provenance/index.d.ts.map +1 -0
  108. package/dist/provenance/index.js +3 -0
  109. package/dist/provenance/index.js.map +1 -0
  110. package/dist/provenance/provenance-engine.d.ts +63 -0
  111. package/dist/provenance/provenance-engine.d.ts.map +1 -0
  112. package/dist/provenance/provenance-engine.js +311 -0
  113. package/dist/provenance/provenance-engine.js.map +1 -0
  114. package/dist/provenance/types.d.ts +193 -0
  115. package/dist/provenance/types.d.ts.map +1 -0
  116. package/dist/provenance/types.js +9 -0
  117. package/dist/provenance/types.js.map +1 -0
  118. package/dist/tee/engine.d.ts.map +1 -1
  119. package/dist/tee/engine.js +14 -0
  120. package/dist/tee/engine.js.map +1 -1
  121. package/dist/warrant/engine.d.ts +24 -1
  122. package/dist/warrant/engine.d.ts.map +1 -1
  123. package/dist/warrant/engine.js +76 -1
  124. package/dist/warrant/engine.js.map +1 -1
  125. package/dist/zk/engine.d.ts.map +1 -1
  126. package/dist/zk/engine.js +7 -4
  127. package/dist/zk/engine.js.map +1 -1
  128. package/docs/SECURITY-PATCHES.md +170 -0
  129. package/package.json +17 -5
  130. package/src/__tests__/accountability.test.ts +308 -0
  131. package/src/__tests__/l1-verification-modes.test.ts +424 -0
  132. package/src/__tests__/phase1.benchmark.test.ts +94 -0
  133. package/src/__tests__/phase1.test.ts +0 -77
  134. package/src/__tests__/phase2-4.benchmark.test.ts +60 -0
  135. package/src/__tests__/phase2-4.test.ts +1 -52
  136. package/src/__tests__/provenance/api-handler.test.ts +356 -0
  137. package/src/__tests__/provenance/provenance-engine.test.ts +628 -0
  138. package/src/__tests__/sa-2026-008.test.ts +45 -0
  139. package/src/__tests__/sa-2026-009.test.ts +86 -0
  140. package/src/__tests__/sa-2026-010.test.ts +72 -0
  141. package/src/__tests__/sa-2026-012.test.ts +65 -0
  142. package/src/__tests__/sa-2026-nfc.test.ts +40 -0
  143. package/src/__tests__/security.test.ts +786 -0
  144. package/src/accountability/engine.ts +230 -0
  145. package/src/accountability/types.ts +58 -0
  146. package/src/checkpoint/engine.ts +6 -2
  147. package/src/context/__tests__/caret-v0.2.0.test.ts +860 -0
  148. package/src/context/__tests__/integration.test.ts +356 -0
  149. package/src/context/compose.ts +388 -0
  150. package/src/context/crypto/hash.ts +277 -0
  151. package/src/context/crypto/hmac.ts +253 -0
  152. package/src/context/crypto/index.ts +29 -0
  153. package/src/context/engine-v3.0-backup.ts +598 -0
  154. package/src/context/engine.ts +2 -2
  155. package/src/context/fragment.ts +454 -0
  156. package/src/context/index.ts +427 -0
  157. package/src/context/provenance.ts +380 -0
  158. package/src/context/resolve.ts +581 -0
  159. package/src/context/store.ts +503 -0
  160. package/src/context/types.ts +679 -0
  161. package/src/context/utils/atomic.ts +207 -0
  162. package/src/context/utils/credit.ts +224 -0
  163. package/src/context/utils/index.ts +13 -0
  164. package/src/context/utils/utility.ts +200 -0
  165. package/src/core/commitment.ts +130 -68
  166. package/src/core/crypto.ts +13 -0
  167. package/src/index.ts +62 -10
  168. package/src/mcca/engine.ts +5 -4
  169. package/src/physics/engine.ts +42 -5
  170. package/src/provenance/api-handler.ts +248 -0
  171. package/src/provenance/api-types.ts +112 -0
  172. package/src/provenance/index.ts +19 -0
  173. package/src/provenance/provenance-engine.ts +387 -0
  174. package/src/provenance/types.ts +211 -0
  175. package/src/tee/engine.ts +16 -0
  176. package/src/warrant/engine.ts +89 -1
  177. package/src/zk/engine.ts +8 -4
  178. package/tsconfig.json +1 -1
@@ -18,9 +18,9 @@ import {
18
18
  hmacSeal,
19
19
  deriveKey,
20
20
  generateTimestamp,
21
- } from '../core/crypto';
21
+ } from '../core/crypto.js';
22
22
 
23
- import { Warrant, WarrantConstraints } from '../warrant/engine';
23
+ import { Warrant, WarrantConstraints } from '../warrant/engine.js';
24
24
 
25
25
  // ============================================================================
26
26
  // PHYSICS TYPES
@@ -289,6 +289,7 @@ export class PhysicsEngine {
289
289
 
290
290
  /**
291
291
  * Check a specific constraint
292
+ * P4 SECURITY: Explicit presence checks prevent trust escalation
292
293
  */
293
294
  private async checkConstraint(
294
295
  constraint: PhysicsConstraint,
@@ -298,8 +299,38 @@ export class PhysicsEngine {
298
299
  switch (constraint.type) {
299
300
  case 'max_amount': {
300
301
  const amount = action.params.amount as number | undefined;
301
- const limit = warrantConstraints.maxAmount ?? (constraint.params.limit as number);
302
-
302
+
303
+ // SA-2026-011: Explicit NaN and negative rejection
304
+ // NaN > X is always false in JS, bypassing maxAmount constraints.
305
+ // Negative amounts have no floor without explicit check.
306
+ if (amount !== undefined) {
307
+ if (typeof amount !== 'number' || isNaN(amount)) {
308
+ return {
309
+ type: 'amount_exceeded',
310
+ constraint,
311
+ message: 'Amount is not a valid number',
312
+ severity: 'block',
313
+ };
314
+ }
315
+ if (amount < 0) {
316
+ return {
317
+ type: 'amount_exceeded',
318
+ constraint,
319
+ message: 'Negative amounts are not permitted',
320
+ severity: 'block',
321
+ };
322
+ }
323
+ }
324
+
325
+ // P4 SECURITY: Explicit presence check - warrant must define maxAmount
326
+ // or policy default applies. Explicitly passing undefined is NOT the same
327
+ // as not having the constraint.
328
+ const hasWarrantLimit = Object.prototype.hasOwnProperty.call(warrantConstraints, 'maxAmount')
329
+ && warrantConstraints.maxAmount !== undefined;
330
+ const limit = hasWarrantLimit
331
+ ? warrantConstraints.maxAmount!
332
+ : (constraint.params.limit as number);
333
+
303
334
  if (amount !== undefined && amount > limit) {
304
335
  return {
305
336
  type: 'amount_exceeded',
@@ -313,7 +344,13 @@ export class PhysicsEngine {
313
344
 
314
345
  case 'domain_allowlist': {
315
346
  const domain = action.params.domain as string | undefined;
316
- const allowed = warrantConstraints.allowedDomains ?? (constraint.params.domains as string[]);
347
+
348
+ // P4 SECURITY: Same pattern - explicit presence check
349
+ const hasWarrantDomains = Object.prototype.hasOwnProperty.call(warrantConstraints, 'allowedDomains')
350
+ && warrantConstraints.allowedDomains !== undefined;
351
+ const allowed = hasWarrantDomains
352
+ ? warrantConstraints.allowedDomains!
353
+ : (constraint.params.domains as string[]);
317
354
 
318
355
  if (domain && allowed.length > 0 && !allowed.includes(domain)) {
319
356
  return {
@@ -0,0 +1,248 @@
1
+ /**
2
+ * mdash v3.1 - Provenance API Handler
3
+ *
4
+ * Wires HTTP request/response types to the ProvenanceEngine.
5
+ * This is the door: external parties call through here to
6
+ * attest, verify, and inspect model provenance.
7
+ */
8
+
9
+ import { ProvenanceEngine } from './provenance-engine.js';
10
+ import type {
11
+ AttestRequest,
12
+ AttestResponse,
13
+ VerifyRequest,
14
+ VerifyResponse,
15
+ ChainResponse,
16
+ } from './api-types.js';
17
+
18
+ export class ProvenanceApiHandler {
19
+ private engine: ProvenanceEngine;
20
+
21
+ constructor(engine: ProvenanceEngine) {
22
+ this.engine = engine;
23
+ }
24
+
25
+ /**
26
+ * Handle POST /provenance/attest
27
+ *
28
+ * Validates the request, creates the identity attestation,
29
+ * and returns the attestation ID and L1 hash.
30
+ */
31
+ async handleAttest(req: AttestRequest): Promise<{ status: number; body: AttestResponse }> {
32
+ // Validate required fields
33
+ const missing: string[] = [];
34
+ if (!req.model?.name) missing.push('model.name');
35
+ if (!req.model?.version) missing.push('model.version');
36
+ if (!req.model?.provider) missing.push('model.provider');
37
+ if (!req.deployment?.environment) missing.push('deployment.environment');
38
+
39
+ if (missing.length > 0) {
40
+ return {
41
+ status: 400,
42
+ body: {
43
+ attestationId: '',
44
+ l1Hash: '',
45
+ timestamp: '',
46
+ status: 'error',
47
+ error: `Missing required fields: ${missing.join(', ')}`,
48
+ },
49
+ };
50
+ }
51
+
52
+ // Check for duplicate (409)
53
+ const existing = this.engine.getIdentity(req.model.name, req.model.version);
54
+ if (existing) {
55
+ return {
56
+ status: 409,
57
+ body: {
58
+ attestationId: existing.id,
59
+ l1Hash: existing.attestation.l1Hash,
60
+ timestamp: existing.attestation.timestamp,
61
+ status: 'error',
62
+ error: `Attestation for ${req.model.name}:${req.model.version} already exists`,
63
+ },
64
+ };
65
+ }
66
+
67
+ try {
68
+ const constraints = {
69
+ safetyTier: req.constraints.safetyTier,
70
+ authorizedDomains: req.constraints.authorizedDomains,
71
+ excludedDomains: req.constraints.excludedDomains,
72
+ maxContextWindow: req.constraints.maxContextWindow,
73
+ reasoningEnabled: req.constraints.reasoningEnabled,
74
+ custom: req.constraints.custom || {},
75
+ };
76
+
77
+ const attestation = await this.engine.createIdentityAttestation(
78
+ req.model,
79
+ constraints,
80
+ req.deployment
81
+ );
82
+
83
+ return {
84
+ status: 201,
85
+ body: {
86
+ attestationId: attestation.id,
87
+ l1Hash: attestation.attestation.l1Hash,
88
+ timestamp: attestation.attestation.timestamp,
89
+ status: 'created',
90
+ },
91
+ };
92
+ } catch (err) {
93
+ return {
94
+ status: 500,
95
+ body: {
96
+ attestationId: '',
97
+ l1Hash: '',
98
+ timestamp: '',
99
+ status: 'error',
100
+ error: err instanceof Error ? err.message : 'Internal error',
101
+ },
102
+ };
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Handle POST /provenance/verify
108
+ *
109
+ * Validates the request, runs provenance verification,
110
+ * and returns the chain verdict with optional ZK proof.
111
+ */
112
+ async handleVerify(req: VerifyRequest): Promise<{ status: number; body: VerifyResponse }> {
113
+ if (!req.modelName) {
114
+ return {
115
+ status: 400,
116
+ body: {
117
+ status: 'error',
118
+ chain: { isComplete: false, confidence: 0, assessment: '', flags: [] },
119
+ timestamp: '',
120
+ responseHash: '',
121
+ error: 'Missing required field: modelName',
122
+ },
123
+ };
124
+ }
125
+
126
+ try {
127
+ const response = await this.engine.verifyProvenance({
128
+ queryType: req.queryType || 'full_chain',
129
+ modelName: req.modelName,
130
+ modelVersion: req.modelVersion,
131
+ timeWindow: req.timeWindow,
132
+ requireHardwareAttestation: req.requireHardwareAttestation || false,
133
+ generateZkProof: req.generateZkProof || false,
134
+ });
135
+
136
+ const isVerified = response.chain.verdict.isComplete;
137
+ const isPartial = !isVerified && response.chain.verdict.confidence > 0;
138
+ const httpStatus = isVerified ? 200 : (response.chain.verdict.flags.includes('no_identity') ? 404 : 200);
139
+
140
+ let verifyStatus: VerifyResponse['status'];
141
+ if (isVerified) {
142
+ verifyStatus = 'verified';
143
+ } else if (isPartial) {
144
+ verifyStatus = 'partial';
145
+ } else {
146
+ verifyStatus = 'unverified';
147
+ }
148
+
149
+ return {
150
+ status: httpStatus,
151
+ body: {
152
+ status: verifyStatus,
153
+ chain: {
154
+ isComplete: response.chain.verdict.isComplete,
155
+ confidence: response.chain.verdict.confidence,
156
+ assessment: response.chain.verdict.assessment,
157
+ flags: response.chain.verdict.flags,
158
+ },
159
+ zkProof: response.zkProof,
160
+ timestamp: response.timestamp,
161
+ responseHash: response.responseHash,
162
+ },
163
+ };
164
+ } catch (err) {
165
+ return {
166
+ status: 500,
167
+ body: {
168
+ status: 'error',
169
+ chain: { isComplete: false, confidence: 0, assessment: '', flags: [] },
170
+ timestamp: '',
171
+ responseHash: '',
172
+ error: err instanceof Error ? err.message : 'Internal error',
173
+ },
174
+ };
175
+ }
176
+ }
177
+
178
+ /**
179
+ * Handle GET /provenance/chain/:modelId
180
+ *
181
+ * Retrieves the full provenance chain for a model.
182
+ * modelId format: "name:version"
183
+ */
184
+ async handleGetChain(modelId: string): Promise<{ status: number; body: ChainResponse }> {
185
+ const [modelName, modelVersion] = modelId.split(':');
186
+
187
+ const chain = this.engine.getChain(modelName, modelVersion);
188
+ if (!chain) {
189
+ // Try verifying to build a minimal chain from identity
190
+ const identity = this.engine.getIdentity(modelName, modelVersion);
191
+ if (!identity) {
192
+ return {
193
+ status: 404,
194
+ body: {
195
+ modelId,
196
+ identity: { name: modelName || '', version: modelVersion || '', provider: '', attestedAt: '', l1Hash: '' },
197
+ warrants: { total: 0, active: 0, revoked: 0, chainHash: '' },
198
+ behavior: { totalSessions: 0, totalActions: 0, violations: 0 },
199
+ verdict: { isComplete: false, confidence: 0, assessment: 'Model not found', flags: ['no_identity'] },
200
+ chainAttestation: { l1Hash: '', timestamp: '' },
201
+ },
202
+ };
203
+ }
204
+
205
+ // Build minimal chain from identity alone
206
+ const minimalChain = await this.engine.buildProvenanceChain(identity, [], []);
207
+ return {
208
+ status: 200,
209
+ body: this.mapChainResponse(modelId, minimalChain),
210
+ };
211
+ }
212
+
213
+ return {
214
+ status: 200,
215
+ body: this.mapChainResponse(modelId, chain),
216
+ };
217
+ }
218
+
219
+ private mapChainResponse(
220
+ modelId: string,
221
+ chain: import('./types.js').ProvenanceChain
222
+ ): ChainResponse {
223
+ return {
224
+ modelId,
225
+ identity: {
226
+ name: chain.identity.model.name,
227
+ version: chain.identity.model.version,
228
+ provider: chain.identity.model.provider,
229
+ attestedAt: chain.identity.attestation.timestamp,
230
+ l1Hash: chain.identity.attestation.l1Hash,
231
+ },
232
+ warrants: {
233
+ total: chain.warrantHistory.totalWarrants,
234
+ active: chain.warrantHistory.activeWarrants,
235
+ revoked: chain.warrantHistory.revokedWarrants,
236
+ chainHash: chain.warrantHistory.warrantChainHash,
237
+ },
238
+ behavior: {
239
+ totalSessions: chain.behavioralRecord.totalSessions,
240
+ totalActions: chain.behavioralRecord.totalActions,
241
+ violations: chain.behavioralRecord.violations,
242
+ latestDriftScore: chain.behavioralRecord.latestDriftReport?.compositeScore,
243
+ },
244
+ verdict: chain.verdict,
245
+ chainAttestation: chain.chainAttestation,
246
+ };
247
+ }
248
+ }
@@ -0,0 +1,112 @@
1
+ /**
2
+ * mdash v3.1 - Provenance API Types
3
+ *
4
+ * HTTP request/response types for the provenance API surface.
5
+ * These types define the contract between external callers
6
+ * and the ProvenanceEngine.
7
+ */
8
+
9
+ /**
10
+ * POST /provenance/attest
11
+ * Called by model providers to register a model's identity.
12
+ */
13
+ export interface AttestRequest {
14
+ model: {
15
+ name: string;
16
+ version: string;
17
+ manifestHash?: string;
18
+ provider: string;
19
+ };
20
+ constraints: {
21
+ safetyTier: string;
22
+ authorizedDomains: string[];
23
+ excludedDomains: string[];
24
+ maxContextWindow: number;
25
+ reasoningEnabled: boolean;
26
+ custom?: Record<string, string | number | boolean>;
27
+ };
28
+ deployment: {
29
+ environment: string;
30
+ region?: string;
31
+ tenantId?: string;
32
+ };
33
+ }
34
+
35
+ export interface AttestResponse {
36
+ attestationId: string;
37
+ l1Hash: string;
38
+ timestamp: string;
39
+ status: 'created' | 'error';
40
+ error?: string;
41
+ }
42
+
43
+ /**
44
+ * POST /provenance/verify
45
+ * Called by verifiers to check a model's provenance.
46
+ */
47
+ export interface VerifyRequest {
48
+ modelName: string;
49
+ modelVersion?: string;
50
+ queryType: 'identity' | 'constraints' | 'behavior' | 'full_chain';
51
+ timeWindow?: {
52
+ start: string;
53
+ end: string;
54
+ };
55
+ requireHardwareAttestation?: boolean;
56
+ generateZkProof?: boolean;
57
+ }
58
+
59
+ export interface VerifyResponse {
60
+ status: 'verified' | 'unverified' | 'partial' | 'error';
61
+ chain: {
62
+ isComplete: boolean;
63
+ confidence: number;
64
+ assessment: string;
65
+ flags: string[];
66
+ };
67
+ zkProof?: {
68
+ claim: string;
69
+ proof: string;
70
+ verificationKey: string;
71
+ };
72
+ timestamp: string;
73
+ responseHash: string;
74
+ error?: string;
75
+ }
76
+
77
+ /**
78
+ * GET /provenance/chain/:modelId
79
+ * Called by regulators to retrieve the full provenance chain.
80
+ */
81
+ export interface ChainResponse {
82
+ modelId: string;
83
+ identity: {
84
+ name: string;
85
+ version: string;
86
+ provider: string;
87
+ attestedAt: string;
88
+ l1Hash: string;
89
+ };
90
+ warrants: {
91
+ total: number;
92
+ active: number;
93
+ revoked: number;
94
+ chainHash: string;
95
+ };
96
+ behavior: {
97
+ totalSessions: number;
98
+ totalActions: number;
99
+ violations: number;
100
+ latestDriftScore?: number;
101
+ };
102
+ verdict: {
103
+ isComplete: boolean;
104
+ confidence: number;
105
+ assessment: string;
106
+ flags: string[];
107
+ };
108
+ chainAttestation: {
109
+ l1Hash: string;
110
+ timestamp: string;
111
+ };
112
+ }
@@ -0,0 +1,19 @@
1
+ export type {
2
+ ModelIdentityAttestation,
3
+ ProvenanceChain,
4
+ ProvenanceQuery,
5
+ ProvenanceResponse,
6
+ GlossEntry,
7
+ } from './types.js';
8
+
9
+ export { ProvenanceEngine } from './provenance-engine.js';
10
+ export type { DriftReportInput } from './provenance-engine.js';
11
+
12
+ export { ProvenanceApiHandler } from './api-handler.js';
13
+ export type {
14
+ AttestRequest,
15
+ AttestResponse,
16
+ VerifyRequest,
17
+ VerifyResponse,
18
+ ChainResponse,
19
+ } from './api-types.js';