@sixb/server 0.1.11 → 0.1.12

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 (38) hide show
  1. package/dist/index.js +147 -27
  2. package/dist/index.js.map +11 -11
  3. package/dist/routes/agents.d.ts +121 -34
  4. package/dist/routes/agents.d.ts.map +1 -1
  5. package/dist/routes/ai-accounting.d.ts.map +1 -1
  6. package/dist/routes/datasets.d.ts +8 -8
  7. package/dist/routes/models.d.ts +1 -1
  8. package/dist/routes/objects.d.ts +16 -5
  9. package/dist/routes/objects.d.ts.map +1 -1
  10. package/dist/routes/ontology.d.ts +24 -12
  11. package/dist/routes/ontology.d.ts.map +1 -1
  12. package/dist/routes/syncs.d.ts +5 -5
  13. package/dist/routes/workflows.d.ts +6 -6
  14. package/dist/schemas/agents.d.ts +205 -100
  15. package/dist/schemas/agents.d.ts.map +1 -1
  16. package/dist/schemas/ai-accounting.d.ts +692 -104
  17. package/dist/schemas/ai-accounting.d.ts.map +1 -1
  18. package/dist/schemas/ai-usage.d.ts +2 -2
  19. package/dist/schemas/common.d.ts +15 -0
  20. package/dist/schemas/common.d.ts.map +1 -1
  21. package/dist/schemas/datasets.d.ts +22 -22
  22. package/dist/schemas/models.d.ts +8 -8
  23. package/dist/schemas/objects.d.ts +8 -0
  24. package/dist/schemas/objects.d.ts.map +1 -1
  25. package/dist/schemas/ontology.d.ts +99 -49
  26. package/dist/schemas/ontology.d.ts.map +1 -1
  27. package/dist/schemas/syncs.d.ts +12 -12
  28. package/dist/schemas/workflows.d.ts +50 -50
  29. package/package.json +5 -5
  30. package/src/routes/agents.ts +48 -6
  31. package/src/routes/ai-accounting.ts +1 -0
  32. package/src/routes/objects.ts +46 -2
  33. package/src/routes/ontology.ts +15 -5
  34. package/src/schemas/agents.ts +9 -0
  35. package/src/schemas/ai-accounting.ts +19 -1
  36. package/src/schemas/common.ts +5 -0
  37. package/src/schemas/objects.ts +18 -6
  38. package/src/schemas/ontology.ts +15 -6
