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