@atbash/sdk 0.3.25 → 0.4.0-dev.1

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.
@@ -0,0 +1,560 @@
1
+ type JudgeEndpointConfig = {
2
+ policy?: "default";
3
+ endpoint?: string;
4
+ } | {
5
+ policy: "self-hosted";
6
+ endpoint: string;
7
+ verifyPubKey: string;
8
+ };
9
+ interface ValidatedEndpoint {
10
+ url: string;
11
+ policy: "default" | "self-hosted";
12
+ verifyPubKey: string | null;
13
+ }
14
+ declare function validateJudgeEndpoint(judge?: JudgeEndpointConfig): ValidatedEndpoint;
15
+
16
+ /**
17
+ * User-facing types. Two groups:
18
+ * - Core types — the exact shapes the Rust core emits across the NAPI
19
+ * boundary (field names match the serde output byte-for-byte).
20
+ * - SDK types — the HTTP-facing result shapes the `Atbash` client returns,
21
+ * already normalized (verdict casing, status).
22
+ */
23
+ /** `generate_keypair` result. Note the `priv_key` / `pub_key` field names. */
24
+ interface KeyPair {
25
+ priv_key: string;
26
+ pub_key: string;
27
+ }
28
+ /** `load_agent` result. Note the `privkey` / `pubkey` field names. */
29
+ interface AgentAuth {
30
+ privkey: string;
31
+ pubkey: string;
32
+ }
33
+ interface SecretMatch {
34
+ kind: string;
35
+ length: number;
36
+ }
37
+ interface RedactResult {
38
+ redacted: string;
39
+ found: SecretMatch[];
40
+ }
41
+ interface MemoryEntry {
42
+ key: string;
43
+ value: string;
44
+ source?: string;
45
+ timestamp?: number;
46
+ }
47
+ interface MemorySnapshot {
48
+ entries: MemoryEntry[];
49
+ takenAt: number;
50
+ }
51
+ interface ModifiedEntry {
52
+ key: string;
53
+ before: string;
54
+ after: string;
55
+ }
56
+ type AnomalyType = "behavioral_override" | "bulk_insertion" | "safety_bypass" | "privilege_escalation" | "gradual_drift";
57
+ type AnomalySeverity = "low" | "medium" | "high" | "critical";
58
+ interface MemoryAnomaly {
59
+ type: AnomalyType;
60
+ severity: AnomalySeverity;
61
+ description: string;
62
+ entries: string[];
63
+ }
64
+ interface MemoryDiffResult {
65
+ safe: boolean;
66
+ added: MemoryEntry[];
67
+ removed: MemoryEntry[];
68
+ modified: ModifiedEntry[];
69
+ anomalies: MemoryAnomaly[];
70
+ }
71
+ /**
72
+ * Which Atbash chain an action runs against. `public` is the shared
73
+ * testnet (Free plan); `private` is reserved for Private / Swarm /
74
+ * Enterprise tier subscribers. The SDK resolves which one to use from
75
+ * the org's subscription via `orgName` — callers normally don't need
76
+ * to pass this manually.
77
+ */
78
+ type Network = "public" | "private";
79
+ /**
80
+ * Per-call chain overrides. Pass exactly what you need to override —
81
+ * `network` selects between the SDK's known chains, `blockchainRid` /
82
+ * `nodeUrls` pin a fully custom chain. Pass none of these to fall back
83
+ * to the SDK's defaults (or to org-resolved chain when `orgName` is set).
84
+ */
85
+ interface ChainOpts {
86
+ network?: Network;
87
+ blockchainRid?: string;
88
+ nodeUrls?: readonly string[];
89
+ }
90
+ /** Canonical verdict after normalization. */
91
+ type Verdict = "ALLOW" | "HOLD" | "BLOCK" | "No verdict";
92
+ /** Canonical judgment status after normalization. */
93
+ type JudgmentState = "pending" | "answered" | "error";
94
+ /**
95
+ * Provider attribution on a judged action. The trailing `string & {}`
96
+ * accepts custom provider names without losing autocompletion on the
97
+ * canonical ones.
98
+ */
99
+ type Provider = "openai" | "google" | "microsoft" | "custom" | (string & {});
100
+ /** Verdict action_type carried in the judge response. */
101
+ type ActionType = "allow" | "hold_for_user_confirm" | "block" | (string & {});
102
+ /** Pubkey value as accepted on the wire — hex string, Buffer, or GTV bytes. */
103
+ type PubkeyValue = string | Buffer | {
104
+ data: number[];
105
+ };
106
+ interface LogToolCallResult {
107
+ success: boolean;
108
+ toolCallId: string | null;
109
+ signedHex?: string;
110
+ error?: string;
111
+ }
112
+ interface JudgeResult {
113
+ verdict: Verdict;
114
+ actionType: string;
115
+ reason: string;
116
+ confidence: number;
117
+ provider: string;
118
+ latencyMs: number;
119
+ toolCallId: string;
120
+ onChain: boolean;
121
+ }
122
+ interface JudgmentStatus {
123
+ status: JudgmentState;
124
+ verdict: Verdict;
125
+ reason: string;
126
+ judgmentId: string;
127
+ onChain?: boolean;
128
+ cached?: boolean;
129
+ responseTimeMs?: number;
130
+ }
131
+ interface TierInfo {
132
+ orgName: string;
133
+ tier: string;
134
+ verdictEnabled: boolean;
135
+ enforcementEnabled: boolean;
136
+ }
137
+ /**
138
+ * Plan-level subscription metadata. Returned by `org-subscription` —
139
+ * field names match the on-chain shape (snake_case) so the response
140
+ * can be inspected without renaming.
141
+ */
142
+ interface Subscription {
143
+ subscription_name: string;
144
+ agent_number: number;
145
+ is_private_blockchain: boolean;
146
+ monthly_price: number;
147
+ yearly_price: number;
148
+ }
149
+ /**
150
+ * Org's binding to a subscription on a specific chain. The chain is
151
+ * implied by which BRID the query hit (controlled by the `network`
152
+ * query param when fetching).
153
+ */
154
+ interface OrgSubscription extends Subscription {
155
+ org_name: string;
156
+ duration_months: number;
157
+ assigned_at: number;
158
+ expires_at: number;
159
+ is_active: boolean;
160
+ }
161
+ interface ToolCallRecord {
162
+ toolCallId: string;
163
+ agentPubkey: string;
164
+ toolName: string;
165
+ commandText: string;
166
+ toolArgsJson: string;
167
+ contextText: string;
168
+ orgName: string;
169
+ rowid: number;
170
+ }
171
+ interface ToolCallFull {
172
+ toolCallId: string;
173
+ agentPubkey: string;
174
+ toolName: string;
175
+ commandText: string;
176
+ contextText: string;
177
+ orgName: string;
178
+ toolArgsJson?: string;
179
+ createdAt?: number;
180
+ actionType?: string;
181
+ resultStatus?: string;
182
+ verdictColor?: string;
183
+ verdictReason?: string;
184
+ verdictSource?: string;
185
+ verdictResponseTimeMs?: number;
186
+ }
187
+ interface HeldAction {
188
+ judgmentId: string;
189
+ agentPubkey: string;
190
+ actionText: string;
191
+ actionContext: string;
192
+ verdict: Verdict;
193
+ reason: string;
194
+ createdAt: number;
195
+ }
196
+ interface HeldActionReview {
197
+ judgmentId: string;
198
+ actionText: string;
199
+ status: string;
200
+ reviewNote: string;
201
+ reviewedAt: number;
202
+ createdAt: number;
203
+ reviewedBy?: string;
204
+ }
205
+ interface AgentPolicy {
206
+ policy: string;
207
+ isJailed: boolean;
208
+ isCustom: boolean;
209
+ defaultPolicy: string;
210
+ }
211
+ /** Optional structured logger. */
212
+ interface AtbashLogger {
213
+ info?(...args: unknown[]): void;
214
+ warn?(...args: unknown[]): void;
215
+ }
216
+ /** Options accepted by the `Atbash` constructor. */
217
+ interface AtbashOptions {
218
+ endpoint?: string;
219
+ timeoutMs?: number;
220
+ nodeUrls?: readonly string[];
221
+ blockchainRid?: string;
222
+ /**
223
+ * Default org name. When set, `judgeAction` / `auditToolCall` resolve
224
+ * the chain via the `org_networks` map on every call (with the
225
+ * per-client cache short-circuiting the second hit onwards). Per-call
226
+ * overrides on the method options still win.
227
+ */
228
+ orgName?: string;
229
+ /**
230
+ * Default response-signing pubkey for `judgeAction` verification. Set
231
+ * automatically by `Atbash.fromConfig` for self-hosted endpoints; a
232
+ * per-call `verifyPubKey` still overrides it.
233
+ */
234
+ verifyPubKey?: string;
235
+ /** When true (default), `auditToolCall` denies on any error. */
236
+ failClosed?: boolean;
237
+ logger?: AtbashLogger;
238
+ }
239
+ /** Canonical decision returned by `auditToolCall`. */
240
+ type DecisionVerdict = "ALLOW" | "HOLD" | "BLOCK" | "ERROR";
241
+ interface Decision {
242
+ allow: boolean;
243
+ verdict: DecisionVerdict;
244
+ reason?: string;
245
+ toolCallId?: string;
246
+ }
247
+ /** Input to `auditToolCall`. */
248
+ interface ToolCallInput {
249
+ toolName: string;
250
+ args?: unknown;
251
+ context?: string;
252
+ }
253
+ /** Options accepted by `Atbash.fromConfig`. All fields are explicit overrides. */
254
+ interface FromConfigOptions {
255
+ /** Inline private key. Overrides env / config-file / key-file resolution. */
256
+ agentKey?: string;
257
+ /** Path to the agent key file (default `~/.config/atbash/guard-client-key`). */
258
+ keyPath?: string;
259
+ /** Judge endpoint config — validated against the allowlist / self-hosted policy. */
260
+ judge?: JudgeEndpointConfig;
261
+ blockchainRid?: string;
262
+ timeoutMs?: number;
263
+ nodeUrls?: readonly string[];
264
+ /** Default org name — see {@link AtbashOptions.orgName}. */
265
+ orgName?: string;
266
+ failClosed?: boolean;
267
+ logger?: AtbashLogger;
268
+ }
269
+ /** Options accepted by `judgeAction`. */
270
+ interface JudgeOptions {
271
+ toolName?: string;
272
+ toolArgsJson?: string;
273
+ provider?: string;
274
+ model?: string;
275
+ verifyPubKey?: string;
276
+ /**
277
+ * Org name — when set, the SDK resolves which chain the agent lives
278
+ * on via the off-chain `org_networks` map (authoritative) before
279
+ * signing. Overrides any `chainOpts.blockchainRid` hint when the map
280
+ * has an entry.
281
+ */
282
+ orgName?: string;
283
+ /**
284
+ * Explicit per-call chain override. Use to pin a specific chain for
285
+ * one call; otherwise the SDK uses the constructor defaults or the
286
+ * org-resolved chain.
287
+ */
288
+ chainOpts?: ChainOpts;
289
+ }
290
+ /** Options accepted by `logToolCall`. */
291
+ interface LogToolCallOptions {
292
+ toolName?: string;
293
+ toolArgsJson?: string;
294
+ /** Per-call chain override — same semantics as `JudgeOptions.chainOpts`. */
295
+ chainOpts?: ChainOpts;
296
+ }
297
+
298
+ interface ChainConfig {
299
+ readonly network: Network;
300
+ readonly blockchainRid: string;
301
+ readonly nodeUrls: readonly string[];
302
+ }
303
+
304
+ declare class Atbash {
305
+ readonly auth: AgentAuth;
306
+ readonly endpoint: string;
307
+ readonly nodeUrls: readonly string[];
308
+ readonly blockchainRid: string;
309
+ /** Default org name used by `auditToolCall` / `judgeAction`. */
310
+ readonly orgName?: string;
311
+ /** Default judge response-signing pubkey, if configured (see fromConfig). */
312
+ readonly verifyPubKey?: string;
313
+ /** When true (default), `auditToolCall` denies on any error. */
314
+ readonly failClosed: boolean;
315
+ private readonly logger;
316
+ private readonly http;
317
+ /**
318
+ * Per-client cache of resolved chains. Keyed by orgName so repeated
319
+ * calls don't re-hit the dashboard. Cleared by `clearChainCache()`.
320
+ */
321
+ private readonly _chainCache;
322
+ /**
323
+ * Cached bearer token for risk-engine / insurance read calls. Built
324
+ * lazily as a signed `log_tool_call` tx and refreshed every 4 min so
325
+ * server-side replay protection windows never expire it mid-session.
326
+ */
327
+ private _authBearer;
328
+ constructor(privkey: string, options?: AtbashOptions);
329
+ /**
330
+ * Construct from resolved config: explicit overrides → env vars → the
331
+ * `~/.config/atbash/config.json` file (see userConfig.resolve). The private
332
+ * key comes from `agentKey` (override/env/file) or, failing that, the agent
333
+ * key file (`~/.config/atbash/guard-client-key`). The judge endpoint is
334
+ * validated against the trusted allowlist / self-hosted policy; a
335
+ * self-hosted endpoint's `verifyPubKey` becomes the client default.
336
+ */
337
+ static fromConfig(options?: FromConfigOptions): Atbash;
338
+ get pubkey(): string;
339
+ get privkey(): string;
340
+ /** GET /api/ai/exists?pubkey=… — defaults to this client's pubkey. */
341
+ checkAgentExists(pubkey?: string): Promise<boolean>;
342
+ /**
343
+ * Pre-flight `checkAgentExists`, then sign `log_tool_call` locally and
344
+ * return the signed tx hex. The server broadcasts to chain.
345
+ */
346
+ logToolCall(action: string, context?: string, options?: LogToolCallOptions): Promise<LogToolCallResult>;
347
+ /**
348
+ * Sign log_tool_call + optionally judge_action, POST /api/v1/judge.
349
+ *
350
+ * `verifyPubKey` checks the `X-Atbash-Signature` header against the exact
351
+ * response bytes via the Rust core's `verifySignature`.
352
+ */
353
+ judgeAction(action: string, context?: string, options?: JudgeOptions): Promise<JudgeResult>;
354
+ private _judgeAction;
355
+ /**
356
+ * High-level guard: redact secrets, submit for judgement, and collapse the
357
+ * result into an allow/deny `Decision`. Fails closed by default — any error
358
+ * (judge unreachable, unrecognized verdict) denies unless `failClosed` is
359
+ * explicitly false.
360
+ */
361
+ auditToolCall(input: ToolCallInput): Promise<Decision>;
362
+ private fail;
363
+ getJudgmentStatus(judgmentId: string, agentPubkey?: string): Promise<JudgmentStatus>;
364
+ getToolCalls(maxCount: number): Promise<ToolCallRecord[]>;
365
+ getOrgToolCalls(orgName: string, maxCount: number): Promise<ToolCallRecord[]>;
366
+ getAgentToolCalls(agentPubkey: string, maxCount: number): Promise<ToolCallRecord[]>;
367
+ getToolCallCount(): Promise<number>;
368
+ getToolCallFull(toolCallId: string): Promise<ToolCallFull | null>;
369
+ getOrgTierInfo(orgName: string): Promise<TierInfo | null>;
370
+ getPendingHeldActions(orgName: string, maxCount: number): Promise<HeldAction[]>;
371
+ getHeldActionReviews(orgName: string, maxCount: number): Promise<HeldActionReview[]>;
372
+ getAgentDetail(agentPubkey: string): Promise<Record<string, unknown>>;
373
+ getAgentPolicy(agentPubkey: string): Promise<AgentPolicy>;
374
+ getSafetyStats(): Promise<Record<string, unknown>>;
375
+ /**
376
+ * Org's subscription on a specific chain. The `network` arg selects
377
+ * which chain to query; without it, the dashboard picks the default.
378
+ * Returns null when the org has no record on that chain.
379
+ */
380
+ getOrgSubscription(orgName: string, network?: Network): Promise<OrgSubscription | null>;
381
+ /**
382
+ * Read the org's active network from the dashboard's off-chain
383
+ * `org_networks` map. The map is the authoritative source after a
384
+ * plan switch — subscription rows on the source chain go stale, but
385
+ * the map is updated on every assign. Returns null when there's no
386
+ * entry (caller falls back to per-chain subscription resolution).
387
+ */
388
+ getActiveNetworkForOrg(orgName: string): Promise<Network | null>;
389
+ /**
390
+ * Resolve which chain an org's actions should run against. Cached
391
+ * per-client by orgName. Resolution order:
392
+ * 1. `org_networks` map (authoritative).
393
+ * 2. Per-chain subscription fallback — public + private records
394
+ * are fetched in parallel, with `is_private_blockchain` and
395
+ * `assigned_at` reconciling mixed states.
396
+ * Defaults to the public chain when nothing else resolves.
397
+ */
398
+ resolveChainForOrg(orgName: string): Promise<ChainConfig>;
399
+ /**
400
+ * Resolve a chain given an already-fetched `org_networks` map result.
401
+ * Split out from {@link resolveChainForOrg} so callers that have already
402
+ * queried the map (the judge path) don't fetch /api/org-network twice.
403
+ * Caches per orgName like its caller.
404
+ */
405
+ private resolveChainFromMap;
406
+ /** Drop any cached chain resolutions. Useful in tests. */
407
+ clearChainCache(): void;
408
+ /**
409
+ * Wrap an SDK method body in telemetry — records the call at start
410
+ * and a success/error duration at end. Re-throws on failure so the
411
+ * caller sees the original exception. Pass `agentPubkey` when the
412
+ * method is keyed to a specific agent; tracked methods that don't
413
+ * depend on an agent (read queries) pass `undefined`.
414
+ */
415
+ private track;
416
+ /**
417
+ * Pick the BRID for a given per-call chain override. `blockchainRid`
418
+ * takes precedence; otherwise `network` maps to one of the known
419
+ * chains; otherwise the client's default.
420
+ */
421
+ private bridFromChainOpts;
422
+ /**
423
+ * Get-or-create a Bearer token for dashboard reads. The token is a
424
+ * signed `log_tool_call` op (locally signed, never submitted) — the
425
+ * dashboard verifies the signature against the agent's pubkey. Cached
426
+ * for 4 minutes; refreshed after that so a long-lived client never
427
+ * trips the server's replay window.
428
+ */
429
+ private getAuthBearer;
430
+ private authHeaders;
431
+ private riskEngineGet;
432
+ private riskEnginePost;
433
+ private riskEngineRecords;
434
+ private raiseIfError;
435
+ /** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
436
+ private httpError;
437
+ /** Wrap a *transport* failure (fetch threw, no response) as an AtbashAPIError. */
438
+ private transportError;
439
+ private json;
440
+ static generateKeypair(): KeyPair;
441
+ static isValidPrivateKey(hex: string): boolean;
442
+ static derivePublicKey(privkey: string): string;
443
+ static redactSecrets(text: string): RedactResult;
444
+ static normalizeForMatching(text: string): string;
445
+ static containsEvasionCharacters(text: string): boolean;
446
+ }
447
+
448
+ declare const DEFAULT_ENDPOINT: string;
449
+ declare const DEFAULT_CHROMIA_NODE_URLS: readonly string[];
450
+ declare const DEFAULT_BLOCKCHAIN_RID: string;
451
+
452
+ declare class AtbashAPIError extends Error {
453
+ /** HTTP status code (or 0 if the request never completed). */
454
+ readonly status: number;
455
+ /** Raw response body text (may be empty). */
456
+ readonly body: string;
457
+ constructor(status: number, body: string, statusText?: string, endpoint?: string);
458
+ }
459
+ declare class SignatureVerificationError extends Error {
460
+ constructor(message: string);
461
+ }
462
+
463
+ /** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
464
+
465
+ declare function normalizeVerdict(raw: unknown): Verdict;
466
+ declare function normalizeStatus(raw: unknown): JudgmentState;
467
+ /** Wire pubkey may be a hex string, a Buffer/Uint8Array, or `{ data: [...] }`. */
468
+ declare function pubkeyToHex(val: unknown): string;
469
+
470
+ interface AtbashUserConfig {
471
+ agentKey?: string;
472
+ orgName?: string;
473
+ judgeEndpoint?: string;
474
+ blockchainRid?: string;
475
+ provider?: string;
476
+ providerModel?: string;
477
+ }
478
+ declare function getConfigDir(): string;
479
+ declare function getConfigPath(): string;
480
+ declare function loadUserConfig(): AtbashUserConfig;
481
+ declare function saveUserConfig(config: AtbashUserConfig): void;
482
+ declare function resolve(key: keyof AtbashUserConfig, flagValue?: string): string;
483
+
484
+ declare function resolveKeyPath(input?: string): string;
485
+ declare function loadAgentFromFile(keyPath?: string): AgentAuth;
486
+
487
+ /**
488
+ * Canonical secret kinds reported by the Rust core in `SecretMatch.kind`.
489
+ * Wire is permissive (modelled as a free string in {@link SecretMatch})
490
+ * so unknown kinds don't break callers; use this union when narrowing.
491
+ */
492
+ type SecretKind = "anthropic" | "openai" | "openai_project" | "github" | "google" | "google_oauth" | "aws_access_key" | "aws_secret_key" | "stripe" | "slack" | "slack_webhook" | "sendgrid" | "twilio_sid" | "mailgun" | "npm_token" | "jwt" | "private_key_pem" | "context_secret" | "bearer" | "base64" | "generic_token";
493
+ /**
494
+ * Walk a JSON-shaped value and redact secrets inside every string leaf.
495
+ * Object keys are not touched; only values. Arrays and nested objects
496
+ * are recursed structurally so the returned value has the same shape.
497
+ */
498
+ declare function redactJsonStrings<T>(value: T): T;
499
+
500
+ declare function verifyJudgeResponseSignature(bodyBytes: Uint8Array, signatureHex: string | null, pubKeyHex: string): {
501
+ ok: boolean;
502
+ reason?: string;
503
+ };
504
+
505
+ /**
506
+ * Atbash SDK Telemetry — OpenTelemetry metrics for usage tracking.
507
+ *
508
+ * Tracks: function call counts, latency, source (CLI/plugin/SDK),
509
+ * and agent identity. ON by default.
510
+ *
511
+ * Opt-out: create ~/.config/atbash/telemetry.json with { "enabled": false }
512
+ * The file must be readable by the SDK process. If missing, corrupted, or
513
+ * unreadable → telemetry stays ON. Environment variables cannot disable
514
+ * telemetry (prevents agent bypass via env-var injection).
515
+ */
516
+ type ClientSource = "cli" | "sdk" | "plugin:openclaw" | "plugin:langchain" | "plugin:langgraph" | "plugin:hermes" | "plugin:eliza" | "plugin:crewai" | "plugin:mcp" | "plugin:autogen" | "plugin:jeenai" | (string & {});
517
+ interface TelemetryConfig {
518
+ /** Must be true to send any telemetry. Default: false */
519
+ enabled: boolean;
520
+ /** Where calls originate */
521
+ source?: ClientSource;
522
+ /** Flush interval in ms. Default: 60000 */
523
+ exportIntervalMs?: number;
524
+ }
525
+ declare function setupTelemetry(config: TelemetryConfig): void;
526
+ /**
527
+ * Record a function call. Call at the START of each tracked function.
528
+ * Safe to call even if telemetry is disabled — does nothing.
529
+ */
530
+ declare function recordCall(functionName: string, source?: ClientSource, agentPubkey?: string): void;
531
+ /**
532
+ * Record function duration. Call at the END of each tracked function.
533
+ * Safe to call even if telemetry is disabled — does nothing.
534
+ */
535
+ declare function recordDuration(functionName: string, durationMs: number, status: "success" | "error", source?: ClientSource): void;
536
+ /**
537
+ * Force-flush pending metrics without shutting down.
538
+ * Use in short-lived processes (CLI) to ensure data is sent.
539
+ */
540
+ declare function flushTelemetry(): Promise<void>;
541
+ /**
542
+ * Flush pending metrics and shut down. Call before process exits.
543
+ */
544
+ declare function shutdownTelemetry(): Promise<void>;
545
+
546
+ declare function isValidPrivateKey(hex: string): boolean;
547
+ declare function derivePublicKey(privkey: string): string;
548
+ declare function generateKeypair(): KeyPair;
549
+ declare function loadAgent(privkey: string): AgentAuth;
550
+ declare function signLogToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, privkey: string, blockchainRid: string): string;
551
+ declare function signJudgeAction(judgmentId: string, action: string, context: string, extra: string, privkey: string, blockchainRid: string): string;
552
+ declare function verifySignature(body: Buffer, signatureHex: string, pubkeyHex: string): boolean;
553
+ declare function normalizeForMatching(text: string): string;
554
+ declare function containsEvasionCharacters(text: string): boolean;
555
+ declare function redactSecrets(text: string): RedactResult;
556
+ declare function containsSecret(text: string): boolean;
557
+ declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
558
+ declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
559
+
560
+ export { type ActionType, type AgentAuth, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClientSource, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, type Decision, type DecisionVerdict, type FromConfigOptions, type HeldAction, type HeldActionReview, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, type Provider, type PubkeyValue, type RedactResult, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, containsEvasionCharacters, containsSecret, createMemorySnapshot, derivePublicKey, diffMemorySnapshots, flushTelemetry, generateKeypair, getConfigDir, getConfigPath, isValidPrivateKey, loadAgent, loadAgentFromFile, loadUserConfig, normalizeForMatching, normalizeStatus, normalizeVerdict, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, saveUserConfig, setupTelemetry, shutdownTelemetry, signJudgeAction, signLogToolCall, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };