@goscribe/server 1.3.4 → 1.6.0

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 (383) hide show
  1. package/.env.example +12 -0
  2. package/.vscode/settings.json +3 -0
  3. package/REFACTOR_NOTES.md +60 -0
  4. package/TESTING_PROMPT.md +225 -0
  5. package/dist/context.d.ts +14 -1
  6. package/dist/context.js +23 -2
  7. package/dist/controllers/admin.controller.d.ts +715 -0
  8. package/dist/controllers/admin.controller.js +9 -0
  9. package/dist/controllers/annotations.controller.d.ts +439 -0
  10. package/dist/controllers/annotations.controller.js +9 -0
  11. package/dist/controllers/app-router.controller.d.ts +3011 -0
  12. package/dist/controllers/app-router.controller.js +38 -0
  13. package/dist/controllers/app-router.controller.test.d.ts +1 -0
  14. package/dist/controllers/app-router.controller.test.js +36 -0
  15. package/dist/controllers/auth.controller.d.ts +323 -0
  16. package/dist/controllers/auth.controller.js +9 -0
  17. package/dist/controllers/base.controller.d.ts +4 -0
  18. package/dist/controllers/base.controller.js +5 -0
  19. package/dist/controllers/chat.controller.d.ts +341 -0
  20. package/dist/controllers/chat.controller.js +9 -0
  21. package/dist/controllers/copilot.controller.d.ts +397 -0
  22. package/dist/controllers/copilot.controller.js +9 -0
  23. package/dist/controllers/flashcards.controller.d.ts +651 -0
  24. package/dist/controllers/flashcards.controller.js +9 -0
  25. package/dist/controllers/members.controller.d.ts +339 -0
  26. package/dist/controllers/members.controller.js +9 -0
  27. package/dist/controllers/notifications.controller.d.ts +199 -0
  28. package/dist/controllers/notifications.controller.js +9 -0
  29. package/dist/controllers/payment.controller.d.ts +181 -0
  30. package/dist/controllers/payment.controller.js +9 -0
  31. package/dist/controllers/podcast.controller.d.ts +575 -0
  32. package/dist/controllers/podcast.controller.js +9 -0
  33. package/dist/controllers/router-module.controller.d.ts +5 -0
  34. package/dist/controllers/router-module.controller.js +6 -0
  35. package/dist/controllers/studyguide.controller.d.ts +73 -0
  36. package/dist/controllers/studyguide.controller.js +9 -0
  37. package/dist/controllers/worksheets.controller.d.ts +829 -0
  38. package/dist/controllers/worksheets.controller.js +9 -0
  39. package/dist/controllers/workspace.controller.d.ts +1207 -0
  40. package/dist/controllers/workspace.controller.js +9 -0
  41. package/dist/lib/activity_human_description.test.js +16 -15
  42. package/dist/lib/activity_log_service.test.js +28 -23
  43. package/dist/lib/ai/config.d.ts +20 -0
  44. package/dist/lib/ai/config.js +31 -0
  45. package/dist/lib/ai/embedding-client.d.ts +8 -0
  46. package/dist/lib/ai/embedding-client.js +30 -0
  47. package/dist/lib/ai/index.d.ts +48 -0
  48. package/dist/lib/ai/index.js +29 -0
  49. package/dist/lib/ai/inference-backend/client.d.ts +28 -0
  50. package/dist/lib/ai/inference-backend/client.js +301 -0
  51. package/dist/lib/ai/inference-backend/mocks.d.ts +12 -0
  52. package/dist/lib/ai/inference-backend/mocks.js +133 -0
  53. package/dist/lib/ai/inference-backend/types.d.ts +44 -0
  54. package/dist/lib/ai/inference-backend/types.js +1 -0
  55. package/dist/lib/ai/json-parse.d.ts +2 -0
  56. package/dist/lib/ai/json-parse.js +34 -0
  57. package/dist/lib/ai/llm-client.d.ts +7 -0
  58. package/dist/lib/ai/llm-client.js +36 -0
  59. package/dist/lib/ai/mock.d.ts +2 -0
  60. package/dist/lib/ai/mock.js +10 -0
  61. package/dist/lib/ai/types.d.ts +9 -0
  62. package/dist/lib/ai/types.js +1 -0
  63. package/dist/lib/chunking.d.ts +19 -0
  64. package/dist/lib/chunking.js +47 -0
  65. package/dist/lib/curated-kb-seed.d.ts +12 -0
  66. package/dist/lib/curated-kb-seed.js +155 -0
  67. package/dist/lib/email.js +67 -108
  68. package/dist/lib/embeddings.d.ts +2 -0
  69. package/dist/lib/embeddings.js +1 -0
  70. package/dist/lib/ensure-curated-kb-catalog.d.ts +6 -0
  71. package/dist/lib/ensure-curated-kb-catalog.js +53 -0
  72. package/dist/lib/env.d.ts +1 -5
  73. package/dist/lib/env.js +2 -7
  74. package/dist/lib/inference.d.ts +1 -8
  75. package/dist/lib/inference.js +1 -19
  76. package/dist/lib/kb-meta.d.ts +8 -0
  77. package/dist/lib/kb-meta.js +77 -0
  78. package/dist/lib/note-text.d.ts +1 -0
  79. package/dist/lib/note-text.js +47 -0
  80. package/dist/lib/notification-service.test.js +37 -36
  81. package/dist/lib/pdf.d.ts +11 -0
  82. package/dist/lib/pdf.js +11 -0
  83. package/dist/lib/usage_service.d.ts +2 -1
  84. package/dist/lib/usage_service.js +30 -12
  85. package/dist/lib/worksheet-generation.js +4 -4
  86. package/dist/lib/worksheet-generation.test.js +32 -17
  87. package/dist/lib/workspace-kb.d.ts +5 -0
  88. package/dist/lib/workspace-kb.js +7 -0
  89. package/dist/models/controller-context.model.d.ts +8 -0
  90. package/dist/models/controller-context.model.js +1 -0
  91. package/dist/repositories/artifact.repository.d.ts +60 -0
  92. package/dist/repositories/artifact.repository.js +40 -0
  93. package/dist/repositories/base.repository.d.ts +14 -0
  94. package/dist/repositories/base.repository.js +14 -0
  95. package/dist/repositories/invitation.repository.d.ts +94 -0
  96. package/dist/repositories/invitation.repository.js +44 -0
  97. package/dist/repositories/notification.repository.d.ts +72 -0
  98. package/dist/repositories/notification.repository.js +44 -0
  99. package/dist/repositories/router-module.repository.d.ts +10 -0
  100. package/dist/repositories/router-module.repository.js +14 -0
  101. package/dist/repositories/user.repository.d.ts +74 -0
  102. package/dist/repositories/user.repository.js +37 -0
  103. package/dist/repositories/workspace-member.repository.d.ts +31 -0
  104. package/dist/repositories/workspace-member.repository.js +31 -0
  105. package/dist/repositories/workspace.repository.d.ts +97 -0
  106. package/dist/repositories/workspace.repository.js +79 -0
  107. package/dist/routers/_app.d.ts +566 -111
  108. package/dist/routers/_app.js +4 -0
  109. package/dist/routers/admin.d.ts +0 -4
  110. package/dist/routers/admin.js +21 -549
  111. package/dist/routers/annotations.js +12 -170
  112. package/dist/routers/artifactVersions.d.ts +65 -0
  113. package/dist/routers/artifactVersions.js +14 -0
  114. package/dist/routers/auth.d.ts +0 -6
  115. package/dist/routers/auth.js +37 -422
  116. package/dist/routers/chat.js +15 -229
  117. package/dist/routers/copilot.d.ts +14 -13
  118. package/dist/routers/copilot.js +13 -532
  119. package/dist/routers/flashcards.d.ts +17 -6
  120. package/dist/routers/flashcards.js +23 -349
  121. package/dist/routers/knowledgeBase.d.ts +421 -0
  122. package/dist/routers/knowledgeBase.js +118 -0
  123. package/dist/routers/members.d.ts +0 -41
  124. package/dist/routers/members.js +22 -710
  125. package/dist/routers/notes.d.ts +94 -0
  126. package/dist/routers/notes.js +37 -0
  127. package/dist/routers/notifications.js +7 -109
  128. package/dist/routers/payment.d.ts +2 -12
  129. package/dist/routers/payment.js +11 -393
  130. package/dist/routers/podcast.d.ts +1 -1
  131. package/dist/routers/podcast.js +11 -784
  132. package/dist/routers/studyguide.js +3 -129
  133. package/dist/routers/worksheets.d.ts +29 -14
  134. package/dist/routers/worksheets.js +49 -628
  135. package/dist/routers/workspace.d.ts +27 -71
  136. package/dist/routers/workspace.js +29 -922
  137. package/dist/scripts/purge-deleted-users.js +2 -2
  138. package/dist/server.js +10 -3
  139. package/dist/services/activity/activity-human-description.service.d.ts +13 -0
  140. package/dist/services/activity/activity-human-description.service.js +221 -0
  141. package/dist/services/activity/activity-human-description.service.test.d.ts +1 -0
  142. package/dist/services/activity/activity-human-description.service.test.js +16 -0
  143. package/dist/services/activity/activity-log.service.d.ts +87 -0
  144. package/dist/services/activity/activity-log.service.js +276 -0
  145. package/dist/services/activity/activity-log.service.test.d.ts +1 -0
  146. package/dist/services/activity/activity-log.service.test.js +27 -0
  147. package/dist/services/activity-human-description.service.d.ts +13 -0
  148. package/dist/services/activity-human-description.service.js +221 -0
  149. package/dist/services/activity-human-description.service.test.d.ts +1 -0
  150. package/dist/services/activity-human-description.service.test.js +16 -0
  151. package/dist/services/activity-log.service.d.ts +87 -0
  152. package/dist/services/activity-log.service.js +276 -0
  153. package/dist/services/activity-log.service.test.d.ts +1 -0
  154. package/dist/services/activity-log.service.test.js +27 -0
  155. package/dist/services/admin/admin.service.d.ts +270 -0
  156. package/dist/services/admin/admin.service.js +476 -0
  157. package/dist/services/admin.service.d.ts +270 -0
  158. package/dist/services/admin.service.js +476 -0
  159. package/dist/services/ai/ai-session.service.d.ts +5 -0
  160. package/dist/services/ai/ai-session.service.js +4 -0
  161. package/dist/services/ai-session.service.d.ts +60 -0
  162. package/dist/services/ai-session.service.js +561 -0
  163. package/dist/services/annotation.service.d.ts +177 -0
  164. package/dist/services/annotation.service.js +154 -0
  165. package/dist/services/artifact-notification.service.d.ts +14 -0
  166. package/dist/services/artifact-notification.service.js +20 -0
  167. package/dist/services/artifact-version.service.d.ts +38 -0
  168. package/dist/services/artifact-version.service.js +129 -0
  169. package/dist/services/artifacts/annotation.service.d.ts +177 -0
  170. package/dist/services/artifacts/annotation.service.js +154 -0
  171. package/dist/services/artifacts/artifact-version.service.d.ts +38 -0
  172. package/dist/services/artifacts/artifact-version.service.js +129 -0
  173. package/dist/services/artifacts/chat.service.d.ts +127 -0
  174. package/dist/services/artifacts/chat.service.js +182 -0
  175. package/dist/services/artifacts/study-guide.service.d.ts +18 -0
  176. package/dist/services/artifacts/study-guide.service.js +65 -0
  177. package/dist/services/auth/auth.service.d.ts +94 -0
  178. package/dist/services/auth/auth.service.js +368 -0
  179. package/dist/services/auth.service.d.ts +94 -0
  180. package/dist/services/auth.service.js +368 -0
  181. package/dist/services/base.service.d.ts +14 -0
  182. package/dist/services/base.service.js +14 -0
  183. package/dist/services/billing/payment.service.d.ts +44 -0
  184. package/dist/services/billing/payment.service.js +365 -0
  185. package/dist/services/billing/subscription.service.d.ts +37 -0
  186. package/dist/services/billing/subscription.service.js +654 -0
  187. package/dist/services/billing/usage.service.d.ts +47 -0
  188. package/dist/services/billing/usage.service.js +149 -0
  189. package/dist/services/chat.service.d.ts +127 -0
  190. package/dist/services/chat.service.js +182 -0
  191. package/dist/services/content/copilot.service.d.ts +113 -0
  192. package/dist/services/content/copilot.service.js +439 -0
  193. package/dist/services/content/flashcard-progress.service.d.ts +159 -0
  194. package/dist/services/content/flashcard-progress.service.js +432 -0
  195. package/dist/services/content/flashcard.service.d.ts +184 -0
  196. package/dist/services/content/flashcard.service.js +339 -0
  197. package/dist/services/content/media-analysis.service.d.ts +23 -0
  198. package/dist/services/content/media-analysis.service.js +404 -0
  199. package/dist/services/content/podcast.service.d.ts +267 -0
  200. package/dist/services/content/podcast.service.js +653 -0
  201. package/dist/services/content/worksheet-content.service.d.ts +37 -0
  202. package/dist/services/content/worksheet-content.service.js +84 -0
  203. package/dist/services/content/worksheet-content.service.test.d.ts +1 -0
  204. package/dist/services/content/worksheet-content.service.test.js +69 -0
  205. package/dist/services/content/worksheet-generation.service.d.ts +91 -0
  206. package/dist/services/content/worksheet-generation.service.js +95 -0
  207. package/dist/services/content/worksheet-generation.service.test.d.ts +1 -0
  208. package/dist/services/content/worksheet-generation.service.test.js +20 -0
  209. package/dist/services/content/worksheet.service.d.ts +347 -0
  210. package/dist/services/content/worksheet.service.js +599 -0
  211. package/dist/services/copilot.service.d.ts +116 -0
  212. package/dist/services/copilot.service.js +447 -0
  213. package/dist/services/flashcard-progress.service.d.ts +2 -2
  214. package/dist/services/flashcard-progress.service.js +3 -2
  215. package/dist/services/flashcard.service.d.ts +140 -0
  216. package/dist/services/flashcard.service.js +325 -0
  217. package/dist/services/invitation.service.d.ts +66 -0
  218. package/dist/services/invitation.service.js +348 -0
  219. package/dist/services/knowledge/knowledge-base.service.d.ts +316 -0
  220. package/dist/services/knowledge/knowledge-base.service.js +544 -0
  221. package/dist/services/knowledge-base.service.d.ts +316 -0
  222. package/dist/services/knowledge-base.service.js +536 -0
  223. package/dist/services/media-analysis.service.d.ts +23 -0
  224. package/dist/services/media-analysis.service.js +384 -0
  225. package/dist/services/member.service.d.ts +36 -0
  226. package/dist/services/member.service.js +193 -0
  227. package/dist/services/members/invitation.service.d.ts +66 -0
  228. package/dist/services/members/invitation.service.js +348 -0
  229. package/dist/services/members/member.service.d.ts +36 -0
  230. package/dist/services/members/member.service.js +193 -0
  231. package/dist/services/note.service.d.ts +55 -0
  232. package/dist/services/note.service.js +111 -0
  233. package/dist/services/notification.service.d.ts +214 -0
  234. package/dist/services/notification.service.js +550 -0
  235. package/dist/services/notification.service.test.d.ts +1 -0
  236. package/dist/services/notification.service.test.js +87 -0
  237. package/dist/services/notifications/notification.service.d.ts +214 -0
  238. package/dist/services/notifications/notification.service.js +550 -0
  239. package/dist/services/notifications/notification.service.test.d.ts +1 -0
  240. package/dist/services/notifications/notification.service.test.js +87 -0
  241. package/dist/services/payment.service.d.ts +55 -0
  242. package/dist/services/payment.service.js +368 -0
  243. package/dist/services/podcast.service.d.ts +267 -0
  244. package/dist/services/podcast.service.js +654 -0
  245. package/dist/services/router-module.service.d.ts +7 -0
  246. package/dist/services/router-module.service.js +10 -0
  247. package/dist/services/study-guide.service.d.ts +18 -0
  248. package/dist/services/study-guide.service.js +65 -0
  249. package/dist/services/subscription.service.d.ts +37 -0
  250. package/dist/services/subscription.service.js +654 -0
  251. package/dist/services/usage-limit-policy.service.d.ts +12 -0
  252. package/dist/services/usage-limit-policy.service.js +22 -0
  253. package/dist/services/usage-limit-policy.service.test.d.ts +1 -0
  254. package/dist/services/usage-limit-policy.service.test.js +46 -0
  255. package/dist/services/usage.service.d.ts +27 -0
  256. package/dist/services/usage.service.js +77 -0
  257. package/dist/services/worksheet-content.service.d.ts +42 -0
  258. package/dist/services/worksheet-content.service.js +84 -0
  259. package/dist/services/worksheet-content.service.test.d.ts +1 -0
  260. package/dist/services/worksheet-content.service.test.js +69 -0
  261. package/dist/services/worksheet-generation.service.d.ts +91 -0
  262. package/dist/services/worksheet-generation.service.js +95 -0
  263. package/dist/services/worksheet-generation.service.test.d.ts +1 -0
  264. package/dist/services/worksheet-generation.service.test.js +20 -0
  265. package/dist/services/worksheet.service.d.ts +385 -0
  266. package/dist/services/worksheet.service.js +596 -0
  267. package/dist/services/workspace/workspace-analytics.service.d.ts +24 -0
  268. package/dist/services/workspace/workspace-analytics.service.js +95 -0
  269. package/dist/services/workspace/workspace-kb.service.d.ts +40 -0
  270. package/dist/services/workspace/workspace-kb.service.js +184 -0
  271. package/dist/services/workspace/workspace.service.d.ts +263 -0
  272. package/dist/services/workspace/workspace.service.js +401 -0
  273. package/dist/services/workspace-analytics.service.d.ts +24 -0
  274. package/dist/services/workspace-analytics.service.js +95 -0
  275. package/dist/services/workspace-kb.service.d.ts +40 -0
  276. package/dist/services/workspace-kb.service.js +184 -0
  277. package/dist/services/workspace-progress.service.d.ts +27 -0
  278. package/dist/services/workspace-progress.service.js +56 -0
  279. package/dist/services/workspace-progress.service.test.d.ts +1 -0
  280. package/dist/services/workspace-progress.service.test.js +49 -0
  281. package/dist/services/workspace.service.d.ts +307 -0
  282. package/dist/services/workspace.service.js +390 -0
  283. package/dist/trpc.d.ts +12 -4
  284. package/dist/trpc.js +7 -13
  285. package/package.json +5 -6
  286. package/prisma/migrations/20260509000001_add_knowledge_base/migration.sql +99 -0
  287. package/prisma/migrations/20260509000002_curate_knowledge_base/migration.sql +52 -0
  288. package/prisma/migrations/20260522000000_add_notes/migration.sql +27 -0
  289. package/prisma/migrations/20260524000000_remove_notes/migration.sql +3 -0
  290. package/prisma/schema.prisma +150 -48
  291. package/prisma/seed.mjs +67 -0
  292. package/scripts/debug/README.md +4 -0
  293. package/src/README.md +63 -0
  294. package/src/context.ts +33 -3
  295. package/src/lib/ai/config.ts +34 -0
  296. package/src/lib/ai/embedding-client.ts +47 -0
  297. package/src/lib/ai/index.ts +65 -0
  298. package/src/lib/ai/inference-backend/client.ts +479 -0
  299. package/src/lib/ai/inference-backend/mocks.ts +171 -0
  300. package/src/lib/ai/inference-backend/types.ts +50 -0
  301. package/src/lib/ai/json-parse.ts +35 -0
  302. package/src/lib/ai/llm-client.ts +54 -0
  303. package/src/lib/ai/mock.ts +12 -0
  304. package/src/lib/ai/types.ts +11 -0
  305. package/src/lib/chunking.ts +81 -0
  306. package/src/lib/curated-kb-seed.ts +164 -0
  307. package/src/lib/email.ts +77 -115
  308. package/src/lib/embeddings.ts +9 -0
  309. package/src/lib/ensure-curated-kb-catalog.ts +60 -0
  310. package/src/lib/env.ts +2 -7
  311. package/src/lib/inference.ts +1 -21
  312. package/src/lib/kb-meta.ts +81 -0
  313. package/src/lib/pdf.ts +23 -0
  314. package/src/lib/workspace-kb.ts +7 -0
  315. package/src/repositories/artifact.repository.ts +55 -0
  316. package/src/repositories/base.repository.ts +19 -0
  317. package/src/repositories/invitation.repository.ts +53 -0
  318. package/src/repositories/notification.repository.ts +53 -0
  319. package/src/repositories/user.repository.ts +44 -0
  320. package/src/repositories/workspace-member.repository.ts +38 -0
  321. package/src/repositories/workspace.repository.ts +89 -0
  322. package/src/routers/_app.ts +4 -0
  323. package/src/routers/admin.ts +124 -692
  324. package/src/routers/annotations.ts +25 -203
  325. package/src/routers/artifactVersions.ts +32 -0
  326. package/src/routers/auth.ts +82 -520
  327. package/src/routers/chat.ts +42 -245
  328. package/src/routers/copilot.ts +41 -666
  329. package/src/routers/flashcards.ts +108 -404
  330. package/src/routers/knowledgeBase.ts +216 -0
  331. package/src/routers/members.ts +60 -782
  332. package/src/routers/notifications.ts +15 -117
  333. package/src/routers/payment.ts +37 -446
  334. package/src/routers/podcast.ts +36 -898
  335. package/src/routers/studyguide.ts +5 -144
  336. package/src/routers/worksheets.ts +171 -735
  337. package/src/routers/workspace.ts +141 -1108
  338. package/src/scripts/purge-deleted-users.ts +2 -2
  339. package/src/server.ts +10 -3
  340. package/src/{lib/activity_human_description.test.ts → services/activity/activity-human-description.service.test.ts} +1 -1
  341. package/src/{lib/activity_log_service.test.ts → services/activity/activity-log.service.test.ts} +1 -1
  342. package/src/{lib/activity_log_service.ts → services/activity/activity-log.service.ts} +2 -2
  343. package/src/services/admin/admin.service.ts +612 -0
  344. package/src/services/ai/ai-session.service.ts +5 -0
  345. package/src/services/artifacts/annotation.service.ts +189 -0
  346. package/src/services/artifacts/artifact-version.service.ts +151 -0
  347. package/src/services/artifacts/chat.service.ts +197 -0
  348. package/src/services/artifacts/study-guide.service.ts +72 -0
  349. package/src/services/auth/auth.service.ts +473 -0
  350. package/src/services/base.service.ts +19 -0
  351. package/src/services/billing/payment.service.ts +433 -0
  352. package/src/{lib/subscription_service.ts → services/billing/subscription.service.ts} +5 -5
  353. package/src/services/billing/usage.service.ts +207 -0
  354. package/src/services/content/copilot.service.ts +587 -0
  355. package/src/services/{flashcard-progress.service.ts → content/flashcard-progress.service.ts} +18 -12
  356. package/src/services/content/flashcard.service.ts +417 -0
  357. package/src/services/content/media-analysis.service.ts +561 -0
  358. package/src/services/content/podcast.service.ts +777 -0
  359. package/src/services/content/worksheet-content.service.test.ts +83 -0
  360. package/src/services/content/worksheet-content.service.ts +117 -0
  361. package/src/{lib/worksheet-generation.test.ts → services/content/worksheet-generation.service.test.ts} +3 -3
  362. package/src/services/content/worksheet.service.ts +751 -0
  363. package/src/services/knowledge/knowledge-base.service.ts +705 -0
  364. package/src/services/members/invitation.service.ts +427 -0
  365. package/src/services/members/member.service.ts +241 -0
  366. package/src/{lib/notification-service.test.ts → services/notifications/notification.service.test.ts} +2 -2
  367. package/src/{lib/notification-service.ts → services/notifications/notification.service.ts} +102 -1
  368. package/src/services/workspace/workspace-analytics.service.ts +107 -0
  369. package/src/services/workspace/workspace-kb.service.ts +273 -0
  370. package/src/services/workspace/workspace.service.ts +488 -0
  371. package/src/trpc.ts +7 -15
  372. package/src/lib/ai-session.ts +0 -704
  373. package/src/lib/usage_service.ts +0 -74
  374. package/src/lib/workspace-access.ts +0 -13
  375. /package/{check-difficulty.cjs → scripts/debug/check-difficulty.cjs} +0 -0
  376. /package/{check-questions.cjs → scripts/debug/check-questions.cjs} +0 -0
  377. /package/{db-summary.cjs → scripts/debug/db-summary.cjs} +0 -0
  378. /package/{mcq-test.cjs → scripts/debug/mcq-test.cjs} +0 -0
  379. /package/{test-generate.js → scripts/debug/test-generate.js} +0 -0
  380. /package/{test-ratio.cjs → scripts/debug/test-ratio.cjs} +0 -0
  381. /package/{zod-test.cjs → scripts/debug/zod-test.cjs} +0 -0
  382. /package/src/{lib/activity_human_description.ts → services/activity/activity-human-description.service.ts} +0 -0
  383. /package/src/{lib/worksheet-generation.ts → services/content/worksheet-generation.service.ts} +0 -0
