@atbash/sdk 0.8.0-dev.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -4
- package/dist/browser.d.mts +495 -184
- package/dist/browser.mjs +1074 -687
- package/dist/index.d.mts +495 -184
- package/dist/index.d.ts +495 -184
- package/dist/index.js +4633 -6964
- package/dist/index.mjs +4618 -6968
- 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/browser.d.mts
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,12 +390,18 @@ 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`. */
|
|
@@ -376,12 +445,6 @@ interface LogToolCallOptions {
|
|
|
376
445
|
orgEncryptionPubKey?: string;
|
|
377
446
|
}
|
|
378
447
|
|
|
379
|
-
interface ChainConfig {
|
|
380
|
-
readonly network: Network;
|
|
381
|
-
readonly blockchainRid: string;
|
|
382
|
-
readonly nodeUrls: readonly string[];
|
|
383
|
-
}
|
|
384
|
-
|
|
385
448
|
declare class Atbash {
|
|
386
449
|
readonly auth: AgentAuth;
|
|
387
450
|
readonly endpoint: string;
|
|
@@ -395,6 +458,9 @@ declare class Atbash {
|
|
|
395
458
|
readonly orgEncryptionPubKey?: string;
|
|
396
459
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
397
460
|
readonly failClosed: boolean;
|
|
461
|
+
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
462
|
+
private _orgKeyFromChain;
|
|
463
|
+
private readonly debug;
|
|
398
464
|
private readonly logger;
|
|
399
465
|
private readonly http;
|
|
400
466
|
/**
|
|
@@ -402,13 +468,57 @@ declare class Atbash {
|
|
|
402
468
|
* calls don't re-hit the dashboard. Cleared by `clearChainCache()`.
|
|
403
469
|
*/
|
|
404
470
|
private readonly _chainCache;
|
|
471
|
+
/**
|
|
472
|
+
* The chain the constructor settled on. Used only where a lookup returns no
|
|
473
|
+
* answer — see {@link resolveChainFromMap}.
|
|
474
|
+
*/
|
|
475
|
+
private readonly _defaultChain;
|
|
476
|
+
/**
|
|
477
|
+
* True when the caller named a chain outright — `chain`, `network`, or the
|
|
478
|
+
* paired `blockchainRid` + `nodeUrls`.
|
|
479
|
+
*
|
|
480
|
+
* Such a client is never re-pointed: not by the migration switch, and not by
|
|
481
|
+
* where an org turns out to live. Naming a chain is the caller saying "talk
|
|
482
|
+
* to this one", and silently routing elsewhere would make the argument a
|
|
483
|
+
* suggestion. A client that names nothing is the one that follows the org.
|
|
484
|
+
*/
|
|
485
|
+
private readonly _explicitChain;
|
|
486
|
+
/**
|
|
487
|
+
* The fleet-wide chain switch, read once at construction. `resolve()` hits
|
|
488
|
+
* the config file on disk, so re-reading it per call would put a file read
|
|
489
|
+
* on every judge.
|
|
490
|
+
*/
|
|
491
|
+
private readonly _forcedNetwork;
|
|
492
|
+
/**
|
|
493
|
+
* Short-TTL cache for `/api/ai/exists`. The `registered` field is
|
|
494
|
+
* monotonic (once true, stays true), so most calls in a burst re-fetch
|
|
495
|
+
* data that hasn't changed. The `org_encryption_pubkey` field CAN change
|
|
496
|
+
* — an org toggling encryption mid-session — so the TTL is deliberately
|
|
497
|
+
* short (see `AGENT_EXISTS_TTL_MS`). Keyed by (pubkey, network) so
|
|
498
|
+
* cross-agent / cross-network calls don't collide.
|
|
499
|
+
*/
|
|
500
|
+
private _agentExistsCache;
|
|
501
|
+
private static readonly AGENT_EXISTS_TTL_MS;
|
|
405
502
|
/**
|
|
406
503
|
* Cached bearer token for risk-engine / insurance read calls. Built
|
|
407
504
|
* lazily as a signed `log_tool_call` tx and refreshed every 4 min so
|
|
408
505
|
* server-side replay protection windows never expire it mid-session.
|
|
409
506
|
*/
|
|
410
|
-
private
|
|
507
|
+
private _authBearers;
|
|
508
|
+
/** Guards `logEnvironmentOnce` — hosts construct several clients. */
|
|
509
|
+
private static environmentLogged;
|
|
411
510
|
constructor(privkey: string, options?: AtbashOptions);
|
|
511
|
+
/**
|
|
512
|
+
* Say which environment this build talks to, once per process.
|
|
513
|
+
*
|
|
514
|
+
* The endpoint and both chain RIDs are compiled in, chosen by the npm tag,
|
|
515
|
+
* and no configuration repoints a released build. So installing the build
|
|
516
|
+
* for the wrong environment is invisible: the plugin loads, the hook fires,
|
|
517
|
+
* and every judge call fails because the agent does not exist on the chain
|
|
518
|
+
* this build targets. Organisation names are not unique across environments
|
|
519
|
+
* either, so an org resolving is not evidence the build is right.
|
|
520
|
+
*/
|
|
521
|
+
private logEnvironmentOnce;
|
|
412
522
|
/**
|
|
413
523
|
* Construct from resolved config: explicit overrides → env vars → the
|
|
414
524
|
* `~/.config/atbash/config.json` file (see userConfig.resolve). The private
|
|
@@ -451,8 +561,27 @@ declare class Atbash {
|
|
|
451
561
|
* explicitly false.
|
|
452
562
|
*/
|
|
453
563
|
auditToolCall(input: ToolCallInput): Promise<Decision>;
|
|
564
|
+
/**
|
|
565
|
+
* One exit for every judge failure.
|
|
566
|
+
*
|
|
567
|
+
* Status and reason go in the *message*, not only in the meta object: hosts
|
|
568
|
+
* print the message and drop the meta, which is why this read as a bare
|
|
569
|
+
* "judge API failed" while the judge was answering with a precise reason.
|
|
570
|
+
* The response body follows only under `debug`, since it can echo the action.
|
|
571
|
+
*/
|
|
572
|
+
private failJudge;
|
|
454
573
|
private fail;
|
|
455
|
-
|
|
574
|
+
/**
|
|
575
|
+
* Return the current status of a previously submitted judgment.
|
|
576
|
+
*
|
|
577
|
+
* `chainOpts` names which chain the judgment was signed against. The
|
|
578
|
+
* server's GET /api/v1/judge routes to that chain when the SDK sends
|
|
579
|
+
* a `brid` query param; without it, the server falls back to public.
|
|
580
|
+
* Callers on the private chain must pass a `chainOpts` (or configure
|
|
581
|
+
* the client on the private chain) — otherwise polling a POSTed
|
|
582
|
+
* judgment on the private chain 404s at the server.
|
|
583
|
+
*/
|
|
584
|
+
getJudgmentStatus(judgmentId: string, agentPubkey?: string, chainOpts?: ChainOpts): Promise<JudgmentStatus>;
|
|
456
585
|
getToolCalls(maxCount: number): Promise<ToolCallRecord[]>;
|
|
457
586
|
getOrgToolCalls(orgName: string, maxCount: number): Promise<ToolCallRecord[]>;
|
|
458
587
|
getAgentToolCalls(agentPubkey: string, maxCount: number): Promise<ToolCallRecord[]>;
|
|
@@ -461,8 +590,8 @@ declare class Atbash {
|
|
|
461
590
|
getOrgTierInfo(orgName: string): Promise<TierInfo | null>;
|
|
462
591
|
getPendingHeldActions(orgName: string, maxCount: number): Promise<HeldAction[]>;
|
|
463
592
|
getHeldActionReviews(orgName: string, maxCount: number): Promise<HeldActionReview[]>;
|
|
464
|
-
getAgentDetail(agentPubkey: string): Promise<Record<string, unknown>>;
|
|
465
|
-
getAgentPolicy(agentPubkey: string): Promise<AgentPolicy>;
|
|
593
|
+
getAgentDetail(agentPubkey: string, options?: AgentLookupOptions): Promise<Record<string, unknown>>;
|
|
594
|
+
getAgentPolicy(agentPubkey: string, options?: AgentLookupOptions): Promise<AgentPolicy>;
|
|
466
595
|
getSafetyStats(): Promise<Record<string, unknown>>;
|
|
467
596
|
/**
|
|
468
597
|
* Org's subscription on a specific chain. The `network` arg selects
|
|
@@ -485,7 +614,9 @@ declare class Atbash {
|
|
|
485
614
|
* 2. Per-chain subscription fallback — public + private records
|
|
486
615
|
* are fetched in parallel, with `is_private_blockchain` and
|
|
487
616
|
* `assigned_at` reconciling mixed states.
|
|
488
|
-
*
|
|
617
|
+
* A lookup that names exactly one chain wins outright. Where it names
|
|
618
|
+
* neither (a brand-new org) or cannot choose between them, the client's
|
|
619
|
+
* configured default decides.
|
|
489
620
|
*/
|
|
490
621
|
resolveChainForOrg(orgName: string): Promise<ChainConfig>;
|
|
491
622
|
/**
|
|
@@ -497,6 +628,8 @@ declare class Atbash {
|
|
|
497
628
|
private resolveChainFromMap;
|
|
498
629
|
/** Drop any cached chain resolutions. Useful in tests. */
|
|
499
630
|
clearChainCache(): void;
|
|
631
|
+
/** Drop the short-TTL `/api/ai/exists` cache. Useful in tests. */
|
|
632
|
+
clearAgentExistsCache(): void;
|
|
500
633
|
/**
|
|
501
634
|
* Wrap an SDK method body in telemetry — records the call at start
|
|
502
635
|
* and a success/error duration at end. Re-throws on failure so the
|
|
@@ -511,6 +644,14 @@ declare class Atbash {
|
|
|
511
644
|
* chains; otherwise the client's default.
|
|
512
645
|
*/
|
|
513
646
|
private bridFromChainOpts;
|
|
647
|
+
/**
|
|
648
|
+
* Resolve the dashboard chain used by agent metadata/policy reads.
|
|
649
|
+
* Explicit per-call network overrides win; otherwise use the supplied org
|
|
650
|
+
* or the client's configured default org. A custom BRID is intentionally
|
|
651
|
+
* left untouched because it cannot be represented by the dashboard's
|
|
652
|
+
* public/private query selector.
|
|
653
|
+
*/
|
|
654
|
+
private resolveAgentLookupNetwork;
|
|
514
655
|
/**
|
|
515
656
|
* Get-or-create a Bearer token for dashboard reads. The token is a
|
|
516
657
|
* signed `log_tool_call` op (locally signed, never submitted) — the
|
|
@@ -523,10 +664,46 @@ declare class Atbash {
|
|
|
523
664
|
private riskEngineGet;
|
|
524
665
|
private riskEnginePost;
|
|
525
666
|
private riskEngineRecords;
|
|
667
|
+
/**
|
|
668
|
+
* BRID for an org — one round-trip to the map, honoring the client's chain
|
|
669
|
+
* cache. A "brand-new org" (nothing anywhere names its chain) is not an
|
|
670
|
+
* error — `resolveChainForOrg` returns the client default for that case and
|
|
671
|
+
* this helper returns its BRID. A transport failure or non-200 from
|
|
672
|
+
* `/api/org-network` IS an error and propagates: the caller cannot fall
|
|
673
|
+
* back to the default chain on outage, because with multi-chain live that
|
|
674
|
+
* silently reads from the wrong chain. Matches the Python binding's
|
|
675
|
+
* `_brid_for_org` semantics.
|
|
676
|
+
*/
|
|
677
|
+
private bridForOrg;
|
|
678
|
+
/**
|
|
679
|
+
* BRID for the client's configured default org, if it has one.
|
|
680
|
+
*
|
|
681
|
+
* Calls that carry no `orgName` argument are not chain-less: they still
|
|
682
|
+
* belong to `this.orgName`, and that org lives on exactly one chain. Routing
|
|
683
|
+
* them by the constructor's chain instead means a client configured
|
|
684
|
+
* `network: "private"` reads the private chain for an org that lives on
|
|
685
|
+
* public, and gets an empty answer rather than an error. So where an org is
|
|
686
|
+
* known the org decides the chain, and the constructor's chain is what is
|
|
687
|
+
* left when no org is known at all — the order `resolveAgentLookupNetwork`
|
|
688
|
+
* already applies to agent metadata reads, and the order the dashboard
|
|
689
|
+
* applies in `resolveChainForWallet`.
|
|
690
|
+
*
|
|
691
|
+
* Undefined when there is no default org, so callers keep falling back to
|
|
692
|
+
* the client default.
|
|
693
|
+
*/
|
|
694
|
+
/** The switch's chain, unless this client named one of its own. */
|
|
695
|
+
private forcedNetwork;
|
|
696
|
+
private defaultOrgBrid;
|
|
526
697
|
private raiseIfError;
|
|
527
698
|
/** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
|
|
528
699
|
private httpError;
|
|
529
|
-
/**
|
|
700
|
+
/**
|
|
701
|
+
* Wrap a transport failure (fetch threw, no response) as an AtbashAPIError.
|
|
702
|
+
*
|
|
703
|
+
* `HttpTransportError.kind` names the cause; the message is already
|
|
704
|
+
* human-readable. `debug` echoes the original exception so operators can
|
|
705
|
+
* cross-reference with node / undici logs when a class doesn't match.
|
|
706
|
+
*/
|
|
530
707
|
private transportError;
|
|
531
708
|
private json;
|
|
532
709
|
static generateKeypair(): KeyPair;
|
|
@@ -552,9 +729,62 @@ declare class SignatureVerificationError extends Error {
|
|
|
552
729
|
constructor(message: string);
|
|
553
730
|
}
|
|
554
731
|
|
|
732
|
+
/**
|
|
733
|
+
* Thin typed fetch wrapper.
|
|
734
|
+
*
|
|
735
|
+
* openapi-typescript emits types only (no runtime client), so this is the
|
|
736
|
+
* single hand-written transport — generic `get`/`post` over global `fetch`
|
|
737
|
+
* with a per-request timeout. The endpoint-specific request/response *shapes*
|
|
738
|
+
* are pulled from the generated `schema.ts` at the call sites in client.ts, so
|
|
739
|
+
* the wire contract still lives in spec/openapi.yaml. Methods return the raw
|
|
740
|
+
* `Response` so the caller can read the exact bytes the server signed before
|
|
741
|
+
* any decode (judge signature verification) — mirroring the Python surface's
|
|
742
|
+
* use of raw httpx (DECISIONS 2026-05-22).
|
|
743
|
+
*/
|
|
744
|
+
type QueryValue = string | number | boolean | undefined | null;
|
|
745
|
+
declare class HttpClient {
|
|
746
|
+
readonly baseUrl: string;
|
|
747
|
+
readonly timeoutMs: number;
|
|
748
|
+
constructor(baseUrl: string, timeoutMs: number);
|
|
749
|
+
buildUrl(path: string, query?: Record<string, QueryValue>): string;
|
|
750
|
+
get(path: string, query?: Record<string, QueryValue>, headers?: Record<string, string>): Promise<Response>;
|
|
751
|
+
post(path: string, body: unknown, headers?: Record<string, string>): Promise<Response>;
|
|
752
|
+
private fetch;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* A transport failure the SDK can act on. Every real cause the platform surfaces
|
|
756
|
+
* lands as one of these — the message names the cause in plain language so a
|
|
757
|
+
* plugin can show it to a user without decoding httpx / fetch internals.
|
|
758
|
+
*
|
|
759
|
+
* `cause` preserves the original error for debug logging; consumers that want
|
|
760
|
+
* the raw exception (e.g. tests) read it there.
|
|
761
|
+
*/
|
|
762
|
+
declare class HttpTransportError extends Error {
|
|
763
|
+
readonly kind: "timeout" | "aborted" | "dns" | "connect_refused" | "connection_reset" | "unknown";
|
|
764
|
+
constructor(kind: HttpTransportError["kind"], message: string, options?: {
|
|
765
|
+
cause?: unknown;
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
declare function canonicalAllow(data: Record<string, unknown>): boolean;
|
|
770
|
+
|
|
555
771
|
/** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
|
|
556
772
|
|
|
557
773
|
declare function normalizeVerdict(raw: unknown): Verdict;
|
|
774
|
+
/**
|
|
775
|
+
* Canonicalize `action_type` at the wire boundary, the way
|
|
776
|
+
* {@link normalizeVerdict} already canonicalizes `verdict`.
|
|
777
|
+
*
|
|
778
|
+
* `verdict` has been normalized here since the beginning and has never
|
|
779
|
+
* drifted between consumers. `action_type` was passed through raw, so every
|
|
780
|
+
* reader invented its own folding policy — `auditToolCall` compared exactly
|
|
781
|
+
* while `memory/scan.ts` trimmed and case-folded, and the same `" ALLOW "`
|
|
782
|
+
* was therefore an error on one path and permission on the other.
|
|
783
|
+
*
|
|
784
|
+
* Trim and case-fold only. Zero-width and homoglyph variants survive
|
|
785
|
+
* untouched, stay outside the known set, and still fail closed.
|
|
786
|
+
*/
|
|
787
|
+
declare function normalizeActionType(raw: unknown): string;
|
|
558
788
|
declare function normalizeStatus(raw: unknown): JudgmentState;
|
|
559
789
|
/** Wire pubkey may be a hex string, a Buffer/Uint8Array, or `{ data: [...] }`. */
|
|
560
790
|
declare function pubkeyToHex(val: unknown): string;
|
|
@@ -563,9 +793,24 @@ interface AtbashUserConfig {
|
|
|
563
793
|
agentKey?: string;
|
|
564
794
|
orgName?: string;
|
|
565
795
|
judgeEndpoint?: string;
|
|
566
|
-
|
|
796
|
+
/**
|
|
797
|
+
* Response-signing pubkey of a self-hosted judge (66 hex). Setting it makes
|
|
798
|
+
* `fromConfig` use the self-hosted policy for `judgeEndpoint`, which is the
|
|
799
|
+
* only way a non-allowlisted judge host is accepted.
|
|
800
|
+
*/
|
|
801
|
+
judgeVerifyPubKey?: string;
|
|
802
|
+
/**
|
|
803
|
+
* `"private"` pins every org to the private chain regardless of where the
|
|
804
|
+
* dashboard says it lives — the migration switch. Leave it unset for the
|
|
805
|
+
* normal mode, where each org's own chain decides. There is no `"public"`
|
|
806
|
+
* value; a caller that wants one specific chain passes `chain` or `network`
|
|
807
|
+
* at construction instead.
|
|
808
|
+
*/
|
|
809
|
+
defaultChainNetwork?: Network;
|
|
567
810
|
provider?: string;
|
|
568
811
|
providerModel?: string;
|
|
812
|
+
/** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
|
|
813
|
+
debug?: string;
|
|
569
814
|
}
|
|
570
815
|
declare function getConfigDir(): string;
|
|
571
816
|
declare function getConfigPath(): string;
|
|
@@ -576,6 +821,26 @@ declare function resolve(key: keyof AtbashUserConfig, flagValue?: string): strin
|
|
|
576
821
|
declare function resolveKeyPath(input?: string): string;
|
|
577
822
|
declare function loadAgentFromFile(keyPath?: string): AgentAuth;
|
|
578
823
|
|
|
824
|
+
/**
|
|
825
|
+
* Accepted key filenames, in precedence order.
|
|
826
|
+
*
|
|
827
|
+
* `guard-client-key` stays first: it is the name every existing install
|
|
828
|
+
* already has, and changing which file wins would silently switch agent
|
|
829
|
+
* identity for anyone holding both. `atbash-client-key` is accepted because
|
|
830
|
+
* it is the name people actually create — the old one carries retired
|
|
831
|
+
* branding — and hitting ENOENT on a key you just wrote, from a plugin that
|
|
832
|
+
* still reports itself installed, is a miserable first run.
|
|
833
|
+
*/
|
|
834
|
+
declare const KEY_FILENAMES: readonly ["guard-client-key", "atbash-client-key"];
|
|
835
|
+
/** Every path checked when no explicit key path is given, in order. */
|
|
836
|
+
declare function keyPathCandidates(): string[];
|
|
837
|
+
/**
|
|
838
|
+
* Pick the key path: an explicit input wins untouched; otherwise the first
|
|
839
|
+
* accepted filename that exists, falling back to the preferred name so the
|
|
840
|
+
* error names something recognisable when nothing is there.
|
|
841
|
+
*/
|
|
842
|
+
declare function chooseKeyPath(input: string | undefined, exists: (p: string) => boolean): string;
|
|
843
|
+
|
|
579
844
|
/**
|
|
580
845
|
* Canonical secret kinds reported by the Rust core in `SecretMatch.kind`.
|
|
581
846
|
* Wire is permissive (modelled as a free string in {@link SecretMatch})
|
|
@@ -594,6 +859,26 @@ declare function verifyJudgeResponseSignature(bodyBytes: Uint8Array, signatureHe
|
|
|
594
859
|
reason?: string;
|
|
595
860
|
};
|
|
596
861
|
|
|
862
|
+
/**
|
|
863
|
+
* The boot memory-sync failure line.
|
|
864
|
+
*
|
|
865
|
+
* Split out of `guard-manager.ts` so it can be asserted without constructing a
|
|
866
|
+
* guard manager, which needs the native addon. The message is the whole point
|
|
867
|
+
* of AT-304: hosts print the message and drop the structured meta, so a cause
|
|
868
|
+
* that lives only in meta never reaches the operator.
|
|
869
|
+
*/
|
|
870
|
+
/** Advice, not a diagnosis — appended only when the cause is unhelpful. */
|
|
871
|
+
declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the cause above does not explain it";
|
|
872
|
+
/**
|
|
873
|
+
* Lead with the real cause.
|
|
874
|
+
*
|
|
875
|
+
* The previous wording named the chain endpoint and orgName as the things to
|
|
876
|
+
* check, which sent operators to verify configuration that was already correct
|
|
877
|
+
* while the actual cause (a node answering `404 Can't find blockchain with
|
|
878
|
+
* blockchainRID: …` for a chain it does not host) stayed hidden.
|
|
879
|
+
*/
|
|
880
|
+
declare function bootSyncFailureLine(cause: unknown): string;
|
|
881
|
+
|
|
597
882
|
/** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
|
|
598
883
|
declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
|
|
599
884
|
/** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
|
|
@@ -608,8 +893,8 @@ declare function decryptMemoryContent(ciphertext: Buffer, nonce: Buffer, key: Bu
|
|
|
608
893
|
* Scan a single memory entry for poisoning.
|
|
609
894
|
*
|
|
610
895
|
* `auth` is the agent that signs the on-chain audit log for the
|
|
611
|
-
* LLM-judge call.
|
|
612
|
-
*
|
|
896
|
+
* LLM-judge call. Unicode-evasion presence is surfaced to the prompt
|
|
897
|
+
* so the LLM can weight suspicion accordingly.
|
|
613
898
|
*/
|
|
614
899
|
declare function scanMemory(entry: MemoryEntry, auth: AgentAuth, opts?: MemoryScanOptions): Promise<MemoryScanResult>;
|
|
615
900
|
/**
|
|
@@ -623,15 +908,26 @@ declare function scanMemoryBatch(entries: MemoryEntry[], auth: AgentAuth, opts?:
|
|
|
623
908
|
interface CommitMemoryOptions {
|
|
624
909
|
/** Score in [1, 10]. Defaults to 5 (matches the Rell entity default). */
|
|
625
910
|
score?: number;
|
|
911
|
+
/**
|
|
912
|
+
* Which memory file this commit targets. Defaults to `""` — the
|
|
913
|
+
* un-pathed slot, matching Rell's `file_path: text = ""` default.
|
|
914
|
+
* Pass an explicit filename (e.g. `"AGENTS.md"`) to keep files
|
|
915
|
+
* versioned independently on chain.
|
|
916
|
+
*/
|
|
917
|
+
filePath?: string;
|
|
626
918
|
/** Org name — when set, the SDK resolves which chain the agent lives on. */
|
|
627
919
|
orgName?: string;
|
|
628
920
|
/** Atbash service endpoint for org→chain lookup. */
|
|
629
921
|
endpoint?: string;
|
|
922
|
+
/** Self-hosted judge response-signing pubkey; required with a non-allowlisted `endpoint`. */
|
|
923
|
+
verifyPubKey?: string;
|
|
630
924
|
chainOpts?: ChainOpts;
|
|
631
925
|
}
|
|
632
926
|
interface RollbackMemoryOptions {
|
|
633
927
|
orgName?: string;
|
|
634
928
|
endpoint?: string;
|
|
929
|
+
/** Self-hosted judge response-signing pubkey; required with a non-allowlisted `endpoint`. */
|
|
930
|
+
verifyPubKey?: string;
|
|
635
931
|
chainOpts?: ChainOpts;
|
|
636
932
|
}
|
|
637
933
|
/**
|
|
@@ -640,9 +936,7 @@ interface RollbackMemoryOptions {
|
|
|
640
936
|
* deactivated on-chain.
|
|
641
937
|
*
|
|
642
938
|
* 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.
|
|
939
|
+
* appropriate — this function does not gate on the verdict.
|
|
646
940
|
*/
|
|
647
941
|
declare function commitMemoryVersion(plaintext: string, auth: AgentAuth, opts?: CommitMemoryOptions): Promise<void>;
|
|
648
942
|
/**
|
|
@@ -655,6 +949,7 @@ declare function commitMemoryVersion(plaintext: string, auth: AgentAuth, opts?:
|
|
|
655
949
|
*/
|
|
656
950
|
interface AgentMemoryEntry {
|
|
657
951
|
id: number;
|
|
952
|
+
filePath: string;
|
|
658
953
|
content: string;
|
|
659
954
|
decryptError?: string;
|
|
660
955
|
score: number;
|
|
@@ -666,6 +961,7 @@ interface AgentMemoryEntry {
|
|
|
666
961
|
interface MemoryRollbackEvent {
|
|
667
962
|
fromId: number;
|
|
668
963
|
toId: number;
|
|
964
|
+
filePath: string;
|
|
669
965
|
reason: string;
|
|
670
966
|
signer: string;
|
|
671
967
|
createdAt: number;
|
|
@@ -674,71 +970,53 @@ interface MemoryRollbackEvent {
|
|
|
674
970
|
* Cheap version-pointer probe. Returns just the id of the current
|
|
675
971
|
* active memory (or null if none). No ciphertext is transferred — the
|
|
676
972
|
* 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.
|
|
973
|
+
* memory-read hot path.
|
|
680
974
|
*/
|
|
681
|
-
declare function getActiveMemoryId(auth: AgentAuth, chainOpts?: ChainOpts): Promise<number | null>;
|
|
975
|
+
declare function getActiveMemoryId(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<number | null>;
|
|
682
976
|
/**
|
|
683
977
|
* 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`.
|
|
978
|
+
* by the chain's `MEMORY_RECENT_WINDOW_MS`. For a time-unbounded view
|
|
979
|
+
* of every currently active version, use `getActiveAgentMemory`.
|
|
688
980
|
*/
|
|
689
|
-
declare function
|
|
981
|
+
declare function getRecentAgentMemory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
690
982
|
/**
|
|
691
983
|
* 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.
|
|
984
|
+
* when you need every active version regardless of age.
|
|
695
985
|
*/
|
|
696
|
-
declare function
|
|
986
|
+
declare function getActiveAgentMemory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
697
987
|
/**
|
|
698
|
-
* Full version history — active + inactive, most recent first.
|
|
699
|
-
*
|
|
988
|
+
* Full version history — active + inactive, most recent first. Used
|
|
989
|
+
* by rollback UX to choose a target version.
|
|
700
990
|
*/
|
|
701
|
-
declare function getMemoryHistory(auth: AgentAuth, chainOpts?: ChainOpts): Promise<AgentMemoryEntry[]>;
|
|
991
|
+
declare function getMemoryHistory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
702
992
|
/**
|
|
703
993
|
* Fetch a single memory entry by version id, including its current
|
|
704
|
-
* `is_active` state.
|
|
705
|
-
*
|
|
994
|
+
* `is_active` state. Version ids are agent-unique on chain (not
|
|
995
|
+
* per-file), so `id` alone resolves the target row.
|
|
706
996
|
*/
|
|
707
997
|
declare function getMemoryById(id: number, auth: AgentAuth, chainOpts?: ChainOpts): Promise<AgentMemoryEntry>;
|
|
708
998
|
/**
|
|
709
999
|
* Audit trail of rollback events for this agent, most recent first.
|
|
1000
|
+
* Scope by file with `filePath`; omit for a cross-file view.
|
|
710
1001
|
*/
|
|
711
|
-
declare function getRollbackHistory(auth: AgentAuth, chainOpts?: ChainOpts): Promise<MemoryRollbackEvent[]>;
|
|
1002
|
+
declare function getRollbackHistory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<MemoryRollbackEvent[]>;
|
|
712
1003
|
/**
|
|
713
1004
|
* Roll back to a previously-committed memory version. The target
|
|
714
|
-
* `toId` must exist and be currently inactive.
|
|
715
|
-
*
|
|
1005
|
+
* `toId` must exist and be currently inactive. The chain resolves the
|
|
1006
|
+
* target row's `file_path` from `toId` — no file path is passed in.
|
|
1007
|
+
* `reason` is required and is recorded on-chain in `memory_rollback_log`.
|
|
716
1008
|
*/
|
|
717
1009
|
declare function rollbackMemory(toId: number, reason: string, auth: AgentAuth, opts?: RollbackMemoryOptions): Promise<void>;
|
|
718
1010
|
|
|
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
1011
|
/**
|
|
734
1012
|
* Tool names that indicate a memory write. Lowercase — matched
|
|
735
|
-
* case-insensitively so
|
|
736
|
-
*
|
|
1013
|
+
* case-insensitively so OpenClaw (lowercase) and Claude API family
|
|
1014
|
+
* (TitleCase) both hit.
|
|
737
1015
|
*/
|
|
738
1016
|
declare const DEFAULT_MEMORY_WRITE_TOOL_NAMES: ReadonlyArray<string>;
|
|
739
1017
|
/**
|
|
740
1018
|
* File path substrings that indicate a memory-shaped target. Callers
|
|
741
|
-
*
|
|
1019
|
+
* extend or override via `classifyMemoryWrite` options.
|
|
742
1020
|
*/
|
|
743
1021
|
declare const DEFAULT_MEMORY_PATH_PATTERNS: ReadonlyArray<string>;
|
|
744
1022
|
/**
|
|
@@ -781,19 +1059,6 @@ interface ClassifyMemoryWriteOptions {
|
|
|
781
1059
|
*/
|
|
782
1060
|
declare function classifyMemoryWrite(event: unknown, ctx: unknown, opts?: ClassifyMemoryWriteOptions): MemoryEntry | null;
|
|
783
1061
|
|
|
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
|
-
*
|
|
791
|
-
* Plugins call this from their `before_tool_call` hook. When it returns
|
|
792
|
-
* `{ handled: false }` the call wasn't a memory write and the plugin
|
|
793
|
-
* should fall through to its regular tool-call audit. When
|
|
794
|
-
* `{ handled: true }` the plugin returns `decision` directly.
|
|
795
|
-
*/
|
|
796
|
-
|
|
797
1062
|
/**
|
|
798
1063
|
* Minimal logger accepted by `guardMemoryWrite`. Plugins pass their
|
|
799
1064
|
* host runtime's logger (openclaw's `api.logger`, MCP's console, etc.).
|
|
@@ -888,12 +1153,19 @@ interface SyncMemoryOptions {
|
|
|
888
1153
|
* `drifted: false` — pointer is still valid; caller can keep serving the local copy.
|
|
889
1154
|
* `drifted: true` — active id changed on chain; `current` is the fresh decrypted row
|
|
890
1155
|
* (or `null` if active memory was removed entirely).
|
|
1156
|
+
*
|
|
1157
|
+
* `checked` — whether this call actually queried chain. `false` means the TTL
|
|
1158
|
+
* window was still open and the pointer was trusted without contacting chain, so
|
|
1159
|
+
* `drifted: false` carries no evidence about the current state. Callers that
|
|
1160
|
+
* vouch for content to a third party must not treat an unchecked result as proof.
|
|
891
1161
|
*/
|
|
892
1162
|
type SyncMemoryResult = {
|
|
893
1163
|
drifted: false;
|
|
1164
|
+
checked: boolean;
|
|
894
1165
|
pointer: MemoryPointer;
|
|
895
1166
|
} | {
|
|
896
1167
|
drifted: true;
|
|
1168
|
+
checked: true;
|
|
897
1169
|
current: AgentMemoryEntry | null;
|
|
898
1170
|
pointer: MemoryPointer;
|
|
899
1171
|
};
|
|
@@ -934,7 +1206,7 @@ declare function createFileLogger(filePath: string, upstream?: UpstreamLogger):
|
|
|
934
1206
|
/** Default log-file location — `<workspaceDir>/.atbash/plugin.log`. */
|
|
935
1207
|
declare function defaultPluginLogPath(workspaceDir?: string): string;
|
|
936
1208
|
|
|
937
|
-
/** Dedicated memory-read tool names, matched case-insensitively.
|
|
1209
|
+
/** Dedicated memory-read tool names, matched case-insensitively. */
|
|
938
1210
|
declare const DEFAULT_MEMORY_READ_TOOL_NAMES: ReadonlyArray<string>;
|
|
939
1211
|
interface ClassifyMemoryReadOptions {
|
|
940
1212
|
/** Tool names that always count as memory reads. Merged with defaults. */
|
|
@@ -948,15 +1220,49 @@ interface ClassifyMemoryReadOptions {
|
|
|
948
1220
|
* Returns `true` when this tool call is a memory read — either a
|
|
949
1221
|
* dedicated memory-read tool from `readToolNames`, or a generic read
|
|
950
1222
|
* tool (`read` / `read_file`) targeting a memory-shaped path.
|
|
1223
|
+
*
|
|
1224
|
+
* Caller-supplied `patterns` are MERGED with the defaults (matches
|
|
1225
|
+
* Node's original behavior — extending in one plugin doesn't disable
|
|
1226
|
+
* standard coverage).
|
|
951
1227
|
*/
|
|
952
1228
|
declare function classifyMemoryRead(event: unknown, ctx: unknown, opts?: ClassifyMemoryReadOptions): boolean;
|
|
953
1229
|
|
|
954
|
-
/**
|
|
1230
|
+
/**
|
|
1231
|
+
* Decision the manager returns to the plugin's `before_tool_call` handler.
|
|
1232
|
+
*
|
|
1233
|
+
* `allow: true` alone is NOT evidence that anything was checked. Read `audited`
|
|
1234
|
+
* to tell the two apart, and route un-audited calls to your own judge — see the
|
|
1235
|
+
* field docs below.
|
|
1236
|
+
*/
|
|
955
1237
|
interface HookDecision {
|
|
956
1238
|
allow?: boolean;
|
|
957
1239
|
block?: boolean;
|
|
958
1240
|
blockReason?: string;
|
|
959
1241
|
reason?: string;
|
|
1242
|
+
/**
|
|
1243
|
+
* Whether the guard reached an enforcement decision about *this* call.
|
|
1244
|
+
*
|
|
1245
|
+
* Note this describes whether the guard **decided**, not whether it allowed.
|
|
1246
|
+
* Every `block` is `audited: true` — a blocked call is the most thoroughly
|
|
1247
|
+
* checked outcome the guard produces (a red scan, a ciphertext integrity
|
|
1248
|
+
* failure, a rolled-back version), and a host must never re-judge its way past
|
|
1249
|
+
* one.
|
|
1250
|
+
*
|
|
1251
|
+
* Absent or false means the guard reached no decision — it was inside its cache
|
|
1252
|
+
* window, chain was unreachable, the scan never ran, the file it can vouch for
|
|
1253
|
+
* is not the file being read, or it is in observe mode. Those calls are
|
|
1254
|
+
* unaudited: fall through to your own judge exactly as for a `null` return.
|
|
1255
|
+
*
|
|
1256
|
+
* So the host rule is:
|
|
1257
|
+
* `if (d.block) deny; else if (d.audited) allow; else judge it yourself;`
|
|
1258
|
+
*
|
|
1259
|
+
* Treating a bare `allow: true` as a completed audit is what this field exists
|
|
1260
|
+
* to prevent. A host that ignores it and returns the decision verbatim will
|
|
1261
|
+
* execute unaudited tool calls.
|
|
1262
|
+
*/
|
|
1263
|
+
audited?: boolean;
|
|
1264
|
+
/** Scan verdict when one was produced (`green` | `yellow` | `red`). Absent when no scan ran. */
|
|
1265
|
+
verdict?: string;
|
|
960
1266
|
}
|
|
961
1267
|
interface MemoryGuardManagerOptions {
|
|
962
1268
|
auth: AgentAuth;
|
|
@@ -979,6 +1285,13 @@ interface MemoryGuardManagerOptions {
|
|
|
979
1285
|
rollbackMinScore?: number;
|
|
980
1286
|
/** True → return `{block:true}` on defense triggers. False → log and return `null` (audit-only). Default true. */
|
|
981
1287
|
enforce?: boolean;
|
|
1288
|
+
/**
|
|
1289
|
+
* Chain targeting for the pointer sync (network, blockchainRid, nodeUrls).
|
|
1290
|
+
* Defaults to the SDK's configured chain. Without this the manager could only
|
|
1291
|
+
* ever talk to the default chain, which left the whole memory-read path
|
|
1292
|
+
* untestable — `syncLocalMemory` already accepted these options.
|
|
1293
|
+
*/
|
|
1294
|
+
chainOpts?: ChainOpts;
|
|
982
1295
|
/** Host-specific tuning of what counts as a memory read. */
|
|
983
1296
|
memoryReadClassifier?: ClassifyMemoryReadOptions;
|
|
984
1297
|
/** Passed through to `guardMemoryWrite`. Host memory-write tool names override. */
|
|
@@ -1007,7 +1320,29 @@ declare class MemoryGuardManager {
|
|
|
1007
1320
|
private readonly rollbackMinScore;
|
|
1008
1321
|
private readonly enforce;
|
|
1009
1322
|
private readonly agentPubkeyHex;
|
|
1323
|
+
/**
|
|
1324
|
+
* Memoized org→chain resolution. Reads have to hit the SAME chain
|
|
1325
|
+
* writes did, so an org-scoped guard must resolve `orgName` to
|
|
1326
|
+
* network exactly like `commitMemoryVersion` does. Without this
|
|
1327
|
+
* cache the read path would either (a) hit the SDK-default chain
|
|
1328
|
+
* every time — silently returning "no active memory on chain" when
|
|
1329
|
+
* writes landed on the org's actual chain, or (b) hammer
|
|
1330
|
+
* `/api/org-network` on every read. `undefined` means "not yet
|
|
1331
|
+
* resolved"; a resolved `null` means "no org / use raw chainOpts".
|
|
1332
|
+
*/
|
|
1333
|
+
private _resolvedChainOpts;
|
|
1334
|
+
private _resolveChainInflight?;
|
|
1010
1335
|
constructor(opts: MemoryGuardManagerOptions);
|
|
1336
|
+
/**
|
|
1337
|
+
* Resolve `orgName` → chain once, cache forever. `commitMemoryVersion`
|
|
1338
|
+
* already does this for writes; without the same call on the read
|
|
1339
|
+
* path, a client on the SDK's baked default chain reads from the wrong
|
|
1340
|
+
* chain and reports "no active memory" for an agent whose writes did
|
|
1341
|
+
* land — on the org's actual chain. An explicit `chainOpts.blockchainRid`
|
|
1342
|
+
* still wins (caller vouched for it); everything else honors the
|
|
1343
|
+
* dashboard's `org_networks` map.
|
|
1344
|
+
*/
|
|
1345
|
+
private resolveChainOpts;
|
|
1011
1346
|
/**
|
|
1012
1347
|
* One-shot chain probe at plugin registration. Refreshes MEMORY.md
|
|
1013
1348
|
* from chain when drifted and score passes threshold. Fire-and-forget
|
|
@@ -1015,12 +1350,33 @@ declare class MemoryGuardManager {
|
|
|
1015
1350
|
*/
|
|
1016
1351
|
runBootProbe(): Promise<void>;
|
|
1017
1352
|
/**
|
|
1018
|
-
* Returns a `HookDecision` when the
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1353
|
+
* Returns a `HookDecision` when the guard reached a decision about this event.
|
|
1354
|
+
* Returns `null` when it did not — either the event isn't memory-related, or it
|
|
1355
|
+
* is but the guard could not check it. In both cases the host falls through to
|
|
1356
|
+
* its own audit.
|
|
1357
|
+
*
|
|
1358
|
+
* A returned decision carries `audited` (see `HookDecision`). Only
|
|
1359
|
+
* `{ allow: true, audited: true }` means "checked and cleared"; anything else
|
|
1360
|
+
* that allows is a call the host still needs to judge.
|
|
1021
1361
|
*/
|
|
1022
1362
|
handleBeforeToolCall(event: unknown, ctx: unknown): Promise<HookDecision | null>;
|
|
1023
1363
|
private mapGuardResult;
|
|
1364
|
+
/**
|
|
1365
|
+
* Whether the pointer state this manager tracks actually describes the file
|
|
1366
|
+
* this call is about to read.
|
|
1367
|
+
*
|
|
1368
|
+
* The classifier fires on nine patterns — including the bare tokens
|
|
1369
|
+
* `"memory/"`, `"CLAUDE.md"` and `"AGENTS.md"` — but the sync path only ever
|
|
1370
|
+
* reads, refreshes, or vouches for `this.memoryFilePath`. Without this check a
|
|
1371
|
+
* read of `/repo/CLAUDE.md` (or any path merely containing `memory/`) would
|
|
1372
|
+
* receive an `audited: true` for a file the guard never opened.
|
|
1373
|
+
*
|
|
1374
|
+
* Conservative on purpose: every path-shaped value found must resolve to the
|
|
1375
|
+
* managed file. If none is found, or any one differs, the answer is no. That
|
|
1376
|
+
* also covers events carrying two different path keys, where the classifier
|
|
1377
|
+
* and the host could otherwise disagree about which one is authoritative.
|
|
1378
|
+
*/
|
|
1379
|
+
private vouchesForTarget;
|
|
1024
1380
|
private handleMemoryRead;
|
|
1025
1381
|
private writeMemoryAtomic;
|
|
1026
1382
|
}
|
|
@@ -1029,13 +1385,17 @@ declare function createMemoryGuardManager(opts: MemoryGuardManagerOptions): Memo
|
|
|
1029
1385
|
/**
|
|
1030
1386
|
* Atbash SDK Telemetry — OpenTelemetry metrics for usage tracking.
|
|
1031
1387
|
*
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1388
|
+
* Metrics are POSTed to the Atbash-owned `/api/telemetry` proxy, which
|
|
1389
|
+
* verifies the bearer, injects the Honeycomb ingest key server-side, and
|
|
1390
|
+
* forwards to Honeycomb. The ingest credential never enters the SDK.
|
|
1391
|
+
*
|
|
1392
|
+
* Environment opt-out (recommended for air-gapped deployments):
|
|
1393
|
+
* ATBASH_TELEMETRY_DISABLED=1
|
|
1034
1394
|
*
|
|
1035
1395
|
* Opt-out: create ~/.config/atbash/telemetry.json with { "enabled": false }
|
|
1036
1396
|
* The file must be readable by the SDK process. If missing, corrupted, or
|
|
1037
|
-
* unreadable
|
|
1038
|
-
*
|
|
1397
|
+
* unreadable, telemetry remains eligible to start unless the environment
|
|
1398
|
+
* opt-out is set.
|
|
1039
1399
|
*/
|
|
1040
1400
|
type ClientSource = "cli" | "sdk" | "plugin:openclaw" | "plugin:langchain" | "plugin:langgraph" | "plugin:hermes" | "plugin:eliza" | "plugin:crewai" | "plugin:mcp" | "plugin:autogen" | "plugin:jeenai" | (string & {});
|
|
1041
1401
|
interface TelemetryConfig {
|
|
@@ -1045,6 +1405,13 @@ interface TelemetryConfig {
|
|
|
1045
1405
|
source?: ClientSource;
|
|
1046
1406
|
/** Flush interval in ms. Default: 60000 */
|
|
1047
1407
|
exportIntervalMs?: number;
|
|
1408
|
+
/** Atbash endpoint that hosts /api/telemetry. Required to actually export. */
|
|
1409
|
+
endpoint?: string;
|
|
1410
|
+
/**
|
|
1411
|
+
* Called on every export to obtain fresh auth headers (typically
|
|
1412
|
+
* `{ Authorization: "Bearer <hex>" }`). Required to actually export.
|
|
1413
|
+
*/
|
|
1414
|
+
getAuthHeaders?: () => Record<string, string>;
|
|
1048
1415
|
}
|
|
1049
1416
|
declare function setupTelemetry(config: TelemetryConfig): void;
|
|
1050
1417
|
/**
|
|
@@ -1068,113 +1435,33 @@ declare function flushTelemetry(): Promise<void>;
|
|
|
1068
1435
|
declare function shutdownTelemetry(): Promise<void>;
|
|
1069
1436
|
|
|
1070
1437
|
/**
|
|
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
|
-
/** Plaintext fields of a tool call, sealed into a single ECIES payload. */
|
|
1086
|
-
interface ToolCallPlaintext {
|
|
1087
|
-
tool_name: string;
|
|
1088
|
-
action: string;
|
|
1089
|
-
context: string;
|
|
1090
|
-
tool_args_json: string;
|
|
1091
|
-
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Canonical form of an action for the retry-cache hash.
|
|
1094
|
-
*
|
|
1095
|
-
* Must stay identical to `normalizeActionForHash` in the dashboard
|
|
1096
|
-
* (`src/lib/api/judge/on-chain.ts`): both write the same
|
|
1097
|
-
* `tool_call_log.normalized_action_hash` column, and `get_resolved_hold_by_action_hash`
|
|
1098
|
-
* matches a YELLOW hold retry against it. Diverging here silently breaks
|
|
1099
|
-
* hold resolution rather than failing loudly.
|
|
1438
|
+
* Rust core does the work; `browser/encrypted-toolcall.ts` mirrors it for the
|
|
1439
|
+
* browser and must produce the same columns.
|
|
1100
1440
|
*/
|
|
1441
|
+
/** Must match `column_aad` in the core — the label binds a ciphertext to its column. */
|
|
1442
|
+
declare function columnAad(toolCallId: string, column: string): string;
|
|
1443
|
+
/** Byte-identical to the dashboard's copy — diverging breaks hold-retry resolution. */
|
|
1101
1444
|
declare function normalizeActionForHash(action: string): string;
|
|
1102
|
-
/**
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
* Everything the agent did — action, context, tool name and args — goes into a
|
|
1106
|
-
* single ECIES payload readable only with the org's private key. Nothing
|
|
1107
|
-
* identifying the action is left in the operation arguments, which are permanent
|
|
1108
|
-
* block data.
|
|
1109
|
-
*
|
|
1110
|
-
* `actionHash` is the one exception, and it is deliberate: it is a SHA-256 over
|
|
1111
|
-
* the normalized action, so the chain can match a held action against its retry
|
|
1112
|
-
* without being able to read it.
|
|
1113
|
-
*
|
|
1114
|
-
* @returns hex-encoded signed transaction, ready to POST as `signed_log_tool_call`.
|
|
1115
|
-
*/
|
|
1445
|
+
/** Lets the judge check the request body against the ciphertext without an org key. */
|
|
1446
|
+
declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string;
|
|
1447
|
+
/** @returns hex-encoded signed tx, ready to POST as `signed_log_tool_call`. */
|
|
1116
1448
|
declare function signEncryptedToolCall(toolCallId: string, action: string, context: string, toolName: string, toolArgsJson: string, orgEncryptionPubKey: string, privkeyHex: string, blockchainRidHex: string): string;
|
|
1117
1449
|
|
|
1118
1450
|
/**
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1122
|
-
* anyone querying the Chromia node directly, and Atbash itself — sees ciphertext.
|
|
1123
|
-
* The recipient key is a dedicated encryption keypair the org generates in the
|
|
1124
|
-
* dashboard and registers via `org_set_encryption_key`; it is read back with the
|
|
1125
|
-
* `get_org_encryption_pubkey` query.
|
|
1126
|
-
*
|
|
1127
|
-
* ─── WIRE FORMAT (normative) ────────────────────────────────────────────────
|
|
1128
|
-
* This exact layout is mirrored in the Atbash dashboard
|
|
1129
|
-
* (`src/lib/chromia/ecies.ts`) and must stay byte-for-byte identical: the SDK
|
|
1130
|
-
* encrypts tool calls, the dashboard decrypts them.
|
|
1131
|
-
*
|
|
1132
|
-
* version 1 byte = 0x01
|
|
1133
|
-
* ephemeral_pubkey 33 bytes compressed secp256k1 point
|
|
1134
|
-
* nonce 12 bytes random, per message
|
|
1135
|
-
* ciphertext+tag N bytes AES-256-GCM output (16-byte tag appended)
|
|
1136
|
-
*
|
|
1137
|
-
* Version 0x01 is FROZEN, not provisional. Records encrypted under it already
|
|
1138
|
-
* exist on the deployed chains, and the ledger is immutable — redefining 0x01
|
|
1139
|
-
* would make them permanently unreadable, not merely stale. Evolving the format
|
|
1140
|
-
* means emitting a NEW version byte and keeping a 0x01 decrypt path, in both
|
|
1141
|
-
* repos, forever.
|
|
1142
|
-
*
|
|
1143
|
-
* Raw bytes, not base64: the on-chain columns are `byte_array`, so encoding to
|
|
1144
|
-
* text would add ~33% to what are the largest columns in the schema.
|
|
1145
|
-
*
|
|
1146
|
-
* Key agreement, per message:
|
|
1147
|
-
* shared_x = ECDH(ephemeral_privkey, org_pubkey).x // 32 bytes
|
|
1148
|
-
* key = HKDF-SHA256(ikm=shared_x, salt=ephemeral_pubkey, info=domain, len=32)
|
|
1149
|
-
* aad = "<domain>|<record_id>"
|
|
1150
|
-
*
|
|
1151
|
-
* A fresh ephemeral keypair is generated for every message and its private half is
|
|
1152
|
-
* discarded immediately. This is what makes the scheme forward-secret with respect
|
|
1153
|
-
* to the *sender*: leaking an agent's long-term signing key later does not expose
|
|
1154
|
-
* anything it encrypted in the past. (Deriving the shared secret from the agent's
|
|
1155
|
-
* static key instead would let anyone recompute every past shared secret, since the
|
|
1156
|
-
* org's public key is public by definition.)
|
|
1157
|
-
*
|
|
1158
|
-
* Three separate bindings, each closing a different substitution:
|
|
1159
|
-
* salt = ephemeral pubkey — ties the key to this exact handshake
|
|
1160
|
-
* info = domain — a verdict payload cannot be read as a tool call
|
|
1161
|
-
* aad = domain|record_id — a payload cannot be lifted onto another row
|
|
1162
|
-
*/
|
|
1163
|
-
/**
|
|
1164
|
-
* Cryptographic domain per payload kind. Fed to HKDF `info`, so each kind derives
|
|
1165
|
-
* a different key from the same handshake — a verdict payload handed to the
|
|
1166
|
-
* tool-call reader fails authentication rather than decoding to an empty struct.
|
|
1451
|
+
* Cryptographic domain per payload kind. Each kind derives a distinct
|
|
1452
|
+
* key from the same handshake — a verdict payload handed to the
|
|
1453
|
+
* tool-call reader fails authentication rather than silently decoding.
|
|
1167
1454
|
*
|
|
1168
|
-
*
|
|
1169
|
-
*
|
|
1170
|
-
*
|
|
1455
|
+
* Values here are the SHORT domain names the Rust core recognizes.
|
|
1456
|
+
* The full HKDF `info` strings (`atbash:chain-encryption:v1:<kind>`)
|
|
1457
|
+
* live inside the core and never surface at the API boundary.
|
|
1171
1458
|
*/
|
|
1172
1459
|
declare const EciesDomain: {
|
|
1173
|
-
readonly toolCall: "
|
|
1174
|
-
readonly verdict: "
|
|
1175
|
-
readonly note: "
|
|
1176
|
-
readonly policy: "
|
|
1177
|
-
readonly raw: "
|
|
1460
|
+
readonly toolCall: "toolcall";
|
|
1461
|
+
readonly verdict: "verdict";
|
|
1462
|
+
readonly note: "note";
|
|
1463
|
+
readonly policy: "policy";
|
|
1464
|
+
readonly raw: "raw";
|
|
1178
1465
|
};
|
|
1179
1466
|
type EciesDomain = (typeof EciesDomain)[keyof typeof EciesDomain];
|
|
1180
1467
|
/**
|
|
@@ -1189,9 +1476,9 @@ declare function encryptForOrg(plaintext: string, orgPubKeyHex: string, aad: str
|
|
|
1189
1476
|
/**
|
|
1190
1477
|
* Decrypt a payload produced by {@link encryptForOrg}.
|
|
1191
1478
|
*
|
|
1192
|
-
* Throws if the key is wrong, the `aad` does not match the one used at
|
|
1193
|
-
* time, or the ciphertext was tampered with — GCM authentication
|
|
1194
|
-
* indistinguishable by design.
|
|
1479
|
+
* Throws if the key is wrong, the `aad` does not match the one used at
|
|
1480
|
+
* encrypt time, or the ciphertext was tampered with — GCM authentication
|
|
1481
|
+
* makes all three indistinguishable by design.
|
|
1195
1482
|
*
|
|
1196
1483
|
* @param payload Value read from the on-chain `byte_array` column.
|
|
1197
1484
|
* @param orgPrivKeyHex Org's secp256k1 private key (32 bytes hex).
|
|
@@ -1199,12 +1486,36 @@ declare function encryptForOrg(plaintext: string, orgPubKeyHex: string, aad: str
|
|
|
1199
1486
|
*/
|
|
1200
1487
|
declare function decryptForOrg(payload: Uint8Array, orgPrivKeyHex: string, aad: string, domain?: EciesDomain): string;
|
|
1201
1488
|
/**
|
|
1202
|
-
* Size in bytes of the encrypted payload for a given plaintext length.
|
|
1203
|
-
* callers check against the on-chain column cap
|
|
1204
|
-
* before submitting a transaction the
|
|
1489
|
+
* Size in bytes of the encrypted payload for a given plaintext length.
|
|
1490
|
+
* Lets callers check against the on-chain column cap
|
|
1491
|
+
* (`MAX_CONTENT_CIPHER_SIZE`) before submitting a transaction the
|
|
1492
|
+
* contract would reject.
|
|
1205
1493
|
*/
|
|
1206
1494
|
declare function encryptedLength(plaintextByteLength: number): number;
|
|
1207
1495
|
|
|
1496
|
+
/**
|
|
1497
|
+
* atb1.<key-fingerprint>.<claim-hash>.<base64 ciphertext>
|
|
1498
|
+
*
|
|
1499
|
+
* Normative spec: `core/src/crypto_envelope.rs`. This mirrors it for the browser.
|
|
1500
|
+
*/
|
|
1501
|
+
interface Envelope {
|
|
1502
|
+
/** First 8 bytes of the recipient public key, hex. May be empty. */
|
|
1503
|
+
keyFingerprint: string;
|
|
1504
|
+
/** Commitment to the accompanying plaintext claims. May be empty. */
|
|
1505
|
+
claimHash: string;
|
|
1506
|
+
/** Raw ECIES payload. */
|
|
1507
|
+
payload: Uint8Array;
|
|
1508
|
+
}
|
|
1509
|
+
declare function packEnvelope(payload: Uint8Array, keyFingerprint?: string, claimHash?: string): string;
|
|
1510
|
+
/**
|
|
1511
|
+
* Stays true for a truncated envelope that `parseEnvelope` rejects — a severed
|
|
1512
|
+
* ciphertext is not plaintext, so callers must show a placeholder.
|
|
1513
|
+
*/
|
|
1514
|
+
declare function isEnvelope(value: string): boolean;
|
|
1515
|
+
/** Null, not a throw — pre-encryption records are plaintext. */
|
|
1516
|
+
declare function parseEnvelope(value: string): Envelope | null;
|
|
1517
|
+
declare function keyFingerprintOf(pubKeyHex: string): string;
|
|
1518
|
+
|
|
1208
1519
|
declare function isValidPrivateKey(hex: string): boolean;
|
|
1209
1520
|
declare function derivePublicKey(privkey: string): string;
|
|
1210
1521
|
declare function generateKeypair(): KeyPair;
|
|
@@ -1220,4 +1531,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1220
1531
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1221
1532
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1222
1533
|
|
|
1223
|
-
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
|
|
1534
|
+
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, 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 };
|