@meistrari/chat-nuxt 4.9.0 → 4.10.0-rc.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/dist/module.json +1 -1
- package/dist/runtime/embed/components/chat-embed-inner.d.vue.ts +9 -9
- package/dist/runtime/embed/components/chat-embed-inner.vue +15 -3
- package/dist/runtime/embed/components/chat-embed-inner.vue.d.ts +9 -9
- package/dist/runtime/messages/composables/use-stick-to-bottom.d.ts +5 -0
- package/dist/runtime/messages/composables/use-stick-to-bottom.js +3 -0
- package/dist/runtime/types/schemas/chat/v3.d.ts +55 -0
- package/dist/runtime/types/schemas/chat/v3.js +37 -0
- package/dist/runtime/types/schemas/integrations/agent-events.d.ts +901 -0
- package/dist/runtime/types/schemas/integrations/agent-events.js +353 -0
- package/package.json +1 -1
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Agent events: client-side mirror of the agent-api v5 events-v1 contract (`packages/models` in
|
|
4
|
+
* meistrari/agent-api). Responses are parsed as loose objects so a field the API adds
|
|
5
|
+
* later never breaks the chat; requests keep the API's own limits so a bad payload is
|
|
6
|
+
* refused here, before it travels.
|
|
7
|
+
*/
|
|
8
|
+
export const v5Limits = {
|
|
9
|
+
messageTextChars: 200_000,
|
|
10
|
+
inputTextChars: 800_000,
|
|
11
|
+
userEventBytes: 1_048_576,
|
|
12
|
+
inlinePayloadBytes: 16_384,
|
|
13
|
+
eventsPerRequest: 32,
|
|
14
|
+
idempotencyKeyChars: 200,
|
|
15
|
+
turnIdChars: 200,
|
|
16
|
+
attributionChars: 200,
|
|
17
|
+
eventPage: { default: 100, max: 500 },
|
|
18
|
+
artifactPage: { default: 100, max: 100 },
|
|
19
|
+
sessionList: 100,
|
|
20
|
+
turnList: 500,
|
|
21
|
+
agentList: 100,
|
|
22
|
+
draftTextChars: 65_536,
|
|
23
|
+
streamHeartbeatMs: 15_000,
|
|
24
|
+
};
|
|
25
|
+
/** Every code a v5 route answers in `{ error }`, with its HTTP status. */
|
|
26
|
+
export const v5ErrorStatus = {
|
|
27
|
+
invalid_request: 400,
|
|
28
|
+
invalid_vault_reference: 400,
|
|
29
|
+
input_payload_required: 400,
|
|
30
|
+
invalid_tool_result_answers: 400,
|
|
31
|
+
cursor_not_found: 400,
|
|
32
|
+
invalid_event_limit: 400,
|
|
33
|
+
invalid_artifact_limit: 400,
|
|
34
|
+
invalid_user_event_batch: 400,
|
|
35
|
+
provider_harness_mismatch: 400,
|
|
36
|
+
insufficient_role: 403,
|
|
37
|
+
agent_publication_forbidden: 403,
|
|
38
|
+
session_not_found: 404,
|
|
39
|
+
agent_not_found: 404,
|
|
40
|
+
snapshot_not_found: 404,
|
|
41
|
+
event_not_found: 404,
|
|
42
|
+
message_not_found: 404,
|
|
43
|
+
turn_not_found: 404,
|
|
44
|
+
artifact_not_found: 404,
|
|
45
|
+
repository_not_found: 404,
|
|
46
|
+
commit_not_found: 404,
|
|
47
|
+
content_unavailable: 404,
|
|
48
|
+
idempotency_conflict: 409,
|
|
49
|
+
agent_not_published: 409,
|
|
50
|
+
snapshot_not_ready: 409,
|
|
51
|
+
snapshot_protected: 409,
|
|
52
|
+
snapshot_build_in_progress: 409,
|
|
53
|
+
session_closed: 409,
|
|
54
|
+
turn_not_running: 409,
|
|
55
|
+
user_event_already_dispatched: 409,
|
|
56
|
+
invalid_tool_result: 409,
|
|
57
|
+
repository_ambiguous: 409,
|
|
58
|
+
user_event_too_large: 413,
|
|
59
|
+
request_too_large: 413,
|
|
60
|
+
payload_not_offloaded: 413,
|
|
61
|
+
agent_config_invalid: 422,
|
|
62
|
+
model_not_on_provider: 422,
|
|
63
|
+
internal_error: 500,
|
|
64
|
+
session_vault_unavailable: 503,
|
|
65
|
+
detached_delivery_unavailable: 503,
|
|
66
|
+
content_storage_unavailable: 503,
|
|
67
|
+
artifact_storage_unavailable: 503,
|
|
68
|
+
snapshot_publishing_unavailable: 503,
|
|
69
|
+
};
|
|
70
|
+
export const v5ErrorBodySchema = z.object({ error: z.string() });
|
|
71
|
+
export const v5EventIdSchema = z.string().uuid();
|
|
72
|
+
export const v5TurnIdSchema = z.string().min(1).max(v5Limits.turnIdChars);
|
|
73
|
+
export const v5HarnessSchema = z.enum(['claude', 'codex', 'lightweight']);
|
|
74
|
+
export const v5SessionStatusSchema = z.enum(['initializing', 'ready', 'running', 'paused', 'detached', 'closing', 'closed', 'failed']);
|
|
75
|
+
export const v5UserEventStatusSchema = z.enum(['queued', 'dispatched', 'received', 'running', 'completed', 'failed', 'cancelled', 'uncertain']);
|
|
76
|
+
export const v5UserEventTypeSchema = z.enum(['message-queue', 'message-steer', 'input', 'cancel', 'tool-result']);
|
|
77
|
+
export const VAULT_REFERENCE_PREFIX = 'vault://';
|
|
78
|
+
export function isVaultReference(payload) {
|
|
79
|
+
return payload.startsWith(VAULT_REFERENCE_PREFIX);
|
|
80
|
+
}
|
|
81
|
+
export const v5VaultReferenceSchema = z.string().max(2048).regex(/^vault:\/\/\S+$/u);
|
|
82
|
+
const inputNameSchema = z.string().min(1).max(128).regex(/^[a-z_][\w-]*$/iu);
|
|
83
|
+
const payloadSchema = z.string().min(1);
|
|
84
|
+
function isAnswers(payload) {
|
|
85
|
+
try {
|
|
86
|
+
const value = JSON.parse(payload);
|
|
87
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** A user event as the client sends it: a message, a steer, an input, a cancel or an answer. */
|
|
94
|
+
export const v5UserEventSchema = z.discriminatedUnion('type', [
|
|
95
|
+
z.object({ type: z.literal('message-queue'), payload: payloadSchema }).strict(),
|
|
96
|
+
z.object({ type: z.literal('message-steer'), turnId: v5TurnIdSchema, payload: payloadSchema }).strict(),
|
|
97
|
+
z.object({ type: z.literal('input'), name: inputNameSchema.optional(), payload: payloadSchema.optional() }).strict(),
|
|
98
|
+
z.object({ type: z.literal('cancel'), turnId: v5TurnIdSchema }).strict(),
|
|
99
|
+
z.object({ type: z.literal('tool-result'), toolCallId: z.string().min(1).max(v5Limits.turnIdChars), payload: payloadSchema }).strict(),
|
|
100
|
+
]).superRefine((input, ctx) => {
|
|
101
|
+
const payload = 'payload' in input ? input.payload : undefined;
|
|
102
|
+
if (input.type === 'input' && payload === undefined && input.name === undefined)
|
|
103
|
+
ctx.addIssue({ code: 'custom', path: ['payload'], message: 'An input without a name needs a payload.' });
|
|
104
|
+
if (payload === undefined)
|
|
105
|
+
return;
|
|
106
|
+
if (input.type === 'tool-result') {
|
|
107
|
+
if (!isAnswers(payload))
|
|
108
|
+
ctx.addIssue({ code: 'custom', path: ['payload'], message: 'The answers are a JSON object keyed by question id.' });
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (isVaultReference(payload)) {
|
|
112
|
+
if (!v5VaultReferenceSchema.safeParse(payload).success)
|
|
113
|
+
ctx.addIssue({ code: 'custom', path: ['payload'], message: 'Not a Vault reference.' });
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (input.type === 'input' && input.name === undefined) {
|
|
117
|
+
ctx.addIssue({ code: 'custom', path: ['payload'], message: 'An input without a name is a file: its payload is a Vault reference.' });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const maximum = input.type === 'input' ? v5Limits.inputTextChars : v5Limits.messageTextChars;
|
|
121
|
+
if (payload.length > maximum)
|
|
122
|
+
ctx.addIssue({ code: 'custom', path: ['payload'], message: `Text exceeds ${maximum} characters.` });
|
|
123
|
+
});
|
|
124
|
+
export const v5EventsRequestSchema = z.object({
|
|
125
|
+
events: z.array(v5UserEventSchema).min(1).max(v5Limits.eventsPerRequest),
|
|
126
|
+
}).strict();
|
|
127
|
+
export const v5EventReceiptSchema = z.looseObject({
|
|
128
|
+
eventId: v5EventIdSchema,
|
|
129
|
+
type: v5UserEventTypeSchema,
|
|
130
|
+
messageId: v5EventIdSchema.optional(),
|
|
131
|
+
sessionId: z.string().uuid(),
|
|
132
|
+
turnId: v5TurnIdSchema.nullable(),
|
|
133
|
+
status: v5UserEventStatusSchema,
|
|
134
|
+
});
|
|
135
|
+
export const v5EventsReceiptSchema = z.looseObject({ events: z.array(v5EventReceiptSchema) });
|
|
136
|
+
/**
|
|
137
|
+
* Hints of the stored event types the chat reads. Unknown types still parse (the type is an open
|
|
138
|
+
* string); `parseV5EventHint` gives the typed hint for the ones listed here.
|
|
139
|
+
*/
|
|
140
|
+
export const v5EventHintSchemas = {
|
|
141
|
+
'session.initializing': z.looseObject({ executionMode: z.enum(['chat', 'sync', 'async']).optional(), resumed: z.literal(true).optional() }),
|
|
142
|
+
'session.ready': z.looseObject({ resumed: z.literal(true).optional() }),
|
|
143
|
+
'session.suspending': z.looseObject({}),
|
|
144
|
+
'session.paused': z.looseObject({}),
|
|
145
|
+
'session.closing': z.looseObject({}),
|
|
146
|
+
'session.closed': z.looseObject({}),
|
|
147
|
+
'session.failed': z.looseObject({ error: z.string() }),
|
|
148
|
+
'user_event.admitted': z.looseObject({ eventId: z.string().uuid(), inputType: v5UserEventTypeSchema, status: z.literal('queued') }),
|
|
149
|
+
'user_event.received': z.looseObject({ eventId: z.string().uuid().optional(), status: z.literal('received') }),
|
|
150
|
+
'user_event.completed': z.looseObject({ eventId: z.string().uuid().optional(), status: z.literal('completed') }),
|
|
151
|
+
'user_event.failed': z.looseObject({ eventId: z.string().uuid().optional(), status: z.literal('failed'), error: z.string().optional(), errorCode: z.string().optional() }),
|
|
152
|
+
'user_event.cancelled': z.looseObject({ eventId: z.string().uuid().optional(), status: z.literal('cancelled') }),
|
|
153
|
+
'user_event.uncertain': z.looseObject({ eventId: z.string().uuid().optional(), status: z.literal('uncertain'), error: z.string().optional() }),
|
|
154
|
+
'message': z.looseObject({
|
|
155
|
+
mode: z.enum(['queue', 'steer', 'answer']),
|
|
156
|
+
status: z.literal('running'),
|
|
157
|
+
inputSnapshot: z.number().int().nonnegative(),
|
|
158
|
+
model: z.string(),
|
|
159
|
+
reasoningEffort: z.string().nullable(),
|
|
160
|
+
}),
|
|
161
|
+
'message.pending': z.looseObject({ status: v5UserEventStatusSchema }),
|
|
162
|
+
'input': z.looseObject({ eventId: z.string().uuid(), name: z.string().nullable() }),
|
|
163
|
+
'assistant.text': z.looseObject({ stepId: z.string().min(1), partIndex: z.number().int().nonnegative(), partCount: z.number().int().positive() }),
|
|
164
|
+
'step': z.looseObject({
|
|
165
|
+
title: z.string(),
|
|
166
|
+
status: z.string(),
|
|
167
|
+
step: z.looseObject({
|
|
168
|
+
kind: z.enum(['message', 'tool', 'reasoning']).optional(),
|
|
169
|
+
toolName: z.string().nullable().optional(),
|
|
170
|
+
status: z.string().optional(),
|
|
171
|
+
preview: z.string().optional(),
|
|
172
|
+
startedAt: z.string().optional(),
|
|
173
|
+
endedAt: z.string().nullable().optional(),
|
|
174
|
+
}),
|
|
175
|
+
}),
|
|
176
|
+
'usage': z.looseObject({ provider: z.string().optional(), usageScope: z.string() }),
|
|
177
|
+
'user_input.requested': z.looseObject({ requestId: z.string().min(1), questionCount: z.number().int().positive(), contentOmitted: z.literal(true).optional() }),
|
|
178
|
+
'user_input.resolved': z.looseObject({ requestId: z.string().min(1), userEventId: z.string().uuid() }),
|
|
179
|
+
'turn.completed': z.looseObject({ status: z.literal('completed') }),
|
|
180
|
+
'turn.failed': z.looseObject({ status: z.literal('failed'), error: z.string().optional(), reason: z.string().optional(), errorCode: z.string().optional() }),
|
|
181
|
+
'turn.cancelled': z.looseObject({ status: z.literal('cancelled'), reason: z.string().optional() }),
|
|
182
|
+
'turn.uncertain': z.looseObject({ status: z.literal('uncertain'), error: z.string().optional() }),
|
|
183
|
+
'artifact.published': z.looseObject({
|
|
184
|
+
artifactId: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
185
|
+
filename: z.string().min(1),
|
|
186
|
+
byteSize: z.number().int().nonnegative(),
|
|
187
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
|
|
188
|
+
kind: z.enum(['file', 'result']),
|
|
189
|
+
validationError: z.string().optional(),
|
|
190
|
+
}),
|
|
191
|
+
};
|
|
192
|
+
export function isKnownV5EventType(type) {
|
|
193
|
+
return Object.hasOwn(v5EventHintSchemas, type);
|
|
194
|
+
}
|
|
195
|
+
/** The typed hint of a known event, or `null` when the type is unknown or the hint does not match. */
|
|
196
|
+
export function parseV5EventHint(type, hint) {
|
|
197
|
+
const parsed = v5EventHintSchemas[type].safeParse(hint);
|
|
198
|
+
return parsed.success ? parsed.data : null;
|
|
199
|
+
}
|
|
200
|
+
/** The question an agent asked (`user_input.requested`), as its event text decodes. */
|
|
201
|
+
export const v5UserInputRequestSchema = z.looseObject({
|
|
202
|
+
prompt: z.string().optional(),
|
|
203
|
+
questions: z.array(z.looseObject({
|
|
204
|
+
id: z.string().min(1),
|
|
205
|
+
label: z.string(),
|
|
206
|
+
description: z.string().optional(),
|
|
207
|
+
required: z.boolean().optional(),
|
|
208
|
+
type: z.enum(['text', 'single_select']),
|
|
209
|
+
placeholder: z.string().optional(),
|
|
210
|
+
options: z.array(z.looseObject({ value: z.string(), label: z.string(), description: z.string().optional() })).optional(),
|
|
211
|
+
})),
|
|
212
|
+
});
|
|
213
|
+
export const v5SessionEventSchema = z.looseObject({
|
|
214
|
+
eventId: v5EventIdSchema,
|
|
215
|
+
sessionId: z.string().uuid(),
|
|
216
|
+
type: z.string().min(1),
|
|
217
|
+
turnId: v5TurnIdSchema.nullable(),
|
|
218
|
+
messageId: v5EventIdSchema.nullable(),
|
|
219
|
+
toolCallId: z.string().nullable(),
|
|
220
|
+
occurredAt: z.string(),
|
|
221
|
+
hint: z.record(z.string(), z.unknown()),
|
|
222
|
+
text: z.string().nullable(),
|
|
223
|
+
partIndex: z.number().int().nullable(),
|
|
224
|
+
partCount: z.number().int().nullable(),
|
|
225
|
+
payloadVaultStatus: z.enum(['none', 'pending', 'published']),
|
|
226
|
+
receipt: v5EventReceiptSchema.optional(),
|
|
227
|
+
});
|
|
228
|
+
/** Transient cumulative text of one step, relayed live without an id; never advances the cursor. */
|
|
229
|
+
export const v5EventDraftSchema = z.looseObject({
|
|
230
|
+
kind: z.enum(['message', 'reasoning']).default('message'),
|
|
231
|
+
messageId: v5EventIdSchema,
|
|
232
|
+
turnId: v5TurnIdSchema,
|
|
233
|
+
afterEventId: v5EventIdSchema,
|
|
234
|
+
sourceId: z.string().min(1),
|
|
235
|
+
stepId: z.string().min(1),
|
|
236
|
+
generation: z.number().int().nonnegative(),
|
|
237
|
+
revision: z.number().int().positive(),
|
|
238
|
+
text: z.string(),
|
|
239
|
+
});
|
|
240
|
+
export const v5EventPageSchema = z.looseObject({ events: z.array(v5SessionEventSchema), nextCursor: v5EventIdSchema.nullable(), hasMore: z.boolean() });
|
|
241
|
+
export const v5EventQuerySchema = z.object({
|
|
242
|
+
after: v5EventIdSchema.optional(),
|
|
243
|
+
before: v5EventIdSchema.optional(),
|
|
244
|
+
messageId: v5EventIdSchema.optional(),
|
|
245
|
+
turnId: v5TurnIdSchema.optional(),
|
|
246
|
+
limit: z.number().int().min(1).max(v5Limits.eventPage.max).optional(),
|
|
247
|
+
}).strict();
|
|
248
|
+
/** One frame of the live event stream: a stored event (with its id), a draft, or a heartbeat. */
|
|
249
|
+
export const v5EventStreamFrameSchema = z.discriminatedUnion('kind', [
|
|
250
|
+
z.object({ kind: z.literal('event'), event: v5SessionEventSchema }),
|
|
251
|
+
z.object({ kind: z.literal('draft'), draft: v5EventDraftSchema }),
|
|
252
|
+
z.object({ kind: z.literal('heartbeat') }),
|
|
253
|
+
]);
|
|
254
|
+
export const v5SessionSchema = z.looseObject({
|
|
255
|
+
sessionId: z.string().uuid(),
|
|
256
|
+
agentId: z.string().uuid(),
|
|
257
|
+
snapshotId: z.string().uuid(),
|
|
258
|
+
harness: v5HarnessSchema,
|
|
259
|
+
status: v5SessionStatusSchema,
|
|
260
|
+
executionMode: z.enum(['chat', 'sync', 'async']),
|
|
261
|
+
runtime: z.looseObject({ state: z.string() }),
|
|
262
|
+
configuration: z.looseObject({
|
|
263
|
+
harness: v5HarnessSchema,
|
|
264
|
+
model: z.string().optional(),
|
|
265
|
+
provider: z.string().optional(),
|
|
266
|
+
effort: z.string().optional(),
|
|
267
|
+
commitSha: z.string(),
|
|
268
|
+
repository: z.string(),
|
|
269
|
+
}),
|
|
270
|
+
effectiveModelSettings: z.looseObject({ model: z.string(), reasoningEffort: z.string().nullable() }).nullable(),
|
|
271
|
+
createdAt: z.string(),
|
|
272
|
+
});
|
|
273
|
+
export const v5SessionListSchema = z.looseObject({ sessions: z.array(v5SessionSchema) });
|
|
274
|
+
/** Creation admits the session and its first queued messages and inputs in one idempotent request. */
|
|
275
|
+
export const v5SessionCreateSchema = z.object({
|
|
276
|
+
agentId: z.string().uuid(),
|
|
277
|
+
snapshotId: z.string().uuid().optional(),
|
|
278
|
+
commitHash: z.string().regex(/^[0-9a-f]{7,64}$/iu).optional(),
|
|
279
|
+
executionMode: z.enum(['chat', 'sync', 'async']).optional(),
|
|
280
|
+
events: z.array(v5UserEventSchema).max(v5Limits.eventsPerRequest).optional(),
|
|
281
|
+
telaAgentId: z.string().min(1).max(v5Limits.attributionChars).optional(),
|
|
282
|
+
projectId: z.string().min(1).max(v5Limits.attributionChars).optional(),
|
|
283
|
+
tags: z.record(z.string(), z.unknown()).optional(),
|
|
284
|
+
}).strict().superRefine((body, ctx) => {
|
|
285
|
+
for (const [index, event] of (body.events ?? []).entries()) {
|
|
286
|
+
if (event.type !== 'message-queue' && event.type !== 'input')
|
|
287
|
+
ctx.addIssue({ code: 'custom', path: ['events', index, 'type'], message: 'A new session starts with queued messages and inputs only.' });
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
export const v5SessionCreationReceiptSchema = z.looseObject({
|
|
291
|
+
sessionId: z.string().uuid(),
|
|
292
|
+
snapshotId: z.string().uuid(),
|
|
293
|
+
status: v5SessionStatusSchema,
|
|
294
|
+
events: z.array(v5EventReceiptSchema),
|
|
295
|
+
});
|
|
296
|
+
export const v5SessionClosureReceiptSchema = z.looseObject({ status: z.literal('closing') });
|
|
297
|
+
export const v5AgentSnapshotSchema = z.looseObject({
|
|
298
|
+
snapshotId: z.string().uuid(),
|
|
299
|
+
commitSha: z.string(),
|
|
300
|
+
purpose: z.enum(['publication', 'iteration']),
|
|
301
|
+
status: z.enum(['building', 'ready', 'failed', 'superseded', 'unbuilt']),
|
|
302
|
+
readyAt: z.string().nullable(),
|
|
303
|
+
createdAt: z.string(),
|
|
304
|
+
});
|
|
305
|
+
/** A catalog agent; `repository` is `organization/repository`, the same coordinates Tela knows. */
|
|
306
|
+
export const v5AgentSchema = z.looseObject({
|
|
307
|
+
agentId: z.string().uuid(),
|
|
308
|
+
repository: z.string(),
|
|
309
|
+
defaultBranch: z.string(),
|
|
310
|
+
publishedSnapshotId: z.string().uuid().nullable(),
|
|
311
|
+
publishedCommitSha: z.string().nullable(),
|
|
312
|
+
harness: v5HarnessSchema.nullable(),
|
|
313
|
+
model: z.string().nullable(),
|
|
314
|
+
createdAt: z.string(),
|
|
315
|
+
updatedAt: z.string(),
|
|
316
|
+
});
|
|
317
|
+
export const v5AgentDetailSchema = v5AgentSchema.extend({ snapshots: z.array(v5AgentSnapshotSchema) });
|
|
318
|
+
export const v5AgentListSchema = z.looseObject({ agents: z.array(v5AgentSchema) });
|
|
319
|
+
export const v5SnapshotPublishSchema = z.object({
|
|
320
|
+
organizationName: z.string().min(1).max(v5Limits.attributionChars),
|
|
321
|
+
repository: z.string().min(1).max(v5Limits.attributionChars),
|
|
322
|
+
commit: z.string().regex(/^[0-9a-f]{7,64}$/iu).optional(),
|
|
323
|
+
}).strict();
|
|
324
|
+
export const v5SnapshotPublicationSchema = z.looseObject({
|
|
325
|
+
agentId: z.string().uuid(),
|
|
326
|
+
snapshot: v5AgentSnapshotSchema.extend({ error: z.string().nullable() }),
|
|
327
|
+
});
|
|
328
|
+
export const v5TurnSchema = z.looseObject({
|
|
329
|
+
turnId: v5TurnIdSchema,
|
|
330
|
+
status: z.enum(['running', 'completed', 'failed', 'cancelled', 'uncertain']),
|
|
331
|
+
usage: z.record(z.string(), z.unknown()),
|
|
332
|
+
error: z.string().nullable(),
|
|
333
|
+
createdAt: z.string(),
|
|
334
|
+
completedAt: z.string().nullable(),
|
|
335
|
+
});
|
|
336
|
+
export const v5TurnListSchema = z.looseObject({ turns: z.array(v5TurnSchema) });
|
|
337
|
+
export const v5ArtifactIdSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
|
338
|
+
export const v5ArtifactSchema = z.looseObject({
|
|
339
|
+
artifactId: v5ArtifactIdSchema,
|
|
340
|
+
turnId: v5TurnIdSchema,
|
|
341
|
+
filename: z.string().min(1),
|
|
342
|
+
byteSize: z.number().int().nonnegative(),
|
|
343
|
+
sha256: v5ArtifactIdSchema,
|
|
344
|
+
eventId: v5EventIdSchema,
|
|
345
|
+
messageId: v5EventIdSchema,
|
|
346
|
+
stepId: z.string().nullable(),
|
|
347
|
+
mediaType: z.string(),
|
|
348
|
+
});
|
|
349
|
+
export const v5ArtifactPageSchema = z.looseObject({ artifacts: z.array(v5ArtifactSchema), nextCursor: v5EventIdSchema.nullable(), hasMore: z.boolean() });
|
|
350
|
+
export const v5ArtifactQuerySchema = z.object({
|
|
351
|
+
after: v5EventIdSchema.optional(),
|
|
352
|
+
limit: z.number().int().min(1).max(v5Limits.artifactPage.max).optional(),
|
|
353
|
+
}).strict();
|