@atbash/sdk 0.8.0 → 0.9.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/README.md CHANGED
@@ -144,8 +144,6 @@ const atbash = Atbash.fromConfig(); // reads env + config file
144
144
  | `judgeEndpoint` | `ATBASH_ENDPOINT` |
145
145
  | `judgeVerifyPubKey` | `ATBASH_JUDGE_VERIFY_PUBKEY` (self-hosted judge response-signing key; selects the self-hosted policy) |
146
146
  | `blockchainRid` | `ATBASH_BLOCKCHAIN_RID` |
147
- | `provider` | `ATBASH_PROVIDER` |
148
- | `providerModel` | `ATBASH_PROVIDER_MODEL` |
149
147
 
150
148
  Persistent config helpers: `saveUserConfig(config)`, `loadUserConfig()`, `resolve(key, flagValue?)`, `getConfigPath()`.
151
149
 
@@ -408,8 +408,6 @@ interface FromConfigOptions {
408
408
  interface JudgeOptions {
409
409
  toolName?: string;
410
410
  toolArgsJson?: string;
411
- provider?: string;
412
- model?: string;
413
411
  verifyPubKey?: string;
414
412
  /** Per-call override of {@link AtbashOptions.orgEncryptionPubKey}. */
415
413
  orgEncryptionPubKey?: string;
@@ -807,8 +805,6 @@ interface AtbashUserConfig {
807
805
  * at construction instead.
808
806
  */
809
807
  defaultChainNetwork?: Network;
810
- provider?: string;
811
- providerModel?: string;
812
808
  /** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
813
809
  debug?: string;
814
810
  }
@@ -879,6 +875,22 @@ declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the caus
879
875
  */
880
876
  declare function bootSyncFailureLine(cause: unknown): string;
881
877
 
878
+ /**
879
+ * Make a chain query result crossable at the NAPI boundary.
880
+ *
881
+ * `postchain-client` decodes a Rell `byte_array` into a Node `Buffer`. The
882
+ * core's `parse*` functions take `serde_json::Value`, and NAPI-RS cannot
883
+ * convert a `Buffer` into one — it reaches the methods every `Uint8Array`
884
+ * inherits and fails with "JS functions cannot be represented as a
885
+ * serde_json::Value", which names functions for what is a plain Buffer.
886
+ *
887
+ * The conversion has to happen here because the failure is in the argument
888
+ * conversion, before any core code runs. Of the shapes the core accepts —
889
+ * hex string, `[u8]`, `{ data: [...] }` — hex is the cheapest to produce.
890
+ */
891
+ /** Recursively rewrite byte containers to hex, leaving everything else as-is. */
892
+ declare function gtvToFfiSafe(value: unknown): unknown;
893
+
882
894
  /** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
883
895
  declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
884
896
  /** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
@@ -1531,4 +1543,4 @@ declare function containsSecret(text: string): boolean;
1531
1543
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1532
1544
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1533
1545
 
1534
- 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_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, PRIVATE_CHAIN, PUBLIC_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, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, 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 };
1546
+ 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_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, PRIVATE_CHAIN, PUBLIC_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, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, gtvToFfiSafe, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, 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/browser.mjs CHANGED
@@ -44656,8 +44656,6 @@ function resolve(_key, flagValue) {
44656
44656
  function forcedChainNetwork(flagValue) {
44657
44657
  return flagValue === "public" || flagValue === "private" ? flagValue : void 0;
44658
44658
  }
44659
- function warnDeprecatedEnvVarsOnce(_log) {
44660
- }
44661
44659
 
44662
44660
  // src-ts/client.ts
44663
44661
  function generateToolCallId() {
@@ -44765,14 +44763,13 @@ var Atbash = class _Atbash {
44765
44763
  this._defaultChain = resolvedChain;
44766
44764
  this._explicitChain = options.chain !== void 0 || options.network !== void 0 || options.blockchainRid !== void 0 && options.nodeUrls !== void 0;
44767
44765
  this._forcedNetwork = forcedChainNetwork();
44768
- warnDeprecatedEnvVarsOnce((msg) => options.logger?.warn?.(msg));
44769
44766
  this.orgName = options.orgName;
44770
44767
  this.verifyPubKey = validated.verifyPubKey ?? void 0;
44771
44768
  this.orgEncryptionPubKey = options.orgEncryptionPubKey;
44772
44769
  this.failClosed = options.failClosed !== false;
44773
44770
  this.debug = options.debug === true;
44774
44771
  this.logger = options.logger ?? {};
44775
- this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 6e4);
44772
+ this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 12e4);
44776
44773
  this.logEnvironmentOnce();
44777
44774
  if (this.endpoint !== DEFAULT_ENDPOINT) {
44778
44775
  this.logger.warn?.("[atbash] running on non-default judge endpoint", {
@@ -45023,18 +45020,15 @@ var Atbash = class _Atbash {
45023
45020
  if (!logResult.success || !logResult.toolCallId || !logResult.signedHex) {
45024
45021
  throw new Error(logResult.error || "Failed to sign log_tool_call");
45025
45022
  }
45026
- let signedJudgeAction;
45027
- if (!options.provider) {
45028
- const judgmentId = generateToolCallId();
45029
- signedJudgeAction = native.signJudgeAction(
45030
- judgmentId,
45031
- action,
45032
- context || "",
45033
- "",
45034
- this.auth.privkey,
45035
- brid
45036
- );
45037
- }
45023
+ const judgmentId = generateToolCallId();
45024
+ const signedJudgeAction = native.signJudgeAction(
45025
+ judgmentId,
45026
+ action,
45027
+ context || "",
45028
+ "",
45029
+ this.auth.privkey,
45030
+ brid
45031
+ );
45038
45032
  const body = {
45039
45033
  tool_call_id: logResult.toolCallId,
45040
45034
  agent_pubkey: this.auth.pubkey,
@@ -45043,10 +45037,8 @@ var Atbash = class _Atbash {
45043
45037
  };
45044
45038
  if (signedJudgeAction) body.signed_judge_action = signedJudgeAction;
45045
45039
  if (context) body.context = context;
45046
- if (options.provider) body.provider = options.provider;
45047
45040
  if (options.toolName) body.tool_name = options.toolName;
45048
45041
  if (options.toolArgsJson) body.tool_args_json = options.toolArgsJson;
45049
- if (options.model) body.model = options.model;
45050
45042
  if (options.resolved) body.resolved = options.resolved;
45051
45043
  if (options.mode) body.mode = options.mode;
45052
45044
  let resp;
@@ -45927,6 +45919,22 @@ function bootSyncFailureLine(cause) {
45927
45919
  );
45928
45920
  }
45929
45921
 
45922
+ // src-ts/memory/_gtv_bytes.ts
45923
+ init_define_ATBASH_CHROMIA_NODE_URLS();
45924
+ init_define_ATBASH_PRIVATE_NODE_URLS();
45925
+ function gtvToFfiSafe(value) {
45926
+ if (value instanceof Uint8Array) return Buffer.from(value).toString("hex");
45927
+ if (Array.isArray(value)) return value.map(gtvToFfiSafe);
45928
+ if (value !== null && typeof value === "object") {
45929
+ const out = {};
45930
+ for (const [key3, val] of Object.entries(value)) {
45931
+ out[key3] = gtvToFfiSafe(val);
45932
+ }
45933
+ return out;
45934
+ }
45935
+ return value;
45936
+ }
45937
+
45930
45938
  // src-ts/memory/index.ts
45931
45939
  init_define_ATBASH_CHROMIA_NODE_URLS();
45932
45940
  init_define_ATBASH_PRIVATE_NODE_URLS();
@@ -46394,6 +46402,7 @@ export {
46394
46402
  getMemoryHistory,
46395
46403
  getRecentAgentMemory,
46396
46404
  getRollbackHistory,
46405
+ gtvToFfiSafe,
46397
46406
  guardMemoryWrite,
46398
46407
  isEnvelope,
46399
46408
  isValidPrivateKey2 as isValidPrivateKey,
package/dist/index.d.mts CHANGED
@@ -408,8 +408,6 @@ interface FromConfigOptions {
408
408
  interface JudgeOptions {
409
409
  toolName?: string;
410
410
  toolArgsJson?: string;
411
- provider?: string;
412
- model?: string;
413
411
  verifyPubKey?: string;
414
412
  /** Per-call override of {@link AtbashOptions.orgEncryptionPubKey}. */
415
413
  orgEncryptionPubKey?: string;
@@ -807,8 +805,6 @@ interface AtbashUserConfig {
807
805
  * at construction instead.
808
806
  */
809
807
  defaultChainNetwork?: Network;
810
- provider?: string;
811
- providerModel?: string;
812
808
  /** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
813
809
  debug?: string;
814
810
  }
@@ -879,6 +875,22 @@ declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the caus
879
875
  */
880
876
  declare function bootSyncFailureLine(cause: unknown): string;
881
877
 
878
+ /**
879
+ * Make a chain query result crossable at the NAPI boundary.
880
+ *
881
+ * `postchain-client` decodes a Rell `byte_array` into a Node `Buffer`. The
882
+ * core's `parse*` functions take `serde_json::Value`, and NAPI-RS cannot
883
+ * convert a `Buffer` into one — it reaches the methods every `Uint8Array`
884
+ * inherits and fails with "JS functions cannot be represented as a
885
+ * serde_json::Value", which names functions for what is a plain Buffer.
886
+ *
887
+ * The conversion has to happen here because the failure is in the argument
888
+ * conversion, before any core code runs. Of the shapes the core accepts —
889
+ * hex string, `[u8]`, `{ data: [...] }` — hex is the cheapest to produce.
890
+ */
891
+ /** Recursively rewrite byte containers to hex, leaving everything else as-is. */
892
+ declare function gtvToFfiSafe(value: unknown): unknown;
893
+
882
894
  /** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
883
895
  declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
884
896
  /** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
@@ -1531,4 +1543,4 @@ declare function containsSecret(text: string): boolean;
1531
1543
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1532
1544
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1533
1545
 
1534
- 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_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, PRIVATE_CHAIN, PUBLIC_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, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, 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 };
1546
+ 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_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, PRIVATE_CHAIN, PUBLIC_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, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, gtvToFfiSafe, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, 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
@@ -408,8 +408,6 @@ interface FromConfigOptions {
408
408
  interface JudgeOptions {
409
409
  toolName?: string;
410
410
  toolArgsJson?: string;
411
- provider?: string;
412
- model?: string;
413
411
  verifyPubKey?: string;
414
412
  /** Per-call override of {@link AtbashOptions.orgEncryptionPubKey}. */
415
413
  orgEncryptionPubKey?: string;
@@ -807,8 +805,6 @@ interface AtbashUserConfig {
807
805
  * at construction instead.
808
806
  */
809
807
  defaultChainNetwork?: Network;
810
- provider?: string;
811
- providerModel?: string;
812
808
  /** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
813
809
  debug?: string;
814
810
  }
@@ -879,6 +875,22 @@ declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the caus
879
875
  */
880
876
  declare function bootSyncFailureLine(cause: unknown): string;
881
877
 
878
+ /**
879
+ * Make a chain query result crossable at the NAPI boundary.
880
+ *
881
+ * `postchain-client` decodes a Rell `byte_array` into a Node `Buffer`. The
882
+ * core's `parse*` functions take `serde_json::Value`, and NAPI-RS cannot
883
+ * convert a `Buffer` into one — it reaches the methods every `Uint8Array`
884
+ * inherits and fails with "JS functions cannot be represented as a
885
+ * serde_json::Value", which names functions for what is a plain Buffer.
886
+ *
887
+ * The conversion has to happen here because the failure is in the argument
888
+ * conversion, before any core code runs. Of the shapes the core accepts —
889
+ * hex string, `[u8]`, `{ data: [...] }` — hex is the cheapest to produce.
890
+ */
891
+ /** Recursively rewrite byte containers to hex, leaving everything else as-is. */
892
+ declare function gtvToFfiSafe(value: unknown): unknown;
893
+
882
894
  /** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
883
895
  declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
884
896
  /** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
@@ -1531,4 +1543,4 @@ declare function containsSecret(text: string): boolean;
1531
1543
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1532
1544
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1533
1545
 
1534
- 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_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, PRIVATE_CHAIN, PUBLIC_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, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, 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 };
1546
+ 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_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, PRIVATE_CHAIN, PUBLIC_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, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveAgentMemory, getActiveMemoryId, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRecentAgentMemory, getRollbackHistory, gtvToFfiSafe, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeActionType, 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
@@ -2908,6 +2908,7 @@ __export(src_ts_exports, {
2908
2908
  getMemoryHistory: () => getMemoryHistory,
2909
2909
  getRecentAgentMemory: () => getRecentAgentMemory,
2910
2910
  getRollbackHistory: () => getRollbackHistory,
2911
+ gtvToFfiSafe: () => gtvToFfiSafe,
2911
2912
  guardMemoryWrite: () => guardMemoryWrite,
2912
2913
  isEnvelope: () => isEnvelope,
2913
2914
  isValidPrivateKey: () => isValidPrivateKey,
@@ -3434,33 +3435,8 @@ var ENV_MAP = {
3434
3435
  // Same variable name the Hermes plugin already documents.
3435
3436
  judgeVerifyPubKey: "ATBASH_JUDGE_VERIFY_PUBKEY",
3436
3437
  defaultChainNetwork: "ATBASH_DEFAULT_CHAIN_NETWORK",
3437
- provider: "ATBASH_PROVIDER",
3438
- providerModel: "ATBASH_PROVIDER_MODEL",
3439
3438
  debug: "ATBASH_DEBUG"
3440
3439
  };
3441
- var DEPRECATED_ENV_VARS = ["ATBASH_BLOCKCHAIN_RID"];
3442
- var DEPRECATED_CONFIG_FIELDS = ["blockchainRid"];
3443
- var deprecatedWarned = false;
3444
- function warnDeprecatedEnvVarsOnce(log = console.warn) {
3445
- if (deprecatedWarned) return;
3446
- for (const name2 of DEPRECATED_ENV_VARS) {
3447
- if (process.env[name2]) {
3448
- deprecatedWarned = true;
3449
- log(
3450
- `[atbash] ${name2} is ignored \u2014 each org's chain is resolved from the dashboard; set ATBASH_DEFAULT_CHAIN_NETWORK=private only to pin everything to private`
3451
- );
3452
- }
3453
- }
3454
- const fileConfig = loadUserConfig();
3455
- for (const field of DEPRECATED_CONFIG_FIELDS) {
3456
- if (fileConfig[field]) {
3457
- deprecatedWarned = true;
3458
- log(
3459
- `[atbash] "${field}" in ${getConfigPath()} is ignored \u2014 pass \`chain\` or \`network\` at construction instead`
3460
- );
3461
- }
3462
- }
3463
- }
3464
3440
  function getConfigDir() {
3465
3441
  const home2 = process.env.HOME || (0, import_node_os3.homedir)() || "";
3466
3442
  return (0, import_node_path3.join)(home2, ".config", "atbash");
@@ -3619,14 +3595,13 @@ var Atbash = class _Atbash {
3619
3595
  this._defaultChain = resolvedChain;
3620
3596
  this._explicitChain = options.chain !== void 0 || options.network !== void 0 || options.blockchainRid !== void 0 && options.nodeUrls !== void 0;
3621
3597
  this._forcedNetwork = forcedChainNetwork();
3622
- warnDeprecatedEnvVarsOnce((msg) => options.logger?.warn?.(msg));
3623
3598
  this.orgName = options.orgName;
3624
3599
  this.verifyPubKey = validated.verifyPubKey ?? void 0;
3625
3600
  this.orgEncryptionPubKey = options.orgEncryptionPubKey;
3626
3601
  this.failClosed = options.failClosed !== false;
3627
3602
  this.debug = options.debug === true;
3628
3603
  this.logger = options.logger ?? {};
3629
- this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 6e4);
3604
+ this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 12e4);
3630
3605
  this.logEnvironmentOnce();
3631
3606
  if (this.endpoint !== DEFAULT_ENDPOINT) {
3632
3607
  this.logger.warn?.("[atbash] running on non-default judge endpoint", {
@@ -3877,18 +3852,15 @@ var Atbash = class _Atbash {
3877
3852
  if (!logResult.success || !logResult.toolCallId || !logResult.signedHex) {
3878
3853
  throw new Error(logResult.error || "Failed to sign log_tool_call");
3879
3854
  }
3880
- let signedJudgeAction;
3881
- if (!options.provider) {
3882
- const judgmentId = generateToolCallId();
3883
- signedJudgeAction = native.signJudgeAction(
3884
- judgmentId,
3885
- action,
3886
- context || "",
3887
- "",
3888
- this.auth.privkey,
3889
- brid
3890
- );
3891
- }
3855
+ const judgmentId = generateToolCallId();
3856
+ const signedJudgeAction = native.signJudgeAction(
3857
+ judgmentId,
3858
+ action,
3859
+ context || "",
3860
+ "",
3861
+ this.auth.privkey,
3862
+ brid
3863
+ );
3892
3864
  const body = {
3893
3865
  tool_call_id: logResult.toolCallId,
3894
3866
  agent_pubkey: this.auth.pubkey,
@@ -3897,10 +3869,8 @@ var Atbash = class _Atbash {
3897
3869
  };
3898
3870
  if (signedJudgeAction) body.signed_judge_action = signedJudgeAction;
3899
3871
  if (context) body.context = context;
3900
- if (options.provider) body.provider = options.provider;
3901
3872
  if (options.toolName) body.tool_name = options.toolName;
3902
3873
  if (options.toolArgsJson) body.tool_args_json = options.toolArgsJson;
3903
- if (options.model) body.model = options.model;
3904
3874
  if (options.resolved) body.resolved = options.resolved;
3905
3875
  if (options.mode) body.mode = options.mode;
3906
3876
  let resp;
@@ -4752,6 +4722,20 @@ function bootSyncFailureLine(cause) {
4752
4722
  );
4753
4723
  }
4754
4724
 
4725
+ // src-ts/memory/_gtv_bytes.ts
4726
+ function gtvToFfiSafe(value) {
4727
+ if (value instanceof Uint8Array) return Buffer.from(value).toString("hex");
4728
+ if (Array.isArray(value)) return value.map(gtvToFfiSafe);
4729
+ if (value !== null && typeof value === "object") {
4730
+ const out = {};
4731
+ for (const [key3, val] of Object.entries(value)) {
4732
+ out[key3] = gtvToFfiSafe(val);
4733
+ }
4734
+ return out;
4735
+ }
4736
+ return value;
4737
+ }
4738
+
4755
4739
  // src-ts/memory/crypto.ts
4756
4740
  async function deriveMemoryKey(privkey) {
4757
4741
  return native.deriveMemoryKey(privkey);
@@ -43039,7 +43023,7 @@ async function commitMemoryVersion(plaintext, auth, opts) {
43039
43023
  );
43040
43024
  }
43041
43025
  async function decryptRow(row, key3) {
43042
- const parsed = native.parseMemoryRow(row);
43026
+ const parsed = native.parseMemoryRow(gtvToFfiSafe(row));
43043
43027
  let content;
43044
43028
  let decryptError;
43045
43029
  try {
@@ -43079,7 +43063,7 @@ async function getActiveMemoryId(auth, chainOpts, filePath) {
43079
43063
  native.QUERY_GET_ACTIVE_MEMORY_ID,
43080
43064
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
43081
43065
  );
43082
- return native.parseActiveMemoryId(raw2);
43066
+ return native.parseActiveMemoryId(gtvToFfiSafe(raw2));
43083
43067
  }
43084
43068
  async function getRecentAgentMemory(auth, chainOpts, filePath) {
43085
43069
  const client = await buildChainClient(chainOpts);
@@ -43131,7 +43115,7 @@ async function getRollbackHistory(auth, chainOpts, filePath) {
43131
43115
  native.QUERY_GET_AGENT_MEMORY_ROLLBACK_HISTORY,
43132
43116
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
43133
43117
  );
43134
- const parsed = native.parseRollbackRows(raw2 ?? []);
43118
+ const parsed = native.parseRollbackRows(gtvToFfiSafe(raw2 ?? []));
43135
43119
  return parsed.map((r2) => ({
43136
43120
  fromId: r2.from_id,
43137
43121
  toId: r2.to_id,
@@ -43891,6 +43875,7 @@ function diffMemorySnapshots(before, after) {
43891
43875
  getMemoryHistory,
43892
43876
  getRecentAgentMemory,
43893
43877
  getRollbackHistory,
43878
+ gtvToFfiSafe,
43894
43879
  guardMemoryWrite,
43895
43880
  isEnvelope,
43896
43881
  isValidPrivateKey,
package/dist/index.mjs CHANGED
@@ -3348,33 +3348,8 @@ var ENV_MAP = {
3348
3348
  // Same variable name the Hermes plugin already documents.
3349
3349
  judgeVerifyPubKey: "ATBASH_JUDGE_VERIFY_PUBKEY",
3350
3350
  defaultChainNetwork: "ATBASH_DEFAULT_CHAIN_NETWORK",
3351
- provider: "ATBASH_PROVIDER",
3352
- providerModel: "ATBASH_PROVIDER_MODEL",
3353
3351
  debug: "ATBASH_DEBUG"
3354
3352
  };
3355
- var DEPRECATED_ENV_VARS = ["ATBASH_BLOCKCHAIN_RID"];
3356
- var DEPRECATED_CONFIG_FIELDS = ["blockchainRid"];
3357
- var deprecatedWarned = false;
3358
- function warnDeprecatedEnvVarsOnce(log = console.warn) {
3359
- if (deprecatedWarned) return;
3360
- for (const name2 of DEPRECATED_ENV_VARS) {
3361
- if (process.env[name2]) {
3362
- deprecatedWarned = true;
3363
- log(
3364
- `[atbash] ${name2} is ignored \u2014 each org's chain is resolved from the dashboard; set ATBASH_DEFAULT_CHAIN_NETWORK=private only to pin everything to private`
3365
- );
3366
- }
3367
- }
3368
- const fileConfig = loadUserConfig();
3369
- for (const field of DEPRECATED_CONFIG_FIELDS) {
3370
- if (fileConfig[field]) {
3371
- deprecatedWarned = true;
3372
- log(
3373
- `[atbash] "${field}" in ${getConfigPath()} is ignored \u2014 pass \`chain\` or \`network\` at construction instead`
3374
- );
3375
- }
3376
- }
3377
- }
3378
3353
  function getConfigDir() {
3379
3354
  const home2 = process.env.HOME || homedir3() || "";
3380
3355
  return join3(home2, ".config", "atbash");
@@ -3533,14 +3508,13 @@ var Atbash = class _Atbash {
3533
3508
  this._defaultChain = resolvedChain;
3534
3509
  this._explicitChain = options.chain !== void 0 || options.network !== void 0 || options.blockchainRid !== void 0 && options.nodeUrls !== void 0;
3535
3510
  this._forcedNetwork = forcedChainNetwork();
3536
- warnDeprecatedEnvVarsOnce((msg) => options.logger?.warn?.(msg));
3537
3511
  this.orgName = options.orgName;
3538
3512
  this.verifyPubKey = validated.verifyPubKey ?? void 0;
3539
3513
  this.orgEncryptionPubKey = options.orgEncryptionPubKey;
3540
3514
  this.failClosed = options.failClosed !== false;
3541
3515
  this.debug = options.debug === true;
3542
3516
  this.logger = options.logger ?? {};
3543
- this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 6e4);
3517
+ this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 12e4);
3544
3518
  this.logEnvironmentOnce();
3545
3519
  if (this.endpoint !== DEFAULT_ENDPOINT) {
3546
3520
  this.logger.warn?.("[atbash] running on non-default judge endpoint", {
@@ -3791,18 +3765,15 @@ var Atbash = class _Atbash {
3791
3765
  if (!logResult.success || !logResult.toolCallId || !logResult.signedHex) {
3792
3766
  throw new Error(logResult.error || "Failed to sign log_tool_call");
3793
3767
  }
3794
- let signedJudgeAction;
3795
- if (!options.provider) {
3796
- const judgmentId = generateToolCallId();
3797
- signedJudgeAction = native.signJudgeAction(
3798
- judgmentId,
3799
- action,
3800
- context || "",
3801
- "",
3802
- this.auth.privkey,
3803
- brid
3804
- );
3805
- }
3768
+ const judgmentId = generateToolCallId();
3769
+ const signedJudgeAction = native.signJudgeAction(
3770
+ judgmentId,
3771
+ action,
3772
+ context || "",
3773
+ "",
3774
+ this.auth.privkey,
3775
+ brid
3776
+ );
3806
3777
  const body = {
3807
3778
  tool_call_id: logResult.toolCallId,
3808
3779
  agent_pubkey: this.auth.pubkey,
@@ -3811,10 +3782,8 @@ var Atbash = class _Atbash {
3811
3782
  };
3812
3783
  if (signedJudgeAction) body.signed_judge_action = signedJudgeAction;
3813
3784
  if (context) body.context = context;
3814
- if (options.provider) body.provider = options.provider;
3815
3785
  if (options.toolName) body.tool_name = options.toolName;
3816
3786
  if (options.toolArgsJson) body.tool_args_json = options.toolArgsJson;
3817
- if (options.model) body.model = options.model;
3818
3787
  if (options.resolved) body.resolved = options.resolved;
3819
3788
  if (options.mode) body.mode = options.mode;
3820
3789
  let resp;
@@ -4666,6 +4635,20 @@ function bootSyncFailureLine(cause) {
4666
4635
  );
4667
4636
  }
4668
4637
 
4638
+ // src-ts/memory/_gtv_bytes.ts
4639
+ function gtvToFfiSafe(value) {
4640
+ if (value instanceof Uint8Array) return Buffer.from(value).toString("hex");
4641
+ if (Array.isArray(value)) return value.map(gtvToFfiSafe);
4642
+ if (value !== null && typeof value === "object") {
4643
+ const out = {};
4644
+ for (const [key3, val] of Object.entries(value)) {
4645
+ out[key3] = gtvToFfiSafe(val);
4646
+ }
4647
+ return out;
4648
+ }
4649
+ return value;
4650
+ }
4651
+
4669
4652
  // src-ts/memory/crypto.ts
4670
4653
  async function deriveMemoryKey(privkey) {
4671
4654
  return native.deriveMemoryKey(privkey);
@@ -42953,7 +42936,7 @@ async function commitMemoryVersion(plaintext, auth, opts) {
42953
42936
  );
42954
42937
  }
42955
42938
  async function decryptRow(row, key3) {
42956
- const parsed = native.parseMemoryRow(row);
42939
+ const parsed = native.parseMemoryRow(gtvToFfiSafe(row));
42957
42940
  let content;
42958
42941
  let decryptError;
42959
42942
  try {
@@ -42993,7 +42976,7 @@ async function getActiveMemoryId(auth, chainOpts, filePath) {
42993
42976
  native.QUERY_GET_ACTIVE_MEMORY_ID,
42994
42977
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
42995
42978
  );
42996
- return native.parseActiveMemoryId(raw2);
42979
+ return native.parseActiveMemoryId(gtvToFfiSafe(raw2));
42997
42980
  }
42998
42981
  async function getRecentAgentMemory(auth, chainOpts, filePath) {
42999
42982
  const client = await buildChainClient(chainOpts);
@@ -43045,7 +43028,7 @@ async function getRollbackHistory(auth, chainOpts, filePath) {
43045
43028
  native.QUERY_GET_AGENT_MEMORY_ROLLBACK_HISTORY,
43046
43029
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
43047
43030
  );
43048
- const parsed = native.parseRollbackRows(raw2 ?? []);
43031
+ const parsed = native.parseRollbackRows(gtvToFfiSafe(raw2 ?? []));
43049
43032
  return parsed.map((r2) => ({
43050
43033
  fromId: r2.from_id,
43051
43034
  toId: r2.to_id,
@@ -43804,6 +43787,7 @@ export {
43804
43787
  getMemoryHistory,
43805
43788
  getRecentAgentMemory,
43806
43789
  getRollbackHistory,
43790
+ gtvToFfiSafe,
43807
43791
  guardMemoryWrite,
43808
43792
  isEnvelope,
43809
43793
  isValidPrivateKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atbash/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript SDK for Atbash — the safety layer that evaluates AI agent actions against operator-defined policies before execution.",
5
5
  "keywords": [
6
6
  "atbash",
@@ -89,10 +89,10 @@
89
89
  "typescript-eslint": "^8.62.1"
90
90
  },
91
91
  "optionalDependencies": {
92
- "@atbash/sdk-linux-x64-gnu": "0.8.0",
93
- "@atbash/sdk-linux-arm64-gnu": "0.8.0",
94
- "@atbash/sdk-linux-x64-musl": "0.8.0",
95
- "@atbash/sdk-darwin-arm64": "0.8.0",
96
- "@atbash/sdk-win32-x64-msvc": "0.8.0"
92
+ "@atbash/sdk-linux-x64-gnu": "0.9.0",
93
+ "@atbash/sdk-linux-arm64-gnu": "0.9.0",
94
+ "@atbash/sdk-linux-x64-musl": "0.9.0",
95
+ "@atbash/sdk-darwin-arm64": "0.9.0",
96
+ "@atbash/sdk-win32-x64-msvc": "0.9.0"
97
97
  }
98
98
  }