@sixb/server 0.1.23 → 0.1.25
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.js +399 -42
- package/dist/index.js.map +8 -8
- package/dist/openapi/components.d.ts +15 -1
- package/dist/openapi/components.d.ts.map +1 -1
- package/dist/routes/auth.d.ts.map +1 -1
- package/dist/routes/model-generations.d.ts +4 -14
- package/dist/routes/model-generations.d.ts.map +1 -1
- package/dist/routes/models.d.ts +3 -0
- package/dist/routes/models.d.ts.map +1 -1
- package/dist/schemas/models.d.ts +43 -3
- package/dist/schemas/models.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/openapi/components.ts +20 -0
- package/src/routes/auth.ts +391 -37
- package/src/routes/model-generations.ts +55 -6
- package/src/routes/models.ts +3 -1
- package/src/schemas/models.ts +19 -2
- package/src/server.ts +3 -9
package/src/schemas/models.ts
CHANGED
|
@@ -138,6 +138,10 @@ export const ModelCatalogSchema = z.object({
|
|
|
138
138
|
speech: z.array(SpeechModelSchema),
|
|
139
139
|
transcription: z.array(TranscriptionModelSchema),
|
|
140
140
|
}),
|
|
141
|
+
capabilities: z.object({
|
|
142
|
+
/** The requester may call these models, through the generation routes or the agent's chat. */
|
|
143
|
+
run: z.boolean(),
|
|
144
|
+
}),
|
|
141
145
|
})
|
|
142
146
|
|
|
143
147
|
export const ModelReasoningLevelSchema = z.enum(MODEL_REASONING_LEVELS)
|
|
@@ -231,9 +235,22 @@ export const FileGenerationSchema = GenerationResultBase.extend({
|
|
|
231
235
|
warnings: z.array(z.string()),
|
|
232
236
|
})
|
|
233
237
|
|
|
238
|
+
// One character class and no group: zod's base64() backtracks, and refused minutes of audio.
|
|
239
|
+
const BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/
|
|
240
|
+
|
|
241
|
+
/** Audio sent with the request, base64-encoded: it reaches the model without being stored. */
|
|
242
|
+
export const InlineAudioSchema = z.object({
|
|
243
|
+
data: z
|
|
244
|
+
.string()
|
|
245
|
+
.min(1)
|
|
246
|
+
.regex(BASE64_PATTERN, "Invalid base64")
|
|
247
|
+
.refine((data) => data.length % 4 === 0, "Invalid base64"),
|
|
248
|
+
mediaType: z.string().min(1),
|
|
249
|
+
})
|
|
250
|
+
|
|
234
251
|
export const TranscriptionBodySchema = GenerationBodyBase.extend({
|
|
235
|
-
/** Audio uploaded through /api/files. */
|
|
236
|
-
audio: FileRefSchema,
|
|
252
|
+
/** Audio uploaded through /api/files, or sent inline, such as a dictation. */
|
|
253
|
+
audio: z.union([FileRefSchema, InlineAudioSchema]),
|
|
237
254
|
})
|
|
238
255
|
|
|
239
256
|
export const TranscriptionSchema = GenerationResultBase.extend({
|
package/src/server.ts
CHANGED
|
@@ -10,7 +10,6 @@ import { checkPipelineMarkings, warmAppliedMarkings } from "@sixb/core/internal/
|
|
|
10
10
|
import type { Server } from "bun"
|
|
11
11
|
import { Elysia, ParseError } from "elysia"
|
|
12
12
|
import { websocket as elysiaWebSocket } from "elysia/ws"
|
|
13
|
-
import { zodToJsonSchema } from "zod-to-json-schema"
|
|
14
13
|
import {
|
|
15
14
|
type AuthInvitationRedirectContext,
|
|
16
15
|
type AuthInvitationRedirectInput,
|
|
@@ -42,7 +41,7 @@ import {
|
|
|
42
41
|
SharedAccessBoundary,
|
|
43
42
|
type SixbSharedAccessOptions,
|
|
44
43
|
} from "./auth/shared-access"
|
|
45
|
-
import { NamedOpenApiSchemas,
|
|
44
|
+
import { NamedOpenApiSchemas, openApiJsonSchema } from "./openapi/components"
|
|
46
45
|
import {
|
|
47
46
|
SIXB_ACCESS_TOKEN_SECURITY_SCHEME,
|
|
48
47
|
SIXB_ACCESS_TOKEN_SECURITY_SCHEME_ID,
|
|
@@ -406,7 +405,7 @@ export function createSixbApi(server: SixbServer) {
|
|
|
406
405
|
openapi({
|
|
407
406
|
path: "/docs",
|
|
408
407
|
provider: "swagger-ui",
|
|
409
|
-
//
|
|
408
|
+
// openApiJsonSchema below emits OpenAPI 3.0 nullable schemas.
|
|
410
409
|
openapiVersion: "3.0.3",
|
|
411
410
|
documentation: {
|
|
412
411
|
info: {
|
|
@@ -431,12 +430,7 @@ export function createSixbApi(server: SixbServer) {
|
|
|
431
430
|
withCredentials: true,
|
|
432
431
|
},
|
|
433
432
|
mapJsonSchema: {
|
|
434
|
-
zod:
|
|
435
|
-
zodToJsonSchema(schema, {
|
|
436
|
-
$refStrategy: "none",
|
|
437
|
-
target: "openApi3",
|
|
438
|
-
override: openApiOverride(),
|
|
439
|
-
}),
|
|
433
|
+
zod: openApiJsonSchema,
|
|
440
434
|
},
|
|
441
435
|
})
|
|
442
436
|
)
|