@leitwerk-dev/domain 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 (60) hide show
  1. package/dist/actor.d.ts +4 -2
  2. package/dist/actor.d.ts.map +1 -1
  3. package/dist/domain-model.d.ts +397 -64
  4. package/dist/domain-model.d.ts.map +1 -1
  5. package/dist/index.d.ts +11 -11
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +2 -21
  8. package/dist/index.js.map +1 -1
  9. package/dist/launcher-recent-values.d.ts +5 -0
  10. package/dist/launcher-recent-values.d.ts.map +1 -1
  11. package/dist/markdown-normalize.d.ts +3 -0
  12. package/dist/markdown-normalize.d.ts.map +1 -1
  13. package/dist/number-normalize.d.ts +1 -1
  14. package/dist/number-normalize.d.ts.map +1 -1
  15. package/dist/process-definitions.d.ts +37 -8
  16. package/dist/process-definitions.d.ts.map +1 -1
  17. package/dist/process-model-config.d.ts +18 -0
  18. package/dist/process-model-config.d.ts.map +1 -1
  19. package/dist/process-row-slots.d.ts +14 -0
  20. package/dist/process-row-slots.d.ts.map +1 -1
  21. package/dist/process-state-json.d.ts +13 -0
  22. package/dist/process-state-json.d.ts.map +1 -1
  23. package/dist/repo-locator.d.ts +8 -0
  24. package/dist/repo-locator.d.ts.map +1 -1
  25. package/dist/semantic-entry-refs.d.ts +21 -0
  26. package/dist/semantic-entry-refs.d.ts.map +1 -1
  27. package/dist/startup-observation.d.ts +35 -2
  28. package/dist/startup-observation.d.ts.map +1 -1
  29. package/dist/string-normalize.d.ts +7 -2
  30. package/dist/string-normalize.d.ts.map +1 -1
  31. package/dist/turn-acceptance.d.ts +2 -0
  32. package/dist/turn-acceptance.d.ts.map +1 -1
  33. package/dist/turn-annotations.d.ts +27 -0
  34. package/dist/turn-annotations.d.ts.map +1 -1
  35. package/dist/turn-recovery.d.ts +24 -0
  36. package/dist/turn-recovery.d.ts.map +1 -1
  37. package/dist/turn-start-resolution.d.ts +48 -1
  38. package/dist/turn-start-resolution.d.ts.map +1 -1
  39. package/dist/unknown-record.d.ts +3 -1
  40. package/dist/unknown-record.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/actor.ts +4 -2
  43. package/src/domain-model.ts +428 -72
  44. package/src/index.ts +1 -34
  45. package/src/launcher-recent-values.ts +5 -0
  46. package/src/markdown-normalize.ts +3 -0
  47. package/src/number-normalize.ts +1 -1
  48. package/src/process-definitions.ts +37 -8
  49. package/src/process-model-config.ts +27 -1
  50. package/src/process-row-slots.ts +14 -0
  51. package/src/process-state-json.ts +13 -0
  52. package/src/repo-locator.ts +8 -0
  53. package/src/semantic-entry-refs.ts +21 -0
  54. package/src/startup-observation.ts +35 -2
  55. package/src/string-normalize.ts +7 -2
  56. package/src/turn-acceptance.ts +2 -0
  57. package/src/turn-annotations.ts +27 -0
  58. package/src/turn-recovery.ts +20 -0
  59. package/src/turn-start-resolution.ts +59 -5
  60. package/src/unknown-record.ts +3 -1
@@ -2,97 +2,157 @@ import type { RepoLocatorKind } from "./repo-locator.js";
2
2
  import type { ProcessSemanticEntryRefKey } from "./semantic-entry-refs.js";
3
3
  import type { FailedTurnRecoveryContext } from "./turn-recovery.js";
4
4
  import type { ProcessTurnStartTarget } from "./turn-start-resolution.js";
5
+ /** @internal */
5
6
  export type TransitionTrigger = "start" | "advance" | "revision_requested" | "plan_approved" | "feedback_received" | "operator_re_review" | "mr_merged" | "abort" | "mr_state_waiting";
7
+ /** @public */
6
8
  export type InputSource = "external_comment" | "app_steer" | "action_prompt" | "watcher_event" | "llm_review" | "system";
7
9
  /**
8
10
  * Stable principal that drove an action, orthogonal to `InputSource` (the
9
11
  * channel an input arrived through) and `TransitionTrigger` (the graph edge a
10
12
  * transition followed). An `Actor` answers "who acted", not "how" or "why".
11
13
  */
14
+ /** @public */
12
15
  export type ActorKind = "user" | "channel" | "system";
16
+ /** @public */
13
17
  export interface Actor {
14
18
  /**
15
19
  * Stable principal id, namespaced by provider where applicable.
16
20
  * e.g. "identity-provider:alice", "operator-channel", "system", "admin".
17
21
  */
22
+ /** @public */
18
23
  id: string;
24
+ /** @public */
19
25
  kind: ActorKind;
20
- /** Origin that vouched for this actor. `null` for system/admin/local. */
26
+ /** Origin that vouched for this actor. `null` for system/admin/local. @public */
21
27
  provider: string | null;
22
- /** Optional human-readable name for UI display. */
28
+ /** Optional human-readable name for UI display. @internal */
23
29
  displayName?: string;
24
30
  }
25
- /** Watcher / scheduler / startup reconciliation and other internal callers. */
31
+ /** Watcher / scheduler / startup reconciliation and other internal callers. @internal */
26
32
  export declare const SYSTEM_ACTOR: Actor;
27
33
  /**
28
34
  * Unauthenticated default for human-driven web/HTTP/WS actions when no SSO
29
35
  * provider is configured. Keeps an auth-disabled leitwerk behaving exactly
30
36
  * as it does today while still attributing actions to a stable principal.
31
37
  */
