@leitwerk-dev/process-sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/README.md +12 -0
  2. package/dist/browser-ui-extension.d.ts +20 -0
  3. package/dist/browser-ui-extension.d.ts.map +1 -1
  4. package/dist/capabilities.d.ts +6 -0
  5. package/dist/capabilities.d.ts.map +1 -1
  6. package/dist/{chunk-LIIP7FMU.js → chunk-5R6MVLHC.js} +1 -1
  7. package/dist/chunk-5R6MVLHC.js.map +1 -0
  8. package/dist/chunk-DVXW2ZUV.js +1 -0
  9. package/dist/chunk-DVXW2ZUV.js.map +1 -0
  10. package/dist/{chunk-TA4KO53Q.js → chunk-I7U6HCLN.js} +1 -7
  11. package/dist/chunk-I7U6HCLN.js.map +1 -0
  12. package/dist/{chunk-WFY2WWZE.js → chunk-TM2LTSW4.js} +1 -1
  13. package/dist/chunk-TM2LTSW4.js.map +1 -0
  14. package/dist/codecs.d.ts +1 -0
  15. package/dist/codecs.d.ts.map +1 -1
  16. package/dist/commit-message.d.ts +5 -0
  17. package/dist/commit-message.d.ts.map +1 -1
  18. package/dist/core-capabilities.d.ts +338 -20
  19. package/dist/core-capabilities.d.ts.map +1 -1
  20. package/dist/define-process.d.ts +195 -18
  21. package/dist/define-process.d.ts.map +1 -1
  22. package/dist/event-bus.d.ts +1 -0
  23. package/dist/event-bus.d.ts.map +1 -1
  24. package/dist/{extension-api-CcqZCYJx.d.ts → extension-api-3Vr3RE8S.d.ts} +1000 -108
  25. package/dist/extension-api.d.ts +385 -50
  26. package/dist/extension-api.d.ts.map +1 -1
  27. package/dist/external-action-source.d.ts +3 -1
  28. package/dist/external-action-source.d.ts.map +1 -1
  29. package/dist/external-source-poll.d.ts +18 -5
  30. package/dist/external-source-poll.d.ts.map +1 -1
  31. package/dist/flow.d.ts +308 -11
  32. package/dist/flow.d.ts.map +1 -1
  33. package/dist/form-contract.d.ts +1 -1
  34. package/dist/form-contract.d.ts.map +1 -1
  35. package/dist/fs-utils.d.ts +4 -0
  36. package/dist/fs-utils.d.ts.map +1 -1
  37. package/dist/git-binary.d.ts +2 -1
  38. package/dist/git-binary.d.ts.map +1 -1
  39. package/dist/git-binary.js.map +1 -1
  40. package/dist/graph-fragments.d.ts +16 -0
  41. package/dist/graph-fragments.d.ts.map +1 -1
  42. package/dist/host-capabilities.d.ts +9 -3
  43. package/dist/host-capabilities.d.ts.map +1 -1
  44. package/dist/index.d.ts +26 -26
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +270 -81
  47. package/dist/index.js.map +1 -1
  48. package/dist/integration-http.d.ts +14 -3
  49. package/dist/integration-http.d.ts.map +1 -1
  50. package/dist/json-data.d.ts +1 -1
  51. package/dist/json-data.d.ts.map +1 -1
  52. package/dist/leaf-outcome-renderer.d.ts +35 -0
  53. package/dist/leaf-outcome-renderer.d.ts.map +1 -1
  54. package/dist/leaf-outcome-renderer.js +12 -0
  55. package/dist/leaf-outcome-renderer.js.map +1 -1
  56. package/dist/leaf-outcomes.d.ts +3 -0
  57. package/dist/leaf-outcomes.d.ts.map +1 -1
  58. package/dist/model-provider.d.ts +144 -12
  59. package/dist/model-provider.d.ts.map +1 -1
  60. package/dist/pi-config-public.d.ts +2 -0
  61. package/dist/pi-config-public.d.ts.map +1 -0
  62. package/dist/pi-config-public.js +15 -0
  63. package/dist/pi-config-public.js.map +1 -0
  64. package/dist/pi-config.d.ts +40 -0
  65. package/dist/pi-config.d.ts.map +1 -1
  66. package/dist/pi-config.js +1 -1
  67. package/dist/process-definition-internals.d.ts +4 -0
  68. package/dist/process-definition-internals.d.ts.map +1 -1
  69. package/dist/process-flow-view.d.ts +2 -0
  70. package/dist/process-flow-view.d.ts.map +1 -1
  71. package/dist/process-graph.d.ts +34 -0
  72. package/dist/process-graph.d.ts.map +1 -1
  73. package/dist/process-launcher-builder.d.ts +5 -0
  74. package/dist/process-launcher-builder.d.ts.map +1 -1
  75. package/dist/process-watcher-builder.d.ts +5 -0
  76. package/dist/process-watcher-builder.d.ts.map +1 -1
  77. package/dist/process-watcher-source.d.ts +3 -1
  78. package/dist/process-watcher-source.d.ts.map +1 -1
  79. package/dist/project-binding.d.ts +5 -1
  80. package/dist/project-binding.d.ts.map +1 -1
  81. package/dist/registry-utils.d.ts +6 -0
  82. package/dist/registry-utils.d.ts.map +1 -1
  83. package/dist/repository-feedback.d.ts +36 -12
  84. package/dist/repository-feedback.d.ts.map +1 -1
  85. package/dist/repository-git-env.d.ts +6 -2
  86. package/dist/repository-git-env.d.ts.map +1 -1
  87. package/dist/repository-http.d.ts +13 -1
  88. package/dist/repository-http.d.ts.map +1 -1
  89. package/dist/repository-https.d.ts +1 -1
  90. package/dist/repository-https.d.ts.map +1 -1
  91. package/dist/repository-issue-watcher.d.ts +31 -6
  92. package/dist/repository-issue-watcher.d.ts.map +1 -1
  93. package/dist/repository-reconciliation.d.ts +5 -0
  94. package/dist/repository-reconciliation.d.ts.map +1 -0
  95. package/dist/repository-source-config.d.ts +29 -18
  96. package/dist/repository-source-config.d.ts.map +1 -1
  97. package/dist/repository-types.d.ts +28 -1
  98. package/dist/repository-types.d.ts.map +1 -1
  99. package/dist/review-flow-public.d.ts +2 -0
  100. package/dist/review-flow-public.d.ts.map +1 -0
  101. package/dist/review-flow-public.js +11 -0
  102. package/dist/review-flow-public.js.map +1 -0
  103. package/dist/review-flow.d.ts +6 -0
  104. package/dist/review-flow.d.ts.map +1 -1
  105. package/dist/review-flow.js +1 -1
  106. package/dist/runtime-internals-public.d.ts +2 -0
  107. package/dist/runtime-internals-public.d.ts.map +1 -0
  108. package/dist/runtime-internals-public.js +16 -0
  109. package/dist/runtime-internals-public.js.map +1 -0
  110. package/dist/runtime-internals.js +2 -1
  111. package/dist/server-events.d.ts +67 -0
  112. package/dist/server-events.d.ts.map +1 -1
  113. package/dist/server-process-builder.d.ts +7 -0
  114. package/dist/server-process-builder.d.ts.map +1 -1
  115. package/dist/state-helpers.d.ts +6 -0
  116. package/dist/state-helpers.d.ts.map +1 -1
  117. package/dist/subprocess-env.d.ts +3 -0
  118. package/dist/subprocess-env.d.ts.map +1 -1
  119. package/dist/tool-arguments.d.ts +4 -2
  120. package/dist/tool-arguments.d.ts.map +1 -1
  121. package/dist/tool-renderers.d.ts +6 -0
  122. package/dist/tool-renderers.d.ts.map +1 -1
  123. package/dist/turn-semantics.d.ts +14 -1
  124. package/dist/turn-semantics.d.ts.map +1 -1
  125. package/dist/types.d.ts +205 -24
  126. package/dist/types.d.ts.map +1 -1
  127. package/dist/ui-process-builder.d.ts +5 -0
  128. package/dist/ui-process-builder.d.ts.map +1 -1
  129. package/dist/worker-process-builder.d.ts +5 -0
  130. package/dist/worker-process-builder.d.ts.map +1 -1
  131. package/package.json +16 -15
  132. package/src/browser-ui-extension.ts +20 -0
  133. package/src/capabilities.ts +9 -1
  134. package/src/codecs.ts +1 -0
  135. package/src/commit-message.ts +5 -0
  136. package/src/core-capabilities.ts +398 -35
  137. package/src/define-process.ts +198 -23
  138. package/src/event-bus.ts +1 -0
  139. package/src/extension-api.ts +399 -55
  140. package/src/external-action-source.ts +7 -2
  141. package/src/external-source-poll.ts +72 -6
  142. package/src/flow.ts +352 -23
  143. package/src/form-contract.ts +0 -4
  144. package/src/fs-utils.ts +4 -0
  145. package/src/git-binary.ts +2 -1
  146. package/src/graph-fragments.ts +16 -0
  147. package/src/host-capabilities.ts +9 -6
  148. package/src/index.ts +14 -202
  149. package/src/integration-http.ts +15 -3
  150. package/src/json-data.ts +1 -1
  151. package/src/leaf-outcome-renderer.ts +35 -0
  152. package/src/leaf-outcomes.ts +3 -0
  153. package/src/model-provider.ts +169 -20
  154. package/src/pi-config-public.ts +7 -0
  155. package/src/pi-config.ts +47 -2
  156. package/src/process-definition-internals.ts +4 -0
  157. package/src/process-flow-view.ts +2 -0
  158. package/src/process-graph.ts +34 -0
  159. package/src/process-launcher-builder.ts +5 -0
  160. package/src/process-watcher-builder.ts +5 -0
  161. package/src/process-watcher-source.ts +6 -4
  162. package/src/project-binding.ts +5 -1
  163. package/src/registry-utils.ts +6 -0
  164. package/src/repository-feedback.ts +59 -5
  165. package/src/repository-git-env.ts +6 -2
  166. package/src/repository-http.ts +19 -2
  167. package/src/repository-https.ts +1 -1
  168. package/src/repository-issue-watcher.ts +64 -7
  169. package/src/repository-reconciliation.ts +30 -0
  170. package/src/repository-source-config.ts +66 -4
  171. package/src/repository-types.ts +43 -5
  172. package/src/review-flow-public.ts +5 -0
  173. package/src/review-flow.ts +6 -0
  174. package/src/runtime-internals-public.ts +7 -0
  175. package/src/server-events.ts +67 -0
  176. package/src/server-process-builder.ts +10 -1
  177. package/src/state-helpers.ts +6 -0
  178. package/src/subprocess-env.ts +3 -0
  179. package/src/tool-arguments.ts +4 -2
  180. package/src/tool-renderers.ts +6 -0
  181. package/src/turn-semantics.ts +15 -2
  182. package/src/types.ts +212 -30
  183. package/src/ui-process-builder.ts +8 -1
  184. package/src/worker-process-builder.ts +8 -1
  185. package/dist/chunk-LIIP7FMU.js.map +0 -1
  186. package/dist/chunk-TA4KO53Q.js.map +0 -1
  187. package/dist/chunk-WFY2WWZE.js.map +0 -1