@@ -231,35 +231,26 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
231
231
  folders: {
232
232
  name: string;
233
233
  id: string;
234
- createdAt: Date;
235
234
  updatedAt: Date;
236
- ownerId: string;
237
235
  parentId: string | null;
238
236
  color: string;
239
237
  markerColor: string | null;
240
238
  }[];
241
- workspaces: ({
242
- uploads: {
243
- name: string;
244
- id: string;
245
- createdAt: Date;
246
- mimeType: string;
247
- }[];
248
- } & {
239
+ workspaces: {
249
240
  id: string;
250
- createdAt: Date;
251
241
  updatedAt: Date;
252
242
  title: string;
253
- description: string | null;
254
- ownerId: string;
255
243
  color: string;
256
244
  markerColor: string | null;
257
245
  icon: string;
258
246
  folderId: string | null;
259
- fileBeingAnalyzed: boolean;
260
- analysisProgress: import("@prisma/client/runtime/library").JsonValue | null;
261
- needsAnalysis: boolean;
262
- })[];
247
+ uploads: {
248
+ name: string;
249
+ id: string;
250
+ createdAt: Date;
251
+ mimeType: string;
252
+ }[];
253
+ }[];
263
254
  };
264
255
  meta: object;
265
256
  }>;
@@ -344,74 +335,43 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
344
335
  id: string;