38
+ /** @internal */
32
39
  export declare const ADMIN_ACTOR: Actor;
40
+ /** @internal */
33
41
  export type QuestionSelectionMode = "single" | "multiple";
42
+ /** @internal */
34
43
  export interface NormalizedQuestionOption {
44
+ /** @internal */
35
45
  id: string;
46
+ /** @internal */
36
47
  label: string;
48
+ /** @internal */
37
49
  details: string | null;
38
50
  }
51
+ /** @internal */
39
52
  export interface NormalizedQuestion {
53
+ /** @internal */
40
54
  id: string;
55
+ /** @internal */
41
56
  question: string;
57
+ /** @internal */
42
58
  selection: QuestionSelectionMode;
59
+ /** @internal */
43
60
  options: readonly NormalizedQuestionOption[];
44
61
  }
62
+ /** @internal */
45
63
  export interface QuestionAnswerDraft {
64
+ /** @internal */
46
65
  selectedOptionIds: readonly string[];
66
+ /** @internal */
47
67
  freeText: string;
68
+ /** @internal */
48
69
  comment: string;
49
70
  }
71
+ /** @internal */
50
72
  export interface ProcessRelation {
73
+ /** @internal */
51
74
  parentInstanceId: string;
75
+ /** @internal */
52
76
  childInstanceId: string;
77
+ /** @internal */
53
78
  kind: "derived";
79
+ /** @internal */
54
80
  purpose: string;
81
+ /** @internal */
55
82
  createdAt: string;
83
+ /** @internal */
56
84
  createdBy: Actor;
57
85
  }
86
+ /** @internal */
58
87
  export type ToolApprovalStatus = "open" | "accepted" | "feedback" | "declined" | "cancelled";
88
+ /** @internal */
59
89
  export interface ProcessToolApprovalDestination {
90
+ /** @internal */
60
91
  id: string;
92
+ /** @internal */
61
93
  displayName: string;
94
+ /** @internal */
62
95
  group?: string;
96
+ /** @internal */
63
97
  description?: string;
64
98
  }
99
+ /** @internal */
65
100
  export interface ProcessToolApprovalRequest {
101
+ /** @internal */
66
102
  id: string;
103
+ /** @internal */
67
104
  instanceId: string;
105
+ /** @internal */
68
106
  turnRecordId: string;
107
+ /** @internal */
69
108
  toolCallId: string;
109
+ /** @internal */
70
110
  toolName: string;
111
+ /** @internal */
71
112
  arguments: Record<string, unknown>;
113
+ /** @internal */
72
114
  destination: ProcessToolApprovalDestination | null;
115
+ /** @internal */
73
116
  status: ToolApprovalStatus;
117
+ /** @internal */
74
118
  requestedAt: string;
119
+ /** @internal */
75
120
  resolvedAt: string | null;
121
+ /** @internal */
76
122
  resolvedBy: Actor | null;
123
+ /** @internal */
77
124
  feedback: string | null;
78
125
  }
126
+ /** @internal */
79
127
  export interface ProcessQuestionRequest {
128
+ /** @internal */
80
129
  id: string;
130
+ /** @internal */
81
131
  instanceId: string;
132
+ /** @internal */
82
133
  turnRecordId: string;
134
+ /** @internal */
83
135
  toolCallId: string;
136
+ /** @internal */
84
137
  questions: readonly NormalizedQuestion[];
138
+ /** @internal */
85
139
  status: "open" | "answered" | "cancelled";
140
+ /** @internal */
86
141
  answers: readonly string[] | null;
142
+ /** @internal */
87
143
  askedAt: string;
144
+ /** @internal */
88
145
  answeredAt: string | null;
146
+ /** @internal */
89
147
  answeredBy: Actor | null;
148
+ /** @internal */
90
149
  cancelledAt: string | null;
91
150
  }
92
- /** Normalize an LLM-authored request into immutable, position-stable identities. */
151
+ /** Normalize an LLM-authored request into immutable, position-stable identities. @internal */
93
152
  export declare function normalizeAskQuestionsInput(value: unknown): NormalizedQuestion[];
153
+ /** @internal */
94
154
  export declare function emptyQuestionDrafts(questions: readonly NormalizedQuestion[]): QuestionAnswerDraft[];
95
- /** Validate a complete structured draft and produce one canonical free-text answer per question. */
155
+ /** Validate a complete structured draft and produce one canonical free-text answer per question. @internal */
96
156
  export declare function canonicalizeQuestionAnswers(questions: readonly NormalizedQuestion[], value: unknown): string[];
97
157
  /**
98
158
  * Durable operator/system input queued for worker delivery.
@@ -100,367 +160,605 @@ export declare function canonicalizeQuestionAnswers(questions: readonly Normaliz
100
160
  * prompts. Delivery semantics are owned by `ProcessInput.target`, not by
101
161
  * `source` or `kind`.
102
162
  */
163
+ /** @public */
103
164
  export type InputKind = "instruction" | "action" | "system_event";
165
+ /** @public */
104
166
  export type ProcessInputTarget = {
167
+ /** @public */
105
168
  semanticRef: ProcessSemanticEntryRefKey;
169
+ /** @internal */
106
170
  productName?: never;
107
171
  } | {
172
+ /** @internal */
108
173
  productName: string;
174
+ /** @public */
109
175
  semanticRef?: never;
110
176
  };
177
+ /** @internal */
111
178
  export declare const WORKER_ERROR_CLASSES: readonly ["llm_error", "git_error", "pi_crash", "pipeline_error", "infrastructure", "protocol_error", "operator_abort"];
