@sixb/server 0.2.4 → 0.2.6
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/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +877 -89
- package/dist/index.js.map +26 -25
- package/dist/live/room.d.ts +2 -0
- package/dist/live/room.d.ts.map +1 -1
- package/dist/registerRoutes.d.ts +1 -0
- package/dist/registerRoutes.d.ts.map +1 -1
- package/dist/routes/agent-approvals.d.ts +22 -0
- package/dist/routes/agent-approvals.d.ts.map +1 -1
- package/dist/routes/agent-computers.d.ts +36 -0
- package/dist/routes/agent-computers.d.ts.map +1 -1
- package/dist/routes/agent-runners.d.ts +5 -1
- package/dist/routes/agent-runners.d.ts.map +1 -1
- package/dist/routes/agent-thread-reads.d.ts +82 -0
- package/dist/routes/agent-thread-reads.d.ts.map +1 -0
- package/dist/routes/agents.d.ts +1760 -86
- 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 +3 -3
- package/dist/routes/artifact-frames.d.ts.map +1 -1
- package/dist/routes/artifacts.d.ts +287 -21
- package/dist/routes/artifacts.d.ts.map +1 -1
- package/dist/routes/auth.d.ts +7 -7
- package/dist/routes/events.d.ts +4 -4
- package/dist/routes/links.d.ts +8 -0
- package/dist/routes/links.d.ts.map +1 -1
- package/dist/routes/model-generations.d.ts +6 -0
- package/dist/routes/model-generations.d.ts.map +1 -1
- package/dist/routes/objects.d.ts +8 -0
- package/dist/routes/objects.d.ts.map +1 -1
- package/dist/routes/observed-agent-threads.d.ts +22 -0
- package/dist/routes/observed-agent-threads.d.ts.map +1 -1
- package/dist/routes/projections.d.ts +2 -0
- package/dist/routes/projections.d.ts.map +1 -1
- package/dist/routes/status.d.ts +4 -1
- package/dist/routes/status.d.ts.map +1 -1
- package/dist/routes/syncs.d.ts +175 -12
- package/dist/routes/syncs.d.ts.map +1 -1
- package/dist/routes/workflows.d.ts +6 -6
- package/dist/routes/ws/agents.d.ts.map +1 -1
- package/dist/routes/ws/events.d.ts +6 -6
- package/dist/schemas/activity.d.ts +4 -4
- package/dist/schemas/agents.d.ts +7697 -262
- package/dist/schemas/agents.d.ts.map +1 -1
- package/dist/schemas/ai-accounting.d.ts +3 -0
- package/dist/schemas/ai-accounting.d.ts.map +1 -1
- package/dist/schemas/artifacts.d.ts +676 -36
- package/dist/schemas/artifacts.d.ts.map +1 -1
- package/dist/schemas/auth.d.ts +8 -8
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/events.d.ts +36 -24
- package/dist/schemas/events.d.ts.map +1 -1
- package/dist/schemas/lineage.d.ts +112 -0
- package/dist/schemas/lineage.d.ts.map +1 -1
- package/dist/schemas/models.d.ts +46 -0
- package/dist/schemas/models.d.ts.map +1 -1
- package/dist/schemas/projections.d.ts +11 -0
- package/dist/schemas/projections.d.ts.map +1 -1
- package/dist/schemas/syncs.d.ts +724 -25
- package/dist/schemas/syncs.d.ts.map +1 -1
- package/dist/schemas/workflows.d.ts +22 -22
- package/dist/server.d.ts +16 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +6 -1
- package/src/live/README.md +9 -6
- package/src/live/room.ts +16 -8
- package/src/registerRoutes.ts +4 -1
- package/src/routes/agent-computers.ts +7 -6
- package/src/routes/agent-runners.ts +15 -4
- package/src/routes/agent-thread-reads.ts +67 -0
- package/src/routes/agents.ts +331 -20
- package/src/routes/ai-accounting.ts +1 -0
- package/src/routes/artifact-frames.ts +22 -9
- package/src/routes/artifacts.ts +124 -3
- package/src/routes/model-generations.ts +1 -1
- package/src/routes/observed-agent-threads.ts +3 -4
- package/src/routes/status.ts +18 -1
- package/src/routes/syncs.ts +135 -8
- package/src/routes/ws/agents.ts +43 -3
- package/src/schemas/agents.ts +148 -12
- package/src/schemas/ai-accounting.ts +12 -0
- package/src/schemas/artifacts.ts +66 -1
- package/src/schemas/common.ts +15 -9
- package/src/schemas/events.ts +1 -0
- package/src/schemas/models.ts +10 -0
- package/src/schemas/projections.ts +1 -0
- package/src/schemas/syncs.ts +63 -1
- package/src/server.ts +208 -14
package/src/schemas/agents.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MAX_AGENT_CONTEXT_ENTRIES } from "@sixb/core"
|
|
1
|
+
import { AGENT_MESSAGE_DELIVERIES, MAX_AGENT_CONTEXT_ENTRIES } from "@sixb/core"
|
|
2
2
|
import { MAX_AGENT_CONTEXT_LABEL_LENGTH } from "@sixb/core/agents/context"
|
|
3
3
|
import { CONTROL_CHARACTER } from "@sixb/core/internal/agent-run-storage-provider"
|
|
4
4
|
import { LANGUAGE_MODEL_TIERS } from "@sixb/core/models"
|
|
@@ -49,6 +49,9 @@ export const AgentAuthorizablePrincipalSchema = z.object({
|
|
|
49
49
|
id: z.string().min(1),
|
|
50
50
|
})
|
|
51
51
|
|
|
52
|
+
/** How a message sent to a thread is delivered while a turn runs. */
|
|
53
|
+
export const AgentMessageDeliverySchema = z.enum(AGENT_MESSAGE_DELIVERIES)
|
|
54
|
+
|
|
52
55
|
export const AgentObjectContextSchema = z.object({
|
|
53
56
|
kind: z.literal("object"),
|
|
54
57
|
ref: z.object({
|
|
@@ -164,6 +167,46 @@ export const AgentThreadParticipantSchema = z.object({
|
|
|
164
167
|
addedBy: AgentPrincipalSchema,
|
|
165
168
|
})
|
|
166
169
|
|
|
170
|
+
export const AgentRunStatusSchema = z.enum([
|
|
171
|
+
"queued",
|
|
172
|
+
"running",
|
|
173
|
+
"succeeded",
|
|
174
|
+
"failed",
|
|
175
|
+
"cancelled",
|
|
176
|
+
])
|
|
177
|
+
|
|
178
|
+
export const AgentRunFinishReasonSchema = z.enum(AGENT_RUN_FINISH_REASONS)
|
|
179
|
+
|
|
180
|
+
/** Your place in a conversation: how far your reading reached, and what is new. */
|
|
181
|
+
export const AgentThreadReadSchema = z.object({
|
|
182
|
+
threadId: z.string(),
|
|
183
|
+
/** The seq of the last message your reading reached; 0 when it reached none. */
|
|
184
|
+
throughSeq: z.number(),
|
|
185
|
+
/** The thread's newest message seq. */
|
|
186
|
+
headSeq: z.number(),
|
|
187
|
+
/** Messages past your place that someone else wrote: not yours, nor approval outcomes alone. */
|
|
188
|
+
unread: z.number(),
|
|
189
|
+
/** When you last marked it read. */
|
|
190
|
+
readAt: z.string().optional(),
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
/** The newest run of a thread, enough to offer Continue or Retry without reading it. */
|
|
194
|
+
export const AgentThreadLastRunSchema = z.object({
|
|
195
|
+
id: z.string(),
|
|
196
|
+
status: AgentRunStatusSchema,
|
|
197
|
+
finishReason: AgentRunFinishReasonSchema.optional(),
|
|
198
|
+
errorCode: z.enum(AGENT_RUN_FAILURE_CODES).optional(),
|
|
199
|
+
completedAt: z.string().optional(),
|
|
200
|
+
/** Who asked for it, when it ended short: only they can run it again. */
|
|
201
|
+
requestedBy: AgentAuthorizablePrincipalSchema.optional(),
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
export const MarkAgentThreadReadBodySchema = z
|
|
205
|
+
.object({ throughMessageId: z.string().trim().min(1).optional() })
|
|
206
|
+
.strict()
|
|
207
|
+
|
|
208
|
+
export const MarkAgentThreadReadResponseSchema = z.object({ read: AgentThreadReadSchema })
|
|
209
|
+
|
|
167
210
|
export const AgentThreadSchema = z.object({
|
|
168
211
|
sandboxState: z
|
|
169
212
|
.object({
|
|
@@ -221,6 +264,10 @@ export const AgentThreadSchema = z.object({
|
|
|
221
264
|
messageCount: z.number(),
|
|
222
265
|
createdAt: z.string(),
|
|
223
266
|
updatedAt: z.string(),
|
|
267
|
+
/** Your place in it: absent for an observer, and for code that is not a person. */
|
|
268
|
+
read: AgentThreadReadSchema.optional(),
|
|
269
|
+
/** Its newest run, so a client can offer Continue or Retry without reading it. */
|
|
270
|
+
lastRun: AgentThreadLastRunSchema.optional(),
|
|
224
271
|
/** Your mode in this thread, when the thread is read alone. */
|
|
225
272
|
approvalMode: AgentApprovalModeSchema.optional(),
|
|
226
273
|
/**
|
|
@@ -240,6 +287,7 @@ export const CreateAgentThreadResponseSchema = z.object({
|
|
|
240
287
|
thread: AgentThreadSchema,
|
|
241
288
|
})
|
|
242
289
|
|
|
290
|
+
/** The computer and folder a thread moves to, whether it runs in the cloud or elsewhere. */
|
|
243
291
|
export const MoveAgentThreadToComputerBodySchema = z
|
|
244
292
|
.object({ computer: AgentThreadComputerInputSchema })
|
|
245
293
|
.strict()
|
|
@@ -485,6 +533,24 @@ export const AgentMessageListResponseSchema = z.object({
|
|
|
485
533
|
total: z.number(),
|
|
486
534
|
})
|
|
487
535
|
|
|
536
|
+
export const EditAgentMessageBodySchema = z
|
|
537
|
+
.object({
|
|
538
|
+
/** Required unless `attachments` are the whole message. */
|
|
539
|
+
text: z.string().trim().min(1).optional(),
|
|
540
|
+
model: LanguageModelRefSchema.optional(),
|
|
541
|
+
reasoning: ModelReasoningSchema.optional(),
|
|
542
|
+
/** IANA time zone of the person asking. The Agent presents dates and times in it. */
|
|
543
|
+
timeZone: z.string().trim().min(1).max(100).optional(),
|
|
544
|
+
/** BCP 47 language of the person asking. */
|
|
545
|
+
locale: z.string().trim().min(1).max(100).optional(),
|
|
546
|
+
/** What this turn may change without asking you. Omitted: your choice in the thread. */
|
|
547
|
+
approvalMode: AgentApprovalModeSchema.optional(),
|
|
548
|
+
attachments: z.array(FileRefSchema).optional(),
|
|
549
|
+
context: z.array(AgentContextEntryInputSchema).max(MAX_AGENT_CONTEXT_ENTRIES).optional(),
|
|
550
|
+
nextMessageId: z.string().trim().min(1).optional(),
|
|
551
|
+
})
|
|
552
|
+
.strict()
|
|
553
|
+
|
|
488
554
|
export const PostAgentMessageBodySchema = z
|
|
489
555
|
.object({
|
|
490
556
|
/** Required unless `continue` is set or `attachments` are the whole message. */
|
|
@@ -502,6 +568,11 @@ export const PostAgentMessageBodySchema = z
|
|
|
502
568
|
attachments: z.array(FileRefSchema).optional(),
|
|
503
569
|
context: z.array(AgentContextEntryInputSchema).max(MAX_AGENT_CONTEXT_ENTRIES).optional(),
|
|
504
570
|
messageId: z.string().trim().min(1).optional(),
|
|
571
|
+
/**
|
|
572
|
+
* Where the message goes while a turn runs: `auto` starts a turn and refuses while one runs,
|
|
573
|
+
* `steer` reaches it, `queue` waits for the next, and `send_now` stops it and goes.
|
|
574
|
+
*/
|
|
575
|
+
delivery: AgentMessageDeliverySchema.optional(),
|
|
505
576
|
})
|
|
506
577
|
.strict()
|
|
507
578
|
|
|
@@ -514,16 +585,6 @@ export const CancelAgentRunBodySchema = z.object({
|
|
|
514
585
|
runId: z.string().trim().min(1),
|
|
515
586
|
})
|
|
516
587
|
|
|
517
|
-
export const AgentRunStatusSchema = z.enum([
|
|
518
|
-
"queued",
|
|
519
|
-
"running",
|
|
520
|
-
"succeeded",
|
|
521
|
-
"failed",
|
|
522
|
-
"cancelled",
|
|
523
|
-
])
|
|
524
|
-
|
|
525
|
-
export const AgentRunFinishReasonSchema = z.enum(AGENT_RUN_FINISH_REASONS)
|
|
526
|
-
|
|
527
588
|
export const AgentRunSchema = z.object({
|
|
528
589
|
id: z.string(),
|
|
529
590
|
projectId: z.string(),
|
|
@@ -543,6 +604,12 @@ export const AgentRunSchema = z.object({
|
|
|
543
604
|
approvalMode: AgentApprovalModeSchema.optional(),
|
|
544
605
|
/** Its owner's computer claims it; absent, the cloud runs it. */
|
|
545
606
|
runsOn: z.literal("computer").optional(),
|
|
607
|
+
/**
|
|
608
|
+
* The computer and folder it runs in, in the list of a thread's runs its owner reads: shown to
|
|
609
|
+
* them alone, as the thread's `computer` is. A turn in another place than the one before it no
|
|
610
|
+
* longer has the files that turn worked on.
|
|
611
|
+
*/
|
|
612
|
+
computer: z.object({ id: z.string(), folder: z.string() }).optional(),
|
|
546
613
|
modelId: z.string().optional(),
|
|
547
614
|
/**
|
|
548
615
|
* `awaiting_approval`: the turn succeeded and paused on calls waiting for its requester. It stays
|
|
@@ -561,8 +628,77 @@ export const AgentRunSchema = z.object({
|
|
|
561
628
|
completedAt: z.string().optional(),
|
|
562
629
|
})
|
|
563
630
|
|
|
631
|
+
/** A message waiting in a thread's inbox: the steer or the queued turn it becomes. */
|
|
632
|
+
export const AgentInboxItemSchema = z.object({
|
|
633
|
+
id: z.string(),
|
|
634
|
+
projectId: z.string(),
|
|
635
|
+
threadId: z.string(),
|
|
636
|
+
/** The id its message takes once a turn writes it. */
|
|
637
|
+
messageId: z.string(),
|
|
638
|
+
seq: z.number(),
|
|
639
|
+
authorPrincipal: AgentPrincipalSchema,
|
|
640
|
+
mode: z.enum(["steer", "queue"]),
|
|
641
|
+
parts: z.array(AgentMessagePartSchema),
|
|
642
|
+
spec: z
|
|
643
|
+
.object({
|
|
644
|
+
model: LanguageModelRefSchema.optional(),
|
|
645
|
+
reasoning: ModelReasoningSchema.optional(),
|
|
646
|
+
approvalMode: AgentApprovalModeSchema.optional(),
|
|
647
|
+
})
|
|
648
|
+
.optional(),
|
|
649
|
+
/** The time zone and locale its message was sent in, which its time renders in. */
|
|
650
|
+
timeZone: z.string().optional(),
|
|
651
|
+
locale: z.string().optional(),
|
|
652
|
+
/** Sent now: it starts even when the turn it waited for ended without answering. */
|
|
653
|
+
immediate: z.boolean().optional(),
|
|
654
|
+
/** An edit waiting for the turn it stopped: the message it replaces once that turn ends. */
|
|
655
|
+
replacesMessageId: z.string().optional(),
|
|
656
|
+
createdAt: z.string(),
|
|
657
|
+
updatedAt: z.string(),
|
|
658
|
+
})
|
|
659
|
+
|
|
660
|
+
export const AgentInboxListResponseSchema = z.object({
|
|
661
|
+
items: z.array(AgentInboxItemSchema),
|
|
662
|
+
})
|
|
663
|
+
|
|
664
|
+
export const AgentThreadInboxParamsSchema = AgentThreadParamsSchema.extend({
|
|
665
|
+
itemId: z.string().min(1),
|
|
666
|
+
})
|
|
667
|
+
|
|
668
|
+
/** What the person who sent a waiting message may change about it. */
|
|
669
|
+
export const UpdateAgentInboxItemBodySchema = z
|
|
670
|
+
.object({
|
|
671
|
+
text: z.string().trim().min(1).optional(),
|
|
672
|
+
model: LanguageModelRefSchema.optional(),
|
|
673
|
+
reasoning: ModelReasoningSchema.optional(),
|
|
674
|
+
approvalMode: AgentApprovalModeSchema.optional(),
|
|
675
|
+
/** Steer the running turn with it, or keep it for the next one. */
|
|
676
|
+
delivery: z.enum(["steer", "queue"]).optional(),
|
|
677
|
+
/** Stop the turn it waits behind and start it now. */
|
|
678
|
+
immediate: z.literal(true).optional(),
|
|
679
|
+
})
|
|
680
|
+
.strict()
|
|
681
|
+
|
|
682
|
+
export const UpdateAgentInboxItemResponseSchema = z.object({
|
|
683
|
+
item: AgentInboxItemSchema,
|
|
684
|
+
})
|
|
685
|
+
|
|
686
|
+
/**
|
|
687
|
+
* What a sent message became: the turn it started, or the inbox item that waits beside the turn
|
|
688
|
+
* that runs. A message that starts a turn carries `run`, as it always has.
|
|
689
|
+
*/
|
|
564
690
|
export const PostAgentMessageResponseSchema = z.object({
|
|
565
|
-
run: AgentRunSchema,
|
|
691
|
+
run: AgentRunSchema.optional(),
|
|
692
|
+
item: AgentInboxItemSchema.optional(),
|
|
693
|
+
})
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* `run` when the edit starts its turn now; `item` when it waits, sent now, for the running turn it
|
|
697
|
+
* stopped to end.
|
|
698
|
+
*/
|
|
699
|
+
export const EditAgentMessageResponseSchema = z.object({
|
|
700
|
+
run: AgentRunSchema.optional(),
|
|
701
|
+
item: AgentInboxItemSchema.optional(),
|
|
566
702
|
})
|
|
567
703
|
|
|
568
704
|
export const CancelAgentRunResponseSchema = z.object({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { canonicalTimeZone } from "@sixb/core/calendar"
|
|
1
2
|
import { z } from "zod"
|
|
2
3
|
import { AiUsageSummarySchema } from "./ai-usage"
|
|
3
4
|
import { ModelReasoningSchema } from "./models"
|
|
@@ -48,8 +49,19 @@ export const AiAccountingRangeQuerySchema = z.object({
|
|
|
48
49
|
kind: ModelKindSchema.optional().describe("Calls to one kind of model"),
|
|
49
50
|
})
|
|
50
51
|
|
|
52
|
+
const TimeZoneSchema = z
|
|
53
|
+
.string()
|
|
54
|
+
.trim()
|
|
55
|
+
.min(1)
|
|
56
|
+
.refine((value) => canonicalTimeZone(value) !== undefined, {
|
|
57
|
+
message: "Use an IANA time zone such as America/New_York",
|
|
58
|
+
})
|
|
59
|
+
|
|
51
60
|
export const AiAccountingOverviewQuerySchema = AiAccountingRangeQuerySchema.extend({
|
|
52
61
|
bucket: AiAccountingBucketSchema,
|
|
62
|
+
timeZone: TimeZoneSchema.optional().describe(
|
|
63
|
+
"The IANA time zone whose days, weeks or hours the periods follow, such as America/New_York; UTC when absent"
|
|
64
|
+
),
|
|
53
65
|
})
|
|
54
66
|
|
|
55
67
|
export const AiModelCallAccountingListQuerySchema = AiAccountingRangeQuerySchema.extend({
|
package/src/schemas/artifacts.ts
CHANGED
|
@@ -17,6 +17,34 @@ const ArtifactFileSchema = z.object({
|
|
|
17
17
|
const DocumentOutlineSchema = z.object({
|
|
18
18
|
kind: z.literal("document"),
|
|
19
19
|
headings: z.array(z.object({ depth: z.number().int(), text: z.string(), slug: z.string() })),
|
|
20
|
+
format: z
|
|
21
|
+
.literal("html")
|
|
22
|
+
.optional()
|
|
23
|
+
.describe("html for a designed document, document.html with its own stylesheets"),
|
|
24
|
+
paper: z
|
|
25
|
+
.object({
|
|
26
|
+
width: z.number(),
|
|
27
|
+
height: z.number(),
|
|
28
|
+
margin: z.object({
|
|
29
|
+
top: z.number(),
|
|
30
|
+
right: z.number(),
|
|
31
|
+
bottom: z.number(),
|
|
32
|
+
left: z.number(),
|
|
33
|
+
}),
|
|
34
|
+
})
|
|
35
|
+
.optional()
|
|
36
|
+
.describe(
|
|
37
|
+
"The sheet a designed document's @page rule sets, in CSS pixels: its size and margins"
|
|
38
|
+
),
|
|
39
|
+
holder: z
|
|
40
|
+
.object({
|
|
41
|
+
objectTypeId: z.string(),
|
|
42
|
+
links: z.array(z.string()).describe("The holder's links its fields read through"),
|
|
43
|
+
})
|
|
44
|
+
.optional()
|
|
45
|
+
.describe(
|
|
46
|
+
'The object a designed document shows live data of, as <meta name="sixb:object-type"> names its type: the one object of that type that holds the document'
|
|
47
|
+
),
|
|
20
48
|
})
|
|
21
49
|
|
|
22
50
|
const SheetOutlineSchema = z.object({
|
|
@@ -145,8 +173,45 @@ export const ArtifactVersionSchema = z.object({
|
|
|
145
173
|
.describe(
|
|
146
174
|
"A canvas's boards by id, as reading or publishing the version returns them: ready when its preview is, pending while it is rendered, none when none will come and the board shows its outline"
|
|
147
175
|
),
|
|
176
|
+
printable: z
|
|
177
|
+
.boolean()
|
|
178
|
+
.optional()
|
|
179
|
+
.describe(
|
|
180
|
+
"true for a designed document in a project that prints to PDF: POST to its pdf route to print it, with the values whoever asks reads"
|
|
181
|
+
),
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
const ArtifactPdfKeySchema = z
|
|
185
|
+
.string()
|
|
186
|
+
.regex(/^sha256:[0-9a-f]{64}$/)
|
|
187
|
+
.describe(
|
|
188
|
+
"The values a document that shows live data prints: ask with it again, and get that PDF with it, whatever the values are by then"
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
export const ArtifactPdfResponseSchema = z.discriminatedUnion("status", [
|
|
192
|
+
z.object({
|
|
193
|
+
status: z.literal("ready"),
|
|
194
|
+
pages: z.number().int().min(1).describe("How many pages it printed on"),
|
|
195
|
+
key: ArtifactPdfKeySchema.optional(),
|
|
196
|
+
}),
|
|
197
|
+
z.object({ status: z.literal("printing"), key: ArtifactPdfKeySchema.optional() }),
|
|
198
|
+
z.object({
|
|
199
|
+
status: z.literal("failed"),
|
|
200
|
+
reason: z.string().describe("Why it could not be printed"),
|
|
201
|
+
key: ArtifactPdfKeySchema.optional(),
|
|
202
|
+
}),
|
|
203
|
+
])
|
|
204
|
+
|
|
205
|
+
export const ArtifactPdfQuerySchema = z.object({
|
|
206
|
+
retry: z
|
|
207
|
+
.enum(["true", "false"])
|
|
208
|
+
.optional()
|
|
209
|
+
.describe("true asks again for a PDF that could not be printed, instead of hearing why"),
|
|
210
|
+
key: ArtifactPdfKeySchema.optional(),
|
|
148
211
|
})
|
|
149
212
|
|
|
213
|
+
export const ArtifactPdfDownloadQuerySchema = z.object({ key: ArtifactPdfKeySchema.optional() })
|
|
214
|
+
|
|
150
215
|
const ArtifactVersionSummarySchema = ArtifactVersionSchema.pick({
|
|
151
216
|
version: true,
|
|
152
217
|
revision: true,
|
|
@@ -391,7 +456,7 @@ export const ArtifactErrorResponseSchema = ErrorResponseSchema.extend({
|
|
|
391
456
|
.string()
|
|
392
457
|
.optional()
|
|
393
458
|
.describe(
|
|
394
|
-
"Stable machine-readable failure code: artifact_not_found, artifact_kind_mismatch, artifact_moved, restore_point_not_found, comment_not_found, invalid_artifact, invalid_comment, invalid_state, name_required (a shared link's guest gives their name before commenting), state_full, comments_full, not_allowed, not_shared (it exists but neither a conversation nor an object you read shares it), read_only (you only read it), query_not_found, query_invalid (the ontology no longer admits the query), preview_not_found (the board has no preview yet, or will have none), execution_lost (a run token's run ended or moved to another runner), or storage_unavailable."
|
|
459
|
+
"Stable machine-readable failure code: artifact_not_found, artifact_kind_mismatch, artifact_moved, restore_point_not_found, comment_not_found, invalid_artifact, invalid_comment, invalid_state, name_required (a shared link's guest gives their name before commenting), state_full, comments_full, not_allowed, not_shared (it exists but neither a conversation nor an object you read shares it), read_only (you only read it), query_not_found, holder_not_found (no one object of the type a designed document names that you read holds it), query_invalid (the ontology no longer admits the query), preview_not_found (the board has no preview yet, or will have none), pdf_not_found (the document is not printed yet: ask for it first), pdf_unavailable (the project has no sandboxes to print in), execution_lost (a run token's run ended or moved to another runner), or storage_unavailable."
|
|
395
460
|
),
|
|
396
461
|
latest: z
|
|
397
462
|
.object({
|
package/src/schemas/common.ts
CHANGED
|
@@ -32,15 +32,21 @@ export type JsonValue =
|
|
|
32
32
|
| JsonValue[]
|
|
33
33
|
| { [key: string]: JsonValue }
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
z.
|
|
43
|
-
|
|
35
|
+
// Zod calls a lazy schema's getter at every value it checks: built there, the union and its array
|
|
36
|
+
// and record would be built again at each node of every JSON value, which cost a thread's messages
|
|
37
|
+
// seconds of CPU. Built once, each check only walks the value.
|
|
38
|
+
let jsonValueUnion: z.ZodType<JsonValue> | undefined
|
|
39
|
+
|
|
40
|
+
export const JsonValueSchema: z.ZodType<JsonValue> = z.lazy(
|
|
41
|
+
() =>
|
|
42
|
+
(jsonValueUnion ??= z.union([
|
|
43
|
+
z.string(),
|
|
44
|
+
z.number().finite(),
|
|
45
|
+
z.boolean(),
|
|
46
|
+
z.null(),
|
|
47
|
+
z.array(JsonValueSchema),
|
|
48
|
+
z.record(JsonValueSchema),
|
|
49
|
+
]))
|
|
44
50
|
)
|
|
45
51
|
|
|
46
52
|
/** A JSON null with an explicit runtime and generated-client type. */
|
package/src/schemas/events.ts
CHANGED
|
@@ -90,6 +90,7 @@ export const EventExecutorSchema = z.discriminatedUnion("type", [
|
|
|
90
90
|
z.object({ type: z.literal("ontology.indexVectors"), indexingId: z.string() }),
|
|
91
91
|
]),
|
|
92
92
|
}),
|
|
93
|
+
z.object({ type: z.literal("script"), runId: z.string(), path: z.string() }),
|
|
93
94
|
])
|
|
94
95
|
|
|
95
96
|
const StoredAuthorableEventBaseSchema = StoredEventBaseSchema.extend({
|
package/src/schemas/models.ts
CHANGED
|
@@ -253,6 +253,16 @@ export const TranscriptionBodySchema = GenerationBodyBase.extend({
|
|
|
253
253
|
audio: z.union([FileRefSchema, InlineAudioSchema]),
|
|
254
254
|
})
|
|
255
255
|
|
|
256
|
+
/** One word the model timed, with who said it where the model labels voices. */
|
|
257
|
+
export const TranscriptionWordSchema = z.object({
|
|
258
|
+
text: z.string(),
|
|
259
|
+
startMs: z.number().int().nonnegative(),
|
|
260
|
+
endMs: z.number().int().nonnegative(),
|
|
261
|
+
speaker: z.string().optional(),
|
|
262
|
+
})
|
|
263
|
+
|
|
256
264
|
export const TranscriptionSchema = GenerationResultBase.extend({
|
|
257
265
|
text: z.string(),
|
|
266
|
+
/** Absent when the model returns no word timings. */
|
|
267
|
+
words: z.array(TranscriptionWordSchema).optional(),
|
|
258
268
|
})
|
|
@@ -100,6 +100,7 @@ export const ObjectProjectionSchema = z.object({
|
|
|
100
100
|
users: z.record(z.enum(["email", "id"])).optional(),
|
|
101
101
|
links: z.record(ForeignKeyDescriptorSchema),
|
|
102
102
|
conflictResolution: SourceEditConflictResolutionSchema,
|
|
103
|
+
missing: z.literal("remove").optional(),
|
|
103
104
|
latestRun: ProjectionRunSchema.nullable(),
|
|
104
105
|
})
|
|
105
106
|
|
package/src/schemas/syncs.ts
CHANGED
|
@@ -19,6 +19,7 @@ const SyncModeSchema = z.enum(["snapshot", "append", "merge"])
|
|
|
19
19
|
|
|
20
20
|
export const SyncRunsQuerySchema = z.object({
|
|
21
21
|
syncId: z.string().optional(),
|
|
22
|
+
connectionId: z.string().optional(),
|
|
22
23
|
datasetId: z.string().optional(),
|
|
23
24
|
status: SyncRunStatusSchema.optional(),
|
|
24
25
|
startedAfter: z.string().optional(),
|
|
@@ -29,6 +30,8 @@ export const SyncRunsQuerySchema = z.object({
|
|
|
29
30
|
})
|
|
30
31
|
|
|
31
32
|
export const RequestSyncRunBodySchema = z.object({
|
|
33
|
+
/** One connection to run, on a sync of an OAuth connector. Without it, every one you can run. */
|
|
34
|
+
connectionId: z.string().optional(),
|
|
32
35
|
expectedLatestVersionId: z.string().optional(),
|
|
33
36
|
commitMessage: z.string().optional(),
|
|
34
37
|
})
|
|
@@ -42,6 +45,8 @@ export const SyncRunSchema = z.object({
|
|
|
42
45
|
id: z.string(),
|
|
43
46
|
projectId: z.string(),
|
|
44
47
|
syncId: z.string(),
|
|
48
|
+
/** The connection the run reads, on a sync of an OAuth connector. */
|
|
49
|
+
connectionId: z.string().optional(),
|
|
45
50
|
datasetId: z.string(),
|
|
46
51
|
mode: SyncModeSchema,
|
|
47
52
|
status: SyncRunStatusSchema,
|
|
@@ -62,6 +67,45 @@ export const SyncRunSchema = z.object({
|
|
|
62
67
|
error: SyncRunFailureSchema.optional(),
|
|
63
68
|
})
|
|
64
69
|
|
|
70
|
+
const SyncAccountConnectionSchema = z.object({
|
|
71
|
+
id: z.string(),
|
|
72
|
+
owner: z.discriminatedUnion("type", [
|
|
73
|
+
z.object({ type: z.literal("project") }),
|
|
74
|
+
z.object({ type: z.literal("user"), id: z.string() }),
|
|
75
|
+
]),
|
|
76
|
+
slot: z.string(),
|
|
77
|
+
account: z.object({ id: z.string(), label: z.string() }),
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
/** One connected account of an OAuth connector, and the latest run of each of its syncs. */
|
|
81
|
+
export const ConnectorAccountSchema = z.object({
|
|
82
|
+
connection: SyncAccountConnectionSchema,
|
|
83
|
+
latestRuns: z.array(SyncRunSchema),
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
export const ConnectorAccountListResponseSchema = z.object({
|
|
87
|
+
accounts: z.array(ConnectorAccountSchema),
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
export const ConnectorAccountsParamsSchema = z.object({
|
|
91
|
+
connectorId: z.string().min(1),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
/** Where a sync of an OAuth connector's accounts stand, by the latest run of each. */
|
|
95
|
+
const SyncAccountSummarySchema = z.object({
|
|
96
|
+
total: z.number(),
|
|
97
|
+
/** Their latest run is queued or running. */
|
|
98
|
+
running: z.number(),
|
|
99
|
+
/** Their latest run failed because the account needs reconnecting. */
|
|
100
|
+
needsReconnecting: z.number(),
|
|
101
|
+
/** Their latest run failed for any other reason. */
|
|
102
|
+
failing: z.number(),
|
|
103
|
+
/** Their latest run succeeded. */
|
|
104
|
+
synced: z.number(),
|
|
105
|
+
/** When the most recent of those successful runs finished. */
|
|
106
|
+
lastSyncedAt: z.string().optional(),
|
|
107
|
+
})
|
|
108
|
+
|
|
65
109
|
export const SyncSchema = z.object({
|
|
66
110
|
id: z.string(),
|
|
67
111
|
mode: SyncModeSchema,
|
|
@@ -75,6 +119,17 @@ export const SyncSchema = z.object({
|
|
|
75
119
|
}),
|
|
76
120
|
triggers: z.array(SyncTriggerSchema),
|
|
77
121
|
latestRun: SyncRunSchema.nullable(),
|
|
122
|
+
/** On a sync of an OAuth connector: the accounts the caller may see. */
|
|
123
|
+
accounts: SyncAccountSummarySchema.optional(),
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
export const ConnectionSyncRunsParamsSchema = z.object({
|
|
127
|
+
connectorId: z.string().min(1),
|
|
128
|
+
connectionId: z.string().min(1),
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
export const ConnectionSyncRunsResponseSchema = z.object({
|
|
132
|
+
runs: z.array(SyncRunSchema),
|
|
78
133
|
})
|
|
79
134
|
|
|
80
135
|
export const SyncRunListResponseSchema = z.object({
|
|
@@ -83,9 +138,16 @@ export const SyncRunListResponseSchema = z.object({
|
|
|
83
138
|
total: z.number(),
|
|
84
139
|
})
|
|
85
140
|
|
|
86
|
-
|
|
141
|
+
const RequestedSyncRunSchema = z.object({
|
|
87
142
|
runId: z.string(),
|
|
88
143
|
jobId: z.string(),
|
|
89
144
|
syncId: z.string(),
|
|
145
|
+
/** The connection the run reads, on a sync of an OAuth connector. */
|
|
146
|
+
connectionId: z.string().optional(),
|
|
90
147
|
queuedAt: z.string(),
|
|
91
148
|
})
|
|
149
|
+
|
|
150
|
+
/** One run for a static connector's sync; one per connection for an OAuth connector's sync. */
|
|
151
|
+
export const RequestSyncRunResponseSchema = z.object({
|
|
152
|
+
runs: z.array(RequestedSyncRunSchema),
|
|
153
|
+
})
|