@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.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.
@@ -2249,4 +2249,4 @@ declare class Cadenza {
2249
2249
  static reset(): void;
2250
2250
  }
2251
2251
 
2252
- export { type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type SchemaConstraints, type SchemaDefinition, type SchemaType, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
2252
+ export { type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, InquiryBroker, type InquiryOptions, type Intent, type SchemaConstraints, type SchemaDefinition, type SchemaType, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
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.
@@ -2249,4 +2249,4 @@ declare class Cadenza {
2249
2249
  static reset(): void;
2250
2250
  }
2251
2251
 
2252
- export { type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type SchemaConstraints, type SchemaDefinition, type SchemaType, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
2252
+ export { type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, InquiryBroker, type InquiryOptions, type Intent, type SchemaConstraints, type SchemaDefinition, type SchemaType, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default };
package/dist/index.js CHANGED
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  GraphRoutine: () => GraphRoutine,
28
28
  GraphRun: () => GraphRun,
29
29
  GraphRunner: () => GraphRunner,
30
+ InquiryBroker: () => InquiryBroker,
30
31
  SignalBroker: () => SignalBroker,
31
32
  SignalEmitter: () => SignalEmitter,
32
33
  Task: () => Task,
@@ -3487,7 +3488,7 @@ var Task = class _Task extends SignalEmitter {
3487
3488
  * @param {number} [retryDelayMax=0] - The maximum delay (in milliseconds) allowed between retries.
3488
3489
  * @param {number} [retryDelayFactor=1] - The factor by which the retry delay increases after each attempt.
3489
3490
  */
3490
- 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) {
3491
3492
  super(isSubMeta || isHidden);
3492
3493
  this.version = 1;
3493
3494
  this.isMeta = false;
@@ -3499,9 +3500,9 @@ var Task = class _Task extends SignalEmitter {
3499
3500
  this.isDeputy = false;
3500
3501
  this.isEphemeral = false;
3501
3502
  this.isDebounce = false;
3502
- this.inputContextSchema = void 0;
3503
+ this.inputContextSchema = { type: "object" };
3503
3504
  this.validateInputContext = false;
3504
- this.outputContextSchema = void 0;
3505
+ this.outputContextSchema = { type: "object" };
3505
3506
  this.validateOutputContext = false;
3506
3507
  this.retryCount = 0;
3507
3508
  this.retryDelay = 0;
@@ -4263,8 +4264,12 @@ var Task = class _Task extends SignalEmitter {
4263
4264
  this.handlesIntents.add(intentName);
4264
4265
  Cadenza.inquiryBroker.observe(intentName, this);
4265
4266
  const intent = Cadenza.inquiryBroker.intents.get(intentName);
4266
- this.inputContextSchema = intent?.input;
4267
- this.outputContextSchema = intent?.output;
4267
+ if (intent?.input) {
4268
+ this.inputContextSchema = intent.input;
4269
+ }
4270
+ if (intent?.output) {
4271
+ this.outputContextSchema = intent.output;
4272
+ }
4268
4273
  }
4269
4274
  return this;
4270
4275
  }
@@ -5629,16 +5634,16 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5629
5634
  this.addIntent({
5630
5635
  name: inquiry,
5631
5636
  description: "",
5632
- input: void 0,
5633
- output: void 0
5637
+ input: { type: "object" },
5638
+ output: { type: "object" }
5634
5639
  });
5635
- this.emit("meta.inquiry_broker.added", { inquiryName: inquiry });
5636
5640
  }
5637
5641
  }
5638
5642
  addIntent(intent) {
5639
5643
  if (!this.intents.has(intent.name)) {
5640
5644
  this.validateInquiryName(intent.name);
5641
5645
  this.intents.set(intent.name, intent);
5646
+ this.emit("meta.inquiry_broker.added", { data: { ...intent } });
5642
5647
  } else {
5643
5648
  const currentIntent = this.intents.get(intent.name);
5644
5649
  if (currentIntent.description !== intent.description) {
@@ -5665,6 +5670,7 @@ var InquiryBroker = class _InquiryBroker extends SignalEmitter {
5665
5670
  return Promise.resolve({});
5666
5671
  }
5667
5672
  return new Promise((resolve) => {
5673
+ this.emit("meta.inquiry_broker.inquire", {});
5668
5674
  let joinedContext = {};
5669
5675
  const pendingTasks = Array.from(tasks).map((task) => task.name);
5670
5676
  const resolveTasks = [];
@@ -5868,7 +5874,7 @@ var Cadenza = class {
5868
5874
  return this.registry?.routines.get(routineName);
5869
5875
  }
5870
5876
  static defineIntent(intent) {
5871
- this.inquiryBroker?.intents.set(intent.name, intent);
5877
+ this.inquiryBroker?.addIntent(intent);
5872
5878
  return intent;
5873
5879
  }
5874
5880
  static async inquire(inquiry, context, options) {
@@ -6421,6 +6427,7 @@ var index_default = Cadenza;
6421
6427
  GraphRoutine,
6422
6428
  GraphRun,
6423
6429
  GraphRunner,
6430
+ InquiryBroker,
6424
6431
  SignalBroker,
6425
6432
  SignalEmitter,
6426
6433
  Task