@nextera.one/axis-server-sdk 2.1.1 → 2.1.3
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/core/index.d.mts +2 -2
- package/dist/core/index.d.ts +2 -2
- package/dist/core/index.js +267 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.mjs +260 -8
- package/dist/core/index.mjs.map +1 -1
- package/dist/index-DXHfWxLG.d.mts +133 -0
- package/dist/index-DXHfWxLG.d.ts +133 -0
- package/dist/index.d.mts +555 -1397
- package/dist/index.d.ts +555 -1397
- package/dist/index.js +432 -3020
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +427 -3028
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -3
- package/dist/codec/axis1.encode.d.mts +0 -10
- package/dist/codec/axis1.encode.d.ts +0 -10
- package/dist/codec/axis1.encode.js +0 -65
- package/dist/codec/axis1.encode.js.map +0 -1
- package/dist/codec/axis1.encode.mjs +0 -41
- package/dist/codec/axis1.encode.mjs.map +0 -1
- package/dist/codec/axis1.signing.d.mts +0 -8
- package/dist/codec/axis1.signing.d.ts +0 -8
- package/dist/codec/axis1.signing.js +0 -61
- package/dist/codec/axis1.signing.js.map +0 -1
- package/dist/codec/axis1.signing.mjs +0 -37
- package/dist/codec/axis1.signing.mjs.map +0 -1
- package/dist/index-VxXqZPuH.d.mts +0 -51
- package/dist/index-VxXqZPuH.d.ts +0 -51
- package/dist/types/frame.d.mts +0 -11
- package/dist/types/frame.d.ts +0 -11
- package/dist/types/frame.js +0 -78
- package/dist/types/frame.js.map +0 -1
- package/dist/types/frame.mjs +0 -54
- package/dist/types/frame.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -340,90 +340,76 @@ var init_sensor_decorator = __esm({
|
|
|
340
340
|
});
|
|
341
341
|
|
|
342
342
|
// src/decorators/tlv-field.decorator.ts
|
|
343
|
-
var
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
property,
|
|
375
|
-
tag,
|
|
376
|
-
options
|
|
377
|
-
});
|
|
378
|
-
Reflect.defineMetadata(exports.TLV_FIELDS_KEY, existing, target.constructor);
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
function TlvValidate2(validator) {
|
|
382
|
-
return (target, propertyKey) => {
|
|
383
|
-
const existing = Reflect.getOwnMetadata(exports.TLV_VALIDATORS_KEY, target.constructor) || [];
|
|
384
|
-
const prop = String(propertyKey);
|
|
385
|
-
let entry = existing.find((e) => e.property === prop);
|
|
386
|
-
if (!entry) {
|
|
387
|
-
entry = { property: prop, tag: 0, validators: [] };
|
|
388
|
-
existing.push(entry);
|
|
389
|
-
}
|
|
390
|
-
entry.validators.push(validator);
|
|
391
|
-
Reflect.defineMetadata(exports.TLV_VALIDATORS_KEY, existing, target.constructor);
|
|
392
|
-
};
|
|
393
|
-
}
|
|
394
|
-
function TlvUtf8Pattern2(pattern, message) {
|
|
395
|
-
const matcher = new RegExp(pattern.source, pattern.flags);
|
|
396
|
-
return TlvValidate2((val, prop) => {
|
|
397
|
-
const str = textDecoder.decode(val);
|
|
398
|
-
matcher.lastIndex = 0;
|
|
399
|
-
return matcher.test(str) ? null : message || `${prop}: failed pattern check`;
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
function TlvMinLen2(min, message) {
|
|
403
|
-
return TlvValidate2((val, prop) => {
|
|
404
|
-
return val.length >= min ? null : message || `${prop}: too short (${val.length} < ${min})`;
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
function TlvEnum2(allowed, message) {
|
|
408
|
-
const set = new Set(allowed);
|
|
409
|
-
return TlvValidate2((val, prop) => {
|
|
410
|
-
const str = textDecoder.decode(val);
|
|
411
|
-
return set.has(str) ? null : message || `${prop}: must be one of [${allowed.join(", ")}]`;
|
|
412
|
-
});
|
|
343
|
+
var tlv_field_decorator_exports = {};
|
|
344
|
+
__export(tlv_field_decorator_exports, {
|
|
345
|
+
TLV_FIELDS_KEY: () => TLV_FIELDS_KEY,
|
|
346
|
+
TLV_VALIDATORS_KEY: () => TLV_VALIDATORS_KEY,
|
|
347
|
+
TlvEnum: () => TlvEnum,
|
|
348
|
+
TlvField: () => TlvField,
|
|
349
|
+
TlvMinLen: () => TlvMinLen,
|
|
350
|
+
TlvRange: () => TlvRange,
|
|
351
|
+
TlvUtf8Pattern: () => TlvUtf8Pattern,
|
|
352
|
+
TlvValidate: () => TlvValidate
|
|
353
|
+
});
|
|
354
|
+
import "reflect-metadata";
|
|
355
|
+
function TlvField(tag, options) {
|
|
356
|
+
return (target, propertyKey) => {
|
|
357
|
+
const existing = Reflect.getOwnMetadata(TLV_FIELDS_KEY, target.constructor) || [];
|
|
358
|
+
existing.push({
|
|
359
|
+
property: String(propertyKey),
|
|
360
|
+
tag,
|
|
361
|
+
options
|
|
362
|
+
});
|
|
363
|
+
Reflect.defineMetadata(TLV_FIELDS_KEY, existing, target.constructor);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function TlvValidate(validator) {
|
|
367
|
+
return (target, propertyKey) => {
|
|
368
|
+
const existing = Reflect.getOwnMetadata(TLV_VALIDATORS_KEY, target.constructor) || [];
|
|
369
|
+
const prop = String(propertyKey);
|
|
370
|
+
let entry = existing.find((e) => e.property === prop);
|
|
371
|
+
if (!entry) {
|
|
372
|
+
entry = { property: prop, tag: 0, validators: [] };
|
|
373
|
+
existing.push(entry);
|
|
413
374
|
}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
375
|
+
entry.validators.push(validator);
|
|
376
|
+
Reflect.defineMetadata(TLV_VALIDATORS_KEY, existing, target.constructor);
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function TlvUtf8Pattern(pattern, message) {
|
|
380
|
+
return TlvValidate((val, prop) => {
|
|
381
|
+
const str = new TextDecoder().decode(val);
|
|
382
|
+
return pattern.test(str) ? null : message || `${prop}: failed pattern check`;
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
function TlvMinLen(min, message) {
|
|
386
|
+
return TlvValidate((val, prop) => {
|
|
387
|
+
return val.length >= min ? null : message || `${prop}: too short (${val.length} < ${min})`;
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
function TlvEnum(allowed, message) {
|
|
391
|
+
const set = new Set(allowed);
|
|
392
|
+
return TlvValidate((val, prop) => {
|
|
393
|
+
const str = new TextDecoder().decode(val);
|
|
394
|
+
return set.has(str) ? null : message || `${prop}: must be one of [${allowed.join(", ")}]`;
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
function TlvRange(min, max, message) {
|
|
398
|
+
return TlvValidate((val, prop) => {
|
|
399
|
+
if (val.length !== 8) return `${prop}: u64 must be 8 bytes`;
|
|
400
|
+
let n = 0n;
|
|
401
|
+
for (const b of val) n = n << 8n | BigInt(b);
|
|
402
|
+
if (n < min || n > max) {
|
|
403
|
+
return message || `${prop}: value ${n} out of range [${min}, ${max}]`;
|
|
426
404
|
}
|
|
405
|
+
return null;
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
var TLV_FIELDS_KEY, TLV_VALIDATORS_KEY;
|
|
409
|
+
var init_tlv_field_decorator = __esm({
|
|
410
|
+
"src/decorators/tlv-field.decorator.ts"() {
|
|
411
|
+
TLV_FIELDS_KEY = "axis:tlv:fields";
|
|
412
|
+
TLV_VALIDATORS_KEY = "axis:tlv:validators";
|
|
427
413
|
}
|
|
428
414
|
});
|
|
429
415
|
|
|
@@ -458,7 +444,7 @@ var require_dto_schema_util = __commonJS({
|
|
|
458
444
|
exports.extractDtoSchema = extractDtoSchema2;
|
|
459
445
|
exports.buildDtoDecoder = buildDtoDecoder2;
|
|
460
446
|
__require("reflect-metadata");
|
|
461
|
-
var tlv_field_decorator_1 =
|
|
447
|
+
var tlv_field_decorator_1 = (init_tlv_field_decorator(), __toCommonJS(tlv_field_decorator_exports));
|
|
462
448
|
var tlv_1 = (init_tlv(), __toCommonJS(tlv_exports));
|
|
463
449
|
function extractDtoSchema2(dto) {
|
|
464
450
|
const fieldMetas = Reflect.getMetadata(tlv_field_decorator_1.TLV_FIELDS_KEY, dto) || [];
|
|
@@ -567,7 +553,7 @@ var require_axis_id_dto = __commonJS({
|
|
|
567
553
|
};
|
|
568
554
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
569
555
|
exports.AxisIdDto = void 0;
|
|
570
|
-
var tlv_field_decorator_1 =
|
|
556
|
+
var tlv_field_decorator_1 = (init_tlv_field_decorator(), __toCommonJS(tlv_field_decorator_exports));
|
|
571
557
|
var axis_tlv_dto_1 = (init_axis_tlv_dto(), __toCommonJS(axis_tlv_dto_exports));
|
|
572
558
|
var AxisIdDto2 = class extends axis_tlv_dto_1.AxisTlvDto {
|
|
573
559
|
};
|
|
@@ -585,26 +571,25 @@ import "reflect-metadata";
|
|
|
585
571
|
function AxisPartialType(BaseDto) {
|
|
586
572
|
class PartialDto extends BaseDto {
|
|
587
573
|
}
|
|
588
|
-
const fields = Reflect.getOwnMetadata(
|
|
574
|
+
const fields = Reflect.getOwnMetadata(TLV_FIELDS_KEY, BaseDto) || [];
|
|
589
575
|
const partialFields = fields.map((f) => ({
|
|
590
576
|
property: f.property,
|
|
591
577
|
tag: f.tag,
|
|
592
578
|
options: { ...f.options, required: false }
|
|
593
579
|
}));
|
|
594
|
-
Reflect.defineMetadata(
|
|
595
|
-
const validators = Reflect.getOwnMetadata(
|
|
580
|
+
Reflect.defineMetadata(TLV_FIELDS_KEY, partialFields, PartialDto);
|
|
581
|
+
const validators = Reflect.getOwnMetadata(TLV_VALIDATORS_KEY, BaseDto) || [];
|
|
596
582
|
if (validators.length > 0) {
|
|
597
|
-
Reflect.defineMetadata(
|
|
583
|
+
Reflect.defineMetadata(TLV_VALIDATORS_KEY, [...validators], PartialDto);
|
|
598
584
|
}
|
|
599
585
|
Object.defineProperty(PartialDto, "name", {
|
|
600
586
|
value: `Partial${BaseDto.name}`
|
|
601
587
|
});
|
|
602
588
|
return PartialDto;
|
|
603
589
|
}
|
|
604
|
-
var import_tlv_field;
|
|
605
590
|
var init_axis_partial_type = __esm({
|
|
606
591
|
"src/base/axis-partial-type.ts"() {
|
|
607
|
-
|
|
592
|
+
init_tlv_field_decorator();
|
|
608
593
|
}
|
|
609
594
|
});
|
|
610
595
|
|
|
@@ -623,7 +608,7 @@ var require_axis_response_dto = __commonJS({
|
|
|
623
608
|
};
|
|
624
609
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
625
610
|
exports.AxisResponseDto = exports.RESPONSE_TAG_UPDATED_BY = exports.RESPONSE_TAG_CREATED_BY = exports.RESPONSE_TAG_UPDATED_AT = exports.RESPONSE_TAG_CREATED_AT = exports.RESPONSE_TAG_ID = void 0;
|
|
626
|
-
var tlv_field_decorator_1 =
|
|
611
|
+
var tlv_field_decorator_1 = (init_tlv_field_decorator(), __toCommonJS(tlv_field_decorator_exports));
|
|
627
612
|
var axis_tlv_dto_1 = (init_axis_tlv_dto(), __toCommonJS(axis_tlv_dto_exports));
|
|
628
613
|
exports.RESPONSE_TAG_ID = 1;
|
|
629
614
|
exports.RESPONSE_TAG_CREATED_AT = 2;
|
|
@@ -661,6 +646,7 @@ var constants_exports = {};
|
|
|
661
646
|
__export(constants_exports, {
|
|
662
647
|
AXIS_MAGIC: () => AXIS_MAGIC,
|
|
663
648
|
AXIS_VERSION: () => AXIS_VERSION,
|
|
649
|
+
AxisMediaTypes: () => AxisMediaTypes,
|
|
664
650
|
BodyProfile: () => BodyProfile,
|
|
665
651
|
ERR_BAD_SIGNATURE: () => ERR_BAD_SIGNATURE,
|
|
666
652
|
ERR_CONTRACT_VIOLATION: () => ERR_CONTRACT_VIOLATION,
|
|
@@ -786,8 +772,30 @@ import {
|
|
|
786
772
|
ERR_REPLAY_DETECTED,
|
|
787
773
|
ERR_CONTRACT_VIOLATION
|
|
788
774
|
} from "@nextera.one/axis-protocol";
|
|
775
|
+
var _AxisMediaTypes, AxisMediaTypes;
|
|
789
776
|
var init_constants = __esm({
|
|
790
777
|
"src/core/constants.ts"() {
|
|
778
|
+
_AxisMediaTypes = class _AxisMediaTypes {
|
|
779
|
+
static normalize(value) {
|
|
780
|
+
if (!value) return void 0;
|
|
781
|
+
return value.split(";", 1)[0].trim().toLowerCase();
|
|
782
|
+
}
|
|
783
|
+
static isAxisContentType(value) {
|
|
784
|
+
const normalized = _AxisMediaTypes.normalize(value);
|
|
785
|
+
return !!normalized && _AxisMediaTypes.VALID_AXIS_CONTENT_TYPES.some(
|
|
786
|
+
(contentType) => contentType === normalized
|
|
787
|
+
);
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
_AxisMediaTypes.BINARY = "application/axis-bin";
|
|
791
|
+
_AxisMediaTypes.OCTET_STREAM = "application/octet-stream";
|
|
792
|
+
_AxisMediaTypes.LEGACY_BINARY = "application/x-axis";
|
|
793
|
+
_AxisMediaTypes.VALID_AXIS_CONTENT_TYPES = [
|
|
794
|
+
_AxisMediaTypes.BINARY,
|
|
795
|
+
_AxisMediaTypes.OCTET_STREAM,
|
|
796
|
+
_AxisMediaTypes.LEGACY_BINARY
|
|
797
|
+
];
|
|
798
|
+
AxisMediaTypes = _AxisMediaTypes;
|
|
791
799
|
}
|
|
792
800
|
});
|
|
793
801
|
|
|
@@ -1970,49 +1978,12 @@ var init_inline_capsule = __esm({
|
|
|
1970
1978
|
var require_intent_router = __commonJS({
|
|
1971
1979
|
"src/engine/intent.router.ts"(exports) {
|
|
1972
1980
|
"use strict";
|
|
1973
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
1974
|
-
if (k2 === void 0) k2 = k;
|
|
1975
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
1976
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
1977
|
-
desc = { enumerable: true, get: function() {
|
|
1978
|
-
return m[k];
|
|
1979
|
-
} };
|
|
1980
|
-
}
|
|
1981
|
-
Object.defineProperty(o, k2, desc);
|
|
1982
|
-
}) : (function(o, m, k, k2) {
|
|
1983
|
-
if (k2 === void 0) k2 = k;
|
|
1984
|
-
o[k2] = m[k];
|
|
1985
|
-
}));
|
|
1986
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
1987
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
1988
|
-
}) : function(o, v) {
|
|
1989
|
-
o["default"] = v;
|
|
1990
|
-
});
|
|
1991
1981
|
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
1992
1982
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1993
1983
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1994
1984
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1995
1985
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1996
1986
|
};
|
|
1997
|
-
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
1998
|
-
var ownKeys = function(o) {
|
|
1999
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
2000
|
-
var ar = [];
|
|
2001
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
2002
|
-
return ar;
|
|
2003
|
-
};
|
|
2004
|
-
return ownKeys(o);
|
|
2005
|
-
};
|
|
2006
|
-
return function(mod) {
|
|
2007
|
-
if (mod && mod.__esModule) return mod;
|
|
2008
|
-
var result = {};
|
|
2009
|
-
if (mod != null) {
|
|
2010
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
2011
|
-
}
|
|
2012
|
-
__setModuleDefault(result, mod);
|
|
2013
|
-
return result;
|
|
2014
|
-
};
|
|
2015
|
-
})();
|
|
2016
1987
|
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
2017
1988
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
2018
1989
|
};
|
|
@@ -2479,7 +2450,7 @@ var require_intent_router = __commonJS({
|
|
|
2479
2450
|
}
|
|
2480
2451
|
}
|
|
2481
2452
|
async executeChainRequest(frame, request) {
|
|
2482
|
-
const { AxisChainExecutor: AxisChainExecutor2 } = await Promise.resolve().then(() =>
|
|
2453
|
+
const { AxisChainExecutor: AxisChainExecutor2 } = await Promise.resolve().then(() => require_axis_chain_executor());
|
|
2483
2454
|
const headerActorId = this.getActorIdFromFrame(frame);
|
|
2484
2455
|
if (request.actorId && headerActorId && !this.identifiersMatch(request.actorId, headerActorId)) {
|
|
2485
2456
|
throw new axis_error_1.AxisError("ACTOR_MISMATCH", "CHAIN.EXEC actorId conflicts with authenticated frame identity", 403);
|
|
@@ -3337,213 +3308,6 @@ var init_observation_hash = __esm({
|
|
|
3337
3308
|
}
|
|
3338
3309
|
});
|
|
3339
3310
|
|
|
3340
|
-
// src/engine/observation/truth-scoring.ts
|
|
3341
|
-
function scoreTruth(obs, expected) {
|
|
3342
|
-
const anomalies = [];
|
|
3343
|
-
let passedChecks = 0;
|
|
3344
|
-
let totalChecks = 0;
|
|
3345
|
-
totalChecks++;
|
|
3346
|
-
if (obs.endMs && obs.decision) {
|
|
3347
|
-
passedChecks++;
|
|
3348
|
-
} else {
|
|
3349
|
-
anomalies.push({
|
|
3350
|
-
code: "OBS_NOT_FINALIZED",
|
|
3351
|
-
level: "critical",
|
|
3352
|
-
message: "Observation was not finalized"
|
|
3353
|
-
});
|
|
3354
|
-
}
|
|
3355
|
-
totalChecks++;
|
|
3356
|
-
if (obs.stages.length > 0) {
|
|
3357
|
-
passedChecks++;
|
|
3358
|
-
} else {
|
|
3359
|
-
anomalies.push({
|
|
3360
|
-
code: "OBS_NO_STAGES",
|
|
3361
|
-
level: "warning",
|
|
3362
|
-
message: "Observation has no execution stages"
|
|
3363
|
-
});
|
|
3364
|
-
}
|
|
3365
|
-
totalChecks++;
|
|
3366
|
-
const failedStages = obs.stages.filter((s) => s.status === "fail");
|
|
3367
|
-
if (failedStages.length === 0 || obs.decision === "DENY") {
|
|
3368
|
-
passedChecks++;
|
|
3369
|
-
} else {
|
|
3370
|
-
for (const stage of failedStages) {
|
|
3371
|
-
anomalies.push({
|
|
3372
|
-
code: "STAGE_FAILED",
|
|
3373
|
-
level: "warning",
|
|
3374
|
-
message: `Stage '${stage.name}' failed: ${stage.reason ?? "unknown"}`,
|
|
3375
|
-
field: `stages.${stage.name}`
|
|
3376
|
-
});
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
totalChecks++;
|
|
3380
|
-
const invalidSensors = obs.sensors.filter((s) => s.durationMs < 0);
|
|
3381
|
-
if (invalidSensors.length === 0) {
|
|
3382
|
-
passedChecks++;
|
|
3383
|
-
} else {
|
|
3384
|
-
anomalies.push({
|
|
3385
|
-
code: "SENSOR_INVALID_TIMING",
|
|
3386
|
-
level: "warning",
|
|
3387
|
-
message: `${invalidSensors.length} sensor(s) have negative duration`
|
|
3388
|
-
});
|
|
3389
|
-
}
|
|
3390
|
-
totalChecks++;
|
|
3391
|
-
if (obs.durationMs !== void 0 && obs.durationMs >= 0 && obs.durationMs < 3e5) {
|
|
3392
|
-
passedChecks++;
|
|
3393
|
-
} else {
|
|
3394
|
-
anomalies.push({
|
|
3395
|
-
code: "OBS_DURATION_ANOMALY",
|
|
3396
|
-
level: "warning",
|
|
3397
|
-
message: `Observation duration ${obs.durationMs}ms is suspicious`,
|
|
3398
|
-
actual: obs.durationMs
|
|
3399
|
-
});
|
|
3400
|
-
}
|
|
3401
|
-
if (expected) {
|
|
3402
|
-
if (expected.decision !== void 0) {
|
|
3403
|
-
totalChecks++;
|
|
3404
|
-
if (obs.decision === expected.decision) {
|
|
3405
|
-
passedChecks++;
|
|
3406
|
-
} else {
|
|
3407
|
-
anomalies.push({
|
|
3408
|
-
code: "DECISION_MISMATCH",
|
|
3409
|
-
level: "critical",
|
|
3410
|
-
message: `Expected decision '${expected.decision}', got '${obs.decision}'`,
|
|
3411
|
-
field: "decision",
|
|
3412
|
-
expected: expected.decision,
|
|
3413
|
-
actual: obs.decision
|
|
3414
|
-
});
|
|
3415
|
-
}
|
|
3416
|
-
}
|
|
3417
|
-
if (expected.statusCode !== void 0) {
|
|
3418
|
-
totalChecks++;
|
|
3419
|
-
if (obs.statusCode === expected.statusCode) {
|
|
3420
|
-
passedChecks++;
|
|
3421
|
-
} else {
|
|
3422
|
-
anomalies.push({
|
|
3423
|
-
code: "STATUS_MISMATCH",
|
|
3424
|
-
level: "warning",
|
|
3425
|
-
message: `Expected status ${expected.statusCode}, got ${obs.statusCode}`,
|
|
3426
|
-
field: "statusCode",
|
|
3427
|
-
expected: expected.statusCode,
|
|
3428
|
-
actual: obs.statusCode
|
|
3429
|
-
});
|
|
3430
|
-
}
|
|
3431
|
-
}
|
|
3432
|
-
if (expected.effect !== void 0) {
|
|
3433
|
-
totalChecks++;
|
|
3434
|
-
if (obs.resultCode === expected.effect || obs.facts?.effect === expected.effect) {
|
|
3435
|
-
passedChecks++;
|
|
3436
|
-
} else {
|
|
3437
|
-
anomalies.push({
|
|
3438
|
-
code: "EFFECT_MISMATCH",
|
|
3439
|
-
level: "warning",
|
|
3440
|
-
message: `Expected effect '${expected.effect}', got '${obs.resultCode}'`,
|
|
3441
|
-
field: "resultCode",
|
|
3442
|
-
expected: expected.effect,
|
|
3443
|
-
actual: obs.resultCode
|
|
3444
|
-
});
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
|
-
if (expected.maxDurationMs !== void 0) {
|
|
3448
|
-
totalChecks++;
|
|
3449
|
-
if (obs.durationMs !== void 0 && obs.durationMs <= expected.maxDurationMs) {
|
|
3450
|
-
passedChecks++;
|
|
3451
|
-
} else {
|
|
3452
|
-
anomalies.push({
|
|
3453
|
-
code: "DURATION_EXCEEDED",
|
|
3454
|
-
level: "warning",
|
|
3455
|
-
message: `Execution took ${obs.durationMs}ms, max allowed ${expected.maxDurationMs}ms`,
|
|
3456
|
-
field: "durationMs",
|
|
3457
|
-
expected: expected.maxDurationMs,
|
|
3458
|
-
actual: obs.durationMs
|
|
3459
|
-
});
|
|
3460
|
-
}
|
|
3461
|
-
}
|
|
3462
|
-
if (expected.minSensorsPassed !== void 0) {
|
|
3463
|
-
totalChecks++;
|
|
3464
|
-
const passed = obs.sensors.filter((s) => s.allowed).length;
|
|
3465
|
-
if (passed >= expected.minSensorsPassed) {
|
|
3466
|
-
passedChecks++;
|
|
3467
|
-
} else {
|
|
3468
|
-
anomalies.push({
|
|
3469
|
-
code: "INSUFFICIENT_SENSORS",
|
|
3470
|
-
level: "warning",
|
|
3471
|
-
message: `Only ${passed} sensors passed, minimum required ${expected.minSensorsPassed}`,
|
|
3472
|
-
field: "sensors",
|
|
3473
|
-
expected: expected.minSensorsPassed,
|
|
3474
|
-
actual: passed
|
|
3475
|
-
});
|
|
3476
|
-
}
|
|
3477
|
-
}
|
|
3478
|
-
if (expected.assertions) {
|
|
3479
|
-
for (const [key, expectedValue] of Object.entries(expected.assertions)) {
|
|
3480
|
-
totalChecks++;
|
|
3481
|
-
const actualValue = obs.facts[key];
|
|
3482
|
-
if (deepEqual(actualValue, expectedValue)) {
|
|
3483
|
-
passedChecks++;
|
|
3484
|
-
} else {
|
|
3485
|
-
anomalies.push({
|
|
3486
|
-
code: "ASSERTION_FAILED",
|
|
3487
|
-
level: "warning",
|
|
3488
|
-
message: `Assertion failed for facts.${key}`,
|
|
3489
|
-
field: `facts.${key}`,
|
|
3490
|
-
expected: expectedValue,
|
|
3491
|
-
actual: actualValue
|
|
3492
|
-
});
|
|
3493
|
-
}
|
|
3494
|
-
}
|
|
3495
|
-
}
|
|
3496
|
-
}
|
|
3497
|
-
const confidence = totalChecks > 0 ? passedChecks / totalChecks : 0;
|
|
3498
|
-
const hasCritical = anomalies.some((a) => a.level === "critical");
|
|
3499
|
-
const status = computeTruthStatus(confidence, hasCritical, anomalies.length);
|
|
3500
|
-
const isDeed = status === "confirmed" || status === "partial" && !hasCritical;
|
|
3501
|
-
return {
|
|
3502
|
-
status,
|
|
3503
|
-
confidence,
|
|
3504
|
-
anomalies,
|
|
3505
|
-
passedChecks,
|
|
3506
|
-
totalChecks,
|
|
3507
|
-
verifiedAt: Date.now(),
|
|
3508
|
-
isDeed
|
|
3509
|
-
};
|
|
3510
|
-
}
|
|
3511
|
-
function computeTruthStatus(confidence, hasCritical, anomalyCount) {
|
|
3512
|
-
if (hasCritical) return "failed";
|
|
3513
|
-
if (confidence === 1) return "confirmed";
|
|
3514
|
-
if (confidence >= 0.8) return "partial";
|
|
3515
|
-
if (confidence >= 0.5) return "uncertain";
|
|
3516
|
-
return "disputed";
|
|
3517
|
-
}
|
|
3518
|
-
function verifyObservation(obs, expected) {
|
|
3519
|
-
const verdict = scoreTruth(obs, expected);
|
|
3520
|
-
return { observation: obs, verdict };
|
|
3521
|
-
}
|
|
3522
|
-
function deepEqual(a, b) {
|
|
3523
|
-
if (a === b) return true;
|
|
3524
|
-
if (a === null || b === null) return false;
|
|
3525
|
-
if (typeof a !== typeof b) return false;
|
|
3526
|
-
if (typeof a !== "object") return String(a) === String(b);
|
|
3527
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
3528
|
-
if (a.length !== b.length) return false;
|
|
3529
|
-
return a.every((v, i) => deepEqual(v, b[i]));
|
|
3530
|
-
}
|
|
3531
|
-
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
3532
|
-
const aKeys = Object.keys(a);
|
|
3533
|
-
const bKeys = Object.keys(b);
|
|
3534
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
3535
|
-
return aKeys.every(
|
|
3536
|
-
(key) => deepEqual(
|
|
3537
|
-
a[key],
|
|
3538
|
-
b[key]
|
|
3539
|
-
)
|
|
3540
|
-
);
|
|
3541
|
-
}
|
|
3542
|
-
var init_truth_scoring = __esm({
|
|
3543
|
-
"src/engine/observation/truth-scoring.ts"() {
|
|
3544
|
-
}
|
|
3545
|
-
});
|
|
3546
|
-
|
|
3547
3311
|
// src/engine/observation/response-observer.ts
|
|
3548
3312
|
function verifyResponse(ctx, response) {
|
|
3549
3313
|
if (!response.effect || typeof response.effect !== "string") {
|
|
@@ -3618,14 +3382,92 @@ __export(axis_bin_exports, {
|
|
|
3618
3382
|
getSignTarget: () => getSignTarget
|
|
3619
3383
|
});
|
|
3620
3384
|
import * as z from "zod";
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3385
|
+
function encodeFrame(frame) {
|
|
3386
|
+
const hdrBytes = encodeTLVs(
|
|
3387
|
+
Array.from(frame.headers.entries()).map(([t, v]) => ({
|
|
3388
|
+
type: t,
|
|
3389
|
+
value: v
|
|
3390
|
+
}))
|
|
3391
|
+
);
|
|
3392
|
+
if (hdrBytes.length > MAX_HDR_LEN) throw new Error("Header too large");
|
|
3393
|
+
if (frame.body.length > MAX_BODY_LEN) throw new Error("Body too large");
|
|
3394
|
+
if (frame.sig.length > MAX_SIG_LEN) throw new Error("Signature too large");
|
|
3395
|
+
const hdrLenBytes = encodeVarint(hdrBytes.length);
|
|
3396
|
+
const bodyLenBytes = encodeVarint(frame.body.length);
|
|
3397
|
+
const sigLenBytes = encodeVarint(frame.sig.length);
|
|
3398
|
+
const totalLen = 5 + // Magic (AXIS1)
|
|
3399
|
+
1 + // Version
|
|
3400
|
+
1 + // Flags
|
|
3401
|
+
hdrLenBytes.length + bodyLenBytes.length + sigLenBytes.length + hdrBytes.length + frame.body.length + frame.sig.length;
|
|
3402
|
+
if (totalLen > MAX_FRAME_LEN) throw new Error("Total frame too large");
|
|
3403
|
+
const buf = new Uint8Array(totalLen);
|
|
3404
|
+
let offset = 0;
|
|
3405
|
+
buf.set(AXIS_MAGIC, offset);
|
|
3406
|
+
offset += 5;
|
|
3407
|
+
buf[offset++] = AXIS_VERSION;
|
|
3408
|
+
buf[offset++] = frame.flags;
|
|
3409
|
+
buf.set(hdrLenBytes, offset);
|
|
3410
|
+
offset += hdrLenBytes.length;
|
|
3411
|
+
buf.set(bodyLenBytes, offset);
|
|
3412
|
+
offset += bodyLenBytes.length;
|
|
3413
|
+
buf.set(sigLenBytes, offset);
|
|
3414
|
+
offset += sigLenBytes.length;
|
|
3415
|
+
buf.set(hdrBytes, offset);
|
|
3416
|
+
offset += hdrBytes.length;
|
|
3417
|
+
buf.set(frame.body, offset);
|
|
3418
|
+
offset += frame.body.length;
|
|
3419
|
+
buf.set(frame.sig, offset);
|
|
3420
|
+
offset += frame.sig.length;
|
|
3421
|
+
return buf;
|
|
3422
|
+
}
|
|
3423
|
+
function decodeFrame(buf) {
|
|
3424
|
+
let offset = 0;
|
|
3425
|
+
if (offset + 5 > buf.length) throw new Error("Packet too short");
|
|
3426
|
+
for (let i = 0; i < 5; i++) {
|
|
3427
|
+
if (buf[offset + i] !== AXIS_MAGIC[i]) throw new Error("Invalid Magic");
|
|
3428
|
+
}
|
|
3429
|
+
offset += 5;
|
|
3430
|
+
const ver = buf[offset++];
|
|
3431
|
+
if (ver !== AXIS_VERSION) throw new Error(`Unsupported version: ${ver}`);
|
|
3432
|
+
const flags = buf[offset++];
|
|
3433
|
+
const { value: hdrLen, length: hlLen } = decodeVarint(buf, offset);
|
|
3434
|
+
offset += hlLen;
|
|
3435
|
+
if (hdrLen > MAX_HDR_LEN) throw new Error("Header limit exceeded");
|
|
3436
|
+
const { value: bodyLen, length: blLen } = decodeVarint(buf, offset);
|
|
3437
|
+
offset += blLen;
|
|
3438
|
+
if (bodyLen > MAX_BODY_LEN) throw new Error("Body limit exceeded");
|
|
3439
|
+
const { value: sigLen, length: slLen } = decodeVarint(buf, offset);
|
|
3440
|
+
offset += slLen;
|
|
3441
|
+
if (sigLen > MAX_SIG_LEN) throw new Error("Signature limit exceeded");
|
|
3442
|
+
if (offset + hdrLen + bodyLen + sigLen > buf.length) {
|
|
3443
|
+
throw new Error("Frame truncated");
|
|
3444
|
+
}
|
|
3445
|
+
const hdrBytes = buf.slice(offset, offset + hdrLen);
|
|
3446
|
+
offset += hdrLen;
|
|
3447
|
+
const bodyBytes = buf.slice(offset, offset + bodyLen);
|
|
3448
|
+
offset += bodyLen;
|
|
3449
|
+
const sigBytes = buf.slice(offset, offset + sigLen);
|
|
3450
|
+
offset += sigLen;
|
|
3451
|
+
const headers = decodeTLVs(hdrBytes);
|
|
3452
|
+
return {
|
|
3453
|
+
flags,
|
|
3454
|
+
headers,
|
|
3455
|
+
body: bodyBytes,
|
|
3456
|
+
sig: sigBytes
|
|
3457
|
+
};
|
|
3458
|
+
}
|
|
3459
|
+
function getSignTarget(frame) {
|
|
3460
|
+
return encodeFrame({
|
|
3461
|
+
...frame,
|
|
3462
|
+
sig: new Uint8Array(0)
|
|
3463
|
+
});
|
|
3464
|
+
}
|
|
3626
3465
|
var AxisFrameZ;
|
|
3627
3466
|
var init_axis_bin = __esm({
|
|
3628
3467
|
"src/core/axis-bin.ts"() {
|
|
3468
|
+
init_constants();
|
|
3469
|
+
init_tlv();
|
|
3470
|
+
init_varint();
|
|
3629
3471
|
AxisFrameZ = z.object({
|
|
3630
3472
|
/** Flag bits for protocol control (e.g., encryption, compression) */
|
|
3631
3473
|
flags: z.number().int().nonnegative(),
|
|
@@ -3645,7 +3487,12 @@ var init_axis_bin = __esm({
|
|
|
3645
3487
|
// src/core/signature.ts
|
|
3646
3488
|
import * as crypto2 from "crypto";
|
|
3647
3489
|
function computeSignaturePayload(frame) {
|
|
3648
|
-
|
|
3490
|
+
const frameWithoutSig = {
|
|
3491
|
+
...frame,
|
|
3492
|
+
sig: new Uint8Array(0)
|
|
3493
|
+
};
|
|
3494
|
+
const encoded = encodeFrame(frameWithoutSig);
|
|
3495
|
+
return Buffer.from(encoded);
|
|
3649
3496
|
}
|
|
3650
3497
|
function signFrame(frame, privateKey) {
|
|
3651
3498
|
const payload = computeSignaturePayload(frame);
|
|
@@ -4526,12 +4373,11 @@ var init_tlv_encode = __esm({
|
|
|
4526
4373
|
});
|
|
4527
4374
|
|
|
4528
4375
|
// src/codec/axis1.encode.ts
|
|
4529
|
-
import { AXIS_MAGIC as AXIS_MAGIC2, AXIS_VERSION as AXIS_VERSION2 } from "@nextera.one/axis-protocol";
|
|
4530
4376
|
function encodeAxis1Frame(f) {
|
|
4531
4377
|
if (!Buffer.isBuffer(f.hdr) || !Buffer.isBuffer(f.body) || !Buffer.isBuffer(f.sig)) {
|
|
4532
4378
|
throw new Error("AXIS1_BAD_BUFFERS");
|
|
4533
4379
|
}
|
|
4534
|
-
if (f.ver !==
|
|
4380
|
+
if (f.ver !== 1) throw new Error("AXIS1_BAD_VER");
|
|
4535
4381
|
const hdrLen = encVarint(BigInt(f.hdr.length));
|
|
4536
4382
|
const bodyLen = encVarint(BigInt(f.body.length));
|
|
4537
4383
|
const sigLen = encVarint(BigInt(f.sig.length));
|
|
@@ -4551,14 +4397,13 @@ var MAGIC;
|
|
|
4551
4397
|
var init_axis1_encode = __esm({
|
|
4552
4398
|
"src/codec/axis1.encode.ts"() {
|
|
4553
4399
|
init_tlv_encode();
|
|
4554
|
-
MAGIC = Buffer.from(
|
|
4400
|
+
MAGIC = Buffer.from("AXIS1", "ascii");
|
|
4555
4401
|
}
|
|
4556
4402
|
});
|
|
4557
4403
|
|
|
4558
4404
|
// src/codec/axis1.signing.ts
|
|
4559
|
-
import { AXIS_MAGIC as AXIS_MAGIC3, AXIS_VERSION as AXIS_VERSION3 } from "@nextera.one/axis-protocol";
|
|
4560
4405
|
function axis1SigningBytes(params) {
|
|
4561
|
-
if (params.ver !==
|
|
4406
|
+
if (params.ver !== 1) throw new Error("AXIS1_BAD_VER");
|
|
4562
4407
|
const hdrLen = encVarint(BigInt(params.hdr.length));
|
|
4563
4408
|
const bodyLen = encVarint(BigInt(params.body.length));
|
|
4564
4409
|
const sigLenZero = encVarint(0n);
|
|
@@ -4577,7 +4422,7 @@ var MAGIC2;
|
|
|
4577
4422
|
var init_axis1_signing = __esm({
|
|
4578
4423
|
"src/codec/axis1.signing.ts"() {
|
|
4579
4424
|
init_tlv_encode();
|
|
4580
|
-
MAGIC2 = Buffer.from(
|
|
4425
|
+
MAGIC2 = Buffer.from("AXIS1", "ascii");
|
|
4581
4426
|
}
|
|
4582
4427
|
});
|
|
4583
4428
|
|
|
@@ -4877,7 +4722,6 @@ var init_tlv2 = __esm({
|
|
|
4877
4722
|
});
|
|
4878
4723
|
|
|
4879
4724
|
// src/types/frame.ts
|
|
4880
|
-
import { AXIS_MAGIC as AXIS_MAGIC4 } from "@nextera.one/axis-protocol";
|
|
4881
4725
|
function decodeAxis1Frame(buf) {
|
|
4882
4726
|
let off = 0;
|
|
4883
4727
|
const magic = buf.subarray(off, off + 5);
|
|
@@ -4912,7 +4756,7 @@ var MAGIC3;
|
|
|
4912
4756
|
var init_frame = __esm({
|
|
4913
4757
|
"src/types/frame.ts"() {
|
|
4914
4758
|
init_tlv2();
|
|
4915
|
-
MAGIC3 = Buffer.from(
|
|
4759
|
+
MAGIC3 = Buffer.from("AXIS1", "ascii");
|
|
4916
4760
|
}
|
|
4917
4761
|
});
|
|
4918
4762
|
|
|
@@ -5035,52 +4879,7 @@ var init_capabilities = __esm({
|
|
|
5035
4879
|
}
|
|
5036
4880
|
});
|
|
5037
4881
|
|
|
5038
|
-
// src/law/law.types.ts
|
|
5039
|
-
function buildAxisLawEvaluationContext(input) {
|
|
5040
|
-
const metadata = input.metadata ?? {};
|
|
5041
|
-
const packet = input.packet;
|
|
5042
|
-
const packetBody = input.frameBody ?? packet?.body ?? packet?.args ?? void 0;
|
|
5043
|
-
const capsuleId = metadata.capsule_id ?? metadata.capsuleId ?? packet?.capsuleId ?? input.clientId;
|
|
5044
|
-
const audience = input.aud ?? metadata.audience ?? packet?.aud;
|
|
5045
|
-
const tps = metadata.tps ?? packet?.tps ?? packet?.tickTps;
|
|
5046
|
-
return {
|
|
5047
|
-
actorId: input.actorId,
|
|
5048
|
-
intent: input.intent,
|
|
5049
|
-
audience,
|
|
5050
|
-
tps,
|
|
5051
|
-
country: input.country,
|
|
5052
|
-
ip: input.ip,
|
|
5053
|
-
path: input.path,
|
|
5054
|
-
clientId: input.clientId,
|
|
5055
|
-
deviceId: input.deviceId,
|
|
5056
|
-
sessionId: input.sessionId,
|
|
5057
|
-
capsuleId,
|
|
5058
|
-
metadata,
|
|
5059
|
-
packet,
|
|
5060
|
-
frameBody: packetBody
|
|
5061
|
-
};
|
|
5062
|
-
}
|
|
5063
|
-
var init_law_types = __esm({
|
|
5064
|
-
"src/law/law.types.ts"() {
|
|
5065
|
-
}
|
|
5066
|
-
});
|
|
5067
|
-
|
|
5068
|
-
// src/law/index.ts
|
|
5069
|
-
var law_exports = {};
|
|
5070
|
-
__export(law_exports, {
|
|
5071
|
-
buildAxisLawEvaluationContext: () => buildAxisLawEvaluationContext
|
|
5072
|
-
});
|
|
5073
|
-
var init_law = __esm({
|
|
5074
|
-
"src/law/index.ts"() {
|
|
5075
|
-
init_law_types();
|
|
5076
|
-
}
|
|
5077
|
-
});
|
|
5078
|
-
|
|
5079
4882
|
// src/risk/index.ts
|
|
5080
|
-
var risk_exports = {};
|
|
5081
|
-
__export(risk_exports, {
|
|
5082
|
-
RiskDecision: () => RiskDecision
|
|
5083
|
-
});
|
|
5084
4883
|
var RiskDecision;
|
|
5085
4884
|
var init_risk = __esm({
|
|
5086
4885
|
"src/risk/index.ts"() {
|
|
@@ -5365,49 +5164,12 @@ var init_upload_types = __esm({
|
|
|
5365
5164
|
var require_axis_files_handlers = __commonJS({
|
|
5366
5165
|
"src/upload/axis-files.handlers.ts"(exports) {
|
|
5367
5166
|
"use strict";
|
|
5368
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
5369
|
-
if (k2 === void 0) k2 = k;
|
|
5370
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5371
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
5372
|
-
desc = { enumerable: true, get: function() {
|
|
5373
|
-
return m[k];
|
|
5374
|
-
} };
|
|
5375
|
-
}
|
|
5376
|
-
Object.defineProperty(o, k2, desc);
|
|
5377
|
-
}) : (function(o, m, k, k2) {
|
|
5378
|
-
if (k2 === void 0) k2 = k;
|
|
5379
|
-
o[k2] = m[k];
|
|
5380
|
-
}));
|
|
5381
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
5382
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
5383
|
-
}) : function(o, v) {
|
|
5384
|
-
o["default"] = v;
|
|
5385
|
-
});
|
|
5386
5167
|
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
5387
5168
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
5388
5169
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5389
5170
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5390
5171
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
5391
5172
|
};
|
|
5392
|
-
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
5393
|
-
var ownKeys = function(o) {
|
|
5394
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
5395
|
-
var ar = [];
|
|
5396
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
5397
|
-
return ar;
|
|
5398
|
-
};
|
|
5399
|
-
return ownKeys(o);
|
|
5400
|
-
};
|
|
5401
|
-
return function(mod) {
|
|
5402
|
-
if (mod && mod.__esModule) return mod;
|
|
5403
|
-
var result = {};
|
|
5404
|
-
if (mod != null) {
|
|
5405
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
5406
|
-
}
|
|
5407
|
-
__setModuleDefault(result, mod);
|
|
5408
|
-
return result;
|
|
5409
|
-
};
|
|
5410
|
-
})();
|
|
5411
5173
|
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
5412
5174
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
5413
5175
|
};
|
|
@@ -5432,7 +5194,7 @@ var require_axis_files_handlers = __commonJS({
|
|
|
5432
5194
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5433
5195
|
exports.AxisFilesFinalizeHandler = exports.AxisFilesDownloadHandler = void 0;
|
|
5434
5196
|
var common_1 = __require("@nestjs/common");
|
|
5435
|
-
var crypto3 =
|
|
5197
|
+
var crypto3 = __require("crypto");
|
|
5436
5198
|
var axis_bin_1 = (init_axis_bin(), __toCommonJS(axis_bin_exports));
|
|
5437
5199
|
var varint_1 = (init_varint(), __toCommonJS(varint_exports));
|
|
5438
5200
|
var handler_decorator_1 = (init_handler_decorator(), __toCommonJS(handler_decorator_exports));
|
|
@@ -6188,374 +5950,6 @@ var require_axis_sensor_chain_service = __commonJS({
|
|
|
6188
5950
|
}
|
|
6189
5951
|
});
|
|
6190
5952
|
|
|
6191
|
-
// src/timeline/timeline.engine.ts
|
|
6192
|
-
import { createHash as createHash5, randomBytes as randomBytes6 } from "crypto";
|
|
6193
|
-
function generateId(prefix) {
|
|
6194
|
-
return `${prefix}_${randomBytes6(16).toString("hex")}`;
|
|
6195
|
-
}
|
|
6196
|
-
function sha2566(data) {
|
|
6197
|
-
return createHash5("sha256").update(data).digest("hex");
|
|
6198
|
-
}
|
|
6199
|
-
function hashPayload2(payload) {
|
|
6200
|
-
return sha2566(JSON.stringify(payload));
|
|
6201
|
-
}
|
|
6202
|
-
function diffObjects(a, b) {
|
|
6203
|
-
const diffs = [];
|
|
6204
|
-
const allKeys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
6205
|
-
for (const key of allKeys) {
|
|
6206
|
-
const va = a[key];
|
|
6207
|
-
const vb = b[key];
|
|
6208
|
-
if (JSON.stringify(va) !== JSON.stringify(vb)) {
|
|
6209
|
-
diffs.push({ field: key, original: va, replayed: vb });
|
|
6210
|
-
}
|
|
6211
|
-
}
|
|
6212
|
-
return diffs;
|
|
6213
|
-
}
|
|
6214
|
-
var TimelineEngine;
|
|
6215
|
-
var init_timeline_engine = __esm({
|
|
6216
|
-
"src/timeline/timeline.engine.ts"() {
|
|
6217
|
-
TimelineEngine = class {
|
|
6218
|
-
constructor(store) {
|
|
6219
|
-
this.store = store;
|
|
6220
|
-
this.handlers = /* @__PURE__ */ new Map();
|
|
6221
|
-
}
|
|
6222
|
-
/** Register an intent handler for timeline execution */
|
|
6223
|
-
registerHandler(handler) {
|
|
6224
|
-
this.handlers.set(handler.intent, handler);
|
|
6225
|
-
}
|
|
6226
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6227
|
-
// Record (store a real execution as a timeline event)
|
|
6228
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6229
|
-
async recordEvent(intent, actorId, payload, result, options = {}) {
|
|
6230
|
-
const event = {
|
|
6231
|
-
event_id: generateId("evt"),
|
|
6232
|
-
timeline_id: options.timelineId ?? "prime",
|
|
6233
|
-
branch_id: options.branchId ?? "main",
|
|
6234
|
-
parent_event_id: options.parentEventId ?? null,
|
|
6235
|
-
intent,
|
|
6236
|
-
actor_id: actorId,
|
|
6237
|
-
capsule_id: options.capsuleId,
|
|
6238
|
-
tps_coordinate: options.tpsCoordinate,
|
|
6239
|
-
payload_hash: hashPayload2(payload),
|
|
6240
|
-
result_hash: hashPayload2(result),
|
|
6241
|
-
status: "executed",
|
|
6242
|
-
domain: "prime",
|
|
6243
|
-
determinism: options.determinism ?? "deterministic",
|
|
6244
|
-
witness_id: options.witnessId,
|
|
6245
|
-
created_at: Date.now(),
|
|
6246
|
-
metadata: { payload, result }
|
|
6247
|
-
};
|
|
6248
|
-
await this.store.saveEvent(event);
|
|
6249
|
-
return event;
|
|
6250
|
-
}
|
|
6251
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6252
|
-
// Replay
|
|
6253
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6254
|
-
async replay(request) {
|
|
6255
|
-
const originalEvent = await this.store.getEvent(request.source_event_id);
|
|
6256
|
-
if (!originalEvent) {
|
|
6257
|
-
throw new Error(`Event ${request.source_event_id} not found`);
|
|
6258
|
-
}
|
|
6259
|
-
const handler = this.handlers.get(originalEvent.intent);
|
|
6260
|
-
if (!handler) {
|
|
6261
|
-
throw new Error(`No handler registered for intent '${originalEvent.intent}'`);
|
|
6262
|
-
}
|
|
6263
|
-
const originalPayload = originalEvent.metadata?.payload ?? {};
|
|
6264
|
-
const replayPayload = request.mode === "analytical" && request.override_payload ? request.override_payload : originalPayload;
|
|
6265
|
-
const snapshot = await this.store.getSnapshotByEvent(originalEvent.event_id);
|
|
6266
|
-
const context = {
|
|
6267
|
-
event_id: generateId("evt"),
|
|
6268
|
-
timeline_id: originalEvent.timeline_id,
|
|
6269
|
-
branch_id: `replay_${originalEvent.branch_id}`,
|
|
6270
|
-
domain: "audit",
|
|
6271
|
-
actor_id: originalEvent.actor_id,
|
|
6272
|
-
tps_coordinate: originalEvent.tps_coordinate,
|
|
6273
|
-
snapshot: snapshot ?? void 0,
|
|
6274
|
-
is_replay: true,
|
|
6275
|
-
is_simulation: false
|
|
6276
|
-
};
|
|
6277
|
-
const startMs = Date.now();
|
|
6278
|
-
const handlerResult = await handler.execute(replayPayload, context);
|
|
6279
|
-
const durationMs = Date.now() - startMs;
|
|
6280
|
-
const replayedEvent = {
|
|
6281
|
-
event_id: context.event_id,
|
|
6282
|
-
timeline_id: originalEvent.timeline_id,
|
|
6283
|
-
branch_id: context.branch_id,
|
|
6284
|
-
parent_event_id: originalEvent.event_id,
|
|
6285
|
-
intent: originalEvent.intent,
|
|
6286
|
-
actor_id: originalEvent.actor_id,
|
|
6287
|
-
capsule_id: originalEvent.capsule_id,
|
|
6288
|
-
tps_coordinate: originalEvent.tps_coordinate,
|
|
6289
|
-
payload_hash: hashPayload2(replayPayload),
|
|
6290
|
-
result_hash: hashPayload2(handlerResult.result_data),
|
|
6291
|
-
status: "replayed",
|
|
6292
|
-
domain: "audit",
|
|
6293
|
-
determinism: originalEvent.determinism,
|
|
6294
|
-
created_at: Date.now(),
|
|
6295
|
-
metadata: { payload: replayPayload, result: handlerResult.result_data }
|
|
6296
|
-
};
|
|
6297
|
-
await this.store.saveEvent(replayedEvent);
|
|
6298
|
-
const originalResult = originalEvent.metadata?.result ?? {};
|
|
6299
|
-
const differences = diffObjects(originalResult, handlerResult.result_data);
|
|
6300
|
-
const deterministicMatch = originalEvent.result_hash === replayedEvent.result_hash;
|
|
6301
|
-
return {
|
|
6302
|
-
original_event: originalEvent,
|
|
6303
|
-
replayed_event: replayedEvent,
|
|
6304
|
-
mode: request.mode,
|
|
6305
|
-
deterministic_match: deterministicMatch,
|
|
6306
|
-
differences,
|
|
6307
|
-
duration_ms: durationMs
|
|
6308
|
-
};
|
|
6309
|
-
}
|
|
6310
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6311
|
-
// Fork
|
|
6312
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6313
|
-
async fork(request) {
|
|
6314
|
-
const sourceEvent = await this.store.getEvent(request.source_event_id);
|
|
6315
|
-
if (!sourceEvent) {
|
|
6316
|
-
throw new Error(`Event ${request.source_event_id} not found`);
|
|
6317
|
-
}
|
|
6318
|
-
const handler = this.handlers.get(sourceEvent.intent);
|
|
6319
|
-
if (!handler) {
|
|
6320
|
-
throw new Error(`No handler registered for intent '${sourceEvent.intent}'`);
|
|
6321
|
-
}
|
|
6322
|
-
const branch = {
|
|
6323
|
-
branch_id: generateId("branch"),
|
|
6324
|
-
timeline_id: generateId("timeline"),
|
|
6325
|
-
origin_timeline_id: sourceEvent.timeline_id,
|
|
6326
|
-
origin_event_id: sourceEvent.event_id,
|
|
6327
|
-
branch_type: "fork",
|
|
6328
|
-
creator_subject_id: request.actor_id,
|
|
6329
|
-
purpose: request.purpose,
|
|
6330
|
-
status: "active"
|
|
6331
|
-
};
|
|
6332
|
-
await this.store.saveBranch(branch);
|
|
6333
|
-
const snapshot = {
|
|
6334
|
-
snapshot_id: generateId("snap"),
|
|
6335
|
-
timeline_id: sourceEvent.timeline_id,
|
|
6336
|
-
event_id: sourceEvent.event_id,
|
|
6337
|
-
tps_coordinate: sourceEvent.tps_coordinate,
|
|
6338
|
-
state_hash: hashPayload2(
|
|
6339
|
-
sourceEvent.metadata?.result ?? {}
|
|
6340
|
-
),
|
|
6341
|
-
state_data: sourceEvent.metadata?.result ?? {},
|
|
6342
|
-
created_at: Date.now()
|
|
6343
|
-
};
|
|
6344
|
-
await this.store.saveSnapshot(snapshot);
|
|
6345
|
-
const context = {
|
|
6346
|
-
event_id: generateId("evt"),
|
|
6347
|
-
timeline_id: branch.timeline_id,
|
|
6348
|
-
branch_id: branch.branch_id,
|
|
6349
|
-
domain: "fork",
|
|
6350
|
-
actor_id: request.actor_id,
|
|
6351
|
-
tps_coordinate: sourceEvent.tps_coordinate,
|
|
6352
|
-
snapshot,
|
|
6353
|
-
is_replay: false,
|
|
6354
|
-
is_simulation: false
|
|
6355
|
-
};
|
|
6356
|
-
const handlerResult = await handler.execute(request.new_payload, context);
|
|
6357
|
-
const forkedEvent = {
|
|
6358
|
-
event_id: context.event_id,
|
|
6359
|
-
timeline_id: branch.timeline_id,
|
|
6360
|
-
branch_id: branch.branch_id,
|
|
6361
|
-
parent_event_id: sourceEvent.event_id,
|
|
6362
|
-
intent: sourceEvent.intent,
|
|
6363
|
-
actor_id: request.actor_id,
|
|
6364
|
-
tps_coordinate: sourceEvent.tps_coordinate,
|
|
6365
|
-
payload_hash: hashPayload2(request.new_payload),
|
|
6366
|
-
result_hash: hashPayload2(handlerResult.result_data),
|
|
6367
|
-
status: "forked",
|
|
6368
|
-
domain: "fork",
|
|
6369
|
-
determinism: sourceEvent.determinism,
|
|
6370
|
-
created_at: Date.now(),
|
|
6371
|
-
metadata: {
|
|
6372
|
-
payload: request.new_payload,
|
|
6373
|
-
result: handlerResult.result_data
|
|
6374
|
-
}
|
|
6375
|
-
};
|
|
6376
|
-
await this.store.saveEvent(forkedEvent);
|
|
6377
|
-
return { branch, forked_event: forkedEvent, snapshot };
|
|
6378
|
-
}
|
|
6379
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6380
|
-
// Simulate
|
|
6381
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6382
|
-
async simulate(request) {
|
|
6383
|
-
const handler = this.handlers.get(request.intent);
|
|
6384
|
-
if (!handler) {
|
|
6385
|
-
throw new Error(`No handler registered for intent '${request.intent}'`);
|
|
6386
|
-
}
|
|
6387
|
-
let snapshot;
|
|
6388
|
-
if (request.from_snapshot_id) {
|
|
6389
|
-
const loaded = await this.store.getSnapshot(request.from_snapshot_id);
|
|
6390
|
-
if (!loaded) {
|
|
6391
|
-
throw new Error(`Snapshot ${request.from_snapshot_id} not found`);
|
|
6392
|
-
}
|
|
6393
|
-
snapshot = loaded;
|
|
6394
|
-
}
|
|
6395
|
-
const branch = {
|
|
6396
|
-
branch_id: generateId("branch"),
|
|
6397
|
-
timeline_id: generateId("timeline"),
|
|
6398
|
-
origin_timeline_id: "prime",
|
|
6399
|
-
origin_event_id: "simulation_origin",
|
|
6400
|
-
branch_type: "simulation",
|
|
6401
|
-
created_at_tps: request.at_tps,
|
|
6402
|
-
creator_subject_id: request.actor_id,
|
|
6403
|
-
purpose: request.purpose,
|
|
6404
|
-
status: "active"
|
|
6405
|
-
};
|
|
6406
|
-
await this.store.saveBranch(branch);
|
|
6407
|
-
const context = {
|
|
6408
|
-
event_id: generateId("evt"),
|
|
6409
|
-
timeline_id: branch.timeline_id,
|
|
6410
|
-
branch_id: branch.branch_id,
|
|
6411
|
-
domain: "shadow",
|
|
6412
|
-
actor_id: request.actor_id,
|
|
6413
|
-
tps_coordinate: request.at_tps,
|
|
6414
|
-
snapshot,
|
|
6415
|
-
is_replay: false,
|
|
6416
|
-
is_simulation: true
|
|
6417
|
-
};
|
|
6418
|
-
const startMs = Date.now();
|
|
6419
|
-
const handlerResult = await handler.execute(request.payload, context);
|
|
6420
|
-
const durationMs = Date.now() - startMs;
|
|
6421
|
-
const simulatedEvent = {
|
|
6422
|
-
event_id: context.event_id,
|
|
6423
|
-
timeline_id: branch.timeline_id,
|
|
6424
|
-
branch_id: branch.branch_id,
|
|
6425
|
-
parent_event_id: null,
|
|
6426
|
-
intent: request.intent,
|
|
6427
|
-
actor_id: request.actor_id,
|
|
6428
|
-
tps_coordinate: request.at_tps,
|
|
6429
|
-
payload_hash: hashPayload2(request.payload),
|
|
6430
|
-
result_hash: hashPayload2(handlerResult.result_data),
|
|
6431
|
-
status: "simulated",
|
|
6432
|
-
domain: "shadow",
|
|
6433
|
-
determinism: "bounded_nondeterministic",
|
|
6434
|
-
created_at: Date.now(),
|
|
6435
|
-
metadata: { payload: request.payload, result: handlerResult.result_data }
|
|
6436
|
-
};
|
|
6437
|
-
await this.store.saveEvent(simulatedEvent);
|
|
6438
|
-
branch.status = "completed";
|
|
6439
|
-
await this.store.saveBranch(branch);
|
|
6440
|
-
return {
|
|
6441
|
-
branch,
|
|
6442
|
-
simulated_event: simulatedEvent,
|
|
6443
|
-
predicted_outcome: handlerResult.result_data,
|
|
6444
|
-
side_effects: handlerResult.side_effects ?? [],
|
|
6445
|
-
duration_ms: durationMs
|
|
6446
|
-
};
|
|
6447
|
-
}
|
|
6448
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6449
|
-
// Compare timelines
|
|
6450
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6451
|
-
async compare(timelineIdA, timelineIdB) {
|
|
6452
|
-
const eventsA = await this.store.getEventsByTimeline(timelineIdA);
|
|
6453
|
-
const eventsB = await this.store.getEventsByTimeline(timelineIdB);
|
|
6454
|
-
eventsA.sort((a, b) => a.created_at - b.created_at);
|
|
6455
|
-
eventsB.sort((a, b) => a.created_at - b.created_at);
|
|
6456
|
-
const maxLen = Math.max(eventsA.length, eventsB.length);
|
|
6457
|
-
const eventPairs = [];
|
|
6458
|
-
let divergencePoint;
|
|
6459
|
-
for (let i = 0; i < maxLen; i++) {
|
|
6460
|
-
const a = eventsA[i];
|
|
6461
|
-
const b = eventsB[i];
|
|
6462
|
-
if (!a || !b) {
|
|
6463
|
-
if (!divergencePoint) {
|
|
6464
|
-
divergencePoint = a?.event_id ?? b?.event_id;
|
|
6465
|
-
}
|
|
6466
|
-
continue;
|
|
6467
|
-
}
|
|
6468
|
-
const match = a.result_hash === b.result_hash;
|
|
6469
|
-
const resultA = a.metadata?.result ?? {};
|
|
6470
|
-
const resultB = b.metadata?.result ?? {};
|
|
6471
|
-
const differences = match ? [] : diffObjects(resultA, resultB);
|
|
6472
|
-
if (!match && !divergencePoint) {
|
|
6473
|
-
divergencePoint = a.event_id;
|
|
6474
|
-
}
|
|
6475
|
-
eventPairs.push({ event_a: a, event_b: b, match, differences });
|
|
6476
|
-
}
|
|
6477
|
-
return {
|
|
6478
|
-
timeline_a: timelineIdA,
|
|
6479
|
-
timeline_b: timelineIdB,
|
|
6480
|
-
event_pairs: eventPairs,
|
|
6481
|
-
divergence_point: divergencePoint
|
|
6482
|
-
};
|
|
6483
|
-
}
|
|
6484
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6485
|
-
// State snapshot management
|
|
6486
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
6487
|
-
async createSnapshot(eventId, stateData) {
|
|
6488
|
-
const event = await this.store.getEvent(eventId);
|
|
6489
|
-
if (!event) {
|
|
6490
|
-
throw new Error(`Event ${eventId} not found`);
|
|
6491
|
-
}
|
|
6492
|
-
const snapshot = {
|
|
6493
|
-
snapshot_id: generateId("snap"),
|
|
6494
|
-
timeline_id: event.timeline_id,
|
|
6495
|
-
event_id: eventId,
|
|
6496
|
-
tps_coordinate: event.tps_coordinate,
|
|
6497
|
-
state_hash: hashPayload2(stateData),
|
|
6498
|
-
state_data: stateData,
|
|
6499
|
-
created_at: Date.now()
|
|
6500
|
-
};
|
|
6501
|
-
await this.store.saveSnapshot(snapshot);
|
|
6502
|
-
return snapshot;
|
|
6503
|
-
}
|
|
6504
|
-
async restoreSnapshot(snapshotId) {
|
|
6505
|
-
const snapshot = await this.store.getSnapshot(snapshotId);
|
|
6506
|
-
if (!snapshot) {
|
|
6507
|
-
throw new Error(`Snapshot ${snapshotId} not found`);
|
|
6508
|
-
}
|
|
6509
|
-
return snapshot;
|
|
6510
|
-
}
|
|
6511
|
-
};
|
|
6512
|
-
}
|
|
6513
|
-
});
|
|
6514
|
-
|
|
6515
|
-
// src/timeline/timeline.store.ts
|
|
6516
|
-
var InMemoryTimelineStore;
|
|
6517
|
-
var init_timeline_store = __esm({
|
|
6518
|
-
"src/timeline/timeline.store.ts"() {
|
|
6519
|
-
InMemoryTimelineStore = class {
|
|
6520
|
-
constructor() {
|
|
6521
|
-
this.events = /* @__PURE__ */ new Map();
|
|
6522
|
-
this.branches = /* @__PURE__ */ new Map();
|
|
6523
|
-
this.snapshots = /* @__PURE__ */ new Map();
|
|
6524
|
-
}
|
|
6525
|
-
async saveEvent(event) {
|
|
6526
|
-
this.events.set(event.event_id, event);
|
|
6527
|
-
}
|
|
6528
|
-
async getEvent(eventId) {
|
|
6529
|
-
return this.events.get(eventId) ?? null;
|
|
6530
|
-
}
|
|
6531
|
-
async getEventsByTimeline(timelineId) {
|
|
6532
|
-
return [...this.events.values()].filter((e) => e.timeline_id === timelineId);
|
|
6533
|
-
}
|
|
6534
|
-
async getEventsByBranch(branchId) {
|
|
6535
|
-
return [...this.events.values()].filter((e) => e.branch_id === branchId);
|
|
6536
|
-
}
|
|
6537
|
-
async saveBranch(branch) {
|
|
6538
|
-
this.branches.set(branch.branch_id, branch);
|
|
6539
|
-
}
|
|
6540
|
-
async getBranch(branchId) {
|
|
6541
|
-
return this.branches.get(branchId) ?? null;
|
|
6542
|
-
}
|
|
6543
|
-
async getBranchesByTimeline(timelineId) {
|
|
6544
|
-
return [...this.branches.values()].filter((b) => b.timeline_id === timelineId);
|
|
6545
|
-
}
|
|
6546
|
-
async saveSnapshot(snapshot) {
|
|
6547
|
-
this.snapshots.set(snapshot.snapshot_id, snapshot);
|
|
6548
|
-
}
|
|
6549
|
-
async getSnapshot(snapshotId) {
|
|
6550
|
-
return this.snapshots.get(snapshotId) ?? null;
|
|
6551
|
-
}
|
|
6552
|
-
async getSnapshotByEvent(eventId) {
|
|
6553
|
-
return [...this.snapshots.values()].find((s) => s.event_id === eventId) ?? null;
|
|
6554
|
-
}
|
|
6555
|
-
};
|
|
6556
|
-
}
|
|
6557
|
-
});
|
|
6558
|
-
|
|
6559
5953
|
// src/utils/axis-tlv-codec.ts
|
|
6560
5954
|
function encodeAxisTlvDto(dtoClass, data) {
|
|
6561
5955
|
const schema = (0, import_dto_schema.extractDtoSchema)(dtoClass);
|
|
@@ -6648,1718 +6042,6 @@ var init_loom_types = __esm({
|
|
|
6648
6042
|
}
|
|
6649
6043
|
});
|
|
6650
6044
|
|
|
6651
|
-
// src/loom/loom.engine.ts
|
|
6652
|
-
import { createHash as createHash6, randomBytes as randomBytes7 } from "crypto";
|
|
6653
|
-
import { sign as sign2 } from "tweetnacl";
|
|
6654
|
-
function sha2567(data) {
|
|
6655
|
-
return createHash6("sha256").update(data).digest("hex");
|
|
6656
|
-
}
|
|
6657
|
-
function hexToUint8(hex) {
|
|
6658
|
-
const bytes2 = new Uint8Array(hex.length / 2);
|
|
6659
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
6660
|
-
bytes2[i / 2] = parseInt(hex.substring(i, i + 2), 16);
|
|
6661
|
-
}
|
|
6662
|
-
return bytes2;
|
|
6663
|
-
}
|
|
6664
|
-
function uint8ToHex(bytes2) {
|
|
6665
|
-
return Array.from(bytes2).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
6666
|
-
}
|
|
6667
|
-
function b64ToUint8(b64) {
|
|
6668
|
-
const bin = Buffer.from(b64, "base64");
|
|
6669
|
-
return new Uint8Array(bin.buffer, bin.byteOffset, bin.byteLength);
|
|
6670
|
-
}
|
|
6671
|
-
function uint8ToB64(bytes2) {
|
|
6672
|
-
return Buffer.from(bytes2).toString("base64");
|
|
6673
|
-
}
|
|
6674
|
-
function createPresenceChallenge(declaration, ttlMs = DEFAULT_PRESENCE_TTL_MS) {
|
|
6675
|
-
const now = Date.now();
|
|
6676
|
-
const nonce = randomBytes7(32).toString("hex");
|
|
6677
|
-
const challengeId = sha2567(`${declaration.softid}:${nonce}:${now}`);
|
|
6678
|
-
return {
|
|
6679
|
-
challenge_id: challengeId,
|
|
6680
|
-
nonce,
|
|
6681
|
-
temporal_anchor: now,
|
|
6682
|
-
ttl_ms: ttlMs,
|
|
6683
|
-
expires_at: now + ttlMs
|
|
6684
|
-
};
|
|
6685
|
-
}
|
|
6686
|
-
function presenceSigningData(challenge, deviceMeta) {
|
|
6687
|
-
return JSON.stringify({
|
|
6688
|
-
nonce: challenge.nonce,
|
|
6689
|
-
temporal_anchor: challenge.temporal_anchor,
|
|
6690
|
-
device_meta: deviceMeta ?? null
|
|
6691
|
-
});
|
|
6692
|
-
}
|
|
6693
|
-
function signPresenceChallenge(challenge, privateKeyHex, publicKeyHex, declaration, kid) {
|
|
6694
|
-
const data = presenceSigningData(challenge, declaration.device_meta);
|
|
6695
|
-
const msgBytes = new TextEncoder().encode(data);
|
|
6696
|
-
const secretKey = hexToUint8(privateKeyHex);
|
|
6697
|
-
const signature = sign2.detached(msgBytes, secretKey);
|
|
6698
|
-
return {
|
|
6699
|
-
challenge_id: challenge.challenge_id,
|
|
6700
|
-
signature: uint8ToHex(signature),
|
|
6701
|
-
public_key: publicKeyHex,
|
|
6702
|
-
kid
|
|
6703
|
-
};
|
|
6704
|
-
}
|
|
6705
|
-
function verifyPresenceProof(challenge, proof, declaration, durationMs = DEFAULT_PRESENCE_DURATION_MS) {
|
|
6706
|
-
if (Date.now() > challenge.expires_at) {
|
|
6707
|
-
return { valid: false, error: "Challenge expired", code: "CHALLENGE_EXPIRED" };
|
|
6708
|
-
}
|
|
6709
|
-
if (proof.challenge_id !== challenge.challenge_id) {
|
|
6710
|
-
return { valid: false, error: "Challenge ID mismatch", code: "CHALLENGE_MISMATCH" };
|
|
6711
|
-
}
|
|
6712
|
-
const data = presenceSigningData(challenge, declaration.device_meta);
|
|
6713
|
-
const msgBytes = new TextEncoder().encode(data);
|
|
6714
|
-
const sigBytes = hexToUint8(proof.signature);
|
|
6715
|
-
const pubBytes = hexToUint8(proof.public_key);
|
|
6716
|
-
let isValid;
|
|
6717
|
-
try {
|
|
6718
|
-
isValid = sign2.detached.verify(msgBytes, sigBytes, pubBytes);
|
|
6719
|
-
} catch {
|
|
6720
|
-
return { valid: false, error: "Signature verification failed", code: "SIG_INVALID" };
|
|
6721
|
-
}
|
|
6722
|
-
if (!isValid) {
|
|
6723
|
-
return { valid: false, error: "Invalid signature", code: "SIG_INVALID" };
|
|
6724
|
-
}
|
|
6725
|
-
const now = Date.now();
|
|
6726
|
-
const presenceId = sha2567(
|
|
6727
|
-
`${proof.public_key}:${challenge.nonce}:${challenge.temporal_anchor}`
|
|
6728
|
-
);
|
|
6729
|
-
const anchorReflection = sha2567(
|
|
6730
|
-
`ar:openlogs:loom:${proof.public_key}`
|
|
6731
|
-
);
|
|
6732
|
-
const receipt = {
|
|
6733
|
-
presence_id: presenceId,
|
|
6734
|
-
softid: declaration.softid,
|
|
6735
|
-
anchor_reflection: anchorReflection,
|
|
6736
|
-
scope: {
|
|
6737
|
-
device_fingerprint: declaration.device_meta?.fingerprint
|
|
6738
|
-
},
|
|
6739
|
-
issued_at: now,
|
|
6740
|
-
expires_at: now + durationMs
|
|
6741
|
-
};
|
|
6742
|
-
return { valid: true, presence: receipt };
|
|
6743
|
-
}
|
|
6744
|
-
function getPresenceStatus(receipt) {
|
|
6745
|
-
const now = Date.now();
|
|
6746
|
-
if (now > receipt.expires_at) return "expired";
|
|
6747
|
-
return "active";
|
|
6748
|
-
}
|
|
6749
|
-
function renewPresence(receipt, extensionMs = DEFAULT_PRESENCE_DURATION_MS) {
|
|
6750
|
-
const now = Date.now();
|
|
6751
|
-
return {
|
|
6752
|
-
...receipt,
|
|
6753
|
-
renewed_at: now,
|
|
6754
|
-
expires_at: now + extensionMs
|
|
6755
|
-
};
|
|
6756
|
-
}
|
|
6757
|
-
function createWrit(body, meta, thread, privateKeyHex, kid) {
|
|
6758
|
-
const head = { tid: thread.tid, seq: thread.seq };
|
|
6759
|
-
const writMeta = { ...meta, prev: thread.prevHash };
|
|
6760
|
-
const unsigned = { head, body, meta: writMeta };
|
|
6761
|
-
const canonical = canonicalizeWrit(unsigned);
|
|
6762
|
-
const msgBytes = new TextEncoder().encode(canonical);
|
|
6763
|
-
const secretKey = hexToUint8(privateKeyHex);
|
|
6764
|
-
const signature = sign2.detached(msgBytes, secretKey);
|
|
6765
|
-
const sig = {
|
|
6766
|
-
alg: "ed25519",
|
|
6767
|
-
value: uint8ToB64(signature),
|
|
6768
|
-
kid
|
|
6769
|
-
};
|
|
6770
|
-
return { head, body, meta: writMeta, sig };
|
|
6771
|
-
}
|
|
6772
|
-
function validateWrit(writ, publicKeyHex, threadState, grants) {
|
|
6773
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
6774
|
-
if (now < writ.meta.iat) {
|
|
6775
|
-
return {
|
|
6776
|
-
valid: false,
|
|
6777
|
-
error: "Writ not yet valid (iat in future)",
|
|
6778
|
-
code: "TEMPORAL_NOT_YET",
|
|
6779
|
-
gate_failed: "temporal"
|
|
6780
|
-
};
|
|
6781
|
-
}
|
|
6782
|
-
if (now > writ.meta.exp) {
|
|
6783
|
-
return {
|
|
6784
|
-
valid: false,
|
|
6785
|
-
error: "Writ expired",
|
|
6786
|
-
code: "TEMPORAL_EXPIRED",
|
|
6787
|
-
gate_failed: "temporal"
|
|
6788
|
-
};
|
|
6789
|
-
}
|
|
6790
|
-
if (threadState) {
|
|
6791
|
-
if (writ.head.tid !== threadState.thread_id) {
|
|
6792
|
-
return {
|
|
6793
|
-
valid: false,
|
|
6794
|
-
error: "Thread ID mismatch",
|
|
6795
|
-
code: "CAUSAL_TID",
|
|
6796
|
-
gate_failed: "causal"
|
|
6797
|
-
};
|
|
6798
|
-
}
|
|
6799
|
-
if (writ.head.seq !== threadState.sequence + 1) {
|
|
6800
|
-
return {
|
|
6801
|
-
valid: false,
|
|
6802
|
-
error: `Expected seq ${threadState.sequence + 1}, got ${writ.head.seq}`,
|
|
6803
|
-
code: "CAUSAL_SEQ",
|
|
6804
|
-
gate_failed: "causal"
|
|
6805
|
-
};
|
|
6806
|
-
}
|
|
6807
|
-
if (writ.meta.prev !== threadState.last_receipt_hash) {
|
|
6808
|
-
return {
|
|
6809
|
-
valid: false,
|
|
6810
|
-
error: "Previous receipt hash mismatch",
|
|
6811
|
-
code: "CAUSAL_PREV",
|
|
6812
|
-
gate_failed: "causal"
|
|
6813
|
-
};
|
|
6814
|
-
}
|
|
6815
|
-
} else {
|
|
6816
|
-
if (writ.head.seq !== 1) {
|
|
6817
|
-
return {
|
|
6818
|
-
valid: false,
|
|
6819
|
-
error: "First writ in thread must have seq=1",
|
|
6820
|
-
code: "CAUSAL_FIRST_SEQ",
|
|
6821
|
-
gate_failed: "causal"
|
|
6822
|
-
};
|
|
6823
|
-
}
|
|
6824
|
-
if (writ.meta.prev !== "") {
|
|
6825
|
-
return {
|
|
6826
|
-
valid: false,
|
|
6827
|
-
error: "First writ must have empty prev hash",
|
|
6828
|
-
code: "CAUSAL_FIRST_PREV",
|
|
6829
|
-
gate_failed: "causal"
|
|
6830
|
-
};
|
|
6831
|
-
}
|
|
6832
|
-
}
|
|
6833
|
-
if (writ.body.law !== "self") {
|
|
6834
|
-
const matchingGrant = grants.find(
|
|
6835
|
-
(g) => g.grant_id === writ.body.law && g.subject === writ.body.who && grantCoversAction(g, writ.body.act, writ.body.res, now)
|
|
6836
|
-
);
|
|
6837
|
-
if (!matchingGrant) {
|
|
6838
|
-
return {
|
|
6839
|
-
valid: false,
|
|
6840
|
-
error: `No valid grant found for law=${writ.body.law}`,
|
|
6841
|
-
code: "LEGAL_NO_GRANT",
|
|
6842
|
-
gate_failed: "legal"
|
|
6843
|
-
};
|
|
6844
|
-
}
|
|
6845
|
-
}
|
|
6846
|
-
const unsigned = {
|
|
6847
|
-
head: writ.head,
|
|
6848
|
-
body: writ.body,
|
|
6849
|
-
meta: writ.meta
|
|
6850
|
-
};
|
|
6851
|
-
const canonical = canonicalizeWrit(unsigned);
|
|
6852
|
-
const msgBytes = new TextEncoder().encode(canonical);
|
|
6853
|
-
const sigBytes = b64ToUint8(writ.sig.value);
|
|
6854
|
-
const pubBytes = hexToUint8(publicKeyHex);
|
|
6855
|
-
let sigValid;
|
|
6856
|
-
try {
|
|
6857
|
-
sigValid = sign2.detached.verify(msgBytes, sigBytes, pubBytes);
|
|
6858
|
-
} catch {
|
|
6859
|
-
return {
|
|
6860
|
-
valid: false,
|
|
6861
|
-
error: "Signature verification failed",
|
|
6862
|
-
code: "AUTH_SIG_FAIL",
|
|
6863
|
-
gate_failed: "authentic"
|
|
6864
|
-
};
|
|
6865
|
-
}
|
|
6866
|
-
if (!sigValid) {
|
|
6867
|
-
return {
|
|
6868
|
-
valid: false,
|
|
6869
|
-
error: "Invalid signature",
|
|
6870
|
-
code: "AUTH_SIG_INVALID",
|
|
6871
|
-
gate_failed: "authentic"
|
|
6872
|
-
};
|
|
6873
|
-
}
|
|
6874
|
-
return { valid: true, writ };
|
|
6875
|
-
}
|
|
6876
|
-
function grantCoversAction(grant, action, resource, nowUnix) {
|
|
6877
|
-
if (nowUnix < grant.meta.iat || nowUnix > grant.meta.exp) {
|
|
6878
|
-
return false;
|
|
6879
|
-
}
|
|
6880
|
-
return grant.caps.some(
|
|
6881
|
-
(cap) => matchOec(cap.oec, action) && matchScope(cap.scope, resource)
|
|
6882
|
-
);
|
|
6883
|
-
}
|
|
6884
|
-
function matchOec(pattern, action) {
|
|
6885
|
-
if (pattern === "*") return true;
|
|
6886
|
-
if (pattern === action) return true;
|
|
6887
|
-
if (pattern.endsWith(".*")) {
|
|
6888
|
-
const prefix = pattern.slice(0, -2);
|
|
6889
|
-
return action.startsWith(prefix + ".");
|
|
6890
|
-
}
|
|
6891
|
-
return false;
|
|
6892
|
-
}
|
|
6893
|
-
function matchScope(pattern, resource) {
|
|
6894
|
-
if (pattern === "*") return true;
|
|
6895
|
-
if (pattern === resource) return true;
|
|
6896
|
-
if (pattern.includes("*")) {
|
|
6897
|
-
const regex = new RegExp(
|
|
6898
|
-
"^" + pattern.replace(/\./g, "\\.").replace(/\*/g, "[^:]*") + "$"
|
|
6899
|
-
);
|
|
6900
|
-
return regex.test(resource);
|
|
6901
|
-
}
|
|
6902
|
-
return false;
|
|
6903
|
-
}
|
|
6904
|
-
function getGrantStatus(grant, revocations) {
|
|
6905
|
-
const now = Math.floor(Date.now() / 1e3);
|
|
6906
|
-
const revoked = revocations.find(
|
|
6907
|
-
(r) => r.target_type === "grant" && r.target_id === grant.grant_id
|
|
6908
|
-
);
|
|
6909
|
-
if (revoked && revoked.effective_at <= now * 1e3) {
|
|
6910
|
-
return "revoked";
|
|
6911
|
-
}
|
|
6912
|
-
if (now > grant.meta.exp) return "expired";
|
|
6913
|
-
return "active";
|
|
6914
|
-
}
|
|
6915
|
-
function validateGrant(grant, issuerPublicKeyHex) {
|
|
6916
|
-
const unsigned = {
|
|
6917
|
-
grant_id: grant.grant_id,
|
|
6918
|
-
issuer: grant.issuer,
|
|
6919
|
-
subject: grant.subject,
|
|
6920
|
-
grant_type: grant.grant_type,
|
|
6921
|
-
caps: grant.caps,
|
|
6922
|
-
meta: grant.meta
|
|
6923
|
-
};
|
|
6924
|
-
const canonical = canonicalizeGrant(unsigned);
|
|
6925
|
-
const msgBytes = new TextEncoder().encode(canonical);
|
|
6926
|
-
const sigBytes = b64ToUint8(grant.sig.value);
|
|
6927
|
-
const pubBytes = hexToUint8(issuerPublicKeyHex);
|
|
6928
|
-
let valid;
|
|
6929
|
-
try {
|
|
6930
|
-
valid = sign2.detached.verify(msgBytes, sigBytes, pubBytes);
|
|
6931
|
-
} catch {
|
|
6932
|
-
return { valid: false, error: "Grant signature verification failed", code: "GRANT_SIG_FAIL" };
|
|
6933
|
-
}
|
|
6934
|
-
if (!valid) {
|
|
6935
|
-
return { valid: false, error: "Invalid grant signature", code: "GRANT_SIG_INVALID" };
|
|
6936
|
-
}
|
|
6937
|
-
return { valid: true, grant };
|
|
6938
|
-
}
|
|
6939
|
-
function createGrant(grantId, issuer, subject, grantType, caps, meta, privateKeyHex, kid) {
|
|
6940
|
-
const unsigned = {
|
|
6941
|
-
grant_id: grantId,
|
|
6942
|
-
issuer,
|
|
6943
|
-
subject,
|
|
6944
|
-
grant_type: grantType,
|
|
6945
|
-
caps,
|
|
6946
|
-
meta
|
|
6947
|
-
};
|
|
6948
|
-
const canonical = canonicalizeGrant(unsigned);
|
|
6949
|
-
const msgBytes = new TextEncoder().encode(canonical);
|
|
6950
|
-
const secretKey = hexToUint8(privateKeyHex);
|
|
6951
|
-
const signature = sign2.detached(msgBytes, secretKey);
|
|
6952
|
-
return {
|
|
6953
|
-
...unsigned,
|
|
6954
|
-
sig: {
|
|
6955
|
-
alg: "ed25519",
|
|
6956
|
-
value: uint8ToB64(signature),
|
|
6957
|
-
kid
|
|
6958
|
-
}
|
|
6959
|
-
};
|
|
6960
|
-
}
|
|
6961
|
-
function createReceipt(writ, effect, prevReceipt, metadata) {
|
|
6962
|
-
const now = Date.now();
|
|
6963
|
-
const sequence = prevReceipt ? prevReceipt.sequence + 1 : 1;
|
|
6964
|
-
const prevHash = prevReceipt?.hash ?? null;
|
|
6965
|
-
const writHash = sha2567(canonicalizeWrit({
|
|
6966
|
-
head: writ.head,
|
|
6967
|
-
body: writ.body,
|
|
6968
|
-
meta: writ.meta
|
|
6969
|
-
}));
|
|
6970
|
-
const hashInput = [
|
|
6971
|
-
prevHash ?? "",
|
|
6972
|
-
writHash,
|
|
6973
|
-
writ.head.tid,
|
|
6974
|
-
String(sequence),
|
|
6975
|
-
effect,
|
|
6976
|
-
String(now)
|
|
6977
|
-
].join(":");
|
|
6978
|
-
const receiptHash = sha2567(hashInput);
|
|
6979
|
-
const receiptId = sha2567(`receipt:${receiptHash}:${now}`);
|
|
6980
|
-
return {
|
|
6981
|
-
receipt_id: receiptId,
|
|
6982
|
-
writ_hash: writHash,
|
|
6983
|
-
thread_id: writ.head.tid,
|
|
6984
|
-
sequence,
|
|
6985
|
-
effect,
|
|
6986
|
-
hash: receiptHash,
|
|
6987
|
-
prev_hash: prevHash,
|
|
6988
|
-
executed_at: now,
|
|
6989
|
-
metadata
|
|
6990
|
-
};
|
|
6991
|
-
}
|
|
6992
|
-
function verifyReceiptChain(receipts) {
|
|
6993
|
-
if (receipts.length === 0) return { valid: true };
|
|
6994
|
-
const sorted = [...receipts].sort((a, b) => a.sequence - b.sequence);
|
|
6995
|
-
if (sorted[0].prev_hash !== null) {
|
|
6996
|
-
return {
|
|
6997
|
-
valid: false,
|
|
6998
|
-
brokenAt: 0,
|
|
6999
|
-
error: "First receipt must have null prev_hash"
|
|
7000
|
-
};
|
|
7001
|
-
}
|
|
7002
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
7003
|
-
if (sorted[i].prev_hash !== sorted[i - 1].hash) {
|
|
7004
|
-
return {
|
|
7005
|
-
valid: false,
|
|
7006
|
-
brokenAt: i,
|
|
7007
|
-
error: `Receipt ${i} prev_hash does not match receipt ${i - 1} hash`
|
|
7008
|
-
};
|
|
7009
|
-
}
|
|
7010
|
-
}
|
|
7011
|
-
return { valid: true };
|
|
7012
|
-
}
|
|
7013
|
-
function updateThreadState(receipt, softid) {
|
|
7014
|
-
return {
|
|
7015
|
-
thread_id: receipt.thread_id,
|
|
7016
|
-
softid,
|
|
7017
|
-
last_receipt_hash: receipt.hash,
|
|
7018
|
-
sequence: receipt.sequence,
|
|
7019
|
-
updated_at: receipt.executed_at
|
|
7020
|
-
};
|
|
7021
|
-
}
|
|
7022
|
-
function createRevocation(targetType, targetId, issuerSoftid, privateKeyHex, reason) {
|
|
7023
|
-
const now = Date.now();
|
|
7024
|
-
const revocationId = sha2567(`revoke:${targetType}:${targetId}:${now}`);
|
|
7025
|
-
const payload = JSON.stringify({
|
|
7026
|
-
revocation_id: revocationId,
|
|
7027
|
-
target_type: targetType,
|
|
7028
|
-
target_id: targetId,
|
|
7029
|
-
issuer_softid: issuerSoftid,
|
|
7030
|
-
effective_at: now,
|
|
7031
|
-
reason: reason ?? null
|
|
7032
|
-
});
|
|
7033
|
-
const msgBytes = new TextEncoder().encode(payload);
|
|
7034
|
-
const secretKey = hexToUint8(privateKeyHex);
|
|
7035
|
-
const signature = sign2.detached(msgBytes, secretKey);
|
|
7036
|
-
return {
|
|
7037
|
-
revocation_id: revocationId,
|
|
7038
|
-
target_type: targetType,
|
|
7039
|
-
target_id: targetId,
|
|
7040
|
-
issuer_softid: issuerSoftid,
|
|
7041
|
-
reason,
|
|
7042
|
-
effective_at: now,
|
|
7043
|
-
sig_value: uint8ToHex(signature)
|
|
7044
|
-
};
|
|
7045
|
-
}
|
|
7046
|
-
function isRevoked(targetType, targetId, revocations) {
|
|
7047
|
-
const now = Date.now();
|
|
7048
|
-
return revocations.some(
|
|
7049
|
-
(r) => r.target_type === targetType && r.target_id === targetId && r.effective_at <= now
|
|
7050
|
-
);
|
|
7051
|
-
}
|
|
7052
|
-
function executeLoomPipeline(writ, publicKeyHex, presence, threadState, grants, revocations, prevReceipt) {
|
|
7053
|
-
const presenceStatus = getPresenceStatus(presence);
|
|
7054
|
-
if (presenceStatus !== "active") {
|
|
7055
|
-
return { valid: false, error: "Presence not active", code: "PRESENCE_INACTIVE" };
|
|
7056
|
-
}
|
|
7057
|
-
if (isRevoked("presence", presence.presence_id, revocations)) {
|
|
7058
|
-
return { valid: false, error: "Presence revoked", code: "PRESENCE_REVOKED" };
|
|
7059
|
-
}
|
|
7060
|
-
const activeGrants = grants.filter(
|
|
7061
|
-
(g) => getGrantStatus(g, revocations) === "active"
|
|
7062
|
-
);
|
|
7063
|
-
const writResult = validateWrit(writ, publicKeyHex, threadState, activeGrants);
|
|
7064
|
-
if (!writResult.valid) {
|
|
7065
|
-
return { valid: false, error: writResult.error, code: writResult.code };
|
|
7066
|
-
}
|
|
7067
|
-
const receipt = createReceipt(writ, "ALLOW", prevReceipt);
|
|
7068
|
-
const newThreadState = updateThreadState(receipt, writ.body.who);
|
|
7069
|
-
return {
|
|
7070
|
-
receipt,
|
|
7071
|
-
threadState: newThreadState,
|
|
7072
|
-
writValidation: writResult
|
|
7073
|
-
};
|
|
7074
|
-
}
|
|
7075
|
-
var DEFAULT_PRESENCE_TTL_MS, DEFAULT_PRESENCE_DURATION_MS;
|
|
7076
|
-
var init_loom_engine = __esm({
|
|
7077
|
-
"src/loom/loom.engine.ts"() {
|
|
7078
|
-
init_loom_types();
|
|
7079
|
-
DEFAULT_PRESENCE_TTL_MS = 5e3;
|
|
7080
|
-
DEFAULT_PRESENCE_DURATION_MS = 30 * 60 * 1e3;
|
|
7081
|
-
}
|
|
7082
|
-
});
|
|
7083
|
-
|
|
7084
|
-
// src/idel/idel.compiler.ts
|
|
7085
|
-
function validateType(value, expectedType) {
|
|
7086
|
-
switch (expectedType) {
|
|
7087
|
-
case "string":
|
|
7088
|
-
return typeof value === "string";
|
|
7089
|
-
case "number":
|
|
7090
|
-
return typeof value === "number" && Number.isFinite(value);
|
|
7091
|
-
case "boolean":
|
|
7092
|
-
return typeof value === "boolean";
|
|
7093
|
-
case "object":
|
|
7094
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7095
|
-
case "array":
|
|
7096
|
-
return Array.isArray(value);
|
|
7097
|
-
default:
|
|
7098
|
-
return true;
|
|
7099
|
-
}
|
|
7100
|
-
}
|
|
7101
|
-
function assessRisk(schema, proposal, constraints) {
|
|
7102
|
-
const factors = [];
|
|
7103
|
-
let score = 0;
|
|
7104
|
-
const baseRiskMap = {
|
|
7105
|
-
none: 0,
|
|
7106
|
-
low: 0.1,
|
|
7107
|
-
medium: 0.3,
|
|
7108
|
-
high: 0.6,
|
|
7109
|
-
critical: 0.9
|
|
7110
|
-
};
|
|
7111
|
-
score = baseRiskMap[schema.risk_level] ?? 0;
|
|
7112
|
-
if (schema.risk_level !== "none") {
|
|
7113
|
-
factors.push(`Base risk: ${schema.risk_level}`);
|
|
7114
|
-
}
|
|
7115
|
-
if (schema.has_side_effects) {
|
|
7116
|
-
score += 0.1;
|
|
7117
|
-
factors.push("Has side effects");
|
|
7118
|
-
}
|
|
7119
|
-
if (!schema.reversible) {
|
|
7120
|
-
score += 0.1;
|
|
7121
|
-
factors.push("Not reversible");
|
|
7122
|
-
}
|
|
7123
|
-
const failed = constraints.filter((c) => !c.satisfied);
|
|
7124
|
-
if (failed.length > 0) {
|
|
7125
|
-
score += 0.05 * failed.length;
|
|
7126
|
-
factors.push(`${failed.length} unsatisfied constraint(s)`);
|
|
7127
|
-
}
|
|
7128
|
-
score = Math.min(score, 1);
|
|
7129
|
-
let level;
|
|
7130
|
-
if (score <= 0) level = "none";
|
|
7131
|
-
else if (score <= 0.2) level = "low";
|
|
7132
|
-
else if (score <= 0.5) level = "medium";
|
|
7133
|
-
else if (score <= 0.8) level = "high";
|
|
7134
|
-
else level = "critical";
|
|
7135
|
-
return { level, score, factors };
|
|
7136
|
-
}
|
|
7137
|
-
var IdelSchemaRegistry, IdelCompiler;
|
|
7138
|
-
var init_idel_compiler = __esm({
|
|
7139
|
-
"src/idel/idel.compiler.ts"() {
|
|
7140
|
-
IdelSchemaRegistry = class {
|
|
7141
|
-
constructor() {
|
|
7142
|
-
this.schemas = /* @__PURE__ */ new Map();
|
|
7143
|
-
this.aliases = /* @__PURE__ */ new Map();
|
|
7144
|
-
}
|
|
7145
|
-
register(schema) {
|
|
7146
|
-
this.schemas.set(schema.intent, schema);
|
|
7147
|
-
}
|
|
7148
|
-
registerAlias(alias, intent) {
|
|
7149
|
-
this.aliases.set(alias.toLowerCase(), intent);
|
|
7150
|
-
}
|
|
7151
|
-
get(intent) {
|
|
7152
|
-
return this.schemas.get(intent);
|
|
7153
|
-
}
|
|
7154
|
-
resolve(raw) {
|
|
7155
|
-
const exact = this.schemas.get(raw);
|
|
7156
|
-
if (exact) return exact;
|
|
7157
|
-
const aliased = this.aliases.get(raw.toLowerCase());
|
|
7158
|
-
if (aliased) return this.schemas.get(aliased);
|
|
7159
|
-
const candidates = [...this.schemas.keys()].filter(
|
|
7160
|
-
(k) => k.startsWith(raw + ".") || k.toLowerCase().includes(raw.toLowerCase())
|
|
7161
|
-
);
|
|
7162
|
-
if (candidates.length === 1) {
|
|
7163
|
-
return this.schemas.get(candidates[0]);
|
|
7164
|
-
}
|
|
7165
|
-
return void 0;
|
|
7166
|
-
}
|
|
7167
|
-
/**
|
|
7168
|
-
* Find all schemas that partially match the raw input.
|
|
7169
|
-
* Returns scored candidates for ambiguity resolution.
|
|
7170
|
-
*/
|
|
7171
|
-
findCandidates(raw) {
|
|
7172
|
-
const normalized = raw.toLowerCase().trim();
|
|
7173
|
-
const results = [];
|
|
7174
|
-
for (const [key, schema] of this.schemas) {
|
|
7175
|
-
let score = 0;
|
|
7176
|
-
if (key === raw) {
|
|
7177
|
-
score = 1;
|
|
7178
|
-
} else if (key.toLowerCase() === normalized) {
|
|
7179
|
-
score = 0.95;
|
|
7180
|
-
} else if (this.aliases.get(normalized) === key) {
|
|
7181
|
-
score = 0.9;
|
|
7182
|
-
} else if (key.toLowerCase().startsWith(normalized)) {
|
|
7183
|
-
score = 0.7;
|
|
7184
|
-
} else if (key.toLowerCase().includes(normalized)) {
|
|
7185
|
-
score = 0.5;
|
|
7186
|
-
} else if (schema.tags?.some((t) => t.toLowerCase().includes(normalized))) {
|
|
7187
|
-
score = 0.4;
|
|
7188
|
-
} else if (schema.description.toLowerCase().includes(normalized)) {
|
|
7189
|
-
score = 0.3;
|
|
7190
|
-
}
|
|
7191
|
-
if (score > 0) {
|
|
7192
|
-
results.push({ schema, score });
|
|
7193
|
-
}
|
|
7194
|
-
}
|
|
7195
|
-
return results.sort((a, b) => b.score - a.score);
|
|
7196
|
-
}
|
|
7197
|
-
list() {
|
|
7198
|
-
return [...this.schemas.values()];
|
|
7199
|
-
}
|
|
7200
|
-
};
|
|
7201
|
-
IdelCompiler = class {
|
|
7202
|
-
constructor(registry) {
|
|
7203
|
-
this.registry = registry;
|
|
7204
|
-
}
|
|
7205
|
-
/**
|
|
7206
|
-
* Compile a raw intent proposal into a validated, executable structure.
|
|
7207
|
-
*/
|
|
7208
|
-
compile(proposal) {
|
|
7209
|
-
const errors = [];
|
|
7210
|
-
const candidates = this.registry.findCandidates(proposal.raw);
|
|
7211
|
-
if (candidates.length === 0) {
|
|
7212
|
-
return {
|
|
7213
|
-
ok: false,
|
|
7214
|
-
errors: [{
|
|
7215
|
-
code: "IDEL_UNKNOWN_INTENT",
|
|
7216
|
-
message: `No intent found matching '${proposal.raw}'`
|
|
7217
|
-
}]
|
|
7218
|
-
};
|
|
7219
|
-
}
|
|
7220
|
-
const best = candidates[0];
|
|
7221
|
-
const schema = best.schema;
|
|
7222
|
-
const alternatives = candidates.slice(1, 4).filter((c) => c.score >= 0.3).map((c) => ({
|
|
7223
|
-
intent: c.schema.intent,
|
|
7224
|
-
confidence: c.score,
|
|
7225
|
-
reason: c.schema.description
|
|
7226
|
-
}));
|
|
7227
|
-
const constraints = [];
|
|
7228
|
-
const clarifications = [];
|
|
7229
|
-
const params = { ...proposal.params };
|
|
7230
|
-
for (const paramSchema of schema.params) {
|
|
7231
|
-
const value = params[paramSchema.name];
|
|
7232
|
-
if (paramSchema.required && value === void 0) {
|
|
7233
|
-
if (paramSchema.default !== void 0) {
|
|
7234
|
-
params[paramSchema.name] = paramSchema.default;
|
|
7235
|
-
constraints.push({
|
|
7236
|
-
kind: "required_param",
|
|
7237
|
-
field: paramSchema.name,
|
|
7238
|
-
description: `Defaulted to ${JSON.stringify(paramSchema.default)}`,
|
|
7239
|
-
satisfied: true,
|
|
7240
|
-
value: paramSchema.default
|
|
7241
|
-
});
|
|
7242
|
-
} else {
|
|
7243
|
-
constraints.push({
|
|
7244
|
-
kind: "required_param",
|
|
7245
|
-
field: paramSchema.name,
|
|
7246
|
-
description: `Required parameter '${paramSchema.name}' is missing`,
|
|
7247
|
-
satisfied: false
|
|
7248
|
-
});
|
|
7249
|
-
clarifications.push({
|
|
7250
|
-
id: `clarify_${paramSchema.name}`,
|
|
7251
|
-
question: paramSchema.description ?? `What is the ${paramSchema.name}?`,
|
|
7252
|
-
field: paramSchema.name,
|
|
7253
|
-
options: paramSchema.enum?.map(String),
|
|
7254
|
-
required: true
|
|
7255
|
-
});
|
|
7256
|
-
}
|
|
7257
|
-
continue;
|
|
7258
|
-
}
|
|
7259
|
-
if (value === void 0) continue;
|
|
7260
|
-
const typeValid = validateType(value, paramSchema.type);
|
|
7261
|
-
constraints.push({
|
|
7262
|
-
kind: "type_check",
|
|
7263
|
-
field: paramSchema.name,
|
|
7264
|
-
description: `Must be ${paramSchema.type}`,
|
|
7265
|
-
satisfied: typeValid,
|
|
7266
|
-
value,
|
|
7267
|
-
expected: paramSchema.type
|
|
7268
|
-
});
|
|
7269
|
-
if (!typeValid) {
|
|
7270
|
-
errors.push({
|
|
7271
|
-
code: "IDEL_TYPE_ERROR",
|
|
7272
|
-
message: `Parameter '${paramSchema.name}' must be ${paramSchema.type}, got ${typeof value}`,
|
|
7273
|
-
field: paramSchema.name
|
|
7274
|
-
});
|
|
7275
|
-
}
|
|
7276
|
-
if (paramSchema.min !== void 0 || paramSchema.max !== void 0) {
|
|
7277
|
-
const numVal = typeof value === "number" ? value : Number(value);
|
|
7278
|
-
const inRange = (paramSchema.min === void 0 || numVal >= paramSchema.min) && (paramSchema.max === void 0 || numVal <= paramSchema.max);
|
|
7279
|
-
constraints.push({
|
|
7280
|
-
kind: "range",
|
|
7281
|
-
field: paramSchema.name,
|
|
7282
|
-
description: `Must be between ${paramSchema.min ?? "-\u221E"} and ${paramSchema.max ?? "\u221E"}`,
|
|
7283
|
-
satisfied: inRange,
|
|
7284
|
-
value: numVal
|
|
7285
|
-
});
|
|
7286
|
-
}
|
|
7287
|
-
if (paramSchema.pattern) {
|
|
7288
|
-
const matches = new RegExp(paramSchema.pattern).test(String(value));
|
|
7289
|
-
constraints.push({
|
|
7290
|
-
kind: "pattern",
|
|
7291
|
-
field: paramSchema.name,
|
|
7292
|
-
description: `Must match ${paramSchema.pattern}`,
|
|
7293
|
-
satisfied: matches,
|
|
7294
|
-
value,
|
|
7295
|
-
expected: paramSchema.pattern
|
|
7296
|
-
});
|
|
7297
|
-
}
|
|
7298
|
-
if (paramSchema.enum) {
|
|
7299
|
-
const inEnum = paramSchema.enum.some(
|
|
7300
|
-
(e) => JSON.stringify(e) === JSON.stringify(value)
|
|
7301
|
-
);
|
|
7302
|
-
constraints.push({
|
|
7303
|
-
kind: "custom",
|
|
7304
|
-
field: paramSchema.name,
|
|
7305
|
-
description: `Must be one of: ${paramSchema.enum.join(", ")}`,
|
|
7306
|
-
satisfied: inEnum,
|
|
7307
|
-
value,
|
|
7308
|
-
expected: paramSchema.enum
|
|
7309
|
-
});
|
|
7310
|
-
}
|
|
7311
|
-
}
|
|
7312
|
-
const risk = assessRisk(schema, proposal, constraints);
|
|
7313
|
-
const unsatisfied = constraints.filter((c) => !c.satisfied);
|
|
7314
|
-
const needsClarification = clarifications.length > 0;
|
|
7315
|
-
let confidence = best.score;
|
|
7316
|
-
if (unsatisfied.length > 0) {
|
|
7317
|
-
confidence *= 1 - unsatisfied.length / Math.max(constraints.length, 1) * 0.5;
|
|
7318
|
-
}
|
|
7319
|
-
if (errors.length > 0) {
|
|
7320
|
-
confidence *= 0.5;
|
|
7321
|
-
}
|
|
7322
|
-
const compiled = {
|
|
7323
|
-
intent: schema.intent,
|
|
7324
|
-
actor_id: proposal.actor_id,
|
|
7325
|
-
target: proposal.target,
|
|
7326
|
-
params,
|
|
7327
|
-
constraints,
|
|
7328
|
-
confidence,
|
|
7329
|
-
alternatives,
|
|
7330
|
-
needs_clarification: needsClarification,
|
|
7331
|
-
clarifications,
|
|
7332
|
-
expected_outcome: schema.description,
|
|
7333
|
-
fallback: schema.related?.[0],
|
|
7334
|
-
risk,
|
|
7335
|
-
metadata: {
|
|
7336
|
-
schema_intent: schema.intent,
|
|
7337
|
-
resolved_from: proposal.raw,
|
|
7338
|
-
has_side_effects: schema.has_side_effects,
|
|
7339
|
-
reversible: schema.reversible
|
|
7340
|
-
}
|
|
7341
|
-
};
|
|
7342
|
-
return {
|
|
7343
|
-
ok: errors.length === 0 && !needsClarification,
|
|
7344
|
-
compiled,
|
|
7345
|
-
errors
|
|
7346
|
-
};
|
|
7347
|
-
}
|
|
7348
|
-
/**
|
|
7349
|
-
* Apply clarification answers and re-compile.
|
|
7350
|
-
*/
|
|
7351
|
-
applyClarifications(compiled, answers) {
|
|
7352
|
-
const proposal = {
|
|
7353
|
-
raw: compiled.intent,
|
|
7354
|
-
actor_id: compiled.actor_id,
|
|
7355
|
-
target: compiled.target,
|
|
7356
|
-
params: { ...compiled.params, ...answers }
|
|
7357
|
-
};
|
|
7358
|
-
return this.compile(proposal);
|
|
7359
|
-
}
|
|
7360
|
-
};
|
|
7361
|
-
}
|
|
7362
|
-
});
|
|
7363
|
-
|
|
7364
|
-
// src/needle/needle.engine.ts
|
|
7365
|
-
import { randomBytes as randomBytes8 } from "crypto";
|
|
7366
|
-
function assembleNeedle(params) {
|
|
7367
|
-
return {
|
|
7368
|
-
needle_id: randomBytes8(16).toString("hex"),
|
|
7369
|
-
phase: "created",
|
|
7370
|
-
tps_coordinate: params.tps_coordinate,
|
|
7371
|
-
intent: params.intent,
|
|
7372
|
-
presence: params.presence,
|
|
7373
|
-
writ: params.writ,
|
|
7374
|
-
grants: params.grants,
|
|
7375
|
-
created_at: Date.now()
|
|
7376
|
-
};
|
|
7377
|
-
}
|
|
7378
|
-
function classifyStitch(observation, verdict) {
|
|
7379
|
-
if (verdict.status === "failed" || verdict.status === "disputed") {
|
|
7380
|
-
return "torn";
|
|
7381
|
-
}
|
|
7382
|
-
if (observation.decision === "DENY") {
|
|
7383
|
-
return "silent";
|
|
7384
|
-
}
|
|
7385
|
-
if (verdict.isDeed) {
|
|
7386
|
-
return "deed";
|
|
7387
|
-
}
|
|
7388
|
-
return "silent";
|
|
7389
|
-
}
|
|
7390
|
-
function formStitch(needle, observation, verdict, receipt) {
|
|
7391
|
-
return {
|
|
7392
|
-
stitch_id: needle.needle_id,
|
|
7393
|
-
kind: classifyStitch(observation, verdict),
|
|
7394
|
-
intent: needle.intent.intent,
|
|
7395
|
-
actor_id: needle.intent.actor_id,
|
|
7396
|
-
tps_coordinate: needle.tps_coordinate,
|
|
7397
|
-
observation,
|
|
7398
|
-
verdict,
|
|
7399
|
-
receipt,
|
|
7400
|
-
thread_id: receipt.thread_id,
|
|
7401
|
-
sequence: receipt.sequence,
|
|
7402
|
-
stitched_at: Date.now()
|
|
7403
|
-
};
|
|
7404
|
-
}
|
|
7405
|
-
async function runNeedlePipeline(needle, config, threadState, prevReceipt, expectedOutcome) {
|
|
7406
|
-
const obs = createObservation("http");
|
|
7407
|
-
obs.intent = needle.intent.intent;
|
|
7408
|
-
obs.actorId = needle.intent.actor_id;
|
|
7409
|
-
needle.phase = "validated";
|
|
7410
|
-
let stage = startStage(obs, "loom.validate");
|
|
7411
|
-
const validation = validateWrit(
|
|
7412
|
-
needle.writ,
|
|
7413
|
-
config.public_key,
|
|
7414
|
-
threadState,
|
|
7415
|
-
needle.grants
|
|
7416
|
-
);
|
|
7417
|
-
if (!validation.valid) {
|
|
7418
|
-
endStage(stage, "fail", validation.error);
|
|
7419
|
-
return failNeedle(needle, obs, "validated", "LOOM_VALIDATION_FAILED", validation.error ?? "Writ validation failed");
|
|
7420
|
-
}
|
|
7421
|
-
endStage(stage, "ok");
|
|
7422
|
-
if (config.sensors && config.sensors.length > 0) {
|
|
7423
|
-
stage = startStage(obs, "sensors.evaluate");
|
|
7424
|
-
const sensorInput = {
|
|
7425
|
-
intent: needle.intent.intent,
|
|
7426
|
-
actorId: needle.intent.actor_id,
|
|
7427
|
-
metadata: {
|
|
7428
|
-
observation: obs,
|
|
7429
|
-
needle_id: needle.needle_id,
|
|
7430
|
-
tps_coordinate: needle.tps_coordinate,
|
|
7431
|
-
writ: needle.writ,
|
|
7432
|
-
grants: needle.grants,
|
|
7433
|
-
params: needle.intent.params
|
|
7434
|
-
}
|
|
7435
|
-
};
|
|
7436
|
-
for (const sensor of config.sensors) {
|
|
7437
|
-
if (sensor.supports && !sensor.supports(sensorInput)) continue;
|
|
7438
|
-
const t0 = Date.now();
|
|
7439
|
-
let decision;
|
|
7440
|
-
try {
|
|
7441
|
-
const rawDecision = await sensor.run(sensorInput);
|
|
7442
|
-
decision = normalizeSensorDecision(rawDecision);
|
|
7443
|
-
} catch (err) {
|
|
7444
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
7445
|
-
recordSensor(obs, sensor.name, false, 100, Date.now() - t0, [`sensor_error:${msg}`]);
|
|
7446
|
-
endStage(stage, "fail", `Sensor ${sensor.name} threw: ${msg}`);
|
|
7447
|
-
return failNeedle(needle, obs, "validated", "SENSOR_ERROR", `Sensor ${sensor.name} failed: ${msg}`);
|
|
7448
|
-
}
|
|
7449
|
-
recordSensor(obs, sensor.name, decision.allow, decision.riskScore, Date.now() - t0, decision.reasons);
|
|
7450
|
-
if (!decision.allow) {
|
|
7451
|
-
endStage(stage, "fail", `Sensor ${sensor.name} denied`);
|
|
7452
|
-
return failNeedle(needle, obs, "validated", "SENSOR_DENY", decision.reasons[0] ?? `Denied by ${sensor.name}`);
|
|
7453
|
-
}
|
|
7454
|
-
}
|
|
7455
|
-
endStage(stage, "ok");
|
|
7456
|
-
}
|
|
7457
|
-
needle.phase = "executing";
|
|
7458
|
-
stage = startStage(obs, "handler.execute");
|
|
7459
|
-
const handler = config.handlers.get(needle.intent.intent);
|
|
7460
|
-
if (!handler) {
|
|
7461
|
-
endStage(stage, "fail", `No handler for intent '${needle.intent.intent}'`);
|
|
7462
|
-
return failNeedle(needle, obs, "executing", "NO_HANDLER", `No handler registered for intent '${needle.intent.intent}'`);
|
|
7463
|
-
}
|
|
7464
|
-
const handlerCtx = {
|
|
7465
|
-
needle_id: needle.needle_id,
|
|
7466
|
-
actor_id: needle.intent.actor_id,
|
|
7467
|
-
presence_id: needle.presence.presence_id,
|
|
7468
|
-
writ: needle.writ,
|
|
7469
|
-
grants: needle.grants,
|
|
7470
|
-
tps_coordinate: needle.tps_coordinate
|
|
7471
|
-
};
|
|
7472
|
-
let handlerResult;
|
|
7473
|
-
try {
|
|
7474
|
-
handlerResult = await handler(needle.intent, handlerCtx);
|
|
7475
|
-
} catch (err) {
|
|
7476
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
7477
|
-
endStage(stage, "fail", msg);
|
|
7478
|
-
return failNeedle(needle, obs, "executing", "HANDLER_ERROR", msg);
|
|
7479
|
-
}
|
|
7480
|
-
if (!handlerResult.ok) {
|
|
7481
|
-
endStage(stage, "fail", handlerResult.effect);
|
|
7482
|
-
obs.decision = "DENY";
|
|
7483
|
-
obs.resultCode = handlerResult.effect;
|
|
7484
|
-
obs.statusCode = handlerResult.status_code ?? 400;
|
|
7485
|
-
} else {
|
|
7486
|
-
endStage(stage, "ok");
|
|
7487
|
-
obs.decision = "ALLOW";
|
|
7488
|
-
obs.resultCode = handlerResult.effect;
|
|
7489
|
-
obs.statusCode = handlerResult.status_code ?? 200;
|
|
7490
|
-
}
|
|
7491
|
-
if (handlerResult.data) {
|
|
7492
|
-
obs.facts = { ...obs.facts, ...handlerResult.data };
|
|
7493
|
-
}
|
|
7494
|
-
needle.phase = "observed";
|
|
7495
|
-
finalizeObservation(obs, obs.decision ?? "DENY", obs.statusCode ?? 500, obs.resultCode);
|
|
7496
|
-
needle.observation = obs;
|
|
7497
|
-
const verdict = scoreTruth(obs, expectedOutcome);
|
|
7498
|
-
needle.verdict = verdict;
|
|
7499
|
-
needle.phase = "stitched";
|
|
7500
|
-
stage = startStage(obs, "stitch.form");
|
|
7501
|
-
const receipt = createReceipt(
|
|
7502
|
-
needle.writ,
|
|
7503
|
-
obs.decision ?? "DENY",
|
|
7504
|
-
prevReceipt
|
|
7505
|
-
);
|
|
7506
|
-
needle.receipt = receipt;
|
|
7507
|
-
const newThreadState = updateThreadState(
|
|
7508
|
-
receipt,
|
|
7509
|
-
needle.intent.actor_id
|
|
7510
|
-
);
|
|
7511
|
-
const stitch = formStitch(needle, obs, verdict, receipt);
|
|
7512
|
-
needle.completed_at = Date.now();
|
|
7513
|
-
endStage(stage, "ok");
|
|
7514
|
-
return {
|
|
7515
|
-
ok: handlerResult.ok,
|
|
7516
|
-
needle,
|
|
7517
|
-
stitch,
|
|
7518
|
-
thread_state: newThreadState
|
|
7519
|
-
};
|
|
7520
|
-
}
|
|
7521
|
-
function failNeedle(needle, obs, phase, code, message) {
|
|
7522
|
-
needle.phase = "failed";
|
|
7523
|
-
needle.error = { phase, code, message };
|
|
7524
|
-
needle.completed_at = Date.now();
|
|
7525
|
-
obs.decision = obs.decision ?? "DENY";
|
|
7526
|
-
obs.statusCode = obs.statusCode ?? 500;
|
|
7527
|
-
finalizeObservation(obs, obs.decision, obs.statusCode, obs.resultCode);
|
|
7528
|
-
needle.observation = obs;
|
|
7529
|
-
const verdict = scoreTruth(obs);
|
|
7530
|
-
needle.verdict = verdict;
|
|
7531
|
-
return {
|
|
7532
|
-
ok: false,
|
|
7533
|
-
needle
|
|
7534
|
-
};
|
|
7535
|
-
}
|
|
7536
|
-
var init_needle_engine = __esm({
|
|
7537
|
-
"src/needle/needle.engine.ts"() {
|
|
7538
|
-
init_axis_observation();
|
|
7539
|
-
init_truth_scoring();
|
|
7540
|
-
init_loom_engine();
|
|
7541
|
-
init_axis_sensor();
|
|
7542
|
-
}
|
|
7543
|
-
});
|
|
7544
|
-
|
|
7545
|
-
// src/needle/knot.engine.ts
|
|
7546
|
-
import { createHash as createHash8, randomBytes as randomBytes9 } from "crypto";
|
|
7547
|
-
function openKnot(params) {
|
|
7548
|
-
const isIrreversible = params.type === "irreversible";
|
|
7549
|
-
return {
|
|
7550
|
-
knot_id: `knot_${randomBytes9(16).toString("hex")}`,
|
|
7551
|
-
type: params.type,
|
|
7552
|
-
status: "open",
|
|
7553
|
-
stitch_ids: [],
|
|
7554
|
-
thread_id: params.thread_id,
|
|
7555
|
-
tps_anchor: params.tps_anchor,
|
|
7556
|
-
irreversible: isIrreversible,
|
|
7557
|
-
capsule_id: params.capsule_id,
|
|
7558
|
-
law_ref: params.law_ref,
|
|
7559
|
-
branch_ids: [],
|
|
7560
|
-
required_count: params.required_count,
|
|
7561
|
-
all_or_nothing: params.all_or_nothing ?? (params.type === "authority" || isIrreversible),
|
|
7562
|
-
actor_id: params.actor_id,
|
|
7563
|
-
created_at: Date.now()
|
|
7564
|
-
};
|
|
7565
|
-
}
|
|
7566
|
-
function addStitchToKnot(knot, stitch) {
|
|
7567
|
-
if (knot.status !== "open") {
|
|
7568
|
-
return `Knot ${knot.knot_id} is ${knot.status}, cannot add stitches`;
|
|
7569
|
-
}
|
|
7570
|
-
if (stitch.thread_id !== knot.thread_id) {
|
|
7571
|
-
return `Stitch thread ${stitch.thread_id} does not match knot thread ${knot.thread_id}`;
|
|
7572
|
-
}
|
|
7573
|
-
if (knot.stitch_ids.includes(stitch.stitch_id)) {
|
|
7574
|
-
return `Stitch ${stitch.stitch_id} already in knot`;
|
|
7575
|
-
}
|
|
7576
|
-
if (knot.type === "authority" && knot.capsule_id) {
|
|
7577
|
-
if (stitch.observation.capsuleId && stitch.observation.capsuleId !== knot.capsule_id) {
|
|
7578
|
-
return `Stitch capsule ${stitch.observation.capsuleId} does not match knot capsule ${knot.capsule_id}`;
|
|
7579
|
-
}
|
|
7580
|
-
}
|
|
7581
|
-
knot.stitch_ids.push(stitch.stitch_id);
|
|
7582
|
-
return null;
|
|
7583
|
-
}
|
|
7584
|
-
function validateKnot(knot, stitches) {
|
|
7585
|
-
const errors = [];
|
|
7586
|
-
const passedIds = [];
|
|
7587
|
-
const failedIds = [];
|
|
7588
|
-
const stitchMap = new Map(stitches.map((s) => [s.stitch_id, s]));
|
|
7589
|
-
for (const sid of knot.stitch_ids) {
|
|
7590
|
-
const stitch = stitchMap.get(sid);
|
|
7591
|
-
if (!stitch) {
|
|
7592
|
-
failedIds.push(sid);
|
|
7593
|
-
errors.push({
|
|
7594
|
-
code: "KNOT_MISSING_STITCH",
|
|
7595
|
-
message: `Stitch ${sid} not found`,
|
|
7596
|
-
stitch_id: sid
|
|
7597
|
-
});
|
|
7598
|
-
continue;
|
|
7599
|
-
}
|
|
7600
|
-
if (stitch.kind === "torn") {
|
|
7601
|
-
failedIds.push(sid);
|
|
7602
|
-
errors.push({
|
|
7603
|
-
code: "KNOT_TORN_STITCH",
|
|
7604
|
-
message: `Stitch ${sid} is torn (failed/disputed)`,
|
|
7605
|
-
stitch_id: sid
|
|
7606
|
-
});
|
|
7607
|
-
continue;
|
|
7608
|
-
}
|
|
7609
|
-
if (knot.type === "irreversible" && stitch.kind !== "deed") {
|
|
7610
|
-
failedIds.push(sid);
|
|
7611
|
-
errors.push({
|
|
7612
|
-
code: "KNOT_REQUIRES_DEED",
|
|
7613
|
-
message: `Irreversible knot requires deed stitch, got '${stitch.kind}'`,
|
|
7614
|
-
stitch_id: sid
|
|
7615
|
-
});
|
|
7616
|
-
continue;
|
|
7617
|
-
}
|
|
7618
|
-
passedIds.push(sid);
|
|
7619
|
-
}
|
|
7620
|
-
if (knot.required_count !== void 0 && knot.stitch_ids.length < knot.required_count) {
|
|
7621
|
-
errors.push({
|
|
7622
|
-
code: "KNOT_INSUFFICIENT_STITCHES",
|
|
7623
|
-
message: `Knot requires ${knot.required_count} stitches, has ${knot.stitch_ids.length}`
|
|
7624
|
-
});
|
|
7625
|
-
}
|
|
7626
|
-
const allPassed = failedIds.length === 0;
|
|
7627
|
-
const canTie = knot.all_or_nothing ? allPassed && (knot.required_count === void 0 || knot.stitch_ids.length >= knot.required_count) : passedIds.length > 0 && (knot.required_count === void 0 || passedIds.length >= knot.required_count);
|
|
7628
|
-
return {
|
|
7629
|
-
valid: allPassed && errors.length === 0,
|
|
7630
|
-
passed_stitch_ids: passedIds,
|
|
7631
|
-
failed_stitch_ids: failedIds,
|
|
7632
|
-
can_tie: canTie,
|
|
7633
|
-
errors
|
|
7634
|
-
};
|
|
7635
|
-
}
|
|
7636
|
-
function tieKnot(knot, stitches) {
|
|
7637
|
-
const validation = validateKnot(knot, stitches);
|
|
7638
|
-
if (!validation.can_tie) {
|
|
7639
|
-
return { ...validation, knot };
|
|
7640
|
-
}
|
|
7641
|
-
const receiptHashes = validation.passed_stitch_ids.map((sid) => stitches.find((s) => s.stitch_id === sid)).sort((a, b) => a.sequence - b.sequence).map((s) => s.receipt.hash);
|
|
7642
|
-
const witnessPayload = receiptHashes.join(":");
|
|
7643
|
-
knot.witness_hash = createHash8("sha256").update(witnessPayload).digest("hex");
|
|
7644
|
-
knot.status = "tied";
|
|
7645
|
-
knot.tied_at = Date.now();
|
|
7646
|
-
return { ...validation, knot };
|
|
7647
|
-
}
|
|
7648
|
-
function breakKnot(knot, request) {
|
|
7649
|
-
if (knot.status === "broken") {
|
|
7650
|
-
return { ok: false, error: "Knot is already broken" };
|
|
7651
|
-
}
|
|
7652
|
-
if (knot.status === "open") {
|
|
7653
|
-
knot.status = "broken";
|
|
7654
|
-
knot.broken_at = Date.now();
|
|
7655
|
-
knot.break_reason = request.reason;
|
|
7656
|
-
return { ok: true };
|
|
7657
|
-
}
|
|
7658
|
-
if (knot.status === "tied") {
|
|
7659
|
-
if (!request.reason) {
|
|
7660
|
-
return { ok: false, error: "Breaking a tied knot requires a reason" };
|
|
7661
|
-
}
|
|
7662
|
-
if ((knot.irreversible || knot.type === "law") && !request.override_grant_id) {
|
|
7663
|
-
return {
|
|
7664
|
-
ok: false,
|
|
7665
|
-
error: `Breaking ${knot.type} knot requires override_grant_id from higher authority`
|
|
7666
|
-
};
|
|
7667
|
-
}
|
|
7668
|
-
knot.status = "broken";
|
|
7669
|
-
knot.broken_at = Date.now();
|
|
7670
|
-
knot.break_reason = request.reason;
|
|
7671
|
-
return { ok: true };
|
|
7672
|
-
}
|
|
7673
|
-
return { ok: false, error: `Cannot break knot in status '${knot.status}'` };
|
|
7674
|
-
}
|
|
7675
|
-
function forkFromKnot(knot, branchId, decisionStitchId) {
|
|
7676
|
-
if (knot.status !== "tied" && knot.status !== "open") {
|
|
7677
|
-
return { ok: false, error: `Cannot fork from knot in status '${knot.status}'` };
|
|
7678
|
-
}
|
|
7679
|
-
if (decisionStitchId) {
|
|
7680
|
-
if (!knot.stitch_ids.includes(decisionStitchId)) {
|
|
7681
|
-
return { ok: false, error: `Decision stitch ${decisionStitchId} is not part of this knot` };
|
|
7682
|
-
}
|
|
7683
|
-
knot.decision_stitch_id = decisionStitchId;
|
|
7684
|
-
}
|
|
7685
|
-
knot.branch_ids.push(branchId);
|
|
7686
|
-
knot.status = "forked";
|
|
7687
|
-
return { ok: true };
|
|
7688
|
-
}
|
|
7689
|
-
function isKnotOpen(knot) {
|
|
7690
|
-
return knot.status === "open";
|
|
7691
|
-
}
|
|
7692
|
-
function isPointOfNoReturn(knot) {
|
|
7693
|
-
return knot.irreversible && knot.status === "tied";
|
|
7694
|
-
}
|
|
7695
|
-
function findKnotsForStitch(stitchId, knots) {
|
|
7696
|
-
return knots.filter((k) => k.stitch_ids.includes(stitchId));
|
|
7697
|
-
}
|
|
7698
|
-
function getIrreversibleKnots(knots) {
|
|
7699
|
-
return knots.filter((k) => k.irreversible && k.status === "tied");
|
|
7700
|
-
}
|
|
7701
|
-
function getDecisionPoints(knots) {
|
|
7702
|
-
return knots.filter((k) => k.type === "decision" || k.status === "forked");
|
|
7703
|
-
}
|
|
7704
|
-
var init_knot_engine = __esm({
|
|
7705
|
-
"src/needle/knot.engine.ts"() {
|
|
7706
|
-
}
|
|
7707
|
-
});
|
|
7708
|
-
|
|
7709
|
-
// src/needle/fabric.engine.ts
|
|
7710
|
-
import { createHash as createHash9, randomBytes as randomBytes10 } from "crypto";
|
|
7711
|
-
function createFabric() {
|
|
7712
|
-
return {
|
|
7713
|
-
fabric_id: `fab_${randomBytes10(16).toString("hex")}`,
|
|
7714
|
-
state_hash: hashState(/* @__PURE__ */ new Map()),
|
|
7715
|
-
cells: /* @__PURE__ */ new Map(),
|
|
7716
|
-
thread_ids: [],
|
|
7717
|
-
stitch_count: 0,
|
|
7718
|
-
knot_count: 0,
|
|
7719
|
-
computed_at: Date.now(),
|
|
7720
|
-
version: 0
|
|
7721
|
-
};
|
|
7722
|
-
}
|
|
7723
|
-
function applyStitch(fabric, stitch, effect) {
|
|
7724
|
-
for (const [key, value] of Object.entries(effect.mutations)) {
|
|
7725
|
-
if (value === null) {
|
|
7726
|
-
fabric.cells.delete(key);
|
|
7727
|
-
} else {
|
|
7728
|
-
const existing = fabric.cells.get(key);
|
|
7729
|
-
if (existing?.locked) {
|
|
7730
|
-
continue;
|
|
7731
|
-
}
|
|
7732
|
-
fabric.cells.set(key, {
|
|
7733
|
-
key,
|
|
7734
|
-
value,
|
|
7735
|
-
last_stitch_id: stitch.stitch_id,
|
|
7736
|
-
last_tps: stitch.tps_coordinate,
|
|
7737
|
-
write_count: (existing?.write_count ?? 0) + 1,
|
|
7738
|
-
locked: false
|
|
7739
|
-
});
|
|
7740
|
-
}
|
|
7741
|
-
}
|
|
7742
|
-
if (!fabric.thread_ids.includes(stitch.thread_id)) {
|
|
7743
|
-
fabric.thread_ids.push(stitch.thread_id);
|
|
7744
|
-
}
|
|
7745
|
-
fabric.stitch_count++;
|
|
7746
|
-
fabric.version++;
|
|
7747
|
-
fabric.projected_at_tps = stitch.tps_coordinate ?? fabric.projected_at_tps;
|
|
7748
|
-
fabric.computed_at = Date.now();
|
|
7749
|
-
fabric.state_hash = hashState(fabric.cells);
|
|
7750
|
-
}
|
|
7751
|
-
function weave(stitches, resolver, knots) {
|
|
7752
|
-
const fabric = createFabric();
|
|
7753
|
-
const sorted = [...stitches].sort((a, b) => a.sequence - b.sequence);
|
|
7754
|
-
for (const stitch of sorted) {
|
|
7755
|
-
if (stitch.kind === "torn") continue;
|
|
7756
|
-
const effect = resolver(stitch);
|
|
7757
|
-
applyStitch(fabric, stitch, effect);
|
|
7758
|
-
}
|
|
7759
|
-
if (knots) {
|
|
7760
|
-
for (const knot of knots) {
|
|
7761
|
-
if (knot.irreversible && knot.status === "tied") {
|
|
7762
|
-
lockCellsByKnot(fabric, knot, stitches, resolver);
|
|
7763
|
-
fabric.knot_count++;
|
|
7764
|
-
}
|
|
7765
|
-
}
|
|
7766
|
-
}
|
|
7767
|
-
return fabric;
|
|
7768
|
-
}
|
|
7769
|
-
function projectAt(stitches, resolver, tpsFilter, knots) {
|
|
7770
|
-
const filtered = stitches.filter((s) => tpsFilter(s.tps_coordinate));
|
|
7771
|
-
return weave(filtered, resolver, knots);
|
|
7772
|
-
}
|
|
7773
|
-
function lockCellsByKnot(fabric, knot, stitches, resolver) {
|
|
7774
|
-
const knotStitchIds = new Set(knot.stitch_ids);
|
|
7775
|
-
const knotStitches = stitches.filter((s) => knotStitchIds.has(s.stitch_id));
|
|
7776
|
-
for (const stitch of knotStitches) {
|
|
7777
|
-
const effect = resolver(stitch);
|
|
7778
|
-
for (const key of Object.keys(effect.mutations)) {
|
|
7779
|
-
const cell = fabric.cells.get(key);
|
|
7780
|
-
if (cell) {
|
|
7781
|
-
cell.locked = true;
|
|
7782
|
-
cell.locked_by_knot = knot.knot_id;
|
|
7783
|
-
}
|
|
7784
|
-
}
|
|
7785
|
-
}
|
|
7786
|
-
}
|
|
7787
|
-
function lockCells(fabric, keys, knotId) {
|
|
7788
|
-
for (const key of keys) {
|
|
7789
|
-
const cell = fabric.cells.get(key);
|
|
7790
|
-
if (cell) {
|
|
7791
|
-
cell.locked = true;
|
|
7792
|
-
cell.locked_by_knot = knotId;
|
|
7793
|
-
}
|
|
7794
|
-
}
|
|
7795
|
-
}
|
|
7796
|
-
function queryFabric(fabric, query) {
|
|
7797
|
-
let results = [...fabric.cells.values()];
|
|
7798
|
-
if (query.keys) {
|
|
7799
|
-
const keySet = new Set(query.keys);
|
|
7800
|
-
results = results.filter((c) => keySet.has(c.key));
|
|
7801
|
-
}
|
|
7802
|
-
if (query.prefix) {
|
|
7803
|
-
const prefix = query.prefix;
|
|
7804
|
-
results = results.filter((c) => c.key.startsWith(prefix));
|
|
7805
|
-
}
|
|
7806
|
-
if (query.locked_only) {
|
|
7807
|
-
results = results.filter((c) => c.locked);
|
|
7808
|
-
}
|
|
7809
|
-
return results;
|
|
7810
|
-
}
|
|
7811
|
-
function getFabricValue(fabric, key) {
|
|
7812
|
-
return fabric.cells.get(key)?.value;
|
|
7813
|
-
}
|
|
7814
|
-
function diffFabrics(a, b) {
|
|
7815
|
-
const entries = [];
|
|
7816
|
-
let added = 0;
|
|
7817
|
-
let modified = 0;
|
|
7818
|
-
let deleted = 0;
|
|
7819
|
-
for (const [key, cellB] of b.cells) {
|
|
7820
|
-
const cellA = a.cells.get(key);
|
|
7821
|
-
if (!cellA) {
|
|
7822
|
-
entries.push({
|
|
7823
|
-
key,
|
|
7824
|
-
kind: "added",
|
|
7825
|
-
after: cellB.value,
|
|
7826
|
-
caused_by_stitch: cellB.last_stitch_id
|
|
7827
|
-
});
|
|
7828
|
-
added++;
|
|
7829
|
-
} else if (JSON.stringify(cellA.value) !== JSON.stringify(cellB.value)) {
|
|
7830
|
-
entries.push({
|
|
7831
|
-
key,
|
|
7832
|
-
kind: "modified",
|
|
7833
|
-
before: cellA.value,
|
|
7834
|
-
after: cellB.value,
|
|
7835
|
-
caused_by_stitch: cellB.last_stitch_id
|
|
7836
|
-
});
|
|
7837
|
-
modified++;
|
|
7838
|
-
}
|
|
7839
|
-
}
|
|
7840
|
-
for (const [key, cellA] of a.cells) {
|
|
7841
|
-
if (!b.cells.has(key)) {
|
|
7842
|
-
entries.push({
|
|
7843
|
-
key,
|
|
7844
|
-
kind: "deleted",
|
|
7845
|
-
before: cellA.value
|
|
7846
|
-
});
|
|
7847
|
-
deleted++;
|
|
7848
|
-
}
|
|
7849
|
-
}
|
|
7850
|
-
return {
|
|
7851
|
-
from_fabric_id: a.fabric_id,
|
|
7852
|
-
to_fabric_id: b.fabric_id,
|
|
7853
|
-
entries,
|
|
7854
|
-
added_count: added,
|
|
7855
|
-
modified_count: modified,
|
|
7856
|
-
deleted_count: deleted
|
|
7857
|
-
};
|
|
7858
|
-
}
|
|
7859
|
-
function hashState(cells) {
|
|
7860
|
-
const keys = [...cells.keys()].sort();
|
|
7861
|
-
const payload = keys.map((k) => `${k}=${JSON.stringify(cells.get(k).value)}`).join("\n");
|
|
7862
|
-
return createHash9("sha256").update(payload).digest("hex");
|
|
7863
|
-
}
|
|
7864
|
-
var init_fabric_engine = __esm({
|
|
7865
|
-
"src/needle/fabric.engine.ts"() {
|
|
7866
|
-
}
|
|
7867
|
-
});
|
|
7868
|
-
|
|
7869
|
-
// src/needle/pattern.engine.ts
|
|
7870
|
-
import { randomBytes as randomBytes11 } from "crypto";
|
|
7871
|
-
function detectSequencePatterns(stitches, windowSize, minOccurrences) {
|
|
7872
|
-
if (stitches.length < windowSize || windowSize < 2) return [];
|
|
7873
|
-
const sorted = [...stitches].sort((a, b) => a.sequence - b.sequence);
|
|
7874
|
-
const sequenceCounts = /* @__PURE__ */ new Map();
|
|
7875
|
-
for (let i = 0; i <= sorted.length - windowSize; i++) {
|
|
7876
|
-
const window = sorted.slice(i, i + windowSize);
|
|
7877
|
-
const key = window.map((s) => s.intent).join("\u2192");
|
|
7878
|
-
const ids = window.map((s) => s.stitch_id);
|
|
7879
|
-
const existing = sequenceCounts.get(key);
|
|
7880
|
-
if (existing) {
|
|
7881
|
-
existing.count++;
|
|
7882
|
-
existing.stitch_ids.push(ids);
|
|
7883
|
-
} else {
|
|
7884
|
-
sequenceCounts.set(key, { count: 1, stitch_ids: [ids] });
|
|
7885
|
-
}
|
|
7886
|
-
}
|
|
7887
|
-
const patterns = [];
|
|
7888
|
-
const now = Date.now();
|
|
7889
|
-
for (const [key, data] of sequenceCounts) {
|
|
7890
|
-
if (data.count < minOccurrences) continue;
|
|
7891
|
-
const intents = key.split("\u2192");
|
|
7892
|
-
const confidence = Math.min(data.count / (minOccurrences * 2), 1);
|
|
7893
|
-
patterns.push({
|
|
7894
|
-
pattern_id: `pat_seq_${randomBytes11(8).toString("hex")}`,
|
|
7895
|
-
kind: "sequence",
|
|
7896
|
-
name: `Sequence: ${intents.join(" \u2192 ")}`,
|
|
7897
|
-
signature: {
|
|
7898
|
-
intent_sequence: intents,
|
|
7899
|
-
min_length: windowSize,
|
|
7900
|
-
max_length: windowSize
|
|
7901
|
-
},
|
|
7902
|
-
confidence,
|
|
7903
|
-
occurrence_count: data.count,
|
|
7904
|
-
first_seen_at: now,
|
|
7905
|
-
last_seen_at: now,
|
|
7906
|
-
seen_in_threads: [...new Set(
|
|
7907
|
-
data.stitch_ids.flatMap(
|
|
7908
|
-
(ids) => ids.map((id) => sorted.find((s) => s.stitch_id === id)?.thread_id).filter(Boolean)
|
|
7909
|
-
)
|
|
7910
|
-
)],
|
|
7911
|
-
classification: "unclassified"
|
|
7912
|
-
});
|
|
7913
|
-
}
|
|
7914
|
-
return patterns;
|
|
7915
|
-
}
|
|
7916
|
-
function detectKnotPatterns(knots, minOccurrences) {
|
|
7917
|
-
const groups = /* @__PURE__ */ new Map();
|
|
7918
|
-
for (const knot of knots) {
|
|
7919
|
-
if (knot.status !== "tied") continue;
|
|
7920
|
-
const key = `${knot.type}:${knot.stitch_ids.length}`;
|
|
7921
|
-
const group = groups.get(key) ?? [];
|
|
7922
|
-
group.push(knot);
|
|
7923
|
-
groups.set(key, group);
|
|
7924
|
-
}
|
|
7925
|
-
const patterns = [];
|
|
7926
|
-
const now = Date.now();
|
|
7927
|
-
for (const [key, group] of groups) {
|
|
7928
|
-
if (group.length < minOccurrences) continue;
|
|
7929
|
-
const [type, sizeStr] = key.split(":");
|
|
7930
|
-
const size = parseInt(sizeStr, 10);
|
|
7931
|
-
const confidence = Math.min(group.length / (minOccurrences * 2), 1);
|
|
7932
|
-
patterns.push({
|
|
7933
|
-
pattern_id: `pat_knot_${randomBytes11(8).toString("hex")}`,
|
|
7934
|
-
kind: "knot",
|
|
7935
|
-
name: `Knot: ${type} (${size} stitches)`,
|
|
7936
|
-
signature: {
|
|
7937
|
-
knot_type: type,
|
|
7938
|
-
knot_size: size
|
|
7939
|
-
},
|
|
7940
|
-
confidence,
|
|
7941
|
-
occurrence_count: group.length,
|
|
7942
|
-
first_seen_at: now,
|
|
7943
|
-
last_seen_at: now,
|
|
7944
|
-
seen_in_threads: [...new Set(group.map((k) => k.thread_id))],
|
|
7945
|
-
classification: "unclassified"
|
|
7946
|
-
});
|
|
7947
|
-
}
|
|
7948
|
-
return patterns;
|
|
7949
|
-
}
|
|
7950
|
-
function matchPatterns(stitches, patterns) {
|
|
7951
|
-
const sorted = [...stitches].sort((a, b) => a.sequence - b.sequence);
|
|
7952
|
-
const matches = [];
|
|
7953
|
-
const now = Date.now();
|
|
7954
|
-
for (const pattern of patterns) {
|
|
7955
|
-
if (pattern.kind === "sequence" && pattern.signature.intent_sequence) {
|
|
7956
|
-
const seq = pattern.signature.intent_sequence;
|
|
7957
|
-
const seqLen = seq.length;
|
|
7958
|
-
for (let i = 0; i <= sorted.length - seqLen; i++) {
|
|
7959
|
-
const window = sorted.slice(i, i + seqLen);
|
|
7960
|
-
const windowIntents = window.map((s) => s.intent);
|
|
7961
|
-
if (windowIntents.every((intent, idx) => intent === seq[idx])) {
|
|
7962
|
-
matches.push({
|
|
7963
|
-
pattern_id: pattern.pattern_id,
|
|
7964
|
-
matched_stitch_ids: window.map((s) => s.stitch_id),
|
|
7965
|
-
match_score: 1,
|
|
7966
|
-
thread_id: window[0].thread_id,
|
|
7967
|
-
detected_at: now
|
|
7968
|
-
});
|
|
7969
|
-
}
|
|
7970
|
-
}
|
|
7971
|
-
}
|
|
7972
|
-
}
|
|
7973
|
-
return matches;
|
|
7974
|
-
}
|
|
7975
|
-
function recordOccurrence(pattern, threadId) {
|
|
7976
|
-
pattern.occurrence_count++;
|
|
7977
|
-
pattern.last_seen_at = Date.now();
|
|
7978
|
-
pattern.confidence = 1 - 1 / (1 + pattern.occurrence_count * 0.5);
|
|
7979
|
-
if (!pattern.seen_in_threads.includes(threadId)) {
|
|
7980
|
-
pattern.seen_in_threads.push(threadId);
|
|
7981
|
-
}
|
|
7982
|
-
}
|
|
7983
|
-
function detectAnomalies(recentStitches, knownPatterns, threshold = 0.7) {
|
|
7984
|
-
const anomalies = [];
|
|
7985
|
-
const sorted = [...recentStitches].sort((a, b) => a.sequence - b.sequence);
|
|
7986
|
-
const now = Date.now();
|
|
7987
|
-
for (const pattern of knownPatterns) {
|
|
7988
|
-
if (pattern.kind !== "sequence" || !pattern.signature.intent_sequence) continue;
|
|
7989
|
-
if (pattern.confidence < threshold) continue;
|
|
7990
|
-
const seq = pattern.signature.intent_sequence;
|
|
7991
|
-
if (sorted.length >= 1 && sorted.length < seq.length) {
|
|
7992
|
-
const partialMatch = sorted.every(
|
|
7993
|
-
(s, i) => i < seq.length && s.intent === seq[i]
|
|
7994
|
-
);
|
|
7995
|
-
if (partialMatch) {
|
|
7996
|
-
const expectedNext = seq[sorted.length];
|
|
7997
|
-
const lastStitch = sorted[sorted.length - 1];
|
|
7998
|
-
if (pattern.occurrence_count >= 3) {
|
|
7999
|
-
anomalies.push({
|
|
8000
|
-
pattern_id: `pat_anom_${randomBytes11(8).toString("hex")}`,
|
|
8001
|
-
kind: "anomaly",
|
|
8002
|
-
name: `Incomplete: ${pattern.name}`,
|
|
8003
|
-
description: `Expected '${expectedNext}' after '${lastStitch.intent}' based on pattern '${pattern.name}'`,
|
|
8004
|
-
signature: pattern.signature,
|
|
8005
|
-
confidence: pattern.confidence * 0.8,
|
|
8006
|
-
occurrence_count: 1,
|
|
8007
|
-
first_seen_at: now,
|
|
8008
|
-
last_seen_at: now,
|
|
8009
|
-
seen_in_threads: [lastStitch.thread_id],
|
|
8010
|
-
classification: "anomalous"
|
|
8011
|
-
});
|
|
8012
|
-
}
|
|
8013
|
-
}
|
|
8014
|
-
}
|
|
8015
|
-
}
|
|
8016
|
-
return anomalies;
|
|
8017
|
-
}
|
|
8018
|
-
var InMemoryPatternStore;
|
|
8019
|
-
var init_pattern_engine = __esm({
|
|
8020
|
-
"src/needle/pattern.engine.ts"() {
|
|
8021
|
-
InMemoryPatternStore = class {
|
|
8022
|
-
constructor() {
|
|
8023
|
-
this.patterns = /* @__PURE__ */ new Map();
|
|
8024
|
-
}
|
|
8025
|
-
save(pattern) {
|
|
8026
|
-
this.patterns.set(pattern.pattern_id, pattern);
|
|
8027
|
-
}
|
|
8028
|
-
get(patternId) {
|
|
8029
|
-
return this.patterns.get(patternId);
|
|
8030
|
-
}
|
|
8031
|
-
findByKind(kind) {
|
|
8032
|
-
return [...this.patterns.values()].filter((p) => p.kind === kind);
|
|
8033
|
-
}
|
|
8034
|
-
findByIntent(intent) {
|
|
8035
|
-
return [...this.patterns.values()].filter(
|
|
8036
|
-
(p) => p.signature.intent_sequence?.includes(intent)
|
|
8037
|
-
);
|
|
8038
|
-
}
|
|
8039
|
-
all() {
|
|
8040
|
-
return [...this.patterns.values()];
|
|
8041
|
-
}
|
|
8042
|
-
};
|
|
8043
|
-
}
|
|
8044
|
-
});
|
|
8045
|
-
|
|
8046
|
-
// src/sensors/tps.sensor.ts
|
|
8047
|
-
var require_tps_sensor = __commonJS({
|
|
8048
|
-
"src/sensors/tps.sensor.ts"(exports) {
|
|
8049
|
-
"use strict";
|
|
8050
|
-
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
8051
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8052
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8053
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8054
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8055
|
-
};
|
|
8056
|
-
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
8057
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8058
|
-
};
|
|
8059
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8060
|
-
exports.TpsSensor = void 0;
|
|
8061
|
-
var common_1 = __require("@nestjs/common");
|
|
8062
|
-
var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
|
|
8063
|
-
var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
|
|
8064
|
-
var TPS_EPOCH_MS = 9343548e5;
|
|
8065
|
-
function parseINotation(tps) {
|
|
8066
|
-
if (!tps.startsWith("i"))
|
|
8067
|
-
return null;
|
|
8068
|
-
const num = Number(tps.slice(1));
|
|
8069
|
-
if (!Number.isFinite(num))
|
|
8070
|
-
return null;
|
|
8071
|
-
return TPS_EPOCH_MS + num;
|
|
8072
|
-
}
|
|
8073
|
-
var TpsSensor2 = class TpsSensor {
|
|
8074
|
-
constructor(options = {}) {
|
|
8075
|
-
this.name = "TpsSensor";
|
|
8076
|
-
this.order = sensor_bands_1.BAND.POLICY + 2;
|
|
8077
|
-
this.maxDriftMs = options.maxDriftMs ?? 3e4;
|
|
8078
|
-
this.resolver = options.resolver ?? parseINotation;
|
|
8079
|
-
}
|
|
8080
|
-
supports(input) {
|
|
8081
|
-
const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
|
|
8082
|
-
return typeof tps === "string" && tps.length > 0;
|
|
8083
|
-
}
|
|
8084
|
-
async run(input) {
|
|
8085
|
-
const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
|
|
8086
|
-
const resolved = this.resolver(tps);
|
|
8087
|
-
if (resolved === null) {
|
|
8088
|
-
return {
|
|
8089
|
-
allow: false,
|
|
8090
|
-
riskScore: 80,
|
|
8091
|
-
reasons: [`TPS coordinate '${tps}' is structurally invalid`],
|
|
8092
|
-
code: "TPS_INVALID_FORMAT"
|
|
8093
|
-
};
|
|
8094
|
-
}
|
|
8095
|
-
const now = Date.now();
|
|
8096
|
-
const drift = Math.abs(now - resolved);
|
|
8097
|
-
if (drift > this.maxDriftMs) {
|
|
8098
|
-
const direction = resolved > now ? "future" : "past";
|
|
8099
|
-
return {
|
|
8100
|
-
allow: false,
|
|
8101
|
-
riskScore: 70,
|
|
8102
|
-
reasons: [
|
|
8103
|
-
`TPS drift ${drift}ms exceeds max ${this.maxDriftMs}ms (${direction})`
|
|
8104
|
-
],
|
|
8105
|
-
code: "TPS_DRIFT_EXCEEDED",
|
|
8106
|
-
tags: { tpsDriftMs: drift, tpsDirection: direction }
|
|
8107
|
-
};
|
|
8108
|
-
}
|
|
8109
|
-
return {
|
|
8110
|
-
allow: true,
|
|
8111
|
-
riskScore: 0,
|
|
8112
|
-
reasons: [],
|
|
8113
|
-
tags: {
|
|
8114
|
-
tpsResolved: resolved,
|
|
8115
|
-
tpsDriftMs: drift
|
|
8116
|
-
}
|
|
8117
|
-
};
|
|
8118
|
-
}
|
|
8119
|
-
};
|
|
8120
|
-
exports.TpsSensor = TpsSensor2;
|
|
8121
|
-
exports.TpsSensor = TpsSensor2 = __decorate([
|
|
8122
|
-
(0, sensor_decorator_1.Sensor)(),
|
|
8123
|
-
(0, common_1.Injectable)(),
|
|
8124
|
-
__metadata("design:paramtypes", [Object])
|
|
8125
|
-
], TpsSensor2);
|
|
8126
|
-
}
|
|
8127
|
-
});
|
|
8128
|
-
|
|
8129
|
-
// src/sensors/risk-gate.sensor.ts
|
|
8130
|
-
var require_risk_gate_sensor = __commonJS({
|
|
8131
|
-
"src/sensors/risk-gate.sensor.ts"(exports) {
|
|
8132
|
-
"use strict";
|
|
8133
|
-
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
8134
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8135
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8136
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8137
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8138
|
-
};
|
|
8139
|
-
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
8140
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8141
|
-
};
|
|
8142
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8143
|
-
exports.RiskGateSensor = void 0;
|
|
8144
|
-
var common_1 = __require("@nestjs/common");
|
|
8145
|
-
var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
|
|
8146
|
-
var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
|
|
8147
|
-
var risk_1 = (init_risk(), __toCommonJS(risk_exports));
|
|
8148
|
-
var SEVERITY_WEIGHT = {
|
|
8149
|
-
low: 10,
|
|
8150
|
-
medium: 25,
|
|
8151
|
-
high: 50,
|
|
8152
|
-
critical: 100
|
|
8153
|
-
};
|
|
8154
|
-
var RiskGateSensor2 = class RiskGateSensor {
|
|
8155
|
-
constructor(options) {
|
|
8156
|
-
this.name = "RiskGateSensor";
|
|
8157
|
-
this.order = sensor_bands_1.BAND.BUSINESS + 10;
|
|
8158
|
-
this.collectors = options.collectors;
|
|
8159
|
-
this.denyThreshold = options.denyThreshold ?? 75;
|
|
8160
|
-
this.flagThreshold = options.flagThreshold ?? 40;
|
|
8161
|
-
}
|
|
8162
|
-
async run(input) {
|
|
8163
|
-
const results = await Promise.all(this.collectors.map((c) => c(input)));
|
|
8164
|
-
const signals = results.flat();
|
|
8165
|
-
let totalWeight = 0;
|
|
8166
|
-
let weightedSum = 0;
|
|
8167
|
-
for (const signal of signals) {
|
|
8168
|
-
const w = SEVERITY_WEIGHT[signal.severity];
|
|
8169
|
-
totalWeight += 1;
|
|
8170
|
-
weightedSum += w;
|
|
8171
|
-
}
|
|
8172
|
-
const aggregateScore = totalWeight > 0 ? Math.min(100, Math.round(weightedSum / totalWeight)) : 0;
|
|
8173
|
-
const evaluation = this.evaluate(aggregateScore, signals);
|
|
8174
|
-
input.metadata = {
|
|
8175
|
-
...input.metadata ?? {},
|
|
8176
|
-
riskEvaluation: evaluation
|
|
8177
|
-
};
|
|
8178
|
-
if (evaluation.decision === risk_1.RiskDecision.DENY) {
|
|
8179
|
-
return {
|
|
8180
|
-
allow: false,
|
|
8181
|
-
riskScore: aggregateScore,
|
|
8182
|
-
reasons: signals.map((s) => s.message),
|
|
8183
|
-
code: "RISK_GATE_DENY",
|
|
8184
|
-
tags: { riskDecision: evaluation.decision, signalCount: signals.length }
|
|
8185
|
-
};
|
|
8186
|
-
}
|
|
8187
|
-
if (evaluation.decision === risk_1.RiskDecision.THROTTLE) {
|
|
8188
|
-
return {
|
|
8189
|
-
allow: false,
|
|
8190
|
-
riskScore: aggregateScore,
|
|
8191
|
-
reasons: signals.map((s) => s.message),
|
|
8192
|
-
code: "RISK_GATE_THROTTLE",
|
|
8193
|
-
retryAfterMs: evaluation.retryAfterMs,
|
|
8194
|
-
tags: { riskDecision: evaluation.decision, signalCount: signals.length }
|
|
8195
|
-
};
|
|
8196
|
-
}
|
|
8197
|
-
return {
|
|
8198
|
-
allow: true,
|
|
8199
|
-
riskScore: aggregateScore,
|
|
8200
|
-
reasons: signals.filter((s) => s.severity === "medium" || s.severity === "high").map((s) => s.message),
|
|
8201
|
-
tags: {
|
|
8202
|
-
riskDecision: evaluation.decision,
|
|
8203
|
-
signalCount: signals.length
|
|
8204
|
-
}
|
|
8205
|
-
};
|
|
8206
|
-
}
|
|
8207
|
-
evaluate(score, signals) {
|
|
8208
|
-
const hasCritical = signals.some((s) => s.severity === "critical");
|
|
8209
|
-
if (hasCritical) {
|
|
8210
|
-
return {
|
|
8211
|
-
decision: risk_1.RiskDecision.DENY,
|
|
8212
|
-
reason: "Critical risk signal detected",
|
|
8213
|
-
confidence: 1,
|
|
8214
|
-
signals
|
|
8215
|
-
};
|
|
8216
|
-
}
|
|
8217
|
-
if (score >= this.denyThreshold) {
|
|
8218
|
-
return {
|
|
8219
|
-
decision: risk_1.RiskDecision.DENY,
|
|
8220
|
-
reason: `Aggregate risk score ${score} exceeds deny threshold ${this.denyThreshold}`,
|
|
8221
|
-
confidence: score / 100,
|
|
8222
|
-
signals
|
|
8223
|
-
};
|
|
8224
|
-
}
|
|
8225
|
-
if (score >= this.flagThreshold) {
|
|
8226
|
-
return {
|
|
8227
|
-
decision: risk_1.RiskDecision.STEP_UP,
|
|
8228
|
-
reason: `Aggregate risk score ${score} exceeds flag threshold ${this.flagThreshold}`,
|
|
8229
|
-
confidence: score / 100,
|
|
8230
|
-
signals
|
|
8231
|
-
};
|
|
8232
|
-
}
|
|
8233
|
-
return {
|
|
8234
|
-
decision: risk_1.RiskDecision.ALLOW,
|
|
8235
|
-
confidence: 1 - score / 100,
|
|
8236
|
-
signals
|
|
8237
|
-
};
|
|
8238
|
-
}
|
|
8239
|
-
};
|
|
8240
|
-
exports.RiskGateSensor = RiskGateSensor2;
|
|
8241
|
-
exports.RiskGateSensor = RiskGateSensor2 = __decorate([
|
|
8242
|
-
(0, sensor_decorator_1.Sensor)(),
|
|
8243
|
-
(0, common_1.Injectable)(),
|
|
8244
|
-
__metadata("design:paramtypes", [Object])
|
|
8245
|
-
], RiskGateSensor2);
|
|
8246
|
-
}
|
|
8247
|
-
});
|
|
8248
|
-
|
|
8249
|
-
// src/sensors/tickauth.sensor.ts
|
|
8250
|
-
var require_tickauth_sensor = __commonJS({
|
|
8251
|
-
"src/sensors/tickauth.sensor.ts"(exports) {
|
|
8252
|
-
"use strict";
|
|
8253
|
-
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
8254
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8255
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
8256
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
8257
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
8258
|
-
};
|
|
8259
|
-
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
8260
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
8261
|
-
};
|
|
8262
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8263
|
-
exports.TickAuthSensor = void 0;
|
|
8264
|
-
var common_1 = __require("@nestjs/common");
|
|
8265
|
-
var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
|
|
8266
|
-
var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
|
|
8267
|
-
var TickAuthSensor2 = class TickAuthSensor {
|
|
8268
|
-
constructor(options = {}) {
|
|
8269
|
-
this.name = "TickAuthSensor";
|
|
8270
|
-
this.order = sensor_bands_1.BAND.IDENTITY + 40;
|
|
8271
|
-
this.verifier = options.verifier;
|
|
8272
|
-
this.matchIntent = options.matchIntent ?? true;
|
|
8273
|
-
this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
|
|
8274
|
-
}
|
|
8275
|
-
supports(input) {
|
|
8276
|
-
return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
|
|
8277
|
-
}
|
|
8278
|
-
async run(input) {
|
|
8279
|
-
const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
|
|
8280
|
-
if (!capsule) {
|
|
8281
|
-
return {
|
|
8282
|
-
allow: false,
|
|
8283
|
-
riskScore: 90,
|
|
8284
|
-
reasons: ["TickAuth capsule not found"],
|
|
8285
|
-
code: "TICKAUTH_MISSING"
|
|
8286
|
-
};
|
|
8287
|
-
}
|
|
8288
|
-
if (!capsule.capsule_id || typeof capsule.capsule_id !== "string") {
|
|
8289
|
-
return {
|
|
8290
|
-
allow: false,
|
|
8291
|
-
riskScore: 100,
|
|
8292
|
-
reasons: ["TickAuth capsule has no valid capsule_id"],
|
|
8293
|
-
code: "TICKAUTH_INVALID_ID"
|
|
8294
|
-
};
|
|
8295
|
-
}
|
|
8296
|
-
const status = capsule.verification?.status;
|
|
8297
|
-
if (status && status !== "approved") {
|
|
8298
|
-
return {
|
|
8299
|
-
allow: false,
|
|
8300
|
-
riskScore: 100,
|
|
8301
|
-
reasons: [
|
|
8302
|
-
`TickAuth capsule status is '${status}'${capsule.verification?.reason ? `: ${capsule.verification.reason}` : ""}`
|
|
8303
|
-
],
|
|
8304
|
-
code: `TICKAUTH_STATUS_${status.toUpperCase()}`
|
|
8305
|
-
};
|
|
8306
|
-
}
|
|
8307
|
-
if (this.acceptTypes && capsule.capsule_type) {
|
|
8308
|
-
if (!this.acceptTypes.has(capsule.capsule_type)) {
|
|
8309
|
-
return {
|
|
8310
|
-
allow: false,
|
|
8311
|
-
riskScore: 80,
|
|
8312
|
-
reasons: [
|
|
8313
|
-
`TickAuth capsule type '${capsule.capsule_type}' is not in accept list`
|
|
8314
|
-
],
|
|
8315
|
-
code: "TICKAUTH_TYPE_REJECTED"
|
|
8316
|
-
};
|
|
8317
|
-
}
|
|
8318
|
-
}
|
|
8319
|
-
if (this.matchIntent && input.intent && capsule.intent) {
|
|
8320
|
-
if (capsule.intent !== input.intent) {
|
|
8321
|
-
return {
|
|
8322
|
-
allow: false,
|
|
8323
|
-
riskScore: 80,
|
|
8324
|
-
reasons: [
|
|
8325
|
-
`TickAuth capsule intent '${capsule.intent}' does not match AXIS intent '${input.intent}'`
|
|
8326
|
-
],
|
|
8327
|
-
code: "TICKAUTH_INTENT_MISMATCH"
|
|
8328
|
-
};
|
|
8329
|
-
}
|
|
8330
|
-
}
|
|
8331
|
-
if (this.verifier) {
|
|
8332
|
-
const error = await this.verifier(capsule, input);
|
|
8333
|
-
if (error) {
|
|
8334
|
-
return {
|
|
8335
|
-
allow: false,
|
|
8336
|
-
riskScore: 90,
|
|
8337
|
-
reasons: [`TickAuth verification failed: ${error}`],
|
|
8338
|
-
code: "TICKAUTH_VERIFY_FAILED"
|
|
8339
|
-
};
|
|
8340
|
-
}
|
|
8341
|
-
}
|
|
8342
|
-
return {
|
|
8343
|
-
allow: true,
|
|
8344
|
-
riskScore: 0,
|
|
8345
|
-
reasons: [],
|
|
8346
|
-
tags: {
|
|
8347
|
-
tickauthCapsuleId: capsule.capsule_id,
|
|
8348
|
-
tickauthMode: capsule.mode,
|
|
8349
|
-
tickauthSingleUse: capsule.single_use
|
|
8350
|
-
}
|
|
8351
|
-
};
|
|
8352
|
-
}
|
|
8353
|
-
};
|
|
8354
|
-
exports.TickAuthSensor = TickAuthSensor2;
|
|
8355
|
-
exports.TickAuthSensor = TickAuthSensor2 = __decorate([
|
|
8356
|
-
(0, sensor_decorator_1.Sensor)(),
|
|
8357
|
-
(0, common_1.Injectable)(),
|
|
8358
|
-
__metadata("design:paramtypes", [Object])
|
|
8359
|
-
], TickAuthSensor2);
|
|
8360
|
-
}
|
|
8361
|
-
});
|
|
8362
|
-
|
|
8363
6045
|
// src/cce/sensors/cce-envelope-validation.sensor.ts
|
|
8364
6046
|
var REQUIRED_FIELDS, CceEnvelopeValidationSensor;
|
|
8365
6047
|
var init_cce_envelope_validation_sensor = __esm({
|
|
@@ -9168,19 +6850,95 @@ var init_cce = __esm({
|
|
|
9168
6850
|
// src/core/index.ts
|
|
9169
6851
|
var core_exports = {};
|
|
9170
6852
|
__export(core_exports, {
|
|
6853
|
+
AXIS_MAGIC: () => AXIS_MAGIC,
|
|
6854
|
+
AXIS_VERSION: () => AXIS_VERSION,
|
|
9171
6855
|
AxisError: () => AxisError,
|
|
9172
6856
|
AxisFrameZ: () => AxisFrameZ,
|
|
6857
|
+
AxisMediaTypes: () => AxisMediaTypes,
|
|
6858
|
+
BodyProfile: () => BodyProfile,
|
|
6859
|
+
ERR_BAD_SIGNATURE: () => ERR_BAD_SIGNATURE,
|
|
6860
|
+
ERR_CONTRACT_VIOLATION: () => ERR_CONTRACT_VIOLATION,
|
|
6861
|
+
ERR_INVALID_PACKET: () => ERR_INVALID_PACKET,
|
|
6862
|
+
ERR_REPLAY_DETECTED: () => ERR_REPLAY_DETECTED,
|
|
6863
|
+
FLAG_BODY_TLV: () => FLAG_BODY_TLV,
|
|
6864
|
+
FLAG_CHAIN_REQ: () => FLAG_CHAIN_REQ,
|
|
6865
|
+
FLAG_HAS_WITNESS: () => FLAG_HAS_WITNESS,
|
|
6866
|
+
MAX_BODY_LEN: () => MAX_BODY_LEN,
|
|
6867
|
+
MAX_FRAME_LEN: () => MAX_FRAME_LEN,
|
|
6868
|
+
MAX_HDR_LEN: () => MAX_HDR_LEN,
|
|
6869
|
+
MAX_SIG_LEN: () => MAX_SIG_LEN,
|
|
6870
|
+
NCERT_ALG: () => NCERT_ALG,
|
|
6871
|
+
NCERT_EXP: () => NCERT_EXP,
|
|
6872
|
+
NCERT_ISSUER_KID: () => NCERT_ISSUER_KID,
|
|
6873
|
+
NCERT_KID: () => NCERT_KID,
|
|
6874
|
+
NCERT_NBF: () => NCERT_NBF,
|
|
6875
|
+
NCERT_NODE_ID: () => NCERT_NODE_ID,
|
|
6876
|
+
NCERT_PAYLOAD: () => NCERT_PAYLOAD,
|
|
6877
|
+
NCERT_PUB: () => NCERT_PUB,
|
|
6878
|
+
NCERT_SCOPE: () => NCERT_SCOPE,
|
|
6879
|
+
NCERT_SIG: () => NCERT_SIG,
|
|
6880
|
+
PROOF_CAPSULE: () => PROOF_CAPSULE,
|
|
6881
|
+
PROOF_JWT: () => PROOF_JWT,
|
|
6882
|
+
PROOF_LOOM: () => PROOF_LOOM,
|
|
6883
|
+
PROOF_MTLS: () => PROOF_MTLS,
|
|
6884
|
+
PROOF_NONE: () => PROOF_NONE,
|
|
6885
|
+
PROOF_WITNESS: () => PROOF_WITNESS,
|
|
6886
|
+
ProofType: () => ProofType,
|
|
6887
|
+
TLV: () => TLV,
|
|
6888
|
+
TLV_ACTOR_ID: () => TLV_ACTOR_ID,
|
|
6889
|
+
TLV_AUD: () => TLV_AUD,
|
|
6890
|
+
TLV_BODY_ARR: () => TLV_BODY_ARR,
|
|
6891
|
+
TLV_BODY_OBJ: () => TLV_BODY_OBJ,
|
|
6892
|
+
TLV_CAPSULE: () => TLV_CAPSULE,
|
|
6893
|
+
TLV_EFFECT: () => TLV_EFFECT,
|
|
6894
|
+
TLV_ERROR_CODE: () => TLV_ERROR_CODE,
|
|
6895
|
+
TLV_ERROR_MSG: () => TLV_ERROR_MSG,
|
|
6896
|
+
TLV_INDEX: () => TLV_INDEX,
|
|
6897
|
+
TLV_INTENT: () => TLV_INTENT,
|
|
6898
|
+
TLV_KID: () => TLV_KID,
|
|
6899
|
+
TLV_LOOM_PRESENCE_ID: () => TLV_LOOM_PRESENCE_ID,
|
|
6900
|
+
TLV_LOOM_THREAD_HASH: () => TLV_LOOM_THREAD_HASH,
|
|
6901
|
+
TLV_LOOM_WRIT: () => TLV_LOOM_WRIT,
|
|
6902
|
+
TLV_NODE: () => TLV_NODE,
|
|
6903
|
+
TLV_NODE_CERT_HASH: () => TLV_NODE_CERT_HASH,
|
|
6904
|
+
TLV_NODE_KID: () => TLV_NODE_KID,
|
|
6905
|
+
TLV_NONCE: () => TLV_NONCE,
|
|
6906
|
+
TLV_OFFSET: () => TLV_OFFSET,
|
|
6907
|
+
TLV_OK: () => TLV_OK,
|
|
6908
|
+
TLV_PID: () => TLV_PID,
|
|
6909
|
+
TLV_PREV_HASH: () => TLV_PREV_HASH,
|
|
6910
|
+
TLV_PROOF_REF: () => TLV_PROOF_REF,
|
|
6911
|
+
TLV_PROOF_TYPE: () => TLV_PROOF_TYPE,
|
|
6912
|
+
TLV_REALM: () => TLV_REALM,
|
|
6913
|
+
TLV_RECEIPT_HASH: () => TLV_RECEIPT_HASH,
|
|
6914
|
+
TLV_RID: () => TLV_RID,
|
|
6915
|
+
TLV_SHA256_CHUNK: () => TLV_SHA256_CHUNK,
|
|
6916
|
+
TLV_TRACE_ID: () => TLV_TRACE_ID,
|
|
6917
|
+
TLV_TS: () => TLV_TS,
|
|
6918
|
+
TLV_UPLOAD_ID: () => TLV_UPLOAD_ID,
|
|
9173
6919
|
computeReceiptHash: () => computeReceiptHash,
|
|
9174
6920
|
computeSignaturePayload: () => computeSignaturePayload,
|
|
6921
|
+
decodeArray: () => decodeArray,
|
|
6922
|
+
decodeFrame: () => decodeFrame,
|
|
6923
|
+
decodeObject: () => decodeObject,
|
|
6924
|
+
decodeTLVs: () => decodeTLVs,
|
|
6925
|
+
decodeTLVsList: () => decodeTLVsList,
|
|
6926
|
+
decodeVarint: () => decodeVarint,
|
|
6927
|
+
encodeFrame: () => encodeFrame,
|
|
6928
|
+
encodeTLVs: () => encodeTLVs,
|
|
6929
|
+
encodeVarint: () => encodeVarint,
|
|
9175
6930
|
generateEd25519KeyPair: () => generateEd25519KeyPair,
|
|
6931
|
+
getSignTarget: () => getSignTarget,
|
|
9176
6932
|
sha256: () => sha2564,
|
|
9177
6933
|
signFrame: () => signFrame,
|
|
6934
|
+
varintLength: () => varintLength,
|
|
9178
6935
|
verifyFrameSignature: () => verifyFrameSignature
|
|
9179
6936
|
});
|
|
9180
|
-
import * as axis_protocol_star from "@nextera.one/axis-protocol";
|
|
9181
6937
|
var init_core = __esm({
|
|
9182
6938
|
"src/core/index.ts"() {
|
|
9183
|
-
|
|
6939
|
+
init_constants();
|
|
6940
|
+
init_varint();
|
|
6941
|
+
init_tlv();
|
|
9184
6942
|
init_axis_bin();
|
|
9185
6943
|
init_signature();
|
|
9186
6944
|
init_axis_error();
|
|
@@ -9197,55 +6955,18 @@ var init_types = __esm({
|
|
|
9197
6955
|
var require_proof_verification_service = __commonJS({
|
|
9198
6956
|
"src/crypto/proof-verification.service.ts"(exports) {
|
|
9199
6957
|
"use strict";
|
|
9200
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
9201
|
-
if (k2 === void 0) k2 = k;
|
|
9202
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9203
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9204
|
-
desc = { enumerable: true, get: function() {
|
|
9205
|
-
return m[k];
|
|
9206
|
-
} };
|
|
9207
|
-
}
|
|
9208
|
-
Object.defineProperty(o, k2, desc);
|
|
9209
|
-
}) : (function(o, m, k, k2) {
|
|
9210
|
-
if (k2 === void 0) k2 = k;
|
|
9211
|
-
o[k2] = m[k];
|
|
9212
|
-
}));
|
|
9213
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
9214
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
9215
|
-
}) : function(o, v) {
|
|
9216
|
-
o["default"] = v;
|
|
9217
|
-
});
|
|
9218
6958
|
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
9219
6959
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9220
6960
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9221
6961
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9222
6962
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
9223
6963
|
};
|
|
9224
|
-
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
9225
|
-
var ownKeys = function(o) {
|
|
9226
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
9227
|
-
var ar = [];
|
|
9228
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
9229
|
-
return ar;
|
|
9230
|
-
};
|
|
9231
|
-
return ownKeys(o);
|
|
9232
|
-
};
|
|
9233
|
-
return function(mod) {
|
|
9234
|
-
if (mod && mod.__esModule) return mod;
|
|
9235
|
-
var result = {};
|
|
9236
|
-
if (mod != null) {
|
|
9237
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
9238
|
-
}
|
|
9239
|
-
__setModuleDefault(result, mod);
|
|
9240
|
-
return result;
|
|
9241
|
-
};
|
|
9242
|
-
})();
|
|
9243
6964
|
var ProofVerificationService_1;
|
|
9244
6965
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9245
6966
|
exports.ProofVerificationService = void 0;
|
|
9246
6967
|
var common_1 = __require("@nestjs/common");
|
|
9247
|
-
var crypto3 =
|
|
9248
|
-
var nacl =
|
|
6968
|
+
var crypto3 = __require("crypto");
|
|
6969
|
+
var nacl = __require("tweetnacl");
|
|
9249
6970
|
var ProofVerificationService = ProofVerificationService_1 = class ProofVerificationService {
|
|
9250
6971
|
constructor() {
|
|
9251
6972
|
this.logger = new common_1.Logger(ProofVerificationService_1.name);
|
|
@@ -9414,13 +7135,127 @@ var init_crypto = __esm({
|
|
|
9414
7135
|
}
|
|
9415
7136
|
});
|
|
9416
7137
|
|
|
7138
|
+
// src/decorators/intent-policy.decorator.ts
|
|
7139
|
+
import "reflect-metadata";
|
|
7140
|
+
function Sensitivity(level) {
|
|
7141
|
+
return ((target, propertyKey) => {
|
|
7142
|
+
if (propertyKey !== void 0) {
|
|
7143
|
+
Reflect.defineMetadata(
|
|
7144
|
+
SENSITIVITY_METADATA_KEY,
|
|
7145
|
+
level,
|
|
7146
|
+
target,
|
|
7147
|
+
propertyKey
|
|
7148
|
+
);
|
|
7149
|
+
return;
|
|
7150
|
+
}
|
|
7151
|
+
Reflect.defineMetadata(SENSITIVITY_METADATA_KEY, level, target);
|
|
7152
|
+
});
|
|
7153
|
+
}
|
|
7154
|
+
function Contract(options) {
|
|
7155
|
+
return ((target, propertyKey) => {
|
|
7156
|
+
if (propertyKey !== void 0) {
|
|
7157
|
+
Reflect.defineMetadata(
|
|
7158
|
+
CONTRACT_METADATA_KEY,
|
|
7159
|
+
options,
|
|
7160
|
+
target,
|
|
7161
|
+
propertyKey
|
|
7162
|
+
);
|
|
7163
|
+
return;
|
|
7164
|
+
}
|
|
7165
|
+
Reflect.defineMetadata(CONTRACT_METADATA_KEY, options, target);
|
|
7166
|
+
});
|
|
7167
|
+
}
|
|
7168
|
+
function RequiredProof(proofs) {
|
|
7169
|
+
return ((target, propertyKey) => {
|
|
7170
|
+
if (propertyKey !== void 0) {
|
|
7171
|
+
Reflect.defineMetadata(
|
|
7172
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7173
|
+
proofs,
|
|
7174
|
+
target,
|
|
7175
|
+
propertyKey
|
|
7176
|
+
);
|
|
7177
|
+
return;
|
|
7178
|
+
}
|
|
7179
|
+
Reflect.defineMetadata(
|
|
7180
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7181
|
+
proofs,
|
|
7182
|
+
target
|
|
7183
|
+
);
|
|
7184
|
+
});
|
|
7185
|
+
}
|
|
7186
|
+
function Capsule() {
|
|
7187
|
+
return ((target, propertyKey) => {
|
|
7188
|
+
const existing = propertyKey !== void 0 ? Reflect.getMetadata(
|
|
7189
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7190
|
+
target,
|
|
7191
|
+
propertyKey
|
|
7192
|
+
) ?? [] : Reflect.getMetadata(
|
|
7193
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7194
|
+
target
|
|
7195
|
+
) ?? [];
|
|
7196
|
+
const merged = existing.includes("CAPSULE") ? existing : [...existing, "CAPSULE"];
|
|
7197
|
+
if (propertyKey !== void 0) {
|
|
7198
|
+
Reflect.defineMetadata(
|
|
7199
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7200
|
+
merged,
|
|
7201
|
+
target,
|
|
7202
|
+
propertyKey
|
|
7203
|
+
);
|
|
7204
|
+
} else {
|
|
7205
|
+
Reflect.defineMetadata(
|
|
7206
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7207
|
+
merged,
|
|
7208
|
+
target
|
|
7209
|
+
);
|
|
7210
|
+
}
|
|
7211
|
+
});
|
|
7212
|
+
}
|
|
7213
|
+
function Witness() {
|
|
7214
|
+
return ((target, propertyKey) => {
|
|
7215
|
+
const existing = propertyKey !== void 0 ? Reflect.getMetadata(
|
|
7216
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7217
|
+
target,
|
|
7218
|
+
propertyKey
|
|
7219
|
+
) ?? [] : Reflect.getMetadata(
|
|
7220
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7221
|
+
target
|
|
7222
|
+
) ?? [];
|
|
7223
|
+
const merged = existing.includes("WITNESS") ? existing : [...existing, "WITNESS"];
|
|
7224
|
+
if (propertyKey !== void 0) {
|
|
7225
|
+
Reflect.defineMetadata(
|
|
7226
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7227
|
+
merged,
|
|
7228
|
+
target,
|
|
7229
|
+
propertyKey
|
|
7230
|
+
);
|
|
7231
|
+
} else {
|
|
7232
|
+
Reflect.defineMetadata(
|
|
7233
|
+
REQUIRED_PROOF_METADATA_KEY,
|
|
7234
|
+
merged,
|
|
7235
|
+
target
|
|
7236
|
+
);
|
|
7237
|
+
}
|
|
7238
|
+
});
|
|
7239
|
+
}
|
|
7240
|
+
var SENSITIVITY_METADATA_KEY, CONTRACT_METADATA_KEY, REQUIRED_PROOF_METADATA_KEY;
|
|
7241
|
+
var init_intent_policy_decorator = __esm({
|
|
7242
|
+
"src/decorators/intent-policy.decorator.ts"() {
|
|
7243
|
+
SENSITIVITY_METADATA_KEY = "axis:sensitivity";
|
|
7244
|
+
CONTRACT_METADATA_KEY = "axis:contract";
|
|
7245
|
+
REQUIRED_PROOF_METADATA_KEY = "axis:required_proof";
|
|
7246
|
+
}
|
|
7247
|
+
});
|
|
7248
|
+
|
|
9417
7249
|
// src/decorators/index.ts
|
|
9418
7250
|
var decorators_exports = {};
|
|
9419
7251
|
__export(decorators_exports, {
|
|
9420
7252
|
CAPSULE_POLICY_METADATA_KEY: () => CAPSULE_POLICY_METADATA_KEY,
|
|
9421
7253
|
CHAIN_METADATA_KEY: () => CHAIN_METADATA_KEY,
|
|
7254
|
+
CONTRACT_METADATA_KEY: () => CONTRACT_METADATA_KEY,
|
|
7255
|
+
Capsule: () => Capsule,
|
|
9422
7256
|
CapsulePolicy: () => CapsulePolicy,
|
|
9423
7257
|
Chain: () => Chain,
|
|
7258
|
+
Contract: () => Contract,
|
|
9424
7259
|
HANDLER_METADATA_KEY: () => HANDLER_METADATA_KEY,
|
|
9425
7260
|
Handler: () => Handler,
|
|
9426
7261
|
INTENT_BODY_KEY: () => INTENT_BODY_KEY,
|
|
@@ -9433,8 +7268,21 @@ __export(decorators_exports, {
|
|
|
9433
7268
|
OBSERVER_BINDINGS_KEY: () => OBSERVER_BINDINGS_KEY,
|
|
9434
7269
|
OBSERVER_METADATA_KEY: () => OBSERVER_METADATA_KEY,
|
|
9435
7270
|
Observer: () => Observer,
|
|
7271
|
+
REQUIRED_PROOF_METADATA_KEY: () => REQUIRED_PROOF_METADATA_KEY,
|
|
7272
|
+
RequiredProof: () => RequiredProof,
|
|
7273
|
+
SENSITIVITY_METADATA_KEY: () => SENSITIVITY_METADATA_KEY,
|
|
9436
7274
|
SENSOR_METADATA_KEY: () => SENSOR_METADATA_KEY,
|
|
7275
|
+
Sensitivity: () => Sensitivity,
|
|
9437
7276
|
Sensor: () => Sensor,
|
|
7277
|
+
TLV_FIELDS_KEY: () => TLV_FIELDS_KEY,
|
|
7278
|
+
TLV_VALIDATORS_KEY: () => TLV_VALIDATORS_KEY,
|
|
7279
|
+
TlvEnum: () => TlvEnum,
|
|
7280
|
+
TlvField: () => TlvField,
|
|
7281
|
+
TlvMinLen: () => TlvMinLen,
|
|
7282
|
+
TlvRange: () => TlvRange,
|
|
7283
|
+
TlvUtf8Pattern: () => TlvUtf8Pattern,
|
|
7284
|
+
TlvValidate: () => TlvValidate,
|
|
7285
|
+
Witness: () => Witness,
|
|
9438
7286
|
mergeCapsulePolicyOptions: () => mergeCapsulePolicyOptions,
|
|
9439
7287
|
normalizeCapsulePolicyOptions: () => normalizeCapsulePolicyOptions
|
|
9440
7288
|
});
|
|
@@ -9442,6 +7290,7 @@ var init_decorators = __esm({
|
|
|
9442
7290
|
"src/decorators/index.ts"() {
|
|
9443
7291
|
__reExport(decorators_exports, __toESM(require_axis_request_decorator()));
|
|
9444
7292
|
init_capsule_policy_decorator();
|
|
7293
|
+
init_intent_policy_decorator();
|
|
9445
7294
|
init_chain_decorator();
|
|
9446
7295
|
__reExport(decorators_exports, __toESM(require_dto_schema_util()));
|
|
9447
7296
|
init_handler_decorator();
|
|
@@ -9450,7 +7299,7 @@ var init_decorators = __esm({
|
|
|
9450
7299
|
init_intent_decorator();
|
|
9451
7300
|
init_observer_decorator();
|
|
9452
7301
|
init_sensor_decorator();
|
|
9453
|
-
|
|
7302
|
+
init_tlv_field_decorator();
|
|
9454
7303
|
}
|
|
9455
7304
|
});
|
|
9456
7305
|
|
|
@@ -9551,25 +7400,6 @@ var init_engine = __esm({
|
|
|
9551
7400
|
}
|
|
9552
7401
|
});
|
|
9553
7402
|
|
|
9554
|
-
// src/idel/idel.types.ts
|
|
9555
|
-
var init_idel_types = __esm({
|
|
9556
|
-
"src/idel/idel.types.ts"() {
|
|
9557
|
-
}
|
|
9558
|
-
});
|
|
9559
|
-
|
|
9560
|
-
// src/idel/index.ts
|
|
9561
|
-
var idel_exports = {};
|
|
9562
|
-
__export(idel_exports, {
|
|
9563
|
-
IdelCompiler: () => IdelCompiler,
|
|
9564
|
-
IdelSchemaRegistry: () => IdelSchemaRegistry
|
|
9565
|
-
});
|
|
9566
|
-
var init_idel = __esm({
|
|
9567
|
-
"src/idel/index.ts"() {
|
|
9568
|
-
init_idel_types();
|
|
9569
|
-
init_idel_compiler();
|
|
9570
|
-
}
|
|
9571
|
-
});
|
|
9572
|
-
|
|
9573
7403
|
// src/loom/index.ts
|
|
9574
7404
|
var loom_exports = {};
|
|
9575
7405
|
__export(loom_exports, {
|
|
@@ -9579,98 +7409,11 @@ __export(loom_exports, {
|
|
|
9579
7409
|
TLV_WRIT: () => TLV_LOOM_WRIT,
|
|
9580
7410
|
canonicalizeGrant: () => canonicalizeGrant,
|
|
9581
7411
|
canonicalizeWrit: () => canonicalizeWrit,
|
|
9582
|
-
|
|
9583
|
-
createPresenceChallenge: () => createPresenceChallenge,
|
|
9584
|
-
createReceipt: () => createReceipt,
|
|
9585
|
-
createRevocation: () => createRevocation,
|
|
9586
|
-
createWrit: () => createWrit,
|
|
9587
|
-
deriveAnchorReflection: () => deriveAnchorReflection,
|
|
9588
|
-
executeLoomPipeline: () => executeLoomPipeline,
|
|
9589
|
-
getGrantStatus: () => getGrantStatus,
|
|
9590
|
-
getPresenceStatus: () => getPresenceStatus,
|
|
9591
|
-
grantCoversAction: () => grantCoversAction,
|
|
9592
|
-
isRevoked: () => isRevoked,
|
|
9593
|
-
renewPresence: () => renewPresence,
|
|
9594
|
-
signPresenceChallenge: () => signPresenceChallenge,
|
|
9595
|
-
updateThreadState: () => updateThreadState,
|
|
9596
|
-
validateGrant: () => validateGrant,
|
|
9597
|
-
validateWrit: () => validateWrit,
|
|
9598
|
-
verifyPresenceProof: () => verifyPresenceProof,
|
|
9599
|
-
verifyReceiptChain: () => verifyReceiptChain
|
|
7412
|
+
deriveAnchorReflection: () => deriveAnchorReflection
|
|
9600
7413
|
});
|
|
9601
7414
|
var init_loom = __esm({
|
|
9602
7415
|
"src/loom/index.ts"() {
|
|
9603
7416
|
init_loom_types();
|
|
9604
|
-
init_loom_engine();
|
|
9605
|
-
}
|
|
9606
|
-
});
|
|
9607
|
-
|
|
9608
|
-
// src/needle/needle.types.ts
|
|
9609
|
-
var init_needle_types = __esm({
|
|
9610
|
-
"src/needle/needle.types.ts"() {
|
|
9611
|
-
}
|
|
9612
|
-
});
|
|
9613
|
-
|
|
9614
|
-
// src/needle/knot.types.ts
|
|
9615
|
-
var init_knot_types = __esm({
|
|
9616
|
-
"src/needle/knot.types.ts"() {
|
|
9617
|
-
}
|
|
9618
|
-
});
|
|
9619
|
-
|
|
9620
|
-
// src/needle/fabric.types.ts
|
|
9621
|
-
var init_fabric_types = __esm({
|
|
9622
|
-
"src/needle/fabric.types.ts"() {
|
|
9623
|
-
}
|
|
9624
|
-
});
|
|
9625
|
-
|
|
9626
|
-
// src/needle/pattern.types.ts
|
|
9627
|
-
var init_pattern_types = __esm({
|
|
9628
|
-
"src/needle/pattern.types.ts"() {
|
|
9629
|
-
}
|
|
9630
|
-
});
|
|
9631
|
-
|
|
9632
|
-
// src/needle/index.ts
|
|
9633
|
-
var needle_exports = {};
|
|
9634
|
-
__export(needle_exports, {
|
|
9635
|
-
InMemoryPatternStore: () => InMemoryPatternStore,
|
|
9636
|
-
addStitchToKnot: () => addStitchToKnot,
|
|
9637
|
-
applyStitch: () => applyStitch,
|
|
9638
|
-
assembleNeedle: () => assembleNeedle,
|
|
9639
|
-
breakKnot: () => breakKnot,
|
|
9640
|
-
createFabric: () => createFabric,
|
|
9641
|
-
detectAnomalies: () => detectAnomalies,
|
|
9642
|
-
detectKnotPatterns: () => detectKnotPatterns,
|
|
9643
|
-
detectSequencePatterns: () => detectSequencePatterns,
|
|
9644
|
-
diffFabrics: () => diffFabrics,
|
|
9645
|
-
findKnotsForStitch: () => findKnotsForStitch,
|
|
9646
|
-
forkFromKnot: () => forkFromKnot,
|
|
9647
|
-
formStitch: () => formStitch,
|
|
9648
|
-
getDecisionPoints: () => getDecisionPoints,
|
|
9649
|
-
getFabricValue: () => getFabricValue,
|
|
9650
|
-
getIrreversibleKnots: () => getIrreversibleKnots,
|
|
9651
|
-
isKnotOpen: () => isKnotOpen,
|
|
9652
|
-
isPointOfNoReturn: () => isPointOfNoReturn,
|
|
9653
|
-
lockCells: () => lockCells,
|
|
9654
|
-
matchPatterns: () => matchPatterns,
|
|
9655
|
-
openKnot: () => openKnot,
|
|
9656
|
-
projectAt: () => projectAt,
|
|
9657
|
-
queryFabric: () => queryFabric,
|
|
9658
|
-
recordOccurrence: () => recordOccurrence,
|
|
9659
|
-
runNeedlePipeline: () => runNeedlePipeline,
|
|
9660
|
-
tieKnot: () => tieKnot,
|
|
9661
|
-
validateKnot: () => validateKnot,
|
|
9662
|
-
weave: () => weave
|
|
9663
|
-
});
|
|
9664
|
-
var init_needle = __esm({
|
|
9665
|
-
"src/needle/index.ts"() {
|
|
9666
|
-
init_needle_types();
|
|
9667
|
-
init_needle_engine();
|
|
9668
|
-
init_knot_types();
|
|
9669
|
-
init_knot_engine();
|
|
9670
|
-
init_fabric_types();
|
|
9671
|
-
init_fabric_engine();
|
|
9672
|
-
init_pattern_types();
|
|
9673
|
-
init_pattern_engine();
|
|
9674
7417
|
}
|
|
9675
7418
|
});
|
|
9676
7419
|
|
|
@@ -10453,54 +8196,17 @@ var require_chunk_hash_sensor = __commonJS({
|
|
|
10453
8196
|
var require_entropy_sensor = __commonJS({
|
|
10454
8197
|
"src/sensors/entropy.sensor.ts"(exports) {
|
|
10455
8198
|
"use strict";
|
|
10456
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
10457
|
-
if (k2 === void 0) k2 = k;
|
|
10458
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10459
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10460
|
-
desc = { enumerable: true, get: function() {
|
|
10461
|
-
return m[k];
|
|
10462
|
-
} };
|
|
10463
|
-
}
|
|
10464
|
-
Object.defineProperty(o, k2, desc);
|
|
10465
|
-
}) : (function(o, m, k, k2) {
|
|
10466
|
-
if (k2 === void 0) k2 = k;
|
|
10467
|
-
o[k2] = m[k];
|
|
10468
|
-
}));
|
|
10469
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
10470
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
10471
|
-
}) : function(o, v) {
|
|
10472
|
-
o["default"] = v;
|
|
10473
|
-
});
|
|
10474
8199
|
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
10475
8200
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10476
8201
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10477
8202
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10478
8203
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10479
8204
|
};
|
|
10480
|
-
var __importStar = exports && exports.__importStar || /* @__PURE__ */ (function() {
|
|
10481
|
-
var ownKeys = function(o) {
|
|
10482
|
-
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
10483
|
-
var ar = [];
|
|
10484
|
-
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
10485
|
-
return ar;
|
|
10486
|
-
};
|
|
10487
|
-
return ownKeys(o);
|
|
10488
|
-
};
|
|
10489
|
-
return function(mod) {
|
|
10490
|
-
if (mod && mod.__esModule) return mod;
|
|
10491
|
-
var result = {};
|
|
10492
|
-
if (mod != null) {
|
|
10493
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
10494
|
-
}
|
|
10495
|
-
__setModuleDefault(result, mod);
|
|
10496
|
-
return result;
|
|
10497
|
-
};
|
|
10498
|
-
})();
|
|
10499
8205
|
var EntropySensor_1;
|
|
10500
8206
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10501
8207
|
exports.EntropySensor = void 0;
|
|
10502
8208
|
var common_1 = __require("@nestjs/common");
|
|
10503
|
-
var crypto3 =
|
|
8209
|
+
var crypto3 = __require("crypto");
|
|
10504
8210
|
var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
|
|
10505
8211
|
var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
|
|
10506
8212
|
var constants_1 = (init_constants(), __toCommonJS(constants_exports));
|
|
@@ -10956,143 +8662,6 @@ var require_intent_registry_sensor = __commonJS({
|
|
|
10956
8662
|
}
|
|
10957
8663
|
});
|
|
10958
8664
|
|
|
10959
|
-
// src/sensors/law-evaluation.sensor.ts
|
|
10960
|
-
var require_law_evaluation_sensor = __commonJS({
|
|
10961
|
-
"src/sensors/law-evaluation.sensor.ts"(exports) {
|
|
10962
|
-
"use strict";
|
|
10963
|
-
var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
|
|
10964
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
10965
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10966
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10967
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10968
|
-
};
|
|
10969
|
-
var __metadata = exports && exports.__metadata || function(k, v) {
|
|
10970
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10971
|
-
};
|
|
10972
|
-
var LawEvaluationSensor_1;
|
|
10973
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10974
|
-
exports.LawEvaluationSensor = void 0;
|
|
10975
|
-
var common_1 = __require("@nestjs/common");
|
|
10976
|
-
var sensor_decorator_1 = (init_sensor_decorator(), __toCommonJS(sensor_decorator_exports));
|
|
10977
|
-
var sensor_bands_1 = (init_sensor_bands(), __toCommonJS(sensor_bands_exports));
|
|
10978
|
-
var law_1 = (init_law(), __toCommonJS(law_exports));
|
|
10979
|
-
var LawEvaluationSensor = LawEvaluationSensor_1 = class LawEvaluationSensor {
|
|
10980
|
-
constructor(options = {}) {
|
|
10981
|
-
this.options = options;
|
|
10982
|
-
this.logger = new common_1.Logger(LawEvaluationSensor_1.name);
|
|
10983
|
-
this.name = "LawEvaluationSensor";
|
|
10984
|
-
this.order = sensor_bands_1.BAND.POLICY + 5;
|
|
10985
|
-
}
|
|
10986
|
-
supports(input) {
|
|
10987
|
-
return !!this.options.evaluator && !!input.intent;
|
|
10988
|
-
}
|
|
10989
|
-
async run(input) {
|
|
10990
|
-
const evaluator = this.options.evaluator;
|
|
10991
|
-
if (!evaluator) {
|
|
10992
|
-
return { action: "ALLOW" };
|
|
10993
|
-
}
|
|
10994
|
-
const context = (0, law_1.buildAxisLawEvaluationContext)(input);
|
|
10995
|
-
let result;
|
|
10996
|
-
try {
|
|
10997
|
-
result = await evaluator(context);
|
|
10998
|
-
} catch (error) {
|
|
10999
|
-
const message = error instanceof Error ? error.message : "Unknown law evaluation error";
|
|
11000
|
-
this.logger.error(`Law evaluation failed for ${input.intent}: ${message}`);
|
|
11001
|
-
input.metadata = {
|
|
11002
|
-
...input.metadata ?? {},
|
|
11003
|
-
lawEvaluation: {
|
|
11004
|
-
decision: "deny",
|
|
11005
|
-
reason: "Law evaluation failed",
|
|
11006
|
-
explanation: message
|
|
11007
|
-
}
|
|
11008
|
-
};
|
|
11009
|
-
return {
|
|
11010
|
-
action: "DENY",
|
|
11011
|
-
code: "LAW_EVALUATION_ERROR",
|
|
11012
|
-
reason: message,
|
|
11013
|
-
meta: { lawDecision: "deny" }
|
|
11014
|
-
};
|
|
11015
|
-
}
|
|
11016
|
-
input.metadata = {
|
|
11017
|
-
...input.metadata ?? {},
|
|
11018
|
-
lawEvaluation: {
|
|
11019
|
-
...result,
|
|
11020
|
-
context: sanitizeLawContext(context)
|
|
11021
|
-
}
|
|
11022
|
-
};
|
|
11023
|
-
if (result.decision === "allow") {
|
|
11024
|
-
return {
|
|
11025
|
-
allow: true,
|
|
11026
|
-
riskScore: 0,
|
|
11027
|
-
reasons: result.reason ? [result.reason] : [],
|
|
11028
|
-
tags: {
|
|
11029
|
-
lawDecision: "allow",
|
|
11030
|
-
...result.applicable ? { lawApplicableArticles: result.applicable.length } : {}
|
|
11031
|
-
},
|
|
11032
|
-
meta: result
|
|
11033
|
-
};
|
|
11034
|
-
}
|
|
11035
|
-
if (result.decision === "conditional") {
|
|
11036
|
-
const mode = this.options.conditionalDecision ?? "deny";
|
|
11037
|
-
const reasons = [result.reason, result.explanation].filter(Boolean);
|
|
11038
|
-
if (mode === "allow") {
|
|
11039
|
-
return {
|
|
11040
|
-
allow: true,
|
|
11041
|
-
riskScore: 0,
|
|
11042
|
-
reasons,
|
|
11043
|
-
tags: {
|
|
11044
|
-
lawDecision: "conditional"
|
|
11045
|
-
},
|
|
11046
|
-
meta: result
|
|
11047
|
-
};
|
|
11048
|
-
}
|
|
11049
|
-
if (mode === "flag") {
|
|
11050
|
-
return {
|
|
11051
|
-
action: "FLAG",
|
|
11052
|
-
scoreDelta: 25,
|
|
11053
|
-
reasons: reasons.length > 0 ? reasons : ["Execution is conditionally permitted pending additional requirements"],
|
|
11054
|
-
meta: result
|
|
11055
|
-
};
|
|
11056
|
-
}
|
|
11057
|
-
return {
|
|
11058
|
-
action: "DENY",
|
|
11059
|
-
code: "LAW_CONDITIONAL",
|
|
11060
|
-
reason: reasons.join(" | ") || "Execution is conditionally permitted pending additional requirements",
|
|
11061
|
-
meta: { lawDecision: "conditional", evaluation: result }
|
|
11062
|
-
};
|
|
11063
|
-
}
|
|
11064
|
-
return {
|
|
11065
|
-
action: "DENY",
|
|
11066
|
-
code: "LAW_DENIED",
|
|
11067
|
-
reason: [result.reason, result.explanation].filter(Boolean).join(" | ") || "Execution denied by law evaluation",
|
|
11068
|
-
meta: { lawDecision: "deny", evaluation: result }
|
|
11069
|
-
};
|
|
11070
|
-
}
|
|
11071
|
-
};
|
|
11072
|
-
exports.LawEvaluationSensor = LawEvaluationSensor;
|
|
11073
|
-
exports.LawEvaluationSensor = LawEvaluationSensor = LawEvaluationSensor_1 = __decorate([
|
|
11074
|
-
(0, sensor_decorator_1.Sensor)(),
|
|
11075
|
-
(0, common_1.Injectable)(),
|
|
11076
|
-
__metadata("design:paramtypes", [Object])
|
|
11077
|
-
], LawEvaluationSensor);
|
|
11078
|
-
function sanitizeLawContext(context) {
|
|
11079
|
-
return {
|
|
11080
|
-
actorId: context.actorId,
|
|
11081
|
-
intent: context.intent,
|
|
11082
|
-
audience: context.audience,
|
|
11083
|
-
tps: context.tps,
|
|
11084
|
-
country: context.country,
|
|
11085
|
-
ip: context.ip,
|
|
11086
|
-
path: context.path,
|
|
11087
|
-
clientId: context.clientId,
|
|
11088
|
-
deviceId: context.deviceId,
|
|
11089
|
-
sessionId: context.sessionId,
|
|
11090
|
-
capsuleId: context.capsuleId
|
|
11091
|
-
};
|
|
11092
|
-
}
|
|
11093
|
-
}
|
|
11094
|
-
});
|
|
11095
|
-
|
|
11096
8665
|
// src/sensors/proof-presence.sensor.ts
|
|
11097
8666
|
var require_proof_presence_sensor = __commonJS({
|
|
11098
8667
|
"src/sensors/proof-presence.sensor.ts"(exports) {
|
|
@@ -11297,12 +8866,7 @@ var require_protocol_strict_sensor = __commonJS({
|
|
|
11297
8866
|
return true;
|
|
11298
8867
|
}
|
|
11299
8868
|
isValidContentType(contentType) {
|
|
11300
|
-
|
|
11301
|
-
"application/axis-bin",
|
|
11302
|
-
"application/octet-stream",
|
|
11303
|
-
"application/x-axis"
|
|
11304
|
-
];
|
|
11305
|
-
return valid.some((v) => contentType.toLowerCase().includes(v));
|
|
8869
|
+
return constants_1.AxisMediaTypes.isAxisContentType(contentType);
|
|
11306
8870
|
}
|
|
11307
8871
|
isValidFlags(flags) {
|
|
11308
8872
|
return VALID_FLAGS.includes(flags);
|
|
@@ -11800,40 +9364,16 @@ var init_sensors2 = __esm({
|
|
|
11800
9364
|
__reExport(sensors_exports, __toESM(require_header_tlv_limit_sensor()));
|
|
11801
9365
|
__reExport(sensors_exports, __toESM(require_intent_allowlist_sensor()));
|
|
11802
9366
|
__reExport(sensors_exports, __toESM(require_intent_registry_sensor()));
|
|
11803
|
-
__reExport(sensors_exports, __toESM(require_law_evaluation_sensor()));
|
|
11804
9367
|
__reExport(sensors_exports, __toESM(require_proof_presence_sensor()));
|
|
11805
9368
|
__reExport(sensors_exports, __toESM(require_protocol_strict_sensor()));
|
|
11806
9369
|
__reExport(sensors_exports, __toESM(require_receipt_policy_sensor()));
|
|
11807
|
-
__reExport(sensors_exports, __toESM(require_risk_gate_sensor()));
|
|
11808
9370
|
__reExport(sensors_exports, __toESM(require_schema_validation_sensor()));
|
|
11809
9371
|
__reExport(sensors_exports, __toESM(require_stream_scope_sensor()));
|
|
11810
|
-
__reExport(sensors_exports, __toESM(require_tickauth_sensor()));
|
|
11811
9372
|
__reExport(sensors_exports, __toESM(require_tlv_parse_sensor()));
|
|
11812
|
-
__reExport(sensors_exports, __toESM(require_tps_sensor()));
|
|
11813
9373
|
__reExport(sensors_exports, __toESM(require_varint_hardening_sensor()));
|
|
11814
9374
|
}
|
|
11815
9375
|
});
|
|
11816
9376
|
|
|
11817
|
-
// src/timeline/timeline.types.ts
|
|
11818
|
-
var init_timeline_types = __esm({
|
|
11819
|
-
"src/timeline/timeline.types.ts"() {
|
|
11820
|
-
}
|
|
11821
|
-
});
|
|
11822
|
-
|
|
11823
|
-
// src/timeline/index.ts
|
|
11824
|
-
var timeline_exports = {};
|
|
11825
|
-
__export(timeline_exports, {
|
|
11826
|
-
InMemoryTimelineStore: () => InMemoryTimelineStore,
|
|
11827
|
-
TimelineEngine: () => TimelineEngine
|
|
11828
|
-
});
|
|
11829
|
-
var init_timeline = __esm({
|
|
11830
|
-
"src/timeline/index.ts"() {
|
|
11831
|
-
init_timeline_types();
|
|
11832
|
-
init_timeline_store();
|
|
11833
|
-
init_timeline_engine();
|
|
11834
|
-
}
|
|
11835
|
-
});
|
|
11836
|
-
|
|
11837
9377
|
// src/utils/index.ts
|
|
11838
9378
|
var utils_exports = {};
|
|
11839
9379
|
__export(utils_exports, {
|
|
@@ -11868,6 +9408,7 @@ __export(index_exports, {
|
|
|
11868
9408
|
AxisFrameZ: () => AxisFrameZ,
|
|
11869
9409
|
AxisIdDto: () => import_axis_id.AxisIdDto,
|
|
11870
9410
|
AxisIp: () => import_axis_request.AxisIp,
|
|
9411
|
+
AxisMediaTypes: () => AxisMediaTypes,
|
|
11871
9412
|
AxisPacketTags: () => T,
|
|
11872
9413
|
AxisPartialType: () => AxisPartialType,
|
|
11873
9414
|
AxisRaw: () => import_axis_request.AxisRaw,
|
|
@@ -11910,10 +9451,6 @@ __export(index_exports, {
|
|
|
11910
9451
|
INTENT_SENSITIVITY_MAP: () => INTENT_SENSITIVITY_MAP,
|
|
11911
9452
|
INTENT_SENSORS_KEY: () => INTENT_SENSORS_KEY,
|
|
11912
9453
|
INTENT_TIMEOUTS: () => INTENT_TIMEOUTS,
|
|
11913
|
-
IdelCompiler: () => IdelCompiler,
|
|
11914
|
-
IdelSchemaRegistry: () => IdelSchemaRegistry,
|
|
11915
|
-
InMemoryPatternStore: () => InMemoryPatternStore,
|
|
11916
|
-
InMemoryTimelineStore: () => InMemoryTimelineStore,
|
|
11917
9454
|
Intent: () => Intent,
|
|
11918
9455
|
IntentBody: () => IntentBody,
|
|
11919
9456
|
IntentRouter: () => import_intent2.IntentRouter,
|
|
@@ -11955,7 +9492,6 @@ __export(index_exports, {
|
|
|
11955
9492
|
RESPONSE_TAG_UPDATED_BY: () => import_axis_response.RESPONSE_TAG_UPDATED_BY,
|
|
11956
9493
|
ResponseObserver: () => ResponseObserver,
|
|
11957
9494
|
RiskDecision: () => RiskDecision,
|
|
11958
|
-
RiskGateSensor: () => import_risk_gate.RiskGateSensor,
|
|
11959
9495
|
SENSOR_METADATA_KEY: () => SENSOR_METADATA_KEY,
|
|
11960
9496
|
Schema2002_PasskeyLoginOptionsRes: () => Schema2002_PasskeyLoginOptionsRes,
|
|
11961
9497
|
Schema2011_PasskeyLoginVerifyReq: () => Schema2011_PasskeyLoginVerifyReq,
|
|
@@ -11974,7 +9510,7 @@ __export(index_exports, {
|
|
|
11974
9510
|
TLV_EFFECT: () => TLV_EFFECT,
|
|
11975
9511
|
TLV_ERROR_CODE: () => TLV_ERROR_CODE,
|
|
11976
9512
|
TLV_ERROR_MSG: () => TLV_ERROR_MSG,
|
|
11977
|
-
TLV_FIELDS_KEY: () =>
|
|
9513
|
+
TLV_FIELDS_KEY: () => TLV_FIELDS_KEY,
|
|
11978
9514
|
TLV_INDEX: () => TLV_INDEX,
|
|
11979
9515
|
TLV_INTENT: () => TLV_INTENT,
|
|
11980
9516
|
TLV_KID: () => TLV_KID,
|
|
@@ -12000,28 +9536,20 @@ __export(index_exports, {
|
|
|
12000
9536
|
TLV_TRACE_ID: () => TLV_TRACE_ID,
|
|
12001
9537
|
TLV_TS: () => TLV_TS,
|
|
12002
9538
|
TLV_UPLOAD_ID: () => TLV_UPLOAD_ID,
|
|
12003
|
-
TLV_VALIDATORS_KEY: () =>
|
|
9539
|
+
TLV_VALIDATORS_KEY: () => TLV_VALIDATORS_KEY,
|
|
12004
9540
|
TLV_WRIT: () => TLV_LOOM_WRIT,
|
|
12005
|
-
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
TlvUtf8Pattern: () => import_tlv_field2.TlvUtf8Pattern,
|
|
12012
|
-
TlvValidate: () => import_tlv_field2.TlvValidate,
|
|
12013
|
-
TpsSensor: () => import_tps.TpsSensor,
|
|
12014
|
-
addStitchToKnot: () => addStitchToKnot,
|
|
12015
|
-
applyStitch: () => applyStitch,
|
|
12016
|
-
assembleNeedle: () => assembleNeedle,
|
|
9541
|
+
TlvEnum: () => TlvEnum,
|
|
9542
|
+
TlvField: () => TlvField,
|
|
9543
|
+
TlvMinLen: () => TlvMinLen,
|
|
9544
|
+
TlvRange: () => TlvRange,
|
|
9545
|
+
TlvUtf8Pattern: () => TlvUtf8Pattern,
|
|
9546
|
+
TlvValidate: () => TlvValidate,
|
|
12017
9547
|
axis1SigningBytes: () => axis1SigningBytes,
|
|
12018
9548
|
b64urlDecode: () => b64urlDecode,
|
|
12019
9549
|
b64urlDecodeString: () => b64urlDecodeString,
|
|
12020
9550
|
b64urlEncode: () => b64urlEncode,
|
|
12021
9551
|
b64urlEncodeString: () => b64urlEncodeString,
|
|
12022
|
-
breakKnot: () => breakKnot,
|
|
12023
9552
|
buildAts1Hdr: () => buildAts1Hdr,
|
|
12024
|
-
buildAxisLawEvaluationContext: () => buildAxisLawEvaluationContext,
|
|
12025
9553
|
buildDtoDecoder: () => import_dto_schema.buildDtoDecoder,
|
|
12026
9554
|
buildPacket: () => buildPacket,
|
|
12027
9555
|
buildQueueMessage: () => buildQueueMessage,
|
|
@@ -12040,13 +9568,7 @@ __export(index_exports, {
|
|
|
12040
9568
|
computeReceiptHash: () => computeReceiptHash,
|
|
12041
9569
|
computeSignaturePayload: () => computeSignaturePayload,
|
|
12042
9570
|
core: () => core_exports,
|
|
12043
|
-
createFabric: () => createFabric,
|
|
12044
|
-
createGrant: () => createGrant,
|
|
12045
9571
|
createObservation: () => createObservation,
|
|
12046
|
-
createPresenceChallenge: () => createPresenceChallenge,
|
|
12047
|
-
createReceipt: () => createReceipt,
|
|
12048
|
-
createRevocation: () => createRevocation,
|
|
12049
|
-
createWrit: () => createWrit,
|
|
12050
9572
|
crypto: () => crypto_exports,
|
|
12051
9573
|
decodeArray: () => decodeArray,
|
|
12052
9574
|
decodeAxis1Frame: () => decodeAxis1Frame,
|
|
@@ -12058,10 +9580,6 @@ __export(index_exports, {
|
|
|
12058
9580
|
decodeVarint: () => decodeVarint,
|
|
12059
9581
|
decorators: () => decorators_exports,
|
|
12060
9582
|
deriveAnchorReflection: () => deriveAnchorReflection,
|
|
12061
|
-
detectAnomalies: () => detectAnomalies,
|
|
12062
|
-
detectKnotPatterns: () => detectKnotPatterns,
|
|
12063
|
-
detectSequencePatterns: () => detectSequencePatterns,
|
|
12064
|
-
diffFabrics: () => diffFabrics,
|
|
12065
9583
|
encVarint: () => encVarint,
|
|
12066
9584
|
encodeAxis1Frame: () => encodeAxis1Frame,
|
|
12067
9585
|
encodeAxisTlvDto: () => encodeAxisTlvDto,
|
|
@@ -12072,38 +9590,20 @@ __export(index_exports, {
|
|
|
12072
9590
|
endStage: () => endStage,
|
|
12073
9591
|
engine: () => engine_exports,
|
|
12074
9592
|
executeCcePipeline: () => executeCcePipeline,
|
|
12075
|
-
executeLoomPipeline: () => executeLoomPipeline,
|
|
12076
9593
|
extractDtoSchema: () => import_dto_schema.extractDtoSchema,
|
|
12077
9594
|
finalizeObservation: () => finalizeObservation,
|
|
12078
|
-
findKnotsForStitch: () => findKnotsForStitch,
|
|
12079
|
-
forkFromKnot: () => forkFromKnot,
|
|
12080
|
-
formStitch: () => formStitch,
|
|
12081
9595
|
generateEd25519KeyPair: () => generateEd25519KeyPair,
|
|
12082
9596
|
getAxisExecutionContext: () => getAxisExecutionContext,
|
|
12083
|
-
getDecisionPoints: () => getDecisionPoints,
|
|
12084
|
-
getFabricValue: () => getFabricValue,
|
|
12085
|
-
getGrantStatus: () => getGrantStatus,
|
|
12086
|
-
getIrreversibleKnots: () => getIrreversibleKnots,
|
|
12087
|
-
getPresenceStatus: () => getPresenceStatus,
|
|
12088
9597
|
getSignTarget: () => getSignTarget,
|
|
12089
|
-
grantCoversAction: () => grantCoversAction,
|
|
12090
9598
|
hasScope: () => hasScope,
|
|
12091
9599
|
hashObservation: () => hashObservation,
|
|
12092
|
-
idel: () => idel_exports,
|
|
12093
9600
|
isAdminOpcode: () => isAdminOpcode,
|
|
12094
|
-
isKnotOpen: () => isKnotOpen,
|
|
12095
9601
|
isKnownOpcode: () => isKnownOpcode,
|
|
12096
|
-
isPointOfNoReturn: () => isPointOfNoReturn,
|
|
12097
|
-
isRevoked: () => isRevoked,
|
|
12098
9602
|
isTimestampValid: () => isTimestampValid,
|
|
12099
|
-
lockCells: () => lockCells,
|
|
12100
9603
|
loom: () => loom_exports,
|
|
12101
|
-
matchPatterns: () => matchPatterns,
|
|
12102
9604
|
mergeAxisExecutionContext: () => mergeAxisExecutionContext,
|
|
12103
|
-
needle: () => needle_exports,
|
|
12104
9605
|
nonce16: () => nonce16,
|
|
12105
9606
|
normalizeSensorDecision: () => normalizeSensorDecision,
|
|
12106
|
-
openKnot: () => openKnot,
|
|
12107
9607
|
packPasskeyLoginOptionsReq: () => packPasskeyLoginOptionsReq,
|
|
12108
9608
|
packPasskeyLoginOptionsRes: () => packPasskeyLoginOptionsRes,
|
|
12109
9609
|
packPasskeyLoginVerifyReq: () => packPasskeyLoginVerifyReq,
|
|
@@ -12112,48 +9612,31 @@ __export(index_exports, {
|
|
|
12112
9612
|
parseAutoClaimEntries: () => parseAutoClaimEntries,
|
|
12113
9613
|
parseScope: () => parseScope,
|
|
12114
9614
|
parseStreamEntries: () => parseStreamEntries,
|
|
12115
|
-
projectAt: () => projectAt,
|
|
12116
|
-
queryFabric: () => queryFabric,
|
|
12117
|
-
recordOccurrence: () => recordOccurrence,
|
|
12118
9615
|
recordSensor: () => recordSensor,
|
|
12119
|
-
renewPresence: () => renewPresence,
|
|
12120
9616
|
resolveTimeout: () => resolveTimeout,
|
|
12121
|
-
runNeedlePipeline: () => runNeedlePipeline,
|
|
12122
9617
|
schemas: () => schemas_exports,
|
|
12123
|
-
scoreTruth: () => scoreTruth,
|
|
12124
9618
|
security: () => security_exports,
|
|
12125
9619
|
sensitivityName: () => sensitivityName,
|
|
12126
9620
|
sensors: () => sensors_exports,
|
|
12127
9621
|
sha256: () => sha2564,
|
|
12128
9622
|
signFrame: () => signFrame,
|
|
12129
|
-
signPresenceChallenge: () => signPresenceChallenge,
|
|
12130
9623
|
stableJsonStringify: () => stableJsonStringify,
|
|
12131
9624
|
startStage: () => startStage,
|
|
12132
|
-
tieKnot: () => tieKnot,
|
|
12133
|
-
timeline: () => timeline_exports,
|
|
12134
9625
|
tlv: () => tlv,
|
|
12135
9626
|
u64be: () => u64be,
|
|
12136
9627
|
unpackPasskeyLoginOptionsReq: () => unpackPasskeyLoginOptionsReq,
|
|
12137
9628
|
unpackPasskeyLoginVerifyReq: () => unpackPasskeyLoginVerifyReq,
|
|
12138
9629
|
unpackPasskeyRegisterOptionsReq: () => unpackPasskeyRegisterOptionsReq,
|
|
12139
|
-
updateThreadState: () => updateThreadState,
|
|
12140
9630
|
utf8: () => utf8,
|
|
12141
9631
|
utils: () => utils_exports,
|
|
12142
9632
|
validateFrameShape: () => validateFrameShape,
|
|
12143
|
-
validateGrant: () => validateGrant,
|
|
12144
|
-
validateKnot: () => validateKnot,
|
|
12145
|
-
validateWrit: () => validateWrit,
|
|
12146
9633
|
varintLength: () => varintLength,
|
|
12147
9634
|
varintU: () => varintU,
|
|
12148
9635
|
verifyFrameSignature: () => verifyFrameSignature,
|
|
12149
|
-
verifyObservation: () => verifyObservation,
|
|
12150
|
-
verifyPresenceProof: () => verifyPresenceProof,
|
|
12151
|
-
verifyReceiptChain: () => verifyReceiptChain,
|
|
12152
9636
|
verifyResponse: () => verifyResponse,
|
|
12153
|
-
weave: () => weave,
|
|
12154
9637
|
withAxisExecutionContext: () => withAxisExecutionContext
|
|
12155
9638
|
});
|
|
12156
|
-
var
|
|
9639
|
+
var import_dto_schema, import_axis_id, import_axis_response, import_axis_chain, import_intent2, import_axis_files, import_axis_request, import_observer_discovery, import_observer_dispatcher, import_handler_discovery, import_sensor_discovery, import_observer2, import_sensor2, import_axis_sensor_chain;
|
|
12157
9640
|
var init_index = __esm({
|
|
12158
9641
|
"src/index.ts"() {
|
|
12159
9642
|
init_chain_decorator();
|
|
@@ -12165,7 +9648,7 @@ var init_index = __esm({
|
|
|
12165
9648
|
init_observer_decorator();
|
|
12166
9649
|
init_handler_sensors_decorator();
|
|
12167
9650
|
init_sensor_decorator();
|
|
12168
|
-
|
|
9651
|
+
init_tlv_field_decorator();
|
|
12169
9652
|
import_dto_schema = __toESM(require_dto_schema_util());
|
|
12170
9653
|
init_axis_tlv_dto();
|
|
12171
9654
|
import_axis_id = __toESM(require_axis_id_dto());
|
|
@@ -12178,7 +9661,6 @@ var init_index = __esm({
|
|
|
12178
9661
|
init_stable_json();
|
|
12179
9662
|
init_observation_queue_codec();
|
|
12180
9663
|
init_observation_hash();
|
|
12181
|
-
init_truth_scoring();
|
|
12182
9664
|
init_response_observer();
|
|
12183
9665
|
init_constants();
|
|
12184
9666
|
init_varint();
|
|
@@ -12200,7 +9682,6 @@ var init_index = __esm({
|
|
|
12200
9682
|
init_axis_sensor();
|
|
12201
9683
|
init_scopes();
|
|
12202
9684
|
init_capabilities();
|
|
12203
|
-
init_law();
|
|
12204
9685
|
init_risk();
|
|
12205
9686
|
init_opcodes();
|
|
12206
9687
|
init_receipt();
|
|
@@ -12220,33 +9701,19 @@ var init_index = __esm({
|
|
|
12220
9701
|
import_sensor2 = __toESM(require_sensor_registry());
|
|
12221
9702
|
init_axis_observation();
|
|
12222
9703
|
import_axis_sensor_chain = __toESM(require_axis_sensor_chain_service());
|
|
12223
|
-
init_timeline_engine();
|
|
12224
|
-
init_timeline_store();
|
|
12225
9704
|
init_cce_pipeline();
|
|
12226
9705
|
init_cce_types();
|
|
12227
9706
|
init_axis_tlv_codec();
|
|
12228
9707
|
init_loom_types();
|
|
12229
|
-
init_loom_engine();
|
|
12230
|
-
init_idel_compiler();
|
|
12231
|
-
init_needle_engine();
|
|
12232
|
-
init_knot_engine();
|
|
12233
|
-
init_fabric_engine();
|
|
12234
|
-
init_pattern_engine();
|
|
12235
|
-
import_tps = __toESM(require_tps_sensor());
|
|
12236
|
-
import_risk_gate = __toESM(require_risk_gate_sensor());
|
|
12237
|
-
import_tickauth = __toESM(require_tickauth_sensor());
|
|
12238
9708
|
init_cce();
|
|
12239
9709
|
init_core();
|
|
12240
9710
|
init_crypto();
|
|
12241
9711
|
init_decorators();
|
|
12242
9712
|
init_engine();
|
|
12243
|
-
init_idel();
|
|
12244
9713
|
init_loom();
|
|
12245
|
-
init_needle();
|
|
12246
9714
|
init_schemas();
|
|
12247
9715
|
init_security();
|
|
12248
9716
|
init_sensors2();
|
|
12249
|
-
init_timeline();
|
|
12250
9717
|
init_utils();
|
|
12251
9718
|
}
|
|
12252
9719
|
});
|
|
@@ -12272,19 +9739,8 @@ var export_RESPONSE_TAG_CREATED_BY = import_axis_response.RESPONSE_TAG_CREATED_B
|
|
|
12272
9739
|
var export_RESPONSE_TAG_ID = import_axis_response.RESPONSE_TAG_ID;
|
|
12273
9740
|
var export_RESPONSE_TAG_UPDATED_AT = import_axis_response.RESPONSE_TAG_UPDATED_AT;
|
|
12274
9741
|
var export_RESPONSE_TAG_UPDATED_BY = import_axis_response.RESPONSE_TAG_UPDATED_BY;
|
|
12275
|
-
var export_RiskGateSensor = import_risk_gate.RiskGateSensor;
|
|
12276
9742
|
var export_SensorDiscoveryService = import_sensor_discovery.SensorDiscoveryService;
|
|
12277
9743
|
var export_SensorRegistry = import_sensor2.SensorRegistry;
|
|
12278
|
-
var export_TLV_FIELDS_KEY = import_tlv_field2.TLV_FIELDS_KEY;
|
|
12279
|
-
var export_TLV_VALIDATORS_KEY = import_tlv_field2.TLV_VALIDATORS_KEY;
|
|
12280
|
-
var export_TickAuthSensor = import_tickauth.TickAuthSensor;
|
|
12281
|
-
var export_TlvEnum = import_tlv_field2.TlvEnum;
|
|
12282
|
-
var export_TlvField = import_tlv_field2.TlvField;
|
|
12283
|
-
var export_TlvMinLen = import_tlv_field2.TlvMinLen;
|
|
12284
|
-
var export_TlvRange = import_tlv_field2.TlvRange;
|
|
12285
|
-
var export_TlvUtf8Pattern = import_tlv_field2.TlvUtf8Pattern;
|
|
12286
|
-
var export_TlvValidate = import_tlv_field2.TlvValidate;
|
|
12287
|
-
var export_TpsSensor = import_tps.TpsSensor;
|
|
12288
9744
|
var export_buildDtoDecoder = import_dto_schema.buildDtoDecoder;
|
|
12289
9745
|
var export_extractDtoSchema = import_dto_schema.extractDtoSchema;
|
|
12290
9746
|
export {
|
|
@@ -12308,6 +9764,7 @@ export {
|
|
|
12308
9764
|
AxisFrameZ,
|
|
12309
9765
|
export_AxisIdDto as AxisIdDto,
|
|
12310
9766
|
export_AxisIp as AxisIp,
|
|
9767
|
+
AxisMediaTypes,
|
|
12311
9768
|
T as AxisPacketTags,
|
|
12312
9769
|
AxisPartialType,
|
|
12313
9770
|
export_AxisRaw as AxisRaw,
|
|
@@ -12350,10 +9807,6 @@ export {
|
|
|
12350
9807
|
INTENT_SENSITIVITY_MAP,
|
|
12351
9808
|
INTENT_SENSORS_KEY,
|
|
12352
9809
|
INTENT_TIMEOUTS,
|
|
12353
|
-
IdelCompiler,
|
|
12354
|
-
IdelSchemaRegistry,
|
|
12355
|
-
InMemoryPatternStore,
|
|
12356
|
-
InMemoryTimelineStore,
|
|
12357
9810
|
Intent,
|
|
12358
9811
|
IntentBody,
|
|
12359
9812
|
export_IntentRouter as IntentRouter,
|
|
@@ -12395,7 +9848,6 @@ export {
|
|
|
12395
9848
|
export_RESPONSE_TAG_UPDATED_BY as RESPONSE_TAG_UPDATED_BY,
|
|
12396
9849
|
ResponseObserver,
|
|
12397
9850
|
RiskDecision,
|
|
12398
|
-
export_RiskGateSensor as RiskGateSensor,
|
|
12399
9851
|
SENSOR_METADATA_KEY,
|
|
12400
9852
|
Schema2002_PasskeyLoginOptionsRes,
|
|
12401
9853
|
Schema2011_PasskeyLoginVerifyReq,
|
|
@@ -12414,7 +9866,7 @@ export {
|
|
|
12414
9866
|
TLV_EFFECT,
|
|
12415
9867
|
TLV_ERROR_CODE,
|
|
12416
9868
|
TLV_ERROR_MSG,
|
|
12417
|
-
|
|
9869
|
+
TLV_FIELDS_KEY,
|
|
12418
9870
|
TLV_INDEX,
|
|
12419
9871
|
TLV_INTENT,
|
|
12420
9872
|
TLV_KID,
|
|
@@ -12440,28 +9892,20 @@ export {
|
|
|
12440
9892
|
TLV_TRACE_ID,
|
|
12441
9893
|
TLV_TS,
|
|
12442
9894
|
TLV_UPLOAD_ID,
|
|
12443
|
-
|
|
9895
|
+
TLV_VALIDATORS_KEY,
|
|
12444
9896
|
TLV_LOOM_WRIT as TLV_WRIT,
|
|
12445
|
-
|
|
12446
|
-
|
|
12447
|
-
|
|
12448
|
-
|
|
12449
|
-
|
|
12450
|
-
|
|
12451
|
-
export_TlvUtf8Pattern as TlvUtf8Pattern,
|
|
12452
|
-
export_TlvValidate as TlvValidate,
|
|
12453
|
-
export_TpsSensor as TpsSensor,
|
|
12454
|
-
addStitchToKnot,
|
|
12455
|
-
applyStitch,
|
|
12456
|
-
assembleNeedle,
|
|
9897
|
+
TlvEnum,
|
|
9898
|
+
TlvField,
|
|
9899
|
+
TlvMinLen,
|
|
9900
|
+
TlvRange,
|
|
9901
|
+
TlvUtf8Pattern,
|
|
9902
|
+
TlvValidate,
|
|
12457
9903
|
axis1SigningBytes,
|
|
12458
9904
|
b64urlDecode,
|
|
12459
9905
|
b64urlDecodeString,
|
|
12460
9906
|
b64urlEncode,
|
|
12461
9907
|
b64urlEncodeString,
|
|
12462
|
-
breakKnot,
|
|
12463
9908
|
buildAts1Hdr,
|
|
12464
|
-
buildAxisLawEvaluationContext,
|
|
12465
9909
|
export_buildDtoDecoder as buildDtoDecoder,
|
|
12466
9910
|
buildPacket,
|
|
12467
9911
|
buildQueueMessage,
|
|
@@ -12480,13 +9924,7 @@ export {
|
|
|
12480
9924
|
computeReceiptHash,
|
|
12481
9925
|
computeSignaturePayload,
|
|
12482
9926
|
core_exports as core,
|
|
12483
|
-
createFabric,
|
|
12484
|
-
createGrant,
|
|
12485
9927
|
createObservation,
|
|
12486
|
-
createPresenceChallenge,
|
|
12487
|
-
createReceipt,
|
|
12488
|
-
createRevocation,
|
|
12489
|
-
createWrit,
|
|
12490
9928
|
crypto_exports as crypto,
|
|
12491
9929
|
decodeArray,
|
|
12492
9930
|
decodeAxis1Frame,
|
|
@@ -12498,10 +9936,6 @@ export {
|
|
|
12498
9936
|
decodeVarint,
|
|
12499
9937
|
decorators_exports as decorators,
|
|
12500
9938
|
deriveAnchorReflection,
|
|
12501
|
-
detectAnomalies,
|
|
12502
|
-
detectKnotPatterns,
|
|
12503
|
-
detectSequencePatterns,
|
|
12504
|
-
diffFabrics,
|
|
12505
9939
|
encVarint,
|
|
12506
9940
|
encodeAxis1Frame,
|
|
12507
9941
|
encodeAxisTlvDto,
|
|
@@ -12512,38 +9946,20 @@ export {
|
|
|
12512
9946
|
endStage,
|
|
12513
9947
|
engine_exports as engine,
|
|
12514
9948
|
executeCcePipeline,
|
|
12515
|
-
executeLoomPipeline,
|
|
12516
9949
|
export_extractDtoSchema as extractDtoSchema,
|
|
12517
9950
|
finalizeObservation,
|
|
12518
|
-
findKnotsForStitch,
|
|
12519
|
-
forkFromKnot,
|
|
12520
|
-
formStitch,
|
|
12521
9951
|
generateEd25519KeyPair,
|
|
12522
9952
|
getAxisExecutionContext,
|
|
12523
|
-
getDecisionPoints,
|
|
12524
|
-
getFabricValue,
|
|
12525
|
-
getGrantStatus,
|
|
12526
|
-
getIrreversibleKnots,
|
|
12527
|
-
getPresenceStatus,
|
|
12528
9953
|
getSignTarget,
|
|
12529
|
-
grantCoversAction,
|
|
12530
9954
|
hasScope,
|
|
12531
9955
|
hashObservation,
|
|
12532
|
-
idel_exports as idel,
|
|
12533
9956
|
isAdminOpcode,
|
|
12534
|
-
isKnotOpen,
|
|
12535
9957
|
isKnownOpcode,
|
|
12536
|
-
isPointOfNoReturn,
|
|
12537
|
-
isRevoked,
|
|
12538
9958
|
isTimestampValid,
|
|
12539
|
-
lockCells,
|
|
12540
9959
|
loom_exports as loom,
|
|
12541
|
-
matchPatterns,
|
|
12542
9960
|
mergeAxisExecutionContext,
|
|
12543
|
-
needle_exports as needle,
|
|
12544
9961
|
nonce16,
|
|
12545
9962
|
normalizeSensorDecision,
|
|
12546
|
-
openKnot,
|
|
12547
9963
|
packPasskeyLoginOptionsReq,
|
|
12548
9964
|
packPasskeyLoginOptionsRes,
|
|
12549
9965
|
packPasskeyLoginVerifyReq,
|
|
@@ -12552,45 +9968,28 @@ export {
|
|
|
12552
9968
|
parseAutoClaimEntries,
|
|
12553
9969
|
parseScope,
|
|
12554
9970
|
parseStreamEntries,
|
|
12555
|
-
projectAt,
|
|
12556
|
-
queryFabric,
|
|
12557
|
-
recordOccurrence,
|
|
12558
9971
|
recordSensor,
|
|
12559
|
-
renewPresence,
|
|
12560
9972
|
resolveTimeout,
|
|
12561
|
-
runNeedlePipeline,
|
|
12562
9973
|
schemas_exports as schemas,
|
|
12563
|
-
scoreTruth,
|
|
12564
9974
|
security_exports as security,
|
|
12565
9975
|
sensitivityName,
|
|
12566
9976
|
sensors_exports as sensors,
|
|
12567
9977
|
sha2564 as sha256,
|
|
12568
9978
|
signFrame,
|
|
12569
|
-
signPresenceChallenge,
|
|
12570
9979
|
stableJsonStringify,
|
|
12571
9980
|
startStage,
|
|
12572
|
-
tieKnot,
|
|
12573
|
-
timeline_exports as timeline,
|
|
12574
9981
|
tlv,
|
|
12575
9982
|
u64be,
|
|
12576
9983
|
unpackPasskeyLoginOptionsReq,
|
|
12577
9984
|
unpackPasskeyLoginVerifyReq,
|
|
12578
9985
|
unpackPasskeyRegisterOptionsReq,
|
|
12579
|
-
updateThreadState,
|
|
12580
9986
|
utf8,
|
|
12581
9987
|
utils_exports as utils,
|
|
12582
9988
|
validateFrameShape,
|
|
12583
|
-
validateGrant,
|
|
12584
|
-
validateKnot,
|
|
12585
|
-
validateWrit,
|
|
12586
9989
|
varintLength,
|
|
12587
9990
|
varintU,
|
|
12588
9991
|
verifyFrameSignature,
|
|
12589
|
-
verifyObservation,
|
|
12590
|
-
verifyPresenceProof,
|
|
12591
|
-
verifyReceiptChain,
|
|
12592
9992
|
verifyResponse,
|
|
12593
|
-
weave,
|
|
12594
9993
|
withAxisExecutionContext
|
|
12595
9994
|
};
|
|
12596
9995
|
//# sourceMappingURL=index.mjs.map
|