@belticlabs/agent-risk-sdk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{adapter-CLy44CD2.d.ts → adapter-DEdhsNt-.d.ts} +3 -10
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.js +3 -4
- package/dist/{chunk-WY5ZX4BD.js → chunk-GM4KEEZB.js} +3 -17
- package/dist/chunk-JSE6JQJC.js +530 -0
- package/dist/index.d.ts +11 -33
- package/dist/index.js +28 -332
- package/dist/protocol/index.d.ts +2 -2
- package/dist/{session-gK51QVAM.d.ts → session-D9E-efc0.d.ts} +71 -93
- package/dist/{verdict-CDAsxktI.d.ts → verdict-DMnbFuS5.d.ts} +1 -1
- package/dist/x402/hono.d.ts +4 -4
- package/dist/x402/hono.js +1 -1
- package/dist/x402/index.d.ts +6 -8
- package/dist/x402/index.js +2 -3
- package/package.json +1 -1
- package/dist/chunk-4MG6VNAU.js +0 -276
package/dist/index.js
CHANGED
|
@@ -2,12 +2,14 @@ import {
|
|
|
2
2
|
Verdict
|
|
3
3
|
} from "./chunk-4BUUPU3O.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
ApiClient,
|
|
6
|
+
BelticApiError,
|
|
7
|
+
BelticConfigError,
|
|
8
|
+
ChainRejectedError,
|
|
7
9
|
Session,
|
|
8
10
|
Sessions,
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
Transport
|
|
12
|
+
} from "./chunk-JSE6JQJC.js";
|
|
11
13
|
import {
|
|
12
14
|
canonicalBytes,
|
|
13
15
|
canonicalize,
|
|
@@ -18,127 +20,12 @@ import {
|
|
|
18
20
|
toHex
|
|
19
21
|
} from "./chunk-X3W2Z5GC.js";
|
|
20
22
|
|
|
21
|
-
// src/core/api-client.ts
|
|
22
|
-
var BelticApiError = class extends Error {
|
|
23
|
-
constructor(status, code, message, details, requestId) {
|
|
24
|
-
super(message);
|
|
25
|
-
this.status = status;
|
|
26
|
-
this.code = code;
|
|
27
|
-
this.details = details;
|
|
28
|
-
this.requestId = requestId;
|
|
29
|
-
this.name = "BelticApiError";
|
|
30
|
-
}
|
|
31
|
-
/** 5xx and network failures are retried by the transport; 4xx are not. */
|
|
32
|
-
get retryable() {
|
|
33
|
-
return this.status === 0 || this.status >= 500 || this.status === 429;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
var ApiClient = class {
|
|
37
|
-
baseUrl;
|
|
38
|
-
fetchImpl;
|
|
39
|
-
timeoutMs;
|
|
40
|
-
headers;
|
|
41
|
-
constructor(opts) {
|
|
42
|
-
this.baseUrl = opts.baseUrl.replace(/\/+$/, "");
|
|
43
|
-
this.fetchImpl = opts.fetch ?? globalThis.fetch.bind(globalThis);
|
|
44
|
-
this.timeoutMs = opts.timeoutMs ?? 1e4;
|
|
45
|
-
this.headers = {
|
|
46
|
-
authorization: `Bearer ${opts.apiKey}`,
|
|
47
|
-
"content-type": "application/json",
|
|
48
|
-
"user-agent": opts.userAgent ?? "@belticlabs/agent-risk-sdk"
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
post(path, body, headers = {}) {
|
|
52
|
-
return this.request("POST", path, JSON.stringify(body), headers);
|
|
53
|
-
}
|
|
54
|
-
get(path, query = {}) {
|
|
55
|
-
const qs = Object.entries(query).filter((e) => e[1] !== void 0).map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`).join("&");
|
|
56
|
-
return this.request("GET", qs ? `${path}?${qs}` : path, void 0, {});
|
|
57
|
-
}
|
|
58
|
-
async request(method, path, body, extra) {
|
|
59
|
-
const controller = new AbortController();
|
|
60
|
-
const timer = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
61
|
-
let res;
|
|
62
|
-
try {
|
|
63
|
-
res = await this.fetchImpl(`${this.baseUrl}${path}`, {
|
|
64
|
-
method,
|
|
65
|
-
headers: { ...this.headers, ...extra },
|
|
66
|
-
...body !== void 0 ? { body } : {},
|
|
67
|
-
signal: controller.signal
|
|
68
|
-
});
|
|
69
|
-
} catch (err) {
|
|
70
|
-
throw new BelticApiError(
|
|
71
|
-
0,
|
|
72
|
-
"NETWORK",
|
|
73
|
-
`request to ${path} failed: ${err.message}`
|
|
74
|
-
);
|
|
75
|
-
} finally {
|
|
76
|
-
clearTimeout(timer);
|
|
77
|
-
}
|
|
78
|
-
const text = await res.text();
|
|
79
|
-
let json = null;
|
|
80
|
-
try {
|
|
81
|
-
json = text ? JSON.parse(text) : null;
|
|
82
|
-
} catch {
|
|
83
|
-
json = null;
|
|
84
|
-
}
|
|
85
|
-
if (!res.ok) {
|
|
86
|
-
const e = json?.error;
|
|
87
|
-
throw new BelticApiError(
|
|
88
|
-
res.status,
|
|
89
|
-
e?.code ?? `HTTP_${res.status}`,
|
|
90
|
-
e?.message ?? res.statusText,
|
|
91
|
-
e?.details,
|
|
92
|
-
e?.request_id
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
return json;
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
// src/core/correlation.ts
|
|
100
|
-
var MemoryCorrelationStore = class {
|
|
101
|
-
constructor(defaultTtlMs = 60 * 60 * 1e3) {
|
|
102
|
-
this.defaultTtlMs = defaultTtlMs;
|
|
103
|
-
}
|
|
104
|
-
entries = /* @__PURE__ */ new Map();
|
|
105
|
-
async bind(key, sessionId, ttlMs = this.defaultTtlMs) {
|
|
106
|
-
this.entries.set(key, { sessionId, expiresAt: Date.now() + ttlMs });
|
|
107
|
-
}
|
|
108
|
-
async resolve(key) {
|
|
109
|
-
const e = this.entries.get(key);
|
|
110
|
-
if (!e) return null;
|
|
111
|
-
if (e.expiresAt < Date.now()) {
|
|
112
|
-
this.entries.delete(key);
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
return e.sessionId;
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
23
|
// src/core/identity.ts
|
|
120
|
-
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
121
|
-
import { dirname } from "path";
|
|
122
24
|
function identityFromSeed(seed, credential) {
|
|
123
25
|
const signer = memorySigner(seed);
|
|
124
26
|
const did = didKeyFromEd25519(signer.publicKey);
|
|
125
27
|
return { did, signer: { ...signer, keyId: did }, ...credential ? { credential } : {} };
|
|
126
28
|
}
|
|
127
|
-
function ephemeralIdentity(credential) {
|
|
128
|
-
return identityFromSeed(memorySigner().seed, credential);
|
|
129
|
-
}
|
|
130
|
-
function fileIdentity(path, credential) {
|
|
131
|
-
let seed;
|
|
132
|
-
try {
|
|
133
|
-
seed = fromHex(JSON.parse(readFileSync(path, "utf8")).seed);
|
|
134
|
-
} catch {
|
|
135
|
-
seed = memorySigner().seed;
|
|
136
|
-
mkdirSync(dirname(path), { recursive: true });
|
|
137
|
-
writeFileSync(path, `${JSON.stringify({ seed: toHex(seed) })}
|
|
138
|
-
`, { mode: 384 });
|
|
139
|
-
}
|
|
140
|
-
return identityFromSeed(seed, credential);
|
|
141
|
-
}
|
|
142
29
|
|
|
143
30
|
// src/core/payment-moment.ts
|
|
144
31
|
function summaryOf(m) {
|
|
@@ -149,9 +36,6 @@ function summaryOf(m) {
|
|
|
149
36
|
...m.payer ? { payer: m.payer } : {}
|
|
150
37
|
};
|
|
151
38
|
}
|
|
152
|
-
function presentedFrom(summary, raw) {
|
|
153
|
-
return { ...summary, artifact: "payment-signature", raw };
|
|
154
|
-
}
|
|
155
39
|
|
|
156
40
|
// src/core/decision.ts
|
|
157
41
|
var Decision = class _Decision {
|
|
@@ -382,238 +266,65 @@ var Run = class _Run {
|
|
|
382
266
|
}
|
|
383
267
|
};
|
|
384
268
|
|
|
385
|
-
// src/core/transport.ts
|
|
386
|
-
var DEFAULT_TRANSPORT = {
|
|
387
|
-
maxBatch: 50,
|
|
388
|
-
flushMs: 1e3,
|
|
389
|
-
maxBuffered: 5e3,
|
|
390
|
-
backoff: { baseMs: 200, maxMs: 3e4, maxAttempts: Number.POSITIVE_INFINITY }
|
|
391
|
-
};
|
|
392
|
-
var ChainRejectedError = class extends Error {
|
|
393
|
-
constructor(sessionId, source, result) {
|
|
394
|
-
super(
|
|
395
|
-
`chain ${sessionId}:${source} halted at seq ${result.seq}: ${result.status}${result.code ? ` ${result.code}` : ""}`
|
|
396
|
-
);
|
|
397
|
-
this.sessionId = sessionId;
|
|
398
|
-
this.source = source;
|
|
399
|
-
this.result = result;
|
|
400
|
-
this.name = "ChainRejectedError";
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
var TransportClosedError = class extends Error {
|
|
404
|
-
constructor() {
|
|
405
|
-
super("transport is closed");
|
|
406
|
-
this.name = "TransportClosedError";
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
|
-
var Transport = class {
|
|
410
|
-
constructor(api, opts = {}) {
|
|
411
|
-
this.api = api;
|
|
412
|
-
this.opts = {
|
|
413
|
-
...DEFAULT_TRANSPORT,
|
|
414
|
-
...opts,
|
|
415
|
-
backoff: { ...DEFAULT_TRANSPORT.backoff, ...opts.backoff }
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
opts;
|
|
419
|
-
chains = /* @__PURE__ */ new Map();
|
|
420
|
-
buffered = 0;
|
|
421
|
-
timer = null;
|
|
422
|
-
closed = false;
|
|
423
|
-
inFlightCount = 0;
|
|
424
|
-
drainWaiters = [];
|
|
425
|
-
get size() {
|
|
426
|
-
return this.buffered;
|
|
427
|
-
}
|
|
428
|
-
hasRoom() {
|
|
429
|
-
return !this.closed && this.buffered < this.opts.maxBuffered;
|
|
430
|
-
}
|
|
431
|
-
haltedError(sessionId, source) {
|
|
432
|
-
return this.chains.get(`${sessionId}:${source}`)?.halted ?? null;
|
|
433
|
-
}
|
|
434
|
-
/** Callers check `hasRoom()` first and assign `seq` only then (GAP-38). */
|
|
435
|
-
enqueue(ev) {
|
|
436
|
-
if (this.closed) throw new TransportClosedError();
|
|
437
|
-
const key = `${ev.sessionId}:${ev.source}`;
|
|
438
|
-
let chain = this.chains.get(key);
|
|
439
|
-
if (!chain) {
|
|
440
|
-
chain = { key, pending: [], inFlight: null, attempts: 0, halted: null };
|
|
441
|
-
this.chains.set(key, chain);
|
|
442
|
-
}
|
|
443
|
-
if (chain.halted) throw chain.halted;
|
|
444
|
-
if (!this.hasRoom()) throw new Error("transport buffer is full");
|
|
445
|
-
chain.pending.push(ev);
|
|
446
|
-
this.buffered++;
|
|
447
|
-
if (chain.pending.length >= this.opts.maxBatch) void this.flushChain(chain);
|
|
448
|
-
else this.schedule();
|
|
449
|
-
}
|
|
450
|
-
/** Send everything pending and wait for every in-flight batch to settle (ack or halt). */
|
|
451
|
-
async flush() {
|
|
452
|
-
this.unschedule();
|
|
453
|
-
for (const chain of this.chains.values()) void this.flushChain(chain);
|
|
454
|
-
await this.drained();
|
|
455
|
-
}
|
|
456
|
-
async close() {
|
|
457
|
-
await this.flush();
|
|
458
|
-
this.closed = true;
|
|
459
|
-
}
|
|
460
|
-
schedule() {
|
|
461
|
-
if (this.timer) return;
|
|
462
|
-
const st = this.opts.setTimeout ?? globalThis.setTimeout;
|
|
463
|
-
this.timer = st(() => {
|
|
464
|
-
this.timer = null;
|
|
465
|
-
for (const chain of this.chains.values()) void this.flushChain(chain);
|
|
466
|
-
}, this.opts.flushMs);
|
|
467
|
-
this.timer.unref?.();
|
|
468
|
-
}
|
|
469
|
-
unschedule() {
|
|
470
|
-
if (!this.timer) return;
|
|
471
|
-
(this.opts.clearTimeout ?? globalThis.clearTimeout)(this.timer);
|
|
472
|
-
this.timer = null;
|
|
473
|
-
}
|
|
474
|
-
drained() {
|
|
475
|
-
if (this.inFlightCount === 0 && [...this.chains.values()].every((c) => c.pending.length === 0 || c.halted)) {
|
|
476
|
-
return Promise.resolve();
|
|
477
|
-
}
|
|
478
|
-
return new Promise((resolve) => this.drainWaiters.push(resolve));
|
|
479
|
-
}
|
|
480
|
-
settleWaiters() {
|
|
481
|
-
if (this.inFlightCount > 0) return;
|
|
482
|
-
if (![...this.chains.values()].every((c) => c.pending.length === 0 || c.halted)) return;
|
|
483
|
-
const waiters = this.drainWaiters;
|
|
484
|
-
this.drainWaiters = [];
|
|
485
|
-
for (const w of waiters) w();
|
|
486
|
-
}
|
|
487
|
-
async flushChain(chain) {
|
|
488
|
-
if (chain.inFlight || chain.halted || chain.pending.length === 0) {
|
|
489
|
-
this.settleWaiters();
|
|
490
|
-
return;
|
|
491
|
-
}
|
|
492
|
-
const batch = chain.pending.splice(0, this.opts.maxBatch);
|
|
493
|
-
chain.inFlight = batch;
|
|
494
|
-
this.inFlightCount++;
|
|
495
|
-
try {
|
|
496
|
-
const ack = await this.send(chain, batch);
|
|
497
|
-
this.buffered -= batch.length;
|
|
498
|
-
this.opts.onAck?.(ack);
|
|
499
|
-
const bad = ack.results.find((r) => r.status === "fork" || r.status === "rejected");
|
|
500
|
-
if (bad) {
|
|
501
|
-
const first = batch[0];
|
|
502
|
-
chain.halted = new ChainRejectedError(first.sessionId, first.source, bad);
|
|
503
|
-
this.buffered -= chain.pending.length;
|
|
504
|
-
chain.pending = [];
|
|
505
|
-
this.opts.onChainHalted?.(chain.halted);
|
|
506
|
-
}
|
|
507
|
-
} catch (err) {
|
|
508
|
-
this.buffered -= batch.length + chain.pending.length;
|
|
509
|
-
chain.pending = [];
|
|
510
|
-
const first = batch[0];
|
|
511
|
-
chain.halted = new ChainRejectedError(first.sessionId, first.source, {
|
|
512
|
-
index: 0,
|
|
513
|
-
sessionId: first.sessionId,
|
|
514
|
-
source: first.source,
|
|
515
|
-
seq: first.seq,
|
|
516
|
-
status: "rejected",
|
|
517
|
-
code: "DELIVERY_FAILED"
|
|
518
|
-
});
|
|
519
|
-
this.opts.onError?.(err);
|
|
520
|
-
this.opts.onChainHalted?.(chain.halted);
|
|
521
|
-
} finally {
|
|
522
|
-
chain.inFlight = null;
|
|
523
|
-
this.inFlightCount--;
|
|
524
|
-
}
|
|
525
|
-
if (chain.pending.length > 0 && !chain.halted) void this.flushChain(chain);
|
|
526
|
-
else this.settleWaiters();
|
|
527
|
-
}
|
|
528
|
-
async send(chain, batch) {
|
|
529
|
-
const { baseMs, maxMs, maxAttempts } = this.opts.backoff;
|
|
530
|
-
for (let attempt = 0; ; attempt++) {
|
|
531
|
-
try {
|
|
532
|
-
const ack = await this.api.post("/v1/evidence", batch);
|
|
533
|
-
chain.attempts = 0;
|
|
534
|
-
return ack;
|
|
535
|
-
} catch (err) {
|
|
536
|
-
const retryable = err instanceof BelticApiError ? err.retryable : true;
|
|
537
|
-
if (!retryable || attempt + 1 >= maxAttempts) throw err;
|
|
538
|
-
this.opts.onError?.(err);
|
|
539
|
-
const delay = Math.min(maxMs, baseMs * 2 ** attempt) * (0.5 + Math.random() / 2);
|
|
540
|
-
await new Promise((r) => (this.opts.setTimeout ?? globalThis.setTimeout)(r, delay));
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
};
|
|
545
|
-
|
|
546
269
|
// src/client.ts
|
|
547
|
-
var SDK_VERSION = "0.
|
|
270
|
+
var SDK_VERSION = "0.5.0";
|
|
548
271
|
var ENV_REQUIRED = ["BELTIC_API_KEY", "BELTIC_BASE_URL", "BELTIC_AGENT_SEED"];
|
|
549
272
|
var ENV_CREDENTIAL = "BELTIC_AGENT_CREDENTIAL";
|
|
550
273
|
var Beltic = class _Beltic {
|
|
551
|
-
api;
|
|
552
274
|
transport;
|
|
553
275
|
sessions;
|
|
554
276
|
identity;
|
|
555
|
-
correlation;
|
|
556
277
|
onReview;
|
|
557
278
|
failOpen;
|
|
558
|
-
|
|
559
|
-
enabled;
|
|
279
|
+
api;
|
|
560
280
|
onError;
|
|
561
281
|
runs = /* @__PURE__ */ new Map();
|
|
562
282
|
/**
|
|
563
283
|
* The client the environment describes: `BELTIC_API_KEY`,
|
|
564
284
|
* `BELTIC_BASE_URL`, `BELTIC_AGENT_SEED` (64 hex) and optionally
|
|
565
|
-
* `BELTIC_AGENT_CREDENTIAL
|
|
566
|
-
*
|
|
285
|
+
* `BELTIC_AGENT_CREDENTIAL`. Any of the three missing is a configuration
|
|
286
|
+
* error, thrown (GAP-78).
|
|
567
287
|
*/
|
|
568
288
|
static fromEnv(env = _Beltic.processEnv(), opts = {}) {
|
|
569
289
|
const missing = ENV_REQUIRED.filter((name) => !env[name]);
|
|
570
|
-
if (missing.length === ENV_REQUIRED.length) return _Beltic.disabled(opts);
|
|
571
290
|
if (missing.length > 0)
|
|
572
|
-
throw new
|
|
573
|
-
|
|
291
|
+
throw new BelticConfigError(
|
|
292
|
+
`${missing.join(", ")} missing \u2014 fromEnv needs ${ENV_REQUIRED.join(", ")}`
|
|
574
293
|
);
|
|
575
294
|
return new _Beltic({
|
|
576
|
-
failOpen: true,
|
|
577
295
|
...opts,
|
|
578
296
|
apiKey: env.BELTIC_API_KEY,
|
|
579
297
|
baseUrl: env.BELTIC_BASE_URL,
|
|
580
298
|
identity: identityFromSeed(fromHex(env.BELTIC_AGENT_SEED), env[ENV_CREDENTIAL])
|
|
581
299
|
});
|
|
582
300
|
}
|
|
583
|
-
/** A client that records nothing and never throws into the work: the null object for "no evidence stream" (GAP-78). */
|
|
584
|
-
static disabled(opts = {}) {
|
|
585
|
-
return new _Beltic({
|
|
586
|
-
...opts,
|
|
587
|
-
apiKey: "",
|
|
588
|
-
baseUrl: "http://beltic.disabled.invalid",
|
|
589
|
-
failOpen: true,
|
|
590
|
-
enabled: false
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
301
|
constructor(opts) {
|
|
594
|
-
|
|
302
|
+
if (!opts.apiKey) throw new BelticConfigError("apiKey is required");
|
|
303
|
+
if (!URL.canParse(opts.baseUrl))
|
|
304
|
+
throw new BelticConfigError(`baseUrl is not a URL: ${JSON.stringify(opts.baseUrl)}`);
|
|
595
305
|
this.failOpen = opts.failOpen ?? false;
|
|
596
306
|
this.onError = opts.onError ?? ((err) => console.error("[beltic]", err));
|
|
597
|
-
this.api = new ApiClient({
|
|
307
|
+
this.api = new ApiClient({
|
|
308
|
+
baseUrl: opts.baseUrl,
|
|
309
|
+
apiKey: opts.apiKey,
|
|
310
|
+
fetch: opts.fetch,
|
|
311
|
+
userAgent: `@belticlabs/agent-risk-sdk/${SDK_VERSION}`
|
|
312
|
+
});
|
|
598
313
|
this.transport = new Transport(this.api, {
|
|
314
|
+
...opts.transport,
|
|
599
315
|
onError: this.onError,
|
|
600
|
-
onChainHalted: this.onError
|
|
601
|
-
...opts.transport
|
|
316
|
+
onChainHalted: this.onError
|
|
602
317
|
});
|
|
603
318
|
this.sessions = new Sessions({
|
|
604
319
|
api: this.api,
|
|
605
320
|
transport: this.transport,
|
|
606
321
|
sdkVersion: SDK_VERSION,
|
|
607
322
|
identity: opts.identity,
|
|
608
|
-
redact: opts.redact,
|
|
609
|
-
now: opts.now,
|
|
610
323
|
failOpen: this.failOpen,
|
|
611
324
|
onError: this.onError,
|
|
612
|
-
openRetryMs: opts.openRetryMs
|
|
613
|
-
enabled: this.enabled
|
|
325
|
+
openRetryMs: opts.openRetryMs
|
|
614
326
|
});
|
|
615
327
|
this.identity = opts.identity;
|
|
616
|
-
this.correlation = opts.correlation ?? new MemoryCorrelationStore();
|
|
617
328
|
this.onReview = opts.onReview ?? "abort";
|
|
618
329
|
}
|
|
619
330
|
/**
|
|
@@ -622,15 +333,14 @@ var Beltic = class _Beltic {
|
|
|
622
333
|
* is flushed first so the platform judges what the caller already saw
|
|
623
334
|
* (GAP-16). A recorded moment is accepted as is: only its comparable core
|
|
624
335
|
* (payee, amount, payer) is sent. `null` only under `failOpen`, when the
|
|
625
|
-
* platform could not be
|
|
336
|
+
* platform could not be reached.
|
|
626
337
|
*/
|
|
627
338
|
async evaluate(sessionId, payment) {
|
|
628
|
-
if (!this.enabled) return null;
|
|
629
339
|
const input = { sessionId, payment: summaryOf(payment) };
|
|
630
|
-
if (!this.failOpen) return this.decide(input);
|
|
631
340
|
try {
|
|
632
341
|
return await this.decide(input);
|
|
633
342
|
} catch (err) {
|
|
343
|
+
if (!this.failOpen || !Transport.outage(err)) throw err;
|
|
634
344
|
this.onError(err);
|
|
635
345
|
return null;
|
|
636
346
|
}
|
|
@@ -672,30 +382,16 @@ var Beltic = class _Beltic {
|
|
|
672
382
|
return globalThis.process?.env ?? {};
|
|
673
383
|
}
|
|
674
384
|
};
|
|
675
|
-
function createBeltic(opts) {
|
|
676
|
-
return new Beltic(opts);
|
|
677
|
-
}
|
|
678
385
|
export {
|
|
679
386
|
ApiClient,
|
|
680
387
|
Beltic,
|
|
681
388
|
BelticApiError,
|
|
682
|
-
|
|
389
|
+
BelticConfigError,
|
|
683
390
|
ChainRejectedError,
|
|
684
|
-
DEFAULT_OPEN_RETRY_MS,
|
|
685
|
-
DEFAULT_TRANSPORT,
|
|
686
391
|
Decision,
|
|
687
|
-
MemoryCorrelationStore,
|
|
688
392
|
Run,
|
|
689
393
|
SDK_VERSION,
|
|
690
394
|
Session,
|
|
691
|
-
Sessions,
|
|
692
395
|
Transport,
|
|
693
|
-
|
|
694
|
-
createBeltic,
|
|
695
|
-
ephemeralIdentity,
|
|
696
|
-
fileIdentity,
|
|
697
|
-
identityFromSeed,
|
|
698
|
-
presentedFrom,
|
|
699
|
-
recordCall,
|
|
700
|
-
summaryOf
|
|
396
|
+
identityFromSeed
|
|
701
397
|
};
|
package/dist/protocol/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ALL_SOURCES,
|
|
1
|
+
import { J as JsonValue, E as EvidenceSourceAll } from '../verdict-DMnbFuS5.js';
|
|
2
|
+
export { A as ALL_SOURCES, a as ANOMALY_TYPES, b as Amount, c as AmountSchema, d as ApiError, e as ApiErrorSchema, C as ChainHead, f as ChainHeadSchema, g as CreatePolicyInput, h as CreatePolicyInputSchema, i as CreatePolicyOutput, j as CreatePolicyOutputSchema, k as CreateSessionInput, l as CreateSessionInputSchema, m as CreateSessionOutput, n as CreateSessionOutputSchema, D as Decision, o as DecisionSchema, p as DeclaredIntent, q as DeclaredIntentSchema, r as DigestedEnvelope, s as EvaluateInput, t as EvaluateInputSchema, u as EvaluateOutput, v as EvaluateOutputSchema, w as EventResult, x as EventResultSchema, y as EventResultStatus, z as EventResultStatusSchema, B as EvidenceAck, F as EvidenceAckSchema, G as EvidenceBatchInput, H as EvidenceBatchInputSchema, I as EvidenceEnvelope, K as EvidenceEvent, L as EvidenceEventSchema, M as EvidenceKind, N as EvidenceKindSchema, O as EvidenceSource, Q as EvidenceSourceAllSchema, R as EvidenceSourceSchema, S as GatewayDecisionPayload, T as GatewayDecisionPayloadSchema, U as Hex64, V as Hex64Schema, W as IntentDeclaredPayload, X as IntentDeclaredPayloadSchema, Y as JsonObject, Z as JsonValueSchema, _ as LlmCallEndPayload, $ as LlmCallEndPayloadSchema, a0 as LlmCallStartPayload, a1 as LlmCallStartPayloadSchema, a2 as MAX_BATCH_EVENTS, a3 as OnReview, a4 as PAYMENT_ARTIFACTS, a5 as PLATFORM_KINDS, a6 as PayloadByKind, P as PaymentMomentPayload, a7 as PaymentMomentPayloadSchema, a8 as PaymentSummary, a9 as PaymentSummarySchema, aa as PlatformAnomalyPayload, ab as PlatformAnomalyPayloadSchema, ac as PlatformEvidenceKind, ad as PlatformEvidenceKindSchema, ae as PlatformObservationPayload, af as PlatformObservationPayloadSchema, ag as SESSION_CLOSE_REASONS, ah as SOURCE_ORDER, ai as SeqSchema, aj as SessionClosePayload, ak as SessionClosePayloadSchema, al as SessionIdSchema, am as SessionOpenPayload, an as SessionOpenPayloadSchema, ao as Sig, ap as SigSchema, aq as TimestampSchema, ar as ToolCallEndPayload, as as ToolCallEndPayloadSchema, at as ToolCallStartPayload, au as ToolCallStartPayloadSchema, av as TransportGapPayload, aw as TransportGapPayloadSchema, ax as Verdict, ay as WIRE_KINDS, az as WIRE_SOURCES, aA as WireEvidenceKind, aB as WireEvidenceKindSchema, aC as compareBySessionSource, aD as compareBySourceSeq, aE as isPlatformKind, aF as isWireKind, aG as payloadSchemaFor } from '../verdict-DMnbFuS5.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
declare const PRIMITIVES: readonly ["THRESHOLD", "MEMBERSHIP", "MATCH", "PRESENCE", "FRESHNESS"];
|