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