@hexabot-ai/agentic 3.4.0-beta.2 → 3.5.0-beta.0

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.
Files changed (134) hide show
  1. package/README.md +67 -15
  2. package/dist/cjs/action/abstract-action.js +13 -1
  3. package/dist/cjs/checkpoint.js +301 -0
  4. package/dist/cjs/context.js +11 -27
  5. package/dist/cjs/dsl.types.js +3 -0
  6. package/dist/cjs/errors.js +116 -9
  7. package/dist/cjs/index.js +15 -6
  8. package/dist/cjs/resume-payload.js +257 -0
  9. package/dist/cjs/runner-runtime-control.js +181 -306
  10. package/dist/cjs/step-executors/conditional-executor.js +27 -29
  11. package/dist/cjs/step-executors/loop-executor.js +53 -62
  12. package/dist/cjs/step-executors/parallel-executor.js +169 -102
  13. package/dist/cjs/step-executors/task-executor.js +180 -96
  14. package/dist/cjs/utils/clone.js +73 -0
  15. package/dist/cjs/workflow-fingerprint.js +138 -0
  16. package/dist/cjs/workflow-runner.js +220 -155
  17. package/dist/cjs/workflow.js +24 -12
  18. package/dist/esm/action/abstract-action.js +14 -2
  19. package/dist/esm/checkpoint.js +293 -0
  20. package/dist/esm/context.js +11 -27
  21. package/dist/esm/dsl.types.js +3 -0
  22. package/dist/esm/errors.js +105 -6
  23. package/dist/esm/index.js +3 -3
  24. package/dist/esm/resume-payload.js +250 -0
  25. package/dist/esm/runner-runtime-control.js +179 -303
  26. package/dist/esm/step-executors/conditional-executor.js +27 -29
  27. package/dist/esm/step-executors/loop-executor.js +53 -62
  28. package/dist/esm/step-executors/parallel-executor.js +165 -98
  29. package/dist/esm/step-executors/task-executor.js +181 -97
  30. package/dist/esm/utils/clone.js +67 -0
  31. package/dist/esm/workflow-fingerprint.js +134 -0
  32. package/dist/esm/workflow-runner.js +220 -155
  33. package/dist/esm/workflow.js +24 -12
  34. package/dist/types/action/abstract-action.d.ts.map +1 -1
  35. package/dist/types/action/action.types.d.ts +0 -14
  36. package/dist/types/action/action.types.d.ts.map +1 -1
  37. package/dist/types/checkpoint.d.ts +188 -0
  38. package/dist/types/checkpoint.d.ts.map +1 -0
  39. package/dist/types/context.d.ts +45 -11
  40. package/dist/types/context.d.ts.map +1 -1
  41. package/dist/types/dsl.types.d.ts.map +1 -1
  42. package/dist/types/errors.d.ts +77 -3
  43. package/dist/types/errors.d.ts.map +1 -1
  44. package/dist/types/index.d.ts +6 -7
  45. package/dist/types/index.d.ts.map +1 -1
  46. package/dist/types/resume-payload.d.ts +69 -0
  47. package/dist/types/resume-payload.d.ts.map +1 -0
  48. package/dist/types/runner-runtime-control.d.ts +63 -51
  49. package/dist/types/runner-runtime-control.d.ts.map +1 -1
  50. package/dist/types/step-executors/conditional-executor.d.ts +6 -3
  51. package/dist/types/step-executors/conditional-executor.d.ts.map +1 -1
  52. package/dist/types/step-executors/loop-executor.d.ts +6 -4
  53. package/dist/types/step-executors/loop-executor.d.ts.map +1 -1
  54. package/dist/types/step-executors/parallel-executor.d.ts +11 -3
  55. package/dist/types/step-executors/parallel-executor.d.ts.map +1 -1
  56. package/dist/types/step-executors/task-executor.d.ts +11 -4
  57. package/dist/types/step-executors/task-executor.d.ts.map +1 -1
  58. package/dist/types/step-executors/types.d.ts +21 -13
  59. package/dist/types/step-executors/types.d.ts.map +1 -1
  60. package/dist/types/utils/clone.d.ts +33 -0
  61. package/dist/types/utils/clone.d.ts.map +1 -0
  62. package/dist/types/workflow-event-emitter.d.ts +29 -5
  63. package/dist/types/workflow-event-emitter.d.ts.map +1 -1
  64. package/dist/types/workflow-fingerprint.d.ts +14 -0
  65. package/dist/types/workflow-fingerprint.d.ts.map +1 -0
  66. package/dist/types/workflow-runner.d.ts +83 -41
  67. package/dist/types/workflow-runner.d.ts.map +1 -1
  68. package/dist/types/workflow-types.d.ts +25 -54
  69. package/dist/types/workflow-types.d.ts.map +1 -1
  70. package/dist/types/workflow.d.ts +24 -9
  71. package/dist/types/workflow.d.ts.map +1 -1
  72. package/examples/defs-bindings-agent/bindings.ts +1 -1
  73. package/examples/defs-bindings-agent/workflow.ts +3 -2
  74. package/examples/full/actions/await-user-input.ts +3 -2
  75. package/examples/full/actions/call-llm.ts +18 -18
  76. package/examples/full/actions/create-ticket.ts +1 -2
  77. package/examples/full/actions/decision-router.ts +6 -2
  78. package/examples/full/actions/get-calendar-events.ts +1 -2
  79. package/examples/full/actions/get-user-profile.ts +1 -2
  80. package/examples/full/actions/query-memory.ts +1 -2
  81. package/examples/full/actions/search-web.ts +1 -2
  82. package/examples/full/actions/send-email.ts +3 -2
  83. package/examples/full/workflow.ts +3 -2
  84. package/examples/loop/actions/await-reply.ts +2 -7
  85. package/examples/loop/workflow.ts +4 -2
  86. package/examples/suspend-resume/actions/wait-for-user.ts +11 -9
  87. package/examples/suspend-resume/workflow.ts +51 -11
  88. package/package.json +3 -3
  89. package/src/__tests__/checkpoint.test.ts +2568 -0
  90. package/src/__tests__/resume-payload.test.ts +245 -0
  91. package/src/__tests__/runner-runtime-control.test.ts +265 -0
  92. package/src/__tests__/workflow-fingerprint.test.ts +165 -0
  93. package/src/__tests__/workflow-runner.test.ts +167 -144
  94. package/src/__tests__/workflow.test.ts +97 -6
  95. package/src/action/abstract-action.ts +21 -2
  96. package/src/action/action.types.ts +0 -12
  97. package/src/checkpoint.ts +561 -0
  98. package/src/context.ts +51 -41
  99. package/src/dsl.types.ts +3 -0
  100. package/src/errors.ts +161 -8
  101. package/src/index.ts +33 -14
  102. package/src/resume-payload.ts +326 -0
  103. package/src/runner-runtime-control.ts +222 -456
  104. package/src/step-executors/conditional-executor.test.ts +77 -46
  105. package/src/step-executors/conditional-executor.ts +47 -40
  106. package/src/step-executors/loop-executor.test.ts +106 -92
  107. package/src/step-executors/loop-executor.ts +84 -101
  108. package/src/step-executors/parallel-executor.test.ts +300 -89
  109. package/src/step-executors/parallel-executor.ts +243 -125
  110. package/src/step-executors/task-executor.test.ts +321 -51
  111. package/src/step-executors/task-executor.ts +232 -145
  112. package/src/step-executors/types.ts +23 -22
  113. package/src/utils/clone.ts +75 -0
  114. package/src/workflow-event-emitter.ts +32 -6
  115. package/src/workflow-fingerprint.ts +159 -0
  116. package/src/workflow-runner.ts +325 -209
  117. package/src/workflow-types.ts +25 -56
  118. package/src/workflow.ts +41 -34
  119. package/dist/cjs/step-executors/suspension-continuation.js +0 -27
  120. package/dist/cjs/suspension-rebuilder.js +0 -265
  121. package/dist/cjs/utils/deferred.js +0 -17
  122. package/dist/esm/step-executors/suspension-continuation.js +0 -24
  123. package/dist/esm/suspension-rebuilder.js +0 -260
  124. package/dist/esm/utils/deferred.js +0 -14
  125. package/dist/types/step-executors/suspension-continuation.d.ts +0 -10
  126. package/dist/types/step-executors/suspension-continuation.d.ts.map +0 -1
  127. package/dist/types/suspension-rebuilder.d.ts +0 -67
  128. package/dist/types/suspension-rebuilder.d.ts.map +0 -1
  129. package/dist/types/utils/deferred.d.ts +0 -7
  130. package/dist/types/utils/deferred.d.ts.map +0 -1
  131. package/src/__tests__/suspension-rebuilder.test.ts +0 -404
  132. package/src/step-executors/suspension-continuation.ts +0 -31
  133. package/src/suspension-rebuilder.ts +0 -446
  134. package/src/utils/deferred.ts +0 -23