345
336
  };
346
337
  output: {
338
+ id: string;
339
+ createdAt: Date;
340
+ updatedAt: Date;
341
+ title: string;
342
+ description: string | null;
347
343
  folder: {
348
344
  name: string;
349
345
  id: string;
350
- createdAt: Date;
351
- updatedAt: Date;
352
- ownerId: string;
353
- parentId: string | null;
354
346
  color: string;
355
- markerColor: string | null;
356
347
  } | null;
357
- artifacts: {
358
- id: string;
359
- createdAt: Date;
360
- updatedAt: Date;
361
- workspaceId: string;
362
- type: import("@prisma/client").$Enums.ArtifactType;
363
- title: string;
364
- isArchived: boolean;
365
- difficulty: import("@prisma/client").$Enums.Difficulty | null;
366
- estimatedTime: string | null;
367
- createdById: string | null;
368
- description: string | null;
369
- generating: boolean;
370
- generatingMetadata: import("@prisma/client/runtime/library").JsonValue | null;
371
- worksheetConfig: import("@prisma/client/runtime/library").JsonValue | null;
372
- imageObjectKey: string | null;
373
- }[];
348
+ ownerId: string;
349
+ color: string;
350
+ markerColor: string | null;
351
+ icon: string;
352
+ folderId: string | null;
353
+ fileBeingAnalyzed: boolean;
354
+ analysisProgress: import("@prisma/client/runtime/library").JsonValue;
355
+ needsAnalysis: boolean;
374
356
  uploads: {
375
- meta: import("@prisma/client/runtime/library").JsonValue | null;
376
357
  name: string;
377
358
  id: string;
378
359
  createdAt: Date;
379
- workspaceId: string | null;
380
- userId: string | null;
381
360
  mimeType: string;
382
361
  size: number;
383
- bucket: string | null;
384
362
  objectKey: string | null;
385
- url: string | null;
386
- checksum: string | null;
387
- aiTranscription: import("@prisma/client/runtime/library").JsonValue | null;
388
363
  }[];
389
- } & {
390
- id: string;
391
- createdAt: Date;
392
- updatedAt: Date;
393
- title: string;
394
- description: string | null;
395
- ownerId: string;
396
- color: string;
397
- markerColor: string | null;
398
- icon: string;
399
- folderId: string | null;
400
- fileBeingAnalyzed: boolean;
401
- analysisProgress: import("@prisma/client/runtime/library").JsonValue | null;
402
- needsAnalysis: boolean;
403
364
  };
