@leitwerk-dev/protocol 0.1.9 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/api-token-contracts.d.ts +45 -0
  2. package/dist/api-token-contracts.d.ts.map +1 -0
  3. package/dist/{chunk-SKQG5SE3.js → chunk-4AKWRRFS.js} +113 -28
  4. package/dist/chunk-4AKWRRFS.js.map +1 -0
  5. package/dist/{chunk-J7LXDQAN.js → chunk-LTIDCJFK.js} +185 -6
  6. package/dist/chunk-LTIDCJFK.js.map +1 -0
  7. package/dist/{chunk-IWVU76M5.js → chunk-RUPDB3WZ.js} +1 -1
  8. package/dist/chunk-RUPDB3WZ.js.map +1 -0
  9. package/dist/compact-turn-summary.d.ts +49 -0
  10. package/dist/compact-turn-summary.d.ts.map +1 -0
  11. package/dist/config-snapshot-public.d.ts +2 -0
  12. package/dist/config-snapshot-public.d.ts.map +1 -0
  13. package/dist/config-snapshot-public.js +1 -0
  14. package/dist/config-snapshot.d.ts +110 -15
  15. package/dist/config-snapshot.d.ts.map +1 -1
  16. package/dist/config-snapshot.js +0 -1
  17. package/dist/config-snapshot.js.map +1 -1
  18. package/dist/extension-ui-contracts.d.ts +49 -0
  19. package/dist/extension-ui-contracts.d.ts.map +1 -0
  20. package/dist/external-review.d.ts +5 -1
  21. package/dist/external-review.d.ts.map +1 -1
  22. package/dist/form-contract-public.d.ts +2 -0
  23. package/dist/form-contract-public.d.ts.map +1 -0
  24. package/dist/form-contract-public.js +1 -0
  25. package/dist/form-contract.d.ts +29 -5
  26. package/dist/form-contract.d.ts.map +1 -1
  27. package/dist/form-contract.js +0 -1
  28. package/dist/form-contract.js.map +1 -1
  29. package/dist/{http-contracts-DP9P_2YM.d.ts → http-contracts-public-rL4HFcxz.d.ts} +1099 -47
  30. package/dist/http-contracts-public.d.ts +4 -0
  31. package/dist/http-contracts-public.d.ts.map +1 -0
  32. package/dist/http-contracts-public.js +10 -0
  33. package/dist/http-contracts.d.ts +923 -45
  34. package/dist/http-contracts.d.ts.map +1 -1
  35. package/dist/http-contracts.js +32 -432
  36. package/dist/http-contracts.js.map +1 -1
  37. package/dist/index.d.ts +30 -20
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1146 -20
  40. package/dist/index.js.map +1 -1
  41. package/dist/initial-prompt.d.ts +6 -0
  42. package/dist/initial-prompt.d.ts.map +1 -1
  43. package/dist/launcher-contract-public.d.ts +2 -0
  44. package/dist/launcher-contract-public.d.ts.map +1 -0
  45. package/dist/launcher-contract-public.js +1 -0
  46. package/dist/launcher-contract-public.js.map +1 -0
  47. package/dist/launcher-contract.d.ts +26 -1
  48. package/dist/launcher-contract.d.ts.map +1 -1
  49. package/dist/launcher-contract.js +0 -1
  50. package/dist/launcher-contract.js.map +1 -1
  51. package/dist/live-turn-projection.d.ts +30 -1
  52. package/dist/live-turn-projection.d.ts.map +1 -1
  53. package/dist/pi-session-message.d.ts +16 -0
  54. package/dist/pi-session-message.d.ts.map +1 -1
  55. package/dist/primary-path-snapshot.d.ts +64 -0
  56. package/dist/primary-path-snapshot.d.ts.map +1 -1
  57. package/dist/protocol.d.ts +450 -17
  58. package/dist/protocol.d.ts.map +1 -1
  59. package/dist/protocol.js +37 -259
  60. package/dist/protocol.js.map +1 -1
  61. package/dist/session-entry-tree.d.ts +12 -0
  62. package/dist/session-entry-tree.d.ts.map +1 -1
  63. package/dist/streamable-events.d.ts +4 -1
  64. package/dist/streamable-events.d.ts.map +1 -1
  65. package/dist/text-preview.d.ts +5 -0
  66. package/dist/text-preview.d.ts.map +1 -1
  67. package/dist/ticket-creation-contracts.d.ts +55 -0
  68. package/dist/ticket-creation-contracts.d.ts.map +1 -0
  69. package/dist/timeline-projection.d.ts +6 -1
  70. package/dist/timeline-projection.d.ts.map +1 -1
  71. package/dist/timestamp-ordering.d.ts +2 -0
  72. package/dist/timestamp-ordering.d.ts.map +1 -1
  73. package/dist/tool-renderer-contract-public.d.ts +3 -0
  74. package/dist/tool-renderer-contract-public.d.ts.map +1 -0
  75. package/dist/tool-renderer-contract-public.js +9 -0
  76. package/dist/tool-renderer-contract-public.js.map +1 -0
  77. package/dist/tool-renderer-contract.d.ts +15 -0
  78. package/dist/tool-renderer-contract.d.ts.map +1 -1
  79. package/dist/tool-renderer-contract.js +10 -21
  80. package/dist/tool-renderer-contract.js.map +1 -1
  81. package/dist/tool-result-truncation.d.ts +10 -0
  82. package/dist/tool-result-truncation.d.ts.map +1 -0
  83. package/dist/turn-continuation.d.ts +29 -1
  84. package/dist/turn-continuation.d.ts.map +1 -1
  85. package/dist/turn-trace-projection.d.ts +5 -0
  86. package/dist/turn-trace-projection.d.ts.map +1 -0
  87. package/dist/usage-by-turn-record.d.ts +2 -0
  88. package/dist/usage-by-turn-record.d.ts.map +1 -1
  89. package/dist/usage-snapshot.d.ts +23 -4
  90. package/dist/usage-snapshot.d.ts.map +1 -1
  91. package/dist/ws-event-payloads.d.ts +16 -1
  92. package/dist/ws-event-payloads.d.ts.map +1 -1
  93. package/package.json +18 -18
  94. package/src/api-token-contracts.ts +44 -0
  95. package/src/compact-turn-summary.ts +141 -0
  96. package/src/config-snapshot-public.ts +12 -0
  97. package/src/config-snapshot.ts +110 -15
  98. package/src/extension-ui-contracts.ts +67 -0
  99. package/src/external-review.ts +5 -1
  100. package/src/form-contract-public.ts +6 -0
  101. package/src/form-contract.ts +29 -5
  102. package/src/http-contracts-public.ts +86 -0
  103. package/src/http-contracts.ts +1059 -102
  104. package/src/index.ts +184 -20
  105. package/src/initial-prompt.ts +9 -6
  106. package/src/launcher-contract-public.ts +8 -0
  107. package/src/launcher-contract.ts +26 -1
  108. package/src/live-turn-projection.ts +70 -113
  109. package/src/pi-session-message.ts +21 -3
  110. package/src/primary-path-snapshot.ts +64 -0
  111. package/src/protocol.ts +461 -26
  112. package/src/session-entry-tree.ts +12 -0
  113. package/src/streamable-events.ts +5 -0
  114. package/src/text-preview.ts +5 -0
  115. package/src/ticket-creation-contracts.ts +62 -0
  116. package/src/timeline-projection.ts +10 -4
  117. package/src/timestamp-ordering.ts +2 -0
  118. package/src/tool-renderer-contract-public.ts +10 -0
  119. package/src/tool-renderer-contract.ts +15 -0
  120. package/src/tool-result-truncation.ts +98 -0
  121. package/src/turn-continuation.ts +50 -46
  122. package/src/turn-trace-projection.ts +42 -0
  123. package/src/usage-by-turn-record.ts +2 -0
  124. package/src/usage-snapshot.ts +45 -62
  125. package/src/ws-event-payloads.ts +19 -14
  126. package/dist/chunk-6L4W7WPV.js +0 -1
  127. package/dist/chunk-AAV3AAOF.js +0 -1
  128. package/dist/chunk-IEMT3JG4.js +0 -1
  129. package/dist/chunk-IWVU76M5.js.map +0 -1
  130. package/dist/chunk-J7LXDQAN.js.map +0 -1
  131. package/dist/chunk-SKQG5SE3.js.map +0 -1
  132. package/dist/external-review.js +0 -2
  133. package/dist/external-review.js.map +0 -1
  134. package/dist/initial-prompt.js +0 -103
  135. package/dist/initial-prompt.js.map +0 -1
  136. package/dist/live-turn-projection.js +0 -395
  137. package/dist/live-turn-projection.js.map +0 -1
  138. package/dist/pi-session-message.js +0 -27
  139. package/dist/pi-session-message.js.map +0 -1
  140. package/dist/primary-path-snapshot.js +0 -2
  141. package/dist/primary-path-snapshot.js.map +0 -1
  142. package/dist/session-entry-tree.js +0 -42
  143. package/dist/session-entry-tree.js.map +0 -1
  144. package/dist/streamable-events.js +0 -17
  145. package/dist/streamable-events.js.map +0 -1
  146. package/dist/text-preview.js +0 -23
  147. package/dist/text-preview.js.map +0 -1
  148. package/dist/timeline-projection.js +0 -33
  149. package/dist/timeline-projection.js.map +0 -1
  150. package/dist/timestamp-ordering.js +0 -15
  151. package/dist/timestamp-ordering.js.map +0 -1
  152. package/dist/turn-continuation.js +0 -179
  153. package/dist/turn-continuation.js.map +0 -1
  154. package/dist/usage-by-turn-record.js +0 -25
  155. package/dist/usage-by-turn-record.js.map +0 -1
  156. package/dist/usage-snapshot.js +0 -120
  157. package/dist/usage-snapshot.js.map +0 -1
  158. package/dist/ws-event-payloads.js +0 -47
  159. package/dist/ws-event-payloads.js.map +0 -1
  160. /package/dist/{chunk-6L4W7WPV.js.map → config-snapshot-public.js.map} +0 -0
  161. /package/dist/{chunk-AAV3AAOF.js.map → form-contract-public.js.map} +0 -0
  162. /package/dist/{chunk-IEMT3JG4.js.map → http-contracts-public.js.map} +0 -0