@@ -1,6 +1,6 @@
1
+ import { type WorkflowCheckpoint } from './checkpoint';
1
2
  import { type BaseWorkflowContext, type StepExecutionRecord, type WorkflowRunStatus, type WorkflowSnapshot } from './context';
2
- import { type StepInfo } from './workflow-event-emitter';
3
- import type { CompiledWorkflow, ExecutionState, PersistedSuspension, ResumeResult, RunnerResumeArgs, RunnerStartArgs, StartResult, WorkflowRunOptions } from './workflow-types';
3
+ import type { CompiledWorkflow, ExecutionState, RunnerResumeArgs, RunnerStartArgs, WorkflowRunOptions, WorkflowRunResult } from './workflow-types';
4
4
  /**
5
5
  * Executes a compiled workflow definition, tracking state, suspensions, and event hooks.
6
6
  * Create a new instance per execution to avoid leaking state between runs.
@@ -11,10 +11,8 @@ export declare class WorkflowRunner {
11
11
  private status;
12
12
  private snapshots;
13
13
  private stepLog;
14
- private suspension?;
14
+ private checkpoint?;
15
15
  private runtimeControl?;
16
- private currentStep?;
17
- private lastResumeData?;
18
16
  private state?;
19
17
  private context?;
20
18
  /**
@@ -49,17 +47,12 @@ export declare class WorkflowRunner {
49
47
  */
