@superinterface/server 1.0.40 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/eslint/.cache_btwyo7 +1 -1
- package/.next/fallback-build-manifest.json +2 -2
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/trace +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.js +1 -12
- package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.d.ts.map +1 -1
- package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.js +1 -12
- package/dist/lib/mcpServers/mcpServerSchema.d.ts +38 -38
- package/dist/lib/mcpServers/mcpServerSchema.d.ts.map +1 -1
- package/dist/lib/mcpServers/mcpServerSchema.js +11 -3
- package/package.json +1 -1
- /package/.next/static/{wuIqo1AC4IH0KlhrbfHcA → 3oLvS6zqEM3JjzXyiTqF1}/_buildManifest.js +0 -0
- /package/.next/static/{wuIqo1AC4IH0KlhrbfHcA → 3oLvS6zqEM3JjzXyiTqF1}/_clientMiddlewareManifest.json +0 -0
- /package/.next/static/{wuIqo1AC4IH0KlhrbfHcA → 3oLvS6zqEM3JjzXyiTqF1}/_ssgManifest.js +0 -0
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"ampDevFiles": [],
|
|
16
16
|
"polyfillFiles": [],
|
|
17
17
|
"lowPriorityFiles": [
|
|
18
|
-
"static/
|
|
19
|
-
"static/
|
|
18
|
+
"static/3oLvS6zqEM3JjzXyiTqF1/_ssgManifest.js",
|
|
19
|
+
"static/3oLvS6zqEM3JjzXyiTqF1/_buildManifest.js"
|
|
20
20
|
],
|
|
21
21
|
"rootMainFiles": [],
|
|
22
22
|
"ampFirstPages": []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--3oLvS6zqEM3JjzXyiTqF1--><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,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";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\":\"3oLvS6zqEM3JjzXyiTqF1\",\"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>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
a:I[51035,["/_next/static/chunks/03d938d038bc30e3.js"],"MetadataBoundary"]
|
|
8
8
|
b:"$Sreact.suspense"
|
|
9
9
|
d:I[25098,["/_next/static/chunks/03d938d038bc30e3.js"],"default"]
|
|
10
|
-
0:{"P":null,"b":"
|
|
10
|
+
0:{"P":null,"b":"3oLvS6zqEM3JjzXyiTqF1","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}
|
|
11
11
|
9:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
|
|
12
12
|
5:null
|
|
13
13
|
7:{"metadata":[],"error":null,"digest":"$undefined"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><!--
|
|
1
|
+
<!DOCTYPE html><!--3oLvS6zqEM3JjzXyiTqF1--><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><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div>@superinterface/server is running.</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\":\"3oLvS6zqEM3JjzXyiTqF1\",\"p\":\"\",\"c\":[\"\",\"\"],\"i\":false,\"f\":[[[\"\",{\"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\":[\"__PAGE__\",[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"div\",null,{\"children\":\"@superinterface/server is running.\"}],null,[\"$\",\"$L4\",null,{\"children\":[\"$L5\",[\"$\",\"$L6\",null,{\"promise\":\"$@7\"}]]}]]}],{},null,false]},null,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],null],[\"$\",\"$La\",null,{\"children\":[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$b\",null,{\"fallback\":null,\"children\":\"$Lc\"}]}]}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$d\",[]],\"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>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
a:I[51035,["/_next/static/chunks/03d938d038bc30e3.js"],"MetadataBoundary"]
|
|
8
8
|
b:"$Sreact.suspense"
|
|
9
9
|
d:I[25098,["/_next/static/chunks/03d938d038bc30e3.js"],"default"]
|
|
10
|
-
0:{"P":null,"b":"
|
|
10
|
+
0:{"P":null,"b":"3oLvS6zqEM3JjzXyiTqF1","p":"","c":["",""],"i":false,"f":[[["",{"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":["__PAGE__",["$","$1","c",{"children":[["$","div",null,{"children":"@superinterface/server is running."}],null,["$","$L4",null,{"children":["$L5",["$","$L6",null,{"promise":"$@7"}]]}]]}],{},null,false]},null,false],["$","$1","h",{"children":[null,[["$","$L8",null,{"children":"$L9"}],null],["$","$La",null,{"children":["$","div",null,{"hidden":true,"children":["$","$b",null,{"fallback":null,"children":"$Lc"}]}]}]]}],false]],"m":"$undefined","G":["$d",[]],"s":false,"S":true}
|
|
11
11
|
9:[["$","meta","0",{"charSet":"utf-8"}],["$","meta","1",{"name":"viewport","content":"width=device-width, initial-scale=1"}]]
|
|
12
12
|
5:null
|
|
13
13
|
7:{"metadata":[],"error":null,"digest":"$undefined"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},30611,e=>{"use strict";e.s(["cacheHeaders",()=>t]);let t={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}},88122,e=>{"use strict";e.s(["getApiKey",()=>r]);var t=e.i(55897);let r=async({authorization:e,type:r,prisma:s})=>{if(!e)return null;let[,a]=e.split("Bearer ");return(0,t.validate)(a)?s.apiKey.findFirst({where:{type:r,value:a}}):null}},67083,e=>{"use strict";e.s(["isJSON",()=>t]);let t=e=>{try{return JSON.parse(e),!0}catch(e){return!1}}},40145,1065,e=>{"use strict";e.s(["serializeApiMcpServer",()=>t],40145);let t=({mcpServer:e})=>({id:e.id,name:e.name,description:e.description,transportType:e.transportType,sseTransport:e.sseTransport?(({sseTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({sseTransport:e.sseTransport}):null,httpTransport:e.httpTransport?(({httpTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({httpTransport:e.httpTransport}):null,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()});e.s(["mcpServerSchema",()=>d],1065);var r=e.i(13669),s=e.i(29173),a=e.i(67083);let n=r.z.object({command:r.z.string().min(1),args:r.z.string().min(1)}),i=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),o=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),p=r.z.string().trim().min(1).optional().nullable(),d=r.z.object({name:p,description:p,transportType:r.z.nativeEnum(s.TransportType).refine(e=>e!==s.TransportType.STDIO,{message:`transportType cannot be ${s.TransportType.STDIO}`}),sseTransport:i.nullable().optional(),httpTransport:o.nullable().optional()}).superRefine((e,t)=>{if(e.transportType===s.TransportType.STDIO){t.addIssue({code:r.z.ZodIssueCode.custom,message:`Transport type ${s.TransportType.STDIO} is not allowed.`});let a=n.safeParse(e.stdioTransport);a.success||a.error.issues.forEach(e=>t.addIssue({...e,path:["stdioTransport",...e.path]}))}else if(e.transportType===s.TransportType.SSE){let r=i.safeParse(e.sseTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["sseTransport",...e.path]}))}else if(e.transportType===s.TransportType.HTTP){let r=o.safeParse(e.httpTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["httpTransport",...e.path]}))}})},98917,e=>{"use strict";e.s([])},29190,e=>{"use strict";e.s(["handler",()=>_,"patchFetch",()=>q,"routeModule",()=>k,"serverHooks",()=>z,"workAsyncStorage",()=>H,"workUnitAsyncStorage",()=>M],29190);var t=e.i(5865),r=e.i(43877),s=e.i(77767),a=e.i(92562),n=e.i(66256),i=e.i(5270),o=e.i(90231),p=e.i(82677),d=e.i(51081),l=e.i(89822),u=e.i(9124),c=e.i(39147),h=e.i(40568),v=e.i(87188),T=e.i(93695);e.i(57132);var m=e.i(80739);e.s(["DELETE",()=>j,"GET",()=>C,"OPTIONS",()=>P,"PATCH",()=>O],28403);var x=e.i(24493),f=e.i(11053),R=e.i(29173),y=e.i(49493),g=e.i(30611),S=e.i(88122),w=e.i(55897),A=e.i(40145),E=e.i(1065);let N=e=>{if(void 0!==e)return null===e?null:e.trim()},I=({assistantId:e,mcpServerId:t})=>(0,w.validate)(e)?(0,w.validate)(t)?null:y.NextResponse.json({error:"Invalid MCP server id"},{status:400}):y.NextResponse.json({error:"Invalid assistant id"},{status:400}),C=(({prisma:e})=>async(t,r)=>{let{assistantId:s,mcpServerId:a}=await r.params,n=(await (0,f.headers)()).get("authorization");if(!n)return y.NextResponse.json({error:"No authorization header found"},{status:400});let i=await (0,S.getApiKey)({type:R.ApiKeyType.PRIVATE,authorization:n,prisma:e});if(!i)return y.NextResponse.json({error:"Invalid api key"},{status:400});let o=I({assistantId:s,mcpServerId:a});if(o)return o;let p=await e.mcpServer.findFirst({where:{id:a,assistant:{id:s,workspaceId:i.workspaceId}},include:{sseTransport:!0,httpTransport:!0}});return p?y.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:p})},{headers:g.cacheHeaders}):y.NextResponse.json({error:"No MCP server found"},{status:400})})({prisma:x.prisma}),O=(({prisma:e})=>async(t,r)=>{let{assistantId:s,mcpServerId:a}=await r.params,n=(await (0,f.headers)()).get("authorization");if(!n)return y.NextResponse.json({error:"No authorization header found"},{status:400});let i=await (0,S.getApiKey)({authorization:n,type:R.ApiKeyType.PRIVATE,prisma:e});if(!i)return y.NextResponse.json({error:"Invalid api key"},{status:400});let o=I({assistantId:s,mcpServerId:a});if(o)return o;let p=await t.json(),d=E.mcpServerSchema.safeParse(p);if(!d.success)return y.NextResponse.json({error:"Invalid payload"},{status:400});let{transportType:l,sseTransport:u,httpTransport:c,name:h,description:v}=d.data,T=N(h),m=N(v);if(!await e.mcpServer.findFirst({where:{id:a,assistant:{id:s,workspaceId:i.workspaceId}}}))return y.NextResponse.json({error:"No MCP server found"},{status:400});let x=await e.mcpServer.update({where:{id:a},data:{transportType:l,...void 0!==T?{name:T}:{},...void 0!==m?{description:m}:{},...l===R.TransportType.SSE?{sseTransport:{update:{url:u.url,headers:JSON.parse(u.headers)}}}:{},...l===R.TransportType.HTTP?{httpTransport:{update:{url:c.url,headers:JSON.parse(c.headers)}}}:{}},include:{sseTransport:!0,httpTransport:!0}});return y.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:x})},{headers:g.cacheHeaders})})({prisma:x.prisma}),j=(({prisma:e})=>async(t,r)=>{let{assistantId:s,mcpServerId:a}=await r.params,n=(await (0,f.headers)()).get("authorization");if(!n)return y.NextResponse.json({error:"No authorization header found"},{status:400});let i=await (0,S.getApiKey)({authorization:n,type:R.ApiKeyType.PRIVATE,prisma:e});if(!i)return y.NextResponse.json({error:"Invalid api key"},{status:400});let o=I({assistantId:s,mcpServerId:a});if(o)return o;if(!await e.mcpServer.findFirst({where:{id:a,assistant:{id:s,workspaceId:i.workspaceId}}}))return y.NextResponse.json({error:"No MCP server found"},{status:400});let p=await e.mcpServer.delete({where:{id:a},include:{sseTransport:!0,httpTransport:!0}});return y.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:p})},{headers:g.cacheHeaders})})({prisma:x.prisma}),P=()=>y.NextResponse.json({},{headers:g.cacheHeaders});var b=e.i(28403);let k=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route",pathname:"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts",nextConfigOutput:"",userland:b}),{workAsyncStorage:H,workUnitAsyncStorage:M,serverHooks:z}=k;function q(){return(0,s.patchFetch)({workAsyncStorage:H,workUnitAsyncStorage:M})}async function _(e,t,s){var x;let f="/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route";f=f.replace(/\/index$/,"")||"/";let R=await k.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:y,params:g,nextConfig:S,isDraftMode:w,prerenderManifest:A,routerServerContext:E,isOnDemandRevalidate:N,revalidateOnlyGenerated:I,resolvedPathname:C}=R,O=(0,i.normalizeAppPath)(f),j=!!(A.dynamicRoutes[O]||A.routes[C]);if(j&&!w){let e=!!A.routes[C],t=A.dynamicRoutes[O];if(t&&!1===t.fallback&&!e)throw new T.NoFallbackError}let P=null;!j||k.isDev||w||(P="/index"===(P=C)?"/":P);let b=!0===k.isDev||!j,H=j&&!b,M=e.method||"GET",z=(0,n.getTracer)(),q=z.getActiveScopeSpan(),_={params:g,prerenderManifest:A,renderOpts:{experimental:{cacheComponents:!!S.experimental.cacheComponents,authInterrupts:!!S.experimental.authInterrupts},supportsDynamicResponse:b,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:null==(x=S.experimental)?void 0:x.cacheLife,isRevalidate:H,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s)=>k.onRequestError(e,t,s,E)},sharedContext:{buildId:y}},D=new o.NodeNextRequest(e),U=new o.NodeNextResponse(t),K=p.NextRequestAdapter.fromNodeNextRequest(D,(0,p.signalFromNodeResponse)(t));try{let i=async r=>k.handle(K,_).finally(()=>{if(!r)return;r.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let s=z.getRootSpanAttributes();if(!s)return;if(s.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${s.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=s.get("next.route");if(a){let e=`${M} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":e}),r.updateName(e)}else r.updateName(`${M} ${e.url}`)}),o=async n=>{var o,p;let d=async({previousCacheEntry:r})=>{try{if(!(0,a.getRequestMeta)(e,"minimalMode")&&N&&I&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=_.renderOpts.fetchMetrics;let p=_.renderOpts.pendingWaitUntil;p&&s.waitUntil&&(s.waitUntil(p),p=void 0);let d=_.renderOpts.collectedTags;if(!j)return await (0,u.sendResponse)(D,U,o,_.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[v.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==_.renderOpts.collectedRevalidate&&!(_.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&_.renderOpts.collectedRevalidate,s=void 0===_.renderOpts.collectedExpire||_.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:_.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await k.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isRevalidate:H,isOnDemandRevalidate:N})},E),t}},T=await k.handleResponse({req:e,nextConfig:S,cacheKey:P,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:I,responseGenerator:d,waitUntil:s.waitUntil});if(!j)return null;if((null==T||null==(o=T.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==T||null==(p=T.value)?void 0:p.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,a.getRequestMeta)(e,"minimalMode")||t.setHeader("x-nextjs-cache",N?"REVALIDATED":T.isMiss?"MISS":T.isStale?"STALE":"HIT"),w&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,c.fromNodeOutgoingHttpHeaders)(T.value.headers);return(0,a.getRequestMeta)(e,"minimalMode")&&j||x.delete(v.NEXT_CACHE_TAGS_HEADER),!T.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,h.getCacheControlHeader)(T.cacheControl)),await (0,u.sendResponse)(D,U,new Response(T.value.body,{headers:x,status:T.value.status||200})),null};q?await o(q):await z.withPropagatedContext(e.headers,()=>z.trace(d.BaseServerSpan.handleRequest,{spanName:`${M} ${e.url}`,kind:n.SpanKind.SERVER,attributes:{"http.method":M,"http.target":e.url}},o))}catch(t){if(t instanceof T.NoFallbackError||await k.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isRevalidate:H,isOnDemandRevalidate:N})}),j)throw t;return await (0,u.sendResponse)(D,U,new Response(null,{status:500})),null}}}];
|
|
1
|
+
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},30611,e=>{"use strict";e.s(["cacheHeaders",()=>t]);let t={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}},88122,e=>{"use strict";e.s(["getApiKey",()=>r]);var t=e.i(55897);let r=async({authorization:e,type:r,prisma:s})=>{if(!e)return null;let[,a]=e.split("Bearer ");return(0,t.validate)(a)?s.apiKey.findFirst({where:{type:r,value:a}}):null}},67083,e=>{"use strict";e.s(["isJSON",()=>t]);let t=e=>{try{return JSON.parse(e),!0}catch(e){return!1}}},40145,1065,e=>{"use strict";e.s(["serializeApiMcpServer",()=>t],40145);let t=({mcpServer:e})=>({id:e.id,name:e.name,description:e.description,transportType:e.transportType,sseTransport:e.sseTransport?(({sseTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({sseTransport:e.sseTransport}):null,httpTransport:e.httpTransport?(({httpTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({httpTransport:e.httpTransport}):null,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()});e.s(["mcpServerSchema",()=>l],1065);var r=e.i(13669),s=e.i(29173),a=e.i(67083);let n=r.z.object({command:r.z.string().min(1),args:r.z.string().min(1)}),i=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),o=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),p=r.z.string().min(1).regex(/^[a-zA-Z0-9-]+$/,{message:"Name can only include letters, numbers, and hyphens."}).optional().nullable(),d=r.z.string().min(1).optional().nullable(),l=r.z.object({name:p,description:d,transportType:r.z.nativeEnum(s.TransportType).refine(e=>e!==s.TransportType.STDIO,{message:`transportType cannot be ${s.TransportType.STDIO}`}),sseTransport:i.nullable().optional(),httpTransport:o.nullable().optional()}).superRefine((e,t)=>{if(e.transportType===s.TransportType.STDIO){t.addIssue({code:r.z.ZodIssueCode.custom,message:`Transport type ${s.TransportType.STDIO} is not allowed.`});let a=n.safeParse(e.stdioTransport);a.success||a.error.issues.forEach(e=>t.addIssue({...e,path:["stdioTransport",...e.path]}))}else if(e.transportType===s.TransportType.SSE){let r=i.safeParse(e.sseTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["sseTransport",...e.path]}))}else if(e.transportType===s.TransportType.HTTP){let r=o.safeParse(e.httpTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["httpTransport",...e.path]}))}})},98917,e=>{"use strict";e.s([])},29190,e=>{"use strict";e.s(["handler",()=>q,"patchFetch",()=>M,"routeModule",()=>b,"serverHooks",()=>H,"workAsyncStorage",()=>k,"workUnitAsyncStorage",()=>z],29190);var t=e.i(5865),r=e.i(43877),s=e.i(77767),a=e.i(92562),n=e.i(66256),i=e.i(5270),o=e.i(90231),p=e.i(82677),d=e.i(51081),l=e.i(89822),u=e.i(9124),c=e.i(39147),h=e.i(40568),v=e.i(87188),T=e.i(93695);e.i(57132);var m=e.i(80739);e.s(["DELETE",()=>O,"GET",()=>I,"OPTIONS",()=>j,"PATCH",()=>C],28403);var x=e.i(24493),f=e.i(11053),R=e.i(29173),g=e.i(49493),y=e.i(30611),S=e.i(88122),w=e.i(55897),A=e.i(40145),E=e.i(1065);let N=({assistantId:e,mcpServerId:t})=>(0,w.validate)(e)?(0,w.validate)(t)?null:g.NextResponse.json({error:"Invalid MCP server id"},{status:400}):g.NextResponse.json({error:"Invalid assistant id"},{status:400}),I=(({prisma:e})=>async(t,r)=>{let{assistantId:s,mcpServerId:a}=await r.params,n=(await (0,f.headers)()).get("authorization");if(!n)return g.NextResponse.json({error:"No authorization header found"},{status:400});let i=await (0,S.getApiKey)({type:R.ApiKeyType.PRIVATE,authorization:n,prisma:e});if(!i)return g.NextResponse.json({error:"Invalid api key"},{status:400});let o=N({assistantId:s,mcpServerId:a});if(o)return o;let p=await e.mcpServer.findFirst({where:{id:a,assistant:{id:s,workspaceId:i.workspaceId}},include:{sseTransport:!0,httpTransport:!0}});return p?g.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:p})},{headers:y.cacheHeaders}):g.NextResponse.json({error:"No MCP server found"},{status:400})})({prisma:x.prisma}),C=(({prisma:e})=>async(t,r)=>{let{assistantId:s,mcpServerId:a}=await r.params,n=(await (0,f.headers)()).get("authorization");if(!n)return g.NextResponse.json({error:"No authorization header found"},{status:400});let i=await (0,S.getApiKey)({authorization:n,type:R.ApiKeyType.PRIVATE,prisma:e});if(!i)return g.NextResponse.json({error:"Invalid api key"},{status:400});let o=N({assistantId:s,mcpServerId:a});if(o)return o;let p=await t.json(),d=E.mcpServerSchema.safeParse(p);if(!d.success)return g.NextResponse.json({error:"Invalid payload"},{status:400});let{transportType:l,sseTransport:u,httpTransport:c,name:h,description:v}=d.data;if(!await e.mcpServer.findFirst({where:{id:a,assistant:{id:s,workspaceId:i.workspaceId}}}))return g.NextResponse.json({error:"No MCP server found"},{status:400});let T=await e.mcpServer.update({where:{id:a},data:{transportType:l,...void 0!==h?{name:h}:{},...void 0!==v?{description:v}:{},...l===R.TransportType.SSE?{sseTransport:{update:{url:u.url,headers:JSON.parse(u.headers)}}}:{},...l===R.TransportType.HTTP?{httpTransport:{update:{url:c.url,headers:JSON.parse(c.headers)}}}:{}},include:{sseTransport:!0,httpTransport:!0}});return g.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:T})},{headers:y.cacheHeaders})})({prisma:x.prisma}),O=(({prisma:e})=>async(t,r)=>{let{assistantId:s,mcpServerId:a}=await r.params,n=(await (0,f.headers)()).get("authorization");if(!n)return g.NextResponse.json({error:"No authorization header found"},{status:400});let i=await (0,S.getApiKey)({authorization:n,type:R.ApiKeyType.PRIVATE,prisma:e});if(!i)return g.NextResponse.json({error:"Invalid api key"},{status:400});let o=N({assistantId:s,mcpServerId:a});if(o)return o;if(!await e.mcpServer.findFirst({where:{id:a,assistant:{id:s,workspaceId:i.workspaceId}}}))return g.NextResponse.json({error:"No MCP server found"},{status:400});let p=await e.mcpServer.delete({where:{id:a},include:{sseTransport:!0,httpTransport:!0}});return g.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:p})},{headers:y.cacheHeaders})})({prisma:x.prisma}),j=()=>g.NextResponse.json({},{headers:y.cacheHeaders});var P=e.i(28403);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route",pathname:"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts",nextConfigOutput:"",userland:P}),{workAsyncStorage:k,workUnitAsyncStorage:z,serverHooks:H}=b;function M(){return(0,s.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:z})}async function q(e,t,s){var x;let f="/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route";f=f.replace(/\/index$/,"")||"/";let R=await b.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:g,params:y,nextConfig:S,isDraftMode:w,prerenderManifest:A,routerServerContext:E,isOnDemandRevalidate:N,revalidateOnlyGenerated:I,resolvedPathname:C}=R,O=(0,i.normalizeAppPath)(f),j=!!(A.dynamicRoutes[O]||A.routes[C]);if(j&&!w){let e=!!A.routes[C],t=A.dynamicRoutes[O];if(t&&!1===t.fallback&&!e)throw new T.NoFallbackError}let P=null;!j||b.isDev||w||(P="/index"===(P=C)?"/":P);let k=!0===b.isDev||!j,z=j&&!k,H=e.method||"GET",M=(0,n.getTracer)(),q=M.getActiveScopeSpan(),_={params:y,prerenderManifest:A,renderOpts:{experimental:{cacheComponents:!!S.experimental.cacheComponents,authInterrupts:!!S.experimental.authInterrupts},supportsDynamicResponse:k,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:null==(x=S.experimental)?void 0:x.cacheLife,isRevalidate:z,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s)=>b.onRequestError(e,t,s,E)},sharedContext:{buildId:g}},D=new o.NodeNextRequest(e),U=new o.NodeNextResponse(t),K=p.NextRequestAdapter.fromNodeNextRequest(D,(0,p.signalFromNodeResponse)(t));try{let i=async r=>b.handle(K,_).finally(()=>{if(!r)return;r.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let s=M.getRootSpanAttributes();if(!s)return;if(s.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${s.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=s.get("next.route");if(a){let e=`${H} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":e}),r.updateName(e)}else r.updateName(`${H} ${e.url}`)}),o=async n=>{var o,p;let d=async({previousCacheEntry:r})=>{try{if(!(0,a.getRequestMeta)(e,"minimalMode")&&N&&I&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=_.renderOpts.fetchMetrics;let p=_.renderOpts.pendingWaitUntil;p&&s.waitUntil&&(s.waitUntil(p),p=void 0);let d=_.renderOpts.collectedTags;if(!j)return await (0,u.sendResponse)(D,U,o,_.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[v.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==_.renderOpts.collectedRevalidate&&!(_.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&_.renderOpts.collectedRevalidate,s=void 0===_.renderOpts.collectedExpire||_.renderOpts.collectedExpire>=v.INFINITE_CACHE?void 0:_.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isRevalidate:z,isOnDemandRevalidate:N})},E),t}},T=await b.handleResponse({req:e,nextConfig:S,cacheKey:P,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:I,responseGenerator:d,waitUntil:s.waitUntil});if(!j)return null;if((null==T||null==(o=T.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==T||null==(p=T.value)?void 0:p.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,a.getRequestMeta)(e,"minimalMode")||t.setHeader("x-nextjs-cache",N?"REVALIDATED":T.isMiss?"MISS":T.isStale?"STALE":"HIT"),w&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,c.fromNodeOutgoingHttpHeaders)(T.value.headers);return(0,a.getRequestMeta)(e,"minimalMode")&&j||x.delete(v.NEXT_CACHE_TAGS_HEADER),!T.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,h.getCacheControlHeader)(T.cacheControl)),await (0,u.sendResponse)(D,U,new Response(T.value.body,{headers:x,status:T.value.status||200})),null};q?await o(q):await M.withPropagatedContext(e.headers,()=>M.trace(d.BaseServerSpan.handleRequest,{spanName:`${H} ${e.url}`,kind:n.SpanKind.SERVER,attributes:{"http.method":H,"http.target":e.url}},o))}catch(t){if(t instanceof T.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:O,routeType:"route",revalidateReason:(0,l.getRevalidateReason)({isRevalidate:z,isOnDemandRevalidate:N})}),j)throw t;return await (0,u.sendResponse)(D,U,new Response(null,{status:500})),null}}}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__441cee00._.js.map
|
|
@@ -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/node_modules/next/dist/esm/build/templates/app-route.js","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.ts"],"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, type PrismaClient } from '@prisma/client'\nimport { validate } from 'uuid'\n\nexport const getApiKey = async ({\n authorization,\n type,\n prisma,\n}: {\n authorization: string | null\n type: ApiKeyType\n prisma: PrismaClient\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 name: mcpServer.name,\n description: mcpServer.description,\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\nconst optionalTrimmedString = z.string().trim().min(1).optional().nullable()\n\nexport const baseSchema = z.object({\n name: optionalTrimmedString,\n description: optionalTrimmedString,\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 { 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/[mcpServerId]/route\",\n pathname: \"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]\",\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/[mcpServerId]/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/[mcpServerId]/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","import { prisma } from '@/lib/prisma'\nimport { buildDELETE, buildGET, buildOPTIONS, buildPATCH } from './buildRoute'\n\nexport const GET = buildGET({ prisma })\n\nexport const PATCH = buildPATCH({ prisma })\n\nexport const DELETE = buildDELETE({ prisma })\n\nexport const OPTIONS = buildOPTIONS()\n","import { headers } from 'next/headers'\nimport { ApiKeyType, TransportType, type PrismaClient } from '@prisma/client'\nimport { NextResponse, type NextRequest } from 'next/server'\nimport { cacheHeaders } from '@/lib/cache/cacheHeaders'\nimport { getApiKey } from '@/lib/apiKeys/getApiKey'\nimport { validate } from 'uuid'\nimport { serializeApiMcpServer } from '@/lib/mcpServers/serializeApiMcpServer'\nimport { mcpServerSchema } from '@/lib/mcpServers/mcpServerSchema'\n\ntype RouteProps = {\n params: Promise<{ assistantId: string; mcpServerId: string }>\n}\n\nconst normalizeOptionalString = (value: string | null | undefined) => {\n if (value === undefined) return undefined\n if (value === null) return null\n return value.trim()\n}\n\nconst validateIds = ({\n assistantId,\n mcpServerId,\n}: {\n assistantId: string\n mcpServerId: string\n}) => {\n if (!validate(assistantId)) {\n return NextResponse.json({ error: 'Invalid assistant id' }, { status: 400 })\n }\n\n if (!validate(mcpServerId)) {\n return NextResponse.json(\n { error: 'Invalid MCP server id' },\n { status: 400 },\n )\n }\n\n return null\n}\n\nexport const buildGET =\n ({ prisma }: { prisma: PrismaClient }) =>\n async (_request: NextRequest, props: RouteProps) => {\n const { assistantId, mcpServerId } = 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 prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const validationError = validateIds({ assistantId, mcpServerId })\n if (validationError) return validationError\n\n const mcpServer = await prisma.mcpServer.findFirst({\n where: {\n id: mcpServerId,\n assistant: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n },\n include: {\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n if (!mcpServer) {\n return NextResponse.json(\n { error: 'No MCP server found' },\n { status: 400 },\n )\n }\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer }),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const buildPATCH =\n ({ prisma }: { prisma: PrismaClient }) =>\n async (request: NextRequest, props: RouteProps) => {\n const { assistantId, mcpServerId } = 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 prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const validationError = validateIds({ assistantId, mcpServerId })\n if (validationError) return validationError\n\n const body = await request.json()\n\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, name, description } =\n parsed.data\n const normalizedName = normalizeOptionalString(name)\n const normalizedDescription = normalizeOptionalString(description)\n\n const mcpServer = await prisma.mcpServer.findFirst({\n where: {\n id: mcpServerId,\n assistant: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n },\n })\n\n if (!mcpServer) {\n return NextResponse.json(\n { error: 'No MCP server found' },\n { status: 400 },\n )\n }\n\n const updatedMcpServer = await prisma.mcpServer.update({\n where: {\n id: mcpServerId,\n },\n data: {\n transportType,\n ...(normalizedName !== undefined ? { name: normalizedName } : {}),\n ...(normalizedDescription !== undefined\n ? { description: normalizedDescription }\n : {}),\n ...(transportType === TransportType.SSE\n ? {\n sseTransport: {\n update: {\n url: sseTransport!.url,\n headers: JSON.parse(sseTransport!.headers),\n },\n },\n }\n : {}),\n ...(transportType === TransportType.HTTP\n ? {\n httpTransport: {\n update: {\n url: httpTransport!.url,\n headers: JSON.parse(httpTransport!.headers),\n },\n },\n }\n : {}),\n },\n include: {\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer: updatedMcpServer }),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const buildDELETE =\n ({ prisma }: { prisma: PrismaClient }) =>\n async (_request: NextRequest, props: RouteProps) => {\n const { assistantId, mcpServerId } = 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 prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const validationError = validateIds({ assistantId, mcpServerId })\n if (validationError) return validationError\n\n const mcpServer = await prisma.mcpServer.findFirst({\n where: {\n id: mcpServerId,\n assistant: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n },\n })\n\n if (!mcpServer) {\n return NextResponse.json(\n { error: 'No MCP server found' },\n { status: 400 },\n )\n }\n\n const deletedMcpServer = await prisma.mcpServer.delete({\n where: { id: mcpServerId },\n include: {\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer: deletedMcpServer }),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const buildOPTIONS = () => () =>\n NextResponse.json(\n {},\n {\n headers: cacheHeaders,\n },\n )\n"],"names":[],"mappings":"6jCAAO,IAAM,EAAe,CAC1B,8BAA+B,IAC/B,+BAAgC,kCAChC,+BAAgC,cAClC,mDCHA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAAY,MAAO,eAC9B,CAAa,MACb,CAAI,QACJ,CAAM,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AA,qBAAA,AAAqB,EAAC,EAAW,YAAY,GAE9E,MAAM,CAAA,EAAA,EAAA,YAAY,AAAZ,EAAa,EAAa,EAAa,IAAI,SAAS,EAAW,KAAK,CAAC,IAAI,CAAE,SAC7E,EACA,OAAQ,EAAW,KAAK,CAAC,MAAM,EAAI,GACvC,IACO,IACX,EAGI,EACA,MAAM,EAAe,EADT,CAGZ,MAAM,EAAO,qBAAqB,CAAC,EAAI,OAAO,CAAE,IAAI,EAAO,KAAK,CAAC,EAAA,cAAc,CAAC,aAAa,CAAE,CACvF,SAAU,CAAA,EAAG,EAAO,CAAC,EAAE,EAAI,GAAG,CAAA,CAAE,CAChC,KAAM,EAAA,QAAQ,CAAC,MAAM,CACrB,WAAY,CACR,cAAe,EACf,cAAe,EAAI,GACvB,AAD0B,CAE9B,EAAG,GAEf,CAAE,MAAO,EAAK,CAcV,GAbI,AAAE,CAAD,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":[5]}
|
|
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/node_modules/next/dist/esm/build/templates/app-route.js","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.ts"],"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, type PrismaClient } from '@prisma/client'\nimport { validate } from 'uuid'\n\nexport const getApiKey = async ({\n authorization,\n type,\n prisma,\n}: {\n authorization: string | null\n type: ApiKeyType\n prisma: PrismaClient\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 name: mcpServer.name,\n description: mcpServer.description,\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\nconst optionalNameString = z\n .string()\n .min(1)\n .regex(/^[a-zA-Z0-9-]+$/, {\n message: 'Name can only include letters, numbers, and hyphens.',\n })\n .optional()\n .nullable()\n\nconst optionalDescriptionString = z.string().min(1).optional().nullable()\n\nexport const baseSchema = z.object({\n name: optionalNameString,\n description: optionalDescriptionString,\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 { 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/[mcpServerId]/route\",\n pathname: \"/api/assistants/[assistantId]/mcp-servers/[mcpServerId]\",\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/[mcpServerId]/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/[mcpServerId]/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","import { prisma } from '@/lib/prisma'\nimport { buildDELETE, buildGET, buildOPTIONS, buildPATCH } from './buildRoute'\n\nexport const GET = buildGET({ prisma })\n\nexport const PATCH = buildPATCH({ prisma })\n\nexport const DELETE = buildDELETE({ prisma })\n\nexport const OPTIONS = buildOPTIONS()\n","import { headers } from 'next/headers'\nimport { ApiKeyType, TransportType, type PrismaClient } from '@prisma/client'\nimport { NextResponse, type NextRequest } from 'next/server'\nimport { cacheHeaders } from '@/lib/cache/cacheHeaders'\nimport { getApiKey } from '@/lib/apiKeys/getApiKey'\nimport { validate } from 'uuid'\nimport { serializeApiMcpServer } from '@/lib/mcpServers/serializeApiMcpServer'\nimport { mcpServerSchema } from '@/lib/mcpServers/mcpServerSchema'\n\ntype RouteProps = {\n params: Promise<{ assistantId: string; mcpServerId: string }>\n}\n\nconst validateIds = ({\n assistantId,\n mcpServerId,\n}: {\n assistantId: string\n mcpServerId: string\n}) => {\n if (!validate(assistantId)) {\n return NextResponse.json({ error: 'Invalid assistant id' }, { status: 400 })\n }\n\n if (!validate(mcpServerId)) {\n return NextResponse.json(\n { error: 'Invalid MCP server id' },\n { status: 400 },\n )\n }\n\n return null\n}\n\nexport const buildGET =\n ({ prisma }: { prisma: PrismaClient }) =>\n async (_request: NextRequest, props: RouteProps) => {\n const { assistantId, mcpServerId } = 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 prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const validationError = validateIds({ assistantId, mcpServerId })\n if (validationError) return validationError\n\n const mcpServer = await prisma.mcpServer.findFirst({\n where: {\n id: mcpServerId,\n assistant: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n },\n include: {\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n if (!mcpServer) {\n return NextResponse.json(\n { error: 'No MCP server found' },\n { status: 400 },\n )\n }\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer }),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const buildPATCH =\n ({ prisma }: { prisma: PrismaClient }) =>\n async (request: NextRequest, props: RouteProps) => {\n const { assistantId, mcpServerId } = 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 prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const validationError = validateIds({ assistantId, mcpServerId })\n if (validationError) return validationError\n\n const body = await request.json()\n\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, name, description } =\n parsed.data\n\n const mcpServer = await prisma.mcpServer.findFirst({\n where: {\n id: mcpServerId,\n assistant: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n },\n })\n\n if (!mcpServer) {\n return NextResponse.json(\n { error: 'No MCP server found' },\n { status: 400 },\n )\n }\n\n const updatedMcpServer = await prisma.mcpServer.update({\n where: {\n id: mcpServerId,\n },\n data: {\n transportType,\n ...(name !== undefined ? { name } : {}),\n ...(description !== undefined ? { description } : {}),\n ...(transportType === TransportType.SSE\n ? {\n sseTransport: {\n update: {\n url: sseTransport!.url,\n headers: JSON.parse(sseTransport!.headers),\n },\n },\n }\n : {}),\n ...(transportType === TransportType.HTTP\n ? {\n httpTransport: {\n update: {\n url: httpTransport!.url,\n headers: JSON.parse(httpTransport!.headers),\n },\n },\n }\n : {}),\n },\n include: {\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer: updatedMcpServer }),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const buildDELETE =\n ({ prisma }: { prisma: PrismaClient }) =>\n async (_request: NextRequest, props: RouteProps) => {\n const { assistantId, mcpServerId } = 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 prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const validationError = validateIds({ assistantId, mcpServerId })\n if (validationError) return validationError\n\n const mcpServer = await prisma.mcpServer.findFirst({\n where: {\n id: mcpServerId,\n assistant: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n },\n })\n\n if (!mcpServer) {\n return NextResponse.json(\n { error: 'No MCP server found' },\n { status: 400 },\n )\n }\n\n const deletedMcpServer = await prisma.mcpServer.delete({\n where: { id: mcpServerId },\n include: {\n sseTransport: true,\n httpTransport: true,\n },\n })\n\n return NextResponse.json(\n {\n mcpServer: serializeApiMcpServer({ mcpServer: deletedMcpServer }),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const buildOPTIONS = () => () =>\n NextResponse.json(\n {},\n {\n headers: cacheHeaders,\n },\n )\n"],"names":[],"mappings":"6jCAAO,IAAM,EAAe,CAC1B,8BAA+B,IAC/B,+BAAgC,kCAChC,+BAAgC,cAClC,mDCHA,IAAA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAAY,MAAO,eAC9B,CAAa,MACb,CAAI,QACJ,CAAM,CAKP,IACC,GAAI,CAAC,EACH,OAAO,KAGT,CAJoB,EAId,EAAG,EAAY,CAAG,EAAc,KAAK,CAAC,iBAE5C,AAAK,CAAA,EAAA,CAAD,CAAC,QAAA,AAAQ,EAAC,GAIP,EAAO,MAAM,CAAC,EAJO,OAIE,CAAC,CAC7B,MAAO,MAAE,EAAM,MAAO,CAAY,CACpC,GALS,IAMX,gDCzBO,IAAM,EAAS,AAAC,IACrB,GAAI,CAEF,OADA,KAAK,KAAK,CAAC,IACJ,CAET,CAAE,MAAO,EAAG,CACV,OAAO,CACT,CACF,0ECkBO,IAAM,EAAwB,CAAC,CACpC,WAAS,CAQV,G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cAAe,EACf,cAAe,EAAI,GACvB,AAD0B,CAE9B,EAAG,GAEf,CAAE,MAAO,EAAK,CAcV,GAbI,AAAE,CAAD,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":[5]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},30611,e=>{"use strict";e.s(["cacheHeaders",()=>t]);let t={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}},88122,e=>{"use strict";e.s(["getApiKey",()=>r]);var t=e.i(55897);let r=async({authorization:e,type:r,prisma:s})=>{if(!e)return null;let[,a]=e.split("Bearer ");return(0,t.validate)(a)?s.apiKey.findFirst({where:{type:r,value:a}}):null}},67083,e=>{"use strict";e.s(["isJSON",()=>t]);let t=e=>{try{return JSON.parse(e),!0}catch(e){return!1}}},40145,1065,e=>{"use strict";e.s(["serializeApiMcpServer",()=>t],40145);let t=({mcpServer:e})=>({id:e.id,name:e.name,description:e.description,transportType:e.transportType,sseTransport:e.sseTransport?(({sseTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({sseTransport:e.sseTransport}):null,httpTransport:e.httpTransport?(({httpTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({httpTransport:e.httpTransport}):null,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()});e.s(["mcpServerSchema",()=>l],1065);var r=e.i(13669),s=e.i(29173),a=e.i(67083);let n=r.z.object({command:r.z.string().min(1),args:r.z.string().min(1)}),i=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),o=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),p=r.z.string().trim().min(1).optional().nullable(),l=r.z.object({name:p,description:p,transportType:r.z.nativeEnum(s.TransportType).refine(e=>e!==s.TransportType.STDIO,{message:`transportType cannot be ${s.TransportType.STDIO}`}),sseTransport:i.nullable().optional(),httpTransport:o.nullable().optional()}).superRefine((e,t)=>{if(e.transportType===s.TransportType.STDIO){t.addIssue({code:r.z.ZodIssueCode.custom,message:`Transport type ${s.TransportType.STDIO} is not allowed.`});let a=n.safeParse(e.stdioTransport);a.success||a.error.issues.forEach(e=>t.addIssue({...e,path:["stdioTransport",...e.path]}))}else if(e.transportType===s.TransportType.SSE){let r=i.safeParse(e.sseTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["sseTransport",...e.path]}))}else if(e.transportType===s.TransportType.HTTP){let r=o.safeParse(e.httpTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["httpTransport",...e.path]}))}})},56584,e=>{"use strict";e.s([])},56410,e=>{"use strict";e.s(["handler",()=>z,"patchFetch",()=>H,"routeModule",()=>b,"serverHooks",()=>k,"workAsyncStorage",()=>P,"workUnitAsyncStorage",()=>j],56410);var t=e.i(5865),r=e.i(43877),s=e.i(77767),a=e.i(92562),n=e.i(66256),i=e.i(5270),o=e.i(90231),p=e.i(82677),l=e.i(51081),d=e.i(89822),u=e.i(9124),c=e.i(39147),h=e.i(40568),T=e.i(87188),v=e.i(93695);e.i(57132);var m=e.i(80739);e.s(["GET",()=>N,"OPTIONS",()=>I,"POST",()=>O],14823);var x=e.i(24493),f=e.i(49493),g=e.i(29173),R=e.i(11053),y=e.i(30611),S=e.i(88122),w=e.i(40145),A=e.i(1065);let E=e=>{if(void 0!==e)return null===e?null:e.trim()},N=(({prisma:e})=>async(t,r)=>{let{assistantId:s}=await r.params,a=(await (0,R.headers)()).get("authorization");if(!a)return f.NextResponse.json({error:"No authorization header found"},{status:400});let n=await (0,S.getApiKey)({type:g.ApiKeyType.PRIVATE,authorization:a,prisma:e});if(!n)return f.NextResponse.json({error:"Invalid api key"},{status:400});let i=await e.assistant.findFirst({where:{id:s,workspaceId:n.workspaceId},include:{mcpServers:{include:{stdioTransport:!0,sseTransport:!0,httpTransport:!0},orderBy:{createdAt:"desc"}}}});return i?f.NextResponse.json({mcpServers:i.mcpServers.map(e=>(0,w.serializeApiMcpServer)({mcpServer:e}))},{headers:y.cacheHeaders}):f.NextResponse.json({error:"No assistant found"},{status:400})})({prisma:x.prisma}),O=(({prisma:e})=>async(t,r)=>{let{assistantId:s}=await r.params,a=(await (0,R.headers)()).get("authorization");if(!a)return f.NextResponse.json({error:"No authorization header found"},{status:400});let n=await (0,S.getApiKey)({authorization:a,type:g.ApiKeyType.PRIVATE,prisma:e});if(!n)return f.NextResponse.json({error:"Invalid api key"},{status:400});let i=await t.json(),o=A.mcpServerSchema.safeParse(i);if(!o.success)return f.NextResponse.json({error:"Invalid payload"},{status:400});let{transportType:p,sseTransport:l,httpTransport:d,name:u,description:c}=o.data,h=E(u),T=E(c),v=n.workspaceId;if(!await e.assistant.findFirst({where:{id:s,workspaceId:v}}))return f.NextResponse.json({error:"No assistant found"},{status:400});let m=await e.mcpServer.create({data:{transportType:p,...p===g.TransportType.SSE?{sseTransport:{create:{url:l.url,headers:JSON.parse(l.headers)}}}:{},...p===g.TransportType.HTTP?{httpTransport:{create:{url:d.url,headers:JSON.parse(d.headers)}}}:{},...void 0!==h?{name:h}:{},...void 0!==T?{description:T}:{},assistant:{connect:{id:s,workspaceId:v}}},include:{stdioTransport:!0,sseTransport:!0,httpTransport:!0}});return f.NextResponse.json({mcpServer:(0,w.serializeApiMcpServer)({mcpServer:m})},{headers:y.cacheHeaders})})({prisma:x.prisma}),I=()=>f.NextResponse.json({},{headers:y.cacheHeaders});var C=e.i(14823);let b=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/assistants/[assistantId]/mcp-servers/route",pathname:"/api/assistants/[assistantId]/mcp-servers",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/route.ts",nextConfigOutput:"",userland:C}),{workAsyncStorage:P,workUnitAsyncStorage:j,serverHooks:k}=b;function H(){return(0,s.patchFetch)({workAsyncStorage:P,workUnitAsyncStorage:j})}async function z(e,t,s){var x;let f="/api/assistants/[assistantId]/mcp-servers/route";f=f.replace(/\/index$/,"")||"/";let g=await b.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!g)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:R,params:y,nextConfig:S,isDraftMode:w,prerenderManifest:A,routerServerContext:E,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,resolvedPathname:I}=g,C=(0,i.normalizeAppPath)(f),P=!!(A.dynamicRoutes[C]||A.routes[I]);if(P&&!w){let e=!!A.routes[I],t=A.dynamicRoutes[C];if(t&&!1===t.fallback&&!e)throw new v.NoFallbackError}let j=null;!P||b.isDev||w||(j="/index"===(j=I)?"/":j);let k=!0===b.isDev||!P,H=P&&!k,z=e.method||"GET",q=(0,n.getTracer)(),M=q.getActiveScopeSpan(),_={params:y,prerenderManifest:A,renderOpts:{experimental:{cacheComponents:!!S.experimental.cacheComponents,authInterrupts:!!S.experimental.authInterrupts},supportsDynamicResponse:k,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:null==(x=S.experimental)?void 0:x.cacheLife,isRevalidate:H,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s)=>b.onRequestError(e,t,s,E)},sharedContext:{buildId:R}},D=new o.NodeNextRequest(e),U=new o.NodeNextResponse(t),K=p.NextRequestAdapter.fromNodeNextRequest(D,(0,p.signalFromNodeResponse)(t));try{let i=async r=>b.handle(K,_).finally(()=>{if(!r)return;r.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let s=q.getRootSpanAttributes();if(!s)return;if(s.get("next.span_type")!==l.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${s.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=s.get("next.route");if(a){let e=`${z} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":e}),r.updateName(e)}else r.updateName(`${z} ${e.url}`)}),o=async n=>{var o,p;let l=async({previousCacheEntry:r})=>{try{if(!(0,a.getRequestMeta)(e,"minimalMode")&&N&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=_.renderOpts.fetchMetrics;let p=_.renderOpts.pendingWaitUntil;p&&s.waitUntil&&(s.waitUntil(p),p=void 0);let l=_.renderOpts.collectedTags;if(!P)return await (0,u.sendResponse)(D,U,o,_.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[T.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==_.renderOpts.collectedRevalidate&&!(_.renderOpts.collectedRevalidate>=T.INFINITE_CACHE)&&_.renderOpts.collectedRevalidate,s=void 0===_.renderOpts.collectedExpire||_.renderOpts.collectedExpire>=T.INFINITE_CACHE?void 0:_.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await b.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isRevalidate:H,isOnDemandRevalidate:N})},E),t}},v=await b.handleResponse({req:e,nextConfig:S,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,responseGenerator:l,waitUntil:s.waitUntil});if(!P)return null;if((null==v||null==(o=v.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==v||null==(p=v.value)?void 0:p.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,a.getRequestMeta)(e,"minimalMode")||t.setHeader("x-nextjs-cache",N?"REVALIDATED":v.isMiss?"MISS":v.isStale?"STALE":"HIT"),w&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,c.fromNodeOutgoingHttpHeaders)(v.value.headers);return(0,a.getRequestMeta)(e,"minimalMode")&&P||x.delete(T.NEXT_CACHE_TAGS_HEADER),!v.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,h.getCacheControlHeader)(v.cacheControl)),await (0,u.sendResponse)(D,U,new Response(v.value.body,{headers:x,status:v.value.status||200})),null};M?await o(M):await q.withPropagatedContext(e.headers,()=>q.trace(l.BaseServerSpan.handleRequest,{spanName:`${z} ${e.url}`,kind:n.SpanKind.SERVER,attributes:{"http.method":z,"http.target":e.url}},o))}catch(t){if(t instanceof v.NoFallbackError||await b.onRequestError(e,t,{routerKind:"App Router",routePath:C,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isRevalidate:H,isOnDemandRevalidate:N})}),P)throw t;return await (0,u.sendResponse)(D,U,new Response(null,{status:500})),null}}}];
|
|
1
|
+
module.exports=[18622,(e,t,r)=>{t.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},30611,e=>{"use strict";e.s(["cacheHeaders",()=>t]);let t={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, PUT, DELETE, OPTIONS","Access-Control-Allow-Headers":"Content-Type"}},88122,e=>{"use strict";e.s(["getApiKey",()=>r]);var t=e.i(55897);let r=async({authorization:e,type:r,prisma:s})=>{if(!e)return null;let[,a]=e.split("Bearer ");return(0,t.validate)(a)?s.apiKey.findFirst({where:{type:r,value:a}}):null}},67083,e=>{"use strict";e.s(["isJSON",()=>t]);let t=e=>{try{return JSON.parse(e),!0}catch(e){return!1}}},40145,1065,e=>{"use strict";e.s(["serializeApiMcpServer",()=>t],40145);let t=({mcpServer:e})=>({id:e.id,name:e.name,description:e.description,transportType:e.transportType,sseTransport:e.sseTransport?(({sseTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({sseTransport:e.sseTransport}):null,httpTransport:e.httpTransport?(({httpTransport:e})=>({id:e.id,url:e.url,headers:e.headers,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()}))({httpTransport:e.httpTransport}):null,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()});e.s(["mcpServerSchema",()=>d],1065);var r=e.i(13669),s=e.i(29173),a=e.i(67083);let n=r.z.object({command:r.z.string().min(1),args:r.z.string().min(1)}),i=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),o=r.z.object({url:r.z.string().min(1).url(),headers:r.z.string().min(1).refine(a.isJSON,{message:"Must be a valid JSON string."})}),p=r.z.string().min(1).regex(/^[a-zA-Z0-9-]+$/,{message:"Name can only include letters, numbers, and hyphens."}).optional().nullable(),l=r.z.string().min(1).optional().nullable(),d=r.z.object({name:p,description:l,transportType:r.z.nativeEnum(s.TransportType).refine(e=>e!==s.TransportType.STDIO,{message:`transportType cannot be ${s.TransportType.STDIO}`}),sseTransport:i.nullable().optional(),httpTransport:o.nullable().optional()}).superRefine((e,t)=>{if(e.transportType===s.TransportType.STDIO){t.addIssue({code:r.z.ZodIssueCode.custom,message:`Transport type ${s.TransportType.STDIO} is not allowed.`});let a=n.safeParse(e.stdioTransport);a.success||a.error.issues.forEach(e=>t.addIssue({...e,path:["stdioTransport",...e.path]}))}else if(e.transportType===s.TransportType.SSE){let r=i.safeParse(e.sseTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["sseTransport",...e.path]}))}else if(e.transportType===s.TransportType.HTTP){let r=o.safeParse(e.httpTransport);if(r.success)return;r.error.issues.forEach(e=>t.addIssue({...e,path:["httpTransport",...e.path]}))}})},56584,e=>{"use strict";e.s([])},56410,e=>{"use strict";e.s(["handler",()=>H,"patchFetch",()=>k,"routeModule",()=>C,"serverHooks",()=>j,"workAsyncStorage",()=>b,"workUnitAsyncStorage",()=>P],56410);var t=e.i(5865),r=e.i(43877),s=e.i(77767),a=e.i(92562),n=e.i(66256),i=e.i(5270),o=e.i(90231),p=e.i(82677),l=e.i(51081),d=e.i(89822),u=e.i(9124),c=e.i(39147),h=e.i(40568),T=e.i(87188),m=e.i(93695);e.i(57132);var v=e.i(80739);e.s(["GET",()=>E,"OPTIONS",()=>O,"POST",()=>N],14823);var x=e.i(24493),g=e.i(49493),f=e.i(29173),y=e.i(11053),R=e.i(30611),S=e.i(88122),A=e.i(40145),w=e.i(1065);let E=(({prisma:e})=>async(t,r)=>{let{assistantId:s}=await r.params,a=(await (0,y.headers)()).get("authorization");if(!a)return g.NextResponse.json({error:"No authorization header found"},{status:400});let n=await (0,S.getApiKey)({type:f.ApiKeyType.PRIVATE,authorization:a,prisma:e});if(!n)return g.NextResponse.json({error:"Invalid api key"},{status:400});let i=await e.assistant.findFirst({where:{id:s,workspaceId:n.workspaceId},include:{mcpServers:{include:{stdioTransport:!0,sseTransport:!0,httpTransport:!0},orderBy:{createdAt:"desc"}}}});return i?g.NextResponse.json({mcpServers:i.mcpServers.map(e=>(0,A.serializeApiMcpServer)({mcpServer:e}))},{headers:R.cacheHeaders}):g.NextResponse.json({error:"No assistant found"},{status:400})})({prisma:x.prisma}),N=(({prisma:e})=>async(t,r)=>{let{assistantId:s}=await r.params,a=(await (0,y.headers)()).get("authorization");if(!a)return g.NextResponse.json({error:"No authorization header found"},{status:400});let n=await (0,S.getApiKey)({authorization:a,type:f.ApiKeyType.PRIVATE,prisma:e});if(!n)return g.NextResponse.json({error:"Invalid api key"},{status:400});let i=await t.json(),o=w.mcpServerSchema.safeParse(i);if(!o.success)return g.NextResponse.json({error:"Invalid payload"},{status:400});let{transportType:p,sseTransport:l,httpTransport:d,name:u,description:c}=o.data,h=n.workspaceId;if(!await e.assistant.findFirst({where:{id:s,workspaceId:h}}))return g.NextResponse.json({error:"No assistant found"},{status:400});let T=await e.mcpServer.create({data:{transportType:p,...p===f.TransportType.SSE?{sseTransport:{create:{url:l.url,headers:JSON.parse(l.headers)}}}:{},...p===f.TransportType.HTTP?{httpTransport:{create:{url:d.url,headers:JSON.parse(d.headers)}}}:{},...void 0!==u?{name:u}:{},...void 0!==c?{description:c}:{},assistant:{connect:{id:s,workspaceId:h}}},include:{stdioTransport:!0,sseTransport:!0,httpTransport:!0}});return g.NextResponse.json({mcpServer:(0,A.serializeApiMcpServer)({mcpServer:T})},{headers:R.cacheHeaders})})({prisma:x.prisma}),O=()=>g.NextResponse.json({},{headers:R.cacheHeaders});var I=e.i(14823);let C=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/assistants/[assistantId]/mcp-servers/route",pathname:"/api/assistants/[assistantId]/mcp-servers",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/mcp-servers/route.ts",nextConfigOutput:"",userland:I}),{workAsyncStorage:b,workUnitAsyncStorage:P,serverHooks:j}=C;function k(){return(0,s.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:P})}async function H(e,t,s){var x;let g="/api/assistants/[assistantId]/mcp-servers/route";g=g.replace(/\/index$/,"")||"/";let f=await C.prepare(e,t,{srcPage:g,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:y,params:R,nextConfig:S,isDraftMode:A,prerenderManifest:w,routerServerContext:E,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,resolvedPathname:I}=f,b=(0,i.normalizeAppPath)(g),P=!!(w.dynamicRoutes[b]||w.routes[I]);if(P&&!A){let e=!!w.routes[I],t=w.dynamicRoutes[b];if(t&&!1===t.fallback&&!e)throw new m.NoFallbackError}let j=null;!P||C.isDev||A||(j="/index"===(j=I)?"/":j);let k=!0===C.isDev||!P,H=P&&!k,z=e.method||"GET",q=(0,n.getTracer)(),M=q.getActiveScopeSpan(),_={params:R,prerenderManifest:w,renderOpts:{experimental:{cacheComponents:!!S.experimental.cacheComponents,authInterrupts:!!S.experimental.authInterrupts},supportsDynamicResponse:k,incrementalCache:(0,a.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:null==(x=S.experimental)?void 0:x.cacheLife,isRevalidate:H,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s)=>C.onRequestError(e,t,s,E)},sharedContext:{buildId:y}},D=new o.NodeNextRequest(e),U=new o.NodeNextResponse(t),K=p.NextRequestAdapter.fromNodeNextRequest(D,(0,p.signalFromNodeResponse)(t));try{let i=async r=>C.handle(K,_).finally(()=>{if(!r)return;r.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let s=q.getRootSpanAttributes();if(!s)return;if(s.get("next.span_type")!==l.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${s.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=s.get("next.route");if(a){let e=`${z} ${a}`;r.setAttributes({"next.route":a,"http.route":a,"next.span_name":e}),r.updateName(e)}else r.updateName(`${z} ${e.url}`)}),o=async n=>{var o,p;let l=async({previousCacheEntry:r})=>{try{if(!(0,a.getRequestMeta)(e,"minimalMode")&&N&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await i(n);e.fetchMetrics=_.renderOpts.fetchMetrics;let p=_.renderOpts.pendingWaitUntil;p&&s.waitUntil&&(s.waitUntil(p),p=void 0);let l=_.renderOpts.collectedTags;if(!P)return await (0,u.sendResponse)(D,U,o,_.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(o.headers);l&&(t[T.NEXT_CACHE_TAGS_HEADER]=l),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==_.renderOpts.collectedRevalidate&&!(_.renderOpts.collectedRevalidate>=T.INFINITE_CACHE)&&_.renderOpts.collectedRevalidate,s=void 0===_.renderOpts.collectedExpire||_.renderOpts.collectedExpire>=T.INFINITE_CACHE?void 0:_.renderOpts.collectedExpire;return{value:{kind:v.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await C.onRequestError(e,t,{routerKind:"App Router",routePath:g,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isRevalidate:H,isOnDemandRevalidate:N})},E),t}},m=await C.handleResponse({req:e,nextConfig:S,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:w,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,responseGenerator:l,waitUntil:s.waitUntil});if(!P)return null;if((null==m||null==(o=m.value)?void 0:o.kind)!==v.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==m||null==(p=m.value)?void 0:p.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,a.getRequestMeta)(e,"minimalMode")||t.setHeader("x-nextjs-cache",N?"REVALIDATED":m.isMiss?"MISS":m.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let x=(0,c.fromNodeOutgoingHttpHeaders)(m.value.headers);return(0,a.getRequestMeta)(e,"minimalMode")&&P||x.delete(T.NEXT_CACHE_TAGS_HEADER),!m.cacheControl||t.getHeader("Cache-Control")||x.get("Cache-Control")||x.set("Cache-Control",(0,h.getCacheControlHeader)(m.cacheControl)),await (0,u.sendResponse)(D,U,new Response(m.value.body,{headers:x,status:m.value.status||200})),null};M?await o(M):await q.withPropagatedContext(e.headers,()=>q.trace(l.BaseServerSpan.handleRequest,{spanName:`${z} ${e.url}`,kind:n.SpanKind.SERVER,attributes:{"http.method":z,"http.target":e.url}},o))}catch(t){if(t instanceof m.NoFallbackError||await C.onRequestError(e,t,{routerKind:"App Router",routePath:b,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isRevalidate:H,isOnDemandRevalidate:N})}),P)throw t;return await (0,u.sendResponse)(D,U,new Response(null,{status:500})),null}}}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=%5Broot-of-the-server%5D__eb816e13._.js.map
|