@pikku/core 0.11.0 → 0.11.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.
Files changed (184) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/dist/errors/error-handler.js +3 -3
  3. package/dist/errors/errors.d.ts +1 -1
  4. package/dist/errors/errors.js +3 -3
  5. package/dist/function/function-runner.d.ts +8 -8
  6. package/dist/function/function-runner.js +88 -23
  7. package/dist/function/functions.types.d.ts +104 -33
  8. package/dist/function/functions.types.js +50 -7
  9. package/dist/handle-error.d.ts +1 -1
  10. package/dist/handle-error.js +1 -1
  11. package/dist/index.d.ts +6 -2
  12. package/dist/index.js +5 -2
  13. package/dist/middleware/auth-apikey.d.ts +1 -1
  14. package/dist/middleware/auth-apikey.js +3 -3
  15. package/dist/middleware/auth-bearer.d.ts +1 -1
  16. package/dist/middleware/auth-bearer.js +3 -3
  17. package/dist/middleware/auth-cookie.d.ts +1 -1
  18. package/dist/middleware/auth-cookie.js +5 -5
  19. package/dist/middleware/timeout.d.ts +1 -1
  20. package/dist/middleware/timeout.js +3 -2
  21. package/dist/middleware-runner.d.ts +6 -20
  22. package/dist/middleware-runner.js +19 -20
  23. package/dist/permissions.d.ts +6 -89
  24. package/dist/permissions.js +24 -81
  25. package/dist/pikku-state.d.ts +32 -104
  26. package/dist/pikku-state.js +140 -66
  27. package/dist/schema.d.ts +8 -6
  28. package/dist/schema.js +25 -13
  29. package/dist/services/user-session-service.d.ts +7 -3
  30. package/dist/services/user-session-service.js +8 -1
  31. package/dist/services/workflow-service.d.ts +38 -0
  32. package/dist/services/workflow-service.js +1 -0
  33. package/dist/types/core.types.d.ts +40 -41
  34. package/dist/types/core.types.js +4 -15
  35. package/dist/types/state.types.d.ts +135 -0
  36. package/dist/types/state.types.js +1 -0
  37. package/dist/utils.d.ts +9 -1
  38. package/dist/utils.js +48 -3
  39. package/dist/wirings/channel/channel-common.js +2 -3
  40. package/dist/wirings/channel/channel-handler.d.ts +3 -2
  41. package/dist/wirings/channel/channel-handler.js +7 -10
  42. package/dist/wirings/channel/channel-runner.d.ts +2 -2
  43. package/dist/wirings/channel/channel-runner.js +5 -5
  44. package/dist/wirings/channel/channel.types.d.ts +10 -5
  45. package/dist/wirings/channel/local/local-channel-runner.d.ts +1 -1
  46. package/dist/wirings/channel/local/local-channel-runner.js +19 -26
  47. package/dist/wirings/channel/log-channels.js +1 -1
  48. package/dist/wirings/channel/serverless/serverless-channel-runner.d.ts +1 -1
  49. package/dist/wirings/channel/serverless/serverless-channel-runner.js +43 -48
  50. package/dist/wirings/cli/channel/cli-channel-runner.js +3 -2
  51. package/dist/wirings/cli/cli-runner.d.ts +5 -5
  52. package/dist/wirings/cli/cli-runner.js +20 -38
  53. package/dist/wirings/cli/cli.types.d.ts +16 -11
  54. package/dist/wirings/forge-node/forge-node.types.d.ts +120 -0
  55. package/dist/wirings/forge-node/forge-node.types.js +38 -0
  56. package/dist/wirings/forge-node/index.d.ts +1 -0
  57. package/dist/wirings/forge-node/index.js +1 -0
  58. package/dist/wirings/http/http-runner.d.ts +8 -8
  59. package/dist/wirings/http/http-runner.js +46 -51
  60. package/dist/wirings/http/http.types.d.ts +19 -11
  61. package/dist/wirings/http/log-http-routes.js +1 -1
  62. package/dist/wirings/http/routers/path-to-regex.js +2 -2
  63. package/dist/wirings/mcp/mcp-runner.d.ts +2 -2
  64. package/dist/wirings/mcp/mcp-runner.js +33 -40
  65. package/dist/wirings/mcp/mcp.types.d.ts +6 -0
  66. package/dist/wirings/queue/queue-runner.d.ts +3 -3
  67. package/dist/wirings/queue/queue-runner.js +13 -23
  68. package/dist/wirings/queue/queue.types.d.ts +4 -11
  69. package/dist/wirings/rpc/index.d.ts +1 -1
  70. package/dist/wirings/rpc/index.js +1 -1
  71. package/dist/wirings/rpc/rpc-runner.d.ts +17 -16
  72. package/dist/wirings/rpc/rpc-runner.js +98 -61
  73. package/dist/wirings/rpc/rpc-types.d.ts +7 -0
  74. package/dist/wirings/scheduler/log-schedulers.js +1 -1
  75. package/dist/wirings/scheduler/scheduler-runner.d.ts +3 -3
  76. package/dist/wirings/scheduler/scheduler-runner.js +18 -29
  77. package/dist/wirings/scheduler/scheduler.types.d.ts +3 -8
  78. package/dist/wirings/trigger/index.d.ts +2 -0
  79. package/dist/wirings/trigger/index.js +2 -0
  80. package/dist/wirings/trigger/trigger-runner.d.ts +29 -0
  81. package/dist/wirings/trigger/trigger-runner.js +57 -0
  82. package/dist/wirings/trigger/trigger.types.d.ts +42 -0
  83. package/dist/wirings/trigger/trigger.types.js +1 -0
  84. package/dist/wirings/workflow/dsl/index.d.ts +5 -0
  85. package/dist/wirings/workflow/dsl/index.js +4 -0
  86. package/dist/wirings/workflow/dsl/workflow-dsl.types.d.ts +286 -0
  87. package/dist/wirings/workflow/dsl/workflow-dsl.types.js +5 -0
  88. package/dist/wirings/workflow/dsl/workflow-runner.d.ts +5 -0
  89. package/dist/wirings/workflow/dsl/workflow-runner.js +22 -0
  90. package/dist/wirings/workflow/graph/graph-node.d.ts +122 -0
  91. package/dist/wirings/workflow/graph/graph-node.js +58 -0
  92. package/dist/wirings/workflow/graph/graph-runner.d.ts +35 -0
  93. package/dist/wirings/workflow/graph/graph-runner.js +452 -0
  94. package/dist/wirings/workflow/graph/index.d.ts +3 -0
  95. package/dist/wirings/workflow/graph/index.js +3 -0
  96. package/dist/wirings/workflow/graph/workflow-graph.types.d.ts +95 -0
  97. package/dist/wirings/workflow/graph/workflow-graph.types.js +15 -0
  98. package/dist/wirings/workflow/index.d.ts +7 -3
  99. package/dist/wirings/workflow/index.js +6 -3
  100. package/dist/wirings/workflow/pikku-workflow-service.d.ts +108 -10
  101. package/dist/wirings/workflow/pikku-workflow-service.js +274 -165
  102. package/dist/wirings/workflow/wire-workflow.d.ts +42 -0
  103. package/dist/wirings/workflow/wire-workflow.js +53 -0
  104. package/dist/wirings/workflow/workflow-utils.d.ts +23 -0
  105. package/dist/wirings/workflow/workflow-utils.js +66 -0
  106. package/dist/wirings/workflow/workflow.types.d.ts +135 -128
  107. package/package.json +11 -2
  108. package/src/errors/error-handler.ts +3 -3
  109. package/src/errors/errors.ts +3 -3
  110. package/src/factory-functions.test.ts +9 -36
  111. package/src/function/function-runner.test.ts +58 -69
  112. package/src/function/function-runner.ts +130 -37
  113. package/src/function/functions.types.ts +193 -54
  114. package/src/handle-error.ts +1 -1
  115. package/src/index.ts +10 -5
  116. package/src/middleware/auth-apikey.test.ts +360 -0
  117. package/src/middleware/auth-apikey.ts +3 -7
  118. package/src/middleware/auth-bearer.test.ts +447 -0
  119. package/src/middleware/auth-bearer.ts +27 -33
  120. package/src/middleware/auth-cookie.test.ts +525 -0
  121. package/src/middleware/auth-cookie.ts +6 -6
  122. package/src/middleware/timeout.ts +4 -2
  123. package/src/middleware-runner.test.ts +58 -127
  124. package/src/middleware-runner.ts +29 -25
  125. package/src/permissions.test.ts +68 -130
  126. package/src/permissions.ts +41 -100
  127. package/src/pikku-state.ts +156 -201
  128. package/src/schema.ts +42 -13
  129. package/src/services/user-session-service.ts +14 -4
  130. package/src/services/workflow-service.ts +74 -0
  131. package/src/types/core.types.ts +79 -58
  132. package/src/types/state.types.ts +195 -0
  133. package/src/utils.ts +59 -4
  134. package/src/wirings/channel/channel-common.ts +4 -7
  135. package/src/wirings/channel/channel-handler.ts +17 -23
  136. package/src/wirings/channel/channel-runner.ts +7 -7
  137. package/src/wirings/channel/channel.types.ts +14 -11
  138. package/src/wirings/channel/local/local-channel-runner.test.ts +8 -4
  139. package/src/wirings/channel/local/local-channel-runner.ts +23 -38
  140. package/src/wirings/channel/log-channels.ts +1 -1
  141. package/src/wirings/channel/serverless/serverless-channel-runner.ts +53 -79
  142. package/src/wirings/cli/channel/cli-channel-runner.ts +4 -3
  143. package/src/wirings/cli/cli-runner.test.ts +26 -26
  144. package/src/wirings/cli/cli-runner.ts +34 -71
  145. package/src/wirings/cli/cli.types.ts +23 -16
  146. package/src/wirings/forge-node/forge-node.types.ts +135 -0
  147. package/src/wirings/forge-node/index.ts +1 -0
  148. package/src/wirings/http/http-runner.test.ts +10 -10
  149. package/src/wirings/http/http-runner.ts +56 -66
  150. package/src/wirings/http/http.types.ts +19 -14
  151. package/src/wirings/http/log-http-routes.ts +1 -1
  152. package/src/wirings/http/routers/path-to-regex.test.ts +30 -19
  153. package/src/wirings/http/routers/path-to-regex.ts +2 -2
  154. package/src/wirings/mcp/mcp-runner.ts +44 -69
  155. package/src/wirings/mcp/mcp.types.ts +6 -0
  156. package/src/wirings/queue/queue-runner.test.ts +641 -0
  157. package/src/wirings/queue/queue-runner.ts +16 -38
  158. package/src/wirings/queue/queue.types.ts +4 -11
  159. package/src/wirings/rpc/index.ts +1 -1
  160. package/src/wirings/rpc/rpc-runner.ts +129 -77
  161. package/src/wirings/rpc/rpc-types.ts +8 -0
  162. package/src/wirings/scheduler/log-schedulers.ts +1 -1
  163. package/src/wirings/scheduler/scheduler-runner.test.ts +627 -0
  164. package/src/wirings/scheduler/scheduler-runner.ts +29 -55
  165. package/src/wirings/scheduler/scheduler.types.ts +3 -9
  166. package/src/wirings/trigger/index.ts +2 -0
  167. package/src/wirings/trigger/trigger-runner.ts +96 -0
  168. package/src/wirings/trigger/trigger.types.ts +56 -0
  169. package/src/wirings/workflow/dsl/index.ts +30 -0
  170. package/src/wirings/workflow/dsl/workflow-dsl.types.ts +312 -0
  171. package/src/wirings/workflow/dsl/workflow-runner.ts +27 -0
  172. package/src/wirings/workflow/graph/graph-node.ts +227 -0
  173. package/src/wirings/workflow/graph/graph-runner.ts +694 -0
  174. package/src/wirings/workflow/graph/index.ts +3 -0
  175. package/src/wirings/workflow/graph/workflow-graph.types.ts +126 -0
  176. package/src/wirings/workflow/index.ts +60 -12
  177. package/src/wirings/workflow/pikku-workflow-service.ts +401 -195
  178. package/src/wirings/workflow/wire-workflow.ts +94 -0
  179. package/src/wirings/workflow/workflow-utils.ts +120 -0
  180. package/src/wirings/workflow/workflow.types.ts +167 -188
  181. package/tsconfig.tsbuildinfo +1 -1
  182. package/dist/wirings/workflow/workflow-runner.d.ts +0 -35
  183. package/dist/wirings/workflow/workflow-runner.js +0 -68
  184. package/src/wirings/workflow/workflow-runner.ts +0 -85
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Ref value - internal representation after input callback is evaluated
3
+ */
4
+ export interface RefValue {
5
+ __isRef: true;
6
+ nodeId: string;
7
+ path?: string;
8
+ }
9
+ /**
10
+ * Helper to create a ref value
11
+ */
12
+ export declare const createRef: (nodeId: string, path?: string) => RefValue;
13
+ /**
14
+ * Check if a value is a ref
15
+ */
16
+ export declare const isRef: (value: unknown) => value is RefValue;
17
+ /**
18
+ * Input reference for fetching step results
19
+ */
20
+ export interface InputRef {
21
+ nodeId: string;
22
+ path?: string;
23
+ }
24
+ /**
25
+ * Ref function type - provides type-safe references to other nodes' outputs
26
+ * The actual typing is done at the pikkuWorkflowGraph level
27
+ */
28
+ export type RefFn<NodeIds extends string = string> = (nodeId: NodeIds, path?: string) => RefValue;
29
+ /**
30
+ * Next node configuration - fully serializable
31
+ * - string: single next node
32
+ * - string[]: parallel execution (all run concurrently)
33
+ * - Record<string, string | string[]>: branching (function calls graph.branch('key'))
34
+ */
35
+ export type NextConfig<NodeIds extends string = string> = NodeIds | NodeIds[] | Record<string, NodeIds | NodeIds[]>;
36
+ /**
37
+ * Graph node configuration - references functions by RPC name
38
+ */
39
+ export interface GraphNodeConfig<NodeIds extends string = string> {
40
+ /** RPC function name */
41
+ func: string;
42
+ /** Input mapping callback - receives ref function, returns input object */
43
+ input?: (ref: RefFn<NodeIds>) => Record<string, unknown>;
44
+ /** Next nodes - string, array, or record for branching */
45
+ next?: NextConfig<NodeIds>;
46
+ /** Error routing - node(s) to execute on error */
47
+ onError?: NodeIds | NodeIds[];
48
+ }
49
+ import type { WorkflowWires } from '../workflow.types.js';
50
+ export type { WorkflowWires };
51
+ /**
52
+ * Workflow graph definition (internal use)
53
+ */
54
+ export interface WorkflowGraphDefinition<Nodes extends Record<string, GraphNodeConfig<string>> = Record<string, GraphNodeConfig>> {
55
+ /** Unique workflow name */
56
+ name: string;
57
+ /** Wire configuration */
58
+ wires: WorkflowWires;
59
+ /** Graph nodes */
60
+ graph: Nodes;
61
+ }
62
+ /**
63
+ * Graph wire context - available to functions running in a workflow graph
64
+ */
65
+ export interface PikkuGraphWire {
66
+ /** Workflow run ID */
67
+ runId: string;
68
+ /** Graph name */
69
+ graphName: string;
70
+ /** Current node ID */
71
+ nodeId: string;
72
+ /**
73
+ * Select which branch to take for Record-based next config.
74
+ * Must be called if the node has a Record `next` configuration.
75
+ * @param key - The branch key to take (must match a key in the next Record)
76
+ */
77
+ branch: (key: string) => void;
78
+ /**
79
+ * Set a state variable value.
80
+ * @param name - Variable name
81
+ * @param value - Value to store
82
+ */
83
+ setState: (name: string, value: unknown) => Promise<void>;
84
+ /**
85
+ * Get the entire state object.
86
+ * @returns The state object with all variables
87
+ */
88
+ getState: () => Promise<Record<string, unknown>>;
89
+ }
90
+ /**
91
+ * Internal mutable state for graph wire (used by runner to capture branch)
92
+ */
93
+ export interface GraphWireState {
94
+ branchKey?: string;
95
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Helper to create a ref value
3
+ */
4
+ export const createRef = (nodeId, path) => ({
5
+ __isRef: true,
6
+ nodeId,
7
+ path,
8
+ });
9
+ /**
10
+ * Check if a value is a ref
11
+ */
12
+ export const isRef = (value) => typeof value === 'object' &&
13
+ value !== null &&
14
+ '__isRef' in value &&
15
+ value.__isRef === true;
@@ -1,6 +1,10 @@
1
1
  /**
2
2
  * Workflow module exports
3
3
  */
4
- export type { CoreWorkflow, WorkflowStepOptions, WorkflowStepMeta, PikkuWorkflowInteraction, PikkuWorkflow, WorkflowsMeta, WorkflowRun, StepState, WorkflowStatus, StepStatus, } from './workflow.types.js';
5
- export { PikkuWorkflowService } from './pikku-workflow-service.js';
6
- export { wireWorkflow } from './workflow-runner.js';
4
+ export { PikkuWorkflowService, WorkflowCancelledException, } from './pikku-workflow-service.js';
5
+ export { addWorkflow } from './dsl/workflow-runner.js';
6
+ export { addWorkflowGraph } from './graph/graph-runner.js';
7
+ export { wireWorkflow } from './wire-workflow.js';
8
+ export type { WorkflowDefinition, WorkflowDefinitionFunc, WorkflowDefinitionGraph, } from './wire-workflow.js';
9
+ export type { WorkflowService, WorkflowServiceConfig, WorkflowHTTPWire, WorkflowWires, WorkflowStatus, StepStatus, WorkflowRun, StepState, CoreWorkflow, PikkuWorkflow, ContextVariable, WorkflowContext, WorkflowsMeta, WorkflowRuntimeMeta, WorkflowsRuntimeMeta, WorkflowStepInput, WorkflowOrchestratorInput, WorkflowSleeperInput, } from './workflow.types.js';
10
+ export type { WorkflowStepOptions, WorkflowWireDoRPC, WorkflowWireDoInline, WorkflowWireSleep, InputSource, OutputBinding, RpcStepMeta, SimpleCondition, Condition, BranchCase, BranchStepMeta, ParallelGroupStepMeta, FanoutStepMeta, ReturnStepMeta, InlineStepMeta, SleepStepMeta, CancelStepMeta, SetStepMeta, SwitchCaseMeta, SwitchStepMeta, FilterStepMeta, ArrayPredicateStepMeta, WorkflowStepMeta, WorkflowStepWire, PikkuWorkflowWire, } from './workflow.types.js';
@@ -1,6 +1,9 @@
1
1
  /**
2
2
  * Workflow module exports
3
3
  */
4
- export { PikkuWorkflowService } from './pikku-workflow-service.js';
5
- // Functions
6
- export { wireWorkflow } from './workflow-runner.js';
4
+ export { PikkuWorkflowService, WorkflowCancelledException, } from './pikku-workflow-service.js';
5
+ // Internal registration functions (used by generated code)
6
+ export { addWorkflow } from './dsl/workflow-runner.js';
7
+ export { addWorkflowGraph } from './graph/graph-runner.js';
8
+ // Unified wireWorkflow function
9
+ export { wireWorkflow } from './wire-workflow.js';
@@ -1,5 +1,35 @@
1
- import { CoreConfig, CoreSingletonServices, CreateSessionServices, SerializedError } from '../../types/core.types.js';
2
- import type { StepState, WorkflowRun, WorkflowStatus, WorkflowService, WorkflowStepOptions } from './workflow.types.js';
1
+ import { CoreConfig, CoreSingletonServices, CreateWireServices, SerializedError } from '../../types/core.types.js';
2
+ import type { StepState, WorkflowRun, WorkflowStatus, WorkflowStepOptions } from './workflow.types.js';
3
+ import { WorkflowService } from '../../services/workflow-service.js';
4
+ import { PikkuError } from '../../errors/error-handler.js';
5
+ /**
6
+ * Exception thrown when workflow needs to pause for async step
7
+ */
8
+ export declare class WorkflowAsyncException extends Error {
9
+ readonly runId: string;
10
+ readonly stepName: string;
11
+ constructor(runId: string, stepName: string);
12
+ }
13
+ /**
14
+ * Exception thrown when workflow is cancelled
15
+ */
16
+ export declare class WorkflowCancelledException extends Error {
17
+ readonly runId: string;
18
+ readonly reason?: string | undefined;
19
+ constructor(runId: string, reason?: string | undefined);
20
+ }
21
+ /**
22
+ * Error class for workflow not found
23
+ */
24
+ export declare class WorkflowNotFoundError extends PikkuError {
25
+ constructor(name: string);
26
+ }
27
+ /**
28
+ * Error class for workflow not found
29
+ */
30
+ export declare class WorkflowRunNotFound extends PikkuError {
31
+ constructor(runId: string);
32
+ }
3
33
  export declare class WorkflowServiceNotInitialized extends Error {
4
34
  }
5
35
  export declare class WorkflowStepNameNotString extends Error {
@@ -13,16 +43,29 @@ export declare class WorkflowStepNameNotString extends Error {
13
43
  export declare abstract class PikkuWorkflowService implements WorkflowService {
14
44
  private config;
15
45
  private singletonServices;
16
- private createSessionServices;
46
+ private createWireServices;
47
+ private inlineRuns;
17
48
  constructor();
18
- setServices(singletonServices: CoreSingletonServices, createSessionServices: CreateSessionServices, { workflow }: CoreConfig): void;
49
+ /**
50
+ * Check if a run is executing inline (without queues)
51
+ */
52
+ protected isInline(runId: string): boolean;
53
+ /**
54
+ * Register a run as inline (for graph-runner to use)
55
+ */
56
+ registerInlineRun(runId: string): void;
57
+ /**
58
+ * Unregister a run from inline tracking
59
+ */
60
+ unregisterInlineRun(runId: string): void;
61
+ setServices(singletonServices: CoreSingletonServices, createWireServices: CreateWireServices, { workflow }: CoreConfig): void;
19
62
  /**
20
63
  * Create a new workflow run
21
64
  * @param name - Workflow name
22
65
  * @param input - Input data for the workflow
23
66
  * @returns Run ID
24
67
  */
25
- abstract createRun(workflowName: string, input: any): Promise<string>;
68
+ abstract createRun(workflowName: string, input: any, inline?: boolean): Promise<string>;
26
69
  /**
27
70
  * Get a workflow run by ID
28
71
  * @param id - Run ID
@@ -103,10 +146,60 @@ export declare abstract class PikkuWorkflowService implements WorkflowService {
103
146
  * @returns Function result
104
147
  */
105
148
  abstract withRunLock<T>(id: string, fn: () => Promise<T>): Promise<T>;
149
+ /**
150
+ * Execute function within a step lock to prevent concurrent step execution
151
+ * @param runId - Run ID
152
+ * @param stepName - Step name
153
+ * @param fn - Function to execute
154
+ * @returns Function result
155
+ */
156
+ abstract withStepLock<T>(runId: string, stepName: string, fn: () => Promise<T>): Promise<T>;
106
157
  /**
107
158
  * Close any open connections
108
159
  */
109
160
  abstract close(): Promise<void>;
161
+ /**
162
+ * Get completed graph state (lightweight - no results)
163
+ * @param runId - Run ID
164
+ * @returns Completed node IDs and their branch keys
165
+ */
166
+ abstract getCompletedGraphState(runId: string): Promise<{
167
+ completedNodeIds: string[];
168
+ branchKeys: Record<string, string>;
169
+ }>;
170
+ /**
171
+ * Filter candidate nodes to only those without existing steps
172
+ * @param runId - Run ID
173
+ * @param nodeIds - Candidate node IDs to check
174
+ * @returns Node IDs that don't have a step yet
175
+ */
176
+ abstract getNodesWithoutSteps(runId: string, nodeIds: string[]): Promise<string[]>;
177
+ /**
178
+ * Get results for specific nodes
179
+ * @param runId - Run ID
180
+ * @param nodeIds - Node IDs to fetch results for
181
+ * @returns Map of nodeId to result
182
+ */
183
+ abstract getNodeResults(runId: string, nodeIds: string[]): Promise<Record<string, any>>;
184
+ /**
185
+ * Set the branch key for a graph node step
186
+ * @param stepId - Step ID
187
+ * @param branchKey - Branch key selected by graph.branch()
188
+ */
189
+ abstract setBranchTaken(stepId: string, branchKey: string): Promise<void>;
190
+ /**
191
+ * Update a state variable in the workflow run's state
192
+ * @param runId - Run ID
193
+ * @param name - Variable name
194
+ * @param value - Value to store
195
+ */
196
+ abstract updateRunState(runId: string, name: string, value: unknown): Promise<void>;
197
+ /**
198
+ * Get the entire state object for a workflow run
199
+ * @param runId - Run ID
200
+ * @returns The state object with all variables
201
+ */
202
+ abstract getRunState(runId: string): Promise<Record<string, unknown>>;
110
203
  /**
111
204
  * Resume a paused workflow by triggering the orchestrator
112
205
  * @param runId - Run ID
@@ -117,7 +210,7 @@ export declare abstract class PikkuWorkflowService implements WorkflowService {
117
210
  * Sets the step result to null and resumes the workflow
118
211
  * @param data - Sleeper input data
119
212
  */
120
- executeWorkflowSleep(runId: string, stepId: string): Promise<void>;
213
+ executeWorkflowSleepCompleted(runId: string, stepId: string): Promise<void>;
121
214
  /**
122
215
  * Schedule orchestrator retry with delay
123
216
  * @param runId - Run ID
@@ -126,8 +219,14 @@ export declare abstract class PikkuWorkflowService implements WorkflowService {
126
219
  protected scheduleOrchestratorRetry(runId: string, retryDelay?: number | string): Promise<void>;
127
220
  /**
128
221
  * Start a new workflow run
129
- */
130
- startWorkflow<I>(name: string, input: I, rpcService: any): Promise<{
222
+ * Automatically detects workflow type (DSL or graph) from meta and executes accordingly
223
+ * @param options.inline - If true, execute workflow directly without queue service
224
+ * @param options.startNode - Starting node ID for graph workflows (from wire config)
225
+ */
226
+ startWorkflow<I>(name: string, input: I, rpcService: any, options?: {
227
+ inline?: boolean;
228
+ startNode?: string;
229
+ }): Promise<{
131
230
  runId: string;
132
231
  }>;
133
232
  runWorkflowJob(runId: string, rpcService: any): Promise<void>;
@@ -145,8 +244,7 @@ export declare abstract class PikkuWorkflowService implements WorkflowService {
145
244
  private rpcStep;
146
245
  private inlineStep;
147
246
  private sleepStep;
148
- private cancelWorkflow;
149
- private createWorkflowInteraction;
247
+ private createWorkflowWire;
150
248
  private verifyStepName;
151
249
  private getConfig;
152
250
  }