@superinterface/server 1.0.18 → 1.0.20

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 (264) 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/files/[fileId]/contents/route.js +1 -1
  9. package/.next/server/app/api/files/[fileId]/contents/route.js.nft.json +1 -1
  10. package/.next/server/app/api/files/route.js +1 -1
  11. package/.next/server/app/api/files/route.js.nft.json +1 -1
  12. package/.next/server/app/api/messages/route.js +3 -3
  13. package/.next/server/app/api/messages/route.js.nft.json +1 -1
  14. package/.next/server/app/index.html +1 -1
  15. package/.next/server/app/index.rsc +1 -1
  16. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js +1 -1
  17. package/.next/server/chunks/[root-of-the-server]__0c1bc5ed._.js.map +1 -1
  18. package/.next/server/chunks/[root-of-the-server]__13c6bd62._.js +1 -1
  19. package/.next/server/chunks/[root-of-the-server]__13c6bd62._.js.map +1 -1
  20. package/.next/server/chunks/[root-of-the-server]__228bff78._.js +2 -2
  21. package/.next/server/chunks/[root-of-the-server]__228bff78._.js.map +1 -1
  22. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js +1 -1
  23. package/.next/server/chunks/[root-of-the-server]__25ee13bc._.js.map +1 -1
  24. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js +1 -1
  25. package/.next/server/chunks/[root-of-the-server]__27aadac9._.js.map +1 -1
  26. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js +1 -1
  27. package/.next/server/chunks/[root-of-the-server]__2945c9e9._.js.map +1 -1
  28. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js +1 -1
  29. package/.next/server/chunks/[root-of-the-server]__29635e8e._.js.map +1 -1
  30. package/.next/server/chunks/[root-of-the-server]__29b43490._.js +2 -2
  31. package/.next/server/chunks/[root-of-the-server]__29b43490._.js.map +1 -1
  32. package/.next/server/chunks/[root-of-the-server]__315f084a._.js +1 -1
  33. package/.next/server/chunks/[root-of-the-server]__315f084a._.js.map +1 -1
  34. package/.next/server/chunks/[root-of-the-server]__3307123c._.js +2 -2
  35. package/.next/server/chunks/[root-of-the-server]__3307123c._.js.map +1 -1
  36. package/.next/server/chunks/[root-of-the-server]__441cee00._.js +1 -1
  37. package/.next/server/chunks/[root-of-the-server]__441cee00._.js.map +1 -1
  38. package/.next/server/chunks/[root-of-the-server]__464a4377._.js +1 -1
  39. package/.next/server/chunks/[root-of-the-server]__464a4377._.js.map +1 -1
  40. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js +1 -1
  41. package/.next/server/chunks/[root-of-the-server]__4e536bc0._.js.map +1 -1
  42. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js +2 -2
  43. package/.next/server/chunks/[root-of-the-server]__50c5f12c._.js.map +1 -1
  44. package/.next/server/chunks/[root-of-the-server]__51977f30._.js +1 -1
  45. package/.next/server/chunks/[root-of-the-server]__51977f30._.js.map +1 -1
  46. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js +1 -1
  47. package/.next/server/chunks/[root-of-the-server]__583a7f1c._.js.map +1 -1
  48. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js +1 -1
  49. package/.next/server/chunks/[root-of-the-server]__5abf1160._.js.map +1 -1
  50. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js +1 -1
  51. package/.next/server/chunks/[root-of-the-server]__5d09614a._.js.map +1 -1
  52. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js +1 -1
  53. package/.next/server/chunks/[root-of-the-server]__62d958e7._.js.map +1 -1
  54. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js +2 -2
  55. package/.next/server/chunks/[root-of-the-server]__6b8ba839._.js.map +1 -1
  56. package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js +1 -1
  57. package/.next/server/chunks/[root-of-the-server]__7f9ca1e3._.js.map +1 -1
  58. package/.next/server/chunks/[root-of-the-server]__83461316._.js +1 -1
  59. package/.next/server/chunks/[root-of-the-server]__83461316._.js.map +1 -1
  60. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js +1 -1
  61. package/.next/server/chunks/[root-of-the-server]__9a611d42._.js.map +1 -1
  62. package/.next/server/chunks/[root-of-the-server]__a135e388._.js +1 -1
  63. package/.next/server/chunks/[root-of-the-server]__a135e388._.js.map +1 -1
  64. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js +1 -1
  65. package/.next/server/chunks/[root-of-the-server]__b10ec83e._.js.map +1 -1
  66. package/.next/server/chunks/[root-of-the-server]__b9a334c3._.js +1 -1
  67. package/.next/server/chunks/[root-of-the-server]__b9a334c3._.js.map +1 -1
  68. package/.next/server/chunks/[root-of-the-server]__c1629392._.js +1 -1
  69. package/.next/server/chunks/[root-of-the-server]__c1629392._.js.map +1 -1
  70. package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js +2 -2
  71. package/.next/server/chunks/[root-of-the-server]__dd176cb5._.js.map +1 -1
  72. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js +2 -2
  73. package/.next/server/chunks/[root-of-the-server]__e7819e95._.js.map +1 -1
  74. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js +1 -1
  75. package/.next/server/chunks/[root-of-the-server]__eb816e13._.js.map +1 -1
  76. package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js +1 -1
  77. package/.next/server/chunks/[root-of-the-server]__ed6cf593._.js.map +1 -1
  78. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js +2 -2
  79. package/.next/server/chunks/[root-of-the-server]__f0dfab03._.js.map +1 -1
  80. package/.next/server/chunks/{[root-of-the-server]__30845206._.js → [root-of-the-server]__ff90af03._.js} +3 -3
  81. package/.next/server/chunks/{[root-of-the-server]__30845206._.js.map → [root-of-the-server]__ff90af03._.js.map} +1 -1
  82. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js +1 -1
  83. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_cb746cf4.js.map +1 -1
  84. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js +1 -1
  85. package/.next/server/chunks/c4f00_next_dist_esm_build_templates_app-route_f952d9ab.js.map +1 -1
  86. package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js +2 -2
  87. package/.next/server/chunks/supercorp_superinterface_bebd2c96._.js.map +1 -1
  88. package/.next/server/pages/404.html +1 -1
  89. package/.next/server/pages/500.html +1 -1
  90. package/.next/trace +1 -1
  91. package/bin/index.cjs +2 -0
  92. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts +55 -0
  93. package/dist/app/api/api-keys/[apiKeyId]/route.d.ts.map +1 -1
  94. package/dist/app/api/api-keys/[apiKeyId]/route.js +10 -4
  95. package/dist/app/api/api-keys/route.d.ts +29 -0
  96. package/dist/app/api/api-keys/route.d.ts.map +1 -1
  97. package/dist/app/api/api-keys/route.js +8 -3
  98. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts +172 -0
  99. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.d.ts.map +1 -1
  100. package/dist/app/api/assistants/[assistantId]/functions/[functionId]/route.js +11 -4
  101. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts +113 -0
  102. package/dist/app/api/assistants/[assistantId]/functions/route.d.ts.map +1 -1
  103. package/dist/app/api/assistants/[assistantId]/functions/route.js +8 -3
  104. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts +39 -0
  105. package/dist/app/api/assistants/[assistantId]/initial-messages/route.d.ts.map +1 -1
  106. package/dist/app/api/assistants/[assistantId]/initial-messages/route.js +8 -3
  107. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts +94 -0
  108. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.d.ts.map +1 -1
  109. package/dist/app/api/assistants/[assistantId]/mcp-servers/[mcpServerId]/route.js +10 -4
  110. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts +61 -0
  111. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.d.ts.map +1 -1
  112. package/dist/app/api/assistants/[assistantId]/mcp-servers/route.js +7 -3
  113. package/dist/app/api/assistants/[assistantId]/route.d.ts +123 -0
  114. package/dist/app/api/assistants/[assistantId]/route.d.ts.map +1 -1
  115. package/dist/app/api/assistants/[assistantId]/route.js +15 -6
  116. package/dist/app/api/assistants/route.d.ts +59 -0
  117. package/dist/app/api/assistants/route.d.ts.map +1 -1
  118. package/dist/app/api/assistants/route.js +8 -4
  119. package/dist/app/api/files/[fileId]/contents/route.d.ts +3 -2
  120. package/dist/app/api/files/[fileId]/contents/route.d.ts.map +1 -1
  121. package/dist/app/api/files/[fileId]/contents/route.js +9 -6
  122. package/dist/app/api/files/route.d.ts +10 -0
  123. package/dist/app/api/files/route.d.ts.map +1 -1
  124. package/dist/app/api/files/route.js +9 -5
  125. package/dist/app/api/messages/route.d.ts +24 -1
  126. package/dist/app/api/messages/route.d.ts.map +1 -1
  127. package/dist/app/api/messages/route.js +38 -13
  128. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts +19 -0
  129. package/dist/app/api/providers/[modelProviderId]/assistants/route.d.ts.map +1 -1
  130. package/dist/app/api/providers/[modelProviderId]/assistants/route.js +4 -2
  131. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts +14 -0
  132. package/dist/app/api/providers/[modelProviderId]/models/route.d.ts.map +1 -1
  133. package/dist/app/api/providers/[modelProviderId]/models/route.js +4 -2
  134. package/dist/app/api/providers/[modelProviderId]/route.d.ts +64 -0
  135. package/dist/app/api/providers/[modelProviderId]/route.d.ts.map +1 -1
  136. package/dist/app/api/providers/[modelProviderId]/route.js +12 -6
  137. package/dist/app/api/providers/route.d.ts +35 -0
  138. package/dist/app/api/providers/route.d.ts.map +1 -1
  139. package/dist/app/api/providers/route.js +9 -5
  140. package/dist/app/api/tasks/[taskId]/route.d.ts +61 -0
  141. package/dist/app/api/tasks/[taskId]/route.d.ts.map +1 -1
  142. package/dist/app/api/tasks/[taskId]/route.js +11 -5
  143. package/dist/app/api/tasks/callback/route.d.ts.map +1 -1
  144. package/dist/app/api/tasks/callback/route.js +17 -9
  145. package/dist/app/api/tasks/route.d.ts +33 -0
  146. package/dist/app/api/tasks/route.d.ts.map +1 -1
  147. package/dist/app/api/tasks/route.js +8 -4
  148. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts +9 -1
  149. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.d.ts.map +1 -1
  150. package/dist/app/api/threads/runs/submit-client-tool-outputs/route.js +5 -3
  151. package/dist/app/api/workspaces/[workspaceId]/route.d.ts +33 -0
  152. package/dist/app/api/workspaces/[workspaceId]/route.d.ts.map +1 -1
  153. package/dist/app/api/workspaces/[workspaceId]/route.js +7 -3
  154. package/dist/app/api/workspaces/route.d.ts +17 -3
  155. package/dist/app/api/workspaces/route.d.ts.map +1 -1
  156. package/dist/app/api/workspaces/route.js +8 -4
  157. package/dist/lib/apiKeys/getApiKey.d.ts +3 -2
  158. package/dist/lib/apiKeys/getApiKey.d.ts.map +1 -1
  159. package/dist/lib/apiKeys/getApiKey.js +1 -2
  160. package/dist/lib/apiKeys/workspaceAccessWhere.d.ts +3 -1
  161. package/dist/lib/apiKeys/workspaceAccessWhere.d.ts.map +1 -1
  162. package/dist/lib/apiKeys/workspaceAccessWhere.js +2 -1
  163. package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts +3 -2
  164. package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.d.ts.map +1 -1
  165. package/dist/lib/assistants/assistantClientAdapter/buildGetOpenaiAssistant.js +3 -3
  166. package/dist/lib/assistants/assistantClientAdapter/index.d.ts.map +1 -1
  167. package/dist/lib/assistants/assistantClientAdapter/index.js +7 -2
  168. package/dist/lib/computerCalls/handleComputerCall/index.d.ts +3 -2
  169. package/dist/lib/computerCalls/handleComputerCall/index.d.ts.map +1 -1
  170. package/dist/lib/computerCalls/handleComputerCall/index.js +5 -1
  171. package/dist/lib/functions/createFunction.d.ts +2 -1
  172. package/dist/lib/functions/createFunction.d.ts.map +1 -1
  173. package/dist/lib/functions/createFunction.js +2 -2
  174. package/dist/lib/functions/handleFunction/handleAssistant.d.ts +3 -2
  175. package/dist/lib/functions/handleFunction/handleAssistant.d.ts.map +1 -1
  176. package/dist/lib/functions/handleFunction/handleAssistant.js +12 -2
  177. package/dist/lib/functions/handleFunction/handleClientTool.d.ts +3 -2
  178. package/dist/lib/functions/handleFunction/handleClientTool.d.ts.map +1 -1
  179. package/dist/lib/functions/handleFunction/handleClientTool.js +2 -1
  180. package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts +3 -2
  181. package/dist/lib/functions/handleFunction/handleFirecrawl.d.ts.map +1 -1
  182. package/dist/lib/functions/handleFunction/handleFirecrawl.js +7 -1
  183. package/dist/lib/functions/handleFunction/handleReplicate.d.ts +3 -2
  184. package/dist/lib/functions/handleFunction/handleReplicate.d.ts.map +1 -1
  185. package/dist/lib/functions/handleFunction/handleReplicate.js +4 -1
  186. package/dist/lib/functions/handleFunction/handleRequest.d.ts +3 -2
  187. package/dist/lib/functions/handleFunction/handleRequest.d.ts.map +1 -1
  188. package/dist/lib/functions/handleFunction/handleRequest.js +6 -1
  189. package/dist/lib/functions/handleFunction/index.d.ts +3 -2
  190. package/dist/lib/functions/handleFunction/index.d.ts.map +1 -1
  191. package/dist/lib/functions/handleFunction/index.js +25 -1
  192. package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts +3 -2
  193. package/dist/lib/functions/handleFunction/tasks/handleCreateTask.d.ts.map +1 -1
  194. package/dist/lib/functions/handleFunction/tasks/handleCreateTask.js +4 -4
  195. package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts +3 -2
  196. package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.d.ts.map +1 -1
  197. package/dist/lib/functions/handleFunction/tasks/handleDeleteTask.js +3 -3
  198. package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts +3 -2
  199. package/dist/lib/functions/handleFunction/tasks/handleListTasks.d.ts.map +1 -1
  200. package/dist/lib/functions/handleFunction/tasks/handleListTasks.js +3 -3
  201. package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts +3 -2
  202. package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.d.ts.map +1 -1
  203. package/dist/lib/functions/handleFunction/tasks/handleUpdateTask.js +4 -4
  204. package/dist/lib/functions/updateFunction.d.ts +2 -1
  205. package/dist/lib/functions/updateFunction.d.ts.map +1 -1
  206. package/dist/lib/functions/updateFunction.js +2 -2
  207. package/dist/lib/handlers/handlerPrismaInput.d.ts +3 -1
  208. package/dist/lib/handlers/handlerPrismaInput.d.ts.map +1 -1
  209. package/dist/lib/handlers/handlerPrismaInput.jsx +1 -2
  210. package/dist/lib/initialMessages/updateInitialMessages.d.ts +3 -2
  211. package/dist/lib/initialMessages/updateInitialMessages.d.ts.map +1 -1
  212. package/dist/lib/initialMessages/updateInitialMessages.js +1 -2
  213. package/dist/lib/logs/createLog.d.ts +3 -2
  214. package/dist/lib/logs/createLog.d.ts.map +1 -1
  215. package/dist/lib/logs/createLog.js +1 -2
  216. package/dist/lib/mcpServers/connectMcpServer.d.ts +5 -3
  217. package/dist/lib/mcpServers/connectMcpServer.d.ts.map +1 -1
  218. package/dist/lib/mcpServers/connectMcpServer.js +7 -5
  219. package/dist/lib/mcpServers/getToolCallMcpServer.d.ts +3 -2
  220. package/dist/lib/mcpServers/getToolCallMcpServer.d.ts.map +1 -1
  221. package/dist/lib/mcpServers/getToolCallMcpServer.js +2 -1
  222. package/dist/lib/mcpServers/headers.d.ts +3 -2
  223. package/dist/lib/mcpServers/headers.d.ts.map +1 -1
  224. package/dist/lib/mcpServers/headers.js +2 -1
  225. package/dist/lib/mcpServers/url.d.ts +3 -2
  226. package/dist/lib/mcpServers/url.d.ts.map +1 -1
  227. package/dist/lib/mcpServers/url.js +2 -1
  228. package/dist/lib/metadata/serializeMetadata.d.ts +3 -1
  229. package/dist/lib/metadata/serializeMetadata.d.ts.map +1 -1
  230. package/dist/lib/metadata/serializeMetadata.js +3 -2
  231. package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts +3 -2
  232. package/dist/lib/organizationApiKeys/getOrganizationApiKey.d.ts.map +1 -1
  233. package/dist/lib/organizationApiKeys/getOrganizationApiKey.js +1 -2
  234. package/dist/lib/prisma/index.d.ts +2 -0
  235. package/dist/lib/prisma/index.d.ts.map +1 -1
  236. package/dist/lib/prisma/index.js +16 -4
  237. package/dist/lib/runs/createRunOpts.d.ts +3 -2
  238. package/dist/lib/runs/createRunOpts.d.ts.map +1 -1
  239. package/dist/lib/runs/createRunOpts.js +2 -2
  240. package/dist/lib/tasks/getTaskToolKey.d.ts +3 -2
  241. package/dist/lib/tasks/getTaskToolKey.d.ts.map +1 -1
  242. package/dist/lib/tasks/getTaskToolKey.js +2 -1
  243. package/dist/lib/tasks/parseTaskToolArgs.d.ts +3 -2
  244. package/dist/lib/tasks/parseTaskToolArgs.d.ts.map +1 -1
  245. package/dist/lib/tasks/parseTaskToolArgs.js +4 -1
  246. package/dist/lib/tasks/scheduleTask.d.ts +3 -2
  247. package/dist/lib/tasks/scheduleTask.d.ts.map +1 -1
  248. package/dist/lib/tasks/scheduleTask.js +1 -2
  249. package/dist/lib/threads/createThread/index.d.ts.map +1 -1
  250. package/dist/lib/threads/createThread/index.js +1 -0
  251. package/dist/lib/threads/managedOpenaiThreadId.d.ts +3 -2
  252. package/dist/lib/threads/managedOpenaiThreadId.d.ts.map +1 -1
  253. package/dist/lib/threads/managedOpenaiThreadId.js +1 -2
  254. package/dist/lib/toolCalls/handleToolCall.d.ts +3 -2
  255. package/dist/lib/toolCalls/handleToolCall.d.ts.map +1 -1
  256. package/dist/lib/toolCalls/handleToolCall.js +5 -1
  257. package/dist/lib/tools/tools/index.d.ts +3 -2
  258. package/dist/lib/tools/tools/index.d.ts.map +1 -1
  259. package/dist/lib/tools/tools/index.js +9 -6
  260. package/package.json +1 -1
  261. package/scripts/utils/loadPrisma.ts +1 -2
  262. /package/.next/static/{s_BjB5fnRbk2L3A0fMr5L → Ggpv5PXa7pPyxP1NXVbh6}/_buildManifest.js +0 -0
  263. /package/.next/static/{s_BjB5fnRbk2L3A0fMr5L → Ggpv5PXa7pPyxP1NXVbh6}/_clientMiddlewareManifest.json +0 -0
  264. /package/.next/static/{s_BjB5fnRbk2L3A0fMr5L → Ggpv5PXa7pPyxP1NXVbh6}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[18622,(e,t,a)=>{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,a)=>{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,a)=>{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,a)=>{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,a)=>{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,a)=>{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),a=e.i(24493);let r=async({authorization:e,type:r})=>{if(!e)return null;let[,s]=e.split("Bearer ");return(0,t.validate)(s)?a.prisma.apiKey.findFirst({where:{type:r,value:s}}):null}},15672,e=>{"use strict";e.s([])},84426,e=>{"use strict";e.s(["handler",()=>q,"patchFetch",()=>H,"routeModule",()=>O,"serverHooks",()=>S,"workAsyncStorage",()=>k,"workUnitAsyncStorage",()=>M],84426);var t=e.i(5865),a=e.i(43877),r=e.i(77767),s=e.i(92562),n=e.i(66256),i=e.i(5270),o=e.i(90231),l=e.i(82677),d=e.i(51081),u=e.i(89822),p=e.i(9124),c=e.i(39147),h=e.i(40568),x=e.i(87188),R=e.i(93695);e.i(57132);var g=e.i(80739);e.s(["GET",()=>b,"OPTIONS",()=>j,"PUT",()=>I],33879);var v=e.i(49493),m=e.i(29173),w=e.i(11053),f=e.i(30611),y=e.i(24493);let E=({initialMessage:e})=>({id:e.id,role:e.role,content:e.content,orderNumber:e.orderNumber,assistantId:e.assistantId,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()});var A=e.i(13669);let N=A.z.object({initialMessages:A.z.array(A.z.object({content:A.z.string().min(1),role:A.z.nativeEnum(m.MessageRole)}))}),C=async({assistantId:e,initialMessages:t})=>(await y.prisma.$transaction(async a=>(await a.initialMessage.deleteMany({where:{assistantId:e}}),0===t.length)?[]:await a.initialMessage.createManyAndReturn({data:t.map((t,a)=>({assistantId:e,role:t.role,content:t.content,orderNumber:a}))}))).sort((e,t)=>e.orderNumber-t.orderNumber);var T=e.i(88122);let b=async(e,t)=>{let{assistantId:a}=await t.params,r=(await (0,w.headers)()).get("authorization");if(!r)return v.NextResponse.json({error:"No authorization header found"},{status:400});let s=await (0,T.getApiKey)({type:m.ApiKeyType.PRIVATE,authorization:r});if(!s)return v.NextResponse.json({error:"Invalid api key"},{status:400});let n=await y.prisma.assistant.findFirst({where:{id:a,workspaceId:s.workspaceId},include:{initialMessages:{orderBy:{orderNumber:"asc"}}}});return n?v.NextResponse.json({initialMessages:n.initialMessages.map(e=>E({initialMessage:e}))},{headers:f.cacheHeaders}):v.NextResponse.json({error:"No assistant found"},{status:400})},I=async(e,t)=>{let{assistantId:a}=await t.params,r=(await (0,w.headers)()).get("authorization");if(!r)return v.NextResponse.json({error:"No authorization header found"},{status:400});let s=await (0,T.getApiKey)({authorization:r,type:m.ApiKeyType.PRIVATE});if(!s)return v.NextResponse.json({error:"Invalid api key"},{status:400});let n=await e.json(),i=N.safeParse(n);if(!i.success)return v.NextResponse.json({error:"Invalid body"},{status:400});let{initialMessages:o}=i.data,l=await y.prisma.assistant.findFirst({where:{id:a,workspaceId:s.workspaceId}});if(!l)return v.NextResponse.json({error:"No assistant found"},{status:400});let d=await C({assistantId:l.id,initialMessages:o});return v.NextResponse.json({initialMessages:d.map(e=>E({initialMessage:e}))},{headers:f.cacheHeaders})},j=()=>v.NextResponse.json({},{headers:f.cacheHeaders});var P=e.i(33879);let O=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/assistants/[assistantId]/initial-messages/route",pathname:"/api/assistants/[assistantId]/initial-messages",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/initial-messages/route.ts",nextConfigOutput:"",userland:P}),{workAsyncStorage:k,workUnitAsyncStorage:M,serverHooks:S}=O;function H(){return(0,r.patchFetch)({workAsyncStorage:k,workUnitAsyncStorage:M})}async function q(e,t,r){var v;let m="/api/assistants/[assistantId]/initial-messages/route";m=m.replace(/\/index$/,"")||"/";let w=await O.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:f,params:y,nextConfig:E,isDraftMode:A,prerenderManifest:N,routerServerContext:C,isOnDemandRevalidate:T,revalidateOnlyGenerated:b,resolvedPathname:I}=w,j=(0,i.normalizeAppPath)(m),P=!!(N.dynamicRoutes[j]||N.routes[I]);if(P&&!A){let e=!!N.routes[I],t=N.dynamicRoutes[j];if(t&&!1===t.fallback&&!e)throw new R.NoFallbackError}let k=null;!P||O.isDev||A||(k="/index"===(k=I)?"/":k);let M=!0===O.isDev||!P,S=P&&!M,H=e.method||"GET",q=(0,n.getTracer)(),_=q.getActiveScopeSpan(),U={params:y,prerenderManifest:N,renderOpts:{experimental:{cacheComponents:!!E.experimental.cacheComponents,authInterrupts:!!E.experimental.authInterrupts},supportsDynamicResponse:M,incrementalCache:(0,s.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:null==(v=E.experimental)?void 0:v.cacheLife,isRevalidate:S,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r)=>O.onRequestError(e,t,r,C)},sharedContext:{buildId:f}},K=new o.NodeNextRequest(e),D=new o.NodeNextResponse(t),F=l.NextRequestAdapter.fromNodeNextRequest(K,(0,l.signalFromNodeResponse)(t));try{let i=async a=>O.handle(F,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=q.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route");if(s){let e=`${H} ${s}`;a.setAttributes({"next.route":s,"http.route":s,"next.span_name":e}),a.updateName(e)}else a.updateName(`${H} ${e.url}`)}),o=async n=>{var o,l;let d=async({previousCacheEntry:a})=>{try{if(!(0,s.getRequestMeta)(e,"minimalMode")&&T&&b&&!a)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=U.renderOpts.fetchMetrics;let l=U.renderOpts.pendingWaitUntil;l&&r.waitUntil&&(r.waitUntil(l),l=void 0);let d=U.renderOpts.collectedTags;if(!P)return await (0,p.sendResponse)(K,D,o,U.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[x.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,r=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await O.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isRevalidate:S,isOnDemandRevalidate:T})},C),t}},R=await O.handleResponse({req:e,nextConfig:E,cacheKey:k,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:b,responseGenerator:d,waitUntil:r.waitUntil});if(!P)return null;if((null==R||null==(o=R.value)?void 0:o.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==R||null==(l=R.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,s.getRequestMeta)(e,"minimalMode")||t.setHeader("x-nextjs-cache",T?"REVALIDATED":R.isMiss?"MISS":R.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let v=(0,c.fromNodeOutgoingHttpHeaders)(R.value.headers);return(0,s.getRequestMeta)(e,"minimalMode")&&P||v.delete(x.NEXT_CACHE_TAGS_HEADER),!R.cacheControl||t.getHeader("Cache-Control")||v.get("Cache-Control")||v.set("Cache-Control",(0,h.getCacheControlHeader)(R.cacheControl)),await (0,p.sendResponse)(K,D,new Response(R.value.body,{headers:v,status:R.value.status||200})),null};_?await o(_):await q.withPropagatedContext(e.headers,()=>q.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 R.NoFallbackError||await O.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isRevalidate:S,isOnDemandRevalidate:T})}),P)throw t;return await (0,p.sendResponse)(K,D,new Response(null,{status:500})),null}}}];
1
+ module.exports=[18622,(e,t,a)=>{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,a)=>{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,a)=>{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,a)=>{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,a)=>{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,a)=>{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",()=>a]);var t=e.i(55897);let a=async({authorization:e,type:a,prisma:r})=>{if(!e)return null;let[,s]=e.split("Bearer ");return(0,t.validate)(s)?r.apiKey.findFirst({where:{type:a,value:s}}):null}},15672,e=>{"use strict";e.s([])},84426,e=>{"use strict";e.s(["handler",()=>U,"patchFetch",()=>_,"routeModule",()=>M,"serverHooks",()=>q,"workAsyncStorage",()=>S,"workUnitAsyncStorage",()=>H],84426);var t=e.i(5865),a=e.i(43877),r=e.i(77767),s=e.i(92562),n=e.i(66256),i=e.i(5270),o=e.i(90231),l=e.i(82677),d=e.i(51081),u=e.i(89822),p=e.i(9124),c=e.i(39147),h=e.i(40568),x=e.i(87188),g=e.i(93695);e.i(57132);var R=e.i(80739);e.s(["GET",()=>I,"OPTIONS",()=>O,"PUT",()=>j,"buildGET",()=>b,"buildPUT",()=>P],33879);var v=e.i(49493),w=e.i(29173),m=e.i(11053),f=e.i(30611),y=e.i(24493);let E=({initialMessage:e})=>({id:e.id,role:e.role,content:e.content,orderNumber:e.orderNumber,assistantId:e.assistantId,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString()});var A=e.i(13669);let N=A.z.object({initialMessages:A.z.array(A.z.object({content:A.z.string().min(1),role:A.z.nativeEnum(w.MessageRole)}))}),C=async({assistantId:e,initialMessages:t,prisma:a})=>(await a.$transaction(async a=>(await a.initialMessage.deleteMany({where:{assistantId:e}}),0===t.length)?[]:await a.initialMessage.createManyAndReturn({data:t.map((t,a)=>({assistantId:e,role:t.role,content:t.content,orderNumber:a}))}))).sort((e,t)=>e.orderNumber-t.orderNumber);var T=e.i(88122);let b=({prisma:e=(0,y.getPrisma)()}={})=>async(t,a)=>{let{assistantId:r}=await a.params,s=(await (0,m.headers)()).get("authorization");if(!s)return v.NextResponse.json({error:"No authorization header found"},{status:400});let n=await (0,T.getApiKey)({type:w.ApiKeyType.PRIVATE,authorization:s,prisma:e});if(!n)return v.NextResponse.json({error:"Invalid api key"},{status:400});let i=await e.assistant.findFirst({where:{id:r,workspaceId:n.workspaceId},include:{initialMessages:{orderBy:{orderNumber:"asc"}}}});return i?v.NextResponse.json({initialMessages:i.initialMessages.map(e=>E({initialMessage:e}))},{headers:f.cacheHeaders}):v.NextResponse.json({error:"No assistant found"},{status:400})},I=b(),P=({prisma:e=(0,y.getPrisma)()}={})=>async(t,a)=>{let{assistantId:r}=await a.params,s=(await (0,m.headers)()).get("authorization");if(!s)return v.NextResponse.json({error:"No authorization header found"},{status:400});let n=await (0,T.getApiKey)({authorization:s,type:w.ApiKeyType.PRIVATE,prisma:e});if(!n)return v.NextResponse.json({error:"Invalid api key"},{status:400});let i=await t.json(),o=N.safeParse(i);if(!o.success)return v.NextResponse.json({error:"Invalid body"},{status:400});let{initialMessages:l}=o.data,d=await e.assistant.findFirst({where:{id:r,workspaceId:n.workspaceId}});if(!d)return v.NextResponse.json({error:"No assistant found"},{status:400});let u=await C({assistantId:d.id,initialMessages:l,prisma:e});return v.NextResponse.json({initialMessages:u.map(e=>E({initialMessage:e}))},{headers:f.cacheHeaders})},j=P(),O=()=>v.NextResponse.json({},{headers:f.cacheHeaders});var k=e.i(33879);let M=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/assistants/[assistantId]/initial-messages/route",pathname:"/api/assistants/[assistantId]/initial-messages",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/initial-messages/route.ts",nextConfigOutput:"",userland:k}),{workAsyncStorage:S,workUnitAsyncStorage:H,serverHooks:q}=M;function _(){return(0,r.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:H})}async function U(e,t,r){var v;let w="/api/assistants/[assistantId]/initial-messages/route";w=w.replace(/\/index$/,"")||"/";let m=await M.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!m)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:f,params:y,nextConfig:E,isDraftMode:A,prerenderManifest:N,routerServerContext:C,isOnDemandRevalidate:T,revalidateOnlyGenerated:b,resolvedPathname:I}=m,P=(0,i.normalizeAppPath)(w),j=!!(N.dynamicRoutes[P]||N.routes[I]);if(j&&!A){let e=!!N.routes[I],t=N.dynamicRoutes[P];if(t&&!1===t.fallback&&!e)throw new g.NoFallbackError}let O=null;!j||M.isDev||A||(O="/index"===(O=I)?"/":O);let k=!0===M.isDev||!j,S=j&&!k,H=e.method||"GET",q=(0,n.getTracer)(),_=q.getActiveScopeSpan(),U={params:y,prerenderManifest:N,renderOpts:{experimental:{cacheComponents:!!E.experimental.cacheComponents,authInterrupts:!!E.experimental.authInterrupts},supportsDynamicResponse:k,incrementalCache:(0,s.getRequestMeta)(e,"incrementalCache"),cacheLifeProfiles:null==(v=E.experimental)?void 0:v.cacheLife,isRevalidate:S,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r)=>M.onRequestError(e,t,r,C)},sharedContext:{buildId:f}},K=new o.NodeNextRequest(e),D=new o.NodeNextResponse(t),F=l.NextRequestAdapter.fromNodeNextRequest(K,(0,l.signalFromNodeResponse)(t));try{let i=async a=>M.handle(F,U).finally(()=>{if(!a)return;a.setAttributes({"http.status_code":t.statusCode,"next.rsc":!1});let r=q.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return void console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route");if(s){let e=`${H} ${s}`;a.setAttributes({"next.route":s,"http.route":s,"next.span_name":e}),a.updateName(e)}else a.updateName(`${H} ${e.url}`)}),o=async n=>{var o,l;let d=async({previousCacheEntry:a})=>{try{if(!(0,s.getRequestMeta)(e,"minimalMode")&&T&&b&&!a)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=U.renderOpts.fetchMetrics;let l=U.renderOpts.pendingWaitUntil;l&&r.waitUntil&&(r.waitUntil(l),l=void 0);let d=U.renderOpts.collectedTags;if(!j)return await (0,p.sendResponse)(K,D,o,U.renderOpts.pendingWaitUntil),null;{let e=await o.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(o.headers);d&&(t[x.NEXT_CACHE_TAGS_HEADER]=d),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==U.renderOpts.collectedRevalidate&&!(U.renderOpts.collectedRevalidate>=x.INFINITE_CACHE)&&U.renderOpts.collectedRevalidate,r=void 0===U.renderOpts.collectedExpire||U.renderOpts.collectedExpire>=x.INFINITE_CACHE?void 0:U.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await M.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isRevalidate:S,isOnDemandRevalidate:T})},C),t}},g=await M.handleResponse({req:e,nextConfig:E,cacheKey:O,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:b,responseGenerator:d,waitUntil:r.waitUntil});if(!j)return null;if((null==g||null==(o=g.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==g||null==(l=g.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});(0,s.getRequestMeta)(e,"minimalMode")||t.setHeader("x-nextjs-cache",T?"REVALIDATED":g.isMiss?"MISS":g.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let v=(0,c.fromNodeOutgoingHttpHeaders)(g.value.headers);return(0,s.getRequestMeta)(e,"minimalMode")&&j||v.delete(x.NEXT_CACHE_TAGS_HEADER),!g.cacheControl||t.getHeader("Cache-Control")||v.get("Cache-Control")||v.set("Cache-Control",(0,h.getCacheControlHeader)(g.cacheControl)),await (0,p.sendResponse)(K,D,new Response(g.value.body,{headers:v,status:g.value.status||200})),null};_?await o(_):await q.withPropagatedContext(e.headers,()=>q.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 g.NoFallbackError||await M.onRequestError(e,t,{routerKind:"App Router",routePath:P,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isRevalidate:S,isOnDemandRevalidate:T})}),j)throw t;return await (0,p.sendResponse)(K,D,new Response(null,{status:500})),null}}}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__315f084a._.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/app/api/assistants/[assistantId]/initial-messages/route.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/initialMessages/schema.ts","turbopack:///[project]/supercorp/superinterface/node_modules/next/dist/esm/build/templates/app-route.js","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/initialMessages/serializeApiInitialMessage.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/initialMessages/updateInitialMessages.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 } from '@prisma/client'\nimport { validate } from 'uuid'\nimport { prisma } from '@/lib/prisma'\n\nexport const getApiKey = async ({\n authorization,\n type,\n}: {\n authorization: string | null\n type: ApiKeyType\n}): Promise<ApiKey | null> => {\n if (!authorization) {\n return null\n }\n\n const [, apiKeyValue] = authorization.split('Bearer ')\n\n if (!validate(apiKeyValue)) {\n return null\n }\n\n return prisma.apiKey.findFirst({\n where: { type, value: apiKeyValue },\n })\n}\n","import { type NextRequest, NextResponse } from 'next/server'\nimport { ApiKeyType, InitialMessage } from '@prisma/client'\nimport { headers } from 'next/headers'\nimport { cacheHeaders } from '@/lib/cache/cacheHeaders'\nimport { prisma } from '@/lib/prisma'\nimport { serializeApiInitialMessage } from '@/lib/initialMessages/serializeApiInitialMessage'\nimport { initialMessagesSchema } from '@/lib/initialMessages/schema'\nimport { updateInitialMessages } from '@/lib/initialMessages/updateInitialMessages'\nimport { getApiKey } from '@/lib/apiKeys/getApiKey'\n\nexport const GET = async (\n _request: NextRequest,\n props: { params: Promise<{ assistantId: string }> },\n) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n type: ApiKeyType.PRIVATE,\n authorization,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const assistant = await prisma.assistant.findFirst({\n where: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n include: {\n initialMessages: {\n orderBy: {\n orderNumber: 'asc',\n },\n },\n },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n return NextResponse.json(\n {\n initialMessages: assistant.initialMessages.map((m) =>\n serializeApiInitialMessage({ initialMessage: m }),\n ),\n },\n { headers: cacheHeaders },\n )\n}\n\nexport const PUT = async (\n request: NextRequest,\n props: { params: Promise<{ assistantId: string }> },\n) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n authorization,\n type: ApiKeyType.PRIVATE,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const body = await request.json()\n const bodyParse = initialMessagesSchema.safeParse(body)\n\n if (!bodyParse.success) {\n return NextResponse.json({ error: 'Invalid body' }, { status: 400 })\n }\n const { initialMessages } = bodyParse.data\n\n const assistant = await prisma.assistant.findFirst({\n where: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n const messages = await updateInitialMessages({\n assistantId: assistant.id,\n initialMessages,\n })\n\n return NextResponse.json(\n {\n initialMessages: messages.map((m: InitialMessage) =>\n serializeApiInitialMessage({ initialMessage: m }),\n ),\n },\n { headers: cacheHeaders },\n )\n}\n\nexport const OPTIONS = () =>\n NextResponse.json(\n {},\n {\n headers: cacheHeaders,\n },\n )\n","import { z } from 'zod'\nimport { MessageRole } from '@prisma/client'\n\nexport const initialMessagesSchema = z.object({\n initialMessages: z.array(\n z.object({\n content: z.string().min(1),\n role: z.nativeEnum(MessageRole),\n }),\n ),\n})\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/assistants/[assistantId]/initial-messages/route\",\n pathname: \"/api/assistants/[assistantId]/initial-messages\",\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]/initial-messages/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]/initial-messages/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 type { InitialMessage } from '@prisma/client'\n\nexport const serializeApiInitialMessage = ({\n initialMessage,\n}: {\n initialMessage: InitialMessage\n}) => ({\n id: initialMessage.id,\n role: initialMessage.role,\n content: initialMessage.content,\n orderNumber: initialMessage.orderNumber,\n assistantId: initialMessage.assistantId,\n createdAt: initialMessage.createdAt.toISOString(),\n updatedAt: initialMessage.updatedAt.toISOString(),\n})\n","import { MessageRole, InitialMessage } from '@prisma/client'\nimport { prisma } from '@/lib/prisma'\n\nexport const updateInitialMessages = async ({\n assistantId,\n initialMessages,\n}: {\n assistantId: string\n initialMessages: { role: MessageRole; content: string }[]\n}) => {\n const messages: InitialMessage[] = await prisma.$transaction(async (tx) => {\n await tx.initialMessage.deleteMany({\n where: { assistantId },\n })\n\n if (initialMessages.length === 0) {\n return [] as InitialMessage[]\n }\n\n const created = await tx.initialMessage.createManyAndReturn({\n data: initialMessages.map((m, index) => ({\n assistantId,\n role: m.role,\n content: m.content,\n orderNumber: index,\n })),\n })\n\n return created\n })\n\n return messages.sort((a, b) => a.orderNumber - b.orderNumber)\n}\n"],"names":[],"mappings":"6jCAAO,IAAM,EAAe,CAC1B,8BAA+B,IAC/B,+BAAgC,kCAChC,+BAAgC,cAClC,mDCHA,IAAA,EAAA,EAAA,CAAA,CAAA,OACA,EAAA,EAAA,CAAA,CAAA,OAEO,IAAM,EAAY,MAAO,eAC9B,CAAa,MACb,CAAI,CAIL,IACC,GAAI,CAAC,EACH,OAAO,KAGT,CAJoB,EAId,EAAG,EAAY,CAAG,EAAc,KAAK,CAAC,iBAE5C,AAAK,CAAA,EAAA,CAAD,CAAC,QAAA,AAAQ,EAAC,GAIP,EAAA,MAAM,CAAC,EAJc,IAIR,CAAC,SAAS,CAAC,CAC7B,MAAO,CAAE,OAAM,MAAO,CAAY,CACpC,GALS,IAMX,wMGxBA,IAAA,EA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C7E,UACA,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":[4]}
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/initialMessages/schema.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/app/api/assistants/[assistantId]/initial-messages/route.ts","turbopack:///[project]/supercorp/superinterface/node_modules/next/dist/esm/build/templates/app-route.js","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/initialMessages/serializeApiInitialMessage.ts","turbopack:///[project]/supercorp/superinterface/packages/server/src/lib/initialMessages/updateInitialMessages.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","import { z } from 'zod'\nimport { MessageRole } from '@prisma/client'\n\nexport const initialMessagesSchema = z.object({\n initialMessages: z.array(\n z.object({\n content: z.string().min(1),\n role: z.nativeEnum(MessageRole),\n }),\n ),\n})\n","import { type NextRequest, NextResponse } from 'next/server'\nimport { ApiKeyType, InitialMessage, type PrismaClient } from '@prisma/client'\nimport { headers } from 'next/headers'\nimport { cacheHeaders } from '@/lib/cache/cacheHeaders'\nimport { getPrisma } from '@/lib/prisma'\nimport { serializeApiInitialMessage } from '@/lib/initialMessages/serializeApiInitialMessage'\nimport { initialMessagesSchema } from '@/lib/initialMessages/schema'\nimport { updateInitialMessages } from '@/lib/initialMessages/updateInitialMessages'\nimport { getApiKey } from '@/lib/apiKeys/getApiKey'\n\nexport const buildGET =\n ({ prisma = getPrisma() }: { prisma?: PrismaClient } = {}) =>\n async (\n _request: NextRequest,\n props: {\n params: Promise<{ assistantId: string }>\n },\n ) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n type: ApiKeyType.PRIVATE,\n authorization,\n prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const assistant = await prisma.assistant.findFirst({\n where: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n include: {\n initialMessages: {\n orderBy: {\n orderNumber: 'asc',\n },\n },\n },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n return NextResponse.json(\n {\n initialMessages: assistant.initialMessages.map((m) =>\n serializeApiInitialMessage({ initialMessage: m }),\n ),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const GET = buildGET()\n\nexport const buildPUT =\n ({ prisma = getPrisma() }: { prisma?: PrismaClient } = {}) =>\n async (\n request: NextRequest,\n props: {\n params: Promise<{ assistantId: string }>\n },\n ) => {\n const { assistantId } = await props.params\n\n const headersList = await headers()\n const authorization = headersList.get('authorization')\n if (!authorization) {\n return NextResponse.json(\n { error: 'No authorization header found' },\n { status: 400 },\n )\n }\n\n const privateApiKey = await getApiKey({\n authorization,\n type: ApiKeyType.PRIVATE,\n prisma,\n })\n\n if (!privateApiKey) {\n return NextResponse.json({ error: 'Invalid api key' }, { status: 400 })\n }\n\n const body = await request.json()\n const bodyParse = initialMessagesSchema.safeParse(body)\n\n if (!bodyParse.success) {\n return NextResponse.json({ error: 'Invalid body' }, { status: 400 })\n }\n const { initialMessages } = bodyParse.data\n\n const assistant = await prisma.assistant.findFirst({\n where: {\n id: assistantId,\n workspaceId: privateApiKey.workspaceId,\n },\n })\n\n if (!assistant) {\n return NextResponse.json({ error: 'No assistant found' }, { status: 400 })\n }\n\n const messages = await updateInitialMessages({\n assistantId: assistant.id,\n initialMessages,\n prisma,\n })\n\n return NextResponse.json(\n {\n initialMessages: messages.map((m: InitialMessage) =>\n serializeApiInitialMessage({ initialMessage: m }),\n ),\n },\n { headers: cacheHeaders },\n )\n }\n\nexport const PUT = buildPUT()\n\nexport const OPTIONS = () =>\n NextResponse.json(\n {},\n {\n headers: cacheHeaders,\n },\n )\n","import { AppRouteRouteModule } from \"next/dist/esm/server/route-modules/app-route/module.compiled\";\nimport { RouteKind } from \"next/dist/esm/server/route-kind\";\nimport { patchFetch as _patchFetch } from \"next/dist/esm/server/lib/patch-fetch\";\nimport { getRequestMeta } from \"next/dist/esm/server/request-meta\";\nimport { getTracer, SpanKind } from \"next/dist/esm/server/lib/trace/tracer\";\nimport { normalizeAppPath } from \"next/dist/esm/shared/lib/router/utils/app-paths\";\nimport { NodeNextRequest, NodeNextResponse } from \"next/dist/esm/server/base-http/node\";\nimport { NextRequestAdapter, signalFromNodeResponse } from \"next/dist/esm/server/web/spec-extension/adapters/next-request\";\nimport { BaseServerSpan } from \"next/dist/esm/server/lib/trace/constants\";\nimport { getRevalidateReason } from \"next/dist/esm/server/instrumentation/utils\";\nimport { sendResponse } from \"next/dist/esm/server/send-response\";\nimport { fromNodeOutgoingHttpHeaders, toNodeOutgoingHttpHeaders } from \"next/dist/esm/server/web/utils\";\nimport { getCacheControlHeader } from \"next/dist/esm/server/lib/cache-control\";\nimport { INFINITE_CACHE, NEXT_CACHE_TAGS_HEADER } from \"next/dist/esm/lib/constants\";\nimport { NoFallbackError } from \"next/dist/esm/shared/lib/no-fallback-error.external\";\nimport { CachedRouteKind } from \"next/dist/esm/server/response-cache\";\nimport * as userland from \"INNER_APP_ROUTE\";\n// We inject the nextConfigOutput here so that we can use them in the route\n// module.\nconst nextConfigOutput = \"\"\nconst routeModule = new AppRouteRouteModule({\n definition: {\n kind: RouteKind.APP_ROUTE,\n page: \"/api/assistants/[assistantId]/initial-messages/route\",\n pathname: \"/api/assistants/[assistantId]/initial-messages\",\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]/initial-messages/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]/initial-messages/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 type { InitialMessage } from '@prisma/client'\n\nexport const serializeApiInitialMessage = ({\n initialMessage,\n}: {\n initialMessage: InitialMessage\n}) => ({\n id: initialMessage.id,\n role: initialMessage.role,\n content: initialMessage.content,\n orderNumber: initialMessage.orderNumber,\n assistantId: initialMessage.assistantId,\n createdAt: initialMessage.createdAt.toISOString(),\n updatedAt: initialMessage.updatedAt.toISOString(),\n})\n","import { MessageRole, InitialMessage, type PrismaClient } from '@prisma/client'\n\nexport const updateInitialMessages = async ({\n assistantId,\n initialMessages,\n prisma,\n}: {\n assistantId: string\n initialMessages: { role: MessageRole; content: string }[]\n prisma: PrismaClient\n}) => {\n const messages: InitialMessage[] = await prisma.$transaction(async (tx) => {\n await tx.initialMessage.deleteMany({\n where: { assistantId },\n })\n\n if (initialMessages.length === 0) {\n return [] as InitialMessage[]\n }\n\n const created = await tx.initialMessage.createManyAndReturn({\n data: initialMessages.map((m, index) => ({\n assistantId,\n role: m.role,\n content: m.content,\n orderNumber: index,\n })),\n })\n\n return created\n })\n\n return messages.sort((a, b) => a.orderNumber - b.orderNumber)\n}\n"],"names":[],"mappings":"6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