@atbash/sdk 0.19.0-dev.0 → 0.19.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/README.md +1 -0
- package/dist/browser.d.mts +0 -10
- package/dist/browser.mjs +25 -12
- package/dist/index.d.mts +0 -10
- package/dist/index.d.ts +0 -10
- package/dist/index.js +54 -21
- package/dist/index.mjs +54 -21
- package/index.js +54 -54
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -211,6 +211,7 @@ below is the whole of it.
|
|
|
211
211
|
| `error.class` | `AtbashAPIError` |
|
|
212
212
|
| `error.status` / `error.path` | `404`, `/api/v1/judge` — the route, never its query string |
|
|
213
213
|
| `sdk.version` | `0.18.0` |
|
|
214
|
+
| `sdk.language` | `node`, `python` — which binding sent it |
|
|
214
215
|
| `chain` | the blockchain RID — public infrastructure, and it names no customer |
|
|
215
216
|
| `agent.hash` | SHA-256 of the agent's **public** key, never the key itself |
|
|
216
217
|
| `source` | `sdk`, `cli`, `plugin:openclaw` |
|
package/dist/browser.d.mts
CHANGED
|
@@ -1780,16 +1780,6 @@ interface OperationEvent {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
/** Hashes an agent key for emission. Supplied by `setupTelemetry`. */
|
|
1782
1782
|
type AgentKeyHasher = (pubkeyHex: string) => string;
|
|
1783
|
-
/**
|
|
1784
|
-
* Point this module at a logger, or at nothing.
|
|
1785
|
-
*
|
|
1786
|
-
* Called by `setupTelemetry` once the shared exporter exists, so events and
|
|
1787
|
-
* counters travel the same authenticated route and share one opt-out decision.
|
|
1788
|
-
*
|
|
1789
|
-
* @param next - Logger to emit through, or null to disable.
|
|
1790
|
-
* @param opts - Version and source stamped on every event, and the hasher
|
|
1791
|
-
* applied to the agent key. Without a hasher, the agent field is dropped.
|
|
1792
|
-
*/
|
|
1793
1783
|
declare function configureEvents(next: Logger | null, opts?: {
|
|
1794
1784
|
version?: string;
|
|
1795
1785
|
source?: string;
|
package/dist/browser.mjs
CHANGED
|
@@ -44625,9 +44625,19 @@ init_define_ATBASH_PRIVATE_NODE_URLS();
|
|
|
44625
44625
|
// src-ts/normalize.ts
|
|
44626
44626
|
init_define_ATBASH_CHROMIA_NODE_URLS();
|
|
44627
44627
|
init_define_ATBASH_PRIVATE_NODE_URLS();
|
|
44628
|
+
function wireText(raw2, fallback = "") {
|
|
44629
|
+
if (raw2 === null || raw2 === void 0) return fallback;
|
|
44630
|
+
if (typeof raw2 === "object" || typeof raw2 === "function") return fallback;
|
|
44631
|
+
return String(raw2);
|
|
44632
|
+
}
|
|
44633
|
+
function wireNumber(raw2, fallback = 0) {
|
|
44634
|
+
if (raw2 === null || raw2 === void 0) return fallback;
|
|
44635
|
+
if (typeof raw2 === "object" || typeof raw2 === "function") return fallback;
|
|
44636
|
+
return Number(raw2);
|
|
44637
|
+
}
|
|
44628
44638
|
function normalizeVerdict(raw2) {
|
|
44629
44639
|
if (raw2 === null || raw2 === void 0) return "No verdict";
|
|
44630
|
-
const v =
|
|
44640
|
+
const v = wireText(raw2).trim().toUpperCase();
|
|
44631
44641
|
if (v === "ALLOW" || v === "GREEN") return "ALLOW";
|
|
44632
44642
|
if (v === "HOLD" || v === "YELLOW") return "HOLD";
|
|
44633
44643
|
if (v === "BLOCK" || v === "RED") return "BLOCK";
|
|
@@ -44637,7 +44647,7 @@ function normalizeActionType(raw2) {
|
|
|
44637
44647
|
return typeof raw2 === "string" ? raw2.trim().toLowerCase() : "";
|
|
44638
44648
|
}
|
|
44639
44649
|
function normalizeStatus(raw2) {
|
|
44640
|
-
const s2 =
|
|
44650
|
+
const s2 = wireText(raw2).toLowerCase();
|
|
44641
44651
|
if (s2 === "pending" || s2 === "answered" || s2 === "error") return s2;
|
|
44642
44652
|
return "error";
|
|
44643
44653
|
}
|
|
@@ -44738,11 +44748,12 @@ function eventsOptedOut() {
|
|
|
44738
44748
|
const flag = process.env.ATBASH_TELEMETRY_EVENTS_DISABLED?.trim().toLowerCase();
|
|
44739
44749
|
return Boolean(flag && ["1", "true", "yes", "on"].includes(flag));
|
|
44740
44750
|
}
|
|
44751
|
+
var SOURCE_SHAPE = /^(?:sdk|cli|plugin:[a-z0-9][a-z0-9._-]{0,31})$/;
|
|
44741
44752
|
function configureEvents(next, opts = {}) {
|
|
44742
44753
|
logger2 = next;
|
|
44743
44754
|
eventsEnabled = next !== null && !eventsOptedOut();
|
|
44744
44755
|
if (opts.version) sdkVersion = opts.version;
|
|
44745
|
-
if (opts.source) eventSource = opts.source;
|
|
44756
|
+
if (opts.source && SOURCE_SHAPE.test(opts.source)) eventSource = opts.source;
|
|
44746
44757
|
hashAgentKey = opts.hashAgentKey ?? null;
|
|
44747
44758
|
}
|
|
44748
44759
|
function eventsAreOn() {
|
|
@@ -45314,15 +45325,15 @@ config.json still holds an "agentKey" (${identity}), but a settings file no long
|
|
|
45314
45325
|
verdict: normalizeVerdict(data.verdict),
|
|
45315
45326
|
allow: this.executable(data),
|
|
45316
45327
|
actionType: normalizeActionType(data.action_type),
|
|
45317
|
-
reason:
|
|
45318
|
-
confidence:
|
|
45319
|
-
provider:
|
|
45320
|
-
latencyMs:
|
|
45321
|
-
toolCallId:
|
|
45328
|
+
reason: wireText(data.reason),
|
|
45329
|
+
confidence: wireNumber(data.confidence),
|
|
45330
|
+
provider: wireText(data.provider),
|
|
45331
|
+
latencyMs: wireNumber(data.latency_ms),
|
|
45332
|
+
toolCallId: wireText(data.tool_call_id, logResult.toolCallId),
|
|
45322
45333
|
onChain: Boolean(data.on_chain),
|
|
45323
45334
|
enforced: Boolean(data.enforced),
|
|
45324
|
-
enforcementMode:
|
|
45325
|
-
status:
|
|
45335
|
+
enforcementMode: wireText(data.enforcement_mode),
|
|
45336
|
+
status: wireText(data.status),
|
|
45326
45337
|
score,
|
|
45327
45338
|
refusal: explicitRefusal(data)
|
|
45328
45339
|
};
|
|
@@ -45546,8 +45557,8 @@ config.json still holds an "agentKey" (${identity}), but a settings file no long
|
|
|
45546
45557
|
status: normalizeStatus(data.status),
|
|
45547
45558
|
verdict: normalizeVerdict(data.verdict),
|
|
45548
45559
|
allow: this.executable(data),
|
|
45549
|
-
reason:
|
|
45550
|
-
judgmentId:
|
|
45560
|
+
reason: wireText(data.reason),
|
|
45561
|
+
judgmentId: wireText(data.judgmentId, judgmentId),
|
|
45551
45562
|
onChain: optBool(data.onChain),
|
|
45552
45563
|
cached: optBool(data.cached),
|
|
45553
45564
|
responseTimeMs: optNumber(data.responseTimeMs)
|
|
@@ -46154,10 +46165,12 @@ function isRecord2(v) {
|
|
|
46154
46165
|
}
|
|
46155
46166
|
function optString(v) {
|
|
46156
46167
|
if (v === null || v === void 0) return void 0;
|
|
46168
|
+
if (typeof v === "object" || typeof v === "function") return void 0;
|
|
46157
46169
|
return typeof v === "string" ? v : String(v);
|
|
46158
46170
|
}
|
|
46159
46171
|
function optNumber(v) {
|
|
46160
46172
|
if (v === null || v === void 0) return void 0;
|
|
46173
|
+
if (typeof v === "object" || typeof v === "function") return void 0;
|
|
46161
46174
|
const n = Number(v);
|
|
46162
46175
|
return Number.isFinite(n) ? n : void 0;
|
|
46163
46176
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1780,16 +1780,6 @@ interface OperationEvent {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
/** Hashes an agent key for emission. Supplied by `setupTelemetry`. */
|
|
1782
1782
|
type AgentKeyHasher = (pubkeyHex: string) => string;
|
|
1783
|
-
/**
|
|
1784
|
-
* Point this module at a logger, or at nothing.
|
|
1785
|
-
*
|
|
1786
|
-
* Called by `setupTelemetry` once the shared exporter exists, so events and
|
|
1787
|
-
* counters travel the same authenticated route and share one opt-out decision.
|
|
1788
|
-
*
|
|
1789
|
-
* @param next - Logger to emit through, or null to disable.
|
|
1790
|
-
* @param opts - Version and source stamped on every event, and the hasher
|
|
1791
|
-
* applied to the agent key. Without a hasher, the agent field is dropped.
|
|
1792
|
-
*/
|
|
1793
1783
|
declare function configureEvents(next: Logger | null, opts?: {
|
|
1794
1784
|
version?: string;
|
|
1795
1785
|
source?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1780,16 +1780,6 @@ interface OperationEvent {
|
|
|
1780
1780
|
}
|
|
1781
1781
|
/** Hashes an agent key for emission. Supplied by `setupTelemetry`. */
|
|
1782
1782
|
type AgentKeyHasher = (pubkeyHex: string) => string;
|
|
1783
|
-
/**
|
|
1784
|
-
* Point this module at a logger, or at nothing.
|
|
1785
|
-
*
|
|
1786
|
-
* Called by `setupTelemetry` once the shared exporter exists, so events and
|
|
1787
|
-
* counters travel the same authenticated route and share one opt-out decision.
|
|
1788
|
-
*
|
|
1789
|
-
* @param next - Logger to emit through, or null to disable.
|
|
1790
|
-
* @param opts - Version and source stamped on every event, and the hasher
|
|
1791
|
-
* applied to the agent key. Without a hasher, the agent field is dropped.
|
|
1792
|
-
*/
|
|
1793
1783
|
declare function configureEvents(next: Logger | null, opts?: {
|
|
1794
1784
|
version?: string;
|
|
1795
1785
|
source?: string;
|
package/dist/index.js
CHANGED
|
@@ -501,9 +501,19 @@ function loadAgentFromFile(keyPath) {
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
// src-ts/normalize.ts
|
|
504
|
+
function wireText(raw, fallback = "") {
|
|
505
|
+
if (raw === null || raw === void 0) return fallback;
|
|
506
|
+
if (typeof raw === "object" || typeof raw === "function") return fallback;
|
|
507
|
+
return String(raw);
|
|
508
|
+
}
|
|
509
|
+
function wireNumber(raw, fallback = 0) {
|
|
510
|
+
if (raw === null || raw === void 0) return fallback;
|
|
511
|
+
if (typeof raw === "object" || typeof raw === "function") return fallback;
|
|
512
|
+
return Number(raw);
|
|
513
|
+
}
|
|
504
514
|
function normalizeVerdict(raw) {
|
|
505
515
|
if (raw === null || raw === void 0) return "No verdict";
|
|
506
|
-
const v =
|
|
516
|
+
const v = wireText(raw).trim().toUpperCase();
|
|
507
517
|
if (v === "ALLOW" || v === "GREEN") return "ALLOW";
|
|
508
518
|
if (v === "HOLD" || v === "YELLOW") return "HOLD";
|
|
509
519
|
if (v === "BLOCK" || v === "RED") return "BLOCK";
|
|
@@ -513,7 +523,7 @@ function normalizeActionType(raw) {
|
|
|
513
523
|
return typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
514
524
|
}
|
|
515
525
|
function normalizeStatus(raw) {
|
|
516
|
-
const s =
|
|
526
|
+
const s = wireText(raw).toLowerCase();
|
|
517
527
|
if (s === "pending" || s === "answered" || s === "error") return s;
|
|
518
528
|
return "error";
|
|
519
529
|
}
|
|
@@ -612,11 +622,12 @@ function eventsOptedOut() {
|
|
|
612
622
|
const flag = process.env.ATBASH_TELEMETRY_EVENTS_DISABLED?.trim().toLowerCase();
|
|
613
623
|
return Boolean(flag && ["1", "true", "yes", "on"].includes(flag));
|
|
614
624
|
}
|
|
625
|
+
var SOURCE_SHAPE = /^(?:sdk|cli|plugin:[a-z0-9][a-z0-9._-]{0,31})$/;
|
|
615
626
|
function configureEvents(next, opts = {}) {
|
|
616
627
|
logger = next;
|
|
617
628
|
eventsEnabled = next !== null && !eventsOptedOut();
|
|
618
629
|
if (opts.version) sdkVersion = opts.version;
|
|
619
|
-
if (opts.source) eventSource = opts.source;
|
|
630
|
+
if (opts.source && SOURCE_SHAPE.test(opts.source)) eventSource = opts.source;
|
|
620
631
|
hashAgentKey = opts.hashAgentKey ?? null;
|
|
621
632
|
}
|
|
622
633
|
function eventsAreOn() {
|
|
@@ -663,6 +674,20 @@ var import_sdk_metrics = require("@opentelemetry/sdk-metrics");
|
|
|
663
674
|
var import_exporter_logs_otlp_http = require("@opentelemetry/exporter-logs-otlp-http");
|
|
664
675
|
var import_sdk_logs = require("@opentelemetry/sdk-logs");
|
|
665
676
|
var import_node_crypto = require("crypto");
|
|
677
|
+
var SDK_VERSION = true ? "0.19.2-dev.0" : "";
|
|
678
|
+
var SDK_LANGUAGE = "node";
|
|
679
|
+
function sdkResourceAttributes() {
|
|
680
|
+
const attrs = {
|
|
681
|
+
"service.name": "atbash-sdk",
|
|
682
|
+
"sdk.language": SDK_LANGUAGE
|
|
683
|
+
};
|
|
684
|
+
if (SDK_VERSION) attrs["sdk.version"] = SDK_VERSION;
|
|
685
|
+
return attrs;
|
|
686
|
+
}
|
|
687
|
+
function sourceOrDefault(candidate) {
|
|
688
|
+
return typeof candidate === "string" && SOURCE_SHAPE.test(candidate) ? candidate : defaultSource;
|
|
689
|
+
}
|
|
690
|
+
var exitHookInstalled = false;
|
|
666
691
|
var meterProvider = null;
|
|
667
692
|
var loggerProvider = null;
|
|
668
693
|
var callCounter = null;
|
|
@@ -729,7 +754,7 @@ function customCollector() {
|
|
|
729
754
|
function setupTelemetry(config) {
|
|
730
755
|
if (!config.enabled) return;
|
|
731
756
|
if (isTelemetryOptedOut()) return;
|
|
732
|
-
if (config.source && !sourceExplicitlySet) {
|
|
757
|
+
if (config.source && !sourceExplicitlySet && SOURCE_SHAPE.test(config.source)) {
|
|
733
758
|
defaultSource = config.source;
|
|
734
759
|
sourceExplicitlySet = true;
|
|
735
760
|
}
|
|
@@ -769,9 +794,7 @@ function setupTelemetry(config) {
|
|
|
769
794
|
exportIntervalMillis: requestedExportIntervalMs ?? 6e4
|
|
770
795
|
});
|
|
771
796
|
meterProvider = new import_sdk_metrics.MeterProvider({
|
|
772
|
-
resource: (0, import_resources.resourceFromAttributes)(
|
|
773
|
-
"service.name": "atbash-sdk"
|
|
774
|
-
}),
|
|
797
|
+
resource: (0, import_resources.resourceFromAttributes)(sdkResourceAttributes()),
|
|
775
798
|
readers: [reader]
|
|
776
799
|
});
|
|
777
800
|
const meter = meterProvider.getMeter("atbash-sdk");
|
|
@@ -790,12 +813,20 @@ function setupTelemetry(config) {
|
|
|
790
813
|
headers: async () => destination.headers()
|
|
791
814
|
});
|
|
792
815
|
loggerProvider = new import_sdk_logs.LoggerProvider({
|
|
793
|
-
resource: (0, import_resources.resourceFromAttributes)(
|
|
816
|
+
resource: (0, import_resources.resourceFromAttributes)(sdkResourceAttributes()),
|
|
794
817
|
processors: [new import_sdk_logs.BatchLogRecordProcessor({ exporter: logExporter })]
|
|
795
818
|
});
|
|
819
|
+
if (!exitHookInstalled && typeof process?.once === "function") {
|
|
820
|
+
exitHookInstalled = true;
|
|
821
|
+
process.once("beforeExit", () => {
|
|
822
|
+
shutdownTelemetry().catch(() => {
|
|
823
|
+
});
|
|
824
|
+
});
|
|
825
|
+
}
|
|
796
826
|
configureEvents(loggerProvider.getLogger("atbash-sdk"), {
|
|
797
|
-
source: config.source
|
|
798
|
-
hashAgentKey: config.hashAgentKey ?? defaultAgentKeyHasher
|
|
827
|
+
source: sourceOrDefault(config.source),
|
|
828
|
+
hashAgentKey: config.hashAgentKey ?? defaultAgentKeyHasher,
|
|
829
|
+
version: SDK_VERSION
|
|
799
830
|
});
|
|
800
831
|
}
|
|
801
832
|
function recordCall(functionName, source, agentPubkey) {
|
|
@@ -803,7 +834,7 @@ function recordCall(functionName, source, agentPubkey) {
|
|
|
803
834
|
if (!callCounter) return;
|
|
804
835
|
callCounter.add(1, {
|
|
805
836
|
"function.name": functionName,
|
|
806
|
-
source: source
|
|
837
|
+
source: sourceOrDefault(source),
|
|
807
838
|
// Hashed on this path too. The counters and the events export to the same
|
|
808
839
|
// place in the same request, so a raw key here would make hashing it on
|
|
809
840
|
// the event beside it pointless.
|
|
@@ -815,7 +846,7 @@ function recordDuration(functionName, durationMs, status, source) {
|
|
|
815
846
|
durationHistogram.record(durationMs, {
|
|
816
847
|
"function.name": functionName,
|
|
817
848
|
status,
|
|
818
|
-
source: source
|
|
849
|
+
source: sourceOrDefault(source)
|
|
819
850
|
});
|
|
820
851
|
}
|
|
821
852
|
async function flushTelemetry() {
|
|
@@ -1398,15 +1429,15 @@ config.json still holds an "agentKey" (${identity}), but a settings file no long
|
|
|
1398
1429
|
verdict: normalizeVerdict(data.verdict),
|
|
1399
1430
|
allow: this.executable(data),
|
|
1400
1431
|
actionType: normalizeActionType(data.action_type),
|
|
1401
|
-
reason:
|
|
1402
|
-
confidence:
|
|
1403
|
-
provider:
|
|
1404
|
-
latencyMs:
|
|
1405
|
-
toolCallId:
|
|
1432
|
+
reason: wireText(data.reason),
|
|
1433
|
+
confidence: wireNumber(data.confidence),
|
|
1434
|
+
provider: wireText(data.provider),
|
|
1435
|
+
latencyMs: wireNumber(data.latency_ms),
|
|
1436
|
+
toolCallId: wireText(data.tool_call_id, logResult.toolCallId),
|
|
1406
1437
|
onChain: Boolean(data.on_chain),
|
|
1407
1438
|
enforced: Boolean(data.enforced),
|
|
1408
|
-
enforcementMode:
|
|
1409
|
-
status:
|
|
1439
|
+
enforcementMode: wireText(data.enforcement_mode),
|
|
1440
|
+
status: wireText(data.status),
|
|
1410
1441
|
score,
|
|
1411
1442
|
refusal: explicitRefusal(data)
|
|
1412
1443
|
};
|
|
@@ -1630,8 +1661,8 @@ config.json still holds an "agentKey" (${identity}), but a settings file no long
|
|
|
1630
1661
|
status: normalizeStatus(data.status),
|
|
1631
1662
|
verdict: normalizeVerdict(data.verdict),
|
|
1632
1663
|
allow: this.executable(data),
|
|
1633
|
-
reason:
|
|
1634
|
-
judgmentId:
|
|
1664
|
+
reason: wireText(data.reason),
|
|
1665
|
+
judgmentId: wireText(data.judgmentId, judgmentId),
|
|
1635
1666
|
onChain: optBool(data.onChain),
|
|
1636
1667
|
cached: optBool(data.cached),
|
|
1637
1668
|
responseTimeMs: optNumber(data.responseTimeMs)
|
|
@@ -2238,10 +2269,12 @@ function isRecord2(v) {
|
|
|
2238
2269
|
}
|
|
2239
2270
|
function optString(v) {
|
|
2240
2271
|
if (v === null || v === void 0) return void 0;
|
|
2272
|
+
if (typeof v === "object" || typeof v === "function") return void 0;
|
|
2241
2273
|
return typeof v === "string" ? v : String(v);
|
|
2242
2274
|
}
|
|
2243
2275
|
function optNumber(v) {
|
|
2244
2276
|
if (v === null || v === void 0) return void 0;
|
|
2277
|
+
if (typeof v === "object" || typeof v === "function") return void 0;
|
|
2245
2278
|
const n = Number(v);
|
|
2246
2279
|
return Number.isFinite(n) ? n : void 0;
|
|
2247
2280
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -374,9 +374,19 @@ function loadAgentFromFile(keyPath) {
|
|
|
374
374
|
}
|
|
375
375
|
|
|
376
376
|
// src-ts/normalize.ts
|
|
377
|
+
function wireText(raw, fallback = "") {
|
|
378
|
+
if (raw === null || raw === void 0) return fallback;
|
|
379
|
+
if (typeof raw === "object" || typeof raw === "function") return fallback;
|
|
380
|
+
return String(raw);
|
|
381
|
+
}
|
|
382
|
+
function wireNumber(raw, fallback = 0) {
|
|
383
|
+
if (raw === null || raw === void 0) return fallback;
|
|
384
|
+
if (typeof raw === "object" || typeof raw === "function") return fallback;
|
|
385
|
+
return Number(raw);
|
|
386
|
+
}
|
|
377
387
|
function normalizeVerdict(raw) {
|
|
378
388
|
if (raw === null || raw === void 0) return "No verdict";
|
|
379
|
-
const v =
|
|
389
|
+
const v = wireText(raw).trim().toUpperCase();
|
|
380
390
|
if (v === "ALLOW" || v === "GREEN") return "ALLOW";
|
|
381
391
|
if (v === "HOLD" || v === "YELLOW") return "HOLD";
|
|
382
392
|
if (v === "BLOCK" || v === "RED") return "BLOCK";
|
|
@@ -386,7 +396,7 @@ function normalizeActionType(raw) {
|
|
|
386
396
|
return typeof raw === "string" ? raw.trim().toLowerCase() : "";
|
|
387
397
|
}
|
|
388
398
|
function normalizeStatus(raw) {
|
|
389
|
-
const s =
|
|
399
|
+
const s = wireText(raw).toLowerCase();
|
|
390
400
|
if (s === "pending" || s === "answered" || s === "error") return s;
|
|
391
401
|
return "error";
|
|
392
402
|
}
|
|
@@ -485,11 +495,12 @@ function eventsOptedOut() {
|
|
|
485
495
|
const flag = process.env.ATBASH_TELEMETRY_EVENTS_DISABLED?.trim().toLowerCase();
|
|
486
496
|
return Boolean(flag && ["1", "true", "yes", "on"].includes(flag));
|
|
487
497
|
}
|
|
498
|
+
var SOURCE_SHAPE = /^(?:sdk|cli|plugin:[a-z0-9][a-z0-9._-]{0,31})$/;
|
|
488
499
|
function configureEvents(next, opts = {}) {
|
|
489
500
|
logger = next;
|
|
490
501
|
eventsEnabled = next !== null && !eventsOptedOut();
|
|
491
502
|
if (opts.version) sdkVersion = opts.version;
|
|
492
|
-
if (opts.source) eventSource = opts.source;
|
|
503
|
+
if (opts.source && SOURCE_SHAPE.test(opts.source)) eventSource = opts.source;
|
|
493
504
|
hashAgentKey = opts.hashAgentKey ?? null;
|
|
494
505
|
}
|
|
495
506
|
function eventsAreOn() {
|
|
@@ -542,6 +553,20 @@ import {
|
|
|
542
553
|
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
543
554
|
import { BatchLogRecordProcessor, LoggerProvider } from "@opentelemetry/sdk-logs";
|
|
544
555
|
import { createHash } from "crypto";
|
|
556
|
+
var SDK_VERSION = true ? "0.19.2-dev.0" : "";
|
|
557
|
+
var SDK_LANGUAGE = "node";
|
|
558
|
+
function sdkResourceAttributes() {
|
|
559
|
+
const attrs = {
|
|
560
|
+
"service.name": "atbash-sdk",
|
|
561
|
+
"sdk.language": SDK_LANGUAGE
|
|
562
|
+
};
|
|
563
|
+
if (SDK_VERSION) attrs["sdk.version"] = SDK_VERSION;
|
|
564
|
+
return attrs;
|
|
565
|
+
}
|
|
566
|
+
function sourceOrDefault(candidate) {
|
|
567
|
+
return typeof candidate === "string" && SOURCE_SHAPE.test(candidate) ? candidate : defaultSource;
|
|
568
|
+
}
|
|
569
|
+
var exitHookInstalled = false;
|
|
545
570
|
var meterProvider = null;
|
|
546
571
|
var loggerProvider = null;
|
|
547
572
|
var callCounter = null;
|
|
@@ -608,7 +633,7 @@ function customCollector() {
|
|
|
608
633
|
function setupTelemetry(config) {
|
|
609
634
|
if (!config.enabled) return;
|
|
610
635
|
if (isTelemetryOptedOut()) return;
|
|
611
|
-
if (config.source && !sourceExplicitlySet) {
|
|
636
|
+
if (config.source && !sourceExplicitlySet && SOURCE_SHAPE.test(config.source)) {
|
|
612
637
|
defaultSource = config.source;
|
|
613
638
|
sourceExplicitlySet = true;
|
|
614
639
|
}
|
|
@@ -648,9 +673,7 @@ function setupTelemetry(config) {
|
|
|
648
673
|
exportIntervalMillis: requestedExportIntervalMs ?? 6e4
|
|
649
674
|
});
|
|
650
675
|
meterProvider = new MeterProvider({
|
|
651
|
-
resource: resourceFromAttributes(
|
|
652
|
-
"service.name": "atbash-sdk"
|
|
653
|
-
}),
|
|
676
|
+
resource: resourceFromAttributes(sdkResourceAttributes()),
|
|
654
677
|
readers: [reader]
|
|
655
678
|
});
|
|
656
679
|
const meter = meterProvider.getMeter("atbash-sdk");
|
|
@@ -669,12 +692,20 @@ function setupTelemetry(config) {
|
|
|
669
692
|
headers: async () => destination.headers()
|
|
670
693
|
});
|
|
671
694
|
loggerProvider = new LoggerProvider({
|
|
672
|
-
resource: resourceFromAttributes(
|
|
695
|
+
resource: resourceFromAttributes(sdkResourceAttributes()),
|
|
673
696
|
processors: [new BatchLogRecordProcessor({ exporter: logExporter })]
|
|
674
697
|
});
|
|
698
|
+
if (!exitHookInstalled && typeof process?.once === "function") {
|
|
699
|
+
exitHookInstalled = true;
|
|
700
|
+
process.once("beforeExit", () => {
|
|
701
|
+
shutdownTelemetry().catch(() => {
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
}
|
|
675
705
|
configureEvents(loggerProvider.getLogger("atbash-sdk"), {
|
|
676
|
-
source: config.source
|
|
677
|
-
hashAgentKey: config.hashAgentKey ?? defaultAgentKeyHasher
|
|
706
|
+
source: sourceOrDefault(config.source),
|
|
707
|
+
hashAgentKey: config.hashAgentKey ?? defaultAgentKeyHasher,
|
|
708
|
+
version: SDK_VERSION
|
|
678
709
|
});
|
|
679
710
|
}
|
|
680
711
|
function recordCall(functionName, source, agentPubkey) {
|
|
@@ -682,7 +713,7 @@ function recordCall(functionName, source, agentPubkey) {
|
|
|
682
713
|
if (!callCounter) return;
|
|
683
714
|
callCounter.add(1, {
|
|
684
715
|
"function.name": functionName,
|
|
685
|
-
source: source
|
|
716
|
+
source: sourceOrDefault(source),
|
|
686
717
|
// Hashed on this path too. The counters and the events export to the same
|
|
687
718
|
// place in the same request, so a raw key here would make hashing it on
|
|
688
719
|
// the event beside it pointless.
|
|
@@ -694,7 +725,7 @@ function recordDuration(functionName, durationMs, status, source) {
|
|
|
694
725
|
durationHistogram.record(durationMs, {
|
|
695
726
|
"function.name": functionName,
|
|
696
727
|
status,
|
|
697
|
-
source: source
|
|
728
|
+
source: sourceOrDefault(source)
|
|
698
729
|
});
|
|
699
730
|
}
|
|
700
731
|
async function flushTelemetry() {
|
|
@@ -1283,15 +1314,15 @@ config.json still holds an "agentKey" (${identity}), but a settings file no long
|
|
|
1283
1314
|
verdict: normalizeVerdict(data.verdict),
|
|
1284
1315
|
allow: this.executable(data),
|
|
1285
1316
|
actionType: normalizeActionType(data.action_type),
|
|
1286
|
-
reason:
|
|
1287
|
-
confidence:
|
|
1288
|
-
provider:
|
|
1289
|
-
latencyMs:
|
|
1290
|
-
toolCallId:
|
|
1317
|
+
reason: wireText(data.reason),
|
|
1318
|
+
confidence: wireNumber(data.confidence),
|
|
1319
|
+
provider: wireText(data.provider),
|
|
1320
|
+
latencyMs: wireNumber(data.latency_ms),
|
|
1321
|
+
toolCallId: wireText(data.tool_call_id, logResult.toolCallId),
|
|
1291
1322
|
onChain: Boolean(data.on_chain),
|
|
1292
1323
|
enforced: Boolean(data.enforced),
|
|
1293
|
-
enforcementMode:
|
|
1294
|
-
status:
|
|
1324
|
+
enforcementMode: wireText(data.enforcement_mode),
|
|
1325
|
+
status: wireText(data.status),
|
|
1295
1326
|
score,
|
|
1296
1327
|
refusal: explicitRefusal(data)
|
|
1297
1328
|
};
|
|
@@ -1515,8 +1546,8 @@ config.json still holds an "agentKey" (${identity}), but a settings file no long
|
|
|
1515
1546
|
status: normalizeStatus(data.status),
|
|
1516
1547
|
verdict: normalizeVerdict(data.verdict),
|
|
1517
1548
|
allow: this.executable(data),
|
|
1518
|
-
reason:
|
|
1519
|
-
judgmentId:
|
|
1549
|
+
reason: wireText(data.reason),
|
|
1550
|
+
judgmentId: wireText(data.judgmentId, judgmentId),
|
|
1520
1551
|
onChain: optBool(data.onChain),
|
|
1521
1552
|
cached: optBool(data.cached),
|
|
1522
1553
|
responseTimeMs: optNumber(data.responseTimeMs)
|
|
@@ -2123,10 +2154,12 @@ function isRecord2(v) {
|
|
|
2123
2154
|
}
|
|
2124
2155
|
function optString(v) {
|
|
2125
2156
|
if (v === null || v === void 0) return void 0;
|
|
2157
|
+
if (typeof v === "object" || typeof v === "function") return void 0;
|
|
2126
2158
|
return typeof v === "string" ? v : String(v);
|
|
2127
2159
|
}
|
|
2128
2160
|
function optNumber(v) {
|
|
2129
2161
|
if (v === null || v === void 0) return void 0;
|
|
2162
|
+
if (typeof v === "object" || typeof v === "function") return void 0;
|
|
2130
2163
|
const n = Number(v);
|
|
2131
2164
|
return Number.isFinite(n) ? n : void 0;
|
|
2132
2165
|
}
|
package/index.js
CHANGED
|
@@ -89,8 +89,8 @@ function requireNative() {
|
|
|
89
89
|
try {
|
|
90
90
|
const binding = require('@atbash/sdk-android-arm64')
|
|
91
91
|
const bindingPackageVersion = require('@atbash/sdk-android-arm64/package.json').version
|
|
92
|
-
if (bindingPackageVersion !== '0.
|
|
93
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
92
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
93
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
94
94
|
}
|
|
95
95
|
return binding
|
|
96
96
|
} catch (e) {
|
|
@@ -105,8 +105,8 @@ function requireNative() {
|
|
|
105
105
|
try {
|
|
106
106
|
const binding = require('@atbash/sdk-android-arm-eabi')
|
|
107
107
|
const bindingPackageVersion = require('@atbash/sdk-android-arm-eabi/package.json').version
|
|
108
|
-
if (bindingPackageVersion !== '0.
|
|
109
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
108
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
109
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
110
110
|
}
|
|
111
111
|
return binding
|
|
112
112
|
} catch (e) {
|
|
@@ -126,8 +126,8 @@ function requireNative() {
|
|
|
126
126
|
try {
|
|
127
127
|
const binding = require('@atbash/sdk-win32-x64-gnu')
|
|
128
128
|
const bindingPackageVersion = require('@atbash/sdk-win32-x64-gnu/package.json').version
|
|
129
|
-
if (bindingPackageVersion !== '0.
|
|
130
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
129
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
130
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
131
131
|
}
|
|
132
132
|
return binding
|
|
133
133
|
} catch (e) {
|
|
@@ -142,8 +142,8 @@ function requireNative() {
|
|
|
142
142
|
try {
|
|
143
143
|
const binding = require('@atbash/sdk-win32-x64-msvc')
|
|
144
144
|
const bindingPackageVersion = require('@atbash/sdk-win32-x64-msvc/package.json').version
|
|
145
|
-
if (bindingPackageVersion !== '0.
|
|
146
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
145
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
146
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
147
147
|
}
|
|
148
148
|
return binding
|
|
149
149
|
} catch (e) {
|
|
@@ -159,8 +159,8 @@ function requireNative() {
|
|
|
159
159
|
try {
|
|
160
160
|
const binding = require('@atbash/sdk-win32-ia32-msvc')
|
|
161
161
|
const bindingPackageVersion = require('@atbash/sdk-win32-ia32-msvc/package.json').version
|
|
162
|
-
if (bindingPackageVersion !== '0.
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
162
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
163
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
164
164
|
}
|
|
165
165
|
return binding
|
|
166
166
|
} catch (e) {
|
|
@@ -175,8 +175,8 @@ function requireNative() {
|
|
|
175
175
|
try {
|
|
176
176
|
const binding = require('@atbash/sdk-win32-arm64-msvc')
|
|
177
177
|
const bindingPackageVersion = require('@atbash/sdk-win32-arm64-msvc/package.json').version
|
|
178
|
-
if (bindingPackageVersion !== '0.
|
|
179
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
178
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
179
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
180
180
|
}
|
|
181
181
|
return binding
|
|
182
182
|
} catch (e) {
|
|
@@ -194,8 +194,8 @@ function requireNative() {
|
|
|
194
194
|
try {
|
|
195
195
|
const binding = require('@atbash/sdk-darwin-universal')
|
|
196
196
|
const bindingPackageVersion = require('@atbash/sdk-darwin-universal/package.json').version
|
|
197
|
-
if (bindingPackageVersion !== '0.
|
|
198
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
197
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
198
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
199
199
|
}
|
|
200
200
|
return binding
|
|
201
201
|
} catch (e) {
|
|
@@ -210,8 +210,8 @@ function requireNative() {
|
|
|
210
210
|
try {
|
|
211
211
|
const binding = require('@atbash/sdk-darwin-x64')
|
|
212
212
|
const bindingPackageVersion = require('@atbash/sdk-darwin-x64/package.json').version
|
|
213
|
-
if (bindingPackageVersion !== '0.
|
|
214
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
213
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
214
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
215
215
|
}
|
|
216
216
|
return binding
|
|
217
217
|
} catch (e) {
|
|
@@ -226,8 +226,8 @@ function requireNative() {
|
|
|
226
226
|
try {
|
|
227
227
|
const binding = require('@atbash/sdk-darwin-arm64')
|
|
228
228
|
const bindingPackageVersion = require('@atbash/sdk-darwin-arm64/package.json').version
|
|
229
|
-
if (bindingPackageVersion !== '0.
|
|
230
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
229
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
230
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
231
231
|
}
|
|
232
232
|
return binding
|
|
233
233
|
} catch (e) {
|
|
@@ -246,8 +246,8 @@ function requireNative() {
|
|
|
246
246
|
try {
|
|
247
247
|
const binding = require('@atbash/sdk-freebsd-x64')
|
|
248
248
|
const bindingPackageVersion = require('@atbash/sdk-freebsd-x64/package.json').version
|
|
249
|
-
if (bindingPackageVersion !== '0.
|
|
250
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
249
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
250
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
251
251
|
}
|
|
252
252
|
return binding
|
|
253
253
|
} catch (e) {
|
|
@@ -262,8 +262,8 @@ function requireNative() {
|
|
|
262
262
|
try {
|
|
263
263
|
const binding = require('@atbash/sdk-freebsd-arm64')
|
|
264
264
|
const bindingPackageVersion = require('@atbash/sdk-freebsd-arm64/package.json').version
|
|
265
|
-
if (bindingPackageVersion !== '0.
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
265
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
266
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
267
267
|
}
|
|
268
268
|
return binding
|
|
269
269
|
} catch (e) {
|
|
@@ -283,8 +283,8 @@ function requireNative() {
|
|
|
283
283
|
try {
|
|
284
284
|
const binding = require('@atbash/sdk-linux-x64-musl')
|
|
285
285
|
const bindingPackageVersion = require('@atbash/sdk-linux-x64-musl/package.json').version
|
|
286
|
-
if (bindingPackageVersion !== '0.
|
|
287
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
286
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
287
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
288
288
|
}
|
|
289
289
|
return binding
|
|
290
290
|
} catch (e) {
|
|
@@ -299,8 +299,8 @@ function requireNative() {
|
|
|
299
299
|
try {
|
|
300
300
|
const binding = require('@atbash/sdk-linux-x64-gnu')
|
|
301
301
|
const bindingPackageVersion = require('@atbash/sdk-linux-x64-gnu/package.json').version
|
|
302
|
-
if (bindingPackageVersion !== '0.
|
|
303
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
302
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
303
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
304
304
|
}
|
|
305
305
|
return binding
|
|
306
306
|
} catch (e) {
|
|
@@ -317,8 +317,8 @@ function requireNative() {
|
|
|
317
317
|
try {
|
|
318
318
|
const binding = require('@atbash/sdk-linux-arm64-musl')
|
|
319
319
|
const bindingPackageVersion = require('@atbash/sdk-linux-arm64-musl/package.json').version
|
|
320
|
-
if (bindingPackageVersion !== '0.
|
|
321
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
320
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
321
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
322
322
|
}
|
|
323
323
|
return binding
|
|
324
324
|
} catch (e) {
|
|
@@ -333,8 +333,8 @@ function requireNative() {
|
|
|
333
333
|
try {
|
|
334
334
|
const binding = require('@atbash/sdk-linux-arm64-gnu')
|
|
335
335
|
const bindingPackageVersion = require('@atbash/sdk-linux-arm64-gnu/package.json').version
|
|
336
|
-
if (bindingPackageVersion !== '0.
|
|
337
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
336
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
337
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
338
338
|
}
|
|
339
339
|
return binding
|
|
340
340
|
} catch (e) {
|
|
@@ -351,8 +351,8 @@ function requireNative() {
|
|
|
351
351
|
try {
|
|
352
352
|
const binding = require('@atbash/sdk-linux-arm-musleabihf')
|
|
353
353
|
const bindingPackageVersion = require('@atbash/sdk-linux-arm-musleabihf/package.json').version
|
|
354
|
-
if (bindingPackageVersion !== '0.
|
|
355
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
354
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
355
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
356
356
|
}
|
|
357
357
|
return binding
|
|
358
358
|
} catch (e) {
|
|
@@ -367,8 +367,8 @@ function requireNative() {
|
|
|
367
367
|
try {
|
|
368
368
|
const binding = require('@atbash/sdk-linux-arm-gnueabihf')
|
|
369
369
|
const bindingPackageVersion = require('@atbash/sdk-linux-arm-gnueabihf/package.json').version
|
|
370
|
-
if (bindingPackageVersion !== '0.
|
|
371
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
370
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
371
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
372
372
|
}
|
|
373
373
|
return binding
|
|
374
374
|
} catch (e) {
|
|
@@ -385,8 +385,8 @@ function requireNative() {
|
|
|
385
385
|
try {
|
|
386
386
|
const binding = require('@atbash/sdk-linux-loong64-musl')
|
|
387
387
|
const bindingPackageVersion = require('@atbash/sdk-linux-loong64-musl/package.json').version
|
|
388
|
-
if (bindingPackageVersion !== '0.
|
|
389
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
388
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
389
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
390
390
|
}
|
|
391
391
|
return binding
|
|
392
392
|
} catch (e) {
|
|
@@ -401,8 +401,8 @@ function requireNative() {
|
|
|
401
401
|
try {
|
|
402
402
|
const binding = require('@atbash/sdk-linux-loong64-gnu')
|
|
403
403
|
const bindingPackageVersion = require('@atbash/sdk-linux-loong64-gnu/package.json').version
|
|
404
|
-
if (bindingPackageVersion !== '0.
|
|
405
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
404
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
405
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
406
406
|
}
|
|
407
407
|
return binding
|
|
408
408
|
} catch (e) {
|
|
@@ -419,8 +419,8 @@ function requireNative() {
|
|
|
419
419
|
try {
|
|
420
420
|
const binding = require('@atbash/sdk-linux-riscv64-musl')
|
|
421
421
|
const bindingPackageVersion = require('@atbash/sdk-linux-riscv64-musl/package.json').version
|
|
422
|
-
if (bindingPackageVersion !== '0.
|
|
423
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
422
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
423
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
424
424
|
}
|
|
425
425
|
return binding
|
|
426
426
|
} catch (e) {
|
|
@@ -435,8 +435,8 @@ function requireNative() {
|
|
|
435
435
|
try {
|
|
436
436
|
const binding = require('@atbash/sdk-linux-riscv64-gnu')
|
|
437
437
|
const bindingPackageVersion = require('@atbash/sdk-linux-riscv64-gnu/package.json').version
|
|
438
|
-
if (bindingPackageVersion !== '0.
|
|
439
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
438
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
439
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
440
440
|
}
|
|
441
441
|
return binding
|
|
442
442
|
} catch (e) {
|
|
@@ -452,8 +452,8 @@ function requireNative() {
|
|
|
452
452
|
try {
|
|
453
453
|
const binding = require('@atbash/sdk-linux-ppc64-gnu')
|
|
454
454
|
const bindingPackageVersion = require('@atbash/sdk-linux-ppc64-gnu/package.json').version
|
|
455
|
-
if (bindingPackageVersion !== '0.
|
|
456
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
455
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
456
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
457
457
|
}
|
|
458
458
|
return binding
|
|
459
459
|
} catch (e) {
|
|
@@ -468,8 +468,8 @@ function requireNative() {
|
|
|
468
468
|
try {
|
|
469
469
|
const binding = require('@atbash/sdk-linux-s390x-gnu')
|
|
470
470
|
const bindingPackageVersion = require('@atbash/sdk-linux-s390x-gnu/package.json').version
|
|
471
|
-
if (bindingPackageVersion !== '0.
|
|
472
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
471
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
472
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
473
473
|
}
|
|
474
474
|
return binding
|
|
475
475
|
} catch (e) {
|
|
@@ -488,8 +488,8 @@ function requireNative() {
|
|
|
488
488
|
try {
|
|
489
489
|
const binding = require('@atbash/sdk-openharmony-arm64')
|
|
490
490
|
const bindingPackageVersion = require('@atbash/sdk-openharmony-arm64/package.json').version
|
|
491
|
-
if (bindingPackageVersion !== '0.
|
|
492
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
491
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
492
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
493
493
|
}
|
|
494
494
|
return binding
|
|
495
495
|
} catch (e) {
|
|
@@ -504,8 +504,8 @@ function requireNative() {
|
|
|
504
504
|
try {
|
|
505
505
|
const binding = require('@atbash/sdk-openharmony-x64')
|
|
506
506
|
const bindingPackageVersion = require('@atbash/sdk-openharmony-x64/package.json').version
|
|
507
|
-
if (bindingPackageVersion !== '0.
|
|
508
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
507
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
508
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
509
509
|
}
|
|
510
510
|
return binding
|
|
511
511
|
} catch (e) {
|
|
@@ -520,8 +520,8 @@ function requireNative() {
|
|
|
520
520
|
try {
|
|
521
521
|
const binding = require('@atbash/sdk-openharmony-arm')
|
|
522
522
|
const bindingPackageVersion = require('@atbash/sdk-openharmony-arm/package.json').version
|
|
523
|
-
if (bindingPackageVersion !== '0.
|
|
524
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
523
|
+
if (bindingPackageVersion !== '0.19.2-dev.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
524
|
+
throw new Error(`Native binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
525
525
|
}
|
|
526
526
|
return binding
|
|
527
527
|
} catch (e) {
|
|
@@ -661,8 +661,8 @@ if (!nativeBinding || forceWasi) {
|
|
|
661
661
|
if (!candidateFailed) {
|
|
662
662
|
if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
663
663
|
const bindingPackageVersion = require('@atbash/sdk-wasm32-wasi/package.json').version
|
|
664
|
-
if (bindingPackageVersion !== '0.
|
|
665
|
-
throw new Error(`WASI binding package version mismatch, expected 0.
|
|
664
|
+
if (bindingPackageVersion !== '0.19.2-dev.0') {
|
|
665
|
+
throw new Error(`WASI binding package version mismatch, expected 0.19.2-dev.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
668
|
wasiBinding = require('@atbash/sdk-wasm32-wasi')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atbash/sdk",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.2-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",
|
|
@@ -95,10 +95,10 @@
|
|
|
95
95
|
"typescript-eslint": "^8.62.1"
|
|
96
96
|
},
|
|
97
97
|
"optionalDependencies": {
|
|
98
|
-
"@atbash/sdk-linux-x64-gnu": "0.19.
|
|
99
|
-
"@atbash/sdk-linux-arm64-gnu": "0.19.
|
|
100
|
-
"@atbash/sdk-linux-x64-musl": "0.19.
|
|
101
|
-
"@atbash/sdk-darwin-arm64": "0.19.
|
|
102
|
-
"@atbash/sdk-win32-x64-msvc": "0.19.
|
|
98
|
+
"@atbash/sdk-linux-x64-gnu": "0.19.2-dev.0",
|
|
99
|
+
"@atbash/sdk-linux-arm64-gnu": "0.19.2-dev.0",
|
|
100
|
+
"@atbash/sdk-linux-x64-musl": "0.19.2-dev.0",
|
|
101
|
+
"@atbash/sdk-darwin-arm64": "0.19.2-dev.0",
|
|
102
|
+
"@atbash/sdk-win32-x64-msvc": "0.19.2-dev.0"
|
|
103
103
|
}
|
|
104
104
|
}
|