@xproof/xproof 0.1.8 → 0.1.9
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/dist/{client-CWrki-T_.d.mts → client-Dq5Be9On.d.mts} +39 -1
- package/dist/{client-CWrki-T_.d.ts → client-Dq5Be9On.d.ts} +39 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +95 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -5
- package/dist/index.mjs.map +1 -1
- package/dist/integrations/vercel.d.mts +1 -1
- package/dist/integrations/vercel.d.ts +1 -1
- package/dist/integrations/vercel.js +93 -5
- package/dist/integrations/vercel.js.map +1 -1
- package/dist/integrations/vercel.mjs +93 -5
- package/dist/integrations/vercel.mjs.map +1 -1
- package/package.json +10 -11
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
type JurisdictionType = "instruction_following" | "autonomous_inference" | "human_approved";
|
|
2
|
+
/**
|
|
3
|
+
* All valid `JurisdictionType` values — useful for runtime validation.
|
|
4
|
+
*
|
|
5
|
+
* - `instruction_following` — agent executed an explicit human instruction;
|
|
6
|
+
* accountability follows the principal.
|
|
7
|
+
* - `autonomous_inference` — agent reached its own conclusion; agent and its
|
|
8
|
+
* operator bear primary accountability.
|
|
9
|
+
* - `human_approved` — agent recommended, human approved; shared accountability.
|
|
10
|
+
*/
|
|
11
|
+
declare const JURISDICTION_TYPES: readonly JurisdictionType[];
|
|
12
|
+
/**
|
|
13
|
+
* Decomposed decision timeline for forensic audit.
|
|
14
|
+
*
|
|
15
|
+
* Pass a `TimingBreakdown` to `certifyWithConfidence()` via `confidence.timing`
|
|
16
|
+
* to anchor the full decision chronology on-chain.
|
|
17
|
+
*
|
|
18
|
+
* All timestamp fields are optional ISO8601 strings with a timezone offset
|
|
19
|
+
* (e.g. `"2026-04-20T14:31:58Z"`).
|
|
20
|
+
*
|
|
21
|
+
* When read back from the API the server populates two computed fields:
|
|
22
|
+
* - `reasoningDurationMs` — ms between `reasoningStartedAt` and `actionTakenAt`
|
|
23
|
+
* - `totalDurationMs` — ms between `instructionReceivedAt` and `actionTakenAt`
|
|
24
|
+
*/
|
|
25
|
+
interface TimingBreakdown {
|
|
26
|
+
instructionReceivedAt?: string;
|
|
27
|
+
reasoningStartedAt?: string;
|
|
28
|
+
actionTakenAt?: string;
|
|
29
|
+
jurisdictionType?: JurisdictionType;
|
|
30
|
+
/** Computed by server; present in API responses only. */
|
|
31
|
+
reasoningDurationMs?: number;
|
|
32
|
+
/** Computed by server; present in API responses only. */
|
|
33
|
+
totalDurationMs?: number;
|
|
34
|
+
}
|
|
1
35
|
interface Certification {
|
|
2
36
|
id: string;
|
|
3
37
|
fileName: string;
|
|
@@ -10,6 +44,7 @@ interface Certification {
|
|
|
10
44
|
isPublic: boolean;
|
|
11
45
|
certificateUrl: string;
|
|
12
46
|
verifyUrl: string;
|
|
47
|
+
timingBreakdown?: TimingBreakdown;
|
|
13
48
|
}
|
|
14
49
|
interface BatchResultSummary {
|
|
15
50
|
total: number;
|
|
@@ -68,6 +103,8 @@ interface ConfidenceOptions {
|
|
|
68
103
|
thresholdStage: ThresholdStage;
|
|
69
104
|
decisionId: string;
|
|
70
105
|
reversibilityClass?: ReversibilityClass;
|
|
106
|
+
/** Optional timing breakdown to anchor the full decision chronology on-chain. */
|
|
107
|
+
timing?: TimingBreakdown;
|
|
71
108
|
}
|
|
72
109
|
interface ConfidenceTrailStage {
|
|
73
110
|
proofId: string;
|
|
@@ -125,6 +162,7 @@ interface BatchFileEntry {
|
|
|
125
162
|
fileName?: string;
|
|
126
163
|
author?: string;
|
|
127
164
|
metadata?: Record<string, unknown>;
|
|
165
|
+
timing?: TimingBreakdown;
|
|
128
166
|
}
|
|
129
167
|
interface XProofClientOptions {
|
|
130
168
|
apiKey?: string;
|
|
@@ -189,4 +227,4 @@ declare class XProofClient {
|
|
|
189
227
|
private handleError;
|
|
190
228
|
}
|
|
191
229
|
|
|
192
|
-
export { type BatchFileEntry as B, type Certification as C, type ExecutionContext as E, type FourWOptions as F, type PolicyCheckResult as P, type RegistrationResult as R, type ThresholdStage as T, XProofClient as X, type BatchResult as a, type BatchResultSummary as b, type CertifyHashOptions as c, type ConfidenceOptions as d, type ConfidenceTrail as e, type ConfidenceTrailDrift as f, type ConfidenceTrailStage as g, type ContextDrift as h, type ContextDriftStage as i, type
|
|
230
|
+
export { type BatchFileEntry as B, type Certification as C, type ExecutionContext as E, type FourWOptions as F, JURISDICTION_TYPES as J, type PolicyCheckResult as P, type RegistrationResult as R, type ThresholdStage as T, XProofClient as X, type BatchResult as a, type BatchResultSummary as b, type CertifyHashOptions as c, type ConfidenceOptions as d, type ConfidenceTrail as e, type ConfidenceTrailDrift as f, type ConfidenceTrailStage as g, type ContextDrift as h, type ContextDriftStage as i, type JurisdictionType as j, type PolicyViolation as k, type PricingInfo as l, type PricingTier as m, type ReversibilityClass as n, type TimingBreakdown as o, type TrialInfo as p, type XProofClientOptions as q };
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
+
type JurisdictionType = "instruction_following" | "autonomous_inference" | "human_approved";
|
|
2
|
+
/**
|
|
3
|
+
* All valid `JurisdictionType` values — useful for runtime validation.
|
|
4
|
+
*
|
|
5
|
+
* - `instruction_following` — agent executed an explicit human instruction;
|
|
6
|
+
* accountability follows the principal.
|
|
7
|
+
* - `autonomous_inference` — agent reached its own conclusion; agent and its
|
|
8
|
+
* operator bear primary accountability.
|
|
9
|
+
* - `human_approved` — agent recommended, human approved; shared accountability.
|
|
10
|
+
*/
|
|
11
|
+
declare const JURISDICTION_TYPES: readonly JurisdictionType[];
|
|
12
|
+
/**
|
|
13
|
+
* Decomposed decision timeline for forensic audit.
|
|
14
|
+
*
|
|
15
|
+
* Pass a `TimingBreakdown` to `certifyWithConfidence()` via `confidence.timing`
|
|
16
|
+
* to anchor the full decision chronology on-chain.
|
|
17
|
+
*
|
|
18
|
+
* All timestamp fields are optional ISO8601 strings with a timezone offset
|
|
19
|
+
* (e.g. `"2026-04-20T14:31:58Z"`).
|
|
20
|
+
*
|
|
21
|
+
* When read back from the API the server populates two computed fields:
|
|
22
|
+
* - `reasoningDurationMs` — ms between `reasoningStartedAt` and `actionTakenAt`
|
|
23
|
+
* - `totalDurationMs` — ms between `instructionReceivedAt` and `actionTakenAt`
|
|
24
|
+
*/
|
|
25
|
+
interface TimingBreakdown {
|
|
26
|
+
instructionReceivedAt?: string;
|
|
27
|
+
reasoningStartedAt?: string;
|
|
28
|
+
actionTakenAt?: string;
|
|
29
|
+
jurisdictionType?: JurisdictionType;
|
|
30
|
+
/** Computed by server; present in API responses only. */
|
|
31
|
+
reasoningDurationMs?: number;
|
|
32
|
+
/** Computed by server; present in API responses only. */
|
|
33
|
+
totalDurationMs?: number;
|
|
34
|
+
}
|
|
1
35
|
interface Certification {
|
|
2
36
|
id: string;
|
|
3
37
|
fileName: string;
|
|
@@ -10,6 +44,7 @@ interface Certification {
|
|
|
10
44
|
isPublic: boolean;
|
|
11
45
|
certificateUrl: string;
|
|
12
46
|
verifyUrl: string;
|
|
47
|
+
timingBreakdown?: TimingBreakdown;
|
|
13
48
|
}
|
|
14
49
|
interface BatchResultSummary {
|
|
15
50
|
total: number;
|
|
@@ -68,6 +103,8 @@ interface ConfidenceOptions {
|
|
|
68
103
|
thresholdStage: ThresholdStage;
|
|
69
104
|
decisionId: string;
|
|
70
105
|
reversibilityClass?: ReversibilityClass;
|
|
106
|
+
/** Optional timing breakdown to anchor the full decision chronology on-chain. */
|
|
107
|
+
timing?: TimingBreakdown;
|
|
71
108
|
}
|
|
72
109
|
interface ConfidenceTrailStage {
|
|
73
110
|
proofId: string;
|
|
@@ -125,6 +162,7 @@ interface BatchFileEntry {
|
|
|
125
162
|
fileName?: string;
|
|
126
163
|
author?: string;
|
|
127
164
|
metadata?: Record<string, unknown>;
|
|
165
|
+
timing?: TimingBreakdown;
|
|
128
166
|
}
|
|
129
167
|
interface XProofClientOptions {
|
|
130
168
|
apiKey?: string;
|
|
@@ -189,4 +227,4 @@ declare class XProofClient {
|
|
|
189
227
|
private handleError;
|
|
190
228
|
}
|
|
191
229
|
|
|
192
|
-
export { type BatchFileEntry as B, type Certification as C, type ExecutionContext as E, type FourWOptions as F, type PolicyCheckResult as P, type RegistrationResult as R, type ThresholdStage as T, XProofClient as X, type BatchResult as a, type BatchResultSummary as b, type CertifyHashOptions as c, type ConfidenceOptions as d, type ConfidenceTrail as e, type ConfidenceTrailDrift as f, type ConfidenceTrailStage as g, type ContextDrift as h, type ContextDriftStage as i, type
|
|
230
|
+
export { type BatchFileEntry as B, type Certification as C, type ExecutionContext as E, type FourWOptions as F, JURISDICTION_TYPES as J, type PolicyCheckResult as P, type RegistrationResult as R, type ThresholdStage as T, XProofClient as X, type BatchResult as a, type BatchResultSummary as b, type CertifyHashOptions as c, type ConfidenceOptions as d, type ConfidenceTrail as e, type ConfidenceTrailDrift as f, type ConfidenceTrailStage as g, type ContextDrift as h, type ContextDriftStage as i, type JurisdictionType as j, type PolicyViolation as k, type PricingInfo as l, type PricingTier as m, type ReversibilityClass as n, type TimingBreakdown as o, type TrialInfo as p, type XProofClientOptions as q };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BatchFileEntry, a as BatchResult, b as BatchResultSummary, C as Certification, c as CertifyHashOptions, d as ConfidenceOptions, e as ConfidenceTrail, f as ConfidenceTrailDrift, g as ConfidenceTrailStage, h as ContextDrift, i as ContextDriftStage, E as ExecutionContext, F as FourWOptions, P as PolicyCheckResult,
|
|
1
|
+
export { B as BatchFileEntry, a as BatchResult, b as BatchResultSummary, C as Certification, c as CertifyHashOptions, d as ConfidenceOptions, e as ConfidenceTrail, f as ConfidenceTrailDrift, g as ConfidenceTrailStage, h as ContextDrift, i as ContextDriftStage, E as ExecutionContext, F as FourWOptions, J as JURISDICTION_TYPES, j as JurisdictionType, P as PolicyCheckResult, k as PolicyViolation, l as PricingInfo, m as PricingTier, R as RegistrationResult, n as ReversibilityClass, T as ThresholdStage, o as TimingBreakdown, p as TrialInfo, X as XProofClient, q as XProofClientOptions } from './client-Dq5Be9On.mjs';
|
|
2
2
|
|
|
3
3
|
declare class XProofError extends Error {
|
|
4
4
|
statusCode: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BatchFileEntry, a as BatchResult, b as BatchResultSummary, C as Certification, c as CertifyHashOptions, d as ConfidenceOptions, e as ConfidenceTrail, f as ConfidenceTrailDrift, g as ConfidenceTrailStage, h as ContextDrift, i as ContextDriftStage, E as ExecutionContext, F as FourWOptions, P as PolicyCheckResult,
|
|
1
|
+
export { B as BatchFileEntry, a as BatchResult, b as BatchResultSummary, C as Certification, c as CertifyHashOptions, d as ConfidenceOptions, e as ConfidenceTrail, f as ConfidenceTrailDrift, g as ConfidenceTrailStage, h as ContextDrift, i as ContextDriftStage, E as ExecutionContext, F as FourWOptions, J as JURISDICTION_TYPES, j as JurisdictionType, P as PolicyCheckResult, k as PolicyViolation, l as PricingInfo, m as PricingTier, R as RegistrationResult, n as ReversibilityClass, T as ThresholdStage, o as TimingBreakdown, p as TrialInfo, X as XProofClient, q as XProofClientOptions } from './client-Dq5Be9On.js';
|
|
2
2
|
|
|
3
3
|
declare class XProofError extends Error {
|
|
4
4
|
statusCode: number;
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
AuthenticationError: () => AuthenticationError,
|
|
24
24
|
ConflictError: () => ConflictError,
|
|
25
|
+
JURISDICTION_TYPES: () => JURISDICTION_TYPES,
|
|
25
26
|
NotFoundError: () => NotFoundError,
|
|
26
27
|
RateLimitError: () => RateLimitError,
|
|
27
28
|
ServerError: () => ServerError,
|
|
@@ -99,8 +100,47 @@ function hashString(data) {
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
// src/parse.ts
|
|
103
|
+
function parseTimingBreakdown(raw) {
|
|
104
|
+
const tb = {};
|
|
105
|
+
let hasAnyField = false;
|
|
106
|
+
if (raw.instruction_received_at != null) {
|
|
107
|
+
tb.instructionReceivedAt = raw.instruction_received_at;
|
|
108
|
+
hasAnyField = true;
|
|
109
|
+
}
|
|
110
|
+
if (raw.reasoning_started_at != null) {
|
|
111
|
+
tb.reasoningStartedAt = raw.reasoning_started_at;
|
|
112
|
+
hasAnyField = true;
|
|
113
|
+
}
|
|
114
|
+
if (raw.action_taken_at != null) {
|
|
115
|
+
tb.actionTakenAt = raw.action_taken_at;
|
|
116
|
+
hasAnyField = true;
|
|
117
|
+
}
|
|
118
|
+
if (raw.jurisdiction_type != null) {
|
|
119
|
+
tb.jurisdictionType = raw.jurisdiction_type;
|
|
120
|
+
hasAnyField = true;
|
|
121
|
+
}
|
|
122
|
+
if (raw.reasoning_duration_ms != null) {
|
|
123
|
+
tb.reasoningDurationMs = raw.reasoning_duration_ms;
|
|
124
|
+
hasAnyField = true;
|
|
125
|
+
}
|
|
126
|
+
if (raw.total_duration_ms != null) {
|
|
127
|
+
tb.totalDurationMs = raw.total_duration_ms;
|
|
128
|
+
hasAnyField = true;
|
|
129
|
+
}
|
|
130
|
+
return hasAnyField ? tb : void 0;
|
|
131
|
+
}
|
|
102
132
|
function parseCertification(data) {
|
|
103
133
|
const blockchain = data.blockchain || {};
|
|
134
|
+
const _meta = data.metadata;
|
|
135
|
+
const _TIMING_KEYS = [
|
|
136
|
+
"instruction_received_at",
|
|
137
|
+
"reasoning_started_at",
|
|
138
|
+
"action_taken_at",
|
|
139
|
+
"jurisdiction_type",
|
|
140
|
+
"reasoning_duration_ms",
|
|
141
|
+
"total_duration_ms"
|
|
142
|
+
];
|
|
143
|
+
const rawTiming = data.timing_breakdown ?? _meta?.timing_breakdown ?? (_meta && _TIMING_KEYS.some((k) => _meta[k] != null) ? _meta : void 0);
|
|
104
144
|
return {
|
|
105
145
|
id: data.id || data.proof_id || "",
|
|
106
146
|
fileName: data.fileName || data.filename || data.file_name || "",
|
|
@@ -112,7 +152,8 @@ function parseCertification(data) {
|
|
|
112
152
|
blockchainStatus: data.blockchainStatus || data.status || "",
|
|
113
153
|
isPublic: data.isPublic !== void 0 ? !!data.isPublic : data.is_public !== void 0 ? !!data.is_public : true,
|
|
114
154
|
certificateUrl: data.certificateUrl || data.certificate_url || "",
|
|
115
|
-
verifyUrl: data.verifyUrl || data.verify_url || ""
|
|
155
|
+
verifyUrl: data.verifyUrl || data.verify_url || "",
|
|
156
|
+
timingBreakdown: rawTiming ? parseTimingBreakdown(rawTiming) : void 0
|
|
116
157
|
};
|
|
117
158
|
}
|
|
118
159
|
function parseBatchResult(data) {
|
|
@@ -170,8 +211,15 @@ function parseRegistrationResult(data) {
|
|
|
170
211
|
};
|
|
171
212
|
}
|
|
172
213
|
|
|
214
|
+
// src/types.ts
|
|
215
|
+
var JURISDICTION_TYPES = [
|
|
216
|
+
"instruction_following",
|
|
217
|
+
"autonomous_inference",
|
|
218
|
+
"human_approved"
|
|
219
|
+
];
|
|
220
|
+
|
|
173
221
|
// src/client.ts
|
|
174
|
-
var VERSION = "0.1.
|
|
222
|
+
var VERSION = "0.1.9";
|
|
175
223
|
var DEFAULT_BASE_URL = "https://xproof.app";
|
|
176
224
|
var DEFAULT_TIMEOUT = 3e4;
|
|
177
225
|
var XProofClient = class _XProofClient {
|
|
@@ -231,7 +279,25 @@ var XProofClient = class _XProofClient {
|
|
|
231
279
|
filename: f.fileName ?? "unknown",
|
|
232
280
|
file_hash: f.fileHash
|
|
233
281
|
};
|
|
234
|
-
|
|
282
|
+
const entryMeta = f.metadata ? { ...f.metadata } : {};
|
|
283
|
+
if (f.timing !== void 0) {
|
|
284
|
+
const t = f.timing;
|
|
285
|
+
if (t.jurisdictionType !== void 0 && !JURISDICTION_TYPES.includes(t.jurisdictionType)) {
|
|
286
|
+
throw new ValidationError(
|
|
287
|
+
`timing.jurisdictionType must be one of: ${JURISDICTION_TYPES.join(", ")}`,
|
|
288
|
+
{}
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
if (t.instructionReceivedAt !== void 0)
|
|
292
|
+
entryMeta.instruction_received_at = t.instructionReceivedAt;
|
|
293
|
+
if (t.reasoningStartedAt !== void 0)
|
|
294
|
+
entryMeta.reasoning_started_at = t.reasoningStartedAt;
|
|
295
|
+
if (t.actionTakenAt !== void 0)
|
|
296
|
+
entryMeta.action_taken_at = t.actionTakenAt;
|
|
297
|
+
if (t.jurisdictionType !== void 0)
|
|
298
|
+
entryMeta.jurisdiction_type = t.jurisdictionType;
|
|
299
|
+
}
|
|
300
|
+
if (Object.keys(entryMeta).length > 0) entry.metadata = entryMeta;
|
|
235
301
|
return entry;
|
|
236
302
|
});
|
|
237
303
|
const payload = { files: entries };
|
|
@@ -241,13 +307,13 @@ var XProofClient = class _XProofClient {
|
|
|
241
307
|
return parseBatchResult(data);
|
|
242
308
|
}
|
|
243
309
|
async verify(proofId) {
|
|
244
|
-
const data = await this.request("GET", `/api/proof/${proofId}`, {
|
|
310
|
+
const data = await this.request("GET", `/api/proof/${encodeURIComponent(proofId)}`, {
|
|
245
311
|
authRequired: false
|
|
246
312
|
});
|
|
247
313
|
return parseCertification(data);
|
|
248
314
|
}
|
|
249
315
|
async verifyHash(fileHash) {
|
|
250
|
-
const data = await this.request("GET", `/api/proof/hash/${fileHash}`, {
|
|
316
|
+
const data = await this.request("GET", `/api/proof/hash/${encodeURIComponent(fileHash)}`, {
|
|
251
317
|
authRequired: false
|
|
252
318
|
});
|
|
253
319
|
return parseCertification(data);
|
|
@@ -275,6 +341,23 @@ var XProofClient = class _XProofClient {
|
|
|
275
341
|
metadata.decision_id = confidence.decisionId;
|
|
276
342
|
if (confidence.reversibilityClass !== void 0)
|
|
277
343
|
metadata.reversibility_class = confidence.reversibilityClass;
|
|
344
|
+
if (confidence.timing !== void 0) {
|
|
345
|
+
const t = confidence.timing;
|
|
346
|
+
if (t.jurisdictionType !== void 0 && !JURISDICTION_TYPES.includes(t.jurisdictionType)) {
|
|
347
|
+
throw new ValidationError(
|
|
348
|
+
`timing.jurisdictionType must be one of: ${JURISDICTION_TYPES.join(", ")}`,
|
|
349
|
+
{}
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
if (t.instructionReceivedAt !== void 0)
|
|
353
|
+
metadata.instruction_received_at = t.instructionReceivedAt;
|
|
354
|
+
if (t.reasoningStartedAt !== void 0)
|
|
355
|
+
metadata.reasoning_started_at = t.reasoningStartedAt;
|
|
356
|
+
if (t.actionTakenAt !== void 0)
|
|
357
|
+
metadata.action_taken_at = t.actionTakenAt;
|
|
358
|
+
if (t.jurisdictionType !== void 0)
|
|
359
|
+
metadata.jurisdiction_type = t.jurisdictionType;
|
|
360
|
+
}
|
|
278
361
|
const payload = {
|
|
279
362
|
filename: fileName,
|
|
280
363
|
file_hash: fileHash,
|
|
@@ -285,6 +368,9 @@ var XProofClient = class _XProofClient {
|
|
|
285
368
|
return parseCertification(data);
|
|
286
369
|
}
|
|
287
370
|
async getConfidenceTrail(decisionId) {
|
|
371
|
+
if (!decisionId || !decisionId.trim()) {
|
|
372
|
+
throw new ValidationError("decisionId is required", {});
|
|
373
|
+
}
|
|
288
374
|
const data = await this.request(
|
|
289
375
|
"GET",
|
|
290
376
|
`/api/confidence-trail/${encodeURIComponent(decisionId)}`,
|
|
@@ -338,6 +424,9 @@ var XProofClient = class _XProofClient {
|
|
|
338
424
|
};
|
|
339
425
|
}
|
|
340
426
|
async getContextDrift(decisionId) {
|
|
427
|
+
if (!decisionId || !decisionId.trim()) {
|
|
428
|
+
throw new ValidationError("decisionId is required", {});
|
|
429
|
+
}
|
|
341
430
|
const data = await this.request(
|
|
342
431
|
"GET",
|
|
343
432
|
`/api/context-drift/${encodeURIComponent(decisionId)}`,
|
|
@@ -491,6 +580,7 @@ var XProofClient = class _XProofClient {
|
|
|
491
580
|
0 && (module.exports = {
|
|
492
581
|
AuthenticationError,
|
|
493
582
|
ConflictError,
|
|
583
|
+
JURISDICTION_TYPES,
|
|
494
584
|
NotFoundError,
|
|
495
585
|
RateLimitError,
|
|
496
586
|
ServerError,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/errors.ts","../src/hash.ts","../src/parse.ts"],"sourcesContent":["export { XProofClient } from \"./client.js\";\nexport {\n XProofError,\n AuthenticationError,\n ValidationError,\n NotFoundError,\n ConflictError,\n RateLimitError,\n ServerError,\n} from \"./errors.js\";\nexport type {\n Certification,\n BatchResult,\n BatchResultSummary,\n PricingInfo,\n PricingTier,\n RegistrationResult,\n TrialInfo,\n FourWOptions,\n CertifyHashOptions,\n BatchFileEntry,\n XProofClientOptions,\n ThresholdStage,\n ReversibilityClass,\n ConfidenceOptions,\n ConfidenceTrail,\n ConfidenceTrailStage,\n ConfidenceTrailDrift,\n PolicyViolation,\n PolicyCheckResult,\n ExecutionContext,\n ContextDriftStage,\n ContextDrift,\n} from \"./types.js\";\nexport { hashFile, hashBuffer, hashString } from \"./hash.js\";\n","import { basename } from \"path\";\nimport {\n XProofError,\n AuthenticationError,\n ValidationError,\n NotFoundError,\n ConflictError,\n RateLimitError,\n ServerError,\n} from \"./errors.js\";\nimport { hashFile } from \"./hash.js\";\nimport {\n parseCertification,\n parseBatchResult,\n parsePricingInfo,\n parseRegistrationResult,\n} from \"./parse.js\";\nimport type {\n Certification,\n BatchResult,\n PricingInfo,\n RegistrationResult,\n FourWOptions,\n BatchFileEntry,\n XProofClientOptions,\n ConfidenceOptions,\n ConfidenceTrail,\n ConfidenceTrailStage,\n ConfidenceTrailDrift,\n ContextDrift,\n ContextDriftStage,\n ExecutionContext,\n PolicyViolation,\n PolicyCheckResult,\n ReversibilityClass,\n} from \"./types.js\";\n\nconst VERSION = \"0.1.7\";\nconst DEFAULT_BASE_URL = \"https://xproof.app\";\nconst DEFAULT_TIMEOUT = 30_000;\n\nexport class XProofClient {\n private apiKey: string;\n private baseUrl: string;\n private timeout: number;\n\n registration: RegistrationResult | null = null;\n\n constructor(options: XProofClientOptions = {}) {\n this.apiKey = options.apiKey ?? \"\";\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n }\n\n static async register(\n agentName: string,\n options: Omit<XProofClientOptions, \"apiKey\"> = {}\n ): Promise<XProofClient> {\n const temp = new XProofClient(options);\n const data = await temp.request(\"POST\", \"/api/agent/register\", {\n body: { agent_name: agentName },\n authRequired: false,\n });\n const result = parseRegistrationResult(data);\n const client = new XProofClient({\n ...options,\n apiKey: result.apiKey,\n });\n client.registration = result;\n return client;\n }\n\n async certify(\n path: string,\n author: string,\n fileName?: string,\n fourW?: FourWOptions\n ): Promise<Certification> {\n this.requireAuth();\n const fileHash = await hashFile(path);\n const resolvedName = fileName ?? basename(path);\n return this.certifyHash(fileHash, resolvedName, author, fourW);\n }\n\n async certifyHash(\n fileHash: string,\n fileName: string,\n author: string,\n fourW?: FourWOptions\n ): Promise<Certification> {\n this.requireAuth();\n\n const metadata: Record<string, unknown> = fourW?.metadata\n ? { ...fourW.metadata }\n : {};\n if (fourW?.who !== undefined) metadata.who = fourW.who;\n if (fourW?.what !== undefined) metadata.what = fourW.what;\n if (fourW?.when !== undefined) metadata.when = fourW.when;\n if (fourW?.why !== undefined) metadata.why = fourW.why;\n if (fourW?.reversibilityClass !== undefined)\n metadata.reversibility_class = fourW.reversibilityClass;\n\n const payload: Record<string, unknown> = {\n filename: fileName,\n file_hash: fileHash,\n author_name: author,\n };\n if (Object.keys(metadata).length > 0) {\n payload.metadata = metadata;\n }\n\n const data = await this.request(\"POST\", \"/api/proof\", { body: payload });\n return parseCertification(data);\n }\n\n async batchCertify(files: BatchFileEntry[]): Promise<BatchResult> {\n this.requireAuth();\n\n if (files.length > 50) {\n throw new Error(\"Batch certification supports a maximum of 50 files\");\n }\n\n const entries = files.map((f) => {\n const entry: Record<string, unknown> = {\n filename: f.fileName ?? \"unknown\",\n file_hash: f.fileHash,\n };\n if (f.metadata) entry.metadata = f.metadata;\n return entry;\n });\n\n const payload: Record<string, unknown> = { files: entries };\n const author = files.find((f) => f.author)?.author;\n if (author) payload.author_name = author;\n\n const data = await this.request(\"POST\", \"/api/batch\", { body: payload });\n return parseBatchResult(data);\n }\n\n async verify(proofId: string): Promise<Certification> {\n const data = await this.request(\"GET\", `/api/proof/${proofId}`, {\n authRequired: false,\n });\n return parseCertification(data);\n }\n\n async verifyHash(fileHash: string): Promise<Certification> {\n const data = await this.request(\"GET\", `/api/proof/hash/${fileHash}`, {\n authRequired: false,\n });\n return parseCertification(data);\n }\n\n async certifyWithConfidence(\n fileHash: string,\n fileName: string,\n author: string,\n confidence: ConfidenceOptions,\n fourW?: FourWOptions\n ): Promise<Certification> {\n this.requireAuth();\n\n if (confidence.confidenceLevel < 0 || confidence.confidenceLevel > 1) {\n throw new ValidationError(\n \"confidenceLevel must be between 0.0 and 1.0\",\n {}\n );\n }\n if (!confidence.decisionId || confidence.decisionId.trim().length === 0) {\n throw new ValidationError(\"decisionId is required\", {});\n }\n\n const metadata: Record<string, unknown> = fourW?.metadata\n ? { ...fourW.metadata }\n : {};\n if (fourW?.who !== undefined) metadata.who = fourW.who;\n if (fourW?.what !== undefined) metadata.what = fourW.what;\n if (fourW?.when !== undefined) metadata.when = fourW.when;\n if (fourW?.why !== undefined) metadata.why = fourW.why;\n if (fourW?.reversibilityClass !== undefined)\n metadata.reversibility_class = fourW.reversibilityClass;\n\n metadata.confidence_level = confidence.confidenceLevel;\n metadata.threshold_stage = confidence.thresholdStage;\n metadata.decision_id = confidence.decisionId;\n // confidence.reversibilityClass takes priority over fourW.reversibilityClass\n if (confidence.reversibilityClass !== undefined)\n metadata.reversibility_class = confidence.reversibilityClass;\n\n const payload: Record<string, unknown> = {\n filename: fileName,\n file_hash: fileHash,\n author_name: author,\n metadata,\n };\n\n const data = await this.request(\"POST\", \"/api/proof\", { body: payload });\n return parseCertification(data);\n }\n\n async getConfidenceTrail(decisionId: string): Promise<ConfidenceTrail> {\n const data = await this.request(\n \"GET\",\n `/api/confidence-trail/${encodeURIComponent(decisionId)}`,\n { authRequired: false }\n );\n\n const rawStages = (data.stages as any[]) || [];\n const stages: ConfidenceTrailStage[] = rawStages.map((s: any) => ({\n proofId: s.proof_id || \"\",\n fileName: s.file_name || \"\",\n fileHash: s.file_hash || \"\",\n confidenceLevel: s.confidence_level ?? null,\n thresholdStage: s.threshold_stage ?? null,\n reversibilityClass: (s.metadata?.reversibility_class ?? null) as ReversibilityClass | null,\n author: s.author || \"\",\n blockchain: {\n transactionHash: s.blockchain?.transaction_hash || \"\",\n explorerUrl: s.blockchain?.explorer_url || \"\",\n status: s.blockchain?.status || \"\",\n },\n anchoredAt: s.anchored_at || \"\",\n metadata: s.metadata || {},\n }));\n\n const rawDrift = data.context_drift as any;\n const contextDrift: ConfidenceTrailDrift | null = rawDrift\n ? {\n contextCoherent: rawDrift.context_coherent ?? true,\n driftScore: rawDrift.drift_score ?? 0,\n fieldsMonitored: rawDrift.fields_monitored || [],\n fieldsDrifted: rawDrift.fields_drifted || [],\n fieldsStable: rawDrift.fields_stable || [],\n fieldsAbsent: rawDrift.fields_absent || [],\n }\n : null;\n\n const rawViolations = (data.policy_violations as any[]) || [];\n const policyViolations: PolicyViolation[] = rawViolations.map((v: any) => ({\n proofId: v.proof_id || \"\",\n confidenceLevel: v.confidence_level ?? null,\n reversibilityClass: v.reversibility_class as ReversibilityClass,\n thresholdStage: v.threshold_stage ?? null,\n threshold: v.threshold ?? 0.95,\n rule: v.rule || \"\",\n }));\n\n return {\n decisionId: (data.decision_id as string) || decisionId,\n totalAnchors: (data.total_anchors as number) || stages.length,\n currentConfidence: (data.current_confidence as number) ?? null,\n currentStage: (data.current_stage as string) ?? null,\n isFinalized: (data.is_finalized as boolean) || false,\n policyCompliant: (data.policy_compliant as boolean) ?? true,\n policyViolations,\n contextDrift,\n stages,\n };\n }\n\n async getContextDrift(decisionId: string): Promise<ContextDrift> {\n const data = await this.request(\n \"GET\",\n `/api/context-drift/${encodeURIComponent(decisionId)}`,\n { authRequired: false }\n );\n\n const rawStages = (data.stages as any[]) || [];\n const stages: ContextDriftStage[] = rawStages.map((s: any) => ({\n proofId: s.proof_id || \"\",\n stageIndex: s.stage_index ?? 0,\n anchoredAt: s.anchored_at || \"\",\n executionContext: (s.execution_context || {}) as ExecutionContext,\n contextBreak: s.context_break || false,\n driftedFields: s.drifted_fields || [],\n }));\n\n return {\n decisionId: (data.decision_id as string) || decisionId,\n contextCoherent: (data.context_coherent as boolean) ?? true,\n driftScore: (data.drift_score as number) ?? 0,\n fieldsMonitored: (data.fields_monitored as string[]) || [],\n fieldsDrifted: (data.fields_drifted as string[]) || [],\n fieldsStable: (data.fields_stable as string[]) || [],\n fieldsAbsent: (data.fields_absent as string[]) || [],\n totalAnchors: (data.total_anchors as number) || stages.length,\n stages,\n };\n }\n\n async getPricing(): Promise<PricingInfo> {\n const data = await this.request(\"GET\", \"/api/pricing\", {\n authRequired: false,\n });\n return parsePricingInfo(data);\n }\n\n private requireAuth(): void {\n if (!this.apiKey) {\n throw new Error(\n \"apiKey is required — call XProofClient.register() or pass an apiKey\"\n );\n }\n }\n\n /**\n * Check policy compliance for a decision chain without fetching the full trail.\n *\n * Calls `GET /api/proofs/policy-check?decision_id=<id>` and returns a lightweight\n * compliance report: whether the chain is policy-compliant and any violations found.\n *\n * @param decisionId - The shared decision chain identifier.\n * @returns A `PolicyCheckResult` with `policyCompliant`, `policyViolations`, and metadata.\n */\n async getPolicyCheck(decisionId: string): Promise<PolicyCheckResult> {\n if (!decisionId || !decisionId.trim()) {\n throw new ValidationError(\"decisionId is required\", {});\n }\n const data = await this.request(\n \"GET\",\n `/api/proofs/policy-check?decision_id=${encodeURIComponent(decisionId)}`,\n { authRequired: false }\n );\n const violations = ((data.policy_violations as unknown[]) ?? []).map(\n (v) => {\n const vv = v as Record<string, unknown>;\n return {\n proofId: (vv.proof_id as string) ?? \"\",\n confidenceLevel:\n vv.confidence_level != null\n ? (vv.confidence_level as number)\n : null,\n reversibilityClass:\n (vv.reversibility_class as ReversibilityClass) ?? \"reversible\",\n thresholdStage:\n vv.threshold_stage != null\n ? (vv.threshold_stage as string)\n : null,\n threshold: (vv.threshold as number) ?? 0,\n rule: (vv.rule as string) ?? \"\",\n } satisfies PolicyViolation;\n }\n );\n return {\n decisionId: (data.decision_id as string) ?? decisionId,\n totalAnchors: (data.total_anchors as number) ?? 0,\n policyCompliant: (data.policy_compliant as boolean) ?? true,\n policyViolations: violations,\n checkedAt: (data.checked_at as string) ?? \"\",\n raw: data,\n };\n }\n\n private async request(\n method: string,\n path: string,\n options: {\n body?: Record<string, unknown>;\n authRequired?: boolean;\n } = {}\n ): Promise<Record<string, unknown>> {\n const url = `${this.baseUrl}${path}`;\n const { body, authRequired = true } = options;\n\n const headers: Record<string, string> = {\n \"User-Agent\": `xproof-js/${VERSION}`,\n };\n\n if (authRequired && this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n if (body) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n let resp: Response;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: body ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n } catch (err) {\n clearTimeout(timer);\n if (err instanceof DOMException && err.name === \"AbortError\") {\n throw new XProofError(`Request timed out after ${this.timeout}ms`);\n }\n throw new XProofError(`Request failed: ${(err as Error).message}`);\n } finally {\n clearTimeout(timer);\n }\n\n if (resp.status === 200 || resp.status === 201) {\n let data: Record<string, unknown>;\n try {\n data = (await resp.json()) as Record<string, unknown>;\n } catch {\n const text = await resp.text().catch(() => \"\");\n throw new XProofError(\n `Unexpected non-JSON response from ${method} ${url}: ${text.slice(0, 200)}`\n );\n }\n return data;\n }\n\n await this.handleError(resp);\n return {};\n }\n\n private async handleError(resp: Response): Promise<never> {\n let body: Record<string, unknown>;\n try {\n body = (await resp.json()) as Record<string, unknown>;\n } catch {\n body = { message: await resp.text().catch(() => \"\") };\n }\n\n const message =\n (body.message as string) || (body.error as string) || `HTTP ${resp.status}`;\n const status = resp.status;\n\n if (status === 400) throw new ValidationError(message, body);\n if (status === 401 || status === 403)\n throw new AuthenticationError(message, body);\n if (status === 404) throw new NotFoundError(message, body);\n if (status === 409)\n throw new ConflictError(\n message,\n (body.certificationId as string) || \"\",\n body\n );\n if (status === 429) throw new RateLimitError(message, body);\n if (status >= 500) throw new ServerError(message, status, body);\n throw new XProofError(message, status, body);\n }\n}\n","export class XProofError extends Error {\n statusCode: number;\n response: Record<string, unknown> | null;\n\n constructor(\n message: string,\n statusCode = 0,\n response: Record<string, unknown> | null = null\n ) {\n super(message);\n this.name = \"XProofError\";\n this.statusCode = statusCode;\n this.response = response;\n }\n}\n\nexport class AuthenticationError extends XProofError {\n constructor(\n message = \"Invalid or missing API key\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 401, response);\n this.name = \"AuthenticationError\";\n }\n}\n\nexport class ValidationError extends XProofError {\n constructor(\n message = \"Invalid request data\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 400, response);\n this.name = \"ValidationError\";\n }\n}\n\nexport class NotFoundError extends XProofError {\n constructor(\n message = \"Resource not found\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 404, response);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class ConflictError extends XProofError {\n certificationId: string;\n\n constructor(\n message = \"File already certified\",\n certificationId = \"\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 409, response);\n this.name = \"ConflictError\";\n this.certificationId = certificationId;\n }\n}\n\nexport class RateLimitError extends XProofError {\n constructor(\n message = \"Rate limit exceeded\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 429, response);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class ServerError extends XProofError {\n constructor(\n message = \"Internal server error\",\n statusCode = 500,\n response: Record<string, unknown> | null = null\n ) {\n super(message, statusCode, response);\n this.name = \"ServerError\";\n }\n}\n","import { createHash } from \"crypto\";\nimport { readFile } from \"fs/promises\";\n\nexport async function hashFile(path: string): Promise<string> {\n const data = await readFile(path);\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\nexport function hashBuffer(data: Uint8Array): string {\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\nexport function hashString(data: string): string {\n return createHash(\"sha256\").update(data, \"utf8\").digest(\"hex\");\n}\n","import type {\n Certification,\n BatchResult,\n BatchResultSummary,\n PricingInfo,\n PricingTier,\n RegistrationResult,\n TrialInfo,\n} from \"./types.js\";\n\nexport function parseCertification(data: Record<string, unknown>): Certification {\n const blockchain = (data.blockchain as Record<string, unknown>) || {};\n return {\n id: (data.id as string) || (data.proof_id as string) || \"\",\n fileName:\n (data.fileName as string) ||\n (data.filename as string) ||\n (data.file_name as string) ||\n \"\",\n fileHash:\n (data.fileHash as string) || (data.file_hash as string) || \"\",\n transactionHash:\n (data.transactionHash as string) ||\n (blockchain.transaction_hash as string) ||\n \"\",\n transactionUrl:\n (data.transactionUrl as string) ||\n (blockchain.explorer_url as string) ||\n \"\",\n createdAt:\n (data.createdAt as string) ||\n (data.created_at as string) ||\n (data.timestamp as string) ||\n \"\",\n authorName:\n (data.authorName as string) || (data.author_name as string) || \"\",\n blockchainStatus:\n (data.blockchainStatus as string) || (data.status as string) || \"\",\n isPublic: data.isPublic !== undefined ? !!data.isPublic : (data.is_public !== undefined ? !!data.is_public : true),\n certificateUrl:\n (data.certificateUrl as string) ||\n (data.certificate_url as string) ||\n \"\",\n verifyUrl:\n (data.verifyUrl as string) || (data.verify_url as string) || \"\",\n };\n}\n\nexport function parseBatchResult(data: Record<string, unknown>): BatchResult {\n const rawResults = (data.results as Array<Record<string, unknown>>) || [];\n const results = rawResults.map(parseCertification);\n const total = (data.total as number) ?? rawResults.length;\n const created = (data.created as number) ?? 0;\n const existing = (data.existing as number) ?? 0;\n\n const summary: BatchResultSummary = {\n total,\n created,\n existing,\n get certified() { return created; },\n get failed() { return total - created - existing; },\n };\n\n return {\n batchId: (data.batch_id as string) || \"\",\n results,\n summary,\n };\n}\n\nexport function parsePricingInfo(data: Record<string, unknown>): PricingInfo {\n const rawTiers = (data.tiers as Array<Record<string, unknown>>) || [];\n const tiers: PricingTier[] = rawTiers.map((t) => ({\n minCertifications:\n (t.min_certifications as number) ?? (t.min as number) ?? 0,\n maxCertifications:\n (t.max_certifications as number) ?? (t.max as number) ?? null,\n priceUsd: (t.price_usd as number) ?? (t.price as number) ?? 0,\n }));\n\n return {\n protocol: (data.protocol as string) || \"\",\n version: (data.version as string) || \"\",\n priceUsd:\n (data.price_usd as number) ?? (data.current_price as number) ?? 0,\n tiers,\n paymentMethods:\n (data.payment_methods as Array<Record<string, string>>) || [],\n raw: data,\n };\n}\n\nexport function parseRegistrationResult(\n data: Record<string, unknown>\n): RegistrationResult {\n const trialData = (data.trial as Record<string, unknown>) || {};\n const trial: TrialInfo = {\n quota: (trialData.quota as number) ?? 0,\n used: (trialData.used as number) ?? 0,\n remaining: (trialData.remaining as number) ?? 0,\n };\n return {\n apiKey: (data.api_key as string) || \"\",\n agentName: (data.agent_name as string) || \"\",\n trial,\n endpoints: (data.endpoints as Record<string, string>) || {},\n raw: data,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyB;;;ACAlB,IAAM,cAAN,cAA0B,MAAM;AAAA,EAIrC,YACE,SACA,aAAa,GACb,WAA2C,MAC3C;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,WAAW;AAAA,EAClB;AACF;AAEO,IAAM,sBAAN,cAAkC,YAAY;AAAA,EACnD,YACE,UAAU,8BACV,WAA2C,MAC3C;AACA,UAAM,SAAS,KAAK,QAAQ;AAC5B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,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ACA,aAAO;AAAA,IACT;AAEA,UAAM,KAAK,YAAY,IAAI;AAC3B,WAAO,CAAC;AAAA,EACV;AAAA,EAEA,MAAc,YAAY,MAAgC;AACxD,QAAI;AACJ,QAAI;AACF,aAAQ,MAAM,KAAK,KAAK;AAAA,IAC1B,QAAQ;AACN,aAAO,EAAE,SAAS,MAAM,KAAK,KAAK,EAAE,MAAM,MAAM,EAAE,EAAE;AAAA,IACtD;AAEA,UAAM,UACH,KAAK,WAAuB,KAAK,SAAoB,QAAQ,KAAK,MAAM;AAC3E,UAAM,SAAS,KAAK;AAEpB,QAAI,WAAW,IAAK,OAAM,IAAI,gBAAgB,SAAS,IAAI;AAC3D,QAAI,WAAW,OAAO,WAAW;AAC/B,YAAM,IAAI,oBAAoB,SAAS,IAAI;AAC7C,QAAI,WAAW,IAAK,OAAM,IAAI,cAAc,SAAS,IAAI;AACzD,QAAI,WAAW;AACb,YAAM,IAAI;AAAA,QACR;AAAA,QACC,KAAK,mBAA8B;AAAA,QACpC;AAAA,MACF;AACF,QAAI,WAAW,IAAK,OAAM,IAAI,eAAe,SAAS,IAAI;AAC1D,QAAI,UAAU,IAAK,OAAM,IAAI,YAAY,SAAS,QAAQ,IAAI;AAC9D,UAAM,IAAI,YAAY,SAAS,QAAQ,IAAI;AAAA,EAC7C;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/errors.ts","../src/hash.ts","../src/parse.ts","../src/types.ts"],"sourcesContent":["export { XProofClient } from \"./client.js\";\nexport {\n XProofError,\n AuthenticationError,\n ValidationError,\n NotFoundError,\n ConflictError,\n RateLimitError,\n ServerError,\n} from \"./errors.js\";\nexport { JURISDICTION_TYPES } from \"./types.js\";\nexport type {\n Certification,\n BatchResult,\n BatchResultSummary,\n PricingInfo,\n PricingTier,\n RegistrationResult,\n TrialInfo,\n FourWOptions,\n CertifyHashOptions,\n BatchFileEntry,\n XProofClientOptions,\n ThresholdStage,\n ReversibilityClass,\n ConfidenceOptions,\n ConfidenceTrail,\n ConfidenceTrailStage,\n ConfidenceTrailDrift,\n PolicyViolation,\n PolicyCheckResult,\n ExecutionContext,\n ContextDriftStage,\n ContextDrift,\n JurisdictionType,\n TimingBreakdown,\n} from \"./types.js\";\nexport { hashFile, hashBuffer, hashString } from \"./hash.js\";\n","import { basename } from \"path\";\nimport {\n XProofError,\n AuthenticationError,\n ValidationError,\n NotFoundError,\n ConflictError,\n RateLimitError,\n ServerError,\n} from \"./errors.js\";\nimport { hashFile } from \"./hash.js\";\nimport {\n parseCertification,\n parseBatchResult,\n parsePricingInfo,\n parseRegistrationResult,\n} from \"./parse.js\";\nimport type {\n Certification,\n BatchResult,\n PricingInfo,\n RegistrationResult,\n FourWOptions,\n BatchFileEntry,\n XProofClientOptions,\n ConfidenceOptions,\n ConfidenceTrail,\n ConfidenceTrailStage,\n ConfidenceTrailDrift,\n ContextDrift,\n ContextDriftStage,\n ExecutionContext,\n PolicyViolation,\n PolicyCheckResult,\n ReversibilityClass,\n} from \"./types.js\";\nimport { JURISDICTION_TYPES } from \"./types.js\";\n\nconst VERSION = \"0.1.9\";\nconst DEFAULT_BASE_URL = \"https://xproof.app\";\nconst DEFAULT_TIMEOUT = 30_000;\n\nexport class XProofClient {\n private apiKey: string;\n private baseUrl: string;\n private timeout: number;\n\n registration: RegistrationResult | null = null;\n\n constructor(options: XProofClientOptions = {}) {\n this.apiKey = options.apiKey ?? \"\";\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT;\n }\n\n static async register(\n agentName: string,\n options: Omit<XProofClientOptions, \"apiKey\"> = {}\n ): Promise<XProofClient> {\n const temp = new XProofClient(options);\n const data = await temp.request(\"POST\", \"/api/agent/register\", {\n body: { agent_name: agentName },\n authRequired: false,\n });\n const result = parseRegistrationResult(data);\n const client = new XProofClient({\n ...options,\n apiKey: result.apiKey,\n });\n client.registration = result;\n return client;\n }\n\n async certify(\n path: string,\n author: string,\n fileName?: string,\n fourW?: FourWOptions\n ): Promise<Certification> {\n this.requireAuth();\n const fileHash = await hashFile(path);\n const resolvedName = fileName ?? basename(path);\n return this.certifyHash(fileHash, resolvedName, author, fourW);\n }\n\n async certifyHash(\n fileHash: string,\n fileName: string,\n author: string,\n fourW?: FourWOptions\n ): Promise<Certification> {\n this.requireAuth();\n\n const metadata: Record<string, unknown> = fourW?.metadata\n ? { ...fourW.metadata }\n : {};\n if (fourW?.who !== undefined) metadata.who = fourW.who;\n if (fourW?.what !== undefined) metadata.what = fourW.what;\n if (fourW?.when !== undefined) metadata.when = fourW.when;\n if (fourW?.why !== undefined) metadata.why = fourW.why;\n if (fourW?.reversibilityClass !== undefined)\n metadata.reversibility_class = fourW.reversibilityClass;\n\n const payload: Record<string, unknown> = {\n filename: fileName,\n file_hash: fileHash,\n author_name: author,\n };\n if (Object.keys(metadata).length > 0) {\n payload.metadata = metadata;\n }\n\n const data = await this.request(\"POST\", \"/api/proof\", { body: payload });\n return parseCertification(data);\n }\n\n async batchCertify(files: BatchFileEntry[]): Promise<BatchResult> {\n this.requireAuth();\n\n if (files.length > 50) {\n throw new Error(\"Batch certification supports a maximum of 50 files\");\n }\n\n const entries = files.map((f) => {\n const entry: Record<string, unknown> = {\n filename: f.fileName ?? \"unknown\",\n file_hash: f.fileHash,\n };\n const entryMeta: Record<string, unknown> = f.metadata ? { ...f.metadata } : {};\n if (f.timing !== undefined) {\n const t = f.timing;\n if (\n t.jurisdictionType !== undefined &&\n !(JURISDICTION_TYPES as readonly string[]).includes(t.jurisdictionType)\n ) {\n throw new ValidationError(\n `timing.jurisdictionType must be one of: ${JURISDICTION_TYPES.join(\", \")}`,\n {}\n );\n }\n if (t.instructionReceivedAt !== undefined)\n entryMeta.instruction_received_at = t.instructionReceivedAt;\n if (t.reasoningStartedAt !== undefined)\n entryMeta.reasoning_started_at = t.reasoningStartedAt;\n if (t.actionTakenAt !== undefined)\n entryMeta.action_taken_at = t.actionTakenAt;\n if (t.jurisdictionType !== undefined)\n entryMeta.jurisdiction_type = t.jurisdictionType;\n }\n if (Object.keys(entryMeta).length > 0) entry.metadata = entryMeta;\n return entry;\n });\n\n const payload: Record<string, unknown> = { files: entries };\n const author = files.find((f) => f.author)?.author;\n if (author) payload.author_name = author;\n\n const data = await this.request(\"POST\", \"/api/batch\", { body: payload });\n return parseBatchResult(data);\n }\n\n async verify(proofId: string): Promise<Certification> {\n const data = await this.request(\"GET\", `/api/proof/${encodeURIComponent(proofId)}`, {\n authRequired: false,\n });\n return parseCertification(data);\n }\n\n async verifyHash(fileHash: string): Promise<Certification> {\n const data = await this.request(\"GET\", `/api/proof/hash/${encodeURIComponent(fileHash)}`, {\n authRequired: false,\n });\n return parseCertification(data);\n }\n\n async certifyWithConfidence(\n fileHash: string,\n fileName: string,\n author: string,\n confidence: ConfidenceOptions,\n fourW?: FourWOptions\n ): Promise<Certification> {\n this.requireAuth();\n\n if (confidence.confidenceLevel < 0 || confidence.confidenceLevel > 1) {\n throw new ValidationError(\n \"confidenceLevel must be between 0.0 and 1.0\",\n {}\n );\n }\n if (!confidence.decisionId || confidence.decisionId.trim().length === 0) {\n throw new ValidationError(\"decisionId is required\", {});\n }\n\n const metadata: Record<string, unknown> = fourW?.metadata\n ? { ...fourW.metadata }\n : {};\n if (fourW?.who !== undefined) metadata.who = fourW.who;\n if (fourW?.what !== undefined) metadata.what = fourW.what;\n if (fourW?.when !== undefined) metadata.when = fourW.when;\n if (fourW?.why !== undefined) metadata.why = fourW.why;\n if (fourW?.reversibilityClass !== undefined)\n metadata.reversibility_class = fourW.reversibilityClass;\n\n metadata.confidence_level = confidence.confidenceLevel;\n metadata.threshold_stage = confidence.thresholdStage;\n metadata.decision_id = confidence.decisionId;\n // confidence.reversibilityClass takes priority over fourW.reversibilityClass\n if (confidence.reversibilityClass !== undefined)\n metadata.reversibility_class = confidence.reversibilityClass;\n\n if (confidence.timing !== undefined) {\n const t = confidence.timing;\n if (\n t.jurisdictionType !== undefined &&\n !(JURISDICTION_TYPES as readonly string[]).includes(t.jurisdictionType)\n ) {\n throw new ValidationError(\n `timing.jurisdictionType must be one of: ${JURISDICTION_TYPES.join(\", \")}`,\n {}\n );\n }\n if (t.instructionReceivedAt !== undefined)\n metadata.instruction_received_at = t.instructionReceivedAt;\n if (t.reasoningStartedAt !== undefined)\n metadata.reasoning_started_at = t.reasoningStartedAt;\n if (t.actionTakenAt !== undefined)\n metadata.action_taken_at = t.actionTakenAt;\n if (t.jurisdictionType !== undefined)\n metadata.jurisdiction_type = t.jurisdictionType;\n }\n\n const payload: Record<string, unknown> = {\n filename: fileName,\n file_hash: fileHash,\n author_name: author,\n metadata,\n };\n\n const data = await this.request(\"POST\", \"/api/proof\", { body: payload });\n return parseCertification(data);\n }\n\n async getConfidenceTrail(decisionId: string): Promise<ConfidenceTrail> {\n if (!decisionId || !decisionId.trim()) {\n throw new ValidationError(\"decisionId is required\", {});\n }\n const data = await this.request(\n \"GET\",\n `/api/confidence-trail/${encodeURIComponent(decisionId)}`,\n { authRequired: false }\n );\n\n const rawStages = (data.stages as any[]) || [];\n const stages: ConfidenceTrailStage[] = rawStages.map((s: any) => ({\n proofId: s.proof_id || \"\",\n fileName: s.file_name || \"\",\n fileHash: s.file_hash || \"\",\n confidenceLevel: s.confidence_level ?? null,\n thresholdStage: s.threshold_stage ?? null,\n reversibilityClass: (s.metadata?.reversibility_class ?? null) as ReversibilityClass | null,\n author: s.author || \"\",\n blockchain: {\n transactionHash: s.blockchain?.transaction_hash || \"\",\n explorerUrl: s.blockchain?.explorer_url || \"\",\n status: s.blockchain?.status || \"\",\n },\n anchoredAt: s.anchored_at || \"\",\n metadata: s.metadata || {},\n }));\n\n const rawDrift = data.context_drift as any;\n const contextDrift: ConfidenceTrailDrift | null = rawDrift\n ? {\n contextCoherent: rawDrift.context_coherent ?? true,\n driftScore: rawDrift.drift_score ?? 0,\n fieldsMonitored: rawDrift.fields_monitored || [],\n fieldsDrifted: rawDrift.fields_drifted || [],\n fieldsStable: rawDrift.fields_stable || [],\n fieldsAbsent: rawDrift.fields_absent || [],\n }\n : null;\n\n const rawViolations = (data.policy_violations as any[]) || [];\n const policyViolations: PolicyViolation[] = rawViolations.map((v: any) => ({\n proofId: v.proof_id || \"\",\n confidenceLevel: v.confidence_level ?? null,\n reversibilityClass: v.reversibility_class as ReversibilityClass,\n thresholdStage: v.threshold_stage ?? null,\n threshold: v.threshold ?? 0.95,\n rule: v.rule || \"\",\n }));\n\n return {\n decisionId: (data.decision_id as string) || decisionId,\n totalAnchors: (data.total_anchors as number) || stages.length,\n currentConfidence: (data.current_confidence as number) ?? null,\n currentStage: (data.current_stage as string) ?? null,\n isFinalized: (data.is_finalized as boolean) || false,\n policyCompliant: (data.policy_compliant as boolean) ?? true,\n policyViolations,\n contextDrift,\n stages,\n };\n }\n\n async getContextDrift(decisionId: string): Promise<ContextDrift> {\n if (!decisionId || !decisionId.trim()) {\n throw new ValidationError(\"decisionId is required\", {});\n }\n const data = await this.request(\n \"GET\",\n `/api/context-drift/${encodeURIComponent(decisionId)}`,\n { authRequired: false }\n );\n\n const rawStages = (data.stages as any[]) || [];\n const stages: ContextDriftStage[] = rawStages.map((s: any) => ({\n proofId: s.proof_id || \"\",\n stageIndex: s.stage_index ?? 0,\n anchoredAt: s.anchored_at || \"\",\n executionContext: (s.execution_context || {}) as ExecutionContext,\n contextBreak: s.context_break || false,\n driftedFields: s.drifted_fields || [],\n }));\n\n return {\n decisionId: (data.decision_id as string) || decisionId,\n contextCoherent: (data.context_coherent as boolean) ?? true,\n driftScore: (data.drift_score as number) ?? 0,\n fieldsMonitored: (data.fields_monitored as string[]) || [],\n fieldsDrifted: (data.fields_drifted as string[]) || [],\n fieldsStable: (data.fields_stable as string[]) || [],\n fieldsAbsent: (data.fields_absent as string[]) || [],\n totalAnchors: (data.total_anchors as number) || stages.length,\n stages,\n };\n }\n\n async getPricing(): Promise<PricingInfo> {\n const data = await this.request(\"GET\", \"/api/pricing\", {\n authRequired: false,\n });\n return parsePricingInfo(data);\n }\n\n private requireAuth(): void {\n if (!this.apiKey) {\n throw new Error(\n \"apiKey is required — call XProofClient.register() or pass an apiKey\"\n );\n }\n }\n\n /**\n * Check policy compliance for a decision chain without fetching the full trail.\n *\n * Calls `GET /api/proofs/policy-check?decision_id=<id>` and returns a lightweight\n * compliance report: whether the chain is policy-compliant and any violations found.\n *\n * @param decisionId - The shared decision chain identifier.\n * @returns A `PolicyCheckResult` with `policyCompliant`, `policyViolations`, and metadata.\n */\n async getPolicyCheck(decisionId: string): Promise<PolicyCheckResult> {\n if (!decisionId || !decisionId.trim()) {\n throw new ValidationError(\"decisionId is required\", {});\n }\n const data = await this.request(\n \"GET\",\n `/api/proofs/policy-check?decision_id=${encodeURIComponent(decisionId)}`,\n { authRequired: false }\n );\n const violations = ((data.policy_violations as unknown[]) ?? []).map(\n (v) => {\n const vv = v as Record<string, unknown>;\n return {\n proofId: (vv.proof_id as string) ?? \"\",\n confidenceLevel:\n vv.confidence_level != null\n ? (vv.confidence_level as number)\n : null,\n reversibilityClass:\n (vv.reversibility_class as ReversibilityClass) ?? \"reversible\",\n thresholdStage:\n vv.threshold_stage != null\n ? (vv.threshold_stage as string)\n : null,\n threshold: (vv.threshold as number) ?? 0,\n rule: (vv.rule as string) ?? \"\",\n } satisfies PolicyViolation;\n }\n );\n return {\n decisionId: (data.decision_id as string) ?? decisionId,\n totalAnchors: (data.total_anchors as number) ?? 0,\n policyCompliant: (data.policy_compliant as boolean) ?? true,\n policyViolations: violations,\n checkedAt: (data.checked_at as string) ?? \"\",\n raw: data,\n };\n }\n\n private async request(\n method: string,\n path: string,\n options: {\n body?: Record<string, unknown>;\n authRequired?: boolean;\n } = {}\n ): Promise<Record<string, unknown>> {\n const url = `${this.baseUrl}${path}`;\n const { body, authRequired = true } = options;\n\n const headers: Record<string, string> = {\n \"User-Agent\": `xproof-js/${VERSION}`,\n };\n\n if (authRequired && this.apiKey) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n if (body) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), this.timeout);\n\n let resp: Response;\n try {\n resp = await fetch(url, {\n method,\n headers,\n body: body ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n } catch (err) {\n clearTimeout(timer);\n if (err instanceof DOMException && err.name === \"AbortError\") {\n throw new XProofError(`Request timed out after ${this.timeout}ms`);\n }\n throw new XProofError(`Request failed: ${(err as Error).message}`);\n } finally {\n clearTimeout(timer);\n }\n\n if (resp.status === 200 || resp.status === 201) {\n let data: Record<string, unknown>;\n try {\n data = (await resp.json()) as Record<string, unknown>;\n } catch {\n const text = await resp.text().catch(() => \"\");\n throw new XProofError(\n `Unexpected non-JSON response from ${method} ${url}: ${text.slice(0, 200)}`\n );\n }\n return data;\n }\n\n await this.handleError(resp);\n return {};\n }\n\n private async handleError(resp: Response): Promise<never> {\n let body: Record<string, unknown>;\n try {\n body = (await resp.json()) as Record<string, unknown>;\n } catch {\n body = { message: await resp.text().catch(() => \"\") };\n }\n\n const message =\n (body.message as string) || (body.error as string) || `HTTP ${resp.status}`;\n const status = resp.status;\n\n if (status === 400) throw new ValidationError(message, body);\n if (status === 401 || status === 403)\n throw new AuthenticationError(message, body);\n if (status === 404) throw new NotFoundError(message, body);\n if (status === 409)\n throw new ConflictError(\n message,\n (body.certificationId as string) || \"\",\n body\n );\n if (status === 429) throw new RateLimitError(message, body);\n if (status >= 500) throw new ServerError(message, status, body);\n throw new XProofError(message, status, body);\n }\n}\n","export class XProofError extends Error {\n statusCode: number;\n response: Record<string, unknown> | null;\n\n constructor(\n message: string,\n statusCode = 0,\n response: Record<string, unknown> | null = null\n ) {\n super(message);\n this.name = \"XProofError\";\n this.statusCode = statusCode;\n this.response = response;\n }\n}\n\nexport class AuthenticationError extends XProofError {\n constructor(\n message = \"Invalid or missing API key\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 401, response);\n this.name = \"AuthenticationError\";\n }\n}\n\nexport class ValidationError extends XProofError {\n constructor(\n message = \"Invalid request data\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 400, response);\n this.name = \"ValidationError\";\n }\n}\n\nexport class NotFoundError extends XProofError {\n constructor(\n message = \"Resource not found\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 404, response);\n this.name = \"NotFoundError\";\n }\n}\n\nexport class ConflictError extends XProofError {\n certificationId: string;\n\n constructor(\n message = \"File already certified\",\n certificationId = \"\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 409, response);\n this.name = \"ConflictError\";\n this.certificationId = certificationId;\n }\n}\n\nexport class RateLimitError extends XProofError {\n constructor(\n message = \"Rate limit exceeded\",\n response: Record<string, unknown> | null = null\n ) {\n super(message, 429, response);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class ServerError extends XProofError {\n constructor(\n message = \"Internal server error\",\n statusCode = 500,\n response: Record<string, unknown> | null = null\n ) {\n super(message, statusCode, response);\n this.name = \"ServerError\";\n }\n}\n","import { createHash } from \"crypto\";\nimport { readFile } from \"fs/promises\";\n\nexport async function hashFile(path: string): Promise<string> {\n const data = await readFile(path);\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\nexport function hashBuffer(data: Uint8Array): string {\n return createHash(\"sha256\").update(data).digest(\"hex\");\n}\n\nexport function hashString(data: string): string {\n return createHash(\"sha256\").update(data, \"utf8\").digest(\"hex\");\n}\n","import type {\n Certification,\n BatchResult,\n BatchResultSummary,\n PricingInfo,\n PricingTier,\n RegistrationResult,\n TimingBreakdown,\n JurisdictionType,\n TrialInfo,\n} from \"./types.js\";\n\nfunction parseTimingBreakdown(\n raw: Record<string, unknown>\n): TimingBreakdown | undefined {\n const tb: TimingBreakdown = {};\n let hasAnyField = false;\n\n if (raw.instruction_received_at != null) {\n tb.instructionReceivedAt = raw.instruction_received_at as string;\n hasAnyField = true;\n }\n if (raw.reasoning_started_at != null) {\n tb.reasoningStartedAt = raw.reasoning_started_at as string;\n hasAnyField = true;\n }\n if (raw.action_taken_at != null) {\n tb.actionTakenAt = raw.action_taken_at as string;\n hasAnyField = true;\n }\n if (raw.jurisdiction_type != null) {\n tb.jurisdictionType = raw.jurisdiction_type as JurisdictionType;\n hasAnyField = true;\n }\n if (raw.reasoning_duration_ms != null) {\n tb.reasoningDurationMs = raw.reasoning_duration_ms as number;\n hasAnyField = true;\n }\n if (raw.total_duration_ms != null) {\n tb.totalDurationMs = raw.total_duration_ms as number;\n hasAnyField = true;\n }\n\n return hasAnyField ? tb : undefined;\n}\n\nexport function parseCertification(data: Record<string, unknown>): Certification {\n const blockchain = (data.blockchain as Record<string, unknown>) || {};\n\n const _meta = data.metadata as Record<string, unknown> | undefined;\n const _TIMING_KEYS = [\n \"instruction_received_at\",\n \"reasoning_started_at\",\n \"action_taken_at\",\n \"jurisdiction_type\",\n \"reasoning_duration_ms\",\n \"total_duration_ms\",\n ] as const;\n const rawTiming =\n (data.timing_breakdown as Record<string, unknown> | undefined) ??\n (_meta?.timing_breakdown as Record<string, unknown> | undefined) ??\n (_meta && _TIMING_KEYS.some((k) => _meta[k] != null) ? _meta : undefined);\n\n return {\n id: (data.id as string) || (data.proof_id as string) || \"\",\n fileName:\n (data.fileName as string) ||\n (data.filename as string) ||\n (data.file_name as string) ||\n \"\",\n fileHash:\n (data.fileHash as string) || (data.file_hash as string) || \"\",\n transactionHash:\n (data.transactionHash as string) ||\n (blockchain.transaction_hash as string) ||\n \"\",\n transactionUrl:\n (data.transactionUrl as string) ||\n (blockchain.explorer_url as string) ||\n \"\",\n createdAt:\n (data.createdAt as string) ||\n (data.created_at as string) ||\n (data.timestamp as string) ||\n \"\",\n authorName:\n (data.authorName as string) || (data.author_name as string) || \"\",\n blockchainStatus:\n (data.blockchainStatus as string) || (data.status as string) || \"\",\n isPublic: data.isPublic !== undefined ? !!data.isPublic : (data.is_public !== undefined ? !!data.is_public : true),\n certificateUrl:\n (data.certificateUrl as string) ||\n (data.certificate_url as string) ||\n \"\",\n verifyUrl:\n (data.verifyUrl as string) || (data.verify_url as string) || \"\",\n timingBreakdown: rawTiming ? parseTimingBreakdown(rawTiming) : undefined,\n };\n}\n\nexport function parseBatchResult(data: Record<string, unknown>): BatchResult {\n const rawResults = (data.results as Array<Record<string, unknown>>) || [];\n const results = rawResults.map(parseCertification);\n const total = (data.total as number) ?? rawResults.length;\n const created = (data.created as number) ?? 0;\n const existing = (data.existing as number) ?? 0;\n\n const summary: BatchResultSummary = {\n total,\n created,\n existing,\n get certified() { return created; },\n get failed() { return total - created - existing; },\n };\n\n return {\n batchId: (data.batch_id as string) || \"\",\n results,\n summary,\n };\n}\n\nexport function parsePricingInfo(data: Record<string, unknown>): PricingInfo {\n const rawTiers = (data.tiers as Array<Record<string, unknown>>) || [];\n const tiers: PricingTier[] = rawTiers.map((t) => ({\n minCertifications:\n (t.min_certifications as number) ?? (t.min as number) ?? 0,\n maxCertifications:\n (t.max_certifications as number) ?? (t.max as number) ?? null,\n priceUsd: (t.price_usd as number) ?? (t.price as number) ?? 0,\n }));\n\n return {\n protocol: (data.protocol as string) || \"\",\n version: (data.version as string) || \"\",\n priceUsd:\n (data.price_usd as number) ?? (data.current_price as number) ?? 0,\n tiers,\n paymentMethods:\n (data.payment_methods as Array<Record<string, string>>) || [],\n raw: data,\n };\n}\n\nexport function parseRegistrationResult(\n data: Record<string, unknown>\n): RegistrationResult {\n const trialData = (data.trial as Record<string, unknown>) || {};\n const trial: TrialInfo = {\n quota: (trialData.quota as number) ?? 0,\n used: (trialData.used as number) ?? 0,\n remaining: (trialData.remaining as number) ?? 0,\n };\n return {\n apiKey: (data.api_key as string) || \"\",\n agentName: (data.agent_name as string) || \"\",\n trial,\n endpoints: (data.endpoints as Record<string, string>) || {},\n raw: data,\n };\n}\n","export type JurisdictionType =\n | \"instruction_following\"\n | \"autonomous_inference\"\n | \"human_approved\";\n\n/**\n * All valid `JurisdictionType` values — useful for runtime validation.\n *\n * - `instruction_following` — agent executed an explicit human instruction;\n * accountability follows the principal.\n * - `autonomous_inference` — agent reached its own conclusion; agent and its\n * operator bear primary accountability.\n * - `human_approved` — agent recommended, human approved; shared accountability.\n */\nexport const JURISDICTION_TYPES: readonly JurisdictionType[] = [\n \"instruction_following\",\n \"autonomous_inference\",\n \"human_approved\",\n] as const;\n\n/**\n * Decomposed decision timeline for forensic audit.\n *\n * Pass a `TimingBreakdown` to `certifyWithConfidence()` via `confidence.timing`\n * to anchor the full decision chronology on-chain.\n *\n * All timestamp fields are optional ISO8601 strings with a timezone offset\n * (e.g. `\"2026-04-20T14:31:58Z\"`).\n *\n * When read back from the API the server populates two computed fields:\n * - `reasoningDurationMs` — ms between `reasoningStartedAt` and `actionTakenAt`\n * - `totalDurationMs` — ms between `instructionReceivedAt` and `actionTakenAt`\n */\nexport interface TimingBreakdown {\n instructionReceivedAt?: string;\n reasoningStartedAt?: string;\n actionTakenAt?: string;\n jurisdictionType?: JurisdictionType;\n /** Computed by server; present in API responses only. */\n reasoningDurationMs?: number;\n /** Computed by server; present in API responses only. */\n totalDurationMs?: number;\n}\n\nexport interface Certification {\n id: string;\n fileName: string;\n fileHash: string;\n transactionHash: string;\n transactionUrl: string;\n createdAt: string;\n authorName: string;\n blockchainStatus: string;\n isPublic: boolean;\n certificateUrl: string;\n verifyUrl: string;\n timingBreakdown?: TimingBreakdown;\n}\n\nexport interface BatchResultSummary {\n total: number;\n created: number;\n existing: number;\n certified: number;\n failed: number;\n}\n\nexport interface BatchResult {\n batchId: string;\n results: Certification[];\n summary: BatchResultSummary;\n}\n\nexport interface PricingTier {\n minCertifications: number;\n maxCertifications: number | null;\n priceUsd: number;\n}\n\nexport interface PricingInfo {\n protocol: string;\n version: string;\n priceUsd: number;\n tiers: PricingTier[];\n paymentMethods: Array<Record<string, string>>;\n raw: Record<string, unknown>;\n}\n\nexport interface TrialInfo {\n quota: number;\n used: number;\n remaining: number;\n}\n\nexport interface RegistrationResult {\n apiKey: string;\n agentName: string;\n trial: TrialInfo;\n endpoints: Record<string, string>;\n raw: Record<string, unknown>;\n}\n\nexport interface FourWOptions {\n who?: string;\n what?: string;\n when?: string;\n why?: string;\n reversibilityClass?: ReversibilityClass;\n metadata?: Record<string, unknown>;\n}\n\nexport interface CertifyHashOptions extends FourWOptions {\n fileHash: string;\n fileName: string;\n author: string;\n}\n\nexport type ThresholdStage = \"initial\" | \"partial\" | \"pre-commitment\" | \"final\";\n\nexport type ReversibilityClass = \"reversible\" | \"costly\" | \"irreversible\";\n\nexport interface ConfidenceOptions {\n confidenceLevel: number;\n thresholdStage: ThresholdStage;\n decisionId: string;\n reversibilityClass?: ReversibilityClass;\n /** Optional timing breakdown to anchor the full decision chronology on-chain. */\n timing?: TimingBreakdown;\n}\n\nexport interface ConfidenceTrailStage {\n proofId: string;\n fileName: string;\n fileHash: string;\n confidenceLevel: number | null;\n thresholdStage: string | null;\n reversibilityClass: ReversibilityClass | null;\n author: string;\n blockchain: {\n transactionHash: string;\n explorerUrl: string;\n status: string;\n };\n anchoredAt: string;\n metadata: Record<string, unknown>;\n}\n\nexport interface ConfidenceTrailDrift {\n contextCoherent: boolean;\n driftScore: number;\n fieldsMonitored: string[];\n fieldsDrifted: string[];\n fieldsStable: string[];\n fieldsAbsent: string[];\n}\n\nexport interface PolicyViolation {\n proofId: string;\n confidenceLevel: number | null;\n reversibilityClass: ReversibilityClass;\n thresholdStage: string | null;\n threshold: number;\n rule: string;\n}\n\nexport interface ConfidenceTrail {\n decisionId: string;\n totalAnchors: number;\n currentConfidence: number | null;\n currentStage: string | null;\n isFinalized: boolean;\n policyCompliant: boolean;\n policyViolations: PolicyViolation[];\n contextDrift: ConfidenceTrailDrift | null;\n stages: ConfidenceTrailStage[];\n}\n\nexport interface PolicyCheckResult {\n decisionId: string;\n totalAnchors: number;\n policyCompliant: boolean;\n policyViolations: PolicyViolation[];\n checkedAt: string;\n raw: Record<string, unknown>;\n}\n\nexport interface BatchFileEntry {\n fileHash: string;\n fileName?: string;\n author?: string;\n metadata?: Record<string, unknown>;\n timing?: TimingBreakdown;\n}\n\nexport interface XProofClientOptions {\n apiKey?: string;\n baseUrl?: string;\n timeout?: number;\n}\n\nexport interface ExecutionContext {\n model_hash: string | null;\n tools_version: string | null;\n strategy_snapshot: string | null;\n operator_scope: string | null;\n [key: string]: string | null;\n}\n\nexport interface ContextDriftStage {\n proofId: string;\n stageIndex: number;\n anchoredAt: string;\n executionContext: ExecutionContext;\n contextBreak: boolean;\n driftedFields: string[];\n}\n\nexport interface ContextDrift {\n decisionId: string;\n contextCoherent: boolean;\n driftScore: number;\n fieldsMonitored: string[];\n fieldsDrifted: string[];\n fieldsStable: string[];\n fieldsAbsent: string[];\n totalAnchors: number;\n stages: ContextDriftStage[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyB;;;ACAlB,IAAM,cAAN,cAA0B,MAAM;AAAA,EAIrC,YACE,SACA,aAAa,GACb,WAA2C,MAC3C;AACA,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,aAAa;AAClB,SAAK,WAAW;AAAA,EAClB;AACF;AAEO,IAAM,sBAAN,cAAkC,YAAY;AAAA,EACnD,YACE,UAAU,8BACV,WAA2C,MAC3C;AACA,UAAM,SAAS,KAAK,QAAQ;AAC5B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,kBAAN,cAA8B,YAAY;AAAA,EAC/C,YACE,UAAU,wBACV,WAA2C,MAC3C;AACA,UAAM,SAAS,KAAK,QAAQ;AAC5B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,YAAY;AAAA,EAC7C,YACE,UAAU,sBACV,WAA2C,MAC3C;AACA,UAAM,SAAS,KAAK,QAAQ;AAC5B,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,gBAAN,cAA4B,YAAY;AAAA,EAG7C,YACE,UAAU,0B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