@leitwerk-dev/protocol 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/LICENSE +13 -0
  2. package/dist/chunk-6L4W7WPV.js +1 -0
  3. package/dist/chunk-6L4W7WPV.js.map +1 -0
  4. package/dist/chunk-7PCFBAV4.js +740 -0
  5. package/dist/chunk-7PCFBAV4.js.map +1 -0
  6. package/dist/chunk-AAV3AAOF.js +1 -0
  7. package/dist/chunk-AAV3AAOF.js.map +1 -0
  8. package/dist/chunk-IEMT3JG4.js +1 -0
  9. package/dist/chunk-IEMT3JG4.js.map +1 -0
  10. package/dist/chunk-IWVU76M5.js +26 -0
  11. package/dist/chunk-IWVU76M5.js.map +1 -0
  12. package/dist/config-snapshot.d.ts +211 -0
  13. package/dist/config-snapshot.d.ts.map +1 -0
  14. package/dist/config-snapshot.js +2 -0
  15. package/dist/config-snapshot.js.map +1 -0
  16. package/dist/external-review.d.ts +8 -0
  17. package/dist/external-review.d.ts.map +1 -0
  18. package/dist/external-review.js +2 -0
  19. package/dist/external-review.js.map +1 -0
  20. package/dist/form-contract.d.ts +41 -0
  21. package/dist/form-contract.d.ts.map +1 -0
  22. package/dist/form-contract.js +2 -0
  23. package/dist/form-contract.js.map +1 -0
  24. package/dist/http-contracts-C8IXe8MU.d.ts +1483 -0
  25. package/dist/http-contracts.d.ts +959 -0
  26. package/dist/http-contracts.d.ts.map +1 -0
  27. package/dist/http-contracts.js +434 -0
  28. package/dist/http-contracts.js.map +1 -0
  29. package/dist/index.d.ts +21 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +21 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/initial-prompt.d.ts +8 -0
  34. package/dist/initial-prompt.d.ts.map +1 -0
  35. package/dist/initial-prompt.js +103 -0
  36. package/dist/initial-prompt.js.map +1 -0
  37. package/dist/launcher-contract.d.ts +34 -0
  38. package/dist/launcher-contract.d.ts.map +1 -0
  39. package/dist/launcher-contract.js +2 -0
  40. package/dist/launcher-contract.js.map +1 -0
  41. package/dist/live-turn-projection.d.ts +39 -0
  42. package/dist/live-turn-projection.d.ts.map +1 -0
  43. package/dist/live-turn-projection.js +395 -0
  44. package/dist/live-turn-projection.js.map +1 -0
  45. package/dist/pi-session-message.d.ts +25 -0
  46. package/dist/pi-session-message.d.ts.map +1 -0
  47. package/dist/pi-session-message.js +27 -0
  48. package/dist/pi-session-message.js.map +1 -0
  49. package/dist/primary-path-snapshot.d.ts +77 -0
  50. package/dist/primary-path-snapshot.d.ts.map +1 -0
  51. package/dist/primary-path-snapshot.js +2 -0
  52. package/dist/primary-path-snapshot.js.map +1 -0
  53. package/dist/protocol.d.ts +428 -0
  54. package/dist/protocol.d.ts.map +1 -0
  55. package/dist/protocol.js +261 -0
  56. package/dist/protocol.js.map +1 -0
  57. package/dist/session-entry-tree.d.ts +15 -0
  58. package/dist/session-entry-tree.d.ts.map +1 -0
  59. package/dist/session-entry-tree.js +42 -0
  60. package/dist/session-entry-tree.js.map +1 -0
  61. package/dist/streamable-events.d.ts +4 -0
  62. package/dist/streamable-events.d.ts.map +1 -0
  63. package/dist/streamable-events.js +17 -0
  64. package/dist/streamable-events.js.map +1 -0
  65. package/dist/text-preview.d.ts +7 -0
  66. package/dist/text-preview.d.ts.map +1 -0
  67. package/dist/text-preview.js +23 -0
  68. package/dist/text-preview.js.map +1 -0
  69. package/dist/timeline-projection.d.ts +9 -0
  70. package/dist/timeline-projection.d.ts.map +1 -0
  71. package/dist/timeline-projection.js +30 -0
  72. package/dist/timeline-projection.js.map +1 -0
  73. package/dist/timestamp-ordering.d.ts +3 -0
  74. package/dist/timestamp-ordering.d.ts.map +1 -0
  75. package/dist/timestamp-ordering.js +15 -0
  76. package/dist/timestamp-ordering.js.map +1 -0
  77. package/dist/tool-renderer-contract.d.ts +18 -0
  78. package/dist/tool-renderer-contract.d.ts.map +1 -0
  79. package/dist/tool-renderer-contract.js +22 -0
  80. package/dist/tool-renderer-contract.js.map +1 -0
  81. package/dist/turn-continuation.d.ts +36 -0
  82. package/dist/turn-continuation.d.ts.map +1 -0
  83. package/dist/turn-continuation.js +179 -0
  84. package/dist/turn-continuation.js.map +1 -0
  85. package/dist/usage-by-turn-record.d.ts +5 -0
  86. package/dist/usage-by-turn-record.d.ts.map +1 -0
  87. package/dist/usage-by-turn-record.js +25 -0
  88. package/dist/usage-by-turn-record.js.map +1 -0
  89. package/dist/usage-snapshot.d.ts +25 -0
  90. package/dist/usage-snapshot.d.ts.map +1 -0
  91. package/dist/usage-snapshot.js +120 -0
  92. package/dist/usage-snapshot.js.map +1 -0
  93. package/dist/ws-event-payloads.d.ts +18 -0
  94. package/dist/ws-event-payloads.d.ts.map +1 -0
  95. package/dist/ws-event-payloads.js +47 -0
  96. package/dist/ws-event-payloads.js.map +1 -0
  97. package/package.json +65 -0
  98. package/src/config-snapshot.ts +244 -0
  99. package/src/external-review.ts +7 -0
  100. package/src/form-contract.ts +50 -0
  101. package/src/http-contracts.ts +1497 -0
  102. package/src/index.ts +20 -0
  103. package/src/initial-prompt.ts +127 -0
  104. package/src/launcher-contract.ts +43 -0
  105. package/src/live-turn-projection.ts +501 -0
  106. package/src/pi-session-message.ts +48 -0
  107. package/src/primary-path-snapshot.ts +98 -0
  108. package/src/protocol.ts +503 -0
  109. package/src/session-entry-tree.ts +63 -0
  110. package/src/streamable-events.ts +20 -0
  111. package/src/text-preview.ts +32 -0
  112. package/src/timeline-projection.ts +43 -0
  113. package/src/timestamp-ordering.ts +15 -0
  114. package/src/tool-renderer-contract.ts +41 -0
  115. package/src/turn-continuation.ts +298 -0
  116. package/src/usage-by-turn-record.ts +34 -0
  117. package/src/usage-snapshot.ts +174 -0
  118. package/src/ws-event-payloads.ts +73 -0