179
+ /** @internal */
112
180
  export type WorkerErrorClass = (typeof WORKER_ERROR_CLASSES)[number];
181
+ /** @internal */
113
182
  export declare function isWorkerErrorClass(value: string): value is WorkerErrorClass;
183
+ /** @internal */
114
184
  export type TurnFailureCode = "branch_drift";
185
+ /** @internal */
115
186
  export declare function isTurnFailureCode(value: string): value is TurnFailureCode;
116
- /** Extension-defined stable turn identifier. */
187
+ /** Extension-defined stable turn identifier. @public */
117
188
  export type TurnId = string;
189
+ /** @internal */
118
190
  export declare const PROCESS_TURN_TYPES: readonly ["llm", "human", "external", "automatic"];
191
+ /** @internal */
119
192
  export type ProcessTurnType = (typeof PROCESS_TURN_TYPES)[number];
193
+ /** @internal */
120
194
  export interface TurnOutcomePayload {
195
+ /** @internal */
121
196
  resultSummary?: string;
197
+ /** @internal */
122
198
  instanceId: string;
199
+ /** @internal */
123
200
  turnRecordId: string;
201
+ /** @internal */
124
202
  turnId: TurnId;
203
+ /** @internal */
125
204
  turnType: ProcessTurnType;
205
+ /** @internal */
126
206
  outcome: string;
207
+ /** @internal */
127
208
  params: Record<string, unknown>;
209
+ /** @internal */
128
210
  pathType?: ProcessTurnRecordPathType;
211
+ /** @internal */
129
212
  forkPiEntryId?: string | null;
213
+ /** @internal */
130
214
  resultPiEntryId?: string | null;
215
+ /** @internal */
131
216
  turnResultMarkdown?: string | null;
217
+ /** @internal */
132
218
  rootEntryId?: string | null;
219
+ /** @internal */
133
220
  state?: unknown;
134
221
  }
222
+ /** @internal */
135
223
  export interface TurnFailedPayload {
224
+ /** @internal */
136
225
  instanceId: string;
226
+ /** @internal */
137
227
  turnRecordId: string;
228
+ /** @internal */
138
229
  turnId: TurnId;
230
+ /** @internal */
139
231
  turnType: ProcessTurnType;
232
+ /** @internal */
140
233
  pathType: ProcessTurnRecordPathType;
234
+ /** @internal */
141
235
  forkPiEntryId?: string | null;
236
+ /** @internal */
142
237
  resultPiEntryId?: string | null;
238
+ /** @internal */
143
239
  errorSummary: string;
240
+ /** @internal */
144
241
  errorClass?: WorkerErrorClass;
242
+ /** @internal */
145
243
  failureCode?: TurnFailureCode | null;
244
+ /** @internal */
146
245
  failureDetails?: Record<string, unknown> | null;
246
+ /** @internal */
147
247
  recoveryContext?: FailedTurnRecoveryContext | null;
148
248
  }
249
+ /** @public */
149
250
  export type ProcessLifecycleStatus = "discovered" | "active" | "waiting" | "error" | "completed" | "aborted";
251
+ /** @internal */
150
252
  export declare function isProcessTurnType(value: unknown): value is ProcessTurnType;
253
+ /** @internal */
151
254
  export declare function isWorkerOwnedTurnType(turnType: ProcessTurnType): boolean;
255
+ /** @internal */
152
256
  export declare function isWaitingTurnType(turnType: ProcessTurnType): boolean;
257
+ /** @internal */
153
258
  export declare function lifecycleStatusForSelectedTurnType(turnType: ProcessTurnType): Extract<ProcessLifecycleStatus, "active" | "waiting">;
259
+ /** @internal */
154
260
  export type ProcessSelectedTurnModelSource = "action_override" | "launch_override" | "instance_turn_config" | "process_config_turn" | "instance_default" | "process_config_default" | "catalog_default" | "legacy_persisted";
261
+ /** @internal */
155
262
  export type ModelSelectionKind = "explicit" | "inherited";
263
+ /** @internal */
156
264
  export type ModelSelectionSource = ProcessSelectedTurnModelSource;
157
- /** Durable intent and resolution path for one effective model selection. */
265
+ /** Durable intent and resolution path for one effective model selection. @internal */
158
266
  export interface ModelSelectionProvenance {
267
+ /** @internal */
159
268
  kind: ModelSelectionKind;
269
+ /** @internal */
160
270
  source: ModelSelectionSource;
161
271
  }
272
+ /** @internal */
162
273
  export interface DurableModelSelection {
274
+ /** @internal */
163
275
  modelProfileId: string;
276
+ /** @internal */
164
277
  provenance: ModelSelectionProvenance;
165
278
  }
279
+ /** @internal */
166
280
  export type ModelPolicyFailureCode = "invalid_model_configuration" | "unknown_model_profile" | "model_profile_not_allowed" | "model_required" | "model_unavailable" | "model_stale" | "stale_evaluation_snapshot";
281
+ /** @internal */
167
282
  export interface FutureExecutionBlockReason {
283
+ /** @internal */
168
284
  code: ModelPolicyFailureCode;
285
+ /** @internal */
169
286
  selection: DurableModelSelection | null;
287
+ /** @internal */
170
288
  summary: string;
289
+ /** @internal */
171
290
  detectedAt: string;
172
- /** Present when the block depends on a runtime availability snapshot. */
291
+ /** Present when the block depends on a runtime availability snapshot. @internal */
173
292
  availabilityRevision?: number;
174
293
  }
175
- /** JSON object persisted as non-secret turn-start configuration. */
294
+ /** JSON object persisted as non-secret turn-start configuration. @internal */
176
295
  export type JsonObject = Record<string, unknown>;
