@nextera.one/axis-server-sdk 2.2.3 → 2.2.5

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,4 +1,4 @@
1
- export { k as AccessProfileResolverSensor, R as BodyBudgetSensor, W as CapabilityEnforcementSensor, $ as ChunkHashSensor, a2 as EntropySensor, a4 as ExecutionTimeoutSensor, a6 as FrameBudgetSensor, a7 as FrameHeaderSanitySensor, a8 as HeaderTLVLimitSensor, ac as IntentAllowlistSensor, af as IntentRegistrySensor, ah as LawEvaluationSensor, an as ProofPresenceSensor, ao as ProtocolStrictSensor, aq as ReceiptPolicySensor, aw as RiskGateSensor, ax as RiskGateSensorOptions, az as RiskSignalCollector, aB as SchemaValidationSensor, aD as StreamScopeSensor, aE as TLVParseSensor, aH as TickAuthCapsuleRef, aI as TickAuthSensor, aJ as TickAuthSensorOptions, aK as TickAuthVerifier, aV as TpsSensor, aW as TpsSensorOptions, aX as VarintHardeningSensor } from '../index-B2G6cbRL.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-ldPtIocV.mjs';
2
2
  import '../axis-sensor-GBEI3Fab.mjs';
3
3
  import '../cce-pipeline-B-zUBHo3.mjs';
4
4
  import '@nextera.one/axis-protocol';
@@ -1,4 +1,4 @@
1
- export { k as AccessProfileResolverSensor, R as BodyBudgetSensor, W as CapabilityEnforcementSensor, $ as ChunkHashSensor, a2 as EntropySensor, a4 as ExecutionTimeoutSensor, a6 as FrameBudgetSensor, a7 as FrameHeaderSanitySensor, a8 as HeaderTLVLimitSensor, ac as IntentAllowlistSensor, af as IntentRegistrySensor, ah as LawEvaluationSensor, an as ProofPresenceSensor, ao as ProtocolStrictSensor, aq as ReceiptPolicySensor, aw as RiskGateSensor, ax as RiskGateSensorOptions, az as RiskSignalCollector, aB as SchemaValidationSensor, aD as StreamScopeSensor, aE as TLVParseSensor, aH as TickAuthCapsuleRef, aI as TickAuthSensor, aJ as TickAuthSensorOptions, aK as TickAuthVerifier, aV as TpsSensor, aW as TpsSensorOptions, aX as VarintHardeningSensor } from '../index-DbSxdR0f.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-CwXlBXJf.js';
2
2
  import '../axis-sensor-GBEI3Fab.js';
3
3
  import '../cce-pipeline-DbGBSsCG.js';
4
4
  import '@nextera.one/axis-protocol';
@@ -525,17 +525,76 @@ var init_intent_policy_decorator = __esm({
525
525
  }
526
526
  });
527
527
 
