@db-lyon/flowkit 0.5.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
1
  import { noopLogger } from '../logger.js';
2
+ import { resolveReferences } from './references.js';
2
3
  // ---------------------------------------------------------------------------
3
4
  // FlowRunner
4
5
  // ---------------------------------------------------------------------------
@@ -16,8 +17,6 @@ export class FlowRunner {
16
17
  this.flows = config.flows;
17
18
  this.registry = config.registry;
18
19
  this.hooks = config.hooks ?? {};
19
- // Inject registry into context so tasks can resolve/call other tasks.
20
- // Spread to avoid mutating the caller's context object.
21
20
  this.ctx = { ...config.context, registry: config.registry };
22
21
  }
23
22
  async run(options) {
@@ -30,26 +29,36 @@ export class FlowRunner {
30
29
  this.runDepth--;
31
30
  }
32
31
  }
33
- /** Flatten a flow definition into an ordered execution plan. */
34
32
  resolveExecutionPlan(flow, skipSet) {
35
33
  const sortedKeys = Object.keys(flow.steps)
36
34
  .map(Number)
37
35
  .sort((a, b) => a - b);
38
- return sortedKeys.map((key) => {
39
- const step = flow.steps[String(key)];
40
- if (step.task === 'None') {
41
- return { stepNumber: key, type: 'task', name: 'None', skipped: true };
42
- }
43
- const name = (step.task ?? step.flow);
44
- const type = step.task ? 'task' : 'flow';
45
- return {
46
- stepNumber: key,
47
- type,
48
- name,
49
- skipped: skipSet.has(name) || skipSet.has(String(key)),
50
- options: step.options,
51
- };
52
- });
36
+ return sortedKeys.map((key) => this.planStepFromDef(flow.steps[String(key)], key, skipSet));
37
+ }
38
+ planStepFromDef(step, stepNumber, skipSet) {
39
+ if (step.task === 'None') {
40
+ return { stepNumber, type: 'task', name: 'None', skipped: true };
41
+ }
42
+ const name = (step.task ?? step.flow);
43
+ const type = step.task ? 'task' : 'flow';
44
+ return {
45
+ stepNumber,
46
+ type,
47
+ name,
48
+ skipped: skipSet.has(name) || skipSet.has(String(stepNumber)),
49
+ options: step.options,
50
+ retries: step.retries,
51
+ retryDelay: step.retryDelay,
52
+ retryOn: step.retryOn,
53
+ };
54
+ }
55
+ planHookSteps(hookSteps, phase, skipSet, baseStepNumber) {
56
+ if (!hookSteps || hookSteps.length === 0)
57
+ return [];
58
+ return hookSteps.map((s, i) => ({
59
+ ...this.planStepFromDef(s, baseStepNumber + i, skipSet),
60
+ phase,
61
+ }));
53
62
  }
54
63
  // ---------------------------------------------------------------------------
55
64
  // Internal