50
48
  getStepLog(): Record<string, StepExecutionRecord>;
51
49
  /**
52
- * Read the step currently being executed.
50
+ * Read the checkpoint of a suspended run: everything a host must persist to
51
+ * resume it later, in this process or another one. Treat it as read-only.
53
52
  *
54
- * @returns Metadata for the in-flight step, if any.
53
+ * @returns The checkpoint while the run is suspended, otherwise undefined.
55
54
  */
56
- getCurrentStep(): StepInfo | undefined;
57
- /**
58
- * Access the last payload supplied to a resume call.
59
- *
60
- * @returns The most recent resume data, or undefined if none.
61
- */
62
- getLastResumeData(): unknown;
55
+ getCheckpoint(): WorkflowCheckpoint | undefined;
63
56
  /**
64
57
  * Begin executing the workflow from the first step.
65
58
  * Returns a status object describing whether execution finished, suspended, or failed.
@@ -67,36 +60,85 @@ export declare class WorkflowRunner {
67
60
  * @param args Input payload and context to seed execution.
68
61
  * @returns Execution result including status and snapshot.
69
62
  */
70
- start(args: RunnerStartArgs): Promise<StartResult>;
63
+ start(args: RunnerStartArgs): Promise<WorkflowRunResult>;
64
+ /**
65
+ * Resume a suspended workflow by satisfying one of its open waits.
66
+ *
67
+ * Execution re-enters the checkpoint's frames: completed work is skipped,
68
+ * the resolved step re-runs its action body, and waits left untouched stay
69
+ * parked.
70
+ *
71
+ * A payload the wait does not accept is refused, first against the wait's
72
+ * `accepts` JSON Schema without running anything, then by the action body.
73
+ * Either way the result is suspended on the same waits and carries
74
+ * `rejection`, and the checkpoint, snapshot and step log are left as they
75
+ * were. Events a refusing body emitted are not withdrawn, and its side
76
+ * effects, including writes to context state, are not undone.
77
+ *
78
+ * @param args Resume payload and, when several waits are open, the wait it satisfies.
79
+ * @returns Execution result including status and snapshot.
80
+ * @throws {WorkflowWaitNotFoundError} When `waitId` is not an open wait.
81
+ * @throws {WorkflowWaitAmbiguousError} When several waits are open and no
82
+ * `waitId` is given.
83
+ */
84
+ resume(args: RunnerResumeArgs): Promise<WorkflowRunResult>;
71
85
  /**
72
- * Resume a previously suspended workflow using the supplied resume data.
86
+ * Run the pass that resolves one wait with an accepted payload.
73
87
  *
74
- * @param args Data provided to resume the suspended step.
88
+ * @param wait The wait being resolved.
89
+ * @param recorded The payload as the checkpoint records it.
75
90
  * @returns Execution result including status and snapshot.
76
91
  */
77
- resume(args: RunnerResumeArgs): Promise<ResumeResult>;
92
+ private resolveWait;
78
93
  /**
79
- * Execute the provided workflow operation and normalize suspension, finish, and failure handling.
94
+ * Run the flow from the top, or from a checkpoint, and normalize
95
+ * suspension, finish, and failure handling.
80
96
  *
81
- * @param execute Function that advances workflow execution and may return a suspension.
97
+ * @param resolutions Resume payloads for the waits this pass satisfies.
98
+ * @param resumed Suspended run to resume from; omitted on start.
82
99
  * @returns Result of the execution attempt.
83
100
  */
84
101
  private runExecution;
