@superinterface/server 1.0.25 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/eslint/.cache_btwyo7 +1 -1
  5. package/.next/fallback-build-manifest.json +2 -2
  6. package/.next/server/app/_not-found.html +1 -1
  7. package/.next/server/app/_not-found.rsc +1 -1
  8. package/.next/server/app/api/api-keys/[apiKeyId]/route.js +1 -1
  9. package/.next/server/app/api/api-keys/[apiKeyId]/route.js.nft.json +1 -1
  10. package/.next/server/app/api/api-keys/route.js +1 -1
  11. package/.next/server/app/api/api-keys/route.js.nft.json +1 -1
  12. package/.next/server/app/api/assistants/[assistantId]/functions/[functionId]/route.js +1 -1
  13. package/.next/server/app/api/assistants/[assistantId]/functions/[functionId]/route.js.nft.json +1 -1
  14. package/.next/server/app/api/assistants/[assistantId]/functions/route.js +1 -1
  15. package/.next/server/app/api/assistants/[assistantId]/functions/route.js.nft.json +1 -1
  16. package/.next/server/app/api/assistants/[assistantId]/initial-messages/route.js +1 -1
  17. package/.next/server/app/api/assistants/[assistantId]/initial-messages/route.js.nft.json +1 -1
  18. package/.next/server/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +1 -1
  19. package/.next/server/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js.nft.json +1 -1
  20. package/.next/server/app/api/assistants/[assistantId]/mcp-servers/route.js +1 -1
  21. package/.next/server/app/api/assistants/[assistantId]/mcp-servers/route.js.nft.json +1 -1
  22. package/.next/server/app/api/assistants/[assistantId]/route.js +1 -1
  23. package/.next/server/app/api/assistants/[assistantId]/route.js.nft.json +1 -1
  24. package/.next/server/app/api/assistants/route.js +1 -1
  25. package/.next/server/app/api/assistants/route.js.nft.json +1 -1
  26. package/.next/server/app/api/files/[fileId]/contents/route.js +1 -1
  27. package/.next/server/app/api/files/[fileId]/contents/route.js.nft.json +1 -1
  28. package/.next/server/app/api/files/route.js +1 -1
  29. package/.next/server/app/api/files/route.js.nft.json +1 -1
  30. package/.next/server/app/api/messages/route.js +1 -1
  31. package/.next/server/app/api/messages/route.js.nft.json +1 -1
  32. package/.next/server/app/api/providers/[modelProviderId]/assistants/route.js +1 -1
  33. package/.next/server/app/api/providers/[modelProviderId]/assistants/route.js.nft.json +1 -1
  34. package/.next/server/app/api/providers/[modelProviderId]/models/route.js +1 -1
  35. package/.next/server/app/api/providers/[modelProviderId]/models/route.js.nft.json +1 -1
  36. package/.next/server/app/api/providers/[modelProviderId]/route.js +1 -1
  37. package/.next/server/app/api/providers/[modelProviderId]/route.js.nft.json +1 -1
  38. package/.next/server/app/api/providers/route.js +1 -1
  39. package/.next/server/app/api/providers/route.js.nft.json +1 -1
  40. package/.next/server/app/api/tasks/[taskId]/route.js +1 -1
  41. package/.next/server/app/api/tasks/[taskId]/route.js.nft.json +1 -1
  42. package/.next/server/app/api/tasks/callback/route.js +1 -1
  43. package/.next/server/app/api/tasks/callback/route.js.nft.json +1 -1
  44. package/.next/server/app/api/tasks/route.js +1 -1
  45. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  46. package/.next/server/app/api/threads/runs/submit-client-tool-outputs/route.js +1 -1
  47. package/.next/server/app/api/threads/runs/submit-client-tool-outputs/route.js.nft.json +1 -1
  48. package/.next/server/app/api/workspaces/[workspaceId]/route.js +1 -1
  49. package/.next/server/app/api/workspaces/[workspaceId]/route.js.nft.json +1 -1
  50. package/.next/server/app/api/workspaces/route.js +1 -1
  51. package/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  52. package/.next/server/app/index.html +1 -1
  53. package/.next/server/app/index.rsc +1 -1
  54. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
  55. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
  56. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
  57. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
  58. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
  59. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
  60. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
  61. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
  62. package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
  63. package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
  64. package/.next/server/chunks/[root-of-the-server]__40ab45eb._.js +1 -1
  65. package/.next/server/chunks/[root-of-the-server]__40ab45eb._.js.map +1 -1
  66. package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
  67. package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
  68. package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
  69. package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
  70. package/.next/server/chunks/[root-of-the-server]__47b17fad._.js +38 -0
  71. package/.next/server/chunks/[root-of-the-server]__47b17fad._.js.map +1 -0
  72. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  73. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  74. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
  75. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
  76. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
  77. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
  78. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
  79. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
  80. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
  81. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
  82. package/.next/server/chunks/[root-of-the-server]__676affb1._.js +1 -1
  83. package/.next/server/chunks/[root-of-the-server]__676affb1._.js.map +1 -1
  84. package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
  85. package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
  86. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
  87. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
  88. package/.next/server/chunks/[root-of-the-server]__a878c913._.js +1 -1
  89. package/.next/server/chunks/[root-of-the-server]__a878c913._.js.map +1 -1
  90. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
  91. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
  92. package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
  93. package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
  94. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
  95. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
  96. package/.next/server/chunks/[root-of-the-server]__f6f61507._.js +38 -0
  97. package/.next/server/chunks/[root-of-the-server]__f6f61507._.js.map +1 -0
  98. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
  99. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
  100. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
  101. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
  102. package/.next/server/functions-config-manifest.json +1 -8
  103. package/.next/server/pages/404.html +1 -1
  104. package/.next/server/pages/500.html +1 -1
  105. package/.next/trace +1 -1
  106. package/dist/app/api/api-keys/[apiKeyId]/buildRoute.d.ts +52 -0
  107. package/dist/app/api/api-keys/[apiKeyId]/buildRoute.d.ts.map +1 -0
  108. package/dist/app/api/api-keys/[apiKeyId]/buildRoute.js +121 -0
  109. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts +10 -21
  110. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
  111. package/dist/app/api/api-keys/[apiKeyId]/route.js +6 -125
  112. package/dist/app/api/api-keys/buildRoute.d.ts +32 -0
  113. package/dist/app/api/api-keys/buildRoute.d.ts.map +1 -0
  114. package/dist/app/api/api-keys/buildRoute.js +104 -0
  115. package/dist/app/api/api-keys/builders.d.ts +31 -0
  116. package/dist/app/api/api-keys/builders.d.ts.map +1 -0
  117. package/dist/app/api/api-keys/builders.js +109 -0
  118. package/dist/app/api/api-keys/route.d.ts +5 -13
  119. package/dist/app/api/api-keys/route.d.ts.map +1 -1
  120. package/dist/app/api/api-keys/route.js +8 -108
  121. package/dist/app/api/assistants/[assistantId]/buildRoute.d.ts +120 -0
  122. package/dist/app/api/assistants/[assistantId]/buildRoute.d.ts.map +1 -0
  123. package/dist/app/api/assistants/[assistantId]/buildRoute.js +226 -0
  124. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.d.ts +167 -0
  125. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.d.ts.map +1 -0
  126. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/buildRoute.js +184 -0
  127. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +10 -21
  128. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
  129. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +6 -191
  130. package/dist/app/api/assistants/[assistantId]/functions/buildRoute.d.ts +114 -0
  131. package/dist/app/api/assistants/[assistantId]/functions/buildRoute.d.ts.map +1 -0
  132. package/dist/app/api/assistants/[assistantId]/functions/buildRoute.js +117 -0
  133. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +7 -15
  134. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
  135. package/dist/app/api/assistants/[assistantId]/functions/route.js +5 -122
  136. package/dist/app/api/assistants/[assistantId]/initial-messages/buildRoute.d.ts +40 -0
  137. package/dist/app/api/assistants/[assistantId]/initial-messages/buildRoute.d.ts.map +1 -0
  138. package/dist/app/api/assistants/[assistantId]/initial-messages/buildRoute.js +85 -0
  139. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +7 -15
  140. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
  141. package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +5 -90
  142. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.d.ts +89 -0
  143. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.d.ts.map +1 -0
  144. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/buildRoute.js +167 -0
  145. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +10 -21
  146. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
  147. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +6 -174
  148. package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.d.ts +62 -0
  149. package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.d.ts.map +1 -0
  150. package/dist/app/api/assistants/[assistantId]/mcp-servers/buildRoute.js +115 -0
  151. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +7 -15
  152. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
  153. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +5 -120
  154. package/dist/app/api/assistants/[assistantId]/route.d.ts +11 -22
  155. package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
  156. package/dist/app/api/assistants/[assistantId]/route.js +6 -233
  157. package/dist/app/api/assistants/buildRoute.d.ts +121 -0
  158. package/dist/app/api/assistants/buildRoute.d.ts.map +1 -0
  159. package/dist/app/api/assistants/buildRoute.js +144 -0
  160. package/dist/app/api/assistants/route.d.ts +7 -13
  161. package/dist/app/api/assistants/route.d.ts.map +1 -1
  162. package/dist/app/api/assistants/route.js +6 -148
  163. package/dist/app/api/files/[fileId]/contents/buildRoute.d.ts +18 -0
  164. package/dist/app/api/files/[fileId]/contents/buildRoute.d.ts.map +1 -0
  165. package/dist/app/api/files/[fileId]/contents/buildRoute.js +81 -0
  166. package/dist/app/api/files/[fileId]/contents/route.d.ts +3 -13
  167. package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
  168. package/dist/app/api/files/[fileId]/contents/route.js +4 -84
  169. package/dist/app/api/files/buildRoute.d.ts +14 -0
  170. package/dist/app/api/files/buildRoute.d.ts.map +1 -0
  171. package/dist/app/api/files/buildRoute.js +88 -0
  172. package/dist/app/api/files/route.d.ts +4 -10
  173. package/dist/app/api/files/route.d.ts.map +1 -1
  174. package/dist/app/api/files/route.js +4 -91
  175. package/dist/app/api/messages/buildRoute.d.ts +34 -0
  176. package/dist/app/api/messages/buildRoute.d.ts.map +1 -0
  177. package/dist/app/api/messages/buildRoute.js +607 -0
  178. package/dist/app/api/messages/lib/initialMessagesResponse.d.ts.map +1 -1
  179. package/dist/app/api/messages/lib/initialMessagesResponse.js +1 -1
  180. package/dist/app/api/messages/route.d.ts +10 -22
  181. package/dist/app/api/messages/route.d.ts.map +1 -1
  182. package/dist/app/api/messages/route.js +6 -612
  183. package/dist/app/api/providers/[modelProviderId]/assistants/buildRoute.d.ts +24 -0
  184. package/dist/app/api/providers/[modelProviderId]/assistants/buildRoute.d.ts.map +1 -0
  185. package/dist/app/api/providers/[modelProviderId]/assistants/buildRoute.js +43 -0
  186. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +4 -9
  187. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
  188. package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -46
  189. package/dist/app/api/providers/[modelProviderId]/buildRoute.d.ts +61 -0
  190. package/dist/app/api/providers/[modelProviderId]/buildRoute.d.ts.map +1 -0
  191. package/dist/app/api/providers/[modelProviderId]/buildRoute.js +134 -0
  192. package/dist/app/api/providers/[modelProviderId]/models/buildRoute.d.ts +19 -0
  193. package/dist/app/api/providers/[modelProviderId]/models/buildRoute.d.ts.map +1 -0
  194. package/dist/app/api/providers/[modelProviderId]/models/buildRoute.js +43 -0
  195. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +4 -9
  196. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
  197. package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -46
  198. package/dist/app/api/providers/[modelProviderId]/route.d.ts +10 -21
  199. package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
  200. package/dist/app/api/providers/[modelProviderId]/route.js +6 -141
  201. package/dist/app/api/providers/buildRoute.d.ts +38 -0
  202. package/dist/app/api/providers/buildRoute.d.ts.map +1 -0
  203. package/dist/app/api/providers/buildRoute.js +75 -0
  204. package/dist/app/api/providers/route.d.ts +5 -13
  205. package/dist/app/api/providers/route.d.ts.map +1 -1
  206. package/dist/app/api/providers/route.js +5 -80
  207. package/dist/app/api/tasks/[taskId]/buildRoute.d.ts +19 -0
  208. package/dist/app/api/tasks/[taskId]/buildRoute.d.ts.map +1 -0
  209. package/dist/app/api/tasks/[taskId]/buildRoute.js +125 -0
  210. package/dist/app/api/tasks/[taskId]/route.d.ts +7 -57
  211. package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
  212. package/dist/app/api/tasks/[taskId]/route.js +6 -144
  213. package/dist/app/api/tasks/buildRoute.d.ts +36 -0
  214. package/dist/app/api/tasks/buildRoute.d.ts.map +1 -0
  215. package/dist/app/api/tasks/buildRoute.js +85 -0
  216. package/dist/app/api/tasks/callback/buildRoute.d.ts +6 -0
  217. package/dist/app/api/tasks/callback/buildRoute.d.ts.map +1 -0
  218. package/dist/app/api/tasks/callback/buildRoute.js +244 -0
  219. package/dist/app/api/tasks/callback/route.d.ts +2 -1
  220. package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
  221. package/dist/app/api/tasks/callback/route.js +4 -244
  222. package/dist/app/api/tasks/route.d.ts +5 -13
  223. package/dist/app/api/tasks/route.d.ts.map +1 -1
  224. package/dist/app/api/tasks/route.js +5 -90
  225. package/dist/app/api/threads/runs/submit-client-tool-outputs/buildRoute.d.ts +10 -0
  226. package/dist/app/api/threads/runs/submit-client-tool-outputs/buildRoute.d.ts.map +1 -0
  227. package/dist/app/api/threads/runs/submit-client-tool-outputs/buildRoute.js +36 -0
  228. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +2 -7
  229. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
  230. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +3 -37
  231. package/dist/app/api/workspaces/[workspaceId]/buildRoute.d.ts +16 -0
  232. package/dist/app/api/workspaces/[workspaceId]/buildRoute.d.ts.map +1 -0
  233. package/dist/app/api/workspaces/[workspaceId]/buildRoute.js +89 -0
  234. package/dist/app/api/workspaces/[workspaceId]/route.d.ts +5 -31
  235. package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
  236. package/dist/app/api/workspaces/[workspaceId]/route.js +5 -89
  237. package/dist/app/api/workspaces/buildRoute.d.ts +42 -0
  238. package/dist/app/api/workspaces/buildRoute.d.ts.map +1 -0
  239. package/dist/app/api/workspaces/buildRoute.js +78 -0
  240. package/dist/app/api/workspaces/route.d.ts +7 -27
  241. package/dist/app/api/workspaces/route.d.ts.map +1 -1
  242. package/dist/app/api/workspaces/route.js +6 -82
  243. package/dist/lib/functions/functionSchema.d.ts +56 -56
  244. package/dist/lib/functions/handleFunction/getFunction.d.ts +4 -4
  245. package/dist/lib/mcpServers/mcpServerSchema.d.ts +20 -20
  246. package/dist/lib/prisma/index.d.ts +2 -5
  247. package/dist/lib/prisma/index.d.ts.map +1 -1
  248. package/dist/lib/prisma/index.js +6 -78
  249. package/package.json +4 -12
  250. package/.next/server/chunks/[root-of-the-server]__228bff78._.js +0 -38
  251. package/.next/server/chunks/[root-of-the-server]__228bff78._.js.map +0 -1
  252. package/.next/server/chunks/[root-of-the-server]__3307123c._.js +0 -38
  253. package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +0 -1
  254. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js +0 -38
  255. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js.map +0 -1
  256. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +0 -38
  257. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +0 -1
  258. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +0 -38
  259. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js.map +0 -1
  260. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js +0 -38
  261. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +0 -1
  262. package/.next/server/chunks/[root-of-the-server]__ff90af03._.js +0 -38
  263. package/.next/server/chunks/[root-of-the-server]__ff90af03._.js.map +0 -1
  264. /package/.next/static/{jt8inwg6nWaLQZ4qpiSJ- → KhKDqyqUf75vkMRrXaWJf}/_buildManifest.js +0 -0
  265. /package/.next/static/{jt8inwg6nWaLQZ4qpiSJ- → KhKDqyqUf75vkMRrXaWJf}/_clientMiddlewareManifest.json +0 -0
  266. /package/.next/static/{jt8inwg6nWaLQZ4qpiSJ- → KhKDqyqUf75vkMRrXaWJf}/_ssgManifest.js +0 -0
