@atbash/sdk 0.9.0-dev.0 → 0.9.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.
- package/README.md +19 -6
- package/dist/browser.d.mts +537 -202
- package/dist/browser.mjs +1131 -711
- package/dist/index.d.mts +537 -202
- package/dist/index.d.ts +537 -202
- package/dist/index.js +38466 -40685
- package/dist/index.mjs +39228 -41466
- package/index.d.ts +264 -14
- package/index.js +347 -104
- package/package.json +8 -5
- package/dist/browser.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -11,8 +11,34 @@ interface ValidatedEndpoint {
|
|
|
11
11
|
policy: "default" | "self-hosted";
|
|
12
12
|
verifyPubKey: string | null;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the trusted judge host set.
|
|
16
|
+
*
|
|
17
|
+
* The compiled-in default is always trusted: a `prod` build resolves it to
|
|
18
|
+
* atbash.ai, a dev build to whatever DEV_ENDPOINT was set at build time. No
|
|
19
|
+
* dev host is spelled out in source, and dev builds still validate their own
|
|
20
|
+
* default.
|
|
21
|
+
*
|
|
22
|
+
* Exported for tests only. The set is a build-time value and is deliberately
|
|
23
|
+
* never read from the process environment — an env var would let anyone widen
|
|
24
|
+
* the allowlist of an already-shipped artifact, which is the silent-redirection
|
|
25
|
+
* attack the allowlist exists to prevent (F-003). Asserting that requires
|
|
26
|
+
* calling this with the environment set, so it cannot stay module-private.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
declare function buildAllowedJudgeHosts(): ReadonlySet<string>;
|
|
14
31
|
declare function validateJudgeEndpoint(judge?: JudgeEndpointConfig): ValidatedEndpoint;
|
|
15
32
|
|
|
33
|
+
interface ChainConfig {
|
|
34
|
+
readonly network: Network;
|
|
35
|
+
readonly blockchainRid: string;
|
|
36
|
+
readonly nodeUrls: readonly string[];
|
|
37
|
+
}
|
|
38
|
+
declare const PUBLIC_CHAIN: ChainConfig;
|
|
39
|
+
declare const PRIVATE_CHAIN: ChainConfig;
|
|
40
|
+
declare function chainForNetwork(network: Network): ChainConfig;
|
|
41
|
+
|
|
16
42
|
/**
|
|
17
43
|
* User-facing types. Two groups:
|
|
18
44
|
* - Core types — the exact shapes the Rust core emits across the NAPI
|
|
@@ -143,6 +169,11 @@ interface LogToolCallResult {
|
|
|
143
169
|
}
|
|
144
170
|
interface JudgeResult {
|
|
145
171
|
verdict: Verdict;
|
|
172
|
+
/**
|
|
173
|
+
* Canonical executable permission, computed by `canonicalAllow` — see that
|
|
174
|
+
* function for the rule. Never more permissive than `auditToolCall`.
|
|
175
|
+
*/
|
|
176
|
+
allow: boolean;
|
|
146
177
|
actionType: string;
|
|
147
178
|
reason: string;
|
|
148
179
|
confidence: number;
|
|
@@ -171,6 +202,8 @@ interface JudgeResult {
|
|
|
171
202
|
interface JudgmentStatus {
|
|
172
203
|
status: JudgmentState;
|
|
173
204
|
verdict: Verdict;
|
|
205
|
+
/** Same canonical executable permission as {@link JudgeResult.allow}. */
|
|
206
|
+
allow: boolean;
|
|
174
207
|
reason: string;
|
|
175
208
|
judgmentId: string;
|
|
176
209
|
onChain?: boolean;
|
|
@@ -257,6 +290,13 @@ interface AgentPolicy {
|
|
|
257
290
|
isCustom: boolean;
|
|
258
291
|
defaultPolicy: string;
|
|
259
292
|
}
|
|
293
|
+
/** Options for agent metadata and policy lookups. */
|
|
294
|
+
interface AgentLookupOptions {
|
|
295
|
+
/** Resolve the agent's network from this organization's active network. */
|
|
296
|
+
orgName?: string;
|
|
297
|
+
/** Explicit per-call chain override. `network` selects the dashboard chain. */
|
|
298
|
+
chainOpts?: ChainOpts;
|
|
299
|
+
}
|
|
260
300
|
/** Optional structured logger. */
|
|
261
301
|
interface AtbashLogger {
|
|
262
302
|
info?(...args: unknown[]): void;
|
|
@@ -266,7 +306,24 @@ interface AtbashLogger {
|
|
|
266
306
|
interface AtbashOptions {
|
|
267
307
|
endpoint?: string;
|
|
268
308
|
timeoutMs?: number;
|
|
309
|
+
/**
|
|
310
|
+
* Full chain override — BRID + nodeUrls in one object. Wins over every
|
|
311
|
+
* other chain selector. Prefer this over paired `nodeUrls`/`blockchainRid`
|
|
312
|
+
* for anything but backwards compatibility.
|
|
313
|
+
*/
|
|
314
|
+
chain?: ChainConfig;
|
|
315
|
+
/**
|
|
316
|
+
* Preset chain selector — `"public"` or `"private"`. Resolves to the
|
|
317
|
+
* matching `ChainConfig` via `chainForNetwork()`. Overridden by `chain`,
|
|
318
|
+
* overrides env `ATBASH_DEFAULT_CHAIN_NETWORK` and the config file.
|
|
319
|
+
*/
|
|
320
|
+
network?: Network;
|
|
321
|
+
/**
|
|
322
|
+
* Explicit node URLs. Must be paired with `blockchainRid`. Passing one
|
|
323
|
+
* without the other throws — a BRID/nodes mismatch 404s every request.
|
|
324
|
+
*/
|
|
269
325
|
nodeUrls?: readonly string[];
|
|
326
|
+
/** Explicit BRID. Must be paired with `nodeUrls`. See {@link nodeUrls}. */
|
|
270
327
|
blockchainRid?: string;
|
|
271
328
|
/**
|
|
272
329
|
* Default org name. When set, `judgeAction` / `auditToolCall` resolve
|
|
@@ -293,6 +350,12 @@ interface AtbashOptions {
|
|
|
293
350
|
orgEncryptionPubKey?: string;
|
|
294
351
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
295
352
|
failClosed?: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Verbose diagnostics. Off by default. When on, a failed judge call also
|
|
355
|
+
* logs the response body, which is the difference between "judge API failed"
|
|
356
|
+
* and knowing why it failed. Opt-in because that body can echo the action.
|
|
357
|
+
*/
|
|
358
|
+
debug?: boolean;
|
|
296
359
|
logger?: AtbashLogger;
|
|
297
360
|
}
|
|
298
361
|
/** Canonical decision returned by `auditToolCall`. */
|
|
@@ -327,20 +390,24 @@ interface FromConfigOptions {
|
|
|
327
390
|
keyPath?: string;
|
|
328
391
|
/** Judge endpoint config — validated against the allowlist / self-hosted policy. */
|
|
329
392
|
judge?: JudgeEndpointConfig;
|
|
393
|
+
/** See {@link AtbashOptions.chain}. */
|
|
394
|
+
chain?: ChainConfig;
|
|
395
|
+
/** See {@link AtbashOptions.network}. */
|
|
396
|
+
network?: Network;
|
|
330
397
|
blockchainRid?: string;
|
|
331
398
|
timeoutMs?: number;
|
|
332
399
|
nodeUrls?: readonly string[];
|
|
333
400
|
/** Default org name — see {@link AtbashOptions.orgName}. */
|
|
334
401
|
orgName?: string;
|
|
335
402
|
failClosed?: boolean;
|
|
403
|
+
/** See {@link AtbashOptions.debug}. */
|
|
404
|
+
debug?: boolean;
|
|
336
405
|
logger?: AtbashLogger;
|
|
337
406
|
}
|
|
338
407
|
/** Options accepted by `judgeAction`. */
|
|
339
408
|
interface JudgeOptions {
|
|
340
409
|
toolName?: string;
|
|
341
410
|
toolArgsJson?: string;
|
|
342
|
-
provider?: string;
|
|
343
|
-
model?: string;
|
|
344
411
|
verifyPubKey?: string;
|
|
345
412
|
/** Per-call override of {@link AtbashOptions.orgEncryptionPubKey}. */
|
|
346
413
|
orgEncryptionPubKey?: string;
|
|
@@ -376,12 +443,6 @@ interface LogToolCallOptions {
|
|
|
376
443
|
orgEncryptionPubKey?: string;
|
|
377
444
|
}
|
|
378
445
|
|
|
379
|
-
interface ChainConfig {
|
|
380
|
-
readonly network: Network;
|
|
381
|
-
readonly blockchainRid: string;
|
|
382
|
-
readonly nodeUrls: readonly string[];
|
|
383
|
-
}
|
|
384
|
-
|
|
385
446
|
declare class Atbash {
|
|
386
447
|
readonly auth: AgentAuth;
|
|
387
448
|
readonly endpoint: string;
|
|
@@ -395,6 +456,9 @@ declare class Atbash {
|
|
|
395
456
|
readonly orgEncryptionPubKey?: string;
|
|
396
457
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
397
458
|
readonly failClosed: boolean;
|
|
459
|
+
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
460
|
+
private _orgKeyFromChain;
|
|
461
|
+
private readonly debug;
|
|
398
462
|
private readonly logger;
|
|
399
463
|
private readonly http;
|
|
400
464
|
/**
|
|
@@ -402,13 +466,57 @@ declare class Atbash {
|
|
|
402
466
|
* calls don't re-hit the dashboard. Cleared by `clearChainCache()`.
|
|
403
467
|
*/
|
|
404
468
|
private readonly _chainCache;
|
|
469
|
+
/**
|
|
470
|
+
* The chain the constructor settled on. Used only where a lookup returns no
|
|
471
|
+
* answer — see {@link resolveChainFromMap}.
|
|
472
|
+
*/
|
|
473
|
+
private readonly _defaultChain;
|
|
474
|
+
/**
|
|
475
|
+
* True when the caller named a chain outright — `chain`, `network`, or the
|
|
476
|
+
* paired `blockchainRid` + `nodeUrls`.
|
|
477
|
+
*
|
|
478
|
+
* Such a client is never re-pointed: not by the migration switch, and not by
|
|
479
|
+
* where an org turns out to live. Naming a chain is the caller saying "talk
|
|
480
|
+
* to this one", and silently routing elsewhere would make the argument a
|
|
481
|
+
* suggestion. A client that names nothing is the one that follows the org.
|
|
482
|
+
*/
|
|
483
|
+
private readonly _explicitChain;
|
|
484
|
+
/**
|
|
485
|
+
* The fleet-wide chain switch, read once at construction. `resolve()` hits
|
|
486
|
+
* the config file on disk, so re-reading it per call would put a file read
|
|
487
|
+
* on every judge.
|
|
488
|
+
*/
|
|
489
|
+
private readonly _forcedNetwork;
|
|
490
|
+
/**
|
|
491
|
+
* Short-TTL cache for `/api/ai/exists`. The `registered` field is
|
|
492
|
+
* monotonic (once true, stays true), so most calls in a burst re-fetch
|
|
493
|
+
* data that hasn't changed. The `org_encryption_pubkey` field CAN change
|
|
494
|
+
* — an org toggling encryption mid-session — so the TTL is deliberately
|
|
495
|
+
* short (see `AGENT_EXISTS_TTL_MS`). Keyed by (pubkey, network) so
|
|
496
|
+
* cross-agent / cross-network calls don't collide.
|
|
497
|
+
*/
|
|
498
|
+
private _agentExistsCache;
|
|
499
|
+
private static readonly AGENT_EXISTS_TTL_MS;
|
|
405
500
|
/**
|
|
406
501
|
* Cached bearer token for risk-engine / insurance read calls. Built
|
|
407
502
|
* lazily as a signed `log_tool_call` tx and refreshed every 4 min so
|
|
408
503
|
* server-side replay protection windows never expire it mid-session.
|
|
409
504
|
*/
|
|
410
|
-
private
|
|
505
|
+
private _authBearers;
|
|
506
|
+
/** Guards `logEnvironmentOnce` — hosts construct several clients. */
|
|
507
|
+
private static environmentLogged;
|
|
411
508
|
constructor(privkey: string, options?: AtbashOptions);
|
|
509
|
+
/**
|
|
510
|
+
* Say which environment this build talks to, once per process.
|
|
511
|
+
*
|
|
512
|
+
* The endpoint and both chain RIDs are compiled in, chosen by the npm tag,
|
|
513
|
+
* and no configuration repoints a released build. So installing the build
|
|
514
|
+
* for the wrong environment is invisible: the plugin loads, the hook fires,
|
|
515
|
+
* and every judge call fails because the agent does not exist on the chain
|
|
516
|
+
* this build targets. Organisation names are not unique across environments
|
|
517
|
+
* either, so an org resolving is not evidence the build is right.
|
|
518
|
+
*/
|
|
519
|
+
private logEnvironmentOnce;
|
|
412
520
|
/**
|
|
413
521
|
* Construct from resolved config: explicit overrides → env vars → the
|
|
414
522
|
* `~/.config/atbash/config.json` file (see userConfig.resolve). The private
|
|
@@ -451,8 +559,27 @@ declare class Atbash {
|
|
|
451
559
|
* explicitly false.
|
|
452
560
|
*/
|
|
453
561
|
auditToolCall(input: ToolCallInput): Promise<Decision>;
|
|
562
|
+
/**
|
|
563
|
+
* One exit for every judge failure.
|
|
564
|
+
*
|
|
565
|
+
* Status and reason go in the *message*, not only in the meta object: hosts
|
|
566
|
+
* print the message and drop the meta, which is why this read as a bare
|
|
567
|
+
* "judge API failed" while the judge was answering with a precise reason.
|
|
568
|
+
* The response body follows only under `debug`, since it can echo the action.
|
|
569
|
+
*/
|
|
570
|
+
private failJudge;
|
|
454
571
|
private fail;
|
|
455
|
-
|
|
572
|
+
/**
|
|
573
|
+
* Return the current status of a previously submitted judgment.
|
|
574
|
+
*
|
|
575
|
+
* `chainOpts` names which chain the judgment was signed against. The
|
|
576
|
+
* server's GET /api/v1/judge routes to that chain when the SDK sends
|
|
577
|
+
* a `brid` query param; without it, the server falls back to public.
|
|
578
|
+
* Callers on the private chain must pass a `chainOpts` (or configure
|
|
579
|
+
* the client on the private chain) — otherwise polling a POSTed
|
|
580
|
+
* judgment on the private chain 404s at the server.
|
|
581
|
+
*/
|
|
582
|
+
getJudgmentStatus(judgmentId: string, agentPubkey?: string, chainOpts?: ChainOpts): Promise<JudgmentStatus>;
|
|
456
583
|
getToolCalls(maxCount: number): Promise<ToolCallRecord[]>;
|
|
457
584
|
getOrgToolCalls(orgName: string, maxCount: number): Promise<ToolCallRecord[]>;
|
|
458
585
|
getAgentToolCalls(agentPubkey: string, maxCount: number): Promise<ToolCallRecord[]>;
|
|
@@ -461,8 +588,8 @@ declare class Atbash {
|
|
|
461
588
|
getOrgTierInfo(orgName: string): Promise<TierInfo | null>;
|
|
462
589
|
getPendingHeldActions(orgName: string, maxCount: number): Promise<HeldAction[]>;
|
|
463
590
|
getHeldActionReviews(orgName: string, maxCount: number): Promise<HeldActionReview[]>;
|
|
464
|
-
getAgentDetail(agentPubkey: string): Promise<Record<string, unknown>>;
|
|
465
|
-
getAgentPolicy(agentPubkey: string): Promise<AgentPolicy>;
|
|
591
|
+
getAgentDetail(agentPubkey: string, options?: AgentLookupOptions): Promise<Record<string, unknown>>;
|
|
592
|
+
getAgentPolicy(agentPubkey: string, options?: AgentLookupOptions): Promise<AgentPolicy>;
|
|
466
593
|
getSafetyStats(): Promise<Record<string, unknown>>;
|
|
467
594
|
/**
|
|
468
595
|
* Org's subscription on a specific chain. The `network` arg selects
|
|
@@ -485,7 +612,9 @@ declare class Atbash {
|
|
|
485
612
|
* 2. Per-chain subscription fallback — public + private records
|
|
486
613
|
* are fetched in parallel, with `is_private_blockchain` and
|
|
487
614
|
* `assigned_at` reconciling mixed states.
|
|
488
|
-
*
|
|
615
|
+
* A lookup that names exactly one chain wins outright. Where it names
|
|
616
|
+
* neither (a brand-new org) or cannot choose between them, the client's
|
|
617
|
+
* configured default decides.
|
|
489
618
|
*/
|
|
490
619
|
resolveChainForOrg(orgName: string): Promise<ChainConfig>;
|
|
491
620
|
/**
|
|
@@ -497,6 +626,8 @@ declare class Atbash {
|
|
|
497
626
|
private resolveChainFromMap;
|
|
498
627
|
/** Drop any cached chain resolutions. Useful in tests. */
|
|
499
628
|
clearChainCache(): void;
|
|
629
|
+
/** Drop the short-TTL `/api/ai/exists` cache. Useful in tests. */
|
|
630
|
+
clearAgentExistsCache(): void;
|
|
500
631
|
/**
|
|
501
632
|
* Wrap an SDK method body in telemetry — records the call at start
|
|
502
633
|
* and a success/error duration at end. Re-throws on failure so the
|
|
@@ -511,6 +642,14 @@ declare class Atbash {
|
|
|
511
642
|
* chains; otherwise the client's default.
|
|
512
643
|
*/
|
|
513
644
|
private bridFromChainOpts;
|
|
645
|
+
/**
|
|
646
|
+
* Resolve the dashboard chain used by agent metadata/policy reads.
|
|
647
|
+
* Explicit per-call network overrides win; otherwise use the supplied org
|
|
648
|
+
* or the client's configured default org. A custom BRID is intentionally
|
|
649
|
+
* left untouched because it cannot be represented by the dashboard's
|
|
650
|
+
* public/private query selector.
|
|
651
|
+
*/
|
|
652
|
+
private resolveAgentLookupNetwork;
|
|
514
653
|
/**
|
|
515
654
|
* Get-or-create a Bearer token for dashboard reads. The token is a
|
|
516
655
|
* signed `log_tool_call` op (locally signed, never submitted) — the
|
|
@@ -523,10 +662,46 @@ declare class Atbash {
|
|
|
523
662
|
private riskEngineGet;
|
|
524
663
|
private riskEnginePost;
|
|
525
664
|
private riskEngineRecords;
|
|
665
|
+
/**
|
|
666
|
+
* BRID for an org — one round-trip to the map, honoring the client's chain
|
|
667
|
+
* cache. A "brand-new org" (nothing anywhere names its chain) is not an
|
|
668
|
+
* error — `resolveChainForOrg` returns the client default for that case and
|
|
669
|
+
* this helper returns its BRID. A transport failure or non-200 from
|
|
670
|
+
* `/api/org-network` IS an error and propagates: the caller cannot fall
|
|
671
|
+
* back to the default chain on outage, because with multi-chain live that
|
|
672
|
+
* silently reads from the wrong chain. Matches the Python binding's
|
|
673
|
+
* `_brid_for_org` semantics.
|
|
674
|
+
*/
|
|
675
|
+
private bridForOrg;
|
|
676
|
+
/**
|
|
677
|
+
* BRID for the client's configured default org, if it has one.
|
|
678
|
+
*
|
|
679
|
+
* Calls that carry no `orgName` argument are not chain-less: they still
|
|
680
|
+
* belong to `this.orgName`, and that org lives on exactly one chain. Routing
|
|
681
|
+
* them by the constructor's chain instead means a client configured
|
|
682
|
+
* `network: "private"` reads the private chain for an org that lives on
|
|
683
|
+
* public, and gets an empty answer rather than an error. So where an org is
|
|
684
|
+
* known the org decides the chain, and the constructor's chain is what is
|
|
685
|
+
* left when no org is known at all — the order `resolveAgentLookupNetwork`
|
|
686
|
+
* already applies to agent metadata reads, and the order the dashboard
|
|
687
|
+
* applies in `resolveChainForWallet`.
|
|
688
|
+
*
|
|
689
|
+
* Undefined when there is no default org, so callers keep falling back to
|
|
690
|
+
* the client default.
|
|
691
|
+
*/
|
|
692
|
+
/** The switch's chain, unless this client named one of its own. */
|
|
693
|
+
private forcedNetwork;
|
|
694
|
+
private defaultOrgBrid;
|
|
526
695
|
private raiseIfError;
|
|
527
696
|
/** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
|
|
528
697
|
private httpError;
|
|
529
|
-
/**
|
|
698
|
+
/**
|
|
699
|
+
* Wrap a transport failure (fetch threw, no response) as an AtbashAPIError.
|
|
700
|
+
*
|
|
701
|
+
* `HttpTransportError.kind` names the cause; the message is already
|
|
702
|
+
* human-readable. `debug` echoes the original exception so operators can
|
|
703
|
+
* cross-reference with node / undici logs when a class doesn't match.
|
|
704
|
+
*/
|
|
530
705
|
private transportError;
|
|
531
706
|
private json;
|
|
532
707
|
static generateKeypair(): KeyPair;
|
|
@@ -546,15 +721,79 @@ declare class AtbashAPIError extends Error {
|
|
|
546
721
|
readonly status: number;
|
|
547
722
|
/** Raw response body text (may be empty). */
|
|
548
723
|
readonly body: string;
|
|
549
|
-
|
|
724
|
+
/**
|
|
725
|
+
* Request path this status came from, e.g. `/api/v1/judge` — absent when the
|
|
726
|
+
* request never reached a response (transport failures carry status 0).
|
|
727
|
+
*
|
|
728
|
+
* A status alone does not say what failed. Several routes answer one call, and
|
|
729
|
+
* more than one of them can 404: a caller reading only `404` cannot tell "this
|
|
730
|
+
* agent is not registered" from "the chain-routing lookup did not resolve", and
|
|
731
|
+
* has to guess from the body's prose — which a 404 raised before any handler
|
|
732
|
+
* ran does not carry. The path is the fact that settles it.
|
|
733
|
+
*/
|
|
734
|
+
readonly path?: string;
|
|
735
|
+
constructor(status: number, body: string, statusText?: string, endpoint?: string, path?: string);
|
|
550
736
|
}
|
|
551
737
|
declare class SignatureVerificationError extends Error {
|
|
552
738
|
constructor(message: string);
|
|
553
739
|
}
|
|
554
740
|
|
|
741
|
+
/**
|
|
742
|
+
* Thin typed fetch wrapper.
|
|
743
|
+
*
|
|
744
|
+
* openapi-typescript emits types only (no runtime client), so this is the
|
|
745
|
+
* single hand-written transport — generic `get`/`post` over global `fetch`
|
|
746
|
+
* with a per-request timeout. The endpoint-specific request/response *shapes*
|
|
747
|
+
* are pulled from the generated `schema.ts` at the call sites in client.ts, so
|
|
748
|
+
* the wire contract still lives in spec/openapi.yaml. Methods return the raw
|
|
749
|
+
* `Response` so the caller can read the exact bytes the server signed before
|
|
750
|
+
* any decode (judge signature verification) — mirroring the Python surface's
|
|
751
|
+
* use of raw httpx (DECISIONS 2026-05-22).
|
|
752
|
+
*/
|
|
753
|
+
type QueryValue = string | number | boolean | undefined | null;
|
|
754
|
+
declare class HttpClient {
|
|
755
|
+
readonly baseUrl: string;
|
|
756
|
+
readonly timeoutMs: number;
|
|
757
|
+
constructor(baseUrl: string, timeoutMs: number);
|
|
758
|
+
buildUrl(path: string, query?: Record<string, QueryValue>): string;
|
|
759
|
+
get(path: string, query?: Record<string, QueryValue>, headers?: Record<string, string>): Promise<Response>;
|
|
760
|
+
post(path: string, body: unknown, headers?: Record<string, string>): Promise<Response>;
|
|
761
|
+
private fetch;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* A transport failure the SDK can act on. Every real cause the platform surfaces
|
|
765
|
+
* lands as one of these — the message names the cause in plain language so a
|
|
766
|
+
* plugin can show it to a user without decoding httpx / fetch internals.
|
|
767
|
+
*
|
|
768
|
+
* `cause` preserves the original error for debug logging; consumers that want
|
|
769
|
+
* the raw exception (e.g. tests) read it there.
|
|
770
|
+
*/
|
|
771
|
+
declare class HttpTransportError extends Error {
|
|
772
|
+
readonly kind: "timeout" | "aborted" | "dns" | "connect_refused" | "connection_reset" | "unknown";
|
|
773
|
+
constructor(kind: HttpTransportError["kind"], message: string, options?: {
|
|
774
|
+
cause?: unknown;
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
declare function canonicalAllow(data: Record<string, unknown>): boolean;
|
|
779
|
+
|
|
555
780
|
/** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
|
|
556
781
|
|
|
557
782
|
declare function normalizeVerdict(raw: unknown): Verdict;
|
|
783
|
+
/**
|
|
784
|
+
* Canonicalize `action_type` at the wire boundary, the way
|
|
785
|
+
* {@link normalizeVerdict} already canonicalizes `verdict`.
|
|
786
|
+
*
|
|
787
|
+
* `verdict` has been normalized here since the beginning and has never
|
|
788
|
+
* drifted between consumers. `action_type` was passed through raw, so every
|
|
789
|
+
* reader invented its own folding policy — `auditToolCall` compared exactly
|
|
790
|
+
* while `memory/scan.ts` trimmed and case-folded, and the same `" ALLOW "`
|
|
791
|
+
* was therefore an error on one path and permission on the other.
|
|
792
|
+
*
|
|
793
|
+
* Trim and case-fold only. Zero-width and homoglyph variants survive
|
|
794
|
+
* untouched, stay outside the known set, and still fail closed.
|
|
795
|
+
*/
|
|
796
|
+
declare function normalizeActionType(raw: unknown): string;
|
|
558
797
|
declare function normalizeStatus(raw: unknown): JudgmentState;
|
|
559
798
|
/** Wire pubkey may be a hex string, a Buffer/Uint8Array, or `{ data: [...] }`. */
|
|
560
799
|
declare function pubkeyToHex(val: unknown): string;
|
|
@@ -563,9 +802,22 @@ interface AtbashUserConfig {
|
|
|
563
802
|
agentKey?: string;
|
|
564
803
|
orgName?: string;
|
|
565
804
|
judgeEndpoint?: string;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
805
|
+
/**
|
|
806
|
+
* Response-signing pubkey of a self-hosted judge (66 hex). Setting it makes
|
|
807
|
+
* `fromConfig` use the self-hosted policy for `judgeEndpoint`, which is the
|
|
808
|
+
* only way a non-allowlisted judge host is accepted.
|
|
809
|
+
*/
|
|
810
|
+
judgeVerifyPubKey?: string;
|
|
811
|
+
/**
|
|
812
|
+
* `"private"` pins every org to the private chain regardless of where the
|
|
813
|
+
* dashboard says it lives — the migration switch. Leave it unset for the
|
|
814
|
+
* normal mode, where each org's own chain decides. There is no `"public"`
|
|
815
|
+
* value; a caller that wants one specific chain passes `chain` or `network`
|
|
816
|
+
* at construction instead.
|
|
817
|
+
*/
|
|
818
|
+
defaultChainNetwork?: Network;
|
|
819
|
+
/** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
|
|
820
|
+
debug?: string;
|
|
569
821
|
}
|
|
570
822
|
declare function getConfigDir(): string;
|
|
571
823
|
declare function getConfigPath(): string;
|
|
@@ -576,6 +828,26 @@ declare function resolve(key: keyof AtbashUserConfig, flagValue?: string): strin
|
|
|
576
828
|
declare function resolveKeyPath(input?: string): string;
|
|
577
829
|
declare function loadAgentFromFile(keyPath?: string): AgentAuth;
|
|
578
830
|
|
|
831
|
+
/**
|
|
832
|
+
* Accepted key filenames, in precedence order.
|
|
833
|
+
*
|
|
834
|
+
* `guard-client-key` stays first: it is the name every existing install
|
|
835
|
+
* already has, and changing which file wins would silently switch agent
|
|
836
|
+
* identity for anyone holding both. `atbash-client-key` is accepted because
|
|
837
|
+
* it is the name people actually create — the old one carries retired
|
|
838
|
+
* branding — and hitting ENOENT on a key you just wrote, from a plugin that
|
|
839
|
+
* still reports itself installed, is a miserable first run.
|
|
840
|
+
*/
|
|
841
|
+
declare const KEY_FILENAMES: readonly ["guard-client-key", "atbash-client-key"];
|
|
842
|
+
/** Every path checked when no explicit key path is given, in order. */
|
|
843
|
+
declare function keyPathCandidates(): string[];
|
|
844
|
+
/**
|
|
845
|
+
* Pick the key path: an explicit input wins untouched; otherwise the first
|
|
846
|
+
* accepted filename that exists, falling back to the preferred name so the
|
|
847
|
+
* error names something recognisable when nothing is there.
|
|
848
|
+
*/
|
|
849
|
+
declare function chooseKeyPath(input: string | undefined, exists: (p: string) => boolean): string;
|
|
850
|
+
|
|
579
851
|
/**
|
|
580
852
|
* Canonical secret kinds reported by the Rust core in `SecretMatch.kind`.
|
|
581
853
|
* Wire is permissive (modelled as a free string in {@link SecretMatch})
|
|
@@ -594,6 +866,42 @@ declare function verifyJudgeResponseSignature(bodyBytes: Uint8Array, signatureHe
|
|
|
594
866
|
reason?: string;
|
|
595
867
|
};
|
|
596
868
|
|
|
869
|
+
/**
|
|
870
|
+
* The boot memory-sync failure line.
|
|
871
|
+
*
|
|
872
|
+
* Split out of `guard-manager.ts` so it can be asserted without constructing a
|
|
873
|
+
* guard manager, which needs the native addon. The message is the whole point
|
|
874
|
+
* of AT-304: hosts print the message and drop the structured meta, so a cause
|
|
875
|
+
* that lives only in meta never reaches the operator.
|
|
876
|
+
*/
|
|
877
|
+
/** Advice, not a diagnosis — appended only when the cause is unhelpful. */
|
|
878
|
+
declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the cause above does not explain it";
|
|
879
|
+
/**
|
|
880
|
+
* Lead with the real cause.
|
|
881
|
+
*
|
|
882
|
+
* The previous wording named the chain endpoint and orgName as the things to
|
|
883
|
+
* check, which sent operators to verify configuration that was already correct
|
|
884
|
+
* while the actual cause (a node answering `404 Can't find blockchain with
|
|
885
|
+
* blockchainRID: …` for a chain it does not host) stayed hidden.
|
|
886
|
+
*/
|
|
887
|
+
declare function bootSyncFailureLine(cause: unknown): string;
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Make a chain query result crossable at the NAPI boundary.
|
|
891
|
+
*
|
|
892
|
+
* `postchain-client` decodes a Rell `byte_array` into a Node `Buffer`. The
|
|
893
|
+
* core's `parse*` functions take `serde_json::Value`, and NAPI-RS cannot
|
|
894
|
+
* convert a `Buffer` into one — it reaches the methods every `Uint8Array`
|
|
895
|
+
* inherits and fails with "JS functions cannot be represented as a
|
|
896
|
+
* serde_json::Value", which names functions for what is a plain Buffer.
|
|
897
|
+
*
|
|
898
|
+
* The conversion has to happen here because the failure is in the argument
|
|
899
|
+
* conversion, before any core code runs. Of the shapes the core accepts —
|
|
900
|
+
* hex string, `[u8]`, `{ data: [...] }` — hex is the cheapest to produce.
|
|
901
|
+
*/
|
|
902
|
+
/** Recursively rewrite byte containers to hex, leaving everything else as-is. */
|
|
903
|
+
declare function gtvToFfiSafe(value: unknown): unknown;
|
|
904
|
+
|
|
597
905
|
/** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
|
|
598
906
|
declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
|
|
599
907
|
/** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
|
|
@@ -608,8 +916,8 @@ declare function decryptMemoryContent(ciphertext: Buffer, nonce: Buffer, key: Bu
|
|
|
608
916
|
* Scan a single memory entry for poisoning.
|
|
609
917
|
*
|
|
610
918
|
* `auth` is the agent that signs the on-chain audit log for the
|
|
611
|
-
* LLM-judge call.
|
|
612
|
-
*
|
|
919
|
+
* LLM-judge call. Unicode-evasion presence is surfaced to the prompt
|
|
920
|
+
* so the LLM can weight suspicion accordingly.
|
|
613
921
|
*/
|
|
614
922
|
declare function scanMemory(entry: MemoryEntry, auth: AgentAuth, opts?: MemoryScanOptions): Promise<MemoryScanResult>;
|
|
615
923
|
/**
|
|
@@ -623,15 +931,26 @@ declare function scanMemoryBatch(entries: MemoryEntry[], auth: AgentAuth, opts?:
|
|
|
623
931
|
interface CommitMemoryOptions {
|
|
624
932
|
/** Score in [1, 10]. Defaults to 5 (matches the Rell entity default). */
|
|
625
933
|
score?: number;
|
|
934
|
+
/**
|
|
935
|
+
* Which memory file this commit targets. Defaults to `""` — the
|
|
936
|
+
* un-pathed slot, matching Rell's `file_path: text = ""` default.
|
|
937
|
+
* Pass an explicit filename (e.g. `"AGENTS.md"`) to keep files
|
|
938
|
+
* versioned independently on chain.
|
|
939
|
+
*/
|
|
940
|
+
filePath?: string;
|
|
626
941
|
/** Org name — when set, the SDK resolves which chain the agent lives on. */
|
|
627
942
|
orgName?: string;
|
|
628
943
|
/** Atbash service endpoint for org→chain lookup. */
|
|
629
944
|
endpoint?: string;
|
|
945
|
+
/** Self-hosted judge response-signing pubkey; required with a non-allowlisted `endpoint`. */
|
|
946
|
+
verifyPubKey?: string;
|
|
630
947
|
chainOpts?: ChainOpts;
|
|
631
948
|
}
|
|
632
949
|
interface RollbackMemoryOptions {
|
|
633
950
|
orgName?: string;
|
|
634
951
|
endpoint?: string;
|
|
952
|
+
/** Self-hosted judge response-signing pubkey; required with a non-allowlisted `endpoint`. */
|
|
953
|
+
verifyPubKey?: string;
|
|
635
954
|
chainOpts?: ChainOpts;
|
|
636
955
|
}
|
|
637
956
|
/**
|
|
@@ -640,9 +959,7 @@ interface RollbackMemoryOptions {
|
|
|
640
959
|
* deactivated on-chain.
|
|
641
960
|
*
|
|
642
961
|
* The caller is responsible for running `scanMemory` first when
|
|
643
|
-
* appropriate — this function does not gate on the verdict.
|
|
644
|
-
* `score` parameter is the only metadata that flows in alongside
|
|
645
|
-
* the ciphertext.
|
|
962
|
+
* appropriate — this function does not gate on the verdict.
|
|
646
963
|
*/
|
|
647
964
|
declare function commitMemoryVersion(plaintext: string, auth: AgentAuth, opts?: CommitMemoryOptions): Promise<void>;
|
|
648
965
|
/**
|
|
@@ -655,6 +972,7 @@ declare function commitMemoryVersion(plaintext: string, auth: AgentAuth, opts?:
|
|
|
655
972
|
*/
|
|
656
973
|
interface AgentMemoryEntry {
|
|
657
974
|
id: number;
|
|
975
|
+
filePath: string;
|
|
658
976
|
content: string;
|
|
659
977
|
decryptError?: string;
|
|
660
978
|
score: number;
|
|
@@ -666,6 +984,7 @@ interface AgentMemoryEntry {
|
|
|
666
984
|
interface MemoryRollbackEvent {
|
|
667
985
|
fromId: number;
|
|
668
986
|
toId: number;
|
|
987
|
+
filePath: string;
|
|
669
988
|
reason: string;
|
|
670
989
|
signer: string;
|
|
671
990
|
createdAt: number;
|
|
@@ -674,71 +993,53 @@ interface MemoryRollbackEvent {
|
|
|
674
993
|
* Cheap version-pointer probe. Returns just the id of the current
|
|
675
994
|
* active memory (or null if none). No ciphertext is transferred — the
|
|
676
995
|
* response is a single integer, so this is safe to call on every
|
|
677
|
-
* memory-read hot path.
|
|
678
|
-
* compare against a stored pointer and only refetch the full row via
|
|
679
|
-
* `getActiveMemory` when the id has changed.
|
|
996
|
+
* memory-read hot path.
|
|
680
997
|
*/
|
|
681
|
-
declare function getActiveMemoryId(auth: AgentAuth, chainOpts?: ChainOpts): Promise<number | null>;
|
|
998
|
+
declare function getActiveMemoryId(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<number | null>;
|
|
682
999
|
/**
|
|
683
1000
|
* Recent active memory entries — subset of active versions filtered
|
|
684
|
-
* by the chain's `MEMORY_RECENT_WINDOW_MS
|
|
685
|
-
*
|
|
686
|
-
* stale memory is worse than missing memory. For a time-unbounded
|
|
687
|
-
* view of every currently active version, use `getAllAgentMemory`.
|
|
1001
|
+
* by the chain's `MEMORY_RECENT_WINDOW_MS`. For a time-unbounded view
|
|
1002
|
+
* of every currently active version, use `getActiveAgentMemory`.
|
|
688
1003
|
*/
|
|
689
|
-
declare function
|
|
1004
|
+
declare function getRecentAgentMemory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
690
1005
|
/**
|
|
691
1006
|
* All currently-active memory entries with no time cutoff. Use this
|
|
692
|
-
* when you need every active version regardless of age
|
|
693
|
-
* dashboard listing, or a long-running agent whose oldest active
|
|
694
|
-
* versions may have fallen outside `getActiveMemory`'s recent window.
|
|
1007
|
+
* when you need every active version regardless of age.
|
|
695
1008
|
*/
|
|
696
|
-
declare function
|
|
1009
|
+
declare function getActiveAgentMemory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
697
1010
|
/**
|
|
698
|
-
* Full version history — active + inactive, most recent first.
|
|
699
|
-
*
|
|
1011
|
+
* Full version history — active + inactive, most recent first. Used
|
|
1012
|
+
* by rollback UX to choose a target version.
|
|
700
1013
|
*/
|
|
701
|
-
declare function getMemoryHistory(auth: AgentAuth, chainOpts?: ChainOpts): Promise<AgentMemoryEntry[]>;
|
|
1014
|
+
declare function getMemoryHistory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
702
1015
|
/**
|
|
703
1016
|
* Fetch a single memory entry by version id, including its current
|
|
704
|
-
* `is_active` state.
|
|
705
|
-
*
|
|
1017
|
+
* `is_active` state. Version ids are agent-unique on chain (not
|
|
1018
|
+
* per-file), so `id` alone resolves the target row.
|
|
706
1019
|
*/
|
|
707
1020
|
declare function getMemoryById(id: number, auth: AgentAuth, chainOpts?: ChainOpts): Promise<AgentMemoryEntry>;
|
|
708
1021
|
/**
|
|
709
1022
|
* Audit trail of rollback events for this agent, most recent first.
|
|
1023
|
+
* Scope by file with `filePath`; omit for a cross-file view.
|
|
710
1024
|
*/
|
|
711
|
-
declare function getRollbackHistory(auth: AgentAuth, chainOpts?: ChainOpts): Promise<MemoryRollbackEvent[]>;
|
|
1025
|
+
declare function getRollbackHistory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<MemoryRollbackEvent[]>;
|
|
712
1026
|
/**
|
|
713
1027
|
* Roll back to a previously-committed memory version. The target
|
|
714
|
-
* `toId` must exist and be currently inactive.
|
|
715
|
-
*
|
|
1028
|
+
* `toId` must exist and be currently inactive. The chain resolves the
|
|
1029
|
+
* target row's `file_path` from `toId` — no file path is passed in.
|
|
1030
|
+
* `reason` is required and is recorded on-chain in `memory_rollback_log`.
|
|
716
1031
|
*/
|
|
717
1032
|
declare function rollbackMemory(toId: number, reason: string, auth: AgentAuth, opts?: RollbackMemoryOptions): Promise<void>;
|
|
718
1033
|
|
|
719
|
-
/**
|
|
720
|
-
* Classify a plugin tool-call event as a memory write.
|
|
721
|
-
*
|
|
722
|
-
* Plugins receive `before_tool_call` events from their host runtime
|
|
723
|
-
* (openclaw, Claude API, MCP, etc.) with varying argument shapes. This
|
|
724
|
-
* module normalizes across shapes and returns a `MemoryEntry` when the
|
|
725
|
-
* call is writing to a memory-like path, or `null` when the SDK should
|
|
726
|
-
* skip the memory-scan path entirely.
|
|
727
|
-
*
|
|
728
|
-
* `event` and `ctx` are typed `unknown` so any plugin can pass its
|
|
729
|
-
* native hook payloads without adaptation — the classifier probes
|
|
730
|
-
* common key names at runtime.
|
|
731
|
-
*/
|
|
732
|
-
|
|
733
1034
|
/**
|
|
734
1035
|
* Tool names that indicate a memory write. Lowercase — matched
|
|
735
|
-
* case-insensitively so
|
|
736
|
-
*
|
|
1036
|
+
* case-insensitively so OpenClaw (lowercase) and Claude API family
|
|
1037
|
+
* (TitleCase) both hit.
|
|
737
1038
|
*/
|
|
738
1039
|
declare const DEFAULT_MEMORY_WRITE_TOOL_NAMES: ReadonlyArray<string>;
|
|
739
1040
|
/**
|
|
740
1041
|
* File path substrings that indicate a memory-shaped target. Callers
|
|
741
|
-
*
|
|
1042
|
+
* extend or override via `classifyMemoryWrite` options.
|
|
742
1043
|
*/
|
|
743
1044
|
declare const DEFAULT_MEMORY_PATH_PATTERNS: ReadonlyArray<string>;
|
|
744
1045
|
/**
|
|
@@ -778,21 +1079,15 @@ interface ClassifyMemoryWriteOptions {
|
|
|
778
1079
|
*
|
|
779
1080
|
* Empty-content writes return `null`: they can't carry a poisoning
|
|
780
1081
|
* payload, and the regular audit path still sees them.
|
|
781
|
-
*/
|
|
782
|
-
declare function classifyMemoryWrite(event: unknown, ctx: unknown, opts?: ClassifyMemoryWriteOptions): MemoryEntry | null;
|
|
783
|
-
|
|
784
|
-
/**
|
|
785
|
-
* Plugin-agnostic memory-write guard.
|
|
786
|
-
*
|
|
787
|
-
* A single call that replaces the plugin's usual memory-write branch:
|
|
788
|
-
* classify → scan (Layer 1 regex + Layer 2 LLM) → gate on verdict →
|
|
789
|
-
* persist to chain (fire-and-forget when allowed) → return decision.
|
|
790
1082
|
*
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
*
|
|
794
|
-
*
|
|
1083
|
+
* THROWS on host input it cannot read without side effects: a proxy, an accessor where a data
|
|
1084
|
+
* property is expected, a value with no safe projection, or one past the size bounds. Refusing is
|
|
1085
|
+
* deliberate - a silent `null` would report "not a memory write" for a call nobody could classify,
|
|
1086
|
+
* and memory protection would be skipped exactly where the input was strange. Callers that sit in a
|
|
1087
|
+
* host hook MUST catch it and turn it into a decision; `guardMemoryWrite` and
|
|
1088
|
+
* `MemoryGuardManager.handleBeforeToolCall` already do.
|
|
795
1089
|
*/
|
|
1090
|
+
declare function classifyMemoryWrite(event: unknown, ctx: unknown, opts?: ClassifyMemoryWriteOptions): MemoryEntry | null;
|
|
796
1091
|
|
|
797
1092
|
/**
|
|
798
1093
|
* Minimal logger accepted by `guardMemoryWrite`. Plugins pass their
|
|
@@ -888,12 +1183,19 @@ interface SyncMemoryOptions {
|
|
|
888
1183
|
* `drifted: false` — pointer is still valid; caller can keep serving the local copy.
|
|
889
1184
|
* `drifted: true` — active id changed on chain; `current` is the fresh decrypted row
|
|
890
1185
|
* (or `null` if active memory was removed entirely).
|
|
1186
|
+
*
|
|
1187
|
+
* `checked` — whether this call actually queried chain. `false` means the TTL
|
|
1188
|
+
* window was still open and the pointer was trusted without contacting chain, so
|
|
1189
|
+
* `drifted: false` carries no evidence about the current state. Callers that
|
|
1190
|
+
* vouch for content to a third party must not treat an unchecked result as proof.
|
|
891
1191
|
*/
|
|
892
1192
|
type SyncMemoryResult = {
|
|
893
1193
|
drifted: false;
|
|
1194
|
+
checked: boolean;
|
|
894
1195
|
pointer: MemoryPointer;
|
|
895
1196
|
} | {
|
|
896
1197
|
drifted: true;
|
|
1198
|
+
checked: true;
|
|
897
1199
|
current: AgentMemoryEntry | null;
|
|
898
1200
|
pointer: MemoryPointer;
|
|
899
1201
|
};
|
|
@@ -934,7 +1236,7 @@ declare function createFileLogger(filePath: string, upstream?: UpstreamLogger):
|
|
|
934
1236
|
/** Default log-file location — `<workspaceDir>/.atbash/plugin.log`. */
|
|
935
1237
|
declare function defaultPluginLogPath(workspaceDir?: string): string;
|
|
936
1238
|
|
|
937
|
-
/** Dedicated memory-read tool names, matched case-insensitively.
|
|
1239
|
+
/** Dedicated memory-read tool names, matched case-insensitively. */
|
|
938
1240
|
declare const DEFAULT_MEMORY_READ_TOOL_NAMES: ReadonlyArray<string>;
|
|
939
1241
|
interface ClassifyMemoryReadOptions {
|
|
940
1242
|
/** Tool names that always count as memory reads. Merged with defaults. */
|
|
@@ -948,15 +1250,56 @@ interface ClassifyMemoryReadOptions {
|
|
|
948
1250
|
* Returns `true` when this tool call is a memory read — either a
|
|
949
1251
|
* dedicated memory-read tool from `readToolNames`, or a generic read
|
|
950
1252
|
* tool (`read` / `read_file`) targeting a memory-shaped path.
|
|
1253
|
+
*
|
|
1254
|
+
* Caller-supplied `patterns` are MERGED with the defaults (matches
|
|
1255
|
+
* Node's original behavior — extending in one plugin doesn't disable
|
|
1256
|
+
* standard coverage).
|
|
1257
|
+
*
|
|
1258
|
+
* THROWS on host input it cannot read without side effects: a proxy, an accessor where a data
|
|
1259
|
+
* property is expected, a value with no safe projection, or one past the size bounds. Refusing is
|
|
1260
|
+
* deliberate - a silent `null` would report "not a memory write" for a call nobody could classify,
|
|
1261
|
+
* and memory protection would be skipped exactly where the input was strange. Callers that sit in a
|
|
1262
|
+
* host hook MUST catch it and turn it into a decision; `guardMemoryWrite` and
|
|
1263
|
+
* `MemoryGuardManager.handleBeforeToolCall` already do.
|
|
951
1264
|
*/
|
|
952
1265
|
declare function classifyMemoryRead(event: unknown, ctx: unknown, opts?: ClassifyMemoryReadOptions): boolean;
|
|
953
1266
|
|
|
954
|
-
/**
|
|
1267
|
+
/**
|
|
1268
|
+
* Decision the manager returns to the plugin's `before_tool_call` handler.
|
|
1269
|
+
*
|
|
1270
|
+
* `allow: true` alone is NOT evidence that anything was checked. Read `audited`
|
|
1271
|
+
* to tell the two apart, and route un-audited calls to your own judge — see the
|
|
1272
|
+
* field docs below.
|
|
1273
|
+
*/
|
|
955
1274
|
interface HookDecision {
|
|
956
1275
|
allow?: boolean;
|
|
957
1276
|
block?: boolean;
|
|
958
1277
|
blockReason?: string;
|
|
959
1278
|
reason?: string;
|
|
1279
|
+
/**
|
|
1280
|
+
* Whether the guard reached an enforcement decision about *this* call.
|
|
1281
|
+
*
|
|
1282
|
+
* Note this describes whether the guard **decided**, not whether it allowed.
|
|
1283
|
+
* Every `block` is `audited: true` — a blocked call is the most thoroughly
|
|
1284
|
+
* checked outcome the guard produces (a red scan, a ciphertext integrity
|
|
1285
|
+
* failure, a rolled-back version), and a host must never re-judge its way past
|
|
1286
|
+
* one.
|
|
1287
|
+
*
|
|
1288
|
+
* Absent or false means the guard reached no decision — it was inside its cache
|
|
1289
|
+
* window, chain was unreachable, the scan never ran, the file it can vouch for
|
|
1290
|
+
* is not the file being read, or it is in observe mode. Those calls are
|
|
1291
|
+
* unaudited: fall through to your own judge exactly as for a `null` return.
|
|
1292
|
+
*
|
|
1293
|
+
* So the host rule is:
|
|
1294
|
+
* `if (d.block) deny; else if (d.audited) allow; else judge it yourself;`
|
|
1295
|
+
*
|
|
1296
|
+
* Treating a bare `allow: true` as a completed audit is what this field exists
|
|
1297
|
+
* to prevent. A host that ignores it and returns the decision verbatim will
|
|
1298
|
+
* execute unaudited tool calls.
|
|
1299
|
+
*/
|
|
1300
|
+
audited?: boolean;
|
|
1301
|
+
/** Scan verdict when one was produced (`green` | `yellow` | `red`). Absent when no scan ran. */
|
|
1302
|
+
verdict?: string;
|
|
960
1303
|
}
|
|
961
1304
|
interface MemoryGuardManagerOptions {
|
|
962
1305
|
auth: AgentAuth;
|
|
@@ -979,6 +1322,13 @@ interface MemoryGuardManagerOptions {
|
|
|
979
1322
|
rollbackMinScore?: number;
|
|
980
1323
|
/** True → return `{block:true}` on defense triggers. False → log and return `null` (audit-only). Default true. */
|
|
981
1324
|
enforce?: boolean;
|
|
1325
|
+
/**
|
|
1326
|
+
* Chain targeting for the pointer sync (network, blockchainRid, nodeUrls).
|
|
1327
|
+
* Defaults to the SDK's configured chain. Without this the manager could only
|
|
1328
|
+
* ever talk to the default chain, which left the whole memory-read path
|
|
1329
|
+
* untestable — `syncLocalMemory` already accepted these options.
|
|
1330
|
+
*/
|
|
1331
|
+
chainOpts?: ChainOpts;
|
|
982
1332
|
/** Host-specific tuning of what counts as a memory read. */
|
|
983
1333
|
memoryReadClassifier?: ClassifyMemoryReadOptions;
|
|
984
1334
|
/** Passed through to `guardMemoryWrite`. Host memory-write tool names override. */
|
|
@@ -1007,7 +1357,29 @@ declare class MemoryGuardManager {
|
|
|
1007
1357
|
private readonly rollbackMinScore;
|
|
1008
1358
|
private readonly enforce;
|
|
1009
1359
|
private readonly agentPubkeyHex;
|
|
1360
|
+
/**
|
|
1361
|
+
* Memoized org→chain resolution. Reads have to hit the SAME chain
|
|
1362
|
+
* writes did, so an org-scoped guard must resolve `orgName` to
|
|
1363
|
+
* network exactly like `commitMemoryVersion` does. Without this
|
|
1364
|
+
* cache the read path would either (a) hit the SDK-default chain
|
|
1365
|
+
* every time — silently returning "no active memory on chain" when
|
|
1366
|
+
* writes landed on the org's actual chain, or (b) hammer
|
|
1367
|
+
* `/api/org-network` on every read. `undefined` means "not yet
|
|
1368
|
+
* resolved"; a resolved `null` means "no org / use raw chainOpts".
|
|
1369
|
+
*/
|
|
1370
|
+
private _resolvedChainOpts;
|
|
1371
|
+
private _resolveChainInflight?;
|
|
1010
1372
|
constructor(opts: MemoryGuardManagerOptions);
|
|
1373
|
+
/**
|
|
1374
|
+
* Resolve `orgName` → chain once, cache forever. `commitMemoryVersion`
|
|
1375
|
+
* already does this for writes; without the same call on the read
|
|
1376
|
+
* path, a client on the SDK's baked default chain reads from the wrong
|
|
1377
|
+
* chain and reports "no active memory" for an agent whose writes did
|
|
1378
|
+
* land — on the org's actual chain. An explicit `chainOpts.blockchainRid`
|
|
1379
|
+
* still wins (caller vouched for it); everything else honors the
|
|
1380
|
+
* dashboard's `org_networks` map.
|
|
1381
|
+
*/
|
|
1382
|
+
private resolveChainOpts;
|
|
1011
1383
|
/**
|
|
1012
1384
|
* One-shot chain probe at plugin registration. Refreshes MEMORY.md
|
|
1013
1385
|
* from chain when drifted and score passes threshold. Fire-and-forget
|
|
@@ -1015,12 +1387,33 @@ declare class MemoryGuardManager {
|
|
|
1015
1387
|
*/
|
|
1016
1388
|
runBootProbe(): Promise<void>;
|
|
1017
1389
|
/**
|
|
1018
|
-
* Returns a `HookDecision` when the
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1390
|
+
* Returns a `HookDecision` when the guard reached a decision about this event.
|
|
1391
|
+
* Returns `null` when it did not — either the event isn't memory-related, or it
|
|
1392
|
+
* is but the guard could not check it. In both cases the host falls through to
|
|
1393
|
+
* its own audit.
|
|
1394
|
+
*
|
|
1395
|
+
* A returned decision carries `audited` (see `HookDecision`). Only
|
|
1396
|
+
* `{ allow: true, audited: true }` means "checked and cleared"; anything else
|
|
1397
|
+
* that allows is a call the host still needs to judge.
|
|
1021
1398
|
*/
|
|
1022
1399
|
handleBeforeToolCall(event: unknown, ctx: unknown): Promise<HookDecision | null>;
|
|
1023
1400
|
private mapGuardResult;
|
|
1401
|
+
/**
|
|
1402
|
+
* Whether the pointer state this manager tracks actually describes the file
|
|
1403
|
+
* this call is about to read.
|
|
1404
|
+
*
|
|
1405
|
+
* The classifier fires on nine patterns — including the bare tokens
|
|
1406
|
+
* `"memory/"`, `"CLAUDE.md"` and `"AGENTS.md"` — but the sync path only ever
|
|
1407
|
+
* reads, refreshes, or vouches for `this.memoryFilePath`. Without this check a
|
|
1408
|
+
* read of `/repo/CLAUDE.md` (or any path merely containing `memory/`) would
|
|
1409
|
+
* receive an `audited: true` for a file the guard never opened.
|
|
1410
|
+
*
|
|
1411
|
+
* Conservative on purpose: every path-shaped value found must resolve to the
|
|
1412
|
+
* managed file. If none is found, or any one differs, the answer is no. That
|
|
1413
|
+
* also covers events carrying two different path keys, where the classifier
|
|
1414
|
+
* and the host could otherwise disagree about which one is authoritative.
|
|
1415
|
+
*/
|
|
1416
|
+
private vouchesForTarget;
|
|
1024
1417
|
private handleMemoryRead;
|
|
1025
1418
|
private writeMemoryAtomic;
|
|
1026
1419
|
}
|
|
@@ -1029,13 +1422,17 @@ declare function createMemoryGuardManager(opts: MemoryGuardManagerOptions): Memo
|
|
|
1029
1422
|
/**
|
|
1030
1423
|
* Atbash SDK Telemetry — OpenTelemetry metrics for usage tracking.
|
|
1031
1424
|
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1425
|
+
* Metrics are POSTed to the Atbash-owned `/api/telemetry` proxy, which
|
|
1426
|
+
* verifies the bearer, injects the Honeycomb ingest key server-side, and
|
|
1427
|
+
* forwards to Honeycomb. The ingest credential never enters the SDK.
|
|
1428
|
+
*
|
|
1429
|
+
* Environment opt-out (recommended for air-gapped deployments):
|
|
1430
|
+
* ATBASH_TELEMETRY_DISABLED=1
|
|
1034
1431
|
*
|
|
1035
1432
|
* Opt-out: create ~/.config/atbash/telemetry.json with { "enabled": false }
|
|
1036
1433
|
* The file must be readable by the SDK process. If missing, corrupted, or
|
|
1037
|
-
* unreadable
|
|
1038
|
-
*
|
|
1434
|
+
* unreadable, telemetry remains eligible to start unless the environment
|
|
1435
|
+
* opt-out is set.
|
|
1039
1436
|
*/
|
|
1040
1437
|
type ClientSource = "cli" | "sdk" | "plugin:openclaw" | "plugin:langchain" | "plugin:langgraph" | "plugin:hermes" | "plugin:eliza" | "plugin:crewai" | "plugin:mcp" | "plugin:autogen" | "plugin:jeenai" | (string & {});
|
|
1041
1438
|
interface TelemetryConfig {
|
|
@@ -1045,6 +1442,13 @@ interface TelemetryConfig {
|
|
|
1045
1442
|
source?: ClientSource;
|
|
1046
1443
|
/** Flush interval in ms. Default: 60000 */
|
|
1047
1444
|
exportIntervalMs?: number;
|
|
1445
|
+
/** Atbash endpoint that hosts /api/telemetry. Required to actually export. */
|
|
1446
|
+
endpoint?: string;
|
|
1447
|
+
/**
|
|
1448
|
+
* Called on every export to obtain fresh auth headers (typically
|
|
1449
|
+
* `{ Authorization: "Bearer <hex>" }`). Required to actually export.
|
|
1450
|
+
*/
|
|
1451
|
+
getAuthHeaders?: () => Record<string, string>;
|
|
1048
1452
|
}
|
|
1049
1453
|
declare function setupTelemetry(config: TelemetryConfig): void;
|
|
1050
1454
|
/**
|
|
@@ -1068,126 +1472,33 @@ declare function flushTelemetry(): Promise<void>;
|
|
|
1068
1472
|
declare function shutdownTelemetry(): Promise<void>;
|
|
1069
1473
|
|
|
1070
1474
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1074
|
-
* Why this is not in the Rust core like the other signing helpers: the operation
|
|
1075
|
-
* takes a `byte_array` argument, and the only consumer today is the dashboard,
|
|
1076
|
-
* which loads the browser bundle where Rust is unreachable by construction. This
|
|
1077
|
-
* module is plain TypeScript so the node and browser builds share one
|
|
1078
|
-
* implementation and cannot drift. The Rust core gets the same operation when the
|
|
1079
|
-
* native/Python/Go callers need it — the wire format is pinned by `crypto/ecies.ts`.
|
|
1080
|
-
*
|
|
1081
|
-
* The contract refuses plaintext once an org registers an encryption key
|
|
1082
|
-
* (`log_tool_call` → "Organization requires encrypted payloads"), so for those
|
|
1083
|
-
* orgs this is the only way to log a tool call at all.
|
|
1084
|
-
*/
|
|
1085
|
-
/**
|
|
1086
|
-
* Commitment to the plaintext claims a caller sends alongside the ciphertext.
|
|
1087
|
-
*
|
|
1088
|
-
* The judge server reads tool_name / action / context / tool_args_json from the
|
|
1089
|
-
* request body and feeds them to policy evaluation, but it holds no org key, so
|
|
1090
|
-
* it cannot check them against content_cipher. This hash is a signed operation
|
|
1091
|
-
* argument, which makes it the one thing it can check them against.
|
|
1092
|
-
*
|
|
1093
|
-
* An array, not an object: key order is not part of a JSON array, so the two
|
|
1094
|
-
* implementations cannot drift on serialization. Must stay identical to
|
|
1095
|
-
* `claimHashHex` in the dashboard (`src/lib/api/judge/action-hash.ts`).
|
|
1096
|
-
*/
|
|
1097
|
-
declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string;
|
|
1098
|
-
/** Plaintext fields of a tool call, sealed into a single ECIES payload. */
|
|
1099
|
-
interface ToolCallPlaintext {
|
|
1100
|
-
tool_name: string;
|
|
1101
|
-
action: string;
|
|
1102
|
-
context: string;
|
|
1103
|
-
tool_args_json: string;
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Canonical form of an action for the retry-cache hash.
|
|
1107
|
-
*
|
|
1108
|
-
* Must stay identical to `normalizeActionForHash` in the dashboard
|
|
1109
|
-
* (`src/lib/api/judge/on-chain.ts`): both write the same
|
|
1110
|
-
* `tool_call_log.normalized_action_hash` column, and `get_resolved_hold_by_action_hash`
|
|
1111
|
-
* matches a YELLOW hold retry against it. Diverging here silently breaks
|
|
1112
|
-
* hold resolution rather than failing loudly.
|
|
1475
|
+
* Rust core does the work; `browser/encrypted-toolcall.ts` mirrors it for the
|
|
1476
|
+
* browser and must produce the same columns.
|
|
1113
1477
|
*/
|
|
1478
|
+
/** Must match `column_aad` in the core — the label binds a ciphertext to its column. */
|
|
1479
|
+
declare function columnAad(toolCallId: string, column: string): string;
|
|
1480
|
+
/** Byte-identical to the dashboard's copy — diverging breaks hold-retry resolution. */
|
|
1114
1481
|
declare function normalizeActionForHash(action: string): string;
|
|
1115
|
-
/**
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
* Everything the agent did — action, context, tool name and args — goes into a
|
|
1119
|
-
* single ECIES payload readable only with the org's private key. Nothing
|
|
1120
|
-
* identifying the action is left in the operation arguments, which are permanent
|
|
1121
|
-
* block data.
|
|
1122
|
-
*
|
|
1123
|
-
* `actionHash` is the one exception, and it is deliberate: it is a SHA-256 over
|
|
1124
|
-
* the normalized action, so the chain can match a held action against its retry
|
|
1125
|
-
* without being able to read it.
|
|
1126
|
-
*
|
|
1127
|
-
* @returns hex-encoded signed transaction, ready to POST as `signed_log_tool_call`.
|
|
1128
|
-
*/
|
|
1482
|
+
/** Lets the judge check the request body against the ciphertext without an org key. */
|
|
1483
|
+
declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string;
|
|
1484
|
+
/** @returns hex-encoded signed tx, ready to POST as `signed_log_tool_call`. */
|
|
1129
1485
|
declare function signEncryptedToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, orgEncryptionPubKey: string, privkeyHex: string, blockchainRidHex: string): string;
|
|
1130
1486
|
|
|
1131
1487
|
/**
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
* anyone querying the Chromia node directly, and Atbash itself — sees ciphertext.
|
|
1136
|
-
* The recipient key is a dedicated encryption keypair the org generates in the
|
|
1137
|
-
* dashboard and registers via `org_set_encryption_key`; it is read back with the
|
|
1138
|
-
* `get_org_encryption_pubkey` query.
|
|
1139
|
-
*
|
|
1140
|
-
* ─── WIRE FORMAT (normative) ────────────────────────────────────────────────
|
|
1141
|
-
* This exact layout is mirrored in the Atbash dashboard
|
|
1142
|
-
* (`src/lib/chromia/ecies.ts`) and must stay byte-for-byte identical: the SDK
|
|
1143
|
-
* encrypts tool calls, the dashboard decrypts them.
|
|
1144
|
-
*
|
|
1145
|
-
* version 1 byte = 0x01
|
|
1146
|
-
* ephemeral_pubkey 33 bytes compressed secp256k1 point
|
|
1147
|
-
* nonce 12 bytes random, per message
|
|
1148
|
-
* ciphertext+tag N bytes AES-256-GCM output (16-byte tag appended)
|
|
1149
|
-
*
|
|
1150
|
-
* Version 0x01 is FROZEN, not provisional. Records encrypted under it already
|
|
1151
|
-
* exist on the deployed chains, and the ledger is immutable — redefining 0x01
|
|
1152
|
-
* would make them permanently unreadable, not merely stale. Evolving the format
|
|
1153
|
-
* means emitting a NEW version byte and keeping a 0x01 decrypt path, in both
|
|
1154
|
-
* repos, forever.
|
|
1155
|
-
*
|
|
1156
|
-
* Raw bytes, not base64: the on-chain columns are `byte_array`, so encoding to
|
|
1157
|
-
* text would add ~33% to what are the largest columns in the schema.
|
|
1158
|
-
*
|
|
1159
|
-
* Key agreement, per message:
|
|
1160
|
-
* shared_x = ECDH(ephemeral_privkey, org_pubkey).x // 32 bytes
|
|
1161
|
-
* key = HKDF-SHA256(ikm=shared_x, salt=ephemeral_pubkey, info=domain, len=32)
|
|
1162
|
-
* aad = "<domain>|<record_id>"
|
|
1163
|
-
*
|
|
1164
|
-
* A fresh ephemeral keypair is generated for every message and its private half is
|
|
1165
|
-
* discarded immediately. This is what makes the scheme forward-secret with respect
|
|
1166
|
-
* to the *sender*: leaking an agent's long-term signing key later does not expose
|
|
1167
|
-
* anything it encrypted in the past. (Deriving the shared secret from the agent's
|
|
1168
|
-
* static key instead would let anyone recompute every past shared secret, since the
|
|
1169
|
-
* org's public key is public by definition.)
|
|
1170
|
-
*
|
|
1171
|
-
* Three separate bindings, each closing a different substitution:
|
|
1172
|
-
* salt = ephemeral pubkey — ties the key to this exact handshake
|
|
1173
|
-
* info = domain — a verdict payload cannot be read as a tool call
|
|
1174
|
-
* aad = domain|record_id — a payload cannot be lifted onto another row
|
|
1175
|
-
*/
|
|
1176
|
-
/**
|
|
1177
|
-
* Cryptographic domain per payload kind. Fed to HKDF `info`, so each kind derives
|
|
1178
|
-
* a different key from the same handshake — a verdict payload handed to the
|
|
1179
|
-
* tool-call reader fails authentication rather than decoding to an empty struct.
|
|
1488
|
+
* Cryptographic domain per payload kind. Each kind derives a distinct
|
|
1489
|
+
* key from the same handshake — a verdict payload handed to the
|
|
1490
|
+
* tool-call reader fails authentication rather than silently decoding.
|
|
1180
1491
|
*
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1492
|
+
* Values here are the SHORT domain names the Rust core recognizes.
|
|
1493
|
+
* The full HKDF `info` strings (`atbash:chain-encryption:v1:<kind>`)
|
|
1494
|
+
* live inside the core and never surface at the API boundary.
|
|
1184
1495
|
*/
|
|
1185
1496
|
declare const EciesDomain: {
|
|
1186
|
-
readonly toolCall: "
|
|
1187
|
-
readonly verdict: "
|
|
1188
|
-
readonly note: "
|
|
1189
|
-
readonly policy: "
|
|
1190
|
-
readonly raw: "
|
|
1497
|
+
readonly toolCall: "toolcall";
|
|
1498
|
+
readonly verdict: "verdict";
|
|
1499
|
+
readonly note: "note";
|
|
1500
|
+
readonly policy: "policy";
|
|
1501
|
+
readonly raw: "raw";
|
|
1191
1502
|
};
|
|
1192
1503
|
type EciesDomain = (typeof EciesDomain)[keyof typeof EciesDomain];
|
|
1193
1504
|
/**
|
|
@@ -1202,9 +1513,9 @@ declare function encryptForOrg(plaintext: string, orgPubKeyHex: string, aad: str
|
|
|
1202
1513
|
/**
|
|
1203
1514
|
* Decrypt a payload produced by {@link encryptForOrg}.
|
|
1204
1515
|
*
|
|
1205
|
-
* Throws if the key is wrong, the `aad` does not match the one used at
|
|
1206
|
-
* time, or the ciphertext was tampered with — GCM authentication
|
|
1207
|
-
* indistinguishable by design.
|
|
1516
|
+
* Throws if the key is wrong, the `aad` does not match the one used at
|
|
1517
|
+
* encrypt time, or the ciphertext was tampered with — GCM authentication
|
|
1518
|
+
* makes all three indistinguishable by design.
|
|
1208
1519
|
*
|
|
1209
1520
|
* @param payload Value read from the on-chain `byte_array` column.
|
|
1210
1521
|
* @param orgPrivKeyHex Org's secp256k1 private key (32 bytes hex).
|
|
@@ -1212,12 +1523,36 @@ declare function encryptForOrg(plaintext: string, orgPubKeyHex: string, aad: str
|
|
|
1212
1523
|
*/
|
|
1213
1524
|
declare function decryptForOrg(payload: Uint8Array, orgPrivKeyHex: string, aad: string, domain?: EciesDomain): string;
|
|
1214
1525
|
/**
|
|
1215
|
-
* Size in bytes of the encrypted payload for a given plaintext length.
|
|
1216
|
-
* callers check against the on-chain column cap
|
|
1217
|
-
* before submitting a transaction the
|
|
1526
|
+
* Size in bytes of the encrypted payload for a given plaintext length.
|
|
1527
|
+
* Lets callers check against the on-chain column cap
|
|
1528
|
+
* (`MAX_CONTENT_CIPHER_SIZE`) before submitting a transaction the
|
|
1529
|
+
* contract would reject.
|
|
1218
1530
|
*/
|
|
1219
1531
|
declare function encryptedLength(plaintextByteLength: number): number;
|
|
1220
1532
|
|
|
1533
|
+
/**
|
|
1534
|
+
* atb1.<key-fingerprint>.<claim-hash>.<base64 ciphertext>
|
|
1535
|
+
*
|
|
1536
|
+
* Normative spec: `core/src/crypto_envelope.rs`. This mirrors it for the browser.
|
|
1537
|
+
*/
|
|
1538
|
+
interface Envelope {
|
|
1539
|
+
/** First 8 bytes of the recipient public key, hex. May be empty. */
|
|
1540
|
+
keyFingerprint: string;
|
|
1541
|
+
/** Commitment to the accompanying plaintext claims. May be empty. */
|
|
1542
|
+
claimHash: string;
|
|
1543
|
+
/** Raw ECIES payload. */
|
|
1544
|
+
payload: Uint8Array;
|
|
1545
|
+
}
|
|
1546
|
+
declare function packEnvelope(payload: Uint8Array, keyFingerprint?: string, claimHash?: string): string;
|
|
1547
|
+
/**
|
|
1548
|
+
* Stays true for a truncated envelope that `parseEnvelope` rejects — a severed
|
|
1549
|
+
* ciphertext is not plaintext, so callers must show a placeholder.
|
|
1550
|
+
*/
|
|
1551
|
+
declare function isEnvelope(value: string): boolean;
|
|
1552
|
+
/** Null, not a throw — pre-encryption records are plaintext. */
|
|
1553
|
+
declare function parseEnvelope(value: string): Envelope | null;
|
|
1554
|
+
declare function keyFingerprintOf(pubKeyHex: string): string;
|
|
1555
|
+
|
|
1221
1556
|
declare function isValidPrivateKey(hex: string): boolean;
|
|
1222
1557
|
declare function derivePublicKey(privkey: string): string;
|
|
1223
1558
|
declare function generateKeypair(): KeyPair;
|
|
@@ -1233,4 +1568,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1233
1568
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1234
1569
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1235
1570
|
|
|
1236
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type
|
|
1571
|
+
export { type ActionType, type AgentAuth, type AgentLookupOptions, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, type ChainConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, HttpClient, HttpTransportError, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PRIVATE_CHAIN, PUBLIC_CHAIN, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, bootSyncFailureLine, buildAllowedJudgeHosts, canonicalAllow, chainForNetwork, chooseKeyPath, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, gtvToFfiSafe, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
|