@atbash/sdk 0.10.6-dev.0 → 0.10.9-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/browser.d.mts +118 -2
- package/dist/browser.mjs +195 -17
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +118 -2
- package/dist/index.d.ts +118 -2
- package/dist/index.js +229 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +226 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -310,6 +310,12 @@ interface AtbashOptions {
|
|
|
310
310
|
orgEncryptionPubKey?: string;
|
|
311
311
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
312
312
|
failClosed?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Verbose diagnostics. Off by default. When on, a failed judge call also
|
|
315
|
+
* logs the response body, which is the difference between "judge API failed"
|
|
316
|
+
* and knowing why it failed. Opt-in because that body can echo the action.
|
|
317
|
+
*/
|
|
318
|
+
debug?: boolean;
|
|
313
319
|
logger?: AtbashLogger;
|
|
314
320
|
}
|
|
315
321
|
/** Canonical decision returned by `auditToolCall`. */
|
|
@@ -350,6 +356,8 @@ interface FromConfigOptions {
|
|
|
350
356
|
/** Default org name — see {@link AtbashOptions.orgName}. */
|
|
351
357
|
orgName?: string;
|
|
352
358
|
failClosed?: boolean;
|
|
359
|
+
/** See {@link AtbashOptions.debug}. */
|
|
360
|
+
debug?: boolean;
|
|
353
361
|
logger?: AtbashLogger;
|
|
354
362
|
}
|
|
355
363
|
/** Options accepted by `judgeAction`. */
|
|
@@ -414,6 +422,7 @@ declare class Atbash {
|
|
|
414
422
|
readonly failClosed: boolean;
|
|
415
423
|
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
416
424
|
private _orgKeyFromChain;
|
|
425
|
+
private readonly debug;
|
|
417
426
|
private readonly logger;
|
|
418
427
|
private readonly http;
|
|
419
428
|
/**
|
|
@@ -427,7 +436,20 @@ declare class Atbash {
|
|
|
427
436
|
* server-side replay protection windows never expire it mid-session.
|
|
428
437
|
*/
|
|
429
438
|
private _authBearer;
|
|
439
|
+
/** Guards `logEnvironmentOnce` — hosts construct several clients. */
|
|
440
|
+
private static environmentLogged;
|
|
430
441
|
constructor(privkey: string, options?: AtbashOptions);
|
|
442
|
+
/**
|
|
443
|
+
* Say which environment this build talks to, once per process.
|
|
444
|
+
*
|
|
445
|
+
* The endpoint and both chain RIDs are compiled in, chosen by the npm tag,
|
|
446
|
+
* and no configuration repoints a released build. So installing the build
|
|
447
|
+
* for the wrong environment is invisible: the plugin loads, the hook fires,
|
|
448
|
+
* and every judge call fails because the agent does not exist on the chain
|
|
449
|
+
* this build targets. Organisation names are not unique across environments
|
|
450
|
+
* either, so an org resolving is not evidence the build is right.
|
|
451
|
+
*/
|
|
452
|
+
private logEnvironmentOnce;
|
|
431
453
|
/**
|
|
432
454
|
* Construct from resolved config: explicit overrides → env vars → the
|
|
433
455
|
* `~/.config/atbash/config.json` file (see userConfig.resolve). The private
|
|
@@ -470,6 +492,15 @@ declare class Atbash {
|
|
|
470
492
|
* explicitly false.
|
|
471
493
|
*/
|
|
472
494
|
auditToolCall(input: ToolCallInput): Promise<Decision>;
|
|
495
|
+
/**
|
|
496
|
+
* One exit for every judge failure.
|
|
497
|
+
*
|
|
498
|
+
* Status and reason go in the *message*, not only in the meta object: hosts
|
|
499
|
+
* print the message and drop the meta, which is why this read as a bare
|
|
500
|
+
* "judge API failed" while the judge was answering with a precise reason.
|
|
501
|
+
* The response body follows only under `debug`, since it can echo the action.
|
|
502
|
+
*/
|
|
503
|
+
private failJudge;
|
|
473
504
|
private fail;
|
|
474
505
|
getJudgmentStatus(judgmentId: string, agentPubkey?: string): Promise<JudgmentStatus>;
|
|
475
506
|
getToolCalls(maxCount: number): Promise<ToolCallRecord[]>;
|
|
@@ -545,7 +576,13 @@ declare class Atbash {
|
|
|
545
576
|
private raiseIfError;
|
|
546
577
|
/** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
|
|
547
578
|
private httpError;
|
|
548
|
-
/**
|
|
579
|
+
/**
|
|
580
|
+
* Wrap a transport failure (fetch threw, no response) as an AtbashAPIError.
|
|
581
|
+
*
|
|
582
|
+
* `HttpTransportError.kind` names the cause; the message is already
|
|
583
|
+
* human-readable. `debug` echoes the original exception so operators can
|
|
584
|
+
* cross-reference with node / undici logs when a class doesn't match.
|
|
585
|
+
*/
|
|
549
586
|
private transportError;
|
|
550
587
|
private json;
|
|
551
588
|
static generateKeypair(): KeyPair;
|
|
@@ -571,6 +608,43 @@ declare class SignatureVerificationError extends Error {
|
|
|
571
608
|
constructor(message: string);
|
|
572
609
|
}
|
|
573
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Thin typed fetch wrapper.
|
|
613
|
+
*
|
|
614
|
+
* openapi-typescript emits types only (no runtime client), so this is the
|
|
615
|
+
* single hand-written transport — generic `get`/`post` over global `fetch`
|
|
616
|
+
* with a per-request timeout. The endpoint-specific request/response *shapes*
|
|
617
|
+
* are pulled from the generated `schema.ts` at the call sites in client.ts, so
|
|
618
|
+
* the wire contract still lives in spec/openapi.yaml. Methods return the raw
|
|
619
|
+
* `Response` so the caller can read the exact bytes the server signed before
|
|
620
|
+
* any decode (judge signature verification) — mirroring the Python surface's
|
|
621
|
+
* use of raw httpx (DECISIONS 2026-05-22).
|
|
622
|
+
*/
|
|
623
|
+
type QueryValue = string | number | boolean | undefined | null;
|
|
624
|
+
declare class HttpClient {
|
|
625
|
+
readonly baseUrl: string;
|
|
626
|
+
readonly timeoutMs: number;
|
|
627
|
+
constructor(baseUrl: string, timeoutMs: number);
|
|
628
|
+
buildUrl(path: string, query?: Record<string, QueryValue>): string;
|
|
629
|
+
get(path: string, query?: Record<string, QueryValue>, headers?: Record<string, string>): Promise<Response>;
|
|
630
|
+
post(path: string, body: unknown, headers?: Record<string, string>): Promise<Response>;
|
|
631
|
+
private fetch;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* A transport failure the SDK can act on. Every real cause the platform surfaces
|
|
635
|
+
* lands as one of these — the message names the cause in plain language so a
|
|
636
|
+
* plugin can show it to a user without decoding httpx / fetch internals.
|
|
637
|
+
*
|
|
638
|
+
* `cause` preserves the original error for debug logging; consumers that want
|
|
639
|
+
* the raw exception (e.g. tests) read it there.
|
|
640
|
+
*/
|
|
641
|
+
declare class HttpTransportError extends Error {
|
|
642
|
+
readonly kind: "timeout" | "aborted" | "dns" | "connect_refused" | "connection_reset" | "unknown";
|
|
643
|
+
constructor(kind: HttpTransportError["kind"], message: string, options?: {
|
|
644
|
+
cause?: unknown;
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
574
648
|
/** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
|
|
575
649
|
|
|
576
650
|
declare function normalizeVerdict(raw: unknown): Verdict;
|
|
@@ -585,6 +659,8 @@ interface AtbashUserConfig {
|
|
|
585
659
|
blockchainRid?: string;
|
|
586
660
|
provider?: string;
|
|
587
661
|
providerModel?: string;
|
|
662
|
+
/** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
|
|
663
|
+
debug?: string;
|
|
588
664
|
}
|
|
589
665
|
declare function getConfigDir(): string;
|
|
590
666
|
declare function getConfigPath(): string;
|
|
@@ -595,6 +671,26 @@ declare function resolve(key: keyof AtbashUserConfig, flagValue?: string): strin
|
|
|
595
671
|
declare function resolveKeyPath(input?: string): string;
|
|
596
672
|
declare function loadAgentFromFile(keyPath?: string): AgentAuth;
|
|
597
673
|
|
|
674
|
+
/**
|
|
675
|
+
* Accepted key filenames, in precedence order.
|
|
676
|
+
*
|
|
677
|
+
* `guard-client-key` stays first: it is the name every existing install
|
|
678
|
+
* already has, and changing which file wins would silently switch agent
|
|
679
|
+
* identity for anyone holding both. `atbash-client-key` is accepted because
|
|
680
|
+
* it is the name people actually create — the old one carries retired
|
|
681
|
+
* branding — and hitting ENOENT on a key you just wrote, from a plugin that
|
|
682
|
+
* still reports itself installed, is a miserable first run.
|
|
683
|
+
*/
|
|
684
|
+
declare const KEY_FILENAMES: readonly ["guard-client-key", "atbash-client-key"];
|
|
685
|
+
/** Every path checked when no explicit key path is given, in order. */
|
|
686
|
+
declare function keyPathCandidates(): string[];
|
|
687
|
+
/**
|
|
688
|
+
* Pick the key path: an explicit input wins untouched; otherwise the first
|
|
689
|
+
* accepted filename that exists, falling back to the preferred name so the
|
|
690
|
+
* error names something recognisable when nothing is there.
|
|
691
|
+
*/
|
|
692
|
+
declare function chooseKeyPath(input: string | undefined, exists: (p: string) => boolean): string;
|
|
693
|
+
|
|
598
694
|
/**
|
|
599
695
|
* Canonical secret kinds reported by the Rust core in `SecretMatch.kind`.
|
|
600
696
|
* Wire is permissive (modelled as a free string in {@link SecretMatch})
|
|
@@ -613,6 +709,26 @@ declare function verifyJudgeResponseSignature(bodyBytes: Uint8Array, signatureHe
|
|
|
613
709
|
reason?: string;
|
|
614
710
|
};
|
|
615
711
|
|
|
712
|
+
/**
|
|
713
|
+
* The boot memory-sync failure line.
|
|
714
|
+
*
|
|
715
|
+
* Split out of `guard-manager.ts` so it can be asserted without constructing a
|
|
716
|
+
* guard manager, which needs the native addon. The message is the whole point
|
|
717
|
+
* of AT-304: hosts print the message and drop the structured meta, so a cause
|
|
718
|
+
* that lives only in meta never reaches the operator.
|
|
719
|
+
*/
|
|
720
|
+
/** Advice, not a diagnosis — appended only when the cause is unhelpful. */
|
|
721
|
+
declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the cause above does not explain it";
|
|
722
|
+
/**
|
|
723
|
+
* Lead with the real cause.
|
|
724
|
+
*
|
|
725
|
+
* The previous wording named the chain endpoint and orgName as the things to
|
|
726
|
+
* check, which sent operators to verify configuration that was already correct
|
|
727
|
+
* while the actual cause (a node answering `404 Can't find blockchain with
|
|
728
|
+
* blockchainRID: …` for a chain it does not host) stayed hidden.
|
|
729
|
+
*/
|
|
730
|
+
declare function bootSyncFailureLine(cause: unknown): string;
|
|
731
|
+
|
|
616
732
|
/** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
|
|
617
733
|
declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
|
|
618
734
|
/** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
|
|
@@ -1164,4 +1280,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1164
1280
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1165
1281
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1166
1282
|
|
|
1167
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, buildAllowedJudgeHosts, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, 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 };
|
|
1283
|
+
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, 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, 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, chooseKeyPath, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -310,6 +310,12 @@ interface AtbashOptions {
|
|
|
310
310
|
orgEncryptionPubKey?: string;
|
|
311
311
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
312
312
|
failClosed?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Verbose diagnostics. Off by default. When on, a failed judge call also
|
|
315
|
+
* logs the response body, which is the difference between "judge API failed"
|
|
316
|
+
* and knowing why it failed. Opt-in because that body can echo the action.
|
|
317
|
+
*/
|
|
318
|
+
debug?: boolean;
|
|
313
319
|
logger?: AtbashLogger;
|
|
314
320
|
}
|
|
315
321
|
/** Canonical decision returned by `auditToolCall`. */
|
|
@@ -350,6 +356,8 @@ interface FromConfigOptions {
|
|
|
350
356
|
/** Default org name — see {@link AtbashOptions.orgName}. */
|
|
351
357
|
orgName?: string;
|
|
352
358
|
failClosed?: boolean;
|
|
359
|
+
/** See {@link AtbashOptions.debug}. */
|
|
360
|
+
debug?: boolean;
|
|
353
361
|
logger?: AtbashLogger;
|
|
354
362
|
}
|
|
355
363
|
/** Options accepted by `judgeAction`. */
|
|
@@ -414,6 +422,7 @@ declare class Atbash {
|
|
|
414
422
|
readonly failClosed: boolean;
|
|
415
423
|
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
416
424
|
private _orgKeyFromChain;
|
|
425
|
+
private readonly debug;
|
|
417
426
|
private readonly logger;
|
|
418
427
|
private readonly http;
|
|
419
428
|
/**
|
|
@@ -427,7 +436,20 @@ declare class Atbash {
|
|
|
427
436
|
* server-side replay protection windows never expire it mid-session.
|
|
428
437
|
*/
|
|
429
438
|
private _authBearer;
|
|
439
|
+
/** Guards `logEnvironmentOnce` — hosts construct several clients. */
|
|
440
|
+
private static environmentLogged;
|
|
430
441
|
constructor(privkey: string, options?: AtbashOptions);
|
|
442
|
+
/**
|
|
443
|
+
* Say which environment this build talks to, once per process.
|
|
444
|
+
*
|
|
445
|
+
* The endpoint and both chain RIDs are compiled in, chosen by the npm tag,
|
|
446
|
+
* and no configuration repoints a released build. So installing the build
|
|
447
|
+
* for the wrong environment is invisible: the plugin loads, the hook fires,
|
|
448
|
+
* and every judge call fails because the agent does not exist on the chain
|
|
449
|
+
* this build targets. Organisation names are not unique across environments
|
|
450
|
+
* either, so an org resolving is not evidence the build is right.
|
|
451
|
+
*/
|
|
452
|
+
private logEnvironmentOnce;
|
|
431
453
|
/**
|
|
432
454
|
* Construct from resolved config: explicit overrides → env vars → the
|
|
433
455
|
* `~/.config/atbash/config.json` file (see userConfig.resolve). The private
|
|
@@ -470,6 +492,15 @@ declare class Atbash {
|
|
|
470
492
|
* explicitly false.
|
|
471
493
|
*/
|
|
472
494
|
auditToolCall(input: ToolCallInput): Promise<Decision>;
|
|
495
|
+
/**
|
|
496
|
+
* One exit for every judge failure.
|
|
497
|
+
*
|
|
498
|
+
* Status and reason go in the *message*, not only in the meta object: hosts
|
|
499
|
+
* print the message and drop the meta, which is why this read as a bare
|
|
500
|
+
* "judge API failed" while the judge was answering with a precise reason.
|
|
501
|
+
* The response body follows only under `debug`, since it can echo the action.
|
|
502
|
+
*/
|
|
503
|
+
private failJudge;
|
|
473
504
|
private fail;
|
|
474
505
|
getJudgmentStatus(judgmentId: string, agentPubkey?: string): Promise<JudgmentStatus>;
|
|
475
506
|
getToolCalls(maxCount: number): Promise<ToolCallRecord[]>;
|
|
@@ -545,7 +576,13 @@ declare class Atbash {
|
|
|
545
576
|
private raiseIfError;
|
|
546
577
|
/** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
|
|
547
578
|
private httpError;
|
|
548
|
-
/**
|
|
579
|
+
/**
|
|
580
|
+
* Wrap a transport failure (fetch threw, no response) as an AtbashAPIError.
|
|
581
|
+
*
|
|
582
|
+
* `HttpTransportError.kind` names the cause; the message is already
|
|
583
|
+
* human-readable. `debug` echoes the original exception so operators can
|
|
584
|
+
* cross-reference with node / undici logs when a class doesn't match.
|
|
585
|
+
*/
|
|
549
586
|
private transportError;
|
|
550
587
|
private json;
|
|
551
588
|
static generateKeypair(): KeyPair;
|
|
@@ -571,6 +608,43 @@ declare class SignatureVerificationError extends Error {
|
|
|
571
608
|
constructor(message: string);
|
|
572
609
|
}
|
|
573
610
|
|
|
611
|
+
/**
|
|
612
|
+
* Thin typed fetch wrapper.
|
|
613
|
+
*
|
|
614
|
+
* openapi-typescript emits types only (no runtime client), so this is the
|
|
615
|
+
* single hand-written transport — generic `get`/`post` over global `fetch`
|
|
616
|
+
* with a per-request timeout. The endpoint-specific request/response *shapes*
|
|
617
|
+
* are pulled from the generated `schema.ts` at the call sites in client.ts, so
|
|
618
|
+
* the wire contract still lives in spec/openapi.yaml. Methods return the raw
|
|
619
|
+
* `Response` so the caller can read the exact bytes the server signed before
|
|
620
|
+
* any decode (judge signature verification) — mirroring the Python surface's
|
|
621
|
+
* use of raw httpx (DECISIONS 2026-05-22).
|
|
622
|
+
*/
|
|
623
|
+
type QueryValue = string | number | boolean | undefined | null;
|
|
624
|
+
declare class HttpClient {
|
|
625
|
+
readonly baseUrl: string;
|
|
626
|
+
readonly timeoutMs: number;
|
|
627
|
+
constructor(baseUrl: string, timeoutMs: number);
|
|
628
|
+
buildUrl(path: string, query?: Record<string, QueryValue>): string;
|
|
629
|
+
get(path: string, query?: Record<string, QueryValue>, headers?: Record<string, string>): Promise<Response>;
|
|
630
|
+
post(path: string, body: unknown, headers?: Record<string, string>): Promise<Response>;
|
|
631
|
+
private fetch;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* A transport failure the SDK can act on. Every real cause the platform surfaces
|
|
635
|
+
* lands as one of these — the message names the cause in plain language so a
|
|
636
|
+
* plugin can show it to a user without decoding httpx / fetch internals.
|
|
637
|
+
*
|
|
638
|
+
* `cause` preserves the original error for debug logging; consumers that want
|
|
639
|
+
* the raw exception (e.g. tests) read it there.
|
|
640
|
+
*/
|
|
641
|
+
declare class HttpTransportError extends Error {
|
|
642
|
+
readonly kind: "timeout" | "aborted" | "dns" | "connect_refused" | "connection_reset" | "unknown";
|
|
643
|
+
constructor(kind: HttpTransportError["kind"], message: string, options?: {
|
|
644
|
+
cause?: unknown;
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
|
|
574
648
|
/** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
|
|
575
649
|
|
|
576
650
|
declare function normalizeVerdict(raw: unknown): Verdict;
|
|
@@ -585,6 +659,8 @@ interface AtbashUserConfig {
|
|
|
585
659
|
blockchainRid?: string;
|
|
586
660
|
provider?: string;
|
|
587
661
|
providerModel?: string;
|
|
662
|
+
/** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
|
|
663
|
+
debug?: string;
|
|
588
664
|
}
|
|
589
665
|
declare function getConfigDir(): string;
|
|
590
666
|
declare function getConfigPath(): string;
|
|
@@ -595,6 +671,26 @@ declare function resolve(key: keyof AtbashUserConfig, flagValue?: string): strin
|
|
|
595
671
|
declare function resolveKeyPath(input?: string): string;
|
|
596
672
|
declare function loadAgentFromFile(keyPath?: string): AgentAuth;
|
|
597
673
|
|
|
674
|
+
/**
|
|
675
|
+
* Accepted key filenames, in precedence order.
|
|
676
|
+
*
|
|
677
|
+
* `guard-client-key` stays first: it is the name every existing install
|
|
678
|
+
* already has, and changing which file wins would silently switch agent
|
|
679
|
+
* identity for anyone holding both. `atbash-client-key` is accepted because
|
|
680
|
+
* it is the name people actually create — the old one carries retired
|
|
681
|
+
* branding — and hitting ENOENT on a key you just wrote, from a plugin that
|
|
682
|
+
* still reports itself installed, is a miserable first run.
|
|
683
|
+
*/
|
|
684
|
+
declare const KEY_FILENAMES: readonly ["guard-client-key", "atbash-client-key"];
|
|
685
|
+
/** Every path checked when no explicit key path is given, in order. */
|
|
686
|
+
declare function keyPathCandidates(): string[];
|
|
687
|
+
/**
|
|
688
|
+
* Pick the key path: an explicit input wins untouched; otherwise the first
|
|
689
|
+
* accepted filename that exists, falling back to the preferred name so the
|
|
690
|
+
* error names something recognisable when nothing is there.
|
|
691
|
+
*/
|
|
692
|
+
declare function chooseKeyPath(input: string | undefined, exists: (p: string) => boolean): string;
|
|
693
|
+
|
|
598
694
|
/**
|
|
599
695
|
* Canonical secret kinds reported by the Rust core in `SecretMatch.kind`.
|
|
600
696
|
* Wire is permissive (modelled as a free string in {@link SecretMatch})
|
|
@@ -613,6 +709,26 @@ declare function verifyJudgeResponseSignature(bodyBytes: Uint8Array, signatureHe
|
|
|
613
709
|
reason?: string;
|
|
614
710
|
};
|
|
615
711
|
|
|
712
|
+
/**
|
|
713
|
+
* The boot memory-sync failure line.
|
|
714
|
+
*
|
|
715
|
+
* Split out of `guard-manager.ts` so it can be asserted without constructing a
|
|
716
|
+
* guard manager, which needs the native addon. The message is the whole point
|
|
717
|
+
* of AT-304: hosts print the message and drop the structured meta, so a cause
|
|
718
|
+
* that lives only in meta never reaches the operator.
|
|
719
|
+
*/
|
|
720
|
+
/** Advice, not a diagnosis — appended only when the cause is unhelpful. */
|
|
721
|
+
declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the cause above does not explain it";
|
|
722
|
+
/**
|
|
723
|
+
* Lead with the real cause.
|
|
724
|
+
*
|
|
725
|
+
* The previous wording named the chain endpoint and orgName as the things to
|
|
726
|
+
* check, which sent operators to verify configuration that was already correct
|
|
727
|
+
* while the actual cause (a node answering `404 Can't find blockchain with
|
|
728
|
+
* blockchainRID: …` for a chain it does not host) stayed hidden.
|
|
729
|
+
*/
|
|
730
|
+
declare function bootSyncFailureLine(cause: unknown): string;
|
|
731
|
+
|
|
616
732
|
/** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
|
|
617
733
|
declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
|
|
618
734
|
/** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
|
|
@@ -1164,4 +1280,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1164
1280
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1165
1281
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1166
1282
|
|
|
1167
|
-
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, buildAllowedJudgeHosts, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, 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 };
|
|
1283
|
+
export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, 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, 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, chooseKeyPath, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, 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 };
|