@sixb/server 0.1.17 → 0.1.18

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.
Files changed (69) hide show
  1. package/dist/auth/experience.d.ts +5 -1
  2. package/dist/auth/experience.d.ts.map +1 -1
  3. package/dist/files/content.d.ts +0 -1
  4. package/dist/files/content.d.ts.map +1 -1
  5. package/dist/index.js +204 -136
  6. package/dist/index.js.map +24 -24
  7. package/dist/routes/agents.d.ts +48 -28
  8. package/dist/routes/agents.d.ts.map +1 -1
  9. package/dist/routes/auth.d.ts +3 -2
  10. package/dist/routes/auth.d.ts.map +1 -1
  11. package/dist/routes/datasets.d.ts +4 -1
  12. package/dist/routes/datasets.d.ts.map +1 -1
  13. package/dist/routes/files.d.ts.map +1 -1
  14. package/dist/routes/models.d.ts +1 -0
  15. package/dist/routes/models.d.ts.map +1 -1
  16. package/dist/routes/objects.d.ts +21 -4
  17. package/dist/routes/objects.d.ts.map +1 -1
  18. package/dist/routes/project.d.ts +2 -0
  19. package/dist/routes/project.d.ts.map +1 -1
  20. package/dist/routes/workflows.d.ts +3 -0
  21. package/dist/routes/workflows.d.ts.map +1 -1
  22. package/dist/routes/ws/events.d.ts.map +1 -1
  23. package/dist/routes/ws/subscription-hub.d.ts +5 -0
  24. package/dist/routes/ws/subscription-hub.d.ts.map +1 -1
  25. package/dist/schemas/agents.d.ts +222 -123
  26. package/dist/schemas/agents.d.ts.map +1 -1
  27. package/dist/schemas/ai-accounting.d.ts +10 -10
  28. package/dist/schemas/auth.d.ts +7 -0
  29. package/dist/schemas/auth.d.ts.map +1 -1
  30. package/dist/schemas/common.d.ts +8 -0
  31. package/dist/schemas/common.d.ts.map +1 -1
  32. package/dist/schemas/datasets.d.ts +18 -3
  33. package/dist/schemas/datasets.d.ts.map +1 -1
  34. package/dist/schemas/event-payloads.d.ts +39 -0
  35. package/dist/schemas/event-payloads.d.ts.map +1 -1
  36. package/dist/schemas/files.d.ts +1 -1
  37. package/dist/schemas/files.d.ts.map +1 -1
  38. package/dist/schemas/models.d.ts +10 -0
  39. package/dist/schemas/models.d.ts.map +1 -1
  40. package/dist/schemas/objects.d.ts +32 -0
  41. package/dist/schemas/objects.d.ts.map +1 -1
  42. package/dist/schemas/project.d.ts +8 -0
  43. package/dist/schemas/project.d.ts.map +1 -1
  44. package/dist/schemas/workflows.d.ts +17 -0
  45. package/dist/schemas/workflows.d.ts.map +1 -1
  46. package/dist/server.d.ts.map +1 -1
  47. package/package.json +6 -5
  48. package/src/auth/experience.ts +20 -2
  49. package/src/files/content.ts +43 -88
  50. package/src/routes/agents.ts +29 -9
  51. package/src/routes/auth.ts +84 -19
  52. package/src/routes/datasets.ts +12 -43
  53. package/src/routes/files.ts +3 -1
  54. package/src/routes/models.ts +3 -0
  55. package/src/routes/objects.ts +12 -2
  56. package/src/routes/project.ts +2 -1
  57. package/src/routes/workflows.ts +5 -0
  58. package/src/routes/ws/events.ts +5 -3
  59. package/src/routes/ws/subscription-hub.ts +20 -5
  60. package/src/schemas/agents.ts +28 -3
  61. package/src/schemas/auth.ts +5 -0
  62. package/src/schemas/common.ts +3 -0
  63. package/src/schemas/datasets.ts +23 -1
  64. package/src/schemas/event-payloads.ts +3 -1
  65. package/src/schemas/files.ts +7 -1
  66. package/src/schemas/models.ts +2 -0
  67. package/src/schemas/objects.ts +13 -0
  68. package/src/schemas/project.ts +4 -0
  69. package/src/server.ts +2 -1
@@ -1,3 +1,4 @@
1
+ import { canonicalMediaType } from "@sixb/core/internal/blob-storage"
1
2
  import { z } from "zod"
2
3
 
3
4
  export const BlobDigestSchema = z.string().regex(/^sha256:[a-f0-9]{64}$/)
