@leitwerk-dev/worker-protocol 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{chunk-DVN32ANP.js → chunk-VR7BWTD7.js} +5 -1
  2. package/dist/chunk-VR7BWTD7.js.map +1 -0
  3. package/dist/docker-config.d.ts +16 -0
  4. package/dist/docker-config.d.ts.map +1 -1
  5. package/dist/index.d.ts +6 -5
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +41 -24
  8. package/dist/index.js.map +1 -1
  9. package/dist/ipc-codec.d.ts +22 -0
  10. package/dist/ipc-codec.d.ts.map +1 -1
  11. package/dist/ipc-decode.d.ts +7 -0
  12. package/dist/ipc-decode.d.ts.map +1 -1
  13. package/dist/ipc-messages.d.ts +286 -18
  14. package/dist/ipc-messages.d.ts.map +1 -1
  15. package/dist/pi-resource-bundle.d.ts +13 -2
  16. package/dist/pi-resource-bundle.d.ts.map +1 -1
  17. package/dist/pi-resource-manifest.d.ts +35 -1
  18. package/dist/pi-resource-manifest.d.ts.map +1 -1
  19. package/dist/testing.d.ts +2 -8
  20. package/dist/testing.d.ts.map +1 -1
  21. package/dist/worker-api-version.d.ts +1 -0
  22. package/dist/worker-api-version.d.ts.map +1 -1
  23. package/dist/worker-ipc-transport.d.ts +7 -0
  24. package/dist/worker-ipc-transport.d.ts.map +1 -1
  25. package/dist/worker-result-image-public.d.ts +2 -0
  26. package/dist/worker-result-image-public.d.ts.map +1 -0
  27. package/dist/worker-result-image-public.js +7 -0
  28. package/dist/worker-result-image-public.js.map +1 -0
  29. package/dist/worker-result-image.d.ts +22 -0
  30. package/dist/worker-result-image.d.ts.map +1 -1
  31. package/dist/worker-result-image.js +1 -1
  32. package/dist/worker-session-snapshot.d.ts +5 -0
  33. package/dist/worker-session-snapshot.d.ts.map +1 -1
  34. package/package.json +6 -6
  35. package/src/docker-config.ts +12 -0
  36. package/src/index.ts +62 -5
  37. package/src/ipc-codec.ts +40 -6
  38. package/src/ipc-decode.ts +15 -2
  39. package/src/ipc-messages.ts +314 -25
  40. package/src/pi-resource-bundle.ts +13 -2
  41. package/src/pi-resource-manifest.ts +35 -1
  42. package/src/testing.ts +2 -11
  43. package/src/worker-api-version.ts +1 -0
  44. package/src/worker-ipc-transport.ts +7 -0
  45. package/src/worker-result-image-public.ts +1 -0
  46. package/src/worker-result-image.ts +25 -1
  47. package/src/worker-session-snapshot.ts +5 -0
  48. package/dist/chunk-DVN32ANP.js.map +0 -1
@@ -3,397 +3,665 @@ import type { ConfigSnapshot } from "@leitwerk-dev/protocol/config-snapshot";
3
3
  import type { InferOutput } from "valibot";
4
4
  import type { dockerRegistryCredentialSchema } from "./docker-config.js";
5
5
  import { type IpcEnvelope } from "./ipc-codec.js";
6
+ /** @internal */
6
7
  export interface ProcessInstanceSnapshot {
8
+ /** @internal */
7
9
  id?: string;
10
+ /** @internal */
8
11
  processId?: string;
12
+ /** @internal */
9
13
  selectedTurnId?: string | null;
14
+ /** @internal */
10
15
  lifecycleStatus?: ProcessLifecycleStatus;
16
+ /** @internal */
11
17
  currentExecution?: CurrentExecutionRef;
18
+ /** @internal */
12
19
  planRevision?: number;
20
+ /** @internal */
13
21
  title?: string | null;
22
+ /** @internal */
14
23
  externalId?: string | null;
24
+ /** @internal */
15
25
  externalUrl?: string | null;
26
+ /** @internal */
16
27
  metadata?: Record<string, unknown> | null;
28
+ /** @internal */
17
29
  defaultModelProfileId?: string | null;
30
+ /** @internal */
18
31
  turnConfigsJson?: string | null;
32
+ /** @internal */
19
33
  selectedTurnModelProfileId?: string | null;
34
+ /** @internal */
20
35
  paramsJson?: string | null;
36
+ /** @internal */
21
37
  stateJson?: string | null;
38
+ /** @internal */
22
39
  createdAt?: string;
40
+ /** @internal */
23
41
  updatedAt?: string;
24
42
  }