528
- // src/decorators/handler.decorator.ts
529
- function Handler(intent) {
528
+ // src/decorators/handler-sensors.decorator.ts
529
+ function HandlerSensors(sensors) {
530
530
  return (target) => {
531
- Reflect.defineMetadata(HANDLER_METADATA_KEY, { intent }, target);
531
+ Reflect.defineMetadata(HANDLER_SENSORS_KEY, sensors, target);
532
532
  };
533
533
  }
534
- var import_reflect_metadata5, HANDLER_METADATA_KEY;
535
- var init_handler_decorator = __esm({
536
- "src/decorators/handler.decorator.ts"() {
534
+ var import_reflect_metadata5, HANDLER_SENSORS_KEY;
535
+ var init_handler_sensors_decorator = __esm({
536
+ "src/decorators/handler-sensors.decorator.ts"() {
537
537
  import_reflect_metadata5 = require("reflect-metadata");
538
- HANDLER_METADATA_KEY = "axis:handler";
538
+ HANDLER_SENSORS_KEY = "axis:handler:sensors";
539
+ }
540
+ });
541
+
542
+ // src/decorators/observer.decorator.ts
543
+ function isBindingOptions(value) {
544
+ return !!value && typeof value === "object" && "use" in value;
545
+ }
546
+ function isDefinitionOptions(value) {
547
+ return !!value && typeof value === "object" && !Array.isArray(value) && !isBindingOptions(value);
548
+ }
549
+ function toObserverBinding(input) {
550
+ if (!input) return null;
551
+ if (isBindingOptions(input)) {
552
+ const refs = Array.isArray(input.use) ? input.use : [input.use];
553
+ return { refs, tags: input.tags, events: input.events };
554
+ }
555
+ if (Array.isArray(input)) {
556
+ return { refs: input };
557
+ }
558
+ if (typeof input === "function" || typeof input === "string") {
559
+ return { refs: [input] };
560
+ }
561
+ return null;
562
+ }
563
+ function Observer(input) {
564
+ return ((target, propertyKey) => {
565
+ const binding = toObserverBinding(input);
566
+ if (binding) {
567
+ if (propertyKey !== void 0) {
568
+ const existing2 = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target, propertyKey) || [];
569
+ existing2.push(binding);
570
+ Reflect.defineMetadata(
571
+ OBSERVER_BINDINGS_KEY,
572
+ existing2,
573
+ target,
574
+ propertyKey
575
+ );
576
+ return;
577
+ }
578
+ const existing = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target) || [];
579
+ existing.push(binding);
580
+ Reflect.defineMetadata(OBSERVER_BINDINGS_KEY, existing, target);
581
+ return;
582
+ }
583
+ if (propertyKey !== void 0) {
584
+ throw new Error(
585
+ "@Observer method usage must reference one or more observer classes or names"
586
+ );
587
+ }
588
+ const definition = isDefinitionOptions(input) ? input : {};
589
+ Reflect.defineMetadata(OBSERVER_METADATA_KEY, definition, target);
590
+ });
591
+ }
592
+ var import_reflect_metadata6, OBSERVER_METADATA_KEY, OBSERVER_BINDINGS_KEY;
593
+ var init_observer_decorator = __esm({
594
+ "src/decorators/observer.decorator.ts"() {
595
+ import_reflect_metadata6 = require("reflect-metadata");
596
+ OBSERVER_METADATA_KEY = "axis:observer";
597
+ OBSERVER_BINDINGS_KEY = "axis:observer:bindings";
539
598
  }
540
599
  });
541
600
 
@@ -545,15 +604,30 @@ function IntentBody(decoder) {
545
604
  Reflect.defineMetadata(INTENT_BODY_KEY, decoder, target, propertyKey);
546
605
  };
547
606
  }
548
- var import_reflect_metadata6, INTENT_BODY_KEY;
607
+ var import_reflect_metadata7, INTENT_BODY_KEY;
549
608
  var init_intent_body_decorator = __esm({
550
609
  "src/decorators/intent-body.decorator.ts"() {
551
- import_reflect_metadata6 = require("reflect-metadata");
610
+ import_reflect_metadata7 = require("reflect-metadata");
552
611
  INTENT_BODY_KEY = "axis:intent:body";
553
612
  }
554
613
  });
555
614
 
556
615
  // src/decorators/intent.decorator.ts
616
+ function isIntentSensorBindingOptions(value) {
617
+ return !!value && typeof value === "object" && !Array.isArray(value) && "use" in value;
618
+ }
619
+ function toIntentSensorBinding(input) {
620
+ if (isIntentSensorBindingOptions(input)) {
621
+ return {
622
+ ref: input.use,
623
+ when: input.when || "before"
624
+ };
625
+ }
626
+ return {
627
+ ref: input,
628
+ when: "before"
629
+ };
630
+ }
557
631
  function Intent(action, options) {
558
632
  return (target, propertyKey) => {
559
633
  const metadata = { intent: action, ...options };
@@ -591,10 +665,10 @@ function Intent(action, options) {
591
665
  Reflect.defineMetadata(INTENT_ROUTES_KEY, routes, target.constructor);
592
666
  };
593
667
  }
594
- var import_reflect_metadata7, INTENT_METADATA_KEY, INTENT_ROUTES_KEY;
668
+ var import_reflect_metadata8, INTENT_METADATA_KEY, INTENT_ROUTES_KEY;
595
669
  var init_intent_decorator = __esm({
596
670
  "src/decorators/intent.decorator.ts"() {
597
- import_reflect_metadata7 = require("reflect-metadata");
671
+ import_reflect_metadata8 = require("reflect-metadata");
598
672
  init_intent_body_decorator();
599
673
  init_intent_policy_decorator();
600
674
  INTENT_METADATA_KEY = "axis:intent";
@@ -602,90 +676,62 @@ var init_intent_decorator = __esm({
602
676
  }
603
677
  });
604
678
 
605
- // src/decorators/intent-sensors.decorator.ts
606
- function IntentSensors(sensors) {
607
- return (target, propertyKey) => {
608
- Reflect.defineMetadata(INTENT_SENSORS_KEY, sensors, target, propertyKey);
609
- };
610
- }
611
- var import_reflect_metadata8, INTENT_SENSORS_KEY;
612
- var init_intent_sensors_decorator = __esm({
613
- "src/decorators/intent-sensors.decorator.ts"() {
614
- import_reflect_metadata8 = require("reflect-metadata");
615
- INTENT_SENSORS_KEY = "axis:intent:sensors";
616
- }
617
- });
618
-
619
- // src/decorators/observer.decorator.ts
620
- function isBindingOptions(value) {
621
- return !!value && typeof value === "object" && "use" in value;
622
- }
623
- function isDefinitionOptions(value) {
624
- return !!value && typeof value === "object" && !Array.isArray(value) && !isBindingOptions(value);
625
- }
626
- function toBinding(input) {
627
- if (!input) return null;
628
- if (isBindingOptions(input)) {
629
- const refs = Array.isArray(input.use) ? input.use : [input.use];
630
- return { refs, tags: input.tags, events: input.events };
631
- }
632
- if (Array.isArray(input)) {
633
- return { refs: input };
634
- }
635
- if (typeof input === "function" || typeof input === "string") {
636
- return { refs: [input] };
637
- }
638
- return null;
639
- }
640
- function Observer(input) {
641
- return ((target, propertyKey) => {
642
- const binding = toBinding(input);
643
- if (binding) {
644
- if (propertyKey !== void 0) {
645
- const existing2 = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target, propertyKey) || [];
646
- existing2.push(binding);
647
- Reflect.defineMetadata(
648
- OBSERVER_BINDINGS_KEY,
649
- existing2,
650
- target,
651
- propertyKey
652
- );
653
- return;
654
- }
655
- const existing = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target) || [];
656
- existing.push(binding);
657
- Reflect.defineMetadata(OBSERVER_BINDINGS_KEY, existing, target);
658
- return;
679
+ // src/decorators/handler.decorator.ts
680
+ function Handler(intentOrOptions, options) {
681
+ return (target) => {
682
+ const intent = typeof intentOrOptions === "string" ? intentOrOptions : void 0;
683
+ const handlerOptions = typeof intentOrOptions === "string" ? options : intentOrOptions;
684
+ const sensorBindings = Array.isArray(handlerOptions?.is) ? handlerOptions.is.map(
685
+ (input) => toIntentSensorBinding(input)
686
+ ) : [];
687
+ const observerBindings = Array.isArray(
688
+ handlerOptions?.observe
689
+ ) ? handlerOptions.observe.map((input) => toObserverBinding(input)).filter((binding) => !!binding) : [];
690
+ Reflect.defineMetadata(
691
+ HANDLER_METADATA_KEY,
692
+ { intent, ...handlerOptions || {} },
693
+ target
694
+ );
695
+ if (sensorBindings.length > 0) {
696
+ const existing = Reflect.getMetadata(HANDLER_SENSORS_KEY, target) || [];
697
+ Reflect.defineMetadata(
698
+ HANDLER_SENSORS_KEY,
699
+ [...existing, ...sensorBindings],
700
+ target
701
+ );
659
702
  }
660
- if (propertyKey !== void 0) {
661
- throw new Error(
662
- "@Observer method usage must reference one or more observer classes or names"
703
+ if (observerBindings.length > 0) {
704
+ const existing = Reflect.getMetadata(OBSERVER_BINDINGS_KEY, target) || [];
705
+ Reflect.defineMetadata(
706
+ OBSERVER_BINDINGS_KEY,
707
+ [...existing, ...observerBindings],
708
+ target
663
709
  );
664
710
  }
665
- const definition = isDefinitionOptions(input) ? input : {};
666
- Reflect.defineMetadata(OBSERVER_METADATA_KEY, definition, target);
667
- });
711
+ };
668
712
  }
669
- var import_reflect_metadata9, OBSERVER_METADATA_KEY, OBSERVER_BINDINGS_KEY;
670
- var init_observer_decorator = __esm({
671
- "src/decorators/observer.decorator.ts"() {
713
+ var import_reflect_metadata9, HANDLER_METADATA_KEY;
714
+ var init_handler_decorator = __esm({
715
+ "src/decorators/handler.decorator.ts"() {
672
716
  import_reflect_metadata9 = require("reflect-metadata");
673
- OBSERVER_METADATA_KEY = "axis:observer";
674
- OBSERVER_BINDINGS_KEY = "axis:observer:bindings";
717
+ init_handler_sensors_decorator();
718
+ init_observer_decorator();
719
+ init_intent_decorator();
720
+ HANDLER_METADATA_KEY = "axis:handler";
675
721
  }
676
722
  });
677
723
 
678
- // src/decorators/handler-sensors.decorator.ts
679
- function HandlerSensors(sensors) {
680
- return (target) => {
681
- Reflect.defineMetadata(HANDLER_SENSORS_KEY, sensors, target);
724
+ // src/decorators/intent-sensors.decorator.ts
725
+ function IntentSensors(sensors) {
726
+ return (target, propertyKey) => {
727
+ Reflect.defineMetadata(INTENT_SENSORS_KEY, sensors, target, propertyKey);
682
728
  };
683
729
  }
684
- var import_reflect_metadata10, HANDLER_SENSORS_KEY;
685
- var init_handler_sensors_decorator = __esm({
686
- "src/decorators/handler-sensors.decorator.ts"() {
730
+ var import_reflect_metadata10, INTENT_SENSORS_KEY;
731
+ var init_intent_sensors_decorator = __esm({
732
+ "src/decorators/intent-sensors.decorator.ts"() {
687
733
  import_reflect_metadata10 = require("reflect-metadata");
688
- HANDLER_SENSORS_KEY = "axis:handler:sensors";
734
+ INTENT_SENSORS_KEY = "axis:intent:sensors";
689
735
  }
690
736
  });
691
737
 
@@ -1175,6 +1221,7 @@ var init_axis_chain_executor = __esm({
1175
1221
  timestamp: startedAt,
1176
1222
  chainId: envelope.chainId,
1177
1223
  stepId: step.stepId,
1224
+ handler: step.handler,
1178
1225
  intent: step.intent,
1179
1226
  envelope,
1180
1227
  step,
@@ -1209,6 +1256,7 @@ var init_axis_chain_executor = __esm({
1209
1256
  timestamp: finishedAt,
1210
1257
  chainId: envelope.chainId,
1211
1258
  stepId: step.stepId,
1259
+ handler: step.handler,
1212
1260
  intent: step.intent,
1213
1261
  effect,
1214
1262
  envelope,
@@ -1223,6 +1271,7 @@ var init_axis_chain_executor = __esm({
1223
1271
  timestamp: finishedAt,
1224
1272
  chainId: envelope.chainId,
1225
1273
  stepId: step.stepId,
1274
+ handler: step.handler,
1226
1275
  intent: step.intent,
1227
1276
  envelope,
1228
1277
  step,
@@ -1237,6 +1286,7 @@ var init_axis_chain_executor = __esm({
1237
1286
  timestamp: finishedAt,
1238
1287
  chainId: envelope.chainId,
1239
1288
  stepId: step.stepId,
1289
+ handler: step.handler,
1240
1290
  intent: step.intent,
1241
1291
  effect,
1242
1292
  envelope,
@@ -1267,6 +1317,7 @@ var init_axis_chain_executor = __esm({
1267
1317
  timestamp: finishedAt,
1268
1318
  chainId: envelope.chainId,
1269
1319
  stepId: step.stepId,
1320
+ handler: step.handler,
1270
1321
  intent: step.intent,
1271
1322
  error: error.message,
1272
1323
  envelope,
@@ -2398,15 +2449,19 @@ function observerRefKey(ref) {
2398
2449
  function sensorRefKey(ref) {
2399
2450
  return typeof ref === "string" ? ref : ref.name;
2400
2451
  }
2401
- function mergeIntentSensorRefs(...sensorGroups) {
2452
+ function sensorBindingKey(binding) {
2453
+ return `${binding.when}:${sensorRefKey(binding.ref)}`;
2454
+ }
2455
+ function mergeIntentSensorBindings(...sensorGroups) {
2402
2456
  const merged = /* @__PURE__ */ new Map();
2403
2457
  for (const group of sensorGroups) {
2404
2458
  if (!Array.isArray(group)) continue;
2405
- for (const ref of group) {
2406
- const key = sensorRefKey(ref);
2459
+ for (const input of group) {
2460
+ const binding = toIntentSensorBinding(input);
2461
+ const key = sensorBindingKey(binding);
2407
2462
  const existing = merged.get(key);
2408
- if (!existing || typeof existing === "string" && typeof ref !== "string") {
2409
- merged.set(key, ref);
2463
+ if (!existing || typeof existing.ref === "string" && typeof binding.ref !== "string") {
2464
+ merged.set(key, binding);
2410
2465
  }
2411
2466
  }
2412
2467
  }
@@ -2482,6 +2537,8 @@ var init_intent_router = __esm({
2482
2537
  this.handlers = /* @__PURE__ */ new Map();
2483
2538
  /** Per-intent sensor refs (resolved through SensorRegistry at call time) */
2484
2539
  this.intentSensors = /* @__PURE__ */ new Map();
2540
+ /** Per-intent handler identifier (e.g. UsersHandler.usersPage) */
2541
+ this.intentHandlerRefs = /* @__PURE__ */ new Map();
2485
2542
  /** Per-intent body decoders */
2486
2543
  this.intentDecoders = /* @__PURE__ */ new Map();
2487
2544
  /** Per-intent TLV schemas */
@@ -2557,6 +2614,16 @@ var init_intent_router = __esm({
2557
2614
  */
2558
2615
  register(intent, handler) {
2559
2616
  this.handlers.set(intent, handler);
2617
+ if (typeof handler === "function" && handler.name) {
2618
+ this.intentHandlerRefs.set(intent, handler.name);
2619
+ } else if (handler && typeof handler === "object") {
2620
+ const objectName = handler.constructor?.name;
2621
+ if (objectName) {
2622
+ this.intentHandlerRefs.set(intent, `${objectName}.handle`);
2623
+ }
2624
+ } else {
2625
+ this.intentHandlerRefs.set(intent, `intent:${intent}`);
2626
+ }
2560
2627
  }
2561
2628
  /**
2562
2629
  * Automatically registers all `@Intent`-decorated methods from a handler instance.
@@ -2587,6 +2654,10 @@ var init_intent_router = __esm({
2587
2654
  } else {
2588
2655
  this.register(intentName, fn);
2589
2656
  }
2657
+ this.intentHandlerRefs.set(
2658
+ intentName,
2659
+ `${instance.constructor.name}.${String(route.methodName)}`
2660
+ );
2590
2661
  this.registerIntentMeta(
2591
2662
  intentName,
2592
2663
  proto,
@@ -2627,15 +2698,18 @@ var init_intent_router = __esm({
2627
2698
  async route(frame) {
2628
2699
  const start = process.hrtime();
2629
2700
  let intent = "unknown";
2701
+ let handlerRef;
2630
2702
  try {
2631
2703
  const intentBytes = frame.headers.get(import_axis_protocol.TLV_INTENT);
2632
2704
  if (!intentBytes) throw new Error("Missing intent");
2633
2705
  intent = this.decoder.decode(intentBytes);
2706
+ handlerRef = this.intentHandlerRefs.get(intent);
2634
2707
  const observerBindings = this.getObservers(intent);
2635
2708
  await this.emitIntentObservers(observerBindings, {
2636
2709
  event: "intent.received",
2637
2710
  timestamp: Date.now(),
2638
2711
  intent,
2712
+ handler: handlerRef,
2639
2713
  frame
2640
2714
  });
2641
2715
  let effect;
@@ -2710,9 +2784,9 @@ var init_intent_router = __esm({
2710
2784
  if (!handler) {
2711
2785
  throw new Error(`Intent not found: ${intent}`);
2712
2786
  }
2713
- const sensorRefs = this.intentSensors.get(intent);
2714
- if (sensorRefs && sensorRefs.length > 0) {
2715
- await this.runIntentSensors(sensorRefs, intent, frame);
2787
+ const sensorBindings = this.intentSensors.get(intent);
2788
+ if (sensorBindings && sensorBindings.length > 0) {
2789
+ await this.runIntentSensors(sensorBindings, intent, frame, "before");
2716
2790
  }
2717
2791
  const decoder = this.intentDecoders.get(intent);
2718
2792
  let decodedBody = frame.body;
@@ -2754,11 +2828,18 @@ var init_intent_router = __esm({
2754
2828
  );
2755
2829
  }
2756
2830
  }
2831
+ if (sensorBindings && sensorBindings.length > 0) {
2832
+ await this.runIntentSensors(sensorBindings, intent, frame, "after", {
2833
+ decodedBody,
2834
+ effect
2835
+ });
2836
+ }
2757
2837
  }
2758
2838
  await this.emitIntentObservers(observerBindings, {
2759
2839
  event: "intent.completed",
2760
2840
  timestamp: Date.now(),
2761
2841
  intent,
2842
+ handler: handlerRef,
2762
2843
  frame,
2763
2844
  effect,
2764
2845
  metadata: effect.metadata
@@ -2770,6 +2851,7 @@ var init_intent_router = __esm({
2770
2851
  event: "intent.failed",
2771
2852
  timestamp: Date.now(),
2772
2853
  intent,
2854
+ handler: handlerRef,
2773
2855
  frame,
2774
2856
  error: e.message
2775
2857
  });
@@ -2797,7 +2879,7 @@ var init_intent_router = __esm({
2797
2879
  methodName
2798
2880
  );
2799
2881
  const meta = Reflect.getMetadata(INTENT_METADATA_KEY, proto, methodName);
2800
- const combined = mergeIntentSensorRefs(
2882
+ const combined = mergeIntentSensorBindings(
2801
2883
  handlerSensors,
2802
2884
  Array.isArray(intentSensors) ? intentSensors : void 0,
2803
2885
  Array.isArray(meta?.is) ? meta.is : void 0
@@ -2939,8 +3021,10 @@ var init_intent_router = __esm({
2939
3021
  if (!this.observerDispatcher || bindings.length === 0) return;
2940
3022
  await this.observerDispatcher.dispatch(bindings, context);
2941
3023
  }
2942
- async runIntentSensors(sensorRefs, intent, frame) {
2943
- for (const sensorRef of sensorRefs) {
3024
+ async runIntentSensors(sensorBindings, intent, frame, stage, extras) {
3025
+ for (const binding of sensorBindings) {
3026
+ if (binding.when !== stage && binding.when !== "both") continue;
3027
+ const sensorRef = binding.ref;
2944
3028
  const sensor = this.resolveIntentSensor(sensorRef);
2945
3029
  const sensorName = sensorRefKey(sensorRef);
2946
3030
  if (!sensor) {
@@ -2957,9 +3041,12 @@ var init_intent_router = __esm({
2957
3041
  frameBody: frame.body,
2958
3042
  metadata: {
2959
3043
  phase: "intent",
3044
+ stage,
2960
3045
  intent,
2961
3046
  schema: this.getSchema(intent),
2962
- validators: this.getValidators(intent)
3047
+ validators: this.getValidators(intent),
3048
+ decodedBody: extras?.decodedBody,
3049
+ effect: extras?.effect
2963
3050
  }
2964
3051
  };
2965
3052
  if (sensor.supports && !sensor.supports(sensorInput)) continue;
@@ -8098,6 +8185,61 @@ var init_disk_upload_file_store = __esm({
8098
8185
  function unique(values) {
8099
8186
  return Array.from(new Set(values));
8100
8187
  }
8188
+ function matchesObserverIntent(intents, intent) {
8189
+ if (!intents || intents.length === 0) {
8190
+ return true;
8191
+ }
8192
+ if (!intent) {
8193
+ return false;
8194
+ }
8195
+ return intents.includes(intent);
8196
+ }
8197
+ function normalizeHandlerToken(value) {
8198
+ return value.trim().toLowerCase();
8199
+ }
8200
+ function matchesObserverHandler(handlers, handler) {
8201
+ if (!handlers || handlers.length === 0) {
8202
+ return true;
8203
+ }
8204
+ if (!handler) {
8205
+ return false;
8206
+ }
8207
+ const normalizedHandler = normalizeHandlerToken(handler);
8208
+ return handlers.some((candidate) => {
8209
+ if (!candidate) {
8210
+ return false;
8211
+ }
8212
+ const normalizedCandidate = normalizeHandlerToken(candidate);
8213
+ return normalizedHandler === normalizedCandidate || normalizedHandler.endsWith(`.${normalizedCandidate}`) || normalizedHandler.startsWith(`${normalizedCandidate}.`) || normalizedCandidate.endsWith(`.${normalizedHandler}`) || normalizedCandidate.startsWith(`${normalizedHandler}.`);
8214
+ });
8215
+ }
8216
+ function observerRefKey2(ref) {
8217
+ return typeof ref === "string" ? ref : ref.name || "(anonymous)";
8218
+ }
8219
+ function mergeBindingRefs(...bindingGroups) {
8220
+ const merged = /* @__PURE__ */ new Map();
8221
+ for (const bindings of bindingGroups) {
8222
+ for (const binding of bindings) {
8223
+ for (const ref of binding.refs) {
8224
+ const key = observerRefKey2(ref);
8225
+ const current = merged.get(key);
8226
+ if (!current) {
8227
+ merged.set(key, {
8228
+ refs: [ref],
8229
+ tags: binding.tags ? [...new Set(binding.tags)] : void 0,
8230
+ events: binding.events ? [...new Set(binding.events)] : void 0
8231
+ });
8232
+ continue;
8233
+ }
8234
+ current.tags = Array.from(
8235
+ /* @__PURE__ */ new Set([...current.tags || [], ...binding.tags || []])
8236
+ );
8237
+ current.events = current.events === void 0 || binding.events === void 0 ? void 0 : Array.from(/* @__PURE__ */ new Set([...current.events || [], ...binding.events]));
8238
+ }
8239
+ }
8240
+ }
8241
+ return Array.from(merged.values());
8242
+ }
8101
8243
  var ObserverDispatcherService;
8102
8244
  var init_observer_dispatcher_service = __esm({
8103
8245
  "src/engine/observer-dispatcher.service.ts"() {
@@ -8108,9 +8250,20 @@ var init_observer_dispatcher_service = __esm({
8108
8250
  this.logger = createAxisLogger(_ObserverDispatcherService.name);
8109
8251
  }
8110
8252
  async dispatch(bindings, context) {
8111
- if (!bindings || bindings.length === 0) return;
8253
+ const explicitBindings = bindings || [];
8254
+ const implicitRegistrations = this.getImplicitRegistrations();
8255
+ if (!explicitBindings.length && implicitRegistrations.length === 0) {
8256
+ return;
8257
+ }
8112
8258
  const invoked = /* @__PURE__ */ new Set();
8113
- for (const binding of bindings) {
8259
+ const implicitBindings = implicitRegistrations.map(
8260
+ (registration) => ({
8261
+ refs: [registration.instance.constructor],
8262
+ events: registration.events
8263
+ })
8264
+ );
8265
+ const merged = mergeBindingRefs(explicitBindings, implicitBindings);
8266
+ for (const binding of merged) {
8114
8267
  if (binding.events && binding.events.length > 0 && !binding.events.includes(context.event)) {
8115
8268
  continue;
8116
8269
  }
@@ -8121,6 +8274,9 @@ var init_observer_dispatcher_service = __esm({
8121
8274
  continue;
8122
8275
  }
8123
8276
  if (invoked.has(registration.name)) continue;
8277
+ if (!matchesObserverIntent(registration.intents, context.intent) || !matchesObserverHandler(registration.handlers, context.handler)) {
8278
+ continue;
8279
+ }
8124
8280
  if (registration.events && registration.events.length > 0 && !registration.events.includes(context.event)) {
8125
8281
  continue;
8126
8282
  }
@@ -8146,6 +8302,9 @@ var init_observer_dispatcher_service = __esm({
8146
8302
  }
8147
8303
  }
8148
8304
  }
8305
+ getImplicitRegistrations() {
8306
+ return this.registry.list();
8307
+ }
8149
8308
  };
8150
8309
  }
8151
8310
  });
@@ -10607,6 +10766,8 @@ __export(index_exports, {
10607
10766
  startStage: () => startStage,
10608
10767
  tieKnot: () => tieKnot,
10609
10768
  tlv: () => tlv,
10769
+ toIntentSensorBinding: () => toIntentSensorBinding,
10770
+ toObserverBinding: () => toObserverBinding,
10610
10771
  u64be: () => u64be,
10611
10772
  unpackPasskeyLoginOptionsReq: () => unpackPasskeyLoginOptionsReq,
10612
10773
  unpackPasskeyLoginVerifyReq: () => unpackPasskeyLoginVerifyReq,
@@ -10638,6 +10799,7 @@ var init_index = __esm({
10638
10799
  init_intent_body_decorator();
10639
10800
  init_intent_sensors_decorator();
10640
10801
  init_observer_decorator();
10802
+ init_observer_decorator();
10641
10803
  init_handler_sensors_decorator();
10642
10804
  init_sensor_decorator();
10643
10805
  import_tlv_field2 = __toESM(require_tlv_field_decorator());