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