177
- /** The one durable technical execution currently owned by a process. */
296
+ /** The one durable technical execution currently owned by a process. @internal */
178
297
  export type CurrentExecutionRef = {
298
+ /** @internal */
179
299
  kind: "worker_start";
300
+ /** @internal */
180
301
  id: string;
181
302
  } | null;
182
- /** Immutable non-secret inputs resolved for a worker-owned turn start. */
303
+ /** Immutable non-secret inputs resolved for a worker-owned turn start. @internal */
183
304
  export type ResolvedTurnStart = {
305
+ /** @internal */
184
306
  kind: "llm";
307
+ /** @internal */
185
308
  model: {
309
+ /** @internal */
186
310
  profileId: string;
311
+ /** @internal */
187
312
  providerId: string;
313
+ /** @internal */
188
314
  modelId: string;
315
+ /** @internal */
189
316
  thinkingLevel: string;
190
317
  };
191
- /** Frozen provenance used to resolve this prepared start. */
318
+ /** Frozen provenance used to resolve this prepared start. @internal */
192
319
  modelSelectionProvenance?: ModelSelectionProvenance;
193
- /** Status revision evaluated before preparation. Diagnostic only. */
320
+ /** Status revision evaluated before preparation. Diagnostic only. @internal */
194
321
  availabilityRevision?: number;
322
+ /** @internal */
195
323
  providerOptions: Record<string, string>;
324
+ /** @internal */
196
325
  providerWorkerConfig: {
326
+ /** @internal */
197
327
  version: number;
328
+ /** @internal */
198
329
  value: JsonObject;
199
330
  } | null;
331
+ /** @internal */
200
332
  piResourceSnapshotDigest: string;
333
+ /** @internal */
201
334
  workerRuntimeProfileId: string;
335
+ /** @internal */
202
336
  piSettings: JsonObject;
203
337
  } | {
338
+ /** @internal */
204
339
  kind: "automatic";
205
340
  };
341
+ /** @internal */
206
342
  export type TurnStartKind = "selected_turn" | "retry" | "continue" | "startup_retry";
343
+ /** @internal */
207
344
  export interface TurnStartContinuation {
345
+ /** @internal */
208
346
  continueFromPiEntryId: string;
347
+ /** @internal */
209
348
  continuePrompt: string;
349
+ /** @internal */
210
350
  savedPrimaryLeafEntryId: string | null;
211
351
  }
352
+ /** @internal */
212
353
  export type TurnStartPreparationFailureCode = "invalid_model_configuration" | "model_required" | "model_unavailable" | "model_stale" | "provider_options_required" | "provider_preflight_failed";
354
+ /** @internal */
213
355
  export type TurnStartRecordState = {
356
+ /** @internal */
214
357
  kind: "preparation_failed";
358
+ /** @internal */
215
359
  requestedModelProfileId: string | null;
360
+ /** @internal */
216
361
  providerOptions: Record<string, string>;
362
+ /** @internal */
217
363
  code: TurnStartPreparationFailureCode;
364
+ /** @internal */
218
365
  safeSummary: string;
366
+ /** @internal */
219
367
  modelSelectionProvenance?: ModelSelectionProvenance;
368
+ /** @internal */
220
369
  availabilityRevision?: number;
221
370
  } | {
371
+ /** @internal */
222
372
  kind: "starting";
373
+ /** @internal */
223
374
  start: ResolvedTurnStart;
224
375
  } | {
376
+ /** @internal */
225
377
  kind: "bootstrap_failed";
378
+ /** @internal */
226
379
  start: ResolvedTurnStart;
380
+ /** @internal */
227
381
  failedWorkerLeaseId: string | null;
382
+ /** @internal */
228
383
  code: string;
384
+ /** @internal */
229
385
  safeSummary: string;
230
386
  } | {
387
+ /** @internal */
231
388
  kind: "accepted";
389
+ /** @internal */
232
390
  start: ResolvedTurnStart;
391
+ /** @internal */
233
392
  turnRecordId: string;
393
+ /** @internal */
234
394
  acceptedWorkerLeaseId: string;
235
395
  } | {
396
+ /** @internal */
236
397
  kind: "superseded";
398
+ /** @internal */
237
399
  start: ResolvedTurnStart | null;
238
400
  };
239
- /** Durable preparation for a single worker-owned selected turn, not an attempt. */
401
+ /** Durable preparation for a single worker-owned selected turn, not an attempt. @internal */
240
402
  export interface TurnStartRecord {
403
+ /** @internal */
241
404
  id: string;
405
+ /** @internal */
242
406
  instanceId: string;
407
+ /** @internal */
243
408
  turnId: TurnId;
409
+ /** @internal */
244
410
  turnType: Extract<ProcessTurnType, "llm" | "automatic">;
245
- /** Reserved id used when, and only when, this start is accepted. */
411
+ /** Reserved id used when, and only when, this start is accepted. @internal */
246
412
  proposedTurnRecordId: string;
413
+ /** @internal */
247
414
  startKind: TurnStartKind;
415
+ /** @internal */
248
416
  recoveryTurnRecordId: string | null;
417
+ /** @internal */
249
418
  continuation: TurnStartContinuation | null;
419
+ /** @internal */
250
420
  state: TurnStartRecordState;
421
+ /** @internal */
251
422
  createdAt: string;
423
+ /** @internal */
252
424
  updatedAt: string;
253
425
  }
