@cadenza.io/core 3.17.1 → 3.18.0

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/index.mjs CHANGED
@@ -1490,17 +1490,24 @@ var SignalBroker = class _SignalBroker {
1490
1490
  squashId,
1491
1491
  debounce_default(() => {
1492
1492
  options.squash = false;
1493
- this.emit(signal, this.squashedContexts.get(squashId), options);
1493
+ this.emit(
1494
+ signal,
1495
+ options.mergeFunction ? options.mergeFunction(
1496
+ this.squashedContexts.get(squashId)[0],
1497
+ ...this.squashedContexts.get(squashId).slice(1)
1498
+ ) : merge_default(
1499
+ this.squashedContexts.get(squashId)[0],
1500
+ ...this.squashedContexts.get(squashId).slice(1)
1501
+ ),
1502
+ options
1503
+ );
1494
1504
  this.squashedEmitters.delete(squashId);
1495
1505
  this.squashedContexts.delete(squashId);
1496
1506
  }, delayMs ?? 300)
1497
1507
  );
1498
- this.squashedContexts.set(squashId, context);
1508
+ this.squashedContexts.set(squashId, [context]);
1499
1509
  } else {
1500
- this.squashedContexts.set(
1501
- squashId,
1502
- options.mergeFunction ? options.mergeFunction(this.squashedContexts.get(squashId), context) : merge_default(this.squashedContexts.get(squashId), context)
1503
- );
1510
+ this.squashedContexts.get(squashId)?.push(context);
1504
1511
  }
1505
1512
  this.squashedEmitters.get(squashId)();
1506
1513
  }
