@nekzus/liop 2.5.0 → 2.6.1
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/NOTICE +19 -0
- package/README.md +67 -34
- package/dist/bin/agent.js +673 -82
- package/dist/bin/agent.js.map +1 -1
- package/dist/bridge.d.ts +3 -3
- package/dist/bridge.js +3 -3
- package/dist/{chunk-PYKRQAER.js → chunk-2KSO3W4A.js} +2 -2
- package/dist/chunk-2KSO3W4A.js.map +1 -0
- package/dist/{chunk-32ADSAJS.js → chunk-2STZHJ24.js} +14 -4
- package/dist/chunk-2STZHJ24.js.map +1 -0
- package/dist/chunk-3QH44NKZ.js +115 -0
- package/dist/chunk-3QH44NKZ.js.map +1 -0
- package/dist/{chunk-WCCGE4QR.js → chunk-5SWHE62F.js} +196 -33
- package/dist/chunk-5SWHE62F.js.map +1 -0
- package/dist/{chunk-SONUORBT.js → chunk-7BSCUYUE.js} +2 -2
- package/dist/chunk-7BSCUYUE.js.map +1 -0
- package/dist/{chunk-QLCOEP5J.js → chunk-7PITYWOV.js} +2 -2
- package/dist/chunk-7PITYWOV.js.map +1 -0
- package/dist/{chunk-T5IUZF47.js → chunk-EJ426URA.js} +109 -7
- package/dist/chunk-EJ426URA.js.map +1 -0
- package/dist/{chunk-CRZBVFDV.js → chunk-FCFTYOAS.js} +243 -66
- package/dist/chunk-FCFTYOAS.js.map +1 -0
- package/dist/chunk-FTF6AMF6.js +3 -0
- package/dist/{chunk-RWRRBYG4.js.map → chunk-FTF6AMF6.js.map} +1 -1
- package/dist/{chunk-OUUTDSOW.js → chunk-IK7CGWAZ.js} +3 -3
- package/dist/chunk-IK7CGWAZ.js.map +1 -0
- package/dist/chunk-K3DGJLUY.js +106 -0
- package/dist/chunk-K3DGJLUY.js.map +1 -0
- package/dist/{chunk-U5BZ66VX.js → chunk-PAICJCKJ.js} +60 -175
- package/dist/chunk-PAICJCKJ.js.map +1 -0
- package/dist/chunk-PUDETPL4.js +279 -0
- package/dist/chunk-PUDETPL4.js.map +1 -0
- package/dist/{chunk-547TYL27.js → chunk-UJFWPRDM.js} +164 -1389
- package/dist/chunk-UJFWPRDM.js.map +1 -0
- package/dist/chunk-VRB5HUYU.js +1492 -0
- package/dist/chunk-VRB5HUYU.js.map +1 -0
- package/dist/{chunk-GA3Q2S7O.js → chunk-VRDZ5IKE.js} +5 -5
- package/dist/chunk-VRDZ5IKE.js.map +1 -0
- package/dist/chunk-WPTOJYN5.js +181 -0
- package/dist/chunk-WPTOJYN5.js.map +1 -0
- package/dist/{chunk-74CISO2I.js → chunk-XRDN232O.js} +28 -4
- package/dist/chunk-XRDN232O.js.map +1 -0
- package/dist/{chunk-JIJPZFR2.js → chunk-Y62GORQF.js} +2 -2
- package/dist/chunk-Y62GORQF.js.map +1 -0
- package/dist/chunk-ZP3VVXOI.js +66 -0
- package/dist/chunk-ZP3VVXOI.js.map +1 -0
- package/dist/client.d.ts +4 -3
- package/dist/client.js +10 -8
- package/dist/gateway.d.ts +4 -4
- package/dist/gateway.js +10 -9
- package/dist/{hybrid-CF__0YnC.d.ts → hybrid-DWe1bMoV.d.ts} +5 -4
- package/dist/{index-cMV0_yD9.d.ts → index-BuEQtBHD.d.ts} +39 -34
- package/dist/{index-BW95kAL4.d.ts → index-CdW8j8Bn.d.ts} +9 -72
- package/dist/index.d.ts +172 -48
- package/dist/index.js +20 -15
- package/dist/index.js.map +1 -1
- package/dist/kyber-CGOA7Q6A.js +3 -0
- package/dist/{kyber-3ULIJSE3.js.map → kyber-CGOA7Q6A.js.map} +1 -1
- package/dist/mesh.d.ts +27 -143
- package/dist/mesh.js +4 -3
- package/dist/node-B0b2vUFS.d.ts +164 -0
- package/dist/protocol/liop_core.proto +3 -0
- package/dist/server.d.ts +3 -3
- package/dist/server.js +7 -6
- package/dist/types-CzRSOlOo.d.ts +452 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/verifier-XFU7ZB2W.js +6 -0
- package/dist/{verifier-3FAKCFNN.js.map → verifier-XFU7ZB2W.js.map} +1 -1
- package/dist/workers/logic-execution.js +3 -3
- package/dist/workers/logic-execution.js.map +1 -1
- package/dist/workers/zk-verifier.js +1 -1
- package/dist/workers/zk-verifier.js.map +1 -1
- package/package.json +50 -44
- package/dist/chunk-32ADSAJS.js.map +0 -1
- package/dist/chunk-547TYL27.js.map +0 -1
- package/dist/chunk-72MNYFR6.js +0 -64
- package/dist/chunk-72MNYFR6.js.map +0 -1
- package/dist/chunk-74CISO2I.js.map +0 -1
- package/dist/chunk-CRZBVFDV.js.map +0 -1
- package/dist/chunk-GA3Q2S7O.js.map +0 -1
- package/dist/chunk-JIJPZFR2.js.map +0 -1
- package/dist/chunk-OUUTDSOW.js.map +0 -1
- package/dist/chunk-PYKRQAER.js.map +0 -1
- package/dist/chunk-QLCOEP5J.js.map +0 -1
- package/dist/chunk-RWRRBYG4.js +0 -3
- package/dist/chunk-SONUORBT.js.map +0 -1
- package/dist/chunk-T5IUZF47.js.map +0 -1
- package/dist/chunk-U5BZ66VX.js.map +0 -1
- package/dist/chunk-WCCGE4QR.js.map +0 -1
- package/dist/chunk-WSW6YJNY.js +0 -168
- package/dist/chunk-WSW6YJNY.js.map +0 -1
- package/dist/kyber-3ULIJSE3.js +0 -3
- package/dist/types-lJIxBlWF.d.ts +0 -256
- package/dist/verifier-3FAKCFNN.js +0 -5
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { sanitizeOutput } from './chunk-
|
|
2
|
-
import { LIOP_SCOPES, Dilithium65Wrapper, authorizeRequest
|
|
3
|
-
import { GRPC_CHANNEL_OPTIONS, liopV1, createServerCredentials } from './chunk-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { sanitizeOutput } from './chunk-Y62GORQF.js';
|
|
2
|
+
import { LIOP_SCOPES, Dilithium65Wrapper, authorizeRequest } from './chunk-WPTOJYN5.js';
|
|
3
|
+
import { GRPC_CHANNEL_OPTIONS, liopV1, createServerCredentials, TokenTelemetryEngine } from './chunk-UJFWPRDM.js';
|
|
4
|
+
import { egressBlocksTotal, toolCallsTotal, fuelConsumed, wireEgressBytesTotal, wireSavedBytesTotal, toolCallErrorsTotal } from './chunk-PAICJCKJ.js';
|
|
5
|
+
import { MeshNode } from './chunk-XRDN232O.js';
|
|
6
|
+
import { log } from './chunk-K3DGJLUY.js';
|
|
6
7
|
import { Buffer } from 'buffer';
|
|
7
8
|
import * as crypto3 from 'crypto';
|
|
8
9
|
import crypto3__default from 'crypto';
|
|
@@ -93,12 +94,23 @@ var AuditLogger = class {
|
|
|
93
94
|
entries = [];
|
|
94
95
|
lastEntryHash = GENESIS_HASH;
|
|
95
96
|
filePath;
|
|
97
|
+
interceptor;
|
|
96
98
|
constructor(filePath) {
|
|
97
99
|
this.filePath = filePath;
|
|
98
100
|
if (this.filePath && fs2.existsSync(this.filePath)) {
|
|
99
101
|
this.loadFromFile(this.filePath);
|
|
100
102
|
}
|
|
101
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Registers a technology-agnostic audit interceptor.
|
|
106
|
+
* The interceptor fires AFTER the entry is sealed (hash computed)
|
|
107
|
+
* and appended to the chain. It receives a frozen deep-clone
|
|
108
|
+
* that cannot tamper with the hash chain.
|
|
109
|
+
* Pass `undefined` to disable interception (zero overhead).
|
|
110
|
+
*/
|
|
111
|
+
setInterceptor(interceptor) {
|
|
112
|
+
this.interceptor = interceptor;
|
|
113
|
+
}
|
|
102
114
|
recordExecution(params) {
|
|
103
115
|
const id = crypto3.randomUUID();
|
|
104
116
|
const timestamp = params.timestamp || (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -135,6 +147,17 @@ var AuditLogger = class {
|
|
|
135
147
|
"utf8"
|
|
136
148
|
);
|
|
137
149
|
}
|
|
150
|
+
if (this.interceptor) {
|
|
151
|
+
const frozenClone = Object.freeze(structuredClone(fullEntry));
|
|
152
|
+
try {
|
|
153
|
+
const result = this.interceptor(frozenClone);
|
|
154
|
+
if (result && typeof result === "object" && "catch" in result) {
|
|
155
|
+
result.catch(() => {
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
} catch {
|
|
159
|
+
}
|
|
160
|
+
}
|
|
138
161
|
return fullEntry;
|
|
139
162
|
}
|
|
140
163
|
getEntries() {
|
|
@@ -279,7 +302,9 @@ var JwtValidator = class {
|
|
|
279
302
|
"127.0.0.1:13000",
|
|
280
303
|
"localhost:13000",
|
|
281
304
|
"127.0.0.1:13001",
|
|
282
|
-
"localhost:13001"
|
|
305
|
+
"localhost:13001",
|
|
306
|
+
"127.0.0.1:15000",
|
|
307
|
+
"localhost:15000"
|
|
283
308
|
];
|
|
284
309
|
let issuerAuthority = "";
|
|
285
310
|
try {
|
|
@@ -481,6 +506,7 @@ var TaintAnalyzer = class _TaintAnalyzer {
|
|
|
481
506
|
]);
|
|
482
507
|
/** Reduce-family methods where the record param is the SECOND callback arg */
|
|
483
508
|
static REDUCE_METHODS = /* @__PURE__ */ new Set(["reduce", "reduceRight"]);
|
|
509
|
+
currentRecordCollections = /* @__PURE__ */ new Set();
|
|
484
510
|
constructor(piiFields, sensitiveKeys = []) {
|
|
485
511
|
this.piiFields = new Set(piiFields.map((f) => f.toLowerCase()));
|
|
486
512
|
this.sensitiveKeys = new Set(sensitiveKeys.map((f) => f.toLowerCase()));
|
|
@@ -652,6 +678,47 @@ ${sourceCode}
|
|
|
652
678
|
}
|
|
653
679
|
return false;
|
|
654
680
|
}
|
|
681
|
+
/** Checks if an expression resolves to env.records, records, an alias, or a derivation chain */
|
|
682
|
+
isRecordsSource(node) {
|
|
683
|
+
if (this.isEnvRecordsAccess(node)) return true;
|
|
684
|
+
if (node.type === "Identifier" && this.currentRecordCollections.has(node.name)) {
|
|
685
|
+
return true;
|
|
686
|
+
}
|
|
687
|
+
if (node.type === "CallExpression") {
|
|
688
|
+
const call = node;
|
|
689
|
+
if (call.callee.type === "MemberExpression") {
|
|
690
|
+
const member = call.callee;
|
|
691
|
+
const method = this.getPropertyName(member);
|
|
692
|
+
if (method && (method === "slice" || method === "filter" || method === "toSorted" || method === "map" || method === "concat")) {
|
|
693
|
+
return this.isRecordsSource(member.object);
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return false;
|
|
698
|
+
}
|
|
699
|
+
/** Gathers aliases and derivations of env.records (e.g. const accounts = env.records; const top5 = accounts.filter(...)) */
|
|
700
|
+
identifyRecordCollections(ast) {
|
|
701
|
+
this.currentRecordCollections.clear();
|
|
702
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
703
|
+
const aliasVisitors = {
|
|
704
|
+
VariableDeclarator: (node) => {
|
|
705
|
+
if (!node.init || node.id.type !== "Identifier") return;
|
|
706
|
+
if (this.isRecordsSource(node.init)) {
|
|
707
|
+
this.currentRecordCollections.add(node.id.name);
|
|
708
|
+
}
|
|
709
|
+
},
|
|
710
|
+
AssignmentExpression: (node) => {
|
|
711
|
+
if (node.left.type !== "Identifier") return;
|
|
712
|
+
if (this.isRecordsSource(node.right)) {
|
|
713
|
+
this.currentRecordCollections.add(
|
|
714
|
+
node.left.name
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
};
|
|
719
|
+
simple(ast, aliasVisitors);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
655
722
|
/**
|
|
656
723
|
* Extracts field names accessed on a record parameter within a function body.
|
|
657
724
|
* e.g., in `(s, r) => s + r.balance`, extracts "balance".
|
|
@@ -733,17 +800,18 @@ ${sourceCode}
|
|
|
733
800
|
if (call.callee.type !== "MemberExpression") return false;
|
|
734
801
|
const callee = call.callee;
|
|
735
802
|
const method = this.getPropertyName(callee);
|
|
736
|
-
return method === "map" && this.
|
|
803
|
+
return method === "map" && this.isRecordsSource(callee.object);
|
|
737
804
|
}
|
|
738
805
|
// ── Pass 1: Record-Bound Variable Identification ──────────────────
|
|
739
806
|
identifyRecordBoundVars(ast, recordBoundVars) {
|
|
807
|
+
this.identifyRecordCollections(ast);
|
|
740
808
|
const visitors = {
|
|
741
809
|
CallExpression: (node) => {
|
|
742
810
|
if (node.callee.type !== "MemberExpression") return;
|
|
743
811
|
const member = node.callee;
|
|
744
812
|
const methodName = this.getPropertyName(member);
|
|
745
813
|
if (!methodName) return;
|
|
746
|
-
if (!this.
|
|
814
|
+
if (!this.isRecordsSource(member.object)) return;
|
|
747
815
|
const callback = node.arguments[0];
|
|
748
816
|
if (!callback) return;
|
|
749
817
|
if (callback.type === "ArrowFunctionExpression" || callback.type === "FunctionExpression") {
|
|
@@ -762,9 +830,9 @@ ${sourceCode}
|
|
|
762
830
|
}
|
|
763
831
|
}
|
|
764
832
|
},
|
|
765
|
-
// for (const r of env.records) → r is record-bound
|
|
833
|
+
// for (const r of env.records) or for (const r of accounts) → r is record-bound
|
|
766
834
|
ForOfStatement: (node) => {
|
|
767
|
-
if (!this.
|
|
835
|
+
if (!this.isRecordsSource(node.right)) return;
|
|
768
836
|
if (node.left.type === "VariableDeclaration") {
|
|
769
837
|
for (const declarator of node.left.declarations) {
|
|
770
838
|
if (declarator.id.type === "Identifier") {
|
|
@@ -780,7 +848,7 @@ ${sourceCode}
|
|
|
780
848
|
if (!node.init || node.id.type !== "Identifier") return;
|
|
781
849
|
if (node.init.type === "MemberExpression" && node.init.computed) {
|
|
782
850
|
const member = node.init;
|
|
783
|
-
if (this.
|
|
851
|
+
if (this.isRecordsSource(member.object)) {
|
|
784
852
|
recordBoundVars.add(node.id.name);
|
|
785
853
|
}
|
|
786
854
|
}
|
|
@@ -800,6 +868,18 @@ ${sourceCode}
|
|
|
800
868
|
}
|
|
801
869
|
},
|
|
802
870
|
AssignmentExpression: (node) => {
|
|
871
|
+
if (node.left.type === "MemberExpression") {
|
|
872
|
+
const member = node.left;
|
|
873
|
+
if (member.computed && this.isExpressionTainted(
|
|
874
|
+
member.property,
|
|
875
|
+
recordBoundVars,
|
|
876
|
+
taintedVars
|
|
877
|
+
)) {
|
|
878
|
+
if (member.object.type === "Identifier") {
|
|
879
|
+
taintedVars.add(member.object.name);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
803
883
|
if (node.left.type !== "Identifier") return;
|
|
804
884
|
if (this.isExpressionTainted(node.right, recordBoundVars, taintedVars)) {
|
|
805
885
|
taintedVars.add(node.left.name);
|
|
@@ -921,9 +1001,26 @@ ${sourceCode}
|
|
|
921
1001
|
}
|
|
922
1002
|
case "ObjectExpression": {
|
|
923
1003
|
const obj = node;
|
|
924
|
-
return obj.properties.some(
|
|
925
|
-
(prop
|
|
926
|
-
|
|
1004
|
+
return obj.properties.some((prop) => {
|
|
1005
|
+
if (prop.type === "Property") {
|
|
1006
|
+
if (prop.computed && this.isExpressionTainted(prop.key, recordBoundVars, taintedVars)) {
|
|
1007
|
+
return true;
|
|
1008
|
+
}
|
|
1009
|
+
return this.isExpressionTainted(
|
|
1010
|
+
prop.value,
|
|
1011
|
+
recordBoundVars,
|
|
1012
|
+
taintedVars
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
if (prop.type === "SpreadElement") {
|
|
1016
|
+
return this.isExpressionTainted(
|
|
1017
|
+
prop.argument,
|
|
1018
|
+
recordBoundVars,
|
|
1019
|
+
taintedVars
|
|
1020
|
+
);
|
|
1021
|
+
}
|
|
1022
|
+
return false;
|
|
1023
|
+
});
|
|
927
1024
|
}
|
|
928
1025
|
case "ArrayExpression": {
|
|
929
1026
|
const arr = node;
|
|
@@ -960,7 +1057,7 @@ ${sourceCode}
|
|
|
960
1057
|
}
|
|
961
1058
|
if (member.object.type === "MemberExpression" && propName && this.piiFields.has(propName.toLowerCase())) {
|
|
962
1059
|
const parentMember = member.object;
|
|
963
|
-
if (parentMember.computed && this.
|
|
1060
|
+
if (parentMember.computed && this.isRecordsSource(parentMember.object)) {
|
|
964
1061
|
return true;
|
|
965
1062
|
}
|
|
966
1063
|
}
|
|
@@ -988,7 +1085,7 @@ ${sourceCode}
|
|
|
988
1085
|
if (methodName && _TaintAnalyzer.TAINT_PROPAGATING_METHODS.has(methodName) && this.isExpressionTainted(callee.object, recordBoundVars, taintedVars)) {
|
|
989
1086
|
return true;
|
|
990
1087
|
}
|
|
991
|
-
if (this.
|
|
1088
|
+
if (this.isRecordsSource(callee.object) && call.arguments[0]) {
|
|
992
1089
|
const callback = call.arguments[0];
|
|
993
1090
|
if (callback.type === "ArrowFunctionExpression" || callback.type === "FunctionExpression") {
|
|
994
1091
|
return this.doesCallbackProduceTaint(
|
|
@@ -1061,6 +1158,11 @@ ${sourceCode}
|
|
|
1061
1158
|
scopedTaintedVars
|
|
1062
1159
|
);
|
|
1063
1160
|
}
|
|
1161
|
+
this.propagateTaint(
|
|
1162
|
+
callback.body,
|
|
1163
|
+
scopedRecordVars,
|
|
1164
|
+
scopedTaintedVars
|
|
1165
|
+
);
|
|
1064
1166
|
let hasTaintedReturnOrYield = false;
|
|
1065
1167
|
const returnVisitors = {
|
|
1066
1168
|
ReturnStatement: (node) => {
|
|
@@ -2243,14 +2345,18 @@ Data structure: ${schemaDigest}. Full schema: resource liop://schema/global`;
|
|
|
2243
2345
|
isError: true
|
|
2244
2346
|
};
|
|
2245
2347
|
}
|
|
2246
|
-
const
|
|
2247
|
-
const
|
|
2248
|
-
const
|
|
2348
|
+
const rawArgs = args && typeof args === "object" ? args : {};
|
|
2349
|
+
const payloadValue = rawArgs.payload ?? rawArgs.envelope ?? rawArgs.code;
|
|
2350
|
+
const bypassCache = rawArgs.__liop_bypass_ast_cache === true;
|
|
2351
|
+
const payloadHash = crypto3__default.createHash("sha256").update(payloadValue || "").digest("hex");
|
|
2249
2352
|
const logic = this.extractLogic(payloadValue);
|
|
2250
2353
|
const cached = this.logicCache.get(payloadHash);
|
|
2251
2354
|
if (!bypassCache && cached && now - cached.timestamp < this.CACHE_TTL_MS) {
|
|
2252
2355
|
if (logic) {
|
|
2253
|
-
|
|
2356
|
+
rawArgs.payload = logic;
|
|
2357
|
+
if (rawArgs.envelope !== void 0) {
|
|
2358
|
+
rawArgs.envelope = logic;
|
|
2359
|
+
}
|
|
2254
2360
|
const preflightReason = this.runPreflightPolicy(
|
|
2255
2361
|
name,
|
|
2256
2362
|
logic,
|
|
@@ -2281,10 +2387,11 @@ Data structure: ${schemaDigest}. Full schema: resource liop://schema/global`;
|
|
|
2281
2387
|
};
|
|
2282
2388
|
}
|
|
2283
2389
|
try {
|
|
2284
|
-
const logic2 = this.extractLogic(
|
|
2285
|
-
|
|
2286
|
-
)
|
|
2287
|
-
|
|
2390
|
+
const logic2 = this.extractLogic(payloadValue);
|
|
2391
|
+
rawArgs.payload = logic2;
|
|
2392
|
+
if (rawArgs.envelope !== void 0) {
|
|
2393
|
+
rawArgs.envelope = logic2;
|
|
2394
|
+
}
|
|
2288
2395
|
const preflightReason = this.runPreflightPolicy(
|
|
2289
2396
|
name,
|
|
2290
2397
|
logic2,
|
|
@@ -2677,6 +2784,12 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
2677
2784
|
setSandboxData(records) {
|
|
2678
2785
|
this.sandboxRecords = records;
|
|
2679
2786
|
}
|
|
2787
|
+
/**
|
|
2788
|
+
* Returns the read-only sandbox records registered in the enclave.
|
|
2789
|
+
*/
|
|
2790
|
+
getSandboxData() {
|
|
2791
|
+
return this.sandboxRecords;
|
|
2792
|
+
}
|
|
2680
2793
|
getBoundPort() {
|
|
2681
2794
|
return this.boundPort;
|
|
2682
2795
|
}
|
|
@@ -2771,7 +2884,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
2771
2884
|
log.info(
|
|
2772
2885
|
`[LIOP-RPC] Bypass authentication for matching localTestToken: ${localTestToken}`
|
|
2773
2886
|
);
|
|
2774
|
-
import('./kyber-
|
|
2887
|
+
import('./kyber-CGOA7Q6A.js').then(
|
|
2775
2888
|
async ({ Kyber768Wrapper }) => {
|
|
2776
2889
|
const { publicKey, secretKey } = await Kyber768Wrapper.generateKeyPair();
|
|
2777
2890
|
const sessionToken = crypto3__default.randomUUID();
|
|
@@ -2807,7 +2920,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
2807
2920
|
});
|
|
2808
2921
|
return;
|
|
2809
2922
|
}
|
|
2810
|
-
import('./kyber-
|
|
2923
|
+
import('./kyber-CGOA7Q6A.js').then(
|
|
2811
2924
|
async ({ Kyber768Wrapper }) => {
|
|
2812
2925
|
const { publicKey, secretKey } = await Kyber768Wrapper.generateKeyPair();
|
|
2813
2926
|
const sessionToken = crypto3__default.randomUUID();
|
|
@@ -2833,7 +2946,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
2833
2946
|
});
|
|
2834
2947
|
});
|
|
2835
2948
|
} else {
|
|
2836
|
-
import('./kyber-
|
|
2949
|
+
import('./kyber-CGOA7Q6A.js').then(async ({ Kyber768Wrapper }) => {
|
|
2837
2950
|
const { publicKey, secretKey } = await Kyber768Wrapper.generateKeyPair();
|
|
2838
2951
|
const sessionToken = crypto3__default.randomUUID();
|
|
2839
2952
|
this.sessions.set(sessionToken, {
|
|
@@ -2890,6 +3003,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
2890
3003
|
const toolName = session.capability_hash;
|
|
2891
3004
|
const toolDef = toolName ? this.tools.get(toolName) : void 0;
|
|
2892
3005
|
const toolPolicy = toolDef?.policy;
|
|
3006
|
+
let decryptedPayload = "";
|
|
2893
3007
|
try {
|
|
2894
3008
|
const kem = await createMlKem768();
|
|
2895
3009
|
const sharedSecret = kem.decap(
|
|
@@ -2908,7 +3022,7 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
2908
3022
|
decipher.setAuthTag(authTag);
|
|
2909
3023
|
let decrypted = decipher.update(encryptedData);
|
|
2910
3024
|
decrypted = Buffer.concat([decrypted, decipher.final()]);
|
|
2911
|
-
|
|
3025
|
+
decryptedPayload = decrypted.toString("utf-8");
|
|
2912
3026
|
const logic = this.extractLogic(decryptedPayload) || decryptedPayload.trim();
|
|
2913
3027
|
const preflightReason = this.runPreflightPolicy(
|
|
2914
3028
|
toolName || "unknown_tool",
|
|
@@ -3057,13 +3171,56 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
3057
3171
|
status: isBlocked ? "BLOCKED_EGRESS" : "SUCCESS"
|
|
3058
3172
|
});
|
|
3059
3173
|
toolCallsTotal.inc({
|
|
3174
|
+
capability: toolName || "unknown",
|
|
3060
3175
|
tool: toolName || "unknown",
|
|
3061
|
-
status: isBlocked ? "blocked_egress" : "success"
|
|
3176
|
+
status: isBlocked ? "blocked_egress" : "success",
|
|
3177
|
+
role: "executor"
|
|
3062
3178
|
});
|
|
3063
3179
|
fuelConsumed.observe(
|
|
3064
|
-
{
|
|
3180
|
+
{
|
|
3181
|
+
capability: toolName || "unknown",
|
|
3182
|
+
tool: toolName || "unknown"
|
|
3183
|
+
},
|
|
3065
3184
|
workerResponse.fuel_consumed || 0
|
|
3066
3185
|
);
|
|
3186
|
+
try {
|
|
3187
|
+
const egressBytes = Buffer.byteLength(response.semantic_evidence || "") + (response.cryptographic_proof ? response.cryptographic_proof.length : 0) + (response.zk_receipt ? response.zk_receipt.length : 0);
|
|
3188
|
+
wireEgressBytesTotal.inc(
|
|
3189
|
+
{ capability: toolName || "unknown" },
|
|
3190
|
+
egressBytes
|
|
3191
|
+
);
|
|
3192
|
+
if (this.sandboxRecords && this.sandboxRecords.length > 0) {
|
|
3193
|
+
const rawDatasetString = JSON.stringify(this.sandboxRecords);
|
|
3194
|
+
const rawDatasetBytes = Buffer.byteLength(rawDatasetString);
|
|
3195
|
+
const savedBytes = Math.max(0, rawDatasetBytes - egressBytes);
|
|
3196
|
+
if (savedBytes > 0) {
|
|
3197
|
+
wireSavedBytesTotal.inc(
|
|
3198
|
+
{ capability: toolName || "unknown" },
|
|
3199
|
+
savedBytes
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3202
|
+
try {
|
|
3203
|
+
const telemetry = TokenTelemetryEngine.getInstance();
|
|
3204
|
+
const originDatasetTokens = telemetry.countTokens(rawDatasetString);
|
|
3205
|
+
const outputTokens = telemetry.countTokens(
|
|
3206
|
+
response.semantic_evidence || ""
|
|
3207
|
+
);
|
|
3208
|
+
const inputTokens = telemetry.countTokens(
|
|
3209
|
+
decryptedPayload || ""
|
|
3210
|
+
);
|
|
3211
|
+
telemetry.record({
|
|
3212
|
+
type: "tool_call",
|
|
3213
|
+
method: "ExecuteLogic",
|
|
3214
|
+
toolName: toolName || "unknown",
|
|
3215
|
+
estimatedInputTokens: inputTokens,
|
|
3216
|
+
estimatedOutputTokens: outputTokens,
|
|
3217
|
+
originDatasetTokens
|
|
3218
|
+
});
|
|
3219
|
+
} catch {
|
|
3220
|
+
}
|
|
3221
|
+
}
|
|
3222
|
+
} catch {
|
|
3223
|
+
}
|
|
3067
3224
|
call.write(response, () => {
|
|
3068
3225
|
call.end();
|
|
3069
3226
|
});
|
|
@@ -3084,8 +3241,14 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
3084
3241
|
status: "ERROR"
|
|
3085
3242
|
});
|
|
3086
3243
|
toolCallsTotal.inc({
|
|
3244
|
+
capability: toolName || "unknown",
|
|
3087
3245
|
tool: toolName || "unknown",
|
|
3088
|
-
status: "error"
|
|
3246
|
+
status: "error",
|
|
3247
|
+
role: "executor"
|
|
3248
|
+
});
|
|
3249
|
+
toolCallErrorsTotal.inc({
|
|
3250
|
+
capability: toolName || "unknown",
|
|
3251
|
+
error_type: "runtime_error"
|
|
3089
3252
|
});
|
|
3090
3253
|
const errorResponse = {
|
|
3091
3254
|
semantic_evidence: errorMessage,
|
|
@@ -3516,5 +3679,5 @@ Data structure: ${schemaDigest}. Full schema: resource ${uri}. Guidelines: resou
|
|
|
3516
3679
|
};
|
|
3517
3680
|
|
|
3518
3681
|
export { AUTH_DEFAULTS, AuditLogger, GENESIS_HASH, JwtValidator, LiopRpcServer, LiopServer, NerScanner, PII_PATTERNS, PII_PRESETS, PiiScanner, computeEntryHash, createOAuthServer, globalAuditLogger };
|
|
3519
|
-
//# sourceMappingURL=chunk-
|
|
3520
|
-
//# sourceMappingURL=chunk-
|
|
3682
|
+
//# sourceMappingURL=chunk-5SWHE62F.js.map
|
|
3683
|
+
//# sourceMappingURL=chunk-5SWHE62F.js.map
|