@superinterface/server 1.0.17 → 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/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 +2 -2
- package/scripts/utils/loadPrisma.ts +1 -2
- /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_buildManifest.js +0 -0
- /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_ssgManifest.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { forEach } from 'p-iteration';
|
|
2
2
|
import { connectMcpServer } from '../../lib/mcpServers/connectMcpServer';
|
|
3
3
|
import { closeMcpConnection } from '../../lib/mcpServers/closeMcpConnection';
|
|
4
|
-
export const getToolCallMcpServer = async ({ assistant, toolCall, thread, }) => {
|
|
4
|
+
export const getToolCallMcpServer = async ({ assistant, toolCall, thread, prisma, }) => {
|
|
5
5
|
let mcpConnection = null;
|
|
6
6
|
await forEach(assistant.mcpServers, async (mcpServer) => {
|
|
7
7
|
if (mcpConnection)
|
|
@@ -10,6 +10,7 @@ export const getToolCallMcpServer = async ({ assistant, toolCall, thread, }) =>
|
|
|
10
10
|
mcpServer,
|
|
11
11
|
thread,
|
|
12
12
|
assistant,
|
|
13
|
+
prisma,
|
|
13
14
|
});
|
|
14
15
|
const listToolsResponse =
|
|
15
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Prisma, Thread, Assistant } from '@prisma/client';
|
|
2
|
-
export declare const headers: ({ thread, mcpServer, assistant, }: {
|
|
1
|
+
import type { Prisma, Thread, Assistant, PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const headers: ({ thread, mcpServer, assistant, prisma, }: {
|
|
3
3
|
thread: Thread;
|
|
4
4
|
mcpServer: Prisma.McpServerGetPayload<{
|
|
5
5
|
include: {
|
|
@@ -8,6 +8,7 @@ export declare const headers: ({ thread, mcpServer, assistant, }: {
|
|
|
8
8
|
};
|
|
9
9
|
}>;
|
|
10
10
|
assistant: Assistant;
|
|
11
|
+
prisma: PrismaClient;
|
|
11
12
|
}) => {
|
|
12
13
|
[k: string]: string;
|
|
13
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"headers.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAgE7E,eAAO,MAAM,OAAO,GAAI,2CAKrB;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,aAAa,EAAE,IAAI,CAAA;YACnB,YAAY,EAAE,IAAI,CAAA;SACnB,CAAA;KACF,CAAC,CAAA;IACF,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;CACrB;;CAoCA,CAAA"}
|
|
@@ -26,7 +26,7 @@ const interpolatedTransportHeaders = ({ mcpServer, thread, metadata, assistant,
|
|
|
26
26
|
}
|
|
27
27
|
return { headers: result, missing };
|
|
28
28
|
};
|
|
29
|
-
export const headers = ({ thread, mcpServer, assistant, }) => {
|
|
29
|
+
export const headers = ({ thread, mcpServer, assistant, prisma, }) => {
|
|
30
30
|
var _a, _b;
|
|
31
31
|
const { headers, missing } = interpolatedTransportHeaders({
|
|
32
32
|
mcpServer,
|
|
@@ -47,6 +47,7 @@ export const headers = ({ thread, mcpServer, assistant, }) => {
|
|
|
47
47
|
assistantId: assistant.id,
|
|
48
48
|
threadId: thread.id,
|
|
49
49
|
},
|
|
50
|
+
prisma,
|
|
50
51
|
});
|
|
51
52
|
throw new Error(message);
|
|
52
53
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Prisma, Thread, Assistant } from '@prisma/client';
|
|
2
|
-
export declare const url: ({ thread, mcpServer, assistant, }: {
|
|
1
|
+
import type { Prisma, Thread, Assistant, PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const url: ({ thread, mcpServer, assistant, prisma, }: {
|
|
3
3
|
thread: Thread;
|
|
4
4
|
mcpServer: Prisma.McpServerGetPayload<{
|
|
5
5
|
include: {
|
|
@@ -8,5 +8,6 @@ export declare const url: ({ thread, mcpServer, assistant, }: {
|
|
|
8
8
|
};
|
|
9
9
|
}>;
|
|
10
10
|
assistant: Assistant;
|
|
11
|
+
prisma: PrismaClient;
|
|
11
12
|
}) => string;
|
|
12
13
|
//# sourceMappingURL=url.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAwD7E,eAAO,MAAM,GAAG,GAAI,2CAKjB;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,aAAa,EAAE,IAAI,CAAA;YACnB,YAAY,EAAE,IAAI,CAAA;SACnB,CAAA;KACF,CAAC,CAAA;IACF,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;CACrB,WA6BA,CAAA"}
|
|
@@ -19,7 +19,7 @@ const interpolatedTransportUrl = ({ mcpServer, thread, metadata, assistant, }) =
|
|
|
19
19
|
});
|
|
20
20
|
return { url: value, missing };
|
|
21
21
|
};
|
|
22
|
-
export const url = ({ thread, mcpServer, assistant, }) => {
|
|
22
|
+
export const url = ({ thread, mcpServer, assistant, prisma, }) => {
|
|
23
23
|
var _a;
|
|
24
24
|
const { url, missing } = interpolatedTransportUrl({
|
|
25
25
|
mcpServer,
|
|
@@ -40,6 +40,7 @@ export const url = ({ thread, mcpServer, assistant, }) => {
|
|
|
40
40
|
assistantId: assistant.id,
|
|
41
41
|
threadId: thread.id,
|
|
42
42
|
},
|
|
43
|
+
prisma,
|
|
43
44
|
});
|
|
44
45
|
throw new Error(message);
|
|
45
46
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { type PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const serializeMetadata: ({ variables, workspaceId, prisma, }: {
|
|
2
3
|
variables: Record<string, any>;
|
|
3
4
|
workspaceId: string;
|
|
5
|
+
prisma: PrismaClient;
|
|
4
6
|
}) => Record<string, string>;
|
|
5
7
|
//# sourceMappingURL=serializeMetadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializeMetadata.d.ts","sourceRoot":"","sources":["../../../src/lib/metadata/serializeMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serializeMetadata.d.ts","sourceRoot":"","sources":["../../../src/lib/metadata/serializeMetadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAGvB,eAAO,MAAM,iBAAiB,GAAI,qCAI/B;IAED,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,EAAE,YAAY,CAAA;CACrB,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAwBxB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LogRequestMethod, LogRequestRoute, LogLevel } from '@prisma/client';
|
|
1
|
+
import { LogRequestMethod, LogRequestRoute, LogLevel, } from '@prisma/client';
|
|
2
2
|
import { createLog } from '../../lib/logs/createLog';
|
|
3
|
-
export const serializeMetadata = ({ variables, workspaceId, }) => {
|
|
3
|
+
export const serializeMetadata = ({ variables, workspaceId, prisma, }) => {
|
|
4
4
|
const metadata = {};
|
|
5
5
|
for (const [key, value] of Object.entries(variables)) {
|
|
6
6
|
try {
|
|
@@ -16,6 +16,7 @@ export const serializeMetadata = ({ variables, workspaceId, }) => {
|
|
|
16
16
|
message: `Failed to serialize key "${key}": ${error instanceof Error ? error.message : String(error)}`,
|
|
17
17
|
workspaceId,
|
|
18
18
|
},
|
|
19
|
+
prisma,
|
|
19
20
|
});
|
|
20
21
|
}
|
|
21
22
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { OrganizationApiKey } from '@prisma/client';
|
|
2
|
-
export declare const getOrganizationApiKey: ({ authorization, }: {
|
|
1
|
+
import type { OrganizationApiKey, PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const getOrganizationApiKey: ({ authorization, prisma, }: {
|
|
3
3
|
authorization: string | null;
|
|
4
|
+
prisma: PrismaClient;
|
|
4
5
|
}) => Promise<OrganizationApiKey | null>;
|
|
5
6
|
//# sourceMappingURL=getOrganizationApiKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOrganizationApiKey.d.ts","sourceRoot":"","sources":["../../../src/lib/organizationApiKeys/getOrganizationApiKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"getOrganizationApiKey.d.ts","sourceRoot":"","sources":["../../../src/lib/organizationApiKeys/getOrganizationApiKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAGtE,eAAO,MAAM,qBAAqB,GAAU,4BAGzC;IACD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,MAAM,EAAE,YAAY,CAAA;CACrB,KAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAcpC,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { validate } from 'uuid';
|
|
2
|
-
|
|
3
|
-
export const getOrganizationApiKey = async ({ authorization, }) => {
|
|
2
|
+
export const getOrganizationApiKey = async ({ authorization, prisma, }) => {
|
|
4
3
|
if (!authorization) {
|
|
5
4
|
return null;
|
|
6
5
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpenAI } from 'openai';
|
|
2
|
-
import { Prisma, Thread } from '@prisma/client';
|
|
3
|
-
export declare const createRunOpts: ({ assistant, thread, }: {
|
|
2
|
+
import { Prisma, Thread, PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const createRunOpts: ({ assistant, thread, prisma, }: {
|
|
4
4
|
assistant: Prisma.AssistantGetPayload<{
|
|
5
5
|
include: {
|
|
6
6
|
tools: {
|
|
@@ -25,6 +25,7 @@ export declare const createRunOpts: ({ assistant, thread, }: {
|
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
thread: Thread;
|
|
28
|
+
prisma: PrismaClient;
|
|
28
29
|
}) => Promise<{
|
|
29
30
|
tools?: undefined;
|
|
30
31
|
model: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRunOpts.d.ts","sourceRoot":"","sources":["../../../src/lib/runs/createRunOpts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"createRunOpts.d.ts","sourceRoot":"","sources":["../../../src/lib/runs/createRunOpts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EACL,MAAM,EACN,MAAM,EAGN,YAAY,EACb,MAAM,gBAAgB,CAAA;AA2CvB,eAAO,MAAM,aAAa,GAAU,gCAIjC;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,OAAO,EAAE;oBACP,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,mBAAmB,EAAE,IAAI,CAAA;oBACzB,mBAAmB,EAAE,IAAI,CAAA;oBACzB,eAAe,EAAE,IAAI,CAAA;iBACtB,CAAA;aACF,CAAA;YACD,SAAS,EAAE,IAAI,CAAA;YACf,aAAa,EAAE,IAAI,CAAA;YACnB,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,eAAe,EAAE,IAAI,CAAA;oBACrB,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,YAAY,EAAE,IAAI,CAAA;iBACnB,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TruncationType } from '@prisma/client';
|
|
1
|
+
import { TruncationType, } from '@prisma/client';
|
|
2
2
|
import { storageAssistantId } from '../../lib/assistants/storageAssistantId';
|
|
3
3
|
import { tools } from '../../lib/tools/tools';
|
|
4
4
|
import { isOpenaiAssistantsStorageProvider } from '../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
@@ -36,4 +36,4 @@ const truncationStrategy = ({ assistant }) => {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
export const createRunOpts = async ({ assistant, thread, }) => (Object.assign(Object.assign(Object.assign({ stream: true, assistant_id: storageAssistantId({ assistant }) }, instructions({ assistant })), { model: assistant.modelSlug, truncation_strategy: truncationStrategy({ assistant }) }), (await tools({ assistant, thread }))));
|
|
39
|
+
export const createRunOpts = async ({ assistant, thread, prisma, }) => (Object.assign(Object.assign(Object.assign({ stream: true, assistant_id: storageAssistantId({ assistant }) }, instructions({ assistant })), { model: assistant.modelSlug, truncation_strategy: truncationStrategy({ assistant }) }), (await tools({ assistant, thread, prisma }))));
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Assistant, Thread } from '@prisma/client';
|
|
2
|
-
export declare const getTaskToolKey: ({ thread, assistant, keyTemplate, }: {
|
|
1
|
+
import { Assistant, Thread, PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const getTaskToolKey: ({ thread, assistant, keyTemplate, prisma, }: {
|
|
3
3
|
thread: Thread;
|
|
4
4
|
assistant: Assistant;
|
|
5
5
|
keyTemplate: string | null;
|
|
6
|
+
prisma: PrismaClient;
|
|
6
7
|
}) => Promise<{
|
|
7
8
|
ok: false;
|
|
8
9
|
error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTaskToolKey.d.ts","sourceRoot":"","sources":["../../../src/lib/tasks/getTaskToolKey.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"getTaskToolKey.d.ts","sourceRoot":"","sources":["../../../src/lib/tasks/getTaskToolKey.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,MAAM,EAIN,YAAY,EACb,MAAM,gBAAgB,CAAA;AAGvB,eAAO,MAAM,cAAc,GAAU,6CAKlC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,MAAM,EAAE,YAAY,CAAA;CACrB;;;;;;;;EAgCA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogRequestMethod, LogRequestRoute, LogLevel, } from '@prisma/client';
|
|
2
2
|
import { createLog } from '../../lib/logs/createLog';
|
|
3
|
-
export const getTaskToolKey = async ({ thread, assistant, keyTemplate, }) => {
|
|
3
|
+
export const getTaskToolKey = async ({ thread, assistant, keyTemplate, prisma, }) => {
|
|
4
4
|
const missing = [];
|
|
5
5
|
const key = (keyTemplate || '').replace(/{{\s*([\w-]+)\s*}}/g, (_, k) => {
|
|
6
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -26,6 +26,7 @@ export const getTaskToolKey = async ({ thread, assistant, keyTemplate, }) => {
|
|
|
26
26
|
assistantId: assistant.id,
|
|
27
27
|
threadId: thread.id,
|
|
28
28
|
},
|
|
29
|
+
prisma,
|
|
29
30
|
});
|
|
30
31
|
return { ok: false, error: message };
|
|
31
32
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const parseTaskToolArgs: ({ toolCall, assistant, thread, }: {
|
|
2
|
+
import { Assistant, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const parseTaskToolArgs: ({ toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
5
5
|
assistant: Assistant;
|
|
6
6
|
thread: Thread;
|
|
7
|
+
prisma: PrismaClient;
|
|
7
8
|
}) => {
|
|
8
9
|
ok: false;
|
|
9
10
|
error: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseTaskToolArgs.d.ts","sourceRoot":"","sources":["../../../src/lib/tasks/parseTaskToolArgs.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"parseTaskToolArgs.d.ts","sourceRoot":"","sources":["../../../src/lib/tasks/parseTaskToolArgs.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,SAAS,EACT,MAAM,EAIN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAuBvB,eAAO,MAAM,iBAAiB,GAAI,0CAK/B;IACD,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAA;IACjE,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;;;;;;CAiEA,CAAA"}
|
|
@@ -13,7 +13,7 @@ const formatCurrentTime = ({ schedule, }) => {
|
|
|
13
13
|
}
|
|
14
14
|
return `${dayjs().toISOString()} in UTC`;
|
|
15
15
|
};
|
|
16
|
-
export const parseTaskToolArgs = ({ toolCall, assistant, thread, }) => {
|
|
16
|
+
export const parseTaskToolArgs = ({ toolCall, assistant, thread, prisma, }) => {
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
18
|
let args = {};
|
|
19
19
|
try {
|
|
@@ -32,6 +32,7 @@ export const parseTaskToolArgs = ({ toolCall, assistant, thread, }) => {
|
|
|
32
32
|
assistantId: assistant.id,
|
|
33
33
|
threadId: thread.id,
|
|
34
34
|
},
|
|
35
|
+
prisma,
|
|
35
36
|
});
|
|
36
37
|
return { ok: false, error: 'Invalid arguments.' };
|
|
37
38
|
}
|
|
@@ -49,6 +50,7 @@ export const parseTaskToolArgs = ({ toolCall, assistant, thread, }) => {
|
|
|
49
50
|
assistantId: assistant.id,
|
|
50
51
|
threadId: thread.id,
|
|
51
52
|
},
|
|
53
|
+
prisma,
|
|
52
54
|
});
|
|
53
55
|
return { ok: false, error: parsed.error.toString() };
|
|
54
56
|
}
|
|
@@ -66,6 +68,7 @@ export const parseTaskToolArgs = ({ toolCall, assistant, thread, }) => {
|
|
|
66
68
|
assistantId: assistant.id,
|
|
67
69
|
threadId: thread.id,
|
|
68
70
|
},
|
|
71
|
+
prisma,
|
|
69
72
|
});
|
|
70
73
|
return { ok: false, error: message };
|
|
71
74
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Task } from '@prisma/client';
|
|
2
|
-
export declare const scheduleTask: ({ task }: {
|
|
1
|
+
import { type Task, type PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const scheduleTask: ({ task, prisma, }: {
|
|
3
3
|
task: Task;
|
|
4
|
+
prisma: PrismaClient;
|
|
4
5
|
}) => Promise<void>;
|
|
5
6
|
//# sourceMappingURL=scheduleTask.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scheduleTask.d.ts","sourceRoot":"","sources":["../../../src/lib/tasks/scheduleTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"scheduleTask.d.ts","sourceRoot":"","sources":["../../../src/lib/tasks/scheduleTask.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAM7D,eAAO,MAAM,YAAY,GAAU,mBAGhC;IACD,IAAI,EAAE,IAAI,CAAA;IACV,MAAM,EAAE,YAAY,CAAA;CACrB,kBAwBA,CAAA"}
|
|
@@ -2,11 +2,10 @@ import dayjs from 'dayjs';
|
|
|
2
2
|
import utc from 'dayjs/plugin/utc';
|
|
3
3
|
import timezone from 'dayjs/plugin/timezone';
|
|
4
4
|
import { qstash } from '../../lib/upstash/qstash';
|
|
5
|
-
import { prisma } from '../../lib/prisma';
|
|
6
5
|
import { getNextOccurrence } from './getNextOccurrence';
|
|
7
6
|
dayjs.extend(utc);
|
|
8
7
|
dayjs.extend(timezone);
|
|
9
|
-
export const scheduleTask = async ({ task }) => {
|
|
8
|
+
export const scheduleTask = async ({ task, prisma, }) => {
|
|
10
9
|
if (!task.schedule || typeof task.schedule !== 'object')
|
|
11
10
|
return;
|
|
12
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -16,12 +16,12 @@ export declare const createThread: ({ client, assistant, prisma, variables, }: {
|
|
|
16
16
|
};
|
|
17
17
|
} & {
|
|
18
18
|
id: string;
|
|
19
|
-
createdAt: Date;
|
|
20
|
-
updatedAt: Date;
|
|
21
|
-
assistantId: string;
|
|
22
19
|
openaiThreadId: string | null;
|
|
23
20
|
openaiConversationId: string | null;
|
|
24
21
|
azureOpenaiConversationId: string | null;
|
|
22
|
+
assistantId: string;
|
|
25
23
|
metadata: PrismaJson.ThreadMetadata | null;
|
|
24
|
+
createdAt: Date;
|
|
25
|
+
updatedAt: Date;
|
|
26
26
|
}>;
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/threads/createThread/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAKrD,eAAO,MAAM,YAAY,GAAU,2CAKhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,eAAe,EAAE,IAAI,CAAA;YACrB,aAAa,EAAE,IAAI,CAAA;SACpB,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,YAAY,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/threads/createThread/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAKrD,eAAO,MAAM,YAAY,GAAU,2CAKhC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,eAAe,EAAE,IAAI,CAAA;YACrB,aAAa,EAAE,IAAI,CAAA;SACpB,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,YAAY,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC;;;;;;;;;;;;;EAmKA,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Prisma } from '@prisma/client';
|
|
2
|
-
export declare const managedOpenaiThreadId: ({ assistant, threadId, }: {
|
|
1
|
+
import { Prisma, type PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const managedOpenaiThreadId: ({ assistant, threadId, prisma, }: {
|
|
3
3
|
assistant: Prisma.AssistantGetPayload<{
|
|
4
4
|
include: {
|
|
5
5
|
tools: {
|
|
@@ -24,5 +24,6 @@ export declare const managedOpenaiThreadId: ({ assistant, threadId, }: {
|
|
|
24
24
|
};
|
|
25
25
|
}>;
|
|
26
26
|
threadId: string;
|
|
27
|
+
prisma: PrismaClient;
|
|
27
28
|
}) => Promise<string>;
|
|
28
29
|
//# sourceMappingURL=managedOpenaiThreadId.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"managedOpenaiThreadId.d.ts","sourceRoot":"","sources":["../../../src/lib/threads/managedOpenaiThreadId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"managedOpenaiThreadId.d.ts","sourceRoot":"","sources":["../../../src/lib/threads/managedOpenaiThreadId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAuB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAI/E,eAAO,MAAM,qBAAqB,GAAU,kCAIzC;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,OAAO,EAAE;oBACP,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,mBAAmB,EAAE,IAAI,CAAA;oBACzB,mBAAmB,EAAE,IAAI,CAAA;oBACzB,eAAe,EAAE,IAAI,CAAA;iBACtB,CAAA;aACF,CAAA;YACD,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,eAAe,EAAE,IAAI,CAAA;oBACrB,cAAc,EAAE,IAAI,CAAA;oBACpB,YAAY,EAAE,IAAI,CAAA;oBAClB,aAAa,EAAE,IAAI,CAAA;iBACpB,CAAA;aACF,CAAA;YACD,SAAS,EAAE,IAAI,CAAA;YACf,aAAa,EAAE,IAAI,CAAA;SACpB,CAAA;KACF,CAAC,CAAA;IACF,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,YAAY,CAAA;CACrB,oBAsCA,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { StorageProviderType } from '@prisma/client';
|
|
2
2
|
import { assistantClientAdapter } from '../../lib/assistants/assistantClientAdapter';
|
|
3
|
-
import { prisma } from '../../lib/prisma';
|
|
4
3
|
import { isOpenaiAssistantsStorageProvider } from '../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
|
|
5
|
-
export const managedOpenaiThreadId = async ({ assistant, threadId, }) => {
|
|
4
|
+
export const managedOpenaiThreadId = async ({ assistant, threadId, prisma, }) => {
|
|
6
5
|
const newStorageThread = await assistantClientAdapter({
|
|
7
6
|
assistant,
|
|
8
7
|
prisma,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { Prisma, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleToolCall: ({ assistant, thread, }: {
|
|
2
|
+
import { Prisma, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleToolCall: ({ assistant, thread, prisma, }: {
|
|
4
4
|
assistant: Prisma.AssistantGetPayload<{
|
|
5
5
|
include: {
|
|
6
6
|
tools: {
|
|
@@ -46,6 +46,7 @@ export declare const handleToolCall: ({ assistant, thread, }: {
|
|
|
46
46
|
};
|
|
47
47
|
}>;
|
|
48
48
|
thread: Thread;
|
|
49
|
+
prisma: PrismaClient;
|
|
49
50
|
}) => ({ toolCall, controller, run, }: {
|
|
50
51
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
51
52
|
controller: ReadableStreamDefaultController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleToolCall.d.ts","sourceRoot":"","sources":["../../../src/lib/toolCalls/handleToolCall.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"handleToolCall.d.ts","sourceRoot":"","sources":["../../../src/lib/toolCalls/handleToolCall.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAMlE,eAAO,MAAM,cAAc,GACxB,gCAIE;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,OAAO,EAAE;oBACP,eAAe,EAAE;wBACf,OAAO,EAAE;4BACP,SAAS,EAAE;gCACT,OAAO,EAAE;oCACP,cAAc,EAAE,IAAI,CAAA;oCACpB,YAAY,EAAE,IAAI,CAAA;oCAClB,aAAa,EAAE,IAAI,CAAA;iCACpB,CAAA;6BACF,CAAA;yBACF,CAAA;qBACF,CAAA;iBACF,CAAA;aACF,CAAA;YACD,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,eAAe,EAAE,IAAI,CAAA;oBACrB,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,YAAY,EAAE,IAAI,CAAA;iBACnB,CAAA;aACF,CAAA;YACD,SAAS,EAAE;gBACT,OAAO,EAAE;oBACP,OAAO,EAAE;wBACP,OAAO,EAAE;4BACP,cAAc,EAAE,IAAI,CAAA;4BACpB,gBAAgB,EAAE,IAAI,CAAA;4BACtB,gBAAgB,EAAE,IAAI,CAAA;4BACtB,iBAAiB,EAAE,IAAI,CAAA;4BACvB,gBAAgB,EAAE,IAAI,CAAA;4BACtB,iBAAiB,EAAE,IAAI,CAAA;4BACvB,gBAAgB,EAAE,IAAI,CAAA;4BACtB,iBAAiB,EAAE,IAAI,CAAA;4BACvB,iBAAiB,EAAE,IAAI,CAAA;yBACxB,CAAA;qBACF,CAAA;iBACF,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB,MACM,gCAIJ;IACD,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAA;IACjE,UAAU,EAAE,+BAA+B,CAAA;IAC3C,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAA;CAClC;;;EA0DA,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { handleFunction } from '../../lib/functions/handleFunction';
|
|
|
2
2
|
import { handleComputerCall } from '../../lib/computerCalls/handleComputerCall';
|
|
3
3
|
import { LogRequestMethod, LogRequestRoute, LogLevel } from '@prisma/client';
|
|
4
4
|
import { createLog } from '../../lib/logs/createLog';
|
|
5
|
-
export const handleToolCall = ({ assistant, thread, }) => async ({ toolCall, controller, run, }) => {
|
|
5
|
+
export const handleToolCall = ({ assistant, thread, prisma, }) => async ({ toolCall, controller, run, }) => {
|
|
6
6
|
if (toolCall.type === 'function') {
|
|
7
7
|
if (!toolCall.function) {
|
|
8
8
|
createLog({
|
|
@@ -16,6 +16,7 @@ export const handleToolCall = ({ assistant, thread, }) => async ({ toolCall, con
|
|
|
16
16
|
assistantId: assistant.id,
|
|
17
17
|
threadId: thread.id,
|
|
18
18
|
},
|
|
19
|
+
prisma,
|
|
19
20
|
});
|
|
20
21
|
return {
|
|
21
22
|
tool_call_id: toolCall.id,
|
|
@@ -28,6 +29,7 @@ export const handleToolCall = ({ assistant, thread, }) => async ({ toolCall, con
|
|
|
28
29
|
controller,
|
|
29
30
|
run,
|
|
30
31
|
thread,
|
|
32
|
+
prisma,
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
else if (toolCall.type === 'computer_call') {
|
|
@@ -35,6 +37,7 @@ export const handleToolCall = ({ assistant, thread, }) => async ({ toolCall, con
|
|
|
35
37
|
assistant,
|
|
36
38
|
toolCall,
|
|
37
39
|
thread,
|
|
40
|
+
prisma,
|
|
38
41
|
});
|
|
39
42
|
}
|
|
40
43
|
else {
|
|
@@ -49,6 +52,7 @@ export const handleToolCall = ({ assistant, thread, }) => async ({ toolCall, con
|
|
|
49
52
|
assistantId: assistant.id,
|
|
50
53
|
threadId: thread.id,
|
|
51
54
|
},
|
|
55
|
+
prisma,
|
|
52
56
|
});
|
|
53
57
|
return {
|
|
54
58
|
tool_call_id: toolCall.id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Prisma, Thread } from '@prisma/client';
|
|
1
|
+
import type { Prisma, Thread, PrismaClient } from '@prisma/client';
|
|
2
2
|
import type OpenAI from 'openai';
|
|
3
|
-
export declare const tools: ({ assistant, thread, }: {
|
|
3
|
+
export declare const tools: ({ assistant, thread, prisma, }: {
|
|
4
4
|
assistant: Prisma.AssistantGetPayload<{
|
|
5
5
|
include: {
|
|
6
6
|
tools: {
|
|
@@ -25,6 +25,7 @@ export declare const tools: ({ assistant, thread, }: {
|
|
|
25
25
|
};
|
|
26
26
|
}>;
|
|
27
27
|
thread: Thread;
|
|
28
|
+
prisma: PrismaClient;
|
|
28
29
|
}) => Promise<{
|
|
29
30
|
tools?: undefined;
|
|
30
31
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/tools/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/tools/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAQlE,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AA0QhC,eAAO,MAAM,KAAK,GAAU,gCAIzB;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,OAAO,EAAE;oBACP,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,mBAAmB,EAAE,IAAI,CAAA;oBACzB,mBAAmB,EAAE,IAAI,CAAA;oBACzB,eAAe,EAAE,IAAI,CAAA;iBACtB,CAAA;aACF,CAAA;YACD,SAAS,EAAE,IAAI,CAAA;YACf,aAAa,EAAE,IAAI,CAAA;YACnB,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,eAAe,EAAE,IAAI,CAAA;oBACrB,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,YAAY,EAAE,IAAI,CAAA;iBACnB,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;WAkBQ,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,EAAE;EAE9C,CAAA"}
|
|
@@ -105,11 +105,12 @@ const serializeTool = ({ tool }) => ({
|
|
|
105
105
|
description: tool.description,
|
|
106
106
|
parameters: tool.inputSchema,
|
|
107
107
|
});
|
|
108
|
-
const mcpServerToolsAsFunction = ({ mcpServers, thread, assistant, }) => map(mcpServers, async (mcpServer) => {
|
|
108
|
+
const mcpServerToolsAsFunction = ({ mcpServers, thread, assistant, prisma, }) => map(mcpServers, async (mcpServer) => {
|
|
109
109
|
const { mcpConnection } = await connectMcpServer({
|
|
110
110
|
mcpServer,
|
|
111
111
|
thread,
|
|
112
112
|
assistant,
|
|
113
|
+
prisma,
|
|
113
114
|
});
|
|
114
115
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
115
116
|
const listToolsResponse = (await mcpConnection.client.listTools());
|
|
@@ -122,7 +123,7 @@ const mcpServerToolsAsFunction = ({ mcpServers, thread, assistant, }) => map(mcp
|
|
|
122
123
|
function: serializeTool({ tool }),
|
|
123
124
|
}));
|
|
124
125
|
});
|
|
125
|
-
const mcpServerTools = async ({ assistant, thread, }) => {
|
|
126
|
+
const mcpServerTools = async ({ assistant, thread, prisma, }) => {
|
|
126
127
|
const nonComputerUseMcpServers = assistant.mcpServers.filter((mcpServer) => !mcpServer.computerUseTool);
|
|
127
128
|
if (isResponsesStorageProvider({
|
|
128
129
|
storageProviderType: assistant.storageProviderType,
|
|
@@ -133,8 +134,8 @@ const mcpServerTools = async ({ assistant, thread, }) => {
|
|
|
133
134
|
type: 'mcp',
|
|
134
135
|
mcp: {
|
|
135
136
|
server_label: `mcp-server-${mcpServer.id}`,
|
|
136
|
-
server_url: url({ thread, mcpServer, assistant }),
|
|
137
|
-
headers: headers({ thread, mcpServer, assistant }),
|
|
137
|
+
server_url: url({ thread, mcpServer, assistant, prisma }),
|
|
138
|
+
headers: headers({ thread, mcpServer, assistant, prisma }),
|
|
138
139
|
require_approval: 'never',
|
|
139
140
|
},
|
|
140
141
|
}));
|
|
@@ -144,6 +145,7 @@ const mcpServerTools = async ({ assistant, thread, }) => {
|
|
|
144
145
|
mcpServers: nonComputerUseMcpServers,
|
|
145
146
|
thread,
|
|
146
147
|
assistant,
|
|
148
|
+
prisma,
|
|
147
149
|
})),
|
|
148
150
|
];
|
|
149
151
|
}
|
|
@@ -151,10 +153,11 @@ const mcpServerTools = async ({ assistant, thread, }) => {
|
|
|
151
153
|
mcpServers: nonComputerUseMcpServers,
|
|
152
154
|
thread,
|
|
153
155
|
assistant,
|
|
156
|
+
prisma,
|
|
154
157
|
});
|
|
155
158
|
return flat(result);
|
|
156
159
|
};
|
|
157
|
-
export const tools = async ({ assistant, thread, }) => {
|
|
160
|
+
export const tools = async ({ assistant, thread, prisma, }) => {
|
|
158
161
|
const modelProviderConfig = modelProviderConfigs.find((config) => config.type === assistant.modelProvider.type);
|
|
159
162
|
if (!modelProviderConfig)
|
|
160
163
|
return {};
|
|
@@ -163,7 +166,7 @@ export const tools = async ({ assistant, thread, }) => {
|
|
|
163
166
|
}
|
|
164
167
|
return {
|
|
165
168
|
tools: [
|
|
166
|
-
...(await mcpServerTools({ assistant, thread })),
|
|
169
|
+
...(await mcpServerTools({ assistant, thread, prisma })),
|
|
167
170
|
...assistant.functions.map((fn) => ({
|
|
168
171
|
type: 'function',
|
|
169
172
|
function: fn.openapiSpec,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superinterface/server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superinterface-server": "./bin/index.cjs"
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"import": "./dist/app/api/files/*.js",
|
|
59
59
|
"default": "./dist/app/api/files/*.js"
|
|
60
60
|
},
|
|
61
|
-
"./next/api/files/[fileId]/contents
|
|
61
|
+
"./next/api/files/[fileId]/contents/*": {
|
|
62
62
|
"types": "./dist/app/api/files/[fileId]/contents/*.d.ts",
|
|
63
63
|
"import": "./dist/app/api/files/[fileId]/contents/*.js",
|
|
64
64
|
"default": "./dist/app/api/files/[fileId]/contents/*.js"
|
|
@@ -52,7 +52,6 @@ const generatePrismaClient = async () => {
|
|
|
52
52
|
const createPrismaClient = async (bustCache = false) => {
|
|
53
53
|
// Dynamically import PrismaClient and PrismaNeon after generation
|
|
54
54
|
let PrismaClientConstructor: typeof PrismaClient
|
|
55
|
-
let PrismaNeonConstructor: any
|
|
56
55
|
|
|
57
56
|
if (bustCache) {
|
|
58
57
|
// After generation, import directly from the file path to bypass Node's module cache
|
|
@@ -75,7 +74,7 @@ const createPrismaClient = async (bustCache = false) => {
|
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
const { PrismaNeon } = await import('@prisma/adapter-neon')
|
|
78
|
-
PrismaNeonConstructor = PrismaNeon
|
|
77
|
+
const PrismaNeonConstructor = PrismaNeon
|
|
79
78
|
|
|
80
79
|
const connectionString = `${process.env.DATABASE_URL}`
|
|
81
80
|
|
|
File without changes
|
/package/.next/static/{kvFNeiykUJqaQCo-lW8D0 → rEvucoSBXJWMKfLWTgPF2}/_clientMiddlewareManifest.json
RENAMED
|
File without changes
|
|
File without changes
|