@@ -33,75 +33,129 @@ import type {
33
33
  RepositoryCredentialRegistrar,
34
34
  } from "./extension-api.js";
35
35
 
36
+ /** @internal */
36
37
  export interface ProcessCreateInputLike {
38
+ /** @internal */
37
39
  processId?: ProcessInstance["processId"];
40
+ /** @internal */
38
41
  selectedTurnId?: ProcessInstance["selectedTurnId"];
42
+ /** @internal */
39
43
  lifecycleStatus?: ProcessInstance["lifecycleStatus"];
44
+ /** @internal */
40
45
  title?: string | null;
46
+ /** @internal */
41
47
  externalId?: string | null;
48
+ /** @internal */
42
49
  externalUrl?: string | null;
50
+ /** @internal */
43
51
  metadata?: Record<string, unknown> | null;
52
+ /** @internal */
44
53
  defaultModelProfileId?: string | null;
54
+ /** @internal */
45
55
  turnConfigsJson?: string | null;
56
+ /** @internal */
46
57
  selectedTurnModelProfileId?: string | null;
58
+ /** @internal */
47
59
  paramsJson?: string | null;
60
+ /** @internal */
48
61
  stateJson?: string | null;
49
62
  }
50
63
 
64
+ /** @public */
51
65
  export interface ProcessRepoLike {
66
+ /** @internal */
52
67
  create(input: ProcessCreateInputLike): ProcessInstance;
68
+ /** @internal */
53
69
  getById(id: string): ProcessInstance | null;
70
+ /** @public */
54
71
  listAll(): ProcessInstance[];
55
- /** Startup-only compatibility migrations may rewrite persisted process position and state. */
72
+ /** Startup-only compatibility migrations may rewrite persisted process position and state. @public */
56
73
  update(
57
74
  id: string,
58
75
  input: {
76
+ /** @public */
59
77
  selectedTurnId?: TurnId | null;
78
+ /** Encoded params rewritten by a startup compatibility migration. @public */
79
+ paramsJson?: string | null;
80
+ /** @public */
60
81
  currentExecution?: ProcessInstance["currentExecution"];
82
+ /** @public */
61
83
  stateJson?: string | null;
62
84
  },
63
85
  ): ProcessInstance | null;
64
86
  }
