@cadenza.io/core 3.24.0 → 3.25.1

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
@@ -854,8 +854,10 @@ declare class Task extends SignalEmitter implements Graph {
854
854
  readonly isEphemeral: boolean;
855
855
  readonly isDebounce: boolean;
856
856
  inputContextSchema: Schema;
857
+ hasExplicitInputContextSchema: boolean;
857
858
  validateInputContext: boolean;
858
859
  outputContextSchema: Schema;
860
+ hasExplicitOutputContextSchema: boolean;
859
861
  validateOutputContext: boolean;
860
862
  readonly retryCount: number;
861
863
  readonly retryDelay: number;
@@ -962,7 +964,10 @@ declare class Task extends SignalEmitter implements Graph {
962
964
  * @param {AnyObject} context - The input context to validate.
963
965
  * @return {true | AnyObject} - Returns `true` if validation succeeds, otherwise returns an error object containing details of the validation failure.
964
966
  */
965
- validateInput(context: AnyObject): true | AnyObject;
967
+ private getEffectiveValidationMode;
968
+ private warnMissingSchema;
969
+ private logValidationFailure;
970
+ validateInput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
966
971
  /**
967
972
  * Validates the output context using the provided schema and emits metadata if validation fails.
968
973
  *
@@ -970,7 +975,7 @@ declare class Task extends SignalEmitter implements Graph {
970
975
  * @return {true | AnyObject} Returns `true` if the output context is valid; otherwise, returns an object
971
976
  * containing error information when validation fails.
972
977
  */
973
- validateOutput(context: AnyObject): true | AnyObject;
978
+ validateOutput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
974
979
  /**
975
980
  * Executes a task within a given context, optionally emitting signals and reporting progress.
976
981
  *
@@ -2152,6 +2157,33 @@ interface TaskOptions {
2152
2157
  retryDelayFactor?: number;
2153
2158
  }
2154
2159
  type CadenzaMode = "dev" | "debug" | "verbose" | "production";
2160
+ type RuntimeValidationMode = "off" | "warn" | "enforce";
2161
+ interface RuntimeValidationPolicy {
2162
+ metaInput?: RuntimeValidationMode;
2163
+ metaOutput?: RuntimeValidationMode;
2164
+ businessInput?: RuntimeValidationMode;
2165
+ businessOutput?: RuntimeValidationMode;
2166
+ warnOnMissingMetaInputSchema?: boolean;
2167
+ warnOnMissingMetaOutputSchema?: boolean;
2168
+ warnOnMissingBusinessInputSchema?: boolean;
2169
+ warnOnMissingBusinessOutputSchema?: boolean;
2170
+ }
2171
+ interface RuntimeValidationScope {
2172
+ id: string;
2173
+ active?: boolean;
2174
+ startTaskNames?: string[];
2175
+ startRoutineNames?: string[];
2176
+ policy?: RuntimeValidationPolicy;
2177
+ }
2178
+ interface ResolvedRuntimeValidationPolicy {
2179
+ layer: "meta" | "business";
2180
+ inputMode: RuntimeValidationMode;
2181
+ outputMode: RuntimeValidationMode;
2182
+ warnOnMissingInputSchema: boolean;
2183
+ warnOnMissingOutputSchema: boolean;
2184
+ activeScopeIds: string[];
2185
+ }
2186
+ type RuntimeInquiryDelegate = (inquiry: string, context: AnyObject, options?: InquiryOptions) => Promise<any>;
2155
2187
  /**
2156
2188
  * Represents the core class of the Cadenza framework managing tasks, meta-tasks, signal emissions, and execution strategies.
2157
2189
  * All core components such as SignalBroker, GraphRunner, and GraphRegistry are initialized through this class, and it provides
@@ -2165,6 +2197,10 @@ declare class Cadenza {
2165
2197
  static registry: GraphRegistry;
2166
2198
  private static taskCache;
2167
2199
  private static actorCache;
2200
+ private static runtimeInquiryDelegate;
2201
+ private static runtimeValidationPolicy;
2202
+ private static runtimeValidationScopes;
2203
+ private static emittedMissingSchemaWarnings;
2168
2204
  static isBootstrapped: boolean;
2169
2205
  static mode: CadenzaMode;
2170
2206
  /**
@@ -2252,6 +2288,19 @@ declare class Cadenza {
2252
2288
  static getRoutine(routineName: string): GraphRoutine | undefined;
2253
2289
  static defineIntent(intent: Intent): Intent;
2254
2290
  static inquire(inquiry: string, context: AnyObject, options?: InquiryOptions): Promise<any>;
2291
+ static setRuntimeInquiryDelegate(delegate?: RuntimeInquiryDelegate): void;
2292
+ static resolveRuntimeInquiryDelegate(): RuntimeInquiryDelegate;
2293
+ static getRuntimeValidationPolicy(): RuntimeValidationPolicy;
2294
+ static setRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
2295
+ static replaceRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
2296
+ static clearRuntimeValidationPolicy(): void;
2297
+ static getRuntimeValidationScopes(): RuntimeValidationScope[];
2298
+ static upsertRuntimeValidationScope(scope: RuntimeValidationScope): RuntimeValidationScope;
2299
+ static removeRuntimeValidationScope(id: string): void;
2300
+ static clearRuntimeValidationScopes(): void;
2301
+ static applyRuntimeValidationScopesToContext(context: AnyObject, routineName: string, tasks: Task[]): AnyObject;
2302
+ static resolveRuntimeValidationPolicyForTask(task: Task, metadata?: AnyObject): ResolvedRuntimeValidationPolicy;
2303
+ static shouldEmitMissingSchemaWarning(cacheKey: string): boolean;
2255
2304
  /**
2256
2305
  * Creates an in-memory actor runtime instance.
2257
2306
  *
@@ -2617,4 +2666,4 @@ declare class Cadenza {
2617
2666
  static reset(): void;
2618
2667
  }
2619
2668
 
2620
- export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorTaskRuntimeMetadata, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, META_ACTOR_SESSION_STATE_PERSIST_INTENT, type RetryPolicy, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };
2669
+ export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorTaskRuntimeMetadata, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, META_ACTOR_SESSION_STATE_PERSIST_INTENT, type ResolvedRuntimeValidationPolicy, type RetryPolicy, type RuntimeValidationMode, type RuntimeValidationPolicy, type RuntimeValidationScope, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };
package/dist/index.d.ts CHANGED
@@ -854,8 +854,10 @@ declare class Task extends SignalEmitter implements Graph {
854
854
  readonly isEphemeral: boolean;
855
855
  readonly isDebounce: boolean;
856
856
  inputContextSchema: Schema;
857
+ hasExplicitInputContextSchema: boolean;
857
858
  validateInputContext: boolean;
858
859
  outputContextSchema: Schema;
860
+ hasExplicitOutputContextSchema: boolean;
859
861
  validateOutputContext: boolean;
860
862
  readonly retryCount: number;
861
863
  readonly retryDelay: number;
@@ -962,7 +964,10 @@ declare class Task extends SignalEmitter implements Graph {
962
964
  * @param {AnyObject} context - The input context to validate.
963
965
  * @return {true | AnyObject} - Returns `true` if validation succeeds, otherwise returns an error object containing details of the validation failure.
964
966
  */
965
- validateInput(context: AnyObject): true | AnyObject;
967
+ private getEffectiveValidationMode;
968
+ private warnMissingSchema;
969
+ private logValidationFailure;
970
+ validateInput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
966
971
  /**
967
972
  * Validates the output context using the provided schema and emits metadata if validation fails.
968
973
  *
@@ -970,7 +975,7 @@ declare class Task extends SignalEmitter implements Graph {
970
975
  * @return {true | AnyObject} Returns `true` if the output context is valid; otherwise, returns an object
971
976
  * containing error information when validation fails.
972
977
  */
973
- validateOutput(context: AnyObject): true | AnyObject;
978
+ validateOutput(context: AnyObject, metadata?: AnyObject): true | AnyObject;
974
979
  /**
975
980
  * Executes a task within a given context, optionally emitting signals and reporting progress.
976
981
  *
@@ -2152,6 +2157,33 @@ interface TaskOptions {
2152
2157
  retryDelayFactor?: number;
2153
2158
  }
2154
2159
  type CadenzaMode = "dev" | "debug" | "verbose" | "production";
2160
+ type RuntimeValidationMode = "off" | "warn" | "enforce";
2161
+ interface RuntimeValidationPolicy {
2162
+ metaInput?: RuntimeValidationMode;
2163
+ metaOutput?: RuntimeValidationMode;
2164
+ businessInput?: RuntimeValidationMode;
2165
+ businessOutput?: RuntimeValidationMode;
2166
+ warnOnMissingMetaInputSchema?: boolean;
2167
+ warnOnMissingMetaOutputSchema?: boolean;
2168
+ warnOnMissingBusinessInputSchema?: boolean;
2169
+ warnOnMissingBusinessOutputSchema?: boolean;
2170
+ }
2171
+ interface RuntimeValidationScope {
2172
+ id: string;
2173
+ active?: boolean;
2174
+ startTaskNames?: string[];
2175
+ startRoutineNames?: string[];
2176
+ policy?: RuntimeValidationPolicy;
2177
+ }
2178
+ interface ResolvedRuntimeValidationPolicy {
2179
+ layer: "meta" | "business";
2180
+ inputMode: RuntimeValidationMode;
2181
+ outputMode: RuntimeValidationMode;
2182
+ warnOnMissingInputSchema: boolean;
2183
+ warnOnMissingOutputSchema: boolean;
2184
+ activeScopeIds: string[];
2185
+ }
2186
+ type RuntimeInquiryDelegate = (inquiry: string, context: AnyObject, options?: InquiryOptions) => Promise<any>;
2155
2187
  /**
2156
2188
  * Represents the core class of the Cadenza framework managing tasks, meta-tasks, signal emissions, and execution strategies.
2157
2189
  * All core components such as SignalBroker, GraphRunner, and GraphRegistry are initialized through this class, and it provides
@@ -2165,6 +2197,10 @@ declare class Cadenza {
2165
2197
  static registry: GraphRegistry;
2166
2198
  private static taskCache;
2167
2199
  private static actorCache;
2200
+ private static runtimeInquiryDelegate;
2201
+ private static runtimeValidationPolicy;
2202
+ private static runtimeValidationScopes;
2203
+ private static emittedMissingSchemaWarnings;
2168
2204
  static isBootstrapped: boolean;
2169
2205
  static mode: CadenzaMode;
2170
2206
  /**
@@ -2252,6 +2288,19 @@ declare class Cadenza {
2252
2288
  static getRoutine(routineName: string): GraphRoutine | undefined;
2253
2289
  static defineIntent(intent: Intent): Intent;
2254
2290
  static inquire(inquiry: string, context: AnyObject, options?: InquiryOptions): Promise<any>;
2291
+ static setRuntimeInquiryDelegate(delegate?: RuntimeInquiryDelegate): void;
2292
+ static resolveRuntimeInquiryDelegate(): RuntimeInquiryDelegate;
2293
+ static getRuntimeValidationPolicy(): RuntimeValidationPolicy;
2294
+ static setRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
2295
+ static replaceRuntimeValidationPolicy(policy?: RuntimeValidationPolicy): RuntimeValidationPolicy;
2296
+ static clearRuntimeValidationPolicy(): void;
2297
+ static getRuntimeValidationScopes(): RuntimeValidationScope[];
2298
+ static upsertRuntimeValidationScope(scope: RuntimeValidationScope): RuntimeValidationScope;
2299
+ static removeRuntimeValidationScope(id: string): void;
2300
+ static clearRuntimeValidationScopes(): void;
2301
+ static applyRuntimeValidationScopesToContext(context: AnyObject, routineName: string, tasks: Task[]): AnyObject;
2302
+ static resolveRuntimeValidationPolicyForTask(task: Task, metadata?: AnyObject): ResolvedRuntimeValidationPolicy;
2303
+ static shouldEmitMissingSchemaWarning(cacheKey: string): boolean;
2255
2304
  /**
2256
2305
  * Creates an in-memory actor runtime instance.
2257
2306
  *
@@ -2617,4 +2666,4 @@ declare class Cadenza {
2617
2666
  static reset(): void;
2618
2667
  }
2619
2668
 
2620
- export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorTaskRuntimeMetadata, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, META_ACTOR_SESSION_STATE_PERSIST_INTENT, type RetryPolicy, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };
2669
+ export { Actor, type ActorConsistencyProfileName, type ActorDefinition, type ActorFactoryOptions, type ActorInvocationOptions, type ActorKeyDefinition, type ActorKind, type ActorLoadPolicy, type ActorRuntimeReadGuard, type ActorSpec, type ActorStateDefinition, type ActorStateReducer, type ActorStateStore, type ActorTaskBindingDefinition, type ActorTaskBindingOptions, type ActorTaskContext, type ActorTaskHandler, type ActorTaskMode, type ActorTaskRuntimeMetadata, type ActorWriteContract, type AnyObject, type CadenzaMode, type DebounceOptions, DebounceTask, type EmitOptions, EphemeralTask, type EphemeralTaskOptions, GraphContext, GraphRegistry, GraphRoutine, GraphRun, GraphRunner, type IdempotencyPolicy, InquiryBroker, type InquiryOptions, type Intent, META_ACTOR_SESSION_STATE_PERSIST_INTENT, type ResolvedRuntimeValidationPolicy, type RetryPolicy, type RuntimeValidationMode, type RuntimeValidationPolicy, type RuntimeValidationScope, type Schema, type SchemaConstraints, type SchemaDefinition, type SchemaType, type SessionPolicy, SignalBroker, SignalEmitter, Task, type TaskFunction, type TaskOptions, type TaskResult, type ThrottleTagGetter, Cadenza as default, getActorTaskRuntimeMetadata };