@leitwerk-dev/worker-protocol 0.1.9 → 0.2.1

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