@atbash/sdk 0.13.0-dev.0 → 0.13.2-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/index.mjs CHANGED
@@ -4346,15 +4346,16 @@ var Atbash = class _Atbash {
4346
4346
  }
4347
4347
  /**
4348
4348
  * BRID for an org — one round-trip to the map, honoring the client's chain
4349
- * cache. Returns undefined when the org is unknown, so the caller falls
4350
- * back to the client default (best-effort discovery).
4349
+ * cache. A "brand-new org" (nothing anywhere names its chain) is not an
4350
+ * error — `resolveChainForOrg` returns the client default for that case and
4351
+ * this helper returns its BRID. A transport failure or non-200 from
4352
+ * `/api/org-network` IS an error and propagates: the caller cannot fall
4353
+ * back to the default chain on outage, because with multi-chain live that
4354
+ * silently reads from the wrong chain. Matches the Python binding's
4355
+ * `_brid_for_org` semantics.
4351
4356
  */
4352
4357
  async bridForOrg(orgName) {
4353
- try {
4354
- return (await this.resolveChainForOrg(orgName)).blockchainRid;
4355
- } catch {
4356
- return void 0;
4357
- }
4358
+ return (await this.resolveChainForOrg(orgName)).blockchainRid;
4358
4359
  }
4359
4360
  /**
4360
4361
  * BRID for the client's configured default org, if it has one.
@@ -4648,21 +4649,26 @@ async function scanMemory(entry, auth, opts) {
4648
4649
  }
4649
4650
  const KNOWN_ACTIONS = ["allow", "block", "hold_for_user_confirm"];
4650
4651
  const action = result.actionType.trim().toLowerCase();
4651
- if (result.verdict !== "No verdict" && !KNOWN_ACTIONS.includes(action)) {
4652
+ if (result.verdict !== "No verdict" && action !== "" && !KNOWN_ACTIONS.includes(action)) {
4652
4653
  throw new Error(
4653
- `memory scan: unrecognized action_type from judge (${result.actionType || "absent"})`
4654
+ `memory scan: unrecognized action_type from judge (${result.actionType})`
4654
4655
  );
4655
4656
  }
4656
- const mapped = native.mapVerdict(
4657
- action,
4658
- result.confidence,
4659
- threshold
4660
- );
4661
- let verdict = mapped;
4662
- if (result.verdict === "BLOCK") {
4663
- verdict = "red";
4664
- } else if (result.verdict === "HOLD" && mapped === "green") {
4665
- verdict = "yellow";
4657
+ let verdict;
4658
+ if (action === "") {
4659
+ verdict = result.verdict === "BLOCK" ? "red" : result.verdict === "HOLD" ? "yellow" : "green";
4660
+ } else {
4661
+ const mapped = native.mapVerdict(
4662
+ action,
4663
+ result.confidence,
4664
+ threshold
4665
+ );
4666
+ verdict = mapped;
4667
+ if (result.verdict === "BLOCK") {
4668
+ verdict = "red";
4669
+ } else if (result.verdict === "HOLD" && mapped === "green") {
4670
+ verdict = "yellow";
4671
+ }
4666
4672
  }
4667
4673
  const parsed = native.parseScoreFromReason(result.reason);
4668
4674
  const score = result.score ?? parsed.score ?? native.defaultScoreForVerdict(verdict);