65
87
 
88
+ /** @public */
66
89
  export interface ProcessProjectRepoLike {
67
- /** Server-provided project mutation service. Implementations should emit project.updated after committed writes. */
90
+ /** Server-provided project mutation service. Implementations should emit project.updated after committed writes. @internal */
68
91
  create(input: {
92
+ /** @internal */
69
93
  instanceId: string;
94
+ /** @internal */
70
95
  key: string;
96
+ /** @internal */
71
97
  repoLocator: string;
98
+ /** @internal */
72
99
  baseBranch: string;
100
+ /** @internal */
73
101
  workBranch?: string | null;
102
+ /** @internal */
74
103
  externalId?: string | null;
104
+ /** @internal */
75
105
  externalUrl?: string | null;
106
+ /** @internal */
76
107
  metadata?: Record<string, unknown> | null;
108
+ /** @internal */
77
109
  pipelineStatus?: string | null;
78
110
  }): ProcessProject;
111
+ /** @internal */
79
112
  getByInstanceAndKey(instanceId: string, key: string): ProcessProject | null;
113
+ /** @public */
80
114
  update(
81
115
  id: string,
82
116
  input: {
117
+ /** @internal */
83
118
  baseBranch?: string;
119
+ /** @internal */
84
120
  workBranch?: string | null;
121
+ /** @internal */
85
122
  externalId?: string | null;
123
+ /** @internal */
86
124
  externalUrl?: string | null;
125
+ /** @public */
87
126
  metadata?: Record<string, unknown> | null;
127
+ /** @internal */
88
128
  pipelineStatus?: string | null;
89
129
  },
90
130
  ): ProcessProject | null;
131
+ /** @internal */
91
132
  listByInstance(instanceId: string): ProcessProject[];
92
133
  }
93
134
 
135
+ /** @public */
94
136
  export interface ProcessEventRepoLike {
95
- create(input: { instanceId: string; eventType: string; data?: Record<string, unknown> }): unknown;
137
+ /** @public */
138
+ create(input: {
139
+ /** @public */
140
+ instanceId: string;
141
+ /** @public */
142
+ eventType: string;
143
+ /** @public */
144
+ data?: Record<string, unknown>;
145
+ }): unknown;
146
+ /** @internal */
96
147
  listByInstance(instanceId: string, limit?: number): ProcessEvent[];
97
148
  }
98
149
 