@@ -0,0 +1,607 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { NextResponse } from 'next/server';
13
+ import { LogRequestMethod, LogRequestRoute, LogLevel, } from '@prisma/client';
14
+ import { messagesResponse, createMessageResponse, } from '@superinterface/react/server';
15
+ import { enqueueJson } from '@superinterface/react/utils';
16
+ import { cacheHeaders } from '../../../lib/cache/cacheHeaders';
17
+ import { z } from 'zod';
18
+ import { storageThreadId as getStorageThreadId } from '../../../lib/threads/storageThreadId';
19
+ import { assistantClientAdapter } from '../../../lib/assistants/assistantClientAdapter';
20
+ import { content as getContent } from '../../../lib/messages/content';
21
+ import { workspaceAccessWhere as getWorkspaceAccessWhere } from '../../../lib/apiKeys/workspaceAccessWhere';
22
+ import { initialMessagesResponse } from './lib/initialMessagesResponse';
23
+ import { createRunOpts } from '../../../lib/runs/createRunOpts';
24
+ import { handleToolCall } from '../../../lib/toolCalls/handleToolCall';
25
+ import { createThread } from '../../../lib/threads/createThread';
26
+ import { managedOpenaiThreadId } from '../../../lib/threads/managedOpenaiThreadId';
27
+ import { createLog } from '../../../lib/logs/createLog';
28
+ import { serializeThread } from './lib/serializeThread';
29
+ import { getWorkspaceId } from './lib/getWorkspaceId';
30
+ import { validThreadId } from '../../../lib/threads/validThreadId';
31
+ import { isOpenaiAssistantsStorageProvider } from '../../../lib/storageProviders/isOpenaiAssistantsStorageProvider';
32
+ import { serializeMetadata } from '../../../lib/metadata/serializeMetadata';
33
+ import { isResponsesStorageProvider } from '../../../lib/storageProviders/isResponsesStorageProvider';
34
+ import { serializeError } from '../../../lib/errors/serializeError';
35
+ export const maxDuration = 800;
36
+ export const buildGET = ({ prisma }) => async (request) => {
37
+ var _a;
38
+ const paramsResult = z
39
+ .object({
40
+ publicApiKey: z.string().optional(),
41
+ assistantId: z.string().optional(),
42
+ threadId: z.string().optional(),
43
+ pageParam: z.string().optional(),
44
+ })
45
+ .parse(Object.fromEntries(request.nextUrl.searchParams.entries()));
46
+ const workspaceAccessWhere = await getWorkspaceAccessWhere({
47
+ publicApiKey: (_a = paramsResult.publicApiKey) !== null && _a !== void 0 ? _a : null,
48
+ prisma,
49
+ });
50
+ if (!workspaceAccessWhere) {
51
+ return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
52
+ }
53
+ const assistantId = paramsResult.assistantId;
54
+ if (!assistantId) {
55
+ createLog({
56
+ log: {
57
+ requestMethod: LogRequestMethod.POST,
58
+ requestRoute: LogRequestRoute.MESSAGES,
59
+ level: LogLevel.ERROR,
60
+ status: 400,
61
+ message: 'No assistantId found.',
62
+ workspaceId: await getWorkspaceId({ workspaceAccessWhere, prisma }),
63
+ },
64
+ prisma,
65
+ });
66
+ return NextResponse.json({ error: 'No assistant id found' }, { status: 400 });
67
+ }
68
+ const { threadId, pageParam } = paramsResult;
69
+ const assistant = await prisma.assistant.findFirst({
70
+ where: {
71
+ id: assistantId,
72
+ workspace: workspaceAccessWhere,
73
+ },
74
+ include: {
75
+ threads: {
76
+ where: {
77
+ id: validThreadId({ threadId: threadId !== null && threadId !== void 0 ? threadId : null }),
78
+ },
79
+ take: 1,
80
+ include: {
81
+ assistant: {
82
+ select: {
83
+ storageProviderType: true,
84
+ },
85
+ },
86
+ },
87
+ },
88
+ workspace: {
89
+ include: {
90
+ modelProviders: true,
91
+ },
92
+ },
93
+ modelProvider: true,
94
+ initialMessages: {
95
+ orderBy: {
96
+ orderNumber: 'desc',
97
+ },
98
+ },
99
+ mcpServers: {
100
+ include: {
101
+ computerUseTool: true,
102
+ stdioTransport: true,
103
+ sseTransport: true,
104
+ httpTransport: true,
105
+ },
106
+ },
107
+ tools: {
108
+ include: {
109
+ fileSearchTool: true,
110
+ webSearchTool: true,
111
+ imageGenerationTool: true,
112
+ codeInterpreterTool: true,
113
+ computerUseTool: true,
114
+ },
115
+ },
116
+ functions: true,
117
+ },
118
+ });
119
+ if (!assistant) {
120
+ createLog({
121
+ log: {
122
+ requestMethod: LogRequestMethod.POST,
123
+ requestRoute: LogRequestRoute.MESSAGES,
124
+ level: LogLevel.ERROR,
125
+ status: 400,
126
+ message: 'No assistant found.',
127
+ workspaceId: await getWorkspaceId({ workspaceAccessWhere, prisma }),
128
+ },
129
+ prisma,
130
+ });
131
+ return NextResponse.json({ error: 'No assistant found' }, { status: 400 });
132
+ }
133
+ if (!threadId) {
134
+ return NextResponse.json(await initialMessagesResponse({ assistant }), {
135
+ headers: cacheHeaders,
136
+ });
137
+ }
138
+ const thread = assistant.threads[0];
139
+ if (!thread) {
140
+ return NextResponse.json(await initialMessagesResponse({ assistant }), {
141
+ headers: cacheHeaders,
142
+ });
143
+ }
144
+ const assistantClient = assistantClientAdapter({
145
+ assistant,
146
+ prisma,
147
+ thread,
148
+ });
149
+ const storageThreadId = getStorageThreadId({
150
+ thread,
151
+ });
152
+ if (!storageThreadId) {
153
+ return NextResponse.json(await initialMessagesResponse({ assistant }), {
154
+ headers: cacheHeaders,
155
+ });
156
+ }
157
+ try {
158
+ return NextResponse.json(await messagesResponse(Object.assign({ threadId: storageThreadId, client: assistantClient }, (pageParam ? { pageParam } : {}))), {
159
+ headers: cacheHeaders,
160
+ });
161
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
162
+ }
163
+ catch (error) {
164
+ console.dir({ error }, { depth: null });
165
+ createLog({
166
+ log: {
167
+ requestMethod: LogRequestMethod.GET,
168
+ requestRoute: LogRequestRoute.MESSAGES,
169
+ level: LogLevel.ERROR,
170
+ status: 500,
171
+ message: `Failed to load messages: ${error.message}`,
172
+ workspaceId: assistant.workspaceId,
173
+ assistantId: assistant.id,
174
+ threadId: thread.id,
175
+ },
176
+ prisma,
177
+ });
178
+ return NextResponse.json({ error: 'Failed to load messages.' }, { status: 500 });
179
+ }
180
+ };
181
+ export const buildPOST = ({ prisma, onSuccessCreateThread = () => void 0, }) => async (request) => {
182
+ var _a;
183
+ const bodyResult = z
184
+ .object({
185
+ audioContent: z.any().optional(),
186
+ content: z.any().optional(),
187
+ attachments: z.array(z.any()).optional(),
188
+ assistantId: z.string().optional(),
189
+ publicApiKey: z.string().optional(),
190
+ threadId: z.string().optional(),
191
+ })
192
+ .passthrough()
193
+ .parse(await request.json());
194
+ const { audioContent, content: textContent, attachments, assistantId, publicApiKey } = bodyResult, variables = __rest(bodyResult, ["audioContent", "content", "attachments", "assistantId", "publicApiKey"]);
195
+ const workspaceAccessWhere = await getWorkspaceAccessWhere({
196
+ publicApiKey: publicApiKey !== null && publicApiKey !== void 0 ? publicApiKey : null,
197
+ prisma,
198
+ });
199
+ if (!workspaceAccessWhere) {
200
+ return NextResponse.json({ error: 'Invalid api key' }, { status: 400 });
201
+ }
202
+ if (!assistantId) {
203
+ createLog({
204
+ log: {
205
+ requestMethod: LogRequestMethod.POST,
206
+ requestRoute: LogRequestRoute.MESSAGES,
207
+ level: LogLevel.ERROR,
208
+ status: 400,
209
+ message: 'No assistantId found.',
210
+ workspaceId: await getWorkspaceId({ workspaceAccessWhere, prisma }),
211
+ },
212
+ prisma,
213
+ });
214
+ return NextResponse.json({ error: 'No assistantId found.' }, { status: 400 });
215
+ }
216
+ if (!textContent && !audioContent && !(attachments === null || attachments === void 0 ? void 0 : attachments.length)) {
217
+ createLog({
218
+ log: {
219
+ requestMethod: LogRequestMethod.POST,
220
+ requestRoute: LogRequestRoute.MESSAGES,
221
+ level: LogLevel.ERROR,
222
+ status: 400,
223
+ message: 'No content found.',
224
+ workspaceId: await getWorkspaceId({ workspaceAccessWhere, prisma }),
225
+ },
226
+ prisma,
227
+ });
228
+ return NextResponse.json({ error: 'No content found.' }, { status: 400 });
229
+ }
230
+ const assistant = await prisma.assistant.findFirst({
231
+ where: {
232
+ id: assistantId,
233
+ workspace: workspaceAccessWhere,
234
+ },
235
+ include: {
236
+ threads: {
237
+ where: {
238
+ id: validThreadId({ threadId: (_a = bodyResult.threadId) !== null && _a !== void 0 ? _a : null }),
239
+ },
240
+ include: {
241
+ assistant: {
242
+ select: {
243
+ storageProviderType: true,
244
+ },
245
+ },
246
+ },
247
+ take: 1,
248
+ },
249
+ workspace: {
250
+ include: {
251
+ modelProviders: true,
252
+ },
253
+ },
254
+ mcpServers: {
255
+ include: {
256
+ computerUseTool: true,
257
+ stdioTransport: true,
258
+ sseTransport: true,
259
+ httpTransport: true,
260
+ },
261
+ },
262
+ tools: {
263
+ include: {
264
+ fileSearchTool: true,
265
+ webSearchTool: true,
266
+ imageGenerationTool: true,
267
+ codeInterpreterTool: true,
268
+ computerUseTool: {
269
+ include: {
270
+ mcpServer: {
271
+ include: {
272
+ stdioTransport: true,
273
+ sseTransport: true,
274
+ httpTransport: true,
275
+ },
276
+ },
277
+ },
278
+ },
279
+ },
280
+ },
281
+ functions: {
282
+ include: {
283
+ handler: {
284
+ include: {
285
+ requestHandler: true,
286
+ firecrawlHandler: true,
287
+ replicateHandler: true,
288
+ clientToolHandler: true,
289
+ assistantHandler: true,
290
+ createTaskHandler: true,
291
+ listTasksHandler: true,
292
+ updateTaskHandler: true,
293
+ deleteTaskHandler: true,
294
+ },
295
+ },
296
+ },
297
+ },
298
+ modelProvider: true,
299
+ initialMessages: {
300
+ orderBy: {
301
+ orderNumber: 'asc',
302
+ },
303
+ },
304
+ },
305
+ });
306
+ if (!assistant) {
307
+ createLog({
308
+ log: {
309
+ requestMethod: LogRequestMethod.POST,
310
+ requestRoute: LogRequestRoute.MESSAGES,
311
+ level: LogLevel.ERROR,
312
+ status: 400,
313
+ message: 'No assistant found.',
314
+ workspaceId: await getWorkspaceId({ workspaceAccessWhere, prisma }),
315
+ },
316
+ prisma,
317
+ });
318
+ return NextResponse.json({ error: 'No assistant found.' }, { status: 400 });
319
+ }
320
+ if (isOpenaiAssistantsStorageProvider({
321
+ storageProviderType: assistant.storageProviderType,
322
+ }) &&
323
+ !assistant.openaiAssistantId) {
324
+ createLog({
325
+ log: {
326
+ requestMethod: LogRequestMethod.POST,
327
+ requestRoute: LogRequestRoute.MESSAGES,
328
+ level: LogLevel.ERROR,
329
+ status: 400,
330
+ message: 'Assistant setup is not done.',
331
+ workspaceId: assistant.workspaceId,
332
+ assistantId: assistant.id,
333
+ },
334
+ prisma,
335
+ });
336
+ return NextResponse.json({ error: 'Assistant setup is not done.' }, { status: 400 });
337
+ }
338
+ let thread = assistant.threads[0];
339
+ let isThreadCreated = false;
340
+ if (!thread) {
341
+ const createThreadClient = assistantClientAdapter({ assistant, prisma });
342
+ try {
343
+ thread = await createThread({
344
+ client: createThreadClient,
345
+ assistant,
346
+ prisma,
347
+ variables: variables,
348
+ });
349
+ onSuccessCreateThread({ thread });
350
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
351
+ }
352
+ catch (error) {
353
+ console.error(error);
354
+ createLog({
355
+ log: {
356
+ requestMethod: LogRequestMethod.POST,
357
+ requestRoute: LogRequestRoute.MESSAGES,
358
+ level: LogLevel.ERROR,
359
+ status: 500,
360
+ message: `Failed to create thread: ${error.message}`,
361
+ workspaceId: assistant.workspaceId,
362
+ assistantId: assistant.id,
363
+ },
364
+ prisma,
365
+ });
366
+ return NextResponse.json({ error: 'Failed to create thread.' }, { status: 500 });
367
+ }
368
+ isThreadCreated = true;
369
+ }
370
+ let storageThreadId;
371
+ try {
372
+ storageThreadId = getStorageThreadId({
373
+ thread,
374
+ });
375
+ }
376
+ catch (error) {
377
+ console.error(error);
378
+ createLog({
379
+ log: {
380
+ requestMethod: LogRequestMethod.POST,
381
+ requestRoute: LogRequestRoute.MESSAGES,
382
+ level: LogLevel.ERROR,
383
+ status: 500,
384
+ message: 'Failed to get storage thread id.',
385
+ workspaceId: assistant.workspaceId,
386
+ assistantId: assistant.id,
387
+ threadId: thread.id,
388
+ },
389
+ prisma,
390
+ });
391
+ return NextResponse.json({ error: 'Failed to get storage thread id.' }, { status: 500 });
392
+ }
393
+ if (!storageThreadId &&
394
+ (isOpenaiAssistantsStorageProvider({
395
+ storageProviderType: assistant.storageProviderType,
396
+ }) ||
397
+ isResponsesStorageProvider({
398
+ storageProviderType: assistant.storageProviderType,
399
+ }))) {
400
+ try {
401
+ storageThreadId = await managedOpenaiThreadId({
402
+ assistant,
403
+ threadId: thread.id,
404
+ prisma,
405
+ });
406
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
407
+ }
408
+ catch (error) {
409
+ createLog({
410
+ log: {
411
+ requestMethod: LogRequestMethod.POST,
412
+ requestRoute: LogRequestRoute.MESSAGES,
413
+ level: LogLevel.ERROR,
414
+ status: 500,
415
+ message: `Failed to get managed openai thread id: ${error.message}`,
416
+ workspaceId: assistant.workspaceId,
417
+ assistantId: assistant.id,
418
+ threadId: thread.id,
419
+ },
420
+ prisma,
421
+ });
422
+ return NextResponse.json({ error: 'Failed to get managed openai thread id.' }, { status: 500 });
423
+ }
424
+ }
425
+ if (!storageThreadId) {
426
+ createLog({
427
+ log: {
428
+ requestMethod: LogRequestMethod.POST,
429
+ requestRoute: LogRequestRoute.MESSAGES,
430
+ level: LogLevel.ERROR,
431
+ status: 500,
432
+ message: 'Invalid thread configuration.',
433
+ workspaceId: assistant.workspaceId,
434
+ assistantId: assistant.id,
435
+ threadId: thread.id,
436
+ },
437
+ prisma,
438
+ });
439
+ return NextResponse.json({ error: 'Invalid thread configuration.' }, { status: 500 });
440
+ }
441
+ let content;
442
+ try {
443
+ content = await getContent({
444
+ audioContent,
445
+ textContent,
446
+ assistant,
447
+ });
448
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
449
+ }
450
+ catch (error) {
451
+ console.error(error);
452
+ createLog({
453
+ log: {
454
+ requestMethod: LogRequestMethod.POST,
455
+ requestRoute: LogRequestRoute.MESSAGES,
456
+ level: LogLevel.ERROR,
457
+ status: 500,
458
+ message: `Failed to get content: ${error.message}`,
459
+ workspaceId: assistant.workspaceId,
460
+ assistantId: assistant.id,
461
+ threadId: thread.id,
462
+ },
463
+ prisma,
464
+ });
465
+ return NextResponse.json({ error: 'Failed to get content.' }, { status: 500 });
466
+ }
467
+ const assistantClient = assistantClientAdapter({
468
+ assistant,
469
+ prisma,
470
+ thread,
471
+ });
472
+ try {
473
+ await assistantClient.beta.threads.messages.create(storageThreadId, Object.assign(Object.assign({ role: 'user', content }, ((attachments === null || attachments === void 0 ? void 0 : attachments.length) ? { attachments } : {})), { metadata: serializeMetadata({
474
+ variables,
475
+ workspaceId: assistant.workspaceId,
476
+ prisma,
477
+ }) }));
478
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
479
+ }
480
+ catch (error) {
481
+ console.log({ error });
482
+ createLog({
483
+ log: {
484
+ requestMethod: LogRequestMethod.POST,
485
+ requestRoute: LogRequestRoute.MESSAGES,
486
+ level: LogLevel.ERROR,
487
+ status: 500,
488
+ message: `Failed to create message: ${error.message}`,
489
+ workspaceId: assistant.workspaceId,
490
+ assistantId: assistant.id,
491
+ threadId: thread.id,
492
+ },
493
+ prisma,
494
+ });
495
+ return NextResponse.json({ error: 'Failed to create message.' }, { status: 500 });
496
+ }
497
+ let createRunStream;
498
+ try {
499
+ createRunStream = await assistantClient.beta.threads.runs.create(storageThreadId, await createRunOpts({ assistant, thread, prisma }));
500
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
501
+ }
502
+ catch (error) {
503
+ console.error(error);
504
+ createLog({
505
+ log: {
506
+ requestMethod: LogRequestMethod.POST,
507
+ requestRoute: LogRequestRoute.MESSAGES,
508
+ level: LogLevel.ERROR,
509
+ status: 500,
510
+ message: `Failed to create run stream: ${serializeError({ error })}`,
511
+ workspaceId: assistant.workspaceId,
512
+ assistantId: assistant.id,
513
+ threadId: thread.id,
514
+ },
515
+ prisma,
516
+ });
517
+ return NextResponse.json({ error: 'Failed to create run stream.' }, { status: 500 });
518
+ }
519
+ let latestInProgressRunData = null;
520
+ let latestCompletedRunData = null;
521
+ return new Response(createMessageResponse({
522
+ client: assistantClient,
523
+ createRunStream,
524
+ handleToolCall: handleToolCall({ assistant, thread, prisma }),
525
+ onStart: ({ controller, }) => {
526
+ if (!isThreadCreated)
527
+ return;
528
+ return enqueueJson({
529
+ controller,
530
+ value: {
531
+ event: 'thread.created',
532
+ data: serializeThread({
533
+ thread,
534
+ }),
535
+ },
536
+ });
537
+ },
538
+ onError: async ({ error }) => {
539
+ if (request.signal.aborted)
540
+ return;
541
+ createLog({
542
+ log: {
543
+ requestMethod: LogRequestMethod.POST,
544
+ requestRoute: LogRequestRoute.MESSAGES,
545
+ level: LogLevel.ERROR,
546
+ status: 500,
547
+ message: `Thread Run failed: ${error.message}`,
548
+ workspaceId: assistant.workspaceId,
549
+ assistantId: assistant.id,
550
+ threadId: thread.id,
551
+ },
552
+ prisma,
553
+ });
554
+ // if (latestInProgressRunData) {
555
+ // await assistantClient.beta.threads.runs.cancel(
556
+ // latestInProgressRunData.thread_id,
557
+ // latestInProgressRunData.id,
558
+ // )
559
+ // }
560
+ },
561
+ onEvent: ({ event, data }) => {
562
+ var _a;
563
+ if (event === 'thread.run.failed') {
564
+ createLog({
565
+ log: {
566
+ requestMethod: LogRequestMethod.POST,
567
+ requestRoute: LogRequestRoute.MESSAGES,
568
+ level: LogLevel.ERROR,
569
+ status: 500,
570
+ message: `Thread Run failed: ${(_a = data.last_error) === null || _a === void 0 ? void 0 : _a.message}`,
571
+ workspaceId: assistant.workspaceId,
572
+ assistantId: assistant.id,
573
+ threadId: thread.id,
574
+ },
575
+ prisma,
576
+ });
577
+ }
578
+ else if (event === 'thread.run.in_progress') {
579
+ latestInProgressRunData = data;
580
+ }
581
+ else if (event === 'thread.run.completed') {
582
+ latestCompletedRunData = data;
583
+ }
584
+ },
585
+ onClose: async () => {
586
+ if (latestCompletedRunData)
587
+ return;
588
+ if (!isOpenaiAssistantsStorageProvider({
589
+ storageProviderType: assistant.storageProviderType,
590
+ }))
591
+ return;
592
+ if (latestInProgressRunData) {
593
+ await assistantClient.beta.threads.runs.cancel(latestInProgressRunData.id, {
594
+ thread_id: latestInProgressRunData.thread_id,
595
+ });
596
+ }
597
+ },
598
+ }), {
599
+ status: 200,
600
+ headers: {
601
+ 'Content-Type': 'application/json; charset=utf-8',
602
+ },
603
+ });
604
+ };
605
+ export const buildOPTIONS = () => () => NextResponse.json({}, {
606
+ headers: cacheHeaders,
607
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"initialMessagesResponse.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/messages/lib/initialMessagesResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EACL,MAAM,EAIP,MAAM,gBAAgB,CAAA;AA+BvB,eAAO,MAAM,uBAAuB,GAAU,gBAE3C;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,eAAe,EAAE,IAAI,CAAA;SACtB,CAAA;KACF,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;EA4CA,CAAA"}
1
+ {"version":3,"file":"initialMessagesResponse.d.ts","sourceRoot":"","sources":["../../../../../src/app/api/messages/lib/initialMessagesResponse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EACL,MAAM,EAIP,MAAM,gBAAgB,CAAA;AA+BvB,eAAO,MAAM,uBAAuB,GAAU,gBAE3C;IACD,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC;QACpC,OAAO,EAAE;YACP,eAAe,EAAE,IAAI,CAAA;SACtB,CAAA;KACF,CAAC,CAAA;CACH;;;;;;;;;;;;;;;;EAgDA,CAAA"}
@@ -23,7 +23,7 @@ export const initialMessagesResponse = async ({ assistant, }) => {
23
23
  const threadId = optimisticId();
24
24
  const initialCreatedAt = dayjs().unix();
25
25
  return {
26
- data: await Promise.all(assistant.initialMessages.map((message, index) => serializeMessage({
26
+ data: await Promise.all(assistant.initialMessages.map(async (message, index) => serializeMessage({
27
27
  message: {
28
28
  id: optimisticId(),
29
29
  role: message.role.toLowerCase(),
@@ -1,36 +1,24 @@
1
- import { type NextRequest, NextResponse } from 'next/server';
2
- import OpenAI from 'openai';
3
- import { type PrismaClient } from '@prisma/client';
4
- import type { Thread } from '@prisma/client';
5
- export declare const maxDuration = 800;
6
- export declare const buildGET: ({ prisma: providedPrisma }?: {
7
- prisma?: PrismaClient;
8
- }) => (request: NextRequest) => Promise<NextResponse<{
1
+ import { maxDuration } from './buildRoute';
2
+ export { maxDuration };
3
+ export declare const GET: (request: import("next/server").NextRequest) => Promise<import("next/server").NextResponse<{
9
4
  error: string;
10
- }> | NextResponse<{
5
+ }> | import("next/server").NextResponse<{
11
6
  data: {
12
7
  id: string;
13
8
  role: "user" | "assistant";
14
9
  created_at: number;
15
- content: OpenAI.Beta.Threads.Messages.MessageContent[];
10
+ content: import("openai/resources/beta/threads/messages.mjs").MessageContent[];
16
11
  run_id: string;
17
12
  assistant_id: string;
18
13
  thread_id: string;
19
- attachments: OpenAI.Beta.Threads.Messages.Message.Attachment[];
14
+ attachments: import("openai/resources/beta/threads/messages.mjs").Message.Attachment[];
20
15
  metadata: import("openai/resources/shared.mjs").Metadata;
21
- runSteps: Pick<OpenAI.Beta.Threads.Runs.Steps.RunStep, "id" | "run_id" | "step_details" | "completed_at" | "cancelled_at" | "failed_at" | "status">[];
16
+ runSteps: Pick<import("openai/resources/beta/threads/runs/steps.mjs").RunStep, "id" | "run_id" | "step_details" | "completed_at" | "cancelled_at" | "failed_at" | "status">[];
22
17
  status: "in_progress" | "incomplete" | "completed";
23
18
  }[];
24
19
  hasNextPage: boolean;
25
20
  lastId: null;
26
- }> | NextResponse<import("@superinterface/react/types/index").MessagesPage>>;
27
- export declare const GET: ReturnType<typeof buildGET>;
28
- export declare const buildPOST: ({ prisma: providedPrisma, onSuccessCreateThread, }?: {
29
- prisma?: PrismaClient;
30
- onSuccessCreateThread?: ({ thread, }: {
31
- thread: Thread;
32
- }) => void | Promise<void>;
33
- }) => (request: NextRequest) => Promise<Response>;
34
- export declare const POST: ReturnType<typeof buildPOST>;
35
- export declare const OPTIONS: () => NextResponse<{}>;
21
+ }> | import("next/server").NextResponse<import("@superinterface/react/types/index").MessagesPage>>;
22
+ export declare const POST: (request: import("next/server").NextRequest) => Promise<Response>;
23
+ export declare const OPTIONS: () => import("next/server").NextResponse<{}>;
36
24
  //# sourceMappingURL=route.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/messages/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAIL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AA2B5C,eAAO,MAAM,WAAW,MAAM,CAAA;AAE9B,eAAO,MAAM,QAAQ,GAClB,6BAA4B;IAAE,MAAM,CAAC,EAAE,YAAY,CAAA;CAAO,MACpD,SAAS,WAAW;;;;;;;;;;;;;;;;;;4EA4K1B,CAAA;AAEH,eAAO,MAAM,GAAG,EACU,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAA;AAErD,eAAO,MAAM,SAAS,GACnB,qDAGE;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,qBAAqB,CAAC,EAAE,CAAC,EACvB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAA;KACf,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACtB,MACC,SAAS,WAAW,sBAggB1B,CAAA;AAEH,eAAO,MAAM,IAAI,EACY,UAAU,CAAC,OAAO,SAAS,CAAC,CAAA;AAEzD,eAAO,MAAM,OAAO,wBAMjB,CAAA"}
1
+ {"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../../src/app/api/messages/route.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,WAAW,EACZ,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;kGAAuB,CAAA;AAEvC,eAAO,MAAM,IAAI,mEAAwB,CAAA;AAEzC,eAAO,MAAM,OAAO,8CAAiB,CAAA"}