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