254
- /** Tree positioning selected during bootstrap, before a turn is accepted. */
426
+ /** Tree positioning selected during bootstrap, before a turn is accepted. @internal */
255
427
  export interface PreparedTurnStart {
428
+ /** @internal */
256
429
  pathType: ProcessTurnRecordPathType;
257
- /** Durable authored context mode used to reconcile pre-prompt positioning and compaction. */
430
+ /** Durable authored context mode used to reconcile pre-prompt positioning and compaction. @internal */
258
431
  contextMode: LlmContextMode;
432
+ /** @internal */
259
433
  startTarget: ProcessTurnStartTarget;
434
+ /** @internal */
260
435
  forkPiEntryId: string | null;
261
436
  }
437
+ /** @internal */
262
438
  export type LlmContextMode = "full" | "compacted" | "fresh" | "fresh_seeded";
263
- /** Immutable, lease-correlated proof of successful worker bootstrap. */
439
+ /** Immutable, lease-correlated proof of successful worker bootstrap. @internal */
264
440
  export type WorkerBootstrapReceipt = {
441
+ /** @internal */
265
442
  kind: "llm";
443
+ /** @internal */
266
444
  startRecordId: string;
445
+ /** @internal */
267
446
  workerLeaseId: string;
447
+ /** @internal */
268
448
  receiptEpoch: string;
449
+ /** @internal */
269
450
  verifiedResourceSnapshotDigest: string;
451
+ /** @internal */
270
452
  credentialRevision: number | null;
453
+ /** @internal */
271
454
  loadedResourceIds: string[];
455
+ /** @internal */
272
456
  resolvedModel: {
457
+ /** @internal */
273
458
  providerId: string;
459
+ /** @internal */
274
460
  modelId: string;
275
461
  };
462
+ /** @internal */
276
463
  preparedStart: PreparedTurnStart | null;
464
+ /** @internal */
277
465
  readyAt: string;
278
466
  } | {
467
+ /** @internal */
279
468
  kind: "automatic";
469
+ /** @internal */
280
470
  startRecordId: string;
471
+ /** @internal */
281
472
  workerLeaseId: string;
473
+ /** @internal */
282
474
  receiptEpoch: string;
475
+ /** @internal */
283
476
  readyAt: string;
284
477
  };
478
+ /** @internal */
285
479
  export declare const PROCESS_SELECTED_TURN_MODEL_SOURCES: readonly ["action_override", "launch_override", "instance_turn_config", "process_config_turn", "instance_default", "process_config_default", "catalog_default", "legacy_persisted"];
480
+ /** @internal */
286
481
  export declare function isProcessSelectedTurnModelSource(value: unknown): value is ProcessSelectedTurnModelSource;
482
+ /** @public */
287
483
  export interface ProcessCustomizableFields {
484
+ /** @internal */
288
485
  title?: string | null;
486
+ /** @public */
289
487
  externalId?: string | null;
488
+ /** @internal */
290
489
  externalUrl?: string | null;
490
+ /** @internal */
291
491
  metadata?: Record<string, unknown> | null;
492
+ /** @internal */
292
493
  defaultModelProfileId?: string | null;
494
+ /** @internal */
293
495
  initialDefaultModelProfileId?: string | null;
496
+ /** @internal */
294
497
  turnConfigsJson?: string | null;
498
+ /** @internal */
295
499
  selectedTurnModelProfileId?: string | null;
500
+ /** @internal */
296
501
  selectedTurnModelKind?: ModelSelectionKind | null;
502
+ /** @internal */
297
503
  selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
298
504
  }
505
+ /** @public */
299
506
  export interface ProcessInstance {
507
+ /** @public */
300
508
  id: string;
301
- /** Canonical process identifier from the extension catalog. */
509
+ /** Canonical process identifier from the extension catalog. @public */
302
510
  processId: string;
303
- /** Durable pointer to the currently selected business turn, if any. */
511
+ /** Durable pointer to the currently selected business turn, if any. @public */
304
512
  selectedTurnId: TurnId | null;
305
- /** High-level lifecycle bucket for scheduling and operator state. */
513
+ /** High-level lifecycle bucket for scheduling and operator state. @public */
306
514
  lifecycleStatus: ProcessLifecycleStatus;
307
- /** Single durable technical execution reference; null for waiting/terminal states. */
515
+ /** Single durable technical execution reference; null for waiting/terminal states. @internal */
308
516
  currentExecution: CurrentExecutionRef;
517
+ /** @public */
309
518
  planRevision: number;
310
- /** Short operator-facing process title used in process lists and related UI. */
519
+ /** Short operator-facing process title used in process lists and related UI. @public */
311
520
  title: string | null;
312
- /** Provider-agnostic external reference, such as a work item key or change path. */
521
+ /** Provider-agnostic external reference, such as a work item key or change path. @public */
313
522
  externalId: string | null;
314
- /** URL to the external resource, if applicable. */
523
+ /** URL to the external resource, if applicable. @internal */
315
524
  externalUrl: string | null;
316
- /** Extension-owned JSON metadata blob. */
525
+ /** Extension-owned JSON metadata blob. @internal */
317
526
  metadata: Record<string, unknown> | null;
318
- /** Instance-scoped default model profile used when no turn override applies. */
527
+ /** Instance-scoped default model profile used when no turn override applies. @internal */
319
528
  defaultModelProfileId?: string | null;
320
- /** Effective default model at creation time, retained for historical inspection. */
529
+ /** Effective default model at creation time, retained for historical inspection. @internal */
321
530
  initialDefaultModelProfileId?: string | null;
322
- /** JSON-serialized per-turn runtime config overrides for this instance. */
531
+ /** JSON-serialized per-turn runtime config overrides for this instance. @internal */
323
532
  turnConfigsJson?: string | null;
324
- /** Frozen effective model profile for the currently selected LLM turn, if any. */
533
+ /** Frozen effective model profile for the currently selected LLM turn, if any. @internal */
325
534
  selectedTurnModelProfileId?: string | null;
326
- /** Explicit operator intent or inherited policy resolution for the selected model. */
535
+ /** Explicit operator intent or inherited policy resolution for the selected model. @internal */
327
536
  selectedTurnModelKind?: ModelSelectionKind | null;
328
- /** Resolution path that selected `selectedTurnModelProfileId`; null for empty selections. */
537
+ /** Resolution path that selected `selectedTurnModelProfileId`; null for empty selections. @internal */
329
538
  selectedTurnModelSource?: ProcessSelectedTurnModelSource | null;
330
- /** JSON-serialized process params. */
539
+ /** JSON-serialized process params. @public */
331
540
  paramsJson: string | null;
332
- /** JSON-serialized process state. */
541
+ /** JSON-serialized process state. @public */
333
542
  stateJson: string | null;
543
+ /** @public */
334
544
  createdAt: string;
545
+ /** @internal */
335
546
  updatedAt: string;
336
- /** Set once when the process first reaches a terminal lifecycle status. */
547
+ /** Set once when the process first reaches a terminal lifecycle status. @internal */
337
548
  closedAt?: string | null;
338
549
  }
