@hexabot-ai/agentic 3.0.2-alpha.0 → 3.1.0-alpha.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.
@@ -19,7 +19,6 @@ class AbstractAction {
19
19
  * Sets up core metadata and schemas for the action.
20
20
  *
21
21
  * @param metadata - Describes the action name, description, and schemas.
22
- * @param options - Optional configuration or definition override.
23
22
  */
24
23
  constructor(metadata) {
25
24
  if (metadata.settingsSchema instanceof zod_1.z.ZodObject) {
@@ -59,7 +58,6 @@ class AbstractAction {
59
58
  * Executes the action with retry, timeout, and schema safety.
60
59
  *
61
60
  * @param payload - Raw input being provided to the action.
62
- * @param context - Workflow context used during execution.
63
61
  * @returns Validated output produced by the action.
64
62
  * @throws Error when retries are exhausted or validation fails.
65
63
  */
@@ -5,7 +5,30 @@
5
5
  * Full terms: see LICENSE.md.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.BaseWorkflowContext = void 0;
8
+ exports.BaseWorkflowContext = exports.WORKFLOW_RUN_STATUSES = exports.EWorkflowRunStatus = void 0;
9
+ /**
10
+ * Lifecycle of a workflow run:
11
+ * - idle: runner constructed but `start` not invoked.
12
+ * - running: set when `start` or `resume` begins executing steps.
13
+ * - suspended: an action awaited `workflow.suspend`; `resume` moves back to running.
14
+ * - finished: all steps completed and outputs were evaluated successfully.
15
+ * - failed: an uncaught error bubbled out of a step or continuation.
16
+ */
17
+ var EWorkflowRunStatus;
18
+ (function (EWorkflowRunStatus) {
19
+ EWorkflowRunStatus["IDLE"] = "idle";
20
+ EWorkflowRunStatus["RUNNING"] = "running";
21
+ EWorkflowRunStatus["SUSPENDED"] = "suspended";
22
+ EWorkflowRunStatus["FINISHED"] = "finished";
23
+ EWorkflowRunStatus["FAILED"] = "failed";
24
+ })(EWorkflowRunStatus || (exports.EWorkflowRunStatus = EWorkflowRunStatus = {}));
25
+ exports.WORKFLOW_RUN_STATUSES = [
26
+ EWorkflowRunStatus.IDLE,
27
+ EWorkflowRunStatus.RUNNING,
28
+ EWorkflowRunStatus.SUSPENDED,
29
+ EWorkflowRunStatus.FINISHED,
30
+ EWorkflowRunStatus.FAILED,
31
+ ];
9
32
  /**
10
33
  * Base context that is threaded through every workflow execution.
11
34
  *
package/dist/cjs/index.js CHANGED
@@ -19,13 +19,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
19
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.withTimeout = exports.sleep = exports.toSnakeCase = exports.isSnakeCaseName = exports.assertSnakeCaseName = exports.createDeferred = exports.mergeSettings = exports.evaluateValue = exports.evaluateMapping = exports.compileValue = exports.NonDeterministicWorkflowError = exports.StepType = exports.WorkflowRunner = exports.WorkflowEventEmitter = exports.Workflow = exports.compileWorkflow = exports.BaseWorkflowContext = exports.defineAction = exports.AbstractAction = void 0;
22
+ exports.withTimeout = exports.sleep = exports.toSnakeCase = exports.isSnakeCaseName = exports.assertSnakeCaseName = exports.createDeferred = exports.mergeSettings = exports.evaluateValue = exports.evaluateMapping = exports.compileValue = exports.NonDeterministicWorkflowError = exports.StepType = exports.WorkflowRunner = exports.WorkflowEventEmitter = exports.Workflow = exports.compileWorkflow = exports.WORKFLOW_RUN_STATUSES = exports.EWorkflowRunStatus = exports.BaseWorkflowContext = exports.defineAction = exports.AbstractAction = void 0;
23
23
  var abstract_action_1 = require("./action/abstract-action");
24
24
  Object.defineProperty(exports, "AbstractAction", { enumerable: true, get: function () { return abstract_action_1.AbstractAction; } });
25
25
  var action_1 = require("./action/action");
26
26
  Object.defineProperty(exports, "defineAction", { enumerable: true, get: function () { return action_1.defineAction; } });
27
27
  var context_1 = require("./context");
28
28
  Object.defineProperty(exports, "BaseWorkflowContext", { enumerable: true, get: function () { return context_1.BaseWorkflowContext; } });
29
+ Object.defineProperty(exports, "EWorkflowRunStatus", { enumerable: true, get: function () { return context_1.EWorkflowRunStatus; } });
30
+ Object.defineProperty(exports, "WORKFLOW_RUN_STATUSES", { enumerable: true, get: function () { return context_1.WORKFLOW_RUN_STATUSES; } });
29
31
  __exportStar(require("./dsl.types"), exports);
30
32
  var workflow_1 = require("./workflow");
31
33
  Object.defineProperty(exports, "compileWorkflow", { enumerable: true, get: function () { return workflow_1.compileWorkflow; } });
@@ -6,6 +6,7 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.WorkflowRunner = void 0;
9
+ const context_1 = require("./context");
9
10
  const runner_runtime_control_1 = require("./runner-runtime-control");
10
11
  const conditional_executor_1 = require("./step-executors/conditional-executor");
11
12
  const loop_executor_1 = require("./step-executors/loop-executor");
@@ -27,7 +28,7 @@ class WorkflowRunner {
27
28
  */
28
29
  constructor(compiled, options) {
29
30
  // Current lifecycle status of the workflow execution.
30
- this.status = 'idle';
31
+ this.status = context_1.EWorkflowRunStatus.IDLE;
31
32
  // Snapshots of action execution keyed by step id for inspection/resume.
32
33
  this.snapshots = {};
33
34
  // Detailed execution records for each task step, used by UI/telemetry.
@@ -101,7 +102,7 @@ class WorkflowRunner {
101
102
  * @returns Execution result including status and snapshot.
102
103
  */
103
104
  async start(args) {
104
- this.status = 'running';
105
+ this.status = context_1.EWorkflowRunStatus.RUNNING;
105
106
  this.snapshots = {};
106
107
  this.stepLog = {};
107
108
  this.suspension = undefined;
@@ -129,13 +130,13 @@ class WorkflowRunner {
129
130
  * @returns Execution result including status and snapshot.
130
131
  */
131
132
  async resume(args) {
132
- if (this.status !== 'suspended' || !this.suspension) {
133
+ if (this.status !== context_1.EWorkflowRunStatus.SUSPENDED || !this.suspension) {
133
134
  throw new Error('Cannot resume a workflow that is not suspended.');
134
135
  }
135
136
  if (!this.context || !this.state) {
136
137
  throw new Error('Workflow state is not initialized.');
137
138
  }
138
- this.status = 'running';
139
+ this.status = context_1.EWorkflowRunStatus.RUNNING;
139
140
  this.lastResumeData = args.resumeData;
140
141
  const suspension = this.suspension;
141
142
  return this.runExecution(() => suspension.continue(args.resumeData));
@@ -151,7 +152,7 @@ class WorkflowRunner {
151
152
  const suspension = await execute();
152
153
  if (suspension) {
153
154
  this.suspension = suspension;
154
- this.status = 'suspended';
155
+ this.status = context_1.EWorkflowRunStatus.SUSPENDED;
155
156
  this.emit('hook:workflow:suspended', {
156
157
  runId: this.runId,
157
158
  step: suspension.step,
@@ -159,7 +160,7 @@ class WorkflowRunner {
159
160
  data: suspension.data,
160
161
  });
161
162
  return {
162
- status: 'suspended',
163
+ status: context_1.EWorkflowRunStatus.SUSPENDED,
163
164
  step: suspension.step,
164
165
  reason: suspension.reason,
165
166
  data: suspension.data,
@@ -171,7 +172,7 @@ class WorkflowRunner {
171
172
  };
172
173
  }
173
174
  const output = await this.evaluateWorkflowOutputs();
174
- this.status = 'finished';
175
+ this.status = context_1.EWorkflowRunStatus.FINISHED;
175
176
  this.suspension = undefined;
176
177
  this.currentStep = undefined;
177
178
  this.emit('hook:workflow:finish', { runId: this.runId, output });
@@ -179,14 +180,22 @@ class WorkflowRunner {
179
180
  throw new Error('Workflow context is not attached.');
180
181
  }
181
182
  this.context.attachWorkflowRuntime(undefined);
182
- return { status: 'finished', output, snapshot: this.getSnapshot() };
183
+ return {
184
+ status: context_1.EWorkflowRunStatus.FINISHED,
185
+ output,
186
+ snapshot: this.getSnapshot(),
187
+ };
183
188
  }
184
189
  catch (error) {
185
- this.status = 'failed';
190
+ this.status = context_1.EWorkflowRunStatus.FAILED;
186
191
  this.currentStep = undefined;
187
192
  this.emit('hook:workflow:failure', { runId: this.runId, error });
188
193
  this.context?.attachWorkflowRuntime(undefined);
189
- return { status: 'failed', error, snapshot: this.getSnapshot() };
194
+ return {
195
+ status: context_1.EWorkflowRunStatus.FAILED,
196
+ error,
197
+ snapshot: this.getSnapshot(),
198
+ };
190
199
  }
191
200
  }
192
201
  /**
@@ -210,7 +219,7 @@ class WorkflowRunner {
210
219
  runner.context = options.context;
211
220
  runner.snapshots = options.snapshot.actions ?? {};
212
221
  runner.stepLog = {};
213
- runner.status = options.snapshot.status ?? 'idle';
222
+ runner.status = options.snapshot.status ?? context_1.EWorkflowRunStatus.IDLE;
214
223
  runner.lastResumeData = options.lastResumeData;
215
224
  runner.runtimeControl = new runner_runtime_control_1.RunnerRuntimeControl(runner);
216
225
  options.context.attachWorkflowRuntime(runner.runtimeControl);
@@ -229,7 +238,7 @@ class WorkflowRunner {
229
238
  throw new Error(`Unable to rebuild suspension for step ${options.suspension.stepId}`);
230
239
  }
231
240
  runner.suspension = suspension;
232
- runner.status = 'suspended';
241
+ runner.status = context_1.EWorkflowRunStatus.SUSPENDED;
233
242
  }
234
243
  return runner;
235
244
  }
@@ -436,7 +445,7 @@ class WorkflowRunner {
436
445
  }
437
446
  /**
438
447
  * Store the raw task result under the task name in the workflow output state.
439
- * @reviewed
448
+ *
440
449
  * @param task The task whose output is being captured.
441
450
  * @param state Current execution state to mutate.
442
451
  * @param result Raw result returned by the task action.
@@ -7,6 +7,7 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.Workflow = exports.WorkflowRunner = exports.WorkflowEventEmitter = exports.compileWorkflow = void 0;
9
9
  const yaml_1 = require("yaml");
10
+ const context_1 = require("./context");
10
11
  const dsl_types_1 = require("./dsl.types");
11
12
  const workflow_definition_1 = require("./utils/workflow-definition");
12
13
  const workflow_compiler_1 = require("./workflow-compiler");
@@ -213,10 +214,10 @@ class Workflow {
213
214
  inputData,
214
215
  context,
215
216
  });
216
- if (result.status === 'finished') {
217
+ if (result.status === context_1.EWorkflowRunStatus.FINISHED) {
217
218
  return result.output;
218
219
  }
219
- if (result.status === 'failed') {
220
+ if (result.status === context_1.EWorkflowRunStatus.FAILED) {
220
221
  throw result.error instanceof Error
221
222
  ? result.error
222
223
  : new Error(String(result.error));
@@ -16,7 +16,6 @@ export class AbstractAction {
16
16
  * Sets up core metadata and schemas for the action.
17
17
  *
18
18
  * @param metadata - Describes the action name, description, and schemas.
19
- * @param options - Optional configuration or definition override.
20
19
  */
21
20
  constructor(metadata) {
22
21
  if (metadata.settingsSchema instanceof z.ZodObject) {
@@ -56,7 +55,6 @@ export class AbstractAction {
56
55
  * Executes the action with retry, timeout, and schema safety.
57
56
  *
58
57
  * @param payload - Raw input being provided to the action.
59
- * @param context - Workflow context used during execution.
60
58
  * @returns Validated output produced by the action.
61
59
  * @throws Error when retries are exhausted or validation fails.
62
60
  */
@@ -3,6 +3,29 @@
3
3
  * Copyright (c) 2025 Hexastack.
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
+ /**
7
+ * Lifecycle of a workflow run:
8
+ * - idle: runner constructed but `start` not invoked.
9
+ * - running: set when `start` or `resume` begins executing steps.
10
+ * - suspended: an action awaited `workflow.suspend`; `resume` moves back to running.
11
+ * - finished: all steps completed and outputs were evaluated successfully.
12
+ * - failed: an uncaught error bubbled out of a step or continuation.
13
+ */
14
+ export var EWorkflowRunStatus;
15
+ (function (EWorkflowRunStatus) {
16
+ EWorkflowRunStatus["IDLE"] = "idle";
17
+ EWorkflowRunStatus["RUNNING"] = "running";
18
+ EWorkflowRunStatus["SUSPENDED"] = "suspended";
19
+ EWorkflowRunStatus["FINISHED"] = "finished";
20
+ EWorkflowRunStatus["FAILED"] = "failed";
21
+ })(EWorkflowRunStatus || (EWorkflowRunStatus = {}));
22
+ export const WORKFLOW_RUN_STATUSES = [
23
+ EWorkflowRunStatus.IDLE,
24
+ EWorkflowRunStatus.RUNNING,
25
+ EWorkflowRunStatus.SUSPENDED,
26
+ EWorkflowRunStatus.FINISHED,
27
+ EWorkflowRunStatus.FAILED,
28
+ ];
6
29
  /**
7
30
  * Base context that is threaded through every workflow execution.
8
31
  *
package/dist/esm/index.js CHANGED
@@ -5,9 +5,9 @@
5
5
  */
6
6
  export { AbstractAction } from './action/abstract-action';
7
7
  export { defineAction } from './action/action';
8
- export { BaseWorkflowContext, } from './context';
8
+ export { BaseWorkflowContext, EWorkflowRunStatus, WORKFLOW_RUN_STATUSES, } from './context';
9
9
  export * from './dsl.types';
10
- export { compileWorkflow, Workflow as Workflow, WorkflowEventEmitter, WorkflowRunner, } from './workflow';
10
+ export { compileWorkflow, Workflow, WorkflowEventEmitter, WorkflowRunner, } from './workflow';
11
11
  export { StepType } from './workflow-event-emitter';
12
12
  export { NonDeterministicWorkflowError } from './runner-runtime-control';
13
13
  export { compileValue, evaluateMapping, evaluateValue, mergeSettings, } from './workflow-values';
@@ -3,6 +3,7 @@
3
3
  * Copyright (c) 2025 Hexastack.
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
+ import { EWorkflowRunStatus, } from './context';
6
7
  import { RunnerRuntimeControl } from './runner-runtime-control';
7
8
  import { executeConditional as runConditionalExecutor } from './step-executors/conditional-executor';
8
9
  import { executeLoop as runLoopExecutor } from './step-executors/loop-executor';
@@ -24,7 +25,7 @@ export class WorkflowRunner {
24
25
  */
25
26
  constructor(compiled, options) {
26
27
  // Current lifecycle status of the workflow execution.
27
- this.status = 'idle';
28
+ this.status = EWorkflowRunStatus.IDLE;
28
29
  // Snapshots of action execution keyed by step id for inspection/resume.
29
30
  this.snapshots = {};
30
31
  // Detailed execution records for each task step, used by UI/telemetry.
@@ -98,7 +99,7 @@ export class WorkflowRunner {
98
99
  * @returns Execution result including status and snapshot.
99
100
  */
100
101
  async start(args) {
101
- this.status = 'running';
102
+ this.status = EWorkflowRunStatus.RUNNING;
102
103
  this.snapshots = {};
103
104
  this.stepLog = {};
104
105
  this.suspension = undefined;
@@ -126,13 +127,13 @@ export class WorkflowRunner {
126
127
  * @returns Execution result including status and snapshot.
127
128
  */
128
129
  async resume(args) {
129
- if (this.status !== 'suspended' || !this.suspension) {
130
+ if (this.status !== EWorkflowRunStatus.SUSPENDED || !this.suspension) {
130
131
  throw new Error('Cannot resume a workflow that is not suspended.');
131
132
  }
132
133
  if (!this.context || !this.state) {
133
134
  throw new Error('Workflow state is not initialized.');
134
135
  }
135
- this.status = 'running';
136
+ this.status = EWorkflowRunStatus.RUNNING;
136
137
  this.lastResumeData = args.resumeData;
137
138
  const suspension = this.suspension;
138
139
  return this.runExecution(() => suspension.continue(args.resumeData));
@@ -148,7 +149,7 @@ export class WorkflowRunner {
148
149
  const suspension = await execute();
149
150
  if (suspension) {
150
151
  this.suspension = suspension;
151
- this.status = 'suspended';
152
+ this.status = EWorkflowRunStatus.SUSPENDED;
152
153
  this.emit('hook:workflow:suspended', {
153
154
  runId: this.runId,
154
155
  step: suspension.step,
@@ -156,7 +157,7 @@ export class WorkflowRunner {
156
157
  data: suspension.data,
157
158
  });
158
159
  return {
159
- status: 'suspended',
160
+ status: EWorkflowRunStatus.SUSPENDED,
160
161
  step: suspension.step,
161
162
  reason: suspension.reason,
162
163
  data: suspension.data,
@@ -168,7 +169,7 @@ export class WorkflowRunner {
168
169
  };
169
170
  }
170
171
  const output = await this.evaluateWorkflowOutputs();
171
- this.status = 'finished';
172
+ this.status = EWorkflowRunStatus.FINISHED;
172
173
  this.suspension = undefined;
173
174
  this.currentStep = undefined;
174
175
  this.emit('hook:workflow:finish', { runId: this.runId, output });
@@ -176,14 +177,22 @@ export class WorkflowRunner {
176
177
  throw new Error('Workflow context is not attached.');
177
178
  }
178
179
  this.context.attachWorkflowRuntime(undefined);
179
- return { status: 'finished', output, snapshot: this.getSnapshot() };
180
+ return {
181
+ status: EWorkflowRunStatus.FINISHED,
182
+ output,
183
+ snapshot: this.getSnapshot(),
184
+ };
180
185
  }
181
186
  catch (error) {
182
- this.status = 'failed';
187
+ this.status = EWorkflowRunStatus.FAILED;
183
188
  this.currentStep = undefined;
184
189
  this.emit('hook:workflow:failure', { runId: this.runId, error });
185
190
  this.context?.attachWorkflowRuntime(undefined);
186
- return { status: 'failed', error, snapshot: this.getSnapshot() };
191
+ return {
192
+ status: EWorkflowRunStatus.FAILED,
193
+ error,
194
+ snapshot: this.getSnapshot(),
195
+ };
187
196
  }
188
197
  }
189
198
  /**
@@ -207,7 +216,7 @@ export class WorkflowRunner {
207
216
  runner.context = options.context;
208
217
  runner.snapshots = options.snapshot.actions ?? {};
209
218
  runner.stepLog = {};
210
- runner.status = options.snapshot.status ?? 'idle';
219
+ runner.status = options.snapshot.status ?? EWorkflowRunStatus.IDLE;
211
220
  runner.lastResumeData = options.lastResumeData;
212
221
  runner.runtimeControl = new RunnerRuntimeControl(runner);
213
222
  options.context.attachWorkflowRuntime(runner.runtimeControl);
@@ -226,7 +235,7 @@ export class WorkflowRunner {
226
235
  throw new Error(`Unable to rebuild suspension for step ${options.suspension.stepId}`);
227
236
  }
228
237
  runner.suspension = suspension;
229
- runner.status = 'suspended';
238
+ runner.status = EWorkflowRunStatus.SUSPENDED;
230
239
  }
231
240
  return runner;
232
241
  }
@@ -433,7 +442,7 @@ export class WorkflowRunner {
433
442
  }
434
443
  /**
435
444
  * Store the raw task result under the task name in the workflow output state.
436
- * @reviewed
445
+ *
437
446
  * @param task The task whose output is being captured.
438
447
  * @param state Current execution state to mutate.
439
448
  * @param result Raw result returned by the task action.
@@ -4,8 +4,9 @@
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
6
  import { stringify as stringifyYaml } from 'yaml';
7
+ import { EWorkflowRunStatus, } from './context';
7
8
  import { TASK_KIND, WorkflowDefinitionSchema, validateWorkflow, } from './dsl.types';
8
- import { safeRenameTaskInDefinition as safeRenameTaskInDefinitionHelper } from './utils/workflow-definition';
9
+ import { safeRenameTaskInDefinition as renameTaskInDefinition } from './utils/workflow-definition';
9
10
  import { compileWorkflow, } from './workflow-compiler';
10
11
  import { WorkflowRunner } from './workflow-runner';
11
12
  export { compileWorkflow } from './workflow-compiler';
@@ -195,7 +196,7 @@ export class Workflow {
195
196
  * Rename a task key and update references in flow steps and output expressions.
196
197
  */
197
198
  static safeRenameTaskInDefinition(definition, currentTaskName, nextTaskName) {
198
- return safeRenameTaskInDefinitionHelper(definition, currentTaskName, nextTaskName);
199
+ return renameTaskInDefinition(definition, currentTaskName, nextTaskName);
199
200
  }
200
201
  /**
201
202
  * Run the workflow until completion or suspension.
@@ -207,10 +208,10 @@ export class Workflow {
207
208
  inputData,
208
209
  context,
209
210
  });
210
- if (result.status === 'finished') {
211
+ if (result.status === EWorkflowRunStatus.FINISHED) {
211
212
  return result.output;
212
213
  }
213
- if (result.status === 'failed') {
214
+ if (result.status === EWorkflowRunStatus.FAILED) {
214
215
  throw result.error instanceof Error
215
216
  ? result.error
216
217
  : new Error(String(result.error));
@@ -15,7 +15,6 @@ export declare abstract class AbstractAction<I, O, C extends BaseWorkflowContext
15
15
  * Sets up core metadata and schemas for the action.
16
16
  *
17
17
  * @param metadata - Describes the action name, description, and schemas.
18
- * @param options - Optional configuration or definition override.
19
18
  */
20
19
  protected constructor(metadata: ActionMetadata<I, O, S>);
21
20
  /**
@@ -36,7 +35,6 @@ export declare abstract class AbstractAction<I, O, C extends BaseWorkflowContext
36
35
  * Executes the action with retry, timeout, and schema safety.
37
36
  *
38
37
  * @param payload - Raw input being provided to the action.
39
- * @param context - Workflow context used during execution.
40
38
  * @returns Validated output produced by the action.
41
39
  * @throws Error when retries are exhausted or validation fails.
42
40
  */
@@ -1 +1 @@
1
- {"version":3,"file":"abstract-action.d.ts","sourceRoot":"","sources":["../../../src/action/abstract-action.ts"],"names":[],"mappings":"AAMA,OAAO,EAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAKjD,OAAO,EACL,MAAM,EACN,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAIxB;;GAEG;AACH,8BAAsB,cAAc,CAClC,CAAC,EACD,CAAC,EACD,CAAC,SAAS,mBAAmB,EAC7B,CAAC,EACD,CAAC,SAAS,kBAAkB,GAAG,kBAAkB,CACjD,YAAW,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAEhC,SAAgB,IAAI,EAAE,MAAM,CAAC;IA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, WorkflowEventEmitterLike } from './workflow-even
7
7
  * - finished: all steps completed and outputs were evaluated successfully.
8
8
  * - failed: an uncaught error bubbled out of a step or continuation.
9
9
  */
10
- export type WorkflowRunStatus = 'idle' | 'running' | 'suspended' | 'finished' | 'failed';
10
+ export declare enum EWorkflowRunStatus {
11
+ IDLE = "idle",
12
+ RUNNING = "running",
13
+ SUSPENDED = "suspended",
14
+ FINISHED = "finished",
15
+ FAILED = "failed"
16
+ }
17
+ export type WorkflowRunStatus = `${EWorkflowRunStatus}`;
18
+ export declare const WORKFLOW_RUN_STATUSES: WorkflowRunStatus[];
11
19
  /**
12
20
  * Lifecycle of an individual action/step captured in snapshots:
13
21
  * - pending: defined but not yet executed (default before runner touches the step).
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,CAAC;AAEb;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,SAAS,GACT,WAAW,GACX,WAAW,GACX,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAA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;;;OAKG;gBACS,YAAY,EAAE,CAAC;IAI3B;;;OAGG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAInC;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,sBAAsB,CAMrC;IAED;;;;;OAKG;IACH,qBAAqB,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,GAAG,IAAI;CAGzE"}
@@ -2,10 +2,10 @@ export { AbstractAction } from './action/abstract-action';
2
2
  export { defineAction } from './action/action';
3
3
  export type { DefineActionParams } from './action/action';
4
4
  export type { Action, ActionExecutionArgs, ActionExecutionOutcome, ActionMetadata, Actions, InferActionArgs, InferActionBindings, InferActionContext, InferActionInput, InferActionOutput, InferActionSettings, SuspensionNotice, } from './action/action.types';
5
- export { BaseWorkflowContext, type ActionSnapshot, type ActionStatus, type StepExecutionRecord, type SuspensionOptions, type WorkflowRunStatus, type WorkflowRuntimeControl, type WorkflowSnapshot, } from './context';
5
+ export { BaseWorkflowContext, EWorkflowRunStatus, WORKFLOW_RUN_STATUSES, type ActionSnapshot, type ActionStatus, type StepExecutionRecord, type SuspensionOptions, type WorkflowRunStatus, type WorkflowRuntimeControl, type WorkflowSnapshot, } from './context';
6
6
  export * from './dsl.types';
7
7
  export type { BindingKindDescriptor, BindingKindSchemas, InferMountedBindingValue, InferWorkflowBindings, } from './bindings/base-binding';
8
- export { compileWorkflow, Workflow as Workflow, WorkflowEventEmitter, WorkflowRunner, type FlowStepPath, type WorkflowCompileOptions, type WorkflowResumeResult, type WorkflowRunOptions, type WorkflowStartResult, } from './workflow';
8
+ export { compileWorkflow, Workflow, WorkflowEventEmitter, WorkflowRunner, type FlowStepPath, type WorkflowCompileOptions, type WorkflowResumeResult, type WorkflowRunOptions, type WorkflowStartResult, } from './workflow';
9
9
  export { StepType } from './workflow-event-emitter';
10
10
  export type { StepInfo, WorkflowEventEmitterLike, WorkflowEventMap, } from './workflow-event-emitter';
11
11
  export type { BaseStep as CompiledBaseStep, ConditionalBranch as CompiledConditionalBranch, ConditionalStep as CompiledConditionalStep, LoopStep as CompiledLoopStep, CompiledMapping, ParallelStep as CompiledParallelStep, CompiledStep, CompiledTask, CompiledTaskBindings, TaskStep as CompiledTaskStep, CompiledValue, CompiledWorkflow, EvaluationScope, ExecutionState, PersistedSuspension, RunnerResumeArgs, RunnerStartArgs, Suspension, ResumeResult as WorkflowResumeOutcome, StartResult as WorkflowStartOutcome, } from './workflow-types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,YAAY,EACV,MAAM,EACN,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,OAAO,EACP,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAC;AAEnB,cAAc,aAAa,CAAC;AAE5B,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,wBAAwB,EACxB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,eAAe,EACf,QAAQ,IAAI,QAAQ,EACpB,oBAAoB,EACpB,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AAEpB,OA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AM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,aAAa,EACb,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { BaseWorkflowContext, StepExecutionRecord, WorkflowRunStatus, WorkflowSnapshot } from './context';
1
+ import { type BaseWorkflowContext, type StepExecutionRecord, type WorkflowRunStatus, type WorkflowSnapshot } from './context';
2
2
  import { type StepInfo } from './workflow-event-emitter';
3
3
  import type { CompiledWorkflow, ExecutionState, PersistedSuspension, ResumeResult, RunnerResumeArgs, RunnerStartArgs, StartResult, WorkflowRunOptions } from './workflow-types';
4
4
  /**
@@ -169,7 +169,7 @@ export declare class WorkflowRunner {
169
169
  private executeStep;
170
170
  /**
171
171
  * Store the raw task result under the task name in the workflow output state.
172
- * @reviewed
172
+ *
173
173
  * @param task The task whose output is being captured.
174
174
  * @param state Current execution state to mutate.
175
175
  * @param result Raw result returned by the task action.
@@ -1 +1 @@
1
- {"version":3,"file":"workflow-runner.d.ts","sourceRoot":"","sources":["../../src/workflow-runner.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAGV,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,WAAW,CAAC;AAWnB,OAAO,EAEL,KAAK,QAAQ,EAEd,MAAM,0BAA0B,CAAC;AAClC,OAAO,K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IAAI;IAOZ;;;;;;OAMG;YACW,uBAAuB;IAYrC;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAc7B;;;;;;OAMG;IACH,OAAO,CAAC,YAAY;IASpB;;;;;OAKG;IACH,OAAO,CAAC,mBAAmB;IA2B3B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;IAqDzB;;;;OAIG;IACH,OAAO,CAAC,6BAA6B;IAkBrC;;;;;;;;OAQG;YACW,WAAW;IA8BzB;;;;;;;OAOG;YACW,WAAW;IAkBzB;;;;;;OAMG;YACW,iBAAiB;CAOhC"}
@@ -1,4 +1,4 @@
1
- import type { BaseWorkflowContext, WorkflowSnapshot } from './context';
1
+ import { type BaseWorkflowContext, type WorkflowSnapshot } from './context';
2
2
  import { WorkflowDefinition, type FlowStep } from './dsl.types';
3
3
  import { type WorkflowCompileOptions } from './workflow-compiler';
4
4
  import { WorkflowRunner } from './workflow-runner';
@@ -1 +1 @@
1
- {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/workflow.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACvE,OAAO,EAEL,kBAAkB,EAGlB,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAEV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAA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CACpB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,cAAc,CAAC;IAI1B;;OAEG;IACG,oBAAoB,CAAC,OAAO,EAAE;QAClC,KAAK,EAAE,cAAc,CAAC;QACtB,OAAO,EAAE,mBAAmB,CAAC;QAC7B,QAAQ,EAAE,gBAAgB,CAAC;QAC3B,UAAU,CAAC,EAAE,mBAAmB,CAAC;QACjC,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,GAAG,OAAO,CAAC,cAAc,CAAC;CAG5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexabot-ai/agentic",
3
- "version": "3.0.2-alpha.0",
3
+ "version": "3.1.0-alpha.0",
4
4
  "description": "Schemas and utilities for the Hexabot agentic workflow DSL.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -50,11 +50,13 @@
50
50
  "build": "pnpm run build:cjs && pnpm run build:esm",
51
51
  "build:cjs": "tsc -p tsconfig.build.cjs.json",
52
52
  "build:esm": "tsc -p tsconfig.build.esm.json",
53
- "dev": "pnpm run build:watch",
53
+ "dev": "pnpm exec concurrently -k -n cjs,esm \"pnpm run build:cjs:watch\" \"pnpm run build:esm:watch\"",
54
54
  "build:watch": "tsc -p tsconfig.json --watch",
55
55
  "lint": "eslint \"{src,examples}/**/*.ts\" \"jest.config.ts\"",
56
56
  "lint:fix": "eslint \"{src,examples}/**/*.ts\" \"jest.config.ts\" --fix",
57
57
  "typecheck": "tsc --noEmit -p tsconfig.json",
58
- "test": "jest --config jest.config.ts"
58
+ "test": "jest --config jest.config.ts",
59
+ "build:cjs:watch": "tsc -p tsconfig.build.cjs.json --watch",
60
+ "build:esm:watch": "tsc -p tsconfig.build.esm.json --watch"
59
61
  }
60
62
  }
@@ -48,7 +48,6 @@ export abstract class AbstractAction<
48
48
  * Sets up core metadata and schemas for the action.
49
49
  *
50
50
  * @param metadata - Describes the action name, description, and schemas.
51
- * @param options - Optional configuration or definition override.
52
51
  */
53
52
  protected constructor(metadata: ActionMetadata<I, O, S>) {
54
53
  if (metadata.settingsSchema instanceof z.ZodObject) {
@@ -97,7 +96,6 @@ export abstract class AbstractAction<
97
96
  * Executes the action with retry, timeout, and schema safety.
98
97
  *
99
98
  * @param payload - Raw input being provided to the action.
100
- * @param context - Workflow context used during execution.
101
99
  * @returns Validated output produced by the action.
102
100
  * @throws Error when retries are exhausted or validation fails.
103
101
  */
package/src/context.ts CHANGED
@@ -17,12 +17,23 @@ import type {
17
17
  * - finished: all steps completed and outputs were evaluated successfully.
18
18
  * - failed: an uncaught error bubbled out of a step or continuation.
19
19
  */
20
- export type WorkflowRunStatus =
21
- | 'idle'
22
- | 'running'
23
- | 'suspended'
24
- | 'finished'
25
- | 'failed';
20
+ export enum EWorkflowRunStatus {
21
+ IDLE = 'idle',
22
+ RUNNING = 'running',
23
+ SUSPENDED = 'suspended',
24
+ FINISHED = 'finished',
25
+ FAILED = 'failed',
26
+ }
27
+
28
+ export type WorkflowRunStatus = `${EWorkflowRunStatus}`;
29
+
30
+ export const WORKFLOW_RUN_STATUSES: WorkflowRunStatus[] = [
31
+ EWorkflowRunStatus.IDLE,
32
+ EWorkflowRunStatus.RUNNING,
33
+ EWorkflowRunStatus.SUSPENDED,
34
+ EWorkflowRunStatus.FINISHED,
35
+ EWorkflowRunStatus.FAILED,
36
+ ];
26
37
 
27
38
  /**
28
39
  * Lifecycle of an individual action/step captured in snapshots:
package/src/index.ts CHANGED
@@ -27,6 +27,8 @@ export type {
27
27
 
28
28
  export {
29
29
  BaseWorkflowContext,
30
+ EWorkflowRunStatus,
31
+ WORKFLOW_RUN_STATUSES,
30
32
  type ActionSnapshot,
31
33
  type ActionStatus,
32
34
  type StepExecutionRecord,
@@ -47,7 +49,7 @@ export type {
47
49
 
48
50
  export {
49
51
  compileWorkflow,
50
- Workflow as Workflow,
52
+ Workflow,
51
53
  WorkflowEventEmitter,
52
54
  WorkflowRunner,
53
55
  type FlowStepPath,
@@ -4,13 +4,14 @@
4
4
  * Full terms: see LICENSE.md.
5
5
  */
6
6
 
7
- import type {
8
- ActionSnapshot,
9
- ActionStatus,
10
- BaseWorkflowContext,
11
- StepExecutionRecord,
12
- WorkflowRunStatus,
13
- WorkflowSnapshot,
7
+ import {
8
+ EWorkflowRunStatus,
9
+ type ActionSnapshot,
10
+ type ActionStatus,
11
+ type BaseWorkflowContext,
12
+ type StepExecutionRecord,
13
+ type WorkflowRunStatus,
14
+ type WorkflowSnapshot,
14
15
  } from './context';
15
16
  import { RunnerRuntimeControl } from './runner-runtime-control';
16
17
  import { executeConditional as runConditionalExecutor } from './step-executors/conditional-executor';
@@ -54,7 +55,7 @@ export class WorkflowRunner {
54
55
  private readonly runId?: string;
55
56
 
56
57
  // Current lifecycle status of the workflow execution.
57
- private status: WorkflowRunStatus = 'idle';
58
+ private status: WorkflowRunStatus = EWorkflowRunStatus.IDLE;
58
59
 
59
60
  // Snapshots of action execution keyed by step id for inspection/resume.
60
61
  private snapshots: Record<string, ActionSnapshot> = {};
@@ -165,7 +166,7 @@ export class WorkflowRunner {
165
166
  * @returns Execution result including status and snapshot.
166
167
  */
167
168
  async start(args: RunnerStartArgs): Promise<StartResult> {
168
- this.status = 'running';
169
+ this.status = EWorkflowRunStatus.RUNNING;
169
170
  this.snapshots = {};
170
171
  this.stepLog = {};
171
172
  this.suspension = undefined;
@@ -200,7 +201,7 @@ export class WorkflowRunner {
200
201
  * @returns Execution result including status and snapshot.
201
202
  */
202
203
  async resume(args: RunnerResumeArgs): Promise<ResumeResult> {
203
- if (this.status !== 'suspended' || !this.suspension) {
204
+ if (this.status !== EWorkflowRunStatus.SUSPENDED || !this.suspension) {
204
205
  throw new Error('Cannot resume a workflow that is not suspended.');
205
206
  }
206
207
 
@@ -208,7 +209,7 @@ export class WorkflowRunner {
208
209
  throw new Error('Workflow state is not initialized.');
209
210
  }
210
211
 
211
- this.status = 'running';
212
+ this.status = EWorkflowRunStatus.RUNNING;
212
213
  this.lastResumeData = args.resumeData;
213
214
 
214
215
  const suspension: Suspension = this.suspension;
@@ -230,7 +231,7 @@ export class WorkflowRunner {
230
231
 
231
232
  if (suspension) {
232
233
  this.suspension = suspension;
233
- this.status = 'suspended';
234
+ this.status = EWorkflowRunStatus.SUSPENDED;
234
235
  this.emit('hook:workflow:suspended', {
235
236
  runId: this.runId,
236
237
  step: suspension.step,
@@ -239,7 +240,7 @@ export class WorkflowRunner {
239
240
  });
240
241
 
241
242
  return {
242
- status: 'suspended',
243
+ status: EWorkflowRunStatus.SUSPENDED,
243
244
  step: suspension.step,
244
245
  reason: suspension.reason,
245
246
  data: suspension.data,
@@ -252,7 +253,7 @@ export class WorkflowRunner {
252
253
  }
253
254
 
254
255
  const output = await this.evaluateWorkflowOutputs();
255
- this.status = 'finished';
256
+ this.status = EWorkflowRunStatus.FINISHED;
256
257
  this.suspension = undefined;
257
258
  this.currentStep = undefined;
258
259
  this.emit('hook:workflow:finish', { runId: this.runId, output });
@@ -261,14 +262,22 @@ export class WorkflowRunner {
261
262
  }
262
263
  this.context.attachWorkflowRuntime(undefined);
263
264
 
264
- return { status: 'finished', output, snapshot: this.getSnapshot() };
265
+ return {
266
+ status: EWorkflowRunStatus.FINISHED,
267
+ output,
268
+ snapshot: this.getSnapshot(),
269
+ };
265
270
  } catch (error) {
266
- this.status = 'failed';
271
+ this.status = EWorkflowRunStatus.FAILED;
267
272
  this.currentStep = undefined;
268
273
  this.emit('hook:workflow:failure', { runId: this.runId, error });
269
274
  this.context?.attachWorkflowRuntime(undefined);
270
275
 
271
- return { status: 'failed', error, snapshot: this.getSnapshot() };
276
+ return {
277
+ status: EWorkflowRunStatus.FAILED,
278
+ error,
279
+ snapshot: this.getSnapshot(),
280
+ };
272
281
  }
273
282
  }
274
283
 
@@ -304,7 +313,7 @@ export class WorkflowRunner {
304
313
  runner.context = options.context;
305
314
  runner.snapshots = options.snapshot.actions ?? {};
306
315
  runner.stepLog = {};
307
- runner.status = options.snapshot.status ?? 'idle';
316
+ runner.status = options.snapshot.status ?? EWorkflowRunStatus.IDLE;
308
317
  runner.lastResumeData = options.lastResumeData;
309
318
  runner.runtimeControl = new RunnerRuntimeControl(runner);
310
319
  options.context.attachWorkflowRuntime(runner.runtimeControl);
@@ -331,7 +340,7 @@ export class WorkflowRunner {
331
340
  }
332
341
 
333
342
  runner.suspension = suspension;
334
- runner.status = 'suspended';
343
+ runner.status = EWorkflowRunStatus.SUSPENDED;
335
344
  }
336
345
 
337
346
  return runner;
@@ -588,7 +597,7 @@ export class WorkflowRunner {
588
597
 
589
598
  /**
590
599
  * Store the raw task result under the task name in the workflow output state.
591
- * @reviewed
600
+ *
592
601
  * @param task The task whose output is being captured.
593
602
  * @param state Current execution state to mutate.
594
603
  * @param result Raw result returned by the task action.
package/src/workflow.ts CHANGED
@@ -6,7 +6,11 @@
6
6
 
7
7
  import { stringify as stringifyYaml } from 'yaml';
8
8
 
9
- import type { BaseWorkflowContext, WorkflowSnapshot } from './context';
9
+ import {
10
+ EWorkflowRunStatus,
11
+ type BaseWorkflowContext,
12
+ type WorkflowSnapshot,
13
+ } from './context';
10
14
  import {
11
15
  TASK_KIND,
12
16
  WorkflowDefinition,
@@ -14,7 +18,7 @@ import {
14
18
  validateWorkflow,
15
19
  type FlowStep,
16
20
  } from './dsl.types';
17
- import { safeRenameTaskInDefinition as safeRenameTaskInDefinitionHelper } from './utils/workflow-definition';
21
+ import { safeRenameTaskInDefinition as renameTaskInDefinition } from './utils/workflow-definition';
18
22
  import {
19
23
  compileWorkflow,
20
24
  type WorkflowCompileOptions,
@@ -323,11 +327,7 @@ export class Workflow {
323
327
  currentTaskName: string,
324
328
  nextTaskName: string,
325
329
  ): WorkflowDefinition {
326
- return safeRenameTaskInDefinitionHelper(
327
- definition,
328
- currentTaskName,
329
- nextTaskName,
330
- );
330
+ return renameTaskInDefinition(definition, currentTaskName, nextTaskName);
331
331
  }
332
332
 
333
333
  /**
@@ -345,11 +345,11 @@ export class Workflow {
345
345
  context,
346
346
  });
347
347
 
348
- if (result.status === 'finished') {
348
+ if (result.status === EWorkflowRunStatus.FINISHED) {
349
349
  return result.output;
350
350
  }
351
351
 
352
- if (result.status === 'failed') {
352
+ if (result.status === EWorkflowRunStatus.FAILED) {
353
353
  throw result.error instanceof Error
354
354
  ? result.error
355
355
  : new Error(String(result.error));