43
+ /** @internal */
25
44
  export interface ProcessProjectSnapshot {
45
+ /** @internal */
26
46
  id?: string;
47
+ /** @internal */
27
48
  instanceId?: string;
49
+ /** @internal */
28
50
  key: string;
51
+ /** @internal */
29
52
  repoLocator: string;
53
+ /** @internal */
30
54
  repoLocatorKind?: "remote_url" | "local_path";
55
+ /** @internal */
31
56
  baseBranch: string;
57
+ /** @internal */
32
58
  workBranch?: string | null;
59
+ /** @internal */
33
60
  externalId?: string | null;
61
+ /** @internal */
34
62
  externalUrl?: string | null;
63
+ /** @internal */
35
64
  metadata?: Record<string, unknown> | null;
65
+ /** @internal */
36
66
  pipelineStatus?: string | null;
67
+ /** @internal */
37
68
  createdAt?: string;
69
+ /** @internal */
38
70
  updatedAt?: string;
39
71
  }
72
+ /** @internal */
40
73
  export interface InputDelivery {
74
+ /** @internal */
41
75
  inputId: string;
76
+ /** @internal */
42
77
  sequence: number;
78
+ /** @internal */
43
79
  source: string;
80
+ /** @internal */
44
81
  kind: string;
82
+ /** @internal */
45
83
  target: ProcessInputTarget | null;
84
+ /** @internal */
46
85
  receivedAt: string;
86
+ /** @internal */
47
87
  bodyMarkdown: string;
48
88
  }
89
+ /** @internal */
49
90
  export interface WorkerRuntimeContextSnapshot {
91
+ /** @internal */
50
92
  processSnapshot: ProcessInstanceSnapshot;
93
+ /** @internal */
51
94
  projectSnapshots: ProcessProjectSnapshot[];
95
+ /** @internal */
52
96
  turnResultMarkdownBySemanticRef?: Partial<Record<ProcessSemanticEntryRefKey, string>>;
97
+ /** @internal */
53
98
  turnResultMarkdownByProduct?: Record<string, string>;
54
99
  }
100
+ /** @internal */
55
101
  export interface WorkerCredentialMaterial {
102
+ /** @internal */
56
103
  providerId: string;
57
- /** Null for generated credentials that are materialized but never synchronized. */
104
+ /** Null for generated credentials that are materialized but never synchronized. @internal */
58
105
  revision: number | null;
59
- /** Secret payload. This type is valid only in worker.start and credential-update frames. */
106
+ /** Secret payload. This type is valid only in worker.start and credential-update frames. @internal */
60
107
  values: Record<string, string>;
61
108
  }
109
+ /** @internal */
62
110
  export interface WorkerGitSshCredential {
111
+ /** @internal */
63
112
  projectKey: string;
113
+ /** @internal */
64
114
  kind: "git_ssh";
115
+ /** @internal */
65
116
  credentialRef: string;
66
- /** Secret values; valid only while preparing worker.start. */
117
+ /** Secret values; valid only while preparing worker.start. @internal */
67
118
  privateKey: string;
119
+ /** @internal */
68
120
  knownHosts: string;
69
121
  }
122
+ /** @internal */
70
123
  export interface WorkerGitHttpsCredential {
124
+ /** @internal */
71
125
  projectKey: string;
126
+ /** @internal */
72
127
  kind: "git_https";
128
+ /** @internal */
73
129
  credentialRef: string;
74
- /** Exact non-secret HTTPS clone URL authorized by the server. */
130
+ /** Exact non-secret HTTPS clone URL authorized by the server. @internal */
75
131
  repositoryUrl: string;
132
+ /** @internal */
76
133
  username: string;
77
- /** Secret; only delivered through authenticated worker.start. */
134
+ /** Secret; only delivered through authenticated worker.start. @internal */
78
135
  password: string;
79
136
  }