550
+ /** @public */
339
551
  export interface ProcessProject {
552
+ /** @public */
340
553
  id: string;
554
+ /** @public */
341
555
  instanceId: string;
556
+ /** @public */
342
557
  key: string;
343
- /** Repository source identifier. May be a remote URL or a local filesystem path. */
558
+ /** Repository source identifier. May be a remote URL or a local filesystem path. @public */
344
559
  repoLocator: string;
560
+ /** @internal */
345
561
  repoLocatorKind: RepoLocatorKind;
562
+ /** @internal */
346
563
  baseBranch: string;
564
+ /** @internal */
347
565
  workBranch: string | null;
348
- /** Provider-agnostic external identifier (e.g. MR IID, PR number). */
566
+ /** Provider-agnostic external identifier (e.g. MR IID, PR number). @internal */
349
567
  externalId: string | null;
350
- /** URL to the external resource (e.g. MR URL, PR URL). */
568
+ /** URL to the external resource (e.g. MR URL, PR URL). @internal */
351
569
  externalUrl: string | null;
352
- /** Extension-owned JSON metadata blob. */
570
+ /** Extension-owned JSON metadata blob. @public */
353
571
  metadata: Record<string, unknown> | null;
572
+ /** @internal */
354
573
  pipelineStatus: string | null;
574
+ /** @internal */
355
575
  createdAt: string;
576
+ /** @internal */
356
577
  updatedAt: string;
357
578
  }
579
+ /** @internal */
358
580
  export interface ProcessInput {
581
+ /** @internal */
359
582
  id: string;
583
+ /** @internal */
360
584
  instanceId: string;
585
+ /** @internal */
361
586
  sequence: number;
587
+ /** @internal */
362
588
  source: InputSource;
589
+ /** @internal */
363
590
  kind: InputKind;
591
+ /** @internal */
364
592
  target: ProcessInputTarget | null;
593
+ /** @internal */
365
594
  bodyMarkdown: string;
366
- /** Stable principal that queued this input. Defaults to `SYSTEM_ACTOR`. */
595
+ /** Stable principal that queued this input. Defaults to `SYSTEM_ACTOR`. @internal */
367
596
  actor: Actor;
597
+ /** @internal */
368
598
  receivedAt: string;
599
+ /** @internal */
369
600
  consumedAt: string | null;
370
601
  }
602
+ /** @internal */
371
603
  export type LaunchOrigin = "ui" | "programmatic" | "watcher" | "scheduled" | "startup_retry";
604
+ /** @internal */
372
605
  export type LaunchRunStatus = "preparing" | "process_created" | "starting" | "completed" | "failed" | "cancelled";
606
+ /** @internal */
373
607
  export type LaunchChecklistStepStatus = "pending" | "in_progress" | "completed" | "failed" | "skipped";
374
- /** Presentation-safe durable progress for one process launch attempt. */
608
+ /** Presentation-safe durable progress for one process launch attempt. @internal */
375
609
  export interface LaunchChecklistStep {
610
+ /** @internal */
376
611
  id: string;
612
+ /** @internal */
377
613
  label: string;
614
+ /** @internal */
378
615
  status: LaunchChecklistStepStatus;
616
+ /** @internal */
379
617
  safeSummary?: string;
618
+ /** @internal */
380
619
  startedAt?: string;
620
+ /** @internal */
381
621
  completedAt?: string;
382
622
  }
383
- /** Durable launch attempt. Secrets and runner identifiers never belong here. */
623
+ /** Durable launch attempt. Secrets and runner identifiers never belong here. @internal */
384
624
  export interface LaunchRun {
625
+ /** @internal */
385
626
  id: string;
627
+ /** @internal */
386
628
  launcherId: string | null;
629
+ /** @internal */
387
630
  origin: LaunchOrigin;
631
+ /** @internal */
388
632
  instanceId: string | null;
633
+ /** @internal */
389
634
  status: LaunchRunStatus;
635
+ /** @internal */
390
636
  steps: LaunchChecklistStep[];
637
+ /** @internal */
391
638
  createdAt: string;
639
+ /** @internal */
392
640
  updatedAt: string;
641
+ /** @internal */
393
642
  completedAt: string | null;
643
+ /** @internal */
394
644
  revision: number;
395
645
  }
646
+ /** @internal */
396
647
  export type FutureExecutionKind = "launch" | "action";
648
+ /** @internal */
397
649
  export type FutureExecutionScheduleKind = "once" | "cron";
