@atbash/sdk 0.10.6-dev.0 → 0.10.7-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.
@@ -310,6 +310,12 @@ interface AtbashOptions {
310
310
  orgEncryptionPubKey?: string;
311
311
  /** When true (default), `auditToolCall` denies on any error. */
312
312
  failClosed?: boolean;
313
+ /**
314
+ * Verbose diagnostics. Off by default. When on, a failed judge call also
315
+ * logs the response body, which is the difference between "judge API failed"
316
+ * and knowing why it failed. Opt-in because that body can echo the action.
317
+ */
318
+ debug?: boolean;
313
319
  logger?: AtbashLogger;
314
320
  }
315
321
  /** Canonical decision returned by `auditToolCall`. */
@@ -350,6 +356,8 @@ interface FromConfigOptions {
350
356
  /** Default org name — see {@link AtbashOptions.orgName}. */
351
357
  orgName?: string;
352
358
  failClosed?: boolean;
359
+ /** See {@link AtbashOptions.debug}. */
360
+ debug?: boolean;
353
361
  logger?: AtbashLogger;
354
362
  }
355
363
  /** Options accepted by `judgeAction`. */
@@ -414,6 +422,7 @@ declare class Atbash {
414
422
  readonly failClosed: boolean;
415
423
  /** Org key learned from the last agent-exists check, for this agent only. */
416
424
  private _orgKeyFromChain;
425
+ private readonly debug;
417
426
  private readonly logger;
418
427
  private readonly http;
419
428
  /**
@@ -427,7 +436,20 @@ declare class Atbash {
427
436
  * server-side replay protection windows never expire it mid-session.
428
437
  */
429
438
  private _authBearer;
439
+ /** Guards `logEnvironmentOnce` — hosts construct several clients. */
440
+ private static environmentLogged;
430
441
  constructor(privkey: string, options?: AtbashOptions);
442
+ /**
443
+ * Say which environment this build talks to, once per process.
444
+ *
445
+ * The endpoint and both chain RIDs are compiled in, chosen by the npm tag,
446
+ * and no configuration repoints a released build. So installing the build
447
+ * for the wrong environment is invisible: the plugin loads, the hook fires,
448
+ * and every judge call fails because the agent does not exist on the chain
449
+ * this build targets. Organisation names are not unique across environments
450
+ * either, so an org resolving is not evidence the build is right.
451
+ */
452
+ private logEnvironmentOnce;
431
453
  /**
432
454
  * Construct from resolved config: explicit overrides → env vars → the
433
455
  * `~/.config/atbash/config.json` file (see userConfig.resolve). The private
@@ -470,6 +492,15 @@ declare class Atbash {
470
492
  * explicitly false.
471
493
  */
472
494
  auditToolCall(input: ToolCallInput): Promise<Decision>;
495
+ /**
496
+ * One exit for every judge failure.
497
+ *
498
+ * Status and reason go in the *message*, not only in the meta object: hosts
499
+ * print the message and drop the meta, which is why this read as a bare
500
+ * "judge API failed" while the judge was answering with a precise reason.
501
+ * The response body follows only under `debug`, since it can echo the action.
502
+ */
503
+ private failJudge;
473
504
  private fail;
474
505
  getJudgmentStatus(judgmentId: string, agentPubkey?: string): Promise<JudgmentStatus>;
475
506
  getToolCalls(maxCount: number): Promise<ToolCallRecord[]>;
@@ -585,6 +616,8 @@ interface AtbashUserConfig {
585
616
  blockchainRid?: string;
586
617
  provider?: string;
587
618
  providerModel?: string;
619
+ /** "1" / "true" turns on verbose diagnostics. See AtbashOptions.debug. */
620
+ debug?: string;
588
621
  }
589
622
  declare function getConfigDir(): string;
590
623
  declare function getConfigPath(): string;
@@ -595,6 +628,26 @@ declare function resolve(key: keyof AtbashUserConfig, flagValue?: string): strin
595
628
  declare function resolveKeyPath(input?: string): string;
596
629
  declare function loadAgentFromFile(keyPath?: string): AgentAuth;
597
630
 
631
+ /**
632
+ * Accepted key filenames, in precedence order.
633
+ *
634
+ * `guard-client-key` stays first: it is the name every existing install
635
+ * already has, and changing which file wins would silently switch agent
636
+ * identity for anyone holding both. `atbash-client-key` is accepted because
637
+ * it is the name people actually create — the old one carries retired
638
+ * branding — and hitting ENOENT on a key you just wrote, from a plugin that
639
+ * still reports itself installed, is a miserable first run.
640
+ */
641
+ declare const KEY_FILENAMES: readonly ["guard-client-key", "atbash-client-key"];
642
+ /** Every path checked when no explicit key path is given, in order. */
643
+ declare function keyPathCandidates(): string[];
644
+ /**
645
+ * Pick the key path: an explicit input wins untouched; otherwise the first
646
+ * accepted filename that exists, falling back to the preferred name so the
647
+ * error names something recognisable when nothing is there.
648
+ */
649
+ declare function chooseKeyPath(input: string | undefined, exists: (p: string) => boolean): string;
650
+
598
651
  /**
599
652
  * Canonical secret kinds reported by the Rust core in `SecretMatch.kind`.
600
653
  * Wire is permissive (modelled as a free string in {@link SecretMatch})
@@ -613,6 +666,26 @@ declare function verifyJudgeResponseSignature(bodyBytes: Uint8Array, signatureHe
613
666
  reason?: string;
614
667
  };
615
668
 
669
+ /**
670
+ * The boot memory-sync failure line.
671
+ *
672
+ * Split out of `guard-manager.ts` so it can be asserted without constructing a
673
+ * guard manager, which needs the native addon. The message is the whole point
674
+ * of AT-304: hosts print the message and drop the structured meta, so a cause
675
+ * that lives only in meta never reaches the operator.
676
+ */
677
+ /** Advice, not a diagnosis — appended only when the cause is unhelpful. */
678
+ declare const BOOT_SYNC_HINT = "check the chain endpoint and orgName if the cause above does not explain it";
679
+ /**
680
+ * Lead with the real cause.
681
+ *
682
+ * The previous wording named the chain endpoint and orgName as the things to
683
+ * check, which sent operators to verify configuration that was already correct
684
+ * while the actual cause (a node answering `404 Can't find blockchain with
685
+ * blockchainRID: …` for a chain it does not host) stayed hidden.
686
+ */
687
+ declare function bootSyncFailureLine(cause: unknown): string;
688
+
616
689
  /** Derive the 32-byte AES key from an agent's secp256k1 privkey (hex). Deterministic — same privkey always yields the same key. */
617
690
  declare function deriveMemoryKey(privkey: string): Promise<Buffer>;
618
691
  /** Encrypt UTF-8 plaintext. `ciphertext` has the 16-byte GCM auth tag appended, matching the SDK's on-chain byte layout. */
@@ -1164,4 +1237,4 @@ declare function containsSecret(text: string): boolean;
1164
1237
  declare function createMemorySnapshot(entries: MemoryEntry[], takenAt: number): MemorySnapshot;
1165
1238
  declare function diffMemorySnapshots(before: MemorySnapshot, after: MemorySnapshot): MemoryDiffResult;
1166
1239
 
1167
- export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, buildAllowedJudgeHosts, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
1240
+ export { type ActionType, type AgentAuth, type AgentMemoryEntry, type AgentPolicy, type AnomalySeverity, type AnomalyType, Atbash, AtbashAPIError, type AtbashLogger, type AtbashOptions, type AtbashUserConfig, BOOT_SYNC_HINT, type ChainOpts, type ClassifierToolContext, type ClassifierToolEvent, type ClassifyMemoryReadOptions, type ClassifyMemoryWriteOptions, type ClientSource, type CommitMemoryOptions, DEFAULT_BLOCKCHAIN_RID, DEFAULT_CHROMIA_NODE_URLS, DEFAULT_ENDPOINT, DEFAULT_MEMORY_PATH_PATTERNS, DEFAULT_MEMORY_READ_TOOL_NAMES, DEFAULT_MEMORY_WRITE_TOOL_NAMES, type Decision, type DecisionVerdict, EciesDomain, type EncryptedMemory, type Envelope, type FromConfigOptions, type GuardLogger, type GuardMemoryDecision, type GuardMemoryWriteInput, type GuardMemoryWriteResult, type HeldAction, type HeldActionReview, type HookDecision, type JudgeEndpointConfig, type JudgeOptions, type JudgeResult, type JudgmentState, type JudgmentStatus, KEY_FILENAMES, type KeyPair, type LogToolCallOptions, type LogToolCallResult, type MemoryAnomaly, type MemoryDiffResult, type MemoryEntry, MemoryGuardManager, type MemoryGuardManagerOptions, MemoryIntegrityError, type MemoryPointer, type MemoryRollbackEvent, type MemoryScanOptions, type MemoryScanResult, type MemoryScanVerdict, type MemorySnapshot, type ModifiedEntry, type Network, type OrgSubscription, PointerStore, type Provider, type PubkeyValue, type RedactResult, type RollbackMemoryOptions, type SecretKind, type SecretMatch, SignatureVerificationError, type Subscription, type SyncMemoryOptions, type SyncMemoryResult, type TelemetryConfig, type TierInfo, type ToolCallFull, type ToolCallInput, type ToolCallRecord, type ValidatedEndpoint, type Verdict, type WrappedLogger, bootSyncFailureLine, buildAllowedJudgeHosts, chooseKeyPath, claimHashHex, classifyMemoryRead, classifyMemoryWrite, columnAad, commitMemoryVersion, containsEvasionCharacters, containsSecret, createFileLogger, createMemoryGuardManager, createMemorySnapshot, decryptForOrg, decryptMemoryContent, defaultPluginLogPath, defaultPointerPath, deriveMemoryKey, derivePublicKey, diffMemorySnapshots, encryptForOrg, encryptMemoryContent, encryptedLength, flushTelemetry, generateKeypair, getActiveMemory, getActiveMemoryId, getAllAgentMemory, getConfigDir, getConfigPath, getMemoryById, getMemoryHistory, getRollbackHistory, guardMemoryWrite, isEnvelope, isValidPrivateKey, keyFingerprintOf, keyPathCandidates, loadAgent, loadAgentFromFile, loadUserConfig, normalizeActionForHash, normalizeForMatching, normalizeStatus, normalizeVerdict, packEnvelope, parseEnvelope, pubkeyToHex, recordCall, recordDuration, redactJsonStrings, redactSecrets, resolve, resolveKeyPath, rollbackMemory, saveUserConfig, scanMemory, scanMemoryBatch, setupTelemetry, shutdownTelemetry, signEncryptedToolCall, signJudgeAction, signLogToolCall, syncLocalMemory, validateJudgeEndpoint, verifyJudgeResponseSignature, verifySignature };
package/dist/browser.mjs CHANGED
@@ -12126,7 +12126,7 @@ function requireBuffer_list() {
12126
12126
  }
12127
12127
  }, {
12128
12128
  key: "join",
12129
- value: function join2(s2) {
12129
+ value: function join3(s2) {
12130
12130
  if (this.length === 0) return "";
12131
12131
  var p = this.head;
12132
12132
  var ret = "" + p.data;
@@ -16208,7 +16208,7 @@ function requireBufferList() {
16208
16208
  this.head = this.tail = null;
16209
16209
  this.length = 0;
16210
16210
  };
16211
- BufferList2.prototype.join = function join2(s2) {
16211
+ BufferList2.prototype.join = function join3(s2) {
16212
16212
  if (this.length === 0) return "";
16213
16213
  var p = this.head;
16214
16214
  var ret = "" + p.data;
@@ -30372,7 +30372,7 @@ function requireBuffer() {
30372
30372
  }
30373
30373
  }
30374
30374
  buffer.EncoderBuffer = EncoderBuffer2;
30375
- EncoderBuffer2.prototype.join = function join2(out, offset) {
30375
+ EncoderBuffer2.prototype.join = function join3(out, offset) {
30376
30376
  if (!out)
30377
30377
  out = new Buffer5(this.length);
30378
30378
  if (!offset)
@@ -43294,9 +43294,9 @@ var index = /* @__PURE__ */ getDefaultExportFromCjs(builtExports);
43294
43294
 
43295
43295
  // src-ts/browser/native.ts
43296
43296
  var { Buffer: Buffer3, gtx: pcgtx } = index;
43297
- var ATBASH_ENDPOINT = "https://atbash.ai";
43298
- var ATBASH_BLOCKCHAIN_RID = "0163241D9AF137638E63E48EFCDE15510F38C2426F7AD5DC726AF60351BF4DFE";
43299
- var ATBASH_PRIVATE_BLOCKCHAIN_RID = "39FFD3557D0296CB2C57FDC6A3B8C024E95639CF4964DA08141AC20C6344D408";
43297
+ var ATBASH_ENDPOINT = "https://chromia-verified-ai-dev-two.vercel.app";
43298
+ var ATBASH_BLOCKCHAIN_RID = "02668C5218871F69A93CC0F7032DCFFE06EF0D35EF2F0B07A92A3D83A3F23A7D";
43299
+ var ATBASH_PRIVATE_BLOCKCHAIN_RID = "2603569AE8DC3F254323F719C8D4347BBA964E874E781291F8474236BE8B6493";
43300
43300
  var DEFAULT_CHROMIA_NODE_URLS_ARR = define_ATBASH_CHROMIA_NODE_URLS_default;
43301
43301
  var DEFAULT_PRIVATE_NODE_URLS_ARR = define_ATBASH_PRIVATE_NODE_URLS_default;
43302
43302
  var MERKLE_HASH_VERSION = 2;
@@ -44573,6 +44573,7 @@ var Atbash = class _Atbash {
44573
44573
  failClosed;
44574
44574
  /** Org key learned from the last agent-exists check, for this agent only. */
44575
44575
  _orgKeyFromChain = null;
44576
+ debug;
44576
44577
  logger;
44577
44578
  http;
44578
44579
  /**
@@ -44586,6 +44587,8 @@ var Atbash = class _Atbash {
44586
44587
  * server-side replay protection windows never expire it mid-session.
44587
44588
  */
44588
44589
  _authBearer = null;
44590
+ /** Guards `logEnvironmentOnce` — hosts construct several clients. */
44591
+ static environmentLogged = false;
44589
44592
  constructor(privkey, options = {}) {
44590
44593
  this.auth = native.loadAgent(privkey);
44591
44594
  this.endpoint = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/+$/, "") || DEFAULT_ENDPOINT;
@@ -44595,8 +44598,10 @@ var Atbash = class _Atbash {
44595
44598
  this.verifyPubKey = options.verifyPubKey;
44596
44599
  this.orgEncryptionPubKey = options.orgEncryptionPubKey;
44597
44600
  this.failClosed = options.failClosed !== false;
44601
+ this.debug = options.debug === true;
44598
44602
  this.logger = options.logger ?? {};
44599
44603
  this.http = new HttpClient(this.endpoint, options.timeoutMs ?? 3e4);
44604
+ this.logEnvironmentOnce();
44600
44605
  if (this.endpoint !== DEFAULT_ENDPOINT) {
44601
44606
  this.logger.warn?.("[atbash] running on non-default judge endpoint", {
44602
44607
  endpoint: this.endpoint,
@@ -44604,6 +44609,31 @@ var Atbash = class _Atbash {
44604
44609
  });
44605
44610
  }
44606
44611
  }
44612
+ /**
44613
+ * Say which environment this build talks to, once per process.
44614
+ *
44615
+ * The endpoint and both chain RIDs are compiled in, chosen by the npm tag,
44616
+ * and no configuration repoints a released build. So installing the build
44617
+ * for the wrong environment is invisible: the plugin loads, the hook fires,
44618
+ * and every judge call fails because the agent does not exist on the chain
44619
+ * this build targets. Organisation names are not unique across environments
44620
+ * either, so an org resolving is not evidence the build is right.
44621
+ */
44622
+ logEnvironmentOnce() {
44623
+ if (_Atbash.environmentLogged) return;
44624
+ _Atbash.environmentLogged = true;
44625
+ const brief = (rid) => rid ? `${rid.slice(0, 8)}\u2026` : "(unset)";
44626
+ this.logger.info?.(
44627
+ `[atbash] environment \u2014 judge=${this.endpoint} publicChain=${brief(native.DEFAULT_BLOCKCHAIN_RID)} privateChain=${brief(native.DEFAULT_PRIVATE_BLOCKCHAIN_RID)} activeChain=${brief(this.blockchainRid)} responseSignatureCheck=${this.verifyPubKey ? "on" : "off"}`,
44628
+ {
44629
+ judgeEndpoint: this.endpoint,
44630
+ publicBlockchainRid: native.DEFAULT_BLOCKCHAIN_RID,
44631
+ privateBlockchainRid: native.DEFAULT_PRIVATE_BLOCKCHAIN_RID,
44632
+ activeBlockchainRid: this.blockchainRid,
44633
+ responseSignatureCheck: Boolean(this.verifyPubKey)
44634
+ }
44635
+ );
44636
+ }
44607
44637
  /**
44608
44638
  * Construct from resolved config: explicit overrides → env vars → the
44609
44639
  * `~/.config/atbash/config.json` file (see userConfig.resolve). The private
@@ -44627,6 +44657,9 @@ var Atbash = class _Atbash {
44627
44657
  orgName: options.orgName,
44628
44658
  verifyPubKey: validated.verifyPubKey ?? void 0,
44629
44659
  failClosed: options.failClosed,
44660
+ // ATBASH_DEBUG lets an operator turn diagnostics on without editing a
44661
+ // host's plugin config, which is usually the harder half.
44662
+ debug: options.debug ?? /^(1|true|yes)$/i.test(resolve("debug")),
44630
44663
  logger: options.logger
44631
44664
  });
44632
44665
  }
@@ -44872,8 +44905,9 @@ var Atbash = class _Atbash {
44872
44905
  });
44873
44906
  if (result.verdict === "No verdict") {
44874
44907
  if (result.status !== "logged") {
44875
- return this.fail(
44908
+ return this.failJudge(
44876
44909
  `judge returned no verdict without an audit-tier marker (status: ${result.status || "absent"})`,
44910
+ void 0,
44877
44911
  result.toolCallId
44878
44912
  );
44879
44913
  }
@@ -44925,16 +44959,38 @@ var Atbash = class _Atbash {
44925
44959
  toolCallId: result.toolCallId
44926
44960
  };
44927
44961
  }
44928
- return this.fail(
44962
+ return this.failJudge(
44929
44963
  "unrecognized action_type from judge",
44964
+ void 0,
44930
44965
  result.toolCallId
44931
44966
  );
44932
44967
  } catch (err) {
44933
- const message = errorMessage(err);
44934
- this.logger.warn?.("[atbash] judge API failed", { reason: message });
44935
- return this.fail(message);
44968
+ return this.failJudge(errorMessage(err), err);
44936
44969
  }
44937
44970
  }
44971
+ /**
44972
+ * One exit for every judge failure.
44973
+ *
44974
+ * Status and reason go in the *message*, not only in the meta object: hosts
44975
+ * print the message and drop the meta, which is why this read as a bare
44976
+ * "judge API failed" while the judge was answering with a precise reason.
44977
+ * The response body follows only under `debug`, since it can echo the action.
44978
+ */
44979
+ failJudge(reason, cause, toolCallId) {
44980
+ const api2 = cause instanceof AtbashAPIError ? cause : null;
44981
+ const status = api2 ? ` status=${api2.status || "no-response"}` : "";
44982
+ const body = this.debug && api2?.body ? ` body=${truncate(api2.body, 500)}` : "";
44983
+ this.logger.warn?.(
44984
+ `[atbash] judge API failed \u2014${status} reason=${truncate(reason, 300)}${body}`,
44985
+ {
44986
+ reason,
44987
+ ...api2 ? { status: api2.status, body: api2.body } : {},
44988
+ endpoint: this.endpoint,
44989
+ ...toolCallId ? { toolCallId } : {}
44990
+ }
44991
+ );
44992
+ return this.fail(reason, toolCallId);
44993
+ }
44938
44994
  fail(reason, toolCallId) {
44939
44995
  return { allow: !this.failClosed, verdict: "ERROR", reason, toolCallId };
44940
44996
  }
@@ -45422,9 +45478,32 @@ function stringifyArgs(args) {
45422
45478
  }
45423
45479
  }
45424
45480
  var MAX_ACTION_LEN = 4e3;
45425
- function truncate(text) {
45426
- if (text.length <= MAX_ACTION_LEN) return text;
45427
- return text.slice(0, MAX_ACTION_LEN) + "\u2026";
45481
+ function truncate(text, limit = MAX_ACTION_LEN) {
45482
+ if (text.length <= limit) return text;
45483
+ return text.slice(0, limit) + "\u2026";
45484
+ }
45485
+
45486
+ // src-ts/key-path.ts
45487
+ init_define_ATBASH_CHROMIA_NODE_URLS();
45488
+ init_define_ATBASH_PRIVATE_NODE_URLS();
45489
+ import { homedir } from "os";
45490
+ import { join as join2 } from "path";
45491
+ var KEY_DIR_REL = ".config/atbash";
45492
+ var KEY_FILENAMES = ["guard-client-key", "atbash-client-key"];
45493
+ function home() {
45494
+ return process.env.HOME || homedir() || "";
45495
+ }
45496
+ function expandHome(p) {
45497
+ if (!p.startsWith("~/")) return p;
45498
+ return join2(home(), p.slice(2));
45499
+ }
45500
+ function keyPathCandidates() {
45501
+ return KEY_FILENAMES.map((name2) => join2(home(), KEY_DIR_REL, name2));
45502
+ }
45503
+ function chooseKeyPath(input, exists) {
45504
+ if (input) return expandHome(input);
45505
+ const candidates = keyPathCandidates();
45506
+ return candidates.find(exists) ?? candidates[0];
45428
45507
  }
45429
45508
 
45430
45509
  // src-ts/redact.ts
@@ -45471,6 +45550,19 @@ function verifyJudgeResponseSignature(bodyBytes, signatureHex, pubKeyHex) {
45471
45550
  };
45472
45551
  }
45473
45552
 
45553
+ // src-ts/memory/boot-sync-message.ts
45554
+ init_define_ATBASH_CHROMIA_NODE_URLS();
45555
+ init_define_ATBASH_PRIVATE_NODE_URLS();
45556
+ var BOOT_SYNC_HINT = "check the chain endpoint and orgName if the cause above does not explain it";
45557
+ function bootSyncFailureLine(cause) {
45558
+ const reason = cause instanceof Error ? cause.message : String(cause);
45559
+ const trimmed = reason.trim();
45560
+ return trimmed ? `[atbash] boot memory sync failed: ${trimmed}` : (
45561
+ // No cause to show: fall back to the advice rather than a bare colon.
45562
+ `[atbash] boot memory sync failed \u2014 ${BOOT_SYNC_HINT}`
45563
+ );
45564
+ }
45565
+
45474
45566
  // src-ts/memory/index.ts
45475
45567
  init_define_ATBASH_CHROMIA_NODE_URLS();
45476
45568
  init_define_ATBASH_PRIVATE_NODE_URLS();
@@ -45876,6 +45968,7 @@ function diffMemorySnapshots2(before, after) {
45876
45968
  export {
45877
45969
  Atbash,
45878
45970
  AtbashAPIError,
45971
+ BOOT_SYNC_HINT,
45879
45972
  DEFAULT_BLOCKCHAIN_RID,
45880
45973
  DEFAULT_CHROMIA_NODE_URLS,
45881
45974
  DEFAULT_ENDPOINT,
@@ -45883,11 +45976,14 @@ export {
45883
45976
  DEFAULT_MEMORY_READ_TOOL_NAMES,
45884
45977
  DEFAULT_MEMORY_WRITE_TOOL_NAMES,
45885
45978
  EciesDomain,
45979
+ KEY_FILENAMES,
45886
45980
  MemoryGuardManager,
45887
45981
  MemoryIntegrityError,
45888
45982
  PointerStore,
45889
45983
  SignatureVerificationError,
45984
+ bootSyncFailureLine,
45890
45985
  buildAllowedJudgeHosts,
45986
+ chooseKeyPath,
45891
45987
  claimHashHex,
45892
45988
  classifyMemoryRead,
45893
45989
  classifyMemoryWrite,
@@ -45922,6 +46018,7 @@ export {
45922
46018
  isEnvelope,
45923
46019
  isValidPrivateKey2 as isValidPrivateKey,
45924
46020
  keyFingerprintOf,
46021
+ keyPathCandidates,
45925
46022
  loadAgent2 as loadAgent,
45926
46023
  loadAgentFromFile,
45927
46024
  loadUserConfig,