@xandreed/process-host 0.0.0-stage → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,970 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { UserMessage } from "@xandreed/core";
|
|
3
|
+
/** The supported wire protocol; stored journal formats have their own version. @public */
|
|
4
|
+
export declare const PROCESS_PROTOCOL_VERSION = 1;
|
|
5
|
+
/** Correlates an outstanding command; durable idempotence belongs to framework input/key identities. @public */
|
|
6
|
+
export declare const ProcessRequestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
7
|
+
export type ProcessRequestId = typeof ProcessRequestId.Type;
|
|
8
|
+
/** Full progress exports all JSON-compatible event content and must be selected explicitly. @public */
|
|
9
|
+
export declare const ProcessEventMode: Schema.Literals<readonly ["projection", "full"]>;
|
|
10
|
+
export type ProcessEventMode = typeof ProcessEventMode.Type;
|
|
11
|
+
/** Version 1 requests. The parent host creates sessions and supplies the Agent and its services. @public */
|
|
12
|
+
export declare const ProcessCommand: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"hello", {
|
|
13
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
14
|
+
readonly protocolVersion: Schema.Int;
|
|
15
|
+
}>, Schema.TaggedStruct<"begin", {
|
|
16
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
17
|
+
readonly session: Schema.Struct<{
|
|
18
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
19
|
+
readonly owner: Schema.Trimmed;
|
|
20
|
+
}>;
|
|
21
|
+
readonly runId: Schema.brand<Schema.String, "RunId">;
|
|
22
|
+
readonly userMessage: typeof UserMessage;
|
|
23
|
+
readonly key: Schema.optionalKey<Schema.String>;
|
|
24
|
+
readonly command: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
25
|
+
readonly meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
26
|
+
readonly resumes: Schema.optionalKey<Schema.Int>;
|
|
27
|
+
readonly takeOver: Schema.optionalKey<Schema.Boolean>;
|
|
28
|
+
readonly timeLimitMs: Schema.optionalKey<Schema.Int>;
|
|
29
|
+
}>, Schema.TaggedStruct<"send", {
|
|
30
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
31
|
+
readonly session: Schema.Struct<{
|
|
32
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
33
|
+
readonly owner: Schema.Trimmed;
|
|
34
|
+
}>;
|
|
35
|
+
readonly input: Schema.Struct<{
|
|
36
|
+
readonly id: Schema.brand<Schema.Trimmed, "InboxItemId">;
|
|
37
|
+
readonly source: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
38
|
+
readonly userMessage: typeof UserMessage;
|
|
39
|
+
}>;
|
|
40
|
+
}>, Schema.TaggedStruct<"steer", {
|
|
41
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
42
|
+
readonly session: Schema.Struct<{
|
|
43
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
44
|
+
readonly owner: Schema.Trimmed;
|
|
45
|
+
}>;
|
|
46
|
+
readonly input: Schema.Struct<{
|
|
47
|
+
readonly id: Schema.brand<Schema.Trimmed, "InboxItemId">;
|
|
48
|
+
readonly source: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
49
|
+
readonly userMessage: typeof UserMessage;
|
|
50
|
+
}>;
|
|
51
|
+
}>, Schema.TaggedStruct<"answer", {
|
|
52
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
53
|
+
readonly parent: Schema.Struct<{
|
|
54
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
55
|
+
readonly owner: Schema.Trimmed;
|
|
56
|
+
}>;
|
|
57
|
+
readonly taskId: Schema.brand<Schema.String, "ConversationId">;
|
|
58
|
+
readonly questionId: Schema.brand<Schema.Trimmed, "TaskQuestionId">;
|
|
59
|
+
readonly text: Schema.NonEmptyString;
|
|
60
|
+
}>, Schema.TaggedStruct<"cancel", {
|
|
61
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
62
|
+
readonly session: Schema.Struct<{
|
|
63
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
64
|
+
readonly owner: Schema.Trimmed;
|
|
65
|
+
}>;
|
|
66
|
+
readonly turn: Schema.Int;
|
|
67
|
+
}>, Schema.TaggedStruct<"ping", {
|
|
68
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
69
|
+
}>, Schema.TaggedStruct<"shutdown", {
|
|
70
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
71
|
+
readonly deadlineMs: Schema.optionalKey<Schema.Int>;
|
|
72
|
+
}>]>;
|
|
73
|
+
export type ProcessCommand = typeof ProcessCommand.Type;
|
|
74
|
+
/** UI progress with explicit field selection; decoded tool values and provider failures are excluded. */
|
|
75
|
+
export declare const ProcessProjection: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"step.started", {
|
|
76
|
+
readonly step: Schema.Int;
|
|
77
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
78
|
+
readonly planned: Schema.Boolean;
|
|
79
|
+
}>, Schema.TaggedStruct<"step.ended", {
|
|
80
|
+
readonly step: Schema.Int;
|
|
81
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
82
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "malformed", "truncated"]>;
|
|
83
|
+
}>, Schema.TaggedStruct<"assistant.delta", {
|
|
84
|
+
readonly step: Schema.Int;
|
|
85
|
+
readonly id: Schema.brand<Schema.String, "StreamPartId">;
|
|
86
|
+
readonly delta: Schema.String;
|
|
87
|
+
}>, Schema.TaggedStruct<"assistant.message", {
|
|
88
|
+
readonly step: Schema.Int;
|
|
89
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
90
|
+
readonly text: Schema.String;
|
|
91
|
+
}>, Schema.TaggedStruct<"tool.started", {
|
|
92
|
+
step: Schema.Int;
|
|
93
|
+
invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
94
|
+
toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
95
|
+
tool: Schema.String;
|
|
96
|
+
}>, Schema.TaggedStruct<"tool.completed", {
|
|
97
|
+
readonly ok: Schema.Boolean;
|
|
98
|
+
readonly step: Schema.Int;
|
|
99
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
100
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
101
|
+
readonly tool: Schema.String;
|
|
102
|
+
}>, Schema.TaggedStruct<"tool.refused", {
|
|
103
|
+
readonly reason: Schema.Literals<readonly ["inactive", "forbidden", "denied", "call-limit", "tool-call-limit", "run-call-limit", "tripped", "concurrency", "intercepted"]>;
|
|
104
|
+
readonly step: Schema.Int;
|
|
105
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
106
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
107
|
+
readonly tool: Schema.String;
|
|
108
|
+
}>, Schema.TaggedStruct<"tool.progress", {
|
|
109
|
+
readonly text: Schema.String;
|
|
110
|
+
readonly step: Schema.Int;
|
|
111
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
112
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
113
|
+
readonly tool: Schema.String;
|
|
114
|
+
}>, Schema.TaggedStruct<"stream.fallback", {
|
|
115
|
+
readonly step: Schema.Int;
|
|
116
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
117
|
+
}>]>;
|
|
118
|
+
export type ProcessProjection = typeof ProcessProjection.Type;
|
|
119
|
+
/** Bus lifecycle events are provisional; only acknowledged SessionLog rows produce lifecycle frames. */
|
|
120
|
+
export declare const ProcessFullEvent: Schema.Union<readonly [Schema.Struct<{
|
|
121
|
+
readonly _tag: Schema.tag<"step.started">;
|
|
122
|
+
readonly step: Schema.Int;
|
|
123
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
124
|
+
readonly planned: Schema.Boolean;
|
|
125
|
+
readonly activeTools: Schema.$Array<Schema.String>;
|
|
126
|
+
}>, Schema.Struct<{
|
|
127
|
+
readonly _tag: Schema.tag<"tool.started">;
|
|
128
|
+
readonly step: Schema.Int;
|
|
129
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
130
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
131
|
+
readonly tool: Schema.String;
|
|
132
|
+
readonly input: Schema.Unknown;
|
|
133
|
+
readonly labels: Schema.$Record<Schema.String, Schema.String>;
|
|
134
|
+
readonly stage: Schema.OptionFromNullOr<Schema.String>;
|
|
135
|
+
}>, Schema.Struct<{
|
|
136
|
+
readonly _tag: Schema.tag<"tool.refused">;
|
|
137
|
+
readonly step: Schema.Int;
|
|
138
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
139
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
140
|
+
readonly tool: Schema.String;
|
|
141
|
+
readonly input: Schema.Unknown;
|
|
142
|
+
readonly reason: Schema.Literals<readonly ["inactive", "forbidden", "denied", "call-limit", "tool-call-limit", "run-call-limit", "tripped", "concurrency", "intercepted"]>;
|
|
143
|
+
readonly message: Schema.String;
|
|
144
|
+
}>, Schema.Struct<{
|
|
145
|
+
readonly _tag: Schema.tag<"tool.progress">;
|
|
146
|
+
readonly step: Schema.Int;
|
|
147
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
148
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
149
|
+
readonly tool: Schema.String;
|
|
150
|
+
readonly channel: Schema.Literals<readonly ["stdout", "stderr", "status"]>;
|
|
151
|
+
readonly text: Schema.String;
|
|
152
|
+
}>, Schema.Struct<{
|
|
153
|
+
readonly _tag: Schema.tag<"tool.completed">;
|
|
154
|
+
readonly step: Schema.Int;
|
|
155
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
156
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
157
|
+
readonly tool: Schema.String;
|
|
158
|
+
readonly input: Schema.Unknown;
|
|
159
|
+
readonly ok: Schema.Boolean;
|
|
160
|
+
readonly result: Schema.Unknown;
|
|
161
|
+
readonly encoded: Schema.Unknown;
|
|
162
|
+
readonly durationMs: Schema.Number;
|
|
163
|
+
readonly labels: Schema.$Record<Schema.String, Schema.String>;
|
|
164
|
+
readonly stage: Schema.OptionFromNullOr<Schema.String>;
|
|
165
|
+
}>, Schema.Struct<{
|
|
166
|
+
readonly _tag: Schema.tag<"step.ended">;
|
|
167
|
+
readonly step: Schema.Int;
|
|
168
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
169
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "malformed", "truncated"]>;
|
|
170
|
+
readonly results: Schema.$Array<Schema.Struct<{
|
|
171
|
+
readonly entry: Schema.brand<Schema.Trimmed, "EntryId">;
|
|
172
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
173
|
+
readonly tool: Schema.String;
|
|
174
|
+
readonly ok: Schema.Boolean;
|
|
175
|
+
}>>;
|
|
176
|
+
}>, Schema.Struct<{
|
|
177
|
+
readonly _tag: Schema.tag<"completion.evaluated">;
|
|
178
|
+
readonly step: Schema.Int;
|
|
179
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
180
|
+
readonly verdict: Schema.Struct<{
|
|
181
|
+
readonly complete: Schema.Boolean;
|
|
182
|
+
readonly awaiting: Schema.$Array<Schema.Trimmed>;
|
|
183
|
+
readonly facts: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
184
|
+
}>;
|
|
185
|
+
}>, Schema.Struct<{
|
|
186
|
+
readonly _tag: Schema.tag<"skills.activated">;
|
|
187
|
+
readonly skills: Schema.$Array<Schema.String>;
|
|
188
|
+
readonly tools: Schema.$Array<Schema.String>;
|
|
189
|
+
readonly source: Schema.Literals<readonly ["always", "matcher", "load_skill", "host"]>;
|
|
190
|
+
}>, Schema.Struct<{
|
|
191
|
+
readonly _tag: Schema.tag<"context.built">;
|
|
192
|
+
readonly step: Schema.Int;
|
|
193
|
+
readonly turn: Schema.Int;
|
|
194
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
195
|
+
readonly strategy: Schema.String;
|
|
196
|
+
readonly strategyVersion: Schema.String;
|
|
197
|
+
readonly fingerprint: Schema.String;
|
|
198
|
+
readonly systemFingerprint: Schema.String;
|
|
199
|
+
readonly estimatedTokens: Schema.Int;
|
|
200
|
+
readonly reservedTokens: Schema.Int;
|
|
201
|
+
readonly budgetTokens: Schema.Int;
|
|
202
|
+
readonly compactions: Schema.Int;
|
|
203
|
+
readonly activeTools: Schema.$Array<Schema.String>;
|
|
204
|
+
}>, Schema.Struct<{
|
|
205
|
+
readonly _tag: Schema.tag<"decision.recorded">;
|
|
206
|
+
readonly record: Schema.Struct<{
|
|
207
|
+
readonly version: Schema.Literal<1>;
|
|
208
|
+
readonly id: Schema.brand<Schema.Trimmed, "DecisionId">;
|
|
209
|
+
readonly family: Schema.NonEmptyString;
|
|
210
|
+
readonly contextHash: Schema.String;
|
|
211
|
+
readonly candidateHash: Schema.String;
|
|
212
|
+
readonly policyVersion: Schema.String;
|
|
213
|
+
readonly candidates: Schema.$Array<Schema.Struct<{
|
|
214
|
+
readonly id: Schema.brand<Schema.String, "CandidateId">;
|
|
215
|
+
readonly description: Schema.String;
|
|
216
|
+
}>>;
|
|
217
|
+
readonly attempts: Schema.$Array<Schema.String>;
|
|
218
|
+
readonly selection: Schema.OptionFromNullOr<Schema.String>;
|
|
219
|
+
readonly validation: Schema.Literals<readonly ["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]>;
|
|
220
|
+
readonly fallback: Schema.OptionFromNullOr<Schema.String>;
|
|
221
|
+
readonly applied: Schema.OptionFromNullOr<Schema.String>;
|
|
222
|
+
readonly probabilities: Schema.OptionFromNullOr<Schema.$Record<Schema.String, Schema.Number>>;
|
|
223
|
+
}>;
|
|
224
|
+
}>, Schema.Struct<{
|
|
225
|
+
readonly _tag: Schema.tag<"assistant.message">;
|
|
226
|
+
readonly step: Schema.Int;
|
|
227
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
228
|
+
readonly text: Schema.String;
|
|
229
|
+
readonly reasoning: Schema.String;
|
|
230
|
+
readonly model: Schema.OptionFromNullOr<Schema.String>;
|
|
231
|
+
readonly toolCalls: Schema.$Array<Schema.Struct<{
|
|
232
|
+
readonly id: Schema.brand<Schema.String, "ToolCallId">;
|
|
233
|
+
readonly tool: Schema.String;
|
|
234
|
+
readonly input: Schema.Unknown;
|
|
235
|
+
}>>;
|
|
236
|
+
readonly usage: Schema.Struct<{
|
|
237
|
+
readonly inputTokens: Schema.Number;
|
|
238
|
+
readonly outputTokens: Schema.Number;
|
|
239
|
+
readonly totalTokens: Schema.Number;
|
|
240
|
+
readonly cacheReadTokens: Schema.Number;
|
|
241
|
+
readonly cacheWriteTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
242
|
+
readonly reasoningTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
243
|
+
}>;
|
|
244
|
+
readonly finishReason: Schema.Literals<readonly ["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>;
|
|
245
|
+
}>, Schema.Struct<{
|
|
246
|
+
readonly _tag: Schema.tag<"assistant.delta">;
|
|
247
|
+
readonly step: Schema.Int;
|
|
248
|
+
readonly channel: Schema.Literals<readonly ["text", "reasoning", "tool-params"]>;
|
|
249
|
+
readonly id: Schema.brand<Schema.String, "StreamPartId">;
|
|
250
|
+
readonly delta: Schema.String;
|
|
251
|
+
}>, Schema.Struct<{
|
|
252
|
+
readonly _tag: Schema.tag<"stream.fallback">;
|
|
253
|
+
readonly step: Schema.Int;
|
|
254
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
255
|
+
readonly message: Schema.String;
|
|
256
|
+
}>, Schema.Struct<{
|
|
257
|
+
readonly _tag: Schema.tag<"host">;
|
|
258
|
+
readonly name: Schema.Trimmed;
|
|
259
|
+
readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
260
|
+
}>, Schema.Struct<{
|
|
261
|
+
readonly callId: Schema.brand<Schema.Trimmed, "ModelCallId">;
|
|
262
|
+
readonly attempt: Schema.Int;
|
|
263
|
+
readonly purpose: Schema.Literals<readonly ["Loop", "Helper"]>;
|
|
264
|
+
readonly method: Schema.Literals<readonly ["Text", "Object", "Stream"]>;
|
|
265
|
+
readonly model: Schema.OptionFromNullOr<typeof import("@xandreed/core").ModelSelection>;
|
|
266
|
+
readonly runId: Schema.OptionFromNullOr<Schema.brand<Schema.String, "RunId">>;
|
|
267
|
+
readonly run: Schema.OptionFromNullOr<Schema.brand<Schema.Int, "RunOrdinal">>;
|
|
268
|
+
readonly step: Schema.OptionFromNullOr<Schema.Int>;
|
|
269
|
+
readonly durationMs: Schema.Finite;
|
|
270
|
+
readonly usage: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Unknown", {}>, Schema.TaggedStruct<"Known", {
|
|
271
|
+
readonly usage: Schema.Struct<{
|
|
272
|
+
readonly inputTokens: Schema.Int;
|
|
273
|
+
readonly outputTokens: Schema.Int;
|
|
274
|
+
readonly totalTokens: Schema.Int;
|
|
275
|
+
readonly cacheReadTokens: Schema.Int;
|
|
276
|
+
readonly cacheWriteTokens: Schema.Int;
|
|
277
|
+
readonly reasoningTokens: Schema.Int;
|
|
278
|
+
}>;
|
|
279
|
+
}>, Schema.TaggedStruct<"Partial", {
|
|
280
|
+
readonly usage: Schema.Struct<{
|
|
281
|
+
readonly inputTokens: Schema.Int;
|
|
282
|
+
readonly outputTokens: Schema.Int;
|
|
283
|
+
readonly totalTokens: Schema.Int;
|
|
284
|
+
readonly cacheReadTokens: Schema.Int;
|
|
285
|
+
readonly cacheWriteTokens: Schema.Int;
|
|
286
|
+
readonly reasoningTokens: Schema.Int;
|
|
287
|
+
}>;
|
|
288
|
+
readonly reported: Schema.$Array<Schema.Literals<readonly ["inputTokens", "outputTokens", "cacheReadTokens", "cacheWriteTokens", "reasoningTokens"]>>;
|
|
289
|
+
}>]>;
|
|
290
|
+
readonly outcome: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Completed", {}>, Schema.TaggedStruct<"Failed", {
|
|
291
|
+
readonly failure: Schema.OptionFromNullOr<Schema.Literals<readonly ["ContextOverflow", "Authentication", "InvalidRequest", "RateLimit", "Quota", "Transient", "InvalidResponse", "Timeout", "Unknown"]>>;
|
|
292
|
+
}>, Schema.TaggedStruct<"Interrupted", {}>]>;
|
|
293
|
+
readonly _tag: Schema.tag<"model.called">;
|
|
294
|
+
}>, Schema.Struct<{
|
|
295
|
+
readonly _tag: Schema.tag<"tool.intercepted">;
|
|
296
|
+
readonly source: Schema.optionalKey<Schema.Literals<readonly ["loop", "direct"]>>;
|
|
297
|
+
readonly phase: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Before", {
|
|
298
|
+
readonly decision: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Allow", {}>, Schema.TaggedStruct<"Deny", {
|
|
299
|
+
readonly failure: Schema.Struct<{
|
|
300
|
+
readonly error: Schema.String;
|
|
301
|
+
readonly message: Schema.String;
|
|
302
|
+
}>;
|
|
303
|
+
}>, Schema.TaggedStruct<"Rewrite", {
|
|
304
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
305
|
+
}>, Schema.TaggedStruct<"Respond", {
|
|
306
|
+
readonly kind: Schema.Literals<readonly ["Success", "Failure"]>;
|
|
307
|
+
}>]>;
|
|
308
|
+
}>, Schema.TaggedStruct<"After", {
|
|
309
|
+
readonly decision: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Keep", {}>, Schema.TaggedStruct<"Replace", {
|
|
310
|
+
readonly kind: Schema.Literals<readonly ["Success", "Failure"]>;
|
|
311
|
+
}>]>;
|
|
312
|
+
}>]>;
|
|
313
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
314
|
+
readonly tool: Schema.String;
|
|
315
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
316
|
+
readonly run: Schema.OptionFromNullOr<Schema.Struct<{
|
|
317
|
+
readonly id: Schema.brand<Schema.String, "RunId">;
|
|
318
|
+
readonly turn: Schema.Int;
|
|
319
|
+
readonly ordinal: Schema.brand<Schema.Int, "RunOrdinal">;
|
|
320
|
+
}>>;
|
|
321
|
+
readonly step: Schema.Int;
|
|
322
|
+
}>]>;
|
|
323
|
+
/** The mode stays explicit in every progress frame. */
|
|
324
|
+
export declare const ProcessProgress: Schema.toTaggedUnion<"mode", readonly [Schema.Struct<{
|
|
325
|
+
readonly mode: Schema.Literal<"projection">;
|
|
326
|
+
readonly event: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"step.started", {
|
|
327
|
+
readonly step: Schema.Int;
|
|
328
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
329
|
+
readonly planned: Schema.Boolean;
|
|
330
|
+
}>, Schema.TaggedStruct<"step.ended", {
|
|
331
|
+
readonly step: Schema.Int;
|
|
332
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
333
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "malformed", "truncated"]>;
|
|
334
|
+
}>, Schema.TaggedStruct<"assistant.delta", {
|
|
335
|
+
readonly step: Schema.Int;
|
|
336
|
+
readonly id: Schema.brand<Schema.String, "StreamPartId">;
|
|
337
|
+
readonly delta: Schema.String;
|
|
338
|
+
}>, Schema.TaggedStruct<"assistant.message", {
|
|
339
|
+
readonly step: Schema.Int;
|
|
340
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
341
|
+
readonly text: Schema.String;
|
|
342
|
+
}>, Schema.TaggedStruct<"tool.started", {
|
|
343
|
+
step: Schema.Int;
|
|
344
|
+
invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
345
|
+
toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
346
|
+
tool: Schema.String;
|
|
347
|
+
}>, Schema.TaggedStruct<"tool.completed", {
|
|
348
|
+
readonly ok: Schema.Boolean;
|
|
349
|
+
readonly step: Schema.Int;
|
|
350
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
351
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
352
|
+
readonly tool: Schema.String;
|
|
353
|
+
}>, Schema.TaggedStruct<"tool.refused", {
|
|
354
|
+
readonly reason: Schema.Literals<readonly ["inactive", "forbidden", "denied", "call-limit", "tool-call-limit", "run-call-limit", "tripped", "concurrency", "intercepted"]>;
|
|
355
|
+
readonly step: Schema.Int;
|
|
356
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
357
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
358
|
+
readonly tool: Schema.String;
|
|
359
|
+
}>, Schema.TaggedStruct<"tool.progress", {
|
|
360
|
+
readonly text: Schema.String;
|
|
361
|
+
readonly step: Schema.Int;
|
|
362
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
363
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
364
|
+
readonly tool: Schema.String;
|
|
365
|
+
}>, Schema.TaggedStruct<"stream.fallback", {
|
|
366
|
+
readonly step: Schema.Int;
|
|
367
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
368
|
+
}>]>;
|
|
369
|
+
}>, Schema.Struct<{
|
|
370
|
+
readonly mode: Schema.Literal<"full">;
|
|
371
|
+
readonly event: Schema.toEncoded<Schema.Union<readonly [Schema.Struct<{
|
|
372
|
+
readonly _tag: Schema.tag<"step.started">;
|
|
373
|
+
readonly step: Schema.Int;
|
|
374
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
375
|
+
readonly planned: Schema.Boolean;
|
|
376
|
+
readonly activeTools: Schema.$Array<Schema.String>;
|
|
377
|
+
}>, Schema.Struct<{
|
|
378
|
+
readonly _tag: Schema.tag<"tool.started">;
|
|
379
|
+
readonly step: Schema.Int;
|
|
380
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
381
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
382
|
+
readonly tool: Schema.String;
|
|
383
|
+
readonly input: Schema.Unknown;
|
|
384
|
+
readonly labels: Schema.$Record<Schema.String, Schema.String>;
|
|
385
|
+
readonly stage: Schema.OptionFromNullOr<Schema.String>;
|
|
386
|
+
}>, Schema.Struct<{
|
|
387
|
+
readonly _tag: Schema.tag<"tool.refused">;
|
|
388
|
+
readonly step: Schema.Int;
|
|
389
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
390
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
391
|
+
readonly tool: Schema.String;
|
|
392
|
+
readonly input: Schema.Unknown;
|
|
393
|
+
readonly reason: Schema.Literals<readonly ["inactive", "forbidden", "denied", "call-limit", "tool-call-limit", "run-call-limit", "tripped", "concurrency", "intercepted"]>;
|
|
394
|
+
readonly message: Schema.String;
|
|
395
|
+
}>, Schema.Struct<{
|
|
396
|
+
readonly _tag: Schema.tag<"tool.progress">;
|
|
397
|
+
readonly step: Schema.Int;
|
|
398
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
399
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
400
|
+
readonly tool: Schema.String;
|
|
401
|
+
readonly channel: Schema.Literals<readonly ["stdout", "stderr", "status"]>;
|
|
402
|
+
readonly text: Schema.String;
|
|
403
|
+
}>, Schema.Struct<{
|
|
404
|
+
readonly _tag: Schema.tag<"tool.completed">;
|
|
405
|
+
readonly step: Schema.Int;
|
|
406
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
407
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
408
|
+
readonly tool: Schema.String;
|
|
409
|
+
readonly input: Schema.Unknown;
|
|
410
|
+
readonly ok: Schema.Boolean;
|
|
411
|
+
readonly result: Schema.Unknown;
|
|
412
|
+
readonly encoded: Schema.Unknown;
|
|
413
|
+
readonly durationMs: Schema.Number;
|
|
414
|
+
readonly labels: Schema.$Record<Schema.String, Schema.String>;
|
|
415
|
+
readonly stage: Schema.OptionFromNullOr<Schema.String>;
|
|
416
|
+
}>, Schema.Struct<{
|
|
417
|
+
readonly _tag: Schema.tag<"step.ended">;
|
|
418
|
+
readonly step: Schema.Int;
|
|
419
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
420
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "malformed", "truncated"]>;
|
|
421
|
+
readonly results: Schema.$Array<Schema.Struct<{
|
|
422
|
+
readonly entry: Schema.brand<Schema.Trimmed, "EntryId">;
|
|
423
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
424
|
+
readonly tool: Schema.String;
|
|
425
|
+
readonly ok: Schema.Boolean;
|
|
426
|
+
}>>;
|
|
427
|
+
}>, Schema.Struct<{
|
|
428
|
+
readonly _tag: Schema.tag<"completion.evaluated">;
|
|
429
|
+
readonly step: Schema.Int;
|
|
430
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
431
|
+
readonly verdict: Schema.Struct<{
|
|
432
|
+
readonly complete: Schema.Boolean;
|
|
433
|
+
readonly awaiting: Schema.$Array<Schema.Trimmed>;
|
|
434
|
+
readonly facts: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
435
|
+
}>;
|
|
436
|
+
}>, Schema.Struct<{
|
|
437
|
+
readonly _tag: Schema.tag<"skills.activated">;
|
|
438
|
+
readonly skills: Schema.$Array<Schema.String>;
|
|
439
|
+
readonly tools: Schema.$Array<Schema.String>;
|
|
440
|
+
readonly source: Schema.Literals<readonly ["always", "matcher", "load_skill", "host"]>;
|
|
441
|
+
}>, Schema.Struct<{
|
|
442
|
+
readonly _tag: Schema.tag<"context.built">;
|
|
443
|
+
readonly step: Schema.Int;
|
|
444
|
+
readonly turn: Schema.Int;
|
|
445
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
446
|
+
readonly strategy: Schema.String;
|
|
447
|
+
readonly strategyVersion: Schema.String;
|
|
448
|
+
readonly fingerprint: Schema.String;
|
|
449
|
+
readonly systemFingerprint: Schema.String;
|
|
450
|
+
readonly estimatedTokens: Schema.Int;
|
|
451
|
+
readonly reservedTokens: Schema.Int;
|
|
452
|
+
readonly budgetTokens: Schema.Int;
|
|
453
|
+
readonly compactions: Schema.Int;
|
|
454
|
+
readonly activeTools: Schema.$Array<Schema.String>;
|
|
455
|
+
}>, Schema.Struct<{
|
|
456
|
+
readonly _tag: Schema.tag<"decision.recorded">;
|
|
457
|
+
readonly record: Schema.Struct<{
|
|
458
|
+
readonly version: Schema.Literal<1>;
|
|
459
|
+
readonly id: Schema.brand<Schema.Trimmed, "DecisionId">;
|
|
460
|
+
readonly family: Schema.NonEmptyString;
|
|
461
|
+
readonly contextHash: Schema.String;
|
|
462
|
+
readonly candidateHash: Schema.String;
|
|
463
|
+
readonly policyVersion: Schema.String;
|
|
464
|
+
readonly candidates: Schema.$Array<Schema.Struct<{
|
|
465
|
+
readonly id: Schema.brand<Schema.String, "CandidateId">;
|
|
466
|
+
readonly description: Schema.String;
|
|
467
|
+
}>>;
|
|
468
|
+
readonly attempts: Schema.$Array<Schema.String>;
|
|
469
|
+
readonly selection: Schema.OptionFromNullOr<Schema.String>;
|
|
470
|
+
readonly validation: Schema.Literals<readonly ["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]>;
|
|
471
|
+
readonly fallback: Schema.OptionFromNullOr<Schema.String>;
|
|
472
|
+
readonly applied: Schema.OptionFromNullOr<Schema.String>;
|
|
473
|
+
readonly probabilities: Schema.OptionFromNullOr<Schema.$Record<Schema.String, Schema.Number>>;
|
|
474
|
+
}>;
|
|
475
|
+
}>, Schema.Struct<{
|
|
476
|
+
readonly _tag: Schema.tag<"assistant.message">;
|
|
477
|
+
readonly step: Schema.Int;
|
|
478
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
479
|
+
readonly text: Schema.String;
|
|
480
|
+
readonly reasoning: Schema.String;
|
|
481
|
+
readonly model: Schema.OptionFromNullOr<Schema.String>;
|
|
482
|
+
readonly toolCalls: Schema.$Array<Schema.Struct<{
|
|
483
|
+
readonly id: Schema.brand<Schema.String, "ToolCallId">;
|
|
484
|
+
readonly tool: Schema.String;
|
|
485
|
+
readonly input: Schema.Unknown;
|
|
486
|
+
}>>;
|
|
487
|
+
readonly usage: Schema.Struct<{
|
|
488
|
+
readonly inputTokens: Schema.Number;
|
|
489
|
+
readonly outputTokens: Schema.Number;
|
|
490
|
+
readonly totalTokens: Schema.Number;
|
|
491
|
+
readonly cacheReadTokens: Schema.Number;
|
|
492
|
+
readonly cacheWriteTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
493
|
+
readonly reasoningTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
494
|
+
}>;
|
|
495
|
+
readonly finishReason: Schema.Literals<readonly ["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>;
|
|
496
|
+
}>, Schema.Struct<{
|
|
497
|
+
readonly _tag: Schema.tag<"assistant.delta">;
|
|
498
|
+
readonly step: Schema.Int;
|
|
499
|
+
readonly channel: Schema.Literals<readonly ["text", "reasoning", "tool-params"]>;
|
|
500
|
+
readonly id: Schema.brand<Schema.String, "StreamPartId">;
|
|
501
|
+
readonly delta: Schema.String;
|
|
502
|
+
}>, Schema.Struct<{
|
|
503
|
+
readonly _tag: Schema.tag<"stream.fallback">;
|
|
504
|
+
readonly step: Schema.Int;
|
|
505
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
506
|
+
readonly message: Schema.String;
|
|
507
|
+
}>, Schema.Struct<{
|
|
508
|
+
readonly _tag: Schema.tag<"host">;
|
|
509
|
+
readonly name: Schema.Trimmed;
|
|
510
|
+
readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
511
|
+
}>, Schema.Struct<{
|
|
512
|
+
readonly callId: Schema.brand<Schema.Trimmed, "ModelCallId">;
|
|
513
|
+
readonly attempt: Schema.Int;
|
|
514
|
+
readonly purpose: Schema.Literals<readonly ["Loop", "Helper"]>;
|
|
515
|
+
readonly method: Schema.Literals<readonly ["Text", "Object", "Stream"]>;
|
|
516
|
+
readonly model: Schema.OptionFromNullOr<typeof import("@xandreed/core").ModelSelection>;
|
|
517
|
+
readonly runId: Schema.OptionFromNullOr<Schema.brand<Schema.String, "RunId">>;
|
|
518
|
+
readonly run: Schema.OptionFromNullOr<Schema.brand<Schema.Int, "RunOrdinal">>;
|
|
519
|
+
readonly step: Schema.OptionFromNullOr<Schema.Int>;
|
|
520
|
+
readonly durationMs: Schema.Finite;
|
|
521
|
+
readonly usage: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Unknown", {}>, Schema.TaggedStruct<"Known", {
|
|
522
|
+
readonly usage: Schema.Struct<{
|
|
523
|
+
readonly inputTokens: Schema.Int;
|
|
524
|
+
readonly outputTokens: Schema.Int;
|
|
525
|
+
readonly totalTokens: Schema.Int;
|
|
526
|
+
readonly cacheReadTokens: Schema.Int;
|
|
527
|
+
readonly cacheWriteTokens: Schema.Int;
|
|
528
|
+
readonly reasoningTokens: Schema.Int;
|
|
529
|
+
}>;
|
|
530
|
+
}>, Schema.TaggedStruct<"Partial", {
|
|
531
|
+
readonly usage: Schema.Struct<{
|
|
532
|
+
readonly inputTokens: Schema.Int;
|
|
533
|
+
readonly outputTokens: Schema.Int;
|
|
534
|
+
readonly totalTokens: Schema.Int;
|
|
535
|
+
readonly cacheReadTokens: Schema.Int;
|
|
536
|
+
readonly cacheWriteTokens: Schema.Int;
|
|
537
|
+
readonly reasoningTokens: Schema.Int;
|
|
538
|
+
}>;
|
|
539
|
+
readonly reported: Schema.$Array<Schema.Literals<readonly ["inputTokens", "outputTokens", "cacheReadTokens", "cacheWriteTokens", "reasoningTokens"]>>;
|
|
540
|
+
}>]>;
|
|
541
|
+
readonly outcome: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Completed", {}>, Schema.TaggedStruct<"Failed", {
|
|
542
|
+
readonly failure: Schema.OptionFromNullOr<Schema.Literals<readonly ["ContextOverflow", "Authentication", "InvalidRequest", "RateLimit", "Quota", "Transient", "InvalidResponse", "Timeout", "Unknown"]>>;
|
|
543
|
+
}>, Schema.TaggedStruct<"Interrupted", {}>]>;
|
|
544
|
+
readonly _tag: Schema.tag<"model.called">;
|
|
545
|
+
}>, Schema.Struct<{
|
|
546
|
+
readonly _tag: Schema.tag<"tool.intercepted">;
|
|
547
|
+
readonly source: Schema.optionalKey<Schema.Literals<readonly ["loop", "direct"]>>;
|
|
548
|
+
readonly phase: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Before", {
|
|
549
|
+
readonly decision: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Allow", {}>, Schema.TaggedStruct<"Deny", {
|
|
550
|
+
readonly failure: Schema.Struct<{
|
|
551
|
+
readonly error: Schema.String;
|
|
552
|
+
readonly message: Schema.String;
|
|
553
|
+
}>;
|
|
554
|
+
}>, Schema.TaggedStruct<"Rewrite", {
|
|
555
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
556
|
+
}>, Schema.TaggedStruct<"Respond", {
|
|
557
|
+
readonly kind: Schema.Literals<readonly ["Success", "Failure"]>;
|
|
558
|
+
}>]>;
|
|
559
|
+
}>, Schema.TaggedStruct<"After", {
|
|
560
|
+
readonly decision: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Keep", {}>, Schema.TaggedStruct<"Replace", {
|
|
561
|
+
readonly kind: Schema.Literals<readonly ["Success", "Failure"]>;
|
|
562
|
+
}>]>;
|
|
563
|
+
}>]>;
|
|
564
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
565
|
+
readonly tool: Schema.String;
|
|
566
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
567
|
+
readonly run: Schema.OptionFromNullOr<Schema.Struct<{
|
|
568
|
+
readonly id: Schema.brand<Schema.String, "RunId">;
|
|
569
|
+
readonly turn: Schema.Int;
|
|
570
|
+
readonly ordinal: Schema.brand<Schema.Int, "RunOrdinal">;
|
|
571
|
+
}>>;
|
|
572
|
+
readonly step: Schema.Int;
|
|
573
|
+
}>]>>;
|
|
574
|
+
}>]>;
|
|
575
|
+
export type ProcessProgress = typeof ProcessProgress.Type;
|
|
576
|
+
/** The real TurnRunner result; this command reply is separate from durable turn.ended evidence. */
|
|
577
|
+
export declare const ProcessTurnResult: Schema.Struct<{
|
|
578
|
+
readonly outcome: Schema.Literals<readonly ["completed", "partial", "failed", "waiting"]>;
|
|
579
|
+
readonly reply: Schema.OptionFromNullOr<Schema.String>;
|
|
580
|
+
readonly usage: Schema.Struct<{
|
|
581
|
+
readonly inputTokens: Schema.Number;
|
|
582
|
+
readonly outputTokens: Schema.Number;
|
|
583
|
+
readonly totalTokens: Schema.Number;
|
|
584
|
+
readonly cacheReadTokens: Schema.Number;
|
|
585
|
+
readonly cacheWriteTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
586
|
+
readonly reasoningTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
587
|
+
}>;
|
|
588
|
+
readonly pending: Schema.optionalKey<Schema.Int>;
|
|
589
|
+
}>;
|
|
590
|
+
export type ProcessTurnResult = typeof ProcessTurnResult.Type;
|
|
591
|
+
/** Owned transport/host failures. Framework codes are optional metadata, never raw error messages. */
|
|
592
|
+
export declare const ProcessErrorCode: Schema.Literals<readonly ["protocol.handshake", "protocol.version", "protocol.sequence", "protocol.invalid", "host.busy", "host.owner", "host.stopping", "host.unsupported", "host.command", "host.setup", "host.runtime", "host.peer"]>;
|
|
593
|
+
export type ProcessErrorCode = typeof ProcessErrorCode.Type;
|
|
594
|
+
/** Version 1 output. Lifecycle identity and journal cursors carry no admitted message or failure text. @public */
|
|
595
|
+
export declare const ProcessEvent: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"hello", {
|
|
596
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
597
|
+
readonly protocolVersion: Schema.Literals<readonly [1]>;
|
|
598
|
+
}>, Schema.TaggedStruct<"turn.started", {
|
|
599
|
+
readonly runId: Schema.brand<Schema.String, "RunId">;
|
|
600
|
+
readonly origin: Schema.Literals<readonly ["user", "inbox", "task"]>;
|
|
601
|
+
readonly input: Schema.optionalKey<Schema.brand<Schema.Trimmed, "InboxItemId">>;
|
|
602
|
+
readonly task: Schema.optionalKey<Schema.Struct<{
|
|
603
|
+
readonly taskId: Schema.brand<Schema.String, "ConversationId">;
|
|
604
|
+
readonly parent: Schema.brand<Schema.String, "ConversationId">;
|
|
605
|
+
}>>;
|
|
606
|
+
readonly resumes: Schema.optionalKey<Schema.Int>;
|
|
607
|
+
readonly journal: Schema.Struct<{
|
|
608
|
+
readonly seq: Schema.Int;
|
|
609
|
+
readonly at: Schema.Finite;
|
|
610
|
+
}>;
|
|
611
|
+
readonly session: Schema.Struct<{
|
|
612
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
613
|
+
readonly owner: Schema.Trimmed;
|
|
614
|
+
}>;
|
|
615
|
+
readonly turn: Schema.Int;
|
|
616
|
+
readonly requestId: Schema.optionalKey<Schema.brand<Schema.Trimmed, "ProcessRequestId">>;
|
|
617
|
+
}>, Schema.TaggedStruct<"turn.event", {
|
|
618
|
+
readonly runId: Schema.brand<Schema.String, "RunId">;
|
|
619
|
+
readonly progress: Schema.toTaggedUnion<"mode", readonly [Schema.Struct<{
|
|
620
|
+
readonly mode: Schema.Literal<"projection">;
|
|
621
|
+
readonly event: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"step.started", {
|
|
622
|
+
readonly step: Schema.Int;
|
|
623
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
624
|
+
readonly planned: Schema.Boolean;
|
|
625
|
+
}>, Schema.TaggedStruct<"step.ended", {
|
|
626
|
+
readonly step: Schema.Int;
|
|
627
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
628
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "malformed", "truncated"]>;
|
|
629
|
+
}>, Schema.TaggedStruct<"assistant.delta", {
|
|
630
|
+
readonly step: Schema.Int;
|
|
631
|
+
readonly id: Schema.brand<Schema.String, "StreamPartId">;
|
|
632
|
+
readonly delta: Schema.String;
|
|
633
|
+
}>, Schema.TaggedStruct<"assistant.message", {
|
|
634
|
+
readonly step: Schema.Int;
|
|
635
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
636
|
+
readonly text: Schema.String;
|
|
637
|
+
}>, Schema.TaggedStruct<"tool.started", {
|
|
638
|
+
step: Schema.Int;
|
|
639
|
+
invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
640
|
+
toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
641
|
+
tool: Schema.String;
|
|
642
|
+
}>, Schema.TaggedStruct<"tool.completed", {
|
|
643
|
+
readonly ok: Schema.Boolean;
|
|
644
|
+
readonly step: Schema.Int;
|
|
645
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
646
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
647
|
+
readonly tool: Schema.String;
|
|
648
|
+
}>, Schema.TaggedStruct<"tool.refused", {
|
|
649
|
+
readonly reason: Schema.Literals<readonly ["inactive", "forbidden", "denied", "call-limit", "tool-call-limit", "run-call-limit", "tripped", "concurrency", "intercepted"]>;
|
|
650
|
+
readonly step: Schema.Int;
|
|
651
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
652
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
653
|
+
readonly tool: Schema.String;
|
|
654
|
+
}>, Schema.TaggedStruct<"tool.progress", {
|
|
655
|
+
readonly text: Schema.String;
|
|
656
|
+
readonly step: Schema.Int;
|
|
657
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
658
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
659
|
+
readonly tool: Schema.String;
|
|
660
|
+
}>, Schema.TaggedStruct<"stream.fallback", {
|
|
661
|
+
readonly step: Schema.Int;
|
|
662
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
663
|
+
}>]>;
|
|
664
|
+
}>, Schema.Struct<{
|
|
665
|
+
readonly mode: Schema.Literal<"full">;
|
|
666
|
+
readonly event: Schema.toEncoded<Schema.Union<readonly [Schema.Struct<{
|
|
667
|
+
readonly _tag: Schema.tag<"step.started">;
|
|
668
|
+
readonly step: Schema.Int;
|
|
669
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
670
|
+
readonly planned: Schema.Boolean;
|
|
671
|
+
readonly activeTools: Schema.$Array<Schema.String>;
|
|
672
|
+
}>, Schema.Struct<{
|
|
673
|
+
readonly _tag: Schema.tag<"tool.started">;
|
|
674
|
+
readonly step: Schema.Int;
|
|
675
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
676
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
677
|
+
readonly tool: Schema.String;
|
|
678
|
+
readonly input: Schema.Unknown;
|
|
679
|
+
readonly labels: Schema.$Record<Schema.String, Schema.String>;
|
|
680
|
+
readonly stage: Schema.OptionFromNullOr<Schema.String>;
|
|
681
|
+
}>, Schema.Struct<{
|
|
682
|
+
readonly _tag: Schema.tag<"tool.refused">;
|
|
683
|
+
readonly step: Schema.Int;
|
|
684
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
685
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
686
|
+
readonly tool: Schema.String;
|
|
687
|
+
readonly input: Schema.Unknown;
|
|
688
|
+
readonly reason: Schema.Literals<readonly ["inactive", "forbidden", "denied", "call-limit", "tool-call-limit", "run-call-limit", "tripped", "concurrency", "intercepted"]>;
|
|
689
|
+
readonly message: Schema.String;
|
|
690
|
+
}>, Schema.Struct<{
|
|
691
|
+
readonly _tag: Schema.tag<"tool.progress">;
|
|
692
|
+
readonly step: Schema.Int;
|
|
693
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
694
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
695
|
+
readonly tool: Schema.String;
|
|
696
|
+
readonly channel: Schema.Literals<readonly ["stdout", "stderr", "status"]>;
|
|
697
|
+
readonly text: Schema.String;
|
|
698
|
+
}>, Schema.Struct<{
|
|
699
|
+
readonly _tag: Schema.tag<"tool.completed">;
|
|
700
|
+
readonly step: Schema.Int;
|
|
701
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
702
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
703
|
+
readonly tool: Schema.String;
|
|
704
|
+
readonly input: Schema.Unknown;
|
|
705
|
+
readonly ok: Schema.Boolean;
|
|
706
|
+
readonly result: Schema.Unknown;
|
|
707
|
+
readonly encoded: Schema.Unknown;
|
|
708
|
+
readonly durationMs: Schema.Number;
|
|
709
|
+
readonly labels: Schema.$Record<Schema.String, Schema.String>;
|
|
710
|
+
readonly stage: Schema.OptionFromNullOr<Schema.String>;
|
|
711
|
+
}>, Schema.Struct<{
|
|
712
|
+
readonly _tag: Schema.tag<"step.ended">;
|
|
713
|
+
readonly step: Schema.Int;
|
|
714
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
715
|
+
readonly status: Schema.Literals<readonly ["completed", "failed", "cancelled", "malformed", "truncated"]>;
|
|
716
|
+
readonly results: Schema.$Array<Schema.Struct<{
|
|
717
|
+
readonly entry: Schema.brand<Schema.Trimmed, "EntryId">;
|
|
718
|
+
readonly toolCallId: Schema.brand<Schema.String, "ToolCallId">;
|
|
719
|
+
readonly tool: Schema.String;
|
|
720
|
+
readonly ok: Schema.Boolean;
|
|
721
|
+
}>>;
|
|
722
|
+
}>, Schema.Struct<{
|
|
723
|
+
readonly _tag: Schema.tag<"completion.evaluated">;
|
|
724
|
+
readonly step: Schema.Int;
|
|
725
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
726
|
+
readonly verdict: Schema.Struct<{
|
|
727
|
+
readonly complete: Schema.Boolean;
|
|
728
|
+
readonly awaiting: Schema.$Array<Schema.Trimmed>;
|
|
729
|
+
readonly facts: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
730
|
+
}>;
|
|
731
|
+
}>, Schema.Struct<{
|
|
732
|
+
readonly _tag: Schema.tag<"skills.activated">;
|
|
733
|
+
readonly skills: Schema.$Array<Schema.String>;
|
|
734
|
+
readonly tools: Schema.$Array<Schema.String>;
|
|
735
|
+
readonly source: Schema.Literals<readonly ["always", "matcher", "load_skill", "host"]>;
|
|
736
|
+
}>, Schema.Struct<{
|
|
737
|
+
readonly _tag: Schema.tag<"context.built">;
|
|
738
|
+
readonly step: Schema.Int;
|
|
739
|
+
readonly turn: Schema.Int;
|
|
740
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
741
|
+
readonly strategy: Schema.String;
|
|
742
|
+
readonly strategyVersion: Schema.String;
|
|
743
|
+
readonly fingerprint: Schema.String;
|
|
744
|
+
readonly systemFingerprint: Schema.String;
|
|
745
|
+
readonly estimatedTokens: Schema.Int;
|
|
746
|
+
readonly reservedTokens: Schema.Int;
|
|
747
|
+
readonly budgetTokens: Schema.Int;
|
|
748
|
+
readonly compactions: Schema.Int;
|
|
749
|
+
readonly activeTools: Schema.$Array<Schema.String>;
|
|
750
|
+
}>, Schema.Struct<{
|
|
751
|
+
readonly _tag: Schema.tag<"decision.recorded">;
|
|
752
|
+
readonly record: Schema.Struct<{
|
|
753
|
+
readonly version: Schema.Literal<1>;
|
|
754
|
+
readonly id: Schema.brand<Schema.Trimmed, "DecisionId">;
|
|
755
|
+
readonly family: Schema.NonEmptyString;
|
|
756
|
+
readonly contextHash: Schema.String;
|
|
757
|
+
readonly candidateHash: Schema.String;
|
|
758
|
+
readonly policyVersion: Schema.String;
|
|
759
|
+
readonly candidates: Schema.$Array<Schema.Struct<{
|
|
760
|
+
readonly id: Schema.brand<Schema.String, "CandidateId">;
|
|
761
|
+
readonly description: Schema.String;
|
|
762
|
+
}>>;
|
|
763
|
+
readonly attempts: Schema.$Array<Schema.String>;
|
|
764
|
+
readonly selection: Schema.OptionFromNullOr<Schema.String>;
|
|
765
|
+
readonly validation: Schema.Literals<readonly ["accepted", "rejected", "abstained", "failed", "cancelled", "bypassed"]>;
|
|
766
|
+
readonly fallback: Schema.OptionFromNullOr<Schema.String>;
|
|
767
|
+
readonly applied: Schema.OptionFromNullOr<Schema.String>;
|
|
768
|
+
readonly probabilities: Schema.OptionFromNullOr<Schema.$Record<Schema.String, Schema.Number>>;
|
|
769
|
+
}>;
|
|
770
|
+
}>, Schema.Struct<{
|
|
771
|
+
readonly _tag: Schema.tag<"assistant.message">;
|
|
772
|
+
readonly step: Schema.Int;
|
|
773
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
774
|
+
readonly text: Schema.String;
|
|
775
|
+
readonly reasoning: Schema.String;
|
|
776
|
+
readonly model: Schema.OptionFromNullOr<Schema.String>;
|
|
777
|
+
readonly toolCalls: Schema.$Array<Schema.Struct<{
|
|
778
|
+
readonly id: Schema.brand<Schema.String, "ToolCallId">;
|
|
779
|
+
readonly tool: Schema.String;
|
|
780
|
+
readonly input: Schema.Unknown;
|
|
781
|
+
}>>;
|
|
782
|
+
readonly usage: Schema.Struct<{
|
|
783
|
+
readonly inputTokens: Schema.Number;
|
|
784
|
+
readonly outputTokens: Schema.Number;
|
|
785
|
+
readonly totalTokens: Schema.Number;
|
|
786
|
+
readonly cacheReadTokens: Schema.Number;
|
|
787
|
+
readonly cacheWriteTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
788
|
+
readonly reasoningTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
789
|
+
}>;
|
|
790
|
+
readonly finishReason: Schema.Literals<readonly ["stop", "length", "content-filter", "tool-calls", "error", "pause", "other", "unknown"]>;
|
|
791
|
+
}>, Schema.Struct<{
|
|
792
|
+
readonly _tag: Schema.tag<"assistant.delta">;
|
|
793
|
+
readonly step: Schema.Int;
|
|
794
|
+
readonly channel: Schema.Literals<readonly ["text", "reasoning", "tool-params"]>;
|
|
795
|
+
readonly id: Schema.brand<Schema.String, "StreamPartId">;
|
|
796
|
+
readonly delta: Schema.String;
|
|
797
|
+
}>, Schema.Struct<{
|
|
798
|
+
readonly _tag: Schema.tag<"stream.fallback">;
|
|
799
|
+
readonly step: Schema.Int;
|
|
800
|
+
readonly run: Schema.withDecodingDefaultKey<Schema.brand<Schema.Int, "RunOrdinal">, never>;
|
|
801
|
+
readonly message: Schema.String;
|
|
802
|
+
}>, Schema.Struct<{
|
|
803
|
+
readonly _tag: Schema.tag<"host">;
|
|
804
|
+
readonly name: Schema.Trimmed;
|
|
805
|
+
readonly data: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
806
|
+
}>, Schema.Struct<{
|
|
807
|
+
readonly callId: Schema.brand<Schema.Trimmed, "ModelCallId">;
|
|
808
|
+
readonly attempt: Schema.Int;
|
|
809
|
+
readonly purpose: Schema.Literals<readonly ["Loop", "Helper"]>;
|
|
810
|
+
readonly method: Schema.Literals<readonly ["Text", "Object", "Stream"]>;
|
|
811
|
+
readonly model: Schema.OptionFromNullOr<typeof import("@xandreed/core").ModelSelection>;
|
|
812
|
+
readonly runId: Schema.OptionFromNullOr<Schema.brand<Schema.String, "RunId">>;
|
|
813
|
+
readonly run: Schema.OptionFromNullOr<Schema.brand<Schema.Int, "RunOrdinal">>;
|
|
814
|
+
readonly step: Schema.OptionFromNullOr<Schema.Int>;
|
|
815
|
+
readonly durationMs: Schema.Finite;
|
|
816
|
+
readonly usage: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Unknown", {}>, Schema.TaggedStruct<"Known", {
|
|
817
|
+
readonly usage: Schema.Struct<{
|
|
818
|
+
readonly inputTokens: Schema.Int;
|
|
819
|
+
readonly outputTokens: Schema.Int;
|
|
820
|
+
readonly totalTokens: Schema.Int;
|
|
821
|
+
readonly cacheReadTokens: Schema.Int;
|
|
822
|
+
readonly cacheWriteTokens: Schema.Int;
|
|
823
|
+
readonly reasoningTokens: Schema.Int;
|
|
824
|
+
}>;
|
|
825
|
+
}>, Schema.TaggedStruct<"Partial", {
|
|
826
|
+
readonly usage: Schema.Struct<{
|
|
827
|
+
readonly inputTokens: Schema.Int;
|
|
828
|
+
readonly outputTokens: Schema.Int;
|
|
829
|
+
readonly totalTokens: Schema.Int;
|
|
830
|
+
readonly cacheReadTokens: Schema.Int;
|
|
831
|
+
readonly cacheWriteTokens: Schema.Int;
|
|
832
|
+
readonly reasoningTokens: Schema.Int;
|
|
833
|
+
}>;
|
|
834
|
+
readonly reported: Schema.$Array<Schema.Literals<readonly ["inputTokens", "outputTokens", "cacheReadTokens", "cacheWriteTokens", "reasoningTokens"]>>;
|
|
835
|
+
}>]>;
|
|
836
|
+
readonly outcome: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Completed", {}>, Schema.TaggedStruct<"Failed", {
|
|
837
|
+
readonly failure: Schema.OptionFromNullOr<Schema.Literals<readonly ["ContextOverflow", "Authentication", "InvalidRequest", "RateLimit", "Quota", "Transient", "InvalidResponse", "Timeout", "Unknown"]>>;
|
|
838
|
+
}>, Schema.TaggedStruct<"Interrupted", {}>]>;
|
|
839
|
+
readonly _tag: Schema.tag<"model.called">;
|
|
840
|
+
}>, Schema.Struct<{
|
|
841
|
+
readonly _tag: Schema.tag<"tool.intercepted">;
|
|
842
|
+
readonly source: Schema.optionalKey<Schema.Literals<readonly ["loop", "direct"]>>;
|
|
843
|
+
readonly phase: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Before", {
|
|
844
|
+
readonly decision: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Allow", {}>, Schema.TaggedStruct<"Deny", {
|
|
845
|
+
readonly failure: Schema.Struct<{
|
|
846
|
+
readonly error: Schema.String;
|
|
847
|
+
readonly message: Schema.String;
|
|
848
|
+
}>;
|
|
849
|
+
}>, Schema.TaggedStruct<"Rewrite", {
|
|
850
|
+
readonly input: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
851
|
+
}>, Schema.TaggedStruct<"Respond", {
|
|
852
|
+
readonly kind: Schema.Literals<readonly ["Success", "Failure"]>;
|
|
853
|
+
}>]>;
|
|
854
|
+
}>, Schema.TaggedStruct<"After", {
|
|
855
|
+
readonly decision: Schema.toTaggedUnion<"_tag", readonly [Schema.TaggedStruct<"Keep", {}>, Schema.TaggedStruct<"Replace", {
|
|
856
|
+
readonly kind: Schema.Literals<readonly ["Success", "Failure"]>;
|
|
857
|
+
}>]>;
|
|
858
|
+
}>]>;
|
|
859
|
+
readonly invocationId: Schema.brand<Schema.String, "InvocationId">;
|
|
860
|
+
readonly tool: Schema.String;
|
|
861
|
+
readonly toolCallId: Schema.optionalKey<Schema.brand<Schema.String, "ToolCallId">>;
|
|
862
|
+
readonly run: Schema.OptionFromNullOr<Schema.Struct<{
|
|
863
|
+
readonly id: Schema.brand<Schema.String, "RunId">;
|
|
864
|
+
readonly turn: Schema.Int;
|
|
865
|
+
readonly ordinal: Schema.brand<Schema.Int, "RunOrdinal">;
|
|
866
|
+
}>>;
|
|
867
|
+
readonly step: Schema.Int;
|
|
868
|
+
}>]>>;
|
|
869
|
+
}>]>;
|
|
870
|
+
readonly session: Schema.Struct<{
|
|
871
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
872
|
+
readonly owner: Schema.Trimmed;
|
|
873
|
+
}>;
|
|
874
|
+
readonly turn: Schema.Int;
|
|
875
|
+
readonly requestId: Schema.optionalKey<Schema.brand<Schema.Trimmed, "ProcessRequestId">>;
|
|
876
|
+
}>, Schema.TaggedStruct<"turn.ended", {
|
|
877
|
+
readonly reason: Schema.Literals<readonly ["completed", "partial", "failed", "waiting", "cancelled", "interrupted"]>;
|
|
878
|
+
readonly failureCode: Schema.optionalKey<Schema.String>;
|
|
879
|
+
readonly journal: Schema.Struct<{
|
|
880
|
+
readonly seq: Schema.Int;
|
|
881
|
+
readonly at: Schema.Finite;
|
|
882
|
+
}>;
|
|
883
|
+
readonly session: Schema.Struct<{
|
|
884
|
+
readonly id: Schema.brand<Schema.String, "ConversationId">;
|
|
885
|
+
readonly owner: Schema.Trimmed;
|
|
886
|
+
}>;
|
|
887
|
+
readonly turn: Schema.Int;
|
|
888
|
+
readonly requestId: Schema.optionalKey<Schema.brand<Schema.Trimmed, "ProcessRequestId">>;
|
|
889
|
+
}>, Schema.TaggedStruct<"begin.result", {
|
|
890
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
891
|
+
readonly result: Schema.Struct<{
|
|
892
|
+
readonly outcome: Schema.Literals<readonly ["completed", "partial", "failed", "waiting"]>;
|
|
893
|
+
readonly reply: Schema.OptionFromNullOr<Schema.String>;
|
|
894
|
+
readonly usage: Schema.Struct<{
|
|
895
|
+
readonly inputTokens: Schema.Number;
|
|
896
|
+
readonly outputTokens: Schema.Number;
|
|
897
|
+
readonly totalTokens: Schema.Number;
|
|
898
|
+
readonly cacheReadTokens: Schema.Number;
|
|
899
|
+
readonly cacheWriteTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
900
|
+
readonly reasoningTokens: Schema.withDecodingDefaultKey<Schema.Number, never>;
|
|
901
|
+
}>;
|
|
902
|
+
readonly pending: Schema.optionalKey<Schema.Int>;
|
|
903
|
+
}>;
|
|
904
|
+
}>, Schema.TaggedStruct<"queued", {
|
|
905
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
906
|
+
readonly command: Schema.Literals<readonly ["send", "steer"]>;
|
|
907
|
+
readonly enqueued: Schema.Boolean;
|
|
908
|
+
readonly pending: Schema.Int;
|
|
909
|
+
}>, Schema.TaggedStruct<"answered", {
|
|
910
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
911
|
+
readonly accepted: Schema.Literals<readonly [true]>;
|
|
912
|
+
readonly enqueued: Schema.Boolean;
|
|
913
|
+
}>, Schema.TaggedStruct<"cancelled", {
|
|
914
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
915
|
+
readonly cancelled: Schema.Boolean;
|
|
916
|
+
readonly pending: Schema.Int;
|
|
917
|
+
}>, Schema.TaggedStruct<"pong", {
|
|
918
|
+
readonly requestId: Schema.brand<Schema.Trimmed, "ProcessRequestId">;
|
|
919
|
+
readonly activity: Schema.Struct<{
|
|
920
|
+
readonly openTurns: Schema.$Array<Schema.Struct<{
|
|
921
|
+
readonly session: Schema.brand<Schema.String, "ConversationId">;
|
|
922
|
+
readonly turn: Schema.Int;
|
|
923
|
+
readonly since: Schema.Number;
|
|
924
|
+
}>>;
|
|
925
|
+
readonly beginningTurns: Schema.Int;
|
|
926
|
+
readonly runningTasks: Schema.Int;
|
|
927
|
+
readonly waiting: Schema.$Array<Schema.Struct<{
|
|
928
|
+
readonly session: Schema.brand<Schema.String, "ConversationId">;
|
|
929
|
+
readonly pending: Schema.Int;
|
|
930
|
+
}>>;
|
|
931
|
+
readonly queuedInput: Schema.Int;
|
|
932
|
+
readonly inFlight: Schema.Boolean;
|
|
933
|
+
readonly busy: Schema.Boolean;
|
|
934
|
+
readonly stopping: Schema.Boolean;
|
|
935
|
+
}>;
|
|
936
|
+
}>, Schema.TaggedStruct<"shutdown", {
|
|
937
|
+
readonly report: Schema.Struct<{
|
|
938
|
+
readonly idle: Schema.Boolean;
|
|
939
|
+
readonly interrupted: Schema.$Array<Schema.Struct<{
|
|
940
|
+
readonly session: Schema.brand<Schema.String, "ConversationId">;
|
|
941
|
+
readonly turn: Schema.Int;
|
|
942
|
+
readonly since: Schema.Number;
|
|
943
|
+
}>>;
|
|
944
|
+
readonly left: Schema.Struct<{
|
|
945
|
+
readonly openTurns: Schema.$Array<Schema.Struct<{
|
|
946
|
+
readonly session: Schema.brand<Schema.String, "ConversationId">;
|
|
947
|
+
readonly turn: Schema.Int;
|
|
948
|
+
readonly since: Schema.Number;
|
|
949
|
+
}>>;
|
|
950
|
+
readonly beginningTurns: Schema.Int;
|
|
951
|
+
readonly runningTasks: Schema.Int;
|
|
952
|
+
readonly waiting: Schema.$Array<Schema.Struct<{
|
|
953
|
+
readonly session: Schema.brand<Schema.String, "ConversationId">;
|
|
954
|
+
readonly pending: Schema.Int;
|
|
955
|
+
}>>;
|
|
956
|
+
readonly queuedInput: Schema.Int;
|
|
957
|
+
readonly inFlight: Schema.Boolean;
|
|
958
|
+
readonly busy: Schema.Boolean;
|
|
959
|
+
readonly stopping: Schema.Boolean;
|
|
960
|
+
}>;
|
|
961
|
+
}>;
|
|
962
|
+
readonly requestId: Schema.optionalKey<Schema.brand<Schema.Trimmed, "ProcessRequestId">>;
|
|
963
|
+
}>, Schema.TaggedStruct<"error", {
|
|
964
|
+
readonly code: Schema.Literals<readonly ["protocol.handshake", "protocol.version", "protocol.sequence", "protocol.invalid", "host.busy", "host.owner", "host.stopping", "host.unsupported", "host.command", "host.setup", "host.runtime", "host.peer"]>;
|
|
965
|
+
readonly message: Schema.String;
|
|
966
|
+
readonly fatal: Schema.Boolean;
|
|
967
|
+
readonly frameworkCode: Schema.optionalKey<Schema.String>;
|
|
968
|
+
readonly requestId: Schema.optionalKey<Schema.brand<Schema.Trimmed, "ProcessRequestId">>;
|
|
969
|
+
}>]>;
|
|
970
|
+
export type ProcessEvent = typeof ProcessEvent.Type;
|