@gobing-ai/ts-dual-workflow-engine 0.3.16 → 0.3.18

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 (53) hide show
  1. package/README.md +22 -6
  2. package/dist/action-step.d.ts +61 -0
  3. package/dist/action-step.d.ts.map +1 -0
  4. package/dist/action-step.js +81 -0
  5. package/dist/errors.d.ts +5 -0
  6. package/dist/errors.d.ts.map +1 -1
  7. package/dist/errors.js +9 -0
  8. package/dist/events.d.ts +41 -0
  9. package/dist/events.d.ts.map +1 -1
  10. package/dist/host.d.ts +10 -1
  11. package/dist/host.d.ts.map +1 -1
  12. package/dist/host.js +41 -2
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +2 -2
  16. package/dist/persistence.d.ts +35 -1
  17. package/dist/persistence.d.ts.map +1 -1
  18. package/dist/persistence.js +112 -5
  19. package/dist/run-lifecycle.d.ts +21 -2
  20. package/dist/run-lifecycle.d.ts.map +1 -1
  21. package/dist/run-lifecycle.js +80 -16
  22. package/dist/schema-sql.d.ts.map +1 -1
  23. package/dist/schema-sql.js +5 -0
  24. package/dist/schema.d.ts +4 -0
  25. package/dist/schema.d.ts.map +1 -1
  26. package/dist/schema.js +4 -0
  27. package/dist/service.d.ts +36 -2
  28. package/dist/service.d.ts.map +1 -1
  29. package/dist/service.js +184 -0
  30. package/dist/state-machine.d.ts +2 -7
  31. package/dist/state-machine.d.ts.map +1 -1
  32. package/dist/state-machine.js +72 -71
  33. package/dist/transition-flow.d.ts +2 -0
  34. package/dist/transition-flow.d.ts.map +1 -1
  35. package/dist/transition-flow.js +46 -43
  36. package/dist/types.d.ts +59 -3
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +4 -4
  39. package/schemas/state-machine-workflow.schema.json +5 -1
  40. package/schemas/transition-flow-workflow.schema.json +5 -1
  41. package/src/action-step.ts +130 -0
  42. package/src/errors.ts +11 -0
  43. package/src/events.ts +54 -4
  44. package/src/host.ts +53 -3
  45. package/src/index.ts +7 -1
  46. package/src/persistence.ts +137 -6
  47. package/src/run-lifecycle.ts +113 -15
  48. package/src/schema-sql.ts +5 -0
  49. package/src/schema.ts +4 -0
  50. package/src/service.ts +255 -1
  51. package/src/state-machine.ts +86 -114
  52. package/src/transition-flow.ts +59 -46
  53. package/src/types.ts +61 -2
package/README.md CHANGED
@@ -782,20 +782,24 @@ All three layers are **additive** — EventBus does not replace logging or traci
782
782
 
783
783
  | Event | Payload | When |
784
784
  |-------|---------|------|
785
- | `workflow.run.started` | `{ workflowName, mode, runId, dryRun }` | When a run begins (inside the span) |
786
- | `workflow.run.done` | `{ runId, finalState, transitionsTaken }` | When a run completes successfully |
787
- | `workflow.run.failed` | `{ runId, finalState, reason }` | When a run fails |
785
+ | `workflow.run.started` | `{ workflowName, mode, runId, dryRun, externalKey? }` | When a run begins (inside the span) |
786
+ | `workflow.run.done` | `{ runId, finalState, transitionsTaken, externalKey? }` | When a run completes successfully |
787
+ | `workflow.run.failed` | `{ runId, finalState, reason, externalKey? }` | When a run fails |
788
788
  | `workflow.node.enter` | `{ runId, node, transitionsTaken }` | When entering a state or node |
789
- | `workflow.node.transition` | `{ runId, from, to, trigger }` | On a state/node transition |
789
+ | `workflow.node.transition` | `{ runId, from, to, trigger, externalKey? }` | On a state/node transition |
790
790
  | `workflow.action.start` | `{ runId, node, kind }` | When an action starts executing |
791
791
  | `workflow.action.done` | `{ runId, node, kind, durationMs, ok }` | When an action finishes (success or failure) |
792
792
  | `workflow.action.failed_continue` | `{ runId, node, transitionsTaken, error? }` | When a non-fatal action failure is continued past |
793
793
  | `workflow.custom` | `{ name, payload }` | Emitted by the builtin `event.emit` action |
794
794
  | `workflow.hitl.note` | `{ runId, node, message }` | Emitted by the builtin `note` action |
795
- | `workflow.guard.evaluated` | `{ runId, from, to, kind, passed }` | When a guard condition is evaluated (fires for every guard) |
795
+ | `workflow.guard.evaluated` | `{ runId, from, to, kind, passed, externalKey? }` | When a guard condition is evaluated (fires for every guard) |
796
796
  | `workflow.hitl.ask` | `{ runId, node, kind, message }` | When an interactive HITL prompt is presented |
