@xandreed/process-host 0.0.0-stage → 0.15.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.
- package/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/index.d.ts +14 -0
- package/dist/index.js +10 -0
- package/dist/ports/process-peer.port.d.ts +22 -0
- package/dist/ports/process-peer.port.js +4 -0
- package/dist/process-host.adapter.d.ts +13 -0
- package/dist/process-host.adapter.js +153 -0
- package/dist/process-host.entity.d.ts +128 -0
- package/dist/process-host.entity.functions.d.ts +12 -0
- package/dist/process-host.entity.functions.js +17 -0
- package/dist/process-host.entity.js +38 -0
- package/dist/process-peer.conformance.d.ts +27 -0
- package/dist/process-peer.conformance.js +99 -0
- package/dist/process-peer.entity.d.ts +37 -0
- package/dist/process-peer.entity.js +40 -0
- package/dist/process-protocol.entity.d.ts +970 -0
- package/dist/process-protocol.entity.functions.d.ts +1495 -0
- package/dist/process-protocol.entity.functions.js +72 -0
- package/dist/process-protocol.entity.js +155 -0
- package/dist/process-runtime.adapter.d.ts +18 -0
- package/dist/process-runtime.adapter.js +49 -0
- package/dist/process-runtime.entity.d.ts +13 -0
- package/dist/process-runtime.entity.js +11 -0
- package/dist/stdio-peer.adapter.d.ts +11 -0
- package/dist/stdio-peer.adapter.js +260 -0
- package/package.json +29 -4
|
@@ -0,0 +1,1495 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
import { ProcessPeerError } from "./process-peer.entity.js";
|
|
3
|
+
/** Decode one complete JSON command; native framing, byte limits and UTF8 belong to ProcessPeer. @public */
|
|
4
|
+
export declare const decodeProcessCommand: (text: string) => Effect.Effect<{
|
|
5
|
+
readonly _tag: "hello";
|
|
6
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
7
|
+
readonly protocolVersion: number;
|
|
8
|
+
} | {
|
|
9
|
+
readonly _tag: "begin";
|
|
10
|
+
readonly session: {
|
|
11
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
12
|
+
readonly owner: string;
|
|
13
|
+
};
|
|
14
|
+
readonly userMessage: import("@xandreed/core").UserMessage;
|
|
15
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
16
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
17
|
+
readonly meta?: {
|
|
18
|
+
readonly [x: string]: Schema.Json;
|
|
19
|
+
};
|
|
20
|
+
readonly key?: string;
|
|
21
|
+
readonly command?: {
|
|
22
|
+
readonly [x: string]: Schema.Json;
|
|
23
|
+
};
|
|
24
|
+
readonly resumes?: number;
|
|
25
|
+
readonly takeOver?: boolean;
|
|
26
|
+
readonly timeLimitMs?: number;
|
|
27
|
+
} | {
|
|
28
|
+
readonly _tag: "send";
|
|
29
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
30
|
+
readonly session: {
|
|
31
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
32
|
+
readonly owner: string;
|
|
33
|
+
};
|
|
34
|
+
readonly input: {
|
|
35
|
+
readonly id: string & import("effect/Brand").Brand<"InboxItemId">;
|
|
36
|
+
readonly source: {
|
|
37
|
+
readonly [x: string]: Schema.Json;
|
|
38
|
+
};
|
|
39
|
+
readonly userMessage: import("@xandreed/core").UserMessage;
|
|
40
|
+
};
|
|
41
|
+
} | {
|
|
42
|
+
readonly _tag: "steer";
|
|
43
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
44
|
+
readonly session: {
|
|
45
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
46
|
+
readonly owner: string;
|
|
47
|
+
};
|
|
48
|
+
readonly input: {
|
|
49
|
+
readonly id: string & import("effect/Brand").Brand<"InboxItemId">;
|
|
50
|
+
readonly source: {
|
|
51
|
+
readonly [x: string]: Schema.Json;
|
|
52
|
+
};
|
|
53
|
+
readonly userMessage: import("@xandreed/core").UserMessage;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
readonly _tag: "answer";
|
|
57
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
58
|
+
readonly parent: {
|
|
59
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
60
|
+
readonly owner: string;
|
|
61
|
+
};
|
|
62
|
+
readonly taskId: string & import("effect/Brand").Brand<"ConversationId">;
|
|
63
|
+
readonly questionId: string & import("effect/Brand").Brand<"TaskQuestionId">;
|
|
64
|
+
readonly text: string;
|
|
65
|
+
} | {
|
|
66
|
+
readonly _tag: "cancel";
|
|
67
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
68
|
+
readonly session: {
|
|
69
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
70
|
+
readonly owner: string;
|
|
71
|
+
};
|
|
72
|
+
readonly turn: number;
|
|
73
|
+
} | {
|
|
74
|
+
readonly _tag: "ping";
|
|
75
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
76
|
+
} | {
|
|
77
|
+
readonly _tag: "shutdown";
|
|
78
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
79
|
+
readonly deadlineMs?: number;
|
|
80
|
+
}, ProcessPeerError, never>;
|
|
81
|
+
/** Encode JSON without a line terminator. The peer admits and serializes writes before calling this helper. @public */
|
|
82
|
+
export declare const encodeProcessEvent: (event: {
|
|
83
|
+
readonly _tag: "hello";
|
|
84
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
85
|
+
readonly protocolVersion: 1;
|
|
86
|
+
} | {
|
|
87
|
+
readonly _tag: "turn.started";
|
|
88
|
+
readonly turn: number;
|
|
89
|
+
readonly session: {
|
|
90
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
91
|
+
readonly owner: string;
|
|
92
|
+
};
|
|
93
|
+
readonly origin: "user" | "inbox" | "task";
|
|
94
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
95
|
+
readonly journal: {
|
|
96
|
+
readonly seq: number;
|
|
97
|
+
readonly at: number;
|
|
98
|
+
};
|
|
99
|
+
readonly input?: string & import("effect/Brand").Brand<"InboxItemId">;
|
|
100
|
+
readonly task?: {
|
|
101
|
+
readonly taskId: string & import("effect/Brand").Brand<"ConversationId">;
|
|
102
|
+
readonly parent: string & import("effect/Brand").Brand<"ConversationId">;
|
|
103
|
+
};
|
|
104
|
+
readonly resumes?: number;
|
|
105
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
106
|
+
} | {
|
|
107
|
+
readonly _tag: "turn.event";
|
|
108
|
+
readonly turn: number;
|
|
109
|
+
readonly session: {
|
|
110
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
111
|
+
readonly owner: string;
|
|
112
|
+
};
|
|
113
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
114
|
+
readonly progress: {
|
|
115
|
+
readonly mode: "projection";
|
|
116
|
+
readonly event: {
|
|
117
|
+
readonly _tag: "step.started";
|
|
118
|
+
readonly step: number;
|
|
119
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
120
|
+
readonly planned: boolean;
|
|
121
|
+
} | {
|
|
122
|
+
readonly _tag: "step.ended";
|
|
123
|
+
readonly step: number;
|
|
124
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
125
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
126
|
+
} | {
|
|
127
|
+
readonly _tag: "assistant.delta";
|
|
128
|
+
readonly step: number;
|
|
129
|
+
readonly id: string & import("effect/Brand").Brand<"StreamPartId">;
|
|
130
|
+
readonly delta: string;
|
|
131
|
+
} | {
|
|
132
|
+
readonly _tag: "assistant.message";
|
|
133
|
+
readonly step: number;
|
|
134
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
135
|
+
readonly text: string;
|
|
136
|
+
} | {
|
|
137
|
+
readonly _tag: "tool.started";
|
|
138
|
+
readonly tool: string;
|
|
139
|
+
readonly step: number;
|
|
140
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
141
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
142
|
+
} | {
|
|
143
|
+
readonly _tag: "tool.completed";
|
|
144
|
+
readonly tool: string;
|
|
145
|
+
readonly ok: boolean;
|
|
146
|
+
readonly step: number;
|
|
147
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
148
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
149
|
+
} | {
|
|
150
|
+
readonly _tag: "tool.refused";
|
|
151
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
152
|
+
readonly tool: string;
|
|
153
|
+
readonly step: number;
|
|
154
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
155
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
156
|
+
} | {
|
|
157
|
+
readonly _tag: "tool.progress";
|
|
158
|
+
readonly text: string;
|
|
159
|
+
readonly tool: string;
|
|
160
|
+
readonly step: number;
|
|
161
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
162
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
163
|
+
} | {
|
|
164
|
+
readonly _tag: "stream.fallback";
|
|
165
|
+
readonly step: number;
|
|
166
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
167
|
+
};
|
|
168
|
+
} | {
|
|
169
|
+
readonly mode: "full";
|
|
170
|
+
readonly event: {
|
|
171
|
+
readonly _tag: "step.started";
|
|
172
|
+
readonly step: number;
|
|
173
|
+
readonly activeTools: readonly string[];
|
|
174
|
+
readonly planned: boolean;
|
|
175
|
+
readonly run?: number;
|
|
176
|
+
} | {
|
|
177
|
+
readonly _tag: "tool.started";
|
|
178
|
+
readonly input: unknown;
|
|
179
|
+
readonly tool: string;
|
|
180
|
+
readonly step: number;
|
|
181
|
+
readonly invocationId: string;
|
|
182
|
+
readonly stage: string | null;
|
|
183
|
+
readonly labels: {
|
|
184
|
+
readonly [x: string]: string;
|
|
185
|
+
};
|
|
186
|
+
readonly toolCallId?: string;
|
|
187
|
+
} | {
|
|
188
|
+
readonly message: string;
|
|
189
|
+
readonly _tag: "tool.refused";
|
|
190
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
191
|
+
readonly input: unknown;
|
|
192
|
+
readonly tool: string;
|
|
193
|
+
readonly step: number;
|
|
194
|
+
readonly invocationId: string;
|
|
195
|
+
readonly toolCallId?: string;
|
|
196
|
+
} | {
|
|
197
|
+
readonly _tag: "tool.progress";
|
|
198
|
+
readonly text: string;
|
|
199
|
+
readonly tool: string;
|
|
200
|
+
readonly step: number;
|
|
201
|
+
readonly invocationId: string;
|
|
202
|
+
readonly channel: "status" | "stdout" | "stderr";
|
|
203
|
+
readonly toolCallId?: string;
|
|
204
|
+
} | {
|
|
205
|
+
readonly _tag: "tool.completed";
|
|
206
|
+
readonly input: unknown;
|
|
207
|
+
readonly tool: string;
|
|
208
|
+
readonly ok: boolean;
|
|
209
|
+
readonly step: number;
|
|
210
|
+
readonly invocationId: string;
|
|
211
|
+
readonly encoded: unknown;
|
|
212
|
+
readonly durationMs: number;
|
|
213
|
+
readonly stage: string | null;
|
|
214
|
+
readonly labels: {
|
|
215
|
+
readonly [x: string]: string;
|
|
216
|
+
};
|
|
217
|
+
readonly result: unknown;
|
|
218
|
+
readonly toolCallId?: string;
|
|
219
|
+
} | {
|
|
220
|
+
readonly _tag: "step.ended";
|
|
221
|
+
readonly step: number;
|
|
222
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
223
|
+
readonly results: readonly {
|
|
224
|
+
readonly entry: string;
|
|
225
|
+
readonly toolCallId: string;
|
|
226
|
+
readonly tool: string;
|
|
227
|
+
readonly ok: boolean;
|
|
228
|
+
}[];
|
|
229
|
+
readonly run?: number;
|
|
230
|
+
} | {
|
|
231
|
+
readonly _tag: "completion.evaluated";
|
|
232
|
+
readonly step: number;
|
|
233
|
+
readonly verdict: {
|
|
234
|
+
readonly complete: boolean;
|
|
235
|
+
readonly awaiting: readonly string[];
|
|
236
|
+
readonly facts: {
|
|
237
|
+
readonly [x: string]: Schema.Json;
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
readonly run?: number;
|
|
241
|
+
} | {
|
|
242
|
+
readonly _tag: "skills.activated";
|
|
243
|
+
readonly skills: readonly string[];
|
|
244
|
+
readonly tools: readonly string[];
|
|
245
|
+
readonly source: "always" | "matcher" | "load_skill" | "host";
|
|
246
|
+
} | {
|
|
247
|
+
readonly _tag: "context.built";
|
|
248
|
+
readonly fingerprint: string;
|
|
249
|
+
readonly turn: number;
|
|
250
|
+
readonly step: number;
|
|
251
|
+
readonly strategy: string;
|
|
252
|
+
readonly compactions: number;
|
|
253
|
+
readonly estimatedTokens: number;
|
|
254
|
+
readonly activeTools: readonly string[];
|
|
255
|
+
readonly strategyVersion: string;
|
|
256
|
+
readonly reservedTokens: number;
|
|
257
|
+
readonly systemFingerprint: string;
|
|
258
|
+
readonly budgetTokens: number;
|
|
259
|
+
readonly run?: number;
|
|
260
|
+
} | {
|
|
261
|
+
readonly _tag: "decision.recorded";
|
|
262
|
+
readonly record: {
|
|
263
|
+
readonly version: 1;
|
|
264
|
+
readonly id: string;
|
|
265
|
+
readonly family: string;
|
|
266
|
+
readonly contextHash: string;
|
|
267
|
+
readonly candidateHash: string;
|
|
268
|
+
readonly policyVersion: string;
|
|
269
|
+
readonly candidates: readonly {
|
|
270
|
+
readonly id: string;
|
|
271
|
+
readonly description: string;
|
|
272
|
+
}[];
|
|
273
|
+
readonly attempts: readonly string[];
|
|
274
|
+
readonly selection: string | null;
|
|
275
|
+
readonly validation: "failed" | "cancelled" | "accepted" | "rejected" | "abstained" | "bypassed";
|
|
276
|
+
readonly fallback: string | null;
|
|
277
|
+
readonly applied: string | null;
|
|
278
|
+
readonly probabilities: {
|
|
279
|
+
readonly [x: string]: number;
|
|
280
|
+
} | null;
|
|
281
|
+
};
|
|
282
|
+
} | {
|
|
283
|
+
readonly _tag: "assistant.message";
|
|
284
|
+
readonly reasoning: string;
|
|
285
|
+
readonly text: string;
|
|
286
|
+
readonly usage: {
|
|
287
|
+
readonly inputTokens: number;
|
|
288
|
+
readonly outputTokens: number;
|
|
289
|
+
readonly totalTokens: number;
|
|
290
|
+
readonly cacheReadTokens: number;
|
|
291
|
+
readonly cacheWriteTokens?: number;
|
|
292
|
+
readonly reasoningTokens?: number;
|
|
293
|
+
};
|
|
294
|
+
readonly step: number;
|
|
295
|
+
readonly model: string | null;
|
|
296
|
+
readonly toolCalls: readonly {
|
|
297
|
+
readonly id: string;
|
|
298
|
+
readonly tool: string;
|
|
299
|
+
readonly input: unknown;
|
|
300
|
+
}[];
|
|
301
|
+
readonly finishReason: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "pause" | "other" | "unknown";
|
|
302
|
+
readonly run?: number;
|
|
303
|
+
} | {
|
|
304
|
+
readonly _tag: "assistant.delta";
|
|
305
|
+
readonly step: number;
|
|
306
|
+
readonly channel: "reasoning" | "text" | "tool-params";
|
|
307
|
+
readonly id: string;
|
|
308
|
+
readonly delta: string;
|
|
309
|
+
} | {
|
|
310
|
+
readonly message: string;
|
|
311
|
+
readonly _tag: "stream.fallback";
|
|
312
|
+
readonly step: number;
|
|
313
|
+
readonly run?: number;
|
|
314
|
+
} | {
|
|
315
|
+
readonly _tag: "host";
|
|
316
|
+
readonly name: string;
|
|
317
|
+
readonly data: {
|
|
318
|
+
readonly [x: string]: Schema.Json;
|
|
319
|
+
};
|
|
320
|
+
} | {
|
|
321
|
+
readonly callId: string;
|
|
322
|
+
readonly attempt: number;
|
|
323
|
+
readonly purpose: "Loop" | "Helper";
|
|
324
|
+
readonly method: "Text" | "Object" | "Stream";
|
|
325
|
+
readonly model: {
|
|
326
|
+
readonly provider: string;
|
|
327
|
+
readonly modelId: string;
|
|
328
|
+
} | null;
|
|
329
|
+
readonly runId: string | null;
|
|
330
|
+
readonly run: number | null;
|
|
331
|
+
readonly step: number | null;
|
|
332
|
+
readonly durationMs: number;
|
|
333
|
+
readonly usage: {
|
|
334
|
+
readonly _tag: "Unknown";
|
|
335
|
+
} | {
|
|
336
|
+
readonly _tag: "Known";
|
|
337
|
+
readonly usage: {
|
|
338
|
+
readonly inputTokens: number;
|
|
339
|
+
readonly outputTokens: number;
|
|
340
|
+
readonly totalTokens: number;
|
|
341
|
+
readonly cacheReadTokens: number;
|
|
342
|
+
readonly cacheWriteTokens: number;
|
|
343
|
+
readonly reasoningTokens: number;
|
|
344
|
+
};
|
|
345
|
+
} | {
|
|
346
|
+
readonly _tag: "Partial";
|
|
347
|
+
readonly usage: {
|
|
348
|
+
readonly inputTokens: number;
|
|
349
|
+
readonly outputTokens: number;
|
|
350
|
+
readonly totalTokens: number;
|
|
351
|
+
readonly cacheReadTokens: number;
|
|
352
|
+
readonly cacheWriteTokens: number;
|
|
353
|
+
readonly reasoningTokens: number;
|
|
354
|
+
};
|
|
355
|
+
readonly reported: readonly ("inputTokens" | "outputTokens" | "cacheReadTokens" | "cacheWriteTokens" | "reasoningTokens")[];
|
|
356
|
+
};
|
|
357
|
+
readonly outcome: {
|
|
358
|
+
readonly _tag: "Completed";
|
|
359
|
+
} | {
|
|
360
|
+
readonly _tag: "Failed";
|
|
361
|
+
readonly failure: "Unknown" | "ContextOverflow" | "Authentication" | "InvalidRequest" | "RateLimit" | "Quota" | "Transient" | "InvalidResponse" | "Timeout" | null;
|
|
362
|
+
} | {
|
|
363
|
+
readonly _tag: "Interrupted";
|
|
364
|
+
};
|
|
365
|
+
readonly _tag: "model.called";
|
|
366
|
+
} | {
|
|
367
|
+
readonly _tag: "tool.intercepted";
|
|
368
|
+
readonly run: {
|
|
369
|
+
readonly id: string;
|
|
370
|
+
readonly turn: number;
|
|
371
|
+
readonly ordinal: number;
|
|
372
|
+
} | null;
|
|
373
|
+
readonly tool: string;
|
|
374
|
+
readonly step: number;
|
|
375
|
+
readonly invocationId: string;
|
|
376
|
+
readonly phase: {
|
|
377
|
+
readonly _tag: "Before";
|
|
378
|
+
readonly decision: {
|
|
379
|
+
readonly _tag: "Allow";
|
|
380
|
+
} | {
|
|
381
|
+
readonly _tag: "Deny";
|
|
382
|
+
readonly failure: {
|
|
383
|
+
readonly error: string;
|
|
384
|
+
readonly message: string;
|
|
385
|
+
};
|
|
386
|
+
} | {
|
|
387
|
+
readonly _tag: "Rewrite";
|
|
388
|
+
readonly input: Schema.Json;
|
|
389
|
+
} | {
|
|
390
|
+
readonly _tag: "Respond";
|
|
391
|
+
readonly kind: "Success" | "Failure";
|
|
392
|
+
};
|
|
393
|
+
} | {
|
|
394
|
+
readonly _tag: "After";
|
|
395
|
+
readonly decision: {
|
|
396
|
+
readonly _tag: "Keep";
|
|
397
|
+
} | {
|
|
398
|
+
readonly _tag: "Replace";
|
|
399
|
+
readonly kind: "Success" | "Failure";
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
readonly toolCallId?: string;
|
|
403
|
+
readonly source?: "loop" | "direct";
|
|
404
|
+
};
|
|
405
|
+
};
|
|
406
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
407
|
+
} | {
|
|
408
|
+
readonly _tag: "turn.ended";
|
|
409
|
+
readonly reason: "partial" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
410
|
+
readonly turn: number;
|
|
411
|
+
readonly session: {
|
|
412
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
413
|
+
readonly owner: string;
|
|
414
|
+
};
|
|
415
|
+
readonly journal: {
|
|
416
|
+
readonly seq: number;
|
|
417
|
+
readonly at: number;
|
|
418
|
+
};
|
|
419
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
420
|
+
readonly failureCode?: string;
|
|
421
|
+
} | {
|
|
422
|
+
readonly _tag: "begin.result";
|
|
423
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
424
|
+
readonly result: {
|
|
425
|
+
readonly outcome: "partial" | "waiting" | "completed" | "failed";
|
|
426
|
+
readonly usage: {
|
|
427
|
+
readonly inputTokens: number;
|
|
428
|
+
readonly outputTokens: number;
|
|
429
|
+
readonly totalTokens: number;
|
|
430
|
+
readonly cacheReadTokens: number;
|
|
431
|
+
readonly cacheWriteTokens: number;
|
|
432
|
+
readonly reasoningTokens: number;
|
|
433
|
+
};
|
|
434
|
+
readonly reply: Option.Option<string>;
|
|
435
|
+
readonly pending?: number;
|
|
436
|
+
};
|
|
437
|
+
} | {
|
|
438
|
+
readonly _tag: "queued";
|
|
439
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
440
|
+
readonly command: "steer" | "send";
|
|
441
|
+
readonly enqueued: boolean;
|
|
442
|
+
readonly pending: number;
|
|
443
|
+
} | {
|
|
444
|
+
readonly _tag: "answered";
|
|
445
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
446
|
+
readonly accepted: true;
|
|
447
|
+
readonly enqueued: boolean;
|
|
448
|
+
} | {
|
|
449
|
+
readonly _tag: "cancelled";
|
|
450
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
451
|
+
readonly cancelled: boolean;
|
|
452
|
+
readonly pending: number;
|
|
453
|
+
} | {
|
|
454
|
+
readonly _tag: "pong";
|
|
455
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
456
|
+
readonly activity: {
|
|
457
|
+
readonly openTurns: readonly {
|
|
458
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
459
|
+
readonly turn: number;
|
|
460
|
+
readonly since: number;
|
|
461
|
+
}[];
|
|
462
|
+
readonly beginningTurns: number;
|
|
463
|
+
readonly runningTasks: number;
|
|
464
|
+
readonly waiting: readonly {
|
|
465
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
466
|
+
readonly pending: number;
|
|
467
|
+
}[];
|
|
468
|
+
readonly queuedInput: number;
|
|
469
|
+
readonly inFlight: boolean;
|
|
470
|
+
readonly busy: boolean;
|
|
471
|
+
readonly stopping: boolean;
|
|
472
|
+
};
|
|
473
|
+
} | {
|
|
474
|
+
readonly _tag: "shutdown";
|
|
475
|
+
readonly report: {
|
|
476
|
+
readonly idle: boolean;
|
|
477
|
+
readonly interrupted: readonly {
|
|
478
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
479
|
+
readonly turn: number;
|
|
480
|
+
readonly since: number;
|
|
481
|
+
}[];
|
|
482
|
+
readonly left: {
|
|
483
|
+
readonly openTurns: readonly {
|
|
484
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
485
|
+
readonly turn: number;
|
|
486
|
+
readonly since: number;
|
|
487
|
+
}[];
|
|
488
|
+
readonly beginningTurns: number;
|
|
489
|
+
readonly runningTasks: number;
|
|
490
|
+
readonly waiting: readonly {
|
|
491
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
492
|
+
readonly pending: number;
|
|
493
|
+
}[];
|
|
494
|
+
readonly queuedInput: number;
|
|
495
|
+
readonly inFlight: boolean;
|
|
496
|
+
readonly busy: boolean;
|
|
497
|
+
readonly stopping: boolean;
|
|
498
|
+
};
|
|
499
|
+
};
|
|
500
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
501
|
+
} | {
|
|
502
|
+
readonly message: string;
|
|
503
|
+
readonly _tag: "error";
|
|
504
|
+
readonly code: "host.busy" | "host.command" | "host.owner" | "host.peer" | "host.runtime" | "host.setup" | "host.stopping" | "host.unsupported" | "protocol.handshake" | "protocol.invalid" | "protocol.sequence" | "protocol.version";
|
|
505
|
+
readonly fatal: boolean;
|
|
506
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
507
|
+
readonly frameworkCode?: string;
|
|
508
|
+
}) => Effect.Effect<string, ProcessPeerError, never>;
|
|
509
|
+
/** Field-selected UI progress by default, or an explicit JSON snapshot of full non-lifecycle content. @public */
|
|
510
|
+
export declare const processProgressOf: (event: {
|
|
511
|
+
readonly _tag: "turn.started";
|
|
512
|
+
readonly turn: number;
|
|
513
|
+
readonly meta: {
|
|
514
|
+
readonly [x: string]: Schema.Json;
|
|
515
|
+
};
|
|
516
|
+
readonly userMessage: import("@xandreed/core").UserMessage;
|
|
517
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
518
|
+
readonly resumes?: number;
|
|
519
|
+
} | {
|
|
520
|
+
readonly _tag: "step.started";
|
|
521
|
+
readonly step: number;
|
|
522
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
523
|
+
readonly planned: boolean;
|
|
524
|
+
readonly activeTools: readonly string[];
|
|
525
|
+
} | {
|
|
526
|
+
readonly _tag: "tool.started";
|
|
527
|
+
readonly input: unknown;
|
|
528
|
+
readonly tool: string;
|
|
529
|
+
readonly step: number;
|
|
530
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
531
|
+
readonly stage: Option.Option<string>;
|
|
532
|
+
readonly labels: {
|
|
533
|
+
readonly [x: string]: string;
|
|
534
|
+
};
|
|
535
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
536
|
+
} | {
|
|
537
|
+
readonly message: string;
|
|
538
|
+
readonly _tag: "tool.refused";
|
|
539
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
540
|
+
readonly input: unknown;
|
|
541
|
+
readonly tool: string;
|
|
542
|
+
readonly step: number;
|
|
543
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
544
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
545
|
+
} | {
|
|
546
|
+
readonly _tag: "tool.completed";
|
|
547
|
+
readonly input: unknown;
|
|
548
|
+
readonly tool: string;
|
|
549
|
+
readonly ok: boolean;
|
|
550
|
+
readonly step: number;
|
|
551
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
552
|
+
readonly encoded: unknown;
|
|
553
|
+
readonly durationMs: number;
|
|
554
|
+
readonly stage: Option.Option<string>;
|
|
555
|
+
readonly labels: {
|
|
556
|
+
readonly [x: string]: string;
|
|
557
|
+
};
|
|
558
|
+
readonly result: unknown;
|
|
559
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
560
|
+
} | {
|
|
561
|
+
readonly _tag: "tool.progress";
|
|
562
|
+
readonly text: string;
|
|
563
|
+
readonly tool: string;
|
|
564
|
+
readonly step: number;
|
|
565
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
566
|
+
readonly channel: "status" | "stdout" | "stderr";
|
|
567
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
568
|
+
} | {
|
|
569
|
+
readonly _tag: "step.ended";
|
|
570
|
+
readonly step: number;
|
|
571
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
572
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
573
|
+
readonly results: readonly {
|
|
574
|
+
readonly entry: string & import("effect/Brand").Brand<"EntryId">;
|
|
575
|
+
readonly toolCallId: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
576
|
+
readonly tool: string;
|
|
577
|
+
readonly ok: boolean;
|
|
578
|
+
}[];
|
|
579
|
+
} | {
|
|
580
|
+
readonly _tag: "completion.evaluated";
|
|
581
|
+
readonly step: number;
|
|
582
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
583
|
+
readonly verdict: {
|
|
584
|
+
readonly complete: boolean;
|
|
585
|
+
readonly awaiting: readonly string[];
|
|
586
|
+
readonly facts: {
|
|
587
|
+
readonly [x: string]: Schema.Json;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
} | {
|
|
591
|
+
readonly _tag: "skills.activated";
|
|
592
|
+
readonly skills: readonly string[];
|
|
593
|
+
readonly tools: readonly string[];
|
|
594
|
+
readonly source: "always" | "matcher" | "load_skill" | "host";
|
|
595
|
+
} | {
|
|
596
|
+
readonly _tag: "context.built";
|
|
597
|
+
readonly step: number;
|
|
598
|
+
readonly turn: number;
|
|
599
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
600
|
+
readonly strategy: string;
|
|
601
|
+
readonly strategyVersion: string;
|
|
602
|
+
readonly fingerprint: string;
|
|
603
|
+
readonly systemFingerprint: string;
|
|
604
|
+
readonly estimatedTokens: number;
|
|
605
|
+
readonly reservedTokens: number;
|
|
606
|
+
readonly budgetTokens: number;
|
|
607
|
+
readonly compactions: number;
|
|
608
|
+
readonly activeTools: readonly string[];
|
|
609
|
+
} | {
|
|
610
|
+
readonly _tag: "decision.recorded";
|
|
611
|
+
readonly record: {
|
|
612
|
+
readonly version: 1;
|
|
613
|
+
readonly id: string & import("effect/Brand").Brand<"DecisionId">;
|
|
614
|
+
readonly family: string;
|
|
615
|
+
readonly contextHash: string;
|
|
616
|
+
readonly candidateHash: string;
|
|
617
|
+
readonly policyVersion: string;
|
|
618
|
+
readonly candidates: readonly {
|
|
619
|
+
readonly id: string & import("effect/Brand").Brand<"CandidateId">;
|
|
620
|
+
readonly description: string;
|
|
621
|
+
}[];
|
|
622
|
+
readonly attempts: readonly string[];
|
|
623
|
+
readonly selection: Option.Option<string>;
|
|
624
|
+
readonly validation: "failed" | "cancelled" | "accepted" | "rejected" | "abstained" | "bypassed";
|
|
625
|
+
readonly fallback: Option.Option<string>;
|
|
626
|
+
readonly applied: Option.Option<string>;
|
|
627
|
+
readonly probabilities: Option.Option<{
|
|
628
|
+
readonly [x: string]: number;
|
|
629
|
+
}>;
|
|
630
|
+
};
|
|
631
|
+
} | {
|
|
632
|
+
readonly _tag: "assistant.message";
|
|
633
|
+
readonly step: number;
|
|
634
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
635
|
+
readonly text: string;
|
|
636
|
+
readonly reasoning: string;
|
|
637
|
+
readonly model: Option.Option<string>;
|
|
638
|
+
readonly toolCalls: readonly {
|
|
639
|
+
readonly id: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
640
|
+
readonly tool: string;
|
|
641
|
+
readonly input: unknown;
|
|
642
|
+
}[];
|
|
643
|
+
readonly usage: {
|
|
644
|
+
readonly inputTokens: number;
|
|
645
|
+
readonly outputTokens: number;
|
|
646
|
+
readonly totalTokens: number;
|
|
647
|
+
readonly cacheReadTokens: number;
|
|
648
|
+
readonly cacheWriteTokens: number;
|
|
649
|
+
readonly reasoningTokens: number;
|
|
650
|
+
};
|
|
651
|
+
readonly finishReason: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "pause" | "other" | "unknown";
|
|
652
|
+
} | {
|
|
653
|
+
readonly _tag: "assistant.delta";
|
|
654
|
+
readonly step: number;
|
|
655
|
+
readonly channel: "reasoning" | "text" | "tool-params";
|
|
656
|
+
readonly id: string & import("effect/Brand").Brand<"StreamPartId">;
|
|
657
|
+
readonly delta: string;
|
|
658
|
+
} | {
|
|
659
|
+
readonly _tag: "stream.fallback";
|
|
660
|
+
readonly step: number;
|
|
661
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
662
|
+
readonly message: string;
|
|
663
|
+
} | {
|
|
664
|
+
readonly _tag: "turn.ended";
|
|
665
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
666
|
+
readonly turn: number;
|
|
667
|
+
readonly outcome: "partial" | "waiting" | "completed" | "failed";
|
|
668
|
+
readonly reply: Option.Option<string>;
|
|
669
|
+
readonly usage: {
|
|
670
|
+
readonly inputTokens: number;
|
|
671
|
+
readonly outputTokens: number;
|
|
672
|
+
readonly totalTokens: number;
|
|
673
|
+
readonly cacheReadTokens: number;
|
|
674
|
+
readonly cacheWriteTokens: number;
|
|
675
|
+
readonly reasoningTokens: number;
|
|
676
|
+
};
|
|
677
|
+
} | {
|
|
678
|
+
readonly _tag: "host";
|
|
679
|
+
readonly name: string;
|
|
680
|
+
readonly data: {
|
|
681
|
+
readonly [x: string]: Schema.Json;
|
|
682
|
+
};
|
|
683
|
+
} | {
|
|
684
|
+
readonly callId: string & import("effect/Brand").Brand<"ModelCallId">;
|
|
685
|
+
readonly attempt: number;
|
|
686
|
+
readonly purpose: "Loop" | "Helper";
|
|
687
|
+
readonly method: "Text" | "Object" | "Stream";
|
|
688
|
+
readonly model: Option.Option<import("@xandreed/core").ModelSelection>;
|
|
689
|
+
readonly runId: Option.Option<string & import("effect/Brand").Brand<"RunId">>;
|
|
690
|
+
readonly run: Option.Option<number & import("effect/Brand").Brand<"RunOrdinal">>;
|
|
691
|
+
readonly step: Option.Option<number>;
|
|
692
|
+
readonly durationMs: number;
|
|
693
|
+
readonly usage: {
|
|
694
|
+
readonly _tag: "Unknown";
|
|
695
|
+
} | {
|
|
696
|
+
readonly _tag: "Known";
|
|
697
|
+
readonly usage: {
|
|
698
|
+
readonly inputTokens: number;
|
|
699
|
+
readonly outputTokens: number;
|
|
700
|
+
readonly totalTokens: number;
|
|
701
|
+
readonly cacheReadTokens: number;
|
|
702
|
+
readonly cacheWriteTokens: number;
|
|
703
|
+
readonly reasoningTokens: number;
|
|
704
|
+
};
|
|
705
|
+
} | {
|
|
706
|
+
readonly _tag: "Partial";
|
|
707
|
+
readonly usage: {
|
|
708
|
+
readonly inputTokens: number;
|
|
709
|
+
readonly outputTokens: number;
|
|
710
|
+
readonly totalTokens: number;
|
|
711
|
+
readonly cacheReadTokens: number;
|
|
712
|
+
readonly cacheWriteTokens: number;
|
|
713
|
+
readonly reasoningTokens: number;
|
|
714
|
+
};
|
|
715
|
+
readonly reported: readonly ("inputTokens" | "outputTokens" | "cacheReadTokens" | "cacheWriteTokens" | "reasoningTokens")[];
|
|
716
|
+
};
|
|
717
|
+
readonly outcome: {
|
|
718
|
+
readonly _tag: "Completed";
|
|
719
|
+
} | {
|
|
720
|
+
readonly _tag: "Failed";
|
|
721
|
+
readonly failure: Option.Option<"Unknown" | "ContextOverflow" | "Authentication" | "InvalidRequest" | "RateLimit" | "Quota" | "Transient" | "InvalidResponse" | "Timeout">;
|
|
722
|
+
} | {
|
|
723
|
+
readonly _tag: "Interrupted";
|
|
724
|
+
};
|
|
725
|
+
readonly _tag: "model.called";
|
|
726
|
+
} | {
|
|
727
|
+
readonly _tag: "tool.intercepted";
|
|
728
|
+
readonly run: Option.Option<{
|
|
729
|
+
readonly id: string & import("effect/Brand").Brand<"RunId">;
|
|
730
|
+
readonly turn: number;
|
|
731
|
+
readonly ordinal: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
732
|
+
}>;
|
|
733
|
+
readonly tool: string;
|
|
734
|
+
readonly step: number;
|
|
735
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
736
|
+
readonly phase: {
|
|
737
|
+
readonly _tag: "Before";
|
|
738
|
+
readonly decision: {
|
|
739
|
+
readonly _tag: "Allow";
|
|
740
|
+
} | {
|
|
741
|
+
readonly _tag: "Deny";
|
|
742
|
+
readonly failure: {
|
|
743
|
+
readonly error: string;
|
|
744
|
+
readonly message: string;
|
|
745
|
+
};
|
|
746
|
+
} | {
|
|
747
|
+
readonly _tag: "Rewrite";
|
|
748
|
+
readonly input: Schema.Json;
|
|
749
|
+
} | {
|
|
750
|
+
readonly _tag: "Respond";
|
|
751
|
+
readonly kind: "Success" | "Failure";
|
|
752
|
+
};
|
|
753
|
+
} | {
|
|
754
|
+
readonly _tag: "After";
|
|
755
|
+
readonly decision: {
|
|
756
|
+
readonly _tag: "Keep";
|
|
757
|
+
} | {
|
|
758
|
+
readonly _tag: "Replace";
|
|
759
|
+
readonly kind: "Success" | "Failure";
|
|
760
|
+
};
|
|
761
|
+
};
|
|
762
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
763
|
+
readonly source?: "loop" | "direct";
|
|
764
|
+
}, mode: "full" | "projection") => Effect.Effect<Option.Option<{
|
|
765
|
+
readonly mode: "projection";
|
|
766
|
+
readonly event: {
|
|
767
|
+
readonly _tag: "step.started";
|
|
768
|
+
readonly step: number;
|
|
769
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
770
|
+
readonly planned: boolean;
|
|
771
|
+
} | {
|
|
772
|
+
readonly _tag: "step.ended";
|
|
773
|
+
readonly step: number;
|
|
774
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
775
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
776
|
+
} | {
|
|
777
|
+
readonly _tag: "assistant.delta";
|
|
778
|
+
readonly step: number;
|
|
779
|
+
readonly id: string & import("effect/Brand").Brand<"StreamPartId">;
|
|
780
|
+
readonly delta: string;
|
|
781
|
+
} | {
|
|
782
|
+
readonly _tag: "assistant.message";
|
|
783
|
+
readonly step: number;
|
|
784
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
785
|
+
readonly text: string;
|
|
786
|
+
} | {
|
|
787
|
+
readonly _tag: "tool.started";
|
|
788
|
+
readonly tool: string;
|
|
789
|
+
readonly step: number;
|
|
790
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
791
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
792
|
+
} | {
|
|
793
|
+
readonly _tag: "tool.completed";
|
|
794
|
+
readonly tool: string;
|
|
795
|
+
readonly ok: boolean;
|
|
796
|
+
readonly step: number;
|
|
797
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
798
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
799
|
+
} | {
|
|
800
|
+
readonly _tag: "tool.refused";
|
|
801
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
802
|
+
readonly tool: string;
|
|
803
|
+
readonly step: number;
|
|
804
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
805
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
806
|
+
} | {
|
|
807
|
+
readonly _tag: "tool.progress";
|
|
808
|
+
readonly text: string;
|
|
809
|
+
readonly tool: string;
|
|
810
|
+
readonly step: number;
|
|
811
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
812
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
813
|
+
} | {
|
|
814
|
+
readonly _tag: "stream.fallback";
|
|
815
|
+
readonly step: number;
|
|
816
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
817
|
+
};
|
|
818
|
+
} | {
|
|
819
|
+
readonly mode: "full";
|
|
820
|
+
readonly event: {
|
|
821
|
+
readonly _tag: "step.started";
|
|
822
|
+
readonly step: number;
|
|
823
|
+
readonly activeTools: readonly string[];
|
|
824
|
+
readonly planned: boolean;
|
|
825
|
+
readonly run?: number;
|
|
826
|
+
} | {
|
|
827
|
+
readonly _tag: "tool.started";
|
|
828
|
+
readonly input: unknown;
|
|
829
|
+
readonly tool: string;
|
|
830
|
+
readonly step: number;
|
|
831
|
+
readonly invocationId: string;
|
|
832
|
+
readonly stage: string | null;
|
|
833
|
+
readonly labels: {
|
|
834
|
+
readonly [x: string]: string;
|
|
835
|
+
};
|
|
836
|
+
readonly toolCallId?: string;
|
|
837
|
+
} | {
|
|
838
|
+
readonly message: string;
|
|
839
|
+
readonly _tag: "tool.refused";
|
|
840
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
841
|
+
readonly input: unknown;
|
|
842
|
+
readonly tool: string;
|
|
843
|
+
readonly step: number;
|
|
844
|
+
readonly invocationId: string;
|
|
845
|
+
readonly toolCallId?: string;
|
|
846
|
+
} | {
|
|
847
|
+
readonly _tag: "tool.progress";
|
|
848
|
+
readonly text: string;
|
|
849
|
+
readonly tool: string;
|
|
850
|
+
readonly step: number;
|
|
851
|
+
readonly invocationId: string;
|
|
852
|
+
readonly channel: "status" | "stdout" | "stderr";
|
|
853
|
+
readonly toolCallId?: string;
|
|
854
|
+
} | {
|
|
855
|
+
readonly _tag: "tool.completed";
|
|
856
|
+
readonly input: unknown;
|
|
857
|
+
readonly tool: string;
|
|
858
|
+
readonly ok: boolean;
|
|
859
|
+
readonly step: number;
|
|
860
|
+
readonly invocationId: string;
|
|
861
|
+
readonly encoded: unknown;
|
|
862
|
+
readonly durationMs: number;
|
|
863
|
+
readonly stage: string | null;
|
|
864
|
+
readonly labels: {
|
|
865
|
+
readonly [x: string]: string;
|
|
866
|
+
};
|
|
867
|
+
readonly result: unknown;
|
|
868
|
+
readonly toolCallId?: string;
|
|
869
|
+
} | {
|
|
870
|
+
readonly _tag: "step.ended";
|
|
871
|
+
readonly step: number;
|
|
872
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
873
|
+
readonly results: readonly {
|
|
874
|
+
readonly entry: string;
|
|
875
|
+
readonly toolCallId: string;
|
|
876
|
+
readonly tool: string;
|
|
877
|
+
readonly ok: boolean;
|
|
878
|
+
}[];
|
|
879
|
+
readonly run?: number;
|
|
880
|
+
} | {
|
|
881
|
+
readonly _tag: "completion.evaluated";
|
|
882
|
+
readonly step: number;
|
|
883
|
+
readonly verdict: {
|
|
884
|
+
readonly complete: boolean;
|
|
885
|
+
readonly awaiting: readonly string[];
|
|
886
|
+
readonly facts: {
|
|
887
|
+
readonly [x: string]: Schema.Json;
|
|
888
|
+
};
|
|
889
|
+
};
|
|
890
|
+
readonly run?: number;
|
|
891
|
+
} | {
|
|
892
|
+
readonly _tag: "skills.activated";
|
|
893
|
+
readonly skills: readonly string[];
|
|
894
|
+
readonly tools: readonly string[];
|
|
895
|
+
readonly source: "always" | "matcher" | "load_skill" | "host";
|
|
896
|
+
} | {
|
|
897
|
+
readonly _tag: "context.built";
|
|
898
|
+
readonly fingerprint: string;
|
|
899
|
+
readonly turn: number;
|
|
900
|
+
readonly step: number;
|
|
901
|
+
readonly strategy: string;
|
|
902
|
+
readonly compactions: number;
|
|
903
|
+
readonly estimatedTokens: number;
|
|
904
|
+
readonly activeTools: readonly string[];
|
|
905
|
+
readonly strategyVersion: string;
|
|
906
|
+
readonly reservedTokens: number;
|
|
907
|
+
readonly systemFingerprint: string;
|
|
908
|
+
readonly budgetTokens: number;
|
|
909
|
+
readonly run?: number;
|
|
910
|
+
} | {
|
|
911
|
+
readonly _tag: "decision.recorded";
|
|
912
|
+
readonly record: {
|
|
913
|
+
readonly version: 1;
|
|
914
|
+
readonly id: string;
|
|
915
|
+
readonly family: string;
|
|
916
|
+
readonly contextHash: string;
|
|
917
|
+
readonly candidateHash: string;
|
|
918
|
+
readonly policyVersion: string;
|
|
919
|
+
readonly candidates: readonly {
|
|
920
|
+
readonly id: string;
|
|
921
|
+
readonly description: string;
|
|
922
|
+
}[];
|
|
923
|
+
readonly attempts: readonly string[];
|
|
924
|
+
readonly selection: string | null;
|
|
925
|
+
readonly validation: "failed" | "cancelled" | "accepted" | "rejected" | "abstained" | "bypassed";
|
|
926
|
+
readonly fallback: string | null;
|
|
927
|
+
readonly applied: string | null;
|
|
928
|
+
readonly probabilities: {
|
|
929
|
+
readonly [x: string]: number;
|
|
930
|
+
} | null;
|
|
931
|
+
};
|
|
932
|
+
} | {
|
|
933
|
+
readonly _tag: "assistant.message";
|
|
934
|
+
readonly reasoning: string;
|
|
935
|
+
readonly text: string;
|
|
936
|
+
readonly usage: {
|
|
937
|
+
readonly inputTokens: number;
|
|
938
|
+
readonly outputTokens: number;
|
|
939
|
+
readonly totalTokens: number;
|
|
940
|
+
readonly cacheReadTokens: number;
|
|
941
|
+
readonly cacheWriteTokens?: number;
|
|
942
|
+
readonly reasoningTokens?: number;
|
|
943
|
+
};
|
|
944
|
+
readonly step: number;
|
|
945
|
+
readonly model: string | null;
|
|
946
|
+
readonly toolCalls: readonly {
|
|
947
|
+
readonly id: string;
|
|
948
|
+
readonly tool: string;
|
|
949
|
+
readonly input: unknown;
|
|
950
|
+
}[];
|
|
951
|
+
readonly finishReason: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "pause" | "other" | "unknown";
|
|
952
|
+
readonly run?: number;
|
|
953
|
+
} | {
|
|
954
|
+
readonly _tag: "assistant.delta";
|
|
955
|
+
readonly step: number;
|
|
956
|
+
readonly channel: "reasoning" | "text" | "tool-params";
|
|
957
|
+
readonly id: string;
|
|
958
|
+
readonly delta: string;
|
|
959
|
+
} | {
|
|
960
|
+
readonly message: string;
|
|
961
|
+
readonly _tag: "stream.fallback";
|
|
962
|
+
readonly step: number;
|
|
963
|
+
readonly run?: number;
|
|
964
|
+
} | {
|
|
965
|
+
readonly _tag: "host";
|
|
966
|
+
readonly name: string;
|
|
967
|
+
readonly data: {
|
|
968
|
+
readonly [x: string]: Schema.Json;
|
|
969
|
+
};
|
|
970
|
+
} | {
|
|
971
|
+
readonly callId: string;
|
|
972
|
+
readonly attempt: number;
|
|
973
|
+
readonly purpose: "Loop" | "Helper";
|
|
974
|
+
readonly method: "Text" | "Object" | "Stream";
|
|
975
|
+
readonly model: {
|
|
976
|
+
readonly provider: string;
|
|
977
|
+
readonly modelId: string;
|
|
978
|
+
} | null;
|
|
979
|
+
readonly runId: string | null;
|
|
980
|
+
readonly run: number | null;
|
|
981
|
+
readonly step: number | null;
|
|
982
|
+
readonly durationMs: number;
|
|
983
|
+
readonly usage: {
|
|
984
|
+
readonly _tag: "Unknown";
|
|
985
|
+
} | {
|
|
986
|
+
readonly _tag: "Known";
|
|
987
|
+
readonly usage: {
|
|
988
|
+
readonly inputTokens: number;
|
|
989
|
+
readonly outputTokens: number;
|
|
990
|
+
readonly totalTokens: number;
|
|
991
|
+
readonly cacheReadTokens: number;
|
|
992
|
+
readonly cacheWriteTokens: number;
|
|
993
|
+
readonly reasoningTokens: number;
|
|
994
|
+
};
|
|
995
|
+
} | {
|
|
996
|
+
readonly _tag: "Partial";
|
|
997
|
+
readonly usage: {
|
|
998
|
+
readonly inputTokens: number;
|
|
999
|
+
readonly outputTokens: number;
|
|
1000
|
+
readonly totalTokens: number;
|
|
1001
|
+
readonly cacheReadTokens: number;
|
|
1002
|
+
readonly cacheWriteTokens: number;
|
|
1003
|
+
readonly reasoningTokens: number;
|
|
1004
|
+
};
|
|
1005
|
+
readonly reported: readonly ("inputTokens" | "outputTokens" | "cacheReadTokens" | "cacheWriteTokens" | "reasoningTokens")[];
|
|
1006
|
+
};
|
|
1007
|
+
readonly outcome: {
|
|
1008
|
+
readonly _tag: "Completed";
|
|
1009
|
+
} | {
|
|
1010
|
+
readonly _tag: "Failed";
|
|
1011
|
+
readonly failure: "Unknown" | "ContextOverflow" | "Authentication" | "InvalidRequest" | "RateLimit" | "Quota" | "Transient" | "InvalidResponse" | "Timeout" | null;
|
|
1012
|
+
} | {
|
|
1013
|
+
readonly _tag: "Interrupted";
|
|
1014
|
+
};
|
|
1015
|
+
readonly _tag: "model.called";
|
|
1016
|
+
} | {
|
|
1017
|
+
readonly _tag: "tool.intercepted";
|
|
1018
|
+
readonly run: {
|
|
1019
|
+
readonly id: string;
|
|
1020
|
+
readonly turn: number;
|
|
1021
|
+
readonly ordinal: number;
|
|
1022
|
+
} | null;
|
|
1023
|
+
readonly tool: string;
|
|
1024
|
+
readonly step: number;
|
|
1025
|
+
readonly invocationId: string;
|
|
1026
|
+
readonly phase: {
|
|
1027
|
+
readonly _tag: "Before";
|
|
1028
|
+
readonly decision: {
|
|
1029
|
+
readonly _tag: "Allow";
|
|
1030
|
+
} | {
|
|
1031
|
+
readonly _tag: "Deny";
|
|
1032
|
+
readonly failure: {
|
|
1033
|
+
readonly error: string;
|
|
1034
|
+
readonly message: string;
|
|
1035
|
+
};
|
|
1036
|
+
} | {
|
|
1037
|
+
readonly _tag: "Rewrite";
|
|
1038
|
+
readonly input: Schema.Json;
|
|
1039
|
+
} | {
|
|
1040
|
+
readonly _tag: "Respond";
|
|
1041
|
+
readonly kind: "Success" | "Failure";
|
|
1042
|
+
};
|
|
1043
|
+
} | {
|
|
1044
|
+
readonly _tag: "After";
|
|
1045
|
+
readonly decision: {
|
|
1046
|
+
readonly _tag: "Keep";
|
|
1047
|
+
} | {
|
|
1048
|
+
readonly _tag: "Replace";
|
|
1049
|
+
readonly kind: "Success" | "Failure";
|
|
1050
|
+
};
|
|
1051
|
+
};
|
|
1052
|
+
readonly toolCallId?: string;
|
|
1053
|
+
readonly source?: "loop" | "direct";
|
|
1054
|
+
};
|
|
1055
|
+
}>, ProcessPeerError, never>;
|
|
1056
|
+
/** Project only actual acknowledged lifecycle rows; the caller filters the logical log's owner first. @public */
|
|
1057
|
+
export declare const processLifecycleOf: (session: {
|
|
1058
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1059
|
+
readonly owner: string;
|
|
1060
|
+
}, row: {
|
|
1061
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1062
|
+
readonly seq: number;
|
|
1063
|
+
readonly turn: Option.Option<number>;
|
|
1064
|
+
readonly kind: string;
|
|
1065
|
+
readonly at: number;
|
|
1066
|
+
readonly data: {
|
|
1067
|
+
readonly [x: string]: Schema.Json;
|
|
1068
|
+
};
|
|
1069
|
+
}, requestId?: (string & import("effect/Brand").Brand<"ProcessRequestId">) | undefined) => Effect.Effect<Option.Option<{
|
|
1070
|
+
readonly _tag: "hello";
|
|
1071
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1072
|
+
readonly protocolVersion: 1;
|
|
1073
|
+
} | {
|
|
1074
|
+
readonly _tag: "turn.started";
|
|
1075
|
+
readonly turn: number;
|
|
1076
|
+
readonly session: {
|
|
1077
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1078
|
+
readonly owner: string;
|
|
1079
|
+
};
|
|
1080
|
+
readonly origin: "user" | "inbox" | "task";
|
|
1081
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
1082
|
+
readonly journal: {
|
|
1083
|
+
readonly seq: number;
|
|
1084
|
+
readonly at: number;
|
|
1085
|
+
};
|
|
1086
|
+
readonly input?: string & import("effect/Brand").Brand<"InboxItemId">;
|
|
1087
|
+
readonly task?: {
|
|
1088
|
+
readonly taskId: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1089
|
+
readonly parent: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1090
|
+
};
|
|
1091
|
+
readonly resumes?: number;
|
|
1092
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1093
|
+
} | {
|
|
1094
|
+
readonly _tag: "turn.event";
|
|
1095
|
+
readonly turn: number;
|
|
1096
|
+
readonly session: {
|
|
1097
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1098
|
+
readonly owner: string;
|
|
1099
|
+
};
|
|
1100
|
+
readonly runId: string & import("effect/Brand").Brand<"RunId">;
|
|
1101
|
+
readonly progress: {
|
|
1102
|
+
readonly mode: "projection";
|
|
1103
|
+
readonly event: {
|
|
1104
|
+
readonly _tag: "step.started";
|
|
1105
|
+
readonly step: number;
|
|
1106
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
1107
|
+
readonly planned: boolean;
|
|
1108
|
+
} | {
|
|
1109
|
+
readonly _tag: "step.ended";
|
|
1110
|
+
readonly step: number;
|
|
1111
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
1112
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
1113
|
+
} | {
|
|
1114
|
+
readonly _tag: "assistant.delta";
|
|
1115
|
+
readonly step: number;
|
|
1116
|
+
readonly id: string & import("effect/Brand").Brand<"StreamPartId">;
|
|
1117
|
+
readonly delta: string;
|
|
1118
|
+
} | {
|
|
1119
|
+
readonly _tag: "assistant.message";
|
|
1120
|
+
readonly step: number;
|
|
1121
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
1122
|
+
readonly text: string;
|
|
1123
|
+
} | {
|
|
1124
|
+
readonly _tag: "tool.started";
|
|
1125
|
+
readonly tool: string;
|
|
1126
|
+
readonly step: number;
|
|
1127
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
1128
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
1129
|
+
} | {
|
|
1130
|
+
readonly _tag: "tool.completed";
|
|
1131
|
+
readonly tool: string;
|
|
1132
|
+
readonly ok: boolean;
|
|
1133
|
+
readonly step: number;
|
|
1134
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
1135
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
1136
|
+
} | {
|
|
1137
|
+
readonly _tag: "tool.refused";
|
|
1138
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
1139
|
+
readonly tool: string;
|
|
1140
|
+
readonly step: number;
|
|
1141
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
1142
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
1143
|
+
} | {
|
|
1144
|
+
readonly _tag: "tool.progress";
|
|
1145
|
+
readonly text: string;
|
|
1146
|
+
readonly tool: string;
|
|
1147
|
+
readonly step: number;
|
|
1148
|
+
readonly invocationId: string & import("effect/Brand").Brand<"InvocationId">;
|
|
1149
|
+
readonly toolCallId?: string & import("effect/Brand").Brand<"ToolCallId">;
|
|
1150
|
+
} | {
|
|
1151
|
+
readonly _tag: "stream.fallback";
|
|
1152
|
+
readonly step: number;
|
|
1153
|
+
readonly run: number & import("effect/Brand").Brand<"RunOrdinal">;
|
|
1154
|
+
};
|
|
1155
|
+
} | {
|
|
1156
|
+
readonly mode: "full";
|
|
1157
|
+
readonly event: {
|
|
1158
|
+
readonly _tag: "step.started";
|
|
1159
|
+
readonly step: number;
|
|
1160
|
+
readonly activeTools: readonly string[];
|
|
1161
|
+
readonly planned: boolean;
|
|
1162
|
+
readonly run?: number;
|
|
1163
|
+
} | {
|
|
1164
|
+
readonly _tag: "tool.started";
|
|
1165
|
+
readonly input: unknown;
|
|
1166
|
+
readonly tool: string;
|
|
1167
|
+
readonly step: number;
|
|
1168
|
+
readonly invocationId: string;
|
|
1169
|
+
readonly stage: string | null;
|
|
1170
|
+
readonly labels: {
|
|
1171
|
+
readonly [x: string]: string;
|
|
1172
|
+
};
|
|
1173
|
+
readonly toolCallId?: string;
|
|
1174
|
+
} | {
|
|
1175
|
+
readonly message: string;
|
|
1176
|
+
readonly _tag: "tool.refused";
|
|
1177
|
+
readonly reason: "inactive" | "concurrency" | "forbidden" | "denied" | "call-limit" | "tool-call-limit" | "run-call-limit" | "tripped" | "intercepted";
|
|
1178
|
+
readonly input: unknown;
|
|
1179
|
+
readonly tool: string;
|
|
1180
|
+
readonly step: number;
|
|
1181
|
+
readonly invocationId: string;
|
|
1182
|
+
readonly toolCallId?: string;
|
|
1183
|
+
} | {
|
|
1184
|
+
readonly _tag: "tool.progress";
|
|
1185
|
+
readonly text: string;
|
|
1186
|
+
readonly tool: string;
|
|
1187
|
+
readonly step: number;
|
|
1188
|
+
readonly invocationId: string;
|
|
1189
|
+
readonly channel: "status" | "stdout" | "stderr";
|
|
1190
|
+
readonly toolCallId?: string;
|
|
1191
|
+
} | {
|
|
1192
|
+
readonly _tag: "tool.completed";
|
|
1193
|
+
readonly input: unknown;
|
|
1194
|
+
readonly tool: string;
|
|
1195
|
+
readonly ok: boolean;
|
|
1196
|
+
readonly step: number;
|
|
1197
|
+
readonly invocationId: string;
|
|
1198
|
+
readonly encoded: unknown;
|
|
1199
|
+
readonly durationMs: number;
|
|
1200
|
+
readonly stage: string | null;
|
|
1201
|
+
readonly labels: {
|
|
1202
|
+
readonly [x: string]: string;
|
|
1203
|
+
};
|
|
1204
|
+
readonly result: unknown;
|
|
1205
|
+
readonly toolCallId?: string;
|
|
1206
|
+
} | {
|
|
1207
|
+
readonly _tag: "step.ended";
|
|
1208
|
+
readonly step: number;
|
|
1209
|
+
readonly status: "completed" | "failed" | "cancelled" | "malformed" | "truncated";
|
|
1210
|
+
readonly results: readonly {
|
|
1211
|
+
readonly entry: string;
|
|
1212
|
+
readonly toolCallId: string;
|
|
1213
|
+
readonly tool: string;
|
|
1214
|
+
readonly ok: boolean;
|
|
1215
|
+
}[];
|
|
1216
|
+
readonly run?: number;
|
|
1217
|
+
} | {
|
|
1218
|
+
readonly _tag: "completion.evaluated";
|
|
1219
|
+
readonly step: number;
|
|
1220
|
+
readonly verdict: {
|
|
1221
|
+
readonly complete: boolean;
|
|
1222
|
+
readonly awaiting: readonly string[];
|
|
1223
|
+
readonly facts: {
|
|
1224
|
+
readonly [x: string]: Schema.Json;
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
readonly run?: number;
|
|
1228
|
+
} | {
|
|
1229
|
+
readonly _tag: "skills.activated";
|
|
1230
|
+
readonly skills: readonly string[];
|
|
1231
|
+
readonly tools: readonly string[];
|
|
1232
|
+
readonly source: "always" | "matcher" | "load_skill" | "host";
|
|
1233
|
+
} | {
|
|
1234
|
+
readonly _tag: "context.built";
|
|
1235
|
+
readonly fingerprint: string;
|
|
1236
|
+
readonly turn: number;
|
|
1237
|
+
readonly step: number;
|
|
1238
|
+
readonly strategy: string;
|
|
1239
|
+
readonly compactions: number;
|
|
1240
|
+
readonly estimatedTokens: number;
|
|
1241
|
+
readonly activeTools: readonly string[];
|
|
1242
|
+
readonly strategyVersion: string;
|
|
1243
|
+
readonly reservedTokens: number;
|
|
1244
|
+
readonly systemFingerprint: string;
|
|
1245
|
+
readonly budgetTokens: number;
|
|
1246
|
+
readonly run?: number;
|
|
1247
|
+
} | {
|
|
1248
|
+
readonly _tag: "decision.recorded";
|
|
1249
|
+
readonly record: {
|
|
1250
|
+
readonly version: 1;
|
|
1251
|
+
readonly id: string;
|
|
1252
|
+
readonly family: string;
|
|
1253
|
+
readonly contextHash: string;
|
|
1254
|
+
readonly candidateHash: string;
|
|
1255
|
+
readonly policyVersion: string;
|
|
1256
|
+
readonly candidates: readonly {
|
|
1257
|
+
readonly id: string;
|
|
1258
|
+
readonly description: string;
|
|
1259
|
+
}[];
|
|
1260
|
+
readonly attempts: readonly string[];
|
|
1261
|
+
readonly selection: string | null;
|
|
1262
|
+
readonly validation: "failed" | "cancelled" | "accepted" | "rejected" | "abstained" | "bypassed";
|
|
1263
|
+
readonly fallback: string | null;
|
|
1264
|
+
readonly applied: string | null;
|
|
1265
|
+
readonly probabilities: {
|
|
1266
|
+
readonly [x: string]: number;
|
|
1267
|
+
} | null;
|
|
1268
|
+
};
|
|
1269
|
+
} | {
|
|
1270
|
+
readonly _tag: "assistant.message";
|
|
1271
|
+
readonly reasoning: string;
|
|
1272
|
+
readonly text: string;
|
|
1273
|
+
readonly usage: {
|
|
1274
|
+
readonly inputTokens: number;
|
|
1275
|
+
readonly outputTokens: number;
|
|
1276
|
+
readonly totalTokens: number;
|
|
1277
|
+
readonly cacheReadTokens: number;
|
|
1278
|
+
readonly cacheWriteTokens?: number;
|
|
1279
|
+
readonly reasoningTokens?: number;
|
|
1280
|
+
};
|
|
1281
|
+
readonly step: number;
|
|
1282
|
+
readonly model: string | null;
|
|
1283
|
+
readonly toolCalls: readonly {
|
|
1284
|
+
readonly id: string;
|
|
1285
|
+
readonly tool: string;
|
|
1286
|
+
readonly input: unknown;
|
|
1287
|
+
}[];
|
|
1288
|
+
readonly finishReason: "stop" | "length" | "content-filter" | "tool-calls" | "error" | "pause" | "other" | "unknown";
|
|
1289
|
+
readonly run?: number;
|
|
1290
|
+
} | {
|
|
1291
|
+
readonly _tag: "assistant.delta";
|
|
1292
|
+
readonly step: number;
|
|
1293
|
+
readonly channel: "reasoning" | "text" | "tool-params";
|
|
1294
|
+
readonly id: string;
|
|
1295
|
+
readonly delta: string;
|
|
1296
|
+
} | {
|
|
1297
|
+
readonly message: string;
|
|
1298
|
+
readonly _tag: "stream.fallback";
|
|
1299
|
+
readonly step: number;
|
|
1300
|
+
readonly run?: number;
|
|
1301
|
+
} | {
|
|
1302
|
+
readonly _tag: "host";
|
|
1303
|
+
readonly name: string;
|
|
1304
|
+
readonly data: {
|
|
1305
|
+
readonly [x: string]: Schema.Json;
|
|
1306
|
+
};
|
|
1307
|
+
} | {
|
|
1308
|
+
readonly callId: string;
|
|
1309
|
+
readonly attempt: number;
|
|
1310
|
+
readonly purpose: "Loop" | "Helper";
|
|
1311
|
+
readonly method: "Text" | "Object" | "Stream";
|
|
1312
|
+
readonly model: {
|
|
1313
|
+
readonly provider: string;
|
|
1314
|
+
readonly modelId: string;
|
|
1315
|
+
} | null;
|
|
1316
|
+
readonly runId: string | null;
|
|
1317
|
+
readonly run: number | null;
|
|
1318
|
+
readonly step: number | null;
|
|
1319
|
+
readonly durationMs: number;
|
|
1320
|
+
readonly usage: {
|
|
1321
|
+
readonly _tag: "Unknown";
|
|
1322
|
+
} | {
|
|
1323
|
+
readonly _tag: "Known";
|
|
1324
|
+
readonly usage: {
|
|
1325
|
+
readonly inputTokens: number;
|
|
1326
|
+
readonly outputTokens: number;
|
|
1327
|
+
readonly totalTokens: number;
|
|
1328
|
+
readonly cacheReadTokens: number;
|
|
1329
|
+
readonly cacheWriteTokens: number;
|
|
1330
|
+
readonly reasoningTokens: number;
|
|
1331
|
+
};
|
|
1332
|
+
} | {
|
|
1333
|
+
readonly _tag: "Partial";
|
|
1334
|
+
readonly usage: {
|
|
1335
|
+
readonly inputTokens: number;
|
|
1336
|
+
readonly outputTokens: number;
|
|
1337
|
+
readonly totalTokens: number;
|
|
1338
|
+
readonly cacheReadTokens: number;
|
|
1339
|
+
readonly cacheWriteTokens: number;
|
|
1340
|
+
readonly reasoningTokens: number;
|
|
1341
|
+
};
|
|
1342
|
+
readonly reported: readonly ("inputTokens" | "outputTokens" | "cacheReadTokens" | "cacheWriteTokens" | "reasoningTokens")[];
|
|
1343
|
+
};
|
|
1344
|
+
readonly outcome: {
|
|
1345
|
+
readonly _tag: "Completed";
|
|
1346
|
+
} | {
|
|
1347
|
+
readonly _tag: "Failed";
|
|
1348
|
+
readonly failure: "Unknown" | "ContextOverflow" | "Authentication" | "InvalidRequest" | "RateLimit" | "Quota" | "Transient" | "InvalidResponse" | "Timeout" | null;
|
|
1349
|
+
} | {
|
|
1350
|
+
readonly _tag: "Interrupted";
|
|
1351
|
+
};
|
|
1352
|
+
readonly _tag: "model.called";
|
|
1353
|
+
} | {
|
|
1354
|
+
readonly _tag: "tool.intercepted";
|
|
1355
|
+
readonly run: {
|
|
1356
|
+
readonly id: string;
|
|
1357
|
+
readonly turn: number;
|
|
1358
|
+
readonly ordinal: number;
|
|
1359
|
+
} | null;
|
|
1360
|
+
readonly tool: string;
|
|
1361
|
+
readonly step: number;
|
|
1362
|
+
readonly invocationId: string;
|
|
1363
|
+
readonly phase: {
|
|
1364
|
+
readonly _tag: "Before";
|
|
1365
|
+
readonly decision: {
|
|
1366
|
+
readonly _tag: "Allow";
|
|
1367
|
+
} | {
|
|
1368
|
+
readonly _tag: "Deny";
|
|
1369
|
+
readonly failure: {
|
|
1370
|
+
readonly error: string;
|
|
1371
|
+
readonly message: string;
|
|
1372
|
+
};
|
|
1373
|
+
} | {
|
|
1374
|
+
readonly _tag: "Rewrite";
|
|
1375
|
+
readonly input: Schema.Json;
|
|
1376
|
+
} | {
|
|
1377
|
+
readonly _tag: "Respond";
|
|
1378
|
+
readonly kind: "Success" | "Failure";
|
|
1379
|
+
};
|
|
1380
|
+
} | {
|
|
1381
|
+
readonly _tag: "After";
|
|
1382
|
+
readonly decision: {
|
|
1383
|
+
readonly _tag: "Keep";
|
|
1384
|
+
} | {
|
|
1385
|
+
readonly _tag: "Replace";
|
|
1386
|
+
readonly kind: "Success" | "Failure";
|
|
1387
|
+
};
|
|
1388
|
+
};
|
|
1389
|
+
readonly toolCallId?: string;
|
|
1390
|
+
readonly source?: "loop" | "direct";
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1394
|
+
} | {
|
|
1395
|
+
readonly _tag: "turn.ended";
|
|
1396
|
+
readonly reason: "partial" | "waiting" | "completed" | "failed" | "cancelled" | "interrupted";
|
|
1397
|
+
readonly turn: number;
|
|
1398
|
+
readonly session: {
|
|
1399
|
+
readonly id: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1400
|
+
readonly owner: string;
|
|
1401
|
+
};
|
|
1402
|
+
readonly journal: {
|
|
1403
|
+
readonly seq: number;
|
|
1404
|
+
readonly at: number;
|
|
1405
|
+
};
|
|
1406
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1407
|
+
readonly failureCode?: string;
|
|
1408
|
+
} | {
|
|
1409
|
+
readonly _tag: "begin.result";
|
|
1410
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1411
|
+
readonly result: {
|
|
1412
|
+
readonly outcome: "partial" | "waiting" | "completed" | "failed";
|
|
1413
|
+
readonly usage: {
|
|
1414
|
+
readonly inputTokens: number;
|
|
1415
|
+
readonly outputTokens: number;
|
|
1416
|
+
readonly totalTokens: number;
|
|
1417
|
+
readonly cacheReadTokens: number;
|
|
1418
|
+
readonly cacheWriteTokens: number;
|
|
1419
|
+
readonly reasoningTokens: number;
|
|
1420
|
+
};
|
|
1421
|
+
readonly reply: Option.Option<string>;
|
|
1422
|
+
readonly pending?: number;
|
|
1423
|
+
};
|
|
1424
|
+
} | {
|
|
1425
|
+
readonly _tag: "queued";
|
|
1426
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1427
|
+
readonly command: "steer" | "send";
|
|
1428
|
+
readonly enqueued: boolean;
|
|
1429
|
+
readonly pending: number;
|
|
1430
|
+
} | {
|
|
1431
|
+
readonly _tag: "answered";
|
|
1432
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1433
|
+
readonly accepted: true;
|
|
1434
|
+
readonly enqueued: boolean;
|
|
1435
|
+
} | {
|
|
1436
|
+
readonly _tag: "cancelled";
|
|
1437
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1438
|
+
readonly cancelled: boolean;
|
|
1439
|
+
readonly pending: number;
|
|
1440
|
+
} | {
|
|
1441
|
+
readonly _tag: "pong";
|
|
1442
|
+
readonly requestId: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1443
|
+
readonly activity: {
|
|
1444
|
+
readonly openTurns: readonly {
|
|
1445
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1446
|
+
readonly turn: number;
|
|
1447
|
+
readonly since: number;
|
|
1448
|
+
}[];
|
|
1449
|
+
readonly beginningTurns: number;
|
|
1450
|
+
readonly runningTasks: number;
|
|
1451
|
+
readonly waiting: readonly {
|
|
1452
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1453
|
+
readonly pending: number;
|
|
1454
|
+
}[];
|
|
1455
|
+
readonly queuedInput: number;
|
|
1456
|
+
readonly inFlight: boolean;
|
|
1457
|
+
readonly busy: boolean;
|
|
1458
|
+
readonly stopping: boolean;
|
|
1459
|
+
};
|
|
1460
|
+
} | {
|
|
1461
|
+
readonly _tag: "shutdown";
|
|
1462
|
+
readonly report: {
|
|
1463
|
+
readonly idle: boolean;
|
|
1464
|
+
readonly interrupted: readonly {
|
|
1465
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1466
|
+
readonly turn: number;
|
|
1467
|
+
readonly since: number;
|
|
1468
|
+
}[];
|
|
1469
|
+
readonly left: {
|
|
1470
|
+
readonly openTurns: readonly {
|
|
1471
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1472
|
+
readonly turn: number;
|
|
1473
|
+
readonly since: number;
|
|
1474
|
+
}[];
|
|
1475
|
+
readonly beginningTurns: number;
|
|
1476
|
+
readonly runningTasks: number;
|
|
1477
|
+
readonly waiting: readonly {
|
|
1478
|
+
readonly session: string & import("effect/Brand").Brand<"ConversationId">;
|
|
1479
|
+
readonly pending: number;
|
|
1480
|
+
}[];
|
|
1481
|
+
readonly queuedInput: number;
|
|
1482
|
+
readonly inFlight: boolean;
|
|
1483
|
+
readonly busy: boolean;
|
|
1484
|
+
readonly stopping: boolean;
|
|
1485
|
+
};
|
|
1486
|
+
};
|
|
1487
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1488
|
+
} | {
|
|
1489
|
+
readonly message: string;
|
|
1490
|
+
readonly _tag: "error";
|
|
1491
|
+
readonly code: "host.busy" | "host.command" | "host.owner" | "host.peer" | "host.runtime" | "host.setup" | "host.stopping" | "host.unsupported" | "protocol.handshake" | "protocol.invalid" | "protocol.sequence" | "protocol.version";
|
|
1492
|
+
readonly fatal: boolean;
|
|
1493
|
+
readonly requestId?: string & import("effect/Brand").Brand<"ProcessRequestId">;
|
|
1494
|
+
readonly frameworkCode?: string;
|
|
1495
|
+
}>, ProcessPeerError, never>;
|