@atbash/sdk 0.10.1-dev.0 → 0.10.5-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 +20 -1
- package/dist/browser.mjs +23 -12
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +18 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,23 @@ interface ValidatedEndpoint {
|
|
|
11
11
|
policy: "default" | "self-hosted";
|
|
12
12
|
verifyPubKey: string | null;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the trusted judge host set.
|
|
16
|
+
*
|
|
17
|
+
* The compiled-in default is always trusted: a `prod` build resolves it to
|
|
18
|
+
* atbash.ai, a dev build to whatever DEV_ENDPOINT was set at build time. No
|
|
19
|
+
* dev host is spelled out in source, and dev builds still validate their own
|
|
20
|
+
* default.
|
|
21
|
+
*
|
|
22
|
+
* Exported for tests only. The set is a build-time value and is deliberately
|
|
23
|
+
* never read from the process environment — an env var would let anyone widen
|
|
24
|
+
* the allowlist of an already-shipped artifact, which is the silent-redirection
|
|
25
|
+
* attack the allowlist exists to prevent (F-003). Asserting that requires
|
|
26
|
+
* calling this with the environment set, so it cannot stay module-private.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
declare function buildAllowedJudgeHosts(): ReadonlySet<string>;
|
|
14
31
|
declare function validateJudgeEndpoint(judge?: JudgeEndpointConfig): ValidatedEndpoint;
|
|
15
32
|
|
|
16
33
|
/**
|
|
@@ -395,6 +412,8 @@ declare class Atbash {
|
|
|
395
412
|
readonly orgEncryptionPubKey?: string;
|
|
396
413
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
397
414
|
readonly failClosed: boolean;
|
|
415
|
+
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
416
|
+
private _orgKeyFromChain;
|
|
398
417
|
private readonly logger;
|
|
399
418
|
private readonly http;
|
|
400
419
|
/**
|
|
@@ -1145,4 +1164,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1145
1164
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1146
1165
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1147
1166
|
|
|
1148
|
-
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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,23 @@ interface ValidatedEndpoint {
|
|
|
11
11
|
policy: "default" | "self-hosted";
|
|
12
12
|
verifyPubKey: string | null;
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Builds the trusted judge host set.
|
|
16
|
+
*
|
|
17
|
+
* The compiled-in default is always trusted: a `prod` build resolves it to
|
|
18
|
+
* atbash.ai, a dev build to whatever DEV_ENDPOINT was set at build time. No
|
|
19
|
+
* dev host is spelled out in source, and dev builds still validate their own
|
|
20
|
+
* default.
|
|
21
|
+
*
|
|
22
|
+
* Exported for tests only. The set is a build-time value and is deliberately
|
|
23
|
+
* never read from the process environment — an env var would let anyone widen
|
|
24
|
+
* the allowlist of an already-shipped artifact, which is the silent-redirection
|
|
25
|
+
* attack the allowlist exists to prevent (F-003). Asserting that requires
|
|
26
|
+
* calling this with the environment set, so it cannot stay module-private.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
declare function buildAllowedJudgeHosts(): ReadonlySet<string>;
|
|
14
31
|
declare function validateJudgeEndpoint(judge?: JudgeEndpointConfig): ValidatedEndpoint;
|
|
15
32
|
|
|
16
33
|
/**
|
|
@@ -395,6 +412,8 @@ declare class Atbash {
|
|
|
395
412
|
readonly orgEncryptionPubKey?: string;
|
|
396
413
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
397
414
|
readonly failClosed: boolean;
|
|
415
|
+
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
416
|
+
private _orgKeyFromChain;
|
|
398
417
|
private readonly logger;
|
|
399
418
|
private readonly http;
|
|
400
419
|
/**
|
|
@@ -1145,4 +1164,4 @@ declare function containsSecret(text: string): boolean;
|
|
|
1145
1164
|
declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
|
|
1146
1165
|
declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
|
|
1147
1166
|
|
|
1148
|
-
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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -2867,6 +2867,7 @@ __export(src_ts_exports, {
|
|
|
2867
2867
|
MemoryIntegrityError: () => MemoryIntegrityError,
|
|
2868
2868
|
PointerStore: () => PointerStore,
|
|
2869
2869
|
SignatureVerificationError: () => SignatureVerificationError,
|
|
2870
|
+
buildAllowedJudgeHosts: () => buildAllowedJudgeHosts,
|
|
2870
2871
|
claimHashHex: () => claimHashHex,
|
|
2871
2872
|
classifyMemoryRead: () => classifyMemoryRead,
|
|
2872
2873
|
classifyMemoryWrite: () => classifyMemoryWrite,
|
|
@@ -3004,11 +3005,14 @@ function signEncryptedToolCall(toolCallId, action, context, toolName, toolArgsJs
|
|
|
3004
3005
|
}
|
|
3005
3006
|
|
|
3006
3007
|
// src-ts/endpoint.ts
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3008
|
+
function buildAllowedJudgeHosts() {
|
|
3009
|
+
return /* @__PURE__ */ new Set([
|
|
3010
|
+
"atbash.ai",
|
|
3011
|
+
"www.atbash.ai",
|
|
3012
|
+
new URL(DEFAULT_ENDPOINT).hostname.toLowerCase()
|
|
3013
|
+
]);
|
|
3014
|
+
}
|
|
3015
|
+
var ALLOWED_JUDGE_HOSTS = buildAllowedJudgeHosts();
|
|
3012
3016
|
function validateJudgeEndpoint(judge) {
|
|
3013
3017
|
const policy = judge?.policy === "self-hosted" ? "self-hosted" : "default";
|
|
3014
3018
|
const candidate = judge?.endpoint?.trim() || DEFAULT_ENDPOINT;
|
|
@@ -3361,6 +3365,8 @@ var Atbash = class _Atbash {
|
|
|
3361
3365
|
orgEncryptionPubKey;
|
|
3362
3366
|
/** When true (default), `auditToolCall` denies on any error. */
|
|
3363
3367
|
failClosed;
|
|
3368
|
+
/** Org key learned from the last agent-exists check, for this agent only. */
|
|
3369
|
+
_orgKeyFromChain = null;
|
|
3364
3370
|
logger;
|
|
3365
3371
|
http;
|
|
3366
3372
|
/**
|
|
@@ -3445,6 +3451,10 @@ var Atbash = class _Atbash {
|
|
|
3445
3451
|
);
|
|
3446
3452
|
await this.raiseIfError(resp);
|
|
3447
3453
|
const data = await this.json(resp);
|
|
3454
|
+
if (pk === this.auth.pubkey) {
|
|
3455
|
+
const key3 = data?.org_encryption_pubkey;
|
|
3456
|
+
this._orgKeyFromChain = typeof key3 === "string" && key3 ? key3 : null;
|
|
3457
|
+
}
|
|
3448
3458
|
return Boolean(data?.registered);
|
|
3449
3459
|
});
|
|
3450
3460
|
}
|
|
@@ -3475,7 +3485,7 @@ var Atbash = class _Atbash {
|
|
|
3475
3485
|
}
|
|
3476
3486
|
const toolCallId = generateToolCallId();
|
|
3477
3487
|
const brid = this.bridFromChainOpts(options.chainOpts);
|
|
3478
|
-
const orgKey = options.orgEncryptionPubKey ?? this.orgEncryptionPubKey;
|
|
3488
|
+
const orgKey = options.orgEncryptionPubKey ?? this.orgEncryptionPubKey ?? this._orgKeyFromChain;
|
|
3479
3489
|
try {
|
|
3480
3490
|
const signedHex = orgKey ? signEncryptedToolCall(
|
|
3481
3491
|
toolCallId,
|
|
@@ -3561,6 +3571,7 @@ var Atbash = class _Atbash {
|
|
|
3561
3571
|
if (context) body.context = context;
|
|
3562
3572
|
if (options.provider) body.provider = options.provider;
|
|
3563
3573
|
if (options.toolName) body.tool_name = options.toolName;
|
|
3574
|
+
if (options.toolArgsJson) body.tool_args_json = options.toolArgsJson;
|
|
3564
3575
|
if (options.model) body.model = options.model;
|
|
3565
3576
|
if (options.resolved) body.resolved = options.resolved;
|
|
3566
3577
|
if (options.mode) body.mode = options.mode;
|
|
@@ -43124,6 +43135,7 @@ function diffMemorySnapshots(before, after) {
|
|
|
43124
43135
|
MemoryIntegrityError,
|
|
43125
43136
|
PointerStore,
|
|
43126
43137
|
SignatureVerificationError,
|
|
43138
|
+
buildAllowedJudgeHosts,
|
|
43127
43139
|
claimHashHex,
|
|
43128
43140
|
classifyMemoryRead,
|
|
43129
43141
|
classifyMemoryWrite,
|