@voltagent/core 1.1.14 → 1.1.16
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 +72 -19
- package/dist/index.d.ts +72 -19
- package/dist/index.js +421 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +420 -78
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -655,7 +655,7 @@ interface WorkflowStateEntry {
|
|
|
655
655
|
/** Workflow name for reference */
|
|
656
656
|
workflowName: string;
|
|
657
657
|
/** Current status */
|
|
658
|
-
status: "running" | "suspended" | "completed" | "error";
|
|
658
|
+
status: "running" | "suspended" | "completed" | "cancelled" | "error";
|
|
659
659
|
/** Original input to the workflow */
|
|
660
660
|
input?: unknown;
|
|
661
661
|
/** Execution context */
|
|
@@ -2010,9 +2010,11 @@ interface VoltAgentStreamTextResult<TOOLS extends Record<string, any> = Record<s
|
|
|
2010
2010
|
interface ObservabilityConfig {
|
|
2011
2011
|
serviceName?: string;
|
|
2012
2012
|
serviceVersion?: string;
|
|
2013
|
+
instrumentationScopeName?: string;
|
|
2013
2014
|
storage?: ObservabilityStorageAdapter;
|
|
2014
2015
|
logger?: Logger;
|
|
2015
2016
|
resourceAttributes?: Record<string, any>;
|
|
2017
|
+
spanFilters?: SpanFilterConfig;
|
|
2016
2018
|
voltOpsSync?: {
|
|
2017
2019
|
sampling?: {
|
|
2018
2020
|
strategy?: "always" | "never" | "ratio" | "parent";
|
|
@@ -2026,6 +2028,23 @@ interface ObservabilityConfig {
|
|
|
2026
2028
|
spanProcessors?: SpanProcessor[];
|
|
2027
2029
|
logProcessors?: LogRecordProcessor[];
|
|
2028
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Span filter configuration
|
|
2033
|
+
*/
|
|
2034
|
+
interface SpanFilterConfig {
|
|
2035
|
+
enabled?: boolean;
|
|
2036
|
+
/**
|
|
2037
|
+
* Restrict span processing to spans originating from these tracer
|
|
2038
|
+
* instrumentation scope names. Defaults to the internal VoltAgent tracer
|
|
2039
|
+
* when omitted.
|
|
2040
|
+
*/
|
|
2041
|
+
instrumentationScopeNames?: string[];
|
|
2042
|
+
/**
|
|
2043
|
+
* Restrict span processing to the provided `service.name` values. If empty
|
|
2044
|
+
* or undefined, this constraint is ignored.
|
|
2045
|
+
*/
|
|
2046
|
+
serviceNames?: string[];
|
|
2047
|
+
}
|
|
2029
2048
|
/**
|
|
2030
2049
|
* Unified span format for all observability features
|
|
2031
2050
|
* Serializable and compatible with OpenTelemetry concepts
|
|
@@ -2201,11 +2220,15 @@ declare class VoltAgentObservability {
|
|
|
2201
2220
|
private localStorageProcessor?;
|
|
2202
2221
|
private config;
|
|
2203
2222
|
private logger;
|
|
2223
|
+
private spanFilterOptions?;
|
|
2224
|
+
private instrumentationScopeName;
|
|
2204
2225
|
constructor(config?: ObservabilityConfig);
|
|
2205
2226
|
/**
|
|
2206
2227
|
* Set up span processors
|
|
2207
2228
|
*/
|
|
2208
2229
|
private setupProcessors;
|
|
2230
|
+
private applySpanFilter;
|
|
2231
|
+
private resolveSpanFilterOptions;
|
|
2209
2232
|
/**
|
|
2210
2233
|
* Try to initialize Pino OpenTelemetry bridge if available
|
|
2211
2234
|
*/
|
|
@@ -3556,7 +3579,7 @@ declare class Agent {
|
|
|
3556
3579
|
private createWorkingMemoryTools;
|
|
3557
3580
|
}
|
|
3558
3581
|
|
|
3559
|
-
type WorkflowStateStatus = "pending" | "running" | "completed" | "failed" | "suspended";
|
|
3582
|
+
type WorkflowStateStatus = "pending" | "running" | "completed" | "failed" | "suspended" | "cancelled";
|
|
3560
3583
|
type WorkflowState<INPUT, RESULT> = {
|
|
3561
3584
|
executionId: string;
|
|
3562
3585
|
conversationId?: string;
|
|
@@ -3575,6 +3598,8 @@ type WorkflowState<INPUT, RESULT> = {
|
|
|
3575
3598
|
error: Error | null;
|
|
3576
3599
|
/** suspension metadata when workflow is suspended */
|
|
3577
3600
|
suspension?: WorkflowSuspensionMetadata;
|
|
3601
|
+
/** cancellation metadata when workflow is cancelled */
|
|
3602
|
+
cancellation?: WorkflowCancellationMetadata;
|
|
3578
3603
|
/** accumulated usage from andAgent calls */
|
|
3579
3604
|
usage: UsageInfo;
|
|
3580
3605
|
};
|
|
@@ -3598,6 +3623,12 @@ interface WorkflowSuspensionMetadata<SUSPEND_DATA = DangerouslyAllowAny> {
|
|
|
3598
3623
|
completedStepsData?: DangerouslyAllowAny[];
|
|
3599
3624
|
};
|
|
3600
3625
|
}
|
|
3626
|
+
interface WorkflowCancellationMetadata {
|
|
3627
|
+
/** Timestamp when the workflow was cancelled */
|
|
3628
|
+
cancelledAt: Date;
|
|
3629
|
+
/** Reason for cancellation */
|
|
3630
|
+
reason?: string;
|
|
3631
|
+
}
|
|
3601
3632
|
/**
|
|
3602
3633
|
* Custom abort controller for workflow suspension with reason tracking
|
|
3603
3634
|
*/
|
|
@@ -3610,14 +3641,26 @@ interface WorkflowSuspendController {
|
|
|
3610
3641
|
* Suspend the workflow with a reason
|
|
3611
3642
|
*/
|
|
3612
3643
|
suspend: (reason?: string) => void;
|
|
3644
|
+
/**
|
|
3645
|
+
* Cancel the workflow with a reason
|
|
3646
|
+
*/
|
|
3647
|
+
cancel: (reason?: string) => void;
|
|
3613
3648
|
/**
|
|
3614
3649
|
* Check if the workflow has been suspended
|
|
3615
3650
|
*/
|
|
3616
3651
|
isSuspended: () => boolean;
|
|
3617
3652
|
/**
|
|
3618
|
-
*
|
|
3653
|
+
* Check if the workflow has been cancelled
|
|
3654
|
+
*/
|
|
3655
|
+
isCancelled: () => boolean;
|
|
3656
|
+
/**
|
|
3657
|
+
* Get the suspension or cancellation reason
|
|
3619
3658
|
*/
|
|
3620
3659
|
getReason: () => string | undefined;
|
|
3660
|
+
/**
|
|
3661
|
+
* Get the cancellation reason if cancellation was requested
|
|
3662
|
+
*/
|
|
3663
|
+
getCancelReason: () => string | undefined;
|
|
3621
3664
|
}
|
|
3622
3665
|
/**
|
|
3623
3666
|
* Base result interface shared by all workflow execution results
|
|
@@ -3642,7 +3685,7 @@ interface WorkflowExecutionResultBase<RESULT_SCHEMA extends z.ZodTypeAny, RESUME
|
|
|
3642
3685
|
/**
|
|
3643
3686
|
* Current status of the workflow execution
|
|
3644
3687
|
*/
|
|
3645
|
-
status: "completed" | "suspended" | "error" | Promise<"completed" | "suspended" | "error">;
|
|
3688
|
+
status: "completed" | "suspended" | "cancelled" | "error" | Promise<"completed" | "suspended" | "cancelled" | "error">;
|
|
3646
3689
|
/**
|
|
3647
3690
|
* The result data if workflow completed successfully
|
|
3648
3691
|
*/
|
|
@@ -3651,6 +3694,10 @@ interface WorkflowExecutionResultBase<RESULT_SCHEMA extends z.ZodTypeAny, RESUME
|
|
|
3651
3694
|
* Suspension metadata if workflow was suspended
|
|
3652
3695
|
*/
|
|
3653
3696
|
suspension?: WorkflowSuspensionMetadata | Promise<WorkflowSuspensionMetadata | undefined>;
|
|
3697
|
+
/**
|
|
3698
|
+
* Cancellation metadata if workflow was cancelled
|
|
3699
|
+
*/
|
|
3700
|
+
cancellation?: WorkflowCancellationMetadata | Promise<WorkflowCancellationMetadata | undefined>;
|
|
3654
3701
|
/**
|
|
3655
3702
|
* Error information if workflow failed
|
|
3656
3703
|
*/
|
|
@@ -3665,9 +3712,10 @@ interface WorkflowExecutionResultBase<RESULT_SCHEMA extends z.ZodTypeAny, RESUME
|
|
|
3665
3712
|
*/
|
|
3666
3713
|
interface WorkflowExecutionResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA extends z.ZodTypeAny = z.ZodAny> extends WorkflowExecutionResultBase<RESULT_SCHEMA, RESUME_SCHEMA> {
|
|
3667
3714
|
endAt: Date;
|
|
3668
|
-
status: "completed" | "suspended" | "error";
|
|
3715
|
+
status: "completed" | "suspended" | "cancelled" | "error";
|
|
3669
3716
|
result: z.infer<RESULT_SCHEMA> | null;
|
|
3670
3717
|
suspension?: WorkflowSuspensionMetadata;
|
|
3718
|
+
cancellation?: WorkflowCancellationMetadata;
|
|
3671
3719
|
error?: unknown;
|
|
3672
3720
|
usage: UsageInfo;
|
|
3673
3721
|
/**
|
|
@@ -3686,9 +3734,10 @@ interface WorkflowExecutionResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCH
|
|
|
3686
3734
|
*/
|
|
3687
3735
|
interface WorkflowStreamResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA extends z.ZodTypeAny = z.ZodAny> extends WorkflowExecutionResultBase<RESULT_SCHEMA, RESUME_SCHEMA>, AsyncIterable<WorkflowStreamEvent> {
|
|
3688
3736
|
endAt: Promise<Date>;
|
|
3689
|
-
status: Promise<"completed" | "suspended" | "error">;
|
|
3737
|
+
status: Promise<"completed" | "suspended" | "cancelled" | "error">;
|
|
3690
3738
|
result: Promise<z.infer<RESULT_SCHEMA> | null>;
|
|
3691
3739
|
suspension: Promise<WorkflowSuspensionMetadata | undefined>;
|
|
3740
|
+
cancellation: Promise<WorkflowCancellationMetadata | undefined>;
|
|
3692
3741
|
error: Promise<unknown | undefined>;
|
|
3693
3742
|
usage: Promise<UsageInfo>;
|
|
3694
3743
|
/**
|
|
@@ -3700,6 +3749,14 @@ interface WorkflowStreamResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA
|
|
|
3700
3749
|
resume: (input: z.infer<RESUME_SCHEMA>, options?: {
|
|
3701
3750
|
stepId?: string;
|
|
3702
3751
|
}) => Promise<WorkflowStreamResult<RESULT_SCHEMA, RESUME_SCHEMA>>;
|
|
3752
|
+
/**
|
|
3753
|
+
* Request workflow suspension
|
|
3754
|
+
*/
|
|
3755
|
+
suspend: (reason?: string) => void;
|
|
3756
|
+
/**
|
|
3757
|
+
* Cancel the workflow execution
|
|
3758
|
+
*/
|
|
3759
|
+
cancel: (reason?: string) => void;
|
|
3703
3760
|
/**
|
|
3704
3761
|
* Abort the workflow execution
|
|
3705
3762
|
*/
|
|
@@ -3995,7 +4052,7 @@ interface WorkflowStreamEvent {
|
|
|
3995
4052
|
/**
|
|
3996
4053
|
* Current status of the step/event
|
|
3997
4054
|
*/
|
|
3998
|
-
status: "pending" | "running" | "success" | "error" | "suspended";
|
|
4055
|
+
status: "pending" | "running" | "success" | "error" | "suspended" | "cancelled";
|
|
3999
4056
|
/**
|
|
4000
4057
|
* User context passed through the workflow
|
|
4001
4058
|
*/
|
|
@@ -4101,6 +4158,10 @@ declare class WorkflowTraceContext {
|
|
|
4101
4158
|
* Record a suspension event on the workflow
|
|
4102
4159
|
*/
|
|
4103
4160
|
recordSuspension(stepIndex: number, reason: string, suspendData?: any, checkpoint?: any): void;
|
|
4161
|
+
/**
|
|
4162
|
+
* Record a cancellation event on the workflow
|
|
4163
|
+
*/
|
|
4164
|
+
recordCancellation(reason?: string): void;
|
|
4104
4165
|
/**
|
|
4105
4166
|
* Record a resume event on the workflow
|
|
4106
4167
|
*/
|
|
@@ -4124,16 +4185,17 @@ declare class WorkflowTraceContext {
|
|
|
4124
4185
|
/**
|
|
4125
4186
|
* End the root span with a status
|
|
4126
4187
|
*/
|
|
4127
|
-
end(status: "completed" | "suspended" | "error", error?: Error | any): void;
|
|
4188
|
+
end(status: "completed" | "suspended" | "cancelled" | "error", error?: Error | any): void;
|
|
4128
4189
|
/**
|
|
4129
4190
|
* End a step span with proper status
|
|
4130
4191
|
*/
|
|
4131
|
-
endStepSpan(span: Span, status: "completed" | "skipped" | "suspended" | "error", options?: {
|
|
4192
|
+
endStepSpan(span: Span, status: "completed" | "skipped" | "suspended" | "cancelled" | "error", options?: {
|
|
4132
4193
|
output?: any;
|
|
4133
4194
|
error?: Error | any;
|
|
4134
4195
|
attributes?: Record<string, any>;
|
|
4135
4196
|
skippedReason?: string;
|
|
4136
4197
|
suspensionReason?: string;
|
|
4198
|
+
cancellationReason?: string;
|
|
4137
4199
|
}): void;
|
|
4138
4200
|
/**
|
|
4139
4201
|
* Get the active context for manual context propagation
|
|
@@ -5359,16 +5421,7 @@ declare class WorkflowRegistry extends EventEmitter {
|
|
|
5359
5421
|
/**
|
|
5360
5422
|
* Resume a suspended workflow execution
|
|
5361
5423
|
*/
|
|
5362
|
-
resumeSuspendedWorkflow(workflowId: string, executionId: string, resumeData?: any, resumeStepId?: string): Promise<
|
|
5363
|
-
executionId: string;
|
|
5364
|
-
startAt: Date;
|
|
5365
|
-
endAt: Date;
|
|
5366
|
-
status: "completed" | "suspended" | "error";
|
|
5367
|
-
result: any;
|
|
5368
|
-
usage: UsageInfo;
|
|
5369
|
-
suspension?: any;
|
|
5370
|
-
error?: unknown;
|
|
5371
|
-
} | null>;
|
|
5424
|
+
resumeSuspendedWorkflow(workflowId: string, executionId: string, resumeData?: any, resumeStepId?: string): Promise<WorkflowExecutionResult<any, any> | null>;
|
|
5372
5425
|
/**
|
|
5373
5426
|
* Get all suspended workflow executions
|
|
5374
5427
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -655,7 +655,7 @@ interface WorkflowStateEntry {
|
|
|
655
655
|
/** Workflow name for reference */
|
|
656
656
|
workflowName: string;
|
|
657
657
|
/** Current status */
|
|
658
|
-
status: "running" | "suspended" | "completed" | "error";
|
|
658
|
+
status: "running" | "suspended" | "completed" | "cancelled" | "error";
|
|
659
659
|
/** Original input to the workflow */
|
|
660
660
|
input?: unknown;
|
|
661
661
|
/** Execution context */
|
|
@@ -2010,9 +2010,11 @@ interface VoltAgentStreamTextResult<TOOLS extends Record<string, any> = Record<s
|
|
|
2010
2010
|
interface ObservabilityConfig {
|
|
2011
2011
|
serviceName?: string;
|
|
2012
2012
|
serviceVersion?: string;
|
|
2013
|
+
instrumentationScopeName?: string;
|
|
2013
2014
|
storage?: ObservabilityStorageAdapter;
|
|
2014
2015
|
logger?: Logger;
|
|
2015
2016
|
resourceAttributes?: Record<string, any>;
|
|
2017
|
+
spanFilters?: SpanFilterConfig;
|
|
2016
2018
|
voltOpsSync?: {
|
|
2017
2019
|
sampling?: {
|
|
2018
2020
|
strategy?: "always" | "never" | "ratio" | "parent";
|
|
@@ -2026,6 +2028,23 @@ interface ObservabilityConfig {
|
|
|
2026
2028
|
spanProcessors?: SpanProcessor[];
|
|
2027
2029
|
logProcessors?: LogRecordProcessor[];
|
|
2028
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Span filter configuration
|
|
2033
|
+
*/
|
|
2034
|
+
interface SpanFilterConfig {
|
|
2035
|
+
enabled?: boolean;
|
|
2036
|
+
/**
|
|
2037
|
+
* Restrict span processing to spans originating from these tracer
|
|
2038
|
+
* instrumentation scope names. Defaults to the internal VoltAgent tracer
|
|
2039
|
+
* when omitted.
|
|
2040
|
+
*/
|
|
2041
|
+
instrumentationScopeNames?: string[];
|
|
2042
|
+
/**
|
|
2043
|
+
* Restrict span processing to the provided `service.name` values. If empty
|
|
2044
|
+
* or undefined, this constraint is ignored.
|
|
2045
|
+
*/
|
|
2046
|
+
serviceNames?: string[];
|
|
2047
|
+
}
|
|
2029
2048
|
/**
|
|
2030
2049
|
* Unified span format for all observability features
|
|
2031
2050
|
* Serializable and compatible with OpenTelemetry concepts
|
|
@@ -2201,11 +2220,15 @@ declare class VoltAgentObservability {
|
|
|
2201
2220
|
private localStorageProcessor?;
|
|
2202
2221
|
private config;
|
|
2203
2222
|
private logger;
|
|
2223
|
+
private spanFilterOptions?;
|
|
2224
|
+
private instrumentationScopeName;
|
|
2204
2225
|
constructor(config?: ObservabilityConfig);
|
|
2205
2226
|
/**
|
|
2206
2227
|
* Set up span processors
|
|
2207
2228
|
*/
|
|
2208
2229
|
private setupProcessors;
|
|
2230
|
+
private applySpanFilter;
|
|
2231
|
+
private resolveSpanFilterOptions;
|
|
2209
2232
|
/**
|
|
2210
2233
|
* Try to initialize Pino OpenTelemetry bridge if available
|
|
2211
2234
|
*/
|
|
@@ -3556,7 +3579,7 @@ declare class Agent {
|
|
|
3556
3579
|
private createWorkingMemoryTools;
|
|
3557
3580
|
}
|
|
3558
3581
|
|
|
3559
|
-
type WorkflowStateStatus = "pending" | "running" | "completed" | "failed" | "suspended";
|
|
3582
|
+
type WorkflowStateStatus = "pending" | "running" | "completed" | "failed" | "suspended" | "cancelled";
|
|
3560
3583
|
type WorkflowState<INPUT, RESULT> = {
|
|
3561
3584
|
executionId: string;
|
|
3562
3585
|
conversationId?: string;
|
|
@@ -3575,6 +3598,8 @@ type WorkflowState<INPUT, RESULT> = {
|
|
|
3575
3598
|
error: Error | null;
|
|
3576
3599
|
/** suspension metadata when workflow is suspended */
|
|
3577
3600
|
suspension?: WorkflowSuspensionMetadata;
|
|
3601
|
+
/** cancellation metadata when workflow is cancelled */
|
|
3602
|
+
cancellation?: WorkflowCancellationMetadata;
|
|
3578
3603
|
/** accumulated usage from andAgent calls */
|
|
3579
3604
|
usage: UsageInfo;
|
|
3580
3605
|
};
|
|
@@ -3598,6 +3623,12 @@ interface WorkflowSuspensionMetadata<SUSPEND_DATA = DangerouslyAllowAny> {
|
|
|
3598
3623
|
completedStepsData?: DangerouslyAllowAny[];
|
|
3599
3624
|
};
|
|
3600
3625
|
}
|
|
3626
|
+
interface WorkflowCancellationMetadata {
|
|
3627
|
+
/** Timestamp when the workflow was cancelled */
|
|
3628
|
+
cancelledAt: Date;
|
|
3629
|
+
/** Reason for cancellation */
|
|
3630
|
+
reason?: string;
|
|
3631
|
+
}
|
|
3601
3632
|
/**
|
|
3602
3633
|
* Custom abort controller for workflow suspension with reason tracking
|
|
3603
3634
|
*/
|
|
@@ -3610,14 +3641,26 @@ interface WorkflowSuspendController {
|
|
|
3610
3641
|
* Suspend the workflow with a reason
|
|
3611
3642
|
*/
|
|
3612
3643
|
suspend: (reason?: string) => void;
|
|
3644
|
+
/**
|
|
3645
|
+
* Cancel the workflow with a reason
|
|
3646
|
+
*/
|
|
3647
|
+
cancel: (reason?: string) => void;
|
|
3613
3648
|
/**
|
|
3614
3649
|
* Check if the workflow has been suspended
|
|
3615
3650
|
*/
|
|
3616
3651
|
isSuspended: () => boolean;
|
|
3617
3652
|
/**
|
|
3618
|
-
*
|
|
3653
|
+
* Check if the workflow has been cancelled
|
|
3654
|
+
*/
|
|
3655
|
+
isCancelled: () => boolean;
|
|
3656
|
+
/**
|
|
3657
|
+
* Get the suspension or cancellation reason
|
|
3619
3658
|
*/
|
|
3620
3659
|
getReason: () => string | undefined;
|
|
3660
|
+
/**
|
|
3661
|
+
* Get the cancellation reason if cancellation was requested
|
|
3662
|
+
*/
|
|
3663
|
+
getCancelReason: () => string | undefined;
|
|
3621
3664
|
}
|
|
3622
3665
|
/**
|
|
3623
3666
|
* Base result interface shared by all workflow execution results
|
|
@@ -3642,7 +3685,7 @@ interface WorkflowExecutionResultBase<RESULT_SCHEMA extends z.ZodTypeAny, RESUME
|
|
|
3642
3685
|
/**
|
|
3643
3686
|
* Current status of the workflow execution
|
|
3644
3687
|
*/
|
|
3645
|
-
status: "completed" | "suspended" | "error" | Promise<"completed" | "suspended" | "error">;
|
|
3688
|
+
status: "completed" | "suspended" | "cancelled" | "error" | Promise<"completed" | "suspended" | "cancelled" | "error">;
|
|
3646
3689
|
/**
|
|
3647
3690
|
* The result data if workflow completed successfully
|
|
3648
3691
|
*/
|
|
@@ -3651,6 +3694,10 @@ interface WorkflowExecutionResultBase<RESULT_SCHEMA extends z.ZodTypeAny, RESUME
|
|
|
3651
3694
|
* Suspension metadata if workflow was suspended
|
|
3652
3695
|
*/
|
|
3653
3696
|
suspension?: WorkflowSuspensionMetadata | Promise<WorkflowSuspensionMetadata | undefined>;
|
|
3697
|
+
/**
|
|
3698
|
+
* Cancellation metadata if workflow was cancelled
|
|
3699
|
+
*/
|
|
3700
|
+
cancellation?: WorkflowCancellationMetadata | Promise<WorkflowCancellationMetadata | undefined>;
|
|
3654
3701
|
/**
|
|
3655
3702
|
* Error information if workflow failed
|
|
3656
3703
|
*/
|
|
@@ -3665,9 +3712,10 @@ interface WorkflowExecutionResultBase<RESULT_SCHEMA extends z.ZodTypeAny, RESUME
|
|
|
3665
3712
|
*/
|
|
3666
3713
|
interface WorkflowExecutionResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA extends z.ZodTypeAny = z.ZodAny> extends WorkflowExecutionResultBase<RESULT_SCHEMA, RESUME_SCHEMA> {
|
|
3667
3714
|
endAt: Date;
|
|
3668
|
-
status: "completed" | "suspended" | "error";
|
|
3715
|
+
status: "completed" | "suspended" | "cancelled" | "error";
|
|
3669
3716
|
result: z.infer<RESULT_SCHEMA> | null;
|
|
3670
3717
|
suspension?: WorkflowSuspensionMetadata;
|
|
3718
|
+
cancellation?: WorkflowCancellationMetadata;
|
|
3671
3719
|
error?: unknown;
|
|
3672
3720
|
usage: UsageInfo;
|
|
3673
3721
|
/**
|
|
@@ -3686,9 +3734,10 @@ interface WorkflowExecutionResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCH
|
|
|
3686
3734
|
*/
|
|
3687
3735
|
interface WorkflowStreamResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA extends z.ZodTypeAny = z.ZodAny> extends WorkflowExecutionResultBase<RESULT_SCHEMA, RESUME_SCHEMA>, AsyncIterable<WorkflowStreamEvent> {
|
|
3688
3736
|
endAt: Promise<Date>;
|
|
3689
|
-
status: Promise<"completed" | "suspended" | "error">;
|
|
3737
|
+
status: Promise<"completed" | "suspended" | "cancelled" | "error">;
|
|
3690
3738
|
result: Promise<z.infer<RESULT_SCHEMA> | null>;
|
|
3691
3739
|
suspension: Promise<WorkflowSuspensionMetadata | undefined>;
|
|
3740
|
+
cancellation: Promise<WorkflowCancellationMetadata | undefined>;
|
|
3692
3741
|
error: Promise<unknown | undefined>;
|
|
3693
3742
|
usage: Promise<UsageInfo>;
|
|
3694
3743
|
/**
|
|
@@ -3700,6 +3749,14 @@ interface WorkflowStreamResult<RESULT_SCHEMA extends z.ZodTypeAny, RESUME_SCHEMA
|
|
|
3700
3749
|
resume: (input: z.infer<RESUME_SCHEMA>, options?: {
|
|
3701
3750
|
stepId?: string;
|
|
3702
3751
|
}) => Promise<WorkflowStreamResult<RESULT_SCHEMA, RESUME_SCHEMA>>;
|
|
3752
|
+
/**
|
|
3753
|
+
* Request workflow suspension
|
|
3754
|
+
*/
|
|
3755
|
+
suspend: (reason?: string) => void;
|
|
3756
|
+
/**
|
|
3757
|
+
* Cancel the workflow execution
|
|
3758
|
+
*/
|
|
3759
|
+
cancel: (reason?: string) => void;
|
|
3703
3760
|
/**
|
|
3704
3761
|
* Abort the workflow execution
|
|
3705
3762
|
*/
|
|
@@ -3995,7 +4052,7 @@ interface WorkflowStreamEvent {
|
|
|
3995
4052
|
/**
|
|
3996
4053
|
* Current status of the step/event
|
|
3997
4054
|
*/
|
|
3998
|
-
status: "pending" | "running" | "success" | "error" | "suspended";
|
|
4055
|
+
status: "pending" | "running" | "success" | "error" | "suspended" | "cancelled";
|
|
3999
4056
|
/**
|
|
4000
4057
|
* User context passed through the workflow
|
|
4001
4058
|
*/
|
|
@@ -4101,6 +4158,10 @@ declare class WorkflowTraceContext {
|
|
|
4101
4158
|
* Record a suspension event on the workflow
|
|
4102
4159
|
*/
|
|
4103
4160
|
recordSuspension(stepIndex: number, reason: string, suspendData?: any, checkpoint?: any): void;
|
|
4161
|
+
/**
|
|
4162
|
+
* Record a cancellation event on the workflow
|
|
4163
|
+
*/
|
|
4164
|
+
recordCancellation(reason?: string): void;
|
|
4104
4165
|
/**
|
|
4105
4166
|
* Record a resume event on the workflow
|
|
4106
4167
|
*/
|
|
@@ -4124,16 +4185,17 @@ declare class WorkflowTraceContext {
|
|
|
4124
4185
|
/**
|
|
4125
4186
|
* End the root span with a status
|
|
4126
4187
|
*/
|
|
4127
|
-
end(status: "completed" | "suspended" | "error", error?: Error | any): void;
|
|
4188
|
+
end(status: "completed" | "suspended" | "cancelled" | "error", error?: Error | any): void;
|
|
4128
4189
|
/**
|
|
4129
4190
|
* End a step span with proper status
|
|
4130
4191
|
*/
|
|
4131
|
-
endStepSpan(span: Span, status: "completed" | "skipped" | "suspended" | "error", options?: {
|
|
4192
|
+
endStepSpan(span: Span, status: "completed" | "skipped" | "suspended" | "cancelled" | "error", options?: {
|
|
4132
4193
|
output?: any;
|
|
4133
4194
|
error?: Error | any;
|
|
4134
4195
|
attributes?: Record<string, any>;
|
|
4135
4196
|
skippedReason?: string;
|
|
4136
4197
|
suspensionReason?: string;
|
|
4198
|
+
cancellationReason?: string;
|
|
4137
4199
|
}): void;
|
|
4138
4200
|
/**
|
|
4139
4201
|
* Get the active context for manual context propagation
|
|
@@ -5359,16 +5421,7 @@ declare class WorkflowRegistry extends EventEmitter {
|
|
|
5359
5421
|
/**
|
|
5360
5422
|
* Resume a suspended workflow execution
|
|
5361
5423
|
*/
|
|
5362
|
-
resumeSuspendedWorkflow(workflowId: string, executionId: string, resumeData?: any, resumeStepId?: string): Promise<
|
|
5363
|
-
executionId: string;
|
|
5364
|
-
startAt: Date;
|
|
5365
|
-
endAt: Date;
|
|
5366
|
-
status: "completed" | "suspended" | "error";
|
|
5367
|
-
result: any;
|
|
5368
|
-
usage: UsageInfo;
|
|
5369
|
-
suspension?: any;
|
|
5370
|
-
error?: unknown;
|
|
5371
|
-
} | null>;
|
|
5424
|
+
resumeSuspendedWorkflow(workflowId: string, executionId: string, resumeData?: any, resumeStepId?: string): Promise<WorkflowExecutionResult<any, any> | null>;
|
|
5372
5425
|
/**
|
|
5373
5426
|
* Get all suspended workflow executions
|
|
5374
5427
|
*/
|