@superinterface/server 1.5.1 → 1.6.0

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 (40) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/cache/eslint/.cache_btwyo7 +1 -1
  7. package/.next/fallback-build-manifest.json +2 -2
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_not-found.html +1 -1
  10. package/.next/server/app/_not-found.rsc +1 -1
  11. package/.next/server/app/index.html +1 -1
  12. package/.next/server/app/index.rsc +1 -1
  13. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  14. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  15. package/.next/server/chunks/[root-of-the-server]__bcdbc64b._.js +1 -1
  16. package/.next/server/chunks/[root-of-the-server]__bcdbc64b._.js.map +1 -1
  17. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_828c7f3d.js +1 -1
  18. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_828c7f3d.js.map +1 -1
  19. package/.next/server/pages/404.html +1 -1
  20. package/.next/server/pages/500.html +1 -1
  21. package/.next/server/server-reference-manifest.js +1 -1
  22. package/.next/server/server-reference-manifest.json +1 -1
  23. package/.next/trace +1 -1
  24. package/dist/app/api/assistants/[assistantId]/buildRoute.d.ts +6 -0
  25. package/dist/app/api/assistants/[assistantId]/buildRoute.d.ts.map +1 -1
  26. package/dist/app/api/assistants/[assistantId]/buildRoute.js +6 -4
  27. package/dist/app/api/assistants/[assistantId]/route.d.ts +6 -0
  28. package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
  29. package/dist/app/api/assistants/buildRoute.d.ts +22 -4
  30. package/dist/app/api/assistants/buildRoute.d.ts.map +1 -1
  31. package/dist/app/api/assistants/buildRoute.js +6 -4
  32. package/dist/app/api/assistants/route.d.ts +4 -0
  33. package/dist/app/api/assistants/route.d.ts.map +1 -1
  34. package/dist/lib/assistants/serializeApiAssistant.d.ts +2 -0
  35. package/dist/lib/assistants/serializeApiAssistant.d.ts.map +1 -1
  36. package/dist/lib/assistants/serializeApiAssistant.js +2 -0
  37. package/package.json +1 -1
  38. /package/.next/static/{sAHFK0SESk212SK8DFgrB → UBq-QQGk_XvgTNFv4eLnz}/_buildManifest.js +0 -0
  39. /package/.next/static/{sAHFK0SESk212SK8DFgrB → UBq-QQGk_XvgTNFv4eLnz}/_clientMiddlewareManifest.json +0 -0
  40. /package/.next/static/{sAHFK0SESk212SK8DFgrB → UBq-QQGk_XvgTNFv4eLnz}/_ssgManifest.js +0 -0