@@ -58,16 +67,26 @@ export class FlowRunner {
58
67
  const startTime = Date.now();
59
68
  const skipSet = new Set(options.skip ?? []);
60
69
  const completedSteps = [];
70
+ const hookErrors = [];
71
+ const rollbackRecords = [];
61
72
  const flow = this.flows[options.flowName];
62
73
  if (!flow) {
63
74
  throw new Error(`Flow "${options.flowName}" not found in configuration`);
64
75
  }
76
+ const rollbackEnabled = options.rollback_on_failure ?? flow.rollback_on_failure ?? false;
65
77
  const executionPlan = this.resolveExecutionPlan(flow, skipSet);
66
- // Plan mode — return the plan without executing anything
78
+ // Plan mode — dump all phases for visibility, nothing runs.
67
79
  if (options.plan) {
80
+ const fullPlan = [
81
+ ...this.planHookSteps(flow.on_start, 'on_start', skipSet, -3000),
82
+ ...executionPlan,
83
+ ...this.planHookSteps(flow.on_success, 'on_success', skipSet, 10_000),
84
+ ...this.planHookSteps(flow.on_failure, 'on_failure', skipSet, 20_000),
85
+ ...this.planHookSteps(flow.finally, 'finally', skipSet, 30_000),
86
+ ];
68
87
  return {
69
88
  success: true,
70
- steps: executionPlan.map((s) => ({
89
+ steps: fullPlan.map((s) => ({
71
90
  stepNumber: s.stepNumber,
72
91
  type: s.type,
73
92
  name: s.name,
@@ -81,79 +100,137 @@ export class FlowRunner {
81
100
  await this.hooks.beforeRun?.(options.flowName, executionPlan);
82
101
  }
83
102
  let flowError;
84
- for (const planStep of executionPlan) {
85
- // ---- Skipped steps ----
86
- if (planStep.skipped) {
87
- const sr = {
88
- stepNumber: planStep.stepNumber,
89
- type: planStep.type,
90
- name: planStep.name,
91
- skipped: true,
92
- duration: 0,
93
- };
94
- completedSteps.push(sr);
95
- await this.hooks.afterStep?.(planStep, sr);
96
- continue;
103
+ let flowErrorStepName;
104
+ // ---- on_start ----
105
+ {
106
+ const startPlan = this.planHookSteps(flow.on_start, 'on_start', skipSet, -3000);
107
+ for (const hookStep of startPlan) {
108
+ const ok = await this.runHookStep(hookStep, options, completedSteps, undefined, hookErrors);
109
+ if (!ok) {
110
+ flowError = hookErrors[hookErrors.length - 1]?.error;
111
+ flowErrorStepName = hookStep.name;
112
+ break;
113
+ }
97
114
  }
98
- // ---- Active steps ----
99
- await this.hooks.beforeStep?.(planStep);
100
- const stepStart = Date.now();
101
- try {
102
- let stepResult;
103
- if (planStep.type === 'task') {
104
- const taskResult = await this.executeTaskStep(planStep, options.params);
105
- stepResult = {
115
+ }
116
+ // ---- main steps ----
117
+ if (!flowError) {
118
+ for (const planStep of executionPlan) {
119
+ if (planStep.skipped) {
120
+ const sr = {
106
121
  stepNumber: planStep.stepNumber,
107
- type: 'task',
122
+ type: planStep.type,
108
123
  name: planStep.name,
109
- result: taskResult,
110
- skipped: false,
111
- duration: Date.now() - stepStart,
124
+ skipped: true,
125
+ duration: 0,
112
126
  };
127
+ completedSteps.push(sr);
128
+ await this.hooks.afterStep?.(planStep, sr);
129
+ continue;
113
130
  }
114
- else {
115
- const nestedResult = await this.run({
116
- ...options,
117
- flowName: planStep.name,
118
- plan: false,
119
- });
120
- stepResult = {
131
+ await this.hooks.beforeStep?.(planStep);
132
+ const stepStart = Date.now();
133
+ try {
134
+ let stepResult;
135
+ if (planStep.type === 'task') {
136
+ const { result: taskResult, attempts } = await this.executeTaskStepWithRetry(planStep, options.params, completedSteps);
137
+ stepResult = {
138
+ stepNumber: planStep.stepNumber,
139
+ type: 'task',
140
+ name: planStep.name,
141
+ result: taskResult,
142
+ skipped: false,
143
+ duration: Date.now() - stepStart,
144
+ attempts,
145
+ };
146
+ if (taskResult.success && taskResult.rollback) {
147
+ rollbackRecords.push({
148
+ taskName: taskResult.rollback.taskName,
149
+ payload: taskResult.rollback.payload,
150
+ });
151
+ }
152
+ }
153
+ else {
154
+ const nestedResult = await this.run({
155
+ ...options,
156
+ flowName: planStep.name,
157
+ plan: false,
158
+ });
159
+ stepResult = {
160
+ stepNumber: planStep.stepNumber,
161
+ type: 'flow',
162
+ name: planStep.name,
163
+ result: {
164
+ success: nestedResult.success,
165
+ data: { stepCount: nestedResult.steps.length },
166
+ },
167
+ skipped: false,
168
+ duration: Date.now() - stepStart,
169
+ };
170
+ // Bubble nested rollback records up so the parent can invoke them.
171
+ for (const s of nestedResult.steps) {
172
+ if (s.result?.success && s.result?.rollback) {
173
+ rollbackRecords.push({
174
+ taskName: s.result.rollback.taskName,
175
+ payload: s.result.rollback.payload,
176
+ });
177
+ }
178
+ }
179
+ if (!nestedResult.success) {
180
+ flowError = nestedResult.error ?? new Error(`Nested flow ${planStep.name} failed`);
181
+ flowErrorStepName = planStep.name;
182
+ }
183
+ }
184
+ completedSteps.push(stepResult);
185
+ await this.hooks.afterStep?.(planStep, stepResult);
186
+ if (!stepResult.result?.success) {
187
+ flowError =
188
+ flowError ?? stepResult.result?.error ?? new Error(`Step ${planStep.name} failed`);
189
+ flowErrorStepName = flowErrorStepName ?? planStep.name;
190
+ await this.hooks.onStepError?.(planStep, flowError, completedSteps);
191
+ break;
192
+ }
193
+ }
194
+ catch (error) {
195
+ const err = error instanceof Error ? error : new Error(String(error));
196
+ completedSteps.push({
121
197
  stepNumber: planStep.stepNumber,
122
- type: 'flow',
198
+ type: planStep.type,
123
199
  name: planStep.name,
124
- result: {
125
- success: nestedResult.success,
126
- data: { stepCount: nestedResult.steps.length },
127
- },
128
200
  skipped: false,
129
201
  duration: Date.now() - stepStart,
130
- };
131
- if (!nestedResult.success) {
132
- flowError = nestedResult.error ?? new Error(`Nested flow ${planStep.name} failed`);
133
- }
134
- }
135
- completedSteps.push(stepResult);
136
- await this.hooks.afterStep?.(planStep, stepResult);
137
- if (!stepResult.result?.success) {
138
- flowError =
139
- flowError ?? stepResult.result?.error ?? new Error(`Step ${planStep.name} failed`);
140
- await this.hooks.onStepError?.(planStep, flowError, completedSteps);
202
+ result: { success: false, error: err },
203
+ });
204
+ flowError = err;
205
+ flowErrorStepName = planStep.name;
206
+ await this.hooks.onStepError?.(planStep, err, completedSteps);
141
207
  break;
142
208
  }
143
209
  }
144
- catch (error) {
145
- const err = error instanceof Error ? error : new Error(String(error));
146
- completedSteps.push({
147
- stepNumber: planStep.stepNumber,
148
- type: planStep.type,
149
- name: planStep.name,
150
- skipped: false,
151
- duration: Date.now() - stepStart,
152
- result: { success: false, error: err },
153
- });
154
- flowError = err;
155
- await this.hooks.onStepError?.(planStep, err, completedSteps);
156
- break;
210
+ }
211
+ // ---- on_success or on_failure ----
212
+ if (flowError) {
213
+ const failPlan = this.planHookSteps(flow.on_failure, 'on_failure', skipSet, 20_000);
214
+ for (const hookStep of failPlan) {
215
+ await this.runHookStep(hookStep, options, completedSteps, { error: flowError, step: flowErrorStepName }, hookErrors);
216
+ }
217
+ }
218
+ else {
219
+ const successPlan = this.planHookSteps(flow.on_success, 'on_success', skipSet, 10_000);
220
+ for (const hookStep of successPlan) {
221
+ await this.runHookStep(hookStep, options, completedSteps, undefined, hookErrors);
222
+ }
223
+ }
224
+ // ---- rollback ----
225
+ let rollbackResult;
226
+ if (flowError && rollbackEnabled && rollbackRecords.length > 0) {
227
+ rollbackResult = await this.performRollback(rollbackRecords);
228
+ }
229
+ // ---- finally ----
230
+ {
231
+ const finallyPlan = this.planHookSteps(flow.finally, 'finally', skipSet, 30_000);
232
+ for (const hookStep of finallyPlan) {
233
+ await this.runHookStep(hookStep, options, completedSteps, flowError ? { error: flowError, step: flowErrorStepName } : undefined, hookErrors);
157
234
  }
158
235
  }
159
236
  const result = {
@@ -161,27 +238,143 @@ export class FlowRunner {
161
238
  steps: completedSteps,
162
239
  duration: Date.now() - startTime,
163
240
  error: flowError,
241
+ hookErrors: hookErrors.length > 0 ? hookErrors : undefined,
242
+ rollback: rollbackResult,
164
243
  };
165
244
  if (isTopLevel) {
166
245
  await this.hooks.afterRun?.(result);
167
246
  }
168
247
  return result;
169
248
  }
170
- async executeTaskStep(step, flowParams) {
249
+ async runHookStep(hookStep, options, completedSteps, errorCtx, hookErrors) {
250
+ if (hookStep.skipped)
251
+ return true;
252
+ try {
253
+ if (hookStep.type === 'flow') {
254
+ const nested = await this.run({
255
+ ...options,
256
+ flowName: hookStep.name,
257
+ plan: false,
258
+ });
259
+ if (!nested.success) {
260
+ hookErrors.push({
261
+ phase: hookStep.phase,
262
+ name: hookStep.name,
263
+ error: nested.error ?? new Error(`Nested flow ${hookStep.name} failed`),
264
+ });
265
+ return false;
266
+ }
267
+ return true;
268
+ }
269
+ const { result } = await this.executeTaskStepWithRetry(hookStep, options.params, completedSteps, errorCtx);
270
+ if (!result.success) {
271
+ hookErrors.push({
272
+ phase: hookStep.phase,
273
+ name: hookStep.name,
274
+ error: result.error ?? new Error(`Hook ${hookStep.phase} step ${hookStep.name} failed`),
275
+ });
276
+ return false;
277
+ }
278
+ return true;
279
+ }
280
+ catch (err) {
281
+ hookErrors.push({
282
+ phase: hookStep.phase,
283
+ name: hookStep.name,
284
+ error: err instanceof Error ? err : new Error(String(err)),
285
+ });
286
+ return false;
287
+ }
288
+ }
289
+ async executeTaskStepWithRetry(step, flowParams, completedSteps, errorCtx) {
290
+ const maxAttempts = Math.max(1, 1 + (step.retries ?? 0));
291
+ const delayMs = step.retryDelay ?? 0;
292
+ const retryOn = step.retryOn;
293
+ let lastResult = { success: false, error: new Error('no attempts executed') };
294
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
295
+ lastResult = await this.executeTaskStep(step, flowParams, completedSteps, errorCtx);
296
+ if (lastResult.success)
297
+ return { result: lastResult, attempts: attempt };
298
+ const errMsg = lastResult.error?.message ?? '';
299
+ const retryMatches = retryOn == null || errMsg.includes(retryOn);
300
+ if (attempt < maxAttempts && retryMatches) {
301
+ if (delayMs > 0)
302
+ await sleep(delayMs);
303
+ this.logger.info({ step: step.stepNumber, task: step.name, attempt, nextAttempt: attempt + 1 }, `Retrying step ${step.name}`);
304
+ continue;
305
+ }
306
+ break;
307
+ }
308
+ return { result: lastResult, attempts: maxAttempts };
309
+ }
310
+ async executeTaskStep(step, flowParams, completedSteps, errorCtx) {
171
311
  const taskDef = this.resolveTaskDefinition(step.name);
172
- // Priority: task defaults < step options < runtime params
173
- const mergedOptions = { ...taskDef.options, ...step.options, ...flowParams };
312
+ const rawOptions = { ...taskDef.options, ...step.options, ...flowParams };
313
+ const refCtx = {
314
+ steps: completedSteps,
315
+ error: errorCtx
316
+ ? {
317
+ message: errorCtx.error.message,
318
+ name: errorCtx.error.name,
319
+ stack: errorCtx.error.stack,
320
+ step: errorCtx.step,
321
+ }
322
+ : undefined,
323
+ };
324
+ let mergedOptions;
325
+ try {
326
+ mergedOptions = resolveReferences(rawOptions, refCtx);
327
+ }
328
+ catch (err) {
329
+ return {
330
+ success: false,
331
+ error: err instanceof Error ? err : new Error(String(err)),
332
+ };
333
+ }
174
334
  this.logger.info({ step: step.stepNumber, task: step.name, type: step.type }, `Executing step ${step.stepNumber}: ${step.name}`);
175
335
  const task = await this.registry.create(taskDef.class_path, this.ctx, mergedOptions);
176
336
  return task.run();
177
337
  }
338
+ async performRollback(records) {
339
+ const result = { attempted: 0, succeeded: 0, errors: [] };
340
+ for (let i = records.length - 1; i >= 0; i--) {
341
+ const rec = records[i];
342
+ result.attempted++;
343
+ try {
344
+ const taskDef = this.resolveTaskDefinition(rec.taskName);
345
+ const task = await this.registry.create(taskDef.class_path, this.ctx, {
346
+ ...taskDef.options,
347
+ ...rec.payload,
348
+ });
349
+ const r = await task.run();
350
+ if (r.success) {
351
+ result.succeeded++;
352
+ }
353
+ else {
354
+ result.errors.push({
355
+ taskName: rec.taskName,
356
+ error: r.error ?? new Error(`Rollback ${rec.taskName} returned failure`),
357
+ });
358
+ }
359
+ }
360
+ catch (err) {
361
+ result.errors.push({
362
+ taskName: rec.taskName,
363
+ error: err instanceof Error ? err : new Error(String(err)),
364
+ });
365
+ }
366
+ }
367
+ return result;
368
+ }
178
369
  resolveTaskDefinition(taskName) {
179
370
  const taskDef = this.tasks[taskName];
180
371
  if (taskDef) {
181
372
  return { class_path: taskDef.class_path, options: taskDef.options ?? {} };
182
373
  }
183
- // Allow using a class_path directly as the task reference
184
374
  return { class_path: taskName, options: {} };
185
375
  }
186
376
  }
377
+ function sleep(ms) {
378
+ return new Promise((resolve) => setTimeout(resolve, ms));
379
+ }
187
380
  //# sourceMappingURL=runner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/flow/runner.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgE1C,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E,MAAM,OAAO,UAAU;IACb,MAAM,CAAS;IACf,KAAK,CAAiC;IACtC,KAAK,CAAiC;IACtC,QAAQ,CAAe;IACvB,GAAG,CAAc;IACjB,KAAK,CAAkB;IACvB,QAAQ,GAAG,CAAC,CAAC;IAErB,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;QAEhC,sEAAsE;QACtE,wDAAwD;QACxD,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9D,CAAC;IAED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+4,18 @@ export type { TaskOptions, TaskDefinition, FlowStep, FlowDefinition, EngineConfi
4
4
  export { loadConfig, loadRawYaml, findConfigFile } from './config/loader.js';
5
5
  export type { LoadConfigOptions, LoadedConfig } from './config/loader.js';
6
6
  export { BaseTask } from './task/base-task.js';
7
- export type { TaskContext, TaskResult } from './task/base-task.js';
7
+ export type { TaskContext, TaskResult, RollbackRecord } from './task/base-task.js';
8
8
  export { ShellTask } from './task/shell-task.js';
9
9
  export type { ShellTaskOptions } from './task/shell-task.js';
10
10
  export { TaskRegistry } from './task/registry.js';
11
11
  export type { TaskConstructor } from './task/registry.js';
12
+ export { AgentPromptTask } from './task/agent-prompt-task.js';
13
+ export type { AgentPromptOptions } from './task/agent-prompt-task.js';
14
+ export type { LLMProvider, LLMCompletionRequest, LLMCompletionResponse, } from './task/llm-provider.js';
12
15
  export { FlowRunner } from './flow/runner.js';
13
- export type { FlowRunOptions, FlowStepResult, FlowRunResult, FlowRunnerHooks, FlowRunnerConfig, PlanStep, } from './flow/runner.js';
16
+ export type { FlowRunOptions, FlowStepResult, FlowRunResult, FlowRunnerHooks, FlowRunnerConfig, PlanStep, HookPhase, HookError, RollbackResult, } from './flow/runner.js';
17
+ export { resolveReferences } from './flow/references.js';
18
+ export type { ReferenceableStep, ReferenceContext } from './flow/references.js';
14
19
  export { topologicalSort, CircularDependencyError, MissingDependencyError, } from './dag/resolver.js';
15
20
  export type { DagNode } from './dag/resolver.js';
16
21
  export type { Logger } from './logger.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,WAAW,EACX,cAAc,EACd,QAAQ,EACR,cAAc,EACd,YAAY,GACb,MAAM,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6
6
  export { BaseTask } from './task/base-task.js';
7
7
  export { ShellTask } from './task/shell-task.js';
8
8
  export { TaskRegistry } from './task/registry.js';
9
+ export { AgentPromptTask } from './task/agent-prompt-task.js';
9
10
  // Flow
10
11
  export { FlowRunner } from './flow/runner.js';
12
+ export { resolveReferences } from './flow/references.js';
11
13
  // DAG
12
14
  export { topologicalSort, CircularDependencyError, MissingDependencyError, } from './dag/resolver.js';
13
15
  export { noopLogger } from './logger.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG7E,OAAO;AACP,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO;AACP,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAU9C,MAAM;AACN,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAG7E,OAAO;AACP,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAQ9D,OAAO;AACP,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAY9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,MAAM;AACN,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAK3B,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { BaseTask, type TaskResult } from './base-task.js';
2
+ export interface AgentPromptOptions {
3
+ prompt: string;
4
+ system?: string;
5
+ model?: string;
6
+ maxTokens?: number;
7
+ schema?: Record<string, unknown>;
8
+ }
9
+ /**
10
+ * Calls the configured LLM provider and returns its response as the step's
11
+ * data. The provider must be registered on the task context as `ctx.llm`.
12
+ *
13
+ * Output shape:
14
+ * - `text` — raw model output (always)
15
+ * - `parsed` — structured value when `schema` was provided and parsing succeeded
16
+ * - `usage` — token usage if reported
17
+ */
18
+ export declare class AgentPromptTask extends BaseTask<AgentPromptOptions> {
19
+ get taskName(): string;
20
+ protected validate(): void;
21
+ execute(): Promise<TaskResult>;
22
+ }
23
+ //# sourceMappingURL=agent-prompt-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-prompt-task.d.ts","sourceRoot":"","sources":["../../src/task/agent-prompt-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG3D,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;GAQG;AACH,qBAAa,eAAgB,SAAQ,QAAQ,CAAC,kBAAkB,CAAC;IAC/D,IAAI,QAAQ,WAEX;IAED,SAAS,CAAC,QAAQ,IAAI,IAAI;IAMpB,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC;CAyBrC"}
@@ -0,0 +1,43 @@
1
+ import { BaseTask } from './base-task.js';
2
+ /**
3
+ * Calls the configured LLM provider and returns its response as the step's
4
+ * data. The provider must be registered on the task context as `ctx.llm`.
5
+ *
6
+ * Output shape:
7
+ * - `text` — raw model output (always)
8
+ * - `parsed` — structured value when `schema` was provided and parsing succeeded
9
+ * - `usage` — token usage if reported
10
+ */
11
+ export class AgentPromptTask extends BaseTask {
12
+ get taskName() {
13
+ return 'agent_prompt';
14
+ }
15
+ validate() {
16
+ if (!this.options?.prompt || typeof this.options.prompt !== 'string') {
17
+ throw new Error('agent_prompt requires a `prompt` string option');
18
+ }
19
+ }
20
+ async execute() {
21
+ const provider = this.ctx.llm;
22
+ if (!provider || typeof provider.complete !== 'function') {
23
+ return {
24
+ success: false,
25
+ error: new Error('agent_prompt: no LLM provider configured. Attach one to ctx.llm before running.'),
26
+ };
27
+ }
28
+ const response = await provider.complete({
29
+ prompt: this.options.prompt,
30
+ system: this.options.system,
31
+ model: this.options.model,
32
+ maxTokens: this.options.maxTokens,
33
+ schema: this.options.schema,
34
+ });
35
+ const data = { text: response.text };
36
+ if (response.parsed !== undefined)
37
+ data.parsed = response.parsed;
38
+ if (response.usage)
39
+ data.usage = response.usage;
40
+ return { success: true, data };
41
+ }
42
+ }
43
+ //# sourceMappingURL=agent-prompt-task.js.map
@@ -0,0 +1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AI,QAAQ,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAEhD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACjC,CAAC;CACF"}
@@ -5,11 +5,21 @@ export interface TaskContext {
5
5
  registry?: TaskRegistry;
6
6
  [key: string]: unknown;
7
7
  }
8
+ /**
9
+ * Rollback record returned by a successful mutation task.
10
+ * The runner invokes `taskName` with `payload` (in reverse step order)
11
+ * when `rollback_on_failure` is enabled and a subsequent step fails.
12
+ */
13
+ export interface RollbackRecord {
14
+ taskName: string;
15
+ payload: Record<string, unknown>;
16
+ }
8
17
  export interface TaskResult {
9
18
  success: boolean;
10
19
  data?: Record<string, unknown>;
11
20
  error?: Error;
12
21
  duration?: number;
22
+ rollback?: RollbackRecord;
13
23
  }
14
24
  export declare abstract class BaseTask<TOpts = Record<string, unknown>> {
15
25
  protected ctx: TaskContext;