137
+ /** @internal */
80
138
  export type WorkerRepositoryCredential = WorkerGitSshCredential | WorkerGitHttpsCredential;
81
- /** Secret material allowed only in authenticated worker.start, never snapshots or exports. */
139
+ /** Secret material allowed only in authenticated worker.start, never snapshots or exports. @internal */
82
140
  export interface WorkerDockerRegistryCredential extends InferOutput<typeof dockerRegistryCredentialSchema> {
83
141
  }
142
+ /** @internal */
84
143
  export interface LlmWorkerStartBootstrap {
144
+ /** @internal */
85
145
  kind: "llm";
146
+ /** @internal */
86
147
  resourceBundle: {
148
+ /** @internal */
87
149
  digest: string;
88
- /** Present for a newly assembled bundle; omitted when the worker can reuse its process volume. */
150
+ /** Present for a newly assembled bundle; omitted when the worker can reuse its process volume. @internal */
89
151
  archiveBase64?: string;
90
152
  };
153
+ /** @internal */
91
154
  credential: WorkerCredentialMaterial | null;
92
155
  }
156
+ /** @internal */
93
157
  export interface AutomaticWorkerStartBootstrap {
158
+ /** @internal */
94
159
  kind: "automatic";
95
160
  }
161
+ /** @internal */
96
162
  export type WorkerRuntimeSettingsSnapshot = ConfigSnapshot["workers"];
163
+ /** @internal */
97
164
  export interface DevelopmentToolsStartConfig {
165
+ /** @internal */
98
166
  runner: "local" | "isolated";
167
+ /** @internal */
99
168
  miseCommand: string;
169
+ /** @internal */
100
170
  installTimeoutMs: number;
171
+ /** @internal */
101
172
  processStorageRoot: string;
102
173
  }
174
+ /** @internal */
103
175
  export interface IntegrationToolDeclaration {
176
+ /** @internal */
104
177
  name: string;
178
+ /** @internal */
105
179
  description: string;
180
+ /** @internal */
106
181
  parameters: Record<string, unknown>;
107
182
  }
183
+ /** @internal */
108
184
  interface WorkerStartPayloadBase extends WorkerRuntimeContextSnapshot {
185
+ /** @internal */
109
186
  workerLeaseId: string;
187
+ /** @internal */
110
188
  turnStart: TurnStartRecord;
111
189
  /**
112
190
  * The immutable pre-acceptance tree plan from the lease that first accepted
113
191
  * this start. It is supplied only when a replacement resumes a running turn.
114
192
  */
193
+ /** @internal */
115
194
  acceptedPreparedStart?: PreparedTurnStart | null;
195
+ /** @internal */
116
196
  pendingInputs: InputDelivery[];
197
+ /** @internal */
117
198
  treePaths: {
199
+ /** @internal */
118
200
  primaryTreeFile: string;
201
+ /** @internal */
119
202
  workspaceRoot: string;
120
- /** Process-scoped persistent storage for immutable Pi resource bundles. */
203
+ /** Process-scoped persistent storage for immutable Pi resource bundles. @internal */
121
204
  piResourceBundlesDir: string;
122
205
  };
206
+ /** @internal */
123
207
  resume: boolean;
208
+ /** @internal */
124
209
  resumeLeafEntryId?: string | null;
125
- /** Durable non-secret preparation checkpoint reused by a replacement or Continue start. */
210
+ /** Durable non-secret preparation checkpoint reused by a replacement or Continue start. @internal */
126
211
  llmPreparation?: {
212
+ /** @internal */
127
213
  sourceTurnRecordId: string;
214
+ /** @internal */
128
215
  data: unknown;
129
216
  };
130
- /** Fresh secret material resolved for this physical worker start only. */
217
+ /** Fresh secret material resolved for this physical worker start only. @internal */
131
218
  repositoryCredentials?: WorkerRepositoryCredential[];
219
+ /** @internal */
132
220
  dockerRegistryCredentials?: WorkerDockerRegistryCredential[];
133
- /** Non-secret lifecycle settings supplied to every worker bootstrap type. */
221
+ /** Non-secret lifecycle settings supplied to every worker bootstrap type. @internal */
134
222
  workerRuntimeSettings?: WorkerRuntimeSettingsSnapshot;
135
- /** Non-secret mise adapter settings. Ignored unless the process opts in. */
223
+ /** Non-secret mise adapter settings. Ignored unless the process opts in. @internal */
136
224
  developmentTools?: DevelopmentToolsStartConfig;
137
- /** Non-secret declarations authorized for the selected LLM turn. */
225
+ /** Non-secret declarations authorized for the selected LLM turn. @internal */
138
226
  integrationTools?: IntegrationToolDeclaration[];
139
227
  }