85
102
  /**
86
- * Rebuild a runner from persisted state, allowing hosts to resume after restarts.
103
+ * Leave the run suspended on `checkpoint` after a resume payload was
104
+ * refused.
87
105
  *
88
- * @param compiled The compiled workflow definition.
89
- * @param options Persisted state and metadata needed to rebuild the runner.
90
- * @returns A runner positioned to continue from the prior suspension or status.
106
+ * @param checkpoint The checkpoint the run was suspended on.
107
+ * @param rejection The refused wait and why.
108
+ * @returns The suspended result, carrying the rejection.
91
109
  */
92
- static fromPersistedState(compiled: CompiledWorkflow, options: {
93
- state: ExecutionState;
110
+ private keepWaiting;
111
+ /**
112
+ * Snapshot the suspended run as a detached JSON checkpoint.
113
+ *
114
+ * The checkpoint goes through the same JSON round trip a host applies when
115
+ * persisting it, so a resumed run sees the same values in process and
116
+ * after a restore.
117
+ *
118
+ * @param state Root execution state at suspension time.
119
+ * @param root Frame returned by the top-level flow.
120
+ * @returns The checkpoint to hand to the host.
121
+ * @throws When the run's state cannot be encoded as JSON.
122
+ */
123
+ private buildCheckpoint;
124
+ /**
125
+ * Restore a suspended run from its persisted checkpoint, typically in a
126
+ * different process than the one that suspended it.
127
+ *
128
+ * @param compiled The compiled workflow definition.
129
+ * @param options.checkpoint Checkpoint returned when the run suspended.
130
+ * @param options.context Freshly hydrated workflow context.
131
+ * @param options.snapshot Persisted action snapshot, to keep reporting past steps.
132
+ * @param options.runId Run identifier propagated through events.
133
+ * @returns A suspended runner ready for {@link resume}.
134
+ * @throws {WorkflowResumeError} When the checkpoint cannot resume against `compiled`.
135
+ */
136
+ static fromCheckpoint(compiled: CompiledWorkflow, options: {
137
+ checkpoint: unknown;
94
138
  context: BaseWorkflowContext;
95
- snapshot: WorkflowSnapshot;
96
- suspension?: PersistedSuspension;
139
+ snapshot?: WorkflowSnapshot;
97
140
  runId?: string;
98
- lastResumeData?: unknown;
99
- }): Promise<WorkflowRunner>;
141
+ }): WorkflowRunner;
100
142
  /**
101
143
  * Emit an event if an emitter is provided.
102
144
  *
@@ -138,24 +180,22 @@ export declare class WorkflowRunner {
138
180
  /**
139
181
  * Construct the environment object passed to step executors.
140
182
  *
183
+ * @param pass The execution pass, shared by every scope it forks.
184
+ * @param overrides Scope-specific replacements, e.g. for a parallel branch.
141
185
  * @returns A step executor environment bound to this runner.
142
- * @throws When the workflow context is missing.
186
+ * @throws When the workflow context or runtime control is missing.
143
187
  */
144
188
  private createExecutorEnv;
145
189
  /**
146
- * Build dependencies used to reconstruct a suspension from persisted state.
147
- *
148
- * @returns Dependency bag for suspension rebuilders.
149
- */
150
- private createSuspensionRebuilderDeps;
151
- /**
152
- * Walk a list of compiled steps, threading state and returning a suspension when encountered.
190
+ * Walk a list of compiled steps, threading state and returning a frame when
191
+ * one of them suspends.
153
192
  *
154
193
  * @param steps The steps to execute sequentially.
155
194
  * @param state Mutable execution state shared across steps.
156
195
  * @param path Path tokens leading to the current step for tracing.
157
- * @param startIndex Index to resume from within the flow.
158
- * @returns A suspension if execution pauses, otherwise void.
196
+ * @param frame Frame of a previous suspension within these steps.
197
+ * @param env Executor environment of the current scope.
198
+ * @returns A frame if execution pauses, otherwise void.
159
199
  */
160
200
  private executeFlow;
161
201
  /**
@@ -164,7 +204,9 @@ export declare class WorkflowRunner {
164
204
  * @param step The step to run.
165
205
  * @param state The shared execution state.
166
206
  * @param path Tokens describing the location of the step in the workflow.
167
- * @returns A suspension if the step pauses execution, otherwise void.
207
+ * @param frame Frame of a previous suspension of this step.
208
+ * @param env Executor environment of the current scope.
209
+ * @returns A frame if the step pauses execution, otherwise void.
168
210
  */
169
211
  private executeStep;