@@ -13,7 +14,12 @@ export const FileRefSchema = z.object({
13
14
 
14
15
  export const CreateFileUploadBodySchema = z.object({
15
16
  fileName: z.string().optional(),
16
- mediaType: z.string().optional(),
17
+ mediaType: z
18
+ .string()
19
+ .refine((value) => canonicalMediaType(value) !== null, {
20
+ message: 'Expected a single media type, such as "application/pdf"',
21
+ })
22
+ .optional(),
17
23
  sizeBytes: z.number().int().nonnegative().optional(),
18
24
  digest: BlobDigestSchema.optional(),
19
25
  logicalPath: z.string().optional(),
@@ -29,6 +29,8 @@ export const LanguageModelSchema = LanguageModelRefSchema.extend({
29
29
  contextWindowTokens: z.number().int().positive().optional(),
30
30
  }),
31
31
  reasoningLevels: z.array(z.enum(MODEL_REASONING_LEVELS)),
32
+ /** Reasoning the project applies when a request selects this model without choosing one. */
33
+ defaultReasoning: z.enum(MODEL_REASONING_LEVELS).optional(),
32
34
  })
33
35
 
34
36
  export const ModelCatalogSchema = z.object({
@@ -5,6 +5,7 @@ import {
5
5
  AiUsageLimitErrorResponseSchema,
6
6
  JsonValueSchema,
7
7
  jsonValueOpenApiOverride,
8
+ RedactionsSchema,
8
9
  } from "./common"
9
10
 
10
11
  type OpenApiSchema = NonNullable<
@@ -350,6 +351,7 @@ export const TwinObjectSchema = z.object({
350
351
  primaryId: z.string(),
351
352
  objectTypeId: z.string(),
352
353
  properties: z.record(z.unknown()),
354
+ redactions: RedactionsSchema.optional(),
353
355
  createdAt: z.string(),
354
356
  updatedAt: z.string(),
355
357
  })
@@ -385,6 +387,16 @@ export const ObjectQueryOpenApiSchemas: OpenApiSchemas = {
385
387
  error: { type: "string" },
386
388
  },
387
389
  },
390
+ // Values omitted because the caller lacks a clearance for their markings.
391
+ Redactions: {
392
+ type: "object",
393
+ additionalProperties: {
394
+ type: "object",
395
+ required: ["reason"],
396
+ additionalProperties: false,
397
+ properties: { reason: { type: "string", enum: ["missing_clearance"] } },
398
+ },
399
+ },
388
400
  ObjectQueryObject: {
389
401
  type: "object",
390
402
  required: ["primaryId", "objectTypeId", "properties", "createdAt", "updatedAt"],
@@ -394,6 +406,7 @@ export const ObjectQueryOpenApiSchemas: OpenApiSchemas = {
394
406
  primaryId: { type: "string" },
395
407
  objectTypeId: { type: "string" },
396
408
  properties: { type: "object", additionalProperties: true },
409
+ redactions: { $ref: "#/components/schemas/Redactions" },
397
410
  createdAt: { type: "string" },
398
411
  updatedAt: { type: "string" },
399
412
  // Populated only on the query route, by an `expand` node: linked objects
@@ -2,4 +2,8 @@ import { z } from "zod"
2
2
 
3
3
  export const ProjectInfoResponseSchema = z.object({
4
4
  id: z.string(),
5
+ /** Canonical BCP 47 language of the project, `"en"` unless configured. */
6
+ locale: z.string(),
7
+ /** Canonical IANA time zone of the project, `"UTC"` unless configured. */
8
+ timeZone: z.string(),
5
9
  })
package/src/server.ts CHANGED
@@ -425,13 +425,14 @@ export function createSixbApi(server: SixbServer) {
425
425
  })
426
426
  )
427
427
 
428
+ const authExperience = server.getAuthExperience()
428
429
  registerAuthRoutes(app, host, {
429
430
  resolveAuthContext: (request) => server.resolveAuthContext(request),
430
431
  resolveAuthRedirectContext: (request, input) =>
431
432
  server.resolveAuthRedirectContext(request, input),
432
433
  getInvitationDestinationOptions: (request) => server.getInvitationDestinationOptions(request),
433
434
  resolveAuthRequestOrigin: (request) => server.resolveAuthRequestOrigin(request),
434
- authExperience: server.getAuthExperience(),
435
+ authExperience: authExperience && { ...authExperience, locale: host.locale },
435
436
  resolveInvitationRedirectContext: (request, input) =>
436
437
  server.resolveInvitationRedirectContext(request, input),
437
438
  })