@leitwerk-dev/process-sdk 0.2.0 → 0.2.1

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 (186) hide show
  1. package/dist/browser-ui-extension.d.ts +20 -0
  2. package/dist/browser-ui-extension.d.ts.map +1 -1
  3. package/dist/capabilities.d.ts +6 -0
  4. package/dist/capabilities.d.ts.map +1 -1
  5. package/dist/{chunk-LIIP7FMU.js → chunk-5R6MVLHC.js} +1 -1
  6. package/dist/chunk-5R6MVLHC.js.map +1 -0
  7. package/dist/chunk-DVXW2ZUV.js +1 -0
  8. package/dist/chunk-DVXW2ZUV.js.map +1 -0
  9. package/dist/{chunk-TA4KO53Q.js → chunk-I7U6HCLN.js} +1 -7
  10. package/dist/chunk-I7U6HCLN.js.map +1 -0
  11. package/dist/{chunk-WFY2WWZE.js → chunk-TM2LTSW4.js} +1 -1
  12. package/dist/chunk-TM2LTSW4.js.map +1 -0
  13. package/dist/codecs.d.ts +1 -0
  14. package/dist/codecs.d.ts.map +1 -1
  15. package/dist/commit-message.d.ts +5 -0
  16. package/dist/commit-message.d.ts.map +1 -1
  17. package/dist/core-capabilities.d.ts +336 -20
  18. package/dist/core-capabilities.d.ts.map +1 -1
  19. package/dist/define-process.d.ts +195 -18
  20. package/dist/define-process.d.ts.map +1 -1
  21. package/dist/event-bus.d.ts +1 -0
  22. package/dist/event-bus.d.ts.map +1 -1
  23. package/dist/{extension-api-CcqZCYJx.d.ts → extension-api-B4gG5w1K.d.ts} +1000 -108
  24. package/dist/extension-api.d.ts +385 -50
  25. package/dist/extension-api.d.ts.map +1 -1
  26. package/dist/external-action-source.d.ts +3 -1
  27. package/dist/external-action-source.d.ts.map +1 -1
  28. package/dist/external-source-poll.d.ts +8 -1
  29. package/dist/external-source-poll.d.ts.map +1 -1
  30. package/dist/flow.d.ts +308 -11
  31. package/dist/flow.d.ts.map +1 -1
  32. package/dist/form-contract.d.ts +1 -1
  33. package/dist/form-contract.d.ts.map +1 -1
  34. package/dist/fs-utils.d.ts +4 -0
  35. package/dist/fs-utils.d.ts.map +1 -1
  36. package/dist/git-binary.d.ts +2 -1
  37. package/dist/git-binary.d.ts.map +1 -1
  38. package/dist/git-binary.js.map +1 -1
  39. package/dist/graph-fragments.d.ts +16 -0
  40. package/dist/graph-fragments.d.ts.map +1 -1
  41. package/dist/host-capabilities.d.ts +9 -3
  42. package/dist/host-capabilities.d.ts.map +1 -1
  43. package/dist/index.d.ts +24 -25
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +262 -80
  46. package/dist/index.js.map +1 -1
  47. package/dist/integration-http.d.ts +14 -3
  48. package/dist/integration-http.d.ts.map +1 -1
  49. package/dist/json-data.d.ts +1 -1
  50. package/dist/json-data.d.ts.map +1 -1
  51. package/dist/leaf-outcome-renderer.d.ts +35 -0
  52. package/dist/leaf-outcome-renderer.d.ts.map +1 -1
  53. package/dist/leaf-outcome-renderer.js +12 -0
  54. package/dist/leaf-outcome-renderer.js.map +1 -1
  55. package/dist/leaf-outcomes.d.ts +3 -0
  56. package/dist/leaf-outcomes.d.ts.map +1 -1
  57. package/dist/model-provider.d.ts +144 -12
  58. package/dist/model-provider.d.ts.map +1 -1
  59. package/dist/pi-config-public.d.ts +2 -0
  60. package/dist/pi-config-public.d.ts.map +1 -0
  61. package/dist/pi-config-public.js +15 -0
  62. package/dist/pi-config-public.js.map +1 -0
  63. package/dist/pi-config.d.ts +40 -0
  64. package/dist/pi-config.d.ts.map +1 -1
  65. package/dist/pi-config.js +1 -1
  66. package/dist/process-definition-internals.d.ts +4 -0
  67. package/dist/process-definition-internals.d.ts.map +1 -1
  68. package/dist/process-flow-view.d.ts +2 -0
  69. package/dist/process-flow-view.d.ts.map +1 -1
  70. package/dist/process-graph.d.ts +34 -0
  71. package/dist/process-graph.d.ts.map +1 -1
  72. package/dist/process-launcher-builder.d.ts +5 -0
  73. package/dist/process-launcher-builder.d.ts.map +1 -1
  74. package/dist/process-watcher-builder.d.ts +5 -0
  75. package/dist/process-watcher-builder.d.ts.map +1 -1
  76. package/dist/process-watcher-source.d.ts +3 -1
  77. package/dist/process-watcher-source.d.ts.map +1 -1
  78. package/dist/project-binding.d.ts +5 -1
  79. package/dist/project-binding.d.ts.map +1 -1
  80. package/dist/registry-utils.d.ts +6 -0
  81. package/dist/registry-utils.d.ts.map +1 -1
  82. package/dist/repository-feedback.d.ts +20 -2
  83. package/dist/repository-feedback.d.ts.map +1 -1
  84. package/dist/repository-git-env.d.ts +6 -2
  85. package/dist/repository-git-env.d.ts.map +1 -1
  86. package/dist/repository-http.d.ts +13 -1
  87. package/dist/repository-http.d.ts.map +1 -1
  88. package/dist/repository-https.d.ts +1 -1
  89. package/dist/repository-https.d.ts.map +1 -1
  90. package/dist/repository-issue-watcher.d.ts +21 -1
  91. package/dist/repository-issue-watcher.d.ts.map +1 -1
  92. package/dist/repository-reconciliation.d.ts +5 -0
  93. package/dist/repository-reconciliation.d.ts.map +1 -0
  94. package/dist/repository-source-config.d.ts +27 -1
  95. package/dist/repository-source-config.d.ts.map +1 -1
  96. package/dist/repository-types.d.ts +28 -1
  97. package/dist/repository-types.d.ts.map +1 -1
  98. package/dist/review-flow-public.d.ts +2 -0
  99. package/dist/review-flow-public.d.ts.map +1 -0
  100. package/dist/review-flow-public.js +11 -0
  101. package/dist/review-flow-public.js.map +1 -0
  102. package/dist/review-flow.d.ts +6 -0
  103. package/dist/review-flow.d.ts.map +1 -1
  104. package/dist/review-flow.js +1 -1
  105. package/dist/runtime-internals-public.d.ts +2 -0
  106. package/dist/runtime-internals-public.d.ts.map +1 -0
  107. package/dist/runtime-internals-public.js +16 -0
  108. package/dist/runtime-internals-public.js.map +1 -0
  109. package/dist/runtime-internals.js +2 -1
  110. package/dist/server-events.d.ts +67 -0
  111. package/dist/server-events.d.ts.map +1 -1
  112. package/dist/server-process-builder.d.ts +7 -0
  113. package/dist/server-process-builder.d.ts.map +1 -1
  114. package/dist/state-helpers.d.ts +6 -0
  115. package/dist/state-helpers.d.ts.map +1 -1
  116. package/dist/subprocess-env.d.ts +3 -0
  117. package/dist/subprocess-env.d.ts.map +1 -1
  118. package/dist/tool-arguments.d.ts +4 -2
  119. package/dist/tool-arguments.d.ts.map +1 -1
  120. package/dist/tool-renderers.d.ts +6 -0
  121. package/dist/tool-renderers.d.ts.map +1 -1
  122. package/dist/turn-semantics.d.ts +14 -1
  123. package/dist/turn-semantics.d.ts.map +1 -1
  124. package/dist/types.d.ts +205 -24
  125. package/dist/types.d.ts.map +1 -1
  126. package/dist/ui-process-builder.d.ts +5 -0
  127. package/dist/ui-process-builder.d.ts.map +1 -1
  128. package/dist/worker-process-builder.d.ts +5 -0
  129. package/dist/worker-process-builder.d.ts.map +1 -1
  130. package/package.json +16 -15
  131. package/src/browser-ui-extension.ts +20 -0
  132. package/src/capabilities.ts +9 -1
  133. package/src/codecs.ts +1 -0
  134. package/src/commit-message.ts +5 -0
  135. package/src/core-capabilities.ts +396 -35
  136. package/src/define-process.ts +198 -23
  137. package/src/event-bus.ts +1 -0
  138. package/src/extension-api.ts +399 -55
  139. package/src/external-action-source.ts +7 -2
  140. package/src/external-source-poll.ts +15 -3
  141. package/src/flow.ts +352 -23
  142. package/src/form-contract.ts +0 -4
  143. package/src/fs-utils.ts +4 -0
  144. package/src/git-binary.ts +2 -1
  145. package/src/graph-fragments.ts +16 -0
  146. package/src/host-capabilities.ts +9 -6
  147. package/src/index.ts +5 -201
  148. package/src/integration-http.ts +15 -3
  149. package/src/json-data.ts +1 -1
  150. package/src/leaf-outcome-renderer.ts +35 -0
  151. package/src/leaf-outcomes.ts +3 -0
  152. package/src/model-provider.ts +169 -20
  153. package/src/pi-config-public.ts +7 -0
  154. package/src/pi-config.ts +47 -2
  155. package/src/process-definition-internals.ts +4 -0
  156. package/src/process-flow-view.ts +2 -0
  157. package/src/process-graph.ts +34 -0
  158. package/src/process-launcher-builder.ts +5 -0
  159. package/src/process-watcher-builder.ts +5 -0
  160. package/src/process-watcher-source.ts +6 -4
  161. package/src/project-binding.ts +5 -1
  162. package/src/registry-utils.ts +6 -0
  163. package/src/repository-feedback.ts +30 -4
  164. package/src/repository-git-env.ts +6 -2
  165. package/src/repository-http.ts +19 -2
  166. package/src/repository-https.ts +1 -1
  167. package/src/repository-issue-watcher.ts +35 -5
  168. package/src/repository-reconciliation.ts +30 -0
  169. package/src/repository-source-config.ts +20 -1
  170. package/src/repository-types.ts +43 -5
  171. package/src/review-flow-public.ts +5 -0
  172. package/src/review-flow.ts +6 -0
  173. package/src/runtime-internals-public.ts +7 -0
  174. package/src/server-events.ts +67 -0
  175. package/src/server-process-builder.ts +10 -1
  176. package/src/state-helpers.ts +6 -0
  177. package/src/subprocess-env.ts +3 -0
  178. package/src/tool-arguments.ts +4 -2
  179. package/src/tool-renderers.ts +6 -0
  180. package/src/turn-semantics.ts +15 -2
  181. package/src/types.ts +212 -30
  182. package/src/ui-process-builder.ts +8 -1
  183. package/src/worker-process-builder.ts +8 -1
  184. package/dist/chunk-LIIP7FMU.js.map +0 -1
  185. package/dist/chunk-TA4KO53Q.js.map +0 -1
  186. package/dist/chunk-WFY2WWZE.js.map +0 -1