150
+ /** @internal */
99
151
  export interface BroadcasterLike {
152
+ /** @internal */
100
153
  sendDurable<T extends KnownDurableWsFrameType>(
101
154
  type: T,
102
155
  payload: WsPayloadByType[T],
103
156
  instanceId?: string,
104
157
  ): void;
158
+ /** @internal */
105
159
  sendEphemeral?<T extends KnownEphemeralWsFrameType>(
106
160
  type: T,
107
161
  payload: WsPayloadByType[T],
@@ -109,20 +163,29 @@ export interface BroadcasterLike {
109
163
  ): void;
110
164
  }
111
165
 
166
+ /** @internal */
112
167
  export type LaunchModelConfigInputLike = LaunchModelConfigInput;
168
+ /** @internal */
113
169
  export type LauncherModelConfigSchemaLike = LauncherModelConfigSchema;
170
+ /** @internal */
114
171
  export type LauncherModelConfigPreviewLike = LauncherModelConfigPreview;
115
172
 
173
+ /** @internal */
116
174
  export interface LauncherModelConfigServiceLike {
175
+ /** @internal */
117
176
  getSchema(launcherId: string): Promise<LauncherModelConfigSchemaLike | null>;
177
+ /** @internal */
118
178
  preview(
119
179
  launcherId: string,
120
180
  launcherInput: Record<string, unknown>,
121
- opts?: { modelConfig?: LaunchModelConfigInputLike },
181
+ opts?: {
182
+ /** @internal */
183
+ modelConfig?: LaunchModelConfigInputLike;
184
+ },
122
185
  ): Promise<LauncherModelConfigPreviewLike | null>;
123
186
  }
124
187
 
125
- /** Stable, machine-readable codes returned while preparing a launch. */
188
+ /** Stable, machine-readable codes returned while preparing a launch. @internal */
126
189
  export type LaunchPlanPreparationIssueCode =
127
190
  | "process_id_mismatch"
128
191
  | "invalid_turn_configs_json"
@@ -133,110 +196,187 @@ export type LaunchPlanPreparationIssueCode =
133
196
  | "selected_turn_model_requires_llm_turn"
134
197
  | "model_required";
135
198
 
136
- /** Complete, presentation-safe diagnostic returned while preparing a launch. */
199
+ /** Complete, presentation-safe diagnostic returned while preparing a launch. @internal */
137
200
  export interface LaunchPlanPreparationIssue {
201
+ /** @internal */
138
202
  readonly code: LaunchPlanPreparationIssueCode;
203
+ /** @internal */
139
204
  readonly message: string;
140
205
  }
141
206
 
207
+ /** @internal */
142
208
  export type LaunchPlanPreparationResultLike =
143
209
  | {
210
+ /** @internal */
144
211
  ok: true;
212
+ /** @internal */
145
213
  launchPlan: ProcessLaunchPlan;
214
+ /** @internal */
146
215
  modelConfig: LaunchModelConfigInputLike;
216
+ /** @internal */
147
217
  warnings: readonly LaunchPlanPreparationIssue[];
148
218
  }
149
219
  | {
220
+ /** @internal */
150
221
  ok: false;
151
- /** Normalized durable plan retained when a scheduled launch is blocked. */
222
+ /** Normalized durable plan retained when a scheduled launch is blocked. @internal */
152
223
  launchPlan: ProcessLaunchPlan;
224
+ /** @internal */
153
225
  modelConfig: LaunchModelConfigInputLike;
226
+ /** @internal */
154
227
  errors: readonly LaunchPlanPreparationIssue[];
155
228
  };
156
229
 
230
+ /** @internal */
157
231
  export interface ProcessLaunchPlanServiceLike {
232
+ /** @internal */
158
233
  prepare(
159
234
  launchPlan: ProcessLaunchPlan,
160
235
  opts?: {
236
+ /** @internal */
161
237
  modelConfig?: LaunchModelConfigInputLike;
238
+ /** @internal */
162
239
  replaceModelConfig?: boolean;
240
+ /** @internal */
163
241
  invalidModelConfig?: "reject" | "omit";
164
242
  },
165
243
  ): Promise<LaunchPlanPreparationResultLike>;
166
244
  }
167
245
 
246
+ /** @internal */
168
247
  export interface HandoffDedupKeyRecordLike {
248
+ /** @internal */
169
249
  key: string;
250
+ /** @internal */
170
251
  instanceId: string;
252
+ /** @internal */
171
253
  createdAt: string;
254
+ /** @internal */
172
255
  metadata: Record<string, unknown>;
173
256
  }
174
257
 
258
+ /** @internal */
175
259
  export interface HandoffDedupKeyServiceLike {
260
+ /** @internal */
176
261
  getByKey(key: string): HandoffDedupKeyRecordLike | null;
177
262
  }
178
263
 
264
+ /** @internal */
179
265
  export interface WorkerSupervisorLike {
266
+ /** @internal */
180
267
  spawnWorker(instanceId: string): Promise<unknown>;
268
+ /** @internal */
181
269
  getWorker(instanceId: string): unknown | undefined;
182
270
  }
183
271
 
272
+ /** @public */
184
273
  export interface ProcessEngineResultLike {
274
+ /** @public */
185
275
  ok: boolean;
276
+ /** @internal */
186
277
  code?: string;
278
+ /** @internal */
187
279
  message?: string;
280
+ /** @internal */
188
281
  process?: ProcessInstance | null;
282
+ /** @internal */
189
283
  stage?: "pre_commit" | "post_commit";
284
+ /** @internal */
190
285
  data?: unknown;
191
286
  }
192
287
 
288
+ /** @internal */
193
289
  export interface DeferredProcessActivationExpected {
290
+ /** @internal */
194
291
  processId: string;
292
+ /** @internal */
195
293
  lifecycleStatus: ProcessLifecycleStatus;
294
+ /** @internal */
196
295
  selectedTurnId: TurnId | null;
296
+ /** @internal */
197
297
  title: string | null;
298
+ /** @internal */
198
299
  paramsJson: string | null;
300
+ /** @internal */
199
301
  projectId: string;
302
+ /** @internal */
200
303
  projectKey: string;
304
+ /** @internal */
201
305
  repoLocator: string;
306
+ /** @internal */
202
307
  baseBranch: string;
308
+ /** @internal */
203
309
  workBranch: string | null;
204
310
  }
205
311
 
312
+ /** @internal */
206
313
  export interface DeferredProcessActivationSnapshot extends DeferredProcessActivationExpected {
314
+ /** @internal */
207
315
  instanceId: string;
316
+ /** @internal */
208
317
  processMetadata: Record<string, unknown> | null;
318
+ /** @internal */
209
319
  projectMetadata: Record<string, unknown> | null;
210
320
  }
211
321
 
322
+ /** @internal */
212
323
  export interface DeferredProcessActivationSnapshotQuery {
324
+ /** @internal */
213
325
  projectKey: string;
326
+ /** @internal */
214
327
  instanceId?: string;
328
+ /** @internal */
215
329
  processId?: string;
216
330
  }
217
331
 
332
+ /** @internal */
218
333
  export type DeferredProcessActivationSnapshotResult =
219
- | { outcome: "ready"; snapshots: DeferredProcessActivationSnapshot[] }
220
- | { outcome: "process_not_found" }
221
- | { outcome: "project_not_found" };
334
+ | {
335
+ /** @internal */
336
+ outcome: "ready";
337
+ /** @internal */
338
+ snapshots: DeferredProcessActivationSnapshot[];
339
+ }
340
+ | {
341
+ /** @internal */
342
+ outcome: "process_not_found";
343
+ }
344
+ | {
345
+ /** @internal */
346
+ outcome: "project_not_found";
347
+ };
222
348
 
349
+ /** @internal */
223
350
  export interface DeferredProcessActivationEvent {
351
+ /** @internal */
224
352
  eventType: string;
353
+ /** @internal */
225
354
  data?: Record<string, unknown>;
355
+ /** @internal */
226
356
  level: "info" | "warn" | "error";
357
+ /** @internal */
227
358
  message: string;
228
359
  }
229
360
 
361
+ /** @internal */
230
362
  export interface PreparedDeferredProcessActivation {
363
+ /** @internal */
231
364
  expected: DeferredProcessActivationExpected;
365
+ /** @internal */
232
366
  workBranch: string;
367
+ /** @internal */
233
368
  paramsJson: string;
369
+ /** @internal */
234
370
  projectMetadata: Record<string, unknown> | null;
371
+ /** @internal */
235
372
  selectedTurnId: TurnId;
373
+ /** @internal */
236
374
  event: DeferredProcessActivationEvent;
375
+ /** @internal */
237
376
  actor?: Actor;
238
377
  }
239
378
 
379
+ /** @internal */
240
380
  export type DeferredProcessActivationOutcome =
241
381
  | "activated"
242
382
  | "already_activated"
@@ -245,314 +385,534 @@ export type DeferredProcessActivationOutcome =
245
385
  | "project_not_found"
246
386
  | "invalid_selected_turn";
247
387
 
388
+ /** @internal */
248
389
  export interface DeferredProcessActivationFailure {
390
+ /** @internal */
249
391
  expected: DeferredProcessActivationExpected;
392
+ /** @internal */
250
393
  errorClass: WorkerErrorClass;
394
+ /** @internal */
251
395
  event: DeferredProcessActivationEvent;
252
396
  }
253
397
 
398
+ /** @internal */
254
399
  export type ProcessActionExecutionSource = "ui" | "external" | "scheduled";
400
+ /** @internal */
255
401
  export type ProcessActionExecutionOrigin = "web_ui" | "external_interface" | "scheduled";
256
402
 
403
+ /** @internal */
257
404
  export interface ProcessActionSummaryLike {
405
+ /** @internal */
258
406
  id: string;
407
+ /** @internal */
259
408
  label: string;
409
+ /** @internal */
260
410
  description?: string | null;
411
+ /** @internal */
261
412
  form?: FormDefinition;
262
413
  }
263
414
 
415
+ /** @internal */
264
416
  export type ActionExecutionFailureStageLike = "pre_commit" | "post_commit";
265
417
 
418
+ /** @public */
266
419
  export type ActionExecutionResultLike =
267
420
  | {
421
+ /** @public */
268
422
  ok: true;
423
+ /** @internal */
269
424
  process: ProcessInstance | null;
425
+ /** @internal */
270
426
  data?: Record<string, unknown>;
427
+ /** @internal */
271
428
  error?: undefined;
429
+ /** @internal */
272
430
  code?: undefined;
431
+ /** @internal */
273
432
  stage?: undefined;
274
433
  }
275
434
  | {
435
+ /** @public */
276
436
  ok: false;
437
+ /** @internal */
277
438
  stage: "pre_commit";
439
+ /** @internal */
278
440
  error: string;
441
+ /** @internal */
279
442
  code?: string;
443
+ /** @internal */
280
444
  process?: undefined;
445
+ /** @internal */
281
446
  data?: undefined;
282
447
  }
283
448
  | {
449
+ /** @public */
284
450
  ok: false;
451
+ /** @internal */
285
452
  stage: "post_commit";
453
+ /** @internal */
286
454
  process: ProcessInstance;
455
+ /** @internal */
287
456
  error: string;
457
+ /** @internal */
288
458
  code?: string;
459
+ /** @internal */
289
460
  data?: Record<string, unknown>;
290
461
  };
291
462
 
463
+ /** @internal */
292
464
  export interface ProcessActionServiceLike {
465
+ /** @internal */
293
466
  listVisibleActions(instanceId: string): readonly ProcessActionSummaryLike[];
467
+ /** @internal */
294
468
  executeAction(
295
469
  instanceId: string,
296
470
  actionId: string,
297
471
  input: Record<string, unknown>,
298
472
  opts?: {
473
+ /** @internal */
299
474
  source?: ProcessActionExecutionSource;
475
+ /** @internal */
300
476
  origin?: ProcessActionExecutionOrigin;
477
+ /** @internal */
301
478
  nextTurnModelProfileId?: string | null;
479
+ /** @internal */
302
480
  actor?: Actor;
303
481
  },
304
482
  ): Promise<ActionExecutionResultLike>;
305
483
  }
306
484
 
485
+ /** @public */
307
486
  export interface ExternalObservationInput {
487
+ /** @public */
308
488
  instanceId: string;
489
+ /** @public */
309
490
  armingId: string;
491
+ /** @public */
310
492
  generation: string;
493
+ /** @public */
311
494
  observation?: {
495
+ /** @public */
312
496
  summary: string;
497
+ /** @internal */
313
498
  links?: import("@leitwerk-dev/domain").TurnProgressLink[];
499
+ /** @public */
314
500
  observedAt: string;
501
+ /** @public */
315
502
  subject: string;
503
+ /** @public */
316
504
  revision: string;
317
505
  };
506
+ /** @public */
318
507
  refreshError?: string;
319
508
  }
320
509
 
510
+ /** @public */
321
511
  export interface ExternalSourceArmingLike {
322
- /** Process-local arming id. Durable arming identity is { instanceId, id }. */
512
+ /** Process-local arming id. Durable arming identity is { instanceId, id }. @public */
323
513
  id: string;
514
+ /** @public */
324
515
  instanceId: string;
516
+ /** @internal */
325
517
  processId: string;
518
+ /** @internal */
326
519
  turnId: string;
520
+ /** @internal */
327
521
  externalActionId: string;
522
+ /** @internal */
328
523
  source: ExternalActionSource;
524
+ /** @public */
329
525
  resolved: unknown;
330
- /** Opaque identity of this resolved subscription. */
526
+ /** Opaque identity of this resolved subscription. @public */
331
527
  generation?: string;
332
528
  }
333
529
 
530
+ /** @public */
334
531
  export interface ExternalSourceFireInput {
532
+ /** @public */
335
533
  instanceId: string;
534
+ /** @public */
336
535
  armingId: string;
337
- /** Reject a superseded subscription instead of queuing its event for a later turn. */
536
+ /** Reject a superseded subscription instead of queuing its event for a later turn. @internal */
338
537
  generation?: string;
538
+ /** @internal */
339
539
  input?: Record<string, unknown>;
540
+ /** @public */
340
541
  event?: Record<string, unknown>;
542
+ /** @public */
341
543
  mergeKey?: string | null;
342
544
  }
343
545
 
546
+ /** @public */
344
547
  export interface ExternalSourceServiceLike {
548
+ /** @public */
345
549
  listArmed(kind: string): readonly ExternalSourceArmingLike[];
550
+ /** @public */
346
551
  fire(input: ExternalSourceFireInput): Promise<ActionExecutionResultLike>;
347
- /** Records facts without firing an action or changing lifecycle state. */
552
+ /** Records facts without firing an action or changing lifecycle state. @public */
348
553
  observe?(input: ExternalObservationInput): Promise<ActionExecutionResultLike>;
349
554
  }
350
555
 
556
+ /** @internal */
351
557
  export interface LauncherRecentValuesServiceLike {
558
+ /** @internal */
352
559
  list(launcherId: string): Record<string, readonly string[]>;
560
+ /** @internal */
353
561
  record(launcherId: string, launcherInput: Record<string, unknown>): void;
354
562
  }
355
563
 
564
+ /** @internal */
356
565
  export interface QueuedProcessInputLike {
566
+ /** @internal */
357
567
  source: InputSource;
568
+ /** @internal */
358
569
  kind: InputKind;
570
+ /** @internal */
359
571
  bodyMarkdown: string;
572
+ /** @internal */
360
573
  target?: ProcessInputTarget | null;
361
- /** Stable principal that queued this input. Defaults to SYSTEM_ACTOR at persist time. */
574
+ /** Stable principal that queued this input. Defaults to SYSTEM_ACTOR at persist time. @internal */
362
575
  actor?: Actor;
363
576
  }
364
577
 
578
+ /** @public */
365
579
  export interface ProcessEngineLike {
580
+ /** @internal */
366
581
  getDeferredProcessActivationSnapshots(
367
582
  query: DeferredProcessActivationSnapshotQuery,
368
583
  ): DeferredProcessActivationSnapshotResult;
584
+ /** @internal */
369
585
  activateDeferredProcess(
370
586
  instanceId: string,
371
587
  prepared: PreparedDeferredProcessActivation,
372
- ): Promise<ProcessEngineResultLike & { data?: { outcome: DeferredProcessActivationOutcome } }>;
588
+ ): Promise<
589
+ ProcessEngineResultLike & {
590
+ /** @internal */
591
+ data?: {
592
+ /** @internal */
593
+ outcome: DeferredProcessActivationOutcome;
594
+ };
595
+ }
596
+ >;
597
+ /** @internal */
373
598
  parkDeferredProcessActivationFailure(
374
599
  instanceId: string,
375
600
  failure: DeferredProcessActivationFailure,
376
601
  ): Promise<
377
602
  ProcessEngineResultLike & {
603
+ /** @internal */
378
604
  data?: {
605
+ /** @internal */
379
606
  outcome: "parked" | "stale" | "not_applicable" | "project_not_found";
380
607
  };
381
608
  }
382
609
  >;
610
+ /** @internal */
383
611
  startProcess(instanceId: string, startTurnId: TurnId): Promise<ProcessEngineResultLike>;
384
- abortProcess(instanceId: string, opts?: { actor?: Actor }): Promise<ProcessEngineResultLike>;
385
- /** Retries the current failed startup or accepted turn; startup retries consume no attempt. */
612
+ /** @public */
613
+ abortProcess(
614
+ instanceId: string,
615
+ opts?: {
616
+ /** @internal */
617
+ actor?: Actor;
618
+ },
619
+ ): Promise<ProcessEngineResultLike>;
620
+ /** Retries the current failed startup or accepted turn; startup retries consume no attempt. @public */
386
621
  retryProcess(
387
622
  instanceId: string,
388
- opts?: { nextTurnModelProfileId?: string | null; actor?: Actor },
623
+ opts?: {
624
+ /** @internal */
625
+ nextTurnModelProfileId?: string | null;
626
+ /** @internal */
627
+ actor?: Actor;
628
+ },
389
629
  ): Promise<ProcessEngineResultLike>;
630
+ /** @internal */
390
631
  continueFailedTurn(
391
632
  instanceId: string,
392
633
  turnRecordId: string,
393
- options?: { prompt?: string | null; nextTurnModelProfileId?: string | null; actor?: Actor },
634
+ options?: {
635
+ /** @internal */
636
+ prompt?: string | null;
637
+ /** @internal */
638
+ nextTurnModelProfileId?: string | null;
639
+ /** @internal */
640
+ actor?: Actor;
641
+ },
394
642
  ): Promise<ProcessEngineResultLike>;
643
+ /** @internal */
395
644
  queueInputs(
396
645
  instanceId: string,
397
646
  inputs: readonly QueuedProcessInputLike[],
398
- opts?: { dispatchErrorMessage?: string; actor?: Actor },
647
+ opts?: {
648
+ /** @internal */
649
+ dispatchErrorMessage?: string;
650
+ /** @internal */
651
+ actor?: Actor;
652
+ },
399
653
  ): Promise<ProcessEngineResultLike>;
400
654
  }