228
+ /** @internal */
140
229
  export type WorkerStartPayload = (WorkerStartPayloadBase & {
230
+ /** @internal */
141
231
  bootstrap: LlmWorkerStartBootstrap;
232
+ /** @internal */
142
233
  configSnapshot: ConfigSnapshot;
143
234
  }) | (WorkerStartPayloadBase & {
235
+ /** @internal */
144
236
  bootstrap: AutomaticWorkerStartBootstrap;
145
237
  });
238
+ /** @internal */
146
239
  export interface InputBatchPayload {
240
+ /** @internal */
147
241
  inputs: InputDelivery[];
148
242
  }
243
+ /** @internal */
149
244
  export interface WorkerStopPayload {
245
+ /** @internal */
150
246
  reason: string;
151
247
  }
248
+ /** @internal */
152
249
  export interface WorkerAbortTurnPayload {
250
+ /** @internal */
153
251
  reason: string;
154
252
  }
253
+ /** @internal */
155
254
  export interface WorkerTurnStartAcceptedPayload {
255
+ /** @internal */
156
256
  startRecordId: string;
257
+ /** @internal */
157
258
  turnRecordId: string;
158
259
  }
260
+ /** @internal */
159
261
  export interface WorkerTurnTerminalRecordedPayload {
262
+ /** @internal */
160
263
  turnRecordId: string;
161
264
  }
265
+ /** @internal */
162
266
  export interface WorkerQuestionResponsePayload {
267
+ /** @internal */
163
268
  turnRecordId: string;
269
+ /** @internal */
164
270
  toolCallId: string;
271
+ /** @internal */
165
272
  answers: string[];
166
273
  }
274
+ /** @internal */
167
275
  export interface WorkerQuestionRequestedPayload {
276
+ /** @internal */
168
277
  turnRecordId: string;
278
+ /** @internal */
169
279
  toolCallId: string;
280
+ /** @internal */
170
281
  questions: NormalizedQuestion[];
171
282
  }
283
+ /** @internal */
172
284
  export interface WorkerIntegrationToolRequestPayload {
285
+ /** @internal */
173
286
  turnRecordId: string;
287
+ /** @internal */
174
288
  toolCallId: string;
289
+ /** @internal */
175
290
  toolName: string;
291
+ /** @internal */
176
292
  args: Record<string, unknown>;
177
293
  }
294
+ /** @internal */
178
295
  export interface WorkerIntegrationToolCancelPayload {
296
+ /** @internal */
179
297
  turnRecordId: string;
298
+ /** @internal */
180
299
  toolCallId: string;
300
+ /** @internal */
181
301
  toolName: string;
182
302
  }
303
+ /** @internal */
183
304
  export interface WorkerIntegrationToolResultPayload {
305
+ /** @internal */
184
306
  turnRecordId: string;
307
+ /** @internal */
185
308
  toolCallId: string;
309
+ /** @internal */
186
310
  ok: boolean;
311
+ /** @internal */
187
312
  result?: unknown;
313
+ /** @internal */
188
314
  error?: string;
189
315
  }
316
+ /** @internal */
190
317
  export interface WorkerCredentialUpdateResultPayload {
318
+ /** @internal */
191
319
  providerId: string;
320
+ /** @internal */
192
321
  accepted: boolean;
322
+ /** @internal */
193
323
  currentRevision: number | null;
324
+ /** @internal */
194
325
  safeReason?: string;
195
326
  }
