@atbash/sdk 0.21.0-dev.0 → 0.23.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/README.md +94 -16
- package/dist/browser.d.mts +109 -12
- package/dist/browser.mjs +339 -59
- package/dist/index.d.mts +109 -12
- package/dist/index.d.ts +109 -12
- package/dist/index.js +235 -63
- package/dist/index.mjs +233 -63
- package/dist/testing.d.mts +15 -0
- package/dist/testing.d.ts +15 -0
- package/dist/testing.js +33 -0
- package/dist/testing.mjs +8 -0
- package/index.d.ts +3 -0
- package/index.js +55 -54
- package/package.json +15 -7
package/README.md
CHANGED
|
@@ -68,7 +68,7 @@ Two ways to create an agent:
|
|
|
68
68
|
|
|
69
69
|
## Secret storage
|
|
70
70
|
|
|
71
|
-
-
|
|
71
|
+
- Keep the private key in the key file (`~/.config/atbash/guard-client-key`, or a file named by `keyPath`), in `ATBASH_AGENT_KEY`, or in a secret manager — never hardcode it. See [Which key signs](#which-key-signs).
|
|
72
72
|
- Never commit `.env` files containing the key.
|
|
73
73
|
- If a key leaks, stop using it and create a new agent in the dashboard.
|
|
74
74
|
|
|
@@ -84,6 +84,8 @@ Every `judgeAction` call returns one of three verdicts:
|
|
|
84
84
|
|
|
85
85
|
> **Gate on `allow`, not on `verdict`.** `allow` is the canonical permission the SDK computes from every signal in the response; `verdict` is one of those signals, and reads as the reason. The two differ when an organisation does not enforce an agent's verdicts — Shadow Mode on an agent, or org-wide Monitor mode — where the action is judged and recorded on chain but deliberately not applied. Branching on `verdict` re-derives a denial the organisation chose not to make.
|
|
86
86
|
|
|
87
|
+
> **Shadow and Monitor mode.** On a judge host whose replies are signature-checked, `auditToolCall` asks the judge for its true verdict and the organisation's mode, and applies the mode itself. Under a signed `shadow`, `monitor` or `off` mode, a BLOCK or HOLD still runs (`allow: true`, `verdict: "ALLOW"`) and `decision.wouldVerdict` says what would have happened; it is also logged as a warning. A missing, unsigned or unknown mode enforces. Set `enforceLocally: true` to enforce every verdict whatever the mode; the SDK then asks the judge to judge every call before answering, and refuses a reply that does not confirm it, so against a judge without client enforcement every call is refused. `getJudgmentStatus` applies the mode the same way, so a shadow call polled later reports its `wouldVerdict` while `allow` stays true. `judgeAction` does not opt in and returns what the server sends. To poll a HOLD, call `getJudgmentStatus(decision.judgmentId || decision.toolCallId)` (or the same fields of a `judgeAction` result): on the on-chain judge path the verdict is recorded under its own id.
|
|
88
|
+
|
|
87
89
|
> **NB:** If your org has no active subscription, the judge returns `"No verdict"` — actions are logged on-chain for the audit trail but not evaluated by an AI provider. Assign a plan at [atbash.ai/risk-engine/settings](https://atbash.ai/risk-engine/settings) for active verdicts.
|
|
88
90
|
|
|
89
91
|
## API
|
|
@@ -127,31 +129,71 @@ Standalone helpers for keypair handling.
|
|
|
127
129
|
| `isValidPrivateKey(hex)` | Validate a private-key string |
|
|
128
130
|
| `loadAgent(privkey)` | Validate the key + return `{ pubkey, privkey }` |
|
|
129
131
|
|
|
130
|
-
## Configuration
|
|
132
|
+
## Configuration resolution
|
|
131
133
|
|
|
132
|
-
|
|
134
|
+
`new Atbash(privkey, options)` takes everything explicitly. `Atbash.fromConfig(options)` fills in what you did not pass from the environment and then from `~/.config/atbash/config.json`, and finds the signing key for you.
|
|
133
135
|
|
|
134
136
|
```ts
|
|
135
137
|
import { Atbash } from "@atbash/sdk";
|
|
136
|
-
const atbash = Atbash.fromConfig(); //
|
|
138
|
+
const atbash = Atbash.fromConfig(); // key file + env + config.json
|
|
137
139
|
```
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
| `
|
|
141
|
+
### Settings: option, then env, then `config.json`
|
|
142
|
+
|
|
143
|
+
Each setting is read from the first place that has it: the `fromConfig` option, then the environment variable, then the key in `config.json`.
|
|
144
|
+
|
|
145
|
+
`judge` is taken whole. Pass it complete, or leave it out and use the environment or `config.json`: a `judge` with only an `endpoint` ignores `ATBASH_JUDGE_VERIFY_PUBKEY`, so a self-hosted host then fails the allowlist.
|
|
146
|
+
|
|
147
|
+
| `fromConfig` option | Env var | `config.json` key | Notes |
|
|
148
|
+
|---|---|---|---|
|
|
149
|
+
| `judge.endpoint` | `ATBASH_ENDPOINT` | `judgeEndpoint` | Must pass the endpoint rules below. |
|
|
150
|
+
| `judge.verifyPubKey` | `ATBASH_JUDGE_VERIFY_PUBKEY` | `judgeVerifyPubKey` | 66-hex response-signing key of a self-hosted judge. Set through the environment or `config.json` without an endpoint, it throws; passed in `judge` without an endpoint, the default endpoint is used. |
|
|
151
|
+
| `network` | `ATBASH_DEFAULT_CHAIN_NETWORK` | `defaultChainNetwork` | Only `"private"` is accepted; anything else throws. A client that names no chain is pinned to it, even for an org the dashboard places on another chain. |
|
|
152
|
+
| `debug` | `ATBASH_DEBUG` | `debug` | `1`, `true` or `yes` turns diagnostics on. |
|
|
153
|
+
| `orgName` | `ATBASH_ORG_NAME` | `orgName` | `fromConfig` reads the option only. The env var and file key are read by `resolve("orgName")`, which the CLI and plugins use. |
|
|
154
|
+
|
|
155
|
+
`agentKey` is not in this table on purpose: the signing key is never read from `config.json` (next section).
|
|
156
|
+
|
|
157
|
+
Helpers: `saveUserConfig(config)`, `loadUserConfig()`, `resolve(key, flagValue?)`, `getConfigPath()`.
|
|
158
|
+
|
|
159
|
+
### Which key signs
|
|
160
|
+
|
|
161
|
+
`fromConfig` picks the first of these that is set:
|
|
162
|
+
|
|
163
|
+
1. `agentKey` option (hex private key in code).
|
|
164
|
+
2. `keyPath` option. A path that does not exist throws; the SDK never falls through to another key when you named one.
|
|
165
|
+
3. `ATBASH_AGENT_KEY` environment variable.
|
|
166
|
+
4. `~/.config/atbash/guard-client-key`.
|
|
167
|
+
5. `~/.config/atbash/atbash-client-key`.
|
|
146
168
|
|
|
147
|
-
|
|
169
|
+
If none exists `fromConfig` throws `atbash key file not found. Looked for: <both default paths>`. The bare constructor never reads a key file.
|
|
148
170
|
|
|
149
|
-
|
|
171
|
+
An `agentKey` inside `config.json` is ignored. A settings file is writable by anything on the machine and is shared by every Atbash integration, so it is not allowed to choose who you sign as. When you pass a `logger`, `fromConfig` warns:
|
|
150
172
|
|
|
151
|
-
|
|
173
|
+
```
|
|
174
|
+
[atbash] "agentKey" in config.json is ignored — settings do not choose the signing key. It holds <pubkey>; this client signs as the key file or ATBASH_AGENT_KEY instead. ...
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
and when no key file exists at all, the "not found" error names the pubkey stranded in `config.json` so you know where it went.
|
|
178
|
+
|
|
179
|
+
A key file is either `key=value` lines or JSON. Both fields must be present; the public key is re-derived from the private key, and a `0x` prefix is accepted.
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
privkey=<64 hex>
|
|
183
|
+
pubkey=<66 hex>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
```json
|
|
187
|
+
{ "privKey": "<64 hex>", "pubKey": "<66 hex>" }
|
|
188
|
+
```
|
|
152
189
|
|
|
153
|
-
|
|
154
|
-
|
|
190
|
+
For adapters and CI, keep the key in a file and point at it with `keyPath` (or let the default path be found). Passing the key on a command line puts it in shell history and process listings.
|
|
191
|
+
|
|
192
|
+
### What `orgName` does
|
|
193
|
+
|
|
194
|
+
`orgName` tells the SDK which chain to sign the call for: the org's network is looked up once through the dashboard, cached per client, and every judge and log call is signed for that chain. The SDK does not check that the name matches the org the agent was registered under; which org's policy judges the action is decided by the agent's registration, not by this string. On a deployment with a single chain a missing or different `orgName` therefore does not change the verdict. Org-scoped reads such as `getOrgTierInfo(orgName)` send the name as given; the dashboard answers an agent-authenticated call for the agent's own org, whatever name was passed.
|
|
195
|
+
|
|
196
|
+
Agent policy and detail reads can take the org, or an explicit chain:
|
|
155
197
|
|
|
156
198
|
```ts
|
|
157
199
|
await atbash.getAgentPolicy(atbash.pubkey, { orgName: "acme" });
|
|
@@ -160,6 +202,42 @@ await atbash.getAgentDetail(atbash.pubkey, {
|
|
|
160
202
|
});
|
|
161
203
|
```
|
|
162
204
|
|
|
205
|
+
### Judge endpoint rules
|
|
206
|
+
|
|
207
|
+
Both `fromConfig` and the constructor validate the endpoint before any request. `validateJudgeEndpoint(...)` exposes the same check.
|
|
208
|
+
|
|
209
|
+
- With no endpoint configured the SDK talks to the endpoint compiled into the build (`https://atbash.ai` for a release build).
|
|
210
|
+
- An `https://` endpoint is accepted without further setup only on the trusted hosts: `atbash.ai`, `www.atbash.ai` and the build's own default host.
|
|
211
|
+
- On the trusted hosts, every judge response and status poll must carry a valid signature from one of the response-signing keys built into the SDK; an unsigned or forged reply is denied, whatever `failClosed` says. No setup is needed. A `verifyPubKey` set for such a host must be one of those keys, or the constructor throws `not the response-signing key pinned for <host>`. A build with no keys for its host leaves replies unchecked, as before.
|
|
212
|
+
- Any other `https://` endpoint is a self-hosted judge. It needs `policy: "self-hosted"` plus `verifyPubKey` (the judge's 66-hex compressed response-signing key), or `ATBASH_ENDPOINT` plus `ATBASH_JUDGE_VERIFY_PUBKEY`. Every judge response is then signature-checked against that key. Without the key the constructor throws `judge endpoint hostname "<host>" is not in the trusted allowlist`.
|
|
213
|
+
- Plain `http://` is accepted only for loopback (`localhost`, `127.0.0.1`, `::1`), for a dashboard running on the same machine. Any other `http://` endpoint throws.
|
|
214
|
+
- A URL with embedded credentials (`user:pass@host`) throws.
|
|
215
|
+
|
|
216
|
+
```ts
|
|
217
|
+
const atbash = Atbash.fromConfig({
|
|
218
|
+
judge: {
|
|
219
|
+
policy: "self-hosted",
|
|
220
|
+
endpoint: "https://judge.example.com",
|
|
221
|
+
verifyPubKey: "02…66 hex…",
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### From a key file to a first ALLOW
|
|
227
|
+
|
|
228
|
+
1. Download the key file the onboarding wizard offers at its Deploy step (it is in the `key=value` form above) and save it, for example as `./agent.key`.
|
|
229
|
+
2. Build the client from that file and judge an action:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
import { Atbash } from "@atbash/sdk";
|
|
233
|
+
|
|
234
|
+
const atbash = Atbash.fromConfig({ keyPath: "./agent.key" });
|
|
235
|
+
const result = await atbash.judgeAction("read file", "list the files in ./src");
|
|
236
|
+
console.log(result.allow, result.enforced, result.reason);
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Dropping the same file at `~/.config/atbash/guard-client-key` lets `Atbash.fromConfig()` find it with no options at all.
|
|
240
|
+
|
|
163
241
|
## Error handling
|
|
164
242
|
|
|
165
243
|
The SDK throws standard `Error` objects. Known failure modes are enriched with a pointer to the dashboard page that fixes them:
|
package/dist/browser.d.mts
CHANGED
|
@@ -31,6 +31,31 @@ interface ValidatedEndpoint {
|
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
33
|
declare function buildAllowedJudgeHosts(): ReadonlySet<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Pin keys for a loopback judge, so tests can drive the pinned-host path
|
|
36
|
+
* against a local server.
|
|
37
|
+
*
|
|
38
|
+
* Only loopback hosts read this, and their traffic never leaves the machine,
|
|
39
|
+
* so it cannot loosen the check on a real Atbash host.
|
|
40
|
+
*
|
|
41
|
+
* @internal
|
|
42
|
+
* @param keys - Compressed pubkeys to pin; `[]` clears them.
|
|
43
|
+
*/
|
|
44
|
+
declare function setLoopbackJudgePinsForTests(keys: readonly string[]): void;
|
|
45
|
+
/**
|
|
46
|
+
* The keys a judge reply must be signed by, for one endpoint.
|
|
47
|
+
*
|
|
48
|
+
* An Atbash host's pinned keys always decide: a configured `verifyPubKey` on
|
|
49
|
+
* such a host must be one of them, or the client refuses to start, because a
|
|
50
|
+
* key that only had to come from config could be anyone's. A host with no pins
|
|
51
|
+
* uses the configured key, or none.
|
|
52
|
+
*
|
|
53
|
+
* @param endpoint - The validated judge endpoint URL.
|
|
54
|
+
* @param configuredKey - The `verifyPubKey` the caller configured, if any.
|
|
55
|
+
* @returns The accepted keys, current first; empty means replies are not checked.
|
|
56
|
+
* @throws When `configuredKey` is not one of the host's pinned keys.
|
|
57
|
+
*/
|
|
58
|
+
declare function judgeVerifyKeys(endpoint: string, configuredKey?: string): readonly string[];
|
|
34
59
|
declare function validateJudgeEndpoint(judge?: JudgeEndpointConfig): ValidatedEndpoint;
|
|
35
60
|
|
|
36
61
|
interface ChainConfig {
|
|
@@ -195,6 +220,12 @@ interface JudgeResult {
|
|
|
195
220
|
provider: string;
|
|
196
221
|
latencyMs: number;
|
|
197
222
|
toolCallId: string;
|
|
223
|
+
/**
|
|
224
|
+
* The id the judge recorded this verdict under, when it differs from
|
|
225
|
+
* `toolCallId` (the on-chain judge path). Poll `getJudgmentStatus` with
|
|
226
|
+
* `judgmentId || toolCallId`. Absent when the reply names none.
|
|
227
|
+
*/
|
|
228
|
+
judgmentId?: string;
|
|
198
229
|
onChain: boolean;
|
|
199
230
|
/** Severity 1 (poisonous) → 10 (benign). Present on memory-scan responses; absent for regular tool-call judgments. */
|
|
200
231
|
score?: number;
|
|
@@ -231,6 +262,12 @@ interface JudgmentStatus {
|
|
|
231
262
|
onChain?: boolean;
|
|
232
263
|
cached?: boolean;
|
|
233
264
|
responseTimeMs?: number;
|
|
265
|
+
/**
|
|
266
|
+
* The verdict the judge reached (`"BLOCK"` or `"HOLD"`) when the
|
|
267
|
+
* organisation's signed mode (`shadow`, `monitor`, `off`) let the action run
|
|
268
|
+
* anyway, as {@link Decision.wouldVerdict}. Absent when the status is the verdict.
|
|
269
|
+
*/
|
|
270
|
+
wouldVerdict?: "BLOCK" | "HOLD";
|
|
234
271
|
}
|
|
235
272
|
interface TierInfo {
|
|
236
273
|
orgName: string;
|
|
@@ -398,6 +435,14 @@ interface AtbashOptions {
|
|
|
398
435
|
* off).
|
|
399
436
|
*/
|
|
400
437
|
requireEnforcement?: boolean;
|
|
438
|
+
/**
|
|
439
|
+
* When true, `auditToolCall` enforces the judge's verdict whatever
|
|
440
|
+
* enforcement mode the organisation is in. Default false: on a judge host
|
|
441
|
+
* whose replies are signature-checked, a signed `shadow`, `monitor` or `off`
|
|
442
|
+
* mode lets a BLOCK or HOLD run, reported in `Decision.wouldVerdict`. This
|
|
443
|
+
* can only make the client stricter.
|
|
444
|
+
*/
|
|
445
|
+
enforceLocally?: boolean;
|
|
401
446
|
/**
|
|
402
447
|
* Verbose diagnostics. Off by default. When on, a failed judge call also
|
|
403
448
|
* logs the response body, which is the difference between "judge API failed"
|
|
@@ -422,6 +467,18 @@ interface Decision {
|
|
|
422
467
|
enforced?: boolean;
|
|
423
468
|
/** Server-reported protection mode (`off`, `monitor`, `enforce`); absent when unknown. */
|
|
424
469
|
enforcementMode?: string;
|
|
470
|
+
/**
|
|
471
|
+
* The verdict the judge reached when the organisation's signed mode
|
|
472
|
+
* (`shadow`, `monitor`, `off`) let the action run anyway: what would have
|
|
473
|
+
* happened under enforcement. Absent when the decision is the verdict.
|
|
474
|
+
*/
|
|
475
|
+
wouldVerdict?: "BLOCK" | "HOLD";
|
|
476
|
+
/**
|
|
477
|
+
* The id the judge recorded this verdict under, when it differs from
|
|
478
|
+
* `toolCallId` (the on-chain judge path), as {@link JudgeResult.judgmentId}.
|
|
479
|
+
* Poll `getJudgmentStatus` with `judgmentId || toolCallId`.
|
|
480
|
+
*/
|
|
481
|
+
judgmentId?: string;
|
|
425
482
|
}
|
|
426
483
|
/** Input to `auditToolCall`. */
|
|
427
484
|
interface ToolCallInput {
|
|
@@ -459,6 +516,8 @@ interface FromConfigOptions {
|
|
|
459
516
|
failClosed?: boolean;
|
|
460
517
|
/** See {@link AtbashOptions.requireEnforcement}. Default true. */
|
|
461
518
|
requireEnforcement?: boolean;
|
|
519
|
+
/** See {@link AtbashOptions.enforceLocally}. Default false. */
|
|
520
|
+
enforceLocally?: boolean;
|
|
462
521
|
/** See {@link AtbashOptions.decisionTimeoutMs}. Default 60 000 ms. */
|
|
463
522
|
decisionTimeoutMs?: number;
|
|
464
523
|
/** See {@link AtbashOptions.debug}. */
|
|
@@ -513,12 +572,21 @@ declare class Atbash {
|
|
|
513
572
|
readonly orgName?: string;
|
|
514
573
|
/** Default judge response-signing pubkey, if configured (see fromConfig). */
|
|
515
574
|
readonly verifyPubKey?: string;
|
|
575
|
+
/**
|
|
576
|
+
* The keys every judge reply must be signed by: the host's pinned keys, or
|
|
577
|
+
* the configured `verifyPubKey` on a host with none. Empty means unchecked.
|
|
578
|
+
*/
|
|
579
|
+
private readonly verifyKeys;
|
|
516
580
|
/** Default org encryption key — see {@link AtbashOptions.orgEncryptionPubKey}. */
|
|
517
581
|
readonly orgEncryptionPubKey?: string;
|
|
518
582
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
519
583
|
readonly failClosed: boolean;
|
|
520
584
|
/** When true (default), an unenforced (audit-tier) answer is refused. */
|
|
521
585
|
readonly requireEnforcement: boolean;
|
|
586
|
+
/** When true, a signed non-enforcing mode never relaxes a verdict. */
|
|
587
|
+
readonly enforceLocally: boolean;
|
|
588
|
+
/** Results whose enforcement mode came signed and bound to their call. */
|
|
589
|
+
private readonly modeTrusted;
|
|
522
590
|
/** Overall deadline for one auditToolCall decision, in ms. */
|
|
523
591
|
readonly decisionTimeoutMs: number;
|
|
524
592
|
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
@@ -659,12 +727,25 @@ declare class Atbash {
|
|
|
659
727
|
* response bytes via the Rust core's `verifySignature`.
|
|
660
728
|
*/
|
|
661
729
|
judgeAction(action: string, context?: string, options?: JudgeOptions): Promise<JudgeResult>;
|
|
730
|
+
/**
|
|
731
|
+
* judgeAction, optionally asking the judge for the true verdict and the
|
|
732
|
+
* organisation's enforcement mode so this client applies the mode itself.
|
|
733
|
+
*
|
|
734
|
+
* Only auditToolCall opts in: judgeAction's callers keep the server-side
|
|
735
|
+
* downgrade they gate on today.
|
|
736
|
+
*
|
|
737
|
+
* @param clientEnforces - Send `X-Atbash-Client-Enforcement` when the reply can be trusted.
|
|
738
|
+
*/
|
|
739
|
+
private judgeTracked;
|
|
662
740
|
private _judgeAction;
|
|
663
741
|
/**
|
|
664
|
-
* Start a local hold on an enforced
|
|
665
|
-
*
|
|
666
|
-
*
|
|
667
|
-
*
|
|
742
|
+
* Start a local hold on an enforced BLOCK that jails: one already on chain,
|
|
743
|
+
* or one the judge answered before its chain write landed
|
|
744
|
+
* (`on_chain_status: "pending"`), which jails once it lands. Refuse any other
|
|
745
|
+
* result that lands while the agent is held, or whose request was already in
|
|
746
|
+
* flight when the block arrived: the server judged it on pre-jail state.
|
|
747
|
+
*
|
|
748
|
+
* @param onChainStatus - The reply's `on_chain_status`; empty when absent.
|
|
668
749
|
*/
|
|
669
750
|
private applyJailHold;
|
|
670
751
|
/** The server's jailed refusal, produced locally while the agent is held. */
|
|
@@ -677,12 +758,12 @@ declare class Atbash {
|
|
|
677
758
|
*/
|
|
678
759
|
auditToolCall(input: ToolCallInput): Promise<Decision>;
|
|
679
760
|
/**
|
|
680
|
-
* The verify
|
|
681
|
-
* may only narrow what the client accepts: on a client pinned to
|
|
682
|
-
*
|
|
683
|
-
*
|
|
761
|
+
* The verify keys for one call (R4, governor tier-2 review). A per-call key
|
|
762
|
+
* may only narrow what the client accepts: on a client pinned to judge keys
|
|
763
|
+
* it must be one of them, never a replacement; on an unpinned client it
|
|
764
|
+
* adds the check.
|
|
684
765
|
*/
|
|
685
|
-
private
|
|
766
|
+
private effectiveVerifyKeys;
|
|
686
767
|
/**
|
|
687
768
|
* Collapse a judge result into a {@link Decision}. The most restrictive
|
|
688
769
|
* signal wins (security review 2026-09-30, H1): `action_type`, `verdict`
|
|
@@ -693,6 +774,15 @@ declare class Atbash {
|
|
|
693
774
|
* never overrides a refusal.
|
|
694
775
|
*/
|
|
695
776
|
private decide;
|
|
777
|
+
/**
|
|
778
|
+
* Apply the organisation's enforcement mode to the judge's true verdict.
|
|
779
|
+
*
|
|
780
|
+
* Only a mode that arrived signed and bound to this call counts; a missing,
|
|
781
|
+
* unsigned or unknown mode, or enforceLocally, means enforce. Under
|
|
782
|
+
* `shadow`, `monitor` or `off` a BLOCK or HOLD runs, reported in
|
|
783
|
+
* `wouldVerdict`. An ERROR stays an error: it is not a verdict.
|
|
784
|
+
*/
|
|
785
|
+
private applyMode;
|
|
696
786
|
private decideInner;
|
|
697
787
|
/**
|
|
698
788
|
* One exit for every judge failure.
|
|
@@ -1154,11 +1244,18 @@ declare function getRecentAgentMemory(auth: AgentAuth, chainOpts?: ChainOpts, fi
|
|
|
1154
1244
|
* when you need every active version regardless of age.
|
|
1155
1245
|
*/
|
|
1156
1246
|
declare function getActiveAgentMemory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
1247
|
+
interface MemoryHistoryPage {
|
|
1248
|
+
/** Most versions to return, at most 200. Omit for the full history. */
|
|
1249
|
+
maxCount?: number;
|
|
1250
|
+
/** Return only versions with a lower id: the last id of the previous page. */
|
|
1251
|
+
beforeId?: number;
|
|
1252
|
+
}
|
|
1157
1253
|
/**
|
|
1158
1254
|
* Full version history — active + inactive, most recent first. Used
|
|
1159
|
-
* by rollback UX to choose a target version.
|
|
1255
|
+
* by rollback UX to choose a target version. Pass `page` to read it in
|
|
1256
|
+
* pages; this needs a Dashboard and chain that support paging.
|
|
1160
1257
|
*/
|
|
1161
|
-
declare function getMemoryHistory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null): Promise<AgentMemoryEntry[]>;
|
|
1258
|
+
declare function getMemoryHistory(auth: AgentAuth, chainOpts?: ChainOpts, filePath?: string | null, page?: MemoryHistoryPage): Promise<AgentMemoryEntry[]>;
|
|
1162
1259
|
/**
|
|
1163
1260
|
* Fetch a single memory entry by version id, including its current
|
|
1164
1261
|
* `is_active` state. Version ids are agent-unique on chain (not
|
|
@@ -1988,4 +2085,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1988
2085
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1989
2086
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1990
2087
|
|
|
1991
|
-
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_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, JudgeRefusalError, 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 OperationEvent, type OrgSubscription, PRIVATE_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, configureEvents, configureJailHold, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, eventsAreOn, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, guardMemoryWrite, isEnvelope, isJailHeld, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, memorySlotOf, normalizeActionForHash, normalizeActionType, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, recordEvent, redactJsonStrings, redactSecrets, releaseJailHolds, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
|
|
2088
|
+
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_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, JudgeRefusalError, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, type MemoryHistoryPage, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OperationEvent, type OrgSubscription, PRIVATE_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, configureEvents, configureJailHold, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, eventsAreOn, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, guardMemoryWrite, isEnvelope, isJailHeld, isValidPrivateKey, judgeVerifyKeys, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, memorySlotOf, normalizeActionForHash, normalizeActionType, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, recordEvent, redactJsonStrings, redactSecrets, releaseJailHolds, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setLoopbackJudgePinsForTests, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
|