404
365
  meta: object;
405
366
  }>;
406
367
  getStats: import("@trpc/server").TRPCQueryProcedure<{
407
368
  input: void;
408
- output: {
409
- workspaces: number;
410
- folders: number;
411
- lastUpdated: Date | undefined;
412
- spaceUsed: number;
413
- spaceTotal: number;
414
- };
369
+ output: import("../services/billing/usage.service.js").AccountStats;
370
+ meta: object;
371
+ }>;
372
+ getAccountSummary: import("@trpc/server").TRPCQueryProcedure<{
373
+ input: void;
374
+ output: import("../services/billing/usage.service.js").AccountSummary;
415
375
  meta: object;
416
376
  }>;
417
377
  getStudyAnalytics: import("@trpc/server").TRPCQueryProcedure<{
@@ -854,10 +814,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
854
814
  id: string;
855
815
  createdAt: Date;
856
816
  artifactId: string;
817
+ tags: string[];
857
818
  order: number;
858
819
  front: string;
859
820
  back: string;
860
- tags: string[];
861
821
  acceptedAnswers: string[];
862
822
  })[];
863
823
  meta: object;
@@ -866,7 +826,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
866
826
  input: {
867
827
  workspaceId: string;
868
828
  };
869
- output: boolean | undefined;
829
+ output: boolean;
870
830
  meta: object;