327
+ /** @internal */
196
328
  export type ServerToWorkerMessage = (Omit<IpcEnvelope, "type" | "payload"> & {
329
+ /** @internal */
197
330
  type: "worker.start";
331
+ /** @internal */
198
332
  payload: WorkerStartPayload;
199
333
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
334
+ /** @internal */
200
335
  type: "worker.turn_start_accepted";
336
+ /** @internal */
201
337
  payload: WorkerTurnStartAcceptedPayload;
202
338
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
339
+ /** @internal */
203
340
  type: "worker.turn_terminal_recorded";
341
+ /** @internal */
204
342
  payload: WorkerTurnTerminalRecordedPayload;
205
343
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
344
+ /** @internal */
206
345
  type: "worker.credential_update_accepted";
346
+ /** @internal */
207
347
  payload: WorkerCredentialUpdateResultPayload;
208
348
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
349
+ /** @internal */
209
350
  type: "worker.question_response";
351
+ /** @internal */
210
352
  payload: WorkerQuestionResponsePayload;
211
353
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
354
+ /** @internal */
212
355
  type: "worker.integration_tool_result";
356
+ /** @internal */
213
357
  payload: WorkerIntegrationToolResultPayload;
214
358
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
359
+ /** @internal */
215
360
  type: "input.batch";
361
+ /** @internal */
216
362
  payload: InputBatchPayload;
217
363
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
364
+ /** @internal */
218
365
  type: "worker.stop";
366
+ /** @internal */
219
367
  payload: WorkerStopPayload;
220
368
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
369
+ /** @internal */
221
370
  type: "worker.abort_turn";
371
+ /** @internal */
222
372
  payload: WorkerAbortTurnPayload;
223
373
  });
374
+ /** @internal */
224
375
  export interface WorkerHelloPayload {
225
- /** Package/runtime version for diagnostics. */
376
+ /** Package/runtime version for diagnostics. @internal */
226
377
  version: string;
227
- /** Server-worker API compatibility version. Missing only on legacy/test workers. */
378
+ /** Server-worker API compatibility version. Missing only on legacy/test workers. @internal */
228
379
  apiVersion?: string;
380
+ /** @internal */
229
381
  capabilities: string[];
230
382
  }
383
+ /** @internal */
231
384
  export interface WorkerBootstrapProgressPayload {
385
+ /** @internal */
232
386
  phase: "worker_connected" | "preparing_workspace" | "loading_resources" | "preparing_turn";
233
387
  }
388
+ /** @internal */
234
389
  export interface WorkerDiagnosticTracePayload {
390
+ /** @internal */
235
391
  text: string;
236
392
  }
393
+ /** @internal */
237
394
  export interface WorkerReadyPayload {
395
+ /** @internal */
238
396
  receipt: WorkerBootstrapReceipt;
397
+ /** @internal */
239
398
  developmentTools?: {
399
+ /** @internal */
240
400
  miseVersion: string;
401
+ /** @internal */
241
402
  repositories: Array<{
403
+ /** @internal */
242
404
  repositoryKey: string;
405
+ /** @internal */
243
406
  tools: Array<{
407
+ /** @internal */
244
408
  name: string;
409
+ /** @internal */
245
410
  version: string;
246
411
  }>;
247
412
  }>;
413
+ /** @internal */
248
414
  warnings: string[];
249
415
  };
416
+ /** @internal */
250
417
  resumed: boolean;
418
+ /** @internal */
251
419
  primaryTreeFile: string;
420
+ /** @internal */
252
421
  workspaceRoot: string;
422
+ /** @internal */
253
423
  aggregatedAgentsSources: string[];
424
+ /** @internal */
254
425
  loadedSkills: string[];
426
+ /** @internal */
255
427
  loadedAgentsFiles: Array<{
428
+ /** @internal */
256
429
  path: string;
430
+ /** @internal */
257
431
  sizeBytes: number;
258
432
  }>;
433
+ /** @internal */
259
434
  loadedSkillFiles: Array<{
435
+ /** @internal */
260
436
  name: string;
437
+ /** @internal */
261
438
  path: string;
262
439
  }>;
440
+ /** @internal */
263
441
  rootEntryId?: string | null;
264
442
  }
443
+ /** @internal */
265
444
  export interface WorkerHeartbeatPayload {
266
- /** Diagnostic worker-local runtime state; not the authoritative lease transition channel. */
445
+ /** Diagnostic worker-local runtime state; not the authoritative lease transition channel. @internal */
267
446
  state: string;
447
+ /** @internal */
268
448
  lastSequenceConsumed: number;
449
+ /** @internal */
269
450
  currentTurnId?: string;
451
+ /** @internal */
270
452
  currentSelectedTurnId?: string | null;
271
453
  }
