@atbash/sdk 0.10.7-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 +45 -2
- package/dist/browser.mjs +84 -3
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +45 -2
- package/dist/index.d.ts +45 -2
- package/dist/index.js +86 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +84 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -576,7 +576,13 @@ declare class Atbash {
|
|
|
576
576
|
private raiseIfError;
|
|
577
577
|
/** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
|
|
578
578
|
private httpError;
|
|
579
|
-
/**
|
|
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
|
+
*/
|
|
580
586
|
private transportError;
|
|
581
587
|
private json;
|
|
582
588
|
static generateKeypair(): KeyPair;
|
|
@@ -602,6 +608,43 @@ declare class SignatureVerificationError extends Error {
|
|
|
602
608
|
constructor(message: string);
|
|
603
609
|
}
|
|
604
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
|
+
|
|
605
648
|
/** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
|
|
606
649
|
|
|
607
650
|
declare function normalizeVerdict(raw: unknown): Verdict;
|
|
@@ -1237,4 +1280,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1237
1280
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1238
1281
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1239
1282
|
|
|
1240
|
-
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, 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 };
|
|
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
|
@@ -576,7 +576,13 @@ declare class Atbash {
|
|
|
576
576
|
private raiseIfError;
|
|
577
577
|
/** Wrap a failed HTTP *response* (non-2xx / non-200) as an AtbashAPIError. */
|
|
578
578
|
private httpError;
|
|
579
|
-
/**
|
|
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
|
+
*/
|
|
580
586
|
private transportError;
|
|
581
587
|
private json;
|
|
582
588
|
static generateKeypair(): KeyPair;
|
|
@@ -602,6 +608,43 @@ declare class SignatureVerificationError extends Error {
|
|
|
602
608
|
constructor(message: string);
|
|
603
609
|
}
|
|
604
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
|
+
|
|
605
648
|
/** Normalize wire shapes (verdict casing, status, pubkey) to canonical forms. */
|
|
606
649
|
|
|
607
650
|
declare function normalizeVerdict(raw: unknown): Verdict;
|
|
@@ -1237,4 +1280,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1237
1280
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1238
1281
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1239
1282
|
|
|
1240
|
-
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, 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 };
|
|
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.js
CHANGED
|
@@ -2864,6 +2864,8 @@ __export(src_ts_exports, {
|
|
|
2864
2864
|
DEFAULT_MEMORY_READ_TOOL_NAMES: () => DEFAULT_MEMORY_READ_TOOL_NAMES,
|
|
2865
2865
|
DEFAULT_MEMORY_WRITE_TOOL_NAMES: () => DEFAULT_MEMORY_WRITE_TOOL_NAMES,
|
|
2866
2866
|
EciesDomain: () => EciesDomain,
|
|
2867
|
+
HttpClient: () => HttpClient,
|
|
2868
|
+
HttpTransportError: () => HttpTransportError,
|
|
2867
2869
|
KEY_FILENAMES: () => KEY_FILENAMES,
|
|
2868
2870
|
MemoryGuardManager: () => MemoryGuardManager,
|
|
2869
2871
|
MemoryIntegrityError: () => MemoryIntegrityError,
|
|
@@ -3134,9 +3136,69 @@ var HttpClient = class {
|
|
|
3134
3136
|
});
|
|
3135
3137
|
}
|
|
3136
3138
|
async fetch(url, init4) {
|
|
3137
|
-
|
|
3139
|
+
try {
|
|
3140
|
+
return await fetch(url, {
|
|
3141
|
+
...init4,
|
|
3142
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
3143
|
+
});
|
|
3144
|
+
} catch (err) {
|
|
3145
|
+
throw classifyTransportError(err, url, init4.method ?? "GET", this.timeoutMs);
|
|
3146
|
+
}
|
|
3138
3147
|
}
|
|
3139
3148
|
};
|
|
3149
|
+
var HttpTransportError = class extends Error {
|
|
3150
|
+
kind;
|
|
3151
|
+
constructor(kind, message, options) {
|
|
3152
|
+
super(message, options);
|
|
3153
|
+
this.name = "HttpTransportError";
|
|
3154
|
+
this.kind = kind;
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
function classifyTransportError(err, url, method, timeoutMs) {
|
|
3158
|
+
const name2 = err instanceof Error ? err.name : "";
|
|
3159
|
+
const cause = err instanceof Error ? err.cause : void 0;
|
|
3160
|
+
const code2 = cause && typeof cause === "object" && "code" in cause ? String(cause.code) : "";
|
|
3161
|
+
if (name2 === "TimeoutError") {
|
|
3162
|
+
return new HttpTransportError(
|
|
3163
|
+
"timeout",
|
|
3164
|
+
`${method} ${url} did not respond within ${timeoutMs} ms \u2014 the judge may be slow to boot or the LLM is under load; retry in a moment`,
|
|
3165
|
+
{ cause: err }
|
|
3166
|
+
);
|
|
3167
|
+
}
|
|
3168
|
+
if (name2 === "AbortError") {
|
|
3169
|
+
return new HttpTransportError(
|
|
3170
|
+
"aborted",
|
|
3171
|
+
`${method} ${url} was cancelled by the caller`,
|
|
3172
|
+
{ cause: err }
|
|
3173
|
+
);
|
|
3174
|
+
}
|
|
3175
|
+
if (code2 === "ENOTFOUND" || code2 === "EAI_AGAIN") {
|
|
3176
|
+
return new HttpTransportError(
|
|
3177
|
+
"dns",
|
|
3178
|
+
`could not resolve the judge hostname (${url}) \u2014 check the endpoint and DNS`,
|
|
3179
|
+
{ cause: err }
|
|
3180
|
+
);
|
|
3181
|
+
}
|
|
3182
|
+
if (code2 === "ECONNREFUSED") {
|
|
3183
|
+
return new HttpTransportError(
|
|
3184
|
+
"connect_refused",
|
|
3185
|
+
`judge refused the connection (${url}) \u2014 the service may be down or restarting`,
|
|
3186
|
+
{ cause: err }
|
|
3187
|
+
);
|
|
3188
|
+
}
|
|
3189
|
+
if (code2 === "ECONNRESET" || code2 === "EPIPE") {
|
|
3190
|
+
return new HttpTransportError(
|
|
3191
|
+
"connection_reset",
|
|
3192
|
+
`judge dropped the connection mid-request (${url}) \u2014 retry once`,
|
|
3193
|
+
{ cause: err }
|
|
3194
|
+
);
|
|
3195
|
+
}
|
|
3196
|
+
return new HttpTransportError(
|
|
3197
|
+
"unknown",
|
|
3198
|
+
`${method} ${url} failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
3199
|
+
{ cause: err }
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3140
3202
|
|
|
3141
3203
|
// src-ts/keyLoader.ts
|
|
3142
3204
|
var import_node_fs = require("fs");
|
|
@@ -3419,7 +3481,7 @@ var Atbash = class _Atbash {
|
|
|
3419
3481
|
this.failClosed = options.failClosed !== false;
|
|
3420
3482
|
this.debug = options.debug === true;
|
|
3421
3483
|
this.logger = options.logger ?? {};
|
|
3422
|
-
this.http = new HttpClient(this.endpoint, options.timeoutMs ??
|
|
3484
|
+
this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 6e4);
|
|
3423
3485
|
this.logEnvironmentOnce();
|
|
3424
3486
|
if (this.endpoint !== DEFAULT_ENDPOINT) {
|
|
3425
3487
|
this.logger.warn?.("[atbash] running on non-default judge endpoint", {
|
|
@@ -4150,8 +4212,27 @@ var Atbash = class _Atbash {
|
|
|
4150
4212
|
this.endpoint
|
|
4151
4213
|
);
|
|
4152
4214
|
}
|
|
4153
|
-
/**
|
|
4215
|
+
/**
|
|
4216
|
+
* Wrap a transport failure (fetch threw, no response) as an AtbashAPIError.
|
|
4217
|
+
*
|
|
4218
|
+
* `HttpTransportError.kind` names the cause; the message is already
|
|
4219
|
+
* human-readable. `debug` echoes the original exception so operators can
|
|
4220
|
+
* cross-reference with node / undici logs when a class doesn't match.
|
|
4221
|
+
*/
|
|
4154
4222
|
transportError(err) {
|
|
4223
|
+
if (err instanceof HttpTransportError) {
|
|
4224
|
+
if (this.debug) {
|
|
4225
|
+
this.logger.warn?.(
|
|
4226
|
+
`[atbash] transport failed \u2014 kind=${err.kind}`,
|
|
4227
|
+
{
|
|
4228
|
+
kind: err.kind,
|
|
4229
|
+
cause: err.cause instanceof Error ? err.cause.message : String(err.cause ?? ""),
|
|
4230
|
+
endpoint: this.endpoint
|
|
4231
|
+
}
|
|
4232
|
+
);
|
|
4233
|
+
}
|
|
4234
|
+
return new AtbashAPIError(0, err.message, "", this.endpoint);
|
|
4235
|
+
}
|
|
4155
4236
|
return new AtbashAPIError(0, errorMessage(err), "", this.endpoint);
|
|
4156
4237
|
}
|
|
4157
4238
|
async json(resp) {
|
|
@@ -43256,6 +43337,8 @@ function diffMemorySnapshots(before, after) {
|
|
|
43256
43337
|
DEFAULT_MEMORY_READ_TOOL_NAMES,
|
|
43257
43338
|
DEFAULT_MEMORY_WRITE_TOOL_NAMES,
|
|
43258
43339
|
EciesDomain,
|
|
43340
|
+
HttpClient,
|
|
43341
|
+
HttpTransportError,
|
|
43259
43342
|
KEY_FILENAMES,
|
|
43260
43343
|
MemoryGuardManager,
|
|
43261
43344
|
MemoryIntegrityError,
|