170
212
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-runner.d.ts","sourceRoot":"","sources":["../../src/workflow-runner.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAgBnB,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAGV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EAEX,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B;;;GAGG;AACH,qBAAa,cAAc;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAG5C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAGhC,OAAO,CAAC,MAAM,CAA8C;IAG5D,OAAO,CAAC,SAAS,CAAsC;IAGvD,OAAO,CAAC,OAAO,CAA2C;IAG1D,OAAO,CAAC,UAAU,CAAC,CAAa;IAGhC,OAAO,CAAC,cAAc,CAAC,CAAuB;IAG9C,OAAO,CAAC,WAAW,CAAC,CAAW;IAG/B,OAAO,CAAC,cAAc,CAAC,CAAU;IAGjC,OAAO,CAAC,KAAK,CAAC,CAAiB;IAG/B,OAAO,CAAC,OAAO,CAAC,CAAsB;IAEtC;;;;;OAKG;gBACS,QAAQ,EAAE,gBAAgB,EAAE,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;;;;;;;;;;OAmBG;IACG,MAAM,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA6BhE;;;;;;OAMG;YACW,WAAW;IAuBzB;;;;;;;OAOG;YACW,YAAY;IAuF1B;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW;IAgBnB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,cAAc,CACnB,QAAQ,EAAE,gBAAgB,EAC1B,OAAO,EAAE;QACP,UAAU,EAAE,OAAO,CAAC;QACpB,OAAO,EAAE,mBAAmB,CAAC;QAC7B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GACA,cAAc;IA0BjB;;;;;OAKG;IACH,OAAO,CAAC,IAAI;IAOZ;;;;;;OAMG;YACW,uBAAuB;IAYrC;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IASpB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IAkC3B;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IAiDzB;;;;;;;;;;OAUG;YACW,WAAW;IAmCzB;;;;;;;;;OASG;YACW,WAAW;IAkCzB;;;;;;OAMG;YACW,iBAAiB;CAOhC"}
@@ -2,9 +2,11 @@ import type { Expression, Focus } from 'jsonata';
2
2
  import type { ZodType } from 'zod';
3
3
  import type { Action } from './action/action.types';
4
4
  import type { CompiledTaskBindings } from './bindings/base-binding';
5
+ import type { WaitInfo, WorkflowCheckpoint } from './checkpoint';
5
6
  import type { BaseWorkflowContext, WorkflowSnapshot } from './context';
6
7
  import type { Settings, TaskDefinition, WorkflowDefinition } from './dsl.types';
7
- import { StepType, type StepInfo } from './workflow-event-emitter';
8
+ import type { WorkflowResumeRejectedError } from './errors';
9
+ import { StepType } from './workflow-event-emitter';
8
10
  export type { CompiledTaskBindings } from './bindings/base-binding';
9
11
  /** Custom function callable from JSONata expressions. */
10
12
  export type JsonataFunctionImplementation = (this: Focus, ...args: any[]) => unknown;
@@ -132,62 +134,31 @@ export type ExecutionState = {
132
134
  accumulator?: unknown;
133
135
  iterationStack: number[];
134
136
  };
