@sixb/server 0.1.20 → 0.1.22
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/artifacts/frame.d.ts +18 -0
- package/dist/artifacts/frame.d.ts.map +1 -0
- package/dist/auth/browser-origin.d.ts +10 -1
- package/dist/auth/browser-origin.d.ts.map +1 -1
- package/dist/auth/experience.d.ts +1 -0
- package/dist/auth/experience.d.ts.map +1 -1
- package/dist/auth/public-routes.d.ts.map +1 -1
- package/dist/auth/responses.d.ts +1 -1
- package/dist/auth/responses.d.ts.map +1 -1
- package/dist/auth/scope.d.ts +19 -3
- package/dist/auth/scope.d.ts.map +1 -1
- package/dist/files/content.d.ts +2 -3
- package/dist/files/content.d.ts.map +1 -1
- package/dist/index.js +10636 -7071
- package/dist/index.js.map +56 -38
- package/dist/models/display.d.ts +27 -0
- package/dist/models/display.d.ts.map +1 -1
- package/dist/openapi/components.d.ts +14 -0
- package/dist/openapi/components.d.ts.map +1 -0
- package/dist/openapi/tags.d.ts +22 -2
- package/dist/openapi/tags.d.ts.map +1 -1
- package/dist/registerRoutes.d.ts +3 -0
- package/dist/registerRoutes.d.ts.map +1 -1
- package/dist/routes/actions.d.ts +5 -5
- package/dist/routes/activity.d.ts +35 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/agent-api-gateway.d.ts.map +1 -1
- package/dist/routes/agent-approval-gate.d.ts +27 -0
- package/dist/routes/agent-approval-gate.d.ts.map +1 -0
- package/dist/routes/agent-approvals.d.ts +599 -0
- package/dist/routes/agent-approvals.d.ts.map +1 -0
- package/dist/routes/agent-children.d.ts +318 -0
- package/dist/routes/agent-children.d.ts.map +1 -0
- package/dist/routes/agent-memory.d.ts +267 -0
- package/dist/routes/agent-memory.d.ts.map +1 -0
- package/dist/routes/agents.d.ts +1008 -98
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/ai-accounting.d.ts.map +1 -1
- package/dist/routes/artifact-frames.d.ts +98 -0
- package/dist/routes/artifact-frames.d.ts.map +1 -0
- package/dist/routes/artifacts.d.ts +1508 -0
- package/dist/routes/artifacts.d.ts.map +1 -0
- package/dist/routes/auth.d.ts +117 -11
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/connector-connection-runs.d.ts +84 -84
- package/dist/routes/connector-connections.d.ts +2 -2
- package/dist/routes/connectors.d.ts +2 -2
- package/dist/routes/datasets.d.ts +27 -27
- package/dist/routes/events.d.ts +5 -5
- package/dist/routes/files.d.ts +14 -14
- package/dist/routes/files.d.ts.map +1 -1
- package/dist/routes/links.d.ts +2 -2
- package/dist/routes/logs.d.ts +5 -5
- package/dist/routes/model-calls.d.ts +155 -0
- package/dist/routes/model-calls.d.ts.map +1 -0
- package/dist/routes/model-generations.d.ts +400 -0
- package/dist/routes/model-generations.d.ts.map +1 -0
- package/dist/routes/models.d.ts +434 -1
- package/dist/routes/models.d.ts.map +1 -1
- package/dist/routes/objects.d.ts +71 -40
- package/dist/routes/objects.d.ts.map +1 -1
- package/dist/routes/observed-agent-threads.d.ts +682 -0
- package/dist/routes/observed-agent-threads.d.ts.map +1 -0
- package/dist/routes/ontology.d.ts +66 -62
- package/dist/routes/ontology.d.ts.map +1 -1
- package/dist/routes/pipelines.d.ts +53 -53
- package/dist/routes/projections.d.ts +63 -63
- package/dist/routes/rules.d.ts +2 -2
- package/dist/routes/share-grants.d.ts +4 -4
- package/dist/routes/syncs.d.ts +18 -18
- package/dist/routes/users.d.ts +117 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/webhook-runs.d.ts +1 -1
- package/dist/routes/workflows.d.ts +142 -76
- package/dist/routes/workflows.d.ts.map +1 -1
- package/dist/routes/ws/agents.d.ts +7 -2
- package/dist/routes/ws/agents.d.ts.map +1 -1
- package/dist/routes/ws/events.d.ts +6 -6
- package/dist/routes/ws/events.d.ts.map +1 -1
- package/dist/routes/ws/logs.d.ts +14 -14
- package/dist/routes/ws/subscription-hub.d.ts +8 -3
- package/dist/routes/ws/subscription-hub.d.ts.map +1 -1
- package/dist/schemas/actions.d.ts +15 -15
- package/dist/schemas/activity.d.ts +1298 -0
- package/dist/schemas/activity.d.ts.map +1 -0
- package/dist/schemas/agent-approvals.d.ts +1091 -0
- package/dist/schemas/agent-approvals.d.ts.map +1 -0
- package/dist/schemas/agent-memory.d.ts +250 -0
- package/dist/schemas/agent-memory.d.ts.map +1 -0
- package/dist/schemas/agents.d.ts +5485 -460
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/ai-accounting.d.ts +1315 -436
- package/dist/schemas/ai-accounting.d.ts.map +1 -1
- package/dist/schemas/ai-limits.d.ts +36 -36
- package/dist/schemas/ai-usage.d.ts +12 -0
- package/dist/schemas/ai-usage.d.ts.map +1 -1
- package/dist/schemas/artifacts.d.ts +1857 -0
- package/dist/schemas/artifacts.d.ts.map +1 -0
- package/dist/schemas/auth.d.ts +125 -52
- package/dist/schemas/auth.d.ts.map +1 -1
- package/dist/schemas/connectors.d.ts +42 -42
- package/dist/schemas/datasets.d.ts +108 -108
- package/dist/schemas/event-payloads.d.ts +6 -6
- package/dist/schemas/events.d.ts +32 -32
- package/dist/schemas/events.d.ts.map +1 -1
- package/dist/schemas/files.d.ts +24 -24
- package/dist/schemas/links.d.ts +2 -2
- package/dist/schemas/logs.d.ts +32 -32
- package/dist/schemas/models.d.ts +8889 -10
- package/dist/schemas/models.d.ts.map +1 -1
- package/dist/schemas/objects.d.ts +48 -12
- package/dist/schemas/objects.d.ts.map +1 -1
- package/dist/schemas/ontology.d.ts +127 -104
- package/dist/schemas/ontology.d.ts.map +1 -1
- package/dist/schemas/pipelines.d.ts +166 -166
- package/dist/schemas/projections.d.ts +346 -346
- package/dist/schemas/rules.d.ts +4 -4
- package/dist/schemas/share-grants.d.ts +14 -14
- package/dist/schemas/syncs.d.ts +40 -40
- package/dist/schemas/users.d.ts +72 -0
- package/dist/schemas/users.d.ts.map +1 -0
- package/dist/schemas/webhook-runs.d.ts +6 -6
- package/dist/schemas/workflows.d.ts +769 -254
- package/dist/schemas/workflows.d.ts.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/utils/http.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/artifacts/frame.ts +51 -0
- package/src/auth/browser-origin.ts +20 -5
- package/src/auth/experience.ts +1 -1
- package/src/auth/guard.ts +2 -2
- package/src/auth/public-routes.ts +16 -0
- package/src/auth/responses.ts +7 -6
- package/src/auth/scope.ts +32 -3
- package/src/files/content.ts +9 -13
- package/src/models/display.ts +61 -16
- package/src/openapi/components.ts +54 -0
- package/src/openapi/tags.ts +20 -0
- package/src/registerRoutes.ts +23 -0
- package/src/routes/activity.ts +327 -0
- package/src/routes/agent-api-gateway.ts +115 -91
- package/src/routes/agent-approval-gate.ts +213 -0
- package/src/routes/agent-approvals.ts +299 -0
- package/src/routes/agent-children.ts +209 -0
- package/src/routes/agent-memory.ts +210 -0
- package/src/routes/agents.ts +364 -143
- package/src/routes/ai-accounting.ts +4 -0
- package/src/routes/artifact-frames.ts +144 -0
- package/src/routes/artifacts.ts +717 -0
- package/src/routes/auth.ts +306 -13
- package/src/routes/file-downloads.ts +1 -3
- package/src/routes/files.ts +6 -7
- package/src/routes/model-calls.ts +120 -0
- package/src/routes/model-generations.ts +245 -0
- package/src/routes/models.ts +116 -9
- package/src/routes/objects.ts +55 -61
- package/src/routes/observed-agent-threads.ts +253 -0
- package/src/routes/ontology.ts +1 -0
- package/src/routes/users.ts +73 -0
- package/src/routes/workflows.ts +6 -9
- package/src/routes/ws/agents.ts +10 -5
- package/src/routes/ws/events.ts +3 -2
- package/src/routes/ws/subscription-hub.ts +53 -20
- package/src/schemas/activity.ts +287 -0
- package/src/schemas/agent-approvals.ts +129 -0
- package/src/schemas/agent-memory.ts +96 -0
- package/src/schemas/agents.ts +240 -2
- package/src/schemas/ai-accounting.ts +40 -4
- package/src/schemas/ai-usage.ts +10 -0
- package/src/schemas/artifacts.ts +246 -0
- package/src/schemas/auth.ts +25 -0
- package/src/schemas/models.ts +197 -1
- package/src/schemas/objects.ts +181 -0
- package/src/schemas/ontology.ts +1 -0
- package/src/schemas/users.ts +24 -0
- package/src/schemas/workflows.ts +2 -0
- package/src/server.ts +34 -19
- package/src/utils/http.ts +2 -0
package/src/schemas/agents.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MAX_AGENT_CONTEXT_ENTRIES } from "@sixb/core"
|
|
2
2
|
import { MAX_AGENT_CONTEXT_LABEL_LENGTH } from "@sixb/core/agents/context"
|
|
3
|
+
import { LANGUAGE_MODEL_TIERS } from "@sixb/core/models"
|
|
3
4
|
import {
|
|
4
5
|
AGENT_RUN_DIAGNOSTIC_CODES,
|
|
5
6
|
AGENT_RUN_FAILURE_CODES,
|
|
@@ -8,6 +9,14 @@ import {
|
|
|
8
9
|
type SixbFailure,
|
|
9
10
|
} from "@sixb/core/storage"
|
|
10
11
|
import { z } from "zod"
|
|
12
|
+
import {
|
|
13
|
+
AgentApprovalCallSummarySchema,
|
|
14
|
+
AgentApprovalModeSchema,
|
|
15
|
+
AgentApprovalModeSourceSchema,
|
|
16
|
+
AgentApprovalOutcomeSchema,
|
|
17
|
+
AgentApprovalSchema,
|
|
18
|
+
AgentApprovalStatusSchema,
|
|
19
|
+
} from "./agent-approvals"
|
|
11
20
|
import { AiCostSummarySchema } from "./ai-accounting"
|
|
12
21
|
import { AiUsageSummarySchema } from "./ai-usage"
|
|
13
22
|
import { ErrorResponseSchema, JsonValueSchema, sixbFailureSchema } from "./common"
|
|
@@ -87,6 +96,8 @@ export const AgentThreadStatusSchema = z.enum(["active", "archived"])
|
|
|
87
96
|
export const AgentThreadListQuerySchema = z
|
|
88
97
|
.object({
|
|
89
98
|
status: AgentThreadStatusSchema.optional(),
|
|
99
|
+
/** `true` lists the threads other users added the caller to, instead of the caller's own. */
|
|
100
|
+
sharedWithMe: z.enum(["true", "false"]).optional(),
|
|
90
101
|
limit: z.string().optional(),
|
|
91
102
|
offset: z.string().optional(),
|
|
92
103
|
order: z.enum(["asc", "desc"]).optional(),
|
|
@@ -101,6 +112,18 @@ export const CreateAgentThreadBodySchema = z
|
|
|
101
112
|
})
|
|
102
113
|
.strict()
|
|
103
114
|
|
|
115
|
+
/** A user the thread's owner added: they read the whole conversation and talk in it. */
|
|
116
|
+
/** A principal with its account's display name, as message authors and thread people are named. */
|
|
117
|
+
export const AgentMessageAuthorSchema = AgentPrincipalSchema.extend({
|
|
118
|
+
displayName: z.string().optional(),
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
export const AgentThreadParticipantSchema = z.object({
|
|
122
|
+
principal: AgentMessageAuthorSchema.extend({ type: z.literal("user") }),
|
|
123
|
+
addedAt: z.string(),
|
|
124
|
+
addedBy: AgentPrincipalSchema,
|
|
125
|
+
})
|
|
126
|
+
|
|
104
127
|
export const AgentThreadSchema = z.object({
|
|
105
128
|
sandboxState: z
|
|
106
129
|
.object({
|
|
@@ -111,7 +134,21 @@ export const AgentThreadSchema = z.object({
|
|
|
111
134
|
.optional(),
|
|
112
135
|
id: z.string(),
|
|
113
136
|
projectId: z.string(),
|
|
137
|
+
/** A conversation, or the thread a sub-agent works in: read through its conversation. */
|
|
138
|
+
kind: z.enum(["conversation", "subagent"]),
|
|
139
|
+
/** A sub-agent's thread: its conversation, the turn that spawned it, and its key there. */
|
|
140
|
+
parent: z
|
|
141
|
+
.object({
|
|
142
|
+
threadId: z.string(),
|
|
143
|
+
/** The turn that spawned it; its later runs work under the turns that go on with it. */
|
|
144
|
+
spawnedBy: z.string(),
|
|
145
|
+
key: z.string(),
|
|
146
|
+
})
|
|
147
|
+
.optional(),
|
|
114
148
|
ownerPrincipal: AgentPrincipalSchema,
|
|
149
|
+
/** The owner, named by their account. */
|
|
150
|
+
owner: AgentMessageAuthorSchema,
|
|
151
|
+
participants: z.array(AgentThreadParticipantSchema),
|
|
115
152
|
title: z.string().optional(),
|
|
116
153
|
sandboxParams: z.record(z.string(), JsonValueSchema).optional(),
|
|
117
154
|
status: AgentThreadStatusSchema,
|
|
@@ -120,6 +157,13 @@ export const AgentThreadSchema = z.object({
|
|
|
120
157
|
messageCount: z.number(),
|
|
121
158
|
createdAt: z.string(),
|
|
122
159
|
updatedAt: z.string(),
|
|
160
|
+
/** Your mode in this thread, when the thread is read alone. */
|
|
161
|
+
approvalMode: AgentApprovalModeSchema.optional(),
|
|
162
|
+
/**
|
|
163
|
+
* Where your mode in this thread comes from, with `approvalMode`. `run`: a sub-agent's thread,
|
|
164
|
+
* whose mode is its latest run's, copied from the turn it works under, for every reader.
|
|
165
|
+
*/
|
|
166
|
+
approvalModeSource: AgentApprovalModeSourceSchema.optional(),
|
|
123
167
|
})
|
|
124
168
|
|
|
125
169
|
export const AgentThreadListResponseSchema = z.object({
|
|
@@ -132,6 +176,28 @@ export const CreateAgentThreadResponseSchema = z.object({
|
|
|
132
176
|
thread: AgentThreadSchema,
|
|
133
177
|
})
|
|
134
178
|
|
|
179
|
+
export const AddAgentThreadParticipantsBodySchema = z
|
|
180
|
+
.object({
|
|
181
|
+
/**
|
|
182
|
+
* Active users of the project, by id or by their account's email; someone already taking part
|
|
183
|
+
* is left as they are.
|
|
184
|
+
*/
|
|
185
|
+
users: z
|
|
186
|
+
.array(
|
|
187
|
+
z.union([
|
|
188
|
+
z.object({ type: z.literal("user"), id: z.string().trim().min(1) }).strict(),
|
|
189
|
+
z.object({ email: z.string().trim().min(1) }).strict(),
|
|
190
|
+
])
|
|
191
|
+
)
|
|
192
|
+
.min(1)
|
|
193
|
+
.max(50),
|
|
194
|
+
})
|
|
195
|
+
.strict()
|
|
196
|
+
|
|
197
|
+
export const AgentThreadParticipantParamsSchema = AgentThreadParamsSchema.extend({
|
|
198
|
+
userId: z.string().min(1),
|
|
199
|
+
})
|
|
200
|
+
|
|
135
201
|
export const AgentMessageRoleSchema = z.enum(["system", "user", "assistant"])
|
|
136
202
|
|
|
137
203
|
const AgentTextPartSchema = z.object({
|
|
@@ -187,9 +253,43 @@ const AgentContinuationPartSchema = z.object({
|
|
|
187
253
|
type: z.literal("continuation"),
|
|
188
254
|
})
|
|
189
255
|
|
|
256
|
+
/** How a call the Agent held ended; Sixb writes it at the start of the next message. */
|
|
257
|
+
const AgentApprovalOutcomePartSchema = z.object({
|
|
258
|
+
type: z.literal("approval-outcome"),
|
|
259
|
+
approvalId: z.string(),
|
|
260
|
+
status: AgentApprovalStatusSchema.exclude(["pending"]),
|
|
261
|
+
call: AgentApprovalCallSummarySchema,
|
|
262
|
+
outcome: AgentApprovalOutcomeSchema.optional(),
|
|
263
|
+
/** The turn's sub-agent that made the call, when the turn did not make it itself. */
|
|
264
|
+
caller: z
|
|
265
|
+
.object({
|
|
266
|
+
runId: z.string(),
|
|
267
|
+
key: z.string(),
|
|
268
|
+
/** The message resumed the turn and the sub-agent, paused on its calls, went on. */
|
|
269
|
+
continues: z.literal(true).optional(),
|
|
270
|
+
})
|
|
271
|
+
.optional(),
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* A message a sub-agent's parent sent it, as it read it before a step: a steer, or the answer to
|
|
276
|
+
* the question it asked (`inReplyTo`). Only a sub-agent's thread holds one.
|
|
277
|
+
*/
|
|
278
|
+
export const AgentMailPartSchema = z.object({
|
|
279
|
+
type: z.literal("mail"),
|
|
280
|
+
id: z.string(),
|
|
281
|
+
from: z.literal("parent"),
|
|
282
|
+
kind: z.enum(["message", "answer"]),
|
|
283
|
+
inReplyTo: z.string().optional(),
|
|
284
|
+
text: z.string(),
|
|
285
|
+
/** It came as the sub-agent answered, so it wrote its result again. */
|
|
286
|
+
afterAnswer: z.literal(true).optional(),
|
|
287
|
+
})
|
|
288
|
+
|
|
190
289
|
export const AgentMessagePartSchema = z.union([
|
|
191
290
|
AgentTextPartSchema,
|
|
192
291
|
AgentContinuationPartSchema,
|
|
292
|
+
AgentApprovalOutcomePartSchema,
|
|
193
293
|
AgentReasoningPartSchema,
|
|
194
294
|
AgentStepStartPartSchema,
|
|
195
295
|
AgentFilePartSchema,
|
|
@@ -197,13 +297,13 @@ export const AgentMessagePartSchema = z.union([
|
|
|
197
297
|
AgentContextPartSchema,
|
|
198
298
|
AgentToolCallOutputSchema,
|
|
199
299
|
AgentToolCallErrorSchema,
|
|
300
|
+
AgentMailPartSchema,
|
|
200
301
|
])
|
|
201
302
|
|
|
202
303
|
export const AgentRunDiagnosticSchema = z.object({
|
|
203
304
|
code: z.enum(AGENT_RUN_DIAGNOSTIC_CODES),
|
|
204
305
|
severity: z.enum(["warning", "error"]),
|
|
205
|
-
scope: z.enum(["
|
|
206
|
-
path: z.string().optional(),
|
|
306
|
+
scope: z.enum(["run"]),
|
|
207
307
|
message: z.string(),
|
|
208
308
|
})
|
|
209
309
|
|
|
@@ -241,6 +341,8 @@ export const AgentMessagesQuerySchema = z.object({
|
|
|
241
341
|
|
|
242
342
|
export const AgentMessageListResponseSchema = z.object({
|
|
243
343
|
messages: z.array(AgentMessageSchema),
|
|
344
|
+
/** The page's distinct authors, to name each message's `authorPrincipal`. */
|
|
345
|
+
authors: z.array(AgentMessageAuthorSchema),
|
|
244
346
|
hasMore: z.boolean(),
|
|
245
347
|
total: z.number(),
|
|
246
348
|
})
|
|
@@ -257,6 +359,8 @@ export const PostAgentMessageBodySchema = z
|
|
|
257
359
|
timeZone: z.string().trim().min(1).max(100).optional(),
|
|
258
360
|
/** BCP 47 language of the person asking. */
|
|
259
361
|
locale: z.string().trim().min(1).max(100).optional(),
|
|
362
|
+
/** What this turn may change without asking you. Omitted: your choice in the thread. */
|
|
363
|
+
approvalMode: AgentApprovalModeSchema.optional(),
|
|
260
364
|
attachments: z.array(FileRefSchema).optional(),
|
|
261
365
|
context: z.array(AgentContextEntryInputSchema).max(MAX_AGENT_CONTEXT_ENTRIES).optional(),
|
|
262
366
|
messageId: z.string().trim().min(1).optional(),
|
|
@@ -285,13 +389,26 @@ export const AgentRunFinishReasonSchema = z.enum(AGENT_RUN_FINISH_REASONS)
|
|
|
285
389
|
export const AgentRunSchema = z.object({
|
|
286
390
|
id: z.string(),
|
|
287
391
|
projectId: z.string(),
|
|
392
|
+
/** A conversation's turn, or a sub-agent's run in its own thread. */
|
|
393
|
+
kind: z.enum(["conversation", "subagent"]),
|
|
288
394
|
threadId: z.string(),
|
|
289
395
|
triggerMessageId: z.string(),
|
|
396
|
+
/** A sub-agent's: the turn it works under, whose deadline, mode and stop it shares. */
|
|
397
|
+
parentRunId: z.string().optional(),
|
|
290
398
|
requestedBy: AgentAuthorizablePrincipalSchema.optional(),
|
|
291
399
|
status: AgentRunStatusSchema,
|
|
292
400
|
model: LanguageModelRefSchema.optional(),
|
|
401
|
+
/** With tiers, the tier of the model the turn runs on. */
|
|
402
|
+
tier: z.enum(LANGUAGE_MODEL_TIERS).optional(),
|
|
293
403
|
reasoning: ModelReasoningSchema.optional(),
|
|
404
|
+
/** What the turn could change without asking. Absent on turns from before approval modes. */
|
|
405
|
+
approvalMode: AgentApprovalModeSchema.optional(),
|
|
294
406
|
modelId: z.string().optional(),
|
|
407
|
+
/**
|
|
408
|
+
* `awaiting_approval`: the turn succeeded and paused on calls waiting for its requester. It stays
|
|
409
|
+
* so: a later turn continues it once they decided on every call, unless a call was set aside or
|
|
410
|
+
* the turn stopped. The thread's approvals say where they stand.
|
|
411
|
+
*/
|
|
295
412
|
finishReason: AgentRunFinishReasonSchema.optional(),
|
|
296
413
|
usage: AiUsageSummarySchema.optional(),
|
|
297
414
|
cost: AiCostSummarySchema.optional(),
|
|
@@ -312,6 +429,24 @@ export const CancelAgentRunResponseSchema = z.object({
|
|
|
312
429
|
run: AgentRunSchema,
|
|
313
430
|
})
|
|
314
431
|
|
|
432
|
+
export const DecideAgentApprovalResponseSchema = z.object({
|
|
433
|
+
approval: AgentApprovalSchema,
|
|
434
|
+
/** The turn that resumed the paused one, when this decision was its last. */
|
|
435
|
+
run: AgentRunSchema.optional(),
|
|
436
|
+
/**
|
|
437
|
+
* The paused turn could not resume; the decision and the call's outcome stand. `retrying`: Sixb
|
|
438
|
+
* resumes it once it can. Otherwise the thread's next message tells the Agent how its calls ended.
|
|
439
|
+
*/
|
|
440
|
+
resume: z
|
|
441
|
+
.object({
|
|
442
|
+
status: z.literal("refused"),
|
|
443
|
+
code: z.string(),
|
|
444
|
+
message: z.string(),
|
|
445
|
+
retrying: z.boolean(),
|
|
446
|
+
})
|
|
447
|
+
.optional(),
|
|
448
|
+
})
|
|
449
|
+
|
|
315
450
|
export const RetryAgentRunResponseSchema = z.object({
|
|
316
451
|
run: AgentRunSchema,
|
|
317
452
|
})
|
|
@@ -328,3 +463,106 @@ export const AgentRunListResponseSchema = z.object({
|
|
|
328
463
|
hasMore: z.boolean(),
|
|
329
464
|
total: z.number(),
|
|
330
465
|
})
|
|
466
|
+
|
|
467
|
+
/** A file a turn and its sub-agent hand each other, by its path in the sub-agent's sandbox. */
|
|
468
|
+
export const AgentChildFileSchema = z.object({
|
|
469
|
+
path: z.string(),
|
|
470
|
+
fileRef: FileRefSchema,
|
|
471
|
+
})
|
|
472
|
+
|
|
473
|
+
export const AgentChildRunSchema = z.object({
|
|
474
|
+
id: z.string(),
|
|
475
|
+
/** The turn the run worked under: the one that spawned the sub-agent, or one that went on. */
|
|
476
|
+
parentRunId: z.string(),
|
|
477
|
+
status: AgentRunStatusSchema,
|
|
478
|
+
finishReason: AgentRunFinishReasonSchema.optional(),
|
|
479
|
+
error: AgentRunFailureSchema.optional(),
|
|
480
|
+
modelId: z.string().optional(),
|
|
481
|
+
attempt: z.number(),
|
|
482
|
+
/** Subscribe to it on `/ws/agents` with the run's id while it is at work. */
|
|
483
|
+
streamId: z.string(),
|
|
484
|
+
createdAt: z.string(),
|
|
485
|
+
startedAt: z.string().optional(),
|
|
486
|
+
completedAt: z.string().optional(),
|
|
487
|
+
/** What it answered, and the files it wrote under `out/`, by path relative to it. */
|
|
488
|
+
result: z
|
|
489
|
+
.object({
|
|
490
|
+
text: z.string(),
|
|
491
|
+
files: z.array(AgentChildFileSchema).optional(),
|
|
492
|
+
/** Why none of what it wrote under `out/` came back. */
|
|
493
|
+
filesError: z.string().optional(),
|
|
494
|
+
})
|
|
495
|
+
.optional(),
|
|
496
|
+
usage: AiUsageSummarySchema.optional(),
|
|
497
|
+
cost: AiCostSummarySchema.optional(),
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
/** What a paused sub-agent waits for before it goes on. */
|
|
501
|
+
export const AgentChildAwaitingSchema = z.discriminatedUnion("type", [
|
|
502
|
+
z.object({
|
|
503
|
+
type: z.literal("approval"),
|
|
504
|
+
/** Its calls still waiting for the turn's requester. */
|
|
505
|
+
approvalIds: z.array(z.string()),
|
|
506
|
+
}),
|
|
507
|
+
/** Its calls were decided: it continues once its turn resumes. */
|
|
508
|
+
z.object({ type: z.literal("resume") }),
|
|
509
|
+
/** It paused on the question it asked: a later turn of the conversation answers it. */
|
|
510
|
+
z.object({
|
|
511
|
+
type: z.literal("answer"),
|
|
512
|
+
question: z.object({ id: z.string(), text: z.string() }),
|
|
513
|
+
}),
|
|
514
|
+
])
|
|
515
|
+
|
|
516
|
+
/**
|
|
517
|
+
* Why a paused sub-agent never continues. On its calls: a new message set them aside, one expired,
|
|
518
|
+
* or its turn was stopped, its requester leaving the conversation among the reasons. On its
|
|
519
|
+
* question: `replaced`, the Agent spawned another sub-agent under its key.
|
|
520
|
+
*/
|
|
521
|
+
export const AgentChildEndedSchema = z.object({
|
|
522
|
+
reason: z.enum(["superseded", "expired", "stopped", "replaced"]),
|
|
523
|
+
})
|
|
524
|
+
|
|
525
|
+
export const AgentChildSchema = z.object({
|
|
526
|
+
/** Its first run's id: the one `spawn_agent` answered with. */
|
|
527
|
+
id: z.string(),
|
|
528
|
+
/** Its own thread: `GET /api/agent-threads/:threadId/messages` reads what it did. */
|
|
529
|
+
threadId: z.string(),
|
|
530
|
+
projectId: z.string(),
|
|
531
|
+
/** The turn that spawned it. */
|
|
532
|
+
spawnedBy: z.string(),
|
|
533
|
+
key: z.string(),
|
|
534
|
+
task: z.string(),
|
|
535
|
+
model: LanguageModelRefSchema,
|
|
536
|
+
tier: z.enum(LANGUAGE_MODEL_TIERS).optional(),
|
|
537
|
+
reasoning: ModelReasoningSchema.optional(),
|
|
538
|
+
/** What its parent handed it, by path in its sandbox. */
|
|
539
|
+
handedFiles: z.array(AgentChildFileSchema),
|
|
540
|
+
/** Its latest run's. */
|
|
541
|
+
status: AgentRunStatusSchema,
|
|
542
|
+
/**
|
|
543
|
+
* `awaiting_approval` or `awaiting_answer`: it paused on held calls or on its question.
|
|
544
|
+
* `awaiting` says what it waits for, or `ended` why it will not continue.
|
|
545
|
+
*/
|
|
546
|
+
finishReason: AgentRunFinishReasonSchema.optional(),
|
|
547
|
+
error: AgentRunFailureSchema.optional(),
|
|
548
|
+
awaiting: AgentChildAwaitingSchema.optional(),
|
|
549
|
+
ended: AgentChildEndedSchema.optional(),
|
|
550
|
+
/** Its run at work, which streams on `/ws/agents`; `null` when none is. */
|
|
551
|
+
activeRunId: z.string().nullable(),
|
|
552
|
+
createdAt: z.string(),
|
|
553
|
+
completedAt: z.string().optional(),
|
|
554
|
+
/** Every run of it, and what those ran. */
|
|
555
|
+
usage: AiUsageSummarySchema.optional(),
|
|
556
|
+
cost: AiCostSummarySchema.optional(),
|
|
557
|
+
/** Oldest first: the run spawned, then each that continued it. */
|
|
558
|
+
runs: z.array(AgentChildRunSchema),
|
|
559
|
+
})
|
|
560
|
+
|
|
561
|
+
export const AgentChildListQuerySchema = z.object({
|
|
562
|
+
/** Only those this turn of the conversation spawned. */
|
|
563
|
+
runId: z.string().min(1).optional(),
|
|
564
|
+
})
|
|
565
|
+
|
|
566
|
+
export const AgentChildListResponseSchema = z.object({
|
|
567
|
+
children: z.array(AgentChildSchema),
|
|
568
|
+
})
|
|
@@ -39,6 +39,17 @@ export const AiCostSummarySchema = z.object({
|
|
|
39
39
|
unvaluedCallCount: z.number().int().nonnegative(),
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
+
const ModelKindSchema = z.enum([
|
|
43
|
+
"language",
|
|
44
|
+
"image",
|
|
45
|
+
"video",
|
|
46
|
+
"embedding",
|
|
47
|
+
"decision",
|
|
48
|
+
"transcription",
|
|
49
|
+
"speech",
|
|
50
|
+
"reranking",
|
|
51
|
+
])
|
|
52
|
+
|
|
42
53
|
const AiAccountingAggregateSchema = z.object({
|
|
43
54
|
modelCallCount: z.number().int().nonnegative(),
|
|
44
55
|
usage: AiUsageSummarySchema.describe(
|
|
@@ -59,6 +70,10 @@ const AiAccountingAggregateSchema = z.object({
|
|
|
59
70
|
textOutputTokens: z.number().int().nonnegative(),
|
|
60
71
|
reasoningOutputTokens: z.number().int().nonnegative(),
|
|
61
72
|
audioDurationMs: z.number().int().nonnegative(),
|
|
73
|
+
imageOutputTokens: z.number().int().nonnegative(),
|
|
74
|
+
audioOutputTokens: z.number().int().nonnegative(),
|
|
75
|
+
outputImages: z.number().int().nonnegative(),
|
|
76
|
+
inputCharacters: z.number().int().nonnegative(),
|
|
62
77
|
}),
|
|
63
78
|
}),
|
|
64
79
|
costs: AiCostSummarySchema,
|
|
@@ -80,6 +95,13 @@ export const AiAccountingOverviewResponseSchema = z.object({
|
|
|
80
95
|
modelId: z.string(),
|
|
81
96
|
})
|
|
82
97
|
),
|
|
98
|
+
kinds: z.array(
|
|
99
|
+
AiAccountingAggregateSchema.extend({
|
|
100
|
+
modelKind: ModelKindSchema.optional().describe(
|
|
101
|
+
"Absent for calls recorded before their kind was captured."
|
|
102
|
+
),
|
|
103
|
+
})
|
|
104
|
+
),
|
|
83
105
|
agents: z.array(
|
|
84
106
|
z.discriminatedUnion("kind", [
|
|
85
107
|
AiAccountingAggregateSchema.extend({ kind: z.literal("agent") }),
|
|
@@ -121,11 +143,19 @@ const AiCostComponentSchema = z.object({
|
|
|
121
143
|
"tokens.output.total",
|
|
122
144
|
"tokens.output.text",
|
|
123
145
|
"tokens.output.reasoning",
|
|
146
|
+
"tokens.output.image",
|
|
147
|
+
"tokens.output.audio",
|
|
124
148
|
"audio.input.milliseconds",
|
|
149
|
+
"images.output",
|
|
150
|
+
"characters.input",
|
|
125
151
|
]),
|
|
126
152
|
quantity: IntegerStringSchema,
|
|
127
153
|
rateAmountNanosPerMillion: IntegerStringSchema,
|
|
128
154
|
chargeAmountNanos: IntegerStringSchema,
|
|
155
|
+
variant: z
|
|
156
|
+
.string()
|
|
157
|
+
.optional()
|
|
158
|
+
.describe("The price variant that applied, such as an image size. Display only."),
|
|
129
159
|
})
|
|
130
160
|
|
|
131
161
|
const AiBillingIdentitySchema = z.object({
|
|
@@ -194,9 +224,7 @@ const AiModelCallUsageRecordSchema = z.object({
|
|
|
194
224
|
callId: z.string(),
|
|
195
225
|
providerId: z.string(),
|
|
196
226
|
requestedModelId: z.string(),
|
|
197
|
-
modelKind:
|
|
198
|
-
.enum(["language", "image", "video", "embedding", "decision", "transcription", "reranking"])
|
|
199
|
-
.optional(),
|
|
227
|
+
modelKind: ModelKindSchema.optional(),
|
|
200
228
|
requestedReasoning: ModelReasoningSchema.optional(),
|
|
201
229
|
responseModelId: z.string().optional(),
|
|
202
230
|
responseId: z.string(),
|
|
@@ -256,7 +284,15 @@ const AiModelCallExecutionSummarySchema = z.object({
|
|
|
256
284
|
executionId: z.string(),
|
|
257
285
|
attribution: AiModelCallAccountingItemSchema.shape.attribution,
|
|
258
286
|
modelCallCount: z.number().int().nonnegative(),
|
|
259
|
-
totalTokens: z
|
|
287
|
+
totalTokens: z
|
|
288
|
+
.number()
|
|
289
|
+
.int()
|
|
290
|
+
.nonnegative()
|
|
291
|
+
.optional()
|
|
292
|
+
.describe("Present when every call that reports tokens did; images and speech don't."),
|
|
293
|
+
outputImages: z.number().int().nonnegative().optional(),
|
|
294
|
+
inputCharacters: z.number().int().nonnegative().optional(),
|
|
295
|
+
audioDurationMs: z.number().int().nonnegative().optional(),
|
|
260
296
|
costs: AiCostSummarySchema,
|
|
261
297
|
firstCallAt: IsoDateSchema,
|
|
262
298
|
lastCallAt: IsoDateSchema,
|
package/src/schemas/ai-usage.ts
CHANGED
|
@@ -15,5 +15,15 @@ export const AiUsageSummarySchema = z.object({
|
|
|
15
15
|
audioDurationMs: TokenCountSchema.optional().describe(
|
|
16
16
|
"Audio content duration in milliseconds; not billed duration."
|
|
17
17
|
),
|
|
18
|
+
imageOutputTokens: TokenCountSchema.optional().describe(
|
|
19
|
+
"Output tokens that encode generated images, within outputTokens."
|
|
20
|
+
),
|
|
21
|
+
audioOutputTokens: TokenCountSchema.optional().describe(
|
|
22
|
+
"Output tokens that encode generated audio, within outputTokens."
|
|
23
|
+
),
|
|
24
|
+
outputImages: TokenCountSchema.optional().describe("Images the call returned."),
|
|
25
|
+
inputCharacters: TokenCountSchema.optional().describe(
|
|
26
|
+
"Input characters, counted by the provider's own billing rule."
|
|
27
|
+
),
|
|
18
28
|
reportingStatus: z.enum(["complete", "partial", "unavailable"]),
|
|
19
29
|
})
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { ARTIFACT_KINDS, ARTIFACT_STATE_LIMITS } from "@sixb/core/artifacts"
|
|
2
|
+
import { z } from "zod"
|
|
3
|
+
import { ErrorResponseSchema, PrincipalSchema } from "./common"
|
|
4
|
+
import { FileRefSchema } from "./files"
|
|
5
|
+
|
|
6
|
+
const ArtifactKindSchema = z.enum(ARTIFACT_KINDS)
|
|
7
|
+
|
|
8
|
+
const ArtifactFileSchema = z.object({
|
|
9
|
+
path: z
|
|
10
|
+
.string()
|
|
11
|
+
.min(1)
|
|
12
|
+
.describe("The file's path inside the artifact, such as figures/revenue.svg"),
|
|
13
|
+
file: FileRefSchema,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const DocumentOutlineSchema = z.object({
|
|
17
|
+
kind: z.literal("document"),
|
|
18
|
+
headings: z.array(z.object({ depth: z.number().int(), text: z.string(), slug: z.string() })),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const SheetOutlineSchema = z.object({
|
|
22
|
+
kind: z.literal("sheet"),
|
|
23
|
+
sheets: z.array(
|
|
24
|
+
z.object({
|
|
25
|
+
name: z.string(),
|
|
26
|
+
rows: z.number().int().describe("The rows of its CSV; none for a live sheet"),
|
|
27
|
+
columns: z.array(z.string()),
|
|
28
|
+
query: z
|
|
29
|
+
.string()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("A live sheet's query, queries/<name>.json, whose rows each reader reads"),
|
|
32
|
+
})
|
|
33
|
+
),
|
|
34
|
+
charts: z.array(z.string()),
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const SlidesOutlineSchema = z.object({
|
|
38
|
+
kind: z.literal("slides"),
|
|
39
|
+
slides: z.array(z.object({ title: z.string().optional() })),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
const PageOutlineSchema = z.object({ kind: z.literal("page"), title: z.string().optional() })
|
|
43
|
+
|
|
44
|
+
const CanvasOutlineSchema = z.object({
|
|
45
|
+
kind: z.literal("canvas"),
|
|
46
|
+
items: z.array(
|
|
47
|
+
z.discriminatedUnion("type", [
|
|
48
|
+
z.object({
|
|
49
|
+
id: z.string(),
|
|
50
|
+
type: z.literal("board"),
|
|
51
|
+
title: z.string().optional(),
|
|
52
|
+
file: z.string(),
|
|
53
|
+
w: z.number(),
|
|
54
|
+
h: z.number(),
|
|
55
|
+
}),
|
|
56
|
+
z.object({ id: z.string(), type: z.literal("section"), title: z.string().optional() }),
|
|
57
|
+
])
|
|
58
|
+
),
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const FileOutlineSchema = z.object({ kind: z.literal("file"), mediaType: z.string() })
|
|
62
|
+
|
|
63
|
+
const ArtifactOutlineSchema = z.discriminatedUnion("kind", [
|
|
64
|
+
DocumentOutlineSchema,
|
|
65
|
+
SheetOutlineSchema,
|
|
66
|
+
SlidesOutlineSchema,
|
|
67
|
+
PageOutlineSchema,
|
|
68
|
+
CanvasOutlineSchema,
|
|
69
|
+
FileOutlineSchema,
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
const ArtifactReferenceSchema = z.object({
|
|
73
|
+
address: z.string(),
|
|
74
|
+
as: z.enum(["embed", "link"]),
|
|
75
|
+
at: z.string(),
|
|
76
|
+
resolvedVersion: z.number().int().positive(),
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const ArtifactWarningSchema = z.object({
|
|
80
|
+
code: z.string(),
|
|
81
|
+
message: z.string(),
|
|
82
|
+
part: z.string().optional(),
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const ArtifactSchema = z.object({
|
|
86
|
+
id: z.string(),
|
|
87
|
+
projectId: z.string(),
|
|
88
|
+
kind: ArtifactKindSchema,
|
|
89
|
+
title: z.string(),
|
|
90
|
+
owner: PrincipalSchema,
|
|
91
|
+
latestVersion: z.number().int().positive(),
|
|
92
|
+
createdAt: z.string(),
|
|
93
|
+
updatedAt: z.string(),
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
const ArtifactOriginSchema = z.object({ threadId: z.string(), runId: z.string() })
|
|
97
|
+
|
|
98
|
+
export const ArtifactVersionSchema = z.object({
|
|
99
|
+
artifactId: z.string(),
|
|
100
|
+
version: z.number().int().positive(),
|
|
101
|
+
title: z.string(),
|
|
102
|
+
entry: z.string(),
|
|
103
|
+
files: z.array(ArtifactFileSchema),
|
|
104
|
+
outline: ArtifactOutlineSchema,
|
|
105
|
+
references: z.array(ArtifactReferenceSchema),
|
|
106
|
+
author: PrincipalSchema,
|
|
107
|
+
origin: ArtifactOriginSchema.optional(),
|
|
108
|
+
createdAt: z.string(),
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
const ArtifactVersionSummarySchema = ArtifactVersionSchema.pick({
|
|
112
|
+
version: true,
|
|
113
|
+
title: true,
|
|
114
|
+
author: true,
|
|
115
|
+
origin: true,
|
|
116
|
+
createdAt: true,
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
export const ArtifactParamsSchema = z.object({ artifactId: z.string().min(1) })
|
|
120
|
+
|
|
121
|
+
export const ArtifactVersionParamsSchema = ArtifactParamsSchema.extend({
|
|
122
|
+
version: z
|
|
123
|
+
.string()
|
|
124
|
+
.regex(/^(?:latest|[1-9]\d*)$/)
|
|
125
|
+
.describe('A version number, or "latest"'),
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
export const ArtifactQueryParamsSchema = ArtifactVersionParamsSchema.extend({
|
|
129
|
+
name: z.string().min(1).describe("The query's name: queries/<name>.json in the version"),
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
export const ArtifactListQuerySchema = z
|
|
133
|
+
.object({
|
|
134
|
+
thread: z
|
|
135
|
+
.string()
|
|
136
|
+
.min(1)
|
|
137
|
+
.optional()
|
|
138
|
+
.describe("Only artifacts with a version the Agent published in this thread"),
|
|
139
|
+
kind: ArtifactKindSchema.optional().describe("Only artifacts of this kind"),
|
|
140
|
+
limit: z.string().optional(),
|
|
141
|
+
offset: z.string().optional(),
|
|
142
|
+
})
|
|
143
|
+
.strict()
|
|
144
|
+
|
|
145
|
+
export const ArtifactListResponseSchema = z.object({
|
|
146
|
+
artifacts: z.array(ArtifactSchema),
|
|
147
|
+
hasMore: z.boolean(),
|
|
148
|
+
total: z.number().int(),
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
export const ArtifactResponseSchema = z.object({
|
|
152
|
+
artifact: ArtifactSchema,
|
|
153
|
+
versions: z.array(ArtifactVersionSummarySchema).describe("Newest first"),
|
|
154
|
+
access: z
|
|
155
|
+
.enum(["owner", "update", "read"])
|
|
156
|
+
.describe(
|
|
157
|
+
"What the caller may do with it: everything as its owner, publish and keep page data as a participant of a conversation that shares it, or only read as an observer of one"
|
|
158
|
+
),
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const PublishArtifactBodySchema = z
|
|
162
|
+
.object({
|
|
163
|
+
kind: ArtifactKindSchema,
|
|
164
|
+
title: z.string(),
|
|
165
|
+
files: z
|
|
166
|
+
.array(ArtifactFileSchema)
|
|
167
|
+
.min(1)
|
|
168
|
+
.describe("Files stored with POST /api/files, at their paths in the artifact"),
|
|
169
|
+
})
|
|
170
|
+
.strict()
|
|
171
|
+
|
|
172
|
+
export const PublishArtifactVersionBodySchema = PublishArtifactBodySchema.extend({
|
|
173
|
+
baseVersion: z
|
|
174
|
+
.number()
|
|
175
|
+
.int()
|
|
176
|
+
.positive()
|
|
177
|
+
.optional()
|
|
178
|
+
.describe(
|
|
179
|
+
"The version this one was made from. When another was published since, the publish is refused with 409 artifact_moved, naming the latest version."
|
|
180
|
+
),
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
export const PublishedArtifactResponseSchema = z.object({
|
|
184
|
+
artifact: ArtifactSchema,
|
|
185
|
+
version: ArtifactVersionSchema,
|
|
186
|
+
warnings: z.array(ArtifactWarningSchema),
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
export const DeleteArtifactResponseSchema = z.object({ deleted: z.literal(true) })
|
|
190
|
+
|
|
191
|
+
export const ArtifactStateParamsSchema = ArtifactParamsSchema.extend({
|
|
192
|
+
key: z
|
|
193
|
+
.string()
|
|
194
|
+
.min(1)
|
|
195
|
+
.max(ARTIFACT_STATE_LIMITS.maxKeyLength)
|
|
196
|
+
.describe("The key a page keeps the value under, such as filters"),
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
const ArtifactStateEntrySchema = z.object({
|
|
200
|
+
key: z.string(),
|
|
201
|
+
value: z.unknown().describe("The JSON value"),
|
|
202
|
+
updatedAt: z.string(),
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
export const ArtifactStateResponseSchema = z.object({
|
|
206
|
+
entries: z.array(ArtifactStateEntrySchema).describe("By key, in order"),
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
export const SetArtifactStateBodySchema = z.object({
|
|
210
|
+
value: z
|
|
211
|
+
.unknown()
|
|
212
|
+
.refine((value) => value !== undefined, "A value is required.")
|
|
213
|
+
.describe(
|
|
214
|
+
`Any JSON value: at most ${ARTIFACT_STATE_LIMITS.maxValueBytes / 1024} KB written out, within ${ARTIFACT_STATE_LIMITS.maxKeys} keys and ${ARTIFACT_STATE_LIMITS.maxBytes / 1024 / 1024} MB for each reader`
|
|
215
|
+
),
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
export const SetArtifactStateResponseSchema = ArtifactStateEntrySchema
|
|
219
|
+
|
|
220
|
+
export const DeleteArtifactStateResponseSchema = z.object({ deleted: z.boolean() })
|
|
221
|
+
|
|
222
|
+
export const ClearArtifactStateResponseSchema = z.object({
|
|
223
|
+
cleared: z.number().int().describe("How many values were deleted"),
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
export const ArtifactFrameResponseSchema = z.object({
|
|
227
|
+
path: z
|
|
228
|
+
.string()
|
|
229
|
+
.describe(
|
|
230
|
+
"The frame's base path on this API, ending in /; the deck's entry is served under it"
|
|
231
|
+
),
|
|
232
|
+
expiresAt: z.string().describe("When the frame stops serving; ask for a new one before then"),
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
export const ArtifactErrorResponseSchema = ErrorResponseSchema.extend({
|
|
236
|
+
code: z
|
|
237
|
+
.string()
|
|
238
|
+
.optional()
|
|
239
|
+
.describe(
|
|
240
|
+
"Stable machine-readable failure code: artifact_not_found, artifact_kind_mismatch, artifact_moved, invalid_artifact, invalid_state, state_full, not_allowed, not_shared (it exists but no conversation you read shares it), read_only (you observe the conversation that shares it), query_not_found, query_invalid (the ontology no longer admits the query), or storage_unavailable."
|
|
241
|
+
),
|
|
242
|
+
latest: z
|
|
243
|
+
.object({ version: z.number().int(), author: PrincipalSchema })
|
|
244
|
+
.optional()
|
|
245
|
+
.describe("With artifact_moved: the latest version and who published it"),
|
|
246
|
+
})
|