@atbash/sdk 0.13.0-dev.0 → 0.13.3-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.d.mts +7 -2
- package/dist/browser.mjs +8 -7
- package/dist/browser.mjs.map +1 -1
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +36 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -5
package/dist/index.d.mts
CHANGED
|
@@ -649,8 +649,13 @@ declare class Atbash {
|
|
|
649
649
|
private riskEngineRecords;
|
|
650
650
|
/**
|
|
651
651
|
* BRID for an org — one round-trip to the map, honoring the client's chain
|
|
652
|
-
* cache.
|
|
653
|
-
*
|
|
652
|
+
* cache. A "brand-new org" (nothing anywhere names its chain) is not an
|
|
653
|
+
* error — `resolveChainForOrg` returns the client default for that case and
|
|
654
|
+
* this helper returns its BRID. A transport failure or non-200 from
|
|
655
|
+
* `/api/org-network` IS an error and propagates: the caller cannot fall
|
|
656
|
+
* back to the default chain on outage, because with multi-chain live that
|
|
657
|
+
* silently reads from the wrong chain. Matches the Python binding's
|
|
658
|
+
* `_brid_for_org` semantics.
|
|
654
659
|
*/
|
|
655
660
|
private bridForOrg;
|
|
656
661
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -649,8 +649,13 @@ declare class Atbash {
|
|
|
649
649
|
private riskEngineRecords;
|
|
650
650
|
/**
|
|
651
651
|
* BRID for an org — one round-trip to the map, honoring the client's chain
|
|
652
|
-
* cache.
|
|
653
|
-
*
|
|
652
|
+
* cache. A "brand-new org" (nothing anywhere names its chain) is not an
|
|
653
|
+
* error — `resolveChainForOrg` returns the client default for that case and
|
|
654
|
+
* this helper returns its BRID. A transport failure or non-200 from
|
|
655
|
+
* `/api/org-network` IS an error and propagates: the caller cannot fall
|
|
656
|
+
* back to the default chain on outage, because with multi-chain live that
|
|
657
|
+
* silently reads from the wrong chain. Matches the Python binding's
|
|
658
|
+
* `_brid_for_org` semantics.
|
|
654
659
|
*/
|
|
655
660
|
private bridForOrg;
|
|
656
661
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4430,15 +4430,16 @@ var Atbash = class _Atbash {
|
|
|
4430
4430
|
}
|
|
4431
4431
|
/**
|
|
4432
4432
|
* BRID for an org — one round-trip to the map, honoring the client's chain
|
|
4433
|
-
* cache.
|
|
4434
|
-
*
|
|
4433
|
+
* cache. A "brand-new org" (nothing anywhere names its chain) is not an
|
|
4434
|
+
* error — `resolveChainForOrg` returns the client default for that case and
|
|
4435
|
+
* this helper returns its BRID. A transport failure or non-200 from
|
|
4436
|
+
* `/api/org-network` IS an error and propagates: the caller cannot fall
|
|
4437
|
+
* back to the default chain on outage, because with multi-chain live that
|
|
4438
|
+
* silently reads from the wrong chain. Matches the Python binding's
|
|
4439
|
+
* `_brid_for_org` semantics.
|
|
4435
4440
|
*/
|
|
4436
4441
|
async bridForOrg(orgName) {
|
|
4437
|
-
|
|
4438
|
-
return (await this.resolveChainForOrg(orgName)).blockchainRid;
|
|
4439
|
-
} catch {
|
|
4440
|
-
return void 0;
|
|
4441
|
-
}
|
|
4442
|
+
return (await this.resolveChainForOrg(orgName)).blockchainRid;
|
|
4442
4443
|
}
|
|
4443
4444
|
/**
|
|
4444
4445
|
* BRID for the client's configured default org, if it has one.
|
|
@@ -4732,21 +4733,26 @@ async function scanMemory(entry, auth, opts) {
|
|
|
4732
4733
|
}
|
|
4733
4734
|
const KNOWN_ACTIONS = ["allow", "block", "hold_for_user_confirm"];
|
|
4734
4735
|
const action = result.actionType.trim().toLowerCase();
|
|
4735
|
-
if (result.verdict !== "No verdict" && !KNOWN_ACTIONS.includes(action)) {
|
|
4736
|
+
if (result.verdict !== "No verdict" && action !== "" && !KNOWN_ACTIONS.includes(action)) {
|
|
4736
4737
|
throw new Error(
|
|
4737
|
-
`memory scan: unrecognized action_type from judge (${result.actionType
|
|
4738
|
+
`memory scan: unrecognized action_type from judge (${result.actionType})`
|
|
4738
4739
|
);
|
|
4739
4740
|
}
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
result.
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
verdict =
|
|
4741
|
+
let verdict;
|
|
4742
|
+
if (action === "") {
|
|
4743
|
+
verdict = result.verdict === "BLOCK" ? "red" : result.verdict === "HOLD" ? "yellow" : "green";
|
|
4744
|
+
} else {
|
|
4745
|
+
const mapped = native.mapVerdict(
|
|
4746
|
+
action,
|
|
4747
|
+
result.confidence,
|
|
4748
|
+
threshold
|
|
4749
|
+
);
|
|
4750
|
+
verdict = mapped;
|
|
4751
|
+
if (result.verdict === "BLOCK") {
|
|
4752
|
+
verdict = "red";
|
|
4753
|
+
} else if (result.verdict === "HOLD" && mapped === "green") {
|
|
4754
|
+
verdict = "yellow";
|
|
4755
|
+
}
|
|
4750
4756
|
}
|
|
4751
4757
|
const parsed = native.parseScoreFromReason(result.reason);
|
|
4752
4758
|
const score = result.score ?? parsed.score ?? native.defaultScoreForVerdict(verdict);
|
|
@@ -43088,11 +43094,20 @@ async function rollbackMemory(toId, reason, auth, opts) {
|
|
|
43088
43094
|
);
|
|
43089
43095
|
}
|
|
43090
43096
|
|
|
43097
|
+
// src-ts/memory/_json_safe.ts
|
|
43098
|
+
function toJsonSafe(value) {
|
|
43099
|
+
try {
|
|
43100
|
+
return JSON.parse(JSON.stringify(value ?? null));
|
|
43101
|
+
} catch {
|
|
43102
|
+
return null;
|
|
43103
|
+
}
|
|
43104
|
+
}
|
|
43105
|
+
|
|
43091
43106
|
// src-ts/memory/classifier.ts
|
|
43092
43107
|
var DEFAULT_MEMORY_WRITE_TOOL_NAMES = native.defaultMemoryWriteToolNames();
|
|
43093
43108
|
var DEFAULT_MEMORY_PATH_PATTERNS = native.defaultMemoryPathPatterns();
|
|
43094
43109
|
function classifyMemoryWrite(event, ctx, opts = {}) {
|
|
43095
|
-
return native.classifyMemoryWrite(event, ctx, {
|
|
43110
|
+
return native.classifyMemoryWrite(toJsonSafe(event), toJsonSafe(ctx), {
|
|
43096
43111
|
patterns: opts.patterns ? [...opts.patterns] : void 0,
|
|
43097
43112
|
toolNames: opts.toolNames ? [...opts.toolNames] : void 0
|
|
43098
43113
|
});
|
|
@@ -43330,7 +43345,7 @@ function defaultPluginLogPath(workspaceDir = process.cwd()) {
|
|
|
43330
43345
|
// src-ts/memory/read-classifier.ts
|
|
43331
43346
|
var DEFAULT_MEMORY_READ_TOOL_NAMES = native.defaultMemoryReadToolNames();
|
|
43332
43347
|
function classifyMemoryRead(event, ctx, opts = {}) {
|
|
43333
|
-
return native.classifyMemoryRead(event, ctx, {
|
|
43348
|
+
return native.classifyMemoryRead(toJsonSafe(event), toJsonSafe(ctx), {
|
|
43334
43349
|
readToolNames: opts.readToolNames ? [...opts.readToolNames] : void 0,
|
|
43335
43350
|
patterns: opts.patterns ? [...opts.patterns] : void 0,
|
|
43336
43351
|
genericReadToolNames: opts.genericReadToolNames ? [...opts.genericReadToolNames] : void 0
|