@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
|
@@ -13,7 +13,7 @@ import { handleDeleteTask } from './tasks/handleDeleteTask';
|
|
|
13
13
|
import { getToolCallMcpServer } from '../../../lib/mcpServers/getToolCallMcpServer';
|
|
14
14
|
import { closeMcpConnection } from '../../../lib/mcpServers/closeMcpConnection';
|
|
15
15
|
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
16
|
-
export const handleFunction = async ({ assistant, toolCall, controller, run, thread, }) => {
|
|
16
|
+
export const handleFunction = async ({ assistant, toolCall, controller, run, thread, prisma, }) => {
|
|
17
17
|
const fn = getFunction({
|
|
18
18
|
toolCall,
|
|
19
19
|
assistant,
|
|
@@ -23,6 +23,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
23
23
|
toolCall,
|
|
24
24
|
assistant,
|
|
25
25
|
thread,
|
|
26
|
+
prisma,
|
|
26
27
|
});
|
|
27
28
|
if (!mcpConnection) {
|
|
28
29
|
createLog({
|
|
@@ -36,6 +37,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
36
37
|
assistantId: assistant.id,
|
|
37
38
|
threadId: thread.id,
|
|
38
39
|
},
|
|
40
|
+
prisma,
|
|
39
41
|
});
|
|
40
42
|
return {
|
|
41
43
|
tool_call_id: toolCall.id,
|
|
@@ -59,6 +61,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
59
61
|
assistantId: assistant.id,
|
|
60
62
|
threadId: thread.id,
|
|
61
63
|
},
|
|
64
|
+
prisma,
|
|
62
65
|
});
|
|
63
66
|
return {
|
|
64
67
|
tool_call_id: toolCall.id,
|
|
@@ -93,6 +96,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
93
96
|
assistantId: assistant.id,
|
|
94
97
|
threadId: thread.id,
|
|
95
98
|
},
|
|
99
|
+
prisma,
|
|
96
100
|
});
|
|
97
101
|
return {
|
|
98
102
|
tool_call_id: toolCall.id,
|
|
@@ -112,6 +116,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
112
116
|
assistantId: assistant.id,
|
|
113
117
|
threadId: thread.id,
|
|
114
118
|
},
|
|
119
|
+
prisma,
|
|
115
120
|
});
|
|
116
121
|
return {
|
|
117
122
|
tool_call_id: toolCall.id,
|
|
@@ -131,6 +136,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
131
136
|
assistantId: assistant.id,
|
|
132
137
|
threadId: thread.id,
|
|
133
138
|
},
|
|
139
|
+
prisma,
|
|
134
140
|
});
|
|
135
141
|
return {
|
|
136
142
|
tool_call_id: toolCall.id,
|
|
@@ -142,6 +148,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
142
148
|
toolCall,
|
|
143
149
|
assistant,
|
|
144
150
|
thread,
|
|
151
|
+
prisma,
|
|
145
152
|
});
|
|
146
153
|
}
|
|
147
154
|
if (fn.handler.type === HandlerType.CLIENT_TOOL) {
|
|
@@ -157,6 +164,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
157
164
|
assistantId: assistant.id,
|
|
158
165
|
threadId: thread.id,
|
|
159
166
|
},
|
|
167
|
+
prisma,
|
|
160
168
|
});
|
|
161
169
|
return {
|
|
162
170
|
tool_call_id: toolCall.id,
|
|
@@ -170,6 +178,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
170
178
|
assistant,
|
|
171
179
|
thread,
|
|
172
180
|
run,
|
|
181
|
+
prisma,
|
|
173
182
|
});
|
|
174
183
|
}
|
|
175
184
|
if (fn.handler.type === HandlerType.FIRECRAWL) {
|
|
@@ -185,6 +194,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
185
194
|
assistantId: assistant.id,
|
|
186
195
|
threadId: thread.id,
|
|
187
196
|
},
|
|
197
|
+
prisma,
|
|
188
198
|
});
|
|
189
199
|
return {
|
|
190
200
|
tool_call_id: toolCall.id,
|
|
@@ -196,6 +206,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
196
206
|
toolCall,
|
|
197
207
|
assistant,
|
|
198
208
|
thread,
|
|
209
|
+
prisma,
|
|
199
210
|
});
|
|
200
211
|
}
|
|
201
212
|
if (fn.handler.type === HandlerType.REPLICATE) {
|
|
@@ -211,6 +222,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
211
222
|
assistantId: assistant.id,
|
|
212
223
|
threadId: thread.id,
|
|
213
224
|
},
|
|
225
|
+
prisma,
|
|
214
226
|
});
|
|
215
227
|
return {
|
|
216
228
|
tool_call_id: toolCall.id,
|
|
@@ -222,6 +234,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
222
234
|
toolCall,
|
|
223
235
|
assistant,
|
|
224
236
|
thread,
|
|
237
|
+
prisma,
|
|
225
238
|
});
|
|
226
239
|
}
|
|
227
240
|
if (fn.handler.type === HandlerType.ASSISTANT) {
|
|
@@ -237,6 +250,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
237
250
|
assistantId: assistant.id,
|
|
238
251
|
threadId: thread.id,
|
|
239
252
|
},
|
|
253
|
+
prisma,
|
|
240
254
|
});
|
|
241
255
|
return {
|
|
242
256
|
tool_call_id: toolCall.id,
|
|
@@ -250,6 +264,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
250
264
|
run,
|
|
251
265
|
assistant,
|
|
252
266
|
thread,
|
|
267
|
+
prisma,
|
|
253
268
|
});
|
|
254
269
|
}
|
|
255
270
|
if (fn.handler.type === HandlerType.CREATE_TASK) {
|
|
@@ -266,6 +281,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
266
281
|
assistantId: assistant.id,
|
|
267
282
|
threadId: thread.id,
|
|
268
283
|
},
|
|
284
|
+
prisma,
|
|
269
285
|
});
|
|
270
286
|
return {
|
|
271
287
|
tool_call_id: toolCall.id,
|
|
@@ -277,6 +293,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
277
293
|
toolCall,
|
|
278
294
|
assistant,
|
|
279
295
|
thread,
|
|
296
|
+
prisma,
|
|
280
297
|
});
|
|
281
298
|
}
|
|
282
299
|
if (fn.handler.type === HandlerType.LIST_TASKS) {
|
|
@@ -293,6 +310,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
293
310
|
assistantId: assistant.id,
|
|
294
311
|
threadId: thread.id,
|
|
295
312
|
},
|
|
313
|
+
prisma,
|
|
296
314
|
});
|
|
297
315
|
return {
|
|
298
316
|
tool_call_id: toolCall.id,
|
|
@@ -304,6 +322,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
304
322
|
toolCall,
|
|
305
323
|
assistant,
|
|
306
324
|
thread,
|
|
325
|
+
prisma,
|
|
307
326
|
});
|
|
308
327
|
}
|
|
309
328
|
if (fn.handler.type === HandlerType.UPDATE_TASK) {
|
|
@@ -320,6 +339,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
320
339
|
assistantId: assistant.id,
|
|
321
340
|
threadId: thread.id,
|
|
322
341
|
},
|
|
342
|
+
prisma,
|
|
323
343
|
});
|
|
324
344
|
return {
|
|
325
345
|
tool_call_id: toolCall.id,
|
|
@@ -331,6 +351,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
331
351
|
toolCall,
|
|
332
352
|
assistant,
|
|
333
353
|
thread,
|
|
354
|
+
prisma,
|
|
334
355
|
});
|
|
335
356
|
}
|
|
336
357
|
if (fn.handler.type === HandlerType.DELETE_TASK) {
|
|
@@ -347,6 +368,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
347
368
|
assistantId: assistant.id,
|
|
348
369
|
threadId: thread.id,
|
|
349
370
|
},
|
|
371
|
+
prisma,
|
|
350
372
|
});
|
|
351
373
|
return {
|
|
352
374
|
tool_call_id: toolCall.id,
|
|
@@ -358,6 +380,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
358
380
|
toolCall,
|
|
359
381
|
assistant,
|
|
360
382
|
thread,
|
|
383
|
+
prisma,
|
|
361
384
|
});
|
|
362
385
|
}
|
|
363
386
|
createLog({
|
|
@@ -371,6 +394,7 @@ export const handleFunction = async ({ assistant, toolCall, controller, run, thr
|
|
|
371
394
|
assistantId: assistant.id,
|
|
372
395
|
threadId: thread.id,
|
|
373
396
|
},
|
|
397
|
+
prisma,
|
|
374
398
|
});
|
|
375
399
|
return {
|
|
376
400
|
tool_call_id: toolCall.id,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { CreateTaskHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleCreateTask: ({ taskHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { CreateTaskHandler, Assistant, Thread, PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleCreateTask: ({ taskHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
taskHandler: CreateTaskHandler;
|
|
5
5
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
6
6
|
assistant: Assistant;
|
|
7
7
|
thread: Thread;
|
|
8
|
+
prisma: PrismaClient;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
tool_call_id: string;
|
|
10
11
|
output: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleCreateTask.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleCreateTask.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"handleCreateTask.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleCreateTask.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,YAAY,EACb,MAAM,gBAAgB,CAAA;AAQvB,eAAO,MAAM,gBAAgB,GAAU,uDAMpC;IACD,WAAW,EAAE,iBAAiB,CAAA;IAC9B,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;;;EAsCA,CAAA"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { prisma } from '../../../../lib/prisma';
|
|
2
1
|
import { serializeTask } from '../../../../lib/tasks/serializeTask';
|
|
3
2
|
import { validateSchedule } from '../../../../lib/tasks/validateSchedule';
|
|
4
3
|
import { createTaskToolSchema } from '../../../../lib/tasks/schemas';
|
|
5
4
|
import { parseTaskToolArgs } from '../../../../lib/tasks/parseTaskToolArgs';
|
|
6
5
|
import { getTaskToolKey } from '../../../../lib/tasks/getTaskToolKey';
|
|
7
6
|
import { scheduleTask } from '../../../../lib/tasks/scheduleTask';
|
|
8
|
-
export const handleCreateTask = async ({ taskHandler, toolCall, assistant, thread, }) => {
|
|
9
|
-
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread });
|
|
7
|
+
export const handleCreateTask = async ({ taskHandler, toolCall, assistant, thread, prisma, }) => {
|
|
8
|
+
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread, prisma });
|
|
10
9
|
if (!parsedArgs.ok)
|
|
11
10
|
return { tool_call_id: toolCall.id, output: parsedArgs.error };
|
|
12
11
|
const check = createTaskToolSchema.safeParse(parsedArgs.args);
|
|
@@ -17,6 +16,7 @@ export const handleCreateTask = async ({ taskHandler, toolCall, assistant, threa
|
|
|
17
16
|
thread,
|
|
18
17
|
assistant,
|
|
19
18
|
keyTemplate: taskHandler.keyTemplate,
|
|
19
|
+
prisma,
|
|
20
20
|
});
|
|
21
21
|
if (!ok)
|
|
22
22
|
return { tool_call_id: toolCall.id, output: error };
|
|
@@ -32,7 +32,7 @@ export const handleCreateTask = async ({ taskHandler, toolCall, assistant, threa
|
|
|
32
32
|
key: key !== null && key !== void 0 ? key : '',
|
|
33
33
|
},
|
|
34
34
|
});
|
|
35
|
-
await scheduleTask({ task });
|
|
35
|
+
await scheduleTask({ task, prisma });
|
|
36
36
|
return {
|
|
37
37
|
tool_call_id: toolCall.id,
|
|
38
38
|
output: JSON.stringify({ task: serializeTask({ task }) }),
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { DeleteTaskHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleDeleteTask: ({ taskHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { DeleteTaskHandler, Assistant, Thread, PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleDeleteTask: ({ taskHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
taskHandler: DeleteTaskHandler;
|
|
5
5
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
6
6
|
assistant: Assistant;
|
|
7
7
|
thread: Thread;
|
|
8
|
+
prisma: PrismaClient;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
tool_call_id: string;
|
|
10
11
|
output: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleDeleteTask.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleDeleteTask.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"handleDeleteTask.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleDeleteTask.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,YAAY,EACb,MAAM,gBAAgB,CAAA;AAOvB,eAAO,MAAM,gBAAgB,GAAU,uDAMpC;IACD,WAAW,EAAE,iBAAiB,CAAA;IAC9B,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;;;EA2CA,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { prisma } from '../../../../lib/prisma';
|
|
2
1
|
import { serializeTask } from '../../../../lib/tasks/serializeTask';
|
|
3
2
|
import { deleteTaskSchema } from '../../../../lib/tasks/schemas';
|
|
4
3
|
import { parseTaskToolArgs } from '../../../../lib/tasks/parseTaskToolArgs';
|
|
5
4
|
import { getTaskToolKey } from '../../../../lib/tasks/getTaskToolKey';
|
|
6
5
|
import { cancelScheduledTask } from '../../../../lib/tasks/cancelScheduledTask';
|
|
7
|
-
export const handleDeleteTask = async ({ taskHandler, toolCall, assistant, thread, }) => {
|
|
8
|
-
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread });
|
|
6
|
+
export const handleDeleteTask = async ({ taskHandler, toolCall, assistant, thread, prisma, }) => {
|
|
7
|
+
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread, prisma });
|
|
9
8
|
if (!parsedArgs.ok)
|
|
10
9
|
return { tool_call_id: toolCall.id, output: parsedArgs.error };
|
|
11
10
|
const check = deleteTaskSchema.safeParse(parsedArgs.args);
|
|
@@ -16,6 +15,7 @@ export const handleDeleteTask = async ({ taskHandler, toolCall, assistant, threa
|
|
|
16
15
|
thread,
|
|
17
16
|
assistant,
|
|
18
17
|
keyTemplate: taskHandler.keyTemplate,
|
|
18
|
+
prisma,
|
|
19
19
|
});
|
|
20
20
|
if (!ok)
|
|
21
21
|
return { tool_call_id: toolCall.id, output: error };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { ListTasksHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleListTasks: ({ taskHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { ListTasksHandler, Assistant, Thread, PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleListTasks: ({ taskHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
taskHandler: ListTasksHandler;
|
|
5
5
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
6
6
|
assistant: Assistant;
|
|
7
7
|
thread: Thread;
|
|
8
|
+
prisma: PrismaClient;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
tool_call_id: string;
|
|
10
11
|
output: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleListTasks.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleListTasks.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"handleListTasks.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleListTasks.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,MAAM,EACN,YAAY,EACb,MAAM,gBAAgB,CAAA;AAMvB,eAAO,MAAM,eAAe,GAAU,uDAMnC;IACD,WAAW,EAAE,gBAAgB,CAAA;IAC7B,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;;;EAmCA,CAAA"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { prisma } from '../../../../lib/prisma';
|
|
2
1
|
import { serializeTask } from '../../../../lib/tasks/serializeTask';
|
|
3
2
|
import { listTasksSchema } from '../../../../lib/tasks/schemas';
|
|
4
3
|
import { parseTaskToolArgs } from '../../../../lib/tasks/parseTaskToolArgs';
|
|
5
4
|
import { getTaskToolKey } from '../../../../lib/tasks/getTaskToolKey';
|
|
6
|
-
export const handleListTasks = async ({ taskHandler, toolCall, assistant, thread, }) => {
|
|
7
|
-
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread });
|
|
5
|
+
export const handleListTasks = async ({ taskHandler, toolCall, assistant, thread, prisma, }) => {
|
|
6
|
+
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread, prisma });
|
|
8
7
|
if (!parsedArgs.ok)
|
|
9
8
|
return { tool_call_id: toolCall.id, output: parsedArgs.error };
|
|
10
9
|
const check = listTasksSchema.safeParse(parsedArgs.args);
|
|
@@ -14,6 +13,7 @@ export const handleListTasks = async ({ taskHandler, toolCall, assistant, thread
|
|
|
14
13
|
thread,
|
|
15
14
|
assistant,
|
|
16
15
|
keyTemplate: taskHandler.keyTemplate,
|
|
16
|
+
prisma,
|
|
17
17
|
});
|
|
18
18
|
if (!ok)
|
|
19
19
|
return { tool_call_id: toolCall.id, output: error };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { UpdateTaskHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleUpdateTask: ({ taskHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { UpdateTaskHandler, Assistant, Thread, PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleUpdateTask: ({ taskHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
taskHandler: UpdateTaskHandler;
|
|
5
5
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
6
6
|
assistant: Assistant;
|
|
7
7
|
thread: Thread;
|
|
8
|
+
prisma: PrismaClient;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
tool_call_id: string;
|
|
10
11
|
output: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleUpdateTask.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleUpdateTask.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"handleUpdateTask.d.ts","sourceRoot":"","sources":["../../../../../src/lib/functions/handleFunction/tasks/handleUpdateTask.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,EACN,YAAY,EACb,MAAM,gBAAgB,CAAA;AAQvB,eAAO,MAAM,gBAAgB,GAAU,uDAMpC;IACD,WAAW,EAAE,iBAAiB,CAAA;IAC9B,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;;;EAkDA,CAAA"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { prisma } from '../../../../lib/prisma';
|
|
2
1
|
import { serializeTask } from '../../../../lib/tasks/serializeTask';
|
|
3
2
|
import { validateSchedule } from '../../../../lib/tasks/validateSchedule';
|
|
4
3
|
import { updateTaskSchema } from '../../../../lib/tasks/schemas';
|
|
5
4
|
import { parseTaskToolArgs } from '../../../../lib/tasks/parseTaskToolArgs';
|
|
6
5
|
import { getTaskToolKey } from '../../../../lib/tasks/getTaskToolKey';
|
|
7
6
|
import { scheduleTask } from '../../../../lib/tasks/scheduleTask';
|
|
8
|
-
export const handleUpdateTask = async ({ taskHandler, toolCall, assistant, thread, }) => {
|
|
7
|
+
export const handleUpdateTask = async ({ taskHandler, toolCall, assistant, thread, prisma, }) => {
|
|
9
8
|
var _a;
|
|
10
|
-
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread });
|
|
9
|
+
const parsedArgs = parseTaskToolArgs({ toolCall, assistant, thread, prisma });
|
|
11
10
|
if (!parsedArgs.ok)
|
|
12
11
|
return { tool_call_id: toolCall.id, output: parsedArgs.error };
|
|
13
12
|
const check = updateTaskSchema.safeParse(parsedArgs.args);
|
|
@@ -18,6 +17,7 @@ export const handleUpdateTask = async ({ taskHandler, toolCall, assistant, threa
|
|
|
18
17
|
thread,
|
|
19
18
|
assistant,
|
|
20
19
|
keyTemplate: taskHandler.keyTemplate,
|
|
20
|
+
prisma,
|
|
21
21
|
});
|
|
22
22
|
if (!ok)
|
|
23
23
|
return { tool_call_id: toolCall.id, output: error };
|
|
@@ -47,7 +47,7 @@ export const handleUpdateTask = async ({ taskHandler, toolCall, assistant, threa
|
|
|
47
47
|
},
|
|
48
48
|
data: updateData,
|
|
49
49
|
});
|
|
50
|
-
await scheduleTask({ task });
|
|
50
|
+
await scheduleTask({ task, prisma });
|
|
51
51
|
return {
|
|
52
52
|
tool_call_id: toolCall.id,
|
|
53
53
|
output: JSON.stringify({ task: serializeTask({ task }) }),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Prisma } from '@prisma/client';
|
|
1
|
+
import type { Prisma, PrismaClient } from '@prisma/client';
|
|
2
2
|
import type { HandlerInput } from '../../types';
|
|
3
3
|
export declare function updateFunction<TInclude extends Prisma.FunctionInclude>(params: {
|
|
4
4
|
fn: Prisma.FunctionGetPayload<{
|
|
@@ -11,6 +11,7 @@ export declare function updateFunction<TInclude extends Prisma.FunctionInclude>(
|
|
|
11
11
|
handler: HandlerInput;
|
|
12
12
|
};
|
|
13
13
|
include: TInclude;
|
|
14
|
+
prisma: PrismaClient;
|
|
14
15
|
}): Promise<Prisma.FunctionGetPayload<{
|
|
15
16
|
include: TInclude;
|
|
16
17
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateFunction.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/updateFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"updateFunction.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/updateFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,wBAAsB,cAAc,CAClC,QAAQ,SAAS,MAAM,CAAC,eAAe,EACvC,MAAM,EAAE;IACR,EAAE,EAAE,MAAM,CAAC,kBAAkB,CAAC;QAC5B,OAAO,EAAE;YACP,SAAS,EAAE,IAAI,CAAA;SAChB,CAAA;KACF,CAAC,CAAA;IACF,WAAW,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,YAAY,CAAA;KAAE,CAAA;IAC3D,OAAO,EAAE,QAAQ,CAAA;IACjB,MAAM,EAAE,YAAY,CAAA;CACrB,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC,CAAC,CA2B5D"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { prisma } from '../../lib/prisma';
|
|
2
1
|
import { handlerPrismaInput } from '../../lib/handlers/handlerPrismaInput';
|
|
3
2
|
export async function updateFunction(params) {
|
|
4
|
-
const { fn, parsedInput, include } = params;
|
|
3
|
+
const { fn, parsedInput, include, prisma } = params;
|
|
5
4
|
return prisma.$transaction(async (tx) => {
|
|
6
5
|
await tx.handler.deleteMany({
|
|
7
6
|
where: { functionId: fn.id },
|
|
@@ -15,6 +14,7 @@ export async function updateFunction(params) {
|
|
|
15
14
|
parsedInput,
|
|
16
15
|
action: 'create',
|
|
17
16
|
assistant: fn.assistant,
|
|
17
|
+
prisma: tx,
|
|
18
18
|
}))),
|
|
19
19
|
},
|
|
20
20
|
},
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import { type PrismaClient } from '@prisma/client';
|
|
1
2
|
import type { Assistant } from '@prisma/client';
|
|
2
3
|
import type { HandlerInput } from '../../types';
|
|
3
|
-
export declare const handlerPrismaInput: ({ parsedInput, action, assistant, }: {
|
|
4
|
+
export declare const handlerPrismaInput: ({ parsedInput, action, assistant, prisma, }: {
|
|
4
5
|
parsedInput: {
|
|
5
6
|
handler: HandlerInput;
|
|
6
7
|
};
|
|
7
8
|
action: "create" | "update";
|
|
8
9
|
assistant: Assistant;
|
|
10
|
+
prisma: PrismaClient;
|
|
9
11
|
}) => Promise<{
|
|
10
12
|
requestHandler: {
|
|
11
13
|
[x: string]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlerPrismaInput.d.ts","sourceRoot":"","sources":["../../../src/lib/handlers/handlerPrismaInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handlerPrismaInput.d.ts","sourceRoot":"","sources":["../../../src/lib/handlers/handlerPrismaInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,eAAO,MAAM,kBAAkB,GAAU,6CAKtC;IACD,WAAW,EAAE;QACX,OAAO,EAAE,YAAY,CAAA;KACtB,CAAA;IACD,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC3B,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4HA,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { HandlerType } from '@prisma/client';
|
|
2
|
-
import { prisma } from '../../lib/prisma';
|
|
3
2
|
import { ValidationError } from '../../lib/errors';
|
|
4
|
-
export const handlerPrismaInput = async ({ parsedInput, action, assistant, }) => {
|
|
3
|
+
export const handlerPrismaInput = async ({ parsedInput, action, assistant, prisma, }) => {
|
|
5
4
|
if (parsedInput.handler.type === HandlerType.REQUEST) {
|
|
6
5
|
if (!parsedInput.handler.requestHandler)
|
|
7
6
|
throw new ValidationError('Request handler is required.');
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { MessageRole } from '@prisma/client';
|
|
2
|
-
export declare const updateInitialMessages: ({ assistantId, initialMessages, }: {
|
|
1
|
+
import { MessageRole, type PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const updateInitialMessages: ({ assistantId, initialMessages, prisma, }: {
|
|
3
3
|
assistantId: string;
|
|
4
4
|
initialMessages: {
|
|
5
5
|
role: MessageRole;
|
|
6
6
|
content: string;
|
|
7
7
|
}[];
|
|
8
|
+
prisma: PrismaClient;
|
|
8
9
|
}) => Promise<{
|
|
9
10
|
id: string;
|
|
10
11
|
createdAt: Date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateInitialMessages.d.ts","sourceRoot":"","sources":["../../../src/lib/initialMessages/updateInitialMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"updateInitialMessages.d.ts","sourceRoot":"","sources":["../../../src/lib/initialMessages/updateInitialMessages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE/E,eAAO,MAAM,qBAAqB,GAAU,2CAIzC;IACD,WAAW,EAAE,MAAM,CAAA;IACnB,eAAe,EAAE;QAAE,IAAI,EAAE,WAAW,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACzD,MAAM,EAAE,YAAY,CAAA;CACrB;;;;;;;;;;IAuBA,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export const updateInitialMessages = async ({ assistantId, initialMessages, }) => {
|
|
1
|
+
export const updateInitialMessages = async ({ assistantId, initialMessages, prisma, }) => {
|
|
3
2
|
const messages = await prisma.$transaction(async (tx) => {
|
|
4
3
|
await tx.initialMessage.deleteMany({
|
|
5
4
|
where: { assistantId },
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type Prisma } from '@prisma/client';
|
|
2
|
-
export declare const createLog: ({ log }: {
|
|
1
|
+
import { type Prisma, type PrismaClient } from '@prisma/client';
|
|
2
|
+
export declare const createLog: ({ log, prisma, }: {
|
|
3
3
|
log: Prisma.LogUncheckedCreateInput;
|
|
4
|
+
prisma: PrismaClient;
|
|
4
5
|
}) => void | undefined;
|
|
5
6
|
//# sourceMappingURL=createLog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createLog.d.ts","sourceRoot":"","sources":["../../../src/lib/logs/createLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"createLog.d.ts","sourceRoot":"","sources":["../../../src/lib/logs/createLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG/D,eAAO,MAAM,SAAS,GAAI,kBAGvB;IACD,GAAG,EAAE,MAAM,CAAC,uBAAuB,CAAA;IACnC,MAAM,EAAE,YAAY,CAAA;CACrB,qBAYE,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { waitUntil } from '@vercel/functions';
|
|
2
|
-
|
|
3
|
-
export const createLog = ({ log }) => waitUntil(new Promise(async (resolve) => {
|
|
2
|
+
export const createLog = ({ log, prisma, }) => waitUntil(new Promise(async (resolve) => {
|
|
4
3
|
console.log('Logging error.');
|
|
5
4
|
await prisma.log.create({
|
|
6
5
|
data: log,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Prisma, Thread, Assistant } from '@prisma/client';
|
|
1
|
+
import type { Prisma, Thread, Assistant, PrismaClient } from '@prisma/client';
|
|
2
2
|
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
3
3
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
4
4
|
import type { McpConnection } from '../../types';
|
|
5
|
-
export declare const getTransport: ({ mcpServer, thread, assistant, }: {
|
|
5
|
+
export declare const getTransport: ({ mcpServer, thread, assistant, prisma, }: {
|
|
6
6
|
mcpServer: Prisma.McpServerGetPayload<{
|
|
7
7
|
include: {
|
|
8
8
|
stdioTransport: true;
|
|
@@ -12,8 +12,9 @@ export declare const getTransport: ({ mcpServer, thread, assistant, }: {
|
|
|
12
12
|
}>;
|
|
13
13
|
thread: Thread;
|
|
14
14
|
assistant: Assistant;
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
prisma: PrismaClient;
|
|
16
|
+
}) => StreamableHTTPClientTransport | SSEClientTransport;
|
|
17
|
+
export declare const connectMcpServer: ({ mcpServer, thread, assistant, prisma, }: {
|
|
17
18
|
mcpServer: Prisma.McpServerGetPayload<{
|
|
18
19
|
include: {
|
|
19
20
|
stdioTransport: true;
|
|
@@ -23,6 +24,7 @@ export declare const connectMcpServer: ({ mcpServer, thread, assistant, }: {
|
|
|
23
24
|
}>;
|
|
24
25
|
thread: Thread;
|
|
25
26
|
assistant: Assistant;
|
|
27
|
+
prisma: PrismaClient;
|
|
26
28
|
}) => Promise<{
|
|
27
29
|
mcpConnection: McpConnection;
|
|
28
30
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connectMcpServer.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/connectMcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"connectMcpServer.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/connectMcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAI7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAA;AAClG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAoB5C,eAAO,MAAM,YAAY,GAAI,2CAK1B;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,cAAc,EAAE,IAAI,CAAA;YACpB,aAAa,EAAE,IAAI,CAAA;YACnB,YAAY,EAAE,IAAI,CAAA;SACnB,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;CACrB,uDA0CA,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAU,2CAKpC;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,cAAc,EAAE,IAAI,CAAA;YACpB,aAAa,EAAE,IAAI,CAAA;YACnB,YAAY,EAAE,IAAI,CAAA;SACnB,CAAA;KACF,CAAC,CAAA;IACF,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,YAAY,CAAA;CACrB;mBAkBQ,aAAa;EAErB,CAAA"}
|
|
@@ -11,7 +11,7 @@ const fetchWithHeaders = ({ headers }) => (url, init) => {
|
|
|
11
11
|
const fetchHeaders = new Headers(Object.assign(Object.assign({}, ((_a = init === null || init === void 0 ? void 0 : init.headers) !== null && _a !== void 0 ? _a : {})), headers));
|
|
12
12
|
return fetch(url.toString(), Object.assign(Object.assign({}, init), { headers: fetchHeaders }));
|
|
13
13
|
};
|
|
14
|
-
export const getTransport = ({ mcpServer, thread, assistant, }) => {
|
|
14
|
+
export const getTransport = ({ mcpServer, thread, assistant, prisma, }) => {
|
|
15
15
|
if (mcpServer.transportType === TransportType.STDIO) {
|
|
16
16
|
throw new Error('STDIO transport is not supported.');
|
|
17
17
|
}
|
|
@@ -20,8 +20,9 @@ export const getTransport = ({ mcpServer, thread, assistant, }) => {
|
|
|
20
20
|
thread,
|
|
21
21
|
mcpServer,
|
|
22
22
|
assistant,
|
|
23
|
+
prisma,
|
|
23
24
|
});
|
|
24
|
-
const url = getUrl({ thread, mcpServer, assistant });
|
|
25
|
+
const url = getUrl({ thread, mcpServer, assistant, prisma });
|
|
25
26
|
return new StreamableHTTPClientTransport(new URL(url), {
|
|
26
27
|
requestInit: {
|
|
27
28
|
headers,
|
|
@@ -29,11 +30,12 @@ export const getTransport = ({ mcpServer, thread, assistant, }) => {
|
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
if (mcpServer.transportType === TransportType.SSE) {
|
|
32
|
-
const url = getUrl({ thread, mcpServer, assistant });
|
|
33
|
+
const url = getUrl({ thread, mcpServer, assistant, prisma });
|
|
33
34
|
const headers = getHeaders({
|
|
34
35
|
thread,
|
|
35
36
|
mcpServer,
|
|
36
37
|
assistant,
|
|
38
|
+
prisma,
|
|
37
39
|
});
|
|
38
40
|
return new SSEClientTransport(new URL(url), {
|
|
39
41
|
eventSourceInit: {
|
|
@@ -46,14 +48,14 @@ export const getTransport = ({ mcpServer, thread, assistant, }) => {
|
|
|
46
48
|
}
|
|
47
49
|
throw new Error(`Unknown transport type ${mcpServer.transportType}`);
|
|
48
50
|
};
|
|
49
|
-
export const connectMcpServer = async ({ mcpServer, thread, assistant, }) => {
|
|
51
|
+
export const connectMcpServer = async ({ mcpServer, thread, assistant, prisma, }) => {
|
|
50
52
|
const client = new Client({
|
|
51
53
|
name: 'superinterface-mcp-client',
|
|
52
54
|
version: '1.0.0',
|
|
53
55
|
}, {
|
|
54
56
|
capabilities: {},
|
|
55
57
|
});
|
|
56
|
-
const transport = getTransport({ mcpServer, thread, assistant });
|
|
58
|
+
const transport = getTransport({ mcpServer, thread, assistant, prisma });
|
|
57
59
|
await client.connect(transport);
|
|
58
60
|
return {
|
|
59
61
|
mcpConnection: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { Prisma, Thread } from '@prisma/client';
|
|
2
|
+
import { Prisma, Thread, PrismaClient } from '@prisma/client';
|
|
3
3
|
import type { McpConnection } from '../../types';
|
|
4
|
-
export declare const getToolCallMcpServer: ({ assistant, toolCall, thread, }: {
|
|
4
|
+
export declare const getToolCallMcpServer: ({ assistant, toolCall, thread, prisma, }: {
|
|
5
5
|
assistant: Prisma.AssistantGetPayload<{
|
|
6
6
|
include: {
|
|
7
7
|
mcpServers: {
|
|
@@ -15,6 +15,7 @@ export declare const getToolCallMcpServer: ({ assistant, toolCall, thread, }: {
|
|
|
15
15
|
}>;
|
|
16
16
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
17
17
|
thread: Thread;
|
|
18
|
+
prisma: PrismaClient;
|
|
18
19
|
}) => Promise<{
|
|
19
20
|
mcpConnection: McpConnection | null;
|
|
20
21
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getToolCallMcpServer.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/getToolCallMcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"getToolCallMcpServer.d.ts","sourceRoot":"","sources":["../../../src/lib/mcpServers/getToolCallMcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,eAAO,MAAM,oBAAoB,GAAU,0CAKxC;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,cAAc,EAAE,IAAI,CAAA;oBACpB,aAAa,EAAE,IAAI,CAAA;oBACnB,YAAY,EAAE,IAAI,CAAA;iBACnB,CAAA;aACF,CAAA;SACF,CAAA;KACF,CAAC,CAAA;IACF,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAA;IACjE,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;mBAmCmC,aAAa,GAAG,IAAI;EAEvD,CAAA"}
|