@atbash/sdk 0.15.2-dev.0 → 0.16.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.
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,7 +44763,6 @@ 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;
@@ -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,7 +3595,6 @@ 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;
@@ -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);
@@ -42971,16 +42955,25 @@ async function resolveChainOptsForOrg(opts, auth) {
42971
42955
  return opts?.chainOpts;
42972
42956
  }
42973
42957
  function materializeChain(chainOpts) {
42974
- if (chainOpts?.blockchainRid && chainOpts.nodeUrls) {
42958
+ const hasNodeUrls = chainOpts?.nodeUrls !== void 0;
42959
+ const hasBrid = chainOpts?.blockchainRid !== void 0;
42960
+ if (hasNodeUrls !== hasBrid) {
42961
+ throw new Error(
42962
+ 'chainOpts.nodeUrls and chainOpts.blockchainRid must be provided together \u2014 passing one without the other 404s every chain request. Prefer `network: "public" | "private"`, or set both.'
42963
+ );
42964
+ }
42965
+ if (hasNodeUrls && hasBrid) {
42975
42966
  return {
42976
42967
  nodeUrls: chainOpts.nodeUrls,
42977
42968
  blockchainRid: chainOpts.blockchainRid
42978
42969
  };
42979
42970
  }
42980
- const config2 = chainOpts?.network ? chainForNetwork(chainOpts.network) : PUBLIC_CHAIN;
42971
+ const config2 = chainForNetwork(
42972
+ chainOpts?.network ?? forcedChainNetwork() ?? "private"
42973
+ );
42981
42974
  return {
42982
- nodeUrls: chainOpts?.nodeUrls ?? config2.nodeUrls,
42983
- blockchainRid: chainOpts?.blockchainRid ?? config2.blockchainRid
42975
+ nodeUrls: config2.nodeUrls,
42976
+ blockchainRid: config2.blockchainRid
42984
42977
  };
42985
42978
  }
42986
42979
  async function buildChainClient(chainOpts) {
@@ -43030,7 +43023,7 @@ async function commitMemoryVersion(plaintext, auth, opts) {
43030
43023
  );
43031
43024
  }
43032
43025
  async function decryptRow(row, key3) {
43033
- const parsed = native.parseMemoryRow(row);
43026
+ const parsed = native.parseMemoryRow(gtvToFfiSafe(row));
43034
43027
  let content;
43035
43028
  let decryptError;
43036
43029
  try {
@@ -43070,7 +43063,7 @@ async function getActiveMemoryId(auth, chainOpts, filePath) {
43070
43063
  native.QUERY_GET_ACTIVE_MEMORY_ID,
43071
43064
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
43072
43065
  );
43073
- return native.parseActiveMemoryId(raw2);
43066
+ return native.parseActiveMemoryId(gtvToFfiSafe(raw2));
43074
43067
  }
43075
43068
  async function getRecentAgentMemory(auth, chainOpts, filePath) {
43076
43069
  const client = await buildChainClient(chainOpts);
@@ -43122,7 +43115,7 @@ async function getRollbackHistory(auth, chainOpts, filePath) {
43122
43115
  native.QUERY_GET_AGENT_MEMORY_ROLLBACK_HISTORY,
43123
43116
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
43124
43117
  );
43125
- const parsed = native.parseRollbackRows(raw2 ?? []);
43118
+ const parsed = native.parseRollbackRows(gtvToFfiSafe(raw2 ?? []));
43126
43119
  return parsed.map((r2) => ({
43127
43120
  fromId: r2.from_id,
43128
43121
  toId: r2.to_id,
@@ -43882,6 +43875,7 @@ function diffMemorySnapshots(before, after) {
43882
43875
  getMemoryHistory,
43883
43876
  getRecentAgentMemory,
43884
43877
  getRollbackHistory,
43878
+ gtvToFfiSafe,
43885
43879
  guardMemoryWrite,
43886
43880
  isEnvelope,
43887
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,7 +3508,6 @@ 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;
@@ -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);
@@ -42885,16 +42868,25 @@ async function resolveChainOptsForOrg(opts, auth) {
42885
42868
  return opts?.chainOpts;
42886
42869
  }
42887
42870
  function materializeChain(chainOpts) {
42888
- if (chainOpts?.blockchainRid && chainOpts.nodeUrls) {
42871
+ const hasNodeUrls = chainOpts?.nodeUrls !== void 0;
42872
+ const hasBrid = chainOpts?.blockchainRid !== void 0;
42873
+ if (hasNodeUrls !== hasBrid) {
42874
+ throw new Error(
42875
+ 'chainOpts.nodeUrls and chainOpts.blockchainRid must be provided together \u2014 passing one without the other 404s every chain request. Prefer `network: "public" | "private"`, or set both.'
42876
+ );
42877
+ }
42878
+ if (hasNodeUrls && hasBrid) {
42889
42879
  return {
42890
42880
  nodeUrls: chainOpts.nodeUrls,
42891
42881
  blockchainRid: chainOpts.blockchainRid
42892
42882
  };
42893
42883
  }
42894
- const config2 = chainOpts?.network ? chainForNetwork(chainOpts.network) : PUBLIC_CHAIN;
42884
+ const config2 = chainForNetwork(
42885
+ chainOpts?.network ?? forcedChainNetwork() ?? "private"
42886
+ );
42895
42887
  return {
42896
- nodeUrls: chainOpts?.nodeUrls ?? config2.nodeUrls,
42897
- blockchainRid: chainOpts?.blockchainRid ?? config2.blockchainRid
42888
+ nodeUrls: config2.nodeUrls,
42889
+ blockchainRid: config2.blockchainRid
42898
42890
  };
42899
42891
  }
42900
42892
  async function buildChainClient(chainOpts) {
@@ -42944,7 +42936,7 @@ async function commitMemoryVersion(plaintext, auth, opts) {
42944
42936
  );
42945
42937
  }
42946
42938
  async function decryptRow(row, key3) {
42947
- const parsed = native.parseMemoryRow(row);
42939
+ const parsed = native.parseMemoryRow(gtvToFfiSafe(row));
42948
42940
  let content;
42949
42941
  let decryptError;
42950
42942
  try {
@@ -42984,7 +42976,7 @@ async function getActiveMemoryId(auth, chainOpts, filePath) {
42984
42976
  native.QUERY_GET_ACTIVE_MEMORY_ID,
42985
42977
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
42986
42978
  );
42987
- return native.parseActiveMemoryId(raw2);
42979
+ return native.parseActiveMemoryId(gtvToFfiSafe(raw2));
42988
42980
  }
42989
42981
  async function getRecentAgentMemory(auth, chainOpts, filePath) {
42990
42982
  const client = await buildChainClient(chainOpts);
@@ -43036,7 +43028,7 @@ async function getRollbackHistory(auth, chainOpts, filePath) {
43036
43028
  native.QUERY_GET_AGENT_MEMORY_ROLLBACK_HISTORY,
43037
43029
  paramsWithOptionalFilePath(q.agent_pubkey_hex, q.file_path)
43038
43030
  );
43039
- const parsed = native.parseRollbackRows(raw2 ?? []);
43031
+ const parsed = native.parseRollbackRows(gtvToFfiSafe(raw2 ?? []));
43040
43032
  return parsed.map((r2) => ({
43041
43033
  fromId: r2.from_id,
43042
43034
  toId: r2.to_id,
@@ -43795,6 +43787,7 @@ export {
43795
43787
  getMemoryHistory,
43796
43788
  getRecentAgentMemory,
43797
43789
  getRollbackHistory,
43790
+ gtvToFfiSafe,
43798
43791
  guardMemoryWrite,
43799
43792
  isEnvelope,
43800
43793
  isValidPrivateKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atbash/sdk",
3
- "version": "0.15.2-dev.0",
3
+ "version": "0.16.0-dev.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.15.2-dev.0",
93
- "@atbash/sdk-linux-arm64-gnu": "0.15.2-dev.0",
94
- "@atbash/sdk-linux-x64-musl": "0.15.2-dev.0",
95
- "@atbash/sdk-darwin-arm64": "0.15.2-dev.0",
96
- "@atbash/sdk-win32-x64-msvc": "0.15.2-dev.0"
92
+ "@atbash/sdk-linux-x64-gnu": "0.16.0-dev.0",
93
+ "@atbash/sdk-linux-arm64-gnu": "0.16.0-dev.0",
94
+ "@atbash/sdk-linux-x64-musl": "0.16.0-dev.0",
95
+ "@atbash/sdk-darwin-arm64": "0.16.0-dev.0",
96
+ "@atbash/sdk-win32-x64-msvc": "0.16.0-dev.0"
97
97
  }
98
98
  }