@intx/workflow-host 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +176 -0
- package/README.md +287 -0
- package/dist/adapters/blob-substrate.d.ts +49 -0
- package/dist/adapters/blob-substrate.js +140 -0
- package/dist/adapters/repo-store.d.ts +39 -0
- package/dist/adapters/repo-store.js +344 -0
- package/dist/adapters/spawn-child.d.ts +74 -0
- package/dist/adapters/spawn-child.js +152 -0
- package/dist/adapters/step-invoker.d.ts +114 -0
- package/dist/adapters/step-invoker.js +360 -0
- package/dist/child/env-bootstrap.d.ts +56 -0
- package/dist/child/env-bootstrap.js +120 -0
- package/dist/child/from-process-env.d.ts +127 -0
- package/dist/child/from-process-env.js +183 -0
- package/dist/child/index.d.ts +9 -0
- package/dist/child/index.js +9 -0
- package/dist/child/outbound-mail-bridge.d.ts +36 -0
- package/dist/child/outbound-mail-bridge.js +143 -0
- package/dist/child/proxy-repo-store.d.ts +27 -0
- package/dist/child/proxy-repo-store.js +200 -0
- package/dist/child/run-child.d.ts +320 -0
- package/dist/child/run-child.js +900 -0
- package/dist/child/self-discovery.d.ts +29 -0
- package/dist/child/self-discovery.js +57 -0
- package/dist/child/substrate-write-bridge.d.ts +72 -0
- package/dist/child/substrate-write-bridge.js +188 -0
- package/dist/child/supervisor-backed-transport.d.ts +10 -0
- package/dist/child/supervisor-backed-transport.js +113 -0
- package/dist/child/warm-agent-cache.d.ts +78 -0
- package/dist/child/warm-agent-cache.js +112 -0
- package/dist/drain-controller.d.ts +37 -0
- package/dist/drain-controller.js +46 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +10 -0
- package/dist/ipc/control-channel.d.ts +336 -0
- package/dist/ipc/control-channel.js +532 -0
- package/dist/ipc/crypto.d.ts +46 -0
- package/dist/ipc/crypto.js +126 -0
- package/dist/ipc/envelope.d.ts +53 -0
- package/dist/ipc/envelope.js +88 -0
- package/dist/ipc/event-channel.d.ts +677 -0
- package/dist/ipc/event-channel.js +278 -0
- package/dist/ipc/index.d.ts +4 -0
- package/dist/ipc/index.js +143 -0
- package/dist/mail-bus/hub-transport-adapter.d.ts +30 -0
- package/dist/mail-bus/hub-transport-adapter.js +76 -0
- package/dist/mail-bus/index.d.ts +1 -0
- package/dist/mail-bus/index.js +1 -0
- package/dist/seams/index.d.ts +3 -0
- package/dist/seams/index.js +3 -0
- package/dist/seams/scheduler-adapter.d.ts +3 -0
- package/dist/seams/scheduler-adapter.js +24 -0
- package/dist/seams/scheduler.d.ts +94 -0
- package/dist/seams/scheduler.js +397 -0
- package/dist/seams/signal-channel.d.ts +74 -0
- package/dist/seams/signal-channel.js +304 -0
- package/dist/supervisor/cancel-signing.d.ts +68 -0
- package/dist/supervisor/cancel-signing.js +144 -0
- package/dist/supervisor/child-termination.d.ts +51 -0
- package/dist/supervisor/child-termination.js +76 -0
- package/dist/supervisor/credentials.d.ts +101 -0
- package/dist/supervisor/credentials.js +153 -0
- package/dist/supervisor/dispatch-attribution.d.ts +37 -0
- package/dist/supervisor/dispatch-attribution.js +114 -0
- package/dist/supervisor/drain-timeout.d.ts +127 -0
- package/dist/supervisor/drain-timeout.js +231 -0
- package/dist/supervisor/index.d.ts +7 -0
- package/dist/supervisor/index.js +6 -0
- package/dist/supervisor/recycle.d.ts +212 -0
- package/dist/supervisor/recycle.js +440 -0
- package/dist/supervisor/run-event-compaction.d.ts +34 -0
- package/dist/supervisor/run-event-compaction.js +115 -0
- package/dist/supervisor/spawn-env.d.ts +39 -0
- package/dist/supervisor/spawn-env.js +36 -0
- package/dist/supervisor/supervisor.d.ts +202 -0
- package/dist/supervisor/supervisor.js +2244 -0
- package/dist/supervisor/terminal-broadcaster.d.ts +45 -0
- package/dist/supervisor/terminal-broadcaster.js +184 -0
- package/dist/supervisor/types.d.ts +542 -0
- package/dist/supervisor/types.js +10 -0
- package/package.json +35 -0
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import { decodeEnvelope } from "./envelope.js";
|
|
2
|
+
/**
|
|
3
|
+
* The event channel additionally carries the two bracket events the
|
|
4
|
+
* reactor emits per message run. They are part of the InferenceEvent
|
|
5
|
+
* union upstream; re-exporting the union directly keeps this channel
|
|
6
|
+
* structurally identical to what the hub's `agent.event` frame
|
|
7
|
+
* carries today.
|
|
8
|
+
*/
|
|
9
|
+
export declare const EventPayload: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
10
|
+
type: "inference.start";
|
|
11
|
+
seq: number;
|
|
12
|
+
data: {
|
|
13
|
+
model: string;
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
type: "inference.thinking.delta";
|
|
17
|
+
seq: number;
|
|
18
|
+
data: {
|
|
19
|
+
token: string;
|
|
20
|
+
partial: {
|
|
21
|
+
text: string;
|
|
22
|
+
thinking?: string;
|
|
23
|
+
toolCalls?: {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
partialArguments: string;
|
|
27
|
+
}[];
|
|
28
|
+
};
|
|
29
|
+
index?: number;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
type: "inference.thinking.signature";
|
|
33
|
+
seq: number;
|
|
34
|
+
data: {
|
|
35
|
+
signature: string;
|
|
36
|
+
index?: number;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
type: "inference.thinking.redacted";
|
|
40
|
+
seq: number;
|
|
41
|
+
data: {
|
|
42
|
+
redactedThinking: {
|
|
43
|
+
type: "redacted_thinking";
|
|
44
|
+
data: string;
|
|
45
|
+
};
|
|
46
|
+
index?: number;
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
type: "inference.text.delta";
|
|
50
|
+
seq: number;
|
|
51
|
+
data: {
|
|
52
|
+
token: string;
|
|
53
|
+
partial: {
|
|
54
|
+
text: string;
|
|
55
|
+
thinking?: string;
|
|
56
|
+
toolCalls?: {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
partialArguments: string;
|
|
60
|
+
}[];
|
|
61
|
+
};
|
|
62
|
+
index?: number;
|
|
63
|
+
};
|
|
64
|
+
} | {
|
|
65
|
+
type: "inference.refusal.delta";
|
|
66
|
+
seq: number;
|
|
67
|
+
data: {
|
|
68
|
+
token: string;
|
|
69
|
+
partial: {
|
|
70
|
+
text: string;
|
|
71
|
+
thinking?: string;
|
|
72
|
+
toolCalls?: {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
partialArguments: string;
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
index?: number;
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
type: "inference.tool_call.start";
|
|
82
|
+
seq: number;
|
|
83
|
+
data: {
|
|
84
|
+
callId: string;
|
|
85
|
+
name: string;
|
|
86
|
+
partial: {
|
|
87
|
+
text: string;
|
|
88
|
+
thinking?: string;
|
|
89
|
+
toolCalls?: {
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
partialArguments: string;
|
|
93
|
+
}[];
|
|
94
|
+
};
|
|
95
|
+
index?: number;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
type: "inference.tool_call.delta";
|
|
99
|
+
seq: number;
|
|
100
|
+
data: {
|
|
101
|
+
callId: string;
|
|
102
|
+
argumentFragment: string;
|
|
103
|
+
partial: {
|
|
104
|
+
text: string;
|
|
105
|
+
thinking?: string;
|
|
106
|
+
toolCalls?: {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
partialArguments: string;
|
|
110
|
+
}[];
|
|
111
|
+
};
|
|
112
|
+
index?: number;
|
|
113
|
+
};
|
|
114
|
+
} | {
|
|
115
|
+
type: "inference.tool_call.end";
|
|
116
|
+
seq: number;
|
|
117
|
+
data: {
|
|
118
|
+
callId: string;
|
|
119
|
+
name: string;
|
|
120
|
+
arguments: Record<string, unknown>;
|
|
121
|
+
partial: {
|
|
122
|
+
text: string;
|
|
123
|
+
thinking?: string;
|
|
124
|
+
toolCalls?: {
|
|
125
|
+
id: string;
|
|
126
|
+
name: string;
|
|
127
|
+
partialArguments: string;
|
|
128
|
+
}[];
|
|
129
|
+
};
|
|
130
|
+
index?: number;
|
|
131
|
+
};
|
|
132
|
+
} | {
|
|
133
|
+
type: "inference.usage";
|
|
134
|
+
seq: number;
|
|
135
|
+
data: {
|
|
136
|
+
usage: {
|
|
137
|
+
input: number;
|
|
138
|
+
output: number;
|
|
139
|
+
cacheRead: number;
|
|
140
|
+
cacheWrite: number;
|
|
141
|
+
thinking: number;
|
|
142
|
+
};
|
|
143
|
+
source: {
|
|
144
|
+
sourceId: string;
|
|
145
|
+
provider: string;
|
|
146
|
+
model: string;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
} | {
|
|
150
|
+
type: "inference.done";
|
|
151
|
+
seq: number;
|
|
152
|
+
data: {
|
|
153
|
+
turn: {
|
|
154
|
+
role: "assistant";
|
|
155
|
+
content: ({
|
|
156
|
+
type: "text";
|
|
157
|
+
text: string;
|
|
158
|
+
} | {
|
|
159
|
+
type: "image";
|
|
160
|
+
source: {
|
|
161
|
+
kind: "base64";
|
|
162
|
+
mimeType: string;
|
|
163
|
+
data: string;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "file-reference";
|
|
166
|
+
mimeType: string;
|
|
167
|
+
reference: string;
|
|
168
|
+
} | {
|
|
169
|
+
kind: "url";
|
|
170
|
+
mimeType: string;
|
|
171
|
+
url: string;
|
|
172
|
+
};
|
|
173
|
+
} | {
|
|
174
|
+
type: "audio";
|
|
175
|
+
source: {
|
|
176
|
+
kind: "base64";
|
|
177
|
+
mimeType: string;
|
|
178
|
+
data: string;
|
|
179
|
+
} | {
|
|
180
|
+
kind: "file-reference";
|
|
181
|
+
mimeType: string;
|
|
182
|
+
reference: string;
|
|
183
|
+
} | {
|
|
184
|
+
kind: "url";
|
|
185
|
+
mimeType: string;
|
|
186
|
+
url: string;
|
|
187
|
+
};
|
|
188
|
+
} | {
|
|
189
|
+
type: "video";
|
|
190
|
+
source: {
|
|
191
|
+
kind: "base64";
|
|
192
|
+
mimeType: string;
|
|
193
|
+
data: string;
|
|
194
|
+
} | {
|
|
195
|
+
kind: "file-reference";
|
|
196
|
+
mimeType: string;
|
|
197
|
+
reference: string;
|
|
198
|
+
} | {
|
|
199
|
+
kind: "url";
|
|
200
|
+
mimeType: string;
|
|
201
|
+
url: string;
|
|
202
|
+
};
|
|
203
|
+
} | {
|
|
204
|
+
type: "document";
|
|
205
|
+
source: {
|
|
206
|
+
kind: "base64";
|
|
207
|
+
mimeType: string;
|
|
208
|
+
data: string;
|
|
209
|
+
} | {
|
|
210
|
+
kind: "file-reference";
|
|
211
|
+
mimeType: string;
|
|
212
|
+
reference: string;
|
|
213
|
+
} | {
|
|
214
|
+
kind: "url";
|
|
215
|
+
mimeType: string;
|
|
216
|
+
url: string;
|
|
217
|
+
};
|
|
218
|
+
} | {
|
|
219
|
+
type: "thinking";
|
|
220
|
+
thinking: string;
|
|
221
|
+
signature?: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: "redacted_thinking";
|
|
224
|
+
data: string;
|
|
225
|
+
} | {
|
|
226
|
+
type: "refusal";
|
|
227
|
+
reason: string;
|
|
228
|
+
} | {
|
|
229
|
+
type: "tool_call";
|
|
230
|
+
id: string;
|
|
231
|
+
name: string;
|
|
232
|
+
arguments: Record<string, unknown>;
|
|
233
|
+
} | {
|
|
234
|
+
type: "citation";
|
|
235
|
+
citedText: string;
|
|
236
|
+
source: {
|
|
237
|
+
title?: string;
|
|
238
|
+
uri?: string;
|
|
239
|
+
documentRef?: {
|
|
240
|
+
index: number;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
location?: {
|
|
244
|
+
kind: "page" | "char" | "content-block";
|
|
245
|
+
start: number;
|
|
246
|
+
end: number;
|
|
247
|
+
};
|
|
248
|
+
textOffset?: {
|
|
249
|
+
start: number;
|
|
250
|
+
end: number;
|
|
251
|
+
};
|
|
252
|
+
} | {
|
|
253
|
+
type: "code_execution_request";
|
|
254
|
+
id: string;
|
|
255
|
+
code: string;
|
|
256
|
+
language?: string;
|
|
257
|
+
} | {
|
|
258
|
+
type: "code_execution_result";
|
|
259
|
+
requestId: string;
|
|
260
|
+
status: "error" | "ok" | "aborted" | "timeout";
|
|
261
|
+
stdout?: string;
|
|
262
|
+
stderr?: string;
|
|
263
|
+
returnCode?: number;
|
|
264
|
+
providerOutcome?: string;
|
|
265
|
+
abortReason?: string;
|
|
266
|
+
} | {
|
|
267
|
+
type: "tool_result";
|
|
268
|
+
callId: string;
|
|
269
|
+
content: ({
|
|
270
|
+
type: "text";
|
|
271
|
+
text: string;
|
|
272
|
+
} | {
|
|
273
|
+
type: "image";
|
|
274
|
+
source: {
|
|
275
|
+
kind: "base64";
|
|
276
|
+
mimeType: string;
|
|
277
|
+
data: string;
|
|
278
|
+
} | {
|
|
279
|
+
kind: "file-reference";
|
|
280
|
+
mimeType: string;
|
|
281
|
+
reference: string;
|
|
282
|
+
} | {
|
|
283
|
+
kind: "url";
|
|
284
|
+
mimeType: string;
|
|
285
|
+
url: string;
|
|
286
|
+
};
|
|
287
|
+
} | {
|
|
288
|
+
type: "audio";
|
|
289
|
+
source: {
|
|
290
|
+
kind: "base64";
|
|
291
|
+
mimeType: string;
|
|
292
|
+
data: string;
|
|
293
|
+
} | {
|
|
294
|
+
kind: "file-reference";
|
|
295
|
+
mimeType: string;
|
|
296
|
+
reference: string;
|
|
297
|
+
} | {
|
|
298
|
+
kind: "url";
|
|
299
|
+
mimeType: string;
|
|
300
|
+
url: string;
|
|
301
|
+
};
|
|
302
|
+
} | {
|
|
303
|
+
type: "video";
|
|
304
|
+
source: {
|
|
305
|
+
kind: "base64";
|
|
306
|
+
mimeType: string;
|
|
307
|
+
data: string;
|
|
308
|
+
} | {
|
|
309
|
+
kind: "file-reference";
|
|
310
|
+
mimeType: string;
|
|
311
|
+
reference: string;
|
|
312
|
+
} | {
|
|
313
|
+
kind: "url";
|
|
314
|
+
mimeType: string;
|
|
315
|
+
url: string;
|
|
316
|
+
};
|
|
317
|
+
} | {
|
|
318
|
+
type: "document";
|
|
319
|
+
source: {
|
|
320
|
+
kind: "base64";
|
|
321
|
+
mimeType: string;
|
|
322
|
+
data: string;
|
|
323
|
+
} | {
|
|
324
|
+
kind: "file-reference";
|
|
325
|
+
mimeType: string;
|
|
326
|
+
reference: string;
|
|
327
|
+
} | {
|
|
328
|
+
kind: "url";
|
|
329
|
+
mimeType: string;
|
|
330
|
+
url: string;
|
|
331
|
+
};
|
|
332
|
+
})[];
|
|
333
|
+
detail?: unknown;
|
|
334
|
+
isError?: boolean;
|
|
335
|
+
})[];
|
|
336
|
+
model: string;
|
|
337
|
+
timestamp: number;
|
|
338
|
+
};
|
|
339
|
+
usage: {
|
|
340
|
+
input: number;
|
|
341
|
+
output: number;
|
|
342
|
+
cacheRead: number;
|
|
343
|
+
cacheWrite: number;
|
|
344
|
+
thinking: number;
|
|
345
|
+
};
|
|
346
|
+
source: {
|
|
347
|
+
sourceId: string;
|
|
348
|
+
provider: string;
|
|
349
|
+
model: string;
|
|
350
|
+
};
|
|
351
|
+
pacingDelayMs?: number;
|
|
352
|
+
};
|
|
353
|
+
} | {
|
|
354
|
+
type: "inference.error";
|
|
355
|
+
seq: number;
|
|
356
|
+
data: {
|
|
357
|
+
error: {
|
|
358
|
+
category: "fatal" | "aborted" | "timeout" | "retryable" | "context_overflow" | "credential_failure" | "quota_exhausted" | "protocol_mismatch";
|
|
359
|
+
message: string;
|
|
360
|
+
statusCode?: number;
|
|
361
|
+
retryAfterMs?: number;
|
|
362
|
+
raw?: unknown;
|
|
363
|
+
};
|
|
364
|
+
partial: {
|
|
365
|
+
text: string;
|
|
366
|
+
thinking?: string;
|
|
367
|
+
toolCalls?: {
|
|
368
|
+
id: string;
|
|
369
|
+
name: string;
|
|
370
|
+
partialArguments: string;
|
|
371
|
+
}[];
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
} | {
|
|
375
|
+
type: "inference.retry";
|
|
376
|
+
seq: number;
|
|
377
|
+
data: {
|
|
378
|
+
attempt: number;
|
|
379
|
+
delayMs: number;
|
|
380
|
+
previousError: {
|
|
381
|
+
category: "fatal" | "aborted" | "timeout" | "retryable" | "context_overflow" | "credential_failure" | "quota_exhausted" | "protocol_mismatch";
|
|
382
|
+
message: string;
|
|
383
|
+
statusCode?: number;
|
|
384
|
+
retryAfterMs?: number;
|
|
385
|
+
raw?: unknown;
|
|
386
|
+
};
|
|
387
|
+
};
|
|
388
|
+
} | {
|
|
389
|
+
type: "inference.citation";
|
|
390
|
+
seq: number;
|
|
391
|
+
data: {
|
|
392
|
+
citation: {
|
|
393
|
+
type: "citation";
|
|
394
|
+
citedText: string;
|
|
395
|
+
source: {
|
|
396
|
+
title?: string;
|
|
397
|
+
uri?: string;
|
|
398
|
+
documentRef?: {
|
|
399
|
+
index: number;
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
location?: {
|
|
403
|
+
kind: "page" | "char" | "content-block";
|
|
404
|
+
start: number;
|
|
405
|
+
end: number;
|
|
406
|
+
};
|
|
407
|
+
textOffset?: {
|
|
408
|
+
start: number;
|
|
409
|
+
end: number;
|
|
410
|
+
};
|
|
411
|
+
};
|
|
412
|
+
index?: number;
|
|
413
|
+
};
|
|
414
|
+
} | {
|
|
415
|
+
type: "inference.code_execution.start";
|
|
416
|
+
seq: number;
|
|
417
|
+
data: {
|
|
418
|
+
request: {
|
|
419
|
+
type: "code_execution_request";
|
|
420
|
+
id: string;
|
|
421
|
+
code: string;
|
|
422
|
+
language?: string;
|
|
423
|
+
};
|
|
424
|
+
index?: number;
|
|
425
|
+
};
|
|
426
|
+
} | {
|
|
427
|
+
type: "inference.code_execution.delta";
|
|
428
|
+
seq: number;
|
|
429
|
+
data: {
|
|
430
|
+
requestId: string;
|
|
431
|
+
codeFragment: string;
|
|
432
|
+
index?: number;
|
|
433
|
+
};
|
|
434
|
+
} | {
|
|
435
|
+
type: "inference.code_execution.result";
|
|
436
|
+
seq: number;
|
|
437
|
+
data: {
|
|
438
|
+
result: {
|
|
439
|
+
type: "code_execution_result";
|
|
440
|
+
requestId: string;
|
|
441
|
+
status: "error" | "ok" | "aborted" | "timeout";
|
|
442
|
+
stdout?: string;
|
|
443
|
+
stderr?: string;
|
|
444
|
+
returnCode?: number;
|
|
445
|
+
providerOutcome?: string;
|
|
446
|
+
abortReason?: string;
|
|
447
|
+
};
|
|
448
|
+
index?: number;
|
|
449
|
+
};
|
|
450
|
+
} | {
|
|
451
|
+
type: "inference.image_output";
|
|
452
|
+
seq: number;
|
|
453
|
+
data: {
|
|
454
|
+
image: {
|
|
455
|
+
type: "image";
|
|
456
|
+
source: {
|
|
457
|
+
kind: "base64";
|
|
458
|
+
mimeType: string;
|
|
459
|
+
data: string;
|
|
460
|
+
} | {
|
|
461
|
+
kind: "file-reference";
|
|
462
|
+
mimeType: string;
|
|
463
|
+
reference: string;
|
|
464
|
+
} | {
|
|
465
|
+
kind: "url";
|
|
466
|
+
mimeType: string;
|
|
467
|
+
url: string;
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
index?: number;
|
|
471
|
+
};
|
|
472
|
+
} | {
|
|
473
|
+
type: "tool.start";
|
|
474
|
+
seq: number;
|
|
475
|
+
data: {
|
|
476
|
+
call: {
|
|
477
|
+
id: string;
|
|
478
|
+
name: string;
|
|
479
|
+
arguments: Record<string, unknown>;
|
|
480
|
+
};
|
|
481
|
+
};
|
|
482
|
+
} | {
|
|
483
|
+
type: "tool.update";
|
|
484
|
+
seq: number;
|
|
485
|
+
data: {
|
|
486
|
+
callId: string;
|
|
487
|
+
partial: string;
|
|
488
|
+
};
|
|
489
|
+
} | {
|
|
490
|
+
type: "tool.done";
|
|
491
|
+
seq: number;
|
|
492
|
+
data: {
|
|
493
|
+
result: {
|
|
494
|
+
callId: string;
|
|
495
|
+
content: string | Record<string, unknown>;
|
|
496
|
+
detail?: unknown;
|
|
497
|
+
isError?: boolean;
|
|
498
|
+
pendingMarker?: {
|
|
499
|
+
status: "pending";
|
|
500
|
+
correlationId: string;
|
|
501
|
+
expectedFrom?: string;
|
|
502
|
+
};
|
|
503
|
+
};
|
|
504
|
+
};
|
|
505
|
+
} | {
|
|
506
|
+
type: "message.queued";
|
|
507
|
+
seq: number;
|
|
508
|
+
data: {
|
|
509
|
+
message: {
|
|
510
|
+
ref: {
|
|
511
|
+
uid: number;
|
|
512
|
+
mailbox: string;
|
|
513
|
+
};
|
|
514
|
+
headers: Record<string, unknown>;
|
|
515
|
+
flags: string[];
|
|
516
|
+
signatureStatus: "unknown" | "valid" | "invalid" | "missing";
|
|
517
|
+
content?: string;
|
|
518
|
+
payload?: object;
|
|
519
|
+
attachments?: unknown[];
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
} | {
|
|
523
|
+
type: "message.run.started";
|
|
524
|
+
seq: number;
|
|
525
|
+
data: {
|
|
526
|
+
messageId: string;
|
|
527
|
+
messageRunId: string;
|
|
528
|
+
receivedAt: number;
|
|
529
|
+
};
|
|
530
|
+
} | {
|
|
531
|
+
type: "message.run.ended";
|
|
532
|
+
seq: number;
|
|
533
|
+
data: {
|
|
534
|
+
messageRunId: string;
|
|
535
|
+
messageId: string;
|
|
536
|
+
status: "completed" | "failed";
|
|
537
|
+
error?: {
|
|
538
|
+
message: string;
|
|
539
|
+
kind?: string;
|
|
540
|
+
};
|
|
541
|
+
};
|
|
542
|
+
} | {
|
|
543
|
+
type: "message.correlated";
|
|
544
|
+
seq: number;
|
|
545
|
+
data: {
|
|
546
|
+
message: {
|
|
547
|
+
ref: {
|
|
548
|
+
uid: number;
|
|
549
|
+
mailbox: string;
|
|
550
|
+
};
|
|
551
|
+
headers: Record<string, unknown>;
|
|
552
|
+
flags: string[];
|
|
553
|
+
signatureStatus: "unknown" | "valid" | "invalid" | "missing";
|
|
554
|
+
content?: string;
|
|
555
|
+
payload?: object;
|
|
556
|
+
attachments?: unknown[];
|
|
557
|
+
};
|
|
558
|
+
correlationId: string;
|
|
559
|
+
};
|
|
560
|
+
} | {
|
|
561
|
+
type: "connector.reply";
|
|
562
|
+
seq: number;
|
|
563
|
+
data: {
|
|
564
|
+
content: string;
|
|
565
|
+
checkpointHash?: string;
|
|
566
|
+
};
|
|
567
|
+
} | {
|
|
568
|
+
type: "reactor.start";
|
|
569
|
+
seq: number;
|
|
570
|
+
data: object;
|
|
571
|
+
} | {
|
|
572
|
+
type: "reactor.gate.blocked";
|
|
573
|
+
seq: number;
|
|
574
|
+
data: {
|
|
575
|
+
reason: "approval" | "payment" | "credential" | "budget" | "child_completion" | "message_response";
|
|
576
|
+
gateId: string;
|
|
577
|
+
};
|
|
578
|
+
} | {
|
|
579
|
+
type: "reactor.gate.cleared";
|
|
580
|
+
seq: number;
|
|
581
|
+
data: {
|
|
582
|
+
gateId: string;
|
|
583
|
+
reason: "timeout" | "resolved" | "shutdown";
|
|
584
|
+
};
|
|
585
|
+
} | {
|
|
586
|
+
type: "reactor.done";
|
|
587
|
+
seq: number;
|
|
588
|
+
data: object;
|
|
589
|
+
} | {
|
|
590
|
+
type: "reactor.error";
|
|
591
|
+
seq: number;
|
|
592
|
+
data: {
|
|
593
|
+
error: string;
|
|
594
|
+
fatal: boolean;
|
|
595
|
+
};
|
|
596
|
+
} | {
|
|
597
|
+
type: "fork.created";
|
|
598
|
+
seq: number;
|
|
599
|
+
data: {
|
|
600
|
+
forkId: string;
|
|
601
|
+
parentId: string;
|
|
602
|
+
mode: "child" | "independent";
|
|
603
|
+
};
|
|
604
|
+
} | {
|
|
605
|
+
type: "fork.done";
|
|
606
|
+
seq: number;
|
|
607
|
+
data: {
|
|
608
|
+
forkId: string;
|
|
609
|
+
result?: unknown;
|
|
610
|
+
};
|
|
611
|
+
} | {
|
|
612
|
+
type: "fork.error";
|
|
613
|
+
seq: number;
|
|
614
|
+
data: {
|
|
615
|
+
forkId: string;
|
|
616
|
+
error: string;
|
|
617
|
+
};
|
|
618
|
+
} | {
|
|
619
|
+
type: "fork.aborted";
|
|
620
|
+
seq: number;
|
|
621
|
+
data: {
|
|
622
|
+
forkId: string;
|
|
623
|
+
};
|
|
624
|
+
} | {
|
|
625
|
+
type: string;
|
|
626
|
+
seq: number;
|
|
627
|
+
data: Record<string, unknown>;
|
|
628
|
+
}, {}>;
|
|
629
|
+
export type EventPayload = typeof EventPayload.infer;
|
|
630
|
+
export interface FrameWriter {
|
|
631
|
+
write(bytes: Uint8Array): Promise<void> | void;
|
|
632
|
+
}
|
|
633
|
+
export interface FrameReader {
|
|
634
|
+
read(): AsyncIterableIterator<Uint8Array>;
|
|
635
|
+
}
|
|
636
|
+
export interface EventChannelSenderOpts {
|
|
637
|
+
hmacKey: Uint8Array;
|
|
638
|
+
channelId: string;
|
|
639
|
+
writer: FrameWriter;
|
|
640
|
+
}
|
|
641
|
+
export interface EventChannelSender {
|
|
642
|
+
send(payload: EventPayload): Promise<void>;
|
|
643
|
+
readonly seq: number;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Construct the child-side event-channel sender. The shared HMAC
|
|
647
|
+
* key lives in closure. The child mints monotonic seq values per
|
|
648
|
+
* channelId; the receiver enforces strict monotonicity.
|
|
649
|
+
*/
|
|
650
|
+
export declare function createEventChannelSender(opts: EventChannelSenderOpts): EventChannelSender;
|
|
651
|
+
export interface EventChannelReceiverOpts {
|
|
652
|
+
hmacKey: Uint8Array;
|
|
653
|
+
channelId: string;
|
|
654
|
+
reader: FrameReader;
|
|
655
|
+
/**
|
|
656
|
+
* Userspace bound on the in-flight buffer between substrate read
|
|
657
|
+
* and caller consume. Overrun calls `onCrash` and stops the
|
|
658
|
+
* iterator. Default 1024 matches the discipline documented in
|
|
659
|
+
* the IPC threat model.
|
|
660
|
+
*/
|
|
661
|
+
bufferLimit?: number;
|
|
662
|
+
onCrash: (reason: string) => void;
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Construct the supervisor-side event-channel receiver. Yields one
|
|
666
|
+
* verified, in-order `EventPayload` per call. Any frame that fails
|
|
667
|
+
* HMAC verification, carries a non-current channelId, arrives out
|
|
668
|
+
* of order, or arrives faster than the consumer drains -- triggers
|
|
669
|
+
* `onCrash` and ends the iterator.
|
|
670
|
+
*/
|
|
671
|
+
export declare function receiveEventChannel(opts: EventChannelReceiverOpts): AsyncGenerator<EventPayload, void, void>;
|
|
672
|
+
export declare const DEFAULT_EVENT_BUFFER_LIMIT = 1024;
|
|
673
|
+
/**
|
|
674
|
+
* Re-export the envelope decoder for callers that need raw access
|
|
675
|
+
* to a frame's envelope outside the receiver iterator.
|
|
676
|
+
*/
|
|
677
|
+
export { decodeEnvelope };
|