@superinterface/server 1.0.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.
- package/README.md +36 -0
- package/eslint.config.mjs +31 -0
- package/next.config.ts +7 -0
- package/package.json +176 -0
- package/prisma/Account.prisma +18 -0
- package/prisma/ApiKey.prisma +13 -0
- package/prisma/Assistant.prisma +32 -0
- package/prisma/AssistantHandler.prisma +12 -0
- package/prisma/Avatar.prisma +10 -0
- package/prisma/ClientToolHandler.prisma +13 -0
- package/prisma/CodeInterpreterTool.prisma +7 -0
- package/prisma/ComputerUseTool.prisma +12 -0
- package/prisma/CreateTaskHandler.prisma +10 -0
- package/prisma/DeleteTaskHandler.prisma +10 -0
- package/prisma/FileSearchTool.prisma +9 -0
- package/prisma/FirecrawlHandler.prisma +13 -0
- package/prisma/Function.prisma +13 -0
- package/prisma/Handler.prisma +19 -0
- package/prisma/HttpTransport.prisma +12 -0
- package/prisma/IconAvatar.prisma +8 -0
- package/prisma/ImageAvatar.prisma +8 -0
- package/prisma/ImageGenerationTool.prisma +11 -0
- package/prisma/InitialMessage.prisma +17 -0
- package/prisma/Invitation.prisma +15 -0
- package/prisma/ListTasksHandler.prisma +10 -0
- package/prisma/Log.prisma +21 -0
- package/prisma/McpServer.prisma +14 -0
- package/prisma/Message.prisma +30 -0
- package/prisma/ModelProvider.prisma +15 -0
- package/prisma/Organization.prisma +10 -0
- package/prisma/OrganizationApiKey.prisma +12 -0
- package/prisma/OrganizationInvitation.prisma +15 -0
- package/prisma/OrganizationUserRole.prisma +14 -0
- package/prisma/ReplicateHandler.prisma +14 -0
- package/prisma/RequestHandler.prisma +15 -0
- package/prisma/Run.prisma +36 -0
- package/prisma/RunStep.prisma +30 -0
- package/prisma/Session.prisma +7 -0
- package/prisma/SseTransport.prisma +12 -0
- package/prisma/StdioTransport.prisma +11 -0
- package/prisma/Task.prisma +15 -0
- package/prisma/Thread.prisma +20 -0
- package/prisma/Tool.prisma +13 -0
- package/prisma/UpdateTaskHandler.prisma +10 -0
- package/prisma/User.prisma +16 -0
- package/prisma/UserRole.prisma +14 -0
- package/prisma/VerificationToken.prisma +7 -0
- package/prisma/WebSearchTool.prisma +7 -0
- package/prisma/Workspace.prisma +14 -0
- package/prisma/enums/ApiKeyType.prisma +4 -0
- package/prisma/enums/AvatarType.prisma +5 -0
- package/prisma/enums/ClientToolHandlerType.prisma +3 -0
- package/prisma/enums/ComputerUseToolEnvironment.prisma +6 -0
- package/prisma/enums/FirecrawlHandlerType.prisma +6 -0
- package/prisma/enums/HandlerType.prisma +11 -0
- package/prisma/enums/IconAvatarName.prisma +14 -0
- package/prisma/enums/ImageGenerationToolOutputFormat.prisma +5 -0
- package/prisma/enums/ImageGenerationToolQuality.prisma +6 -0
- package/prisma/enums/ImageGenerationToolSize.prisma +6 -0
- package/prisma/enums/LogLevel.prisma +5 -0
- package/prisma/enums/LogRequestMethod.prisma +7 -0
- package/prisma/enums/LogRequestRoute.prisma +6 -0
- package/prisma/enums/MessageRole.prisma +4 -0
- package/prisma/enums/MessageStatus.prisma +5 -0
- package/prisma/enums/MethodType.prisma +7 -0
- package/prisma/enums/ModelProviderType.prisma +13 -0
- package/prisma/enums/OrganizationUserRoleType.prisma +3 -0
- package/prisma/enums/ReplicateHandlerType.prisma +3 -0
- package/prisma/enums/RunStatus.prisma +10 -0
- package/prisma/enums/RunStepStatus.prisma +7 -0
- package/prisma/enums/RunStepType.prisma +4 -0
- package/prisma/enums/StorageProviderType.prisma +7 -0
- package/prisma/enums/ToolType.prisma +7 -0
- package/prisma/enums/TransportType.prisma +5 -0
- package/prisma/enums/TruncationType.prisma +5 -0
- package/prisma/enums/UserRoleType.prisma +3 -0
- package/prisma/migrations/20251006235143_initial_setup/migration.sql +986 -0
- package/prisma/migrations/20251007163926_add_truncation_type/migration.sql +6 -0
- package/prisma/migrations/20251007190703_add_organizations/migration.sql +97 -0
- package/prisma/migrations/migration_lock.toml +3 -0
- package/prisma/schema.prisma +13 -0
- package/prisma.config.ts +6 -0
- package/scripts/cli.ts +84 -0
- package/scripts/commands/organizations/api-keys/create.ts +159 -0
- package/scripts/commands/organizations/create.ts +82 -0
- package/scripts/utils/env.ts +31 -0
- package/scripts/utils/errors.ts +6 -0
- package/src/app/api/api-keys/[apiKeyId]/route.ts +178 -0
- package/src/app/api/api-keys/route.ts +147 -0
- package/src/app/api/assistants/[assistantId]/functions/[functionId]/route.ts +245 -0
- package/src/app/api/assistants/[assistantId]/functions/route.ts +157 -0
- package/src/app/api/assistants/[assistantId]/initial-messages/route.ts +127 -0
- package/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts +243 -0
- package/src/app/api/assistants/[assistantId]/mcp-servers/route.ts +163 -0
- package/src/app/api/assistants/[assistantId]/route.ts +336 -0
- package/src/app/api/assistants/route.ts +196 -0
- package/src/app/api/files/[fileId]/contents/route.ts +145 -0
- package/src/app/api/files/route.ts +117 -0
- package/src/app/api/messages/lib/getWorkspaceId.ts +12 -0
- package/src/app/api/messages/lib/initialMessagesResponse.ts +90 -0
- package/src/app/api/messages/lib/serializeThread.ts +22 -0
- package/src/app/api/messages/route.ts +710 -0
- package/src/app/api/providers/[modelProviderId]/assistants/route.ts +68 -0
- package/src/app/api/providers/[modelProviderId]/models/route.ts +68 -0
- package/src/app/api/providers/[modelProviderId]/route.ts +202 -0
- package/src/app/api/providers/route.ts +105 -0
- package/src/app/api/tasks/[taskId]/route.ts +213 -0
- package/src/app/api/tasks/callback/route.ts +280 -0
- package/src/app/api/tasks/route.ts +121 -0
- package/src/app/api/threads/runs/submit-client-tool-outputs/route.ts +54 -0
- package/src/app/api/workspaces/[workspaceId]/route.ts +137 -0
- package/src/app/api/workspaces/route.ts +139 -0
- package/src/app/layout.tsx +9 -0
- package/src/app/page.tsx +3 -0
- package/src/lib/apiKeys/formatApiKeyName.ts +13 -0
- package/src/lib/apiKeys/getApiKey.ts +25 -0
- package/src/lib/apiKeys/serializeApiKey.ts +11 -0
- package/src/lib/apiKeys/workspaceAccessWhere.ts +21 -0
- package/src/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.ts +96 -0
- package/src/lib/assistants/assistantClientAdapter/index.ts +165 -0
- package/src/lib/assistants/formatName.ts +9 -0
- package/src/lib/assistants/serializeApiAssistant.ts +40 -0
- package/src/lib/assistants/serializeAssistant.ts +31 -0
- package/src/lib/assistants/storageAssistantId.ts +29 -0
- package/src/lib/avatars/defaultAvatar.ts +15 -0
- package/src/lib/avatars/serializeAvatar.ts +26 -0
- package/src/lib/cache/cacheHeaders.ts +5 -0
- package/src/lib/computerCalls/handleComputerCall/index.ts +173 -0
- package/src/lib/errors/index.ts +10 -0
- package/src/lib/errors/serializeError.ts +11 -0
- package/src/lib/functions/createFunction.ts +32 -0
- package/src/lib/functions/functionSchema.ts +201 -0
- package/src/lib/functions/handleFunction/getFunction.ts +43 -0
- package/src/lib/functions/handleFunction/handleAssistant.ts +399 -0
- package/src/lib/functions/handleFunction/handleClientTool.ts +127 -0
- package/src/lib/functions/handleFunction/handleFirecrawl.ts +212 -0
- package/src/lib/functions/handleFunction/handleReplicate.ts +109 -0
- package/src/lib/functions/handleFunction/handleRequest.ts +272 -0
- package/src/lib/functions/handleFunction/index.ts +474 -0
- package/src/lib/functions/handleFunction/tasks/handleCreateTask.ts +58 -0
- package/src/lib/functions/handleFunction/tasks/handleDeleteTask.ts +62 -0
- package/src/lib/functions/handleFunction/tasks/handleListTasks.ts +53 -0
- package/src/lib/functions/handleFunction/tasks/handleUpdateTask.ts +70 -0
- package/src/lib/functions/interpolateFunctionValue.ts +26 -0
- package/src/lib/functions/serializeApiFunction.ts +32 -0
- package/src/lib/functions/updateFunction.ts +42 -0
- package/src/lib/handlers/handlerPrismaInput.tsx +141 -0
- package/src/lib/handlers/serializeApiHandler.ts +94 -0
- package/src/lib/iconAvatars/serializeIconAvatar.ts +9 -0
- package/src/lib/imageAvatars/serializeImageAvatar.ts +9 -0
- package/src/lib/initialMessages/schema.ts +11 -0
- package/src/lib/initialMessages/serializeApiInitialMessage.ts +15 -0
- package/src/lib/initialMessages/updateInitialMessages.ts +33 -0
- package/src/lib/logs/createLog.ts +17 -0
- package/src/lib/mcpServers/closeMcpConnection.ts +16 -0
- package/src/lib/mcpServers/connectMcpServer.ts +117 -0
- package/src/lib/mcpServers/getToolCallMcpServer.ts +62 -0
- package/src/lib/mcpServers/headers.ts +113 -0
- package/src/lib/mcpServers/mcpServerSchema.ts +77 -0
- package/src/lib/mcpServers/serializeApiMcpServer.ts +51 -0
- package/src/lib/mcpServers/url.ts +98 -0
- package/src/lib/messages/content.ts +60 -0
- package/src/lib/messages/textContent.ts +13 -0
- package/src/lib/metadata/serializeMetadata.ts +34 -0
- package/src/lib/misc/isJSON.ts +9 -0
- package/src/lib/misc/merge/customizer.ts +8 -0
- package/src/lib/misc/merge/index.ts +6 -0
- package/src/lib/modelProviders/buildAzureOpenaiClientAdapter.ts +33 -0
- package/src/lib/modelProviders/buildOpenaiClient.ts +14 -0
- package/src/lib/modelProviders/buildOpenaiClientAdapter.ts +30 -0
- package/src/lib/modelProviders/clientAdapter.ts +121 -0
- package/src/lib/modelProviders/isModelProviderValid.ts +23 -0
- package/src/lib/modelProviders/modelProviderConfigs.ts +221 -0
- package/src/lib/modelProviders/serializeModelProvider.ts +19 -0
- package/src/lib/models/getModels.ts +27 -0
- package/src/lib/models/serializeApiModel.ts +5 -0
- package/src/lib/openai/getOpenaiAssistants.ts +30 -0
- package/src/lib/organizationApiKeys/getOrganizationApiKey.ts +23 -0
- package/src/lib/prisma/index.ts +29 -0
- package/src/lib/redis/index.ts +3 -0
- package/src/lib/runs/createRunOpts.ts +80 -0
- package/src/lib/storageProviders/getStorageProviderAssistants.ts +19 -0
- package/src/lib/storageProviders/getStorageProviderType.ts +21 -0
- package/src/lib/storageProviders/isOpenaiAssistantsStorageProvider.ts +8 -0
- package/src/lib/storageProviders/isResponsesStorageProvider.ts +8 -0
- package/src/lib/storageProviders/openaiAssistantsStorageProviderTypes.ts +6 -0
- package/src/lib/storageProviders/responsesStorageProviderTypes.ts +6 -0
- package/src/lib/storageProviders/serializeApiStorageProviderAssistant.ts +14 -0
- package/src/lib/tasks/cancelScheduledTask.ts +13 -0
- package/src/lib/tasks/getNextOccurrence.ts +77 -0
- package/src/lib/tasks/getTaskToolKey.ts +49 -0
- package/src/lib/tasks/parseTaskToolArgs.ts +101 -0
- package/src/lib/tasks/scheduleSchema.ts +34 -0
- package/src/lib/tasks/scheduleTask.ts +37 -0
- package/src/lib/tasks/schemas.ts +25 -0
- package/src/lib/tasks/serializeTask.ts +14 -0
- package/src/lib/tasks/validateSchedule.ts +23 -0
- package/src/lib/themes/defaultTheme.ts +7 -0
- package/src/lib/themes/serializeAccentColor.ts +9 -0
- package/src/lib/themes/serializeTheme/index.ts +25 -0
- package/src/lib/themes/serializeTheme/serializeScaling.ts +14 -0
- package/src/lib/threads/createThread/index.ts +185 -0
- package/src/lib/threads/createThread/initialMessages.ts +36 -0
- package/src/lib/threads/managedOpenaiThreadId.ts +72 -0
- package/src/lib/threads/storageThreadId.ts +49 -0
- package/src/lib/threads/validThreadId.ts +10 -0
- package/src/lib/toolCalls/handleToolCall.ts +121 -0
- package/src/lib/toolCalls/messagesToOutput.ts +8 -0
- package/src/lib/toolCalls/streamOutput.ts +106 -0
- package/src/lib/tools/tools/index.ts +316 -0
- package/src/lib/upstash/qstash.ts +5 -0
- package/src/lib/upstash/upstashWorkflowClient.ts +5 -0
- package/src/lib/workspaces/serializeApiWorkspace.ts +12 -0
- package/src/types/index.ts +133 -0
- package/tsconfig.build.json +13 -0
- package/tsconfig.json +27 -0
- package/types/prisma.d.ts +4 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
model Organization {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
name String @default("")
|
|
4
|
+
workspaces Workspace[]
|
|
5
|
+
organizationUserRoles OrganizationUserRole[]
|
|
6
|
+
organizationInvitations OrganizationInvitation[]
|
|
7
|
+
organizationApiKeys OrganizationApiKey[]
|
|
8
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
9
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
model OrganizationApiKey {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
name String @default("")
|
|
4
|
+
value String @default(dbgenerated("gen_random_uuid()")) @unique @db.Uuid
|
|
5
|
+
organizationId String @db.Uuid
|
|
6
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
7
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
8
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
9
|
+
|
|
10
|
+
@@index([value])
|
|
11
|
+
@@index([organizationId])
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
model OrganizationInvitation {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
email String
|
|
4
|
+
roleType OrganizationUserRoleType @default(ADMIN)
|
|
5
|
+
createdByUserId String
|
|
6
|
+
createdByUser User @relation(fields: [createdByUserId], references: [id], onDelete: Cascade)
|
|
7
|
+
organizationId String @db.Uuid
|
|
8
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
9
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
10
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
11
|
+
|
|
12
|
+
@@index([createdByUserId])
|
|
13
|
+
@@index([organizationId])
|
|
14
|
+
@@unique([organizationId, email])
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
model OrganizationUserRole {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
type OrganizationUserRoleType @default(ADMIN)
|
|
4
|
+
userId String
|
|
5
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
6
|
+
organizationId String @db.Uuid
|
|
7
|
+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
8
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
9
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
10
|
+
|
|
11
|
+
@@index([userId])
|
|
12
|
+
@@index([organizationId])
|
|
13
|
+
@@unique([organizationId, userId])
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
model ReplicateHandler {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
type ReplicateHandlerType @default(RUN)
|
|
4
|
+
identifier String
|
|
5
|
+
apiKey String
|
|
6
|
+
/// [ReplicateHandlerBody]
|
|
7
|
+
body Json
|
|
8
|
+
handlerId String @db.Uuid @unique
|
|
9
|
+
handler Handler @relation(fields: [handlerId], references: [id], onDelete: Cascade)
|
|
10
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
11
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
12
|
+
|
|
13
|
+
@@index([handlerId])
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
model RequestHandler {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
url String
|
|
4
|
+
method MethodType
|
|
5
|
+
/// [RequestHandlerHeaders]
|
|
6
|
+
headers Json
|
|
7
|
+
/// [RequestHandlerBody]
|
|
8
|
+
body Json
|
|
9
|
+
handlerId String @db.Uuid @unique
|
|
10
|
+
handler Handler @relation(fields: [handlerId], references: [id], onDelete: Cascade)
|
|
11
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
12
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
13
|
+
|
|
14
|
+
@@index([handlerId])
|
|
15
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
model Run {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
threadId String @db.Uuid
|
|
4
|
+
thread Thread @relation(fields: [threadId], references: [id], onDelete: Cascade)
|
|
5
|
+
assistantId String @db.Uuid
|
|
6
|
+
assistant Assistant @relation(fields: [assistantId], references: [id], onDelete: Cascade)
|
|
7
|
+
status RunStatus
|
|
8
|
+
/// [RunRequiredAction]
|
|
9
|
+
requiredAction Json?
|
|
10
|
+
/// [RunLastError]
|
|
11
|
+
lastError Json?
|
|
12
|
+
expiresAt Int
|
|
13
|
+
startedAt Int?
|
|
14
|
+
cancelledAt Int?
|
|
15
|
+
failedAt Int?
|
|
16
|
+
completedAt Int?
|
|
17
|
+
model String
|
|
18
|
+
instructions String
|
|
19
|
+
/// [RunTools]
|
|
20
|
+
tools Json[] @default([])
|
|
21
|
+
/// [RunMetadata]
|
|
22
|
+
metadata Json?
|
|
23
|
+
/// [RunUsage]
|
|
24
|
+
usage Json?
|
|
25
|
+
/// [RunTruncationStrategy]
|
|
26
|
+
truncationStrategy Json @default("{ \"type\": \"auto\" }")
|
|
27
|
+
/// [RunResponseFormat]
|
|
28
|
+
responseFormat Json @default("{ \"type\": \"text\" }")
|
|
29
|
+
runSteps RunStep[]
|
|
30
|
+
messages Message[]
|
|
31
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
32
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
33
|
+
|
|
34
|
+
@@index([assistantId])
|
|
35
|
+
@@index([threadId])
|
|
36
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
model RunStep {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
threadId String @db.Uuid
|
|
4
|
+
thread Thread @relation(fields: [threadId], references: [id], onDelete: Cascade)
|
|
5
|
+
assistantId String @db.Uuid
|
|
6
|
+
assistant Assistant @relation(fields: [assistantId], references: [id], onDelete: Cascade)
|
|
7
|
+
runId String @db.Uuid
|
|
8
|
+
run Run @relation(fields: [runId], references: [id], onDelete: Cascade)
|
|
9
|
+
type RunStepType
|
|
10
|
+
status RunStepStatus
|
|
11
|
+
/// [RunStepStepDetails]
|
|
12
|
+
stepDetails Json
|
|
13
|
+
/// [RunStepLastError]
|
|
14
|
+
lastError Json?
|
|
15
|
+
expiredAt Int?
|
|
16
|
+
cancelledAt Int?
|
|
17
|
+
failedAt Int?
|
|
18
|
+
completedAt Int?
|
|
19
|
+
/// [RunStepMetadata]
|
|
20
|
+
metadata Json?
|
|
21
|
+
/// [RunStepUsage]
|
|
22
|
+
usage Json?
|
|
23
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
24
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
25
|
+
|
|
26
|
+
@@index([threadId, runId, type, status])
|
|
27
|
+
@@index([createdAt(sort: Asc)])
|
|
28
|
+
@@index([assistantId])
|
|
29
|
+
@@index([runId])
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
model SseTransport {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
mcpServerId String @db.Uuid @unique
|
|
4
|
+
mcpServer McpServer @relation(fields: [mcpServerId], references: [id], onDelete: Cascade)
|
|
5
|
+
url String
|
|
6
|
+
/// [SseTransportHeaders]
|
|
7
|
+
headers Json @default("{}")
|
|
8
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
9
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
10
|
+
|
|
11
|
+
@@index([mcpServerId])
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
model StdioTransport {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
mcpServerId String @db.Uuid @unique
|
|
4
|
+
mcpServer McpServer @relation(fields: [mcpServerId], references: [id], onDelete: Cascade)
|
|
5
|
+
command String
|
|
6
|
+
args String
|
|
7
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
8
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
9
|
+
|
|
10
|
+
@@index([mcpServerId])
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
model Task {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
title String
|
|
4
|
+
message String
|
|
5
|
+
/// [TaskSchedule]
|
|
6
|
+
schedule Json
|
|
7
|
+
key String
|
|
8
|
+
qstashMessageId String?
|
|
9
|
+
threadId String @db.Uuid
|
|
10
|
+
thread Thread @relation(fields: [threadId], references: [id], onDelete: Cascade)
|
|
11
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
12
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
13
|
+
|
|
14
|
+
@@index([threadId])
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
model Thread {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
openaiThreadId String?
|
|
4
|
+
openaiConversationId String?
|
|
5
|
+
azureOpenaiConversationId String?
|
|
6
|
+
assistantId String @db.Uuid
|
|
7
|
+
assistant Assistant @relation(fields: [assistantId], references: [id], onDelete: Cascade)
|
|
8
|
+
/// [ThreadMetadata]
|
|
9
|
+
metadata Json?
|
|
10
|
+
messages Message[]
|
|
11
|
+
runs Run[]
|
|
12
|
+
runSteps RunStep[]
|
|
13
|
+
logs Log[]
|
|
14
|
+
tasks Task[]
|
|
15
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
16
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
17
|
+
|
|
18
|
+
@@index([assistantId])
|
|
19
|
+
@@index([createdAt(sort: Desc)])
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
model Tool {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
type ToolType
|
|
4
|
+
assistantId String @db.Uuid
|
|
5
|
+
assistant Assistant @relation(fields: [assistantId], references: [id], onDelete: Cascade)
|
|
6
|
+
fileSearchTool FileSearchTool?
|
|
7
|
+
webSearchTool WebSearchTool?
|
|
8
|
+
codeInterpreterTool CodeInterpreterTool?
|
|
9
|
+
imageGenerationTool ImageGenerationTool?
|
|
10
|
+
computerUseTool ComputerUseTool?
|
|
11
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
12
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
model UpdateTaskHandler {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
keyTemplate String @default("")
|
|
4
|
+
handlerId String @db.Uuid @unique
|
|
5
|
+
handler Handler @relation(fields: [handlerId], references: [id], onDelete: Cascade)
|
|
6
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
7
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
8
|
+
|
|
9
|
+
@@index([handlerId])
|
|
10
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
model User {
|
|
2
|
+
id String @id @default(cuid())
|
|
3
|
+
name String?
|
|
4
|
+
email String? @unique
|
|
5
|
+
emailVerified DateTime?
|
|
6
|
+
image String?
|
|
7
|
+
accounts Account[]
|
|
8
|
+
sessions Session[]
|
|
9
|
+
userRoles UserRole[]
|
|
10
|
+
invitations Invitation[]
|
|
11
|
+
organizationUserRoles OrganizationUserRole[]
|
|
12
|
+
organizationInvitations OrganizationInvitation[]
|
|
13
|
+
|
|
14
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
15
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
model UserRole {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
type UserRoleType @default(ADMIN)
|
|
4
|
+
userId String
|
|
5
|
+
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
6
|
+
workspaceId String @db.Uuid
|
|
7
|
+
workspace Workspace @relation(fields: [workspaceId], references: [id], onDelete: Cascade)
|
|
8
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
9
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
10
|
+
|
|
11
|
+
@@index([userId])
|
|
12
|
+
@@index([workspaceId])
|
|
13
|
+
@@unique([workspaceId, userId])
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
model WebSearchTool {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
toolId String @db.Uuid @unique
|
|
4
|
+
tool Tool @relation(fields: [toolId], references: [id], onDelete: Cascade)
|
|
5
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
6
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
model Workspace {
|
|
2
|
+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
3
|
+
name String @default("")
|
|
4
|
+
userRoles UserRole[]
|
|
5
|
+
modelProviders ModelProvider[]
|
|
6
|
+
assistants Assistant[]
|
|
7
|
+
apiKeys ApiKey[]
|
|
8
|
+
logs Log[]
|
|
9
|
+
invitations Invitation[]
|
|
10
|
+
organizationId String? @db.Uuid
|
|
11
|
+
organization Organization? @relation(fields: [organizationId], references: [id], onDelete: SetNull)
|
|
12
|
+
createdAt DateTime @default(now()) @db.Timestamptz(6)
|
|
13
|
+
updatedAt DateTime @updatedAt @db.Timestamptz(6)
|
|
14
|
+
}
|