@atbash/sdk 0.10.12-dev.0 → 0.12.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/dist/browser.mjs CHANGED
@@ -37,7 +37,7 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
37
37
  var define_ATBASH_CHROMIA_NODE_URLS_default;
38
38
  var init_define_ATBASH_CHROMIA_NODE_URLS = __esm({
39
39
  "<define:__ATBASH_CHROMIA_NODE_URLS__>"() {
40
- define_ATBASH_CHROMIA_NODE_URLS_default = ["https://node0.testnet.chromia.com:7740", "https://node1.testnet.chromia.com:7740", "https://node3.testnet.chromia.com:7740"];
40
+ define_ATBASH_CHROMIA_NODE_URLS_default = ["https://node0.testnet.chromia.com:7740", "https://node1.testnet.chromia.com:7740"];
41
41
  }
42
42
  });
43
43
 
@@ -45,7 +45,7 @@ var init_define_ATBASH_CHROMIA_NODE_URLS = __esm({
45
45
  var define_ATBASH_PRIVATE_NODE_URLS_default;
46
46
  var init_define_ATBASH_PRIVATE_NODE_URLS = __esm({
47
47
  "<define:__ATBASH_PRIVATE_NODE_URLS__>"() {
48
- define_ATBASH_PRIVATE_NODE_URLS_default = ["https://node0-pvn-testnet.dynamic.chromia.dev"];
48
+ define_ATBASH_PRIVATE_NODE_URLS_default = ["https://node0-pvn-testnet.dynamic.chromia.dev:7740", "https://node1-pvn-testnet.dynamic.chromia.dev:7740", "https://node2-pvn-testnet.dynamic.chromia.dev:7740"];
49
49
  }
50
50
  });
51
51
 
@@ -43478,9 +43478,10 @@ var native = {
43478
43478
  validateMemoryId: stub("validateMemoryId"),
43479
43479
  validateRollbackReason: stub("validateRollbackReason"),
43480
43480
  validateMemoryNonce: stub("validateMemoryNonce"),
43481
+ validateFilePath: stub("validateFilePath"),
43481
43482
  buildGetActiveMemoryIdQuery: stub("buildGetActiveMemoryIdQuery"),
43482
- buildGetAgentMemoryQuery: stub("buildGetAgentMemoryQuery"),
43483
- buildGetAllAgentMemoryQuery: stub("buildGetAllAgentMemoryQuery"),
43483
+ buildGetRecentAgentMemoryQuery: stub("buildGetRecentAgentMemoryQuery"),
43484
+ buildGetActiveAgentMemoryQuery: stub("buildGetActiveAgentMemoryQuery"),
43484
43485
  buildGetAgentMemoryHistoryQuery: stub("buildGetAgentMemoryHistoryQuery"),
43485
43486
  buildGetAgentMemoryRollbackHistoryQuery: stub("buildGetAgentMemoryRollbackHistoryQuery"),
43486
43487
  buildGetAgentMemoryByIdQuery: stub("buildGetAgentMemoryByIdQuery"),
@@ -43499,13 +43500,14 @@ var native = {
43499
43500
  OP_ROLLBACK_AGENT_MEMORY: "rollback_agent_memory",
43500
43501
  OP_LOG_ENCRYPTED_TOOL_CALL: "log_encrypted_tool_call",
43501
43502
  QUERY_GET_ACTIVE_MEMORY_ID: "get_active_memory_id",
43502
- QUERY_GET_AGENT_MEMORY: "get_agent_memory",
43503
- QUERY_GET_ALL_AGENT_MEMORY: "get_all_agent_memory",
43503
+ QUERY_GET_RECENT_AGENT_MEMORY: "get_recent_agent_memory",
43504
+ QUERY_GET_ACTIVE_AGENT_MEMORY: "get_active_agent_memory",
43504
43505
  QUERY_GET_AGENT_MEMORY_HISTORY: "get_agent_memory_history",
43505
43506
  QUERY_GET_AGENT_MEMORY_BY_ID: "get_agent_memory_by_id",
43506
43507
  QUERY_GET_AGENT_MEMORY_ROLLBACK_HISTORY: "get_agent_memory_rollback_history",
43507
43508
  ARG_AGENT_PUBKEY: "agent_pubkey",
43508
- ARG_ID: "id"
43509
+ ARG_ID: "id",
43510
+ ARG_FILE_PATH: "file_path"
43509
43511
  };
43510
43512
 
43511
43513
  // src-ts/client.ts
@@ -44653,16 +44655,27 @@ var Atbash = class _Atbash {
44653
44655
  * lazily as a signed `log_tool_call` tx and refreshed every 4 min so
44654
44656
  * server-side replay protection windows never expire it mid-session.
44655
44657
  */
44656
- _authBearer = null;
44658
+ // Keyed by blockchainRid so bearers for the public and private chains can
44659
+ // coexist. The dashboard derives `authNetwork` from the BRID inside the
44660
+ // signed envelope, so a bearer signed for chain A cannot authenticate a
44661
+ // request routed to chain B — every chain the client talks to needs its own.
44662
+ _authBearers = /* @__PURE__ */ new Map();
44657
44663
  /** Guards `logEnvironmentOnce` — hosts construct several clients. */
44658
44664
  static environmentLogged = false;
44659
44665
  constructor(privkey, options = {}) {
44660
44666
  this.auth = native.loadAgent(privkey);
44661
- this.endpoint = (options.endpoint ?? DEFAULT_ENDPOINT).replace(/\/+$/, "") || DEFAULT_ENDPOINT;
44667
+ const validated = validateJudgeEndpoint(
44668
+ options.verifyPubKey ? {
44669
+ policy: "self-hosted",
44670
+ endpoint: options.endpoint ?? DEFAULT_ENDPOINT,
44671
+ verifyPubKey: options.verifyPubKey
44672
+ } : { endpoint: options.endpoint }
44673
+ );
44674
+ this.endpoint = validated.url;
44662
44675
  this.nodeUrls = options.nodeUrls ? [...options.nodeUrls] : DEFAULT_CHROMIA_NODE_URLS;
44663
44676
  this.blockchainRid = options.blockchainRid ?? native.DEFAULT_BLOCKCHAIN_RID;
44664
44677
  this.orgName = options.orgName;
44665
- this.verifyPubKey = options.verifyPubKey;
44678
+ this.verifyPubKey = validated.verifyPubKey ?? void 0;
44666
44679
  this.orgEncryptionPubKey = options.orgEncryptionPubKey;
44667
44680
  this.failClosed = options.failClosed !== false;
44668
44681
  this.debug = options.debug === true;
@@ -44720,8 +44733,19 @@ var Atbash = class _Atbash {
44720
44733
  * self-hosted endpoint's `verifyPubKey` becomes the client default.
44721
44734
  */
44722
44735
  static fromConfig(options = {}) {
44736
+ const configuredEndpoint = resolve("judgeEndpoint") || void 0;
44737
+ const configuredVerifyPubKey = resolve("judgeVerifyPubKey") || void 0;
44738
+ if (!options.judge && configuredVerifyPubKey && !configuredEndpoint) {
44739
+ throw new Error(
44740
+ "judgeVerifyPubKey / ATBASH_JUDGE_VERIFY_PUBKEY is set but no judge endpoint is configured: set judgeEndpoint / ATBASH_ENDPOINT to the self-hosted judge"
44741
+ );
44742
+ }
44723
44743
  const validated = validateJudgeEndpoint(
44724
- options.judge ?? { endpoint: resolve("judgeEndpoint") || void 0 }
44744
+ options.judge ?? (configuredVerifyPubKey && configuredEndpoint ? {
44745
+ policy: "self-hosted",
44746
+ endpoint: configuredEndpoint,
44747
+ verifyPubKey: configuredVerifyPubKey
44748
+ } : { endpoint: configuredEndpoint })
44725
44749
  );
44726
44750
  const agentKey = resolve("agentKey", options.agentKey);
44727
44751
  const auth = agentKey ? native.loadAgent(agentKey) : loadAgentFromFile(options.keyPath);
@@ -44769,10 +44793,11 @@ var Atbash = class _Atbash {
44769
44793
  return this.track("checkAgentExists", pk, async () => {
44770
44794
  const query = { pubkey: pk };
44771
44795
  if (network) query.network = network;
44796
+ const brid = this.bridFromChainOpts(network ? { network } : void 0);
44772
44797
  const resp = await this.http.get(
44773
44798
  "/api/ai/exists",
44774
44799
  query,
44775
- this.authHeaders()
44800
+ this.authHeaders(brid)
44776
44801
  );
44777
44802
  await this.raiseIfError(resp);
44778
44803
  const data = await this.json(resp);
@@ -45127,15 +45152,15 @@ var Atbash = class _Atbash {
45127
45152
  () => this.riskEngineRecords("tool-calls", { limit: maxCount })
45128
45153
  );
45129
45154
  }
45130
- getOrgToolCalls(orgName, maxCount) {
45131
- return this.track(
45132
- "getOrgToolCalls",
45133
- void 0,
45134
- () => this.riskEngineRecords("org-tool-calls", {
45135
- org: orgName,
45136
- limit: maxCount
45137
- })
45138
- );
45155
+ async getOrgToolCalls(orgName, maxCount) {
45156
+ return this.track("getOrgToolCalls", void 0, async () => {
45157
+ const brid = await this.bridForOrg(orgName);
45158
+ return this.riskEngineRecords(
45159
+ "org-tool-calls",
45160
+ { org: orgName, limit: maxCount },
45161
+ brid
45162
+ );
45163
+ });
45139
45164
  }
45140
45165
  getAgentToolCalls(agentPubkey, maxCount) {
45141
45166
  return this.track(
@@ -45165,7 +45190,12 @@ var Atbash = class _Atbash {
45165
45190
  }
45166
45191
  async getOrgTierInfo(orgName) {
45167
45192
  return this.track("getOrgTierInfo", void 0, async () => {
45168
- const raw2 = await this.riskEngineGet("org-tier-info", { org: orgName });
45193
+ const brid = await this.bridForOrg(orgName);
45194
+ const raw2 = await this.riskEngineGet(
45195
+ "org-tier-info",
45196
+ { org: orgName },
45197
+ brid
45198
+ );
45169
45199
  if (!isRecord(raw2)) return null;
45170
45200
  return {
45171
45201
  orgName: String(raw2.org_name ?? ""),
@@ -45177,20 +45207,24 @@ var Atbash = class _Atbash {
45177
45207
  }
45178
45208
  async getPendingHeldActions(orgName, maxCount) {
45179
45209
  return this.track("getPendingHeldActions", void 0, async () => {
45180
- const raw2 = await this.riskEngineGet("pending-held-actions", {
45181
- org: orgName,
45182
- limit: maxCount
45183
- });
45210
+ const brid = await this.bridForOrg(orgName);
45211
+ const raw2 = await this.riskEngineGet(
45212
+ "pending-held-actions",
45213
+ { org: orgName, limit: maxCount },
45214
+ brid
45215
+ );
45184
45216
  if (!Array.isArray(raw2)) return [];
45185
45217
  return raw2.map((item) => toHeldAction(item));
45186
45218
  });
45187
45219
  }
45188
45220
  async getHeldActionReviews(orgName, maxCount) {
45189
45221
  return this.track("getHeldActionReviews", void 0, async () => {
45190
- const raw2 = await this.riskEngineGet("held-action-reviews", {
45191
- org: orgName,
45192
- limit: maxCount
45193
- });
45222
+ const brid = await this.bridForOrg(orgName);
45223
+ const raw2 = await this.riskEngineGet(
45224
+ "held-action-reviews",
45225
+ { org: orgName, limit: maxCount },
45226
+ brid
45227
+ );
45194
45228
  if (!Array.isArray(raw2)) return [];
45195
45229
  return raw2.map(
45196
45230
  (item) => toHeldActionReview(item)
@@ -45201,21 +45235,25 @@ var Atbash = class _Atbash {
45201
45235
  async getAgentDetail(agentPubkey, options = {}) {
45202
45236
  return this.track("getAgentDetail", agentPubkey, async () => {
45203
45237
  const network = await this.resolveAgentLookupNetwork(options);
45238
+ const brid = network ? this.bridFromChainOpts({ network }) : void 0;
45204
45239
  return this.riskEnginePost(
45205
45240
  { action: "agent-detail-batch", agent: agentPubkey },
45206
- network
45241
+ network,
45242
+ brid
45207
45243
  );
45208
45244
  });
45209
45245
  }
45210
45246
  async getAgentPolicy(agentPubkey, options = {}) {
45211
45247
  return this.track("getAgentPolicy", agentPubkey, async () => {
45212
45248
  const network = await this.resolveAgentLookupNetwork(options);
45249
+ const brid = network ? this.bridFromChainOpts({ network }) : void 0;
45213
45250
  const raw2 = await this.riskEnginePost(
45214
45251
  {
45215
45252
  action: "agent-policy-batch",
45216
45253
  agent: agentPubkey
45217
45254
  },
45218
- network
45255
+ network,
45256
+ brid
45219
45257
  );
45220
45258
  return {
45221
45259
  policy: String(raw2.policy ?? ""),
@@ -45249,7 +45287,8 @@ var Atbash = class _Atbash {
45249
45287
  return this.track("getOrgSubscription", void 0, async () => {
45250
45288
  const params = { org: orgName };
45251
45289
  if (network) params.network = network;
45252
- const raw2 = await this.riskEngineGet("org-subscription", params);
45290
+ const brid = network ? this.bridFromChainOpts({ network }) : void 0;
45291
+ const raw2 = await this.riskEngineGet("org-subscription", params, brid);
45253
45292
  if (!isRecord(raw2)) return null;
45254
45293
  return coerceOrgSubscription(raw2, orgName);
45255
45294
  });
@@ -45262,21 +45301,22 @@ var Atbash = class _Atbash {
45262
45301
  * entry (caller falls back to per-chain subscription resolution).
45263
45302
  */
45264
45303
  async getActiveNetworkForOrg(orgName) {
45304
+ let resp;
45265
45305
  try {
45266
- const resp = await this.http.get(
45306
+ resp = await this.http.get(
45267
45307
  "/api/org-network",
45268
- { org: orgName },
45308
+ { org: orgName.trim() },
45269
45309
  this.authHeaders()
45270
45310
  );
45271
- if (resp.status !== 200) return null;
45272
- const data = await this.json(resp);
45273
- if (data?.network === "public" || data?.network === "private") {
45274
- return data.network;
45275
- }
45276
- return null;
45277
- } catch {
45278
- return null;
45311
+ } catch (err) {
45312
+ throw this.transportError(err);
45313
+ }
45314
+ if (resp.status !== 200) throw await this.httpError(resp);
45315
+ const data = await this.json(resp);
45316
+ if (data?.network === "public" || data?.network === "private") {
45317
+ return data.network;
45279
45318
  }
45319
+ return null;
45280
45320
  }
45281
45321
  /**
45282
45322
  * Resolve which chain an org's actions should run against. Cached
@@ -45288,10 +45328,11 @@ var Atbash = class _Atbash {
45288
45328
  * Defaults to the public chain when nothing else resolves.
45289
45329
  */
45290
45330
  async resolveChainForOrg(orgName) {
45291
- const cached = this._chainCache.get(orgName);
45331
+ const name2 = orgName.trim();
45332
+ const cached = this._chainCache.get(name2);
45292
45333
  if (cached) return cached;
45293
- const mapNetwork = await this.getActiveNetworkForOrg(orgName);
45294
- return this.resolveChainFromMap(orgName, mapNetwork);
45334
+ const mapNetwork = await this.getActiveNetworkForOrg(name2);
45335
+ return this.resolveChainFromMap(name2, mapNetwork);
45295
45336
  }
45296
45337
  /**
45297
45338
  * Resolve a chain given an already-fetched `org_networks` map result.
@@ -45307,29 +45348,38 @@ var Atbash = class _Atbash {
45307
45348
  this._chainCache.set(orgName, chain);
45308
45349
  return chain;
45309
45350
  }
45310
- try {
45311
- const [pubSub, privSub] = await Promise.all([
45312
- this.getOrgSubscription(orgName, "public").catch(() => null),
45313
- this.getOrgSubscription(orgName, "private").catch(() => null)
45314
- ]);
45315
- if (pubSub?.is_private_blockchain) {
45316
- this._chainCache.set(orgName, PRIVATE_CHAIN);
45317
- return PRIVATE_CHAIN;
45318
- }
45319
- if (pubSub && privSub) {
45320
- const chain = privSub.assigned_at > pubSub.assigned_at ? PRIVATE_CHAIN : PUBLIC_CHAIN;
45321
- this._chainCache.set(orgName, chain);
45322
- return chain;
45323
- }
45324
- if (pubSub) {
45325
- this._chainCache.set(orgName, PUBLIC_CHAIN);
45326
- return PUBLIC_CHAIN;
45327
- }
45328
- if (privSub?.is_private_blockchain) {
45329
- this._chainCache.set(orgName, PRIVATE_CHAIN);
45330
- return PRIVATE_CHAIN;
45331
- }
45332
- } catch {
45351
+ const [pubRes, privRes] = await Promise.allSettled([
45352
+ this.getOrgSubscription(orgName, "public"),
45353
+ this.getOrgSubscription(orgName, "private")
45354
+ ]);
45355
+ const pubSub = pubRes.status === "fulfilled" ? pubRes.value : null;
45356
+ const privSub = privRes.status === "fulfilled" ? privRes.value : null;
45357
+ const failure = pubRes.status === "rejected" ? pubRes.reason : privRes.status === "rejected" ? privRes.reason : null;
45358
+ if (pubSub?.is_private_blockchain) {
45359
+ this._chainCache.set(orgName, PRIVATE_CHAIN);
45360
+ return PRIVATE_CHAIN;
45361
+ }
45362
+ if (pubSub && privSub) {
45363
+ const chain = privSub.assigned_at > pubSub.assigned_at ? PRIVATE_CHAIN : PUBLIC_CHAIN;
45364
+ this._chainCache.set(orgName, chain);
45365
+ return chain;
45366
+ }
45367
+ if (pubSub) {
45368
+ this._chainCache.set(orgName, PUBLIC_CHAIN);
45369
+ return PUBLIC_CHAIN;
45370
+ }
45371
+ if (privSub?.is_private_blockchain) {
45372
+ this._chainCache.set(orgName, PRIVATE_CHAIN);
45373
+ return PRIVATE_CHAIN;
45374
+ }
45375
+ if (failure) {
45376
+ const detail = failure instanceof Error ? failure.message : String(failure);
45377
+ throw new AtbashAPIError(
45378
+ failure instanceof AtbashAPIError ? failure.status : 0,
45379
+ `could not resolve the chain for org "${orgName}": ${detail}`,
45380
+ "",
45381
+ this.endpoint
45382
+ );
45333
45383
  }
45334
45384
  this._chainCache.set(orgName, PUBLIC_CHAIN);
45335
45385
  return PUBLIC_CHAIN;
@@ -45394,11 +45444,11 @@ var Atbash = class _Atbash {
45394
45444
  * for 4 minutes; refreshed after that so a long-lived client never
45395
45445
  * trips the server's replay window.
45396
45446
  */
45397
- getAuthBearer() {
45447
+ getAuthBearer(brid) {
45448
+ const chainBrid = brid ?? this.blockchainRid;
45398
45449
  const now = Date.now();
45399
- if (this._authBearer && now - this._authBearer.issuedAt < 4 * 60 * 1e3) {
45400
- return this._authBearer.hex;
45401
- }
45450
+ const cached = this._authBearers.get(chainBrid);
45451
+ if (cached && now - cached.issuedAt < 4 * 60 * 1e3) return cached.hex;
45402
45452
  const nonce = `auth-${now.toString(36)}-${randomHex(4)}`;
45403
45453
  const hex = native.signLogToolCall(
45404
45454
  nonce,
@@ -45407,21 +45457,21 @@ var Atbash = class _Atbash {
45407
45457
  "auth-bearer",
45408
45458
  "",
45409
45459
  this.auth.privkey,
45410
- this.blockchainRid
45460
+ chainBrid
45411
45461
  );
45412
- this._authBearer = { hex, issuedAt: now };
45462
+ this._authBearers.set(chainBrid, { hex, issuedAt: now });
45413
45463
  return hex;
45414
45464
  }
45415
- authHeaders() {
45416
- return { Authorization: `Bearer ${this.getAuthBearer()}` };
45465
+ authHeaders(brid) {
45466
+ return { Authorization: `Bearer ${this.getAuthBearer(brid)}` };
45417
45467
  }
45418
- async riskEngineGet(action, params) {
45468
+ async riskEngineGet(action, params, brid) {
45419
45469
  let resp;
45420
45470
  try {
45421
45471
  resp = await this.http.get(
45422
45472
  "/api/risk-engine",
45423
45473
  { action, ...params },
45424
- this.authHeaders()
45474
+ this.authHeaders(brid)
45425
45475
  );
45426
45476
  } catch (err) {
45427
45477
  throw this.transportError(err);
@@ -45429,11 +45479,11 @@ var Atbash = class _Atbash {
45429
45479
  if (resp.status !== 200) throw await this.httpError(resp);
45430
45480
  return this.json(resp);
45431
45481
  }
45432
- async riskEnginePost(body, network) {
45482
+ async riskEnginePost(body, network, brid) {
45433
45483
  let resp;
45434
45484
  try {
45435
45485
  const path4 = network ? `/api/risk-engine?network=${encodeURIComponent(network)}` : "/api/risk-engine";
45436
- resp = await this.http.post(path4, body, this.authHeaders());
45486
+ resp = await this.http.post(path4, body, this.authHeaders(brid));
45437
45487
  } catch (err) {
45438
45488
  throw this.transportError(err);
45439
45489
  }
@@ -45441,11 +45491,23 @@ var Atbash = class _Atbash {
45441
45491
  const data = await this.json(resp);
45442
45492
  return isRecord(data) ? data : {};
45443
45493
  }
45444
- async riskEngineRecords(action, params) {
45445
- const raw2 = await this.riskEngineGet(action, params);
45494
+ async riskEngineRecords(action, params, brid) {
45495
+ const raw2 = await this.riskEngineGet(action, params, brid);
45446
45496
  if (!Array.isArray(raw2)) return [];
45447
45497
  return raw2.map((item) => toToolCallRecord(item));
45448
45498
  }
45499
+ /**
45500
+ * BRID for an org — one round-trip to the map, honoring the client's chain
45501
+ * cache. Returns undefined when the org is unknown, so the caller falls
45502
+ * back to the client default (best-effort discovery).
45503
+ */
45504
+ async bridForOrg(orgName) {
45505
+ try {
45506
+ return (await this.resolveChainForOrg(orgName)).blockchainRid;
45507
+ } catch {
45508
+ return void 0;
45509
+ }
45510
+ }
45449
45511
  async raiseIfError(resp) {
45450
45512
  if (resp.ok) return;
45451
45513
  throw await this.httpError(resp);
@@ -45811,11 +45873,11 @@ async function commitMemoryVersion(_plaintext, _auth, _opts) {
45811
45873
  async function getActiveMemoryId(_auth, _chainOpts) {
45812
45874
  throw new Error(`getActiveMemoryId ${STUB_MSG3}`);
45813
45875
  }
45814
- async function getActiveMemory(_auth, _chainOpts) {
45815
- throw new Error(`getActiveMemory ${STUB_MSG3}`);
45876
+ async function getRecentAgentMemory(_auth, _chainOpts) {
45877
+ throw new Error(`getRecentAgentMemory ${STUB_MSG3}`);
45816
45878
  }
45817
- async function getAllAgentMemory(_auth, _chainOpts) {
45818
- throw new Error(`getAllAgentMemory ${STUB_MSG3}`);
45879
+ async function getActiveAgentMemory(_auth, _chainOpts) {
45880
+ throw new Error(`getActiveAgentMemory ${STUB_MSG3}`);
45819
45881
  }
45820
45882
  async function getMemoryHistory(_auth, _chainOpts) {
45821
45883
  throw new Error(`getMemoryHistory ${STUB_MSG3}`);
@@ -45894,8 +45956,7 @@ async function guardMemoryWrite(input) {
45894
45956
  toolNames,
45895
45957
  enforce = true,
45896
45958
  debug: debug2 = false,
45897
- logger: logger2,
45898
- memoryFilePath
45959
+ logger: logger2
45899
45960
  } = input;
45900
45961
  const memEntry = classifyMemoryWrite(event, ctx, { patterns, toolNames });
45901
45962
  if (debug2) emitDebugProbe(event, ctx, memEntry, logger2);
@@ -45931,37 +45992,35 @@ async function guardMemoryWrite(input) {
45931
45992
  committed: false
45932
45993
  };
45933
45994
  }
45934
- const isManagedMemoryFile = memoryFilePath !== void 0 && path3.resolve(memEntry.key) === path3.resolve(memoryFilePath);
45935
- if (isManagedMemoryFile) {
45936
- commitMemoryVersion(memEntry.value, auth, {
45937
- score: scanResult.score,
45938
- orgName,
45939
- endpoint
45940
- }).catch((err) => {
45941
- const reason = err instanceof Error ? err.message : String(err);
45942
- logger2?.warn?.("[atbash] memory commit to chain failed", {
45943
- path: memEntry.key,
45944
- reason
45945
- });
45995
+ const filePath = path3.basename(memEntry.key);
45996
+ commitMemoryVersion(memEntry.value, auth, {
45997
+ score: scanResult.score,
45998
+ filePath,
45999
+ orgName,
46000
+ endpoint,
46001
+ verifyPubKey
46002
+ }).catch((err) => {
46003
+ const reason = err instanceof Error ? err.message : String(err);
46004
+ logger2?.warn?.("[atbash] memory commit to chain failed", {
46005
+ path: memEntry.key,
46006
+ filePath,
46007
+ reason
45946
46008
  });
45947
- } else {
45948
- logger2?.info?.(
45949
- "[atbash] scanned but not committed \u2014 not the managed memory file",
45950
- {
45951
- path: memEntry.key,
45952
- memoryFilePath: memoryFilePath ?? "(not configured)"
45953
- }
45954
- );
45955
- }
46009
+ });
45956
46010
  logger2?.info?.(
45957
46011
  scanResult.verdict === "yellow" ? "[atbash] memory HOLD" : "[atbash] memory ALLOW",
45958
- { path: memEntry.key, score: scanResult.score, reason: scanResult.reason }
46012
+ {
46013
+ path: memEntry.key,
46014
+ filePath,
46015
+ score: scanResult.score,
46016
+ reason: scanResult.reason
46017
+ }
45959
46018
  );
45960
46019
  return {
45961
46020
  handled: true,
45962
46021
  decision: { allow: true },
45963
46022
  scanResult,
45964
- committed: isManagedMemoryFile
46023
+ committed: true
45965
46024
  };
45966
46025
  }
45967
46026
 
@@ -46168,13 +46227,13 @@ export {
46168
46227
  encryptedLength,
46169
46228
  flushTelemetry,
46170
46229
  generateKeypair2 as generateKeypair,
46171
- getActiveMemory,
46230
+ getActiveAgentMemory,
46172
46231
  getActiveMemoryId,
46173
- getAllAgentMemory,
46174
46232
  getConfigDir,
46175
46233
  getConfigPath,
46176
46234
  getMemoryById,
46177
46235
  getMemoryHistory,
46236
+ getRecentAgentMemory,
46178
46237
  getRollbackHistory,
46179
46238
  guardMemoryWrite,
46180
46239
  isEnvelope,