@cadenza.io/core 3.18.0 → 3.18.2

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
@@ -3451,7 +3451,7 @@ var Task = class _Task extends SignalEmitter {
3451
3451
  * @param {number} [retryDelayMax=0] - The maximum delay (in milliseconds) allowed between retries.
3452
3452
  * @param {number} [retryDelayFactor=1] - The factor by which the retry delay increases after each attempt.
3453
3453
  */
3454
- constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, isSubMeta = false, isHidden = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
3454
+ constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, isSubMeta = false, isHidden = false, getTagCallback = void 0, inputSchema = { type: "object" }, validateInputContext = false, outputSchema = { type: "object" }, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
3455
3455
  super(isSubMeta || isHidden);
3456
3456
  this.version = 1;
3457
3457
  this.isMeta = false;
@@ -3463,9 +3463,9 @@ var Task = class _Task extends SignalEmitter {
3463
3463
  this.isDeputy = false;
3464
3464
  this.isEphemeral = false;
3465
3465
  this.isDebounce = false;
3466
- this.inputContextSchema = void 0;
3466
+ this.inputContextSchema = { type: "object" };
3467
3467
  this.validateInputContext = false;
3468
- this.outputContextSchema = void 0;
3468
+ this.outputContextSchema = { type: "object" };
3469
3469
  this.validateOutputContext = false;
3470
3470
  this.retryCount = 0;
3471
3471
  this.retryDelay = 0;
@@ -4227,8 +4227,12 @@ var Task = class _Task extends SignalEmitter {
4227
4227
  this.handlesIntents.add(intentName);
4228
4228
  Cadenza.inquiryBroker.observe(intentName, this);
4229
4229
  const intent = Cadenza.inquiryBroker.intents.get(intentName);
4230
- this.inputContextSchema = intent?.input;
4231
- this.outputContextSchema = intent?.output;
4230
+ if (intent?.input) {
4231
+ this.inputContextSchema = intent.input;
4232
+ }
4233
+ if (intent?.output) {
4234
+ this.outputContextSchema = intent.output;
4235
+ }
4232
4236
  }
4233
4237
  return this;
4234
4238
  }
@@ -5593,16 +5597,16 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5593
5597
  this.addIntent({
5594
5598
  name: inquiry,
5595
5599
  description: "",
5596
- input: void 0,
5597
- output: void 0
5600
+ input: { type: "object" },
5601
+ output: { type: "object" }
5598
5602
  });
5599
- this.emit("meta.inquiry_broker.added", { inquiryName: inquiry });
5600
5603
  }
5601
5604
  }
5602
5605
  addIntent(intent) {
5603
5606
  if (!this.intents.has(intent.name)) {
5604
5607
  this.validateInquiryName(intent.name);
5605
5608
  this.intents.set(intent.name, intent);
5609
+ this.emit("meta.inquiry_broker.added", { data: { ...intent } });
5606
5610
  } else {
5607
5611
  const currentIntent = this.intents.get(intent.name);
5608
5612
  if (currentIntent.description !== intent.description) {
@@ -5629,6 +5633,7 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5629
5633
  return Promise.resolve({});
5630
5634
  }
5631
5635
  return new Promise((resolve) => {
5636
+ this.emit("meta.inquiry_broker.inquire", {});
5632
5637
  let joinedContext = {};
5633
5638
  const pendingTasks = Array.from(tasks).map((task) => task.name);
5634
5639
  const resolveTasks = [];
@@ -5832,7 +5837,7 @@ var Cadenza = class {
5832
5837
  return this.registry?.routines.get(routineName);
5833
5838
  }
5834
5839
  static defineIntent(intent) {
5835
- this.inquiryBroker?.intents.set(intent.name, intent);
5840
+ this.inquiryBroker?.addIntent(intent);
5836
5841
  return intent;
5837
5842
  }
5838
5843
  static async inquire(inquiry, context, options) {
@@ -6384,6 +6389,7 @@ export {
6384
6389
  GraphRoutine,
6385
6390
  GraphRun,
6386
6391
  GraphRunner,
6392
+ InquiryBroker,
6387
6393
  SignalBroker,
6388
6394
  SignalEmitter,
6389
6395
  Task,