@nextera.one/axis-server-sdk 2.2.6 → 2.2.7

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.
@@ -1,5 +1,5 @@
1
- export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-ldPtIocV.mjs';
2
- import '../axis-sensor-GBEI3Fab.mjs';
3
- import '../cce-pipeline-B-zUBHo3.mjs';
1
+ export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-BLK3AtRm.mjs';
2
+ import '../axis-sensor-DMW4rfRg.mjs';
3
+ import '../cce-pipeline-CBt56guN.mjs';
4
4
  import '@nextera.one/axis-protocol';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
- export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-CwXlBXJf.js';
2
- import '../axis-sensor-GBEI3Fab.js';
3
- import '../cce-pipeline-DbGBSsCG.js';
1
+ export { m as AccessProfileResolverSensor, Y as BodyBudgetSensor, $ as CapabilityEnforcementSensor, a4 as ChunkHashSensor, a7 as EntropySensor, a9 as ExecutionTimeoutSensor, ab as FrameBudgetSensor, ac as FrameHeaderSanitySensor, ad as HeaderTLVLimitSensor, ah as IntentAllowlistSensor, ak as IntentRegistrySensor, am as LawEvaluationSensor, as as ProofPresenceSensor, at as ProtocolStrictSensor, av as ReceiptPolicySensor, aB as RiskGateSensor, aC as RiskGateSensorOptions, aE as RiskSignalCollector, aG as SchemaValidationSensor, aI as StreamScopeSensor, aJ as TLVParseSensor, aM as TickAuthCapsuleRef, aN as TickAuthSensor, aO as TickAuthSensorOptions, aP as TickAuthVerifier, a_ as TpsSensor, a$ as TpsSensorOptions, b0 as VarintHardeningSensor } from '../index-BAoKsEOu.js';
2
+ import '../axis-sensor-DMW4rfRg.js';
3
+ import '../cce-pipeline-BJ-F1isr.js';
4
4
  import '@nextera.one/axis-protocol';
5
5
  import 'zod';
