@sixb/server 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +123 -0
- package/dist/auth/access-token-boundary.d.ts +23 -0
- package/dist/auth/access-token-boundary.d.ts.map +1 -0
- package/dist/auth/application-access.d.ts +4 -0
- package/dist/auth/application-access.d.ts.map +1 -0
- package/dist/auth/browser-origin.d.ts +62 -0
- package/dist/auth/browser-origin.d.ts.map +1 -0
- package/dist/auth/csrf.d.ts +2 -0
- package/dist/auth/csrf.d.ts.map +1 -0
- package/dist/auth/guard.d.ts +35 -0
- package/dist/auth/guard.d.ts.map +1 -0
- package/dist/auth/public-routes.d.ts +8 -0
- package/dist/auth/public-routes.d.ts.map +1 -0
- package/dist/auth/responses.d.ts +11 -0
- package/dist/auth/responses.d.ts.map +1 -0
- package/dist/auth/return-to.d.ts +3 -0
- package/dist/auth/return-to.d.ts.map +1 -0
- package/dist/auth/scope.d.ts +43 -0
- package/dist/auth/scope.d.ts.map +1 -0
- package/dist/auth/session-activity.d.ts +4 -0
- package/dist/auth/session-activity.d.ts.map +1 -0
- package/dist/auth/session-cookies.d.ts +12 -0
- package/dist/auth/session-cookies.d.ts.map +1 -0
- package/dist/files/content.d.ts +141 -0
- package/dist/files/content.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11522 -0
- package/dist/index.js.map +78 -0
- package/dist/openapi/security.d.ts +26 -0
- package/dist/openapi/security.d.ts.map +1 -0
- package/dist/openapi/tags.d.ts +151 -0
- package/dist/openapi/tags.d.ts.map +1 -0
- package/dist/registerRoutes.d.ts +31 -0
- package/dist/registerRoutes.d.ts.map +1 -0
- package/dist/routes/action-runs.d.ts +244 -0
- package/dist/routes/action-runs.d.ts.map +1 -0
- package/dist/routes/actions.d.ts +183 -0
- package/dist/routes/actions.d.ts.map +1 -0
- package/dist/routes/agent-api-gateway.d.ts +4 -0
- package/dist/routes/agent-api-gateway.d.ts.map +1 -0
- package/dist/routes/agents.d.ts +1061 -0
- package/dist/routes/agents.d.ts.map +1 -0
- package/dist/routes/auth.d.ts +1366 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/connectors.d.ts +108 -0
- package/dist/routes/connectors.d.ts.map +1 -0
- package/dist/routes/datasets.d.ts +339 -0
- package/dist/routes/datasets.d.ts.map +1 -0
- package/dist/routes/events.d.ts +116 -0
- package/dist/routes/events.d.ts.map +1 -0
- package/dist/routes/files.d.ts +340 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/links.d.ts +175 -0
- package/dist/routes/links.d.ts.map +1 -0
- package/dist/routes/logs.d.ts +88 -0
- package/dist/routes/logs.d.ts.map +1 -0
- package/dist/routes/objects.d.ts +450 -0
- package/dist/routes/objects.d.ts.map +1 -0
- package/dist/routes/ontology.d.ts +240 -0
- package/dist/routes/ontology.d.ts.map +1 -0
- package/dist/routes/pipelines.d.ts +399 -0
- package/dist/routes/pipelines.d.ts.map +1 -0
- package/dist/routes/project.d.ts +56 -0
- package/dist/routes/project.d.ts.map +1 -0
- package/dist/routes/projections.d.ts +916 -0
- package/dist/routes/projections.d.ts.map +1 -0
- package/dist/routes/rules.d.ts +165 -0
- package/dist/routes/rules.d.ts.map +1 -0
- package/dist/routes/status.d.ts +81 -0
- package/dist/routes/status.d.ts.map +1 -0
- package/dist/routes/syncs.d.ts +294 -0
- package/dist/routes/syncs.d.ts.map +1 -0
- package/dist/routes/telemetry.d.ts +241 -0
- package/dist/routes/telemetry.d.ts.map +1 -0
- package/dist/routes/webhook-runs.d.ts +89 -0
- package/dist/routes/webhook-runs.d.ts.map +1 -0
- package/dist/routes/webhooks.d.ts +60 -0
- package/dist/routes/webhooks.d.ts.map +1 -0
- package/dist/routes/workflows.d.ts +973 -0
- package/dist/routes/workflows.d.ts.map +1 -0
- package/dist/routes/ws/agents.d.ts +99 -0
- package/dist/routes/ws/agents.d.ts.map +1 -0
- package/dist/routes/ws/events.d.ts +89 -0
- package/dist/routes/ws/events.d.ts.map +1 -0
- package/dist/routes/ws/index.d.ts +31 -0
- package/dist/routes/ws/index.d.ts.map +1 -0
- package/dist/routes/ws/log-subscription-hub.d.ts +47 -0
- package/dist/routes/ws/log-subscription-hub.d.ts.map +1 -0
- package/dist/routes/ws/logs.d.ts +110 -0
- package/dist/routes/ws/logs.d.ts.map +1 -0
- package/dist/schemas/actions.d.ts +644 -0
- package/dist/schemas/actions.d.ts.map +1 -0
- package/dist/schemas/agents.d.ts +3157 -0
- package/dist/schemas/agents.d.ts.map +1 -0
- package/dist/schemas/auth.d.ts +2023 -0
- package/dist/schemas/auth.d.ts.map +1 -0
- package/dist/schemas/common.d.ts +30 -0
- package/dist/schemas/common.d.ts.map +1 -0
- package/dist/schemas/connectors.d.ts +82 -0
- package/dist/schemas/connectors.d.ts.map +1 -0
- package/dist/schemas/datasets.d.ts +744 -0
- package/dist/schemas/datasets.d.ts.map +1 -0
- package/dist/schemas/event-payloads.d.ts +477 -0
- package/dist/schemas/event-payloads.d.ts.map +1 -0
- package/dist/schemas/events.d.ts +665 -0
- package/dist/schemas/events.d.ts.map +1 -0
- package/dist/schemas/files.d.ts +241 -0
- package/dist/schemas/files.d.ts.map +1 -0
- package/dist/schemas/links.d.ts +90 -0
- package/dist/schemas/links.d.ts.map +1 -0
- package/dist/schemas/logs.d.ts +231 -0
- package/dist/schemas/logs.d.ts.map +1 -0
- package/dist/schemas/objects.d.ts +288 -0
- package/dist/schemas/objects.d.ts.map +1 -0
- package/dist/schemas/ontology.d.ts +778 -0
- package/dist/schemas/ontology.d.ts.map +1 -0
- package/dist/schemas/pipelines.d.ts +1373 -0
- package/dist/schemas/pipelines.d.ts.map +1 -0
- package/dist/schemas/project.d.ts +9 -0
- package/dist/schemas/project.d.ts.map +1 -0
- package/dist/schemas/projections.d.ts +6992 -0
- package/dist/schemas/projections.d.ts.map +1 -0
- package/dist/schemas/rules.d.ts +204 -0
- package/dist/schemas/rules.d.ts.map +1 -0
- package/dist/schemas/status.d.ts +189 -0
- package/dist/schemas/status.d.ts.map +1 -0
- package/dist/schemas/syncs.d.ts +538 -0
- package/dist/schemas/syncs.d.ts.map +1 -0
- package/dist/schemas/telemetry.d.ts +265 -0
- package/dist/schemas/telemetry.d.ts.map +1 -0
- package/dist/schemas/webhook-runs.d.ts +169 -0
- package/dist/schemas/webhook-runs.d.ts.map +1 -0
- package/dist/schemas/workflows.d.ts +1720 -0
- package/dist/schemas/workflows.d.ts.map +1 -0
- package/dist/server.d.ts +64 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/tsconfig.json +5 -0
- package/dist/utils/http.d.ts +23 -0
- package/dist/utils/http.d.ts.map +1 -0
- package/dist/utils/request-body.d.ts +15 -0
- package/dist/utils/request-body.d.ts.map +1 -0
- package/dist/utils/ws.d.ts +10 -0
- package/dist/utils/ws.d.ts.map +1 -0
- package/package.json +68 -0
- package/src/auth/access-token-boundary.ts +68 -0
- package/src/auth/application-access.ts +16 -0
- package/src/auth/browser-origin.ts +367 -0
- package/src/auth/csrf.ts +1 -0
- package/src/auth/guard.ts +169 -0
- package/src/auth/public-routes.ts +87 -0
- package/src/auth/responses.ts +54 -0
- package/src/auth/return-to.ts +21 -0
- package/src/auth/scope.ts +64 -0
- package/src/auth/session-activity.ts +19 -0
- package/src/auth/session-cookies.ts +43 -0
- package/src/files/content.ts +419 -0
- package/src/index.ts +2 -0
- package/src/openapi/security.ts +37 -0
- package/src/openapi/tags.ts +151 -0
- package/src/registerRoutes.ts +49 -0
- package/src/routes/action-runs.ts +238 -0
- package/src/routes/actions.ts +126 -0
- package/src/routes/agent-api-gateway.ts +260 -0
- package/src/routes/agents.ts +943 -0
- package/src/routes/auth.ts +2233 -0
- package/src/routes/connectors.ts +69 -0
- package/src/routes/datasets.ts +402 -0
- package/src/routes/events.ts +55 -0
- package/src/routes/files.ts +675 -0
- package/src/routes/links.ts +143 -0
- package/src/routes/logs.ts +65 -0
- package/src/routes/objects.ts +838 -0
- package/src/routes/ontology.ts +138 -0
- package/src/routes/pipelines.ts +332 -0
- package/src/routes/project.ts +16 -0
- package/src/routes/projections.ts +251 -0
- package/src/routes/rules.ts +124 -0
- package/src/routes/status.ts +53 -0
- package/src/routes/syncs.ts +243 -0
- package/src/routes/telemetry.ts +207 -0
- package/src/routes/webhook-runs.ts +81 -0
- package/src/routes/webhooks.ts +508 -0
- package/src/routes/workflows.ts +1333 -0
- package/src/routes/ws/agents.ts +301 -0
- package/src/routes/ws/events.ts +278 -0
- package/src/routes/ws/index.ts +12 -0
- package/src/routes/ws/log-subscription-hub.ts +375 -0
- package/src/routes/ws/logs.ts +117 -0
- package/src/schemas/actions.ts +123 -0
- package/src/schemas/agents.ts +293 -0
- package/src/schemas/auth.ts +317 -0
- package/src/schemas/common.ts +60 -0
- package/src/schemas/connectors.ts +21 -0
- package/src/schemas/datasets.ts +107 -0
- package/src/schemas/event-payloads.ts +79 -0
- package/src/schemas/events.ts +117 -0
- package/src/schemas/files.ts +82 -0
- package/src/schemas/links.ts +38 -0
- package/src/schemas/logs.ts +76 -0
- package/src/schemas/objects.ts +759 -0
- package/src/schemas/ontology.ts +77 -0
- package/src/schemas/pipelines.ts +150 -0
- package/src/schemas/project.ts +5 -0
- package/src/schemas/projections.ts +144 -0
- package/src/schemas/rules.ts +98 -0
- package/src/schemas/status.ts +51 -0
- package/src/schemas/syncs.ts +83 -0
- package/src/schemas/telemetry.ts +59 -0
- package/src/schemas/webhook-runs.ts +40 -0
- package/src/schemas/workflows.ts +229 -0
- package/src/server.ts +383 -0
- package/src/utils/http.ts +108 -0
- package/src/utils/request-body.ts +62 -0
- package/src/utils/ws.ts +59 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { AGENT_REASONING_LEVELS, MAX_AGENT_CONTEXT_ENTRIES } from "@sixb/core"
|
|
2
|
+
import { AGENT_RUN_DIAGNOSTIC_CODES } from "@sixb/core/storage"
|
|
3
|
+
import { z } from "zod"
|
|
4
|
+
import { JsonValueSchema } from "./common"
|
|
5
|
+
import { FileRefSchema } from "./files"
|
|
6
|
+
|
|
7
|
+
export const AgentIdParamsSchema = z.object({
|
|
8
|
+
agentId: z.string().min(1),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const AgentThreadParamsSchema = z.object({
|
|
12
|
+
threadId: z.string().min(1),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const AgentRunParamsSchema = z.object({
|
|
16
|
+
runId: z.string().min(1),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const AgentMessageFileContentParamsSchema = AgentThreadParamsSchema.extend({
|
|
20
|
+
messageId: z.string().min(1),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const AgentPrincipalSchema = z.object({
|
|
24
|
+
type: z.enum(["user", "serviceAccount", "system"]),
|
|
25
|
+
id: z.string().min(1),
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
export const AgentObjectContextSchema = z.object({
|
|
29
|
+
kind: z.literal("object"),
|
|
30
|
+
ref: z.object({
|
|
31
|
+
objectTypeId: z.string().min(1),
|
|
32
|
+
primaryId: z.string().min(1),
|
|
33
|
+
}),
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
export const AgentAppStateContextSchema = z.object({
|
|
37
|
+
kind: z.literal("app-state"),
|
|
38
|
+
id: z.string().min(1),
|
|
39
|
+
label: z.string().min(1),
|
|
40
|
+
description: z.string().min(1),
|
|
41
|
+
value: JsonValueSchema,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
export const AgentContextInputSchema = z.discriminatedUnion("kind", [
|
|
45
|
+
AgentObjectContextSchema,
|
|
46
|
+
AgentAppStateContextSchema,
|
|
47
|
+
])
|
|
48
|
+
|
|
49
|
+
export const AgentContextOriginSchema = z.enum(["ambient", "explicit"])
|
|
50
|
+
|
|
51
|
+
export const AgentContextEntryInputSchema = z.object({
|
|
52
|
+
context: AgentContextInputSchema,
|
|
53
|
+
origin: AgentContextOriginSchema,
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
export const AgentContextPartSchema = AgentContextEntryInputSchema.extend({
|
|
57
|
+
type: z.literal("context"),
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
export const AgentLoopConfigSchema = z.object({
|
|
61
|
+
stopWhen: z
|
|
62
|
+
.object({
|
|
63
|
+
maxSteps: z.number().int().positive().optional(),
|
|
64
|
+
})
|
|
65
|
+
.optional(),
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
export const AgentReasoningLevelSchema = z.enum(AGENT_REASONING_LEVELS)
|
|
69
|
+
|
|
70
|
+
export const AgentCatalogItemSchema = z.object({
|
|
71
|
+
id: z.string(),
|
|
72
|
+
name: z.string(),
|
|
73
|
+
description: z.string().optional(),
|
|
74
|
+
modelId: z.string().optional(),
|
|
75
|
+
reasoning: AgentReasoningLevelSchema.optional(),
|
|
76
|
+
groupIds: z.array(z.string()),
|
|
77
|
+
loop: AgentLoopConfigSchema.optional(),
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
export const AgentThreadStatusSchema = z.enum(["active", "archived"])
|
|
81
|
+
|
|
82
|
+
export const AgentThreadListQuerySchema = z.object({
|
|
83
|
+
agentId: z.string().optional(),
|
|
84
|
+
status: AgentThreadStatusSchema.optional(),
|
|
85
|
+
limit: z.string().optional(),
|
|
86
|
+
offset: z.string().optional(),
|
|
87
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
export const CreateAgentThreadBodySchema = z.object({
|
|
91
|
+
agentId: z.string().min(1),
|
|
92
|
+
title: z.string().trim().min(1).optional(),
|
|
93
|
+
threadId: z.string().trim().min(1).optional(),
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
export const AgentThreadSchema = z.object({
|
|
97
|
+
id: z.string(),
|
|
98
|
+
projectId: z.string(),
|
|
99
|
+
agentId: z.string(),
|
|
100
|
+
ownerPrincipal: AgentPrincipalSchema,
|
|
101
|
+
title: z.string().optional(),
|
|
102
|
+
status: AgentThreadStatusSchema,
|
|
103
|
+
activeRunId: z.string().nullable(),
|
|
104
|
+
lastMessageAt: z.string().optional(),
|
|
105
|
+
messageCount: z.number(),
|
|
106
|
+
createdAt: z.string(),
|
|
107
|
+
updatedAt: z.string(),
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
export const AgentThreadListResponseSchema = z.object({
|
|
111
|
+
threads: z.array(AgentThreadSchema),
|
|
112
|
+
hasMore: z.boolean(),
|
|
113
|
+
total: z.number(),
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
export const CreateAgentThreadResponseSchema = z.object({
|
|
117
|
+
thread: AgentThreadSchema,
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
export const AgentMessageRoleSchema = z.enum(["system", "user", "assistant"])
|
|
121
|
+
|
|
122
|
+
const AgentTextPartSchema = z.object({
|
|
123
|
+
type: z.literal("text"),
|
|
124
|
+
text: z.string(),
|
|
125
|
+
providerMetadata: JsonValueSchema.optional(),
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
const AgentReasoningPartSchema = z.object({
|
|
129
|
+
type: z.literal("reasoning"),
|
|
130
|
+
text: z.string(),
|
|
131
|
+
providerMetadata: JsonValueSchema.optional(),
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
const AgentStepStartPartSchema = z.object({
|
|
135
|
+
type: z.literal("step-start"),
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const AgentFilePartSchema = z.object({
|
|
139
|
+
type: z.literal("file"),
|
|
140
|
+
fileRef: FileRefSchema,
|
|
141
|
+
providerMetadata: JsonValueSchema.optional(),
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
const AgentToolCallBaseSchema = z.object({
|
|
145
|
+
type: z.literal("tool-call"),
|
|
146
|
+
toolCallId: z.string(),
|
|
147
|
+
toolName: z.string(),
|
|
148
|
+
dynamic: z.boolean().optional(),
|
|
149
|
+
providerExecuted: z.boolean().optional(),
|
|
150
|
+
input: JsonValueSchema,
|
|
151
|
+
providerMetadata: JsonValueSchema.optional(),
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
const AgentToolCallOutputSchema = AgentToolCallBaseSchema.extend({
|
|
155
|
+
state: z.literal("output-available"),
|
|
156
|
+
output: JsonValueSchema,
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
const AgentToolCallErrorSchema = AgentToolCallBaseSchema.extend({
|
|
160
|
+
state: z.literal("output-error"),
|
|
161
|
+
errorText: z.string(),
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
export const AgentMessagePartSchema = z.union([
|
|
165
|
+
AgentTextPartSchema,
|
|
166
|
+
AgentReasoningPartSchema,
|
|
167
|
+
AgentStepStartPartSchema,
|
|
168
|
+
AgentFilePartSchema,
|
|
169
|
+
AgentContextPartSchema,
|
|
170
|
+
AgentToolCallOutputSchema,
|
|
171
|
+
AgentToolCallErrorSchema,
|
|
172
|
+
])
|
|
173
|
+
|
|
174
|
+
export const AgentRunDiagnosticSchema = z.object({
|
|
175
|
+
code: z.enum(AGENT_RUN_DIAGNOSTIC_CODES),
|
|
176
|
+
severity: z.enum(["warning", "error"]),
|
|
177
|
+
scope: z.literal("output"),
|
|
178
|
+
path: z.string().optional(),
|
|
179
|
+
message: z.string(),
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
export const AgentMessageSchema = z.object({
|
|
183
|
+
id: z.string(),
|
|
184
|
+
projectId: z.string(),
|
|
185
|
+
threadId: z.string(),
|
|
186
|
+
runId: z.string().nullable(),
|
|
187
|
+
role: AgentMessageRoleSchema,
|
|
188
|
+
authorPrincipal: AgentPrincipalSchema.optional(),
|
|
189
|
+
seq: z.number(),
|
|
190
|
+
parts: z.array(AgentMessagePartSchema),
|
|
191
|
+
/** Platform-authored annotations associated with this message's run. */
|
|
192
|
+
annotations: z.array(AgentRunDiagnosticSchema),
|
|
193
|
+
metadata: JsonValueSchema.optional(),
|
|
194
|
+
contentVersion: z.number(),
|
|
195
|
+
createdAt: z.string(),
|
|
196
|
+
completedAt: z.string().optional(),
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
export const AgentMessagesQuerySchema = z.object({
|
|
200
|
+
role: AgentMessageRoleSchema.optional(),
|
|
201
|
+
limit: z.string().optional(),
|
|
202
|
+
offset: z.string().optional(),
|
|
203
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
export const AgentMessageListResponseSchema = z.object({
|
|
207
|
+
messages: z.array(AgentMessageSchema),
|
|
208
|
+
hasMore: z.boolean(),
|
|
209
|
+
total: z.number(),
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
export const PostAgentMessageBodySchema = z.object({
|
|
213
|
+
text: z.string().trim().min(1),
|
|
214
|
+
attachments: z.array(FileRefSchema).optional(),
|
|
215
|
+
context: z.array(AgentContextEntryInputSchema).max(MAX_AGENT_CONTEXT_ENTRIES).optional(),
|
|
216
|
+
messageId: z.string().trim().min(1).optional(),
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
export const CancelAgentRunBodySchema = z.object({
|
|
220
|
+
runId: z.string().trim().min(1),
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
export const AgentRunStatusSchema = z.enum([
|
|
224
|
+
"queued",
|
|
225
|
+
"running",
|
|
226
|
+
"succeeded",
|
|
227
|
+
"failed",
|
|
228
|
+
"cancelled",
|
|
229
|
+
])
|
|
230
|
+
|
|
231
|
+
export const AgentRunFinishReasonSchema = z.enum([
|
|
232
|
+
"stop",
|
|
233
|
+
"length",
|
|
234
|
+
"content-filter",
|
|
235
|
+
"tool-calls",
|
|
236
|
+
"error",
|
|
237
|
+
"other",
|
|
238
|
+
"unknown",
|
|
239
|
+
])
|
|
240
|
+
|
|
241
|
+
export const AgentRunUsageSchema = z.object({
|
|
242
|
+
inputTokens: z.number().optional(),
|
|
243
|
+
outputTokens: z.number().optional(),
|
|
244
|
+
totalTokens: z.number().optional(),
|
|
245
|
+
reasoningTokens: z.number().optional(),
|
|
246
|
+
cachedInputTokens: z.number().optional(),
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
export const AgentRunSchema = z.object({
|
|
250
|
+
id: z.string(),
|
|
251
|
+
projectId: z.string(),
|
|
252
|
+
threadId: z.string(),
|
|
253
|
+
agentId: z.string(),
|
|
254
|
+
triggerMessageId: z.string(),
|
|
255
|
+
requestedByPrincipal: AgentPrincipalSchema,
|
|
256
|
+
executionPrincipal: AgentPrincipalSchema.optional(),
|
|
257
|
+
status: AgentRunStatusSchema,
|
|
258
|
+
modelId: z.string().optional(),
|
|
259
|
+
finishReason: AgentRunFinishReasonSchema.optional(),
|
|
260
|
+
usage: AgentRunUsageSchema.optional(),
|
|
261
|
+
diagnostics: z.array(AgentRunDiagnosticSchema).optional(),
|
|
262
|
+
error: z.string().optional(),
|
|
263
|
+
attempt: z.number(),
|
|
264
|
+
streamId: z.string(),
|
|
265
|
+
createdAt: z.string(),
|
|
266
|
+
startedAt: z.string().optional(),
|
|
267
|
+
completedAt: z.string().optional(),
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
export const PostAgentMessageResponseSchema = z.object({
|
|
271
|
+
run: AgentRunSchema,
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
export const CancelAgentRunResponseSchema = z.object({
|
|
275
|
+
run: AgentRunSchema,
|
|
276
|
+
})
|
|
277
|
+
|
|
278
|
+
export const RetryAgentRunResponseSchema = z.object({
|
|
279
|
+
run: AgentRunSchema,
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
export const AgentRunListQuerySchema = z.object({
|
|
283
|
+
status: AgentRunStatusSchema.optional(),
|
|
284
|
+
limit: z.string().optional(),
|
|
285
|
+
offset: z.string().optional(),
|
|
286
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
export const AgentRunListResponseSchema = z.object({
|
|
290
|
+
runs: z.array(AgentRunSchema),
|
|
291
|
+
hasMore: z.boolean(),
|
|
292
|
+
total: z.number(),
|
|
293
|
+
})
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const AuthInvitationStatusSchema = z.enum(["pending", "accepted", "revoked"])
|
|
4
|
+
|
|
5
|
+
export const AuthGroupOptionSchema = z.object({
|
|
6
|
+
id: z.string(),
|
|
7
|
+
label: z.string().optional(),
|
|
8
|
+
description: z.string().optional(),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const AuthInvitationSchema = z.object({
|
|
12
|
+
id: z.string(),
|
|
13
|
+
email: z.string(),
|
|
14
|
+
groupIds: z.array(z.string()),
|
|
15
|
+
status: AuthInvitationStatusSchema,
|
|
16
|
+
createdAt: z.string(),
|
|
17
|
+
updatedAt: z.string(),
|
|
18
|
+
expiresAt: z.string(),
|
|
19
|
+
acceptedAt: z.string().optional(),
|
|
20
|
+
revokedAt: z.string().optional(),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const AuthInvitationDeliverySchema = z.object({
|
|
24
|
+
status: z.enum(["sent", "skipped", "rate_limited", "not_supported"]),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export const AuthInvitationGroupOptionSchema = AuthGroupOptionSchema
|
|
28
|
+
|
|
29
|
+
export const AuthAccessTokenKindSchema = z.enum(["personal", "serviceAccount"])
|
|
30
|
+
export const AuthAccessTokenSubjectTypeSchema = z.enum(["user", "serviceAccount"])
|
|
31
|
+
export const AuthAccessTokenStatusSchema = z.enum(["active", "expired", "revoked"])
|
|
32
|
+
export const AuthServiceAccountStatusSchema = z.enum(["active", "suspended"])
|
|
33
|
+
export const AuthUserStatusSchema = z.enum(["active", "suspended"])
|
|
34
|
+
|
|
35
|
+
export const AuthAccessTokenSchema = z.object({
|
|
36
|
+
id: z.string(),
|
|
37
|
+
name: z.string(),
|
|
38
|
+
kind: AuthAccessTokenKindSchema,
|
|
39
|
+
status: AuthAccessTokenStatusSchema,
|
|
40
|
+
subjectType: AuthAccessTokenSubjectTypeSchema,
|
|
41
|
+
subjectId: z.string(),
|
|
42
|
+
subjectLabel: z.string().optional(),
|
|
43
|
+
groupIds: z.array(z.string()).optional(),
|
|
44
|
+
createdAt: z.string(),
|
|
45
|
+
expiresAt: z.string(),
|
|
46
|
+
revokedAt: z.string().optional(),
|
|
47
|
+
lastUsedAt: z.string().optional(),
|
|
48
|
+
lastUsedUserAgent: z.string().optional(),
|
|
49
|
+
lastUsedIpAddress: z.string().optional(),
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
export const AuthServiceAccountSchema = z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
name: z.string(),
|
|
55
|
+
description: z.string().optional(),
|
|
56
|
+
status: AuthServiceAccountStatusSchema,
|
|
57
|
+
groupIds: z.array(z.string()),
|
|
58
|
+
createdAt: z.string(),
|
|
59
|
+
updatedAt: z.string(),
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
export const AuthMemberUserSchema = z.object({
|
|
63
|
+
id: z.string(),
|
|
64
|
+
email: z.string(),
|
|
65
|
+
displayName: z.string().optional(),
|
|
66
|
+
avatarUrl: z.string().optional(),
|
|
67
|
+
status: AuthUserStatusSchema,
|
|
68
|
+
createdAt: z.string(),
|
|
69
|
+
updatedAt: z.string(),
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
export const AuthManagedMemberSchema = z.object({
|
|
73
|
+
user: AuthMemberUserSchema,
|
|
74
|
+
groupIds: z.array(z.string()),
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
export const AuthMemberCapabilitiesSchema = z.object({
|
|
78
|
+
assignGroups: z.boolean(),
|
|
79
|
+
suspend: z.boolean(),
|
|
80
|
+
reactivate: z.boolean(),
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
export const AuthMemberSchema = AuthManagedMemberSchema.extend({
|
|
84
|
+
capabilities: AuthMemberCapabilitiesSchema,
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
export const GetAuthAccessManagementOptionsResponseSchema = z.object({
|
|
88
|
+
groups: z.array(AuthGroupOptionSchema),
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
export const ListAuthAccessTokensResponseSchema = z.object({
|
|
92
|
+
accessTokens: z.array(AuthAccessTokenSchema),
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
export const CreateAuthPersonalAccessTokenBodySchema = z.object({
|
|
96
|
+
name: z.string().trim().min(1),
|
|
97
|
+
expiresAt: z.string().min(1),
|
|
98
|
+
groupIds: z.array(z.string().min(1)).optional(),
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
export const CreateAuthPersonalAccessTokenResponseSchema = z.object({
|
|
102
|
+
accessToken: AuthAccessTokenSchema,
|
|
103
|
+
tokenValue: z.string(),
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
export const RevokeAuthAccessTokenParamsSchema = z.object({
|
|
107
|
+
tokenId: z.string().min(1),
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
export const RevokeAuthAccessTokenResponseSchema = z.object({
|
|
111
|
+
accessToken: AuthAccessTokenSchema,
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
export const ListAuthServiceAccountsResponseSchema = z.object({
|
|
115
|
+
serviceAccounts: z.array(AuthServiceAccountSchema),
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
export const CreateAuthServiceAccountBodySchema = z.object({
|
|
119
|
+
id: z.string().trim().min(1).optional(),
|
|
120
|
+
name: z.string().trim().min(1),
|
|
121
|
+
description: z.string().trim().optional(),
|
|
122
|
+
groupIds: z.array(z.string().min(1)).optional(),
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
export const CreateAuthServiceAccountResponseSchema = z.object({
|
|
126
|
+
serviceAccount: AuthServiceAccountSchema,
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
export const AuthServiceAccountParamsSchema = z.object({
|
|
130
|
+
serviceAccountId: z.string().min(1),
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
export const DisableAuthServiceAccountResponseSchema = z.object({
|
|
134
|
+
serviceAccount: AuthServiceAccountSchema,
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
export const ListAuthServiceAccountAccessTokensResponseSchema = z.object({
|
|
138
|
+
accessTokens: z.array(AuthAccessTokenSchema),
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
export const CreateAuthServiceAccountAccessTokenBodySchema = z.object({
|
|
142
|
+
name: z.string().trim().min(1),
|
|
143
|
+
expiresAt: z.string().min(1),
|
|
144
|
+
groupIds: z.array(z.string().min(1)).optional(),
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
export const CreateAuthServiceAccountAccessTokenResponseSchema = z.object({
|
|
148
|
+
accessToken: AuthAccessTokenSchema,
|
|
149
|
+
tokenValue: z.string(),
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
export const RevokeAuthServiceAccountAccessTokenParamsSchema =
|
|
153
|
+
AuthServiceAccountParamsSchema.extend({
|
|
154
|
+
tokenId: z.string().min(1),
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
export const RevokeAuthServiceAccountAccessTokenResponseSchema = z.object({
|
|
158
|
+
accessToken: AuthAccessTokenSchema,
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
export const AuthCreateInvitationCapabilitySchema = z.union([
|
|
162
|
+
z.object({
|
|
163
|
+
state: z.literal("enabled"),
|
|
164
|
+
}),
|
|
165
|
+
z.object({
|
|
166
|
+
state: z.literal("disabled"),
|
|
167
|
+
reason: z.enum(["missing_membership_policy", "invitation_delivery_not_supported"]),
|
|
168
|
+
}),
|
|
169
|
+
])
|
|
170
|
+
|
|
171
|
+
export const AuthInvitationDestinationSchema = z.object({
|
|
172
|
+
id: z.enum(["atlas", "app"]),
|
|
173
|
+
label: z.string(),
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
export const GetAuthInvitationOptionsResponseSchema = z.object({
|
|
177
|
+
groups: z.array(AuthInvitationGroupOptionSchema),
|
|
178
|
+
destinations: z.array(AuthInvitationDestinationSchema),
|
|
179
|
+
defaultDestinationId: z.enum(["atlas", "app"]).optional(),
|
|
180
|
+
canInviteWithoutGroups: z.boolean(),
|
|
181
|
+
capabilities: z.object({
|
|
182
|
+
createInvitation: AuthCreateInvitationCapabilitySchema,
|
|
183
|
+
}),
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
export const GetAuthMembershipOptionsResponseSchema = z.object({
|
|
187
|
+
groups: z.array(AuthGroupOptionSchema),
|
|
188
|
+
capabilities: z.object({
|
|
189
|
+
invite: z.boolean(),
|
|
190
|
+
assignGroups: z.boolean(),
|
|
191
|
+
suspend: z.boolean(),
|
|
192
|
+
}),
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
export const ListAuthMembersQuerySchema = z.object({
|
|
196
|
+
limit: z.string().optional(),
|
|
197
|
+
offset: z.string().optional(),
|
|
198
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
export const ListAuthMembersResponseSchema = z.object({
|
|
202
|
+
members: z.array(AuthMemberSchema),
|
|
203
|
+
hasMore: z.boolean(),
|
|
204
|
+
total: z.number(),
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
export const AuthMemberParamsSchema = z.object({
|
|
208
|
+
userId: z.string().min(1),
|
|
209
|
+
})
|
|
210
|
+
|
|
211
|
+
export const UpdateAuthMemberGroupsBodySchema = z.object({
|
|
212
|
+
groupIds: z.array(z.string().min(1)),
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
export const UpdateAuthMemberGroupsResponseSchema = z.object({
|
|
216
|
+
member: AuthManagedMemberSchema,
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
export const SuspendAuthMemberResponseSchema = z.object({
|
|
220
|
+
member: AuthManagedMemberSchema,
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
export const ReactivateAuthMemberResponseSchema = z.object({
|
|
224
|
+
member: AuthManagedMemberSchema,
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
export const CreateAuthInvitationBodySchema = z.object({
|
|
228
|
+
email: z.string().min(1),
|
|
229
|
+
groupIds: z.array(z.string().min(1)).optional(),
|
|
230
|
+
destinationId: z.enum(["atlas", "app"]).optional(),
|
|
231
|
+
expiresAt: z.string().optional(),
|
|
232
|
+
returnTo: z.string().optional(),
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
export const CreateAuthInvitationResponseSchema = z.object({
|
|
236
|
+
invitation: AuthInvitationSchema,
|
|
237
|
+
delivery: AuthInvitationDeliverySchema,
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
export const ListAuthInvitationsQuerySchema = z.object({
|
|
241
|
+
email: z.string().optional(),
|
|
242
|
+
status: AuthInvitationStatusSchema.optional(),
|
|
243
|
+
limit: z.string().optional(),
|
|
244
|
+
offset: z.string().optional(),
|
|
245
|
+
order: z.enum(["asc", "desc"]).optional(),
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
export const ListAuthInvitationsResponseSchema = z.object({
|
|
249
|
+
invitations: z.array(AuthInvitationSchema),
|
|
250
|
+
hasMore: z.boolean(),
|
|
251
|
+
total: z.number(),
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
export const RevokeAuthInvitationParamsSchema = z.object({
|
|
255
|
+
invitationId: z.string().min(1),
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
export const RevokeAuthInvitationResponseSchema = z.object({
|
|
259
|
+
invitation: AuthInvitationSchema,
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
export const AuthSessionResponseSchema = z.union([
|
|
263
|
+
z.object({
|
|
264
|
+
authenticated: z.literal(false),
|
|
265
|
+
}),
|
|
266
|
+
z.object({
|
|
267
|
+
authenticated: z.literal(true),
|
|
268
|
+
csrfToken: z.string(),
|
|
269
|
+
applicationAccess: z.object({
|
|
270
|
+
allowed: z.boolean(),
|
|
271
|
+
audience: z.enum(["atlas", "app"]),
|
|
272
|
+
}),
|
|
273
|
+
user: z.object({
|
|
274
|
+
id: z.string(),
|
|
275
|
+
email: z.string(),
|
|
276
|
+
displayName: z.string().optional(),
|
|
277
|
+
avatarUrl: z.string().optional(),
|
|
278
|
+
groupIds: z.array(z.string()),
|
|
279
|
+
}),
|
|
280
|
+
session: z.object({
|
|
281
|
+
id: z.string(),
|
|
282
|
+
expiresAt: z.string(),
|
|
283
|
+
}),
|
|
284
|
+
}),
|
|
285
|
+
])
|
|
286
|
+
|
|
287
|
+
export const AuthSignOutResponseSchema = z.object({
|
|
288
|
+
success: z.boolean(),
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
export const AuthSessionSummarySchema = z.object({
|
|
292
|
+
id: z.string(),
|
|
293
|
+
audience: z.enum(["atlas", "app"]),
|
|
294
|
+
current: z.boolean(),
|
|
295
|
+
createdAt: z.string(),
|
|
296
|
+
expiresAt: z.string(),
|
|
297
|
+
lastSeenAt: z.string().optional(),
|
|
298
|
+
userAgent: z.string().optional(),
|
|
299
|
+
ipAddress: z.string().optional(),
|
|
300
|
+
})
|
|
301
|
+
|
|
302
|
+
export const ListAuthSessionsResponseSchema = z.object({
|
|
303
|
+
sessions: z.array(AuthSessionSummarySchema),
|
|
304
|
+
})
|
|
305
|
+
|
|
306
|
+
export const RevokeAuthSessionParamsSchema = z.object({
|
|
307
|
+
sessionId: z.string().min(1),
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
export const RevokeAuthSessionResponseSchema = z.object({
|
|
311
|
+
success: z.boolean(),
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
export const SignOutAllResponseSchema = z.object({
|
|
315
|
+
success: z.boolean(),
|
|
316
|
+
revokedCount: z.number(),
|
|
317
|
+
})
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
import { ignoreOverride, type JsonSchema7Type, type OverrideCallback } from "zod-to-json-schema"
|
|
3
|
+
|
|
4
|
+
export const ErrorResponseSchema = z.object({ error: z.string() })
|
|
5
|
+
|
|
6
|
+
export const SuccessResponseSchema = z.object({ success: z.boolean() })
|
|
7
|
+
|
|
8
|
+
export type JsonValue =
|
|
9
|
+
| string
|
|
10
|
+
| number
|
|
11
|
+
| boolean
|
|
12
|
+
| null
|
|
13
|
+
| JsonValue[]
|
|
14
|
+
| { [key: string]: JsonValue }
|
|
15
|
+
|
|
16
|
+
export const JsonValueSchema: z.ZodType<JsonValue> = z.lazy(() =>
|
|
17
|
+
z.union([
|
|
18
|
+
z.string(),
|
|
19
|
+
z.number().finite(),
|
|
20
|
+
z.boolean(),
|
|
21
|
+
z.null(),
|
|
22
|
+
z.array(JsonValueSchema),
|
|
23
|
+
z.record(JsonValueSchema),
|
|
24
|
+
])
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
/** A JSON null with an explicit runtime and generated-client type. */
|
|
28
|
+
export const JsonNullSchema = JsonValueSchema.refine((value): value is null => value === null)
|
|
29
|
+
|
|
30
|
+
const JsonValueOpenApiSchema = {
|
|
31
|
+
description: "Any JSON-compatible value.",
|
|
32
|
+
nullable: true,
|
|
33
|
+
anyOf: [
|
|
34
|
+
{ type: "string" },
|
|
35
|
+
{ type: "number" },
|
|
36
|
+
{ type: "boolean" },
|
|
37
|
+
{ type: "array", items: {} },
|
|
38
|
+
{ type: "object", additionalProperties: true },
|
|
39
|
+
],
|
|
40
|
+
} as JsonSchema7Type
|
|
41
|
+
|
|
42
|
+
const jsonValueSchemaDef = JsonValueSchema._def
|
|
43
|
+
const jsonNullSchemaDef = JsonNullSchema._def
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Runtime validation needs the recursive JSON-value Zod schema above. OpenAPI
|
|
47
|
+
* does not need to expand that recursion at every metadata/input leaf; these
|
|
48
|
+
* fields are intentionally arbitrary JSON values. Emit that contract directly
|
|
49
|
+
* so zod-to-json-schema does not hit its "$refStrategy: none" recursion path.
|
|
50
|
+
*/
|
|
51
|
+
export const jsonValueOpenApiOverride: OverrideCallback = (def) => {
|
|
52
|
+
if (def === jsonValueSchemaDef) {
|
|
53
|
+
return JsonValueOpenApiSchema
|
|
54
|
+
}
|
|
55
|
+
if (def === jsonNullSchemaDef) {
|
|
56
|
+
return { nullable: true, enum: [null] } as JsonSchema7Type
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return ignoreOverride
|
|
60
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod"
|
|
2
|
+
|
|
3
|
+
export const ConnectorParamsSchema = z.object({
|
|
4
|
+
connectorId: z.string().min(1),
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const ConnectorWebhookSchema = z.object({
|
|
8
|
+
id: z.string(),
|
|
9
|
+
method: z.literal("POST"),
|
|
10
|
+
route: z.string(),
|
|
11
|
+
bodyFormat: z.enum(["json", "text", "raw"]),
|
|
12
|
+
hasVerify: z.boolean(),
|
|
13
|
+
hasIdempotency: z.boolean(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const ConnectorSchema = z.object({
|
|
17
|
+
id: z.string(),
|
|
18
|
+
type: z.string(),
|
|
19
|
+
syncIds: z.array(z.string()),
|
|
20
|
+
webhooks: z.array(ConnectorWebhookSchema),
|
|
21
|
+
})
|