@atbash/sdk 0.8.0-dev.0 → 0.9.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.
@@ -1082,6 +1082,19 @@ declare function shutdownTelemetry(): Promise<void>;
1082
1082
  * (`log_tool_call` → "Organization requires encrypted payloads"), so for those
1083
1083
  * orgs this is the only way to log a tool call at all.
1084
1084
  */
1085
+ /**
1086
+ * Commitment to the plaintext claims a caller sends alongside the ciphertext.
1087
+ *
1088
+ * The judge server reads tool_name / action / context / tool_args_json from the
1089
+ * request body and feeds them to policy evaluation, but it holds no org key, so
1090
+ * it cannot check them against content_cipher. This hash is a signed operation
1091
+ * argument, which makes it the one thing it can check them against.
1092
+ *
1093
+ * An array, not an object: key order is not part of a JSON array, so the two
1094
+ * implementations cannot drift on serialization. Must stay identical to
1095
+ * `claimHashHex` in the dashboard (`src/lib/api/judge/action-hash.ts`).
1096
+ */
1097
+ declare function claimHashHex(toolName: string, action: string, context: string, toolArgsJson: string): string;
1085
1098
  /** Plaintext fields of a tool call, sealed into a single ECIES payload. */
1086
1099
  interface ToolCallPlaintext {
1087
1100
  tool_name: string;
@@ -1220,4 +1233,4 @@ declare function containsSecret(text: string): boolean;
1220
1233
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1221
1234
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1222
1235
 
1223
- 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 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 ToolCallPlaintext, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, classifyMemoryRead, classifyMemoryWrite, 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, isValidPrivateKey, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeForMatching, normalizeStatus, normalizeVerdict, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
1236
+ 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 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 ToolCallPlaintext, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, claimHashHex, classifyMemoryRead, classifyMemoryWrite, 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, isValidPrivateKey, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeForMatching, normalizeStatus, normalizeVerdict, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
package/dist/browser.mjs CHANGED
@@ -44061,6 +44061,15 @@ function encryptedLength(plaintextByteLength) {
44061
44061
  // src-ts/encrypted-toolcall.ts
44062
44062
  var { Buffer: PolyBuffer, gtx: pcgtx2 } = index;
44063
44063
  var MERKLE_HASH_VERSION2 = 2;
44064
+ function claimHashHex(toolName, action, context, toolArgsJson) {
44065
+ const canonical = JSON.stringify([
44066
+ toolName.trim(),
44067
+ normalizeActionForHash(action),
44068
+ context.trim(),
44069
+ toolArgsJson.trim()
44070
+ ]);
44071
+ return bytesToHex2(sha256(new TextEncoder().encode(canonical)));
44072
+ }
44064
44073
  function normalizeActionForHash(action) {
44065
44074
  action = action.trim();
44066
44075
  try {
@@ -44123,7 +44132,15 @@ function signEncryptedToolCall(toolCallId, action, context, toolName, toolArgsJs
44123
44132
  );
44124
44133
  return signOpWithBytes(
44125
44134
  "log_encrypted_tool_call",
44126
- [toolCallId, toolName, contentCipher, actionHash],
44135
+ [
44136
+ toolCallId,
44137
+ toolName,
44138
+ contentCipher,
44139
+ actionHash,
44140
+ // Empty = "the org's current key"; the chain resolves it.
44141
+ PolyBuffer.from(new Uint8Array(0)),
44142
+ claimHashHex(toolName, action, context, toolArgsJson)
44143
+ ],
44127
44144
  privkeyHex,
44128
44145
  blockchainRidHex
44129
44146
  );
@@ -45984,6 +46001,7 @@ export {
45984
46001
  MemoryIntegrityError,
45985
46002
  PointerStore,
45986
46003
  SignatureVerificationError,
46004
+ claimHashHex,
45987
46005
  classifyMemoryRead,
45988
46006
  classifyMemoryWrite,
45989
46007
  commitMemoryVersion,