797
797
  | `workflow.hitl.response` | `{ runId, node, ok }` | When a HITL prompt receives a response |
798
-
798
+ | `workflow.run.reseeded` | `{ runId, fromState, toState, externalKey? }` | When a run's state is force-set via reseed |
799
+ | `workflow.transition.requested` | `{ runId, from, to, trigger, externalKey? }` | When an external transition request is allowed and committed |
800
+ | `workflow.transition.denied` | `{ runId, from, to, reason, externalKey? }` | When an external transition request is denied |
801
+ | `workflow.run.paused` | `{ runId, node, transitionsTaken, externalKey? }` | When a run pauses at a declared pause point |
802
+ | `workflow.run.resumed` | `{ runId, node, externalKey? }` | When a paused run is resumed |
799
803
  ### Compatibility Policy
800
804
 
801
805
  The event map is a **cross-package public contract**. Policy: **additive-only** — new events allowed, new optional payload fields allowed; never rename, remove, or repurpose an existing event or field.
@@ -809,6 +813,18 @@ Event handlers registered via `EventBus.on()` or `EventBus.once()` **must** be:
809
813
 
810
814
  For **durable** audit/history/telemetry, use the persistence layer — every record is written incrementally during the run via direct adapter calls, not through the event bus.
811
815
 
816
+ ### Delivery Scope
817
+
818
+ Event subscriptions are **process-local**: subscribe at startup, receive every event the run produces within
819
+ that process. When a run spans multiple processes (e.g. created in process A, re-attached in process B via
820
+ E1 durable runs, or resumed after restart via E3), each process receives only the events emitted during
821
+ its own execution window. **Cross-process event delivery is explicitly out of scope** — consumers who need
822
+ run-agnostic event history should build on the persistence layer instead.
823
+
824
+ This design keeps the EventBus zero-config and test-friendly: no message broker, no serialization, no
825
+ delivery guarantees. A subscriber in one process never receives events from another process's run
826
+ execution.
827
+
812
828
  ### Usage
813
829
 
814
830
  Pass an `EventBus` via `WorkflowRunOptions.events`:
