@nextera.one/axis-server-sdk 2.2.5 → 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",
@@ -3018,8 +3024,11 @@ var init_intent_router = __esm({
3018
3024
  return this.intentRateLimits.get(intent);
3019
3025
  }
3020
3026
  async emitIntentObservers(bindings, context) {
3021
- if (!this.observerDispatcher || bindings.length === 0) return;
3022
- await this.observerDispatcher.dispatch(bindings, context);
3027
+ if (!this.observerDispatcher) return;
3028
+ await this.observerDispatcher.dispatch(
3029
+ bindings.length > 0 ? bindings : void 0,
3030
+ context
3031
+ );
3023
3032
  }
3024
3033
  async runIntentSensors(sensorBindings, intent, frame, stage, extras) {
3025
3034
  for (const binding of sensorBindings) {
@@ -8547,9 +8556,37 @@ var init_axis_sensor_chain_service = __esm({
8547
8556
  );
8548
8557
  }
8549
8558
  async evaluateSensors(sensors, input, baseDecision) {
8550
- const relevantSensors = sensors.filter(
8551
- (s) => !s.supports || s.supports(input)
8552
- );
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
+ }
8553
8590
  const normalizedBase = baseDecision ? normalizeSensorDecision(baseDecision) : void 0;
8554
8591
  let riskScore = normalizedBase?.riskScore ?? 0;
8555
8592
  const reasons = normalizedBase?.reasons ? [...normalizedBase.reasons] : [];
@@ -10894,8 +10931,9 @@ var require_capability_enforcement_sensor = __commonJS({
10894
10931
  this.name = "CapabilityEnforcementSensor";
10895
10932
  this.order = sensor_bands_1.BAND.POLICY + 10;
10896
10933
  }
10897
- supports(input) {
10898
- return !!input.intent;
10934
+ async supports(input) {
10935
+ void input;
10936
+ return { action: "ALLOW" };
10899
10937
  }
10900
10938
  async run(input) {
10901
10939
  const { intent, packet } = input;
@@ -10961,8 +10999,12 @@ var require_chunk_hash_sensor = __commonJS({
10961
10999
  this.name = "ChunkHashSensor";
10962
11000
  this.order = sensor_bands_1.BAND.CONTENT + 50;
10963
11001
  }
10964
- supports(input) {
10965
- 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
+ };
10966
11008
  }
10967
11009
  async run(input) {
10968
11010
  const headerTLVs = input.headerTLVs;
@@ -11152,8 +11194,8 @@ var require_execution_timeout_sensor = __commonJS({
11152
11194
  this.name = "ExecutionTimeoutSensor";
11153
11195
  this.order = sensor_bands_1.BAND.BUSINESS + 10;
11154
11196
  }
11155
- supports(input) {
11156
- return !!input.intent;
11197
+ async supports() {
11198
+ return Promise.resolve({ action: "ALLOW" });
11157
11199
  }
11158
11200
  async run(input) {
11159
11201
  const { intent, context } = input;
@@ -11206,8 +11248,12 @@ var require_frame_budget_sensor = __commonJS({
11206
11248
  this.name = "FrameBudgetSensor";
11207
11249
  this.order = sensor_bands_1.BAND.WIRE + 20;
11208
11250
  }
11209
- supports(input) {
11210
- 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
+ };
11211
11257
  }
11212
11258
  async run(input) {
11213
11259
  const maxBytes = Number(process.env["AXIS_MAX_FRAME_SIZE"]) || 50 * 1024 * 1024;
@@ -11252,8 +11298,12 @@ var require_frame_header_sanity_sensor = __commonJS({
11252
11298
  this.name = "FrameHeaderSanitySensor";
11253
11299
  this.order = sensor_bands_1.BAND.WIRE + 30;
11254
11300
  }
11255
- supports(input) {
11256
- 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
+ };
11257
11307
  }
11258
11308
  async run(input) {
11259
11309
  const peek = input.peek;
@@ -11319,8 +11369,12 @@ var require_header_tlv_limit_sensor = __commonJS({
11319
11369
  this.order = sensor_bands_1.BAND.CONTENT + 0;
11320
11370
  this.MAX_TLVS = 64;
11321
11371
  }
11322
- supports(input) {
11323
- 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
+ };
11324
11378
  }
11325
11379
  async run(input) {
11326
11380
  if (input.headerTLVs && input.headerTLVs.size > this.MAX_TLVS) {
@@ -11376,8 +11430,12 @@ var require_intent_allowlist_sensor = __commonJS({
11376
11430
  this.name = "IntentAllowlistSensor";
11377
11431
  this.order = sensor_bands_1.BAND.IDENTITY + 20;
11378
11432
  }
11379
- supports(input) {
11380
- 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
+ };
11381
11439
  }
11382
11440
  async run(input) {
11383
11441
  const profile = input.metadata?.profile || "PUBLIC";
@@ -11427,8 +11485,8 @@ var require_intent_registry_sensor = __commonJS({
11427
11485
  this.name = "IntentRegistrySensor";
11428
11486
  this.order = sensor_bands_1.BAND.IDENTITY + 25;
11429
11487
  }
11430
- supports(input) {
11431
- return !!input.intent;
11488
+ async supports() {
11489
+ return Promise.resolve({ action: "ALLOW" });
11432
11490
  }
11433
11491
  async run(input) {
11434
11492
  const intent = input.intent;
@@ -11477,8 +11535,12 @@ var require_law_evaluation_sensor = __commonJS({
11477
11535
  this.name = "LawEvaluationSensor";
11478
11536
  this.order = sensor_bands_1.BAND.POLICY + 5;
11479
11537
  }
11480
- supports(input) {
11481
- 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
+ };
11482
11544
  }
11483
11545
  async run(input) {
11484
11546
  const evaluator = this.options.evaluator;
@@ -11544,7 +11606,9 @@ var require_law_evaluation_sensor = __commonJS({
11544
11606
  return {
11545
11607
  action: "FLAG",
11546
11608
  scoreDelta: 25,
11547
- 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
+ ],
11548
11612
  meta: result
11549
11613
  };
11550
11614
  }
@@ -11935,8 +11999,11 @@ var require_proof_presence_sensor = __commonJS({
11935
11999
  this.name = "ProofPresenceSensor";
11936
12000
  this.order = sensor_bands_1.BAND.IDENTITY + 30;
11937
12001
  }
11938
- supports(input) {
11939
- 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" };
11940
12007
  }
11941
12008
  async run(input) {
11942
12009
  const validatedInput = axis_schemas_1.ProofPresenceInputZ.safeParse(input);
@@ -12230,8 +12297,8 @@ var require_receipt_policy_sensor = __commonJS({
12230
12297
  this.name = "ReceiptPolicySensor";
12231
12298
  this.order = sensor_bands_1.BAND.BUSINESS + 20;
12232
12299
  }
12233
- supports() {
12234
- return true;
12300
+ async supports() {
12301
+ return { action: "ALLOW" };
12235
12302
  }
12236
12303
  async run() {
12237
12304
  return { action: "ALLOW" };
@@ -12391,8 +12458,11 @@ var require_schema_validation_sensor = __commonJS({
12391
12458
  this.name = "SchemaValidationSensor";
12392
12459
  this.order = sensor_bands_1.BAND.CONTENT + 35;
12393
12460
  }
12394
- supports(input) {
12395
- 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" };
12396
12466
  }
12397
12467
  async run(input) {
12398
12468
  const schema = input.metadata?.schema;
@@ -12517,8 +12587,8 @@ var require_stream_scope_sensor = __commonJS({
12517
12587
  this.name = "StreamScopeSensor";
12518
12588
  this.order = sensor_bands_1.BAND.BUSINESS + 0;
12519
12589
  }
12520
- supports() {
12521
- return true;
12590
+ async supports() {
12591
+ return { action: "ALLOW" };
12522
12592
  }
12523
12593
  async run() {
12524
12594
  return { action: "ALLOW" };
@@ -12556,8 +12626,12 @@ var require_tickauth_sensor = __commonJS({
12556
12626
  this.matchIntent = options.matchIntent ?? true;
12557
12627
  this.acceptTypes = options.acceptTypes?.length ? new Set(options.acceptTypes) : null;
12558
12628
  }
12559
- supports(input) {
12560
- 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
+ };
12561
12635
  }
12562
12636
  async run(input) {
12563
12637
  const capsule = input.metadata?.capsule ?? input.metadata?.tickauthCapsule ?? input.metadata?.cceEnvelope?.capsule;
@@ -12663,8 +12737,12 @@ var require_tlv_parse_sensor = __commonJS({
12663
12737
  this.name = "TLVParseSensor";
12664
12738
  this.order = sensor_bands_1.BAND.CONTENT + 20;
12665
12739
  }
12666
- supports(input) {
12667
- 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
+ };
12668
12746
  }
12669
12747
  async run(input) {
12670
12748
  const packet = input.packet;
@@ -12796,9 +12874,13 @@ var require_tps_sensor = __commonJS({
12796
12874
  this.maxDriftMs = options.maxDriftMs ?? 3e4;
12797
12875
  this.resolver = options.resolver ?? parseINotation;
12798
12876
  }
12799
- supports(input) {
12877
+ async supports(input) {
12800
12878
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
12801
- 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
+ };
12802
12884
  }
12803
12885
  async run(input) {
12804
12886
  const tps = input.metadata?.tps_coordinate ?? input.metadata?.tps ?? input.packet?.tps;
@@ -12864,8 +12946,12 @@ var require_varint_hardening_sensor = __commonJS({
12864
12946
  this.order = sensor_bands_1.BAND.WIRE + 35;
12865
12947
  this.MAX_VARINT_BYTES = 5;
12866
12948
  }
12867
- supports(input) {
12868
- 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
+ };
12869
12955
  }
12870
12956
  async run(input) {
12871
12957
  const peek = input.peek;