@@ -98,8 +98,9 @@ var require_access_profile_resolver_sensor = __commonJS({
98
98
  this.name = "AccessProfileResolverSensor";
99
99
  this.order = sensor_bands_1.BAND.IDENTITY + 10;
100
100
  }
101
- supports() {
102
- return true;
101
+ async supports(input) {
102
+ void input;
103
+ return { action: "ALLOW" };
103
104
  }
104
105
  async run(input) {
105
106
  const hasCapsule = !!input.metadata?.capsuleId;
@@ -249,8 +250,12 @@ var require_body_budget_sensor = __commonJS({
249
250
  this.name = "BodyBudgetSensor";
250
251
  this.order = sensor_bands_1.BAND.CONTENT + 10;
251
252
  }
252
- supports(input) {
253
- return !!input.peek && input.peek.length >= 8;
253
+ async supports(input) {
254
+ return !!input.peek && input.peek.length >= 8 ? { action: "ALLOW" } : {
255
+ action: "DENY",
256
+ code: "SENSOR_NOT_APPLICABLE",
257
+ reason: "Insufficient peek data to read headers"
258
+ };
254
259
  }
255
260
  async run(input) {
256
261
  const { peek } = input;
@@ -1571,6 +1576,7 @@ var init_cce_types = __esm({
1571
1576
  CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID",
1572
1577
  CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED",
1573
1578
  CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED",
1579
+ CAPSULE_NOT_VERIFIED: "CCE_CAPSULE_NOT_VERIFIED",
1574
1580
  // Binding errors
1575
1581
  AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH",
1576
1582
  INTENT_MISMATCH: "CCE_INTENT_MISMATCH",
@@ -8550,9 +8556,37 @@ var init_axis_sensor_chain_service = __esm({
8550
8556
  );
8551
8557
  }
8552
8558
  async evaluateSensors(sensors, input, baseDecision) {
8553
- const relevantSensors = sensors.filter(
8554
- (s) => !s.supports || s.supports(input)
8555
- );
8559
+ const relevantSensors = [];
8560
+ for (const sensor of sensors) {
8561
+ if (!sensor.supports) {
8562
+ relevantSensors.push(sensor);
8563
+ continue;
8564
+ }
8565
+ try {
8566
+ const supportsDecision = normalizeSensorDecision(
8567
+ await sensor.supports(input)
8568
+ );
8569
+ if (supportsDecision.allow) {
8570
+ relevantSensors.push(sensor);
8571
+ }
8572
+ } catch (error) {
8573
+ console.error(
8574
+ `[AXIS][SENSOR] ${sensor.name} supports() failed:`,
8575
+ error
8576
+ );
8577
+ const obs = input.metadata?.observation;
8578
+ if (obs) {
8579
+ recordSensor(obs, sensor.name, false, 100, 0, [
8580
+ `sensor_support_error:${sensor.name}`
8581
+ ]);
8582
+ }
8583
+ return {
8584
+ allow: false,
8585
+ riskScore: 100,
8586
+ reasons: [`sensor_support_error:${sensor.name}`]
8587
+ };
8588
+ }
8589
+ }
8556
8590
  const normalizedBase = baseDecision ? normalizeSensorDecision(baseDecision) : void 0;
8557
8591
  let riskScore = normalizedBase?.riskScore ?? 0;
8558
8592
  const reasons = normalizedBase?.reasons ? [...normalizedBase.reasons] : [];
@@ -10897,8 +10931,9 @@ var require_capability_enforcement_sensor = __commonJS({
10897
10931
  this.name = "CapabilityEnforcementSensor";
10898
10932
  this.order = sensor_bands_1.BAND.POLICY + 10;
10899
10933
  }
10900
- supports(input) {
10901
- return !!input.intent;
10934
+ async supports(input) {
10935
+ void input;
10936
+ return { action: "ALLOW" };
10902
10937
  }
10903
10938
  async run(input) {
10904
10939
  const { intent, packet } = input;
@@ -10964,8 +10999,12 @@ var require_chunk_hash_sensor = __commonJS({
10964
10999
  this.name = "ChunkHashSensor";
10965
11000
  this.order = sensor_bands_1.BAND.CONTENT + 50;
10966
11001
  }
10967
- supports(input) {
10968
- return input.intent === "file.chunk";
11002
+ async supports(input) {
11003
+ return input.intent === "file.chunk" ? { action: "ALLOW" } : {
11004
+ action: "DENY",
11005
+ code: "SENSOR_NOT_APPLICABLE",
11006
+ reason: "Only file.chunk intent is supported"
11007
+ };
10969
11008
  }
10970
11009
  async run(input) {
10971
11010
  const headerTLVs = input.headerTLVs;
@@ -11155,8 +11194,8 @@ var require_execution_timeout_sensor = __commonJS({
11155
11194
  this.name = "ExecutionTimeoutSensor";
11156
11195
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11157
11196
  }
11158
- supports(input) {
11159
- return !!input.intent;
11197
+ async supports() {
11198
+ return Promise.resolve({ action: "ALLOW" });
11160
11199
  }
11161
11200
  async run(input) {
11162
11201
  const { intent, context } = input;
@@ -11209,8 +11248,12 @@ var require_frame_budget_sensor = __commonJS({
11209
11248
  this.name = "FrameBudgetSensor";
11210
11249
  this.order = sensor_bands_1.BAND.WIRE + 20;
11211
11250
  }
11212
- supports(input) {
11213
- return typeof input.contentLength === "number";
11251
+ async supports(input) {
11252
+ return typeof input.contentLength === "number" ? { action: "ALLOW" } : {
11253
+ action: "DENY",
11254
+ code: "SENSOR_NOT_APPLICABLE",
11255
+ reason: "Content-Length not available"
11256
+ };
11214
11257
  }
11215
11258
  async run(input) {
11216
11259
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11255,8 +11298,12 @@ var require_frame_header_sanity_sensor = __commonJS({
11255
11298
  this.name = "FrameHeaderSanitySensor";
11256
11299
  this.order = sensor_bands_1.BAND.WIRE + 30;
11257
11300
  }
11258
- supports(input) {
11259
- return !!input.peek && input.peek.length >= 7;
11301
+ async supports(input) {
11302
+ return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
11303
+ action: "DENY",
11304
+ code: "SENSOR_NOT_APPLICABLE",
11305
+ reason: "Insufficient peek data for header sanity checks"
11306
+ };
11260
11307
  }
11261
11308
  async run(input) {
11262
11309
  const peek = input.peek;
@@ -11322,8 +11369,12 @@ var require_header_tlv_limit_sensor = __commonJS({
11322
11369
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11323
11370
  this.MAX_TLVS = 64;
11324
11371
  }
11325
- supports(input) {
11326
- return !!input.headerTLVs || !!input.packet;
11372
+ async supports(input) {
11373
+ return !!input.headerTLVs || !!input.packet ? { action: "ALLOW" } : {
11374
+ action: "DENY",
11375
+ code: "SENSOR_NOT_APPLICABLE",
11376
+ reason: "Header TLV context is not available"
11377
+ };
11327
11378
  }
11328
11379
  async run(input) {
11329
11380
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11379,8 +11430,12 @@ var require_intent_allowlist_sensor = __commonJS({
11379
11430
  this.name = "IntentAllowlistSensor";
11380
11431
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11381
11432
  }
11382
- supports(input) {
11383
- return !!input.intent;
11433
+ async supports(input) {
11434
+ return !!input.intent ? { action: "ALLOW" } : {
11435
+ action: "DENY",
11436
+ code: "SENSOR_NOT_APPLICABLE",
11437
+ reason: "Intent is not available"
11438
+ };
11384
11439
  }
11385
11440
  async run(input) {
11386
11441
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11430,8 +11485,8 @@ var require_intent_registry_sensor = __commonJS({
11430
11485
  this.name = "IntentRegistrySensor";
11431
11486
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11432
11487
  }
11433
- supports(input) {
11434
- return !!input.intent;
11488
+ async supports() {
11489
+ return Promise.resolve({ action: "ALLOW" });
11435
11490
  }
11436
11491
  async run(input) {
11437
11492
  const intent = input.intent;
@@ -11480,8 +11535,12 @@ var require_law_evaluation_sensor = __commonJS({
11480
11535
  this.name = "LawEvaluationSensor";
11481
11536
  this.order = sensor_bands_1.BAND.POLICY + 5;
11482
11537
  }
11483
- supports(input) {
11484
- return !!this.options.evaluator && !!input.intent;
11538
+ async supports(input) {
11539
+ return !!this.options.evaluator && !!input.intent ? { action: "ALLOW" } : {
11540
+ action: "DENY",
11541
+ code: "SENSOR_NOT_APPLICABLE",
11542
+ reason: "Law evaluator or intent missing"
11543
+ };
11485
11544
  }
11486
11545
  async run(input) {
11487
11546
  const evaluator = this.options.evaluator;
@@ -11547,7 +11606,9 @@ var require_law_evaluation_sensor = __commonJS({
11547
11606
  return {
11548
11607
  action: "FLAG",
11549
11608
  scoreDelta: 25,
11550
- reasons: reasons.length > 0 ? reasons : ["Execution is conditionally permitted pending additional requirements"],
11609
+ reasons: reasons.length > 0 ? reasons : [
11610
+ "Execution is conditionally permitted pending additional requirements"
11611
+ ],
11551
11612
  meta: result
11552
11613
  };
11553
11614
  }
@@ -11938,8 +11999,11 @@ var require_proof_presence_sensor = __commonJS({
11938
11999
  this.name = "ProofPresenceSensor";
11939
12000
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
11940
12001
  }
11941
- supports(input) {
11942
- return !!input.profile && !!input.visibility;
12002
+ async supports(input) {
12003
+ if (!!input.profile && !!input.visibility) {
12004
+ return { action: "ALLOW" };
12005
+ }
12006
+ return { action: "DENY", code: "MISSING_REQUIRED_FIELDS" };
11943
12007
  }
11944
12008
  async run(input) {
11945
12009
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12233,8 +12297,8 @@ var require_receipt_policy_sensor = __commonJS({
12233
12297
  this.name = "ReceiptPolicySensor";
12234
12298
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12235
12299
  }
12236
- supports() {
12237
- return true;
12300
+ async supports() {
12301
+ return { action: "ALLOW" };
12238
12302
  }
12239
12303
  async run() {
12240
12304
  return { action: "ALLOW" };
@@ -12394,8 +12458,11 @@ var require_schema_validation_sensor = __commonJS({
12394
12458
  this.name = "SchemaValidationSensor";
12395
12459
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12396
12460
  }
12397
- supports(input) {
12398
- return !!input.metadata?.schema;
12461
+ async supports(input) {
12462
+ if (input.metadata?.schema) {
12463
+ return { action: "ALLOW" };
12464
+ }
12465
+ return { action: "DENY", code: "SCHEMA_NOT_CONFIGURED" };
12399
12466
  }
12400
12467
  async run(input) {
12401
12468
  const schema = input.metadata?.schema;
@@ -12520,8 +12587,8 @@ var require_stream_scope_sensor = __commonJS({
12520
12587
  this.name = "StreamScopeSensor";
12521
12588
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12522
12589
  }
12523
- supports() {
12524
- return true;
12590
+ async supports() {
12591
+ return { action: "ALLOW" };
12525
12592
  }
12526
12593
  async run() {
12527
12594
  return { action: "ALLOW" };
@@ -12559,8 +12626,12 @@ var require_tickauth_sensor = __commonJS({
12559
12626
  this.matchIntent = options.matchIntent ?? true;
12560
12627
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12561
12628
  }
12562
- supports(input) {
12563
- return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule);
12629
+ async supports(input) {
12630
+ return !!(input.metadata?.capsule || input.metadata?.tickauthCapsule || input.metadata?.cceEnvelope?.capsule) ? { action: "ALLOW" } : {
12631
+ action: "DENY",
12632
+ code: "SENSOR_NOT_APPLICABLE",
12633
+ reason: "TickAuth capsule not found"
12634
+ };
12564
12635
  }
12565
12636
  async run(input) {
12566
12637
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12666,8 +12737,12 @@ var require_tlv_parse_sensor = __commonJS({
12666
12737
  this.name = "TLVParseSensor";
12667
12738
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12668
12739
  }
12669
- supports(input) {
12670
- return !!input.packet;
12740
+ async supports(input) {
12741
+ return !!input.packet ? { action: "ALLOW" } : {
12742
+ action: "DENY",
12743
+ code: "SENSOR_NOT_APPLICABLE",
12744
+ reason: "Packet is not available"
12745
+ };
12671
12746
  }
12672
12747
  async run(input) {
12673
12748
  const packet = input.packet;
@@ -12799,9 +12874,13 @@ var require_tps_sensor = __commonJS({
12799
12874
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12800
12875
  this.resolver = options.resolver ?? parseINotation;
12801
12876
  }
12802
- supports(input) {
12877
+ async supports(input) {
12803
12878
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12804
- return typeof tps === "string" && tps.length > 0;
12879
+ return typeof tps === "string" && tps.length > 0 ? { action: "ALLOW" } : {
12880
+ action: "DENY",
12881
+ code: "SENSOR_NOT_APPLICABLE",
12882
+ reason: "TPS coordinate not available"
12883
+ };
12805
12884
  }
12806
12885
  async run(input) {
12807
12886
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12867,8 +12946,12 @@ var require_varint_hardening_sensor = __commonJS({
12867
12946
  this.order = sensor_bands_1.BAND.WIRE + 35;
12868
12947
  this.MAX_VARINT_BYTES = 5;
12869
12948
  }
12870
- supports(input) {
12871
- return !!input.peek && input.peek.length >= 7;
12949
+ async supports(input) {
12950
+ return !!input.peek && input.peek.length >= 7 ? { action: "ALLOW" } : {
12951
+ action: "DENY",
12952
+ code: "SENSOR_NOT_APPLICABLE",
12953
+ reason: "Insufficient peek data for varint hardening"
12954
+ };
12872
12955
  }
12873
12956
  async run(input) {
12874
12957
  const peek = input.peek;