401
655
 
656
+ /** @internal */
402
657
  export interface ComponentConfigLike {
658
+ /** @internal */
403
659
  repo: string;
660
+ /** @internal */
404
661
  default_branch: string;
405
662
  }
406
663
 
664
+ /** @public */
407
665
  export interface RegisteredProcessWatcherLike<TConfig = unknown, TEvent = unknown> {
666
+ /** @public */
408
667
  readonly processId: string;
668
+ /** @internal */
409
669
  readonly processDisplayName: string;
670
+ /** @public */
410
671
  readonly watcherId: string;
672
+ /** @internal */
411
673
  readonly watcherLabel: string;
674
+ /** @internal */
412
675
  readonly watcherDescription: string;
676
+ /** @internal */
413
677
  readonly sourceId: string;
678
+ /** @internal */
414
679
  readonly sourceLabel: string;
680
+ /** @public */
415
681
  readonly enabled: boolean;
682
+ /** @internal */
416
683
  readonly configPath: string;
684
+ /** @public */
417
685
  readonly config: TConfig;
686
+ /** @internal */
418
687
  readonly presentation: ProcessWatcherPresentation;
688
+ /** @internal */
419
689
  readonly launchModelConfig: LaunchModelConfigInputLike;
690
+ /** @internal */
420
691
  resolveLaunch(event: TEvent, ctx?: LauncherContext): Promise<ProcessLaunchPlan | null>;
692
+ /** @internal */
421
693
  resolveLaunchAttempt(
422
694
  event: TEvent,
423
695
  ctx?: LauncherContext,
424
696
  ): Promise<{
697
+ /** @internal */
425
698
  launchConfig: ProcessLaunchConfig;
699
+ /** @internal */
426
700
  launchPlan: ProcessLaunchPlan;
701
+ /** @internal */
427
702
  preparationChecks: readonly LaunchPreparationCheck[];
428
703
  } | null>;
429
704
  }