package/src/flow.ts CHANGED
@@ -18,7 +18,6 @@ import type {
18
18
  HumanTurnOperatorAttention,
19
19
  LlmModelPurpose,
20
20
  LlmTurnDefinition,
21
- ProcessDefinition,
22
21
  ProcessEffectPlan,
23
22
  ProcessHumanTurnActionSpec,
24
23
  ProcessHumanTurnExternalActionSpec,
@@ -33,6 +32,7 @@ import type {
33
32
  import { defineProcess } from "./define-process.js";
34
33
  import type {
35
34
  Codec,
35
+ ExtensionProcessDefinition,
36
36
  ExternalActionSource,
37
37
  ExternalSourceEffect,
38
38
  ExternalSourceEffectContext,
@@ -54,9 +54,12 @@ import {
54
54
  } from "./process-graph.js";
55
55
  import type { OutcomeToolParameterSpec, PiBuiltInToolName, ProcessPiConfig } from "./types.js";
56
56
 
57
+ /** @public */
57
58
  type MaybePromise<T> = T | Promise<T>;
58
59
 
60
+ /** @internal */
59
61
  export const DEFAULT_PLAN_RESULT_OUTCOME_ID = "plan_saved" as const;
62
+ /** @internal */
60
63
  export const DEFAULT_FLOW_PRODUCT_NAME = "default" as const;
61
64
  const ASSISTANT_OUTPUT_TURN_RESULT = { mode: "assistant_output", required: true } as const;
62
65
  const OUTCOME_TOOL_MARKDOWN_PARAMETER_NAME = "markdown" as const;
@@ -66,48 +69,72 @@ const OUTCOME_TOOL_ARGUMENT_TURN_RESULT = {
66
69
  required: true,
67
70
  } as const;
68
71
 
72
+ /** @public */
69
73
  export interface FlowLlmTurn<
70
74
  TParams = unknown,
71
75
  TState = unknown,
72
76
  TOutcome extends string = string,
73
77
  > {
78
+ /** @public */
74
79
  id: TurnId;
80
+ /** @public */
75
81
  definition: LlmTurnDefinition<TOutcome, TParams, TState>;
76
82
  }
77
83
 
84
+ /** @public */
78
85
  export interface FlowAutomaticTurn<
79
86
  TParams = unknown,
80
87
  TState = unknown,
81
88
  TOutcome extends string = string,
82
89
  > {
90
+ /** @public */
83
91
  id: TurnId;
92
+ /** @public */
84
93
  definition: AutomaticTurnDefinition<TOutcome, TParams, TState>;
85
94
  }
86
95
 
96
+ /** @public */
87
97
  export interface FlowHumanTurn<TParams = unknown, TState = unknown> {
98
+ /** @public */
88
99
  id: TurnId;
100
+ /** @public */
89
101
  definition: HumanTurnDefinition<TParams, TState>;
90
102
  }
91
103
 
104
+ /** @public */
92
105
  export interface FlowExternalTurn<TParams = unknown, TState = unknown> {
106
+ /** @public */
93
107
  id: TurnId;
108
+ /** @public */
94
109
  definition: ExternalTurnDefinition<TParams, TState>;
95
110
  }
96
111
 
112
+ /** @public */
97
113
  export type FlowTurn<TParams = unknown, TState = unknown> =
98
114
  | FlowLlmTurn<TParams, TState, string>
99
115
  | FlowAutomaticTurn<TParams, TState, string>
100
116
  | FlowHumanTurn<TParams, TState>
101
117
  | FlowExternalTurn<TParams, TState>
102
- | { id: TurnId; definition: TurnDefinition<TParams, TState> };
103
-
118
+ | {
119
+ /** @public */
120
+ id: TurnId;
121
+ /** @public */
122
+ definition: TurnDefinition<TParams, TState>;
123
+ };
124
+
125
+ /** @internal */
104
126
  export interface PlanFieldOptions {
127
+ /** @internal */
105
128
  description?: string;
129
+ /** @internal */
106
130
  requiredErrorCode?: string;
107
131
  }
108
132
 
133
+ /** @internal */
109
134
  export interface PlanAcceptanceCriteriaOptions extends PlanFieldOptions {
135
+ /** @internal */
110
136
  minItems?: number;
137
+ /** @internal */
111
138
  minItemsErrorCode?: string;
112
139
  }
113
140
 
@@ -115,69 +142,120 @@ export interface PlanSavedStateInput<TParams = unknown, TState = unknown> {
115
142
  effect: ProcessOutcomeEffect<TParams, TState>;
116
143
  }
117
144
 
145
+ /** @public */
118
146
  export interface FlowRepoContext {
147
+ /** @internal */
119
148
  key: string;
149
+ /** @public */
120
150
  fsPath: string;
151
+ /** @internal */
121
152
  workspaceClonePath: string;
153
+ /** @public */
122
154
  baseBranch: string;
155
+ /** @public */
123
156
  workBranch: string;
157
+ /** @internal */
124
158
  locator: string;
125
159
  }
126
160
 
161
+ /** @public */
127
162
  export interface FlowRepoLookup {
163
+ /** @public */
128
164
  get(key: string): FlowRepoContext;
165
+ /** @internal */
129
166
  optional(key: string): FlowRepoContext | undefined;
167
+ /** @internal */
130
168
  all(): FlowRepoContext[];
131
169
  }
132
170
 
171
+ /** @public */
133
172
  export type FlowPromptContext<
134
173
  TParams = unknown,
135
174
  TState = unknown,
136
175
  TConsumedProducts extends string = string,
137
176
  TPrepared = undefined,
138
177
  > = {
178
+ /** @internal */
139
179
  process: ProcessInstance;
180
+ /** @internal */
140
181
  projects: readonly ProcessProject[];
182
+ /** @public */
141
183
  params: TParams;
184
+ /** @public */
142
185
  state: TState;
186
+ /** @internal */
143
187
  workspaceRoot?: string;
188
+ /** @internal */
144
189
  prompts: {
190
+ /** @internal */
145
191
  initial: string;
146
192
  };
193
+ /** @public */
147
194
  input: Readonly<Partial<Record<TConsumedProducts, string>>>;
195
+ /** @internal */
148
196
  repo: FlowRepoLookup;
149
- } & ([TPrepared] extends [undefined] ? { prepared?: undefined } : { prepared: TPrepared });
197
+ } & ([TPrepared] extends [undefined]
198
+ ? {
199
+ /** @internal */
200
+ prepared?: undefined;
201
+ }
202
+ : {
203
+ /** @internal */
204
+ prepared: TPrepared;
205
+ });
150
206
 
207
+ /** @public */
151
208
  export interface FlowAutomaticRunContext<TParams = unknown, TState = unknown> {
209
+ /** @public */
152
210
  process: ProcessInstance;
211
+ /** @public */
153
212
  projects: readonly ProcessProject[];
213
+ /** @public */
154
214
  params: TParams;
215
+ /** @public */
155
216
  state: TState;
217
+ /** @public */
156
218
  workspaceRoot?: string;
219
+ /** @public */
157
220
  repo: FlowRepoLookup;
221
+ /** @public */
158
222
  callIntegrationTool(name: string, args: Record<string, unknown>): Promise<unknown>;
223
+ /** @public */
159
224
  reportProgress(report: TurnProgressReport): void;
160
225
  }
161
226
 
227
+ /** @public */
162
228
  export type FlowLlmPreparationContext<
163
229
  TParams = unknown,
164
230
  TState = unknown,
165
231
  > = FlowAutomaticRunContext<TParams, TState>;
166
232
 
233
+ /** @public */
167
234
  interface FlowOutcomeEffectContext<TParams = unknown, TState = unknown> {
235
+ /** @public */
168
236
  process: ProcessInstance;
237
+ /** @internal */
169
238
  projects: readonly ProcessProject[];
239
+ /** @internal */
170
240
  params: TParams;
241
+ /** @public */
171
242
  state: TState;
172
- output: { content: string | null } | null;
243
+ /** @internal */
244
+ output: {
245
+ /** @internal */
246
+ content: string | null;
247
+ } | null;
173
248
  }
174
249
 
250
+ /** @public */
175
251
  export interface FlowLlmOutcomeEffectContext<TParams = unknown, TState = unknown>
176
252
  extends FlowOutcomeEffectContext<TParams, TState> {}
177
253
 
254
+ /** @public */
178
255
  export interface FlowAutomaticOutcomeEffectContext<TParams = unknown, TState = unknown>
179
256
  extends FlowOutcomeEffectContext<TParams, TState> {}
180
257
 
258
+ /** @internal */
181
259
  export interface FlowExternalSourceContext<
182
260
  TParams = unknown,
183
261
  TState = unknown,
@@ -185,17 +263,24 @@ export interface FlowExternalSourceContext<
185
263
  TInput extends Record<string, unknown> = Record<string, unknown>,
186
264
  > extends ExternalSourceEffectContext<TParams, TState, TEvent, TInput> {}
187
265
 
266
+ /** @public */
188
267
  type FlowOutcomeEffectInput<TParams, TState, TContext> = {
268
+ /** @public */
189
269
  ctx: TContext;
270
+ /** @public */
190
271
  event: ProcessOutcomeExecution<TParams, TState>["event"];
272
+ /** @internal */
191
273
  turnId: TurnId;
274
+ /** @internal */
192
275
  outcome: string;
193
276
  };
194
277
 
278
+ /** @public */
195
279
  type FlowOutcomeEffect<TParams, TState, TContext> = (
196
280
  input: FlowOutcomeEffectInput<TParams, TState, TContext>,
197
281
  ) => MaybePromise<ProcessEffectPlan<TState> | undefined>;
198
282
 
283
+ /** @public */
199
284
  type FlowOutcomeStateEffect<TParams, TState, TContext> = (
200
285
  input: FlowOutcomeEffectInput<TParams, TState, TContext>,
201
286
  ) => MaybePromise<TState>;
@@ -383,6 +468,7 @@ function createFlowContextBase<TParams, TState>(ctx: ProcessRuntimeTurnContext<T
383
468
  };
384
469
  }
385
470
 
471
+ /** @internal */
386
472
  export function createFlowPromptContext<
387
473
  TParams,
388
474
  TState,
@@ -422,6 +508,7 @@ export function createFlowPromptContext<
422
508
  } as FlowPromptContext<TParams, TState, TConsumedProducts, TPrepared>;
