@cadenza.io/core 3.18.1 → 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.d.mts CHANGED
@@ -848,9 +848,9 @@ declare class Task extends SignalEmitter implements Graph {
848
848
  readonly isDeputy: boolean;
849
849
  readonly isEphemeral: boolean;
850
850
  readonly isDebounce: boolean;
851
- inputContextSchema: SchemaDefinition | undefined;
851
+ inputContextSchema: SchemaDefinition;
852
852
  validateInputContext: boolean;
853
- outputContextSchema: SchemaDefinition | undefined;
853
+ outputContextSchema: SchemaDefinition;
854
854
  validateOutputContext: boolean;
855
855
  readonly retryCount: number;
856
856
  readonly retryDelay: number;
@@ -895,7 +895,7 @@ declare class Task extends SignalEmitter implements Graph {
895
895
  * @param {number} [retryDelayMax=0] - The maximum delay (in milliseconds) allowed between retries.
896
896
  * @param {number} [retryDelayFactor=1] - The factor by which the retry delay increases after each attempt.
897
897
  */
898
- constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
898
+ constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition, validateInputContext?: boolean, outputSchema?: SchemaDefinition, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
899
899
  clone(traverse?: boolean, includeSignals?: boolean): Task;
900
900
  /**
901
901
  * Retrieves the tag associated with the instance.
package/dist/index.d.ts CHANGED
@@ -848,9 +848,9 @@ declare class Task extends SignalEmitter implements Graph {
848
848
  readonly isDeputy: boolean;
849
849
  readonly isEphemeral: boolean;
850
850
  readonly isDebounce: boolean;
851
- inputContextSchema: SchemaDefinition | undefined;
851
+ inputContextSchema: SchemaDefinition;
852
852
  validateInputContext: boolean;
853
- outputContextSchema: SchemaDefinition | undefined;
853
+ outputContextSchema: SchemaDefinition;
854
854
  validateOutputContext: boolean;
855
855
  readonly retryCount: number;
856
856
  readonly retryDelay: number;
@@ -895,7 +895,7 @@ declare class Task extends SignalEmitter implements Graph {
895
895
  * @param {number} [retryDelayMax=0] - The maximum delay (in milliseconds) allowed between retries.
896
896
  * @param {number} [retryDelayFactor=1] - The factor by which the retry delay increases after each attempt.
897
897
  */
898
- constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition | undefined, validateInputContext?: boolean, outputSchema?: SchemaDefinition | undefined, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
898
+ constructor(name: string, task: TaskFunction, description?: string, concurrency?: number, timeout?: number, register?: boolean, isUnique?: boolean, isMeta?: boolean, isSubMeta?: boolean, isHidden?: boolean, getTagCallback?: ThrottleTagGetter | undefined, inputSchema?: SchemaDefinition, validateInputContext?: boolean, outputSchema?: SchemaDefinition, validateOutputContext?: boolean, retryCount?: number, retryDelay?: number, retryDelayMax?: number, retryDelayFactor?: number);
899
899
  clone(traverse?: boolean, includeSignals?: boolean): Task;
900
900
  /**
901
901
  * Retrieves the tag associated with the instance.
package/dist/index.js CHANGED
@@ -3488,7 +3488,7 @@ var Task = class _Task extends SignalEmitter {
3488
3488
  * @param {number} [retryDelayMax=0] - The maximum delay (in milliseconds) allowed between retries.
3489
3489
  * @param {number} [retryDelayFactor=1] - The factor by which the retry delay increases after each attempt.
3490
3490
  */
3491
- 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) {
3491
+ 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) {
3492
3492
  super(isSubMeta || isHidden);
3493
3493
  this.version = 1;
3494
3494
  this.isMeta = false;
@@ -3500,9 +3500,9 @@ var Task = class _Task extends SignalEmitter {
3500
3500
  this.isDeputy = false;
3501
3501
  this.isEphemeral = false;
3502
3502
  this.isDebounce = false;
3503
- this.inputContextSchema = void 0;
3503
+ this.inputContextSchema = { type: "object" };
3504
3504
  this.validateInputContext = false;
3505
- this.outputContextSchema = void 0;
3505
+ this.outputContextSchema = { type: "object" };
3506
3506
  this.validateOutputContext = false;
3507
3507
  this.retryCount = 0;
3508
3508
  this.retryDelay = 0;
@@ -4264,8 +4264,12 @@ var Task = class _Task extends SignalEmitter {
4264
4264
  this.handlesIntents.add(intentName);
4265
4265
  Cadenza.inquiryBroker.observe(intentName, this);
4266
4266
  const intent = Cadenza.inquiryBroker.intents.get(intentName);
4267
- this.inputContextSchema = intent?.input;
4268
- this.outputContextSchema = intent?.output;
4267
+ if (intent?.input) {
4268
+ this.inputContextSchema = intent.input;
4269
+ }
4270
+ if (intent?.output) {
4271
+ this.outputContextSchema = intent.output;
4272
+ }
4269
4273
  }
4270
4274
  return this;
4271
4275
  }
@@ -5630,16 +5634,16 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5630
5634
  this.addIntent({
5631
5635
  name: inquiry,
5632
5636
  description: "",
5633
- input: void 0,
5634
- output: void 0
5637
+ input: { type: "object" },
5638
+ output: { type: "object" }
5635
5639
  });
5636
- this.emit("meta.inquiry_broker.added", { inquiryName: inquiry });
5637
5640
  }
5638
5641
  }
5639
5642
  addIntent(intent) {
5640
5643
  if (!this.intents.has(intent.name)) {
5641
5644
  this.validateInquiryName(intent.name);
5642
5645
  this.intents.set(intent.name, intent);
5646
+ this.emit("meta.inquiry_broker.added", { data: { ...intent } });
5643
5647
  } else {
5644
5648
  const currentIntent = this.intents.get(intent.name);
5645
5649
  if (currentIntent.description !== intent.description) {
@@ -5666,6 +5670,7 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5666
5670
  return Promise.resolve({});
5667
5671
  }
5668
5672
  return new Promise((resolve) => {
5673
+ this.emit("meta.inquiry_broker.inquire", {});
5669
5674
  let joinedContext = {};
5670
5675
  const pendingTasks = Array.from(tasks).map((task) => task.name);
5671
5676
  const resolveTasks = [];
@@ -5869,7 +5874,7 @@ var Cadenza = class {
5869
5874
  return this.registry?.routines.get(routineName);
5870
5875
  }
5871
5876
  static defineIntent(intent) {
5872
- this.inquiryBroker?.intents.set(intent.name, intent);
5877
+ this.inquiryBroker?.addIntent(intent);
5873
5878
  return intent;
5874
5879
  }
5875
5880
  static async inquire(inquiry, context, options) {