@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspaceAccessWhere.d.ts","sourceRoot":"","sources":["../../../src/lib/apiKeys/workspaceAccessWhere.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspaceAccessWhere.d.ts","sourceRoot":"","sources":["../../../src/lib/apiKeys/workspaceAccessWhere.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAG9D,eAAO,MAAM,oBAAoB,GAAU,2BAGxC;IACD,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,MAAM,EAAE,YAAY,CAAA;CACrB;;;;;;SAcA,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ApiKeyType } from '@prisma/client';
|
|
2
2
|
import { getApiKey } from './getApiKey';
|
|
3
|
-
export const workspaceAccessWhere = async ({ publicApiKey, }) => {
|
|
3
|
+
export const workspaceAccessWhere = async ({ publicApiKey, prisma, }) => {
|
|
4
4
|
const apiKey = await getApiKey({
|
|
5
5
|
authorization: publicApiKey ? `Bearer ${publicApiKey}` : null,
|
|
6
6
|
type: ApiKeyType.PUBLIC,
|
|
7
|
+
prisma,
|
|
7
8
|
});
|
|
8
9
|
if (!apiKey)
|
|
9
10
|
return null;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { OpenAI } from 'openai';
|
|
2
|
-
import { Prisma, Thread } from '@prisma/client';
|
|
2
|
+
import { Prisma, Thread, PrismaClient } from '@prisma/client';
|
|
3
3
|
type Args = {
|
|
4
4
|
select?: {
|
|
5
5
|
id?: boolean;
|
|
6
6
|
};
|
|
7
7
|
};
|
|
8
|
-
export declare const buildGetOpenaiAssistant: ({ assistant, thread, }: {
|
|
8
|
+
export declare const buildGetOpenaiAssistant: ({ assistant, thread, prisma, }: {
|
|
9
9
|
assistant: Prisma.AssistantGetPayload<{
|
|
10
10
|
include: {
|
|
11
11
|
tools: {
|
|
@@ -30,6 +30,7 @@ export declare const buildGetOpenaiAssistant: ({ assistant, thread, }: {
|
|
|
30
30
|
};
|
|
31
31
|
}>;
|
|
32
32
|
thread: Thread | null;
|
|
33
|
+
prisma: PrismaClient;
|
|
33
34
|
}) => ({ select: { id } }?: Args) => Promise<{
|
|
34
35
|
id: string;
|
|
35
36
|
object?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildGetOpenaiAssistant.d.ts","sourceRoot":"","sources":["../../../../src/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,
|
|
1
|
+
{"version":3,"file":"buildGetOpenaiAssistant.d.ts","sourceRoot":"","sources":["../../../../src/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EACL,MAAM,EACN,MAAM,EAGN,YAAY,EACb,MAAM,gBAAgB,CAAA;AAIvB,KAAK,IAAI,GAAG;IACV,MAAM,CAAC,EAAE;QACP,EAAE,CAAC,EAAE,OAAO,CAAA;KACb,CAAA;CACF,CAAA;AA8BD,eAAO,MAAM,uBAAuB,GACjC,gCAIE;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,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,EAAE,YAAY,CAAA;CACrB,MACM,qBAAiC,IAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0BhD,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TruncationType } from '@prisma/client';
|
|
1
|
+
import { TruncationType, } from '@prisma/client';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import { tools as getTools } from '../../../lib/tools/tools';
|
|
4
4
|
const truncationStrategy = ({ assistant, }) => {
|
|
@@ -20,7 +20,7 @@ const truncationStrategy = ({ assistant, }) => {
|
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
export const buildGetOpenaiAssistant = ({ assistant, thread, }) => async ({ select: { id = false } = {} } = {}) => {
|
|
23
|
+
export const buildGetOpenaiAssistant = ({ assistant, thread, prisma, }) => async ({ select: { id = false } = {} } = {}) => {
|
|
24
24
|
var _a, _b;
|
|
25
25
|
const args = { select: { id } };
|
|
26
26
|
if (args.select.id) {
|
|
@@ -37,7 +37,7 @@ export const buildGetOpenaiAssistant = ({ assistant, thread, }) => async ({ sele
|
|
|
37
37
|
instructions: assistant.instructions,
|
|
38
38
|
description: null,
|
|
39
39
|
tools: thread
|
|
40
|
-
? ((_b = (_a = (await getTools({ assistant, thread }))) === null || _a === void 0 ? void 0 : _a.tools) !== null && _b !== void 0 ? _b : [])
|
|
40
|
+
? ((_b = (_a = (await getTools({ assistant, thread, prisma }))) === null || _a === void 0 ? void 0 : _a.tools) !== null && _b !== void 0 ? _b : [])
|
|
41
41
|
: [],
|
|
42
42
|
metadata: {},
|
|
43
43
|
top_p: 1.0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/assistants/assistantClientAdapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EACL,YAAY,EACZ,MAAM,EAEN,MAAM,EACP,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/assistants/assistantClientAdapter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EACL,YAAY,EACZ,MAAM,EAEN,MAAM,EACP,MAAM,gBAAgB,CAAA;AAuHvB,eAAO,MAAM,sBAAsB,GAAI,gCAIpC;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,MAAM,EAAE,YAAY,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACvB,KAAG,MAgBqB,CAAA"}
|
|
@@ -23,7 +23,7 @@ const storageAdapter = ({ assistant, prisma, }) => {
|
|
|
23
23
|
}
|
|
24
24
|
throw new Error(`Invalid storage provider type: ${assistant.storageProviderType}`);
|
|
25
25
|
};
|
|
26
|
-
const runAdapter = ({ assistant, thread, }) => {
|
|
26
|
+
const runAdapter = ({ assistant, thread, prisma, }) => {
|
|
27
27
|
if (assistant.storageProviderType === StorageProviderType.SUPERINTERFACE_CLOUD) {
|
|
28
28
|
return completionsRunAdapter();
|
|
29
29
|
}
|
|
@@ -36,7 +36,11 @@ const runAdapter = ({ assistant, thread, }) => {
|
|
|
36
36
|
storageProviderType: assistant.storageProviderType,
|
|
37
37
|
})) {
|
|
38
38
|
return responsesRunAdapter({
|
|
39
|
-
getOpenaiAssistant: buildGetOpenaiAssistant({
|
|
39
|
+
getOpenaiAssistant: buildGetOpenaiAssistant({
|
|
40
|
+
assistant,
|
|
41
|
+
thread,
|
|
42
|
+
prisma,
|
|
43
|
+
}),
|
|
40
44
|
waitUntil,
|
|
41
45
|
});
|
|
42
46
|
}
|
|
@@ -55,5 +59,6 @@ export const assistantClientAdapter = ({ assistant, prisma, thread = null, }) =>
|
|
|
55
59
|
runAdapter: runAdapter({
|
|
56
60
|
assistant,
|
|
57
61
|
thread,
|
|
62
|
+
prisma,
|
|
58
63
|
}),
|
|
59
64
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { Prisma, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleComputerCall: ({ assistant, toolCall, thread, }: {
|
|
2
|
+
import { Prisma, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleComputerCall: ({ assistant, toolCall, thread, prisma, }: {
|
|
4
4
|
assistant: Prisma.AssistantGetPayload<{
|
|
5
5
|
include: {
|
|
6
6
|
tools: {
|
|
@@ -22,6 +22,7 @@ export declare const handleComputerCall: ({ assistant, toolCall, thread, }: {
|
|
|
22
22
|
}>;
|
|
23
23
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
24
24
|
thread: Thread;
|
|
25
|
+
prisma: PrismaClient;
|
|
25
26
|
}) => Promise<{
|
|
26
27
|
tool_call_id: string;
|
|
27
28
|
output: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/computerCalls/handleComputerCall/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,MAAM,EACN,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/computerCalls/handleComputerCall/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,MAAM,EACN,MAAM,EAKN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AA0BvB,eAAO,MAAM,kBAAkB,GAAU,0CAKtC;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;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;;;;;;;;EAoHA,CAAA"}
|
|
@@ -10,7 +10,7 @@ const getImageUrl = ({ mcpServerToolOutput, }) => {
|
|
|
10
10
|
return null;
|
|
11
11
|
return `data:${content.mimeType};base64,${content.data}`;
|
|
12
12
|
};
|
|
13
|
-
export const handleComputerCall = async ({ assistant, toolCall, thread, }) => {
|
|
13
|
+
export const handleComputerCall = async ({ assistant, toolCall, thread, prisma, }) => {
|
|
14
14
|
const tool = assistant.tools.find((tool) => tool.type === ToolType.COMPUTER_USE);
|
|
15
15
|
if (!tool || !tool.computerUseTool || !tool.computerUseTool.mcpServer) {
|
|
16
16
|
createLog({
|
|
@@ -24,6 +24,7 @@ export const handleComputerCall = async ({ assistant, toolCall, thread, }) => {
|
|
|
24
24
|
assistantId: assistant.id,
|
|
25
25
|
threadId: thread.id,
|
|
26
26
|
},
|
|
27
|
+
prisma,
|
|
27
28
|
});
|
|
28
29
|
return {
|
|
29
30
|
tool_call_id: toolCall.id,
|
|
@@ -34,6 +35,7 @@ export const handleComputerCall = async ({ assistant, toolCall, thread, }) => {
|
|
|
34
35
|
thread,
|
|
35
36
|
assistant,
|
|
36
37
|
mcpServer: tool.computerUseTool.mcpServer,
|
|
38
|
+
prisma,
|
|
37
39
|
});
|
|
38
40
|
try {
|
|
39
41
|
const mcpServerToolOutput = (await mcpConnection.client.callTool({
|
|
@@ -64,6 +66,7 @@ export const handleComputerCall = async ({ assistant, toolCall, thread, }) => {
|
|
|
64
66
|
assistantId: assistant.id,
|
|
65
67
|
threadId: thread.id,
|
|
66
68
|
},
|
|
69
|
+
prisma,
|
|
67
70
|
});
|
|
68
71
|
return {
|
|
69
72
|
tool_call_id: toolCall.id,
|
|
@@ -99,6 +102,7 @@ export const handleComputerCall = async ({ assistant, toolCall, thread, }) => {
|
|
|
99
102
|
assistantId: assistant.id,
|
|
100
103
|
threadId: thread.id,
|
|
101
104
|
},
|
|
105
|
+
prisma,
|
|
102
106
|
});
|
|
103
107
|
return {
|
|
104
108
|
tool_call_id: toolCall.id,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Assistant, Prisma } from '@prisma/client';
|
|
1
|
+
import type { Assistant, Prisma, PrismaClient } from '@prisma/client';
|
|
2
2
|
import type { HandlerInput } from '../../types';
|
|
3
3
|
export declare function createFunction<TInclude extends Prisma.FunctionInclude>(params: {
|
|
4
4
|
assistant: Assistant;
|
|
@@ -7,6 +7,7 @@ export declare function createFunction<TInclude extends Prisma.FunctionInclude>(
|
|
|
7
7
|
handler: HandlerInput;
|
|
8
8
|
};
|
|
9
9
|
include: TInclude;
|
|
10
|
+
prisma: PrismaClient;
|
|
10
11
|
}): Promise<Prisma.FunctionGetPayload<{
|
|
11
12
|
include: TInclude;
|
|
12
13
|
}>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createFunction.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/createFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"createFunction.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/createFunction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,wBAAsB,cAAc,CAClC,QAAQ,SAAS,MAAM,CAAC,eAAe,EACvC,MAAM,EAAE;IACR,SAAS,EAAE,SAAS,CAAA;IACpB,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,CAqB5D"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { prisma } from '../../lib/prisma';
|
|
2
1
|
import { handlerPrismaInput } from '../../lib/handlers/handlerPrismaInput';
|
|
3
2
|
export async function createFunction(params) {
|
|
4
|
-
const { assistant, parsedInput, include } = params;
|
|
3
|
+
const { assistant, parsedInput, include, prisma } = params;
|
|
5
4
|
return prisma.function.create({
|
|
6
5
|
data: {
|
|
7
6
|
openapiSpec: JSON.parse(parsedInput.openapiSpec),
|
|
@@ -11,6 +10,7 @@ export async function createFunction(params) {
|
|
|
11
10
|
parsedInput,
|
|
12
11
|
action: 'create',
|
|
13
12
|
assistant,
|
|
13
|
+
prisma,
|
|
14
14
|
}))),
|
|
15
15
|
},
|
|
16
16
|
},
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { AssistantHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleAssistant: ({ assistantHandler, toolCall, controller, run, assistant: parentAssistant, thread: parentThread, }: {
|
|
2
|
+
import { AssistantHandler, Assistant, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleAssistant: ({ assistantHandler, toolCall, controller, run, assistant: parentAssistant, thread: parentThread, prisma, }: {
|
|
4
4
|
assistantHandler: AssistantHandler;
|
|
5
5
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
6
6
|
controller: ReadableStreamDefaultController;
|
|
7
7
|
run: OpenAI.Beta.Threads.Runs.Run;
|
|
8
8
|
assistant: Assistant;
|
|
9
9
|
thread: Thread;
|
|
10
|
+
prisma: PrismaClient;
|
|
10
11
|
}) => Promise<{
|
|
11
12
|
tool_call_id: string;
|
|
12
13
|
output: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleAssistant.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAIhB,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"handleAssistant.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleAssistant.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAIhB,SAAS,EACT,MAAM,EACN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAgBvB,eAAO,MAAM,eAAe,GAAU,4GAQnC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,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;IACjC,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;EAkXA,CAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { LogRequestMethod, LogRequestRoute, LogLevel, } from '@prisma/client';
|
|
2
2
|
import { createMessageResponse } from '@superinterface/react/server';
|
|
3
|
-
import { prisma } from '../../../lib/prisma';
|
|
4
3
|
import { assistantClientAdapter } from '../../../lib/assistants/assistantClientAdapter';
|
|
5
4
|
import { createThread } from '../../../lib/threads/createThread';
|
|
6
5
|
import { managedOpenaiThreadId } from '../../../lib/threads/managedOpenaiThreadId';
|
|
@@ -14,7 +13,7 @@ import { isOpenaiAssistantsStorageProvider } from '../../../lib/storageProviders
|
|
|
14
13
|
import { map } from 'p-iteration';
|
|
15
14
|
import { redis } from '../../../lib/redis';
|
|
16
15
|
import { waitUntil } from '@vercel/functions';
|
|
17
|
-
export const handleAssistant = async ({ assistantHandler, toolCall, controller, run, assistant: parentAssistant, thread: parentThread, }) => {
|
|
16
|
+
export const handleAssistant = async ({ assistantHandler, toolCall, controller, run, assistant: parentAssistant, thread: parentThread, prisma, }) => {
|
|
18
17
|
var _a;
|
|
19
18
|
let args;
|
|
20
19
|
try {
|
|
@@ -33,6 +32,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
33
32
|
assistantId: parentAssistant.id,
|
|
34
33
|
threadId: parentThread.id,
|
|
35
34
|
},
|
|
35
|
+
prisma,
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
38
|
tool_call_id: toolCall.id,
|
|
@@ -100,6 +100,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
100
100
|
assistantId: parentAssistant.id,
|
|
101
101
|
threadId: parentThread.id,
|
|
102
102
|
},
|
|
103
|
+
prisma,
|
|
103
104
|
});
|
|
104
105
|
return {
|
|
105
106
|
tool_call_id: toolCall.id,
|
|
@@ -128,6 +129,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
128
129
|
workspaceId: assistant.workspaceId,
|
|
129
130
|
assistantId: assistant.id,
|
|
130
131
|
},
|
|
132
|
+
prisma,
|
|
131
133
|
});
|
|
132
134
|
return {
|
|
133
135
|
tool_call_id: toolCall.id,
|
|
@@ -153,6 +155,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
153
155
|
assistantId: assistant.id,
|
|
154
156
|
threadId: thread.id,
|
|
155
157
|
},
|
|
158
|
+
prisma,
|
|
156
159
|
});
|
|
157
160
|
return {
|
|
158
161
|
tool_call_id: toolCall.id,
|
|
@@ -167,6 +170,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
167
170
|
storageThreadId = await managedOpenaiThreadId({
|
|
168
171
|
assistant,
|
|
169
172
|
threadId: thread.id,
|
|
173
|
+
prisma,
|
|
170
174
|
});
|
|
171
175
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
|
|
172
176
|
}
|
|
@@ -182,6 +186,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
182
186
|
assistantId: assistant.id,
|
|
183
187
|
threadId: thread.id,
|
|
184
188
|
},
|
|
189
|
+
prisma,
|
|
185
190
|
});
|
|
186
191
|
return {
|
|
187
192
|
tool_call_id: toolCall.id,
|
|
@@ -201,6 +206,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
201
206
|
assistantId: assistant.id,
|
|
202
207
|
threadId: thread.id,
|
|
203
208
|
},
|
|
209
|
+
prisma,
|
|
204
210
|
});
|
|
205
211
|
return {
|
|
206
212
|
tool_call_id: toolCall.id,
|
|
@@ -236,6 +242,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
236
242
|
assistantId: assistant.id,
|
|
237
243
|
threadId: thread.id,
|
|
238
244
|
},
|
|
245
|
+
prisma,
|
|
239
246
|
});
|
|
240
247
|
return {
|
|
241
248
|
tool_call_id: toolCall.id,
|
|
@@ -246,6 +253,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
246
253
|
const runOpts = await createRunOpts({
|
|
247
254
|
assistant,
|
|
248
255
|
thread,
|
|
256
|
+
prisma,
|
|
249
257
|
});
|
|
250
258
|
try {
|
|
251
259
|
createRunStream = await client.beta.threads.runs.create(storageThreadId, runOpts);
|
|
@@ -263,6 +271,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
263
271
|
assistantId: assistant.id,
|
|
264
272
|
threadId: thread.id,
|
|
265
273
|
},
|
|
274
|
+
prisma,
|
|
266
275
|
});
|
|
267
276
|
return {
|
|
268
277
|
tool_call_id: toolCall.id,
|
|
@@ -275,6 +284,7 @@ export const handleAssistant = async ({ assistantHandler, toolCall, controller,
|
|
|
275
284
|
handleToolCall: handleToolCall({
|
|
276
285
|
assistant,
|
|
277
286
|
thread,
|
|
287
|
+
prisma,
|
|
278
288
|
}),
|
|
279
289
|
});
|
|
280
290
|
if (assistant.id === 'a606a15d-c9a2-45d3-8e54-ee088a500008') {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { ClientToolHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleClientTool: ({ clientToolHandler, toolCall, assistant, thread, controller, run, }: {
|
|
2
|
+
import { ClientToolHandler, Assistant, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleClientTool: ({ clientToolHandler, toolCall, assistant, thread, controller, run, prisma, }: {
|
|
4
4
|
clientToolHandler: ClientToolHandler;
|
|
5
5
|
toolCall: OpenAI.Beta.Threads.Runs.RequiredActionFunctionToolCall;
|
|
6
6
|
assistant: Assistant;
|
|
7
7
|
thread: Thread;
|
|
8
8
|
controller: ReadableStreamDefaultController;
|
|
9
9
|
run: OpenAI.Beta.Threads.Runs.Run;
|
|
10
|
+
prisma: PrismaClient;
|
|
10
11
|
}) => Promise<{
|
|
11
12
|
tool_call_id: string;
|
|
12
13
|
output: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleClientTool.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleClientTool.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"handleClientTool.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleClientTool.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,MAAM,EAIN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAKvB,eAAO,MAAM,gBAAgB,GAAU,8EAQpC;IACD,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8BAA8B,CAAA;IACjE,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,+BAA+B,CAAA;IAC3C,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAA;IACjC,MAAM,EAAE,YAAY,CAAA;CACrB;;;EAoGA,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { LogRequestMethod, LogRequestRoute, LogLevel, } from '@prisma/client';
|
|
|
2
2
|
import { createLog } from '../../../lib/logs/createLog';
|
|
3
3
|
import { enqueueJson } from '@superinterface/react/utils';
|
|
4
4
|
import { redis } from '../../../lib/redis';
|
|
5
|
-
export const handleClientTool = async ({ clientToolHandler, toolCall, assistant, thread, controller, run, }) => {
|
|
5
|
+
export const handleClientTool = async ({ clientToolHandler, toolCall, assistant, thread, controller, run, prisma, }) => {
|
|
6
6
|
let args = {};
|
|
7
7
|
const toolCallArguments = toolCall.function.arguments;
|
|
8
8
|
if (toolCallArguments) {
|
|
@@ -22,6 +22,7 @@ export const handleClientTool = async ({ clientToolHandler, toolCall, assistant,
|
|
|
22
22
|
assistantId: assistant.id,
|
|
23
23
|
threadId: thread.id,
|
|
24
24
|
},
|
|
25
|
+
prisma,
|
|
25
26
|
});
|
|
26
27
|
return {
|
|
27
28
|
tool_call_id: toolCall.id,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { FirecrawlHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleFirecrawl: ({ firecrawlHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { FirecrawlHandler, Assistant, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleFirecrawl: ({ firecrawlHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
firecrawlHandler: FirecrawlHandler;
|
|
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":"handleFirecrawl.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleFirecrawl.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAEhB,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"handleFirecrawl.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleFirecrawl.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAEhB,SAAS,EACT,MAAM,EAIN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAKvB,eAAO,MAAM,eAAe,GAAU,4DAMnC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,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;;;EAiMA,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { FirecrawlHandlerType, LogRequestMethod, LogRequestRoute, LogLevel, } fr
|
|
|
2
2
|
import FirecrawlApp from '@mendable/firecrawl-js';
|
|
3
3
|
import { omit } from 'radash';
|
|
4
4
|
import { createLog } from '../../../lib/logs/createLog';
|
|
5
|
-
export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, thread, }) => {
|
|
5
|
+
export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, thread, prisma, }) => {
|
|
6
6
|
var _a;
|
|
7
7
|
let args;
|
|
8
8
|
try {
|
|
@@ -21,6 +21,7 @@ export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, t
|
|
|
21
21
|
assistantId: assistant.id,
|
|
22
22
|
threadId: thread.id,
|
|
23
23
|
},
|
|
24
|
+
prisma,
|
|
24
25
|
});
|
|
25
26
|
return {
|
|
26
27
|
tool_call_id: toolCall.id,
|
|
@@ -53,6 +54,7 @@ export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, t
|
|
|
53
54
|
assistantId: assistant.id,
|
|
54
55
|
threadId: thread.id,
|
|
55
56
|
},
|
|
57
|
+
prisma,
|
|
56
58
|
});
|
|
57
59
|
return {
|
|
58
60
|
tool_call_id: toolCall.id,
|
|
@@ -81,6 +83,7 @@ export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, t
|
|
|
81
83
|
assistantId: assistant.id,
|
|
82
84
|
threadId: thread.id,
|
|
83
85
|
},
|
|
86
|
+
prisma,
|
|
84
87
|
});
|
|
85
88
|
return {
|
|
86
89
|
tool_call_id: toolCall.id,
|
|
@@ -109,6 +112,7 @@ export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, t
|
|
|
109
112
|
assistantId: assistant.id,
|
|
110
113
|
threadId: thread.id,
|
|
111
114
|
},
|
|
115
|
+
prisma,
|
|
112
116
|
});
|
|
113
117
|
return {
|
|
114
118
|
tool_call_id: toolCall.id,
|
|
@@ -145,6 +149,7 @@ export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, t
|
|
|
145
149
|
assistantId: assistant.id,
|
|
146
150
|
threadId: thread.id,
|
|
147
151
|
},
|
|
152
|
+
prisma,
|
|
148
153
|
});
|
|
149
154
|
return {
|
|
150
155
|
tool_call_id: toolCall.id,
|
|
@@ -164,6 +169,7 @@ export const handleFirecrawl = async ({ firecrawlHandler, toolCall, assistant, t
|
|
|
164
169
|
assistantId: assistant.id,
|
|
165
170
|
threadId: thread.id,
|
|
166
171
|
},
|
|
172
|
+
prisma,
|
|
167
173
|
});
|
|
168
174
|
return {
|
|
169
175
|
tool_call_id: toolCall.id,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { ReplicateHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleReplicate: ({ replicateHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { ReplicateHandler, Assistant, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleReplicate: ({ replicateHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
replicateHandler: ReplicateHandler;
|
|
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":"handleReplicate.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleReplicate.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAEhB,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"handleReplicate.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleReplicate.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,gBAAgB,EAEhB,SAAS,EACT,MAAM,EAIN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAKvB,eAAO,MAAM,eAAe,GAAU,4DAMnC;IACD,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,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;;;EAuFA,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { ReplicateHandlerType, LogRequestMethod, LogRequestRoute, LogLevel, } fr
|
|
|
2
2
|
import Replicate from 'replicate';
|
|
3
3
|
import { createLog } from '../../../lib/logs/createLog';
|
|
4
4
|
import { merge } from '../../../lib/misc/merge';
|
|
5
|
-
export const handleReplicate = async ({ replicateHandler, toolCall, assistant, thread, }) => {
|
|
5
|
+
export const handleReplicate = async ({ replicateHandler, toolCall, assistant, thread, prisma, }) => {
|
|
6
6
|
let args;
|
|
7
7
|
try {
|
|
8
8
|
args = JSON.parse(toolCall.function.arguments);
|
|
@@ -20,6 +20,7 @@ export const handleReplicate = async ({ replicateHandler, toolCall, assistant, t
|
|
|
20
20
|
assistantId: assistant.id,
|
|
21
21
|
threadId: thread.id,
|
|
22
22
|
},
|
|
23
|
+
prisma,
|
|
23
24
|
});
|
|
24
25
|
return {
|
|
25
26
|
tool_call_id: toolCall.id,
|
|
@@ -51,6 +52,7 @@ export const handleReplicate = async ({ replicateHandler, toolCall, assistant, t
|
|
|
51
52
|
assistantId: assistant.id,
|
|
52
53
|
threadId: thread.id,
|
|
53
54
|
},
|
|
55
|
+
prisma,
|
|
54
56
|
});
|
|
55
57
|
return {
|
|
56
58
|
tool_call_id: toolCall.id,
|
|
@@ -70,6 +72,7 @@ export const handleReplicate = async ({ replicateHandler, toolCall, assistant, t
|
|
|
70
72
|
assistantId: assistant.id,
|
|
71
73
|
threadId: thread.id,
|
|
72
74
|
},
|
|
75
|
+
prisma,
|
|
73
76
|
});
|
|
74
77
|
return {
|
|
75
78
|
tool_call_id: toolCall.id,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { RequestHandler, Assistant, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleRequest: ({ requestHandler, toolCall, assistant, thread, }: {
|
|
2
|
+
import { RequestHandler, Assistant, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleRequest: ({ requestHandler, toolCall, assistant, thread, prisma, }: {
|
|
4
4
|
requestHandler: RequestHandler;
|
|
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":"handleRequest.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleRequest.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,cAAc,EACd,SAAS,EACT,MAAM,
|
|
1
|
+
{"version":3,"file":"handleRequest.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/handleRequest.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,cAAc,EACd,SAAS,EACT,MAAM,EAIN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAgGvB,eAAO,MAAM,aAAa,GAAU,0DAMjC;IACD,cAAc,EAAE,cAAc,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;;;EAkKA,CAAA"}
|
|
@@ -50,7 +50,7 @@ const headers = ({ requestHandler, args, thread, assistant, }) => {
|
|
|
50
50
|
}
|
|
51
51
|
return { headers: result, missing };
|
|
52
52
|
};
|
|
53
|
-
export const handleRequest = async ({ requestHandler, toolCall, assistant, thread, }) => {
|
|
53
|
+
export const handleRequest = async ({ requestHandler, toolCall, assistant, thread, prisma, }) => {
|
|
54
54
|
let args = {};
|
|
55
55
|
try {
|
|
56
56
|
args = JSON.parse(toolCall.function.arguments);
|
|
@@ -68,6 +68,7 @@ export const handleRequest = async ({ requestHandler, toolCall, assistant, threa
|
|
|
68
68
|
assistantId: assistant.id,
|
|
69
69
|
threadId: thread.id,
|
|
70
70
|
},
|
|
71
|
+
prisma,
|
|
71
72
|
});
|
|
72
73
|
return {
|
|
73
74
|
tool_call_id: toolCall.id,
|
|
@@ -93,6 +94,7 @@ export const handleRequest = async ({ requestHandler, toolCall, assistant, threa
|
|
|
93
94
|
assistantId: assistant.id,
|
|
94
95
|
threadId: thread.id,
|
|
95
96
|
},
|
|
97
|
+
prisma,
|
|
96
98
|
});
|
|
97
99
|
return { tool_call_id: toolCall.id, output: message };
|
|
98
100
|
}
|
|
@@ -118,6 +120,7 @@ export const handleRequest = async ({ requestHandler, toolCall, assistant, threa
|
|
|
118
120
|
assistantId: assistant.id,
|
|
119
121
|
threadId: thread.id,
|
|
120
122
|
},
|
|
123
|
+
prisma,
|
|
121
124
|
});
|
|
122
125
|
return {
|
|
123
126
|
tool_call_id: toolCall.id,
|
|
@@ -145,6 +148,7 @@ export const handleRequest = async ({ requestHandler, toolCall, assistant, threa
|
|
|
145
148
|
assistantId: assistant.id,
|
|
146
149
|
threadId: thread.id,
|
|
147
150
|
},
|
|
151
|
+
prisma,
|
|
148
152
|
});
|
|
149
153
|
return {
|
|
150
154
|
tool_call_id: toolCall.id,
|
|
@@ -176,6 +180,7 @@ export const handleRequest = async ({ requestHandler, toolCall, assistant, threa
|
|
|
176
180
|
assistantId: assistant.id,
|
|
177
181
|
threadId: thread.id,
|
|
178
182
|
},
|
|
183
|
+
prisma,
|
|
179
184
|
});
|
|
180
185
|
return {
|
|
181
186
|
tool_call_id: toolCall.id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import { Prisma, Thread } from '@prisma/client';
|
|
3
|
-
export declare const handleFunction: ({ assistant, toolCall, controller, run, thread, }: {
|
|
2
|
+
import { Prisma, Thread, type PrismaClient } from '@prisma/client';
|
|
3
|
+
export declare const handleFunction: ({ assistant, toolCall, controller, run, thread, prisma, }: {
|
|
4
4
|
assistant: Prisma.AssistantGetPayload<{
|
|
5
5
|
include: {
|
|
6
6
|
mcpServers: {
|
|
@@ -33,6 +33,7 @@ export declare const handleFunction: ({ assistant, toolCall, controller, run, th
|
|
|
33
33
|
controller: ReadableStreamDefaultController;
|
|
34
34
|
run: OpenAI.Beta.Threads.Runs.Run;
|
|
35
35
|
thread: Thread;
|
|
36
|
+
prisma: PrismaClient;
|
|
36
37
|
}) => Promise<{
|
|
37
38
|
tool_call_id: string;
|
|
38
39
|
output: unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,MAAM,EAEN,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/functions/handleFunction/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EACL,MAAM,EAEN,MAAM,EAIN,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AAgBvB,eAAO,MAAM,cAAc,GAAU,2DAOlC;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;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,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;IACjC,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,YAAY,CAAA;CACrB;;;EAkbA,CAAA"}
|