454
+ /** @internal */
272
455
  export interface WorkerStatePayload {
273
- /** Explicit server-visible runtime transition, e.g. idle -> busy or busy -> idle. */
456
+ /** Explicit server-visible runtime transition, e.g. idle -> busy or busy -> idle. @internal */
274
457
  from: string;
458
+ /** @internal */
275
459
  to: string;
460
+ /** @internal */
276
461
  reason: string;
277
462
  }
463
+ /** @internal */
278
464
  export interface WorkerInputConsumedPayload {
465
+ /** @internal */
279
466
  inputId: string;
467
+ /** @internal */
280
468
  sequence: number;
469
+ /** @internal */
281
470
  deliveryMode: string;
471
+ /** @internal */
282
472
  currentPrimaryPathLeafId?: string | null;
473
+ /** @internal */
283
474
  rootEntryId?: string | null;
475
+ /** @internal */
284
476
  targetSemanticRef?: ProcessSemanticEntryRefKey | null;
477
+ /** @internal */
285
478
  targetProductName?: string | null;
479
+ /** @internal */
286
480
  targetEntryId?: string | null;
287
481
  }
482
+ /** @internal */
288
483
  export interface WorkerEventPayload {
484
+ /** @internal */
289
485
  eventType: string;
486
+ /** @internal */
290
487
  selectedTurnId?: string | null;
291
488
  /**
292
489
  * Object-shaped event data emitted by trusted worker senders. Decode helpers
293
490
  * do not deeply validate this field at runtime; they only narrow it at the
294
491
  * protocol boundary after envelope + message-type validation.
295
492
  */
493
+ /** @internal */
296
494
  data: Record<string, unknown>;
297
495
  }
496
+ /** @internal */
298
497
  export interface WorkerTurnStartedPayload {
498
+ /** @internal */
299
499
  startRecordId: string;
500
+ /** @internal */
300
501
  proposedTurnRecordId: string;
301
502
  }
503
+ /** @internal */
302
504
  export interface WorkerCredentialUpdatePayload {
505
+ /** @internal */
303
506
  providerId: string;
507
+ /** @internal */
304
508
  expectedRevision: number;
305
- /** Secret payload. It must not be copied into receipts, events, or turn state. */
509
+ /** Secret payload. It must not be copied into receipts, events, or turn state. @internal */
306
510
  values: Record<string, string>;
307
511
  }
512
+ /** @internal */
308
513
  export interface WorkerTurnOutcomePayload extends Omit<TurnOutcomePayload, "instanceId" | "state"> {
309
514
  }
515
+ /** @internal */
310
516
  export interface WorkerTurnFailedPayload extends Omit<TurnFailedPayload, "instanceId" | "errorClass"> {
517
+ /** @internal */
311
518
  errorClass?: string;
312
519
  }
520
+ /** @internal */
313
521
  export interface WorkerLifecycleParkedPayload {
522
+ /** @internal */
314
523
  selectedTurnId: string | null;
524
+ /** @internal */
315
525
  reason?: string;
526
+ /** @internal */
316
527
  errorClass?: string;
317
528
  }
529
+ /** @internal */
318
530
  export interface WorkerCleanupStartedPayload {
531
+ /** @internal */
319
532
  reason: string;
320
533
  }
534
+ /** @internal */
321
535
  export interface WorkerCleanupCompletedPayload {
536
+ /** @internal */
322
537
  releasedLocks: string[];
538
+ /** @internal */
323
539
  removedTransientPaths: string[];
324
540
  }
541
+ /** @internal */
325
542
  export interface WorkerFailedPayload {
543
+ /** @internal */
326
544
  state: string;
545
+ /** @internal */
327
546
  errorCode: string;
547
+ /** @internal */
328
548
  message: string;
549
+ /** @internal */
329
550
  errorClass: string;
551
+ /** @internal */
330
552
  selectedTurnId?: string | null;
553
+ /** @internal */
331
554
  retryAttempt?: number;
332
555
  }