@@ -0,0 +1,1483 @@
1
+ import { SemanticEntryRef, ProcessSemanticEntryRefs, ProcessTurnAnnotation, WorkerLease, ProcessTurnRecord, ProcessInstance, ProcessProject, ProcessInput, FutureExecutionKind, Actor, FutureExecutionBlockReason, DurableModelSelection, LaunchModelConfigInput, InstanceTurnConfigMap, ProcessSelectedTurnModelSource, ProcessFlowView, ProcessTurnType, ProcessRowSlot, ProcessEvent, ProcessLeafOutcomeSnapshot, SerializedProcessGraph, ProcessQuestionRequest, QuestionAnswerDraft } from '@leitwerk-dev/domain';
2
+ import * as v from 'valibot';
3
+ import { ProcessWatcherType } from './config-snapshot.js';
4
+ import { FormFieldOptionDefinition, ActionFormFieldDefinition, ActionFormDefinition } from './form-contract.js';
5
+ import { LauncherValidationError, UiLauncherSummaryBase } from './launcher-contract.js';
6
+ import { ToolCallRendererDefinition } from './tool-renderer-contract.js';
7
+
8
+ interface UsageCostSnapshot {
9
+ input: number;
10
+ output: number;
11
+ cacheRead: number;
12
+ cacheWrite: number;
13
+ total: number;
14
+ }
15
+ interface UsageSnapshot {
16
+ input: number;
17
+ output: number;
18
+ /** Provider-reported reasoning/thinking tokens. This is a subset of output tokens. */
19
+ reasoning?: number;
20
+ cacheRead: number;
21
+ cacheWrite: number;
22
+ totalTokens: number;
23
+ cost: UsageCostSnapshot | null;
24
+ /** Number of model requests represented by this aggregate, when known. */
25
+ requestCount?: number;
26
+ /** Largest input-token count for a single represented model request, when known. */
27
+ maxInputTokens?: number;
28
+ }
29
+ declare function cloneUsageSnapshot(usage: UsageSnapshot | null | undefined): UsageSnapshot | null;
30
+ declare function normalizeUsageSnapshot(value: unknown): UsageSnapshot | null;
31
+ declare function mergeUsageSnapshots(total: UsageSnapshot | null, usage: UsageSnapshot | null): UsageSnapshot | null;
32
+
33
+ interface PrimaryPathEntrySnapshot extends Record<string, unknown> {
34
+ id: string;
35
+ parentId: string | null;
36
+ type: string;
37
+ timestamp: string;
38
+ }
39
+ interface PrimaryPathDetailRailSnapshot {
40
+ keyPoints: [];
41
+ futureTurns: [];
42
+ currentPosition: null;
43
+ }
44
+ interface PrimaryPathStreamingAssistantSnapshot {
45
+ text: string;
46
+ thinking: string;
47
+ lastUpdatedAt: string | null;
48
+ }
49
+ interface PrimaryPathThinkingTraceItemSnapshot {
50
+ kind: "thinking";
51
+ text: string;
52
+ }
53
+ interface PrimaryPathToolCallTraceItemSnapshot {
54
+ kind: "tool_call";
55
+ toolCallId: string;
56
+ }
57
+ type PrimaryPathOperationalTraceSeverity = "info" | "success" | "warning" | "error";
58
+ interface PrimaryPathOperationalTraceItemSnapshot {
59
+ kind: "operational_event";
60
+ eventType: string;
61
+ severity: PrimaryPathOperationalTraceSeverity;
62
+ title: string;
63
+ message: string;
64
+ timestamp: string;
65
+ }
66
+ type PrimaryPathTraceItemSnapshot = PrimaryPathThinkingTraceItemSnapshot | PrimaryPathToolCallTraceItemSnapshot | PrimaryPathOperationalTraceItemSnapshot;
67
+ interface PrimaryPathToolCallSnapshot {
68
+ toolCallId: string;
69
+ toolName: string;
70
+ status: "running" | "completed";
71
+ startedAt: string;
72
+ completedAt: string | null;
73
+ arguments: Record<string, unknown> | null;
74
+ result: unknown;
75
+ isError: boolean;
76
+ }
77
+ type TurnUsageSnapshot = UsageSnapshot;
78
+ interface PrimaryPathActiveTurnSnapshot {
79
+ turnRecordId: string;
80
+ turnId: string;
81
+ turnType: ProcessTurnRecord["turnType"];
82
+ pathType: ProcessTurnRecord["pathType"];
83
+ startedAt: string;
84
+ assistant: PrimaryPathStreamingAssistantSnapshot;
85
+ toolCalls: PrimaryPathToolCallSnapshot[];
86
+ traceItems: PrimaryPathTraceItemSnapshot[];
87
+ usage: TurnUsageSnapshot | null;
88
+ eventWindowTruncated: boolean;
89
+ }
90
+ interface PrimaryPathTurnStateSnapshot {
91
+ currentTurnRecordId: string | null;
92
+ workerState: WorkerLease["state"] | null;
93
+ isStreaming: boolean;
94
+ activeTurn: PrimaryPathActiveTurnSnapshot | null;
95
+ }
96
+ interface PrimaryPathSnapshot {
97
+ instanceId: string;
98
+ rebuiltAt: string;
99
+ primaryPathEntries: PrimaryPathEntrySnapshot[];
100
+ currentLeaf: SemanticEntryRef | null;
101
+ semanticEntryRefs: ProcessSemanticEntryRefs;
102
+ labels: Record<string, string>;
103
+ turnAnnotations: ProcessTurnAnnotation[];
104
+ detailRail: PrimaryPathDetailRailSnapshot;
105
+ turnState: PrimaryPathTurnStateSnapshot;
106
+ }
107
+
108
+ type ParseResult<T> = {
109
+ ok: true;
110
+ value: T;
111
+ } | {
112
+ ok: false;
113
+ error: string;
114
+ };
115
+ declare const ok: <T>(value: T) => ParseResult<T>;
116
+ declare const err: (error: string) => ParseResult<never>;
117
+ declare const unknownRecordSchema: v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>;
118
+ declare const nullableStringSchema: v.NullableSchema<v.StringSchema<undefined>, undefined>;
119
+ declare const optionalNullableStringSchema: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
120
+ declare function parseSchema<TSchema extends v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>>(schema: TSchema, value: unknown, context: string): ParseResult<v.InferOutput<TSchema>>;
121
+ declare function parseLiteral<T extends string>(value: unknown, allowed: readonly T[], context: string): ParseResult<T>;
122
+ declare const WS_PROTOCOL_VERSION = "leitwerk/ws/v1";
123
+ declare const WS_PROCESS_TYPES: {
124
+ readonly TOAST: "process.toast";
125
+ readonly FUTURE_UPDATED: "future.updated";
126
+ };
127
+ declare const WS_PRIMARY_PATH_TYPES: {
128
+ readonly TURN_STARTED: "primary_path.turn_started";
129
+ readonly ASSISTANT_PARTIAL: "primary_path.assistant_partial";
130
+ readonly USAGE_UPDATED: "primary_path.usage_updated";
131
+ readonly ASSISTANT_COMMITTED: "primary_path.assistant_committed";
132
+ readonly TOOL_CALL_STARTED: "primary_path.tool_call_started";
133
+ readonly TOOL_CALL_COMPLETED: "primary_path.tool_call_completed";
134
+ readonly TURN_ANNOTATION_CHANGED: "primary_path.turn_annotation_changed";
135
+ readonly LABEL_CHANGED: "primary_path.label_changed";
136
+ readonly CHANGED: "primary_path.changed";
137
+ };
138
+ declare const WS_PI_STREAM_TYPES: {
139
+ readonly STARTED: "pi.stream.started";
140
+ readonly DELTA: "pi.stream.delta";
141
+ readonly COMPLETED: "pi.stream.completed";
142
+ readonly TOOL_STARTED: "pi.tool.started";
143
+ readonly TOOL_COMPLETED: "pi.tool.completed";
144
+ readonly LABEL_CHANGED: "pi.label.changed";
145
+ readonly ERROR: "pi.error";
146
+ readonly RETRY_START: "pi.retry.start";
147
+ readonly RETRY_END: "pi.retry.end";
148
+ readonly USAGE: "pi.usage";
149
+ };
150
+ type PiPayload<T = Record<string, never>> = {
151
+ turnId?: string | null;
152
+ turnRecordId?: string | null;
153
+ timestamp?: string;
154
+ } & T;
155
+ declare const primaryPathTreeSchema: v.ObjectSchema<{
156
+ rootEntry: v.NullableSchema<v.ObjectSchema<{
157
+ readonly entryId: v.StringSchema<undefined>;
158
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
159
+ }, undefined>, undefined>;
160
+ currentLeaf: v.NullableSchema<v.ObjectSchema<{
161
+ readonly entryId: v.StringSchema<undefined>;
162
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
163
+ }, undefined>, undefined>;
164
+ }, undefined>;
165
+ declare const PRIMARY_PATH_PAYLOAD_SCHEMAS: {
166
+ readonly "primary_path.turn_started": v.ObjectSchema<{
167
+ readonly turnRecord: v.ObjectSchema<{
168
+ readonly id: v.StringSchema<undefined>;
169
+ readonly turnId: v.StringSchema<undefined>;
170
+ readonly turnType: v.PicklistSchema<readonly ["llm", "human", "external", "automatic", "server_automatic"], undefined>;
171
+ readonly pathType: v.PicklistSchema<readonly ["primary", "root_branch", "leaf_branch"], undefined>;
172
+ readonly startedAt: v.StringSchema<undefined>;
173
+ }, undefined>;
174
+ }, undefined>;
175
+ readonly "primary_path.assistant_partial": v.ObjectSchema<{
176
+ readonly text: v.StringSchema<undefined>;
177
+ readonly streamType: v.StringSchema<undefined>;
178
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
179
+ readonly piTurnId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
180
+ readonly timestamp: v.StringSchema<undefined>;
181
+ }, undefined>;
182
+ readonly "primary_path.usage_updated": v.ObjectSchema<{
183
+ readonly usage: v.ObjectSchema<{
184
+ readonly input: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
185
+ readonly output: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
186
+ readonly cacheRead: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
187
+ readonly cacheWrite: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
188
+ readonly totalTokens: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
189
+ readonly cost: v.NullableSchema<v.ObjectSchema<{
190
+ readonly input: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
191
+ readonly output: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
192
+ readonly reasoning: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>, undefined>;
193
+ readonly cacheRead: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
194
+ readonly cacheWrite: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
195
+ readonly total: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.FiniteAction<number, undefined>]>;
196
+ }, undefined>, undefined>;
197
+ }, undefined>;
198
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
199
+ readonly piTurnId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
200
+ readonly timestamp: v.StringSchema<undefined>;
201
+ }, undefined>;
202
+ readonly "primary_path.assistant_committed": v.ObjectSchema<{
203
+ readonly rootEntry: v.NullableSchema<v.ObjectSchema<{
204
+ readonly entryId: v.StringSchema<undefined>;
205
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
206
+ }, undefined>, undefined>;
207
+ readonly currentLeaf: v.NullableSchema<v.ObjectSchema<{
208
+ readonly entryId: v.StringSchema<undefined>;
209
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
210
+ }, undefined>, undefined>;
211
+ readonly turnRecord: v.ObjectSchema<{
212
+ readonly id: v.StringSchema<undefined>;
213
+ readonly turnId: v.StringSchema<undefined>;
214
+ readonly turnType: v.PicklistSchema<readonly ["llm", "human", "external", "automatic", "server_automatic"], undefined>;
215
+ readonly pathType: v.PicklistSchema<readonly ["primary", "root_branch", "leaf_branch"], undefined>;
216
+ readonly startedAt: v.StringSchema<undefined>;
217
+ }, undefined>;
218
+ }, undefined>;
219
+ readonly "primary_path.tool_call_started": v.ObjectSchema<{
220
+ readonly toolCallId: v.StringSchema<undefined>;
221
+ readonly toolName: v.StringSchema<undefined>;
222
+ readonly arguments: v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>;
223
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
224
+ readonly piTurnId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
225
+ readonly timestamp: v.StringSchema<undefined>;
226
+ }, undefined>;
227
+ readonly "primary_path.tool_call_completed": v.ObjectSchema<{
228
+ readonly toolCallId: v.StringSchema<undefined>;
229
+ readonly toolName: v.StringSchema<undefined>;
230
+ readonly result: v.UnknownSchema;
231
+ readonly isError: v.BooleanSchema<undefined>;
232
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
233
+ readonly piTurnId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
234
+ readonly timestamp: v.StringSchema<undefined>;
235
+ }, undefined>;
236
+ readonly "primary_path.turn_annotation_changed": v.ObjectSchema<{
237
+ readonly change: v.PicklistSchema<["created", "updated"], undefined>;
238
+ readonly annotation: v.ObjectSchema<{
239
+ readonly id: v.StringSchema<undefined>;
240
+ readonly instanceId: v.StringSchema<undefined>;
241
+ readonly annotationType: v.StringSchema<undefined>;
242
+ readonly annotationKey: v.NullableSchema<v.StringSchema<undefined>, undefined>;
243
+ readonly references: v.ArraySchema<v.VariantSchema<"kind", [v.ObjectSchema<{
244
+ readonly kind: v.LiteralSchema<"turn_record", undefined>;
245
+ readonly turnRecordId: v.StringSchema<undefined>;
246
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
247
+ }, undefined>, v.ObjectSchema<{
248
+ readonly kind: v.LiteralSchema<"entry", undefined>;
249
+ readonly entryId: v.StringSchema<undefined>;
250
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
251
+ }, undefined>, v.ObjectSchema<{
252
+ readonly kind: v.LiteralSchema<"semantic_entry_ref", undefined>;
253
+ readonly ref: v.PicklistSchema<readonly ["plan", "review", "currentPrimaryPathLeaf", "rootEntry"], undefined>;
254
+ readonly role: v.NullableSchema<v.StringSchema<undefined>, undefined>;
255
+ }, undefined>], undefined>, undefined>;
256
+ readonly payload: v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>;
257
+ readonly createdAt: v.StringSchema<undefined>;
258
+ readonly updatedAt: v.StringSchema<undefined>;
259
+ }, undefined>;
260
+ }, undefined>;
261
+ readonly "primary_path.label_changed": v.ObjectSchema<{
262
+ readonly targetId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
263
+ readonly label: v.NullableSchema<v.StringSchema<undefined>, undefined>;
264
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
265
+ readonly piTurnId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
266
+ readonly timestamp: v.StringSchema<undefined>;
267
+ }, undefined>;
268
+ readonly "primary_path.changed": v.ObjectSchema<{
269
+ rootEntry: v.NullableSchema<v.ObjectSchema<{
270
+ readonly entryId: v.StringSchema<undefined>;
271
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
272
+ }, undefined>, undefined>;
273
+ currentLeaf: v.NullableSchema<v.ObjectSchema<{
274
+ readonly entryId: v.StringSchema<undefined>;
275
+ readonly turnRecordId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
276
+ }, undefined>, undefined>;
277
+ }, undefined>;
278
+ };
279
+ type PrimaryPathPayloadByType = {
280
+ [K in keyof typeof PRIMARY_PATH_PAYLOAD_SCHEMAS]: v.InferOutput<(typeof PRIMARY_PATH_PAYLOAD_SCHEMAS)[K]>;
281
+ };
282
+ type PrimaryPathTree = v.InferOutput<typeof primaryPathTreeSchema>;
283
+ type PiUsagePayload = PiPayload<{
284
+ input?: number;
285
+ output?: number;
286
+ cacheRead?: number;
287
+ cacheWrite?: number;
288
+ totalTokens?: number;
289
+ cost?: {
290
+ input?: number;
291
+ output?: number;
292
+ cacheRead?: number;
293
+ cacheWrite?: number;
294
+ total?: number;
295
+ };
296
+ cacheHitRate?: number;
297
+ }>;
298
+ type WsDurability = "durable" | "ephemeral";
299
+ type ProcessAttentionTarget = {
300
+ kind: "action_required";
301
+ } | {
302
+ kind: "turn_failed";
303
+ } | {
304
+ kind: "worker_failed";
305
+ } | {
306
+ kind: "question_request";
307
+ requestId: string;
308
+ };
309
+ type WsPayloadByType = {
310
+ hello: {
311
+ serverVersion: string;
312
+ };
313
+ pong: Record<string, never>;
314
+ "process.created": {
315
+ process: ProcessInstance;
316
+ processId: string;
317
+ launcherId?: string;
318
+ };
319
+ "process.updated": {
320
+ process: Partial<ProcessInstance>;
321
+ changedFields?: readonly string[];
322
+ };
323
+ "process.deleted": {
324
+ instanceId: string;
325
+ };
326
+ "project.updated": {
327
+ projectId: string;
328
+ project: {
329
+ key: string;
330
+ repoLocator: string;
331
+ repoLocatorKind: ProcessProject["repoLocatorKind"];
332
+ branch: string;
333
+ baseBranch: string;
334
+ workBranch: string | null;
335
+ externalId: string | null;
336
+ externalUrl: string | null;
337
+ pipelineStatus: string | null;
338
+ };
339
+ };
340
+ "worker.state": {
341
+ worker: WorkerLease;
342
+ workerId: string;
343
+ state: WorkerLease["state"];
344
+ previousState: WorkerLease["state"];
345
+ reason: string;
346
+ };
347
+ "process.input.queued": {
348
+ instanceId: string;
349
+ input: ProcessInput;
350
+ };
351
+ "process.input.acknowledged": {
352
+ instanceId: string;
353
+ inputId: string;
354
+ sequence: number;
355
+ };
356
+ "process.event": {
357
+ eventType: string;
358
+ level: string;
359
+ message: string;
360
+ };
361
+ [WS_PROCESS_TYPES.TOAST]: {
362
+ instanceId: string;
363
+ level: "warn" | "error";
364
+ message: string;
365
+ eventType: string;
366
+ dedupeKey: string;
367
+ ttlMs: number;
368
+ /** Optional typed Chronicle target applied only when the operator opens the toast. */
369
+ focusTarget?: ProcessAttentionTarget;
370
+ };
371
+ [WS_PROCESS_TYPES.FUTURE_UPDATED]: {
372
+ futureExecutionId: string;
373
+ operation: "created" | "updated" | "deleted";
374
+ kind: FutureExecutionKind;
375
+ };
376
+ "plan.updated": {
377
+ planRevision: number;
378
+ reviewState: string;
379
+ approved: boolean;
380
+ summary: string;
381
+ };
382
+ "review.updated": {
383
+ hasIssues: boolean;
384
+ issueCount: number;
385
+ reviewMarkdown?: string;
386
+ nextTurnId: string | null;
387
+ };
388
+ [WS_PI_STREAM_TYPES.STARTED]: PiPayload;
389
+ [WS_PI_STREAM_TYPES.DELTA]: PiPayload<{
390
+ text?: string;
391
+ delta?: string;
392
+ chunk?: string;
393
+ streamType?: string;
394
+ }>;
395
+ [WS_PI_STREAM_TYPES.COMPLETED]: PiPayload;
396
+ [WS_PI_STREAM_TYPES.TOOL_STARTED]: PiPayload<{
397
+ toolCallId?: string;
398
+ toolName?: string;
399
+ name?: string;
400
+ arguments?: Record<string, unknown>;
401
+ args?: Record<string, unknown>;
402
+ }>;
403
+ [WS_PI_STREAM_TYPES.TOOL_COMPLETED]: PiPayload<{
404
+ toolCallId?: string;
405
+ toolName?: string;
406
+ name?: string;
407
+ result?: unknown;
408
+ isError?: boolean;
409
+ }>;
410
+ [WS_PI_STREAM_TYPES.LABEL_CHANGED]: PiPayload<{
411
+ targetId?: string | null;
412
+ label?: string | null;
413
+ }>;
414
+ [WS_PI_STREAM_TYPES.ERROR]: PiPayload<{
415
+ message?: string;
416
+ errorMessage?: string;
417
+ source?: string;
418
+ toolName?: string;
419
+ stopReason?: string;
420
+ provider?: string;
421
+ model?: string;
422
+ }>;
423
+ [WS_PI_STREAM_TYPES.RETRY_START]: PiPayload<{
424
+ attempt?: number;
425
+ maxAttempts?: number;
426
+ delayMs?: number;
427
+ errorMessage?: string;
428
+ message?: string;
429
+ }>;
430
+ [WS_PI_STREAM_TYPES.RETRY_END]: PiPayload<{
431
+ success?: boolean;
432
+ attempt?: number;
433
+ finalError?: string;
434
+ message?: string;
435
+ }>;
436
+ [WS_PI_STREAM_TYPES.USAGE]: PiUsagePayload;
437
+ [WS_PRIMARY_PATH_TYPES.TURN_STARTED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.TURN_STARTED];
438
+ [WS_PRIMARY_PATH_TYPES.ASSISTANT_PARTIAL]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.ASSISTANT_PARTIAL];
439
+ [WS_PRIMARY_PATH_TYPES.USAGE_UPDATED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.USAGE_UPDATED];
440
+ [WS_PRIMARY_PATH_TYPES.ASSISTANT_COMMITTED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.ASSISTANT_COMMITTED];
441
+ [WS_PRIMARY_PATH_TYPES.TOOL_CALL_STARTED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.TOOL_CALL_STARTED];
442
+ [WS_PRIMARY_PATH_TYPES.TOOL_CALL_COMPLETED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.TOOL_CALL_COMPLETED];
443
+ [WS_PRIMARY_PATH_TYPES.TURN_ANNOTATION_CHANGED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.TURN_ANNOTATION_CHANGED];
444
+ [WS_PRIMARY_PATH_TYPES.LABEL_CHANGED]: PrimaryPathPayloadByType[typeof WS_PRIMARY_PATH_TYPES.LABEL_CHANGED];
445
+ [WS_PRIMARY_PATH_TYPES.CHANGED]: PrimaryPathTree;
446
+ };
447
+ declare const WS_FRAME_DURABILITY: {
448
+ readonly hello: "ephemeral";
449
+ readonly pong: "ephemeral";
450
+ readonly "process.created": "durable";
451
+ readonly "process.updated": "durable";
452
+ readonly "process.deleted": "durable";
453
+ readonly "project.updated": "durable";
454
+ readonly "worker.state": "durable";
455
+ readonly "process.input.queued": "durable";
456
+ readonly "process.input.acknowledged": "durable";
457
+ readonly "process.event": "durable";
458
+ readonly "process.toast": "ephemeral";
459
+ readonly "future.updated": "durable";
460
+ readonly "plan.updated": "durable";
461
+ readonly "review.updated": "durable";
462
+ readonly "pi.stream.started": "ephemeral";
463
+ readonly "pi.stream.delta": "ephemeral";
464
+ readonly "pi.stream.completed": "ephemeral";
465
+ readonly "pi.tool.started": "ephemeral";
466
+ readonly "pi.tool.completed": "ephemeral";
467
+ readonly "pi.label.changed": "ephemeral";
468
+ readonly "pi.error": "ephemeral";
469
+ readonly "pi.retry.start": "ephemeral";
470
+ readonly "pi.retry.end": "ephemeral";
471
+ readonly "pi.usage": "ephemeral";
472
+ readonly "primary_path.turn_started": "durable";
473
+ readonly "primary_path.assistant_partial": "ephemeral";
474
+ readonly "primary_path.usage_updated": "ephemeral";
475
+ readonly "primary_path.assistant_committed": "durable";
476
+ readonly "primary_path.tool_call_started": "ephemeral";
477
+ readonly "primary_path.tool_call_completed": "ephemeral";
478
+ readonly "primary_path.turn_annotation_changed": "durable";
479
+ readonly "primary_path.label_changed": "durable";
480
+ readonly "primary_path.changed": "durable";
481
+ };
482
+ type WsDurabilityByType = typeof WS_FRAME_DURABILITY;
483
+ type KnownWsFrameType = keyof WsPayloadByType;
484
+ type KnownDurableWsFrameType = {
485
+ [K in KnownWsFrameType]: WsDurabilityByType[K] extends "durable" ? K : never;
486
+ }[KnownWsFrameType];
487
+ type KnownEphemeralWsFrameType = {
488
+ [K in KnownWsFrameType]: WsDurabilityByType[K] extends "ephemeral" ? K : never;
489
+ }[KnownWsFrameType];
490
+ type WsFrameOfType<T extends KnownWsFrameType> = {
491
+ protocol: typeof WS_PROTOCOL_VERSION;
492
+ type: T;
493
+ durability: WsDurabilityByType[T];
494
+ sentAt: string;
495
+ instanceId?: string;
496
+ payload: WsPayloadByType[T];
497
+ };
498
+ type DurableWsFrameInput = {
499
+ [K in KnownDurableWsFrameType]: {
500
+ type: K;
501
+ instanceId?: string;
502
+ payload: WsPayloadByType[K];
503
+ };
504
+ }[KnownDurableWsFrameType];
505
+ type EphemeralWsFrameInput = {
506
+ [K in KnownEphemeralWsFrameType]: {
507
+ type: K;
508
+ instanceId?: string;
509
+ payload: WsPayloadByType[K];
510
+ };
511
+ }[KnownEphemeralWsFrameType];
512
+ type WsFrame = {
513
+ [K in KnownWsFrameType]: WsFrameOfType<K>;
514
+ }[KnownWsFrameType];
515
+ type PrimaryPathWsFrameType = (typeof WS_PRIMARY_PATH_TYPES)[keyof typeof WS_PRIMARY_PATH_TYPES];
516
+ type PrimaryPathWsFrame = Extract<WsFrame, {
517
+ type: PrimaryPathWsFrameType;
518
+ }>;
519
+ declare function parsePrimaryPathWsFrameInput(value: unknown): ParseResult<PrimaryPathWsFrame>;
520
+ declare function parseWsFrame(value: unknown): ParseResult<WsFrame>;
521
+ declare function createDurableWsFrame(input: DurableWsFrameInput & {
522
+ sentAt?: string;
523
+ }): WsFrame;
524
+ declare function createEphemeralWsFrame(input: {
525
+ type: KnownEphemeralWsFrameType;
526
+ instanceId?: string;
527
+ payload: WsPayloadByType[KnownEphemeralWsFrameType];
528
+ sentAt?: string;
529
+ }): WsFrame;
530
+ type RawPiDiagnosticWsFrameType = (typeof WS_PI_STREAM_TYPES)[keyof typeof WS_PI_STREAM_TYPES];
531
+ declare function mapWorkerEventToWsType(workerEventType: string): RawPiDiagnosticWsFrameType | null;
532
+
533
+ interface AuthMeResponseBody {
534
+ authEnabled: boolean;
535
+ actor: Actor | null;
536
+ }
537
+ interface ProcessListItem {
538
+ process: ProcessInstance;
539
+ projects: ProcessProject[];
540
+ workerLease: WorkerLease | null;
541
+ processDisplayName: string | null;
542
+ }
543
+ type ScheduleMode = "now" | "once" | "cron";
544
+ type ScheduleConfigInput = {
545
+ mode: ScheduleMode;
546
+ runAt?: string | null;
547
+ cronExpression?: string | null;
548
+ };
549
+ interface FutureExecutionBaseSummary {
550
+ id: string;
551
+ kind: "launch" | "action";
552
+ scheduleKind: "once" | "cron";
553
+ processId: string;
554
+ nextRunAt: string;
555
+ cronExpression: string | null;
556
+ title: string;
557
+ subtitle: string;
558
+ status?: "scheduled" | "blocked";
559
+ modelSelection?: DurableModelSelection | null;
560
+ blockedReason?: FutureExecutionBlockReason | null;
561
+ }
562
+ type LauncherModelConfigDefaults = LaunchModelConfigInput;
563
+ interface FutureLaunchSummary extends FutureExecutionBaseSummary {
564
+ kind: "launch";
565
+ launcherId: string;
566
+ launcherLabel: string;
567
+ launchTitle: string | null;
568
+ launcherInput: Record<string, unknown>;
569
+ skillIds: string[];
570
+ modelConfig: LauncherModelConfigDefaults;
571
+ }
572
+ interface FutureActionSummary extends FutureExecutionBaseSummary {
573
+ kind: "action";
574
+ instanceId: string;
575
+ actionId: string;
576
+ actionLabel: string;
577
+ nextTurnModelProfileId: string | null;
578
+ }
579
+ type FutureExecutionSummary = FutureLaunchSummary | FutureActionSummary;
580
+ type ProcessActionFieldDefinition = ActionFormFieldDefinition;
581
+ type ProcessActionFormDefinition = ActionFormDefinition;
582
+ type ProcessActionPreviewSummary = {
583
+ kind: "turn" | "terminal";
584
+ turnId: string | null;
585
+ turnKind: ProcessTurnType | null;
586
+ description: string;
587
+ };
588
+ interface ProcessActionSummary {
589
+ id: string;
590
+ label: string;
591
+ description: string | null;
592
+ preview: ProcessActionPreviewSummary | null;
593
+ supportsScheduling: boolean;
594
+ supportsNextTurnModelOverride: boolean;
595
+ form?: ProcessActionFormDefinition;
596
+ }
597
+ interface ScheduledActionDetail {
598
+ id: string;
599
+ nextRunAt: string;
600
+ actionId: string;
601
+ actionLabel: string;
602
+ input: Record<string, unknown>;
603
+ nextTurnModelProfileId: string | null;
604
+ status?: "scheduled" | "blocked";
605
+ modelSelection?: DurableModelSelection | null;
606
+ blockedReason?: FutureExecutionBlockReason | null;
607
+ action: ProcessActionSummary;
608
+ }
609
+ type ProcessActionModelResolutionSource = ProcessSelectedTurnModelSource | "persisted_selection" | "none";
610
+ interface ProcessActionModelResolutionPreview {
611
+ status: "resolved" | "none" | "error";
612
+ modelProfileId: string | null;
613
+ source: ProcessActionModelResolutionSource | null;
614
+ error: string | null;
615
+ }
616
+ interface ProcessActionWarmPromptCacheContext {
617
+ previousModelProfileId: string;
618
+ compatibleModelProfileIds: readonly string[];
619
+ expiresAt: string;
620
+ }
621
+ interface PromptCacheSwitchResolution {
622
+ switchingModelMayBypassPromptCache: boolean;
623
+ recommendedModelProfileId: string | null;
624
+ }
625
+ declare function resolvePromptCacheSwitch(input: {
626
+ context: ProcessActionWarmPromptCacheContext | null | undefined;
627
+ effectiveModelProfileId: string;
628
+ selectableModelProfileIds?: readonly string[];
629
+ now?: number;
630
+ }): PromptCacheSwitchResolution;
631
+ interface ProcessActionModelPreview {
632
+ kind: "llm_turn" | "not_applicable" | "unavailable";
633
+ turnId: string | null;
634
+ description: string | null;
635
+ resolvedModel?: ProcessActionModelResolutionPreview;
636
+ warmPromptCache?: ProcessActionWarmPromptCacheContext;
637
+ unavailableReason?: "action_not_found" | "action_not_visible" | "invalid_action_input" | "action_failed";
638
+ unavailableMessage?: string | null;
639
+ }
640
+ type ProcessExternalSourceSummary = {
641
+ id: string;
642
+ kind: string;
643
+ externalActionId?: string;
644
+ sourceKind?: string;
645
+ label: string | null;
646
+ description: string | null;
647
+ };
648
+ type ProcessExternalTriggerSummary = ProcessExternalSourceSummary;
649
+ interface ProcessSelectedTurnSummary {
650
+ turnId: string;
651
+ kind: ProcessTurnType;
652
+ description: string;
653
+ commentary: string | null;
654
+ externalTriggers: ProcessExternalSourceSummary[];
655
+ }
656
+ type ModelProfileAvailability = "available" | "unavailable" | "stale";
657
+ type ModelProfileOptionSummary = {
658
+ id: string;
659
+ label: string;
660
+ description: string;
661
+ availability: ModelProfileAvailability;
662
+ safeReason?: string | null;
663
+ checkedAt?: string | null;
664
+ };
665
+ interface ProviderOptionChoiceSummary {
666
+ value: string;
667
+ label: string;
668
+ }
669
+ interface ProviderOptionFieldSummary {
670
+ id: string;
671
+ label: string;
672
+ required: boolean;
673
+ minLength: number | null;
674
+ maxLength: number | null;
675
+ defaultValue: string | null;
676
+ /** Advisory values. Values outside this list can still be valid. */
677
+ choices: readonly ProviderOptionChoiceSummary[];
678
+ }
679
+ interface ModelProviderOptionsResponseBody {
680
+ modelProfileId: string;
681
+ providerId: string;
682
+ fields: readonly ProviderOptionFieldSummary[];
683
+ choicesStatus: "available" | "unavailable";
684
+ choicesUnavailableReason: string | null;
685
+ }
686
+ interface ProcessTurnModelConfigurationView {
687
+ turnId: string;
688
+ description: string;
689
+ pathType: string;
690
+ processConfigModelProfileId: string | null;
691
+ instanceModelProfileId: string | null;
692
+ effectiveConfiguredModelProfileId: string | null;
693
+ source: "instance" | "process_config" | "default";
694
+ }
695
+ type ProcessModelConfigurationIssueView = {
696
+ code: "invalid_turn_configs_json";
697
+ reason: "invalid_json" | "not_object" | "turn_config_not_object";
698
+ turnId?: string;
699
+ };
700
+ interface ProcessModelConfigurationView {
701
+ state: {
702
+ kind: "ready";
703
+ } | {
704
+ kind: "blocked";
705
+ issues: readonly ProcessModelConfigurationIssueView[];
706
+ };
707
+ availableProfiles: readonly ModelProfileOptionSummary[];
708
+ effectiveSelectedTurn: {
709
+ turnId: string;
710
+ description: string;
711
+ modelProfileId: string;
712
+ source: ProcessActionModelResolutionSource;
713
+ } | null;
714
+ defaultModel: {
715
+ processConfigModelProfileId: string | null;
716
+ instanceModelProfileId: string | null;
717
+ effectiveModelProfileId: string | null;
718
+ source: "instance" | "process_config" | "catalog_default" | "none";
719
+ };
720
+ turns: readonly ProcessTurnModelConfigurationView[];
721
+ }
722
+ type ProcessRunToolParameterView = {
723
+ name: string;
724
+ type: string;
725
+ description: string;
726
+ required: boolean;
727
+ };
728
+ type ProcessRunToolView = {
729
+ name: string;
730
+ description: string;
731
+ parameters: readonly ProcessRunToolParameterView[];
732
+ };
733
+ type ProcessRunTurnView = {
734
+ turnId: string;
735
+ description: string;
736
+ pathType: string;
737
+ consumedProducts: readonly string[];
738
+ publishedProducts: readonly string[];
739
+ activePiToolNames: readonly string[];
740
+ outcomeActions: readonly ProcessRunToolView[];
741
+ };
742
+ type ProcessRunDetailsView = {
743
+ systemPrompt: string | null;
744
+ appendSystemPrompt: string | null;
745
+ availablePiToolNames: readonly string[];
746
+ turns: readonly ProcessRunTurnView[];
747
+ };
748
+ interface ProcessLaunchConfigurationParameterView {
749
+ fieldId: string;
750
+ label: string;
751
+ value: string | null;
752
+ }
753
+ interface ProcessLaunchConfigurationProjectView {
754
+ key: string;
755
+ repoLocator: string;
756
+ repoLocatorKind: ProcessProject["repoLocatorKind"];
757
+ baseBranch: string;
758
+ workBranch: string | null;
759
+ externalId: string | null;
760
+ externalUrl: string | null;
761
+ pipelineStatus: string | null;
762
+ }
763
+ interface ProcessLaunchConfigurationView {
764
+ launcherId: string | null;
765
+ launcherLabel: string | null;
766
+ launcherSchemaTitle: string | null;
767
+ paramsParseError: string | null;
768
+ parameters: readonly ProcessLaunchConfigurationParameterView[];
769
+ projects: readonly ProcessLaunchConfigurationProjectView[];
770
+ }
771
+ interface PiSessionUsageSnapshot {
772
+ input: number;
773
+ output: number;
774
+ /** Provider-reported reasoning/thinking tokens. This is a subset of output tokens. */
775
+ reasoning?: number;
776
+ cacheRead: number;
777
+ cacheWrite: number;
778
+ totalTokens: number;
779
+ cost?: {
780
+ input: number;
781
+ output: number;
782
+ cacheRead: number;
783
+ cacheWrite: number;
784
+ total: number;
785
+ };
786
+ }
787
+ type PiSessionTextContentBlock = {
788
+ type: "text";
789
+ text: string;
790
+ };
791
+ type PiSessionThinkingContentBlock = {
792
+ type: "thinking";
793
+ thinking: string;
794
+ redacted?: boolean;
795
+ };
796
+ type PiSessionToolCallContentBlock = {
797
+ type: "toolCall";
798
+ id: string;
799
+ name: string;
800
+ arguments: Record<string, unknown>;
801
+ };
802
+ type PiSessionImageContentBlock = {
803
+ type: "image";
804
+ data: string;
805
+ mimeType: string;
806
+ };
807
+ type PiSessionContentBlock = PiSessionTextContentBlock | PiSessionThinkingContentBlock | PiSessionToolCallContentBlock | PiSessionImageContentBlock;
808
+ interface PiSessionMessageRecord {
809
+ role?: string;
810
+ content?: string | PiSessionContentBlock[];
811
+ toolCallId?: string;
812
+ toolName?: string;
813
+ details?: unknown;
814
+ isError?: boolean;
815
+ usage?: PiSessionUsageSnapshot;
816
+ stopReason?: string;
817
+ errorMessage?: string;
818
+ provider?: string;
819
+ model?: string;
820
+ timestamp?: number;
821
+ }
822
+ interface PiSessionEntry {
823
+ type: string;
824
+ id: string;
825
+ parentId: string | null;
826
+ timestamp: string;
827
+ message?: PiSessionMessageRecord;
828
+ targetId?: string;
829
+ label?: string;
830
+ }
831
+ interface ProcessDiagnosticsData {
832
+ process: ProcessInstance;
833
+ projects: ProcessProject[];
834
+ inputs: ProcessInput[];
835
+ events: ProcessEvent[];
836
+ leafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
837
+ turnRecords: ProcessTurnRecord[];
838
+ turnAnnotations: ProcessTurnAnnotation[];
839
+ workerLease: WorkerLease | null;
840
+ processDisplayName: string | null;
841
+ processGraph: SerializedProcessGraph;
842
+ processFlow: ProcessFlowView;
843
+ piSessionEntries: PiSessionEntry[];
844
+ definesLeafOutcome: boolean;
845
+ selectedTurn?: ProcessSelectedTurnSummary | null;
846
+ scheduledAction?: ScheduledActionDetail | null;
847
+ modelConfiguration: ProcessModelConfigurationView;
848
+ runDetails: ProcessRunDetailsView;
849
+ launchConfiguration: ProcessLaunchConfigurationView;
850
+ actions: ProcessActionSummary[];
851
+ toolRenderers: ToolCallRendererDefinition[];
852
+ }
853
+ interface ProcessDetailData extends ProcessDiagnosticsData {
854
+ primaryPath: PrimaryPathSnapshot;
855
+ }
856
+ interface LauncherModelConfigSchema {
857
+ availableProfiles: readonly ModelProfileOptionSummary[];
858
+ llmTurns: ReadonlyArray<{
859
+ turnId: string;
860
+ description: string;
861
+ }>;
862
+ }
863
+ type LauncherDefaultModelPreview = {
864
+ source: "instance_default" | "process_config_default" | "catalog_default" | "none";
865
+ profile: ModelProfileOptionSummary | null;
866
+ };
867
+ interface LauncherTurnModelConfigPreview {
868
+ turnId: string;
869
+ description: string;
870
+ effective: {
871
+ source: ProcessActionModelResolutionSource;
872
+ profile: ModelProfileOptionSummary | null;
873
+ };
874
+ }
875
+ type LauncherModelConfigPreview = {
876
+ defaultModel: LauncherDefaultModelPreview;
877
+ turns: readonly LauncherTurnModelConfigPreview[];
878
+ };
879
+ type UiLauncherSummary = UiLauncherSummaryBase & {
880
+ modelConfigSchema?: LauncherModelConfigSchema;
881
+ processFlow?: ProcessFlowView;
882
+ };
883
+ type ProcessRetryConfig = {
884
+ launcherId: string;
885
+ title: string | null;
886
+ launcherInput: Record<string, unknown>;
887
+ skillIds: string[];
888
+ modelConfig: LauncherModelConfigDefaults;
889
+ };
890
+ type WatcherLaunchModelSummary = {
891
+ defaultModelProfileId: string | null;
892
+ turnConfigs: Array<{
893
+ turnId: string;
894
+ modelProfileId: string | null;
895
+ }>;
896
+ };
897
+ interface WatcherSummaryBase {
898
+ processId: string;
899
+ processDisplayName: string;
900
+ watcherId: string;
901
+ label: string;
902
+ description: string;
903
+ type: ProcessWatcherType;
904
+ enabled: boolean;
905
+ pollInterval: string;
906
+ configPath: string;
907
+ targetSummary: string;
908
+ launchModel: WatcherLaunchModelSummary;
909
+ }
910
+ interface JiraWatcherSummary extends WatcherSummaryBase {
911
+ type: "jira";
912
+ project: string;
913
+ labels: {
914
+ trigger: string;
915
+ done: string;
916
+ required?: string[];
917
+ forbidden?: string[];
918
+ };
919
+ targetBranchLabelPrefix: string;
920
+ }
921
+ interface GitLabMrWatcherSummary extends WatcherSummaryBase {
922
+ type: "gitlab_mr";
923
+ group: string;
924
+ labels: {
925
+ trigger: string;
926
+ done: string;
927
+ };
928
+ }
929
+ type FilesystemWatcherSummary = WatcherSummaryBase & {
930
+ type: "filesystem";
931
+ filePath: string;
932
+ };
933
+ type WatcherSummary = JiraWatcherSummary | GitLabMrWatcherSummary | FilesystemWatcherSummary;
934
+ interface SkillUsageSummary {
935
+ attachedAllTime: number;
936
+ attachedLast30Days: number;
937
+ invokedAllTime: number;
938
+ invokedLast30Days: number;
939
+ }
940
+ interface SkillRepositorySummary {
941
+ id: string;
942
+ label: string;
943
+ url: string;
944
+ ref: string;
945
+ path: string;
946
+ lastRefreshedAt: string | null;
947
+ error: string | null;
948
+ }
949
+ interface SkillCatalogItem {
950
+ repositoryId: string;
951
+ id: string;
952
+ label: string;
953
+ description: string | null;
954
+ sourcePath: string;
955
+ sourceRevision: string;
956
+ registered: boolean;
957
+ updateAvailable: boolean;
958
+ conflict: boolean;
959
+ stale: boolean;
960
+ usage: SkillUsageSummary;
961
+ }
962
+ type SkillRegistrationKind = "configuration" | "catalog";
963
+ interface InstalledSkillCatalogItem {
964
+ id: string;
965
+ label: string;
966
+ description: string | null;
967
+ activeRevisionId: string;
968
+ activeSourceRevision: string | null;
969
+ registrationKind: SkillRegistrationKind;
970
+ sourceRepositoryId: string | null;
971
+ updateAvailable: boolean;
972
+ usage: SkillUsageSummary;
973
+ }
974
+ interface SkillRevisionSummary {
975
+ id: string;
976
+ sourceRevision: string | null;
977
+ importedAt: string;
978
+ active: boolean;
979
+ }
980
+ interface SkillUsageProcessSummary {
981
+ instanceId: string;
982
+ title: string;
983
+ attachedAt: string;
984
+ invocationCount: number;
985
+ lastInvokedAt: string | null;
986
+ }
987
+ interface SkillCatalogDetail extends SkillCatalogItem {
988
+ skillMarkdown: string;
989
+ processes: SkillUsageProcessSummary[];
990
+ }
991
+ interface InstalledSkillCatalogDetail extends InstalledSkillCatalogItem {
992
+ skillMarkdown: string;
993
+ processes: SkillUsageProcessSummary[];
994
+ revisions: SkillRevisionSummary[];
995
+ }
996
+ type ErrorResponseBody = {
997
+ error?: string | null;
998
+ code?: string | null;
999
+ };
1000
+ type ProcessesListResponseBody = {
1001
+ processes: ProcessListItem[];
1002
+ futureExecutions: FutureExecutionSummary[];
1003
+ };
1004
+ interface ProcessOverviewItem extends ProcessRowSlot {
1005
+ processDisplayName: string | null;
1006
+ /** Nullable durable title before external-id/instance-id display fallback. */
1007
+ processTitle: string | null;
1008
+ initialPromptPreview: string | null;
1009
+ createdAt: string;
1010
+ updatedAt: string;
1011
+ closedAt: string | null;
1012
+ }
1013
+ interface FutureExecutionOverviewItemBase {
1014
+ id: string;
1015
+ scheduleKind: "once" | "cron";
1016
+ processId: string;
1017
+ nextRunAt: string;
1018
+ cronExpression: string | null;
1019
+ title: string;
1020
+ initialPromptPreview: string | null;
1021
+ status?: "scheduled" | "blocked";
1022
+ blockedReason?: FutureExecutionBlockReason | null;
1023
+ }
1024
+ interface FutureLaunchOverviewItem extends FutureExecutionOverviewItemBase {
1025
+ kind: "launch";
1026
+ instanceId: null;
1027
+ launcherId: string;
1028
+ launcherLabel: string;
1029
+ }
1030
+ interface FutureActionOverviewItem extends FutureExecutionOverviewItemBase {
1031
+ kind: "action";
1032
+ instanceId: string;
1033
+ actionId: string;
1034
+ actionLabel: string;
1035
+ }
1036
+ type FutureExecutionOverviewItem = FutureLaunchOverviewItem | FutureActionOverviewItem;
1037
+ interface ProcessesOverviewResponseBody {
1038
+ processes: ProcessOverviewItem[];
1039
+ futureExecutions: FutureExecutionOverviewItem[];
1040
+ /** True when the bounded sidebar response omitted less-recent rows. */
1041
+ truncated: boolean;
1042
+ }
1043
+ interface ProcessBrowsePagination {
1044
+ limit: number;
1045
+ offset: number;
1046
+ total: number;
1047
+ processTotal: number;
1048
+ futureExecutionTotal: number;
1049
+ hasMore: boolean;
1050
+ }
1051
+ interface ProcessBrowseFacets {
1052
+ statusCounts: Record<"all" | "running" | "scheduled" | "needs_attention" | "completed" | "aborted", number>;
1053
+ processTypes: Array<{
1054
+ value: string;
1055
+ label: string;
1056
+ count: number;
1057
+ }>;
1058
+ }
1059
+ type ProcessBrowseItem = {
1060
+ kind: "process";
1061
+ item: ProcessOverviewItem;
1062
+ } | {
1063
+ kind: "future";
1064
+ item: FutureExecutionOverviewItem;
1065
+ };
1066
+ interface ProcessBrowseResponseBody {
1067
+ /** Globally sorted page. The browser must preserve this server-owned order. */
1068
+ items: ProcessBrowseItem[];
1069
+ pagination: ProcessBrowsePagination;
1070
+ facets: ProcessBrowseFacets;
1071
+ }
1072
+ type TurnTraceToolCallSnapshot = Omit<PrimaryPathToolCallSnapshot, "result"> & {
1073
+ resultText: string | null;
1074
+ truncated: boolean;
1075
+ };
1076
+ type TurnPiInputPartRole = "user" | "system" | "unknown";
1077
+ interface TurnPiInputPart {
1078
+ role: TurnPiInputPartRole;
1079
+ text: string;
1080
+ createdAt: string;
1081
+ }
1082
+ interface TurnPiInputSnapshot {
1083
+ parts: TurnPiInputPart[];
1084
+ fullPrompt: string;
1085
+ createdAt: string;
1086
+ userInput?: string | null;
1087
+ }
1088
+ interface TurnTraceSnapshot {
1089
+ assistant: PrimaryPathStreamingAssistantSnapshot;
1090
+ toolCalls: TurnTraceToolCallSnapshot[];
1091
+ traceItems: PrimaryPathTraceItemSnapshot[];
1092
+ usage: TurnUsageSnapshot | null;
1093
+ piInput: TurnPiInputSnapshot | null;
1094
+ }
1095
+ interface TurnTracePreview {
1096
+ turnRecordId: string;
1097
+ assistantTextPreview: string;
1098
+ assistantTextTruncated: boolean;
1099
+ thinkingPreview: string;
1100
+ thinkingPreviewTruncated: boolean;
1101
+ toolCallCount: number;
1102
+ traceItemCount: number;
1103
+ hasReasoningDetails: boolean;
1104
+ usage: TurnUsageSnapshot | null;
1105
+ piInput: {
1106
+ createdAt: string | null;
1107
+ partCount: number;
1108
+ userInputPreview: string | null;
1109
+ } | null;
1110
+ }
1111
+ type ProcessTimelineTurnPresentation = "llm_turn" | "automatic_turn" | "operator_decision" | "external_trigger";
1112
+ interface ProcessTimelineTurnSummary {
1113
+ id: string;
1114
+ turnId: string;
1115
+ turnType: ProcessTurnType;
1116
+ displayTurn: string;
1117
+ outcome: string;
1118
+ summary: string;
1119
+ output: string;
1120
+ turnResultMarkdown: string;
1121
+ pathType: ProcessTurnRecord["pathType"];
1122
+ createdAt: string;
1123
+ presentation: ProcessTimelineTurnPresentation;
1124
+ status: "completed" | "in_progress";
1125
+ modelProfileId: string | null;
1126
+ /** Durable lineage needed by the chronicle rail and input correlation. */
1127
+ attemptNumber: number;
1128
+ parentTurnRecordId: string | null;
1129
+ startedAt: string;
1130
+ endedAt: string | null;
1131
+ actionSource: "ui" | "external" | "scheduled" | null;
1132
+ }
1133
+ type ProcessTimelineInputSummary = Pick<ProcessInput, "id" | "sequence" | "source" | "kind" | "bodyMarkdown" | "receivedAt" | "consumedAt">;
1134
+ interface ProcessExternalTriggerSignal {
1135
+ triggerId: string;
1136
+ state: "error" | "armed" | "triggered" | "waiting";
1137
+ occurredAt: string | null;
1138
+ secondaryDetail: string | null;
1139
+ }
1140
+ interface ProcessTimelineSnapshot {
1141
+ prompt: {
1142
+ text: string | null;
1143
+ createdAt: string | null;
1144
+ };
1145
+ turns: ProcessTimelineTurnSummary[];
1146
+ tracePreviewsByTurnRecordId: Record<string, TurnTracePreview>;
1147
+ inputs: ProcessTimelineInputSummary[];
1148
+ externalTriggerSignals: ProcessExternalTriggerSignal[];
1149
+ }
1150
+ interface CurrentErrorSummary {
1151
+ title: string;
1152
+ summary: string;
1153
+ guidance?: string;
1154
+ technicalDetail?: string | null;
1155
+ }
1156
+ interface CurrentTurnRecoverySummary extends CurrentErrorSummary {
1157
+ turnRecordId: string;
1158
+ defaultContinuePrompt: string;
1159
+ canContinue: boolean;
1160
+ defaultModelProfileId: string | null;
1161
+ providerOptions: Record<string, string>;
1162
+ }
1163
+ interface StartupRecoverySummary extends CurrentErrorSummary {
1164
+ startRecordId: string;
1165
+ kind: "preparation_failed" | "bootstrap_failed";
1166
+ action: "choose_model" | "retry_startup";
1167
+ defaultModelProfileId: string | null;
1168
+ providerOptions: Record<string, string>;
1169
+ }
1170
+ type CurrentProcessErrorSummary = CurrentErrorSummary;
1171
+ interface ProcessUsageEstimateSnapshot {
1172
+ usage: TurnUsageSnapshot;
1173
+ includesLiveTurn: boolean;
1174
+ totalLlmTurnCount: number;
1175
+ coveredTurnCount: number;
1176
+ missingUsageTurnCount: number;
1177
+ missingCostTurnCount: number;
1178
+ isPartial: boolean;
1179
+ }
1180
+ interface PrimaryPathUiSnapshot extends PrimaryPathSnapshot {
1181
+ entryCount: number;
1182
+ entriesOmitted: true;
1183
+ }
1184
+ type ProcessUiSnapshotProcess = Pick<ProcessInstance, "id" | "processId" | "selectedTurnId" | "lifecycleStatus" | "currentExecution" | "planRevision" | "title" | "externalId" | "externalUrl" | "initialDefaultModelProfileId" | "createdAt" | "updatedAt" | "closedAt">;
1185
+ /**
1186
+ * Initial render contract for process detail. Raw process events, inputs,
1187
+ * session entries, projects, and full durable records belong to diagnostics;
1188
+ * this DTO carries only browser-facing projections.
1189
+ */
1190
+ interface ProcessDetailUiSnapshotResponseBody {
1191
+ process: ProcessUiSnapshotProcess;
1192
+ /** Durable requests in Chronicle order; at most one is open for the current turn. */
1193
+ questionRequests: ProcessQuestionRequest[];
1194
+ leafOutcomeSnapshots: ProcessLeafOutcomeSnapshot[];
1195
+ processDisplayName: string | null;
1196
+ processFlow: ProcessFlowView;
1197
+ definesLeafOutcome: boolean;
1198
+ selectedTurn: ProcessSelectedTurnSummary | null;
1199
+ scheduledAction: ScheduledActionDetail | null;
1200
+ modelConfiguration: ProcessModelConfigurationView;
1201
+ runDetails: ProcessRunDetailsView;
1202
+ launchConfiguration: ProcessLaunchConfigurationView;
1203
+ actions: ProcessActionSummary[];
1204
+ toolRenderers: ToolCallRendererDefinition[];
1205
+ primaryPath: PrimaryPathUiSnapshot;
1206
+ timeline: ProcessTimelineSnapshot;
1207
+ instanceTree: ProcessInstanceTreeResponseBody;
1208
+ recovery: CurrentTurnRecoverySummary | null;
1209
+ startupRecovery: StartupRecoverySummary | null;
1210
+ processError: CurrentProcessErrorSummary | null;
1211
+ usageEstimate: ProcessUsageEstimateSnapshot | null;
1212
+ persistedModelSelectionWarning: string | null;
1213
+ session: {
1214
+ signature: string | null;
1215
+ };
1216
+ }
1217
+ type InstanceTreeTurnResultState = "succeeded" | "failed" | "aborted" | "pending";
1218
+ /** Redacted, semantic process history. Pi message/activity categories are never exposed. */
1219
+ interface InstanceTreeNodeSummary {
1220
+ id: string;
1221
+ parentId: string | null;
1222
+ label: string;
1223
+ pathType: "primary" | "root_branch" | "leaf_branch";
1224
+ resultState: InstanceTreeTurnResultState;
1225
+ timestamp: string;
1226
+ }
1227
+ interface InstanceTreeEdgeSummary {
1228
+ id: string;
1229
+ sourceNodeId: string;
1230
+ targetNodeId: string | null;
1231
+ hasContext: boolean;
1232
+ productLabels: readonly string[];
1233
+ actionLabel: string | null;
1234
+ endState: "not_applied" | "completed" | null;
1235
+ }
1236
+ interface ProcessInstanceTreeResponseBody {
1237
+ currentLeafId: string | null;
1238
+ nodes: InstanceTreeNodeSummary[];
1239
+ edges: InstanceTreeEdgeSummary[];
1240
+ }
1241
+ interface TurnReasoningDetailResponseBody {
1242
+ instanceId: string;
1243
+ turnRecordId: string;
1244
+ sessionSignature: string | null;
1245
+ reasoning: TurnTraceSnapshot;
1246
+ }
1247
+ interface SubmitQuestionAnswersRequestBody {
1248
+ draft: QuestionAnswerDraft[];
1249
+ }
1250
+ type QuestionRequestMutationResponseBody = {
1251
+ request: ProcessQuestionRequest;
1252
+ };
1253
+ type FutureExecutionDetailResponseBody = FutureExecutionSummary;
1254
+ type LaunchersResponseBody = {
1255
+ launchers: UiLauncherSummary[];
1256
+ };
1257
+ type WatchersResponseBody = {
1258
+ watchers: WatcherSummary[];
1259
+ };
1260
+ type SkillCatalogDetailResponseBody = {
1261
+ skill: SkillCatalogDetail;
1262
+ };
1263
+ type InstalledSkillCatalogDetailResponseBody = {
1264
+ skill: InstalledSkillCatalogDetail;
1265
+ };
1266
+ type SkillsCatalogResponseBody = {
1267
+ repositories: SkillRepositorySummary[];
1268
+ availableSkills: SkillCatalogItem[];
1269
+ installedSkills: InstalledSkillCatalogItem[];
1270
+ };
1271
+ interface LauncherDefaultsResponseBody {
1272
+ defaults: Record<string, unknown>;
1273
+ title: string | null;
1274
+ modelConfig: LauncherModelConfigDefaults;
1275
+ warnings?: LauncherValidationError[];
1276
+ }
1277
+ type LauncherOptionsResponseBody = {
1278
+ options: Record<string, readonly FormFieldOptionDefinition[]>;
1279
+ };
1280
+ type LauncherRecentValuesResponseBody = {
1281
+ values: Record<string, readonly string[]>;
1282
+ };
1283
+ type LauncherModelConfigPreviewResponseBody = {
1284
+ preview: LauncherModelConfigPreview;
1285
+ };
1286
+ interface LauncherMutationResponseBody {
1287
+ kind?: "scheduled";
1288
+ process?: ProcessInstance | null;
1289
+ futureExecution?: FutureLaunchSummary | null;
1290
+ projects?: ProcessProject[];
1291
+ errors?: LauncherValidationError[];
1292
+ error?: string | null;
1293
+ }
1294
+ type ScheduledActionMutationResponseBody = {
1295
+ kind?: "scheduled";
1296
+ scheduledAction?: ScheduledActionDetail | null;
1297
+ error?: string | null;
1298
+ };
1299
+ type ProcessRetryConfigResponseBody = ProcessRetryConfig;
1300
+ type ProcessActionModelPreviewResponseBody = {
1301
+ preview: ProcessActionModelPreview;
1302
+ };
1303
+ type ProcessDiagnosticsResponseBody = ProcessDiagnosticsData;
1304
+ type PrimaryPathSnapshotResponseBody = PrimaryPathSnapshot;
1305
+ type CronPreviewResponseBody = {
1306
+ nextRunAt: string;
1307
+ };
1308
+ type ParsedLauncherRequestBody = {
1309
+ title: string | null;
1310
+ titleProvided: boolean;
1311
+ launcherInput: Record<string, unknown>;
1312
+ launcherInputProvided: boolean;
1313
+ skillIds?: string[];
1314
+ modelConfig: LauncherModelConfigDefaults;
1315
+ modelConfigProvided: boolean;
1316
+ schedule: ParsedScheduleRequest;
1317
+ scheduleProvided: boolean;
1318
+ };
1319
+ type ParsedActionRequestBody = {
1320
+ input: Record<string, unknown>;
1321
+ inputProvided: boolean;
1322
+ nextTurnModelProfileId?: string | null;
1323
+ nextTurnModelProfileIdProvided: boolean;
1324
+ schedule: ParsedScheduleRequest;
1325
+ scheduleProvided: boolean;
1326
+ };
1327
+ declare const futureLaunchPayloadInputSchema: v.ObjectSchema<{
1328
+ readonly launcherInput: v.OptionalSchema<v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>, undefined>;
1329
+ readonly modelConfig: v.OptionalSchema<v.UnknownSchema, undefined>;
1330
+ readonly actor: v.OptionalSchema<v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>, undefined>;
1331
+ readonly launchPlan: v.ObjectSchema<{
1332
+ readonly launcherId: v.StringSchema<undefined>;
1333
+ readonly processId: v.StringSchema<undefined>;
1334
+ readonly handoffDedupKey: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1335
+ readonly processInput: v.ObjectSchema<{
1336
+ readonly processId: v.StringSchema<undefined>;
1337
+ readonly selectedTurnId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1338
+ readonly lifecycleStatus: v.PicklistSchema<readonly ["discovered", "active", "waiting", "error", "completed", "aborted"], undefined>;
1339
+ readonly title: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1340
+ readonly externalId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1341
+ readonly externalUrl: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1342
+ readonly metadata: v.OptionalSchema<v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>, undefined>;
1343
+ readonly defaultModelProfileId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1344
+ readonly turnConfigsJson: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1345
+ readonly selectedTurnModelProfileId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1346
+ readonly selectedTurnModelKind: v.OptionalSchema<v.NullableSchema<v.PicklistSchema<["explicit", "inherited"], undefined>, undefined>, undefined>;
1347
+ readonly selectedTurnModelSource: v.OptionalSchema<v.NullableSchema<v.PicklistSchema<["action_override", "launch_override", "instance_turn_config", "process_config_turn", "instance_default", "process_config_default", "catalog_default", "legacy_persisted"], undefined>, undefined>, undefined>;
1348
+ readonly paramsJson: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1349
+ readonly stateJson: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1350
+ }, undefined>;
1351
+ readonly titleSourceFields: v.OptionalSchema<v.NullableSchema<v.ArraySchema<v.ObjectSchema<{
1352
+ readonly label: v.StringSchema<undefined>;
1353
+ readonly value: v.StringSchema<undefined>;
1354
+ }, undefined>, undefined>, undefined>, undefined>;
1355
+ readonly projectInputs: v.OptionalSchema<v.NullableSchema<v.ArraySchema<v.ObjectSchema<{
1356
+ readonly key: v.StringSchema<undefined>;
1357
+ readonly repoLocator: v.StringSchema<undefined>;
1358
+ readonly baseBranch: v.StringSchema<undefined>;
1359
+ readonly workBranch: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1360
+ readonly externalId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1361
+ readonly externalUrl: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1362
+ readonly metadata: v.OptionalSchema<v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>, undefined>;
1363
+ }, undefined>, undefined>, undefined>, undefined>;
1364
+ readonly startTurnId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1365
+ }, undefined>;
1366
+ readonly selectedSkillIds: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
1367
+ readonly resourceSelections: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
1368
+ readonly skillId: v.StringSchema<undefined>;
1369
+ readonly revisionId: v.StringSchema<undefined>;
1370
+ }, undefined>, undefined>, undefined>;
1371
+ }, undefined>;
1372
+ declare const futureActionPayloadInputSchema: v.ObjectSchema<{
1373
+ readonly input: v.OptionalSchema<v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>, undefined>;
1374
+ readonly nextTurnModelProfileId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1375
+ readonly actionLabel: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1376
+ readonly actor: v.OptionalSchema<v.NullableSchema<v.CustomSchema<Record<string, unknown>, v.ErrorMessage<v.CustomIssue> | undefined>, undefined>, undefined>;
1377
+ }, undefined>;
1378
+ type ParsedScheduleRequest = {
1379
+ mode: "now";
1380
+ } | {
1381
+ mode: "once";
1382
+ runAt: string;
1383
+ } | {
1384
+ mode: "cron";
1385
+ cronExpression: string;
1386
+ };
1387
+ type ValidatedScheduleRequest = {
1388
+ mode: "now";
1389
+ nextRunAt: null;
1390
+ cronExpression: null;
1391
+ } | {
1392
+ mode: "once";
1393
+ nextRunAt: string;
1394
+ cronExpression: null;
1395
+ } | {
1396
+ mode: "cron";
1397
+ nextRunAt: string;
1398
+ cronExpression: string;
1399
+ };
1400
+ type FutureLaunchPayloadBase = v.InferOutput<typeof futureLaunchPayloadInputSchema>;
1401
+ type FutureActionPayloadBase = v.InferOutput<typeof futureActionPayloadInputSchema>;
1402
+ declare const normalizeFutureLaunchPayload: (payload: FutureLaunchPayloadBase) => {
1403
+ launcherInput: {
1404
+ [x: string]: unknown;
1405
+ };
1406
+ modelConfig: {
1407
+ defaultModelProfileId: string | null;
1408
+ turnConfigs: InstanceTurnConfigMap;
1409
+ };
1410
+ actor: Actor | null;
1411
+ selectedSkillIds: string[];
1412
+ resourceSelections: {
1413
+ skillId: string;
1414
+ revisionId: string;
1415
+ }[];
1416
+ launchPlan: {
1417
+ launcherId: string;
1418
+ processId: string;
1419
+ handoffDedupKey: string | null;
1420
+ processInput: {
1421
+ processId: string;
1422
+ selectedTurnId: string | null;
1423
+ lifecycleStatus: "error" | "completed" | "aborted" | "waiting" | "discovered" | "active";
1424
+ title: string | null;
1425
+ externalId: string | null;
1426
+ externalUrl: string | null;
1427
+ metadata: {
1428
+ [x: string]: unknown;
1429
+ } | null;
1430
+ defaultModelProfileId: string | null;
1431
+ turnConfigsJson: string | null;
1432
+ selectedTurnModelProfileId: string | null;
1433
+ selectedTurnModelKind: "explicit" | "inherited" | null;
1434
+ selectedTurnModelSource: "action_override" | "launch_override" | "instance_turn_config" | "process_config_turn" | "instance_default" | "process_config_default" | "catalog_default" | "legacy_persisted" | null;
1435
+ paramsJson: string | null;
1436
+ stateJson: string | null;
1437
+ };
1438
+ titleSourceFields: {
1439
+ label: string;
1440
+ value: string;
1441
+ }[];
1442
+ projectInputs: {
1443
+ key: string;
1444
+ repoLocator: string;
1445
+ baseBranch: string;
1446
+ workBranch: string | null;
1447
+ externalId: string | null;
1448
+ externalUrl: string | null;
1449
+ metadata: {
1450
+ [x: string]: unknown;
1451
+ } | null;
1452
+ }[];
1453
+ startTurnId: string | null;
1454
+ };
1455
+ };
1456
+ declare const normalizeFutureActionPayload: (payload: FutureActionPayloadBase) => {
1457
+ input: {
1458
+ [x: string]: unknown;
1459
+ };
1460
+ nextTurnModelProfileId: string | null;
1461
+ actionLabel: string | null;
1462
+ actor: Actor | null;
1463
+ };
1464
+ type FutureLaunchPayload = ReturnType<typeof normalizeFutureLaunchPayload>;
1465
+ type FutureActionPayload = ReturnType<typeof normalizeFutureActionPayload>;
1466
+ declare function parseScheduleRequestInput(value: unknown): ParseResult<ParsedScheduleRequest>;
1467
+ declare function validateScheduleRequestInput(schedule: ParsedScheduleRequest, allowedModes: readonly ScheduleMode[], options?: {
1468
+ now?: () => Date;
1469
+ resolveCronNextRunAt?: (expression: string, now: Date) => string;
1470
+ }): ParseResult<ValidatedScheduleRequest>;
1471
+ declare function parseLauncherTurnConfigsJson(turnConfigsJson: string | null | undefined): ParseResult<InstanceTurnConfigMap>;
1472
+ declare function parseLauncherInputJson(launcherInputJson: string | null | undefined, context?: string): ParseResult<Record<string, unknown>>;
1473
+ declare function parseLauncherModelConfigInput(value: unknown, context?: string): ParseResult<LaunchModelConfigInput>;
1474
+ declare function parseLauncherRequestBody(value: unknown): ParseResult<ParsedLauncherRequestBody>;
1475
+ declare function parseActionRequestBody(value: unknown): ParseResult<ParsedActionRequestBody>;
1476
+ declare function serializeFutureLaunchPayload(payload: unknown): string;
1477
+ declare function parseFutureLaunchPayloadObject(value: unknown, context?: string): ParseResult<FutureLaunchPayload>;
1478
+ declare function parseFutureLaunchPayloadJson(payloadJson: string): ParseResult<FutureLaunchPayload>;
1479
+ declare function serializeFutureActionPayload(payload: unknown): string;
1480
+ declare function parseFutureActionPayloadObject(value: unknown, context?: string): ParseResult<FutureActionPayload>;
1481
+ declare function parseFutureActionPayloadJson(payloadJson: string): ParseResult<FutureActionPayload>;
1482
+
1483
+ export { type ParsedScheduleRequest as $, type AuthMeResponseBody as A, type KnownWsFrameType as B, type CronPreviewResponseBody as C, type DurableWsFrameInput as D, type EphemeralWsFrameInput as E, type FutureExecutionSummary as F, type GitLabMrWatcherSummary as G, type LauncherDefaultsResponseBody as H, type InstalledSkillCatalogDetail as I, type JiraWatcherSummary as J, type KnownDurableWsFrameType as K, type LauncherDefaultModelPreview as L, type LauncherModelConfigDefaults as M, type LauncherModelConfigPreview as N, type LauncherModelConfigPreviewResponseBody as O, type PrimaryPathStreamingAssistantSnapshot as P, type LauncherModelConfigSchema as Q, type LauncherMutationResponseBody as R, type LauncherOptionsResponseBody as S, type LauncherRecentValuesResponseBody as T, type UsageSnapshot as U, type LauncherTurnModelConfigPreview as V, type LaunchersResponseBody as W, type ModelProfileAvailability as X, type ModelProfileOptionSummary as Y, type ModelProviderOptionsResponseBody as Z, type ParseResult as _, type FutureExecutionOverviewItem as a, type ProviderOptionChoiceSummary as a$, type PiSessionContentBlock as a0, type PiSessionEntry as a1, type PiSessionImageContentBlock as a2, type PiSessionMessageRecord as a3, type PiSessionTextContentBlock as a4, type PiSessionThinkingContentBlock as a5, type PiSessionToolCallContentBlock as a6, type PiSessionUsageSnapshot as a7, type PrimaryPathDetailRailSnapshot as a8, type PrimaryPathEntrySnapshot as a9, type ProcessDiagnosticsResponseBody as aA, type ProcessExternalSourceSummary as aB, type ProcessExternalTriggerSignal as aC, type ProcessExternalTriggerSummary as aD, type ProcessInstanceTreeResponseBody as aE, type ProcessLaunchConfigurationParameterView as aF, type ProcessLaunchConfigurationProjectView as aG, type ProcessLaunchConfigurationView as aH, type ProcessListItem as aI, type ProcessModelConfigurationIssueView as aJ, type ProcessModelConfigurationView as aK, type ProcessOverviewItem as aL, type ProcessRetryConfig as aM, type ProcessRetryConfigResponseBody as aN, type ProcessRunDetailsView as aO, type ProcessRunToolParameterView as aP, type ProcessRunToolView as aQ, type ProcessRunTurnView as aR, type ProcessSelectedTurnSummary as aS, type ProcessTimelineInputSummary as aT, type ProcessTimelineSnapshot as aU, type ProcessTurnModelConfigurationView as aV, type ProcessUiSnapshotProcess as aW, type ProcessUsageEstimateSnapshot as aX, type ProcessesListResponseBody as aY, type ProcessesOverviewResponseBody as aZ, type PromptCacheSwitchResolution as a_, type PrimaryPathOperationalTraceSeverity as aa, type PrimaryPathSnapshot as ab, type PrimaryPathSnapshotResponseBody as ac, type PrimaryPathThinkingTraceItemSnapshot as ad, type PrimaryPathToolCallTraceItemSnapshot as ae, type PrimaryPathTurnStateSnapshot as af, type PrimaryPathUiSnapshot as ag, type PrimaryPathWsFrame as ah, type PrimaryPathWsFrameType as ai, type ProcessActionFieldDefinition as aj, type ProcessActionFormDefinition as ak, type ProcessActionModelPreview as al, type ProcessActionModelPreviewResponseBody as am, type ProcessActionModelResolutionPreview as an, type ProcessActionModelResolutionSource as ao, type ProcessActionPreviewSummary as ap, type ProcessActionSummary as aq, type ProcessActionWarmPromptCacheContext as ar, type ProcessAttentionTarget as as, type ProcessBrowseFacets as at, type ProcessBrowseItem as au, type ProcessBrowsePagination as av, type ProcessBrowseResponseBody as aw, type ProcessDetailData as ax, type ProcessDetailUiSnapshotResponseBody as ay, type ProcessDiagnosticsData as az, type PrimaryPathToolCallSnapshot as b, parseScheduleRequestInput as b$, type ProviderOptionFieldSummary as b0, type QuestionRequestMutationResponseBody as b1, type RawPiDiagnosticWsFrameType as b2, type ScheduleConfigInput as b3, type ScheduleMode as b4, type ScheduledActionDetail as b5, type ScheduledActionMutationResponseBody as b6, type SkillCatalogDetail as b7, type SkillCatalogDetailResponseBody as b8, type SkillCatalogItem as b9, type WatchersResponseBody as bA, type WsDurability as bB, type WsDurabilityByType as bC, type WsFrame as bD, type WsFrameOfType as bE, type WsPayloadByType as bF, cloneUsageSnapshot as bG, createDurableWsFrame as bH, createEphemeralWsFrame as bI, err as bJ, mapWorkerEventToWsType as bK, mergeUsageSnapshots as bL, normalizeUsageSnapshot as bM, nullableStringSchema as bN, ok as bO, optionalNullableStringSchema as bP, parseActionRequestBody as bQ, parseFutureActionPayloadJson as bR, parseFutureActionPayloadObject as bS, parseFutureLaunchPayloadJson as bT, parseFutureLaunchPayloadObject as bU, parseLauncherInputJson as bV, parseLauncherModelConfigInput as bW, parseLauncherRequestBody as bX, parseLauncherTurnConfigsJson as bY, parseLiteral as bZ, parsePrimaryPathWsFrameInput as b_, type SkillRegistrationKind as ba, type SkillRepositorySummary as bb, type SkillRevisionSummary as bc, type SkillUsageProcessSummary as bd, type SkillUsageSummary as be, type SkillsCatalogResponseBody as bf, type StartupRecoverySummary as bg, type SubmitQuestionAnswersRequestBody as bh, type TurnPiInputPart as bi, type TurnPiInputPartRole as bj, type TurnPiInputSnapshot as bk, type TurnReasoningDetailResponseBody as bl, type TurnTracePreview as bm, type TurnTraceSnapshot as bn, type TurnTraceToolCallSnapshot as bo, type TurnUsageSnapshot as bp, type UiLauncherSummary as bq, type UsageCostSnapshot as br, WS_FRAME_DURABILITY as bs, WS_PI_STREAM_TYPES as bt, WS_PRIMARY_PATH_TYPES as bu, WS_PROCESS_TYPES as bv, WS_PROTOCOL_VERSION as bw, type WatcherLaunchModelSummary as bx, type WatcherSummary as by, type WatcherSummaryBase as bz, type PrimaryPathTraceItemSnapshot as c, parseSchema as c0, parseWsFrame as c1, resolvePromptCacheSwitch as c2, serializeFutureActionPayload as c3, serializeFutureLaunchPayload as c4, unknownRecordSchema as c5, validateScheduleRequestInput as c6, type PrimaryPathOperationalTraceItemSnapshot as d, type PrimaryPathActiveTurnSnapshot as e, type ProcessTimelineTurnSummary as f, type ProcessTimelineTurnPresentation as g, type CurrentErrorSummary as h, type CurrentProcessErrorSummary as i, type CurrentTurnRecoverySummary as j, type ErrorResponseBody as k, type FilesystemWatcherSummary as l, type FutureActionOverviewItem as m, type FutureActionPayload as n, type FutureActionSummary as o, type FutureExecutionBaseSummary as p, type FutureExecutionDetailResponseBody as q, type FutureLaunchOverviewItem as r, type FutureLaunchPayload as s, type FutureLaunchSummary as t, type InstalledSkillCatalogDetailResponseBody as u, type InstalledSkillCatalogItem as v, type InstanceTreeEdgeSummary as w, type InstanceTreeNodeSummary as x, type InstanceTreeTurnResultState as y, type KnownEphemeralWsFrameType as z };