423
509
  }
424
510
 
511
+ /** @internal */
425
512
  export function createFlowAutomaticRunContext<TParams, TState>(
426
513
  ctx: ProcessRuntimeTurnContext<TParams, TState>,
427
514
  ): FlowAutomaticRunContext<TParams, TState> {
@@ -462,10 +549,14 @@ function wrapOutcomeCallback<TParams, TState, TResult>(
462
549
  });
463
550
  }
464
551
 
552
+ /** @public */
465
553
  class RouteAndEffectBuilder<TParams, TState, TContext> {
554
+ /** @internal */
466
555
  protected target: FlowTargetSpec = null;
556
+ /** @internal */
467
557
  protected flowEffect: FlowOutcomeEffect<TParams, TState, TContext> | undefined;
468
558
 
559
+ /** @internal */
469
560
  protected setTarget(next: FlowTargetSpec): this {
470
561
  if (this.target && next) {
471
562
  throw new Error("Flow route already declares a target");
@@ -474,55 +565,83 @@ class RouteAndEffectBuilder<TParams, TState, TContext> {
474
565
  return this;
475
566
  }
476
567
 
568
+ /** @public */
477
569
  to(turnId: TurnId): this {
478
570
  return this.setTarget({ kind: "to", turnId });
479
571
  }
480
572
 
573
+ /** @public */
481
574
  complete(): this {
482
575
  return this.setTarget({ kind: "complete" });
483
576
  }
484
577
 
578
+ /** @public */
485
579
  lifecycleStatus(status: ProcessTurnTerminalLifecycleStatus): this {
486
580
  return this.setTarget({ kind: "lifecycleStatus", status });
487
581
  }
488
582
 
583
+ /** @internal */
489
584
  stay(): this {
490
585
  this.target = null;
491
586
  return this;
492
587
  }
493
588
 
589
+ /** @public */
494
590
  state(fn: FlowOutcomeStateEffect<TParams, TState, TContext>): this {
495
591
  this.flowEffect = async (input) => ({ state: await fn(input) });
496
592
  return this;
497
593
  }
498
594
 
595
+ /** @public */
499
596
  effect(fn: FlowOutcomeEffect<TParams, TState, TContext>): this {
500
597
  this.flowEffect = fn;
501
598
  return this;
502
599
  }
503
600
 
601
+ /** @internal */
504
602
  hasRoute(): boolean {
505
603
  return this.target !== null;
506
604
  }
507
605
 
606
+ /** @internal */
508
607
  protected buildRouteTarget(): {
608
+ /** @internal */
509
609
  to?: TurnId;
610
+ /** @internal */
510
611
  complete?: boolean;
612
+ /** @internal */
511
613
  lifecycleStatus?: ProcessTurnTerminalLifecycleStatus;
512
614
  } {
513
615
  return buildRouteTargetSpec(this.target);
514
616
  }
515
617
  }
516
618
 
619
+ /** @internal */
517
620
  export type FlowTargetSpec =
518
- | { kind: "to"; turnId: TurnId }
519
- | { kind: "complete" }
520
- | { kind: "lifecycleStatus"; status: ProcessTurnTerminalLifecycleStatus }
621
+ | {
622
+ /** @internal */
623
+ kind: "to";
624
+ /** @internal */
625
+ turnId: TurnId;
626
+ }
627
+ | {
628
+ /** @internal */
629
+ kind: "complete";
630
+ }
631
+ | {
632
+ /** @internal */
633
+ kind: "lifecycleStatus";
634
+ /** @internal */
635
+ status: ProcessTurnTerminalLifecycleStatus;
636
+ }
521
637
  | null;
522
638
 
523
639
  export function buildRouteTargetSpec(target: FlowTargetSpec): {
640
+ /** @internal */
524
641
  to?: TurnId;
642
+ /** @internal */
525
643
  complete?: boolean;
644
+ /** @internal */
526
645
  lifecycleStatus?: ProcessTurnTerminalLifecycleStatus;
527
646
  } {
528
647
  if (!target) {
@@ -537,20 +656,29 @@ export function buildRouteTargetSpec(target: FlowTargetSpec): {
537
656
  return { lifecycleStatus: target.status };
538
657
  }
539
658
 
659
+ /** @public */
540
660
  interface ParameterOptions extends Partial<Omit<OutcomeToolParameterSpec, "type" | "description">> {
661
+ /** @public */
541
662
  description?: string;
663
+ /** @internal */
542
664
  requiredErrorCode?: string;
543
665
  }
544
666
 
667
+ /** @internal */
545
668
  interface ArrayParameterOptions extends ParameterOptions {
669
+ /** @internal */
546
670
  items?: OutcomeToolParameterSpec["items"];
547
671
  }
548
672
 
673
+ /** @internal */
549
674
  interface EnumParameterOptions extends ParameterOptions {
675
+ /** @internal */
550
676
  values?: readonly string[];
551
677
  }
552
678
 
679
+ /** @public */
553
680
  interface MarkdownParameterOptions extends ParameterOptions {
681
+ /** @public */
554
682
  publish?: true;
555
683
  }
556
684
 
@@ -558,17 +686,22 @@ function isStringArray(value: unknown): value is readonly string[] {
558
686
  return Array.isArray(value) && value.every((entry) => typeof entry === "string");
559
687
  }
560
688
 
689
+ /** @public */
561
690
  class ParameterizedOutcomeBuilder<TParams, TState, TContext> extends RouteAndEffectBuilder<
562
691
  TParams,
563
692
  TState,
564
693
  TContext
565
694
  > {
695
+ /** @internal */
566
696
  protected outcomeDescription: string | null = null;
697
+ /** @internal */
567
698
  protected parameters: Record<string, OutcomeToolParameterSpec> = {};
699
+ /** @internal */
568
700
  protected publishedMarkdownParameter: string | null = null;
701
+ /** @internal */
569
702
  protected summaryParameter: string | null = null;
570
703
 
571
- /** Optional concise result publication, separate from the full Markdown. */
704
+ /** Optional concise result publication, separate from the full Markdown. @public */
572
705
  resultSummary(name = "resultSummary"): this {
573
706
  this.summaryParameter = name;
574
707
  return this.parameter(name, {
@@ -577,20 +710,25 @@ class ParameterizedOutcomeBuilder<TParams, TState, TContext> extends RouteAndEff
577
710
  });
578
711
  }
579
712
 
713
+ /** @internal */
580
714
  protected publishedMarkdownFields() {
581
715
  return this.publishedMarkdownParameter
582
716
  ? {
717
+ /** @internal */
583
718
  publishedProduct: this.publishedMarkdownParameter,
719
+ /** @internal */
584
720
  turnResultMarkdownParameter: this.publishedMarkdownParameter,
585
721
  }
586
722
  : {};
587
723
  }
588
724
 
725
+ /** @public */
589
726
  description(text: string): this {
590
727
  this.outcomeDescription = text;
591
728
  return this;
592
729
  }
593
730
 
731
+ /** @internal */
594
732
  parameter(name: string, spec: OutcomeToolParameterSpec): this {
595
733
  if (name.trim() === "") {
596
734
  throw new Error("Outcome parameter name must be non-empty");
@@ -628,10 +766,12 @@ class ParameterizedOutcomeBuilder<TParams, TState, TContext> extends RouteAndEff
628
766
  });
629
767
  }
630
768
 
769
+ /** @internal */
631
770
  string(name: string, options: string | ParameterOptions = {}): this {
632
771
  return this.typedParameter(name, "string", options);
633
772
  }
634
773
 
774
+ /** @public */
635
775
  markdown(name: string, options: string | MarkdownParameterOptions = {}): this {
636
776
  const resolved = typeof options === "string" ? { description: options } : options;
637
777
  const { publish, ...parameterOptions } = resolved;
@@ -649,34 +789,42 @@ class ParameterizedOutcomeBuilder<TParams, TState, TContext> extends RouteAndEff
649
789
  });
650
790
  }
651
791
 
792
+ /** @public */
652
793
  requiredString(name: string, options: string | ParameterOptions = {}): this {
653
794
  return this.typedParameter(name, "string", this.withRequired(name, options));
654
795
  }
655
796
 
797
+ /** @internal */
656
798
  number(name: string, options: string | ParameterOptions = {}): this {
657
799
  return this.typedParameter(name, "number", options);
658
800
  }
659
801
 
802
+ /** @internal */
660
803
  requiredNumber(name: string, options: string | ParameterOptions = {}): this {
661
804
  return this.typedParameter(name, "number", this.withRequired(name, options));
662
805
  }
663
806
 
807
+ /** @internal */
664
808
  boolean(name: string, options: string | ParameterOptions = {}): this {
665
809
  return this.typedParameter(name, "boolean", options);
666
810
  }
667
811
 
812
+ /** @internal */
668
813
  requiredBoolean(name: string, options: string | ParameterOptions = {}): this {
669
814
  return this.typedParameter(name, "boolean", this.withRequired(name, options));
670
815
  }
671
816
 
817
+ /** @internal */
672
818
  stringArray(name: string, options: string | ArrayParameterOptions = {}): this {
673
819
  return this.typedParameter(name, "array", options);
674
820
  }
675
821
 
822
+ /** @internal */
676
823
  requiredStringArray(name: string, options: string | ArrayParameterOptions = {}): this {
677
824
  return this.typedParameter(name, "array", this.withRequired(name, options));
678
825
  }
679
826
 
827
+ /** @internal */
680
828
  enum(name: string, valuesOrOptions: readonly string[] | EnumParameterOptions): this {
681
829
  const resolved: EnumParameterOptions = isStringArray(valuesOrOptions)
682
830
  ? { values: [...valuesOrOptions] }
@@ -690,15 +838,18 @@ class ParameterizedOutcomeBuilder<TParams, TState, TContext> extends RouteAndEff
690
838
  });
691
839
  }