430
705
 
706
+ /** @public */
431
707
  export interface WatcherLaunchResultLike extends ProgrammaticLaunchResultLike {}
432
708
 
709
+ /** @internal */
433
710
  export interface ProgrammaticLaunchRequestLike {
711
+ /** @internal */
434
712
  launcherId: string;
713
+ /** @internal */
435
714
  launcherInput: Record<string, unknown>;
715
+ /** @internal */
436
716
  title?: string | null;
717
+ /** @internal */
437
718
  modelConfig?: LaunchModelConfigInputLike;
719
+ /** @internal */
438
720
  skillIds?: readonly string[];
439
- /** Trusted, non-secret process metadata merged after launcher resolution. */
721
+ /** Trusted, non-secret process metadata merged after launcher resolution. @internal */
440
722
  processMetadata?: Record<string, unknown>;
441
723
  }
442
724
 
725
+ /** @public */
443
726
  export interface ProgrammaticLaunchResultLike {
727
+ /** @public */
444
728
  launchRunId: string;
729
+ /** @public */
445
730
  process: ProcessInstance | null;
731
+ /** @public */
446
732
  error: string | null;
447
733
  }
448
734
 
735
+ /** @public */
449
736
  export interface LaunchRunServiceLike {
737
+ /** @internal */
450
738
  startProgrammatic(
451
739
  request: ProgrammaticLaunchRequestLike,
452
- opts: { idempotencyKey: string; actor?: Actor },
740
+ opts: {
741
+ /** @internal */
742
+ idempotencyKey: string;
743
+ /** @internal */
744
+ actor?: Actor;
745
+ },
453
746
  ): Promise<ProgrammaticLaunchResultLike>;
747
+ /** @public */
454
748
  startWatcher<TConfig, TEvent>(
455
749
  watcher: RegisteredProcessWatcherLike<TConfig, TEvent>,
456
750
  event: TEvent,
457
- opts: { idempotencyKey: string; actor?: Actor },
751
+ opts: {
752
+ /** @public */
753
+ idempotencyKey: string;
754
+ /** @internal */
755
+ actor?: Actor;
756
+ },
458
757
  ): Promise<WatcherLaunchResultLike>;
459
758
  }