871
831
  }>;
872
832
  createCard: import("@trpc/server").TRPCMutationProcedure<{
@@ -882,10 +842,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
882
842
  id: string;
883
843
  createdAt: Date;
884
844
  artifactId: string;
845
+ tags: string[];
885
846
  order: number;
886
847
  front: string;
887
848
  back: string;
888
- tags: string[];
889
849
  acceptedAnswers: string[];
890
850
  };
891
851
  meta: object;
@@ -903,10 +863,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
903
863
  id: string;
904
864
  createdAt: Date;
905
865
  artifactId: string;
866
+ tags: string[];
906
867
  order: number;
907
868
  front: string;
908
869
  back: string;
909
- tags: string[];
910
870
  acceptedAnswers: string[];
911
871
  };
912
872
  meta: object;
@@ -949,6 +909,17 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
949
909
  };
950
910
  output: {
951
911
  artifact: {
912
+ flashcards: {
913
+ id: string;
914
+ createdAt: Date;
915
+ artifactId: string;
916
+ tags: string[];
917
+ order: number;
918
+ front: string;
919
+ back: string;
920
+ acceptedAnswers: string[];
921
+ }[];
922
+ } & {
952
923
  id: string;
953
924
  createdAt: Date;
954
925
  updatedAt: Date;
@@ -1033,10 +1004,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1033
1004
  id: string;
1034
1005
  createdAt: Date;
1035
1006
  artifactId: string;
1007
+ tags: string[];
1036
1008
  order: number;
1037
1009
  front: string;
1038
1010
  back: string;
1039
- tags: string[];
1040
1011
  acceptedAnswers: string[];
1041
1012
  }) | {
1042
1013
  artifact: {
@@ -1059,10 +1030,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1059
1030
  id: string;
1060
1031
  createdAt: Date;
1061
1032
  artifactId: string;
1033
+ tags: string[];
1062
1034
  order: number;
1063
1035
  front: string;
1064
1036
  back: string;
1065
- tags: string[];
1066
1037
  acceptedAnswers: string[];
1067
1038
  })[];
1068
1039
  meta: object;
@@ -1161,7 +1132,33 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1161
1132
  generatingMetadata: import("@prisma/client/runtime/library").JsonValue | null;
1162
1133
  worksheetConfig: import("@prisma/client/runtime/library").JsonValue | null;
1163
1134
  imageObjectKey: string | null;
1164
- })[];
1135
+ })[] | {
1136
+ questions: import("../services/content/worksheet-content.service.js").WorksheetQuestionWithProgress[];
1137
+ versions: {
1138
+ id: string;
1139
+ createdAt: Date;
1140
+ createdById: string | null;
1141
+ artifactId: string;
1142
+ content: string;
1143
+ data: import("@prisma/client/runtime/library").JsonValue | null;
1144
+ version: number;
1145
+ }[];
1146
+ id: string;
1147
+ createdAt: Date;
1148
+ updatedAt: Date;
1149
+ workspaceId: string;
1150
+ type: import("@prisma/client").$Enums.ArtifactType;
1151
+ title: string;
1152
+ isArchived: boolean;
1153
+ difficulty: import("@prisma/client").$Enums.Difficulty | null;
1154
+ estimatedTime: string | null;
1155
+ createdById: string | null;
1156
+ description: string | null;
1157
+ generating: boolean;
1158
+ generatingMetadata: import("@prisma/client/runtime/library").JsonValue | null;
1159
+ worksheetConfig: import("@prisma/client/runtime/library").JsonValue | null;
1160
+ imageObjectKey: string | null;
1161
+ }[];
1165
1162
  meta: object;
1166
1163
  }>;
1167
1164
  listPresets: import("@trpc/server").TRPCQueryProcedure<{
@@ -1273,18 +1270,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1273
1270
  worksheetId: string;
1274
1271
  };
