@superinterface/server 1.0.18 → 1.0.19
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/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_btwyo7 +1 -1
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/api/files/[fileId]/contents/route.js +1 -1
- package/.next/server/app/api/files/[fileId]/contents/route.js.nft.json +1 -1
- package/.next/server/app/api/files/route.js +1 -1
- package/.next/server/app/api/files/route.js.nft.json +1 -1
- package/.next/server/app/api/messages/route.js +3 -3
- package/.next/server/app/api/messages/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__13c6bd62._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__13c6bd62._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__29b43490._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__29b43490._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__b9a334c3._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__b9a334c3._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js.map +1 -1
- package/.next/server/chunks/{[root-of-the-server]__30845206._.js → [root-of-the-server]__ff90af03._.js} +3 -3
- package/.next/server/chunks/{[root-of-the-server]__30845206._.js.map → [root-of-the-server]__ff90af03._.js.map} +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
- package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
- package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js +2 -2
- package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js.map +1 -1
- package/.next/server/functions-config-manifest.json +2 -2
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/trace +1 -1
- package/bin/index.cjs +2 -0
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts +55 -0
- package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/[apiKeyId]/route.js +10 -4
- package/dist/app/api/api-keys/route.d.ts +29 -0
- package/dist/app/api/api-keys/route.d.ts.map +1 -1
- package/dist/app/api/api-keys/route.js +8 -3
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +172 -0
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +11 -4
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +113 -0
- package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/functions/route.js +8 -3
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +39 -0
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +8 -3
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +94 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +10 -4
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +61 -0
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +7 -3
- package/dist/app/api/assistants/[assistantId]/route.d.ts +123 -0
- package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/route.js +15 -6
- package/dist/app/api/assistants/route.d.ts +59 -0
- package/dist/app/api/assistants/route.d.ts.map +1 -1
- package/dist/app/api/assistants/route.js +8 -4
- package/dist/app/api/files/[fileId]/contents/route.d.ts +3 -2
- package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
- package/dist/app/api/files/[fileId]/contents/route.js +6 -3
- package/dist/app/api/files/route.d.ts +10 -0
- package/dist/app/api/files/route.d.ts.map +1 -1
- package/dist/app/api/files/route.js +7 -3
- package/dist/app/api/messages/route.d.ts +24 -1
- package/dist/app/api/messages/route.d.ts.map +1 -1
- package/dist/app/api/messages/route.js +27 -6
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +19 -0
- package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -2
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +14 -0
- package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -2
- package/dist/app/api/providers/[modelProviderId]/route.d.ts +64 -0
- package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
- package/dist/app/api/providers/[modelProviderId]/route.js +12 -6
- package/dist/app/api/providers/route.d.ts +35 -0
- package/dist/app/api/providers/route.d.ts.map +1 -1
- package/dist/app/api/providers/route.js +9 -5
- package/dist/app/api/tasks/[taskId]/route.d.ts +61 -0
- package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
- package/dist/app/api/tasks/[taskId]/route.js +11 -5
- package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
- package/dist/app/api/tasks/callback/route.js +14 -6
- package/dist/app/api/tasks/route.d.ts +33 -0
- package/dist/app/api/tasks/route.d.ts.map +1 -1
- package/dist/app/api/tasks/route.js +8 -4
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +9 -1
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
- package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +5 -3
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts +33 -0
- package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/[workspaceId]/route.js +7 -3
- package/dist/app/api/workspaces/route.d.ts +17 -3
- package/dist/app/api/workspaces/route.d.ts.map +1 -1
- package/dist/app/api/workspaces/route.js +8 -4
- package/dist/lib/apiKeys/getApiKey.d.ts +3 -2
- package/dist/lib/apiKeys/getApiKey.d.ts.map +1 -1
- package/dist/lib/apiKeys/getApiKey.js +1 -2
- package/dist/lib/apiKeys/workspaceAccessWhere.d.ts +3 -1
- package/dist/lib/apiKeys/workspaceAccessWhere.d.ts.map +1 -1
- package/dist/lib/apiKeys/workspaceAccessWhere.js +2 -1
- package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts +3 -2
- package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts.map +1 -1
- package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.js +3 -3
- package/dist/lib/assistants/assistantClientAdapter/index.d.ts.map +1 -1
- package/dist/lib/assistants/assistantClientAdapter/index.js +7 -2
- package/dist/lib/computerCalls/handleComputerCall/index.d.ts +3 -2
- package/dist/lib/computerCalls/handleComputerCall/index.d.ts.map +1 -1
- package/dist/lib/computerCalls/handleComputerCall/index.js +5 -1
- package/dist/lib/functions/createFunction.d.ts +2 -1
- package/dist/lib/functions/createFunction.d.ts.map +1 -1
- package/dist/lib/functions/createFunction.js +2 -2
- package/dist/lib/functions/handleFunction/handleAssistant.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleAssistant.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleAssistant.js +12 -2
- package/dist/lib/functions/handleFunction/handleClientTool.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleClientTool.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleClientTool.js +2 -1
- package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleFirecrawl.js +7 -1
- package/dist/lib/functions/handleFunction/handleReplicate.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleReplicate.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleReplicate.js +4 -1
- package/dist/lib/functions/handleFunction/handleRequest.d.ts +3 -2
- package/dist/lib/functions/handleFunction/handleRequest.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/handleRequest.js +6 -1
- package/dist/lib/functions/handleFunction/index.d.ts +3 -2
- package/dist/lib/functions/handleFunction/index.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/index.js +25 -1
- package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleCreateTask.js +4 -4
- package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.js +3 -3
- package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleListTasks.js +3 -3
- package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts +3 -2
- package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts.map +1 -1
- package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.js +4 -4
- package/dist/lib/functions/updateFunction.d.ts +2 -1
- package/dist/lib/functions/updateFunction.d.ts.map +1 -1
- package/dist/lib/functions/updateFunction.js +2 -2
- package/dist/lib/handlers/handlerPrismaInput.d.ts +3 -1
- package/dist/lib/handlers/handlerPrismaInput.d.ts.map +1 -1
- package/dist/lib/handlers/handlerPrismaInput.jsx +1 -2
- package/dist/lib/initialMessages/updateInitialMessages.d.ts +3 -2
- package/dist/lib/initialMessages/updateInitialMessages.d.ts.map +1 -1
- package/dist/lib/initialMessages/updateInitialMessages.js +1 -2
- package/dist/lib/logs/createLog.d.ts +3 -2
- package/dist/lib/logs/createLog.d.ts.map +1 -1
- package/dist/lib/logs/createLog.js +1 -2
- package/dist/lib/mcpServers/connectMcpServer.d.ts +6 -4
- package/dist/lib/mcpServers/connectMcpServer.d.ts.map +1 -1
- package/dist/lib/mcpServers/connectMcpServer.js +7 -5
- package/dist/lib/mcpServers/getToolCallMcpServer.d.ts +3 -2
- package/dist/lib/mcpServers/getToolCallMcpServer.d.ts.map +1 -1
- package/dist/lib/mcpServers/getToolCallMcpServer.js +2 -1
- package/dist/lib/mcpServers/headers.d.ts +3 -2
- package/dist/lib/mcpServers/headers.d.ts.map +1 -1
- package/dist/lib/mcpServers/headers.js +2 -1
- package/dist/lib/mcpServers/url.d.ts +3 -2
- package/dist/lib/mcpServers/url.d.ts.map +1 -1
- package/dist/lib/mcpServers/url.js +2 -1
- package/dist/lib/metadata/serializeMetadata.d.ts +3 -1
- package/dist/lib/metadata/serializeMetadata.d.ts.map +1 -1
- package/dist/lib/metadata/serializeMetadata.js +3 -2
- package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts +3 -2
- package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts.map +1 -1
- package/dist/lib/organizationApiKeys/getOrganizationApiKey.js +1 -2
- package/dist/lib/runs/createRunOpts.d.ts +3 -2
- package/dist/lib/runs/createRunOpts.d.ts.map +1 -1
- package/dist/lib/runs/createRunOpts.js +2 -2
- package/dist/lib/tasks/getTaskToolKey.d.ts +3 -2
- package/dist/lib/tasks/getTaskToolKey.d.ts.map +1 -1
- package/dist/lib/tasks/getTaskToolKey.js +2 -1
- package/dist/lib/tasks/parseTaskToolArgs.d.ts +3 -2
- package/dist/lib/tasks/parseTaskToolArgs.d.ts.map +1 -1
- package/dist/lib/tasks/parseTaskToolArgs.js +4 -1
- package/dist/lib/tasks/scheduleTask.d.ts +3 -2
- package/dist/lib/tasks/scheduleTask.d.ts.map +1 -1
- package/dist/lib/tasks/scheduleTask.js +1 -2
- package/dist/lib/threads/createThread/index.d.ts +3 -3
- package/dist/lib/threads/createThread/index.d.ts.map +1 -1
- package/dist/lib/threads/createThread/index.js +1 -0
- package/dist/lib/threads/managedOpenaiThreadId.d.ts +3 -2
- package/dist/lib/threads/managedOpenaiThreadId.d.ts.map +1 -1
- package/dist/lib/threads/managedOpenaiThreadId.js +1 -2
- package/dist/lib/toolCalls/handleToolCall.d.ts +3 -2
- package/dist/lib/toolCalls/handleToolCall.d.ts.map +1 -1
- package/dist/lib/toolCalls/handleToolCall.js +5 -1
- package/dist/lib/tools/tools/index.d.ts +3 -2
- package/dist/lib/tools/tools/index.d.ts.map +1 -1
- package/dist/lib/tools/tools/index.js +9 -6
- package/package.json +1 -1
- package/scripts/utils/loadPrisma.ts +1 -2
- /package/.next/static/{s_BjB5fnRbk2L3A0fMr5L → rEvucoSBXJWMKfLWTgPF2}/_buildManifest.js +0 -0
- /package/.next/static/{s_BjB5fnRbk2L3A0fMr5L → rEvucoSBXJWMKfLWTgPF2}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{s_BjB5fnRbk2L3A0fMr5L → rEvucoSBXJWMKfLWTgPF2}/_ssgManifest.js +0 -0
|
@@ -2,13 +2,13 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import { prisma } from '../../../../../../lib/prisma';
|
|
5
|
+
import { prisma as defaultPrisma } from '../../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { validate } from 'uuid';
|
|
8
8
|
import { serializeApiFunction } from '../../../../../../lib/functions/serializeApiFunction';
|
|
9
9
|
import { functionSchema } from '../../../../../../lib/functions/functionSchema';
|
|
10
10
|
import { updateFunction } from '../../../../../../lib/functions/updateFunction';
|
|
11
|
-
export const
|
|
11
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
12
12
|
const { assistantId, functionId } = await props.params;
|
|
13
13
|
const headersList = await headers();
|
|
14
14
|
const authorization = headersList.get('authorization');
|
|
@@ -18,6 +18,7 @@ export const GET = async (_request, props) => {
|
|
|
18
18
|
const privateApiKey = await getApiKey({
|
|
19
19
|
type: ApiKeyType.PRIVATE,
|
|
20
20
|
authorization,
|
|
21
|
+
prisma,
|
|
21
22
|
});
|
|
22
23
|
if (!privateApiKey) {
|
|
23
24
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -59,7 +60,8 @@ export const GET = async (_request, props) => {
|
|
|
59
60
|
function: serializeApiFunction({ fn }),
|
|
60
61
|
}, { headers: cacheHeaders });
|
|
61
62
|
};
|
|
62
|
-
export const
|
|
63
|
+
export const GET = buildGET();
|
|
64
|
+
export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
63
65
|
const { assistantId, functionId } = await props.params;
|
|
64
66
|
const headersList = await headers();
|
|
65
67
|
const authorization = headersList.get('authorization');
|
|
@@ -69,6 +71,7 @@ export const PATCH = async (request, props) => {
|
|
|
69
71
|
const privateApiKey = await getApiKey({
|
|
70
72
|
authorization,
|
|
71
73
|
type: ApiKeyType.PRIVATE,
|
|
74
|
+
prisma,
|
|
72
75
|
});
|
|
73
76
|
if (!privateApiKey) {
|
|
74
77
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -117,12 +120,14 @@ export const PATCH = async (request, props) => {
|
|
|
117
120
|
},
|
|
118
121
|
},
|
|
119
122
|
},
|
|
123
|
+
prisma,
|
|
120
124
|
});
|
|
121
125
|
return NextResponse.json({
|
|
122
126
|
function: serializeApiFunction({ fn: updatedFunction }),
|
|
123
127
|
}, { headers: cacheHeaders });
|
|
124
128
|
};
|
|
125
|
-
export const
|
|
129
|
+
export const PATCH = buildPATCH();
|
|
130
|
+
export const buildDELETE = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
126
131
|
const { assistantId, functionId } = await props.params;
|
|
127
132
|
const headersList = await headers();
|
|
128
133
|
const authorization = headersList.get('authorization');
|
|
@@ -132,6 +137,7 @@ export const DELETE = async (_request, props) => {
|
|
|
132
137
|
const privateApiKey = await getApiKey({
|
|
133
138
|
authorization,
|
|
134
139
|
type: ApiKeyType.PRIVATE,
|
|
140
|
+
prisma,
|
|
135
141
|
});
|
|
136
142
|
if (!privateApiKey) {
|
|
137
143
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -176,6 +182,7 @@ export const DELETE = async (_request, props) => {
|
|
|
176
182
|
mcpServer: serializeApiFunction({ fn: deletedFunction }),
|
|
177
183
|
}, { headers: cacheHeaders });
|
|
178
184
|
};
|
|
185
|
+
export const DELETE = buildDELETE();
|
|
179
186
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
180
187
|
headers: cacheHeaders,
|
|
181
188
|
});
|
|
@@ -1,4 +1,61 @@
|
|
|
1
1
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const buildGET: ({ prisma }?: {
|
|
4
|
+
prisma?: PrismaClient;
|
|
5
|
+
}) => (_request: NextRequest, props: {
|
|
6
|
+
params: Promise<{
|
|
7
|
+
assistantId: string;
|
|
8
|
+
}>;
|
|
9
|
+
}) => Promise<NextResponse<{
|
|
10
|
+
error: string;
|
|
11
|
+
}> | NextResponse<{
|
|
12
|
+
functions: {
|
|
13
|
+
id: string;
|
|
14
|
+
openapiSpec: PrismaJson.OpenapiSpec;
|
|
15
|
+
handler: {
|
|
16
|
+
deleteTaskHandler?: {
|
|
17
|
+
keyTemplate: string;
|
|
18
|
+
} | undefined;
|
|
19
|
+
updateTaskHandler?: {
|
|
20
|
+
keyTemplate: string;
|
|
21
|
+
} | undefined;
|
|
22
|
+
createTaskHandler?: {
|
|
23
|
+
keyTemplate: string;
|
|
24
|
+
} | undefined;
|
|
25
|
+
listTasksHandler?: {
|
|
26
|
+
keyTemplate: string;
|
|
27
|
+
} | undefined;
|
|
28
|
+
assistantHandler?: {
|
|
29
|
+
assistantId: string;
|
|
30
|
+
} | undefined;
|
|
31
|
+
clientToolHandler?: {
|
|
32
|
+
type: "FUNCTION";
|
|
33
|
+
name: string;
|
|
34
|
+
arguments: PrismaJson.ClientToolHandlerArguments;
|
|
35
|
+
} | undefined;
|
|
36
|
+
replicateHandler?: {
|
|
37
|
+
type: "RUN";
|
|
38
|
+
apiKey: string;
|
|
39
|
+
identifier: string;
|
|
40
|
+
body: PrismaJson.ReplicateHandlerBody;
|
|
41
|
+
} | undefined;
|
|
42
|
+
firecrawlHandler?: {
|
|
43
|
+
type: import("@prisma/client").$Enums.FirecrawlHandlerType;
|
|
44
|
+
apiKey: string;
|
|
45
|
+
body: PrismaJson.FirecrawlHandlerBody;
|
|
46
|
+
} | undefined;
|
|
47
|
+
requestHandler?: {
|
|
48
|
+
url: string;
|
|
49
|
+
method: import("@prisma/client").$Enums.MethodType;
|
|
50
|
+
headers: PrismaJson.RequestHandlerHeaders;
|
|
51
|
+
body: PrismaJson.RequestHandlerBody;
|
|
52
|
+
} | undefined;
|
|
53
|
+
type: import("@prisma/client").$Enums.HandlerType;
|
|
54
|
+
};
|
|
55
|
+
createdAt: string;
|
|
56
|
+
updatedAt: string;
|
|
57
|
+
}[];
|
|
58
|
+
}>>;
|
|
2
59
|
export declare const GET: (_request: NextRequest, props: {
|
|
3
60
|
params: Promise<{
|
|
4
61
|
assistantId: string;
|
|
@@ -53,6 +110,62 @@ export declare const GET: (_request: NextRequest, props: {
|
|
|
53
110
|
updatedAt: string;
|
|
54
111
|
}[];
|
|
55
112
|
}>>;
|
|
113
|
+
export declare const buildPOST: ({ prisma }?: {
|
|
114
|
+
prisma?: PrismaClient;
|
|
115
|
+
}) => (request: NextRequest, props: {
|
|
116
|
+
params: Promise<{
|
|
117
|
+
assistantId: string;
|
|
118
|
+
}>;
|
|
119
|
+
}) => Promise<NextResponse<{
|
|
120
|
+
error: string;
|
|
121
|
+
}> | NextResponse<{
|
|
122
|
+
function: {
|
|
123
|
+
id: string;
|
|
124
|
+
openapiSpec: PrismaJson.OpenapiSpec;
|
|
125
|
+
handler: {
|
|
126
|
+
deleteTaskHandler?: {
|
|
127
|
+
keyTemplate: string;
|
|
128
|
+
} | undefined;
|
|
129
|
+
updateTaskHandler?: {
|
|
130
|
+
keyTemplate: string;
|
|
131
|
+
} | undefined;
|
|
132
|
+
createTaskHandler?: {
|
|
133
|
+
keyTemplate: string;
|
|
134
|
+
} | undefined;
|
|
135
|
+
listTasksHandler?: {
|
|
136
|
+
keyTemplate: string;
|
|
137
|
+
} | undefined;
|
|
138
|
+
assistantHandler?: {
|
|
139
|
+
assistantId: string;
|
|
140
|
+
} | undefined;
|
|
141
|
+
clientToolHandler?: {
|
|
142
|
+
type: "FUNCTION";
|
|
143
|
+
name: string;
|
|
144
|
+
arguments: PrismaJson.ClientToolHandlerArguments;
|
|
145
|
+
} | undefined;
|
|
146
|
+
replicateHandler?: {
|
|
147
|
+
type: "RUN";
|
|
148
|
+
apiKey: string;
|
|
149
|
+
identifier: string;
|
|
150
|
+
body: PrismaJson.ReplicateHandlerBody;
|
|
151
|
+
} | undefined;
|
|
152
|
+
firecrawlHandler?: {
|
|
153
|
+
type: import("@prisma/client").$Enums.FirecrawlHandlerType;
|
|
154
|
+
apiKey: string;
|
|
155
|
+
body: PrismaJson.FirecrawlHandlerBody;
|
|
156
|
+
} | undefined;
|
|
157
|
+
requestHandler?: {
|
|
158
|
+
url: string;
|
|
159
|
+
method: import("@prisma/client").$Enums.MethodType;
|
|
160
|
+
headers: PrismaJson.RequestHandlerHeaders;
|
|
161
|
+
body: PrismaJson.RequestHandlerBody;
|
|
162
|
+
} | undefined;
|
|
163
|
+
type: import("@prisma/client").$Enums.HandlerType;
|
|
164
|
+
};
|
|
165
|
+
createdAt: string;
|
|
166
|
+
updatedAt: string;
|
|
167
|
+
};
|
|
168
|
+
}>>;
|
|
56
169
|
export declare const POST: (request: NextRequest, props: {
|
|
57
170
|
params: Promise<{
|
|
58
171
|
assistantId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/functions/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/functions/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS9D,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEpD,CAAA;AAEH,eAAO,MAAM,GAAG,aArEF,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoE1B,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEpD,CAAA;AAEH,eAAO,MAAM,IAAI,YAxEJ,WAAW,SACb;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuExB,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,12 +2,12 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { headers } from 'next/headers';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import { prisma } from '../../../../../lib/prisma';
|
|
5
|
+
import { prisma as defaultPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { serializeApiFunction } from '../../../../../lib/functions/serializeApiFunction';
|
|
8
8
|
import { functionSchema } from '../../../../../lib/functions/functionSchema';
|
|
9
9
|
import { createFunction } from '../../../../../lib/functions/createFunction';
|
|
10
|
-
export const
|
|
10
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
11
11
|
const { assistantId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -17,6 +17,7 @@ export const GET = async (_request, props) => {
|
|
|
17
17
|
const privateApiKey = await getApiKey({
|
|
18
18
|
type: ApiKeyType.PRIVATE,
|
|
19
19
|
authorization,
|
|
20
|
+
prisma,
|
|
20
21
|
});
|
|
21
22
|
if (!privateApiKey) {
|
|
22
23
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -58,7 +59,8 @@ export const GET = async (_request, props) => {
|
|
|
58
59
|
})),
|
|
59
60
|
}, { headers: cacheHeaders });
|
|
60
61
|
};
|
|
61
|
-
export const
|
|
62
|
+
export const GET = buildGET();
|
|
63
|
+
export const buildPOST = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
62
64
|
const { assistantId } = await props.params;
|
|
63
65
|
const headersList = await headers();
|
|
64
66
|
const authorization = headersList.get('authorization');
|
|
@@ -68,6 +70,7 @@ export const POST = async (request, props) => {
|
|
|
68
70
|
const privateApiKey = await getApiKey({
|
|
69
71
|
authorization,
|
|
70
72
|
type: ApiKeyType.PRIVATE,
|
|
73
|
+
prisma,
|
|
71
74
|
});
|
|
72
75
|
if (!privateApiKey) {
|
|
73
76
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -105,11 +108,13 @@ export const POST = async (request, props) => {
|
|
|
105
108
|
},
|
|
106
109
|
},
|
|
107
110
|
},
|
|
111
|
+
prisma,
|
|
108
112
|
});
|
|
109
113
|
return NextResponse.json({
|
|
110
114
|
function: serializeApiFunction({ fn }),
|
|
111
115
|
}, { headers: cacheHeaders });
|
|
112
116
|
};
|
|
117
|
+
export const POST = buildPOST();
|
|
113
118
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
114
119
|
headers: cacheHeaders,
|
|
115
120
|
});
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const buildGET: ({ prisma }?: {
|
|
4
|
+
prisma?: PrismaClient;
|
|
5
|
+
}) => (_request: NextRequest, props: {
|
|
6
|
+
params: Promise<{
|
|
7
|
+
assistantId: string;
|
|
8
|
+
}>;
|
|
9
|
+
}) => Promise<NextResponse<{
|
|
10
|
+
error: string;
|
|
11
|
+
}> | NextResponse<{
|
|
12
|
+
initialMessages: {
|
|
13
|
+
id: string;
|
|
14
|
+
role: import("@prisma/client").$Enums.MessageRole;
|
|
15
|
+
content: string;
|
|
16
|
+
orderNumber: number;
|
|
17
|
+
assistantId: string | null;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}[];
|
|
21
|
+
}>>;
|
|
2
22
|
export declare const GET: (_request: NextRequest, props: {
|
|
3
23
|
params: Promise<{
|
|
4
24
|
assistantId: string;
|
|
@@ -16,6 +36,25 @@ export declare const GET: (_request: NextRequest, props: {
|
|
|
16
36
|
updatedAt: string;
|
|
17
37
|
}[];
|
|
18
38
|
}>>;
|
|
39
|
+
export declare const buildPUT: ({ prisma }?: {
|
|
40
|
+
prisma?: PrismaClient;
|
|
41
|
+
}) => (request: NextRequest, props: {
|
|
42
|
+
params: Promise<{
|
|
43
|
+
assistantId: string;
|
|
44
|
+
}>;
|
|
45
|
+
}) => Promise<NextResponse<{
|
|
46
|
+
error: string;
|
|
47
|
+
}> | NextResponse<{
|
|
48
|
+
initialMessages: {
|
|
49
|
+
id: string;
|
|
50
|
+
role: import("@prisma/client").$Enums.MessageRole;
|
|
51
|
+
content: string;
|
|
52
|
+
orderNumber: number;
|
|
53
|
+
assistantId: string | null;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
updatedAt: string;
|
|
56
|
+
}[];
|
|
57
|
+
}>>;
|
|
19
58
|
export declare const PUT: (request: NextRequest, props: {
|
|
20
59
|
params: Promise<{
|
|
21
60
|
assistantId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/initial-messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/initial-messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAA8B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAS9E,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;GAiDpD,CAAA;AAEH,eAAO,MAAM,GAAG,aApDF,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;GAmD1B,CAAA;AAE7B,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;GAwDpD,CAAA;AAEH,eAAO,MAAM,GAAG,YA3DH,WAAW,SACb;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;GA0D1B,CAAA;AAE7B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,12 +2,12 @@ import { NextResponse } from 'next/server';
|
|
|
2
2
|
import { ApiKeyType } from '@prisma/client';
|
|
3
3
|
import { headers } from 'next/headers';
|
|
4
4
|
import { cacheHeaders } from '../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import { prisma } from '../../../../../lib/prisma';
|
|
5
|
+
import { prisma as defaultPrisma } from '../../../../../lib/prisma';
|
|
6
6
|
import { serializeApiInitialMessage } from '../../../../../lib/initialMessages/serializeApiInitialMessage';
|
|
7
7
|
import { initialMessagesSchema } from '../../../../../lib/initialMessages/schema';
|
|
8
8
|
import { updateInitialMessages } from '../../../../../lib/initialMessages/updateInitialMessages';
|
|
9
9
|
import { getApiKey } from '../../../../../lib/apiKeys/getApiKey';
|
|
10
|
-
export const
|
|
10
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
11
11
|
const { assistantId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -17,6 +17,7 @@ export const GET = async (_request, props) => {
|
|
|
17
17
|
const privateApiKey = await getApiKey({
|
|
18
18
|
type: ApiKeyType.PRIVATE,
|
|
19
19
|
authorization,
|
|
20
|
+
prisma,
|
|
20
21
|
});
|
|
21
22
|
if (!privateApiKey) {
|
|
22
23
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -41,7 +42,8 @@ export const GET = async (_request, props) => {
|
|
|
41
42
|
initialMessages: assistant.initialMessages.map((m) => serializeApiInitialMessage({ initialMessage: m })),
|
|
42
43
|
}, { headers: cacheHeaders });
|
|
43
44
|
};
|
|
44
|
-
export const
|
|
45
|
+
export const GET = buildGET();
|
|
46
|
+
export const buildPUT = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
45
47
|
const { assistantId } = await props.params;
|
|
46
48
|
const headersList = await headers();
|
|
47
49
|
const authorization = headersList.get('authorization');
|
|
@@ -51,6 +53,7 @@ export const PUT = async (request, props) => {
|
|
|
51
53
|
const privateApiKey = await getApiKey({
|
|
52
54
|
authorization,
|
|
53
55
|
type: ApiKeyType.PRIVATE,
|
|
56
|
+
prisma,
|
|
54
57
|
});
|
|
55
58
|
if (!privateApiKey) {
|
|
56
59
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -73,11 +76,13 @@ export const PUT = async (request, props) => {
|
|
|
73
76
|
const messages = await updateInitialMessages({
|
|
74
77
|
assistantId: assistant.id,
|
|
75
78
|
initialMessages,
|
|
79
|
+
prisma,
|
|
76
80
|
});
|
|
77
81
|
return NextResponse.json({
|
|
78
82
|
initialMessages: messages.map((m) => serializeApiInitialMessage({ initialMessage: m })),
|
|
79
83
|
}, { headers: cacheHeaders });
|
|
80
84
|
};
|
|
85
|
+
export const PUT = buildPUT();
|
|
81
86
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
82
87
|
headers: cacheHeaders,
|
|
83
88
|
});
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
+
import { type PrismaClient } from '@prisma/client';
|
|
1
2
|
import { NextResponse, type NextRequest } from 'next/server';
|
|
3
|
+
export declare const buildGET: ({ prisma }?: {
|
|
4
|
+
prisma?: PrismaClient;
|
|
5
|
+
}) => (_request: NextRequest, props: {
|
|
6
|
+
params: Promise<{
|
|
7
|
+
assistantId: string;
|
|
8
|
+
mcpServerId: string;
|
|
9
|
+
}>;
|
|
10
|
+
}) => Promise<NextResponse<{
|
|
11
|
+
error: string;
|
|
12
|
+
}> | NextResponse<{
|
|
13
|
+
mcpServer: {
|
|
14
|
+
id: string;
|
|
15
|
+
transportType: import("@prisma/client").$Enums.TransportType;
|
|
16
|
+
sseTransport: {
|
|
17
|
+
id: string;
|
|
18
|
+
url: string;
|
|
19
|
+
headers: PrismaJson.SseTransportHeaders;
|
|
20
|
+
createdAt: string;
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
} | null;
|
|
23
|
+
httpTransport: {
|
|
24
|
+
id: string;
|
|
25
|
+
url: string;
|
|
26
|
+
headers: PrismaJson.HttpTransportHeaders;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
} | null;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
};
|
|
33
|
+
}>>;
|
|
2
34
|
export declare const GET: (_request: NextRequest, props: {
|
|
3
35
|
params: Promise<{
|
|
4
36
|
assistantId: string;
|
|
@@ -28,6 +60,37 @@ export declare const GET: (_request: NextRequest, props: {
|
|
|
28
60
|
updatedAt: string;
|
|
29
61
|
};
|
|
30
62
|
}>>;
|
|
63
|
+
export declare const buildPATCH: ({ prisma }?: {
|
|
64
|
+
prisma?: PrismaClient;
|
|
65
|
+
}) => (request: NextRequest, props: {
|
|
66
|
+
params: Promise<{
|
|
67
|
+
assistantId: string;
|
|
68
|
+
mcpServerId: string;
|
|
69
|
+
}>;
|
|
70
|
+
}) => Promise<NextResponse<{
|
|
71
|
+
error: string;
|
|
72
|
+
}> | NextResponse<{
|
|
73
|
+
mcpServer: {
|
|
74
|
+
id: string;
|
|
75
|
+
transportType: import("@prisma/client").$Enums.TransportType;
|
|
76
|
+
sseTransport: {
|
|
77
|
+
id: string;
|
|
78
|
+
url: string;
|
|
79
|
+
headers: PrismaJson.SseTransportHeaders;
|
|
80
|
+
createdAt: string;
|
|
81
|
+
updatedAt: string;
|
|
82
|
+
} | null;
|
|
83
|
+
httpTransport: {
|
|
84
|
+
id: string;
|
|
85
|
+
url: string;
|
|
86
|
+
headers: PrismaJson.HttpTransportHeaders;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
updatedAt: string;
|
|
89
|
+
} | null;
|
|
90
|
+
createdAt: string;
|
|
91
|
+
updatedAt: string;
|
|
92
|
+
};
|
|
93
|
+
}>>;
|
|
31
94
|
export declare const PATCH: (request: NextRequest, props: {
|
|
32
95
|
params: Promise<{
|
|
33
96
|
assistantId: string;
|
|
@@ -57,6 +120,37 @@ export declare const PATCH: (request: NextRequest, props: {
|
|
|
57
120
|
updatedAt: string;
|
|
58
121
|
};
|
|
59
122
|
}>>;
|
|
123
|
+
export declare const buildDELETE: ({ prisma }?: {
|
|
124
|
+
prisma?: PrismaClient;
|
|
125
|
+
}) => (_request: NextRequest, props: {
|
|
126
|
+
params: Promise<{
|
|
127
|
+
assistantId: string;
|
|
128
|
+
mcpServerId: string;
|
|
129
|
+
}>;
|
|
130
|
+
}) => Promise<NextResponse<{
|
|
131
|
+
error: string;
|
|
132
|
+
}> | NextResponse<{
|
|
133
|
+
mcpServer: {
|
|
134
|
+
id: string;
|
|
135
|
+
transportType: import("@prisma/client").$Enums.TransportType;
|
|
136
|
+
sseTransport: {
|
|
137
|
+
id: string;
|
|
138
|
+
url: string;
|
|
139
|
+
headers: PrismaJson.SseTransportHeaders;
|
|
140
|
+
createdAt: string;
|
|
141
|
+
updatedAt: string;
|
|
142
|
+
} | null;
|
|
143
|
+
httpTransport: {
|
|
144
|
+
id: string;
|
|
145
|
+
url: string;
|
|
146
|
+
headers: PrismaJson.HttpTransportHeaders;
|
|
147
|
+
createdAt: string;
|
|
148
|
+
updatedAt: string;
|
|
149
|
+
} | null;
|
|
150
|
+
createdAt: string;
|
|
151
|
+
updatedAt: string;
|
|
152
|
+
};
|
|
153
|
+
}>>;
|
|
60
154
|
export declare const DELETE: (_request: NextRequest, props: {
|
|
61
155
|
params: Promise<{
|
|
62
156
|
assistantId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts"],"names":[],"mappings":"AACA,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AAQ5D,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAgEzE,CAAA;AAEH,eAAO,MAAM,GAAG,aAnEF,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAkE/C,CAAA;AAE7B,eAAO,MAAM,UAAU,GACpB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAuGzE,CAAA;AAEH,eAAO,MAAM,KAAK,YA1GL,WAAW,SACb;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAyG3C,CAAA;AAEjC,eAAO,MAAM,WAAW,GACrB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAoEzE,CAAA;AAEH,eAAO,MAAM,MAAM,aAvEL,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAsEzC,CAAA;AAEnC,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|
|
@@ -2,12 +2,12 @@ import { headers } from 'next/headers';
|
|
|
2
2
|
import { ApiKeyType, TransportType } from '@prisma/client';
|
|
3
3
|
import { NextResponse } from 'next/server';
|
|
4
4
|
import { cacheHeaders } from '../../../../../../lib/cache/cacheHeaders';
|
|
5
|
-
import { prisma } from '../../../../../../lib/prisma';
|
|
5
|
+
import { prisma as defaultPrisma } from '../../../../../../lib/prisma';
|
|
6
6
|
import { getApiKey } from '../../../../../../lib/apiKeys/getApiKey';
|
|
7
7
|
import { validate } from 'uuid';
|
|
8
8
|
import { serializeApiMcpServer } from '../../../../../../lib/mcpServers/serializeApiMcpServer';
|
|
9
9
|
import { mcpServerSchema } from '../../../../../../lib/mcpServers/mcpServerSchema';
|
|
10
|
-
export const
|
|
10
|
+
export const buildGET = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
11
11
|
const { assistantId, mcpServerId } = await props.params;
|
|
12
12
|
const headersList = await headers();
|
|
13
13
|
const authorization = headersList.get('authorization');
|
|
@@ -17,6 +17,7 @@ export const GET = async (_request, props) => {
|
|
|
17
17
|
const privateApiKey = await getApiKey({
|
|
18
18
|
type: ApiKeyType.PRIVATE,
|
|
19
19
|
authorization,
|
|
20
|
+
prisma,
|
|
20
21
|
});
|
|
21
22
|
if (!privateApiKey) {
|
|
22
23
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -47,7 +48,8 @@ export const GET = async (_request, props) => {
|
|
|
47
48
|
mcpServer: serializeApiMcpServer({ mcpServer }),
|
|
48
49
|
}, { headers: cacheHeaders });
|
|
49
50
|
};
|
|
50
|
-
export const
|
|
51
|
+
export const GET = buildGET();
|
|
52
|
+
export const buildPATCH = ({ prisma = defaultPrisma } = {}) => async (request, props) => {
|
|
51
53
|
const { assistantId, mcpServerId } = await props.params;
|
|
52
54
|
const headersList = await headers();
|
|
53
55
|
const authorization = headersList.get('authorization');
|
|
@@ -57,6 +59,7 @@ export const PATCH = async (request, props) => {
|
|
|
57
59
|
const privateApiKey = await getApiKey({
|
|
58
60
|
authorization,
|
|
59
61
|
type: ApiKeyType.PRIVATE,
|
|
62
|
+
prisma,
|
|
60
63
|
});
|
|
61
64
|
if (!privateApiKey) {
|
|
62
65
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -117,7 +120,8 @@ export const PATCH = async (request, props) => {
|
|
|
117
120
|
mcpServer: serializeApiMcpServer({ mcpServer: updatedMcpServer }),
|
|
118
121
|
}, { headers: cacheHeaders });
|
|
119
122
|
};
|
|
120
|
-
export const
|
|
123
|
+
export const PATCH = buildPATCH();
|
|
124
|
+
export const buildDELETE = ({ prisma = defaultPrisma } = {}) => async (_request, props) => {
|
|
121
125
|
const { assistantId, mcpServerId } = await props.params;
|
|
122
126
|
const headersList = await headers();
|
|
123
127
|
const authorization = headersList.get('authorization');
|
|
@@ -127,6 +131,7 @@ export const DELETE = async (_request, props) => {
|
|
|
127
131
|
const privateApiKey = await getApiKey({
|
|
128
132
|
authorization,
|
|
129
133
|
type: ApiKeyType.PRIVATE,
|
|
134
|
+
prisma,
|
|
130
135
|
});
|
|
131
136
|
if (!privateApiKey) {
|
|
132
137
|
return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
|
|
@@ -160,6 +165,7 @@ export const DELETE = async (_request, props) => {
|
|
|
160
165
|
mcpServer: serializeApiMcpServer({ mcpServer: deletedMcpServer }),
|
|
161
166
|
}, { headers: cacheHeaders });
|
|
162
167
|
};
|
|
168
|
+
export const DELETE = buildDELETE();
|
|
163
169
|
export const OPTIONS = () => NextResponse.json({}, {
|
|
164
170
|
headers: cacheHeaders,
|
|
165
171
|
});
|
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
import { type NextRequest, NextResponse } from 'next/server';
|
|
2
|
+
import { type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const buildGET: ({ prisma }?: {
|
|
4
|
+
prisma?: PrismaClient;
|
|
5
|
+
}) => (_request: NextRequest, props: {
|
|
6
|
+
params: Promise<{
|
|
7
|
+
assistantId: string;
|
|
8
|
+
}>;
|
|
9
|
+
}) => Promise<NextResponse<{
|
|
10
|
+
error: string;
|
|
11
|
+
}> | NextResponse<{
|
|
12
|
+
mcpServers: {
|
|
13
|
+
id: string;
|
|
14
|
+
transportType: import("@prisma/client").$Enums.TransportType;
|
|
15
|
+
sseTransport: {
|
|
16
|
+
id: string;
|
|
17
|
+
url: string;
|
|
18
|
+
headers: PrismaJson.SseTransportHeaders;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
} | null;
|
|
22
|
+
httpTransport: {
|
|
23
|
+
id: string;
|
|
24
|
+
url: string;
|
|
25
|
+
headers: PrismaJson.HttpTransportHeaders;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
} | null;
|
|
29
|
+
createdAt: string;
|
|
30
|
+
updatedAt: string;
|
|
31
|
+
}[];
|
|
32
|
+
}>>;
|
|
2
33
|
export declare const GET: (_request: NextRequest, props: {
|
|
3
34
|
params: Promise<{
|
|
4
35
|
assistantId: string;
|
|
@@ -27,6 +58,36 @@ export declare const GET: (_request: NextRequest, props: {
|
|
|
27
58
|
updatedAt: string;
|
|
28
59
|
}[];
|
|
29
60
|
}>>;
|
|
61
|
+
export declare const buildPOST: ({ prisma }?: {
|
|
62
|
+
prisma?: PrismaClient;
|
|
63
|
+
}) => (request: NextRequest, props: {
|
|
64
|
+
params: Promise<{
|
|
65
|
+
assistantId: string;
|
|
66
|
+
}>;
|
|
67
|
+
}) => Promise<NextResponse<{
|
|
68
|
+
error: string;
|
|
69
|
+
}> | NextResponse<{
|
|
70
|
+
mcpServer: {
|
|
71
|
+
id: string;
|
|
72
|
+
transportType: import("@prisma/client").$Enums.TransportType;
|
|
73
|
+
sseTransport: {
|
|
74
|
+
id: string;
|
|
75
|
+
url: string;
|
|
76
|
+
headers: PrismaJson.SseTransportHeaders;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
updatedAt: string;
|
|
79
|
+
} | null;
|
|
80
|
+
httpTransport: {
|
|
81
|
+
id: string;
|
|
82
|
+
url: string;
|
|
83
|
+
headers: PrismaJson.HttpTransportHeaders;
|
|
84
|
+
createdAt: string;
|
|
85
|
+
updatedAt: string;
|
|
86
|
+
} | null;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
updatedAt: string;
|
|
89
|
+
};
|
|
90
|
+
}>>;
|
|
30
91
|
export declare const POST: (request: NextRequest, props: {
|
|
31
92
|
params: Promise<{
|
|
32
93
|
assistantId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../../../src/app/api/assistants/[assistantId]/mcp-servers/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAA6B,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQ7E,eAAO,MAAM,QAAQ,GAClB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,UAAU,WAAW,EACrB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAwDpD,CAAA;AAEH,eAAO,MAAM,GAAG,aA3DF,WAAW,SACd;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GA0D1B,CAAA;AAE7B,eAAO,MAAM,SAAS,GACnB,aAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MAEzD,SAAS,WAAW,EACpB,OAAO;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAqFpD,CAAA;AAEH,eAAO,MAAM,IAAI,YAxFJ,WAAW,SACb;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;GAuFxB,CAAA;AAE/B,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
|