@atbash/sdk 0.22.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/dist/index.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, on-chain BLOCK (the verdict that jails).
665
- * Refuse any other result that lands while the agent is held, or whose
666
- * request was already in flight when the block arrived: the server judged it
667
- * on pre-jail state.
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 key for one call (R4, governor tier-2 review). A per-call key
681
- * may only narrow what the client accepts: on a client pinned to a judge
682
- * key it must be that same key, never a replacement; on an unpinned client
683
- * it adds the check.
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 effectiveVerifyKey;
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.
@@ -1995,4 +2085,4 @@ declare function containsSecret(text: string): boolean;
1995
2085
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1996
2086
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1997
2087
 
1998
- 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, 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 };
package/dist/index.d.ts 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, on-chain BLOCK (the verdict that jails).
665
- * Refuse any other result that lands while the agent is held, or whose
666
- * request was already in flight when the block arrived: the server judged it
667
- * on pre-jail state.
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 key for one call (R4, governor tier-2 review). A per-call key
681
- * may only narrow what the client accepts: on a client pinned to a judge
682
- * key it must be that same key, never a replacement; on an unpinned client
683
- * it adds the check.
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 effectiveVerifyKey;
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.
@@ -1995,4 +2085,4 @@ declare function containsSecret(text: string): boolean;
1995
2085
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1996
2086
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1997
2087
 
1998
- 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, 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 };