1275
1272
  output: {
1276
- questions: {
1277
- meta: import("@prisma/client/runtime/library").JsonValue | null;
1278
- id: string;
1279
- createdAt: Date;
1280
- type: import("@prisma/client").$Enums.QuestionType;
1281
- difficulty: import("@prisma/client").$Enums.Difficulty;
1282
- artifactId: string;
1283
- prompt: string;
1284
- answer: string | null;
1285
- order: number;
1286
- }[];
1287
- } & {
1273
+ questions: import("../services/content/worksheet-content.service.js").WorksheetQuestionWithProgress[];
1288
1274
  id: string;
1289
1275
  createdAt: Date;
1290
1276
  updatedAt: Date;
@@ -1499,7 +1485,7 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1499
1485
  };
1500
1486
  output: {
1501
1487
  isCorrect: boolean;
1502
- userMarkScheme: import("../types/index.js").UserMarkScheme | null;
1488
+ userMarkScheme: any;
1503
1489
  progress: {
1504
1490
  meta: import("@prisma/client/runtime/library").JsonValue | null;
1505
1491
  id: string;
@@ -1739,8 +1725,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
1739
1725
  duration: number;
1740
1726
  order: number;
1741
1727
  startTime: number;
1742
- keyPoints: string[];
1743
1728
  audioUrl: string | null;
1729
+ keyPoints: string[];
1744
1730
  };
1745
1731
  meta: object;
1746
1732
  }>;