@@ -41,7 +41,25 @@ export const AiCostSummarySchema = z.object({
41
41
 
42
42
  const AiAccountingAggregateSchema = z.object({
43
43
  modelCallCount: z.number().int().nonnegative(),
44
- usage: AiUsageSummarySchema,
44
+ usage: AiUsageSummarySchema.describe(
45
+ "Sums of reported meters; unreported meters are absent. totalTokens sums available input and output counts and is a lower bound when coverage is incomplete."
46
+ ),
47
+ usageCoverage: z.object({
48
+ completeCallCount: z
49
+ .number()
50
+ .int()
51
+ .nonnegative()
52
+ .describe("Calls reporting both inputTokens and outputTokens."),
53
+ fieldCallCounts: z.object({
54
+ inputTokens: z.number().int().nonnegative(),
55
+ outputTokens: z.number().int().nonnegative(),
56
+ uncachedInputTokens: z.number().int().nonnegative(),
57
+ cacheReadInputTokens: z.number().int().nonnegative(),
58
+ cacheWriteInputTokens: z.number().int().nonnegative(),
59
+ textOutputTokens: z.number().int().nonnegative(),
60
+ reasoningOutputTokens: z.number().int().nonnegative(),
61
+ }),
62
+ }),
45
63
  costs: AiCostSummarySchema,
46
64
  })
47
65
 
@@ -84,3 +84,8 @@ export const jsonValueOpenApiOverride: OverrideCallback = (def) => {
84
84
 
85
85
  return ignoreOverride
86
86
  }
87
+
88
+ export const AiUsageLimitErrorResponseSchema = codedErrorResponseSchema([
89
+ "ai.usage_limit_exceeded",
90
+ "ai.usage_limit_unavailable",
91
+ ]).extend({ details: JsonValueSchema.optional() })
@@ -1,6 +1,11 @@
1
1
  import type { ElysiaOpenAPIConfig } from "@elysiajs/openapi"
2
2
  import { z } from "zod"
3
- import { JsonValueSchema } from "./common"
3
+ import { zodToJsonSchema } from "zod-to-json-schema"
4
+ import {
5
+ AiUsageLimitErrorResponseSchema,
6
+ JsonValueSchema,
7
+ jsonValueOpenApiOverride,
8
+ } from "./common"
4
9
 
5
10
  type OpenApiSchema = NonNullable<
6
11
  NonNullable<NonNullable<ElysiaOpenAPIConfig["documentation"]>["components"]>["schemas"]
@@ -229,8 +234,8 @@ export const ObjectQuerySchema: z.ZodType<unknown> = z.lazy(() =>
229
234
  .object({
230
235
  kind: z.literal("vector"),
231
236
  input: ObjectQuerySchema,
232
- vector: z.array(z.number().finite()),
233
- propertyId: z.string().min(1),
237
+ vector: z.string().min(1).max(8000),
238
+ profile: z.string().min(1),
234
239
  k: z.number().int().positive(),
235
240
  })
236
241
  .strict(),
@@ -334,6 +339,7 @@ export const ObjectQueryLinksRequestSchema = z
334
339
  .strict()
335
340
 
336
341
  export const TwinObjectSchema = z.object({
342
+ score: z.number().finite().optional(),
337
343
  primaryId: z.string(),
338
344
  objectTypeId: z.string(),
339
345
  properties: z.record(z.unknown()),
@@ -377,6 +383,7 @@ export const ObjectQueryOpenApiSchemas: OpenApiSchemas = {
377
383
  required: ["primaryId", "objectTypeId", "properties", "createdAt", "updatedAt"],
378
384
  additionalProperties: false,
379
385
  properties: {
386
+ score: { type: "number" },
380
387
  primaryId: { type: "string" },
381
388
  objectTypeId: { type: "string" },
382
389
  properties: { type: "object", additionalProperties: true },
@@ -540,6 +547,11 @@ export const ObjectQueryOpenApiSchemas: OpenApiSchemas = {
540
547
  nextPageToken: { type: "string" },
541
548
  },
542
549
  },
550
+ AiUsageLimitErrorResponse: zodToJsonSchema(AiUsageLimitErrorResponseSchema, {
551
+ target: "openApi3",
552
+ $refStrategy: "none",
553
+ override: jsonValueOpenApiOverride,
554
+ }) as OpenApi3Schema,
543
555
  ObjectQueryErrorResponse: {
544
556
  type: "object",
545
557
  required: ["error"],
@@ -680,13 +692,13 @@ export const ObjectQueryOpenApiSchemas: OpenApiSchemas = {
680
692
  },
681
693
  {
682
694
  type: "object",
683
- required: ["kind", "input", "vector", "propertyId", "k"],
695
+ required: ["kind", "input", "vector", "profile", "k"],
684
696
  additionalProperties: false,
685
697
  properties: {
686
698
  kind: { type: "string", enum: ["vector"] },
687
699
  input: objectQueryRef,
688
- vector: { type: "array", items: { type: "number" } },
689
- propertyId: { type: "string", minLength: 1 },
700
+ vector: { type: "string", minLength: 1, maxLength: 8000 },
701
+ profile: { type: "string", minLength: 1 },
690
702
  k: { type: "integer", minimum: 1 },
691
703
  },
692
704
  },
@@ -20,7 +20,6 @@ export const PropertyDefinitionSchema = z.object({
20
20
  text: z.boolean().optional(),
21
21
  exact: z.boolean().optional(),
22
22
  facet: z.boolean().optional(),
23
- vector: z.boolean().optional(),
24
23
  weight: z.number().optional(),
25
24
  })
26
25
  .optional(),
@@ -64,11 +63,21 @@ export const ObjectTypeSchema = z.object({
64
63
  title: z.string().optional(),
65
64
  defaultText: z.array(z.string()).optional(),
66
65
  exact: z.array(z.string()).optional(),
67
- vector: z
68
- .object({
69
- property: z.string(),
70
- source: z.array(z.string()),
71
- })
66
+ vectors: z
67
+ .record(
68
+ z.string(),
69
+ z.object({
70
+ source: z.array(z.string()),
71
+ model: z.object({
72
+ providerId: z.string(),
73
+ modelId: z.string(),
74
+ dimensions: z.number().int().positive(),
75
+ representation: z
76
+ .object({ name: z.string(), version: z.string().optional() })
77
+ .optional(),
78
+ }),
79
+ })
80
+ )
72
81
  .optional(),
73
82
  })
74
83
  .optional(),