@superinterface/server 1.0.5 → 1.0.6

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.
Files changed (65) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/fallback-build-manifest.json +2 -2
  5. package/.next/server/app/_not-found.html +1 -1
  6. package/.next/server/app/_not-found.rsc +1 -1
  7. package/.next/server/app/index.html +1 -1
  8. package/.next/server/app/index.rsc +1 -1
  9. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
  10. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
  11. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
  12. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
  13. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
  14. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
  15. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
  16. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
  17. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
  18. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
  19. package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
  20. package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
  21. package/.next/server/chunks/[root-of-the-server]__3ba06f7c._.js +1 -1
  22. package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
  23. package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
  24. package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
  25. package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
  26. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  27. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  28. package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
  29. package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
  30. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
  31. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
  32. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
  33. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
  34. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
  35. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
  36. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
  37. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
  38. package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js +1 -1
  39. package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js.map +1 -1
  40. package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
  41. package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
  42. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
  43. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
  44. package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
  45. package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
  46. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
  47. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
  48. package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
  49. package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
  50. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
  51. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
  52. package/.next/server/chunks/ssr/[root-of-the-server]__09232d18._.js +1 -1
  53. package/.next/server/chunks/ssr/[root-of-the-server]__09232d18._.js.map +1 -1
  54. package/.next/server/chunks/ssr/[root-of-the-server]__55cc8360._.js +1 -1
  55. package/.next/server/chunks/ssr/[root-of-the-server]__55cc8360._.js.map +1 -1
  56. package/.next/server/functions-config-manifest.json +2 -2
  57. package/.next/server/pages/404.html +1 -1
  58. package/.next/server/pages/500.html +1 -1
  59. package/.next/trace +1 -1
  60. package/package.json +2 -1
  61. package/scripts/commands/prisma/deploy.ts +32 -5
  62. package/scripts/utils/loadPrisma.ts +75 -1
  63. /package/.next/static/{AV1cmwx295lp-1-2s0TpY → eIqLpUWXibF0G0ipW0IC-}/_buildManifest.js +0 -0
  64. /package/.next/static/{AV1cmwx295lp-1-2s0TpY → eIqLpUWXibF0G0ipW0IC-}/_clientMiddlewareManifest.json +0 -0
  65. /package/.next/static/{AV1cmwx295lp-1-2s0TpY → eIqLpUWXibF0G0ipW0IC-}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/cache/cacheHeaders.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/apiKeys/getApiKey.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/misc/isJSON.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/mcpServers/serializeApiMcpServer.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/mcpServers/mcpServerSchema.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/route.ts","turbopack:///[project]/supercorp/superinterface/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["export const cacheHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type',\n}\n","import { ApiKeyType, ApiKey } from '@prisma/client'\nimport { validate } from 'uuid'\nimport { prisma } from '@/lib/prisma'\n\nexport const getApiKey = async ({\n authorization,\n type,\n}: {\n authorization: string | null\n type: ApiKeyType\n}): Promise<ApiKey | null> => {\n if (!authorization) {\n return null\n }\n\n const [, apiKeyValue] = authorization.split('Bearer ')\n\n if (!validate(apiKeyValue)) {\n return null\n }\n\n return prisma.apiKey.findFirst({\n where: { type, value: apiKeyValue },\n })\n}\n","export const isJSON = (value: string) => {\n try {\n JSON.parse(value)\n return true\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n return false\n }\n}\n","import type { Prisma, SseTransport, HttpTransport } from '@prisma/client'\n\nconst serializeApiSseTransport = ({\n sseTransport,\n}: {\n sseTransport: SseTransport\n}) => ({\n id: sseTransport.id,\n url: sseTransport.url,\n headers: sseTransport.headers,\n createdAt: sseTransport.createdAt.toISOString(),\n updatedAt: sseTransport.updatedAt.toISOString(),\n})\n\nconst serializeApiHttpTransport = ({\n httpTransport,\n}: {\n httpTransport: HttpTransport\n}) => ({\n id: httpTransport.id,\n url: httpTransport.url,\n headers: httpTransport.headers,\n createdAt: httpTransport.createdAt.toISOString(),\n updatedAt: httpTransport.updatedAt.toISOString(),\n})\n\nexport const serializeApiMcpServer = ({\n mcpServer,\n}: {\n mcpServer: Prisma.McpServerGetPayload<{\n include: {\n sseTransport: true\n httpTransport: true\n }\n }>\n}) => ({\n id: mcpServer.id,\n transportType: mcpServer.transportType,\n sseTransport: mcpServer.sseTransport\n ? serializeApiSseTransport({\n sseTransport: mcpServer.sseTransport,\n })\n : null,\n httpTransport: mcpServer.httpTransport\n ? serializeApiHttpTransport({\n httpTransport: mcpServer.httpTransport,\n })\n : null,\n createdAt: mcpServer.createdAt.toISOString(),\n updatedAt: mcpServer.updatedAt.toISOString(),\n})\n","import { z } from 'zod'\nimport { TransportType } from '@prisma/client'\nimport { isJSON } from '@/lib/misc/isJSON'\n\nconst stdioTransportSchema = z.object({\n command: z.string().min(1),\n args: z.string().min(1),\n})\n\nconst sseTransportSchema = z.object({\n url: z.string().min(1).url(),\n headers: z.string().min(1).refine(isJSON, {\n message: 'Must be a valid JSON string.',\n }),\n})\n\nconst httpTransportSchema = z.object({\n url: z.string().min(1).url(),\n headers: z.string().min(1).refine(isJSON, {\n message: 'Must be a valid JSON string.',\n }),\n})\n\nexport const baseSchema = z.object({\n transportType: z\n .nativeEnum(TransportType)\n .refine((t) => t !== TransportType.STDIO, {\n message: `transportType cannot be ${TransportType.STDIO}`,\n }),\n sseTransport: sseTransportSchema.nullable().optional(),\n httpTransport: httpTransportSchema.nullable().optional(),\n})\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const superRefine = (values: any, ctx: any) => {\n if (values.transportType === TransportType.STDIO) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Transport type ${TransportType.STDIO} is not allowed.`,\n })\n\n const result = stdioTransportSchema.safeParse(values.stdioTransport)\n\n if (result.success) return\n\n result.error.issues.forEach((issue) =>\n ctx.addIssue({\n ...issue,\n path: ['stdioTransport', ...issue.path],\n }),\n )\n } else if (values.transportType === TransportType.SSE) {\n const result = sseTransportSchema.safeParse(values.sseTransport)\n\n if (result.success) return\n\n result.error.issues.forEach((issue) =>\n ctx.addIssue({\n ...issue,\n path: ['sseTransport', ...issue.path],\n }),\n )\n } else if (values.transportType === TransportType.HTTP) {\n const result = httpTransportSchema.safeParse(values.httpTransport)\n\n if (result.success) return\n\n result.error.issues.forEach((issue) =>\n ctx.addIssue({\n ...issue,\n path: ['httpTransport', ...issue.path],\n }),\n )\n }\n}\n\nexport const mcpServerSchema = baseSchema.superRefine(superRefine)\n","import { type NextRequest, NextResponse } from 'next/server'\nimport { ApiKeyType, TransportType } from '@prisma/client'\nimport { headers } from 'next/headers'\nimport { cacheHeaders } from '@/lib/cache/cacheHeaders'\nimport { prisma } from '@/lib/prisma'\nimport { getApiKey } from '@/lib/apiKeys/getApiKey'\nimport { serializeApiMcpServer } from '@/lib/mcpServers/serializeApiMcpServer'\nimport { mcpServerSchema } from '@/lib/mcpServers/mcpServerSchema'\n\nexport const GET = async (\n _request: NextRequest,\n props: { params: Promise<{ assistantId: string }> },\n) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n type: ApiKeyType.PRIVATE,\n authorization,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const assistant = await prisma.assistant.findFirst({\n where: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n include: {\n mcpServers: {\n include: {\n stdioTransport: true,\n sseTransport: true,\n httpTransport: true,\n },\n orderBy: {\n createdAt: 'desc',\n },\n },\n },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n return NextResponse.json(\n {\n mcpServers: assistant.mcpServers.map((mcpServer) =>\n serializeApiMcpServer({\n mcpServer,\n }),\n ),\n },\n { headers: cacheHeaders },\n )\n}\n\nexport const POST = async (\n request: NextRequest,\n props: { params: Promise<{ assistantId: string }> },\n) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n authorization,\n type: ApiKeyType.PRIVATE,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const body = await request.json()\n const parsed = mcpServerSchema.safeParse(body)\n\n if (!parsed.success) {\n return NextResponse.json({ error: 'Invalid payload' }, { status: 400 })\n }\n\n const { transportType, sseTransport, httpTransport } = parsed.data\n\n const workspaceId = privateApiKey.workspaceId\n\n const assistant = await prisma.assistant.findFirst({\n where: { id: assistantId, workspaceId },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n const mcpServer = await prisma.mcpServer.create({\n data: {\n transportType,\n ...(transportType === TransportType.SSE\n ? {\n sseTransport: {\n create: {\n url: sseTransport!.url,\n headers: JSON.parse(sseTransport!.headers),\n },\n },\n }\n : {}),\n ...(transportType === TransportType.HTTP\n ? {\n httpTransport: {\n create: {\n url: httpTransport!.url,\n headers: JSON.parse(httpTransport!.headers),\n },\n },\n }\n : {}),\n assistant: {\n connect: {\n id: assistantId,\n workspaceId,\n },\n },\n },\n include: {\n stdioTransport: true,\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer }),\n },\n { headers: cacheHeaders },\n )\n}\n\nexport const OPTIONS = () =>\n NextResponse.json(\n {},\n {\n headers: cacheHeaders,\n },\n )\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/assistants/[assistantId]/mcp-servers/route\",\n pathname: \"/api/assistants/[assistantId]/mcp-servers\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n var _nextConfig_experimental;\n let srcPage = \"/api/assistants/[assistantId]/mcp-servers/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isRevalidate = isIsr && !supportsDynamicResponse;\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n cacheComponents: Boolean(nextConfig.experimental.cacheComponents),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: (_nextConfig_experimental = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental.cacheLife,\n isRevalidate,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext)=>routeModule.onRequestError(req, error, errorContext, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${req.url}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!getRequestMeta(req, 'minimalMode') && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate\n })\n }, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!getRequestMeta(req, 'minimalMode')) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate\n })\n });\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"6jCAAO,IAAM,EAAe,CAC1B,8BAA+B,IAC/B,+BAAgC,kCAChC,+BAAgC,cAClC,mDCHA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EA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ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/apiKeys/getApiKey.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/misc/isJSON.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/mcpServers/serializeApiMcpServer.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/mcpServers/mcpServerSchema.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/route.ts","turbopack:///[project]/supercorp/superinterface/node_modules/next/dist/esm/build/templates/app-route.js"],"sourcesContent":["export const cacheHeaders = {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type',\n}\n","import { ApiKeyType, ApiKey } from '@prisma/client'\nimport { validate } from 'uuid'\nimport { prisma } from '@/lib/prisma'\n\nexport const getApiKey = async ({\n authorization,\n type,\n}: {\n authorization: string | null\n type: ApiKeyType\n}): Promise<ApiKey | null> => {\n if (!authorization) {\n return null\n }\n\n const [, apiKeyValue] = authorization.split('Bearer ')\n\n if (!validate(apiKeyValue)) {\n return null\n }\n\n return prisma.apiKey.findFirst({\n where: { type, value: apiKeyValue },\n })\n}\n","export const isJSON = (value: string) => {\n try {\n JSON.parse(value)\n return true\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n return false\n }\n}\n","import type { Prisma, SseTransport, HttpTransport } from '@prisma/client'\n\nconst serializeApiSseTransport = ({\n sseTransport,\n}: {\n sseTransport: SseTransport\n}) => ({\n id: sseTransport.id,\n url: sseTransport.url,\n headers: sseTransport.headers,\n createdAt: sseTransport.createdAt.toISOString(),\n updatedAt: sseTransport.updatedAt.toISOString(),\n})\n\nconst serializeApiHttpTransport = ({\n httpTransport,\n}: {\n httpTransport: HttpTransport\n}) => ({\n id: httpTransport.id,\n url: httpTransport.url,\n headers: httpTransport.headers,\n createdAt: httpTransport.createdAt.toISOString(),\n updatedAt: httpTransport.updatedAt.toISOString(),\n})\n\nexport const serializeApiMcpServer = ({\n mcpServer,\n}: {\n mcpServer: Prisma.McpServerGetPayload<{\n include: {\n sseTransport: true\n httpTransport: true\n }\n }>\n}) => ({\n id: mcpServer.id,\n transportType: mcpServer.transportType,\n sseTransport: mcpServer.sseTransport\n ? serializeApiSseTransport({\n sseTransport: mcpServer.sseTransport,\n })\n : null,\n httpTransport: mcpServer.httpTransport\n ? serializeApiHttpTransport({\n httpTransport: mcpServer.httpTransport,\n })\n : null,\n createdAt: mcpServer.createdAt.toISOString(),\n updatedAt: mcpServer.updatedAt.toISOString(),\n})\n","import { z } from 'zod'\nimport { TransportType } from '@prisma/client'\nimport { isJSON } from '@/lib/misc/isJSON'\n\nconst stdioTransportSchema = z.object({\n command: z.string().min(1),\n args: z.string().min(1),\n})\n\nconst sseTransportSchema = z.object({\n url: z.string().min(1).url(),\n headers: z.string().min(1).refine(isJSON, {\n message: 'Must be a valid JSON string.',\n }),\n})\n\nconst httpTransportSchema = z.object({\n url: z.string().min(1).url(),\n headers: z.string().min(1).refine(isJSON, {\n message: 'Must be a valid JSON string.',\n }),\n})\n\nexport const baseSchema = z.object({\n transportType: z\n .nativeEnum(TransportType)\n .refine((t) => t !== TransportType.STDIO, {\n message: `transportType cannot be ${TransportType.STDIO}`,\n }),\n sseTransport: sseTransportSchema.nullable().optional(),\n httpTransport: httpTransportSchema.nullable().optional(),\n})\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const superRefine = (values: any, ctx: any) => {\n if (values.transportType === TransportType.STDIO) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Transport type ${TransportType.STDIO} is not allowed.`,\n })\n\n const result = stdioTransportSchema.safeParse(values.stdioTransport)\n\n if (result.success) return\n\n result.error.issues.forEach((issue) =>\n ctx.addIssue({\n ...issue,\n path: ['stdioTransport', ...issue.path],\n }),\n )\n } else if (values.transportType === TransportType.SSE) {\n const result = sseTransportSchema.safeParse(values.sseTransport)\n\n if (result.success) return\n\n result.error.issues.forEach((issue) =>\n ctx.addIssue({\n ...issue,\n path: ['sseTransport', ...issue.path],\n }),\n )\n } else if (values.transportType === TransportType.HTTP) {\n const result = httpTransportSchema.safeParse(values.httpTransport)\n\n if (result.success) return\n\n result.error.issues.forEach((issue) =>\n ctx.addIssue({\n ...issue,\n path: ['httpTransport', ...issue.path],\n }),\n )\n }\n}\n\nexport const mcpServerSchema = baseSchema.superRefine(superRefine)\n","import { type NextRequest, NextResponse } from 'next/server'\nimport { ApiKeyType, TransportType } from '@prisma/client'\nimport { headers } from 'next/headers'\nimport { cacheHeaders } from '@/lib/cache/cacheHeaders'\nimport { prisma } from '@/lib/prisma'\nimport { getApiKey } from '@/lib/apiKeys/getApiKey'\nimport { serializeApiMcpServer } from '@/lib/mcpServers/serializeApiMcpServer'\nimport { mcpServerSchema } from '@/lib/mcpServers/mcpServerSchema'\n\nexport const GET = async (\n _request: NextRequest,\n props: { params: Promise<{ assistantId: string }> },\n) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n type: ApiKeyType.PRIVATE,\n authorization,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const assistant = await prisma.assistant.findFirst({\n where: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n include: {\n mcpServers: {\n include: {\n stdioTransport: true,\n sseTransport: true,\n httpTransport: true,\n },\n orderBy: {\n createdAt: 'desc',\n },\n },\n },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n return NextResponse.json(\n {\n mcpServers: assistant.mcpServers.map((mcpServer) =>\n serializeApiMcpServer({\n mcpServer,\n }),\n ),\n },\n { headers: cacheHeaders },\n )\n}\n\nexport const POST = async (\n request: NextRequest,\n props: { params: Promise<{ assistantId: string }> },\n) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n authorization,\n type: ApiKeyType.PRIVATE,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const body = await request.json()\n const parsed = mcpServerSchema.safeParse(body)\n\n if (!parsed.success) {\n return NextResponse.json({ error: 'Invalid payload' }, { status: 400 })\n }\n\n const { transportType, sseTransport, httpTransport } = parsed.data\n\n const workspaceId = privateApiKey.workspaceId\n\n const assistant = await prisma.assistant.findFirst({\n where: { id: assistantId, workspaceId },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n const mcpServer = await prisma.mcpServer.create({\n data: {\n transportType,\n ...(transportType === TransportType.SSE\n ? {\n sseTransport: {\n create: {\n url: sseTransport!.url,\n headers: JSON.parse(sseTransport!.headers),\n },\n },\n }\n : {}),\n ...(transportType === TransportType.HTTP\n ? {\n httpTransport: {\n create: {\n url: httpTransport!.url,\n headers: JSON.parse(httpTransport!.headers),\n },\n },\n }\n : {}),\n assistant: {\n connect: {\n id: assistantId,\n workspaceId,\n },\n },\n },\n include: {\n stdioTransport: true,\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer }),\n },\n { headers: cacheHeaders },\n )\n}\n\nexport const OPTIONS = () =>\n NextResponse.json(\n {},\n {\n headers: cacheHeaders,\n },\n )\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/assistants/[assistantId]/mcp-servers/route\",\n pathname: \"/api/assistants/[assistantId]/mcp-servers\",\n filename: \"route\",\n bundlePath: \"\"\n },\n distDir: process.env.__NEXT_RELATIVE_DIST_DIR || '',\n relativeProjectDir: process.env.__NEXT_RELATIVE_PROJECT_DIR || '',\n resolvedPagePath: \"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/route.ts\",\n nextConfigOutput,\n userland\n});\n// Pull out the exports that we need to expose from the module. This should\n// be eliminated when we've moved the other routes to the new format. These\n// are used to hook into the route.\nconst { workAsyncStorage, workUnitAsyncStorage, serverHooks } = routeModule;\nfunction patchFetch() {\n return _patchFetch({\n workAsyncStorage,\n workUnitAsyncStorage\n });\n}\nexport { routeModule, workAsyncStorage, workUnitAsyncStorage, serverHooks, patchFetch, };\nexport async function handler(req, res, ctx) {\n var _nextConfig_experimental;\n let srcPage = \"/api/assistants/[assistantId]/mcp-servers/route\";\n // turbopack doesn't normalize `/index` in the page name\n // so we need to to process dynamic routes properly\n // TODO: fix turbopack providing differing value from webpack\n if (process.env.TURBOPACK) {\n srcPage = srcPage.replace(/\\/index$/, '') || '/';\n } else if (srcPage === '/index') {\n // we always normalize /index specifically\n srcPage = '/';\n }\n const multiZoneDraftMode = process.env.__NEXT_MULTI_ZONE_DRAFT_MODE;\n const prepareResult = await routeModule.prepare(req, res, {\n srcPage,\n multiZoneDraftMode\n });\n if (!prepareResult) {\n res.statusCode = 400;\n res.end('Bad Request');\n ctx.waitUntil == null ? void 0 : ctx.waitUntil.call(ctx, Promise.resolve());\n return null;\n }\n const { buildId, params, nextConfig, isDraftMode, prerenderManifest, routerServerContext, isOnDemandRevalidate, revalidateOnlyGenerated, resolvedPathname } = prepareResult;\n const normalizedSrcPage = normalizeAppPath(srcPage);\n let isIsr = Boolean(prerenderManifest.dynamicRoutes[normalizedSrcPage] || prerenderManifest.routes[resolvedPathname]);\n if (isIsr && !isDraftMode) {\n const isPrerendered = Boolean(prerenderManifest.routes[resolvedPathname]);\n const prerenderInfo = prerenderManifest.dynamicRoutes[normalizedSrcPage];\n if (prerenderInfo) {\n if (prerenderInfo.fallback === false && !isPrerendered) {\n throw new NoFallbackError();\n }\n }\n }\n let cacheKey = null;\n if (isIsr && !routeModule.isDev && !isDraftMode) {\n cacheKey = resolvedPathname;\n // ensure /index and / is normalized to one key\n cacheKey = cacheKey === '/index' ? '/' : cacheKey;\n }\n const supportsDynamicResponse = // If we're in development, we always support dynamic HTML\n routeModule.isDev === true || // If this is not SSG or does not have static paths, then it supports\n // dynamic HTML.\n !isIsr;\n // This is a revalidation request if the request is for a static\n // page and it is not being resumed from a postponed render and\n // it is not a dynamic RSC request then it is a revalidation\n // request.\n const isRevalidate = isIsr && !supportsDynamicResponse;\n const method = req.method || 'GET';\n const tracer = getTracer();\n const activeSpan = tracer.getActiveScopeSpan();\n const context = {\n params,\n prerenderManifest,\n renderOpts: {\n experimental: {\n cacheComponents: Boolean(nextConfig.experimental.cacheComponents),\n authInterrupts: Boolean(nextConfig.experimental.authInterrupts)\n },\n supportsDynamicResponse,\n incrementalCache: getRequestMeta(req, 'incrementalCache'),\n cacheLifeProfiles: (_nextConfig_experimental = nextConfig.experimental) == null ? void 0 : _nextConfig_experimental.cacheLife,\n isRevalidate,\n waitUntil: ctx.waitUntil,\n onClose: (cb)=>{\n res.on('close', cb);\n },\n onAfterTaskError: undefined,\n onInstrumentationRequestError: (error, _request, errorContext)=>routeModule.onRequestError(req, error, errorContext, routerServerContext)\n },\n sharedContext: {\n buildId\n }\n };\n const nodeNextReq = new NodeNextRequest(req);\n const nodeNextRes = new NodeNextResponse(res);\n const nextReq = NextRequestAdapter.fromNodeNextRequest(nodeNextReq, signalFromNodeResponse(res));\n try {\n const invokeRouteModule = async (span)=>{\n return routeModule.handle(nextReq, context).finally(()=>{\n if (!span) return;\n span.setAttributes({\n 'http.status_code': res.statusCode,\n 'next.rsc': false\n });\n const rootSpanAttributes = tracer.getRootSpanAttributes();\n // We were unable to get attributes, probably OTEL is not enabled\n if (!rootSpanAttributes) {\n return;\n }\n if (rootSpanAttributes.get('next.span_type') !== BaseServerSpan.handleRequest) {\n console.warn(`Unexpected root span type '${rootSpanAttributes.get('next.span_type')}'. Please report this Next.js issue https://github.com/vercel/next.js`);\n return;\n }\n const route = rootSpanAttributes.get('next.route');\n if (route) {\n const name = `${method} ${route}`;\n span.setAttributes({\n 'next.route': route,\n 'http.route': route,\n 'next.span_name': name\n });\n span.updateName(name);\n } else {\n span.updateName(`${method} ${req.url}`);\n }\n });\n };\n const handleResponse = async (currentSpan)=>{\n var _cacheEntry_value;\n const responseGenerator = async ({ previousCacheEntry })=>{\n try {\n if (!getRequestMeta(req, 'minimalMode') && isOnDemandRevalidate && revalidateOnlyGenerated && !previousCacheEntry) {\n res.statusCode = 404;\n // on-demand revalidate always sets this header\n res.setHeader('x-nextjs-cache', 'REVALIDATED');\n res.end('This page could not be found');\n return null;\n }\n const response = await invokeRouteModule(currentSpan);\n req.fetchMetrics = context.renderOpts.fetchMetrics;\n let pendingWaitUntil = context.renderOpts.pendingWaitUntil;\n // Attempt using provided waitUntil if available\n // if it's not we fallback to sendResponse's handling\n if (pendingWaitUntil) {\n if (ctx.waitUntil) {\n ctx.waitUntil(pendingWaitUntil);\n pendingWaitUntil = undefined;\n }\n }\n const cacheTags = context.renderOpts.collectedTags;\n // If the request is for a static response, we can cache it so long\n // as it's not edge.\n if (isIsr) {\n const blob = await response.blob();\n // Copy the headers from the response.\n const headers = toNodeOutgoingHttpHeaders(response.headers);\n if (cacheTags) {\n headers[NEXT_CACHE_TAGS_HEADER] = cacheTags;\n }\n if (!headers['content-type'] && blob.type) {\n headers['content-type'] = blob.type;\n }\n const revalidate = typeof context.renderOpts.collectedRevalidate === 'undefined' || context.renderOpts.collectedRevalidate >= INFINITE_CACHE ? false : context.renderOpts.collectedRevalidate;\n const expire = typeof context.renderOpts.collectedExpire === 'undefined' || context.renderOpts.collectedExpire >= INFINITE_CACHE ? undefined : context.renderOpts.collectedExpire;\n // Create the cache entry for the response.\n const cacheEntry = {\n value: {\n kind: CachedRouteKind.APP_ROUTE,\n status: response.status,\n body: Buffer.from(await blob.arrayBuffer()),\n headers\n },\n cacheControl: {\n revalidate,\n expire\n }\n };\n return cacheEntry;\n } else {\n // send response without caching if not ISR\n await sendResponse(nodeNextReq, nodeNextRes, response, context.renderOpts.pendingWaitUntil);\n return null;\n }\n } catch (err) {\n // if this is a background revalidate we need to report\n // the request error here as it won't be bubbled\n if (previousCacheEntry == null ? void 0 : previousCacheEntry.isStale) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: srcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate\n })\n }, routerServerContext);\n }\n throw err;\n }\n };\n const cacheEntry = await routeModule.handleResponse({\n req,\n nextConfig,\n cacheKey,\n routeKind: RouteKind.APP_ROUTE,\n isFallback: false,\n prerenderManifest,\n isRoutePPREnabled: false,\n isOnDemandRevalidate,\n revalidateOnlyGenerated,\n responseGenerator,\n waitUntil: ctx.waitUntil\n });\n // we don't create a cacheEntry for ISR\n if (!isIsr) {\n return null;\n }\n if ((cacheEntry == null ? void 0 : (_cacheEntry_value = cacheEntry.value) == null ? void 0 : _cacheEntry_value.kind) !== CachedRouteKind.APP_ROUTE) {\n var _cacheEntry_value1;\n throw Object.defineProperty(new Error(`Invariant: app-route received invalid cache entry ${cacheEntry == null ? void 0 : (_cacheEntry_value1 = cacheEntry.value) == null ? void 0 : _cacheEntry_value1.kind}`), \"__NEXT_ERROR_CODE\", {\n value: \"E701\",\n enumerable: false,\n configurable: true\n });\n }\n if (!getRequestMeta(req, 'minimalMode')) {\n res.setHeader('x-nextjs-cache', isOnDemandRevalidate ? 'REVALIDATED' : cacheEntry.isMiss ? 'MISS' : cacheEntry.isStale ? 'STALE' : 'HIT');\n }\n // Draft mode should never be cached\n if (isDraftMode) {\n res.setHeader('Cache-Control', 'private, no-cache, no-store, max-age=0, must-revalidate');\n }\n const headers = fromNodeOutgoingHttpHeaders(cacheEntry.value.headers);\n if (!(getRequestMeta(req, 'minimalMode') && isIsr)) {\n headers.delete(NEXT_CACHE_TAGS_HEADER);\n }\n // If cache control is already set on the response we don't\n // override it to allow users to customize it via next.config\n if (cacheEntry.cacheControl && !res.getHeader('Cache-Control') && !headers.get('Cache-Control')) {\n headers.set('Cache-Control', getCacheControlHeader(cacheEntry.cacheControl));\n }\n await sendResponse(nodeNextReq, nodeNextRes, new Response(cacheEntry.value.body, {\n headers,\n status: cacheEntry.value.status || 200\n }));\n return null;\n };\n // TODO: activeSpan code path is for when wrapped by\n // next-server can be removed when this is no longer used\n if (activeSpan) {\n await handleResponse(activeSpan);\n } else {\n await tracer.withPropagatedContext(req.headers, ()=>tracer.trace(BaseServerSpan.handleRequest, {\n spanName: `${method} ${req.url}`,\n kind: SpanKind.SERVER,\n attributes: {\n 'http.method': method,\n 'http.target': req.url\n }\n }, handleResponse));\n }\n } catch (err) {\n if (!(err instanceof NoFallbackError)) {\n await routeModule.onRequestError(req, err, {\n routerKind: 'App Router',\n routePath: normalizedSrcPage,\n routeType: 'route',\n revalidateReason: getRevalidateReason({\n isRevalidate,\n isOnDemandRevalidate\n })\n });\n }\n // rethrow so that we can handle serving error page\n // If this is during static generation, throw the error again.\n if (isIsr) throw err;\n // Otherwise, send a 500 response.\n await sendResponse(nodeNextReq, nodeNextRes, new Response(null, {\n status: 500\n }));\n return null;\n }\n}\n\n//# sourceMappingURL=app-route.js.map\n"],"names":[],"mappings":"6jCAAO,IAAM,EAAe,CAC1B,8BAA+B,IAC/B,+BAAgC,kCAChC,+BAAgC,cAClC,mDCHA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAAY,MAAO,eAC9B,CAAa,CACb,MAAI,CAIL,IACC,GAAI,CAAC,EACH,OAAO,KAGT,CAJoB,EAId,EAAG,EAAY,CAAG,EAAc,KAAK,CAAC,iBAE5C,AAAK,CAAA,EAAA,CAAD,CAAC,QAAA,AAAQ,EAAC,GAIP,EAAA,MAAM,CAAC,EAJc,IAIR,CAAC,SAAS,CAAC,CAC7B,MAAO,MAAE,EAAM,MAAO,CAAY,CACpC,GALS,IAMX,gDCxBO,IAAM,EAAS,AAAC,IACrB,GAAI,CAEF,OADA,KAAK,KAAK,CAAC,IACJ,CAET,CAAE,MAAO,EAAG,CACV,OAAO,CACT,CACF,0ECkBO,IAAM,EAAwB,CAAC,WACpC,CAAS,CAQV,GAAK,CAAC,CACL,GAAI,EAAU,EAAE,CAChB,cAAe,EAAU,aAAa,CACtC,aAAc,EAAU,YAAY,CAChC,CArC2B,CAAC,cAChC,CAAY,CAGb,GAAK,CAAC,CACL,GAAI,EAAa,EAAE,CACnB,IAAK,EAAa,GAAG,CACrB,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,EAAE,EAAI,GAAG,CAAA,CAAE,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GAAG,AAC1B,CACJ,EAAG,GAEf,CAAE,MAAO,EAAK,CAcV,GAbM,AAAF,CAAC,YAAgB,EAAA,eAAe,EAChC,CADmC,KAC7B,EAAY,cAAc,CAAC,EAAK,EAAK,CACvC,WAAY,aACZ,UAAW,EACX,UAAW,QACX,iBAAkB,CAAA,EAAA,EAAA,mBAAA,AAAmB,EAAC,cAClC,uBACA,CACJ,EACJ,GAIA,EAAO,MAAM,EAKjB,OAHA,MAAM,CAAA,EAAA,EAAA,YAAA,AAAY,EAAC,EAAa,EAAa,IAAI,SAAS,KAAM,CAC5D,OAAQ,GACZ,IACO,IACX,CACJ,EAEA,qCAAqC","ignoreList":[6]}
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},36929,(a,b,c)=>{},63668,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return f}});let d=a.r(32623),e=a.r(8404);function f(){return(0,d.jsx)(e.HTTPAccessErrorFallback,{status:401,message:"You're not authorized to access this page."})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)}];
1
+ module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},36929,a=>{"use strict";a.s([])},63668,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return f}});let d=a.r(32623),e=a.r(8404);function f(){return(0,d.jsx)(e.HTTPAccessErrorFallback,{status:401,message:"You're not authorized to access this page."})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__09232d18._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["turbopack:///[project]/supercorp/superinterface/node_modules/next/src/client/components/builtin/unauthorized.tsx"],"sourcesContent":["import { HTTPAccessErrorFallback } from '../http-access-fallback/error-fallback'\n\nexport default function Unauthorized() {\n return (\n <HTTPAccessErrorFallback\n status={401}\n message=\"You're not authorized to access this page.\"\n />\n )\n}\n"],"names":["Unauthorized","HTTPAccessErrorFallback","status","message"],"mappings":"+RAEA,UAAA,qCAAwBA,0BAFgB,CAAA,CAAA,IAAA,EAEzB,SAASA,IACtB,MACE,CADF,AACE,EAAA,EAAA,GAAA,EAACC,EADH,AACGA,uBAAuB,CAAA,CACtBC,OAAQ,IACRC,QAAQ,8CAGd","ignoreList":[0]}
1
+ {"version":3,"sources":["turbopack:///[project]/supercorp/superinterface/node_modules/next/src/client/components/builtin/unauthorized.tsx"],"sourcesContent":["import { HTTPAccessErrorFallback } from '../http-access-fallback/error-fallback'\n\nexport default function Unauthorized() {\n return (\n <HTTPAccessErrorFallback\n status={401}\n message=\"You're not authorized to access this page.\"\n />\n )\n}\n"],"names":["Unauthorized","HTTPAccessErrorFallback","status","message"],"mappings":"6SAEA,UAAA,qCAAwBA,0BAFgB,CAAA,CAAA,IAAA,EAEzB,SAASA,IACtB,MACE,CADF,AACE,EAAA,EAAA,GAAA,EAACC,EADH,AACGA,uBAAuB,CAAA,CACtBC,OAAQ,IACRC,QAAQ,8CAGd","ignoreList":[0]}
@@ -1,3 +1,3 @@
1
- module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},25456,(a,b,c)=>{},55789,a=>{"use strict";a.s(["default",()=>c]);var b=a.i(32623);function c(){return(0,b.jsx)("div",{children:"@superinterface/server is running."})}}];
1
+ module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},25456,a=>{"use strict";a.s([])},55789,a=>{"use strict";a.s(["default",()=>c]);var b=a.i(32623);function c(){return(0,b.jsx)("div",{children:"@superinterface/server is running."})}}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__55cc8360._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["turbopack:///[project]/supercorp/superinterface/packages/server/src/app/page.tsx"],"sourcesContent":["export default function Page() {\n return <div>@superinterface/server is running.</div>\n}\n"],"names":[],"mappings":"wPAAe,SAAS,IACtB,MAAO,CAAA,EAAA,EAAA,GAAA,EAAC,MAAA,UAAI,sCACd"}
1
+ {"version":3,"sources":["turbopack:///[project]/supercorp/superinterface/packages/server/src/app/page.tsx"],"sourcesContent":["export default function Page() {\n return <div>@superinterface/server is running.</div>\n}\n"],"names":[],"mappings":"sQAAe,SAAS,IACtB,MAAO,CAAA,EAAA,EAAA,GAAA,EAAC,MAAA,UAAI,sCACd"}
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "version": 1,
3
3
  "functions": {
4
- "/api/messages": {
4
+ "/api/tasks/callback": {
5
5
  "maxDuration": 800
6
6
  },
7
- "/api/tasks/callback": {
7
+ "/api/messages": {
8
8
  "maxDuration": 800
9
9
  }
10
10
  }
@@ -1 +1 @@
1
- <!DOCTYPE html><!--AV1cmwx295lp_1_2s0TpY--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/76a8a50dbf44f000.js"/><script src="/_next/static/chunks/079ce3572ffa07f6.js" async=""></script><script src="/_next/static/chunks/4649e58e35bcde4b.js" async=""></script><script src="/_next/static/chunks/turbopack-11882cf18a9eb231.js" async=""></script><script src="/_next/static/chunks/03d938d038bc30e3.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/76a8a50dbf44f000.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[96352,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"default\"]\n3:I[17753,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"default\"]\n4:I[51035,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"OutletBoundary\"]\n6:I[33159,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"AsyncMetadataOutlet\"]\n8:I[51035,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"ViewportBoundary\"]\na:I[51035,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"MetadataBoundary\"]\nb:\"$Sreact.suspense\"\nd:I[25098,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"AV1cmwx295lp-1-2s0TpY\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/03d938d038bc30e3.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$L5\",[\"$\",\"$L6\",null,{\"promise\":\"$@7\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],null],[\"$\",\"$La\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$b\",null,{\"fallback\":null,\"children\":\"$Lc\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,"7:{\"metadata\":[],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"c:\"$7:metadata\"\n"])</script></body></html>
1
+ <!DOCTYPE html><!--eIqLpUWXibF0G0ipW0IC_--><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/76a8a50dbf44f000.js"/><script src="/_next/static/chunks/079ce3572ffa07f6.js" async=""></script><script src="/_next/static/chunks/4649e58e35bcde4b.js" async=""></script><script src="/_next/static/chunks/turbopack-11882cf18a9eb231.js" async=""></script><script src="/_next/static/chunks/03d938d038bc30e3.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/76a8a50dbf44f000.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[96352,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"default\"]\n3:I[17753,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"default\"]\n4:I[51035,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"OutletBoundary\"]\n6:I[33159,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"AsyncMetadataOutlet\"]\n8:I[51035,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"ViewportBoundary\"]\na:I[51035,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"MetadataBoundary\"]\nb:\"$Sreact.suspense\"\nd:I[25098,[\"/_next/static/chunks/03d938d038bc30e3.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"eIqLpUWXibF0G0ipW0IC-\",\"p\":\"\",\"c\":[\"\",\"_not-found\"],\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[\"\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/03d938d038bc30e3.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"children\":[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}]}]]}],{\"children\":[\"/_not-found\",[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:1:props:children:1:props:children:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L4\",null,{\"children\":[\"$L5\",[\"$\",\"$L6\",null,{\"promise\":\"$@7\"}]]}]]}],{},null,false]},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],null],[\"$\",\"$La\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$b\",null,{\"fallback\":null,\"children\":\"$Lc\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",\"$undefined\"],\"s\":false,\"S\":true}\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,"7:{\"metadata\":[],\"error\":null,\"digest\":\"$undefined\"}\n"])</script><script>self.__next_f.push([1,"c:\"$7:metadata\"\n"])</script></body></html>
@@ -1 +1 @@
1
- <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/a6dad97d9634a72d.js"></script><script src="/_next/static/chunks/22bca0be24d1dbb3.js" defer=""></script><script src="/_next/static/chunks/bd1a5816a611d718.js" defer=""></script><script src="/_next/static/chunks/turbopack-3bdbb570d8566903.js" defer=""></script><script src="/_next/static/chunks/e57ec661e9850a31.js" defer=""></script><script src="/_next/static/chunks/turbopack-67ff8c1c5b1ad9a8.js" defer=""></script><script src="/_next/static/AV1cmwx295lp-1-2s0TpY/_ssgManifest.js" defer=""></script><script src="/_next/static/AV1cmwx295lp-1-2s0TpY/_buildManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"AV1cmwx295lp-1-2s0TpY","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
1
+ <!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/a6dad97d9634a72d.js"></script><script src="/_next/static/chunks/22bca0be24d1dbb3.js" defer=""></script><script src="/_next/static/chunks/bd1a5816a611d718.js" defer=""></script><script src="/_next/static/chunks/turbopack-3bdbb570d8566903.js" defer=""></script><script src="/_next/static/chunks/e57ec661e9850a31.js" defer=""></script><script src="/_next/static/chunks/turbopack-67ff8c1c5b1ad9a8.js" defer=""></script><script src="/_next/static/eIqLpUWXibF0G0ipW0IC-/_ssgManifest.js" defer=""></script><script src="/_next/static/eIqLpUWXibF0G0ipW0IC-/_buildManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"eIqLpUWXibF0G0ipW0IC-","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
package/.next/trace CHANGED
@@ -1 +1 @@
1
- [{"name":"generate-buildid","duration":147,"timestamp":4796047400,"id":4,"parentId":1,"tags":{},"startTime":1759896308361,"traceId":"a26e44ee902bd4fd"},{"name":"load-custom-routes","duration":182,"timestamp":4796047598,"id":5,"parentId":1,"tags":{},"startTime":1759896308361,"traceId":"a26e44ee902bd4fd"},{"name":"create-dist-dir","duration":1974,"timestamp":4796092215,"id":6,"parentId":1,"tags":{},"startTime":1759896308406,"traceId":"a26e44ee902bd4fd"},{"name":"create-pages-mapping","duration":2441,"timestamp":4796135572,"id":7,"parentId":1,"tags":{},"startTime":1759896308449,"traceId":"a26e44ee902bd4fd"},{"name":"collect-app-files","duration":4975,"timestamp":4796138046,"id":8,"parentId":1,"tags":{},"startTime":1759896308451,"traceId":"a26e44ee902bd4fd"},{"name":"create-app-mapping","duration":927,"timestamp":4796143043,"id":9,"parentId":1,"tags":{},"startTime":1759896308456,"traceId":"a26e44ee902bd4fd"},{"name":"create-app-layouts","duration":186,"timestamp":4796143984,"id":10,"parentId":1,"tags":{},"startTime":1759896308457,"traceId":"a26e44ee902bd4fd"},{"name":"collect-default-files","duration":859,"timestamp":4796147325,"id":12,"parentId":1,"tags":{},"startTime":1759896308461,"traceId":"a26e44ee902bd4fd"},{"name":"generate-route-types","duration":27097,"timestamp":4796144465,"id":11,"parentId":1,"tags":{},"startTime":1759896308458,"traceId":"a26e44ee902bd4fd"},{"name":"public-dir-conflict-check","duration":685,"timestamp":4796171685,"id":13,"parentId":1,"tags":{},"startTime":1759896308485,"traceId":"a26e44ee902bd4fd"},{"name":"generate-routes-manifest","duration":2103,"timestamp":4796172490,"id":14,"parentId":1,"tags":{},"startTime":1759896308486,"traceId":"a26e44ee902bd4fd"},{"name":"run-turbopack-compiler","duration":7969853,"timestamp":4796192295,"id":16,"parentId":1,"tags":{},"startTime":1759896308506,"traceId":"a26e44ee902bd4fd"},{"name":"verify-and-lint","duration":1655817,"timestamp":4804183992,"id":19,"parentId":1,"tags":{},"startTime":1759896316497,"traceId":"a26e44ee902bd4fd"},{"name":"verify-typescript-setup","duration":4978483,"timestamp":4804180022,"id":18,"parentId":1,"tags":{},"startTime":1759896316493,"traceId":"a26e44ee902bd4fd"},{"name":"check-static-error-page","duration":2835,"timestamp":4809168813,"id":22,"parentId":21,"tags":{},"startTime":1759896321482,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":2040,"timestamp":4809256699,"id":23,"parentId":21,"tags":{"page":"/_app"},"startTime":1759896321570,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":1470,"timestamp":4809257278,"id":25,"parentId":21,"tags":{"page":"/_document"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":1530,"timestamp":4809257220,"id":24,"parentId":21,"tags":{"page":"/_error"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":317446,"timestamp":4809264309,"id":52,"parentId":28,"tags":{},"startTime":1759896321578,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":324432,"timestamp":4809257369,"id":28,"parentId":21,"tags":{"page":"/api/api-keys"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":333981,"timestamp":4809260478,"id":50,"parentId":46,"tags":{},"startTime":1759896321574,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":336940,"timestamp":4809257547,"id":46,"parentId":21,"tags":{"page":"/api/threads/runs/submit-client-tool-outputs"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":338555,"timestamp":4809265600,"id":55,"parentId":35,"tags":{},"startTime":1759896321579,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":346696,"timestamp":4809257488,"id":35,"parentId":21,"tags":{"page":"/api/assistants"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":339506,"timestamp":4809264749,"id":53,"parentId":27,"tags":{},"startTime":1759896321578,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":346912,"timestamp":4809257354,"id":27,"parentId":21,"tags":{"page":"/api/api-keys/[apiKeyId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":340388,"timestamp":4809263904,"id":51,"parentId":31,"tags":{},"startTime":1759896321577,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":346850,"timestamp":4809257449,"id":31,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/initial-messages"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":339074,"timestamp":4809265245,"id":54,"parentId":29,"tags":{},"startTime":1759896321579,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":346949,"timestamp":4809257377,"id":29,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/functions/[functionId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":343305,"timestamp":4809267609,"id":62,"parentId":42,"tags":{},"startTime":1759896321581,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":353412,"timestamp":4809257524,"id":42,"parentId":21,"tags":{"page":"/api/providers"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":349968,"timestamp":4809267995,"id":63,"parentId":41,"tags":{},"startTime":1759896321581,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":360468,"timestamp":4809257519,"id":41,"parentId":21,"tags":{"page":"/api/providers/[modelProviderId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":360235,"timestamp":4809266767,"id":58,"parentId":34,"tags":{},"startTime":1759896321580,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":369549,"timestamp":4809257481,"id":34,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":380921,"timestamp":4809268230,"id":64,"parentId":45,"tags":{},"startTime":1759896321582,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":391637,"timestamp":4809257539,"id":45,"parentId":21,"tags":{"page":"/api/tasks"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":389989,"timestamp":4809268722,"id":65,"parentId":43,"tags":{},"startTime":1759896321582,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":401250,"timestamp":4809257529,"id":43,"parentId":21,"tags":{"page":"/api/tasks/[taskId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":402708,"timestamp":4809267118,"id":59,"parentId":33,"tags":{},"startTime":1759896321580,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":412415,"timestamp":4809257474,"id":33,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/mcp-servers"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":421435,"timestamp":4809268987,"id":66,"parentId":47,"tags":{},"startTime":1759896321582,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":432897,"timestamp":4809257553,"id":47,"parentId":21,"tags":{"page":"/api/workspaces/[workspaceId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":440149,"timestamp":4809270786,"id":69,"parentId":26,"tags":{},"startTime":1759896321584,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":453667,"timestamp":4809257293,"id":26,"parentId":21,"tags":{"page":"/_not-found"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":449757,"timestamp":4809271026,"id":70,"parentId":48,"tags":{},"startTime":1759896321584,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":463250,"timestamp":4809257558,"id":48,"parentId":21,"tags":{"page":"/api/workspaces"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":459939,"timestamp":4809271285,"id":71,"parentId":30,"tags":{},"startTime":1759896321585,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":473913,"timestamp":4809257384,"id":30,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/functions"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":463573,"timestamp":4809271685,"id":72,"parentId":32,"tags":{},"startTime":1759896321585,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":477826,"timestamp":4809257462,"id":32,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":466219,"timestamp":4809274525,"id":73,"parentId":49,"tags":{},"startTime":1759896321588,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":483205,"timestamp":4809257565,"id":49,"parentId":21,"tags":{"page":"/"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":561407,"timestamp":4809267402,"id":61,"parentId":39,"tags":{},"startTime":1759896321581,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":571352,"timestamp":4809257509,"id":39,"parentId":21,"tags":{"page":"/api/providers/[modelProviderId]/assistants"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":584621,"timestamp":4809267263,"id":60,"parentId":40,"tags":{},"startTime":1759896321581,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":594433,"timestamp":4809257514,"id":40,"parentId":21,"tags":{"page":"/api/providers/[modelProviderId]/models"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":600221,"timestamp":4809266151,"id":57,"parentId":37,"tags":{},"startTime":1759896321580,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":608906,"timestamp":4809257498,"id":37,"parentId":21,"tags":{"page":"/api/files"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":603429,"timestamp":4809265864,"id":56,"parentId":36,"tags":{},"startTime":1759896321579,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":611819,"timestamp":4809257493,"id":36,"parentId":21,"tags":{"page":"/api/files/[fileId]/contents"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":652753,"timestamp":4809270723,"id":68,"parentId":44,"tags":{},"startTime":1759896321584,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":665999,"timestamp":4809257534,"id":44,"parentId":21,"tags":{"page":"/api/tasks/callback"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"is-page-static","duration":661009,"timestamp":4809270283,"id":67,"parentId":38,"tags":{},"startTime":1759896321584,"traceId":"a26e44ee902bd4fd"},{"name":"check-page","duration":673835,"timestamp":4809257504,"id":38,"parentId":21,"tags":{"page":"/api/messages"},"startTime":1759896321571,"traceId":"a26e44ee902bd4fd"},{"name":"static-check","duration":763165,"timestamp":4809168208,"id":21,"parentId":1,"tags":{},"startTime":1759896321482,"traceId":"a26e44ee902bd4fd"},{"name":"generate-required-server-files","duration":225,"timestamp":4809931714,"id":75,"parentId":1,"tags":{},"startTime":1759896322245,"traceId":"a26e44ee902bd4fd"},{"name":"write-routes-manifest","duration":647,"timestamp":4809938014,"id":77,"parentId":1,"tags":{},"startTime":1759896322251,"traceId":"a26e44ee902bd4fd"},{"name":"load-dotenv","duration":15,"timestamp":4809953625,"id":80,"parentId":79,"tags":{},"startTime":1759896322267,"traceId":"a26e44ee902bd4fd"},{"name":"run-export-path-map","duration":336,"timestamp":4810063960,"id":81,"parentId":79,"tags":{},"startTime":1759896322377,"traceId":"a26e44ee902bd4fd"},{"name":"next-export","duration":1060333,"timestamp":4809953069,"id":79,"parentId":1,"tags":{},"startTime":1759896322266,"traceId":"a26e44ee902bd4fd"},{"name":"move-exported-app-not-found-","duration":3365,"timestamp":4811014512,"id":82,"parentId":78,"tags":{},"startTime":1759896323328,"traceId":"a26e44ee902bd4fd"},{"name":"move-exported-page","duration":37127,"timestamp":4811017978,"id":83,"parentId":78,"tags":{},"startTime":1759896323331,"traceId":"a26e44ee902bd4fd"},{"name":"static-generation","duration":1458432,"timestamp":4809947824,"id":78,"parentId":1,"tags":{},"startTime":1759896322261,"traceId":"a26e44ee902bd4fd"},{"name":"write-routes-manifest","duration":55991,"timestamp":4811406492,"id":84,"parentId":1,"tags":{},"startTime":1759896323720,"traceId":"a26e44ee902bd4fd"},{"name":"node-file-trace-build","duration":3914674,"timestamp":4809933767,"id":76,"parentId":1,"tags":{"isTurbotrace":"false"},"startTime":1759896322247,"traceId":"a26e44ee902bd4fd"},{"name":"apply-include-excludes","duration":309,"timestamp":4813848457,"id":85,"parentId":1,"tags":{},"startTime":1759896326162,"traceId":"a26e44ee902bd4fd"},{"name":"print-tree-view","duration":2078,"timestamp":4813849031,"id":86,"parentId":1,"tags":{},"startTime":1759896326162,"traceId":"a26e44ee902bd4fd"},{"name":"telemetry-flush","duration":23,"timestamp":4813851116,"id":87,"parentId":1,"tags":{},"startTime":1759896326165,"traceId":"a26e44ee902bd4fd"},{"name":"next-build","duration":18206239,"timestamp":4795644903,"id":1,"tags":{"buildMode":"default","isTurboBuild":"true","version":"15.5.4","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1759896307958,"traceId":"a26e44ee902bd4fd"}]
1
+ [{"name":"generate-buildid","duration":137,"timestamp":5535771480,"id":4,"parentId":1,"tags":{},"startTime":1759897048085,"traceId":"44044ed658d1c9cb"},{"name":"load-custom-routes","duration":183,"timestamp":5535771667,"id":5,"parentId":1,"tags":{},"startTime":1759897048085,"traceId":"44044ed658d1c9cb"},{"name":"create-dist-dir","duration":1034,"timestamp":5535836611,"id":6,"parentId":1,"tags":{},"startTime":1759897048150,"traceId":"44044ed658d1c9cb"},{"name":"create-pages-mapping","duration":221,"timestamp":5535933509,"id":7,"parentId":1,"tags":{},"startTime":1759897048247,"traceId":"44044ed658d1c9cb"},{"name":"collect-app-files","duration":11302,"timestamp":5535933808,"id":8,"parentId":1,"tags":{},"startTime":1759897048247,"traceId":"44044ed658d1c9cb"},{"name":"create-app-mapping","duration":946,"timestamp":5535945136,"id":9,"parentId":1,"tags":{},"startTime":1759897048259,"traceId":"44044ed658d1c9cb"},{"name":"create-app-layouts","duration":180,"timestamp":5535946097,"id":10,"parentId":1,"tags":{},"startTime":1759897048260,"traceId":"44044ed658d1c9cb"},{"name":"collect-default-files","duration":5954,"timestamp":5535949401,"id":12,"parentId":1,"tags":{},"startTime":1759897048263,"traceId":"44044ed658d1c9cb"},{"name":"generate-route-types","duration":98300,"timestamp":5535946588,"id":11,"parentId":1,"tags":{},"startTime":1759897048260,"traceId":"44044ed658d1c9cb"},{"name":"public-dir-conflict-check","duration":1051,"timestamp":5536045214,"id":13,"parentId":1,"tags":{},"startTime":1759897048359,"traceId":"44044ed658d1c9cb"},{"name":"generate-routes-manifest","duration":4734,"timestamp":5536046522,"id":14,"parentId":1,"tags":{},"startTime":1759897048360,"traceId":"44044ed658d1c9cb"},{"name":"run-turbopack-compiler","duration":5876013,"timestamp":5536061613,"id":16,"parentId":1,"tags":{},"startTime":1759897048375,"traceId":"44044ed658d1c9cb"},{"name":"verify-and-lint","duration":2189578,"timestamp":5541961423,"id":19,"parentId":1,"tags":{},"startTime":1759897054275,"traceId":"44044ed658d1c9cb"},{"name":"verify-typescript-setup","duration":5302632,"timestamp":5541959034,"id":18,"parentId":1,"tags":{},"startTime":1759897054273,"traceId":"44044ed658d1c9cb"},{"name":"check-static-error-page","duration":3421,"timestamp":5547313605,"id":22,"parentId":21,"tags":{},"startTime":1759897059627,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":2400,"timestamp":5547430215,"id":23,"parentId":21,"tags":{"page":"/_app"},"startTime":1759897059744,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":1592,"timestamp":5547431036,"id":25,"parentId":21,"tags":{"page":"/_document"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":1716,"timestamp":5547430913,"id":24,"parentId":21,"tags":{"page":"/_error"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":490375,"timestamp":5547434943,"id":50,"parentId":46,"tags":{},"startTime":1759897059749,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":494078,"timestamp":5547431340,"id":46,"parentId":21,"tags":{"page":"/api/threads/runs/submit-client-tool-outputs"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":491552,"timestamp":5547441131,"id":51,"parentId":30,"tags":{},"startTime":1759897059755,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":501569,"timestamp":5547431155,"id":30,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/functions"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":484812,"timestamp":5547448015,"id":55,"parentId":29,"tags":{},"startTime":1759897059762,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":501686,"timestamp":5547431148,"id":29,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/functions/[functionId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":490577,"timestamp":5547443290,"id":53,"parentId":31,"tags":{},"startTime":1759897059757,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":502636,"timestamp":5547431243,"id":31,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/initial-messages"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":509052,"timestamp":5547442270,"id":52,"parentId":28,"tags":{},"startTime":1759897059756,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":520213,"timestamp":5547431139,"id":28,"parentId":21,"tags":{"page":"/api/api-keys"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":538102,"timestamp":5547445448,"id":54,"parentId":33,"tags":{},"startTime":1759897059759,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":552303,"timestamp":5547431272,"id":33,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/mcp-servers"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":549938,"timestamp":5547450515,"id":62,"parentId":42,"tags":{},"startTime":1759897059764,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":569159,"timestamp":5547431321,"id":42,"parentId":21,"tags":{"page":"/api/providers"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":559772,"timestamp":5547449225,"id":57,"parentId":34,"tags":{},"startTime":1759897059763,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":577775,"timestamp":5547431279,"id":34,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":560384,"timestamp":5547450879,"id":63,"parentId":27,"tags":{},"startTime":1759897059765,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":580191,"timestamp":5547431122,"id":27,"parentId":21,"tags":{"page":"/api/api-keys/[apiKeyId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":580549,"timestamp":5547451242,"id":64,"parentId":35,"tags":{},"startTime":1759897059765,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":600531,"timestamp":5547431286,"id":35,"parentId":21,"tags":{"page":"/api/assistants"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":602225,"timestamp":5547451629,"id":65,"parentId":45,"tags":{},"startTime":1759897059765,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":622581,"timestamp":5547431335,"id":45,"parentId":21,"tags":{"page":"/api/tasks"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":640964,"timestamp":5547448539,"id":56,"parentId":32,"tags":{},"startTime":1759897059762,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":658301,"timestamp":5547431257,"id":32,"parentId":21,"tags":{"page":"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":656148,"timestamp":5547453139,"id":68,"parentId":48,"tags":{},"startTime":1759897059767,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":677975,"timestamp":5547431350,"id":48,"parentId":21,"tags":{"page":"/api/workspaces"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":691792,"timestamp":5547452159,"id":66,"parentId":43,"tags":{},"startTime":1759897059766,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":712733,"timestamp":5547431325,"id":43,"parentId":21,"tags":{"page":"/api/tasks/[taskId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":691190,"timestamp":5547453212,"id":69,"parentId":26,"tags":{},"startTime":1759897059767,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":713363,"timestamp":5547431054,"id":26,"parentId":21,"tags":{"page":"/_not-found"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":694330,"timestamp":5547453617,"id":70,"parentId":41,"tags":{},"startTime":1759897059767,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":716663,"timestamp":5547431316,"id":41,"parentId":21,"tags":{"page":"/api/providers/[modelProviderId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":694154,"timestamp":5547453878,"id":71,"parentId":47,"tags":{},"startTime":1759897059768,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":716696,"timestamp":5547431345,"id":47,"parentId":21,"tags":{"page":"/api/workspaces/[workspaceId]"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":680874,"timestamp":5547494995,"id":73,"parentId":49,"tags":{},"startTime":1759897059809,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":744562,"timestamp":5547431354,"id":49,"parentId":21,"tags":{"page":"/"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":760774,"timestamp":5547450164,"id":60,"parentId":39,"tags":{},"startTime":1759897059764,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":779726,"timestamp":5547431306,"id":39,"parentId":21,"tags":{"page":"/api/providers/[modelProviderId]/assistants"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":826244,"timestamp":5547450298,"id":61,"parentId":40,"tags":{},"startTime":1759897059764,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":845292,"timestamp":5547431311,"id":40,"parentId":21,"tags":{"page":"/api/providers/[modelProviderId]/models"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":872103,"timestamp":5547449997,"id":59,"parentId":37,"tags":{},"startTime":1759897059764,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":890862,"timestamp":5547431296,"id":37,"parentId":21,"tags":{"page":"/api/files"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":877137,"timestamp":5547449666,"id":58,"parentId":36,"tags":{},"startTime":1759897059763,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":895565,"timestamp":5547431291,"id":36,"parentId":21,"tags":{"page":"/api/files/[fileId]/contents"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":903685,"timestamp":5547452884,"id":67,"parentId":44,"tags":{},"startTime":1759897059767,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":925269,"timestamp":5547431331,"id":44,"parentId":21,"tags":{"page":"/api/tasks/callback"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"is-page-static","duration":914247,"timestamp":5547454997,"id":72,"parentId":38,"tags":{},"startTime":1759897059769,"traceId":"44044ed658d1c9cb"},{"name":"check-page","duration":938012,"timestamp":5547431301,"id":38,"parentId":21,"tags":{"page":"/api/messages"},"startTime":1759897059745,"traceId":"44044ed658d1c9cb"},{"name":"static-check","duration":1056918,"timestamp":5547312445,"id":21,"parentId":1,"tags":{},"startTime":1759897059626,"traceId":"44044ed658d1c9cb"},{"name":"generate-required-server-files","duration":251,"timestamp":5548369815,"id":75,"parentId":1,"tags":{},"startTime":1759897060684,"traceId":"44044ed658d1c9cb"},{"name":"write-routes-manifest","duration":1033,"timestamp":5548376703,"id":77,"parentId":1,"tags":{},"startTime":1759897060690,"traceId":"44044ed658d1c9cb"},{"name":"load-dotenv","duration":21,"timestamp":5548437543,"id":80,"parentId":79,"tags":{},"startTime":1759897060751,"traceId":"44044ed658d1c9cb"},{"name":"run-export-path-map","duration":274,"timestamp":5548531016,"id":81,"parentId":79,"tags":{},"startTime":1759897060845,"traceId":"44044ed658d1c9cb"},{"name":"next-export","duration":1135689,"timestamp":5548436910,"id":79,"parentId":1,"tags":{},"startTime":1759897060751,"traceId":"44044ed658d1c9cb"},{"name":"move-exported-app-not-found-","duration":8375,"timestamp":5549573719,"id":82,"parentId":78,"tags":{},"startTime":1759897061887,"traceId":"44044ed658d1c9cb"},{"name":"move-exported-page","duration":89793,"timestamp":5549582213,"id":83,"parentId":78,"tags":{},"startTime":1759897061896,"traceId":"44044ed658d1c9cb"},{"name":"static-generation","duration":1527497,"timestamp":5548432201,"id":78,"parentId":1,"tags":{},"startTime":1759897060746,"traceId":"44044ed658d1c9cb"},{"name":"write-routes-manifest","duration":25826,"timestamp":5549960018,"id":84,"parentId":1,"tags":{},"startTime":1759897062274,"traceId":"44044ed658d1c9cb"},{"name":"node-file-trace-build","duration":4043565,"timestamp":5548372555,"id":76,"parentId":1,"tags":{"isTurbotrace":"false"},"startTime":1759897060686,"traceId":"44044ed658d1c9cb"},{"name":"apply-include-excludes","duration":357,"timestamp":5552416146,"id":85,"parentId":1,"tags":{},"startTime":1759897064730,"traceId":"44044ed658d1c9cb"},{"name":"print-tree-view","duration":2264,"timestamp":5552416984,"id":86,"parentId":1,"tags":{},"startTime":1759897064731,"traceId":"44044ed658d1c9cb"},{"name":"telemetry-flush","duration":32,"timestamp":5552419257,"id":87,"parentId":1,"tags":{},"startTime":1759897064733,"traceId":"44044ed658d1c9cb"},{"name":"next-build","duration":16963213,"timestamp":5535456079,"id":1,"tags":{"buildMode":"default","isTurboBuild":"true","version":"15.5.4","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1759897047770,"traceId":"44044ed658d1c9cb"}]
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@superinterface/server",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
+ "type": "module",
4
5
  "bin": {
5
6
  "superinterface-server": "./bin/index.cjs"
6
7
  },
@@ -1,5 +1,7 @@
1
1
  import { spawn } from 'node:child_process'
2
+ import { createRequire } from 'node:module'
2
3
  import process from 'node:process'
4
+ import { fileURLToPath } from 'node:url'
3
5
  import { CliError } from '../../utils/errors'
4
6
  import { ensureEnv, ensureDatabaseUrl } from '../../utils/env'
5
7
 
@@ -7,21 +9,46 @@ export type PrismaDeployOptions = {
7
9
  schema?: string
8
10
  }
9
11
 
12
+ const packageRoot = fileURLToPath(new URL('../../..', import.meta.url))
13
+ const defaultSchemaPath = fileURLToPath(
14
+ new URL('../../../prisma/schema.prisma', import.meta.url),
15
+ )
16
+ const nodeRequire = createRequire(import.meta.url)
17
+
10
18
  export const prismaDeploy = async ({ schema }: PrismaDeployOptions = {}) => {
11
19
  await ensureEnv()
12
20
  ensureDatabaseUrl()
13
21
 
14
22
  await new Promise<void>((resolve, reject) => {
15
- const args = ['prisma', 'migrate', 'deploy']
23
+ const args = ['migrate', 'deploy']
24
+ const schemaPath = schema ?? defaultSchemaPath
25
+
26
+ if (schemaPath) {
27
+ args.push('--schema', schemaPath)
28
+ }
16
29
 
17
- if (schema) {
18
- args.push('--schema', schema)
30
+ let prismaCliPath: string
31
+
32
+ try {
33
+ prismaCliPath = nodeRequire.resolve('prisma/build/index.js', {
34
+ paths: [packageRoot],
35
+ })
36
+ } catch (error) {
37
+ reject(
38
+ new CliError(
39
+ 'Unable to resolve Prisma CLI. Install `prisma` dependency.',
40
+ {
41
+ cause: error,
42
+ },
43
+ ),
44
+ )
45
+ return
19
46
  }
20
47
 
21
- const child = spawn('npx', args, {
48
+ const child = spawn(process.execPath, [prismaCliPath, ...args], {
49
+ cwd: packageRoot,
22
50
  stdio: 'inherit',
23
51
  env: process.env,
24
- shell: true,
25
52
  })
26
53
 
27
54
  child.once('error', (error) => {
@@ -1,3 +1,7 @@
1
+ import { spawn } from 'node:child_process'
2
+ import { createRequire } from 'node:module'
3
+ import process from 'node:process'
4
+ import { fileURLToPath } from 'node:url'
1
5
  import type { PrismaClient } from '@prisma/client'
2
6
  import { CliError } from './errors'
3
7
 
@@ -10,6 +14,12 @@ type PrismaModule = {
10
14
  prisma?: PrismaClient
11
15
  }
12
16
 
17
+ const packageRoot = fileURLToPath(new URL('../..', import.meta.url))
18
+ const schemaPath = fileURLToPath(
19
+ new URL('../../prisma/schema.prisma', import.meta.url),
20
+ )
21
+ const nodeRequire = createRequire(import.meta.url)
22
+
13
23
  const isModuleNotFoundError = (error: unknown, modulePath: string) => {
14
24
  if (!(error instanceof Error)) return false
15
25
 
@@ -30,10 +40,61 @@ const isModuleNotFoundError = (error: unknown, modulePath: string) => {
30
40
  )
31
41
  }
32
42
 
43
+ const isPrismaClientNotGeneratedError = (error: unknown) => {
44
+ if (!(error instanceof Error)) return false
45
+ return /prisma\s+client\s+did\s+not\s+initialize|Please\s+run\s+"prisma\s+generate"/i.test(
46
+ error.message,
47
+ )
48
+ }
49
+
50
+ const generatePrismaClient = async () => {
51
+ let prismaCliPath: string
52
+
53
+ try {
54
+ prismaCliPath = nodeRequire.resolve('prisma/build/index.js', {
55
+ paths: [packageRoot],
56
+ })
57
+ } catch (error) {
58
+ throw new CliError(
59
+ 'Unable to resolve Prisma CLI. Install `prisma` dependency.',
60
+ {
61
+ cause: error,
62
+ },
63
+ )
64
+ }
65
+
66
+ await new Promise<void>((resolve, reject) => {
67
+ const child = spawn(
68
+ process.execPath,
69
+ [prismaCliPath, 'generate', '--schema', schemaPath],
70
+ {
71
+ cwd: packageRoot,
72
+ stdio: 'inherit',
73
+ env: process.env,
74
+ },
75
+ )
76
+
77
+ child.once('error', (error) => {
78
+ reject(new CliError('Failed to run `prisma generate`.', { cause: error }))
79
+ })
80
+
81
+ child.once('exit', (code) => {
82
+ if (typeof code === 'number' && code !== 0) {
83
+ reject(new CliError(`prisma generate exited with code ${code}.`))
84
+ return
85
+ }
86
+
87
+ resolve()
88
+ })
89
+ })
90
+ }
91
+
33
92
  export const loadPrismaClient = async (): Promise<PrismaClient> => {
34
93
  let lastError: unknown
94
+ let attemptedGenerate = false
35
95
 
36
- for (const candidate of prismaModuleCandidates) {
96
+ for (let index = 0; index < prismaModuleCandidates.length; index += 1) {
97
+ const candidate = prismaModuleCandidates[index]
37
98
  try {
38
99
  const module = (await import(candidate)) as PrismaModule
39
100
  if (module?.prisma) {
@@ -44,6 +105,19 @@ export const loadPrismaClient = async (): Promise<PrismaClient> => {
44
105
  `Module "${candidate}" does not export a prisma client.`,
45
106
  )
46
107
  } catch (error) {
108
+ if (isPrismaClientNotGeneratedError(error)) {
109
+ if (attemptedGenerate) {
110
+ throw new CliError('Prisma client failed to initialize.', {
111
+ cause: error,
112
+ })
113
+ }
114
+
115
+ await generatePrismaClient()
116
+ attemptedGenerate = true
117
+ index -= 1
118
+ continue
119
+ }
120
+
47
121
  if (isModuleNotFoundError(error, candidate)) {
48
122
  lastError = error
49
123
  continue