@@ -2649,18 +2635,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2649
2635
  getUsageOverview: import("@trpc/server").TRPCQueryProcedure<{
2650
2636
  input: void;
2651
2637
  output: {
2652
- usage: import("../lib/usage_service.js").UserUsage;
2653
- limits: {
2654
- id: string;
2655
- planId: string;
2656
- maxStorageBytes: bigint;
2657
- maxWorksheets: number;
2658
- maxFlashcards: number;
2659
- maxPodcasts: number;
2660
- maxStudyGuides: number;
2661
- createdAt: Date;
2662
- updatedAt: Date;
2663
- } | null;
2638
+ usage: import("../services/billing/usage.service.js").UserUsage;
2639
+ limits: import("../services/billing/usage.service.js").UserPlanLimits;
2664
2640
  hasActivePlan: boolean;
2665
2641
  };
2666
2642
  meta: object;
@@ -2748,8 +2724,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2748
2724
  context: {
2749
2725
  workspaceId: string;
2750
2726
  artifactId: string;
2751
- artifactType: "flashcards" | "worksheet" | "study-guide" | "notes";
2727
+ artifactType: "flashcards" | "worksheet" | "study-guide";
2752
2728
  documentContent: string;
2729
+ documentPlainText?: string | undefined;
2753
2730
  selectedText?: string | undefined;
2754
2731
  viewportText?: string | undefined;
2755
2732
  cursorPosition?: {
@@ -2768,9 +2745,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2768
2745
  output: {
2769
2746
  answer: string;
2770
2747
  highlights: {
2771
- start: number;
2772
- end: number;
2773
- label?: string | undefined;
2748
+ text: string;
2749
+ label?: string;
2774
2750
  }[];
2775
2751
  };
2776
2752
  meta: object;
@@ -2780,8 +2756,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2780
2756
  context: {
2781
2757
  workspaceId: string;
2782
2758
  artifactId: string;
2783
- artifactType: "flashcards" | "worksheet" | "study-guide" | "notes";
2759
+ artifactType: "flashcards" | "worksheet" | "study-guide";
2784
2760
  documentContent: string;
2761
+ documentPlainText?: string | undefined;
2785
2762
  selectedText?: string | undefined;
2786
2763
  viewportText?: string | undefined;
2787
2764
  cursorPosition?: {
@@ -2807,8 +2784,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2807
2784
  context: {
2808
2785
  workspaceId: string;
2809
2786
  artifactId: string;
2810
- artifactType: "flashcards" | "worksheet" | "study-guide" | "notes";
2787
+ artifactType: "flashcards" | "worksheet" | "study-guide";
2811
2788
  documentContent: string;
2789
+ documentPlainText?: string | undefined;
2812
2790
  selectedText?: string | undefined;
2813
2791
  viewportText?: string | undefined;
2814
2792
  cursorPosition?: {
@@ -2827,9 +2805,8 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2827
2805
  output: {
2828
2806
  answer: string;
2829
2807
  highlights: {
2830
- start: number;
2831
- end: number;
2832
- label?: string | undefined;
2808
+ text: string;
2809
+ label?: string;
2833
2810
  }[];
2834
2811
  };
2835
2812
  meta: object;
@@ -2839,8 +2816,9 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2839
2816
  context: {
2840
2817
  workspaceId: string;
2841
2818
  artifactId: string;
2842
- artifactType: "flashcards" | "worksheet" | "study-guide" | "notes";
2819
+ artifactType: "flashcards" | "worksheet" | "study-guide";
2843
2820
  documentContent: string;
2821
+ documentPlainText?: string | undefined;
2844
2822
  selectedText?: string | undefined;
2845
2823
  viewportText?: string | undefined;
2846
2824
  cursorPosition?: {
@@ -2864,10 +2842,10 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2864
2842
  id: string;
2865
2843
  createdAt: Date;
2866
2844
  artifactId: string;
2845
+ tags: string[];
2867
2846
  order: number;
2868
2847
  front: string;
2869
2848
  back: string;
2870
- tags: string[];
2871
2849
  acceptedAnswers: string[];
2872
2850
  }[];
2873
2851
  };
@@ -2973,6 +2951,483 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
2973
2951
  meta: object;
2974
2952
  }>;
2975
2953
  }>>;
2954
+ knowledgeBase: import("@trpc/server").TRPCBuiltRouter<{
2955
+ ctx: import("../context.js").Context;
2956
+ meta: object;
2957
+ errorShape: {
2958
+ data: {
2959
+ zodError: string | null;
2960
+ code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
2961
+ httpStatus: number;
2962
+ path?: string;
2963
+ stack?: string;
2964
+ };
2965
+ message: string;
2966
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
2967
+ };
2968
+ transformer: true;
2969
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
2970
+ listForWorkspace: import("@trpc/server").TRPCQueryProcedure<{
2971
+ input: {
2972
+ workspaceId: string;
2973
+ };
2974
+ output: {
2975
+ attachmentId: string;
2976
+ attachedAt: Date;
2977
+ attachedById: string | null;
2978
+ _count: {
2979
+ documents: number;
2980
+ };
2981
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
2982
+ name: string;
2983
+ id: string;
2984
+ createdAt: Date;
2985
+ updatedAt: Date;
2986
+ createdById: string | null;
2987
+ description: string | null;
2988
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
2989
+ isCurated: boolean;
2990
+ embeddingModel: string;
2991
+ embeddingDim: number;
2992
+ }[];
2993
+ meta: object;
2994
+ }>;
2995
+ searchCatalog: import("@trpc/server").TRPCQueryProcedure<{
2996
+ input: {
2997
+ query?: string | undefined;
2998
+ workspaceId?: string | undefined;
2999
+ limit?: number | undefined;
3000
+ };
3001
+ output: {
3002
+ attached: boolean;
3003
+ _count: {
3004
+ documents: number;
3005
+ };
3006
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3007
+ name: string;
3008
+ id: string;
3009
+ createdAt: Date;
3010
+ updatedAt: Date;
3011
+ createdById: string | null;
3012
+ description: string | null;
3013
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
3014
+ isCurated: boolean;
3015
+ embeddingModel: string;
3016
+ embeddingDim: number;
3017
+ }[];
3018
+ meta: object;
3019
+ }>;
3020
+ get: import("@trpc/server").TRPCQueryProcedure<{
3021
+ input: {
3022
+ id: string;
3023
+ };
3024
+ output: {
3025
+ documents: {
3026
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3027
+ name: string;
3028
+ id: string;
3029
+ createdAt: Date;
3030
+ updatedAt: Date;
3031
+ mimeType: string;
3032
+ size: number;
3033
+ bucket: string | null;
3034
+ objectKey: string | null;
3035
+ status: import("@prisma/client").$Enums.KnowledgeBaseDocumentStatus;
3036
+ knowledgeBaseId: string;
3037
+ errorMessage: string | null;
3038
+ numChunks: number;
3039
+ numPages: number | null;
3040
+ }[];
3041
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3042
+ name: string;
3043
+ id: string;
3044
+ createdAt: Date;
3045
+ updatedAt: Date;
3046
+ createdById: string | null;
3047
+ description: string | null;
3048
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
3049
+ isCurated: boolean;
3050
+ embeddingModel: string;
3051
+ embeddingDim: number;
3052
+ };
3053
+ meta: object;
3054
+ }>;
3055
+ listDocuments: import("@trpc/server").TRPCQueryProcedure<{
3056
+ input: {
3057
+ knowledgeBaseId: string;
3058
+ };
3059
+ output: {
3060
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3061
+ name: string;
3062
+ id: string;
3063
+ createdAt: Date;
3064
+ updatedAt: Date;
3065
+ mimeType: string;
3066
+ size: number;
3067
+ bucket: string | null;
3068
+ objectKey: string | null;
3069
+ status: import("@prisma/client").$Enums.KnowledgeBaseDocumentStatus;
3070
+ knowledgeBaseId: string;
3071
+ errorMessage: string | null;
3072
+ numChunks: number;
3073
+ numPages: number | null;
3074
+ }[];
3075
+ meta: object;
3076
+ }>;
3077
+ addToWorkspace: import("@trpc/server").TRPCMutationProcedure<{
3078
+ input: {
3079
+ workspaceId: string;
3080
+ knowledgeBaseId: string;
3081
+ };
3082
+ output: {
3083
+ id: string;
3084
+ createdAt: Date;
3085
+ workspaceId: string;
3086
+ knowledgeBaseId: string;
3087
+ addedById: string | null;
3088
+ };
3089
+ meta: object;
3090
+ }>;
3091
+ removeFromWorkspace: import("@trpc/server").TRPCMutationProcedure<{
3092
+ input: {
3093
+ workspaceId: string;
3094
+ knowledgeBaseId: string;
3095
+ };
3096
+ output: boolean;
3097
+ meta: object;
3098
+ }>;
3099
+ query: import("@trpc/server").TRPCMutationProcedure<{
3100
+ input: {
3101
+ knowledgeBaseId: string;
3102
+ query: string;
3103
+ topK?: number | undefined;
3104
+ generateAnswer?: boolean | undefined;
3105
+ };
3106
+ output: {
3107
+ matches: {
3108
+ chunkId: string;
3109
+ documentId: string;
3110
+ documentName: string;
3111
+ chunkIndex: number;
3112
+ content: string;
3113
+ score: number;
3114
+ }[];
3115
+ answer: string | null;
3116
+ };
3117
+ meta: object;
3118
+ }>;
3119
+ admin: import("@trpc/server").TRPCBuiltRouter<{
3120
+ ctx: import("../context.js").Context;
3121
+ meta: object;
3122
+ errorShape: {
3123
+ data: {
3124
+ zodError: string | null;
3125
+ code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3126
+ httpStatus: number;
3127
+ path?: string;
3128
+ stack?: string;
3129
+ };
3130
+ message: string;
3131
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3132
+ };
3133
+ transformer: true;
3134
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
3135
+ listAll: import("@trpc/server").TRPCQueryProcedure<{
3136
+ input: void;
3137
+ output: ({
3138
+ _count: {
3139
+ workspaces: number;
3140
+ documents: number;
3141
+ };
3142
+ } & {
3143
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3144
+ name: string;
3145
+ id: string;
3146
+ createdAt: Date;
3147
+ updatedAt: Date;
3148
+ createdById: string | null;
3149
+ description: string | null;
3150
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
3151
+ isCurated: boolean;
3152
+ embeddingModel: string;
3153
+ embeddingDim: number;
3154
+ })[];
3155
+ meta: object;
3156
+ }>;
3157
+ get: import("@trpc/server").TRPCQueryProcedure<{
3158
+ input: {
3159
+ id: string;
3160
+ };
3161
+ output: {
3162
+ documents: {
3163
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3164
+ name: string;
3165
+ id: string;
3166
+ createdAt: Date;
3167
+ updatedAt: Date;
3168
+ mimeType: string;
3169
+ size: number;
3170
+ bucket: string | null;
3171
+ objectKey: string | null;
3172
+ status: import("@prisma/client").$Enums.KnowledgeBaseDocumentStatus;
3173
+ knowledgeBaseId: string;
3174
+ errorMessage: string | null;
3175
+ numChunks: number;
3176
+ numPages: number | null;
3177
+ }[];
3178
+ workspaces: ({
3179
+ workspace: {
3180
+ id: string;
3181
+ title: string;
3182
+ icon: string;
3183
+ };
3184
+ } & {
3185
+ id: string;
3186
+ createdAt: Date;
3187
+ workspaceId: string;
3188
+ knowledgeBaseId: string;
3189
+ addedById: string | null;
3190
+ })[];
3191
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3192
+ name: string;
3193
+ id: string;
3194
+ createdAt: Date;
3195
+ updatedAt: Date;
3196
+ createdById: string | null;
3197
+ description: string | null;
3198
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
3199
+ isCurated: boolean;
3200
+ embeddingModel: string;
3201
+ embeddingDim: number;
3202
+ };
3203
+ meta: object;
3204
+ }>;
3205
+ listDocuments: import("@trpc/server").TRPCQueryProcedure<{
3206
+ input: {
3207
+ knowledgeBaseId: string;
3208
+ };
3209
+ output: {
3210
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3211
+ name: string;
3212
+ id: string;
3213
+ createdAt: Date;
3214
+ updatedAt: Date;
3215
+ mimeType: string;
3216
+ size: number;
3217
+ bucket: string | null;
3218
+ objectKey: string | null;
3219
+ status: import("@prisma/client").$Enums.KnowledgeBaseDocumentStatus;
3220
+ knowledgeBaseId: string;
3221
+ errorMessage: string | null;
3222
+ numChunks: number;
3223
+ numPages: number | null;
3224
+ }[];
3225
+ meta: object;
3226
+ }>;
3227
+ create: import("@trpc/server").TRPCMutationProcedure<{
3228
+ input: {
3229
+ name: string;
3230
+ description?: string | undefined;
3231
+ isCurated?: boolean | undefined;
3232
+ };
3233
+ output: {
3234
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3235
+ name: string;
3236
+ id: string;
3237
+ createdAt: Date;
3238
+ updatedAt: Date;
3239
+ createdById: string | null;
3240
+ description: string | null;
3241
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
3242
+ isCurated: boolean;
3243
+ embeddingModel: string;
3244
+ embeddingDim: number;
3245
+ };
3246
+ meta: object;
3247
+ }>;
3248
+ update: import("@trpc/server").TRPCMutationProcedure<{
3249
+ input: {
3250
+ id: string;
3251
+ name?: string | undefined;
3252
+ description?: string | null | undefined;
3253
+ isCurated?: boolean | undefined;
3254
+ };
3255
+ output: {
3256
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3257
+ name: string;
3258
+ id: string;
3259
+ createdAt: Date;
3260
+ updatedAt: Date;
3261
+ createdById: string | null;
3262
+ description: string | null;
3263
+ status: import("@prisma/client").$Enums.KnowledgeBaseStatus;
3264
+ isCurated: boolean;
3265
+ embeddingModel: string;
3266
+ embeddingDim: number;
3267
+ };
3268
+ meta: object;
3269
+ }>;
3270
+ delete: import("@trpc/server").TRPCMutationProcedure<{
3271
+ input: {
3272
+ id: string;
3273
+ };
3274
+ output: boolean;
3275
+ meta: object;
3276
+ }>;
3277
+ attachToWorkspace: import("@trpc/server").TRPCMutationProcedure<{
3278
+ input: {
3279
+ workspaceId: string;
3280
+ knowledgeBaseId: string;
3281
+ };
3282
+ output: {
3283
+ id: string;
3284
+ createdAt: Date;
3285
+ workspaceId: string;
3286
+ knowledgeBaseId: string;
3287
+ addedById: string | null;
3288
+ };
3289
+ meta: object;
3290
+ }>;
3291
+ detachFromWorkspace: import("@trpc/server").TRPCMutationProcedure<{
3292
+ input: {
3293
+ workspaceId: string;
3294
+ knowledgeBaseId: string;
3295
+ };
3296
+ output: boolean;
3297
+ meta: object;
3298
+ }>;
3299
+ requestDocumentUploadUrl: import("@trpc/server").TRPCMutationProcedure<{
3300
+ input: {
3301
+ knowledgeBaseId: string;
3302
+ filename: string;
3303
+ contentType: string;
3304
+ size: number;
3305
+ };
3306
+ output: {
3307
+ documentId: string;
3308
+ uploadUrl: string;
3309
+ bucket: string;
3310
+ objectKey: string;
3311
+ };
3312
+ meta: object;
3313
+ }>;
3314
+ processDocument: import("@trpc/server").TRPCMutationProcedure<{
3315
+ input: {
3316
+ knowledgeBaseId: string;
3317
+ documentId: string;
3318
+ };
3319
+ output: {
3320
+ meta: import("@prisma/client/runtime/library").JsonValue | null;
3321
+ name: string;
3322
+ id: string;
3323
+ createdAt: Date;
3324
+ updatedAt: Date;
3325
+ mimeType: string;
3326
+ size: number;
3327
+ bucket: string | null;
3328
+ objectKey: string | null;
3329
+ status: import("@prisma/client").$Enums.KnowledgeBaseDocumentStatus;
3330
+ knowledgeBaseId: string;
3331
+ errorMessage: string | null;
3332
+ numChunks: number;
3333
+ numPages: number | null;
3334
+ } | null;
3335
+ meta: object;
3336
+ }>;
3337
+ deleteDocument: import("@trpc/server").TRPCMutationProcedure<{
3338
+ input: {
3339
+ documentId: string;
3340
+ };
3341
+ output: boolean;
3342
+ meta: object;
3343
+ }>;
3344
+ query: import("@trpc/server").TRPCMutationProcedure<{
3345
+ input: {
3346
+ knowledgeBaseId: string;
3347
+ query: string;
3348
+ topK?: number | undefined;
3349
+ generateAnswer?: boolean | undefined;
3350
+ };
3351
+ output: {
3352
+ matches: {
3353
+ chunkId: string;
3354
+ documentId: string;
3355
+ documentName: string;
3356
+ chunkIndex: number;
3357
+ content: string;
3358
+ score: number;
3359
+ }[];
3360
+ answer: string | null;
3361
+ };
3362
+ meta: object;
3363
+ }>;
3364
+ }>>;
3365
+ }>>;
3366
+ artifactVersions: import("@trpc/server").TRPCBuiltRouter<{
3367
+ ctx: import("../context.js").Context;
3368
+ meta: object;
3369
+ errorShape: {
3370
+ data: {
3371
+ zodError: string | null;
3372
+ code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
3373
+ httpStatus: number;
3374
+ path?: string;
3375
+ stack?: string;
3376
+ };
3377
+ message: string;
3378
+ code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
3379
+ };
3380
+ transformer: true;
3381
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
3382
+ list: import("@trpc/server").TRPCQueryProcedure<{
3383
+ input: {
3384
+ artifactId: string;
3385
+ };
3386
+ output: {
3387
+ id: string;
3388
+ version: number;
3389
+ createdAt: Date;
3390
+ isCurrent: boolean;
3391
+ label: string | null;
3392
+ createdBy: {
3393
+ name: string | null;
3394
+ id: string;
3395
+ } | null;
3396
+ }[];
3397
+ meta: object;
3398
+ }>;
3399
+ get: import("@trpc/server").TRPCQueryProcedure<{
3400
+ input: {
3401
+ artifactVersionId: string;
3402
+ };
3403
+ output: {
3404
+ id: string;
3405
+ artifactId: string;
3406
+ version: number;
3407
+ content: string;
3408
+ data: import("@prisma/client/runtime/library").JsonValue;
3409
+ createdAt: Date;
3410
+ isCurrent: boolean;
3411
+ createdBy: string | null;
3412
+ };
3413
+ meta: object;
3414
+ }>;
3415
+ restore: import("@trpc/server").TRPCMutationProcedure<{
3416
+ input: {
3417
+ artifactVersionId: string;
3418
+ };
3419
+ output: {
3420
+ id: string;
3421
+ createdAt: Date;
3422
+ createdById: string | null;
3423
+ artifactId: string;
3424
+ content: string;
3425
+ data: import("@prisma/client/runtime/library").JsonValue | null;
3426
+ version: number;
3427
+ };
3428
+ meta: object;
3429
+ }>;
3430
+ }>>;
2976
3431
  member: import("@trpc/server").TRPCBuiltRouter<{
2977
3432
  ctx: import("../context.js").Context;
2978
3433
  meta: object;