@@ -2078,7 +2085,7 @@ var SignalEmitter = class {
2078
2085
  * @param options
2079
2086
  */
2080
2087
  emit(signal, data = {}, options = {}) {
2081
- Cadenza.broker.emit(signal, data, options);
2088
+ Cadenza.signalBroker.emit(signal, data, options);
2082
2089
  }
2083
2090
  /**
2084
2091
  * Emits a signal via the broker if not silent.
@@ -2090,7 +2097,7 @@ var SignalEmitter = class {
2090
2097
  if (this.silent) {
2091
2098
  return;
2092
2099
  }
2093
- Cadenza.broker.emit(signal, data, options);
2100
+ Cadenza.signalBroker.emit(signal, data, options);
2094
2101
  }
2095
2102
  };
2096
2103
 
@@ -2402,7 +2409,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
2402
2409
  );
2403
2410
  if (this.graphDone()) {
2404
2411
  const context2 = this.context.getFullContext();
2405
- if (context2.__isDeputy)
2412
+ if (context2.__isDeputy || context2.__isInquiry)
2406
2413
  this.emitWithMetadata(
2407
2414
  `meta.node.graph_completed:${this.routineExecId}`,
2408
2415
  context2
@@ -2510,6 +2517,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
2510
2517
  const result = this.task.execute(
2511
2518
  this.context,
2512
2519
  this.emitWithMetadata.bind(this),
2520
+ this.inquire.bind(this),
2513
2521
  this.onProgress.bind(this),
2514
2522
  { nodeId: this.id, routineExecId: this.routineExecId }
2515
2523
  );
@@ -2528,6 +2536,13 @@ var GraphNode = class _GraphNode extends SignalEmitter {
2528
2536
  });
2529
2537
  }
2530
2538
  }
2539
+ inquire(inquiry, context, options) {
2540
+ return Cadenza.inquire(
2541
+ inquiry,
2542
+ { ...context, __executionTraceId: this.executionTraceId },
2543
+ options
2544
+ );
2545
+ }
2531
2546
  /**
2532
2547
  * Emits a signal along with its associated metadata. The metadata includes
2533
2548
  * task-specific information such as task name, version, execution ID, and
@@ -3156,8 +3171,7 @@ var GraphRoutine = class extends SignalEmitter {
3156
3171
  */
3157
3172
  doOn(...signals) {
3158
3173
  signals.forEach((signal) => {
3159
- if (this.observedSignals.has(signal)) return;
3160
- Cadenza.broker.observe(signal, this);
3174
+ this.tasks.forEach((task) => task.doOn(signal));
3161
3175
  this.observedSignals.add(signal);
3162
3176
  });
3163
3177
  return this;
@@ -3171,7 +3185,7 @@ var GraphRoutine = class extends SignalEmitter {
3171
3185
  */
3172
3186
  unsubscribeAll() {
3173
3187
  this.observedSignals.forEach(
3174
- (signal) => Cadenza.broker.unsubscribe(signal, this)
3188
+ (signal) => this.tasks.forEach((task) => task.unsubscribe(signal))
3175
3189
  );
3176
3190
  this.observedSignals.clear();
3177
3191
  return this;
@@ -3184,10 +3198,8 @@ var GraphRoutine = class extends SignalEmitter {
3184
3198
  */
3185
3199
  unsubscribe(...signals) {
3186
3200
  signals.forEach((signal) => {
3187
- if (this.observedSignals.has(signal)) {
3188
- Cadenza.broker.unsubscribe(signal, this);
3189
- this.observedSignals.delete(signal);
3190
- }
3201
+ this.tasks.forEach((task) => task.unsubscribe(signal));
3202
+ this.observedSignals.delete(signal);
3191
3203
  });
3192
3204
  return this;
3193
3205
  }
@@ -3472,7 +3484,8 @@ var Task = class _Task extends SignalEmitter {
3472
3484
  this.signalsToEmitAfter = /* @__PURE__ */ new Set();
3473
3485
  this.signalsToEmitOnFail = /* @__PURE__ */ new Set();
3474
3486
  this.observedSignals = /* @__PURE__ */ new Set();
3475
- this.intents = /* @__PURE__ */ new Set();
3487
+ this.handlesIntents = /* @__PURE__ */ new Set();
3488
+ this.inquiresIntents = /* @__PURE__ */ new Set();
3476
3489
  this.name = name;
3477
3490
  this.taskFunction = task;
3478
3491
  this.description = description;
@@ -3551,7 +3564,8 @@ var Task = class _Task extends SignalEmitter {
3551
3564
  observed: Array.from(this.observedSignals)
3552
3565
  },
3553
3566
  intents: {
3554
- handles: Array.from(this.intents)
3567
+ handles: Array.from(this.handlesIntents),
3568
+ inquires: Array.from(this.inquiresIntents)
3555
3569
  }
3556
3570
  },
3557
3571
  taskInstance: this,
@@ -3843,14 +3857,16 @@ var Task = class _Task extends SignalEmitter {
3843
3857
  *
3844
3858
  * @param {GraphContext} context The execution context which provides data and functions necessary for the task.
3845
3859
  * @param {function(string, AnyObject): void} emit A function to emit signals and communicate intermediate results or states.
3860
+ * @param {function(string, AnyObject, InquiryOptions): Promise<AnyObject>} inquire A function to inquire something from another task.
3846
3861
  * @param {function(number): void} progressCallback A callback function used to report task progress as a percentage (0 to 100).
3847
3862
  * @param {{ nodeId: string; routineExecId: string }} nodeData An object containing identifiers related to the node and execution routine.
3848
3863
  * @return {TaskResult} The result of the executed task.
3849
3864
  */
3850
- execute(context, emit, progressCallback, nodeData) {
3865
+ execute(context, emit, inquire, progressCallback, nodeData) {
3851
3866
  return this.taskFunction(
3852
3867
  this.isMeta ? context.getClonedFullContext() : context.getClonedContext(),
3853
3868
  emit,
3869
+ inquire,
3854
3870
  progressCallback
3855
3871
  );
3856
3872
  }
@@ -4060,7 +4076,7 @@ var Task = class _Task extends SignalEmitter {
4060
4076
  doOn(...signals) {
4061
4077
  signals.forEach((signal) => {
4062
4078
  if (this.observedSignals.has(signal)) return;
4063
- Cadenza.broker.observe(signal, this);
4079
+ Cadenza.signalBroker.observe(signal, this);
4064
4080
  this.observedSignals.add(signal);
4065
4081
  if (this.register) {
4066
4082
  this.emitWithMetadata("meta.task.observed_signal", {
@@ -4114,7 +4130,7 @@ var Task = class _Task extends SignalEmitter {
4114
4130
  attachSignal(...signals) {
4115
4131
  signals.forEach((signal) => {
4116
4132
  this.emitsSignals.add(signal);
4117
- Cadenza.broker.registerEmittedSignal(signal);
4133
+ Cadenza.signalBroker.registerEmittedSignal(signal);
4118
4134
  if (this.register) {
4119
4135
  const data = {
4120
4136
  signals: {
@@ -4146,7 +4162,7 @@ var Task = class _Task extends SignalEmitter {
4146
4162
  unsubscribe(...signals) {
4147
4163
  signals.forEach((signal) => {
4148
4164
  if (this.observedSignals.has(signal)) {
4149
- Cadenza.broker.unsubscribe(signal, this);
4165
+ Cadenza.signalBroker.unsubscribe(signal, this);
4150
4166
  this.observedSignals.delete(signal);
4151
4167
  if (this.register) {
4152
4168
  signal = signal.split(":")[0];
@@ -4206,8 +4222,30 @@ var Task = class _Task extends SignalEmitter {
4206
4222
  this.signalsToEmitAfter.clear();
4207
4223
  return this;
4208
4224
  }
4209
- handlesIntent(intent) {
4210
- this.intents.add(intent);
4225
+ respondsTo(...inquires) {
4226
+ for (const intentName of inquires) {
4227
+ this.handlesIntents.add(intentName);
4228
+ Cadenza.inquiryBroker.observe(intentName, this);
4229
+ const intent = Cadenza.inquiryBroker.intents.get(intentName);
4230
+ this.inputContextSchema = intent?.input;
4231
+ this.outputContextSchema = intent?.output;
4232
+ }
4233
+ return this;
4234
+ }
4235
+ attachIntents(...intentNames) {
4236
+ for (const intent of intentNames) {
4237
+ this.inquiresIntents.add(intent);
4238
+ }
4239
+ return this;
4240
+ }
4241
+ detachIntents(...intentNames) {
4242
+ for (const intent of intentNames) {
4243
+ this.inquiresIntents.delete(intent);
4244
+ }
4245
+ return this;
4246
+ }
4247
+ detachAllIntents() {
4248
+ this.inquiresIntents.clear();
4211
4249
  return this;
4212
4250
  }
4213
4251
  /**
@@ -4544,6 +4582,7 @@ var DebounceTask = class extends Task {
4544
4582
  this.lastTimeout = null;
4545
4583
  this.lastProgressCallback = null;
4546
4584
  this.lastEmitFunction = null;
4585
+ this.lastInquireFunction = null;
4547
4586
  this.debounceTime = debounceTime;
4548
4587
  this.leading = leading;
4549
4588
  this.trailing = trailing;
@@ -4566,6 +4605,7 @@ var DebounceTask = class extends Task {
4566
4605
  result = this.taskFunction(
4567
4606
  this.lastContext.getClonedContext(),
4568
4607
  this.lastEmitFunction,
4608
+ this.lastInquireFunction,
4569
4609
  this.lastProgressCallback
4570
4610
  );
4571
4611
  } catch (error) {
@@ -4581,6 +4621,11 @@ var DebounceTask = class extends Task {
4581
4621
  this.lastResolve(result);
4582
4622
  }
4583
4623
  }
4624
+ this.lastContext = null;
4625
+ this.lastTimeout = null;
4626
+ this.lastProgressCallback = null;
4627
+ this.lastEmitFunction = null;
4628
+ this.lastInquireFunction = null;
4584
4629
  }
4585
4630
  /**
4586
4631
  * Executes a debounced operation, ensuring controlled execution of functions
@@ -4592,10 +4637,11 @@ var DebounceTask = class extends Task {
4592
4637
  * @param {GraphContext} context - The execution context for the operation.
4593
4638
  * @param {NodeJS.Timeout} timeout - A timeout object for managing execution delays.
4594
4639
  * @param {Function} emit - A callback function to emit signals with a specific context.
4640
+ * @param inquire
4595
4641
  * @param {Function} progressCallback - A callback function to report progress during operation execution.
4596
4642
  * @return {void} Does not return a value but sets internal timers and invokes provided callbacks.
4597
4643
  */
4598
- debouncedTrigger(resolve, reject, context, timeout, emit, progressCallback) {
4644
+ debouncedTrigger(resolve, reject, context, timeout, emit, inquire, progressCallback) {
4599
4645
  const callNow = this.leading && this.timer === null;
4600
4646
  const isNewBurst = this.timer === null;
4601
4647
  if (this.timer !== null) {
@@ -4608,6 +4654,7 @@ var DebounceTask = class extends Task {
4608
4654
  this.lastTimeout = timeout;
4609
4655
  this.lastProgressCallback = progressCallback;
4610
4656
  this.lastEmitFunction = emit;
4657
+ this.lastInquireFunction = inquire;
4611
4658
  if (!callNow) {
4612
4659
  this.hasLaterCall = true;
4613
4660
  }
@@ -4645,10 +4692,11 @@ var DebounceTask = class extends Task {
4645
4692
  *
4646
4693
  * @param {GraphContext} context - The context containing relevant graph data for the execution.
4647
4694
  * @param {function(string, any): void} emit - A function used to emit signals with associated context.
4695
+ * @param inquire
4648
4696
  * @param {function(number): void} progressCallback - A callback function to report the progress of the task as a number between 0 and 1.
4649
4697
  * @return {Promise<TaskResult>} A promise that resolves with the task result upon completion or rejects on failure.
4650
4698
  */
4651
- execute(context, emit, progressCallback) {
4699
+ execute(context, emit, inquire, progressCallback) {
4652
4700
  return new Promise((resolve, reject) => {
4653
4701
  const timeout = setTimeout(() => {
4654
4702
  resolve(false);
@@ -4659,6 +4707,7 @@ var DebounceTask = class extends Task {
4659
4707
  context,
4660
4708
  timeout,
4661
4709
  emit,
4710
+ inquire,
4662
4711
  progressCallback
4663
4712
  );
4664
4713
  });
@@ -4698,12 +4747,19 @@ var EphemeralTask = class extends Task {
4698
4747
  *
4699
4748
  * @param {any} context - The execution context, carrying necessary parameters or states for the operation.
4700
4749
  * @param {function(string, AnyObject): void} emit - A function to emit signals with a string identifier and associated context.
4750
+ * @param inquire
4701
4751
  * @param {function(number): void} progressCallback - A callback function to report the progress of the execution as a numerical value.
4702
4752
  * @param {{ nodeId: string, routineExecId: string }} nodeData - An object containing details about the node ID and routine execution ID.
4703
4753
  * @return {any} The result of the execution, returned from the base implementation or processed internally.
4704
4754
  */
4705
- execute(context, emit, progressCallback, nodeData) {
4706
- const result = super.execute(context, emit, progressCallback, nodeData);
4755
+ execute(context, emit, inquire, progressCallback, nodeData) {
4756
+ const result = super.execute(
4757
+ context,
4758
+ emit,
4759
+ inquire,
4760
+ progressCallback,
4761
+ nodeData
4762
+ );
4707
4763
  if (this.once || this.condition(result)) {
4708
4764
  this.destroy();
4709
4765
  }
@@ -5450,6 +5506,187 @@ var GraphStandardRun = class extends GraphRunStrategy {
5450
5506
  }
5451
5507
  };
5452
5508
 
5509
+ // src/engine/InquiryBroker.ts
5510
+ import { v4 as uuid7 } from "uuid";
5511
+ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5512
+ constructor() {
5513
+ super(...arguments);
5514
+ this.debug = false;
5515
+ this.verbose = false;
5516
+ this.inquiryObservers = /* @__PURE__ */ new Map();
5517
+ this.intents = /* @__PURE__ */ new Map();
5518
+ }
5519
+ static get instance() {
5520
+ if (!this.instance_) {
5521
+ this.instance_ = new _InquiryBroker();
5522
+ }
5523
+ return this.instance_;
5524
+ }
5525
+ setDebug(value) {
5526
+ this.debug = value;
5527
+ }
5528
+ setVerbose(value) {
5529
+ this.verbose = value;
5530
+ }
5531
+ validateInquiryName(inquiryName) {
5532
+ if (inquiryName.length > 100) {
5533
+ throw new Error(
5534
+ `Inquiry name must be less than 100 characters: ${inquiryName}`
5535
+ );
5536
+ }
5537
+ if (inquiryName.includes(" ")) {
5538
+ throw new Error(`Inquiry name must not contain spaces: ${inquiryName}"`);
5539
+ }
5540
+ if (inquiryName.includes("\\")) {
5541
+ throw new Error(
5542
+ `Inquiry name must not contain backslashes: ${inquiryName}`
5543
+ );
5544
+ }
5545
+ if (inquiryName.includes(".")) {
5546
+ throw new Error(`Inquiry name must not contain dots: ${inquiryName}`);
5547
+ }
5548
+ }
5549
+ /**
5550
+ * Initializes with runners.
5551
+ * @param runner Standard runner for user signals.
5552
+ * @param metaRunner Meta runner for 'meta.' signals (suppresses further meta-emits).
5553
+ */
5554
+ bootstrap(runner, metaRunner) {
5555
+ this.runner = runner;
5556
+ this.metaRunner = metaRunner;
5557
+ }
5558
+ init() {
5559
+ }
5560
+ /**
5561
+ * Observes an inquiry with a routine/task.
5562
+ * @param inquiry The inquiry (e.g., 'domain.action', 'domain.*' for wildcards).
5563
+ * @param task The observer.
5564
+ * @edge Duplicates ignored; supports wildcards for broad listening.
5565
+ */
5566
+ observe(inquiry, task) {
5567
+ this.addInquiry(inquiry);
5568
+ this.inquiryObservers.get(inquiry).tasks.add(task);
5569
+ }
5570
+ /**
5571
+ * Unsubscribes a routine/task from an inquiry.
5572
+ * @param inquiry The inquiry.
5573
+ * @param task The observer.
5574
+ * @edge Removes all instances if duplicate; deletes if empty.
5575
+ */
5576
+ unsubscribe(inquiry, task) {
5577
+ const obs = this.inquiryObservers.get(inquiry);
5578
+ if (obs) {
5579
+ obs.tasks.delete(task);
5580
+ if (obs.tasks.size === 0) {
5581
+ this.inquiryObservers.delete(inquiry);
5582
+ }
5583
+ }
5584
+ }
5585
+ addInquiry(inquiry) {
5586
+ if (!this.inquiryObservers.has(inquiry)) {
5587
+ this.validateInquiryName(inquiry);
5588
+ this.inquiryObservers.set(inquiry, {
5589
+ fn: (runner, tasks, context) => runner.run(tasks, context),
5590
+ tasks: /* @__PURE__ */ new Set(),
5591
+ registered: false
5592
+ });
5593
+ this.addIntent({
5594
+ name: inquiry,
5595
+ description: "",
5596
+ input: void 0,
5597
+ output: void 0
5598
+ });
5599
+ this.emit("meta.inquiry_broker.added", { inquiryName: inquiry });
5600
+ }
5601
+ }
5602
+ addIntent(intent) {
5603
+ if (!this.intents.has(intent.name)) {
5604
+ this.validateInquiryName(intent.name);
5605
+ this.intents.set(intent.name, intent);
5606
+ } else {
5607
+ const currentIntent = this.intents.get(intent.name);
5608
+ if (currentIntent.description !== intent.description) {
5609
+ currentIntent.description = intent.description;
5610
+ }
5611
+ if (intent.input && currentIntent.input !== intent.input) {
5612
+ currentIntent.input = intent.input;
5613
+ }
5614
+ if (intent.output && currentIntent.output !== intent.output) {
5615
+ currentIntent.output = intent.output;
5616
+ }
5617
+ if (this.inquiryObservers.has(intent.name)) {
5618
+ for (const task of this.inquiryObservers.get(intent.name).tasks) {
5619
+ task.respondsTo(intent.name);
5620
+ }
5621
+ }
5622
+ }
5623
+ }
5624
+ inquire(inquiry, context, options = {
5625
+ timeout: 0
5626
+ }) {
5627
+ const tasks = this.inquiryObservers.get(inquiry)?.tasks;
5628
+ if (!tasks) {
5629
+ return Promise.resolve({});
5630
+ }
5631
+ return new Promise((resolve) => {
5632
+ let joinedContext = {};
5633
+ const pendingTasks = Array.from(tasks).map((task) => task.name);
5634
+ const resolveTasks = [];
5635
+ let timeoutId;
5636
+ if (options.timeout > 0) {
5637
+ timeoutId = setTimeout(() => {
5638
+ for (const resolveTask of resolveTasks) {
5639
+ resolveTask.destroy();
5640
+ }
5641
+ resolve({
5642
+ __error: "Inquire timeout",
5643
+ errored: true,
5644
+ pendingTasks,
5645
+ ...joinedContext
5646
+ });
5647
+ }, options.timeout);
5648
+ }
5649
+ for (const task of tasks) {
5650
+ const inquiryId = uuid7();
5651
+ resolveTasks.push(
5652
+ Cadenza.createEphemeralMetaTask(
5653
+ `Resolve inquiry for ${inquiry}`,
5654
+ (ctx) => {
5655
+ joinedContext = { ...joinedContext, ...ctx };
5656
+ pendingTasks.splice(pendingTasks.indexOf(task.name), 1);
5657
+ if (pendingTasks.length === 0) {
5658
+ resolve(joinedContext);
5659
+ }
5660
+ if (timeoutId) {
5661
+ clearTimeout(timeoutId);
5662
+ timeoutId = void 0;
5663
+ }
5664
+ },
5665
+ "",
5666
+ {
5667
+ once: true,
5668
+ register: false
5669
+ }
5670
+ ).doOn(`meta.node.graph_completed:${inquiryId}`)
5671
+ );
5672
+ if (task.isMeta) {
5673
+ this.metaRunner?.run(task, {
5674
+ ...context,
5675
+ __routineExecId: inquiryId,
5676
+ __isInquiry: true
5677
+ });
5678
+ } else {
5679
+ this.runner?.run(task, {
5680
+ ...context,
5681
+ __routineExecId: inquiryId,
5682
+ __isInquiry: true
5683
+ });
5684
+ }
5685
+ }
5686
+ });
5687
+ }
5688
+ };
5689
+
5453
5690
  // src/Cadenza.ts
5454
5691
  var Cadenza = class {
5455
5692
  /**
@@ -5462,17 +5699,21 @@ var Cadenza = class {
5462
5699
  static bootstrap() {
5463
5700
  if (this.isBootstrapped) return;
5464
5701
  this.isBootstrapped = true;
5465
- this.broker = SignalBroker.instance;
5702
+ this.signalBroker = SignalBroker.instance;
5703
+ this.inquiryBroker = InquiryBroker.instance;
5466
5704
  this.runner = new GraphRunner();
5467
5705
  this.metaRunner = new GraphRunner(true);
5468
- this.broker.bootstrap(this.runner, this.metaRunner);
5706
+ this.signalBroker.bootstrap(this.runner, this.metaRunner);
5707
+ this.inquiryBroker.bootstrap(this.runner, this.metaRunner);
5469
5708
  if (this.mode === "debug" || this.mode === "dev") {
5470
- this.broker.setDebug(true);
5709
+ this.signalBroker.setDebug(true);
5710
+ this.inquiryBroker.setDebug(true);
5471
5711
  this.runner.setDebug(true);
5472
5712
  this.metaRunner.setDebug(true);
5473
5713
  }
5474
5714
  this.registry = GraphRegistry.instance;
5475
- this.broker.init();
5715
+ this.signalBroker.init();
5716
+ this.inquiryBroker.init();
5476
5717
  }
5477
5718
  /**
5478
5719
  * Retrieves the available strategies for running graphs.
@@ -5499,18 +5740,18 @@ var Cadenza = class {
5499
5740
  this.mode = mode;
5500
5741
  this.bootstrap();
5501
5742
  if (mode === "debug" || mode === "dev") {
5502
- this.broker.setDebug(true);
5743
+ this.signalBroker.setDebug(true);
5503
5744
  this.runner.setDebug(true);
5504
5745
  }
5505
5746
  if (mode === "verbose") {
5506
- this.broker.setDebug(true);
5507
- this.broker.setVerbose(true);
5747
+ this.signalBroker.setDebug(true);
5748
+ this.signalBroker.setVerbose(true);
5508
5749
  this.runner.setDebug(true);
5509
5750
  this.runner.setVerbose(true);
5510
5751
  }
5511
5752
  if (mode === "production") {
5512
- this.broker.setDebug(false);
5513
- this.broker.setVerbose(false);
5753
+ this.signalBroker.setDebug(false);
5754
+ this.signalBroker.setVerbose(false);
5514
5755
  this.runner.setDebug(false);
5515
5756
  this.runner.setVerbose(false);
5516
5757
  }
@@ -5567,13 +5808,13 @@ var Cadenza = class {
5567
5808
  * ```
5568
5809
  */
5569
5810
  static emit(event, data = {}, options = {}) {
5570
- this.broker?.emit(event, data, options);
5811
+ this.signalBroker?.emit(event, data, options);
5571
5812
  }
5572
5813
  static schedule(taskName, context, delayMs, exactDateTime) {
5573
- this.broker?.schedule(taskName, context, { delayMs, exactDateTime });
5814
+ this.signalBroker?.schedule(taskName, context, { delayMs, exactDateTime });
5574
5815
  }
5575
5816
  static interval(taskName, context, intervalMs, leading = false, startDateTime) {
5576
- this.broker?.interval(
5817
+ this.signalBroker?.interval(
5577
5818
  taskName,
5578
5819
  context,
5579
5820
  intervalMs,
@@ -5582,7 +5823,7 @@ var Cadenza = class {
5582
5823
  );
5583
5824
  }
5584
5825
  static debounce(signalName, context, delayMs) {
5585
- this.broker?.debounce(signalName, context, { delayMs });
5826
+ this.signalBroker?.debounce(signalName, context, { delayMs });
5586
5827
  }
5587
5828
  static get(taskName) {
5588
5829
  return this.registry?.tasks.get(taskName);
@@ -5590,6 +5831,13 @@ var Cadenza = class {
5590
5831
  static getRoutine(routineName) {
5591
5832
  return this.registry?.routines.get(routineName);
5592
5833
  }
5834
+ static defineIntent(intent) {
5835
+ this.inquiryBroker?.intents.set(intent.name, intent);
5836
+ return intent;
5837
+ }
5838
+ static async inquire(inquiry, context, options) {
5839
+ return this.inquiryBroker?.inquire(inquiry, context, options);
5840
+ }
5593
5841
  /**
5594
5842
  * Creates and registers a new task with the specified parameters and options.
5595
5843
  * Tasks are the basic building blocks of Cadenza graphs and are responsible for executing logic.
@@ -6118,7 +6366,7 @@ var Cadenza = class {
6118
6366
  return new GraphRoutine(name, tasks, description, true);
6119
6367
  }
6120
6368
  static reset() {
6121
- this.broker?.reset();
6369
+ this.signalBroker?.reset();
6122
6370
  this.registry?.reset();
6123
6371
  this.isBootstrapped = false;
6124
6372
  }
@@ -6126,14 +6374,6 @@ var Cadenza = class {
6126
6374
  Cadenza.isBootstrapped = false;
6127
6375
  Cadenza.mode = "production";
6128
6376
 
6129
- // src/graph/definition/SignalTask.ts
6130
- var SignalTask = class extends Task {
6131
- constructor(signal, description = "") {
6132
- super(signal, () => true, description);
6133
- this.signalsToEmitAfter.add(signal);
6134
- }
6135
- };
6136
-
6137
6377
  // src/index.ts
6138
6378
  var index_default = Cadenza;
6139
6379
  export {
@@ -6146,7 +6386,6 @@ export {
6146
6386
  GraphRunner,
6147
6387
  SignalBroker,
6148
6388
  SignalEmitter,
6149
- SignalTask,
6150
6389
  Task,
6151
6390
  index_default as default
6152
6391
  };