@@ -0,0 +1,61 @@
1
+ import type { WorkflowEngineHost } from './host';
2
+ import type { RunLifecycle } from './run-lifecycle';
3
+ import { type WorkflowMode } from './run-lifecycle';
4
+ import type { ActionDef, ActionResult, OnErrorPolicy, WorkflowPersistenceAdapter, WorkflowRunOptions } from './types';
5
+ /**
6
+ * Outcome discriminator for a single action step. `terminal` means the action
7
+ * declared terminal success (the run is done); `fail` means a failure under a
8
+ * 'fail' policy (the caller must halt); `completed` means the step ran (possibly
9
+ * a failure that the 'continue' policy logged past) and the loop may proceed.
10
+ */
11
+ export type ActionStepOutcome = 'completed' | 'terminal' | 'fail';
12
+ /** Result of running one or more action steps: last result plus a control-flow discriminator. */
13
+ export interface ActionStepResult {
14
+ readonly outcome: ActionStepOutcome;
15
+ readonly result: ActionResult | undefined;
16
+ }
17
+ /**
18
+ * Everything an action step needs that does not change between the two drivers:
19
+ * the host that owns the runner registry, the persistence sink, the lifecycle for
20
+ * observability, plus the resolution inputs (vars/env/builtins source) and the
21
+ * onError precedence chain. Drivers differ only in how many actions they feed in
22
+ * and how they map the outcome onto their control loop — not in this mechanism.
23
+ */
24
+ export interface ActionStepDeps {
25
+ readonly host: WorkflowEngineHost;
26
+ readonly persistence: WorkflowPersistenceAdapter;
27
+ readonly lifecycle: RunLifecycle;
28
+ readonly workflowName: string;
29
+ readonly stateOrNodeId: string;
30
+ readonly runId: string;
31
+ readonly mode: WorkflowMode;
32
+ readonly transitionsTaken: number;
33
+ readonly env: Record<string, string>;
34
+ readonly options: WorkflowRunOptions;
35
+ readonly defaultOnError: OnErrorPolicy | undefined;
36
+ }
37
+ /**
38
+ * Run one action through its full lifecycle: resolve templates, persist the
39
+ * start row, time the host invocation inside try/finally, persist + emit the
40
+ * finalize, then classify terminal/fail/continue. `vars` is read-only here;
41
+ * callers thread any `setVars` from the returned result back into their own
42
+ * vars map (the merge stays caller-owned because the two drivers carry vars
43
+ * differently across their loops).
44
+ *
45
+ * This is the single seam both drivers share for action execution (ADR-006 §7
46
+ * keeps the *control loops* dialect-specific; only this per-action mechanism is
47
+ * shared). Returns the action result plus an outcome discriminator.
48
+ */
49
+ export declare function runActionStep(action: ActionDef, vars: Record<string, string>, deps: ActionStepDeps): Promise<ActionStepResult>;
50
+ /**
51
+ * Run a sequence of actions in declaration order, stopping at the first
52
+ * `terminal` or `fail` outcome. Every action resolves its templates against the
53
+ * same `vars` snapshot the caller passed in — `setVars` does not affect later
54
+ * actions within the same sequence; it is the caller (the state-machine driver)
55
+ * that merges the returned result's `setVars` into its run-local vars after the
56
+ * sequence settles. Returns the last action result (retained even when a failure
57
+ * was continued past, so downstream guards can inspect it) plus the controlling
58
+ * outcome.
59
+ */
60
+ export declare function runActionSequence(actions: readonly ActionDef[], vars: Record<string, string>, deps: ActionStepDeps): Promise<ActionStepResult>;
61
+ //# sourceMappingURL=action-step.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-step.d.ts","sourceRoot":"","sources":["../src/action-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGtH;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAElE,iGAAiG;AACjG,MAAM,WAAW,gBAAgB;IAC7B,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,WAAW,EAAE,0BAA0B,CAAC;IACjD,QAAQ,CAAC,SAAS,EAAE,YAAY,CAAC;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,QAAQ,CAAC,cAAc,EAAE,aAAa,GAAG,SAAS,CAAC;CACtD;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAC/B,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,cAAc,GACrB,OAAO,CAAC,gBAAgB,CAAC,CA+C3B;AAED;;;;;;;;;GASG;AACH,wBAAsB,iBAAiB,CACnC,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,IAAI,EAAE,cAAc,GACrB,OAAO,CAAC,gBAAgB,CAAC,CAS3B"}
@@ -0,0 +1,81 @@
1
+ import { runtimeBuiltins } from './run-lifecycle.js';
2
+ import { resolveOnErrorPolicy, resolveTemplates } from './variables.js';
3
+ /**
4
+ * Run one action through its full lifecycle: resolve templates, persist the
5
+ * start row, time the host invocation inside try/finally, persist + emit the
6
+ * finalize, then classify terminal/fail/continue. `vars` is read-only here;
7
+ * callers thread any `setVars` from the returned result back into their own
8
+ * vars map (the merge stays caller-owned because the two drivers carry vars
9
+ * differently across their loops).
10
+ *
11
+ * This is the single seam both drivers share for action execution (ADR-006 §7
12
+ * keeps the *control loops* dialect-specific; only this per-action mechanism is
13
+ * shared). Returns the action result plus an outcome discriminator.
14
+ */
15
+ export async function runActionStep(action, vars, deps) {
16
+ const { host, persistence, lifecycle, stateOrNodeId, runId } = deps;
17
+ const resolved = resolveTemplates(action.options ?? {}, {
18
+ vars,
19
+ env: deps.env,
20
+ builtins: runtimeBuiltins(deps.workflowName, stateOrNodeId, runId, deps.transitionsTaken, deps.mode),
21
+ });
22
+ const actionId = await persistence.saveActionStart(runId, stateOrNodeId, action.kind);
23
+ const actionStartMs = Date.now();
24
+ lifecycle.actionStart(stateOrNodeId, action.kind);
25
+ let result;
26
+ try {
27
+ result = await host.runAction(action.kind, resolved, {
28
+ runId,
29
+ workdir: deps.options.workdir,
30
+ stateOrNodeId,
31
+ vars,
32
+ env: deps.env,
33
+ metadata: deps.options.metadata,
34
+ events: deps.options.events,
35
+ });
36
+ }
37
+ finally {
38
+ const durationMs = Date.now() - actionStartMs;
39
+ lifecycle.actionDone(stateOrNodeId, action.kind, durationMs, result?.ok ?? false);
40
+ // Fire-and-forget the finalize write: the action row already exists (saveActionStart
41
+ // was awaited), and finalize only updates audit fields — the run's correctness never
42
+ // depends on it, so it must not block or fail the control loop. A swallowed `.catch`
43
+ // keeps a rejected write from surfacing as an unhandledRejection (repo convention,
44
+ // see runtime/process-executor.ts).
45
+ void persistence
46
+ .saveActionFinalize(actionId, result?.ok !== false ? 'done' : 'failed', durationMs, result?.ok ?? false, result)
47
+ .catch(() => undefined);
48
+ }
49
+ if (result.terminal === true)
50
+ return { outcome: 'terminal', result };
51
+ if (!result.ok) {
52
+ const policy = resolveOnErrorPolicy(action.onError, deps.defaultOnError, deps.options.onError);
53
+ if (policy === 'fail')
54
+ return { outcome: 'fail', result };
55
+ lifecycle.warnActionFailed(stateOrNodeId, deps.transitionsTaken, result.error);
56
+ }
57
+ return { outcome: 'completed', result };
58
+ }
59
+ /**
60
+ * Run a sequence of actions in declaration order, stopping at the first
61
+ * `terminal` or `fail` outcome. Every action resolves its templates against the
62
+ * same `vars` snapshot the caller passed in — `setVars` does not affect later
63
+ * actions within the same sequence; it is the caller (the state-machine driver)
64
+ * that merges the returned result's `setVars` into its run-local vars after the
65
+ * sequence settles. Returns the last action result (retained even when a failure
66
+ * was continued past, so downstream guards can inspect it) plus the controlling
67
+ * outcome.
68
+ */
69
+ export async function runActionSequence(actions, vars, deps) {
70
+ let last;
71
+ for (const action of actions) {
72
+ const step = await runActionStep(action, vars, deps);
73
+ if (step.result !== undefined)
74
+ last = step.result;
75
+ if (step.outcome === 'terminal')
76
+ return { outcome: 'terminal', result: last };
77
+ if (step.outcome === 'fail')
78
+ return { outcome: 'fail', result: last };
79
+ }
80
+ return { outcome: 'completed', result: last };
81
+ }
package/dist/errors.d.ts CHANGED
@@ -12,4 +12,9 @@ export declare class FSMError extends Error {
12
12
  export declare class RunCollisionError extends Error {
13
13
  constructor(runId: string);
14
14
  }
15
+ /** Error raised when attempting to resume a run that is not paused. */
16
+ export declare class WorkflowResumeError extends Error {
17
+ readonly details?: unknown | undefined;
18
+ constructor(message: string, details?: unknown | undefined);
19
+ }
15
20
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,qBAAa,uBAAwB,SAAQ,KAAK;IAG1C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAD1B,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,OAAO,YAAA;CAKjC;AAED,0EAA0E;AAC1E,qBAAa,QAAS,SAAQ,KAAK;IAG3B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAD1B,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,OAAO,YAAA;CAKjC;AAED,0EAA0E;AAC1E,qBAAa,iBAAkB,SAAQ,KAAK;gBAC5B,KAAK,EAAE,MAAM;CAI5B"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,qBAAa,uBAAwB,SAAQ,KAAK;IAG1C,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAD1B,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,OAAO,YAAA;CAKjC;AAED,0EAA0E;AAC1E,qBAAa,QAAS,SAAQ,KAAK;IAG3B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAD1B,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,OAAO,YAAA;CAKjC;AAED,0EAA0E;AAC1E,qBAAa,iBAAkB,SAAQ,KAAK;gBAC5B,KAAK,EAAE,MAAM;CAI5B;AAED,uEAAuE;AACvE,qBAAa,mBAAoB,SAAQ,KAAK;IAGtC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO;gBAD1B,OAAO,EAAE,MAAM,EACN,OAAO,CAAC,EAAE,OAAO,YAAA;CAKjC"}
package/dist/errors.js CHANGED
@@ -23,3 +23,12 @@ export class RunCollisionError extends Error {
23
23
  this.name = 'RunCollisionError';
24
24
  }