692
840
 
841
+ /** @public */
693
842
  object(name: string, options: string | ParameterOptions = {}): this {
694
843
  return this.typedParameter(name, "object", options);
695
844
  }
696
845
 
846
+ /** @internal */
697
847
  array(name: string, options: string | ArrayParameterOptions = {}): this {
698
848
  return this.typedParameter(name, "array", options);
699
849
  }
700
850
  }
701
851
 
852
+ /** @public */
702
853
  export class OutcomeToolBuilder<
703
854
  TParams = unknown,
704
855
  TState = unknown,
@@ -720,6 +871,7 @@ export class OutcomeToolBuilder<
720
871
  }
721
872
  | undefined;
722
873
 
874
+ /** @public */
723
875
  routeByState(
724
876
  branches: Record<string, TurnId>,
725
877
  choose: (
@@ -736,6 +888,7 @@ export class OutcomeToolBuilder<
736
888
  return this;
737
889
  }
738
890
 
891
+ /** @internal */
739
892
  build(): ProcessToolOutcomeSpec<TParams, TState> {
740
893
  if (!this.outcomeDescription) {
741
894
  throw new Error("LLM outcome tool must declare .description(...)");
@@ -765,6 +918,7 @@ export class OutcomeToolBuilder<
765
918
  }
766
919
  }
767
920
 
921
+ /** @public */
768
922
  export class AutomaticOutcomeBuilder<
769
923
  TParams = unknown,
770
924
  TState = unknown,
@@ -775,12 +929,14 @@ export class AutomaticOutcomeBuilder<
775
929
  > {
776
930
  private waits = false;
777
931
 
932
+ /** @public */
778
933
  wait(): this {
779
934
  if (this.hasRoute()) throw new Error("Waiting outcome cannot declare another route");
780
935
  this.waits = true;
781
936
  return this;
782
937
  }
783
938
 
939
+ /** @internal */
784
940
  build(): ProcessToolOutcomeSpec<TParams, TState> {
785
941
  if (!this.outcomeDescription) {
786
942
  throw new Error("Automatic outcome must declare .description(...)");
@@ -808,6 +964,7 @@ export class AutomaticOutcomeBuilder<
808
964
  }
809
965
  }
810
966
 
967
+ /** @internal */
811
968
  export class PlanResultBuilder<TParams = unknown, TState = unknown> extends RouteAndEffectBuilder<
812
969
  TParams,
813
970
  TState,
@@ -818,11 +975,13 @@ export class PlanResultBuilder<TParams = unknown, TState = unknown> extends Rout
818
975
  private acceptanceCriteriaSpec: OutcomeToolParameterSpec | null = null;
819
976
  private reviewTurnId: TurnId | null = null;
820
977
 
978
+ /** @internal */
821
979
  description(text: string): this {
822
980
  this.resultDescription = text;
823
981
  return this;
824
982
  }
825
983
 
984
+ /** @internal */
826
985
  summary(options: string | PlanFieldOptions = {}): this {
827
986
  const resolved = typeof options === "string" ? { description: options } : options;
828
987
  this.summarySpec = textField({
@@ -832,6 +991,7 @@ export class PlanResultBuilder<TParams = unknown, TState = unknown> extends Rout
832
991
  return this;
833
992
  }
834
993
 
994
+ /** @internal */
835
995
  acceptanceCriteria(options: string | PlanAcceptanceCriteriaOptions = {}): this {
836
996
  const resolved = typeof options === "string" ? { description: options } : options;
837
997
  this.acceptanceCriteriaSpec = stringArrayField({
@@ -843,11 +1003,13 @@ export class PlanResultBuilder<TParams = unknown, TState = unknown> extends Rout
843
1003
  return this;
844
1004
  }
845
1005
 
1006
+ /** @internal */
846
1007
  review(turnId: TurnId): this {
847
1008
  this.reviewTurnId = turnId;
848
1009
  return this.setTarget({ kind: "to", turnId });
849
1010
  }
850
1011
 
1012
+ /** @internal */
851
1013
  buildOutcome(): ProcessToolOutcomeSpec<TParams, TState> {
852
1014
  if (!this.summarySpec) {
853
1015
  throw new Error("plan result must declare .summary(...)");
@@ -879,12 +1041,15 @@ export class PlanResultBuilder<TParams = unknown, TState = unknown> extends Rout
879
1041
  }
880
1042
  }
881
1043
 
1044
+ /** @public */
882
1045
  abstract class TurnEndBuilder<TParams, TState>
883
1046
  extends RouteAndEffectBuilder<TParams, TState, FlowLlmOutcomeEffectContext<TParams, TState>>
884
1047
  implements FlowLlmTurn<TParams, TState, string>
885
1048
  {
1049
+ /** @internal */
886
1050
  protected abstract readonly builderName: string;
887
1051
 
1052
+ /** @internal */
888
1053
  constructor(
889
1054
  private readonly outcomeId: string,
890
1055
  private readonly parent?: FlowLlmTurn<TParams, TState, string>,
@@ -897,14 +1062,17 @@ abstract class TurnEndBuilder<TParams, TState>
897
1062
  return this.parent;
898
1063
  }
899
1064
 
1065
+ /** @internal */
900
1066
  get id(): TurnId {
901
1067
  return this.turn.id;
902
1068
  }
903
1069
 
1070
+ /** @internal */
904
1071
  get definition(): LlmTurnDefinition<string, TParams, TState> {
905
1072
  return this.turn.definition;
906
1073
  }
907
1074
 
1075
+ /** @internal */
908
1076
  protected buildResult(): ProcessTurnEndSpec<TParams, TState, string> {
909
1077
  const effect = this.flowEffect ? wrapOutcomeCallback(this.flowEffect) : undefined;
910
1078
  return {
@@ -915,52 +1083,69 @@ abstract class TurnEndBuilder<TParams, TState>
915
1083
  }
916
1084
  }
917
1085
 
1086
+ /** @public */
918
1087
  export class PublishedResultBuilder<TParams = unknown, TState = unknown> extends TurnEndBuilder<
919
1088
  TParams,
920
1089
  TState
921
1090
  > {
1091
+ /** @internal */
922
1092
  protected readonly builderName = "Published result";
923
1093
 
1094
+ /** @internal */
924
1095
  buildTurnEnd(): ProcessTurnEndSpec<TParams, TState, string> {
925
1096
  return this.buildResult();
926
1097
  }
927
1098
  }
928
1099
 
1100
+ /** @public */
929
1101
  export class LlmTurnEndBuilder<TParams = unknown, TState = unknown> extends TurnEndBuilder<
930
1102
  TParams,
931
1103
  TState
932
1104
  > {
1105
+ /** @internal */
933
1106
  protected readonly builderName = "LLM turn end";
934
1107
 
1108
+ /** @internal */
935
1109
  constructor(outcomeId: string, parent?: FlowLlmTurn<TParams, TState, string>) {
936
1110
  super(outcomeId, parent);
937
1111
  if (outcomeId.trim() === "") throw new Error("LLM turn end outcome must be non-empty");
938
1112
  }
939
1113
 
1114
+ /** @internal */
940
1115
  build(): ProcessTurnEndSpec<TParams, TState, string> {
941
1116
  return this.buildResult();
942
1117
  }
943
1118
  }
944
1119
 
1120
+ /** @public */
945
1121
  type LlmPromptBuilder<TParams, TState, TConsumedProducts extends string, TPrepared> = (
946
1122
  ctx: FlowPromptContext<TParams, TState, TConsumedProducts, TPrepared>,
947
1123
  ) => MaybePromise<string>;
948
1124
 
1125
+ /** @public */
949
1126
  abstract class DescribedTurnBuilder {
1127
+ /** @internal */
950
1128
  protected turnDescription: string | null = null;
951
1129
 
952
- constructor(protected readonly turnId: TurnId) {}
1130
+ /** @internal */
1131
+ constructor(
1132
+ /** @internal */
1133
+ protected readonly turnId: TurnId,
1134
+ ) {}
953
1135
 
1136
+ /** @internal */
954
1137
  get id(): TurnId {
955
1138
  return this.turnId;
956
1139
  }
957
1140
 
1141
+ /** @public */
958
1142
  description(description: string): this {
959
1143
  this.turnDescription = description;
960
1144
  return this;
961
1145
  }
962
1146
  }
963
1147
 
1148
+ /** @public */
964
1149
  export class LlmFlowBuilder<
965
1150
  TParams = unknown,
966
1151
  TState = unknown,
@@ -996,30 +1181,36 @@ export class LlmFlowBuilder<
996
1181
  private endResult: LlmTurnEndBuilder<TParams, TState> | null = null;
997
1182
  private outcomeToolBuilders = new Map<string, OutcomeToolBuilder<TParams, TState>>();
998
1183
 
1184
+ /** @internal */
999
1185
  get definition(): LlmTurnDefinition<string, TParams, TState> {
1000
1186
  return this.buildDefinition();
1001
1187
  }
1002
1188
 
1189
+ /** @internal */
1003
1190
  modelPurpose(purpose: LlmModelPurpose): this {
1004
1191
  this.modelPurposeValue = purpose;
1005
1192
  return this;
1006
1193
  }
1007
1194
 
1195
+ /** @public */
1008
1196
  tools(...tools: readonly PiBuiltInToolName[]): this {
1009
1197
  this.availableTools = tools;
1010
1198
  return this;
1011
1199
  }
1012
1200
 
1201
+ /** @public */
1013
1202
  integrationTools(...tools: readonly string[]): this {
1014
1203
  this.availableIntegrationTools = tools.map((tool) => tool.trim());
1015
1204
  return this;
1016
1205
  }
1017
1206
 
1207
+ /** @public */
1018
1208
  resolveIntegrationTools(resolver: (params: TParams, state: TState) => readonly string[]): this {
1019
1209
  this.integrationToolResolver = resolver;
1020
1210
  return this;
1021
1211
  }
1022
1212
 
1213
+ /** @public */
1023
1214
  prepare<TNextPrepared>(
1024
1215
  fn: (ctx: FlowLlmPreparationContext<TParams, TState>) => MaybePromise<TNextPrepared>,
1025
1216
  ): LlmFlowBuilder<TParams, TState, TConsumedProducts, TNextPrepared> {
@@ -1027,12 +1218,13 @@ export class LlmFlowBuilder<
1027
1218
  return this as unknown as LlmFlowBuilder<TParams, TState, TConsumedProducts, TNextPrepared>;
1028
1219
  }
1029
1220
 
1030
- /** Enable durable operator questions for this LLM turn. */
1221
+ /** Enable durable operator questions for this LLM turn. @public */
1031
1222
  askQuestions(): this {
1032
1223
  this.questionsEnabled = true;
1033
1224
  return this;
1034
1225
  }
1035
1226
 
1227
+ /** @public */
1036
1228
  freshPrimary(): this {
1037
1229
  this.branchType = "primary";
1038
1230
  this.context = "fresh";
@@ -1041,6 +1233,7 @@ export class LlmFlowBuilder<
1041
1233
  return this;
1042
1234
  }
1043
1235
 
1236
+ /** @internal */
1044
1237
  freshSeededPrimary(): this {
1045
1238
  this.branchType = "primary";
1046
1239
  this.context = "fresh_seeded";
@@ -1049,12 +1242,14 @@ export class LlmFlowBuilder<
1049
1242
  return this;
1050
1243
  }
1051
1244
 
1245
+ /** @public */
1052
1246
  fullPrimary(): this {
1053
1247
  this.branchType = "primary";
1054
1248
  this.context = "full";
1055
1249
  return this;
1056
1250
  }
1057
1251
 
1252
+ /** @internal */
1058
1253
  rootBranchReview(): this {
1059
1254
  this.branchType = "root_branch";
1060
1255
  this.context = "full";
@@ -1062,6 +1257,7 @@ export class LlmFlowBuilder<
1062
1257
  return this;
1063
1258
  }
1064
1259
 
1260
+ /** @public */
1065
1261
  continueFromPrimaryLeaf(): this {
1066
1262
  this.startFrom = {
1067
1263
  kind: "semantic_ref",
@@ -1071,6 +1267,7 @@ export class LlmFlowBuilder<
1071
1267
  return this;
1072
1268
  }
1073
1269
 
1270
+ /** @internal */
1074
1271
  continueFromReviewBranch(): this {
1075
1272
  this.startFrom = {
1076
1273
  kind: "semantic_ref",
@@ -1080,6 +1277,7 @@ export class LlmFlowBuilder<
1080
1277
  return this;
1081
1278
  }
1082
1279
 
1280
+ /** @internal */
1083
1281
  continueFromProductBranch(
1084
1282
  productName: string,
1085
1283
  fallback: ProcessTurnStartSelection = { kind: "current_leaf" },
@@ -1087,6 +1285,7 @@ export class LlmFlowBuilder<
1087
1285
  return this.startFromProductBranch(productName, fallback);
1088
1286
  }
1089
1287
 
1288
+ /** @internal */
1090
1289
  startFromReviewBranch(): this {
1091
1290
  this.startFrom = {
1092
1291
  kind: "semantic_ref",
@@ -1096,6 +1295,7 @@ export class LlmFlowBuilder<
1096
1295
  return this;
1097
1296
  }
1098
1297
 
1298
+ /** @internal */
1099
1299
  startFromProductBranch(
1100
1300
  productName: string,
1101
1301
  fallback: ProcessTurnStartSelection = { kind: "session_root" },
@@ -1108,11 +1308,13 @@ export class LlmFlowBuilder<
1108
1308
  return this;
1109
1309
  }
1110
1310
 
1311
+ /** @internal */
1111
1312
  startFromRoot(): this {
1112
1313
  this.startFrom = { kind: "session_root" };
1113
1314
  return this;
1114
1315
  }
1115
1316
 
1317
+ /** @public */
1116
1318
  consume<TProductName extends string>(
1117
1319
  productName: TProductName,
1118
1320
  ): LlmFlowBuilder<TParams, TState, TConsumedProducts | TProductName, TPrepared> {
@@ -1125,6 +1327,7 @@ export class LlmFlowBuilder<
1125
1327
  >;
1126
1328
  }
1127
1329
 
1330
+ /** @public */
1128
1331
  optionalConsume<TProductName extends string>(
1129
1332
  productName: TProductName,
1130
1333
  ): LlmFlowBuilder<TParams, TState, TConsumedProducts | TProductName, TPrepared> {
@@ -1137,6 +1340,7 @@ export class LlmFlowBuilder<
1137
1340
  >;
1138
1341
  }
1139
1342
 
1343
+ /** @public */
1140
1344
  publish(productName: string): PublishedResultBuilder<TParams, TState> {
1141
1345
  const normalized = normalizeProductName(productName);
1142
1346
  if (this.publishedResult) {
@@ -1150,6 +1354,7 @@ export class LlmFlowBuilder<
1150
1354
  return builder;
1151
1355
  }
1152
1356
 
1357
+ /** @public */
1153
1358
  end(outcomeId: string): LlmTurnEndBuilder<TParams, TState> {
1154
1359
  if (this.endResult) {
1155
1360
  throw new Error(`LLM turn '${this.turnId}' declares duplicate .end(...) completion`);
@@ -1164,6 +1369,7 @@ export class LlmFlowBuilder<
1164
1369
  return this.endResult;
1165
1370
  }
1166
1371
 
1372
+ /** @public */
1167
1373
  buildPrompt(fn: LlmPromptBuilder<TParams, TState, TConsumedProducts, TPrepared>): this {
1168
1374
  this.promptBuilder = (ctx) =>
1169
1375
  fn(
@@ -1174,11 +1380,13 @@ export class LlmFlowBuilder<
1174
1380
  return this;
1175
1381
  }
1176
1382
 
1383
+ /** @public */
1177
1384
  prompt(prompt: (ctx: ProcessRuntimeTurnContext<TParams, TState>) => MaybePromise<string>): this {
1178
1385
  this.promptBuilder = prompt;
1179
1386
  return this;
1180
1387
  }
1181
1388
 
1389
+ /** @public */
1182
1390
  outcomeTool(
1183
1391
  id: string,
1184
1392
  configure: (
@@ -1241,6 +1449,7 @@ export class LlmFlowBuilder<
1241
1449
  };
1242
1450
  }
1243
1451
 
1452
+ /** @internal */
1244
1453
  producesPlan(
1245
1454
  configure: (plan: PlanResultBuilder<TParams, TState>) => PlanResultBuilder<TParams, TState>,
1246
1455
  ): FlowLlmTurn<TParams, TState, typeof DEFAULT_PLAN_RESULT_OUTCOME_ID> {
@@ -1361,10 +1570,13 @@ type StoredExternalActionBuilder<TParams, TState> = ExternalActionBuilder<
1361
1570
  Record<string, unknown>
1362
1571
  >;
1363
1572
 
1573
+ /** @public */
1364
1574
  abstract class ExternalActionTurnBuilder<TParams, TState> extends DescribedTurnBuilder {
1575
+ /** @internal */
1365
1576
  protected abstract readonly turnKind: "Automatic" | "Human";
1366
1577
  private externalActionBuilders = new Map<string, StoredExternalActionBuilder<TParams, TState>>();
1367
1578
 
1579
+ /** @public */
1368
1580
  externalAction<
1369
1581
  TEvent = unknown,
1370
1582
  TInput extends Record<string, unknown> = Record<string, unknown>,
@@ -1389,6 +1601,7 @@ abstract class ExternalActionTurnBuilder<TParams, TState> extends DescribedTurnB
1389
1601
  return this;
1390
1602
  }
1391
1603
 
1604
+ /** @internal */
1392
1605
  protected buildExternalActions():
1393
1606
  | Record<string, ProcessHumanTurnExternalActionSpec<TParams, TState>>
1394
1607
  | undefined {
@@ -1400,10 +1613,12 @@ abstract class ExternalActionTurnBuilder<TParams, TState> extends DescribedTurnB
1400
1613
  }
1401
1614
  }
1402
1615
 
1616
+ /** @public */
1403
1617
  export class AutomaticFlowBuilder<TParams = unknown, TState = unknown>
1404
1618
  extends ExternalActionTurnBuilder<TParams, TState>
1405
1619
  implements FlowAutomaticTurn<TParams, TState, string>
1406
1620
  {
1621
+ /** @internal */
1407
1622
  protected readonly turnKind = "Automatic";
1408
1623
  private runFn:
1409
1624
  | ((ctx: FlowAutomaticRunContext<TParams, TState>) => MaybePromise<WorkerCompleteInput<string>>)
@@ -1411,10 +1626,12 @@ export class AutomaticFlowBuilder<TParams = unknown, TState = unknown>
1411
1626
  private outcomeBuilders = new Map<string, AutomaticOutcomeBuilder<TParams, TState>>();
1412
1627
  private availableIntegrationTools: readonly string[] = [];
1413
1628
 
1629
+ /** @internal */
1414
1630
  get definition(): AutomaticTurnDefinition<string, TParams, TState> {
1415
1631
  return this.buildDefinition();
1416
1632
  }
1417
1633
 
1634
+ /** @public */
1418
1635
  run(
1419
1636
  fn: (
1420
1637
  ctx: FlowAutomaticRunContext<TParams, TState>,
@@ -1424,11 +1641,13 @@ export class AutomaticFlowBuilder<TParams = unknown, TState = unknown>
1424
1641
  return this;
1425
1642
  }
1426
1643
 
1644
+ /** @public */
1427
1645
  integrationTools(...tools: readonly string[]): this {
1428
1646
  this.availableIntegrationTools = tools.map((tool) => tool.trim());
1429
1647
  return this;
1430
1648
  }
1431
1649
 
1650
+ /** @public */
1432
1651
  outcome(
1433
1652
  id: string,
1434
1653
  configure: (
@@ -1487,61 +1706,74 @@ function inferAcceptanceState(actionId: string): ProcessHumanTurnActionSpec["acc
1487
1706
  return "neutral";
1488
1707
  }
1489
1708
 
1709
+ /** @public */
1490
1710
  export class HumanActionBuilder<TParams = unknown, TState = unknown> {
1491
1711
  private spec: Record<string, unknown> = {};
1492
1712
 
1713
+ /** @internal */
1493
1714
  constructor(private readonly actionId: string) {}
1494
1715
 
1716
+ /** @public */
1495
1717
  label(label: string): this {
1496
1718
  this.spec.label = label;
1497
1719
  return this;
1498
1720
  }
1499
1721
 
1722
+ /** @internal */
1500
1723
  description(description: string): this {
1501
1724
  this.spec.description = description;
1502
1725
  return this;
1503
1726
  }
1504
1727
 
1728
+ /** @public */
1505
1729
  acceptanceState(state: ProcessHumanTurnActionSpec<TParams, TState>["acceptanceState"]): this {
1506
1730
  this.spec.acceptanceState = state;
1507
1731
  return this;
1508
1732
  }
1509
1733
 
1734
+ /** @public */
1510
1735
  form(form: FormDefinition): this {
1511
1736
  this.spec.form = form;
1512
1737
  return this;
1513
1738
  }
1514
1739
 
1740
+ /** @public */
1515
1741
  to(turnId: TurnId): this {
1516
1742
  this.spec.to = turnId;
1517
1743
  return this;
1518
1744
  }
1519
1745
 
1746
+ /** @internal */
1520
1747
  complete(): this {
1521
1748
  this.spec.complete = true;
1522
1749
  return this;
1523
1750
  }
1524
1751
 
1752
+ /** @public */
1525
1753
  lifecycleStatus(status: ProcessTurnTerminalLifecycleStatus): this {
1526
1754
  this.spec.lifecycleStatus = status;
1527
1755
  return this;
1528
1756
  }
1529
1757
 
1758
+ /** @internal */
1530
1759
  trigger(trigger: string): this {
1531
1760
  this.spec.trigger = trigger;
1532
1761
  return this;
1533
1762
  }
1534
1763
 
1764
+ /** @internal */
1535
1765
  schedulable(value = true): this {
1536
1766
  this.spec.schedulable = value;
1537
1767
  return this;
1538
1768
  }
1539
1769
 
1770
+ /** @public */
1540
1771
  effect(effect: ProcessHumanTurnActionSpec<TParams, TState>["effect"]): this {
1541
1772
  this.spec.effect = effect;
1542
1773
  return this;
1543
1774
  }
1544
1775
 
1776
+ /** @internal */
1545
1777
  build(): ProcessHumanTurnActionSpec<TParams, TState> {
1546
1778
  return {
1547
1779
  label:
@@ -1555,6 +1787,7 @@ export class HumanActionBuilder<TParams = unknown, TState = unknown> {
1555
1787
  }
1556
1788
  }
1557
1789
 
1790
+ /** @public */
1558
1791
  export class ExternalActionBuilder<
1559
1792
  TParams = unknown,
1560
1793
  TState = unknown,
@@ -1563,41 +1796,55 @@ export class ExternalActionBuilder<
1563
1796
  > {
1564
1797
  private spec: Partial<ProcessHumanTurnExternalActionSpec<TParams, TState, TEvent, TInput>>;
1565
1798
 
1799
+ /** @internal */
1566
1800
  constructor(actionId: string, source: ExternalActionSource<TParams, TState, TEvent, TInput>) {
1567
1801
  this.spec = { id: actionId, source };
1568
1802
  }
1569
1803
 
1804
+ /** @public */
1570
1805
  label(label: string): this {
1571
1806
  this.spec.label = label;
1572
1807
  return this;
1573
1808
  }
1574
1809
 
1810
+ /** @public */
1575
1811
  description(description: string): this {
1576
1812
  this.spec.description = description;
1577
1813
  return this;
1578
1814
  }
1579
1815
 
1816
+ /** @public */
1580
1817
  when(condition: NonNullable<ProcessHumanTurnExternalActionSpec<TParams, TState>["when"]>): this {
1581
1818
  this.spec.when = condition;
1582
1819
  return this;
1583
1820
  }
1584
1821
 
1822
+ /** @public */
1585
1823
  to(turnId: TurnId): this {
1586
1824
  this.spec.to = turnId;
1587
1825
  return this;
1588
1826
  }
1589
1827
 
1828
+ /** @internal */
1590
1829
  complete(): this {
1591
1830
  this.spec.complete = true;
1592
1831
  return this;
1593
1832
  }
1594
1833
 
1834
+ /** @public */
1595
1835
  lifecycleStatus(status: ProcessTurnTerminalLifecycleStatus): this {
1596
1836
  this.spec.lifecycleStatus = status;
1597
1837
  return this;
1598
1838
  }
1599
1839
 
1600
- publishInput(productName: string, options: { inputField: string }): this {
1840
+ /** @internal */
1841
+ publishInput(
1842
+ productName: string,
1843
+ options: {
1844
+ /** @internal */
1845
+ inputField: string;
1846
+ },
1847
+ ): this {
1601
1848
  this.spec.publishInput = {
1602
1849
  productName: normalizeProductName(productName),
1603
1850
  inputField: options.inputField,
@@ -1605,20 +1852,24 @@ export class ExternalActionBuilder<
1605
1852
  return this;
1606
1853
  }
1607
1854
 
1855
+ /** @public */
1608
1856
  effect(effect: ExternalSourceEffect<TParams, TState, TEvent, TInput>): this {
1609
1857
  this.spec.effect = effect;
1610
1858
  return this;
1611
1859
  }
1612
1860
 
1861
+ /** @internal */
1613
1862
  build(): ProcessHumanTurnExternalActionSpec<TParams, TState, TEvent, TInput> {
1614
1863
  return this.spec as ProcessHumanTurnExternalActionSpec<TParams, TState, TEvent, TInput>;
1615
1864
  }
1616
1865
  }
1617
1866
 
1867
+ /** @public */
1618
1868
  export class HumanFlowBuilder<TParams = unknown, TState = unknown>
1619
1869
  extends ExternalActionTurnBuilder<TParams, TState>
1620
1870
  implements FlowHumanTurn<TParams, TState>
1621
1871
  {
1872
+ /** @internal */
1622
1873
  protected readonly turnKind = "Human";
1623
1874
  private reviewProductName: string | undefined;
1624
1875
  private reviewSemanticRef: ProcessSemanticEntryRefKey | undefined;
@@ -1627,6 +1878,7 @@ export class HumanFlowBuilder<TParams = unknown, TState = unknown>
1627
1878
  private notes: HumanTurnDefinition<TParams, TState>["notesFields"] | undefined;
1628
1879
  private actions = new Map<string, HumanActionBuilder<TParams, TState>>();
1629
1880
 
1881
+ /** @public */
1630
1882
  get definition(): HumanTurnDefinition<TParams, TState> {
1631
1883
  if (!this.turnDescription) {
1632
1884
  throw new Error(`Human turn '${this.turnId}' must declare .description(...)`);
@@ -1647,6 +1899,7 @@ export class HumanFlowBuilder<TParams = unknown, TState = unknown>
1647
1899
  };
1648
1900
  }
1649
1901
 
1902
+ /** @public */
1650
1903
  reviewProduct(productName: string): this {
1651
1904
  const normalized = normalizeProductName(productName);
1652
1905
  this.reviewProductName = normalized;
@@ -1655,21 +1908,25 @@ export class HumanFlowBuilder<TParams = unknown, TState = unknown>
1655
1908
  return this;
1656
1909
  }
1657
1910
 
1911
+ /** @public */
1658
1912
  operatorAttention(attention: HumanTurnOperatorAttention): this {
1659
1913
  this.operatorAttentionValue = attention;
1660
1914
  return this;
1661
1915
  }
1662
1916
 
1917
+ /** @internal */
1663
1918
  commentary(commentary: string): this {
1664
1919
  this.turnCommentary = commentary;
1665
1920
  return this;
1666
1921
  }
1667
1922
 
1923
+ /** @internal */
1668
1924
  notesFields(notes: HumanTurnDefinition<TParams, TState>["notesFields"]): this {
1669
1925
  this.notes = notes;
1670
1926
  return this;
1671
1927
  }
1672
1928
 
1929
+ /** @public */
1673
1930
  action(
1674
1931
  actionId: string,
1675
1932
  configure: (
@@ -1686,6 +1943,7 @@ export class HumanFlowBuilder<TParams = unknown, TState = unknown>
1686
1943
  }
1687
1944
  }
1688
1945
 
1946
+ /** @public */
1689
1947
  export class ExternalRouteBuilder<
1690
1948
  TParams = unknown,
1691
1949
  TState = unknown,
@@ -1695,15 +1953,18 @@ export class ExternalRouteBuilder<
1695
1953
  {
1696
1954
  private externalEffect: ExternalSourceEffect<TParams, TState, TEvent, TInput> | undefined;
1697
1955
  private target: FlowTargetSpec = null;
1956
+ /** @internal */
1698
1957
  constructor(
1699
1958
  private readonly parent: ExternalFlowBuilder<TParams, TState>,
1700
1959
  private readonly source: ExternalActionSource<TParams, TState, TEvent, TInput>,
1701
1960
  ) {}
1702
1961
 
1962
+ /** @internal */
1703
1963
  get id(): TurnId {
1704
1964
  return this.parent.id;
1705
1965
  }
1706
1966
 
1967
+ /** @internal */
1707
1968
  get definition(): ExternalTurnDefinition<TParams, TState> {
1708
1969
  return this.parent.definition;
1709
1970
  }
@@ -1716,22 +1977,29 @@ export class ExternalRouteBuilder<
1716
1977
  return this;
1717
1978
  }
1718
1979
 
1980
+ /** @public */
1719
1981
  to(turnId: TurnId): this {
1720
1982
  return this.setTarget({ kind: "to", turnId });
1721
1983
  }
1722
1984
 
1985
+ /** @internal */
1723
1986
  complete(): this {
1724
1987
  return this.setTarget({ kind: "complete" });
1725
1988
  }
1726
1989
 
1990
+ /** @internal */
1727
1991
  lifecycleStatus(status: ProcessTurnTerminalLifecycleStatus): this {
1728
1992
  return this.setTarget({ kind: "lifecycleStatus", status });
1729
1993
  }
1730
1994
 
1995
+ /** @internal */
1731
1996
  state(
1732
1997
  fn: (input: {
1998
+ /** @internal */
1733
1999
  ctx: FlowExternalSourceContext<TParams, TState, TEvent, TInput>;
2000
+ /** @internal */
1734
2001
  event: TEvent;
2002
+ /** @internal */
1735
2003
  input: TInput;
1736
2004
  }) => MaybePromise<TState>,
1737
2005
  ): this {
@@ -1741,10 +2009,14 @@ export class ExternalRouteBuilder<
1741
2009
  return this;
1742
2010
  }
1743
2011
 
2012
+ /** @internal */
1744
2013
  effect(
1745
2014
  fn: (input: {
2015
+ /** @internal */
1746
2016
  ctx: FlowExternalSourceContext<TParams, TState, TEvent, TInput>;
2017
+ /** @internal */
1747
2018
  event: TEvent;
2019
+ /** @internal */
1748
2020
  input: TInput;
1749
2021
  }) => MaybePromise<ProcessEffectPlan<TState> | undefined>,
1750
2022
  ): this {
@@ -1752,15 +2024,23 @@ export class ExternalRouteBuilder<
1752
2024
  return this;
1753
2025
  }
1754
2026
 
2027
+ /** @internal */
1755
2028
  build() {
1756
2029
  return {
2030
+ /** @internal */
1757
2031
  source: this.source,
1758
2032
  ...buildRouteTargetSpec(this.target),
1759
- ...(this.externalEffect ? { effect: this.externalEffect } : {}),
2033
+ ...(this.externalEffect
2034
+ ? {
2035
+ /** @internal */
2036
+ effect: this.externalEffect,
2037
+ }
2038
+ : {}),
1760
2039
  };
1761
2040
  }
1762
2041
  }
1763
2042
 
2043
+ /** @public */
1764
2044
  export class ExternalFlowBuilder<TParams = unknown, TState = unknown>
1765
2045
  extends DescribedTurnBuilder
1766
2046
  implements FlowExternalTurn<TParams, TState>
@@ -1768,6 +2048,7 @@ export class ExternalFlowBuilder<TParams = unknown, TState = unknown>
1768
2048
  private routeBuilders: ExternalRouteBuilder<TParams, TState, unknown, Record<string, unknown>>[] =
1769
2049
  [];
1770
2050
 
2051
+ /** @internal */
1771
2052
  get definition(): ExternalTurnDefinition<TParams, TState> {
1772
2053
  if (!this.turnDescription) {
1773
2054
  this.turnDescription =
@@ -1783,6 +2064,7 @@ export class ExternalFlowBuilder<TParams = unknown, TState = unknown>
1783
2064
  };
1784
2065
  }
1785
2066
 
2067
+ /** @public */
1786
2068
  from<TEvent = unknown, TInput extends Record<string, unknown> = Record<string, unknown>>(
1787
2069
  source: ExternalActionSource<TParams, TState, TEvent, TInput>,
1788
2070
  ): ExternalRouteBuilder<TParams, TState, TEvent, TInput> {
@@ -1794,6 +2076,7 @@ export class ExternalFlowBuilder<TParams = unknown, TState = unknown>
1794
2076
  }
1795
2077
  }
1796
2078
 
2079
+ /** @public */
1797
2080
  type Hook<TApi> = (api: TApi) => void;
1798
2081
 
1799
2082
  function chainHooks<TApi>(hooks: readonly Hook<TApi>[]): Hook<TApi> {
@@ -1802,33 +2085,44 @@ function chainHooks<TApi>(hooks: readonly Hook<TApi>[]): Hook<TApi> {
1802
2085
  };
1803
2086
  }
1804
2087
 
2088
+ /** @public */
1805
2089
  export abstract class FlowComponentBuilder<TParams = unknown, TState = unknown> {
2090
+ /** @internal */
1806
2091
  readonly turns: FlowTurn<TParams, TState>[] = [];
2092
+ /** @internal */
1807
2093
  readonly serverHooks: Hook<ServerProcessAPI<TParams, TState>>[] = [];
2094
+ /** @internal */
1808
2095
  readonly uiHooks: Hook<UiProcessAPI<TParams, TState>>[] = [];
2096
+ /** @internal */
1809
2097
  readonly launcherHooks: Hook<ProcessLauncherAPI<TParams>>[] = [];
2098
+ /** @internal */
1810
2099
  readonly watcherHooks: Hook<ProcessWatcherAPI<TParams>>[] = [];
1811
2100
 
2101
+ /** @public */
1812
2102
  turn(turn: FlowTurn<TParams, TState>): this {
1813
2103
  this.turns.push(turn);
1814
2104
  return this;
1815
2105
  }
1816
2106
 
2107
+ /** @internal */
1817
2108
  server(hook: Hook<ServerProcessAPI<TParams, TState>>): this {
1818
2109
  this.serverHooks.push(hook);
1819
2110
  return this;
1820
2111
  }
1821
2112
 
2113
+ /** @internal */
1822
2114
  action(definition: ProcessActionDefinition<TParams, TState>): this {
1823
2115
  this.serverHooks.push((api) => api.action(definition));
1824
2116
  return this;
1825
2117
  }
1826
2118
 
2119
+ /** @internal */
1827
2120
  ui(hook: Hook<UiProcessAPI<TParams, TState>>): this {
1828
2121
  this.uiHooks.push(hook);
1829
2122
  return this;
1830
2123
  }
1831
2124
 
2125
+ /** @public */
1832
2126
  launcher(
1833
2127
  definitionOrHook: ProcessLauncherDefinition<TParams> | Hook<ProcessLauncherAPI<TParams>>,
1834
2128
  ): this {
@@ -1840,6 +2134,7 @@ export abstract class FlowComponentBuilder<TParams = unknown, TState = unknown>
1840
2134
  return this;
1841
2135
  }
1842
2136
 
2137
+ /** @public */
1843
2138
  watcher<TEvent = unknown, TConfig = unknown>(
1844
2139
  definitionOrHook:
1845
2140
  | ProcessWatcherDefinition<TParams, TEvent, TConfig>
@@ -1854,12 +2149,15 @@ export abstract class FlowComponentBuilder<TParams = unknown, TState = unknown>
1854
2149
  }
1855
2150
  }
1856
2151
 
2152
+ /** @public */
1857
2153
  export class FlowFragmentBuilder<TParams = unknown, TState = unknown> extends FlowComponentBuilder<
1858
2154
  TParams,
1859
2155
  TState
1860
2156
  > {
2157
+ /** @internal */
1861
2158
  readonly name: string;
1862
2159
 
2160
+ /** @internal */
1863
2161
  constructor(name: string) {
1864
2162
  super();
1865
2163
  if (name.trim() === "") {
@@ -1869,6 +2167,7 @@ export class FlowFragmentBuilder<TParams = unknown, TState = unknown> extends Fl
1869
2167
  }
1870
2168
  }
1871
2169
 
2170
+ /** @public */
1872
2171
  export class FlowProcessBuilder<TParams = unknown, TState = unknown> extends FlowComponentBuilder<
1873
2172
  TParams,
1874
2173
  TState
@@ -1881,12 +2180,16 @@ export class FlowProcessBuilder<TParams = unknown, TState = unknown> extends Flo
1881
2180
  private paramsCodec: Codec<TParams> | null = null;
1882
2181
  private stateCodec: Codec<TState> | null = null;
1883
2182
  private initialStateFn: ((params: TParams) => TState) | null = null;
1884
- private repositoryCredentialsFn: ProcessDefinition<TParams, TState>["repositoryCredentials"];
1885
- private storageSizeResolver: ProcessDefinition<TParams, TState>["resolveStorageSize"];
2183
+ private repositoryCredentialsFn: ExtensionProcessDefinition<
2184
+ TParams,
2185
+ TState
2186
+ >["repositoryCredentials"];
2187
+ private storageSizeResolver: ExtensionProcessDefinition<TParams, TState>["resolveStorageSize"];
1886
2188
  private processPiConfig: ProcessPiConfig | undefined;
1887
2189
  private developmentTools = false;
1888
2190
  private docker = false;
1889
2191
 
2192
+ /** @internal */
1890
2193
  constructor(processId: string) {
1891
2194
  super();
1892
2195
  if (processId.trim() === "") {
@@ -1895,17 +2198,19 @@ export class FlowProcessBuilder<TParams = unknown, TState = unknown> extends Flo
1895
2198
  this.processId = processId;
1896
2199
  }
1897
2200
 
2201
+ /** @public */
1898
2202
  displayName(displayName: string): this {
1899
2203
  this.processDisplayName = displayName;
1900
2204
  return this;
1901
2205
  }
1902
2206
 
2207
+ /** @public */
1903
2208
  entry(turnId: TurnId): this {
1904
2209
  this.entryTurnId = turnId;
1905
2210
  return this;
1906
2211
  }
1907
2212
 
1908
- /** Declare an additional turn that launchers may select as the first turn. */
2213
+ /** Declare an additional turn that launchers may select as the first turn. @internal */
1909
2214
  alternateEntry(turnId: TurnId): this {
1910
2215
  this.alternateEntryTurnIds.push(turnId);
1911
2216
  return this;
@@ -1916,49 +2221,65 @@ export class FlowProcessBuilder<TParams = unknown, TState = unknown> extends Flo
1916
2221
  * through. Flow diagrams render this as the main line. Must start at the entry
1917
2222
  * turn and reference only declared turns without repeats.
1918
2223
  */
2224
+ /** @public */
1919
2225
  happyPath(...turnIds: readonly TurnId[]): this {
1920
2226
  this.happyPathTurnIds = turnIds;
1921
2227
  return this;
1922
2228
  }
1923
2229
 
1924
- codecs(input: { params: Codec<TParams>; state: Codec<TState> }): this {
2230
+ /** @public */
2231
+ codecs(input: {
2232
+ /** @public */
2233
+ params: Codec<TParams>;
2234
+ /** @public */
2235
+ state: Codec<TState>;
2236
+ }): this {
1925
2237
  this.paramsCodec = input.params;
1926
2238
  this.stateCodec = input.state;
1927
2239
  return this;
1928
2240
  }
1929
2241
 
2242
+ /** @public */
1930
2243
  initialState(fn: (params: TParams) => TState): this {
1931
2244
  this.initialStateFn = fn;
1932
2245
  return this;
1933
2246
  }
1934
2247
 
2248
+ /** @public */
1935
2249
  repositoryCredentials(
1936
- fn: NonNullable<ProcessDefinition<TParams, TState>["repositoryCredentials"]>,
2250
+ fn: NonNullable<ExtensionProcessDefinition<TParams, TState>["repositoryCredentials"]>,
1937
2251
  ): this {
1938
2252
  this.repositoryCredentialsFn = fn;
1939
2253
  return this;
1940
2254
  }
1941
2255
 
1942
- /** Resolve new process-volume capacity on the server; operator configuration wins. */
2256
+ /** Resolve new process-volume capacity on the server; operator configuration wins. @internal */
1943
2257
  resolveStorageSize(
1944
- fn: NonNullable<ProcessDefinition<TParams, TState>["resolveStorageSize"]>,
2258
+ fn: NonNullable<ExtensionProcessDefinition<TParams, TState>["resolveStorageSize"]>,
1945
2259
  ): this {
1946
2260
  this.storageSizeResolver = fn;
1947
2261
  return this;
1948
2262
  }
1949
2263
 
2264
+ /** @public */
1950
2265
  piConfig(config: ProcessPiConfig): this {
1951
2266
  this.processPiConfig = config;
1952
2267
  return this;
1953
2268
  }
1954
2269
 
1955
- /** Declare runner-provided process runtime capabilities. */
1956
- runtime(capabilities: { developmentTools?: boolean; docker?: boolean }): this {
2270
+ /** Declare runner-provided process runtime capabilities. @public */
2271
+ runtime(capabilities: {
2272
+ /** @internal */
2273
+ developmentTools?: boolean;
2274
+ /** @public */
2275
+ docker?: boolean;
2276
+ }): this {
1957
2277
  this.developmentTools = capabilities.developmentTools === true;
1958
2278
  this.docker = capabilities.docker === true;
1959
2279
  return this;
1960
2280
  }
1961
2281
 
2282
+ /** @internal */
1962
2283
  use(fragment: FlowFragmentBuilder<TParams, TState>): this {
1963
2284
  this.turns.push(...fragment.turns);
1964
2285
  this.serverHooks.push(...fragment.serverHooks);
@@ -1968,7 +2289,8 @@ export class FlowProcessBuilder<TParams = unknown, TState = unknown> extends Flo
1968
2289
  return this;
1969
2290
  }
1970
2291
 
1971
- define(): ProcessDefinition<TParams, TState> {
2292
+ /** @public */
2293
+ define(): ExtensionProcessDefinition<TParams, TState> {
1972
2294
  if (!this.processDisplayName) {
1973
2295
  throw new Error(`Flow process '${this.processId}' must declare .displayName(...)`);
1974
2296
  }
@@ -2030,28 +2352,35 @@ export class FlowProcessBuilder<TParams = unknown, TState = unknown> extends Flo
2030
2352
  }
2031
2353
  }
2032
2354
 
2355
+ /** @public */
2033
2356
  export const flow = {
2357
+ /** @public */
2034
2358
  llm<TParams = unknown, TState = unknown>(turnId: TurnId): LlmFlowBuilder<TParams, TState> {
2035
2359
  return new LlmFlowBuilder<TParams, TState>(turnId);
2036
2360
  },
2361
+ /** @public */
2037
2362
  automatic<TParams = unknown, TState = unknown>(
2038
2363
  turnId: TurnId,
2039
2364
  ): AutomaticFlowBuilder<TParams, TState> {
2040
2365
  return new AutomaticFlowBuilder<TParams, TState>(turnId);
2041
2366
  },
2367
+ /** @public */
2042
2368
  human<TParams = unknown, TState = unknown>(turnId: TurnId): HumanFlowBuilder<TParams, TState> {
2043
2369
  return new HumanFlowBuilder<TParams, TState>(turnId);
2044
2370
  },
2371
+ /** @public */
2045
2372
  external<TParams = unknown, TState = unknown>(
2046
2373
  turnId: TurnId,
2047
2374
  ): ExternalFlowBuilder<TParams, TState> {
2048
2375
  return new ExternalFlowBuilder<TParams, TState>(turnId);
2049
2376
  },
2377
+ /** @public */
2050
2378
  fragment<TParams = unknown, TState = unknown>(
2051
2379
  name: string,
2052
2380
  ): FlowFragmentBuilder<TParams, TState> {
2053
2381
  return new FlowFragmentBuilder<TParams, TState>(name);
2054
2382
  },
2383
+ /** @public */
2055
2384
  process<TParams = unknown, TState = unknown>(
2056
2385
  processId: string,
2057
2386
  ): FlowProcessBuilder<TParams, TState> {