@atbash/sdk 0.16.6-dev.0 → 0.18.0-dev.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/LICENSE +202 -28
- package/NOTICE +10 -0
- package/README.md +1 -1
- package/THIRD-PARTY-NOTICES +10256 -0
- package/dist/browser.d.mts +236 -54
- package/dist/browser.mjs +377 -141
- package/dist/index.d.mts +236 -54
- package/dist/index.d.ts +236 -54
- package/dist/index.js +1107 -41571
- package/dist/index.mjs +2538 -43030
- package/index.d.ts +19 -0
- package/index.js +61 -54
- package/package.json +10 -8
package/dist/browser.d.mts
CHANGED
|
@@ -136,14 +136,24 @@ interface MemoryScanOptions {
|
|
|
136
136
|
type Network = "public" | "private";
|
|
137
137
|
/**
|
|
138
138
|
* Per-call chain overrides. Pass exactly what you need to override —
|
|
139
|
-
* `network` selects between the SDK's known chains, `blockchainRid`
|
|
140
|
-
*
|
|
141
|
-
* to the SDK's defaults (or to org-resolved
|
|
139
|
+
* `network` selects between the SDK's known chains, `blockchainRid` pins a
|
|
140
|
+
* custom one, and `endpoint` names the Dashboard the calls travel over. Pass
|
|
141
|
+
* none of these to fall back to the SDK's defaults (or to the org-resolved
|
|
142
|
+
* chain when `orgName` is set).
|
|
142
143
|
*/
|
|
143
144
|
interface ChainOpts {
|
|
144
145
|
network?: Network;
|
|
145
146
|
blockchainRid?: string;
|
|
147
|
+
/**
|
|
148
|
+
* No longer dialled: memory reaches the chain through the Dashboard. Kept
|
|
149
|
+
* because callers and the other bindings still carry it as chain config.
|
|
150
|
+
*/
|
|
146
151
|
nodeUrls?: readonly string[];
|
|
152
|
+
/**
|
|
153
|
+
* Dashboard base URL. Memory reaches the chain through it, so this is where
|
|
154
|
+
* those requests go; defaults to the endpoint compiled into the core.
|
|
155
|
+
*/
|
|
156
|
+
endpoint?: string;
|
|
147
157
|
}
|
|
148
158
|
/** Canonical verdict after normalization. */
|
|
149
159
|
type Verdict = "ALLOW" | "HOLD" | "BLOCK" | "No verdict";
|
|
@@ -198,6 +208,11 @@ interface JudgeResult {
|
|
|
198
208
|
* missing" — never infer the former from a null verdict alone.
|
|
199
209
|
*/
|
|
200
210
|
status: string;
|
|
211
|
+
/**
|
|
212
|
+
* The judge's explicit refusal in the raw body (`explicitRefusal`): "BLOCK",
|
|
213
|
+
* "HOLD", or "" when it neither refused nor is a known refusal shape.
|
|
214
|
+
*/
|
|
215
|
+
refusal?: "" | "BLOCK" | "HOLD";
|
|
201
216
|
}
|
|
202
217
|
interface JudgmentStatus {
|
|
203
218
|
status: JudgmentState;
|
|
@@ -305,6 +320,13 @@ interface AtbashLogger {
|
|
|
305
320
|
/** Options accepted by the `Atbash` constructor. */
|
|
306
321
|
interface AtbashOptions {
|
|
307
322
|
endpoint?: string;
|
|
323
|
+
/**
|
|
324
|
+
* Overall deadline for one `auditToolCall` decision, across every request
|
|
325
|
+
* it makes (org lookup, exists check, judge). Default 60 000 ms. When it
|
|
326
|
+
* passes the decision is an ERROR (denied unless `failClosed` is false).
|
|
327
|
+
* `timeoutMs` still bounds each single request.
|
|
328
|
+
*/
|
|
329
|
+
decisionTimeoutMs?: number;
|
|
308
330
|
timeoutMs?: number;
|
|
309
331
|
/**
|
|
310
332
|
* Full chain override — BRID + nodeUrls in one object. Wins over every
|
|
@@ -350,6 +372,16 @@ interface AtbashOptions {
|
|
|
350
372
|
orgEncryptionPubKey?: string;
|
|
351
373
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
352
374
|
failClosed?: boolean;
|
|
375
|
+
/**
|
|
376
|
+
* When true (the default), an answer that carries no enforcement decision
|
|
377
|
+
* (the audit tier's `{status:"logged"}` with no verdict) is refused:
|
|
378
|
+
* `auditToolCall` returns `{allow:false, verdict:"ERROR"}` whatever
|
|
379
|
+
* `failClosed` says, and `judgeAction().allow` / `getJudgmentStatus().allow`
|
|
380
|
+
* are false. Set it to `false` only to run deliberately in log-only mode
|
|
381
|
+
* (security review 2026-09-30, H6: an unsigned marker switched enforcement
|
|
382
|
+
* off).
|
|
383
|
+
*/
|
|
384
|
+
requireEnforcement?: boolean;
|
|
353
385
|
/**
|
|
354
386
|
* Verbose diagnostics. Off by default. When on, a failed judge call also
|
|
355
387
|
* logs the response body, which is the difference between "judge API failed"
|
|
@@ -400,6 +432,10 @@ interface FromConfigOptions {
|
|
|
400
432
|
/** Default org name — see {@link AtbashOptions.orgName}. */
|
|
401
433
|
orgName?: string;
|
|
402
434
|
failClosed?: boolean;
|
|
435
|
+
/** See {@link AtbashOptions.requireEnforcement}. Default true. */
|
|
436
|
+
requireEnforcement?: boolean;
|
|
437
|
+
/** See {@link AtbashOptions.decisionTimeoutMs}. Default 60 000 ms. */
|
|
438
|
+
decisionTimeoutMs?: number;
|
|
403
439
|
/** See {@link AtbashOptions.debug}. */
|
|
404
440
|
debug?: boolean;
|
|
405
441
|
logger?: AtbashLogger;
|
|
@@ -456,6 +492,10 @@ declare class Atbash {
|
|
|
456
492
|
readonly orgEncryptionPubKey?: string;
|
|
457
493
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
458
494
|
readonly failClosed: boolean;
|
|
495
|
+
/** When true (default), an unenforced (audit-tier) answer is refused. */
|
|
496
|
+
readonly requireEnforcement: boolean;
|
|
497
|
+
/** Overall deadline for one auditToolCall decision, in ms. */
|
|
498
|
+
readonly decisionTimeoutMs: number;
|
|
459
499
|
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
460
500
|
private _orgKeyFromChain;
|
|
461
501
|
private readonly debug;
|
|
@@ -497,12 +537,6 @@ declare class Atbash {
|
|
|
497
537
|
*/
|
|
498
538
|
private _agentExistsCache;
|
|
499
539
|
private static readonly AGENT_EXISTS_TTL_MS;
|
|
500
|
-
/**
|
|
501
|
-
* Cached bearer token for risk-engine / insurance read calls. Built
|
|
502
|
-
* lazily as a signed `log_tool_call` tx and refreshed every 4 min so
|
|
503
|
-
* server-side replay protection windows never expire it mid-session.
|
|
504
|
-
*/
|
|
505
|
-
private _authBearers;
|
|
506
540
|
/** Guards `logEnvironmentOnce` — hosts construct several clients. */
|
|
507
541
|
private static environmentLogged;
|
|
508
542
|
constructor(privkey: string, options?: AtbashOptions);
|
|
@@ -525,6 +559,48 @@ declare class Atbash {
|
|
|
525
559
|
* validated against the trusted allowlist / self-hosted policy; a
|
|
526
560
|
* self-hosted endpoint's `verifyPubKey` becomes the client default.
|
|
527
561
|
*/
|
|
562
|
+
/**
|
|
563
|
+
* Decide which key this client signs as.
|
|
564
|
+
*
|
|
565
|
+
* Most specific wins: a key passed in code, then a key file the host named,
|
|
566
|
+
* then the environment, then the default key file. `config.json` is absent
|
|
567
|
+
* from that list on purpose — it is a settings file, writable by anything
|
|
568
|
+
* that can write the user's home and read by every Atbash integration on the
|
|
569
|
+
* machine, so letting it name the key meant one stray value silently
|
|
570
|
+
* re-pointed who each of them signed as.
|
|
571
|
+
*
|
|
572
|
+
* A named `keyPath` that does not exist throws rather than falling through.
|
|
573
|
+
* The caller said which file holds its identity; quietly signing as a
|
|
574
|
+
* different one is the outcome worth refusing.
|
|
575
|
+
*
|
|
576
|
+
* @param options - The `fromConfig` options, read for `agentKey` and `keyPath`.
|
|
577
|
+
* @returns The resolved agent identity.
|
|
578
|
+
* @throws When a named key file is missing, or no identity can be found.
|
|
579
|
+
*/
|
|
580
|
+
private static resolveIdentity;
|
|
581
|
+
/**
|
|
582
|
+
* Add the one thing a machine with no key file needs to hear.
|
|
583
|
+
*
|
|
584
|
+
* This is the only path where the operator cannot see what happened: no key
|
|
585
|
+
* file, and the key they are looking for sits in `config.json`, which no
|
|
586
|
+
* longer selects the identity. A bare "key file not found" sends them hunting
|
|
587
|
+
* for a key they already have. Only this branch gets the hint — a caller who
|
|
588
|
+
* named a `keyPath` is told about that path, where a stranded key is noise.
|
|
589
|
+
*
|
|
590
|
+
* @param err - The "key file not found" error from the default lookup.
|
|
591
|
+
* @returns The same error, or one that also names the key in config.json.
|
|
592
|
+
*/
|
|
593
|
+
private static explainStrandedKey;
|
|
594
|
+
/**
|
|
595
|
+
* Say so when `config.json` still holds an agent key.
|
|
596
|
+
*
|
|
597
|
+
* Nothing signs with it any more, and silence would leave an operator
|
|
598
|
+
* believing one identity is in force while another is. The pubkey is named,
|
|
599
|
+
* not the key, so the line is safe in a log.
|
|
600
|
+
*
|
|
601
|
+
* @param logger - The host logger, when one was supplied.
|
|
602
|
+
*/
|
|
603
|
+
private static warnOnStrandedKey;
|
|
528
604
|
static fromConfig(options?: FromConfigOptions): Atbash;
|
|
529
605
|
get pubkey(): string;
|
|
530
606
|
get privkey(): string;
|
|
@@ -559,6 +635,23 @@ declare class Atbash {
|
|
|
559
635
|
* explicitly false.
|
|
560
636
|
*/
|
|
561
637
|
auditToolCall(input: ToolCallInput): Promise<Decision>;
|
|
638
|
+
/**
|
|
639
|
+
* The verify key for one call (R4, governor tier-2 review). A per-call key
|
|
640
|
+
* may only narrow what the client accepts: on a client pinned to a judge
|
|
641
|
+
* key it must be that same key, never a replacement; on an unpinned client
|
|
642
|
+
* it adds the check.
|
|
643
|
+
*/
|
|
644
|
+
private effectiveVerifyKey;
|
|
645
|
+
/**
|
|
646
|
+
* Collapse a judge result into a {@link Decision}. The most restrictive
|
|
647
|
+
* signal wins (security review 2026-09-30, H1): `action_type`, `verdict`
|
|
648
|
+
* and the canonical `allow` are each able to deny, and only a result where
|
|
649
|
+
* all three agree may execute. A present `allow` / `decision.allow` that is
|
|
650
|
+
* not exactly `true` is the judge declining to grant permission, so it
|
|
651
|
+
* denies even under `failClosed: false` — that option relaxes *errors*, it
|
|
652
|
+
* never overrides a refusal.
|
|
653
|
+
*/
|
|
654
|
+
private decide;
|
|
562
655
|
/**
|
|
563
656
|
* One exit for every judge failure.
|
|
564
657
|
*
|
|
@@ -568,6 +661,12 @@ declare class Atbash {
|
|
|
568
661
|
* The response body follows only under `debug`, since it can echo the action.
|
|
569
662
|
*/
|
|
570
663
|
private failJudge;
|
|
664
|
+
/**
|
|
665
|
+
* The canonical permission for a response body under this client's
|
|
666
|
+
* settings: {@link canonicalAllow}, minus the audit tier when
|
|
667
|
+
* `requireEnforcement` is on. Never more permissive than `auditToolCall`.
|
|
668
|
+
*/
|
|
669
|
+
private executable;
|
|
571
670
|
private fail;
|
|
572
671
|
/**
|
|
573
672
|
* Return the current status of a previously submitted judgment.
|
|
@@ -886,22 +985,6 @@ declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the caus
|
|
|
886
985
|
*/
|
|
887
986
|
declare function bootSyncFailureLine(cause: unknown): string;
|
|
888
987
|
|
|
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
|
-
|
|
905
988
|
/** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
|
|
906
989
|
declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
|
|
907
990
|
/** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
|
|
@@ -940,7 +1023,7 @@ interface CommitMemoryOptions {
|
|
|
940
1023
|
filePath?: string;
|
|
941
1024
|
/** Org name — when set, the SDK resolves which chain the agent lives on. */
|
|
942
1025
|
orgName?: string;
|
|
943
|
-
/** Atbash service endpoint
|
|
1026
|
+
/** Atbash service endpoint — where memory reaches the chain, and the org→chain lookup. */
|
|
944
1027
|
endpoint?: string;
|
|
945
1028
|
/** Self-hosted judge response-signing pubkey; required with a non-allowlisted `endpoint`. */
|
|
946
1029
|
verifyPubKey?: string;
|
|
@@ -948,6 +1031,7 @@ interface CommitMemoryOptions {
|
|
|
948
1031
|
}
|
|
949
1032
|
interface RollbackMemoryOptions {
|
|
950
1033
|
orgName?: string;
|
|
1034
|
+
/** Atbash service endpoint — where memory reaches the chain, and the org→chain lookup. */
|
|
951
1035
|
endpoint?: string;
|
|
952
1036
|
/** Self-hosted judge response-signing pubkey; required with a non-allowlisted `endpoint`. */
|
|
953
1037
|
verifyPubKey?: string;
|
|
@@ -1121,6 +1205,17 @@ interface GuardMemoryWriteInput extends ClassifyMemoryWriteOptions {
|
|
|
1121
1205
|
debug?: boolean;
|
|
1122
1206
|
/** Optional logger for debug probe + persist-failure warnings. */
|
|
1123
1207
|
logger?: GuardLogger;
|
|
1208
|
+
/** Agent home directory names to accept beyond the built-in list. */
|
|
1209
|
+
agentHomeDirs?: string[];
|
|
1210
|
+
/**
|
|
1211
|
+
* Root the caller keeps memory under, when it is not an agent home.
|
|
1212
|
+
*
|
|
1213
|
+
* Only pass a value the host stated outright. A root defaulted from the
|
|
1214
|
+
* process working directory would make whichever directory the host happened
|
|
1215
|
+
* to start in look like a memory store — which is how a stray MEMORY.md once
|
|
1216
|
+
* ended up inside a plugin checkout.
|
|
1217
|
+
*/
|
|
1218
|
+
memoryRoot?: string;
|
|
1124
1219
|
}
|
|
1125
1220
|
/** Plugin-facing decision. Shape mirrors what plugins return from `before_tool_call`. */
|
|
1126
1221
|
interface GuardMemoryDecision {
|
|
@@ -1138,21 +1233,6 @@ interface GuardMemoryWriteResult {
|
|
|
1138
1233
|
/** Present when handled. True only after the chain transaction confirms. */
|
|
1139
1234
|
committed?: boolean;
|
|
1140
1235
|
}
|
|
1141
|
-
/**
|
|
1142
|
-
* Guarded memory-write flow. Returns `{ handled: false }` when the tool
|
|
1143
|
-
* call isn't a memory write, otherwise returns a `decision` the plugin
|
|
1144
|
-
* should return from its hook.
|
|
1145
|
-
*
|
|
1146
|
-
* Verdict handling:
|
|
1147
|
-
* - `red` → not persisted to chain; decision blocks (unless `enforce: false`)
|
|
1148
|
-
* - `yellow` → persisted with its LLM score; decision allows once the chain confirms
|
|
1149
|
-
* - `green` → persisted with its LLM score; decision allows once the chain confirms
|
|
1150
|
-
* - anything else → not persisted; decision blocks (unless `enforce: false`)
|
|
1151
|
-
*
|
|
1152
|
-
* A write is acknowledged only after the chain transaction confirms, for
|
|
1153
|
-
* yellow exactly as for green. An unconfirmed write blocks in enforce mode
|
|
1154
|
-
* and remains unaudited in observe mode.
|
|
1155
|
-
*/
|
|
1156
1236
|
declare function guardMemoryWrite(input: GuardMemoryWriteInput): Promise<GuardMemoryWriteResult>;
|
|
1157
1237
|
|
|
1158
1238
|
/**
|
|
@@ -1216,10 +1296,19 @@ declare class PointerStore {
|
|
|
1216
1296
|
private cache;
|
|
1217
1297
|
private loading;
|
|
1218
1298
|
constructor(filePath: string);
|
|
1219
|
-
/**
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1299
|
+
/**
|
|
1300
|
+
* The pointer for one agent's file, or a zero-pointer forcing a sync.
|
|
1301
|
+
*
|
|
1302
|
+
* @param filePath - The file's chain slot, i.e. its basename.
|
|
1303
|
+
*/
|
|
1304
|
+
get(agentPubkeyHex: string, filePath: string): Promise<MemoryPointer>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Persist one file's pointer, leaving the agent's other files alone.
|
|
1307
|
+
*
|
|
1308
|
+
* Write failures are reported to `onError` rather than thrown: a cache that
|
|
1309
|
+
* cannot be written must not take down the read it was speeding up.
|
|
1310
|
+
*/
|
|
1311
|
+
set(agentPubkeyHex: string, filePath: string, pointer: MemoryPointer, onError?: (err: Error) => void): Promise<void>;
|
|
1223
1312
|
private ensureLoaded;
|
|
1224
1313
|
private loadOnce;
|
|
1225
1314
|
private persist;
|
|
@@ -1314,6 +1403,17 @@ interface MemoryGuardManagerOptions {
|
|
|
1314
1403
|
workspaceDir: string;
|
|
1315
1404
|
/** Absolute MEMORY.md path. Default `<workspaceDir>/MEMORY.md`. */
|
|
1316
1405
|
memoryFilePath?: string;
|
|
1406
|
+
/**
|
|
1407
|
+
* Root this host keeps memory under, when it is not an agent home.
|
|
1408
|
+
*
|
|
1409
|
+
* Only set this from a value the host stated outright — never from
|
|
1410
|
+
* `process.cwd()`. A guessed root makes whichever directory the host started
|
|
1411
|
+
* in look like a memory store, which is how a stray MEMORY.md once ended up
|
|
1412
|
+
* inside a plugin checkout.
|
|
1413
|
+
*/
|
|
1414
|
+
memoryRoot?: string;
|
|
1415
|
+
/** Agent home directory names to accept beyond the built-in list. */
|
|
1416
|
+
agentHomeDirs?: string[];
|
|
1317
1417
|
/** Persistent pointer file. Default `<workspaceDir>/.atbash/memory-pointer.json`. */
|
|
1318
1418
|
pointerFilePath?: string;
|
|
1319
1419
|
/** File-backed log. Default `<workspaceDir>/.atbash/plugin.log`. */
|
|
@@ -1360,6 +1460,10 @@ declare class MemoryGuardManager {
|
|
|
1360
1460
|
private readonly pointerStore;
|
|
1361
1461
|
private readonly logger;
|
|
1362
1462
|
private readonly memoryFilePath;
|
|
1463
|
+
/** Base for resolving the relative paths a host sends. */
|
|
1464
|
+
private readonly workspaceDir;
|
|
1465
|
+
/** Set by `verifyOneFile` when the file it checked was actually on chain. */
|
|
1466
|
+
private lastVerified;
|
|
1363
1467
|
private readonly ttlMs;
|
|
1364
1468
|
private readonly rollbackMinScore;
|
|
1365
1469
|
private readonly enforce;
|
|
@@ -1377,6 +1481,14 @@ declare class MemoryGuardManager {
|
|
|
1377
1481
|
private _resolvedChainOpts;
|
|
1378
1482
|
private _resolveChainInflight?;
|
|
1379
1483
|
constructor(opts: MemoryGuardManagerOptions);
|
|
1484
|
+
/**
|
|
1485
|
+
* Carry this manager's host into `chainOpts`.
|
|
1486
|
+
*
|
|
1487
|
+
* Memory reads reach the chain through that host, and they are handed only
|
|
1488
|
+
* `chainOpts` — without this a self-hosted deployment would read from the
|
|
1489
|
+
* compiled-in default host while writing to its own.
|
|
1490
|
+
*/
|
|
1491
|
+
private withEndpoint;
|
|
1380
1492
|
/**
|
|
1381
1493
|
* Resolve `orgName` → chain once, cache forever. `commitMemoryVersion`
|
|
1382
1494
|
* already does this for writes; without the same call on the read
|
|
@@ -1394,15 +1506,27 @@ declare class MemoryGuardManager {
|
|
|
1394
1506
|
*/
|
|
1395
1507
|
runBootProbe(): Promise<void>;
|
|
1396
1508
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1509
|
+
* Bring one chain file into step with its local counterpart.
|
|
1510
|
+
*
|
|
1511
|
+
* Only a file that already exists locally is touched. Restoring one that is
|
|
1512
|
+
* absent would mean choosing where to create it, and the root is a guess the
|
|
1513
|
+
* moment more than one could apply — the same guess that once wrote a
|
|
1514
|
+
* MEMORY.md into a plugin checkout.
|
|
1515
|
+
*
|
|
1516
|
+
* @returns What happened, for the single summary line the caller logs.
|
|
1517
|
+
*/
|
|
1518
|
+
private syncOneAtBoot;
|
|
1519
|
+
/**
|
|
1520
|
+
* Where a chain slot's file lives locally, or null when we do not have it.
|
|
1401
1521
|
*
|
|
1402
|
-
* A
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1522
|
+
* A stated root is tried first, then each agent home that actually exists in
|
|
1523
|
+
* the user's home directory — the same rule that produced the slot, run
|
|
1524
|
+
* backwards. Only an existing file is returned: creating one would mean
|
|
1525
|
+
* picking a root, and picking is guessing.
|
|
1405
1526
|
*/
|
|
1527
|
+
private locate;
|
|
1528
|
+
/** Roots a chain slot may be joined to, most specific first. */
|
|
1529
|
+
private memoryRoots;
|
|
1406
1530
|
handleBeforeToolCall(event: unknown, ctx: unknown): Promise<HookDecision | null>;
|
|
1407
1531
|
private mapGuardResult;
|
|
1408
1532
|
/**
|
|
@@ -1420,12 +1544,70 @@ declare class MemoryGuardManager {
|
|
|
1420
1544
|
* also covers events carrying two different path keys, where the classifier
|
|
1421
1545
|
* and the host could otherwise disagree about which one is authoritative.
|
|
1422
1546
|
*/
|
|
1423
|
-
|
|
1547
|
+
/**
|
|
1548
|
+
* The memory files this tool call reads, as absolute paths.
|
|
1549
|
+
*
|
|
1550
|
+
* Relative paths resolve against the workspace, not `process.cwd()`. The host
|
|
1551
|
+
* sends paths relative to the agent's workspace; resolving them against the
|
|
1552
|
+
* process's own directory made the guard protect whichever directory the host
|
|
1553
|
+
* happened to start in, which on one machine was a plugin checkout.
|
|
1554
|
+
*
|
|
1555
|
+
* @returns Every named target, de-duplicated; empty when the call names none.
|
|
1556
|
+
*/
|
|
1557
|
+
private readTargets;
|
|
1558
|
+
/**
|
|
1559
|
+
* Say what the read classifier saw and what it concluded.
|
|
1560
|
+
*
|
|
1561
|
+
* The write path has `emitDebugProbe`; this is its counterpart, so a tool
|
|
1562
|
+
* call can be followed across the fork instead of only after it. `false` here
|
|
1563
|
+
* is the normal answer for a write — it means the call goes to the write
|
|
1564
|
+
* classifier next, not that it was ignored.
|
|
1565
|
+
*
|
|
1566
|
+
* @param isMemoryRead - What `classifyMemoryRead` returned.
|
|
1567
|
+
*/
|
|
1568
|
+
private emitReadProbe;
|
|
1569
|
+
/**
|
|
1570
|
+
* The chain slot for a path, or null when the file gets no chain record.
|
|
1571
|
+
*
|
|
1572
|
+
* One helper so the boot probe and every read agree: taking a basename in one
|
|
1573
|
+
* place and a relative path in the other would verify a file against a record
|
|
1574
|
+
* that is not its own.
|
|
1575
|
+
*/
|
|
1576
|
+
private slotFor;
|
|
1577
|
+
/**
|
|
1578
|
+
* Verify every memory file this call reads, each against its own chain slot.
|
|
1579
|
+
*
|
|
1580
|
+
* A call naming several files is only cleared when all of them are, so one
|
|
1581
|
+
* unverifiable file cannot ride along with a verified one.
|
|
1582
|
+
*
|
|
1583
|
+
* @returns A block for the first file that fails, an audited allow when all
|
|
1584
|
+
* were verified, or null when none of them is on chain.
|
|
1585
|
+
*/
|
|
1424
1586
|
private handleMemoryRead;
|
|
1587
|
+
/**
|
|
1588
|
+
* Check one memory file against the chain slot of the same name.
|
|
1589
|
+
*
|
|
1590
|
+
* A file with no chain version is passed through rather than blocked: there
|
|
1591
|
+
* is no claim to protect, so refusing would only stop an agent reading memory
|
|
1592
|
+
* it has never committed. A file that IS on chain must match, or the read is
|
|
1593
|
+
* refused — that is the whole guarantee.
|
|
1594
|
+
*
|
|
1595
|
+
* @returns A decision when the read must not proceed, else null.
|
|
1596
|
+
*/
|
|
1597
|
+
private verifyOneFile;
|
|
1425
1598
|
/** Complete queued audit-log writes before a host shuts down or removes its workspace. */
|
|
1426
1599
|
flushLogs(): Promise<void>;
|
|
1600
|
+
/**
|
|
1601
|
+
* A read this guard could not verify.
|
|
1602
|
+
*
|
|
1603
|
+
* Enforcing, that is a block. Observing, the host audits it as usual — but
|
|
1604
|
+
* the reason is said out loud either way, or an unverified read looks
|
|
1605
|
+
* identical to a clean one in the log.
|
|
1606
|
+
*/
|
|
1427
1607
|
private unverifiedRead;
|
|
1428
1608
|
private writeMemoryAtomic;
|
|
1609
|
+
/** Replace `target` in one step, so a reader never sees a half-written file. */
|
|
1610
|
+
private writeFileAtomic;
|
|
1429
1611
|
}
|
|
1430
1612
|
declare function createMemoryGuardManager(opts: MemoryGuardManagerOptions): MemoryGuardManager;
|
|
1431
1613
|
|
|
@@ -1578,4 +1760,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1578
1760
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1579
1761
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1580
1762
|
|
|
1581
|
-
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,
|
|
1763
|
+
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 };
|