25
25
  }
26
+ /** Error raised when attempting to resume a run that is not paused. */
27
+ export class WorkflowResumeError extends Error {
28
+ details;
29
+ constructor(message, details) {
30
+ super(message);
31
+ this.details = details;
32
+ this.name = 'WorkflowResumeError';
33
+ }
34
+ }
package/dist/events.d.ts CHANGED
@@ -6,18 +6,21 @@ export type WorkflowEngineEvents = {
6
6
  mode: string;
7
7
  runId: string;
8
8
  dryRun: boolean;
9
+ externalKey?: string;
9
10
  }) => void;
10
11
  /** Emitted when a run completes successfully. */
11
12
  'workflow.run.done': (data: {
12
13
  runId: string;
13
14
  finalState: string;
14
15
  transitionsTaken: number;
16
+ externalKey?: string;
15
17
  }) => void;
16
18
  /** Emitted when a run fails. */
17
19
  'workflow.run.failed': (data: {
18
20
  runId: string;
19
21
  finalState: string;
20
22
  reason: string;
23
+ externalKey?: string;
21
24
  }) => void;
22
25
  /** Emitted when entering a state or node. */
23
26
  'workflow.node.enter': (data: {
@@ -31,6 +34,7 @@ export type WorkflowEngineEvents = {
31
34
  from: string;
32
35
  to: string;
33
36
  trigger: string | null;
37
+ externalKey?: string;
34
38
  }) => void;
35
39
  /** Emitted when an action starts executing. */
36
40
  'workflow.action.start': (data: {
@@ -71,6 +75,7 @@ export type WorkflowEngineEvents = {
71
75
  to: string;
72
76
  kind: string;
73
77
  passed: boolean;
78
+ externalKey?: string;
74
79
  }) => void;
75
80
  /** Emitted when an interactive HITL prompt is presented and the engine waits for input. */
76
81
  'workflow.hitl.ask': (data: {
@@ -85,5 +90,41 @@ export type WorkflowEngineEvents = {
85
90
  node: string;
86
91
  ok: boolean;
87
92
  }) => void;
93
+ /** Emitted when a run's state is force-set via reseed (consumer-side authority reconciliation). */
94
+ 'workflow.run.reseeded': (data: {
95
+ runId: string;
96
+ fromState: string;
97
+ toState: string;
98
+ externalKey?: string;
99
+ }) => void;
100
+ /** Emitted when an external transition request is allowed and committed. */
101
+ 'workflow.transition.requested': (data: {
102
+ runId: string;
103
+ from: string;
104
+ to: string;
105
+ trigger: string | null;
106
+ externalKey?: string;
107
+ }) => void;
108
+ /** Emitted when an external transition request is denied. */
109
+ 'workflow.transition.denied': (data: {
110
+ runId: string;
111
+ from: string;
112
+ to: string;
113
+ reason: string;
114
+ externalKey?: string;
115
+ }) => void;
116
+ /** Emitted when a run pauses at a declared pause point. */
117
+ 'workflow.run.paused': (data: {
118
+ runId: string;
119
+ node: string;
120
+ transitionsTaken: number;
121
+ externalKey?: string;
122
+ }) => void;
123
+ /** Emitted when a paused run is resumed. */
124
+ 'workflow.run.resumed': (data: {
125
+ runId: string;
126
+ node: string;
127
+ externalKey?: string;
128
+ }) => void;
88
129
  };
89
130
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,MAAM,oBAAoB,GAAG;IAC/B,mDAAmD;IACnD,sBAAsB,EAAE,CAAC,IAAI,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,M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-runtime';
2
2
  import { type CapabilityOrigin } from '@gobing-ai/ts-runtime/extension';
3
- import type { ActionResult, ActionRunContext, ActionRunner, GuardContext, GuardRunner } from './types';
3
+ import type { ActionResult, ActionRunContext, ActionRunner, GuardContext, GuardEvaluationResult, GuardRunner } from './types';
4
4
  /** Registry owner for workflow actions and guards. */
5
5
  export declare class WorkflowEngineHost {
6
6
  private readonly actions;
@@ -25,6 +25,8 @@ export declare class WorkflowEngineHost {
25
25
  runAction(kind: string, options: Record<string, unknown>, context: ActionRunContext): Promise<ActionResult>;
26
26
  /** Evaluate a registered guard. */
27
27
  evaluateGuard(kind: string, options: Record<string, unknown>, context: GuardContext): Promise<boolean>;
28
+ /** Evaluate a registered guard and preserve any machine-readable report it returns. */
29
+ evaluateGuardResult(kind: string, options: Record<string, unknown>, context: GuardContext): Promise<GuardEvaluationResult>;
28
30
  }
29
31
  /** Create a workflow host with built-in note, shell, always, and action-ok capabilities. */
30
32
  export declare function createDefaultWorkflowEngineHost(options?: {
@@ -57,4 +59,11 @@ export declare class ShellActionRunner implements ActionRunner {
57
59
  */
58
60
  execute(options: Record<string, unknown>, context: ActionRunContext): Promise<ActionResult>;
59
61
  }
62
+ /** Built-in shell guard backed by ts-runtime ProcessExecutor; passes when the command exits with 0. */
63
+ export declare class ShellGuardRunner implements GuardRunner {
64
+ private readonly processExecutor;
65
+ readonly kind = "shell";
66
+ constructor(processExecutor: ProcessExecutor);
67
+ evaluate(options: Record<string, unknown>, context: GuardContext): Promise<GuardEvaluationResult>;
68
+ }
60
69
  //# sourceMappingURL=host.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../src/host.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,KAAK,gBAAgB,EAAsB,MAAM,iCAAiC,CAAC;AAE5F,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,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,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CASrG;AAED,yFAAyF;AACzF,qBAAa,qBAAsB,YAAW,YAAY;IACtD,QAAQ,CAAC,IAAI,gBAAgB;IAEvB,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAOrG;AAED,kEAAkE;AAClE,qBAAa,iBAAkB,YAAW,YAAY;IAGtC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAF5C,QAAQ,CAAC,IAAI,WAAW;gBAEK,eAAe,EAAE,eAAe;IAE7D;;;;;;;;OAQG;IACG,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAkBpG;AAED,uGAAuG;AACvG,qBAAa,gBAAiB,YAAW,WAAW;IAGpC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAF5C,QAAQ,CAAC,IAAI,WAAW;gBAEK,eAAe,EAAE,eAAe;IAEvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAiB1G"}
package/dist/host.js CHANGED
@@ -49,9 +49,14 @@ export class WorkflowEngineHost {
49
49
  }
50
50
  /** Evaluate a registered guard. */
51
51
  async evaluateGuard(kind, options, context) {
52
+ return (await this.evaluateGuardResult(kind, options, context)).passed;
53
+ }
54
+ /** Evaluate a registered guard and preserve any machine-readable report it returns. */
55
+ async evaluateGuardResult(kind, options, context) {
52
56
  if (!this.guards.has(kind))
53
57
  throw new WorkflowValidationError(`Unknown workflow guard "${kind}"`);
54
- return await this.guards.get(kind).evaluate(options, context);
58
+ const result = await this.guards.get(kind).evaluate(options, context);
59
+ return typeof result === 'boolean' ? { passed: result } : result;
55
60
  }
56
61
  }
57
62
  /** Create a workflow host with built-in note, shell, always, and action-ok capabilities. */
@@ -60,6 +65,7 @@ export function createDefaultWorkflowEngineHost(options = {}) {
60
65
  host.registerAction(new NoteActionRunner(), 'builtin');
61
66
  host.registerAction(new ShellActionRunner(options.processExecutor ?? new NodeProcessExecutor()), 'builtin');
62
67
  host.registerAction(new EventEmitActionRunner(), 'builtin');
68
+ host.registerGuard(new ShellGuardRunner(options.processExecutor ?? new NodeProcessExecutor()), 'builtin');
63
69
  host.registerGuard({ kind: 'always', evaluate: async () => true }, 'builtin');
64
70
  host.registerGuard({ kind: 'never', evaluate: async () => false }, 'builtin');
65
71
  host.registerGuard({
@@ -118,7 +124,7 @@ export class ShellActionRunner {
118
124
  const result = await this.processExecutor.run({
119
125
  command: spawn.command,
120
126
  args: spawn.args,
121
- cwd: stringOption(options, 'cwd', context.workdir),
127
+ cwd: optionalStringOption(options, 'cwd', context.workdir),
122
128
  rejectOnError: false,
123
129
  forceBuffered: true,
124
130
  });
@@ -129,6 +135,31 @@ export class ShellActionRunner {
129
135
  };
130
136
  }
131
137
  }
138
+ /** Built-in shell guard backed by ts-runtime ProcessExecutor; passes when the command exits with 0. */
139
+ export class ShellGuardRunner {
140
+ processExecutor;
141
+ kind = 'shell';
142
+ constructor(processExecutor) {
143
+ this.processExecutor = processExecutor;
144
+ }
145
+ async evaluate(options, context) {
146
+ const command = stringOption(options, 'command');
147
+ const explicitArgs = arrayOption(options, 'args');
148
+ const usesShell = explicitArgs.length === 0;
149
+ const spawn = usesShell ? { command: '/bin/sh', args: ['-c', command] } : { command, args: explicitArgs };
150
+ const result = await this.processExecutor.run({
151
+ command: spawn.command,
152
+ args: spawn.args,
153
+ cwd: optionalStringOption(options, 'cwd', context.workdir),
154
+ rejectOnError: false,
155
+ forceBuffered: true,
156
+ });
157
+ return {
158
+ passed: result.exitCode === 0,
159
+ report: { stdout: result.stdout, stderr: result.stderr, exitCode: result.exitCode },
160
+ };
161
+ }
162
+ }
132
163
  function stringOption(options, key, fallback) {
133
164
  const value = options[key];
134
165
  if (typeof value === 'string')
@@ -137,6 +168,14 @@ function stringOption(options, key, fallback) {
137
168
  return fallback;
138
169
  throw new WorkflowValidationError(`Action option "${key}" must be a string`);
139
170
  }
171
+ function optionalStringOption(options, key, fallback) {
172
+ const value = options[key];
173
+ if (typeof value === 'string')
174
+ return value;
175
+ if (value === undefined)
176
+ return fallback;
177
+ throw new WorkflowValidationError(`Action option "${key}" must be a string`);
178
+ }
140
179
  function arrayOption(options, key) {
141
180
  const value = options[key];
142
181
  if (value === undefined)
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { loadWorkflowDef, loadWorkflowDefFromText, validateWorkflowDef } from './config';
2
- export { FSMError, RunCollisionError, WorkflowValidationError } from './errors';
2
+ export { FSMError, RunCollisionError, WorkflowResumeError, WorkflowValidationError } from './errors';
3
3
  export type { WorkflowEngineEvents } from './events';
4
4
  export { type LoadWorkflowExtensionsOptions, loadWorkflowExtensionsIntoHost, type WorkflowExtensionKind, type WorkflowExtensionLogger, type WorkflowExtensionRef, } from './extensions';
5
5
  export type { HitlAnswer, HitlRequest, HitlRequestKind, HitlResponder } from './hitl';
6
- export { createDefaultWorkflowEngineHost, EventEmitActionRunner, NoteActionRunner, ShellActionRunner, WorkflowEngineHost, } from './host';
6
+ export { createDefaultWorkflowEngineHost, EventEmitActionRunner, NoteActionRunner, ShellActionRunner, ShellGuardRunner, WorkflowEngineHost, } from './host';
7
7
  export { applyWorkflowEngineSchema, DbWorkflowPersistenceAdapter, MemoryWorkflowPersistenceAdapter, } from './persistence';
8
8
  export { allowedEnv, RUNTIME_BUILTIN_KEYS, RunLifecycle, type RunLifecycleDeps, runtimeBuiltins, type WorkflowMode, } from './run-lifecycle';
9
9
  export { ActionDefSchema, GuardDefSchema, StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema, WorkflowDefSchema, } from './schema';
@@ -11,6 +11,6 @@ export { WORKFLOW_ENGINE_SCHEMA_SQL } from './schema-sql';
11
11
  export { WorkflowService } from './service';
12
12
  export { StateMachineDriver, type StateMachineDriverOptions } from './state-machine';
13
13
  export { TransitionFlowDriver, type TransitionFlowDriverOptions } from './transition-flow';
14
- export type { ActionDef, ActionRedactor, ActionResult, ActionRunContext, ActionRunner, ActionRunRecord, Env, FlowEdgeDef, FlowNodeDef, GuardContext, GuardDef, GuardRunner, OnErrorPolicy, StateDef, StateMachineWorkflowDef, TransitionDef, TransitionFlowWorkflowDef, Vars, WorkflowDef, WorkflowPersistenceAdapter, WorkflowRunOptions, WorkflowRunRecord, WorkflowRunResult, WorkflowStatus, } from './types';
14
+ export type { ActionDef, ActionRedactor, ActionResult, ActionRunContext, ActionRunner, ActionRunRecord, Env, FlowEdgeDef, FlowNodeDef, GuardContext, GuardDef, GuardEvaluationResult, GuardRunner, OnErrorPolicy, StateDef, StateMachineWorkflowDef, TransitionAllowed, TransitionDef, TransitionDenied, TransitionDeniedReason, TransitionFlowWorkflowDef, TransitionRequestResult, Vars, WorkflowDef, WorkflowPersistenceAdapter, WorkflowRunOptions, WorkflowRunRecord, WorkflowRunResult, WorkflowStatus, } from './types';
15
15
  export { mergeSetVars, mergeVars, resolveOnErrorPolicy, resolveTemplateString, resolveTemplates, type VariableContext, } from './variables';
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAChF,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EACH,KAAK,6BAA6B,EAClC,8BAA8B,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B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,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,GAAG,EACH,WAAW,EACX,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,qBAAqB,EACrB,WAAW,EACX,aAAa,EACb,QAAQ,EACR,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,EACvB,IAAI,EACJ,WAAW,EACX,0BAA0B,EAC1B,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACH,YAAY,EACZ,SAAS,EACT,oBAAoB,EACpB,qBAAqB,EACrB,gBAAgB,EAChB,KAAK,eAAe,GACvB,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { loadWorkflowDef, loadWorkflowDefFromText, validateWorkflowDef } from './config.js';
2
- export { FSMError, RunCollisionError, WorkflowValidationError } from './errors.js';
2
+ export { FSMError, RunCollisionError, WorkflowResumeError, WorkflowValidationError } from './errors.js';
3
3
  export { loadWorkflowExtensionsIntoHost, } from './extensions.js';
4
- export { createDefaultWorkflowEngineHost, EventEmitActionRunner, NoteActionRunner, ShellActionRunner, WorkflowEngineHost, } from './host.js';
4
+ export { createDefaultWorkflowEngineHost, EventEmitActionRunner, NoteActionRunner, ShellActionRunner, ShellGuardRunner, WorkflowEngineHost, } from './host.js';
5
5
  export { applyWorkflowEngineSchema, DbWorkflowPersistenceAdapter, MemoryWorkflowPersistenceAdapter, } from './persistence.js';
6
6
  export { allowedEnv, RUNTIME_BUILTIN_KEYS, RunLifecycle, runtimeBuiltins, } from './run-lifecycle.js';
7
7
  export { ActionDefSchema, GuardDefSchema, StateMachineWorkflowDefSchema, TransitionFlowWorkflowDefSchema, WorkflowDefSchema, } from './schema.js';
@@ -1,11 +1,19 @@
1
1
  import type { DbAdapter } from '@gobing-ai/ts-db';
2
- import type { ActionRedactor, WorkflowPersistenceAdapter, WorkflowRunRecord, WorkflowStatus } from './types';
2
+ import type { ActionRedactor, WorkflowPersistenceAdapter, WorkflowReseedResult, WorkflowRunRecord, WorkflowStatus } from './types';
3
3
  /** Apply workflow-engine-owned schema to a database adapter. */
4
4
  export declare function applyWorkflowEngineSchema(db: DbAdapter): Promise<void>;
5
5
  /** SQLite/D1-compatible workflow persistence adapter backed by ts-db. */
6
6
  export declare class DbWorkflowPersistenceAdapter implements WorkflowPersistenceAdapter {
7
7
  private readonly db;
8
+ /** Memoized schema-ensure; the DDL runs at most once per adapter instance. */
9
+ private schemaReady;
8
10
  constructor(db: DbAdapter);
11
+ /**
12
+ * Apply the workflow-engine schema once per adapter, latching the in-flight
13
+ * promise so concurrent first calls share a single DDL pass. Every public
14
+ * read/write awaits this instead of re-running the idempotent DDL per call.
15
+ */
16
+ private ensureSchema;
9
17
  /** Create a run row, rejecting duplicate run ids. */
10
18
  createRun(record: WorkflowRunRecord): Promise<void>;
11
19
  /** Finalize a run with terminal status and timestamp. */
@@ -24,6 +32,19 @@ export declare class DbWorkflowPersistenceAdapter implements WorkflowPersistence
24
32
  loadRun(runId: string): Promise<WorkflowRunRecord | undefined>;
25
33
  /** List persisted workflow runs. */
26
34
  listRuns(): Promise<readonly WorkflowRunRecord[]>;
35
+ /** Look up a run by its external key within a workflow definition. */
36
+ findRunByKey(workflowName: string, externalKey: string): Promise<WorkflowRunRecord | undefined>;
37
+ /** Create a run or attach to an existing one by external key. */
38
+ createOrAttachRun(record: WorkflowRunRecord): Promise<WorkflowRunRecord>;
39
+ /** Force-set the current state of a run (reseed). */
40
+ reseedRun(runId: string, newState: string): Promise<WorkflowReseedResult>;
41
+ /** Load the current state name for a run. */
42
+ loadCurrentState(runId: string): Promise<string | undefined>;
43
+ /** List runs with status 'paused'. Ordered most-recent-first. */
44
+ listPausedRuns(options?: {
45
+ workflowName?: string;
46
+ limit?: number;
47
+ }): Promise<readonly WorkflowRunRecord[]>;
27
48
  }
28
49
  /** In-memory persistence adapter for tests and embedding. */
29
50
  export declare class MemoryWorkflowPersistenceAdapter implements WorkflowPersistenceAdapter {
@@ -72,5 +93,18 @@ export declare class MemoryWorkflowPersistenceAdapter implements WorkflowPersist
72
93
  loadRun(runId: string): Promise<WorkflowRunRecord | undefined>;
73
94
  /** List persisted workflow runs. */
74
95
  listRuns(): Promise<readonly WorkflowRunRecord[]>;
96
+ /** Look up a run by its external key within a workflow definition. */
97
+ findRunByKey(workflowName: string, externalKey: string): Promise<WorkflowRunRecord | undefined>;
98
+ /** Create a run or attach to an existing one by external key. */
99
+ createOrAttachRun(record: WorkflowRunRecord): Promise<WorkflowRunRecord>;
100
+ /** Force-set the current state of a run (reseed). */
101
+ reseedRun(runId: string, newState: string): Promise<WorkflowReseedResult>;
102
+ /** Load the current state name for a run. */
103
+ loadCurrentState(runId: string): Promise<string | undefined>;
104
+ /** List runs with status 'paused'. Ordered most-recent-first. */
105
+ listPausedRuns(options?: {
106
+ workflowName?: string;
107
+ limit?: number;
108
+ }): Promise<readonly WorkflowRunRecord[]>;
75
109
  }
76
110
  //# sourceMappingURL=persistence.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"persistence.d.ts","sourceRoot":"","sources":["../src/persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,KAAK,EAAE,cAAc,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7G,gEAAgE;AAChE,wBAAsB,yBAAyB,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAK5E;AAED,yEAAyE;AACzE,qBAAa,4BAA6B,YAAW,0BAA0B;IAC/D,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,SAAS;IAE1C,qDAAqD;IAC/C,SAAS,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IA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