650
+ /** @internal */
398
651
  export interface FutureExecution {
652
+ /** @internal */
399
653
  id: string;
654
+ /** @internal */
400
655
  kind: FutureExecutionKind;
656
+ /** @internal */
401
657
  scheduleKind: FutureExecutionScheduleKind;
402
- /** Canonical target process identifier. */
658
+ /** Canonical target process identifier. @internal */
403
659
  processId: string;
404
- /** Populated only for scheduled actions on an existing process instance. */
660
+ /** Populated only for scheduled actions on an existing process instance. @internal */
405
661
  instanceId: string | null;
662
+ /** @internal */
406
663
  launcherId: string | null;
664
+ /** @internal */
407
665
  actionId: string | null;
408
- /** JSON-serialized kind-specific payload. */
666
+ /** JSON-serialized kind-specific payload. @internal */
409
667
  payloadJson: string;
668
+ /** @internal */
410
669
  cronExpression: string | null;
670
+ /** @internal */
411
671
  nextRunAt: string;
412
- /** Immediate LLM selection caused by this execution, if known. */
672
+ /** Immediate LLM selection caused by this execution, if known. @internal */
413
673
  modelSelection?: DurableModelSelection | null;
414
- /** Structured model-policy block. Blocked rows remain durable. */
674
+ /** Structured model-policy block. Blocked rows remain durable. @internal */
415
675
  blockedReason?: FutureExecutionBlockReason | null;
676
+ /** @internal */
416
677
  createdAt: string;
678
+ /** @internal */
417
679
  updatedAt: string;
418
680
  }
681
+ /** @internal */
419
682
  export interface ProcessEvent {
420
- /** Persisted ingestion order. Absent only on legacy in-memory fixtures. */
683
+ /** Persisted ingestion order. Absent only on legacy in-memory fixtures. @internal */
421
684
  eventSequence?: number;
685
+ /** @internal */
422
686
  id: string;
687
+ /** @internal */
423
688
  instanceId: string;
689
+ /** @internal */
424
690
  eventType: string;
691
+ /** @internal */
425
692
  data: Record<string, unknown>;
693
+ /** @internal */
426
694
  createdAt: string;
427
695
  }
696
+ /** @internal */
428
697
  export type ProcessLeafOutcomeSnapshotStatus = "ready" | "capture_error";
698
+ /** @internal */
429
699
  export interface ProcessLeafOutcomeSnapshot {
700
+ /** @internal */
430
701
  id: string;
702
+ /** @internal */
431
703
  instanceId: string;
704
+ /** @internal */
432
705
  leafEntryId: string;
706
+ /** @internal */
433
707
  turnRecordId: string | null;
708
+ /** @internal */
434
709
  rendererId: string | null;
710
+ /** @internal */
435
711
  schemaVersion: number | null;
712
+ /** @internal */
436
713
  props: Record<string, unknown> | null;
714
+ /** @internal */
437
715
  fallbackMarkdown: string | null;
716
+ /** @internal */
438
717
  status: ProcessLeafOutcomeSnapshotStatus;
718
+ /** @internal */
439
719
  warningCode: string | null;
720
+ /** @internal */
440
721
  warningMessage: string | null;
722
+ /** @internal */
441
723
  anchoredAt: string;
724
+ /** @internal */
442
725
  createdAt: string;
443
726
  }
727
+ /** @public */
444
728
  export type ProcessTurnRecordStatus = "running" | "succeeded" | "failed" | "superseded";
729
+ /** @public */
445
730
  export type TurnProgressStepStatus = "incomplete" | "in_progress" | "completed" | "failed";
731
+ /** @public */
446
732
  export interface TurnProgressStep {
733
+ /** @public */
447
734
  id: string;
735
+ /** @public */
448
736
  label: string;
737
+ /** @public */
449
738
  status: TurnProgressStepStatus;
739
+ /** @public */
450
740
  detail?: string | null;
451
741
  }
742
+ /** @public */
452
743
  export interface TurnProgressLink {
744
+ /** @public */
453
745
  id: string;
746
+ /** @public */
454
747
  label: string;
748
+ /** @public */
455
749
  url: string;
750
+ /** @public */
456
751
  kind?: "pull_request" | "merge_request" | "commit" | "pipeline" | "other";
457
752
  }
458
- /** A complete operator-facing snapshot. Reporters replace, rather than patch, this value. */
753
+ /** A complete operator-facing snapshot. Reporters replace, rather than patch, this value. @public */
459
754
  export interface TurnProgressReport {
755
+ /** @public */
460
756
  title: string;
461
- /** Attempt-specific progress or waiting explanation; not an operation receipt. */
757
+ /** Attempt-specific progress or waiting explanation; not an operation receipt. @public */
462
758
  summary?: string;
759
+ /** @public */
463
760
  steps: TurnProgressStep[];
761
+ /** @public */
464
762
  links?: TurnProgressLink[];
465
763
  }
466
764
  /**
@@ -469,59 +767,84 @@ export interface TurnProgressReport {
469
767
  * - `root_branch`: start from the implicit session root with no prior Pi entry context
470
768
  * - `leaf_branch`: fork from the current leaf as a side path
471
769
  */
770
+ /** @public */
472
771
  export declare const PROCESS_TURN_RECORD_PATH_TYPES: readonly ["primary", "root_branch", "leaf_branch"];
772
+ /** @public */
473
773
  export type ProcessTurnRecordPathType = (typeof PROCESS_TURN_RECORD_PATH_TYPES)[number];