556
+ /** @internal */
333
557
  export type WorkerToServerMessage = (Omit<IpcEnvelope, "type" | "payload"> & {
558
+ /** @internal */
334
559
  type: "worker.hello";
560
+ /** @internal */
335
561
  payload: WorkerHelloPayload;
336
562
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
563
+ /** @internal */
337
564
  type: "worker.credential_update";
565
+ /** @internal */
338
566
  payload: WorkerCredentialUpdatePayload;
339
567
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
568
+ /** @internal */
340
569
  type: "worker.bootstrap_progress";
570
+ /** @internal */
341
571
  payload: WorkerBootstrapProgressPayload;
342
572
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
573
+ /** @internal */
343
574
  type: "worker.diagnostic_trace";
575
+ /** @internal */
344
576
  payload: WorkerDiagnosticTracePayload;
345
577
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
578
+ /** @internal */
346
579
  type: "worker.ready";
580
+ /** @internal */
347
581
  payload: WorkerReadyPayload;
348
582
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
583
+ /** @internal */
349
584
  type: "worker.heartbeat";
585
+ /** @internal */
350
586
  payload: WorkerHeartbeatPayload;
351
587
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
588
+ /** @internal */
352
589
  type: "worker.state";
590
+ /** @internal */
353
591
  payload: WorkerStatePayload;
354
592
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
593
+ /** @internal */
355
594
  type: "worker.input_consumed";
595
+ /** @internal */
356
596
  payload: WorkerInputConsumedPayload;
357
597
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
598
+ /** @internal */
358
599
  type: "worker.event";
600
+ /** @internal */
359
601
  payload: WorkerEventPayload;
360
602
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
603
+ /** @internal */
361
604
  type: "worker.turn_started";
605
+ /** @internal */
362
606
  payload: WorkerTurnStartedPayload;
363
607
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
608
+ /** @internal */
364
609
  type: "worker.question_requested";
610
+ /** @internal */
365
611
  payload: WorkerQuestionRequestedPayload;
366
612
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
613
+ /** @internal */
367
614
  type: "worker.integration_tool_request";
615
+ /** @internal */
368
616
  payload: WorkerIntegrationToolRequestPayload;
369
617
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
618
+ /** @internal */
370
619
  type: "worker.integration_tool_cancel";
620
+ /** @internal */
371
621
  payload: WorkerIntegrationToolCancelPayload;
372
622
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
623
+ /** @internal */
373
624
  type: "worker.turn_outcome";
625
+ /** @internal */
374
626
  payload: WorkerTurnOutcomePayload;
375
627
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
628
+ /** @internal */
376
629
  type: "worker.turn_failed";
630
+ /** @internal */
377
631
  payload: WorkerTurnFailedPayload;
378
632
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
633
+ /** @internal */
379
634
  type: "worker.lifecycle_parked";
635
+ /** @internal */
380
636
  payload: WorkerLifecycleParkedPayload;
381
637
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
638
+ /** @internal */
382
639
  type: "worker.cleanup_started";
640
+ /** @internal */
383
641
  payload: WorkerCleanupStartedPayload;
384
642
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
643
+ /** @internal */
385
644
  type: "worker.cleanup_completed";
645
+ /** @internal */
386
646
  payload: WorkerCleanupCompletedPayload;
387
647
  }) | (Omit<IpcEnvelope, "type" | "payload"> & {
648
+ /** @internal */
388
649
  type: "worker.failed";
650
+ /** @internal */
389
651
  payload: WorkerFailedPayload;
390
652
  });
653
+ /** @internal */
391
654
  export type AnyIpcMessage = ServerToWorkerMessage | WorkerToServerMessage;
655
+ /** @internal */
392
656
  export type IpcMessageType = AnyIpcMessage["type"];
657
+ /** @internal */
393
658
  export type IpcMessageOfType<TType extends IpcMessageType> = Extract<AnyIpcMessage, {
659
+ /** @internal */
394
660
  type: TType;
395
661
  }>;
662
+ /** @internal */
396
663
  export declare function createIpcMessage<TMessage extends AnyIpcMessage>(args: Omit<TMessage, "protocol" | "sentAt"> & {
664
+ /** @internal */
397
665
  sentAt?: string;
398
666
  }): TMessage;
399
667
  export {};