460
759
 
760
+ /** @public */
461
761
  export interface ProcessWatcherServiceLike {
762
+ /** @internal */
462
763
  listAll(): readonly RegisteredProcessWatcherLike[];
764
+ /** @public */
463
765
  listBySource<TConfig, TEvent>(
464
766
  source: ProcessWatcherSource<TConfig, TEvent>,
465
767
  ): readonly RegisteredProcessWatcherLike<TConfig, TEvent>[];
466
768
  }
467
769
 
770
+ /** @public */
468
771
  export interface PollResultLike {
772
+ /** @internal */
469
773
  readonly errors: readonly string[];
470
774
  }
471
775
 
472
- export interface PollingHandleLike<T extends PollResultLike = PollResultLike> {
473
- poll(): Promise<T>;
474
- }
475
-
776
+ /** @public */
476
777
  export interface PollingServiceLike {
778
+ /** @public */
477
779
  create<T extends PollResultLike>(options: {
780
+ /** @public */
478
781
  id: string;
782
+ /** @public */
479
783
  pollOnce(): Promise<T>;
784
+ /** @public */
480
785
  isEnabled(): boolean;
786
+ /** @public */
481
787
  pollInterval(): string;
788
+ /** @public */
482
789
  defaultIntervalMs?: number;
483
- }): PollingHandleLike<T>;
790
+ }): {
791
+ /** @public */
792
+ poll(): Promise<T>;
793
+ };
484
794
  }
485
795
 