774
+ /** @public */
474
775
  export interface ProcessTurnRecord {
776
+ /** @public */
475
777
  id: string;
778
+ /** @internal */
476
779
  instanceId: string;
780
+ /** @public */
477
781
  turnId: TurnId;
782
+ /** @internal */
478
783
  turnType: ProcessTurnType;
784
+ /** @public */
479
785
  status: ProcessTurnRecordStatus;
786
+ /** @internal */
480
787
  attemptNumber: number;
788
+ /** @internal */
481
789
  parentTurnRecordId: string | null;
790
+ /** @internal */
482
791
  pathType: ProcessTurnRecordPathType;
792
+ /** @internal */
483
793
  forkPiEntryId: string | null;
484
- /** Accepted worker-start preparation that created this worker-owned record. */
794
+ /** Accepted worker-start preparation that created this worker-owned record. @internal */
485
795
  turnStartRecordId?: string | null;
486
- /** Lease whose receipt first authorized this worker-owned record. */
796
+ /** Lease whose receipt first authorized this worker-owned record. @internal */
487
797
  acceptedWorkerLeaseId?: string | null;
798
+ /** @internal */
488
799
  resultPiEntryId: string | null;
800
+ /** @internal */
489
801
  modelProfileId: string | null;
802
+ /** @internal */
490
803
  modelSelectionProvenance?: ModelSelectionProvenance | null;
804
+ /** @internal */
491
805
  turnResultMarkdown: string | null;
806
+ /** @public */
492
807
  errorSummary: string | null;
808
+ /** @internal */
493
809
  errorClass: WorkerErrorClass | null;
810
+ /** @internal */
494
811
  startedAt: string;
812
+ /** @internal */
495
813
  endedAt: string | null;
496
814
  }
815
+ /** @internal */
497
816
  export interface WorkerLease {
817
+ /** @internal */
498
818
  id: string;
819
+ /** @internal */
499
820
  instanceId: string;
821
+ /** @internal */
500
822
  workerId: string;
501
- /** Worker start this physical lease was created to execute. */
823
+ /** Worker start this physical lease was created to execute. @internal */
502
824
  turnStartRecordId?: string | null;
503
- /** Durable server-owned supervision state for the current worker lease. */
825
+ /** Durable server-owned supervision state for the current worker lease. @internal */
504
826
  state: WorkerState;
505
- /** Server epoch this lease belongs to, used to reject stale snapshot writes. */
827
+ /** Server epoch this lease belongs to, used to reject stale snapshot writes. @internal */
506
828
  serverEpoch?: string | null;
507
- /** Hash of the lease-scoped WebSocket connect token. The raw token is never stored. */
829
+ /** Hash of the lease-scoped WebSocket connect token. The raw token is never stored. @internal */
508
830
  connectTokenHash?: string | null;
509
- /** Hash of the lease-scoped HTTP session-snapshot credential. The raw token is never stored. */
831
+ /** Hash of the lease-scoped HTTP session-snapshot credential. The raw token is never stored. @internal */
510
832
  snapshotTokenHash?: string | null;
511
- /** Fingerprint of the effective instance model policy/config snapshot used to start this worker. */
833
+ /** Fingerprint of the effective instance model policy/config snapshot used to start this worker. @internal */
512
834
  modelPolicyFingerprint?: string | null;
513
- /** First valid lease-correlated bootstrap receipt; written once by the server. */
835
+ /** First valid lease-correlated bootstrap receipt; written once by the server. @internal */
514
836
  bootstrapReceipt?: WorkerBootstrapReceipt | null;
515
- /** Updated from heartbeats for liveness/recovery diagnostics. */
837
+ /** Updated from heartbeats for liveness/recovery diagnostics. @internal */
516
838
  lastHeartbeatAt: string | null;
839
+ /** @internal */
517
840
  startedAt: string;
518
- /** First valid server-observed worker handshake. */
841
+ /** First valid server-observed worker handshake. @internal */
519
842
  connectedAt?: string | null;
520
- /** First valid server-observed workspace preparation progress. */
843
+ /** First valid server-observed workspace preparation progress. @internal */
521
844
  workspacePreparationStartedAt?: string | null;
522
- /** First accepted server-observed worker readiness. */
845
+ /** First accepted server-observed worker readiness. @internal */
523
846
  readyAt?: string | null;
524
- /** Set once the lease is no longer active for supervision. */
847
+ /** Set once the lease is no longer active for supervision. @internal */
525
848
  exitedAt: string | null;
526
849
  }
527
850
  /**
@@ -529,18 +852,27 @@ export interface WorkerLease {
529
852
  * `absent` is conceptual in lifecycle logic and usually represented by
530
853
  * the absence of an active lease row.
531
854
  */
855
+ /** @internal */
532
856
  export type WorkerState = "absent" | "spawning" | "bootstrapping" | "idle" | "busy" | "draining" | "failed" | "cleanup" | "exited";
533
857
  /**
534
858
  * External write type identifier. Extensions define their own write types
535
859
  * as plain strings (e.g. "tracker.approved_plan_comment", "code_host.create_change").
536
860
  */
861
+ /** @public */
537
862
  export type ExternalWriteType = string;
863
+ /** @public */
538
864
  export interface ExternalWriteLog {
865
+ /** @internal */
539
866
  id: string;
867
+ /** @internal */
540
868
  instanceId: string;
869
+ /** @public */
541
870
  writeType: ExternalWriteType;
871
+ /** @internal */
542
872
  dedupKey: string;
873
+ /** @internal */
543
874
  completedAt: string;
875
+ /** @internal */
544
876
  metadata: Record<string, unknown>;
545
877
  }
546
878
  /**
@@ -549,5 +881,6 @@ export interface ExternalWriteLog {
549
881
  * as "primary" or "root_branch" in favour of plain descriptions of what the
550
882
  * turn is doing relative to the main path.
551
883
  */
884
+ /** @internal */
552
885
  export declare function formatPathTypeLabel(pathType: ProcessTurnRecordPathType): string;
553
886
  //# sourceMappingURL=domain-model.d.ts.map