@intelligo-dev/core 1.0.0-beta.1 → 1.0.0-beta.14

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 (356) hide show
  1. package/NOTICE +6 -0
  2. package/README.md +102 -0
  3. package/dist/attachments/errors.d.ts +7 -0
  4. package/dist/attachments/errors.d.ts.map +1 -0
  5. package/dist/attachments/errors.js +11 -0
  6. package/dist/attachments/errors.js.map +1 -0
  7. package/dist/attachments/index.d.ts +8 -0
  8. package/dist/attachments/index.d.ts.map +1 -0
  9. package/dist/attachments/index.js +7 -0
  10. package/dist/attachments/index.js.map +1 -0
  11. package/dist/attachments/service.d.ts +45 -0
  12. package/dist/attachments/service.d.ts.map +1 -0
  13. package/dist/attachments/service.js +100 -0
  14. package/dist/attachments/service.js.map +1 -0
  15. package/dist/attachments/types.d.ts +6 -0
  16. package/dist/attachments/types.d.ts.map +1 -0
  17. package/dist/attachments/types.js +2 -0
  18. package/dist/attachments/types.js.map +1 -0
  19. package/dist/conversations/errors.d.ts +2 -8
  20. package/dist/conversations/errors.d.ts.map +1 -1
  21. package/dist/conversations/errors.js +2 -8
  22. package/dist/conversations/errors.js.map +1 -1
  23. package/dist/conversations/index.d.ts +4 -12
  24. package/dist/conversations/index.d.ts.map +1 -1
  25. package/dist/conversations/index.js +2 -11
  26. package/dist/conversations/index.js.map +1 -1
  27. package/dist/conversations/service.d.ts +49 -61
  28. package/dist/conversations/service.d.ts.map +1 -1
  29. package/dist/conversations/service.js +110 -83
  30. package/dist/conversations/service.js.map +1 -1
  31. package/dist/conversations/types.d.ts +1 -4
  32. package/dist/conversations/types.d.ts.map +1 -1
  33. package/dist/conversations/types.js +0 -3
  34. package/dist/conversations/types.js.map +1 -1
  35. package/dist/db/client.d.ts +21 -10
  36. package/dist/db/client.d.ts.map +1 -1
  37. package/dist/db/client.js +43 -18
  38. package/dist/db/client.js.map +1 -1
  39. package/dist/db/index.d.ts +3 -3
  40. package/dist/db/index.d.ts.map +1 -1
  41. package/dist/db/index.js +3 -7
  42. package/dist/db/index.js.map +1 -1
  43. package/dist/db/schema/agents.d.ts +14 -51
  44. package/dist/db/schema/agents.d.ts.map +1 -1
  45. package/dist/db/schema/agents.js +9 -21
  46. package/dist/db/schema/agents.js.map +1 -1
  47. package/dist/db/schema/ai.d.ts +86 -1556
  48. package/dist/db/schema/ai.d.ts.map +1 -1
  49. package/dist/db/schema/ai.js +32 -236
  50. package/dist/db/schema/ai.js.map +1 -1
  51. package/dist/db/schema/auth.d.ts +5 -34
  52. package/dist/db/schema/auth.d.ts.map +1 -1
  53. package/dist/db/schema/auth.js +25 -56
  54. package/dist/db/schema/auth.js.map +1 -1
  55. package/dist/db/schema/billing.d.ts +339 -105
  56. package/dist/db/schema/billing.d.ts.map +1 -1
  57. package/dist/db/schema/billing.js +99 -58
  58. package/dist/db/schema/billing.js.map +1 -1
  59. package/dist/db/schema/feature-flags.d.ts +3 -12
  60. package/dist/db/schema/feature-flags.d.ts.map +1 -1
  61. package/dist/db/schema/feature-flags.js +3 -12
  62. package/dist/db/schema/feature-flags.js.map +1 -1
  63. package/dist/db/schema/identity.d.ts +12 -274
  64. package/dist/db/schema/identity.d.ts.map +1 -1
  65. package/dist/db/schema/identity.js +19 -104
  66. package/dist/db/schema/identity.js.map +1 -1
  67. package/dist/db/schema/index.d.ts +8 -15
  68. package/dist/db/schema/index.d.ts.map +1 -1
  69. package/dist/db/schema/index.js +12 -42
  70. package/dist/db/schema/index.js.map +1 -1
  71. package/dist/db/schema/notifications.d.ts +3 -17
  72. package/dist/db/schema/notifications.d.ts.map +1 -1
  73. package/dist/db/schema/notifications.js +3 -17
  74. package/dist/db/schema/notifications.js.map +1 -1
  75. package/dist/db/schema/usage.d.ts +94 -77
  76. package/dist/db/schema/usage.d.ts.map +1 -1
  77. package/dist/db/schema/usage.js +59 -89
  78. package/dist/db/schema/usage.js.map +1 -1
  79. package/dist/db/validate.d.ts +2 -11
  80. package/dist/db/validate.d.ts.map +1 -1
  81. package/dist/db/validate.js +6 -17
  82. package/dist/db/validate.js.map +1 -1
  83. package/dist/db/workspace-queries.d.ts +5 -29
  84. package/dist/db/workspace-queries.d.ts.map +1 -1
  85. package/dist/db/workspace-queries.js +5 -29
  86. package/dist/db/workspace-queries.js.map +1 -1
  87. package/dist/documents/classifier.d.ts +5 -12
  88. package/dist/documents/classifier.d.ts.map +1 -1
  89. package/dist/documents/classifier.js +16 -16
  90. package/dist/documents/classifier.js.map +1 -1
  91. package/dist/documents/errors.d.ts +2 -10
  92. package/dist/documents/errors.d.ts.map +1 -1
  93. package/dist/documents/errors.js +2 -10
  94. package/dist/documents/errors.js.map +1 -1
  95. package/dist/documents/index.d.ts +4 -13
  96. package/dist/documents/index.d.ts.map +1 -1
  97. package/dist/documents/index.js +3 -12
  98. package/dist/documents/index.js.map +1 -1
  99. package/dist/documents/service.d.ts +19 -26
  100. package/dist/documents/service.d.ts.map +1 -1
  101. package/dist/documents/service.js +44 -38
  102. package/dist/documents/service.js.map +1 -1
  103. package/dist/documents/types.d.ts +6 -10
  104. package/dist/documents/types.d.ts.map +1 -1
  105. package/dist/documents/types.js +0 -3
  106. package/dist/documents/types.js.map +1 -1
  107. package/dist/email/brand.d.ts +17 -0
  108. package/dist/email/brand.d.ts.map +1 -0
  109. package/dist/email/brand.js +9 -0
  110. package/dist/email/brand.js.map +1 -0
  111. package/dist/email/index.d.ts +4 -4
  112. package/dist/email/index.js +4 -4
  113. package/dist/email/provider.d.ts +1 -7
  114. package/dist/email/provider.d.ts.map +1 -1
  115. package/dist/email/provider.js +10 -19
  116. package/dist/email/provider.js.map +1 -1
  117. package/dist/email/send.d.ts +12 -12
  118. package/dist/email/send.d.ts.map +1 -1
  119. package/dist/email/send.js +5 -19
  120. package/dist/email/send.js.map +1 -1
  121. package/dist/email/senders.d.ts +17 -30
  122. package/dist/email/senders.d.ts.map +1 -1
  123. package/dist/email/senders.js +33 -47
  124. package/dist/email/senders.js.map +1 -1
  125. package/dist/email/templates/base-layout.d.ts +1 -1
  126. package/dist/email/templates/base-layout.d.ts.map +1 -1
  127. package/dist/email/templates/base-layout.js +4 -6
  128. package/dist/email/templates/base-layout.js.map +1 -1
  129. package/dist/email/templates/index.d.ts +10 -10
  130. package/dist/email/templates/index.d.ts.map +1 -1
  131. package/dist/email/templates/index.js +10 -16
  132. package/dist/email/templates/index.js.map +1 -1
  133. package/dist/email/templates/password-reset.d.ts +2 -2
  134. package/dist/email/templates/password-reset.d.ts.map +1 -1
  135. package/dist/email/templates/password-reset.js +10 -22
  136. package/dist/email/templates/password-reset.js.map +1 -1
  137. package/dist/email/templates/payment-failed.d.ts +2 -2
  138. package/dist/email/templates/payment-failed.d.ts.map +1 -1
  139. package/dist/email/templates/payment-failed.js +11 -24
  140. package/dist/email/templates/payment-failed.js.map +1 -1
  141. package/dist/email/templates/quota-warning.d.ts +4 -4
  142. package/dist/email/templates/quota-warning.d.ts.map +1 -1
  143. package/dist/email/templates/quota-warning.js +19 -39
  144. package/dist/email/templates/quota-warning.js.map +1 -1
  145. package/dist/email/templates/subscription-confirmed.d.ts +2 -2
  146. package/dist/email/templates/subscription-confirmed.d.ts.map +1 -1
  147. package/dist/email/templates/subscription-confirmed.js +13 -28
  148. package/dist/email/templates/subscription-confirmed.js.map +1 -1
  149. package/dist/email/templates/trial-expiry.d.ts +2 -2
  150. package/dist/email/templates/trial-expiry.d.ts.map +1 -1
  151. package/dist/email/templates/trial-expiry.js +12 -36
  152. package/dist/email/templates/trial-expiry.js.map +1 -1
  153. package/dist/email/templates/trial-warning.d.ts +2 -2
  154. package/dist/email/templates/trial-warning.d.ts.map +1 -1
  155. package/dist/email/templates/trial-warning.js +15 -32
  156. package/dist/email/templates/trial-warning.js.map +1 -1
  157. package/dist/email/templates/verify-email.d.ts +2 -2
  158. package/dist/email/templates/verify-email.d.ts.map +1 -1
  159. package/dist/email/templates/verify-email.js +10 -22
  160. package/dist/email/templates/verify-email.js.map +1 -1
  161. package/dist/email/templates/welcome.d.ts +2 -2
  162. package/dist/email/templates/welcome.d.ts.map +1 -1
  163. package/dist/email/templates/welcome.js +13 -20
  164. package/dist/email/templates/welcome.js.map +1 -1
  165. package/dist/email/templates/workspace-invitation.d.ts +2 -2
  166. package/dist/email/templates/workspace-invitation.d.ts.map +1 -1
  167. package/dist/email/templates/workspace-invitation.js +12 -26
  168. package/dist/email/templates/workspace-invitation.js.map +1 -1
  169. package/dist/env.d.ts +5 -10
  170. package/dist/env.d.ts.map +1 -1
  171. package/dist/env.js +41 -31
  172. package/dist/env.js.map +1 -1
  173. package/dist/identity/audit.d.ts +11 -24
  174. package/dist/identity/audit.d.ts.map +1 -1
  175. package/dist/identity/audit.js +13 -27
  176. package/dist/identity/audit.js.map +1 -1
  177. package/dist/identity/errors.d.ts +4 -12
  178. package/dist/identity/errors.d.ts.map +1 -1
  179. package/dist/identity/errors.js +2 -8
  180. package/dist/identity/errors.js.map +1 -1
  181. package/dist/identity/index.d.ts +6 -13
  182. package/dist/identity/index.d.ts.map +1 -1
  183. package/dist/identity/index.js +5 -12
  184. package/dist/identity/index.js.map +1 -1
  185. package/dist/identity/service.d.ts +29 -47
  186. package/dist/identity/service.d.ts.map +1 -1
  187. package/dist/identity/service.js +107 -79
  188. package/dist/identity/service.js.map +1 -1
  189. package/dist/identity/types.d.ts +28 -4
  190. package/dist/identity/types.d.ts.map +1 -1
  191. package/dist/identity/types.js +0 -3
  192. package/dist/identity/types.js.map +1 -1
  193. package/dist/index.d.ts +1 -2
  194. package/dist/index.d.ts.map +1 -1
  195. package/dist/index.js +3 -10
  196. package/dist/index.js.map +1 -1
  197. package/dist/logger.d.ts +7 -18
  198. package/dist/logger.d.ts.map +1 -1
  199. package/dist/logger.js +45 -49
  200. package/dist/logger.js.map +1 -1
  201. package/dist/money.d.ts +95 -0
  202. package/dist/money.d.ts.map +1 -0
  203. package/dist/money.js +208 -0
  204. package/dist/money.js.map +1 -0
  205. package/dist/notifications/index.d.ts +9 -43
  206. package/dist/notifications/index.d.ts.map +1 -1
  207. package/dist/notifications/index.js +9 -49
  208. package/dist/notifications/index.js.map +1 -1
  209. package/dist/notifications/triggers.d.ts +9 -32
  210. package/dist/notifications/triggers.d.ts.map +1 -1
  211. package/dist/notifications/triggers.js +21 -58
  212. package/dist/notifications/triggers.js.map +1 -1
  213. package/dist/notifications/types.d.ts +6 -8
  214. package/dist/notifications/types.d.ts.map +1 -1
  215. package/dist/notifications/types.js +0 -9
  216. package/dist/notifications/types.js.map +1 -1
  217. package/dist/prompt.d.ts +38 -0
  218. package/dist/prompt.d.ts.map +1 -0
  219. package/dist/prompt.js +118 -0
  220. package/dist/prompt.js.map +1 -0
  221. package/dist/registry.d.ts +32 -0
  222. package/dist/registry.d.ts.map +1 -0
  223. package/dist/registry.js +60 -0
  224. package/dist/registry.js.map +1 -0
  225. package/dist/request-context.d.ts +49 -0
  226. package/dist/request-context.d.ts.map +1 -0
  227. package/dist/request-context.js +100 -0
  228. package/dist/request-context.js.map +1 -0
  229. package/dist/storage/index.d.ts +65 -0
  230. package/dist/storage/index.d.ts.map +1 -0
  231. package/dist/storage/index.js +109 -0
  232. package/dist/storage/index.js.map +1 -0
  233. package/package.json +74 -24
  234. package/src/attachments/errors.ts +18 -0
  235. package/src/attachments/index.ts +22 -0
  236. package/src/attachments/service.ts +178 -0
  237. package/src/attachments/types.ts +6 -0
  238. package/src/conversations/errors.ts +45 -0
  239. package/src/conversations/index.ts +39 -0
  240. package/src/conversations/service.ts +594 -0
  241. package/src/conversations/types.ts +15 -0
  242. package/src/db/client.ts +91 -0
  243. package/src/db/index.ts +3 -0
  244. package/src/db/migrations/0000_baseline.sql +652 -0
  245. package/src/db/migrations/0001_reconcile_chain_built_databases.sql +53 -0
  246. package/src/db/migrations/0002_webhook_claim_lease.sql +1 -0
  247. package/src/db/migrations/0003_local_payments.sql +18 -0
  248. package/src/db/migrations/README.md +103 -36
  249. package/src/db/migrations/legacy-chain.json +206 -0
  250. package/src/db/migrations/meta/0000_snapshot.json +4182 -157
  251. package/src/db/migrations/meta/0002_snapshot.json +2478 -368
  252. package/src/db/migrations/meta/0003_snapshot.json +2567 -554
  253. package/src/db/migrations/meta/_journal.json +8 -274
  254. package/src/db/schema/agents.ts +57 -0
  255. package/src/db/schema/ai.ts +174 -0
  256. package/src/db/schema/auth.ts +183 -0
  257. package/src/db/schema/billing.ts +245 -0
  258. package/src/db/schema/feature-flags.ts +20 -0
  259. package/src/db/schema/identity.ts +250 -0
  260. package/src/db/schema/index.ts +12 -0
  261. package/src/db/schema/notifications.ts +31 -0
  262. package/src/db/schema/usage.ts +269 -0
  263. package/src/db/validate.ts +63 -0
  264. package/src/db/workspace-queries.ts +64 -0
  265. package/src/documents/classifier.ts +61 -0
  266. package/src/documents/errors.ts +44 -0
  267. package/src/documents/index.ts +24 -0
  268. package/src/documents/service.ts +256 -0
  269. package/src/documents/types.ts +24 -0
  270. package/src/email/brand.ts +24 -0
  271. package/src/email/index.ts +19 -0
  272. package/src/email/provider.ts +278 -0
  273. package/src/email/send.ts +169 -0
  274. package/src/email/senders.ts +292 -0
  275. package/src/email/templates/base-layout.tsx +145 -0
  276. package/src/email/templates/index.ts +28 -0
  277. package/src/email/templates/password-reset.tsx +72 -0
  278. package/src/email/templates/payment-failed.tsx +77 -0
  279. package/src/email/templates/quota-warning.tsx +118 -0
  280. package/src/email/templates/subscription-confirmed.tsx +91 -0
  281. package/src/email/templates/trial-expiry.tsx +124 -0
  282. package/src/email/templates/trial-warning.tsx +104 -0
  283. package/src/email/templates/verify-email.tsx +72 -0
  284. package/src/email/templates/welcome.tsx +64 -0
  285. package/src/email/templates/workspace-invitation.tsx +105 -0
  286. package/src/env.ts +180 -0
  287. package/src/identity/audit.ts +65 -0
  288. package/src/identity/errors.ts +44 -0
  289. package/src/identity/index.ts +29 -0
  290. package/src/identity/service.ts +303 -0
  291. package/src/identity/types.ts +58 -0
  292. package/src/index.ts +4 -0
  293. package/src/logger.ts +198 -0
  294. package/src/money.ts +270 -0
  295. package/src/notifications/index.ts +112 -0
  296. package/src/notifications/triggers.ts +158 -0
  297. package/src/notifications/types.ts +26 -0
  298. package/src/prompt.ts +142 -0
  299. package/src/registry.ts +75 -0
  300. package/src/request-context.ts +137 -0
  301. package/src/storage/index.ts +153 -0
  302. package/dist/db/schema/rag.d.ts +0 -171
  303. package/dist/db/schema/rag.d.ts.map +0 -1
  304. package/dist/db/schema/rag.js +0 -42
  305. package/dist/db/schema/rag.js.map +0 -1
  306. package/src/db/migrations/0000_sharp_night_nurse.sql +0 -52
  307. package/src/db/migrations/0001_hesitant_vapor.sql +0 -40
  308. package/src/db/migrations/0002_numerous_lady_vermin.sql +0 -235
  309. package/src/db/migrations/0003_mighty_jean_grey.sql +0 -37
  310. package/src/db/migrations/0004_cynical_grandmaster.sql +0 -2
  311. package/src/db/migrations/0005_careful_switch.sql +0 -8
  312. package/src/db/migrations/0006_tense_blue_marvel.sql +0 -16
  313. package/src/db/migrations/0007_next_squadron_sinister.sql +0 -1
  314. package/src/db/migrations/0008_powerful_scream.sql +0 -39
  315. package/src/db/migrations/0009_sad_ink.sql +0 -1
  316. package/src/db/migrations/0010_shocking_omega_flight.sql +0 -2
  317. package/src/db/migrations/0011_ambiguous_otto_octavius.sql +0 -151
  318. package/src/db/migrations/0011_hnsw_vector_index.sql +0 -17
  319. package/src/db/migrations/0012_user_profiles.sql +0 -30
  320. package/src/db/migrations/0013_trending_seasonal_columns.sql +0 -9
  321. package/src/db/migrations/0014_add_product_type_to_agents.sql +0 -6
  322. package/src/db/migrations/0015_new_v1_tables.sql +0 -149
  323. package/src/db/migrations/0016_document_types.sql +0 -30
  324. package/src/db/migrations/0017_document_metadata.sql +0 -2
  325. package/src/db/migrations/0018_identity_graph.sql +0 -200
  326. package/src/db/migrations/0019_db_driven_prompts.sql +0 -20
  327. package/src/db/migrations/0020_pending_extractions.sql +0 -35
  328. package/src/db/migrations/0021_rag_documents.sql +0 -39
  329. package/src/db/migrations/0022_user_quotas_usage_jsonb.sql +0 -70
  330. package/src/db/migrations/0023_user_facts_user_scoped_unique.sql +0 -17
  331. package/src/db/migrations/0024_user_memories_hnsw.sql +0 -23
  332. package/src/db/migrations/0025_audit_trigger_errcode.sql +0 -21
  333. package/src/db/migrations/0026_user_profile_snapshots_composite_pk.sql +0 -17
  334. package/src/db/migrations/0027_billing_settings_mnt_columns.sql +0 -54
  335. package/src/db/migrations/0028_trial_credits_normalized_email.sql +0 -37
  336. package/src/db/migrations/0029_usage_records_conversation_idx.sql +0 -13
  337. package/src/db/migrations/0030_pending_extractions_composite_idx.sql +0 -11
  338. package/src/db/migrations/0031_rag_documents_hnsw.sql +0 -16
  339. package/src/db/migrations/0032_rate_limit_unique_idx.sql +0 -16
  340. package/src/db/migrations/0033_pending_extractions_partial_idx.sql +0 -18
  341. package/src/db/migrations/0034_rate_limit_count.sql +0 -9
  342. package/src/db/migrations/0035_credit_reservations.sql +0 -24
  343. package/src/db/migrations/0036_executions_audit_jobs.sql +0 -96
  344. package/src/db/migrations/0037_rate_limit_minute_bucket.sql +0 -46
  345. package/src/db/migrations/0038_user_quotas_generic_usage.sql +0 -25
  346. package/src/db/migrations/0039_platform_admin_impersonation.sql +0 -27
  347. package/src/db/migrations/0040_ee_audit_chain.sql +0 -23
  348. package/src/db/migrations/meta/0001_snapshot.json +0 -631
  349. package/src/db/migrations/meta/0004_snapshot.json +0 -2500
  350. package/src/db/migrations/meta/0005_snapshot.json +0 -2548
  351. package/src/db/migrations/meta/0006_snapshot.json +0 -2650
  352. package/src/db/migrations/meta/0007_snapshot.json +0 -2657
  353. package/src/db/migrations/meta/0008_snapshot.json +0 -2719
  354. package/src/db/migrations/meta/0009_snapshot.json +0 -2726
  355. package/src/db/migrations/meta/0010_snapshot.json +0 -2739
  356. package/src/db/migrations/meta/0011_snapshot.json +0 -3886
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ Intelligo
2
+ Copyright 2026 Turtuvshin Byambaa and the Intelligo contributors
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see
5
+ LICENSE). The Intelligo name and logo are trademarks; see TRADEMARK.md
6
+ in the source repository, https://github.com/intelligo-dev/intelligo.
package/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # @intelligo-dev/core
2
+
3
+ Database schema, email, logging, notifications, and the conversation, document and identity contracts.
4
+
5
+ Part of [Intelligo](https://intelligo.dev), an application framework and
6
+ operational platform for vertical AI SaaS products. Every `@intelligo-dev/*`
7
+ package is released at one version and shares one database schema;
8
+ `pnpm dlx @intelligo-dev/cli@beta create my-app` installs the set an
9
+ application needs. Documentation:
10
+ [intelligo.dev/docs/packages/core](https://intelligo.dev/docs/packages/core).
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pnpm add @intelligo-dev/core@beta drizzle-orm
16
+ ```
17
+
18
+ `drizzle-orm` is a peer; `react` 19 is an optional one, needed only by the
19
+ email templates. Every other `@intelligo-dev/*` package depends on this one,
20
+ and this one imports none of them.
21
+
22
+ ## Use
23
+
24
+ ```ts
25
+ import { db, withWorkspaceFilter } from "@intelligo-dev/core/db";
26
+ import { conversations } from "@intelligo-dev/core/db/schema";
27
+ import { createLogger } from "@intelligo-dev/core/logger";
28
+ import { eq } from "drizzle-orm";
29
+
30
+ const log = createLogger("Inbox");
31
+
32
+ const mine = await db
33
+ .select()
34
+ .from(conversations)
35
+ .where(
36
+ withWorkspaceFilter(
37
+ conversations.workspaceId,
38
+ workspace.id,
39
+ eq(conversations.userId, user.id)
40
+ )
41
+ );
42
+ log.info("Loaded conversations", { count: String(mine.length) });
43
+ ```
44
+
45
+ `db` connects on first use from `DATABASE_URL`: a Neon host takes the
46
+ WebSocket driver and anything else takes node-postgres, unless
47
+ `INTELLIGO_DB_DRIVER` says `pg` or `neon-serverless`. Every tenant-scoped query
48
+ filters on `workspaceId`; `workspaceEq` and `withWorkspaceFilter` make that the
49
+ short way to write one.
50
+
51
+ The leaves import nothing, so a client bundle, an edge runtime or another
52
+ package can reach them without pulling in the database:
53
+
54
+ ```ts
55
+ import { formatMoney, fromMajor } from "@intelligo-dev/core/money";
56
+ import { sanitizeForSystemPrompt } from "@intelligo-dev/core/prompt";
57
+
58
+ formatMoney(fromMajor(12.5, "USD"), "en-US"); // "$12.50", held as 12_500_000 micros
59
+
60
+ const system = `${basePrompt}\n\nAbout the user: ${sanitizeForSystemPrompt(profile)}`;
61
+ ```
62
+
63
+ ## Exports
64
+
65
+ | Subpath | What |
66
+ | ------------------ | -------------------------------------------------------------------------------------- |
67
+ | `/db` | Drizzle client and the workspace-scoped query helpers |
68
+ | `/db/schema` | Every framework table |
69
+ | `/conversations` | Conversation and message persistence |
70
+ | `/documents` | Document persistence and the title classifier |
71
+ | `/identity` | The identity graph: facts, memories, profile snapshots |
72
+ | `/attachments` | Rows for the files users put into conversations |
73
+ | `/storage` | Where those files' bytes live: one adapter (S3, R2, disk) bound by the application |
74
+ | `/email` | Transactional email and its templates |
75
+ | `/notifications` | In-app notification records and triggers |
76
+ | `/logger` | Structured logging with credential redaction |
77
+ | `/registry` | Registries that survive a bundler duplicating a module |
78
+ | `/money` | Amount-plus-currency value object in micros; imports nothing |
79
+ | `/request-context` | Where the framework reads the request's headers from; bound by the adapter |
80
+ | `/prompt` | Prompt-injection sanitisation for user text bound for a system prompt; imports nothing |
81
+ | `/env` | Environment validation |
82
+
83
+ ## Environment
84
+
85
+ `assertEnv()` from `/env` fails at boot rather than at the first query when
86
+ `DATABASE_URL`, `BETTER_AUTH_SECRET` or `NEXT_PUBLIC_APP_URL` is missing;
87
+ `validateEnv()` returns the same findings, with warnings for the optional
88
+ Stripe, email and `CRON_SECRET` values. The composition root calls it once.
89
+
90
+ ## Migrations
91
+
92
+ The framework migration chain ships inside this package
93
+ (`src/db/migrations`) and is applied by `intelligo migrate` from
94
+ [`@intelligo-dev/cli`](https://www.npmjs.com/package/@intelligo-dev/cli).
95
+
96
+ Do not provision with `drizzle-kit push`. A pushed database has the schema and
97
+ no migration records, and the migrator refuses it rather than half-applying the
98
+ chain to tables that already exist.
99
+
100
+ ## Licence
101
+
102
+ Apache-2.0
@@ -0,0 +1,7 @@
1
+ export type AttachmentServiceErrorCode = "not_found" | "forbidden" | "invalid_input" | "database_error";
2
+ export declare class AttachmentServiceError extends Error {
3
+ readonly code: AttachmentServiceErrorCode;
4
+ constructor(code: AttachmentServiceErrorCode, message: string);
5
+ }
6
+ export declare function isAttachmentServiceError(error: unknown): error is AttachmentServiceError;
7
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/attachments/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GACpC,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEjE,qBAAa,sBAAuB,SAAQ,KAAK;aAE7B,IAAI,EAAE,0BAA0B;gBAAhC,IAAI,EAAE,0BAA0B,EAChD,OAAO,EAAE,MAAM;CAKlB;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,sBAAsB,CAEjC"}
@@ -0,0 +1,11 @@
1
+ export class AttachmentServiceError extends Error {
2
+ constructor(code, message) {
3
+ super(message);
4
+ this.code = code;
5
+ this.name = "AttachmentServiceError";
6
+ }
7
+ }
8
+ export function isAttachmentServiceError(error) {
9
+ return error instanceof AttachmentServiceError;
10
+ }
11
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/attachments/errors.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YACkB,IAAgC,EAChD,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAA4B;QAIhD,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,MAAM,UAAU,wBAAwB,CACtC,KAAc;IAEd,OAAO,KAAK,YAAY,sBAAsB,CAAC;AACjD,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Rows for the files users put into conversations; the bytes live behind
3
+ * `@intelligo-dev/core/storage`.
4
+ */
5
+ export { attachToConversation, createAttachment, deleteAttachment, getAttachment, getAttachments, listOrphanAttachments, setExtractedText, } from "./service.js";
6
+ export { AttachmentServiceError, isAttachmentServiceError, type AttachmentServiceErrorCode, } from "./errors.js";
7
+ export type { Attachment, AttachmentActor, InsertAttachment } from "./types.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/attachments/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,0BAA0B,GAChC,MAAM,UAAU,CAAC;AAElB,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Rows for the files users put into conversations; the bytes live behind
3
+ * `@intelligo-dev/core/storage`.
4
+ */
5
+ export { attachToConversation, createAttachment, deleteAttachment, getAttachment, getAttachments, listOrphanAttachments, setExtractedText, } from "./service.js";
6
+ export { AttachmentServiceError, isAttachmentServiceError, } from "./errors.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/attachments/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,GAEzB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Server-only rows for the files users put into conversations. The bytes
3
+ * live behind the storage port; this table records who uploaded a file,
4
+ * its workspace, type, size and, once the turn is persisted, conversation.
5
+ *
6
+ * Every read and write is scoped to the workspace and the uploader: the ids
7
+ * arrive in the request body, and conversations are user-private, so a
8
+ * workspace-only scope would let a member trade a colleague's attachment id
9
+ * for a signed URL to it.
10
+ */
11
+ import type { Attachment, AttachmentActor } from "./types.js";
12
+ export declare function createAttachment(actor: AttachmentActor, params: {
13
+ id?: string;
14
+ storageKey: string;
15
+ filename: string;
16
+ mediaType: string;
17
+ sizeBytes: number;
18
+ conversationId?: string | null;
19
+ extractedText?: string | null;
20
+ }): Promise<Attachment>;
21
+ /** One attachment, if the actor uploaded it in their own workspace. */
22
+ export declare function getAttachment(actor: AttachmentActor, id: string): Promise<Attachment>;
23
+ /** The attachments among `ids` that the actor uploaded. */
24
+ export declare function getAttachments(actor: AttachmentActor, ids: readonly string[]): Promise<Attachment[]>;
25
+ /** Tie uploaded files to the conversation whose turn carried them. */
26
+ export declare function attachToConversation(actor: AttachmentActor, params: {
27
+ ids: readonly string[];
28
+ conversationId: string;
29
+ }): Promise<void>;
30
+ export declare function setExtractedText(actor: AttachmentActor, params: {
31
+ id: string;
32
+ text: string | null;
33
+ }): Promise<void>;
34
+ /** Remove the row. The caller deletes the object behind `storageKey`. */
35
+ export declare function deleteAttachment(actor: AttachmentActor, id: string): Promise<Attachment>;
36
+ /**
37
+ * Uploads that never made it into a conversation — a turn that was
38
+ * refused, a tab closed mid-compose. A maintenance job deletes them
39
+ * and their objects.
40
+ */
41
+ export declare function listOrphanAttachments(params: {
42
+ olderThan: Date;
43
+ limit?: number;
44
+ }): Promise<Attachment[]>;
45
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/attachments/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,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,EAAE,IAAI,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAWxB"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Server-only rows for the files users put into conversations. The bytes
3
+ * live behind the storage port; this table records who uploaded a file,
4
+ * its workspace, type, size and, once the turn is persisted, conversation.
5
+ *
6
+ * Every read and write is scoped to the workspace and the uploader: the ids
7
+ * arrive in the request body, and conversations are user-private, so a
8
+ * workspace-only scope would let a member trade a colleague's attachment id
9
+ * for a signed URL to it.
10
+ */
11
+ import { and, eq, inArray, isNull, lt } from "drizzle-orm";
12
+ import { db } from "../db/index.js";
13
+ import { attachments } from "../db/schema/index.js";
14
+ import { AttachmentServiceError } from "./errors.js";
15
+ export async function createAttachment(actor, params) {
16
+ if (!params.filename.trim()) {
17
+ throw new AttachmentServiceError("invalid_input", "Filename is required");
18
+ }
19
+ if (params.sizeBytes < 0) {
20
+ throw new AttachmentServiceError("invalid_input", "Size cannot be negative");
21
+ }
22
+ const [row] = await db
23
+ .insert(attachments)
24
+ .values({
25
+ id: params.id ?? crypto.randomUUID(),
26
+ workspaceId: actor.workspaceId,
27
+ userId: actor.userId,
28
+ conversationId: params.conversationId ?? null,
29
+ storageKey: params.storageKey,
30
+ filename: params.filename,
31
+ mediaType: params.mediaType,
32
+ sizeBytes: params.sizeBytes,
33
+ extractedText: params.extractedText ?? null,
34
+ })
35
+ .returning();
36
+ if (!row) {
37
+ throw new AttachmentServiceError("database_error", "Failed to create attachment");
38
+ }
39
+ return row;
40
+ }
41
+ /** One attachment, if the actor uploaded it in their own workspace. */
42
+ export async function getAttachment(actor, id) {
43
+ const [row] = await db
44
+ .select()
45
+ .from(attachments)
46
+ .where(and(eq(attachments.id, id), eq(attachments.workspaceId, actor.workspaceId), eq(attachments.userId, actor.userId)))
47
+ .limit(1);
48
+ if (!row) {
49
+ throw new AttachmentServiceError("not_found", "Attachment not found");
50
+ }
51
+ return row;
52
+ }
53
+ /** The attachments among `ids` that the actor uploaded. */
54
+ export async function getAttachments(actor, ids) {
55
+ if (ids.length === 0)
56
+ return [];
57
+ return db
58
+ .select()
59
+ .from(attachments)
60
+ .where(and(inArray(attachments.id, [...ids]), eq(attachments.workspaceId, actor.workspaceId), eq(attachments.userId, actor.userId)));
61
+ }
62
+ /** Tie uploaded files to the conversation whose turn carried them. */
63
+ export async function attachToConversation(actor, params) {
64
+ if (params.ids.length === 0)
65
+ return;
66
+ await db
67
+ .update(attachments)
68
+ .set({ conversationId: params.conversationId })
69
+ .where(and(inArray(attachments.id, [...params.ids]), eq(attachments.workspaceId, actor.workspaceId), eq(attachments.userId, actor.userId), isNull(attachments.conversationId)));
70
+ }
71
+ export async function setExtractedText(actor, params) {
72
+ await db
73
+ .update(attachments)
74
+ .set({ extractedText: params.text })
75
+ .where(and(eq(attachments.id, params.id), eq(attachments.workspaceId, actor.workspaceId), eq(attachments.userId, actor.userId)));
76
+ }
77
+ /** Remove the row. The caller deletes the object behind `storageKey`. */
78
+ export async function deleteAttachment(actor, id) {
79
+ const [row] = await db
80
+ .delete(attachments)
81
+ .where(and(eq(attachments.id, id), eq(attachments.workspaceId, actor.workspaceId), eq(attachments.userId, actor.userId)))
82
+ .returning();
83
+ if (!row) {
84
+ throw new AttachmentServiceError("not_found", "Attachment not found");
85
+ }
86
+ return row;
87
+ }
88
+ /**
89
+ * Uploads that never made it into a conversation — a turn that was
90
+ * refused, a tab closed mid-compose. A maintenance job deletes them
91
+ * and their objects.
92
+ */
93
+ export async function listOrphanAttachments(params) {
94
+ return db
95
+ .select()
96
+ .from(attachments)
97
+ .where(and(isNull(attachments.conversationId), lt(attachments.createdAt, params.olderThan)))
98
+ .limit(params.limit ?? 100);
99
+ }
100
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/attachments/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,G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AE,CAAC;QACT,MAAM,IAAI,sBAAsB,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAG3C;IACC,OAAO,EAAE;SACN,MAAM,EAAE;SACR,IAAI,CAAC,WAAW,CAAC;SACjB,KAAK,CACJ,GAAG,CACD,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,EAClC,EAAE,CAAC,WAAW,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAC5C,CACF;SACA,KAAK,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type AttachmentActor = {
2
+ workspaceId: string;
3
+ userId: string;
4
+ };
5
+ export type { Attachment, InsertAttachment } from "../db/schema/index.js";
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/attachments/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/attachments/types.ts"],"names":[],"mappings":""}
@@ -1,12 +1,6 @@
1
1
  /**
2
- * Conversation service error type.
3
- *
4
- * Mirrors `./documents/errors.ts` and `@intelligo-dev/auth`'s
5
- * `WorkspaceServiceError` exactly: the conversations service
6
- * (./service.ts) throws this for every failure it recognizes rather
7
- * than returning an ad-hoc `{ success, error }` envelope. Shaping to a
8
- * transport-facing envelope (plus Sentry/logging/revalidatePath) is
9
- * the caller's job, one layer up.
2
+ * Thrown by the conversations service for every failure it recognizes.
3
+ * Shaping it into a transport envelope is the caller's job.
10
4
  */
11
5
  /**
12
6
  * - `not_found` — no conversation, or no message, exists at the given
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/conversations/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4BAA4B,GACpC,WAAW,GACX,WAAW,GACX,eAAe,GACf,gBAAgB,CAAC;AAErB,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAI5C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGvB,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAUhC;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,CAEnC"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/conversations/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4BAA4B,GACtC,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEjE,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAG5C,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGvB,IAAI,EAAE,4BAA4B,EAClC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAUhC;AAED,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,CAEnC"}
@@ -1,12 +1,6 @@
1
1
  /**
2
- * Conversation service error type.
3
- *
4
- * Mirrors `./documents/errors.ts` and `@intelligo-dev/auth`'s
5
- * `WorkspaceServiceError` exactly: the conversations service
6
- * (./service.ts) throws this for every failure it recognizes rather
7
- * than returning an ad-hoc `{ success, error }` envelope. Shaping to a
8
- * transport-facing envelope (plus Sentry/logging/revalidatePath) is
9
- * the caller's job, one layer up.
2
+ * Thrown by the conversations service for every failure it recognizes.
3
+ * Shaping it into a transport envelope is the caller's job.
10
4
  */
11
5
  export class ConversationServiceError extends Error {
12
6
  constructor(code, message, options) {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/conversations/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAmBH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAOjD,YACE,IAAkC,EAClC,OAAe,EACf,OAA6B;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,IAA4B,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QACtD,CAAC;QACD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,KAAK,YAAY,wBAAwB,CAAC;AACnD,CAAC"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/conversations/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH,MAAM,OAAO,wBAAyB,SAAQ,KAAK;IAMjD,YACE,IAAkC,EAClC,OAAe,EACf,OAA6B;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,0BAA0B,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS,EAAE,CAAC;YAChC,IAA4B,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QACtD,CAAC;QACD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,OAAO,KAAK,YAAY,wBAAwB,CAAC;AACnD,CAAC"}
@@ -1,13 +1,5 @@
1
- /**
2
- * Conversations Module (ADR-0009)
3
- *
4
- * Conversation/message lifecycle: create, list, read, rename, delete,
5
- * message append/window reads, vote state. See ./service.ts for the
6
- * full module doc comment, including what stayed product-side.
7
- *
8
- * Use via subpath import: @intelligo-dev/core/conversations
9
- */
10
- export { createConversation, getConversation, listConversations, getConversationHistory, renameConversation, deleteConversation, deleteAllConversations, getMessages, saveMessages, upsertMessages, updateMessage, deleteTrailingMessages, voteMessage, getVotes, } from "./service";
11
- export { ConversationServiceError, isConversationServiceError, type ConversationServiceErrorCode, } from "./errors";
12
- export type { ConversationActor, Conversation, InsertConversation, Message, InsertMessage, Vote, InsertVote, ConversationMetadata, } from "./types";
1
+ export { createConversation, getConversation, listConversations, getConversationHistory, renameConversation, deleteConversation, deleteAllConversations, getMessages, saveMessages, upsertMessages, updateMessage, deleteTrailingMessages, voteMessage, getVotes, clearVote, updateConversationMetadata, setConversationVisibility, getPublicConversation, getPublicMessages, } from "./service.js";
2
+ export type { ConversationVisibility } from "./service.js";
3
+ export { ConversationServiceError, isConversationServiceError, type ConversationServiceErrorCode, } from "./errors.js";
4
+ export type { ConversationActor, Conversation, InsertConversation, Message, InsertMessage, Vote, InsertVote, ConversationMetadata, } from "./types.js";
13
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,QAAQ,GACT,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,4BAA4B,GAClC,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/conversations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,KAAK,4BAA4B,GAClC,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,IAAI,EACJ,UAAU,EACV,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
@@ -1,12 +1,3 @@
1
- /**
2
- * Conversations Module (ADR-0009)
3
- *
4
- * Conversation/message lifecycle: create, list, read, rename, delete,
5
- * message append/window reads, vote state. See ./service.ts for the
6
- * full module doc comment, including what stayed product-side.
7
- *
8
- * Use via subpath import: @intelligo-dev/core/conversations
9
- */
10
- export { createConversation, getConversation, listConversations, getConversationHistory, renameConversation, deleteConversation, deleteAllConversations, getMessages, saveMessages, upsertMessages, updateMessage, deleteTrailingMessages, voteMessage, getVotes, } from "./service";
11
- export { ConversationServiceError, isConversationServiceError, } from "./errors";
1
+ export { createConversation, getConversation, listConversations, getConversationHistory, renameConversation, deleteConversation, deleteAllConversations, getMessages, saveMessages, upsertMessages, updateMessage, deleteTrailingMessages, voteMessage, getVotes, clearVote, updateConversationMetadata, setConversationVisibility, getPublicConversation, getPublicMessages, } from "./service.js";
2
+ export { ConversationServiceError, isConversationServiceError, } from "./errors.js";
12
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conversations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,QAAQ,GACT,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAE3B,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conversations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,YAAY,EACZ,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,0BAA0B,EAC1B,yBAAyB,EACzB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAE3B,MAAM,UAAU,CAAC"}
@@ -1,48 +1,20 @@
1
1
  /**
2
- * Conversation & Message Persistence Service — Server-only
2
+ * Server-only persistence for conversations, messages and votes.
3
3
  *
4
- * Persistence-only: conversation lifecycle (create, list, read,
5
- * rename, delete), message append/window reads, and vote state.
6
- * Ported from the product application's conversation server actions
7
- * and chat-route persistence helper (ADR-0009) — the tables
8
- * (`conversations`, `messages`, `votes`) always lived in
9
- * @intelligo-dev/core's schema, only the service layer sat in the product
10
- * application.
4
+ * Title generation, windowing and summarization, agent validation and model
5
+ * selection belong to the product; this module takes an already-resolved
6
+ * agentId and modelId.
11
7
  *
12
- * What did NOT come with it (stays product-side, native AI code):
13
- * - LLM title generation (`generateTitleFromUserMessage` ran a
14
- * Mastra agent inside an execution boundary — that's product
15
- * logic over the execution boundary, not persistence).
16
- * - Conversation windowing/summarization
17
- * (applyConversationWindow, summarizeOldMessages) and the
18
- * `conversationSummary` metadata write they produce.
19
- * - Career's assessment-state read/write helpers
20
- * (getAssessmentState/updateAssessmentState) — career-specific
21
- * shape living under `conversations.metadata`.
22
- * - Agent id validation ("career-advisor" | "sesh-planner") and
23
- * default model selection — product decides both; this module
24
- * accepts an already-resolved agentId/modelId.
25
- *
26
- * Callers pass a resolved actor (workspaceId, userId) rather than this
27
- * module resolving one itself — @intelligo-dev/core cannot depend on
28
- * @intelligo-dev/auth (see tests/architecture/dependency-direction.test.ts).
29
- * Every query still filters by workspaceId AND userId internally
30
- * (conversations are USER-PRIVATE within a workspace); the actor is
31
- * never trusted to have done that itself.
32
- *
33
- * Failure is reported by throwing `ConversationServiceError` rather
34
- * than returning a `{ success, error }` envelope — see ./errors.ts.
35
- *
36
- * This module is SERVER-ONLY. Do not import from client components.
8
+ * Callers pass a resolved actor (workspaceId, userId); core cannot depend on
9
+ * `@intelligo-dev/auth`. Conversations are user-private within a workspace,
10
+ * so every query filters by both ids — the caller is never trusted to have
11
+ * done it. Failures throw `ConversationServiceError`.
37
12
  */
38
- import type { Conversation, ConversationActor, InsertMessage, Message, Vote } from "./types";
13
+ import type { Conversation, ConversationActor, InsertMessage, Message, Vote } from "./types.js";
39
14
  /**
40
- * Create a new conversation.
41
- *
42
- * `agentId` and `modelId` are opaque to this module — the product
43
- * decides which agents exist and which model backs a new conversation
44
- * (see the module doc comment). `id` defaults to a fresh UUID when
45
- * omitted.
15
+ * Creates a conversation. `agentId` and `modelId` are opaque to this
16
+ * module; `id` defaults to a fresh UUID. An `id` the actor already owns
17
+ * returns that conversation; one another actor owns is `forbidden`.
46
18
  */
47
19
  export declare function createConversation(actor: ConversationActor, params: {
48
20
  agentId: string;
@@ -59,7 +31,7 @@ export declare function getConversation(actor: ConversationActor, id: string): P
59
31
  export declare function listConversations(actor: ConversationActor, options?: {
60
32
  limit?: number;
61
33
  offset?: number;
62
- }): Promise<Array<Pick<Conversation, "id" | "title" | "agentId" | "updatedAt">>>;
34
+ }): Promise<Array<Pick<Conversation, "id" | "title" | "agentId" | "updatedAt" | "metadata">>>;
63
35
  /** Paginated conversation history with cursor-based pagination. */
64
36
  export declare function getConversationHistory(actor: ConversationActor, params: {
65
37
  limit: number;
@@ -70,6 +42,28 @@ export declare function getConversationHistory(actor: ConversationActor, params:
70
42
  }>;
71
43
  /** Rename a conversation. Throws on an empty title or a title that's too long. */
72
44
  export declare function renameConversation(actor: ConversationActor, id: string, title: string): Promise<Conversation>;
45
+ /**
46
+ * Shallow-merges a patch into the conversation's `metadata`: each top-level
47
+ * key in `patch` replaces the stored one, every other key stays.
48
+ */
49
+ export declare function updateConversationMetadata(actor: ConversationActor, id: string, patch: Record<string, unknown>): Promise<Conversation>;
50
+ export type ConversationVisibility = "private" | "public";
51
+ /** Publish or unpublish a conversation. Public means readable by its id, by anyone. */
52
+ export declare function setConversationVisibility(actor: ConversationActor, id: string, visibility: ConversationVisibility): Promise<Conversation>;
53
+ /**
54
+ * A conversation its owner published, by id alone — no actor, because
55
+ * the reader has none. Everything else about the row stays private:
56
+ * only what a shared page shows is projected.
57
+ */
58
+ export declare function getPublicConversation(id: string): Promise<{
59
+ id: string;
60
+ title: string | null;
61
+ agentId: string;
62
+ createdAt: Date;
63
+ updatedAt: Date;
64
+ }>;
65
+ /** The messages of a published conversation, oldest first. Empty when it is not public. */
66
+ export declare function getPublicMessages(id: string): Promise<Message[]>;
73
67
  /** Delete a conversation and all its messages (CASCADE). */
74
68
  export declare function deleteConversation(actor: ConversationActor, id: string): Promise<void>;
75
69
  /** Delete all conversations for the actor (user-scoped within the workspace). */
@@ -79,31 +73,20 @@ export declare function deleteAllConversations(actor: ConversationActor): Promis
79
73
  /** Get all messages for a conversation, ordered oldest-first. */
80
74
  export declare function getMessages(actor: ConversationActor, conversationId: string): Promise<Message[]>;
81
75
  /**
82
- * Save a batch of messages. Every message's `conversationId` must
83
- * belong to a conversation the actor owns — this is a directly
84
- * reachable persistence entry point (through a Server Action or
85
- * route), not a background job with its own scope check, so a
86
- * workspace-only guard here would let any member insert content into
87
- * a colleague's private conversation. Bumps `updatedAt` on the
76
+ * Saves a batch of messages. Every `conversationId` must belong to a
77
+ * conversation the actor owns — a workspace-only guard would let any member
78
+ * write into a colleague's private conversation. Bumps `updatedAt` on the
88
79
  * touched conversations.
89
80
  */
90
81
  export declare function saveMessages(actor: ConversationActor, messagesToSave: InsertMessage[]): Promise<Message[]>;
91
82
  /**
92
- * Upsert streamed messages after completion — transport-adjacent
93
- * batched upsert, ported from the chat route's post-stream
94
- * persistence step. No actor param: by the time a caller reaches this
95
- * (mid- or post-stream, inside an already-authorized request) the
96
- * conversation's ownership was already verified once (typically via
97
- * `getConversation`/`getMessages` at the top of the request); this
98
- * function's job is the idempotent write, not a second ownership
99
- * check per message.
83
+ * Idempotently upserts streamed messages. Takes no actor: the caller
84
+ * verified ownership once at the top of the already-authorized request.
100
85
  *
101
- * Uses a single multi-row `INSERT ... ON CONFLICT (id) DO UPDATE` so
102
- * an N-message tool loop pays one round-trip instead of 2N. The
103
- * `WHERE` clause on the DO UPDATE keeps the write scoped to
104
- * `conversationId` even if a message id collided across
105
- * conversations (defended against, not expected under normal id
106
- * generation).
86
+ * One multi-row `INSERT ... ON CONFLICT (id) DO UPDATE`, so an N-message
87
+ * tool loop pays one round-trip. The `WHERE` on the update keeps the write
88
+ * scoped to `conversationId` even if a message id collided across
89
+ * conversations.
107
90
  */
108
91
  export declare function upsertMessages(conversationId: string, finishedMessages: Array<{
109
92
  id: string;
@@ -127,6 +110,11 @@ export declare function voteMessage(actor: ConversationActor, params: {
127
110
  messageId: string;
128
111
  type: "up" | "down";
129
112
  }): Promise<void>;
113
+ /** Withdraw a vote. A missing vote is not an error. */
114
+ export declare function clearVote(actor: ConversationActor, params: {
115
+ chatId: string;
116
+ messageId: string;
117
+ }): Promise<void>;
130
118
  /** Get all votes for a conversation. */
131
119
  export declare function getVotes(actor: ConversationActor, chatId: string): Promise<Vote[]>;
132
120
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/conversations/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAMH,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,IAAI,EACL,MAAM,SAAS,CAAC;AAwCjB;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,iBAAiB,EACxB,MAAM,EAAE;IACN,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,GACA,OAAO,CAAC,YAAY,CAAC,CAqBvB;AAED,sDAAsD;AACtD,wBAAsB,eAAe,CACnC,KAAK,EAAE,iBAAiB,EACxB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,YAAY,CAAC,CAEvB;AAED;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,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