@@ -18,43 +18,57 @@ declare const createAssistantSchema: z.ZodEffects<z.ZodObject<{
18
18
  instructions: z.ZodDefault<z.ZodOptional<z.ZodString>>;
19
19
  codeInterpreterEnabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
20
20
  fileSearchEnabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
21
+ truncationType: z.ZodOptional<z.ZodNativeEnum<{
22
+ AUTO: "AUTO";
23
+ LAST_MESSAGES: "LAST_MESSAGES";
24
+ DISABLED: "DISABLED";
25
+ }>>;
26
+ truncationLastMessagesCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
21
27
  }, "strip", z.ZodTypeAny, {
22
- model: string;
23
28
  instructions: string;
24
29
  description: string;
25
30
  modelProviderId: string;
26
31
  storageProviderType: "OPENAI" | "AZURE_OPENAI" | "SUPERINTERFACE_CLOUD" | "OPENAI_RESPONSES" | "AZURE_RESPONSES" | "AZURE_AGENTS";
32
+ model: string;
27
33
  codeInterpreterEnabled: boolean;
28
34
  fileSearchEnabled: boolean;
29
35
  name?: string | undefined;
36
+ truncationType?: "AUTO" | "LAST_MESSAGES" | "DISABLED" | undefined;
37
+ truncationLastMessagesCount?: number | null | undefined;
30
38
  storageProviderAssistantId?: string | null | undefined;
31
39
  }, {
32
- model: string;
33
40
  modelProviderId: string;
34
41
  storageProviderType: "OPENAI" | "AZURE_OPENAI" | "SUPERINTERFACE_CLOUD" | "OPENAI_RESPONSES" | "AZURE_RESPONSES" | "AZURE_AGENTS";
42
+ model: string;
35
43
  name?: string | undefined;
36
44
  instructions?: string | undefined;
37
45
  description?: string | undefined;
46
+ truncationType?: "AUTO" | "LAST_MESSAGES" | "DISABLED" | undefined;
47
+ truncationLastMessagesCount?: number | null | undefined;
38
48
  storageProviderAssistantId?: string | null | undefined;
39
49
  codeInterpreterEnabled?: boolean | undefined;
40
50
  fileSearchEnabled?: boolean | undefined;
41
51
  }>, {
42
- model: string;
43
52
  instructions: string;
44
53
  description: string;
45
54
  modelProviderId: string;
46
55
  storageProviderType: "OPENAI" | "AZURE_OPENAI" | "SUPERINTERFACE_CLOUD" | "OPENAI_RESPONSES" | "AZURE_RESPONSES" | "AZURE_AGENTS";
56
+ model: string;
47
57
  codeInterpreterEnabled: boolean;
48
58
  fileSearchEnabled: boolean;
49
59
  name?: string | undefined;
60
+ truncationType?: "AUTO" | "LAST_MESSAGES" | "DISABLED" | undefined;
61
+ truncationLastMessagesCount?: number | null | undefined;
50
62
  storageProviderAssistantId?: string | null | undefined;
51
63
  }, {
52
- model: string;
53
64
  modelProviderId: string;
54
65
  storageProviderType: "OPENAI" | "AZURE_OPENAI" | "SUPERINTERFACE_CLOUD" | "OPENAI_RESPONSES" | "AZURE_RESPONSES" | "AZURE_AGENTS";
66
+ model: string;
55
67
  name?: string | undefined;
56
68
  instructions?: string | undefined;
57
69
  description?: string | undefined;
70
+ truncationType?: "AUTO" | "LAST_MESSAGES" | "DISABLED" | undefined;
71
+ truncationLastMessagesCount?: number | null | undefined;
58
72
  storageProviderAssistantId?: string | null | undefined;
59
73
  codeInterpreterEnabled?: boolean | undefined;
60
74
  fileSearchEnabled?: boolean | undefined;
@@ -75,6 +89,8 @@ export declare const buildGET: ({ prisma }: {
75
89
  instructions: string;
76
90
  codeInterpreterEnabled: boolean;
77
91
  fileSearchEnabled: boolean;
92
+ truncationType: import("@prisma/client").$Enums.TruncationType;
93
+ truncationLastMessagesCount: number | null;
78
94
  createdAt: string;
79
95
  updatedAt: string;
80
96
  avatar: {
@@ -104,6 +120,8 @@ export declare const buildPOST: ({ prisma }: {
104
120
  instructions: string;
105
121
  codeInterpreterEnabled: boolean;
106
122
  fileSearchEnabled: boolean;
123
+ truncationType: import("@prisma/client").$Enums.TruncationType;
124
+ truncationLastMessagesCount: number | null;
107
125
  createdAt: string;
108
126
  updatedAt: string;
109
127
  avatar: {
@@ -1 +1 @@
1
- {"version":3,"file":"buildRoute.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/buildRoute.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoCvB,CAAA;AAEJ,eAAO,MAAM,QAAQ,GAClB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CpC,CAAA;AAEH,eAAO,MAAM,SAAS,GACnB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGtB,CAAA;AAEH,eAAO,MAAM,YAAY,8BAMtB,CAAA;AAEH,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
1
+ {"version":3,"file":"buildRoute.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/buildRoute.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCvB,CAAA;AAEJ,eAAO,MAAM,QAAQ,GAClB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CpC,CAAA;AAEH,eAAO,MAAM,SAAS,GACnB,YAAY;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,MAC9B,SAAS,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyGtB,CAAA;AAEH,eAAO,MAAM,YAAY,8BAMtB,CAAA;AAEH,OAAO,EAAE,qBAAqB,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { headers } from 'next/headers';
2
- import { ApiKeyType, StorageProviderType, ToolType, } from '@prisma/client';
2
+ import { ApiKeyType, StorageProviderType, TruncationType, ToolType, } from '@prisma/client';
3
3
  import { NextResponse } from 'next/server';
4
4
  import { z } from 'zod';
5
5
  import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
@@ -16,6 +16,8 @@ const createAssistantSchema = z
16
16
  instructions: z.string().optional().default(''),
17
17
  codeInterpreterEnabled: z.boolean().optional().default(false),
18
18
  fileSearchEnabled: z.boolean().optional().default(false),
19
+ truncationType: z.nativeEnum(TruncationType).optional(),
20
+ truncationLastMessagesCount: z.number().int().nullable().optional(),
19
21
  })
20
22
  .superRefine((data, ctx) => {
21
23
  if (data.storageProviderType === StorageProviderType.SUPERINTERFACE_CLOUD &&
@@ -87,17 +89,17 @@ export const buildPOST = ({ prisma }) => async (request) => {
87
89
  error: `Missing required fields. ${JSON.stringify(parseResult.error.format())}`,
88
90
  }, { status: 400 });
89
91
  }
90
- const { storageProviderType, storageProviderAssistantId, modelProviderId, model, name, description, instructions, codeInterpreterEnabled, fileSearchEnabled, } = parseResult.data;
92
+ const { storageProviderType, storageProviderAssistantId, modelProviderId, model, name, description, instructions, codeInterpreterEnabled, fileSearchEnabled, truncationType, truncationLastMessagesCount, } = parseResult.data;
91
93
  const workspaceId = privateApiKey.workspaceId;
92
94
  const assistant = await prisma.assistant.create({
93
- data: Object.assign(Object.assign({ workspace: { connect: { id: workspaceId } }, modelProvider: { connect: { id: modelProviderId } }, modelSlug: model, name,
95
+ data: Object.assign(Object.assign(Object.assign(Object.assign({ workspace: { connect: { id: workspaceId } }, modelProvider: { connect: { id: modelProviderId } }, modelSlug: model, name,
94
96
  description,
95
97
  instructions,
96
98
  storageProviderType }, (storageProviderType === StorageProviderType.AZURE_AGENTS
97
99
  ? { azureAgentsAgentId: storageProviderAssistantId !== null && storageProviderAssistantId !== void 0 ? storageProviderAssistantId : null }
98
100
  : storageProviderType === StorageProviderType.AZURE_RESPONSES
99
101
  ? { azureResponsesAgentName: storageProviderAssistantId !== null && storageProviderAssistantId !== void 0 ? storageProviderAssistantId : null }
100
- : { openaiAssistantId: storageProviderAssistantId !== null && storageProviderAssistantId !== void 0 ? storageProviderAssistantId : null })), { tools: {
102
+ : { openaiAssistantId: storageProviderAssistantId !== null && storageProviderAssistantId !== void 0 ? storageProviderAssistantId : null })), (truncationType !== undefined && { truncationType })), (truncationLastMessagesCount !== undefined && { truncationLastMessagesCount })), { tools: {
101
103
  create: [
102
104
  ...(fileSearchEnabled
103
105
  ? [
@@ -14,6 +14,8 @@ export declare const GET: () => Promise<import("next/server").NextResponse<{
14
14
  instructions: string;
15
15
  codeInterpreterEnabled: boolean;
16
16
  fileSearchEnabled: boolean;
17
+ truncationType: import("@prisma/client").$Enums.TruncationType;
18
+ truncationLastMessagesCount: number | null;
17
19
  createdAt: string;
18
20
  updatedAt: string;
19
21
  avatar: {
@@ -41,6 +43,8 @@ export declare const POST: (request: Request) => Promise<import("next/server").N
41
43
  instructions: string;
42
44
  codeInterpreterEnabled: boolean;
43
45
  fileSearchEnabled: boolean;
46
+ truncationType: import("@prisma/client").$Enums.TruncationType;
47
+ truncationLastMessagesCount: number | null;
44
48
  createdAt: string;
45
49
  updatedAt: string;
46
50
  avatar: {
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAEhC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;GAAuB,CAAA;AAEvC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;GAAwB,CAAA;AAEzC,eAAO,MAAM,OAAO,8CAAiB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/assistants/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,qBAAqB,EACtB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAEhC,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAuB,CAAA;AAEvC,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAAwB,CAAA;AAEzC,eAAO,MAAM,OAAO,8CAAiB,CAAA"}
@@ -22,6 +22,8 @@ export declare const serializeApiAssistant: ({ assistant, }: {
22
22
  instructions: string;
23
23
  codeInterpreterEnabled: boolean;
24
24
  fileSearchEnabled: boolean;
25
+ truncationType: import("@prisma/client").$Enums.TruncationType;
26
+ truncationLastMessagesCount: number | null;
25
27
  createdAt: string;
26
28
  updatedAt: string;
27
29
  avatar: {
@@ -1 +1 @@
1
- {"version":3,"file":"serializeApiAssistant.d.ts","sourceRoot":"","sources":["../../../src/lib/assistants/serializeApiAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAK5C,eAAO,MAAM,qBAAqB,GAAI,gBAEnC;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,KAAK,EAAE,IAAI,CAAA;YACX,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,UAAU,EAAE,IAAI,CAAA;oBAChB,WAAW,EAAE,IAAI,CAAA;iBAClB,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;CAyBC,CAAA"}
1
+ {"version":3,"file":"serializeApiAssistant.d.ts","sourceRoot":"","sources":["../../../src/lib/assistants/serializeApiAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAK5C,eAAO,MAAM,qBAAqB,GAAI,gBAEnC;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,KAAK,EAAE,IAAI,CAAA;YACX,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,UAAU,EAAE,IAAI,CAAA;oBAChB,WAAW,EAAE,IAAI,CAAA;iBAClB,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;;;;;;;;;CA2BC,CAAA"}
@@ -18,6 +18,8 @@ export const serializeApiAssistant = ({ assistant, }) => {
18
18
  instructions: assistant.instructions,
19
19
  codeInterpreterEnabled: assistant.tools.some((tool) => tool.type === ToolType.CODE_INTERPRETER),
20
20
  fileSearchEnabled: assistant.tools.some((tool) => tool.type === ToolType.FILE_SEARCH),
21
+ truncationType: assistant.truncationType,
22
+ truncationLastMessagesCount: assistant.truncationLastMessagesCount,
21
23
  createdAt: assistant.createdAt.toISOString(),
22
24
  updatedAt: assistant.updatedAt.toISOString(),
23
25
  avatar: serializeAvatar({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superinterface/server",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superinterface-server": "./bin/index.cjs"