@@ -4,6 +4,7 @@ import {
4
4
  type FutureExecutionBlockReason,
5
5
  type InstanceTurnConfigMap,
6
6
  type LaunchModelConfigInput,
7
+ type LaunchRun,
7
8
  normalizeActor,
8
9
  normalizeLaunchModelConfigInput,
9
10
  type ProcessEvent,
@@ -15,6 +16,7 @@ import {
15
16
  type ProcessQuestionRequest,
16
17
  type ProcessRowSlot,
17
18
  type ProcessSelectedTurnModelSource,
19
+ type ProcessToolApprovalRequest,
18
20
  type ProcessTurnAnnotation,
19
21
  type ProcessTurnRecord,
20
22
  type ProcessTurnType,
@@ -25,6 +27,7 @@ import {
25
27
  type WorkerLease,
26
28
  } from "@leitwerk-dev/domain";
27
29
  import * as v from "valibot";
30
+ import type { CompactActiveTurnSnapshot } from "./compact-turn-summary.js";
28
31
  import type {
29
32
  ActionFormDefinition,
30
33
  ActionFormFieldDefinition,
@@ -49,123 +52,239 @@ import {
49
52
  unknownRecordSchema,
50
53
  } from "./protocol.js";
51
54
  import type { ToolCallRendererDefinition } from "./tool-renderer-contract.js";
55
+ import type { UsageCostSnapshot, UsageTokenCounts } from "./usage-snapshot.js";
52
56
 
57
+ /** @internal */
58
+ export interface StartLaunchRunResponseBody {
59
+ /** @internal */
60
+ launchRunId: string;
61
+ /** @internal */
62
+ instanceId: string | null;
63
+ }
64
+
65
+ /** @internal */
66
+ export interface LaunchRunResponseBody {
67
+ /** @internal */
68
+ launchRun: LaunchRun;
69
+ }
70
+
71
+ /** @internal */
72
+ export interface ProcessLaunchRunsResponseBody {
73
+ /** @internal */
74
+ launchRuns: LaunchRun[];
75
+ }
76
+
77
+ /** @internal */
53
78
  export interface AuthMeResponseBody {
79
+ /** @internal */
54
80
  authEnabled: boolean;
81
+ /** @internal */
55
82
  actor: Actor | null;
56
83
  }
57
84
 
85
+ /** @internal */
86
+ export interface SessionTransferOperationView {
87
+ /** @internal */
88
+ attemptId: string;
89
+ /** @internal */
90
+ phase: string;
91
+ /** @internal */
92
+ blocksManualTurns: boolean;
93
+ }
94
+
95
+ /** @internal */
58
96
  export interface ProcessListItem {
97
+ /** @internal */
59
98
  process: ProcessInstance;
99
+ /** @internal */
60
100
  projects: ProcessProject[];
101
+ /** @internal */
61
102
  workerLease: WorkerLease | null;
103
+ /** @internal */
62
104
  processDisplayName: string | null;
63
105
  }
64
106
 
107
+ /** @internal */
65
108
  export type ScheduleMode = "now" | "once" | "cron";
66
109
 
110
+ /** @internal */
67
111
  export type ScheduleConfigInput = {
112
+ /** @internal */
68
113
  mode: ScheduleMode;
114
+ /** @internal */
69
115
  runAt?: string | null;
116
+ /** @internal */
70
117
  cronExpression?: string | null;
71
118
  };
72
119
 
120
+ /** @internal */
73
121
  export interface FutureExecutionBaseSummary {
122
+ /** @internal */
74
123
  id: string;
124
+ /** @internal */
75
125
  kind: "launch" | "action";
126
+ /** @internal */
76
127
  scheduleKind: "once" | "cron";
128
+ /** @internal */
77
129
  processId: string;
130
+ /** @internal */
78
131
  nextRunAt: string;
132
+ /** @internal */
79
133
  cronExpression: string | null;
134
+ /** @internal */
80
135
  title: string;
136
+ /** @internal */
81
137
  subtitle: string;
138
+ /** @internal */
82
139
  status?: "scheduled" | "blocked";
140
+ /** @internal */
83
141
  modelSelection?: DurableModelSelection | null;
142
+ /** @internal */
84
143
  blockedReason?: FutureExecutionBlockReason | null;
85
144
  }
86
145
 
146
+ /** @internal */
87
147
  export type LauncherModelConfigDefaults = LaunchModelConfigInput;
88
148
 
149
+ /** @internal */
89
150
  export interface FutureLaunchSummary extends FutureExecutionBaseSummary {
151
+ /** @internal */
90
152
  kind: "launch";
153
+ /** @internal */
91
154
  launcherId: string;
155
+ /** @internal */
92
156
  launcherLabel: string;
157
+ /** @internal */
93
158
  launchTitle: string | null;
159
+ /** @internal */
94
160
  launcherInput: Record<string, unknown>;
161
+ /** @internal */
95
162
  skillIds: string[];
163
+ /** @internal */
96
164
  modelConfig: LauncherModelConfigDefaults;
97
165
  }
98
166
 
167
+ /** @internal */
99
168
  export interface FutureActionSummary extends FutureExecutionBaseSummary {
169
+ /** @internal */
100
170
  kind: "action";
171
+ /** @internal */
101
172
  instanceId: string;
173
+ /** @internal */
102
174
  actionId: string;
175
+ /** @internal */
103
176
  actionLabel: string;
177
+ /** @internal */
104
178
  nextTurnModelProfileId: string | null;
105
179
  }
106
180
 
181
+ /** @internal */
107
182
  export type FutureExecutionSummary = FutureLaunchSummary | FutureActionSummary;
108
183
 
184
+ /** @internal */
109
185
  export type ProcessActionFieldDefinition = ActionFormFieldDefinition;
186
+ /** @internal */
110
187
  export type ProcessActionFormDefinition = ActionFormDefinition;
111
188
 
189
+ /** @internal */
112
190
  export type ProcessActionPreviewSummary = {
191
+ /** @internal */
113
192
  kind: "turn" | "terminal";
193
+ /** @internal */
114
194
  turnId: string | null;
195
+ /** @internal */
115
196
  turnKind: ProcessTurnType | null;
197
+ /** @internal */
116
198
  description: string;
117
199
  };
118
200
 
201
+ /** @internal */
119
202
  export interface ProcessActionSummary {
203
+ /** @internal */
120
204
  id: string;
205
+ /** @internal */
121
206
  label: string;
207
+ /** @internal */
122
208
  description: string | null;
209
+ /** @internal */
123
210
  preview: ProcessActionPreviewSummary | null;
211
+ /** @internal */
124
212
  supportsScheduling: boolean;
213
+ /** @internal */
125
214
  supportsNextTurnModelOverride: boolean;
215
+ /** @internal */
126
216
  form?: ProcessActionFormDefinition;
127
217
  }
128
218
 
219
+ /** @internal */
129
220
  export interface ScheduledActionDetail {
221
+ /** @internal */
130
222
  id: string;
223
+ /** @internal */
131
224
  nextRunAt: string;
225
+ /** @internal */
132
226
  actionId: string;
227
+ /** @internal */
133
228
  actionLabel: string;
229
+ /** @internal */
134
230
  input: Record<string, unknown>;
231
+ /** @internal */
135
232
  nextTurnModelProfileId: string | null;
233
+ /** @internal */
136
234
  status?: "scheduled" | "blocked";
235
+ /** @internal */
137
236
  modelSelection?: DurableModelSelection | null;
237
+ /** @internal */
138
238
  blockedReason?: FutureExecutionBlockReason | null;
239
+ /** @internal */
139
240
  action: ProcessActionSummary;
140
241
  }
141
242
 
243
+ /** @internal */
142
244
  export type ProcessActionModelResolutionSource =
143
245
  | ProcessSelectedTurnModelSource
144
246
  | "persisted_selection"
145
247
  | "none";
146
248
 
249
+ /** @internal */
147
250
  export interface ProcessActionModelResolutionPreview {
251
+ /** @internal */
148
252
  status: "resolved" | "none" | "error";
253
+ /** @internal */
149
254
  modelProfileId: string | null;
255
+ /** @internal */
150
256
  source: ProcessActionModelResolutionSource | null;
257
+ /** @internal */
151
258
  error: string | null;
152
259
  }
153
260
 
261
+ /** @internal */
154
262
  export interface ProcessActionWarmPromptCacheContext {
263
+ /** @internal */
155
264
  previousModelProfileId: string;
265
+ /** @internal */
156
266
  compatibleModelProfileIds: readonly string[];
267
+ /** @internal */
157
268
  expiresAt: string;
158
269
  }
159
270
 
271
+ /** @internal */
160
272
  export interface PromptCacheSwitchResolution {
273
+ /** @internal */
161
274
  switchingModelMayBypassPromptCache: boolean;
275
+ /** @internal */
162
276
  recommendedModelProfileId: string | null;
163
277
  }
164
278
 
279
+ /** @internal */
165
280
  export function resolvePromptCacheSwitch(input: {
281
+ /** @internal */
166
282
  context: ProcessActionWarmPromptCacheContext | null | undefined;
283
+ /** @internal */
167
284
  effectiveModelProfileId: string;
285
+ /** @internal */
168
286
  selectableModelProfileIds?: readonly string[];
287
+ /** @internal */
169
288
  now?: number;
170
289
  }): PromptCacheSwitchResolution {
171
290
  const expiresAtMs = input.context ? Date.parse(input.context.expiresAt) : Number.NaN;
@@ -191,605 +310,1153 @@ export function resolvePromptCacheSwitch(input: {
191
310
  };
192
311
  }
193
312
 
313
+ /** @internal */
194
314
  export interface ProcessActionModelPreview {
315
+ /** @internal */
195
316
  kind: "llm_turn" | "not_applicable" | "unavailable";
317
+ /** @internal */
196
318
  turnId: string | null;
319
+ /** @internal */
197
320
  description: string | null;
321
+ /** @internal */
198
322
  resolvedModel?: ProcessActionModelResolutionPreview;
323
+ /** @internal */
199
324
  warmPromptCache?: ProcessActionWarmPromptCacheContext;
325
+ /** @internal */
200
326
  unavailableReason?:
201
327
  | "action_not_found"
202
328
  | "action_not_visible"
203
329
  | "invalid_action_input"
204
330
  | "action_failed";
331
+ /** @internal */
205
332
  unavailableMessage?: string | null;
206
333
  }
207
334
 
335
+ /** @internal */
208
336
  export type ProcessExternalSourceSummary = {
337
+ /** @internal */
209
338
  id: string;
339
+ /** @internal */
210
340
  kind: string;
341
+ /** @internal */
211
342
  externalActionId?: string;
343
+ /** @internal */
212
344
  sourceKind?: string;
345
+ /** @internal */
213
346
  label: string | null;
347
+ /** @internal */
214
348
  description: string | null;
215
349
  };
216
350
 
351
+ /** @internal */
217
352
  export type ProcessExternalTriggerSummary = ProcessExternalSourceSummary;
218
353
 
354
+ /** @internal */
219
355
  export interface ProcessSelectedTurnSummary {
356
+ /** @internal */
220
357
  turnId: string;
358
+ /** @internal */
221
359
  kind: ProcessTurnType;
360
+ /** @internal */
222
361
  description: string;
362
+ /** @internal */
223
363
  commentary: string | null;
364
+ /** @internal */
224
365
  externalTriggers: ProcessExternalSourceSummary[];
225
366
  }
226
367
 
368
+ /** @internal */
227
369
  export type ModelProfileAvailability = "available" | "unavailable" | "stale";
228
370
 
371
+ /** @internal */
229
372
  export type ModelProfileOptionSummary = {
373
+ /** @internal */
230
374
  id: string;
375
+ /** @internal */
231
376
  label: string;
377
+ /** @internal */
232
378
  description: string;
379
+ /** @internal */
233
380
  availability: ModelProfileAvailability;
381
+ /** @internal */
234
382
  safeReason?: string | null;
383
+ /** @internal */
235
384
  checkedAt?: string | null;
236
385
  };
237
386
 
387
+ /** @internal */
238
388
  export interface ProviderOptionChoiceSummary {
389
+ /** @internal */
239
390
  value: string;
391
+ /** @internal */
240
392
  label: string;
241
393
  }
242
394
 
395
+ /** @internal */
243
396
  export interface ProviderOptionFieldSummary {
397
+ /** @internal */
244
398
  id: string;
399
+ /** @internal */
245
400
  label: string;
401
+ /** @internal */
246
402
  required: boolean;
403
+ /** @internal */
247
404
  minLength: number | null;
405
+ /** @internal */
248
406
  maxLength: number | null;
407
+ /** @internal */
249
408
  defaultValue: string | null;
250
- /** Advisory values. Values outside this list can still be valid. */
409
+ /** Advisory values. Values outside this list can still be valid. @internal */
251
410
  choices: readonly ProviderOptionChoiceSummary[];
252
411
  }
253
412
 
413
+ /** @internal */
254
414
  export interface ModelProviderOptionsResponseBody {
415
+ /** @internal */
255
416
  modelProfileId: string;
417
+ /** @internal */
256
418
  providerId: string;
419
+ /** @internal */
257
420
  fields: readonly ProviderOptionFieldSummary[];
421
+ /** @internal */
258
422
  choicesStatus: "available" | "unavailable";
423
+ /** @internal */
259
424
  choicesUnavailableReason: string | null;
260
425
  }
261
426
 
427
+ /** @internal */
262
428
  export interface ProcessTurnModelConfigurationView {
429
+ /** @internal */
263
430
  turnId: string;
431
+ /** @internal */
264
432
  description: string;
433
+ /** @internal */
265
434
  pathType: string;
435
+ /** @internal */
266
436
  processConfigModelProfileId: string | null;
437
+ /** @internal */
267
438
  instanceModelProfileId: string | null;
439
+ /** @internal */
268
440
  effectiveConfiguredModelProfileId: string | null;
441
+ /** @internal */
269
442
  source: "instance" | "process_config" | "default";
270
443
  }
271
444
 
445
+ /** @internal */
272
446
  export type ProcessModelConfigurationIssueView = {
447
+ /** @internal */
273
448
  code: "invalid_turn_configs_json";
449
+ /** @internal */
274
450
  reason: "invalid_json" | "not_object" | "turn_config_not_object";
451
+ /** @internal */
275
452
  turnId?: string;
276
453
  };
277
454
 
455
+ /** @internal */
278
456
  export interface ProcessModelConfigurationView {
457
+ /** @internal */
279
458
  state:
280
- | { kind: "ready" }
281
- | { kind: "blocked"; issues: readonly ProcessModelConfigurationIssueView[] };
459
+ | {
460
+ /** @internal */
461
+ kind: "ready";
462
+ }
463
+ | {
464
+ /** @internal */
465
+ kind: "blocked";
466
+ /** @internal */
467
+ issues: readonly ProcessModelConfigurationIssueView[];
468
+ };
469
+ /** @internal */
282
470
  availableProfiles: readonly ModelProfileOptionSummary[];
471
+ /** @internal */
283
472
  effectiveSelectedTurn: {
473
+ /** @internal */
284
474
  turnId: string;
475
+ /** @internal */
285
476
  description: string;
477
+ /** @internal */
286
478
  modelProfileId: string;
479
+ /** @internal */
287
480
  source: ProcessActionModelResolutionSource;
288
481
  } | null;
482
+ /** @internal */
289
483
  defaultModel: {
484
+ /** @internal */
290
485
  processConfigModelProfileId: string | null;
486
+ /** @internal */
291
487
  instanceModelProfileId: string | null;
488
+ /** @internal */
292
489
  effectiveModelProfileId: string | null;
490
+ /** @internal */
293
491
  source: "instance" | "process_config" | "catalog_default" | "none";
294
492
  };
493
+ /** @internal */
295
494
  turns: readonly ProcessTurnModelConfigurationView[];
296
495
  }
297
496
 
497
+ /** @internal */
298
498
  export type ProcessRunToolParameterView = {
499
+ /** @internal */
299
500
  name: string;
501
+ /** @internal */
300
502
  type: string;
503
+ /** @internal */
301
504
  description: string;
505
+ /** @internal */
302
506
  required: boolean;
303
507
  };
304
508
 
509
+ /** @internal */
305
510
  export type ProcessRunToolView = {
511
+ /** @internal */
306
512
  name: string;
513
+ /** @internal */
307
514
  description: string;
515
+ /** @internal */
308
516
  parameters: readonly ProcessRunToolParameterView[];
309
517
  };
310
518
 
519
+ /** @internal */
311
520
  export type ProcessRunTurnView = {
521
+ /** @internal */
312
522
  turnId: string;
523
+ /** @internal */
313
524
  description: string;
525
+ /** @internal */
314
526
  pathType: string;
527
+ /** @internal */
315
528
  consumedProducts: readonly string[];
529
+ /** @internal */
316
530
  publishedProducts: readonly string[];
531
+ /** @internal */
317
532
  activePiToolNames: readonly string[];
533
+ /** @internal */
318
534
  outcomeActions: readonly ProcessRunToolView[];
319
535
  };
320
536
 
537
+ /** @internal */
321
538
  export type ProcessRunDetailsView = {
539
+ /** @internal */
322
540
  systemPrompt: string | null;
541
+ /** @internal */
323
542
  appendSystemPrompt: string | null;
543
+ /** @internal */
324
544
  availablePiToolNames: readonly string[];
545
+ /** @internal */
325
546
  turns: readonly ProcessRunTurnView[];
326
547
  };
327
548
 
549
+ /** @internal */
328
550
  export interface ProcessLaunchConfigurationParameterView {
551
+ /** @internal */
329
552
  fieldId: string;
553
+ /** @internal */
330
554
  label: string;
555
+ /** @internal */
331
556
  value: string | null;
332
557
  }
333
558
 
559
+ /** @internal */
334
560
  export interface ProcessLaunchConfigurationProjectView {
561
+ /** @internal */
335
562
  key: string;
563
+ /** @internal */
336
564
  repoLocator: string;
565
+ /** @internal */
337
566
  repoLocatorKind: ProcessProject["repoLocatorKind"];
567
+ /** @internal */
338
568
  baseBranch: string;
569
+ /** @internal */
339
570
  workBranch: string | null;
571
+ /** @internal */
340
572
  externalId: string | null;
573
+ /** @internal */
341
574
  externalUrl: string | null;
575
+ /** @internal */
342
576
  pipelineStatus: string | null;
343
577
  }
344
578
 
579
+ /** @internal */
345
580
  export interface ProcessLaunchConfigurationView {
581
+ /** @internal */
346
582
  launcherId: string | null;
583
+ /** @internal */
347
584
  launcherLabel: string | null;
585
+ /** @internal */
348
586
  launcherSchemaTitle: string | null;
587
+ /** @internal */
349
588
  paramsParseError: string | null;
589
+ /** @internal */
350
590
  parameters: readonly ProcessLaunchConfigurationParameterView[];
591
+ /** @internal */
351
592
  projects: readonly ProcessLaunchConfigurationProjectView[];
352
593
  }
353
594
 
354
- export interface PiSessionUsageSnapshot {
355
- input: number;
356
- output: number;
357
- /** Provider-reported reasoning/thinking tokens. This is a subset of output tokens. */
358
- reasoning?: number;
359
- cacheRead: number;
360
- cacheWrite: number;
361
- totalTokens: number;
362
- cost?: {
363
- input: number;
364
- output: number;
365
- cacheRead: number;
366
- cacheWrite: number;
367
- total: number;
368
- };
595
+ /** @internal */
596
+ export interface PiSessionUsageSnapshot extends UsageTokenCounts {
597
+ /** @internal */
598
+ cost?: UsageCostSnapshot;
369
599
  }
370
600
 
371
- export type PiSessionTextContentBlock = { type: "text"; text: string };
601
+ /** @internal */
602
+ export type PiSessionTextContentBlock = {
603
+ /** @internal */
604
+ type: "text";
605
+ /** @internal */
606
+ text: string;
607
+ };
372
608
 
609
+ /** @internal */
373
610
  export type PiSessionThinkingContentBlock = {
611
+ /** @internal */
374
612
  type: "thinking";
613
+ /** @internal */
375
614
  thinking: string;
615
+ /** @internal */
376
616
  redacted?: boolean;
377
617
  };
378
618
 
619
+ /** @internal */
379
620
  export type PiSessionToolCallContentBlock = {
621
+ /** @internal */
380
622
  type: "toolCall";
623
+ /** @internal */
381
624
  id: string;
625
+ /** @internal */
382
626
  name: string;
627
+ /** @internal */
383
628
  arguments: Record<string, unknown>;
384
629
  };
385
630
 
631
+ /** @internal */
386
632
  export type PiSessionImageContentBlock = {
633
+ /** @internal */
387
634
  type: "image";
635
+ /** @internal */
388
636
  data: string;
637
+ /** @internal */
389
638
  mimeType: string;
390
639
  };
391
640
 
641
+ /** @internal */
392
642
  export type PiSessionContentBlock =
393
643
  | PiSessionTextContentBlock
394
644
  | PiSessionThinkingContentBlock
395
645
  | PiSessionToolCallContentBlock
396
646
  | PiSessionImageContentBlock;
397
647
 
648
+ /** @internal */
398
649
  export interface PiSessionMessageRecord {
650
+ /** @internal */
399
651
  role?: string;
652
+ /** @internal */
400
653
  content?: string | PiSessionContentBlock[];
654
+ /** @internal */
401
655
  toolCallId?: string;
656
+ /** @internal */
402
657
  toolName?: string;
658
+ /** @internal */
403
659
  details?: unknown;
660
+ /** @internal */
404
661
  isError?: boolean;
662
+ /** @internal */
405
663
  usage?: PiSessionUsageSnapshot;
664
+ /** @internal */
406
665
  stopReason?: string;
666
+ /** @internal */
407
667
  errorMessage?: string;
668
+ /** @internal */
408
669
  provider?: string;
670
+ /** @internal */
409
671
  model?: string;
672
+ /** @internal */
410
673
  timestamp?: number;
411
674
  }
412
675
 
676
+ /** @internal */
413
677
  export interface PiSessionEntry {
678
+ /** @internal */
414
679
  type: string;
680
+ /** @internal */
415
681
  id: string;
682
+ /** @internal */
416
683
  parentId: string | null;
684
+ /** @internal */
417
685
  timestamp: string;
686
+ /** @internal */
418
687
  message?: PiSessionMessageRecord;
688
+ /** @internal */
419
689
  targetId?: string;
690
+ /** @internal */
420
691
  label?: string;
421
692
  }
422
693
 
694
+ /** @internal */
423
695
  export interface ProcessDiagnosticsData {
696
+ /** @internal */
424
697
  process: ProcessInstance;
698
+ /** @internal */
425
699
  projects: ProcessProject[];
700
+ /** @internal */
426
701
  inputs: ProcessInput[];
702
+ /** @internal */
427
703
  events: ProcessEvent[];
704
+ /** @internal */
428
705
  leafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
706
+ /** @internal */
429
707
  turnRecords: ProcessTurnRecord[];
708
+ /** @internal */
430
709
  turnAnnotations: ProcessTurnAnnotation[];
710
+ /** @internal */
431
711
  workerLease: WorkerLease | null;
712
+ /** @internal */
432
713
  processDisplayName: string | null;
714
+ /** @internal */
433
715
  processGraph: SerializedProcessGraph;
716
+ /** @internal */
434
717
  processFlow: ProcessFlowView;
718
+ /** @internal */
435
719
  piSessionEntries: PiSessionEntry[];
720
+ /** @internal */
436
721
  definesLeafOutcome: boolean;
722
+ /** @internal */
437
723
  selectedTurn?: ProcessSelectedTurnSummary | null;
724
+ /** @internal */
438
725
  scheduledAction?: ScheduledActionDetail | null;
726
+ /** @internal */
439
727
  modelConfiguration: ProcessModelConfigurationView;
728
+ /** @internal */
440
729
  runDetails: ProcessRunDetailsView;
730
+ /** @internal */
441
731
  launchConfiguration: ProcessLaunchConfigurationView;
732
+ /** @internal */
442
733
  actions: ProcessActionSummary[];
734
+ /** @internal */
443
735
  toolRenderers: ToolCallRendererDefinition[];
444
736
  }
445
737
 
738
+ /** @internal */
446
739
  export interface ProcessDetailData extends ProcessDiagnosticsData {
740
+ /** @internal */
447
741
  primaryPath: PrimaryPathSnapshot;
448
742
  }
449
743
 
744
+ /** @internal */
450
745
  export interface LauncherModelConfigSchema {
746
+ /** @internal */
451
747
  availableProfiles: readonly ModelProfileOptionSummary[];
748
+ /** @internal */
452
749
  llmTurns: ReadonlyArray<{
750
+ /** @internal */
453
751
  turnId: string;
752
+ /** @internal */
454
753
  description: string;
455
754
  }>;
456
755
  }
457
756
 
757
+ /** @internal */
458
758
  export type LauncherDefaultModelPreview = {
759
+ /** @internal */
459
760
  source: "instance_default" | "process_config_default" | "catalog_default" | "none";
761
+ /** @internal */
460
762
  profile: ModelProfileOptionSummary | null;
461
763
  };
462
764
 
765
+ /** @internal */
463
766
  export interface LauncherTurnModelConfigPreview {
767
+ /** @internal */
464
768
  turnId: string;
769
+ /** @internal */
465
770
  description: string;
771
+ /** @internal */
466
772
  effective: {
773
+ /** @internal */
467
774
  source: ProcessActionModelResolutionSource;
775
+ /** @internal */
468
776
  profile: ModelProfileOptionSummary | null;
469
777
  };
470
778
  }
471
779
 
780
+ /** @internal */
472
781
  export type LauncherModelConfigPreview = {
782
+ /** @internal */
473
783
  defaultModel: LauncherDefaultModelPreview;
784
+ /** @internal */
474
785
  turns: readonly LauncherTurnModelConfigPreview[];
475
786
  };
476
787
 
788
+ /** @internal */
477
789
  export type UiLauncherSummary = UiLauncherSummaryBase & {
790
+ /** @internal */
478
791
  modelConfigSchema?: LauncherModelConfigSchema;
792
+ /** @internal */
479
793
  processFlow?: ProcessFlowView;
480
794
  };
481
795
 
796
+ /** @internal */
482
797
  export type ProcessRetryConfig = {
798
+ /** @internal */
483
799
  launcherId: string;
800
+ /** @internal */
484
801
  title: string | null;
802
+ /** @internal */
485
803
  launcherInput: Record<string, unknown>;
804
+ /** @internal */
486
805
  skillIds: string[];
806
+ /** @internal */
487
807
  modelConfig: LauncherModelConfigDefaults;
488
808
  };
489
809
 
810
+ /** @internal */
490
811
  export type WatcherLaunchModelSummary = {
812
+ /** @internal */
491
813
  defaultModelProfileId: string | null;
492
- turnConfigs: Array<{ turnId: string; modelProfileId: string | null }>;
814
+ /** @internal */
815
+ turnConfigs: Array<{
816
+ /** @internal */
817
+ turnId: string;
818
+ /** @internal */
819
+ modelProfileId: string | null;
820
+ }>;
493
821
  };
494
822
 
823
+ /** @public */
495
824
  export interface WatcherPresentationField {
825
+ /** @public */
496
826
  label: string;
827
+ /** @public */
497
828
  value: string;
829
+ /** @internal */
498
830
  format?: "text" | "code";
499
831
  }
500
832
 
833
+ /** @internal */
501
834
  export interface WatcherSummary {
835
+ /** @internal */
502
836
  processId: string;
837
+ /** @internal */
503
838
  processDisplayName: string;
839
+ /** @internal */
504
840
  watcherId: string;
841
+ /** @internal */
505
842
  label: string;
843
+ /** @internal */
506
844
  description: string;
845
+ /** @internal */
507
846
  sourceId: string;
847
+ /** @internal */
508
848
  sourceLabel: string;
849
+ /** @internal */
509
850
  enabled: boolean;
851
+ /** @internal */
510
852
  configPath: string;
853
+ /** @internal */
511
854
  targetSummary: string;
855
+ /** @internal */
512
856
  details: WatcherPresentationField[];
857
+ /** @internal */
513
858
  launchModel: WatcherLaunchModelSummary;
514
859
  }
515
860
 
861
+ /** @internal */
516
862
  export interface SkillUsageSummary {
863
+ /** @internal */
517
864
  attachedAllTime: number;
865
+ /** @internal */
518
866
  attachedLast30Days: number;
867
+ /** @internal */
519
868
  invokedAllTime: number;
869
+ /** @internal */
520
870
  invokedLast30Days: number;
521
871
  }
522
872
 
873
+ /** @internal */
523
874
  export interface SkillRepositorySummary {
875
+ /** @internal */
524
876
  id: string;
877
+ /** @internal */
525
878
  label: string;
879
+ /** @internal */
526
880
  url: string;
881
+ /** @internal */
527
882
  ref: string;
883
+ /** @internal */
528
884
  path: string;
885
+ /** @internal */
529
886
  lastRefreshedAt: string | null;
887
+ /** @internal */
530
888
  error: string | null;
531
889
  }
532
890
 
533
- export interface SkillCatalogSummary {
891
+ /** @internal */
892
+ export interface SkillCatalogItem {
893
+ /** @internal */
894
+ repositoryId: string;
895
+ /** @internal */
534
896
  id: string;
897
+ /** @internal */
535
898
  label: string;
899
+ /** @internal */
536
900
  description: string | null;
537
- updateAvailable: boolean;
538
- modelInvocable: boolean;
539
- usage: SkillUsageSummary;
540
- }
541
-
542
- export interface SkillCatalogItem extends SkillCatalogSummary {
543
- repositoryId: string;
901
+ /** @internal */
544
902
  sourcePath: string;
903
+ /** @internal */
545
904
  sourceRevision: string;
905
+ /** @internal */
546
906
  registered: boolean;
907
+ /** @internal */
908
+ updateAvailable: boolean;
909
+ /** @internal */
910
+ conflict: boolean;
911
+ /** @internal */
547
912
  stale: boolean;
913
+ /** @internal */
914
+ modelInvocable: boolean;
915
+ /** @internal */
916
+ usage: SkillUsageSummary;
548
917
  }
549
918
 
550
- export interface InstalledSkillCatalogItem extends SkillCatalogSummary {
919
+ /** @internal */
920
+ export type SkillRegistrationKind = "configuration" | "catalog";
921
+
922
+ /** @internal */
923
+ export interface InstalledSkillCatalogItem {
924
+ /** @internal */
925
+ id: string;
926
+ /** @internal */
927
+ label: string;
928
+ /** @internal */
929
+ description: string | null;
930
+ /** @internal */
551
931
  activeRevisionId: string;
932
+ /** @internal */
552
933
  activeSourceRevision: string | null;
934
+ /** @internal */
935
+ registrationKind: SkillRegistrationKind;
936
+ /** @internal */
553
937
  sourceRepositoryId: string | null;
938
+ /** @internal */
939
+ updateAvailable: boolean;
940
+ /** @internal */
941
+ modelInvocable: boolean;
942
+ /** @internal */
943
+ usage: SkillUsageSummary;
554
944
  }
555
945
 
946
+ /** @internal */
556
947
  export interface SkillRevisionSummary {
948
+ /** @internal */
557
949
  id: string;
950
+ /** @internal */
558
951
  sourceRevision: string | null;
952
+ /** @internal */
559
953
  importedAt: string;
954
+ /** @internal */
560
955
  active: boolean;
561
956
  }
562
957
 
958
+ /** @internal */
563
959
  export interface SkillUsageProcessSummary {
960
+ /** @internal */
564
961
  instanceId: string;
962
+ /** @internal */
565
963
  title: string;
964
+ /** @internal */
566
965
  attachedAt: string;
966
+ /** @internal */
567
967
  invocationCount: number;
968
+ /** @internal */
568
969
  lastInvokedAt: string | null;
569
970
  }
570
971
 
972
+ /** @internal */
571
973
  export interface SkillCatalogDetail extends SkillCatalogItem {
974
+ /** @internal */
572
975
  skillMarkdown: string;
976
+ /** @internal */
573
977
  processes: SkillUsageProcessSummary[];
574
978
  }
575
979
 
980
+ /** @internal */
576
981
  export interface InstalledSkillCatalogDetail extends InstalledSkillCatalogItem {
982
+ /** @internal */
577
983
  skillMarkdown: string;
984
+ /** @internal */
578
985
  processes: SkillUsageProcessSummary[];
986
+ /** @internal */
579
987
  revisions: SkillRevisionSummary[];
580
988
  }
581
989
 
582
- export type ErrorResponseBody = { error?: string | null; code?: string | null };
990
+ /** @internal */
991
+ export type ErrorResponseBody = {
992
+ /** @internal */
993
+ error?: string | null;
994
+ /** @internal */
995
+ code?: string | null;
996
+ };
583
997
 
998
+ /** @internal */
584
999
  export type ProcessesListResponseBody = {
1000
+ /** @internal */
585
1001
  processes: ProcessListItem[];
1002
+ /** @internal */
586
1003
  futureExecutions: FutureExecutionSummary[];
587
1004
  };
588
1005
 
1006
+ /** @internal */
589
1007
  export interface ProcessOverviewItem extends ProcessRowSlot {
1008
+ /** @internal */
590
1009
  processDisplayName: string | null;
591
- /** Nullable durable title before external-id/instance-id display fallback. */
1010
+ /** Nullable durable title before external-id/instance-id display fallback. @internal */
592
1011
  processTitle: string | null;
1012
+ /** @internal */
593
1013
  initialPromptPreview: string | null;
1014
+ /** @internal */
594
1015
  createdAt: string;
1016
+ /** @internal */
595
1017
  updatedAt: string;
1018
+ /** @internal */
596
1019
  closedAt: string | null;
597
1020
  }
598
1021
 
599
- interface FutureExecutionOverviewItemBase {
600
- id: string;
601
- scheduleKind: "once" | "cron";
602
- processId: string;
603
- nextRunAt: string;
604
- cronExpression: string | null;
605
- title: string;
1022
+ /** @internal */
1023
+ interface FutureExecutionOverviewItemBase
1024
+ extends Omit<FutureExecutionBaseSummary, "kind" | "subtitle" | "modelSelection"> {
1025
+ /** @internal */
606
1026
  initialPromptPreview: string | null;
607
- status?: "scheduled" | "blocked";
608
- blockedReason?: FutureExecutionBlockReason | null;
609
1027
  }
610
1028
 
1029
+ /** @internal */
611
1030
  export interface FutureLaunchOverviewItem extends FutureExecutionOverviewItemBase {
1031
+ /** @internal */
612
1032
  kind: "launch";
1033
+ /** @internal */
613
1034
  instanceId: null;
1035
+ /** @internal */
614
1036
  launcherId: string;
1037
+ /** @internal */
615
1038
  launcherLabel: string;
616
1039
  }
617
1040
 
1041
+ /** @internal */
618
1042
  export interface FutureActionOverviewItem extends FutureExecutionOverviewItemBase {
1043
+ /** @internal */
619
1044
  kind: "action";
1045
+ /** @internal */
620
1046
  instanceId: string;
1047
+ /** @internal */
621
1048
  actionId: string;
1049
+ /** @internal */
622
1050
  actionLabel: string;
623
1051
  }
624
1052
 
1053
+ /** @internal */
625
1054
  export type FutureExecutionOverviewItem = FutureLaunchOverviewItem | FutureActionOverviewItem;
626
1055
 
1056
+ /** @internal */
627
1057
  export interface ProcessesOverviewResponseBody {
1058
+ /** @internal */
628
1059
  processes: ProcessOverviewItem[];
1060
+ /** @internal */
629
1061
  futureExecutions: FutureExecutionOverviewItem[];
630
- /** True when the bounded sidebar response omitted less-recent rows. */
1062
+ /** True when the bounded sidebar response omitted less-recent rows. @internal */
631
1063
  truncated: boolean;
632
1064
  }
633
1065
 
1066
+ /** @internal */
634
1067
  export interface ProcessBrowsePagination {
1068
+ /** @internal */
635
1069
  limit: number;
1070
+ /** @internal */
636
1071
  offset: number;
1072
+ /** @internal */
637
1073
  total: number;
1074
+ /** @internal */
638
1075
  processTotal: number;
1076
+ /** @internal */
639
1077
  futureExecutionTotal: number;
1078
+ /** @internal */
640
1079
  hasMore: boolean;
641
1080
  }
642
1081
 
1082
+ /** @internal */
643
1083
  export interface ProcessBrowseFacets {
1084
+ /** @internal */
644
1085
  statusCounts: Record<
645
1086
  "all" | "running" | "scheduled" | "needs_attention" | "completed" | "aborted",
646
1087
  number
647
1088
  >;
648
- processTypes: Array<{ value: string; label: string; count: number }>;
1089
+ /** @internal */
1090
+ processTypes: Array<{
1091
+ /** @internal */
1092
+ value: string;
1093
+ /** @internal */
1094
+ label: string;
1095
+ /** @internal */
1096
+ count: number;
1097
+ }>;
649
1098
  }
650
1099
 
1100
+ /** @internal */
651
1101
  export type ProcessBrowseItem =
652
- | { kind: "process"; item: ProcessOverviewItem }
653
- | { kind: "future"; item: FutureExecutionOverviewItem };
654
-
1102
+ | {
1103
+ /** @internal */
1104
+ kind: "process";
1105
+ /** @internal */
1106
+ item: ProcessOverviewItem;
1107
+ }
1108
+ | {
1109
+ /** @internal */
1110
+ kind: "future";
1111
+ /** @internal */
1112
+ item: FutureExecutionOverviewItem;
1113
+ };
1114
+
1115
+ /** @internal */
655
1116
  export interface ProcessBrowseResponseBody {
656
- /** Globally sorted page. The browser must preserve this server-owned order. */
1117
+ /** Globally sorted page. The browser must preserve this server-owned order. @internal */
657
1118
  items: ProcessBrowseItem[];
1119
+ /** @internal */
658
1120
  pagination: ProcessBrowsePagination;
1121
+ /** @internal */
659
1122
  facets: ProcessBrowseFacets;
660
1123
  }
661
1124
 
1125
+ /** @internal */
662
1126
  export type TurnTraceToolCallSnapshot = Omit<PrimaryPathToolCallSnapshot, "result"> & {
1127
+ /** @internal */
663
1128
  resultText: string | null;
1129
+ /** @internal */
664
1130
  truncated: boolean;
665
1131
  };
666
1132
 
1133
+ /** @internal */
667
1134
  export type TurnPiInputPartRole = "user" | "system" | "unknown";
668
1135
 
1136
+ /** @internal */
669
1137
  export interface TurnPiInputPart {
1138
+ /** @internal */
670
1139
  role: TurnPiInputPartRole;
1140
+ /** @internal */
671
1141
  text: string;
1142
+ /** @internal */
672
1143
  createdAt: string;
673
1144
  }
674
1145
 
1146
+ /** @internal */
675
1147
  export interface TurnPiInputSnapshot {
1148
+ /** @internal */
676
1149
  parts: TurnPiInputPart[];
1150
+ /** @internal */
677
1151
  fullPrompt: string;
1152
+ /** @internal */
678
1153
  createdAt: string;
1154
+ /** @internal */
679
1155
  userInput?: string | null;
680
1156
  }
681
1157
 
1158
+ /** @internal */
682
1159
  export interface TurnTraceSnapshot {
1160
+ /** @internal */
683
1161
  assistant: PrimaryPathStreamingAssistantSnapshot;
1162
+ /** @internal */
684
1163
  toolCalls: TurnTraceToolCallSnapshot[];
1164
+ /** @internal */
685
1165
  traceItems: PrimaryPathTraceItemSnapshot[];
1166
+ /** @internal */
686
1167
  usage: TurnUsageSnapshot | null;
1168
+ /** @internal */
687
1169
  piInput: TurnPiInputSnapshot | null;
688
1170
  }
689
1171
 
1172
+ /** @internal */
690
1173
  export interface TurnTracePreview {
1174
+ /** @internal */
691
1175
  turnRecordId: string;
1176
+ /** @internal */
692
1177
  assistantTextPreview: string;
1178
+ /** @internal */
693
1179
  assistantTextTruncated: boolean;
1180
+ /** @internal */
694
1181
  thinkingPreview: string;
1182
+ /** @internal */
695
1183
  thinkingPreviewTruncated: boolean;
1184
+ /** @internal */
696
1185
  toolCallCount: number;
1186
+ /** @internal */
697
1187
  traceItemCount: number;
1188
+ /** @internal */
698
1189
  hasReasoningDetails: boolean;
1190
+ /** @internal */
699
1191
  usage: TurnUsageSnapshot | null;
700
- piInput: { createdAt: string | null; partCount: number; userInputPreview: string | null } | null;
1192
+ /** @internal */
1193
+ piInput: {
1194
+ /** @internal */
1195
+ createdAt: string | null;
1196
+ /** @internal */
1197
+ partCount: number;
1198
+ /** @internal */
1199
+ userInputPreview: string | null;
1200
+ } | null;
701
1201
  }
702
1202
 
1203
+ /** @internal */
703
1204
  export type ProcessTimelineTurnPresentation =
704
1205
  | "llm_turn"
705
1206
  | "automatic_turn"
706
1207
  | "operator_decision"
707
1208
  | "external_trigger";
708
1209
 
1210
+ /** @internal */
709
1211
  export interface ProcessTimelineTurnSummary {
1212
+ /** @internal */
710
1213
  id: string;
1214
+ /** @internal */
711
1215
  turnId: string;
1216
+ /** @internal */
712
1217
  turnType: ProcessTurnType;
1218
+ /** @internal */
713
1219
  displayTurn: string;
1220
+ /** @internal */
714
1221
  outcome: string;
1222
+ /** @internal */
715
1223
  summary: string;
1224
+ /** @internal */
716
1225
  output: string;
1226
+ /** @internal */
717
1227
  turnResultMarkdown: string;
1228
+ /** @internal */
1229
+ resultSummary?: string;
1230
+ /** @internal */
1231
+ reviewedTurnRecordId?: string;
1232
+ /** @internal */
1233
+ resources?: import("@leitwerk-dev/domain").TurnProgressLink[];
1234
+ /** @internal */
1235
+ transition?: {
1236
+ /** @internal */
1237
+ selectedTurnId: string;
1238
+ /** @internal */
1239
+ targetTurnRecordId?: string;
1240
+ /** @internal */
1241
+ accepted: boolean;
1242
+ };
1243
+ /** @internal */
718
1244
  pathType: ProcessTurnRecord["pathType"];
1245
+ /** @internal */
719
1246
  createdAt: string;
1247
+ /** @internal */
720
1248
  presentation: ProcessTimelineTurnPresentation;
1249
+ /** @internal */
721
1250
  status: "completed" | "in_progress";
1251
+ /** @internal */
722
1252
  modelProfileId: string | null;
723
- /** Durable lineage needed by the chronicle rail and input correlation. */
1253
+ /** Durable lineage needed by the chronicle rail and input correlation. @internal */
724
1254
  attemptNumber: number;
1255
+ /** @internal */
725
1256
  parentTurnRecordId: string | null;
1257
+ /** @internal */
726
1258
  startedAt: string;
1259
+ /** @internal */
727
1260
  endedAt: string | null;
1261
+ /** @internal */
728
1262
  actionSource: "ui" | "external" | "scheduled" | null;
1263
+ /** @internal */
729
1264
  progress?: TurnProgressReport | null;
1265
+ /** @internal */
1266
+ progressRecordedAt?: string;
730
1267
  }
731
1268
 
1269
+ /** @internal */
732
1270
  export type ProcessTimelineInputSummary = Pick<
733
1271
  ProcessInput,
734
1272
  "id" | "sequence" | "source" | "kind" | "bodyMarkdown" | "receivedAt" | "consumedAt"
735
1273
  >;
736
1274
 
1275
+ /** @internal */
1276
+ export interface ProcessExternalObservation {
1277
+ /** @internal */
1278
+ summary: string;
1279
+ /** @internal */
1280
+ links?: import("@leitwerk-dev/domain").TurnProgressLink[];
1281
+ /** @internal */
1282
+ observedAt: string;
1283
+ /** @internal */
1284
+ subject: string;
1285
+ /** @internal */
1286
+ revision: string;
1287
+ }
1288
+
1289
+ /** @internal */
737
1290
  export interface ProcessExternalTriggerSignal {
1291
+ /** @internal */
1292
+ observation?: ProcessExternalObservation;
1293
+ /** @internal */
1294
+ refreshError?: string | null;
1295
+ /** @internal */
1296
+ refreshedAt?: string;
1297
+ /** @internal */
738
1298
  triggerId: string;
1299
+ /** @internal */
739
1300
  state: "error" | "armed" | "triggered" | "waiting";
1301
+ /** @internal */
740
1302
  occurredAt: string | null;
1303
+ /** @internal */
741
1304
  secondaryDetail: string | null;
742
1305
  }
743
1306
 
1307
+ /** @internal */
744
1308
  export interface ProcessTimelineSnapshot {
745
- prompt: { text: string | null; createdAt: string | null };
1309
+ /** @internal */
1310
+ prompt: {
1311
+ /** @internal */
1312
+ text: string | null;
1313
+ /** @internal */
1314
+ createdAt: string | null;
1315
+ };
1316
+ /** @internal */
746
1317
  turns: ProcessTimelineTurnSummary[];
1318
+ /** @internal */
747
1319
  tracePreviewsByTurnRecordId: Record<string, TurnTracePreview>;
1320
+ /** @internal */
748
1321
  inputs: ProcessTimelineInputSummary[];
1322
+ /** @internal */
749
1323
  externalTriggerSignals: ProcessExternalTriggerSignal[];
750
1324
  }
751
1325
 
1326
+ /** @internal */
752
1327
  export interface CurrentErrorSummary {
1328
+ /** @internal */
753
1329
  title: string;
1330
+ /** @internal */
754
1331
  summary: string;
1332
+ /** @internal */
755
1333
  guidance?: string;
1334
+ /** @internal */
756
1335
  technicalDetail?: string | null;
757
1336
  }
758
1337
 
1338
+ /** @internal */
759
1339
  export interface CurrentTurnRecoverySummary extends CurrentErrorSummary {
1340
+ /** @internal */
760
1341
  turnRecordId: string;
1342
+ /** @internal */
761
1343
  defaultContinuePrompt: string;
1344
+ /** @internal */
762
1345
  canContinue: boolean;
1346
+ /** @internal */
763
1347
  supportsModelOverride: boolean;
1348
+ /** @internal */
764
1349
  defaultModelProfileId: string | null;
1350
+ /** @internal */
765
1351
  providerOptions: Record<string, string>;
766
1352
  }
767
1353
 
1354
+ /** @internal */
768
1355
  export interface StartupRecoverySummary extends CurrentErrorSummary {
1356
+ /** @internal */
769
1357
  startRecordId: string;
1358
+ /** @internal */
770
1359
  kind: "preparation_failed" | "bootstrap_failed";
1360
+ /** @internal */
771
1361
  action: "choose_model" | "retry_startup";
1362
+ /** @internal */
772
1363
  defaultModelProfileId: string | null;
1364
+ /** @internal */
773
1365
  providerOptions: Record<string, string>;
774
1366
  }
775
1367
 
1368
+ /** @internal */
1369
+ export type StartupAttemptStatus = "starting" | "failed" | "succeeded" | "recovered" | "superseded";
1370
+
1371
+ /** @internal */
1372
+ export interface StartupAttemptStepSummary {
1373
+ /** Observed phase interval; absent for older servers or unavailable evidence. @internal */
1374
+ startedAt?: string | null;
1375
+ /** @internal */
1376
+ endedAt?: string | null;
1377
+ /** @internal */
1378
+ detail?: string;
1379
+ /** @internal */
1380
+ id: "start_worker" | "connect_worker" | "prepare_workspace" | "start_first_turn";
1381
+ /** @internal */
1382
+ label: string;
1383
+ /** @internal */
1384
+ status: "pending" | "in_progress" | "completed" | "failed" | "superseded";
1385
+ /** @internal */
1386
+ occurredAt: string | null;
1387
+ }
1388
+
1389
+ /** Worker-start history derived from correlated start, lease, readiness, and turn records. @internal */
1390
+ export interface StartupAttemptSummary {
1391
+ /** @internal */
1392
+ startRecordId: string;
1393
+ /** @internal */
1394
+ workerLeaseId: string | null;
1395
+ /** @internal */
1396
+ status: StartupAttemptStatus;
1397
+ /** @internal */
1398
+ startedAt: string;
1399
+ /** @internal */
1400
+ readyAt: string | null;
1401
+ /** @internal */
1402
+ durationMs: number | null;
1403
+ /** @internal */
1404
+ summary: string | null;
1405
+ /** @internal */
1406
+ recoveredByStartRecordId: string | null;
1407
+ /** @internal */
1408
+ steps: StartupAttemptStepSummary[];
1409
+ }
1410
+
1411
+ /** @internal */
1412
+ export interface ProcessStartupSummary {
1413
+ /** @internal */
1414
+ workerStarts?: import("@leitwerk-dev/domain").PhysicalWorkerStart[];
1415
+ /** @internal */
1416
+ authoritativeAttemptId: string | null;
1417
+ /** @internal */
1418
+ attempts: StartupAttemptSummary[];
1419
+ /** @internal */
1420
+ recovery: StartupRecoverySummary | null;
1421
+ }
1422
+
1423
+ /** @internal */
776
1424
  export type CurrentProcessErrorSummary = CurrentErrorSummary;
777
1425
 
1426
+ /** @internal */
778
1427
  export interface ProcessUsageEstimateSnapshot {
1428
+ /** @internal */
779
1429
  usage: TurnUsageSnapshot;
1430
+ /** @internal */
780
1431
  includesLiveTurn: boolean;
1432
+ /** @internal */
781
1433
  totalLlmTurnCount: number;
1434
+ /** @internal */
782
1435
  coveredTurnCount: number;
1436
+ /** @internal */
783
1437
  missingUsageTurnCount: number;
1438
+ /** @internal */
784
1439
  missingCostTurnCount: number;
1440
+ /** @internal */
785
1441
  isPartial: boolean;
786
1442
  }
787
1443
 
788
- export interface PrimaryPathUiSnapshot extends PrimaryPathSnapshot {
1444
+ /** @internal */
1445
+ export interface PrimaryPathUiSnapshot extends Omit<PrimaryPathSnapshot, "turnState"> {
1446
+ /** @internal */
1447
+ throughEventSequence: number;
1448
+ /** @internal */
1449
+ turnState: Omit<PrimaryPathSnapshot["turnState"], "activeTurn"> & {
1450
+ /** @internal */
1451
+ activeTurn: CompactActiveTurnSnapshot | null;
1452
+ };
1453
+ /** @internal */
789
1454
  entryCount: number;
1455
+ /** @internal */
790
1456
  entriesOmitted: true;
791
1457
  }
792
1458
 
1459
+ /** @internal */
793
1460
  export type ProcessUiSnapshotProcess = Pick<
794
1461
  ProcessInstance,
795
1462
  | "id"
@@ -812,148 +1479,296 @@ export type ProcessUiSnapshotProcess = Pick<
812
1479
  * session entries, projects, and full durable records belong to diagnostics;
813
1480
  * this DTO carries only browser-facing projections.
814
1481
  */
1482
+ /** @internal */
815
1483
  export interface ProcessDetailUiSnapshotResponseBody {
1484
+ /** @internal */
816
1485
  process: ProcessUiSnapshotProcess;
817
- /** Durable requests in Chronicle order; at most one is open for the current turn. */
1486
+ /** Next turn on the declared happy path, including human decisions. @internal */
1487
+ plannedNextTurn?: Pick<ProcessSelectedTurnSummary, "turnId" | "description"> | null;
1488
+ /** Durable requests in Chronicle order; at most one is open for the current turn. @internal */
818
1489
  questionRequests: ProcessQuestionRequest[];
1490
+ /** @internal */
1491
+ toolApprovalRequests: ProcessToolApprovalRequest[];
1492
+ /** @internal */
819
1493
  leafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
1494
+ /** @internal */
820
1495
  processDisplayName: string | null;
1496
+ /** @internal */
821
1497
  processFlow: ProcessFlowView;
1498
+ /** @internal */
822
1499
  definesLeafOutcome: boolean;
1500
+ /** @internal */
823
1501
  selectedTurn: ProcessSelectedTurnSummary | null;
1502
+ /** @internal */
824
1503
  scheduledAction: ScheduledActionDetail | null;
1504
+ /** @internal */
825
1505
  modelConfiguration: ProcessModelConfigurationView;
1506
+ /** @internal */
826
1507
  runDetails: ProcessRunDetailsView;
1508
+ /** @internal */
827
1509
  launchConfiguration: ProcessLaunchConfigurationView;
1510
+ /** @internal */
828
1511
  actions: ProcessActionSummary[];
1512
+ /** @internal */
829
1513
  toolRenderers: ToolCallRendererDefinition[];
1514
+ /** @internal */
830
1515
  primaryPath: PrimaryPathUiSnapshot;
1516
+ /** @internal */
831
1517
  timeline: ProcessTimelineSnapshot;
1518
+ /** @internal */
832
1519
  instanceTree: ProcessInstanceTreeResponseBody;
1520
+ /** @internal */
833
1521
  recovery: CurrentTurnRecoverySummary | null;
1522
+ /** Authoritative startup history and current remediation. @internal */
1523
+ startup: ProcessStartupSummary;
1524
+ /** Compatibility alias for startup.recovery. @internal */
834
1525
  startupRecovery: StartupRecoverySummary | null;
1526
+ /** @internal */
835
1527
  processError: CurrentProcessErrorSummary | null;
1528
+ /** @internal */
836
1529
  usageEstimate: ProcessUsageEstimateSnapshot | null;
1530
+ /** @internal */
837
1531
  persistedModelSelectionWarning: string | null;
838
- session: { signature: string | null };
1532
+ /** @internal */
1533
+ session: {
1534
+ /** @internal */
1535
+ signature: string | null;
1536
+ };
1537
+ /** @internal */
1538
+ sessionTransfer: SessionTransferOperationView | null;
839
1539
  }
840
1540
 
1541
+ /** @internal */
841
1542
  export type InstanceTreeTurnResultState = "succeeded" | "failed" | "aborted" | "pending";
842
1543
 
843
- /** Redacted, semantic process history. Pi message/activity categories are never exposed. */
1544
+ /** Redacted, semantic process history. Pi message/activity categories are never exposed. @internal */
844
1545
  export interface InstanceTreeNodeSummary {
1546
+ /** @internal */
845
1547
  id: string;
1548
+ /** @internal */
846
1549
  parentId: string | null;
1550
+ /** @internal */
847
1551
  label: string;
1552
+ /** @internal */
848
1553
  pathType: "primary" | "root_branch" | "leaf_branch";
1554
+ /** @internal */
849
1555
  resultState: InstanceTreeTurnResultState;
1556
+ /** @internal */
850
1557
  timestamp: string;
851
1558
  }
852
1559
 
1560
+ /** @internal */
853
1561
  export interface InstanceTreeEdgeSummary {
1562
+ /** @internal */
854
1563
  id: string;
1564
+ /** @internal */
855
1565
  sourceNodeId: string;
1566
+ /** @internal */
856
1567
  targetNodeId: string | null;
1568
+ /** @internal */
857
1569
  hasContext: boolean;
1570
+ /** @internal */
858
1571
  productLabels: readonly string[];
1572
+ /** @internal */
859
1573
  actionLabel: string | null;
1574
+ /** @internal */
860
1575
  endState: "not_applied" | "completed" | null;
861
1576
  }
862
1577
 
1578
+ /** @internal */
863
1579
  export interface ProcessInstanceTreeResponseBody {
1580
+ /** @internal */
864
1581
  currentLeafId: string | null;
1582
+ /** @internal */
865
1583
  nodes: InstanceTreeNodeSummary[];
1584
+ /** @internal */
866
1585
  edges: InstanceTreeEdgeSummary[];
867
1586
  }
868
1587
 
1588
+ /** @internal */
869
1589
  export interface TurnReasoningDetailResponseBody {
1590
+ /** @internal */
1591
+ state: "live" | "committed";
1592
+ /** @internal */
1593
+ throughEventSequence: number;
1594
+ /** @internal */
870
1595
  instanceId: string;
1596
+ /** @internal */
871
1597
  turnRecordId: string;
1598
+ /** @internal */
872
1599
  sessionSignature: string | null;
1600
+ /** @internal */
873
1601
  reasoning: TurnTraceSnapshot;
874
1602
  }
875
1603
 
1604
+ /** @internal */
876
1605
  export interface SubmitQuestionAnswersRequestBody {
1606
+ /** @internal */
877
1607
  draft: QuestionAnswerDraft[];
878
1608
  }
879
1609
 
1610
+ /** @internal */
880
1611
  export type QuestionRequestMutationResponseBody = {
1612
+ /** @internal */
881
1613
  request: ProcessQuestionRequest;
882
1614
  };
883
1615
 
1616
+ /** @internal */
884
1617
  export type FutureExecutionDetailResponseBody = FutureExecutionSummary;
885
1618
 
886
- export type LaunchersResponseBody = { launchers: UiLauncherSummary[] };
1619
+ /** @internal */
1620
+ export type LaunchersResponseBody = {
1621
+ /** @internal */
1622
+ launchers: UiLauncherSummary[];
1623
+ };
887
1624
 
888
- export type WatchersResponseBody = { watchers: WatcherSummary[] };
889
- export type SkillCatalogDetailResponseBody = { skill: SkillCatalogDetail };
890
- export type InstalledSkillCatalogDetailResponseBody = { skill: InstalledSkillCatalogDetail };
1625
+ /** @internal */
1626
+ export type WatchersResponseBody = {
1627
+ /** @internal */
1628
+ watchers: WatcherSummary[];
1629
+ };
1630
+ /** @internal */
1631
+ export type SkillCatalogDetailResponseBody = {
1632
+ /** @internal */
1633
+ skill: SkillCatalogDetail;
1634
+ };
1635
+ /** @internal */
1636
+ export type InstalledSkillCatalogDetailResponseBody = {
1637
+ /** @internal */
1638
+ skill: InstalledSkillCatalogDetail;
1639
+ };
1640
+ /** @internal */
891
1641
  export type SkillsCatalogResponseBody = {
1642
+ /** @internal */
892
1643
  repositories: SkillRepositorySummary[];
1644
+ /** @internal */
893
1645
  availableSkills: SkillCatalogItem[];
1646
+ /** @internal */
894
1647
  installedSkills: InstalledSkillCatalogItem[];
895
1648
  };
896
1649
 
1650
+ /** @internal */
897
1651
  export interface LauncherDefaultsResponseBody {
1652
+ /** @internal */
898
1653
  defaults: Record<string, unknown>;
1654
+ /** @internal */
899
1655
  title: string | null;
1656
+ /** @internal */
900
1657
  modelConfig: LauncherModelConfigDefaults;
1658
+ /** @internal */
901
1659
  warnings?: LauncherValidationError[];
902
1660
  }
903
1661
 
1662
+ /** @internal */
904
1663
  export type LauncherOptionsResponseBody = {
1664
+ /** @internal */
905
1665
  options: Record<string, readonly FormFieldOptionDefinition[]>;
906
1666
  };
907
1667
 
1668
+ /** @internal */
908
1669
  export type LauncherRecentValuesResponseBody = {
1670
+ /** @internal */
909
1671
  values: Record<string, readonly string[]>;
910
1672
  };
911
1673
 
912
- export type LauncherModelConfigPreviewResponseBody = { preview: LauncherModelConfigPreview };
1674
+ /** @internal */
1675
+ export type LauncherModelConfigPreviewResponseBody = {
1676
+ /** @internal */
1677
+ preview: LauncherModelConfigPreview;
1678
+ };
913
1679
 
1680
+ /** @internal */
914
1681
  export interface LauncherMutationResponseBody {
1682
+ /** @internal */
915
1683
  kind?: "scheduled";
1684
+ /** @internal */
916
1685
  process?: ProcessInstance | null;
1686
+ /** @internal */
917
1687
  futureExecution?: FutureLaunchSummary | null;
1688
+ /** @internal */
918
1689
  projects?: ProcessProject[];
1690
+ /** @internal */
919
1691
  errors?: LauncherValidationError[];
1692
+ /** @internal */
920
1693
  error?: string | null;
921
1694
  }
922
1695
 
1696
+ /** @internal */
1697
+ export interface FutureLaunchMutationResponseBody {
1698
+ /** @internal */
1699
+ kind: "scheduled";
1700
+ /** @internal */
1701
+ futureExecution: FutureLaunchSummary | null;
1702
+ /** @internal */
1703
+ error?: string | null;
1704
+ }
1705
+
1706
+ /** @internal */
923
1707
  export type ScheduledActionMutationResponseBody = {
1708
+ /** @internal */
924
1709
  kind?: "scheduled";
1710
+ /** @internal */
925
1711
  scheduledAction?: ScheduledActionDetail | null;
1712
+ /** @internal */
926
1713
  error?: string | null;
927
1714
  };
928
1715
 
1716
+ /** @internal */
929
1717
  export type ProcessRetryConfigResponseBody = ProcessRetryConfig;
930
1718
 
931
- export type ProcessActionModelPreviewResponseBody = { preview: ProcessActionModelPreview };
1719
+ /** @internal */
1720
+ export type ProcessActionModelPreviewResponseBody = {
1721
+ /** @internal */
1722
+ preview: ProcessActionModelPreview;
1723
+ };
932
1724
 
1725
+ /** @internal */
933
1726
  export type ProcessDiagnosticsResponseBody = ProcessDiagnosticsData;
934
1727
 
1728
+ /** @internal */
935
1729
  export type PrimaryPathSnapshotResponseBody = PrimaryPathSnapshot;
936
1730
 
937
- export type CronPreviewResponseBody = { nextRunAt: string };
1731
+ /** @internal */
1732
+ export type CronPreviewResponseBody = {
1733
+ /** @internal */
1734
+ nextRunAt: string;
1735
+ };
938
1736
 
939
- type ParsedLauncherRequestBody = {
1737
+ /** @internal */
1738
+ export type ParsedLauncherRequestBody = {
1739
+ /** @internal */
940
1740
  title: string | null;
1741
+ /** @internal */
941
1742
  titleProvided: boolean;
1743
+ /** @internal */
942
1744
  launcherInput: Record<string, unknown>;
1745
+ /** @internal */
943
1746
  launcherInputProvided: boolean;
1747
+ /** @internal */
944
1748
  skillIds?: string[];
1749
+ /** @internal */
945
1750
  modelConfig: LauncherModelConfigDefaults;
1751
+ /** @internal */
946
1752
  modelConfigProvided: boolean;
1753
+ /** @internal */
947
1754
  schedule: ParsedScheduleRequest;
1755
+ /** @internal */
948
1756
  scheduleProvided: boolean;
949
1757
  };
950
1758
 
951
- type ParsedActionRequestBody = {
1759
+ /** @internal */
1760
+ export type ParsedActionRequestBody = {
1761
+ /** @internal */
952
1762
  input: Record<string, unknown>;
1763
+ /** @internal */
953
1764
  inputProvided: boolean;
1765
+ /** @internal */
954
1766
  nextTurnModelProfileId?: string | null;
1767
+ /** @internal */
955
1768
  nextTurnModelProfileIdProvided: boolean;
1769
+ /** @internal */
956
1770
  schedule: ParsedScheduleRequest;
1771
+ /** @internal */
957
1772
  scheduleProvided: boolean;
958
1773
  };
959
1774
 
@@ -979,25 +1794,45 @@ const actionStructuredBodySchema = v.strictObject({
979
1794
  schedule: v.optional(v.unknown()),
980
1795
  });
981
1796
  const futureLaunchPayloadInputSchema = v.object({
1797
+ /** @internal */
982
1798
  launcherInput: v.optional(v.nullable(unknownRecordSchema)),
1799
+ /** @internal */
983
1800
  modelConfig: v.optional(v.unknown()),
1801
+ /** @internal */
984
1802
  actor: v.optional(v.nullable(unknownRecordSchema)),
1803
+ /** @internal */
985
1804
  launchPlan: v.object({
1805
+ /** @internal */
986
1806
  launcherId: v.string(),
1807
+ /** @internal */
987
1808
  processId: v.string(),
1809
+ /** @internal */
988
1810
  handoffDedupKey: optionalNullableStringSchema,
1811
+ /** @internal */
989
1812
  processInput: v.object({
1813
+ /** @internal */
990
1814
  processId: v.string(),
1815
+ /** @internal */
991
1816
  selectedTurnId: optionalNullableStringSchema,
1817
+ /** @internal */
992
1818
  lifecycleStatus: v.picklist(PROCESS_LIFECYCLE_STATUSES),
1819
+ /** @internal */
993
1820
  title: optionalNullableStringSchema,
1821
+ /** @internal */
994
1822
  externalId: optionalNullableStringSchema,
1823
+ /** @internal */
995
1824
  externalUrl: optionalNullableStringSchema,
1825
+ /** @internal */
996
1826
  metadata: v.optional(v.nullable(unknownRecordSchema)),
1827
+ /** @internal */
997
1828
  defaultModelProfileId: optionalNullableStringSchema,
1829
+ /** @internal */
998
1830
  turnConfigsJson: optionalNullableStringSchema,
1831
+ /** @internal */
999
1832
  selectedTurnModelProfileId: optionalNullableStringSchema,
1833
+ /** @internal */
1000
1834
  selectedTurnModelKind: v.optional(v.nullable(v.picklist(["explicit", "inherited"]))),
1835
+ /** @internal */
1001
1836
  selectedTurnModelSource: v.optional(
1002
1837
  v.nullable(
1003
1838
  v.picklist([
@@ -1012,128 +1847,232 @@ const futureLaunchPayloadInputSchema = v.object({
1012
1847
  ]),
1013
1848
  ),
1014
1849
  ),
1850
+ /** @internal */
1015
1851
  paramsJson: optionalNullableStringSchema,
1852
+ /** @internal */
1016
1853
  stateJson: optionalNullableStringSchema,
1017
1854
  }),
1855
+ /** @internal */
1018
1856
  titleSourceFields: v.optional(
1019
- v.nullable(v.array(v.object({ label: v.string(), value: v.string() }))),
1857
+ v.nullable(
1858
+ v.array(
1859
+ v.object({
1860
+ /** @internal */
1861
+ label: v.string(),
1862
+ /** @internal */
1863
+ value: v.string(),
1864
+ }),
1865
+ ),
1866
+ ),
1020
1867
  ),
1868
+ /** @internal */
1021
1869
  projectInputs: v.optional(
1022
1870
  v.nullable(
1023
1871
  v.array(
1024
1872
  v.object({
1873
+ /** @internal */
1025
1874
  key: v.string(),
1875
+ /** @internal */
1026
1876
  repoLocator: v.string(),
1877
+ /** @internal */
1027
1878
  baseBranch: v.string(),
1879
+ /** @internal */
1028
1880
  workBranch: optionalNullableStringSchema,
1881
+ /** @internal */
1029
1882
  externalId: optionalNullableStringSchema,
1883
+ /** @internal */
1030
1884
  externalUrl: optionalNullableStringSchema,
1885
+ /** @internal */
1031
1886
  metadata: v.optional(v.nullable(unknownRecordSchema)),
1032
1887
  }),
1033
1888
  ),
1034
1889
  ),
1035
1890
  ),
1891
+ /** @internal */
1036
1892
  startTurnId: optionalNullableStringSchema,
1037
1893
  }),
1894
+ /** @internal */
1038
1895
  selectedSkillIds: v.optional(v.array(v.string())),
1896
+ /** @internal */
1039
1897
  resourceSelections: v.optional(
1040
- v.array(v.object({ skillId: v.string(), revisionId: v.string() })),
1898
+ v.array(
1899
+ v.object({
1900
+ /** @internal */
1901
+ skillId: v.string(),
1902
+ /** @internal */
1903
+ revisionId: v.string(),
1904
+ }),
1905
+ ),
1041
1906
  ),
1042
1907
  });
1043
1908
  const futureActionPayloadInputSchema = v.object({
1909
+ /** @internal */
1044
1910
  input: v.optional(v.nullable(unknownRecordSchema)),
1911
+ /** @internal */
1045
1912
  nextTurnModelProfileId: optionalNullableStringSchema,
1913
+ /** @internal */
1046
1914
  actionLabel: optionalNullableStringSchema,
1915
+ /** @internal */
1047
1916
  actor: v.optional(v.nullable(unknownRecordSchema)),
1048
1917
  });
1049
1918
 
1919
+ /** @internal */
1050
1920
  export type ParsedScheduleRequest =
1051
- | { mode: "now" }
1052
- | { mode: "once"; runAt: string }
1053
- | { mode: "cron"; cronExpression: string };
1921
+ | {
1922
+ /** @internal */
1923
+ mode: "now";
1924
+ }
1925
+ | {
1926
+ /** @internal */
1927
+ mode: "once";
1928
+ /** @internal */
1929
+ runAt: string;
1930
+ }
1931
+ | {
1932
+ /** @internal */
1933
+ mode: "cron";
1934
+ /** @internal */
1935
+ cronExpression: string;
1936
+ };
1937
+ /** @internal */
1054
1938
  type ValidatedScheduleRequest =
1055
- | { mode: "now"; nextRunAt: null; cronExpression: null }
1056
- | { mode: "once"; nextRunAt: string; cronExpression: null }
1057
- | { mode: "cron"; nextRunAt: string; cronExpression: string };
1939
+ | {
1940
+ /** @internal */
1941
+ mode: "now";
1942
+ /** @internal */
1943
+ nextRunAt: null;
1944
+ /** @internal */
1945
+ cronExpression: null;
1946
+ }
1947
+ | {
1948
+ /** @internal */
1949
+ mode: "once";
1950
+ /** @internal */
1951
+ nextRunAt: string;
1952
+ /** @internal */
1953
+ cronExpression: null;
1954
+ }
1955
+ | {
1956
+ /** @internal */
1957
+ mode: "cron";
1958
+ /** @internal */
1959
+ nextRunAt: string;
1960
+ /** @internal */
1961
+ cronExpression: string;
1962
+ };
1058
1963
 
1059
1964
  type FutureLaunchPayloadBase = v.InferOutput<typeof futureLaunchPayloadInputSchema>;
1060
1965
  type FutureActionPayloadBase = v.InferOutput<typeof futureActionPayloadInputSchema>;
1061
1966
  const cloneUnknownRecord = (value?: Record<string, unknown> | null) =>
1062
1967
  value ? { ...value } : null;
1063
- const cloneTurnConfigMap = (turnConfigs: InstanceTurnConfigMap = {}) =>
1064
- Object.fromEntries(
1065
- Object.entries(turnConfigs as Record<string, InstanceTurnConfigMap[string]>).map(
1066
- ([turnId, turnConfig]) => [turnId, { ...turnConfig }],
1067
- ),
1068
- ) as InstanceTurnConfigMap;
1968
+ /** @internal */
1069
1969
  const normalizeFutureLaunchPayload = (payload: FutureLaunchPayloadBase) => {
1070
1970
  const modelConfig = normalizeLaunchModelConfigInput(
1071
1971
  (payload.modelConfig ?? {}) as LaunchModelConfigInput,
1072
1972
  );
1073
1973
  return {
1974
+ /** @internal */
1074
1975
  launcherInput: cloneUnknownRecord(payload.launcherInput) ?? {},
1976
+ /** @internal */
1075
1977
  modelConfig: {
1978
+ /** @internal */
1076
1979
  defaultModelProfileId: modelConfig.defaultModelProfileId ?? null,
1077
- turnConfigs: cloneTurnConfigMap(modelConfig.turnConfigs),
1980
+ /** @internal */
1981
+ turnConfigs: { ...modelConfig.turnConfigs },
1078
1982
  },
1983
+ /** @internal */
1079
1984
  actor: normalizeActor(payload.actor),
1985
+ /** @internal */
1080
1986
  selectedSkillIds: [
1081
1987
  ...(payload.selectedSkillIds ??
1082
1988
  payload.resourceSelections?.map(({ skillId }) => skillId) ??
1083
1989
  []),
1084
1990
  ],
1991
+ /** @internal */
1085
1992
  resourceSelections: (payload.resourceSelections ?? []).map((selection) => ({ ...selection })),
1993
+ /** @internal */
1086
1994
  launchPlan: {
1995
+ /** @internal */
1087
1996
  launcherId: payload.launchPlan.launcherId,
1997
+ /** @internal */
1088
1998
  processId: payload.launchPlan.processId,
1999
+ /** @internal */
1089
2000
  handoffDedupKey: trimToNull(payload.launchPlan.handoffDedupKey) ?? null,
2001
+ /** @internal */
1090
2002
  processInput: {
2003
+ /** @internal */
1091
2004
  processId: payload.launchPlan.processInput.processId,
2005
+ /** @internal */
1092
2006
  selectedTurnId: payload.launchPlan.processInput.selectedTurnId ?? null,
2007
+ /** @internal */
1093
2008
  lifecycleStatus: payload.launchPlan.processInput.lifecycleStatus,
2009
+ /** @internal */
1094
2010
  title: payload.launchPlan.processInput.title ?? null,
2011
+ /** @internal */
1095
2012
  externalId: payload.launchPlan.processInput.externalId ?? null,
2013
+ /** @internal */
1096
2014
  externalUrl: payload.launchPlan.processInput.externalUrl ?? null,
2015
+ /** @internal */
1097
2016
  metadata: cloneUnknownRecord(payload.launchPlan.processInput.metadata),
2017
+ /** @internal */
1098
2018
  defaultModelProfileId: payload.launchPlan.processInput.defaultModelProfileId ?? null,
2019
+ /** @internal */
1099
2020
  turnConfigsJson: payload.launchPlan.processInput.turnConfigsJson ?? null,
2021
+ /** @internal */
1100
2022
  selectedTurnModelProfileId:
1101
2023
  payload.launchPlan.processInput.selectedTurnModelProfileId ?? null,
2024
+ /** @internal */
1102
2025
  selectedTurnModelKind: payload.launchPlan.processInput.selectedTurnModelKind ?? null,
2026
+ /** @internal */
1103
2027
  selectedTurnModelSource: payload.launchPlan.processInput.selectedTurnModelSource ?? null,
2028
+ /** @internal */
1104
2029
  paramsJson: payload.launchPlan.processInput.paramsJson ?? null,
2030
+ /** @internal */
1105
2031
  stateJson: payload.launchPlan.processInput.stateJson ?? null,
1106
2032
  },
2033
+ /** @internal */
1107
2034
  titleSourceFields: (payload.launchPlan.titleSourceFields ?? []).map((field) => ({
1108
2035
  ...field,
1109
2036
  })),
2037
+ /** @internal */
1110
2038
  projectInputs: (payload.launchPlan.projectInputs ?? []).map((project) => ({
2039
+ /** @internal */
1111
2040
  key: project.key,
2041
+ /** @internal */
1112
2042
  repoLocator: project.repoLocator,
2043
+ /** @internal */
1113
2044
  baseBranch: project.baseBranch,
2045
+ /** @internal */
1114
2046
  workBranch: project.workBranch ?? null,
2047
+ /** @internal */
1115
2048
  externalId: project.externalId ?? null,
2049
+ /** @internal */
1116
2050
  externalUrl: project.externalUrl ?? null,
2051
+ /** @internal */
1117
2052
  metadata: cloneUnknownRecord(project.metadata),
1118
2053
  })),
2054
+ /** @internal */
1119
2055
  startTurnId: payload.launchPlan.startTurnId ?? null,
1120
2056
  },
1121
2057
  };
1122
2058
  };
2059
+ /** @internal */
1123
2060
  const normalizeFutureActionPayload = (payload: FutureActionPayloadBase) => ({
2061
+ /** @internal */
1124
2062
  input: cloneUnknownRecord(payload.input) ?? {},
2063
+ /** @internal */
1125
2064
  nextTurnModelProfileId: trimToNull(payload.nextTurnModelProfileId) ?? null,
2065
+ /** @internal */
1126
2066
  actionLabel: trimToNull(payload.actionLabel) ?? null,
2067
+ /** @internal */
1127
2068
  actor: normalizeActor(payload.actor),
1128
2069
  });
1129
2070
 
2071
+ /** @internal */
1130
2072
  export type FutureLaunchPayload = ReturnType<typeof normalizeFutureLaunchPayload>;
2073
+ /** @internal */
1131
2074
  export type FutureActionPayload = ReturnType<typeof normalizeFutureActionPayload>;
1132
2075
 
1133
- function hasOwn(object: Record<string, unknown>, key: string): boolean {
1134
- return Object.hasOwn(object, key);
1135
- }
1136
-
1137
2076
  function parseJsonPayload(payloadJson: string, context: string): ParseResult<unknown> {
1138
2077
  try {
1139
2078
  return ok(JSON.parse(payloadJson));
@@ -1167,6 +2106,7 @@ function parseLauncherTurnConfigMap(
1167
2106
  return ok(turnConfigs);
1168
2107
  }
1169
2108
 
2109
+ /** @internal */
1170
2110
  export function parseScheduleRequestInput(value: unknown): ParseResult<ParsedScheduleRequest> {
1171
2111
  if (value === undefined || value === null) {
1172
2112
  return ok({ mode: "now" });
@@ -1191,11 +2131,14 @@ export function parseScheduleRequestInput(value: unknown): ParseResult<ParsedSch
1191
2131
  : err("cronExpression is required for cron schedules");
1192
2132
  }
1193
2133
 
2134
+ /** @internal */
1194
2135
  export function validateScheduleRequestInput(
1195
2136
  schedule: ParsedScheduleRequest,
1196
2137
  allowedModes: readonly ScheduleMode[],
1197
2138
  options: {
2139
+ /** @internal */
1198
2140
  now?: () => Date;
2141
+ /** @internal */
1199
2142
  resolveCronNextRunAt?: (expression: string, now: Date) => string;
1200
2143
  } = {},
1201
2144
  ): ParseResult<ValidatedScheduleRequest> {
@@ -1228,6 +2171,7 @@ export function validateScheduleRequestInput(
1228
2171
  }
1229
2172
  }
1230
2173
 
2174
+ /** @internal */
1231
2175
  export function parseLauncherTurnConfigsJson(
1232
2176
  turnConfigsJson: string | null | undefined,
1233
2177
  ): ParseResult<InstanceTurnConfigMap> {
@@ -1238,6 +2182,7 @@ export function parseLauncherTurnConfigsJson(
1238
2182
  return parsed.ok ? parseLauncherTurnConfigMap(parsed.value, "turnConfigsJson") : parsed;
1239
2183
  }
1240
2184
 
2185
+ /** @internal */
1241
2186
  export function parseLauncherInputJson(
1242
2187
  launcherInputJson: string | null | undefined,
1243
2188
  context = "launcherInputJson",
@@ -1249,6 +2194,7 @@ export function parseLauncherInputJson(
1249
2194
  return parsed.ok ? parseRecord(parsed.value, context) : parsed;
1250
2195
  }
1251
2196
 
2197
+ /** @internal */
1252
2198
  export function parseLauncherModelConfigInput(
1253
2199
  value: unknown,
1254
2200
  context = "modelConfig",
@@ -1262,7 +2208,7 @@ export function parseLauncherModelConfigInput(
1262
2208
  }
1263
2209
  const defaultModelProfileId = trimToNull(record.value.defaultModelProfileId);
1264
2210
  if (
1265
- hasOwn(record.value, "defaultModelProfileId") &&
2211
+ Object.hasOwn(record.value, "defaultModelProfileId") &&
1266
2212
  record.value.defaultModelProfileId !== null &&
1267
2213
  typeof record.value.defaultModelProfileId !== "string"
1268
2214
  ) {
@@ -1283,9 +2229,14 @@ export function parseLauncherModelConfigInput(
1283
2229
  }
1284
2230
 
1285
2231
  function hasInlineScheduleFields(object: Record<string, unknown>): boolean {
1286
- return hasOwn(object, "mode") || hasOwn(object, "runAt") || hasOwn(object, "cronExpression");
2232
+ return (
2233
+ Object.hasOwn(object, "mode") ||
2234
+ Object.hasOwn(object, "runAt") ||
2235
+ Object.hasOwn(object, "cronExpression")
2236
+ );
1287
2237
  }
1288
2238
 
2239
+ /** @internal */
1289
2240
  export function parseLauncherRequestBody(value: unknown): ParseResult<ParsedLauncherRequestBody> {
1290
2241
  if (value === undefined || value === null) {
1291
2242
  return ok({
@@ -1304,7 +2255,7 @@ export function parseLauncherRequestBody(value: unknown): ParseResult<ParsedLaun
1304
2255
  return record;
1305
2256
  }
1306
2257
  if (
1307
- hasOwn(record.value, "title") ||
2258
+ Object.hasOwn(record.value, "title") ||
1308
2259
  record.value.launcherInput !== undefined ||
1309
2260
  record.value.skillIds !== undefined ||
1310
2261
  record.value.modelConfig !== undefined ||
@@ -1312,12 +2263,7 @@ export function parseLauncherRequestBody(value: unknown): ParseResult<ParsedLaun
1312
2263
  ) {
1313
2264
  if (
1314
2265
  Object.keys(record.value).some(
1315
- (key) =>
1316
- key !== "title" &&
1317
- key !== "launcherInput" &&
1318
- key !== "skillIds" &&
1319
- key !== "modelConfig" &&
1320
- key !== "schedule",
2266
+ (key) => !Object.hasOwn(launcherStructuredBodySchema.entries, key),
1321
2267
  )
1322
2268
  ) {
1323
2269
  return err(
@@ -1342,14 +2288,14 @@ export function parseLauncherRequestBody(value: unknown): ParseResult<ParsedLaun
1342
2288
  }
1343
2289
  return ok({
1344
2290
  title: parsed.value.title ?? null,
1345
- titleProvided: hasOwn(record.value, "title"),
2291
+ titleProvided: Object.hasOwn(record.value, "title"),
1346
2292
  launcherInput: parsed.value.launcherInput ?? {},
1347
- launcherInputProvided: hasOwn(record.value, "launcherInput"),
1348
- ...(hasOwn(record.value, "skillIds") ? { skillIds: [...skillIds] } : {}),
2293
+ launcherInputProvided: Object.hasOwn(record.value, "launcherInput"),
2294
+ ...(Object.hasOwn(record.value, "skillIds") ? { skillIds: [...skillIds] } : {}),
1349
2295
  modelConfig: modelConfig.value,
1350
- modelConfigProvided: hasOwn(record.value, "modelConfig"),
2296
+ modelConfigProvided: Object.hasOwn(record.value, "modelConfig"),
1351
2297
  schedule: schedule.value,
1352
- scheduleProvided: hasOwn(record.value, "schedule"),
2298
+ scheduleProvided: Object.hasOwn(record.value, "schedule"),
1353
2299
  });
1354
2300
  }
1355
2301
  const modelConfig = parseLauncherModelConfigInput(record.value, "modelConfig");
@@ -1372,6 +2318,7 @@ export function parseLauncherRequestBody(value: unknown): ParseResult<ParsedLaun
1372
2318
  });
1373
2319
  }
1374
2320
 
2321
+ /** @internal */
1375
2322
  export function parseActionRequestBody(value: unknown): ParseResult<ParsedActionRequestBody> {
1376
2323
  if (value === undefined || value === null) {
1377
2324
  return ok({
@@ -1386,7 +2333,7 @@ export function parseActionRequestBody(value: unknown): ParseResult<ParsedAction
1386
2333
  if (!record.ok) {
1387
2334
  return record;
1388
2335
  }
1389
- const nextTurnModelProfileIdProvided = hasOwn(record.value, "nextTurnModelProfileId");
2336
+ const nextTurnModelProfileIdProvided = Object.hasOwn(record.value, "nextTurnModelProfileId");
1390
2337
  if (
1391
2338
  record.value.input !== undefined ||
1392
2339
  nextTurnModelProfileIdProvided ||
@@ -1394,7 +2341,7 @@ export function parseActionRequestBody(value: unknown): ParseResult<ParsedAction
1394
2341
  ) {
1395
2342
  if (
1396
2343
  Object.keys(record.value).some(
1397
- (key) => key !== "input" && key !== "nextTurnModelProfileId" && key !== "schedule",
2344
+ (key) => !Object.hasOwn(actionStructuredBodySchema.entries, key),
1398
2345
  )
1399
2346
  ) {
1400
2347
  return err("action request body must use { input, nextTurnModelProfileId }");
@@ -1409,10 +2356,10 @@ export function parseActionRequestBody(value: unknown): ParseResult<ParsedAction
1409
2356
  }
1410
2357
  return ok({
1411
2358
  input: parsed.value.input ?? {},
1412
- inputProvided: hasOwn(record.value, "input"),
2359
+ inputProvided: Object.hasOwn(record.value, "input"),
1413
2360
  nextTurnModelProfileIdProvided,
1414
2361
  schedule: schedule.value,
1415
- scheduleProvided: hasOwn(record.value, "schedule"),
2362
+ scheduleProvided: Object.hasOwn(record.value, "schedule"),
1416
2363
  ...(nextTurnModelProfileIdProvided
1417
2364
  ? { nextTurnModelProfileId: parsed.value.nextTurnModelProfileId ?? null }
1418
2365
  : {}),
@@ -1428,16 +2375,15 @@ export function parseActionRequestBody(value: unknown): ParseResult<ParsedAction
1428
2375
  nextTurnModelProfileIdProvided,
1429
2376
  schedule: schedule.value,
1430
2377
  scheduleProvided: hasInlineScheduleFields(record.value),
1431
- ...(nextTurnModelProfileIdProvided
1432
- ? { nextTurnModelProfileId: trimToNull(record.value.nextTurnModelProfileId) }
1433
- : {}),
1434
2378
  });
1435
2379
  }
1436
2380
 
2381
+ /** @internal */
1437
2382
  export function serializeFutureLaunchPayload(payload: unknown): string {
1438
2383
  return JSON.stringify(normalizeFutureLaunchPayload(payload as FutureLaunchPayloadBase));
1439
2384
  }
1440
2385
 
2386
+ /** @internal */
1441
2387
  export function parseFutureLaunchPayloadObject(
1442
2388
  value: unknown,
1443
2389
  context = "Scheduled launch payload",
@@ -1446,6 +2392,7 @@ export function parseFutureLaunchPayloadObject(
1446
2392
  return parsed.ok ? ok(normalizeFutureLaunchPayload(parsed.value)) : parsed;
1447
2393
  }
1448
2394
 
2395
+ /** @internal */
1449
2396
  export function parseFutureLaunchPayloadJson(
1450
2397
  payloadJson: string,
1451
2398
  ): ParseResult<FutureLaunchPayload> {
@@ -1453,10 +2400,12 @@ export function parseFutureLaunchPayloadJson(
1453
2400
  return parsed.ok ? parseFutureLaunchPayloadObject(parsed.value) : parsed;
1454
2401
  }
1455
2402
 
2403
+ /** @internal */
1456
2404
  export function serializeFutureActionPayload(payload: unknown): string {
1457
2405
  return JSON.stringify(normalizeFutureActionPayload(payload as FutureActionPayloadBase));
1458
2406
  }
1459
2407
 
2408
+ /** @internal */
1460
2409
  export function parseFutureActionPayloadObject(
1461
2410
  value: unknown,
1462
2411
  context = "Scheduled action payload",
@@ -1465,9 +2414,17 @@ export function parseFutureActionPayloadObject(
1465
2414
  return parsed.ok ? ok(normalizeFutureActionPayload(parsed.value)) : parsed;
1466
2415
  }
1467
2416
 
2417
+ /** @internal */
1468
2418
  export function parseFutureActionPayloadJson(
1469
2419
  payloadJson: string,
1470
2420
  ): ParseResult<FutureActionPayload> {
1471
2421
  const parsed = parseJsonPayload(payloadJson, "Scheduled action payload");
1472
2422
  return parsed.ok ? parseFutureActionPayloadObject(parsed.value) : parsed;
1473
2423
  }
2424
+
2425
+ export type {
2426
+ ApiTokenMetadata,
2427
+ ApiTokenPolicy,
2428
+ ApiTokensResponseBody,
2429
+ CreateApiTokenResponseBody,
2430
+ } from "./api-token-contracts.js";