135
- /** Encapsulates a suspended step and how to continue it. */
136
- export type Suspension = {
137
- step: StepInfo;
138
- reason?: string;
139
- data?: unknown;
140
- stepExecId?: string;
141
- suspendIndex?: number;
142
- suspendKey?: string;
143
- awaitResults?: Record<string, unknown>;
144
- continue: (resumeData: unknown) => Promise<Suspension | void>;
145
- };
146
- export type PersistedSuspension = {
147
- stepId: string;
148
- reason?: string | null;
149
- data?: unknown;
150
- stepExecId?: string;
151
- suspendIndex?: number;
152
- suspendKey?: string;
153
- awaitResults?: Record<string, unknown>;
154
- };
155
- /** Result of starting a workflow run. */
156
- export type StartResult = {
157
- status: 'finished';
158
- output: Record<string, unknown>;
159
- snapshot: WorkflowSnapshot;
160
- } | {
137
+ /** Result of a run that paused on one or more open waits. */
138
+ export type SuspendedResult = {
161
139
  status: 'suspended';
162
- step: StepInfo;
163
- reason?: string;
164
- data?: unknown;
165
- stepExecId?: string;
166
- suspendIndex?: number;
167
- suspendKey?: string;
168
- awaitResults?: Record<string, unknown>;
140
+ /** Open waits, in flow order; resume one of them by `waitId`. */
141
+ waits: WaitInfo[];
142
+ /** Everything a host must persist to resume the run later. */
143
+ checkpoint: WorkflowCheckpoint;
169
144
  snapshot: WorkflowSnapshot;
170
- } | {
171
- status: 'failed';
172
- error: unknown;
173
- snapshot: WorkflowSnapshot;
174
- };
175
- /** Result of resuming a suspended workflow. */
176
- export type ResumeResult = {
145
+ /**
146
+ * Set when this resume was refused: the run and its checkpoint are exactly
147
+ * as they were, and the wait is still open under the same `waitId`.
148
+ */
149
+ rejection?: ResumeRejection;
150
+ };
151
+ /** A resume payload that was refused. */
152
+ export type ResumeRejection = {
153
+ waitId: string;
154
+ error: WorkflowResumeRejectedError;
155
+ };
156
+ /** Where a run stopped: the result of both `start()` and `resume()`. */
157
+ export type WorkflowRunResult = {
177
158
  status: 'finished';
178
159
  output: Record<string, unknown>;
179
160
  snapshot: WorkflowSnapshot;
180
- } | {
181
- status: 'suspended';
182
- step: StepInfo;
183
- reason?: string;
184
- data?: unknown;
185
- stepExecId?: string;
186
- suspendIndex?: number;
187
- suspendKey?: string;
188
- awaitResults?: Record<string, unknown>;
189
- snapshot: WorkflowSnapshot;
190
- } | {
161
+ } | SuspendedResult | {
191
162
  status: 'failed';
192
163
  error: unknown;
193
164
  snapshot: WorkflowSnapshot;
@@ -196,8 +167,6 @@ export type ResumeResult = {
196
167
  export type WorkflowRunOptions = {
197
168
  runId?: string;
198
169
  };
199
- export type WorkflowStartResult = StartResult;
200
- export type WorkflowResumeResult = ResumeResult;
201
170
  /** Arguments required to start a run. */
202
171
  export type RunnerStartArgs = {
203
172
  inputData: unknown;
@@ -206,5 +175,7 @@ export type RunnerStartArgs = {
206
175
  /** Payload passed when resuming a suspended run. */
207
176
  export type RunnerResumeArgs = {
208
177
  resumeData?: unknown;
178
+ /** Wait to satisfy; required only when the run has several open waits. */
179
+ waitId?: string;
209
180
  };
210
181
  //# sourceMappingURL=workflow-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-types.d.ts","sourceRoot":"","sources":["../../src/workflow-types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAA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iE;IACjE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,8DAA8D;IAC9D,UAAU,EAAE,kBAAkB,CAAC;IAC/B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,2BAA2B,CAAC;CACpC,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GACzB;IACE,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,GACD,eAAe,GACf;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAErE,8DAA8D;AAC9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,yCAAyC;AACzC,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,mBAAmB,CAAC;CAC9B,CAAC;AAEF,oDAAoD;AACpD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
@@ -1,12 +1,13 @@
1
+ import { type CheckpointValidationResult } from './checkpoint';
1
2
  import { type BaseWorkflowContext, type WorkflowSnapshot } from './context';
2
3
  import { WorkflowDefinition, type FlowStep } from './dsl.types';
3
4
  import { type WorkflowCompileOptions } from './workflow-compiler';
4
5
  import { WorkflowRunner } from './workflow-runner';
5
- import type { ExecutionState, PersistedSuspension, WorkflowRunOptions } from './workflow-types';
6
+ import type { WorkflowRunOptions } from './workflow-types';
6
7
  export { compileWorkflow } from './workflow-compiler';
7
8
  export { WorkflowEventEmitter } from './workflow-event-emitter';
8
9
  export { WorkflowRunner } from './workflow-runner';
9
- export type { WorkflowResumeResult, WorkflowRunOptions, WorkflowStartResult, } from './workflow-types';
10
+ export type { WorkflowRunOptions, WorkflowRunResult } from './workflow-types';
10
11
  export type { WorkflowCompileOptions } from './workflow-compiler';
11
12
  export type FlowStepPath = Array<string | number>;
12
13
  /**
@@ -61,15 +62,29 @@ export declare class Workflow {
61
62
  */
62
63
  buildAsyncRunner(options?: WorkflowRunOptions): Promise<WorkflowRunner>;
63
64
  /**
64
- * Rebuild a runner from persisted state and snapshot, useful after restarts.
65
+ * Decide whether a persisted checkpoint can resume against this workflow,
66
+ * without running anything. Call it before claiming a wait.
67
+ *
68
+ * @param checkpoint The checkpoint, as persisted.
69
+ * @param options.waitId Wait the caller is about to resume.
70
+ * @param options.resumeData Payload the caller is about to resume with,
71
+ * checked against what the wait accepts when the key is present.
72
+ * @returns The parsed checkpoint, or the typed reason it cannot resume.
65
73
  */
66
- buildRunnerFromState(options: {
67
- state: ExecutionState;
74
+ validateCheckpoint(checkpoint: unknown, options?: {
75
+ waitId?: string;
76
+ resumeData?: unknown;
77
+ }): CheckpointValidationResult;
78
+ /**
79
+ * Restore a suspended runner from its persisted checkpoint, useful after restarts.
80
+ *
81
+ * @throws {WorkflowResumeError} When the checkpoint cannot resume against this workflow.
82
+ */
83
+ buildRunnerFromCheckpoint(options: {
84
+ checkpoint: unknown;
68
85
  context: BaseWorkflowContext;
69
- snapshot: WorkflowSnapshot;
70
- suspension?: PersistedSuspension;
86
+ snapshot?: WorkflowSnapshot;
71
87
  runId?: string;
72
- lastResumeData?: unknown;
73
- }): Promise<WorkflowRunner>;
88
+ }): WorkflowRunner;
74
89
  }
75
90
  //# sourceMappingURL=workflow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../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ClB,SAAS,EAAE,OAAO,GACjB,CAAC;IAgCJ;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACrB,UAAU,EAAE,kBAAkB,EAC9B,QAAQ,EAAE,YAAY,GACrB,kBAAkB,GAAG,IAAI;IA4D5B;;OAEG;IACH,MAAM,CAAC,gBAAgB,CACrB,UAAU,EAAE,kBAAkB,EAC9B,UAAU,EAAE,YAAY,EACxB,IAAI,EAAE,QAAQ,GACb,kBAAkB,GAAG,IAAI;IA0B5B;;OAEG;IACH,MAAM,CAAC,0BAA0B,CAC/B,UAAU,EAAE,kBAAkB,EAC9B,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,kBAAkB;IAIrB;;;OAGG;IACG,GAAG,CACP,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAqBnC;;OAEG;IACG,gBAAgB,CACpB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,cAAc,CAAC;IAI1B;;;;;;;;;OASG;IACH,kBAAkB,CAChB,UAAU,EAAE,OAAO,EACnB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAClD,0BAA0B;IAI7B;;;;OAIG;IACH,yBAAyB,CAAC,OAAO,EAAE;QACjC,UAAU,EAAE,OAAO,CAAC;QACpB,OAAO,EAAE,mBAAmB,CAAC;QAC7B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;QAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,cAAc;CAGnB"}
@@ -11,7 +11,7 @@ import type { InferWorkflowBindings } from '../../src';
11
11
  export const bindingKinds = {
12
12
  tools: {
13
13
  schema: z.record(z.string(), z.unknown()),
14
- multiple: true,
14
+ multiple: true as const,
15
15
  actionPolicy: 'required' as const,
16
16
  supportedBindings: ['tools'],
17
17
  },
@@ -52,9 +52,10 @@ async function main() {
52
52
  }
53
53
 
54
54
  if (result.status === 'suspended') {
55
+ const [wait] = result.waits;
55
56
  console.log(
56
- `Workflow suspended at step ${result.step.id} for reason "${result.reason}"`,
57
- result.data,
57
+ `Workflow suspended at step ${wait.step.id} for reason "${wait.reason}"`,
58
+ wait.data,
58
59
  );
59
60
 
60
61
  return;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -18,7 +17,9 @@ const outputSchema = z.object({
18
17
  text: z.string().optional(),
19
18
  attachments: z.array(z.string()).optional(),
20
19
  });
21
- const settingsSchema = SettingsSchema;
20
+ const settingsSchema = z.strictObject({
21
+ await_user: z.boolean().optional(),
22
+ });
22
23
 
23
24
  type AwaitUserInput = z.infer<typeof inputSchema>;
24
25
  type AwaitUserOutput = z.infer<typeof outputSchema>;
@@ -7,26 +7,26 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
- const inputSchema = z.record(z.any());
14
- const outputSchema = z
15
- .object({
16
- intent: z.string().optional(),
17
- confidence: z.number().optional(),
18
- summary: z.string().optional(),
19
- missing_fields: z.array(z.string()).optional(),
20
- needs_human: z.boolean().optional(),
21
- synthesis: z.string().optional(),
22
- questions: z.array(z.string()).optional(),
23
- message: z.string().optional(),
24
- links: z.array(z.string()).optional(),
25
- email: z.string().optional(),
26
- cta: z.string().optional(),
27
- })
28
- .passthrough();
29
- const settingsSchema = SettingsSchema;
12
+ const inputSchema = z.record(z.string(), z.any());
13
+ const outputSchema = z.looseObject({
14
+ intent: z.string().optional(),
15
+ confidence: z.number().optional(),
16
+ summary: z.string().optional(),
17
+ missing_fields: z.array(z.string()).optional(),
18
+ needs_human: z.boolean().optional(),
19
+ synthesis: z.string().optional(),
20
+ questions: z.array(z.string()).optional(),
21
+ message: z.string().optional(),
22
+ links: z.array(z.string()).optional(),
23
+ email: z.string().optional(),
24
+ cta: z.string().optional(),
25
+ });
26
+ const settingsSchema = z.strictObject({
27
+ model: z.string().optional(),
28
+ temperature: z.number().optional(),
29
+ });
30
30
 
31
31
  type CallLlmInput = z.infer<typeof inputSchema>;
32
32
  type CallLlmOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -20,7 +19,7 @@ const outputSchema = z.object({
20
19
  ticket_id: z.string(),
21
20
  status: z.string(),
22
21
  });
23
- const settingsSchema = SettingsSchema;
22
+ const settingsSchema = z.strictObject({});
24
23
 
25
24
  type CreateTicketInput = z.infer<typeof inputSchema>;
26
25
  type CreateTicketOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -25,7 +24,12 @@ const outputSchema = z.object({
25
24
  ]),
26
25
  explanation: z.string(),
27
26
  });
28
- const settingsSchema = SettingsSchema;
27
+ const settingsSchema = z.strictObject({
28
+ branches: z
29
+ .array(z.object({ when: z.string(), next: z.string() }))
30
+ .optional(),
31
+ default_next: z.string().optional(),
32
+ });
29
33
 
30
34
  type DecisionRouterInput = z.infer<typeof inputSchema>;
31
35
  type DecisionRouterOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -22,7 +21,7 @@ const outputSchema = z.object({
22
21
  }),
23
22
  ),
24
23
  });
25
- const settingsSchema = SettingsSchema;
24
+ const settingsSchema = z.strictObject({});
26
25
 
27
26
  type GetCalendarEventsInput = z.infer<typeof inputSchema>;
28
27
  type GetCalendarEventsOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const stakeholderSchema = z.object({
@@ -29,7 +28,7 @@ const outputSchema = z.object({
29
28
  }),
30
29
  recent_cases: z.array(z.object({ id: z.string(), subject: z.string() })),
31
30
  });
32
- const settingsSchema = SettingsSchema;
31
+ const settingsSchema = z.strictObject({});
33
32
 
34
33
  type GetUserProfileInput = z.infer<typeof inputSchema>;
35
34
  type GetUserProfileOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -17,7 +16,7 @@ const inputSchema = z.object({
17
16
  const outputSchema = z.object({
18
17
  summary: z.string(),
19
18
  });
20
- const settingsSchema = SettingsSchema;
19
+ const settingsSchema = z.strictObject({});
21
20
 
22
21
  type QueryMemoryInput = z.infer<typeof inputSchema>;
23
22
  type QueryMemoryOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -18,7 +17,7 @@ const outputSchema = z.object({
18
17
  links: z.array(z.string()),
19
18
  snippets: z.array(z.string()),
20
19
  });
21
- const settingsSchema = SettingsSchema;
20
+ const settingsSchema = z.strictObject({});
22
21
 
23
22
  type SearchWebInput = z.infer<typeof inputSchema>;
24
23
  type SearchWebOutput = z.infer<typeof outputSchema>;
@@ -7,7 +7,6 @@
7
7
  import { z } from 'zod';
8
8
 
9
9
  import { defineAction } from '../../../src';
10
- import { SettingsSchema } from '../../../src/dsl.types';
11
10
  import type { ExampleContext } from '../context';
12
11
 
13
12
  const inputSchema = z.object({
@@ -20,7 +19,9 @@ const outputSchema = z.object({
20
19
  status: z.string(),
21
20
  acknowledged: z.boolean().optional(),
22
21
  });
23
- const settingsSchema = SettingsSchema;
22
+ const settingsSchema = z.strictObject({
23
+ track_opens: z.boolean().optional(),
24
+ });
24
25
 
25
26
  type SendEmailInput = z.infer<typeof inputSchema>;
26
27
  type SendEmailOutput = z.infer<typeof outputSchema>;
@@ -60,9 +60,10 @@ async function main() {
60
60
  }
61
61
 
62
62
  if (result.status === 'suspended') {
63
+ const [wait] = result.waits;
63
64
  console.log(
64
- `Workflow suspended at step ${result.step.id} for reason "${result.reason}"`,
65
- result.data,
65
+ `Workflow suspended at step ${wait.step.id} for reason "${wait.reason}"`,
66
+ wait.data,
66
67
  );
67
68
 
68
69
  return;