796
+ /** @internal */
486
797
  export interface ProcessQuestionServiceLike {
798
+ /** @internal */
487
799
  listOpen(instanceId?: string): readonly import("@leitwerk-dev/domain").ProcessQuestionRequest[];
800
+ /** @internal */
488
801
  submitAnswers(
489
802
  instanceId: string,
490
803
  requestId: string,
491
804
  draft: readonly import("@leitwerk-dev/domain").QuestionAnswerDraft[],
492
805
  actor: Actor,
493
806
  ): Promise<
494
- | { ok: true; request: import("@leitwerk-dev/domain").ProcessQuestionRequest }
495
807
  | {
808
+ /** @internal */
809
+ ok: true;
810
+ /** @internal */
811
+ request: import("@leitwerk-dev/domain").ProcessQuestionRequest;
812
+ }
813
+ | {
814
+ /** @internal */
496
815
  ok: false;
816
+ /** @internal */
497
817
  code: "not_found" | "not_current" | "invalid";
818
+ /** @internal */
498
819
  message: string;
820
+ /** @internal */
499
821
  request?: import("@leitwerk-dev/domain").ProcessQuestionRequest;
500
822
  }
501
823
  >;
502
824
  }
503
825
 
826
+ /** @public */
504
827
  export interface CoreServerSetupDeps {
828
+ /** @internal */
505
829
  serverBaseUrl: string;
830
+ /** @internal */
506
831
  processWorkspacesDir?: string;
832
+ /** @internal */
507
833
  components: Record<string, ComponentConfigLike>;
508
- /** Typed by consuming extensions via watcher-utils ExternalWriteLogRepoLike. */
834
+ /** Typed by consuming extensions via watcher-utils ExternalWriteLogRepoLike. @public */
509
835
  externalWrites: unknown;
836
+ /** @public */
510
837
  processes: ProcessRepoLike;
838
+ /** @public */
511
839
  projects: ProcessProjectRepoLike;
840
+ /** @public */
512
841
  events: ProcessEventRepoLike;
842
+ /** @internal */
513
843
  broadcaster: BroadcasterLike;
844
+ /** @public */
514
845
  commands: ProcessEngineLike;
846
+ /** @internal */
515
847
  processActions: ProcessActionServiceLike;
848
+ /** @public */
516
849
  externalSources: ExternalSourceServiceLike;
850
+ /** @internal */
517
851
  getSupervisor: () => WorkerSupervisorLike | undefined;
852
+ /** @internal */
518
853
  launcherService: ProcessLauncherService;
854
+ /** @internal */
519
855
  launcherRecentValues: LauncherRecentValuesServiceLike;
856
+ /** @internal */
520
857
  launcherModelConfigs: LauncherModelConfigServiceLike;
858
+ /** @internal */
521
859
  launchPlans: ProcessLaunchPlanServiceLike;
860
+ /** @internal */
522
861
  handoffDedupKeys?: HandoffDedupKeyServiceLike;
862
+ /** @public */
523
863
  processWatchers?: ProcessWatcherServiceLike;
864
+ /** @public */
524
865
  launchRuns: LaunchRunServiceLike;
866
+ /** @public */
525
867
  polling: PollingServiceLike;
868
+ /** @internal */
526
869
  processModelSelection?: ProcessModelSelectionServiceLike;
527
- /** Durable active-turn questions for trusted operator-channel extensions. */
870
+ /** Durable active-turn questions for trusted operator-channel extensions. @internal */
528
871
  processQuestions?: ProcessQuestionServiceLike;
529
- /** Registration boundary for secret-backed repository credential extensions. */
872
+ /** Registration boundary for secret-backed repository credential extensions. @internal */
530
873
  repositoryCredentials: RepositoryCredentialRegistrar;
531
- /** Server-owned managed result images, available to trusted delivery extensions. */
874
+ /** Server-owned managed result images, available to trusted delivery extensions. @internal */
532
875
  resultImages?: {
876
+ /** @internal */
533
877
  get(instanceId: string, turnRecordId: string, imageId: string): Promise<Uint8Array | null>;
534
878
  };
535
879
  }
536
880
 
881
+ /** @internal */
537
882
  export type ProcessActionModelPreviewLike = ProcessActionModelPreview;
538
883
 
884
+ /** @internal */
539
885
  export type ProcessModelSelectionPreviewFailureCode =
540
886
  | "process_not_found"
541
887
  | "instance_tree_unavailable";
542
888
 
889
+ /** @internal */
543
890
  export type ProcessModelSelectionPreviewResultLike =
544
891
  | ProcessActionModelPreviewLike
545
- | { kind: "operational_failure"; code: ProcessModelSelectionPreviewFailureCode };
892
+ | {
893
+ /** @internal */
894
+ kind: "operational_failure";
895
+ /** @internal */
896
+ code: ProcessModelSelectionPreviewFailureCode;
897
+ };
546
898
 
899
+ /** @internal */
547
900
  export interface ModelProfileOptionSummaryLike {
901
+ /** @internal */
548
902
  id: string;
903
+ /** @internal */
549
904
  label: string;
905
+ /** @internal */
550
906
  description: string;
907
+ /** @internal */
551
908
  availability: "available" | "unavailable" | "stale";
552
909
  }
553
910
 
911
+ /** @internal */
554
912
  export interface ProcessModelSelectionServiceLike {
913
+ /** @internal */
555
914
  listAvailableProfiles(instanceId: string): readonly ModelProfileOptionSummaryLike[] | null;
915
+ /** @internal */
556
916
  preview(
557
917
  instanceId: string,
558
918
  actionId: string,
@@ -560,8 +920,11 @@ export interface ProcessModelSelectionServiceLike {
560
920
  ): Promise<ProcessModelSelectionPreviewResultLike>;
561
921
  }
562
922
 
923
+ /** @public */
563
924
  export const coreHostCapabilities = {
925
+ /** @public */
564
926
  serverSetup: createCapabilityToken<CoreServerSetupDeps>("core:serverSetup"),
927
+ /** @internal */
565
928
  processModelSelection: createCapabilityToken<ProcessModelSelectionServiceLike>(
566
929
  "core:processModelSelection",
567
930
  ),