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

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 (355) 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 +136 -107
  56. package/dist/db/schema/billing.d.ts.map +1 -1
  57. package/dist/db/schema/billing.js +72 -60
  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 +5 -13
  182. package/dist/identity/index.d.ts.map +1 -1
  183. package/dist/identity/index.js +4 -12
  184. package/dist/identity/index.js.map +1 -1
  185. package/dist/identity/service.d.ts +13 -47
  186. package/dist/identity/service.d.ts.map +1 -1
  187. package/dist/identity/service.js +31 -78
  188. package/dist/identity/service.js.map +1 -1
  189. package/dist/identity/types.d.ts +1 -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 +1 -10
  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/README.md +74 -36
  248. package/src/db/migrations/legacy-chain.json +197 -0
  249. package/src/db/migrations/meta/0000_snapshot.json +4182 -157
  250. package/src/db/migrations/meta/0002_snapshot.json +2478 -368
  251. package/src/db/migrations/meta/_journal.json +6 -279
  252. package/src/db/schema/agents.ts +57 -0
  253. package/src/db/schema/ai.ts +174 -0
  254. package/src/db/schema/auth.ts +183 -0
  255. package/src/db/schema/billing.ts +209 -0
  256. package/src/db/schema/feature-flags.ts +20 -0
  257. package/src/db/schema/identity.ts +250 -0
  258. package/src/db/schema/index.ts +12 -0
  259. package/src/db/schema/notifications.ts +31 -0
  260. package/src/db/schema/usage.ts +269 -0
  261. package/src/db/validate.ts +63 -0
  262. package/src/db/workspace-queries.ts +64 -0
  263. package/src/documents/classifier.ts +61 -0
  264. package/src/documents/errors.ts +44 -0
  265. package/src/documents/index.ts +24 -0
  266. package/src/documents/service.ts +256 -0
  267. package/src/documents/types.ts +24 -0
  268. package/src/email/brand.ts +24 -0
  269. package/src/email/index.ts +19 -0
  270. package/src/email/provider.ts +278 -0
  271. package/src/email/send.ts +169 -0
  272. package/src/email/senders.ts +292 -0
  273. package/src/email/templates/base-layout.tsx +145 -0
  274. package/src/email/templates/index.ts +28 -0
  275. package/src/email/templates/password-reset.tsx +72 -0
  276. package/src/email/templates/payment-failed.tsx +77 -0
  277. package/src/email/templates/quota-warning.tsx +118 -0
  278. package/src/email/templates/subscription-confirmed.tsx +91 -0
  279. package/src/email/templates/trial-expiry.tsx +124 -0
  280. package/src/email/templates/trial-warning.tsx +104 -0
  281. package/src/email/templates/verify-email.tsx +72 -0
  282. package/src/email/templates/welcome.tsx +64 -0
  283. package/src/email/templates/workspace-invitation.tsx +105 -0
  284. package/src/env.ts +180 -0
  285. package/src/identity/audit.ts +65 -0
  286. package/src/identity/errors.ts +44 -0
  287. package/src/identity/index.ts +26 -0
  288. package/src/identity/service.ts +202 -0
  289. package/src/identity/types.ts +28 -0
  290. package/src/index.ts +4 -0
  291. package/src/logger.ts +198 -0
  292. package/src/money.ts +270 -0
  293. package/src/notifications/index.ts +108 -0
  294. package/src/notifications/triggers.ts +158 -0
  295. package/src/notifications/types.ts +18 -0
  296. package/src/prompt.ts +142 -0
  297. package/src/registry.ts +75 -0
  298. package/src/request-context.ts +137 -0
  299. package/src/storage/index.ts +153 -0
  300. package/dist/db/schema/rag.d.ts +0 -171
  301. package/dist/db/schema/rag.d.ts.map +0 -1
  302. package/dist/db/schema/rag.js +0 -42
  303. package/dist/db/schema/rag.js.map +0 -1
  304. package/src/db/migrations/0000_sharp_night_nurse.sql +0 -52
  305. package/src/db/migrations/0001_hesitant_vapor.sql +0 -40
  306. package/src/db/migrations/0002_numerous_lady_vermin.sql +0 -235
  307. package/src/db/migrations/0003_mighty_jean_grey.sql +0 -37
  308. package/src/db/migrations/0004_cynical_grandmaster.sql +0 -2
  309. package/src/db/migrations/0005_careful_switch.sql +0 -8
  310. package/src/db/migrations/0006_tense_blue_marvel.sql +0 -16
  311. package/src/db/migrations/0007_next_squadron_sinister.sql +0 -1
  312. package/src/db/migrations/0008_powerful_scream.sql +0 -39
  313. package/src/db/migrations/0009_sad_ink.sql +0 -1
  314. package/src/db/migrations/0010_shocking_omega_flight.sql +0 -2
  315. package/src/db/migrations/0011_ambiguous_otto_octavius.sql +0 -151
  316. package/src/db/migrations/0011_hnsw_vector_index.sql +0 -17
  317. package/src/db/migrations/0012_user_profiles.sql +0 -30
  318. package/src/db/migrations/0013_trending_seasonal_columns.sql +0 -9
  319. package/src/db/migrations/0014_add_product_type_to_agents.sql +0 -6
  320. package/src/db/migrations/0015_new_v1_tables.sql +0 -149
  321. package/src/db/migrations/0016_document_types.sql +0 -30
  322. package/src/db/migrations/0017_document_metadata.sql +0 -2
  323. package/src/db/migrations/0018_identity_graph.sql +0 -200
  324. package/src/db/migrations/0019_db_driven_prompts.sql +0 -20
  325. package/src/db/migrations/0020_pending_extractions.sql +0 -35
  326. package/src/db/migrations/0021_rag_documents.sql +0 -39
  327. package/src/db/migrations/0022_user_quotas_usage_jsonb.sql +0 -70
  328. package/src/db/migrations/0023_user_facts_user_scoped_unique.sql +0 -17
  329. package/src/db/migrations/0024_user_memories_hnsw.sql +0 -23
  330. package/src/db/migrations/0025_audit_trigger_errcode.sql +0 -21
  331. package/src/db/migrations/0026_user_profile_snapshots_composite_pk.sql +0 -17
  332. package/src/db/migrations/0027_billing_settings_mnt_columns.sql +0 -54
  333. package/src/db/migrations/0028_trial_credits_normalized_email.sql +0 -37
  334. package/src/db/migrations/0029_usage_records_conversation_idx.sql +0 -13
  335. package/src/db/migrations/0030_pending_extractions_composite_idx.sql +0 -11
  336. package/src/db/migrations/0031_rag_documents_hnsw.sql +0 -16
  337. package/src/db/migrations/0032_rate_limit_unique_idx.sql +0 -16
  338. package/src/db/migrations/0033_pending_extractions_partial_idx.sql +0 -18
  339. package/src/db/migrations/0034_rate_limit_count.sql +0 -9
  340. package/src/db/migrations/0035_credit_reservations.sql +0 -24
  341. package/src/db/migrations/0036_executions_audit_jobs.sql +0 -96
  342. package/src/db/migrations/0037_rate_limit_minute_bucket.sql +0 -46
  343. package/src/db/migrations/0038_user_quotas_generic_usage.sql +0 -25
  344. package/src/db/migrations/0039_platform_admin_impersonation.sql +0 -27
  345. package/src/db/migrations/0040_ee_audit_chain.sql +0 -23
  346. package/src/db/migrations/meta/0001_snapshot.json +0 -631
  347. package/src/db/migrations/meta/0003_snapshot.json +0 -2488
  348. package/src/db/migrations/meta/0004_snapshot.json +0 -2500
  349. package/src/db/migrations/meta/0005_snapshot.json +0 -2548
  350. package/src/db/migrations/meta/0006_snapshot.json +0 -2650
  351. package/src/db/migrations/meta/0007_snapshot.json +0 -2657
  352. package/src/db/migrations/meta/0008_snapshot.json +0 -2719
  353. package/src/db/migrations/meta/0009_snapshot.json +0 -2726
  354. package/src/db/migrations/meta/0010_snapshot.json +0 -2739
  355. package/src/db/migrations/meta/0011_snapshot.json +0 -3886
@@ -1,48 +1,16 @@
1
1
  /**
2
- * Identity Service — Server-only
2
+ * Server-only reads and mutations over the user identity graph: fact
3
+ * listing and deletion, a full data export, and the memory-audit trail.
3
4
  *
4
- * Privacy-facing reads and mutations over the user identity graph:
5
- * fact listing/deletion, a full-identity data export, and the
6
- * memory-audit trail that records every mutation to a user's facts,
7
- * memories, and synthesized profile snapshot. Ported from Ignite's
8
- * `actions/identity.ts` (ADR-0008/ADR-0009 precedent — see
9
- * `../documents/service.ts` and `../conversations/service.ts` for the
10
- * same move): the tables (`user_facts`, `user_memories`,
11
- * `user_profile_snapshots`, `user_memory_audit`) always lived in
12
- * `@intelligo-dev/core`'s schema (`../db/schema/identity.ts`, documented
13
- * there as "a platform-level memory primitive — separate from any
14
- * single product"); only the service layer sat in the product
15
- * application.
5
+ * `deleteFact` does not touch the cached profile snapshot; profile synthesis
6
+ * is the product's AI code, so a caller that owns it re-triggers it.
16
7
  *
17
- * What did NOT come with it (stays product/agents-side):
18
- * - `updateMyFactImportance` and the `synthesizeProfile()` re-trigger
19
- * Ignite's `deleteMyFact` ran after deleting — synthesis is
20
- * `@intelligo-dev/agents`' concern (deprecated, dissolving under
21
- * ADR-0008), and this package cannot depend on it. `deleteFact`
22
- * below does not touch the cached snapshot; a caller that also
23
- * owns a synthesis engine re-triggers it after calling this.
24
- *
25
- * Callers pass a resolved actor (workspaceId, userId) rather than this
26
- * module resolving one itself — `@intelligo-dev/core` cannot depend on
27
- * `@intelligo-dev/auth` (see tests/architecture/dependency-direction.test.ts).
28
- * Every query filters by workspaceId AND userId internally; the actor
29
- * is never trusted to have done that itself.
30
- *
31
- * Every mutation writes a `user_memory_audit` row via the internal
32
- * `recordMemoryAudit` (./audit.ts). See that file's doc comment for
33
- * why the writer lives here rather than in `@intelligo-dev/audit`, which
34
- * is where ADR-0008 names its destination — the allowlist only grants
35
- * audit -> core, never core -> audit
36
- * (tests/architecture/dependency-direction.test.ts), so
37
- * `@intelligo-dev/audit` exports the event *contract* only.
38
- *
39
- * Failure is reported by throwing `IdentityServiceError` rather than
40
- * returning a `{ success, error }` envelope — see ./errors.ts.
41
- *
42
- * 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`. Every query filters by both ids. Every mutation
10
+ * writes a `user_memory_audit` row. Failures throw `IdentityServiceError`.
43
11
  */
44
- import type { UserFact, UserMemoryAuditRow } from "../db/schema";
45
- import type { IdentityActor, IdentityExport } from "./types";
12
+ import type { UserFact, UserMemoryAuditRow } from "../db/schema/index.js";
13
+ import type { IdentityActor, IdentityExport } from "./types.js";
46
14
  /** List the actor's facts, most important and most confident first. */
47
15
  export declare function listFacts(actor: IdentityActor): Promise<UserFact[]>;
48
16
  /**
@@ -56,15 +24,13 @@ export declare function getAuditTrail(actor: IdentityActor, options?: {
56
24
  /**
57
25
  * Delete a fact and record the deletion in the audit trail. Throws
58
26
  * `invalid_input` for an empty id and `not_found` for anything outside
59
- * the actor's scope (see `verifyFact`). Does NOT re-trigger profile
60
- * synthesis — see the module doc comment.
27
+ * the actor's scope. Does not re-trigger profile synthesis.
61
28
  */
62
29
  export declare function deleteFact(actor: IdentityActor, factId: string): Promise<void>;
63
30
  /**
64
- * Aggregate the actor's full identity graph — facts, memories, latest
65
- * profile snapshot, and full audit trail — for a data-export flow.
66
- * Records its own audit row (action "export"): the export operation
67
- * audits itself, same as the ported Ignite implementation.
31
+ * The actor's full identity graph — facts, memories, latest profile
32
+ * snapshot and audit trail — for a "download my data" flow. Records its own
33
+ * audit row (action "export").
68
34
  */
69
35
  export declare function exportIdentity(actor: IdentityActor): Promise<IdentityExport>;
70
36
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/identity/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAUH,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGjE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAuC7D,uEAAuE;AACvE,wBAAsB,SAAS,CAAC,KAAK,EAAE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,CA+DzB"}
@@ -1,61 +1,23 @@
1
1
  /**
2
- * Identity Service — Server-only
2
+ * Server-only reads and mutations over the user identity graph: fact
3
+ * listing and deletion, a full data export, and the memory-audit trail.
3
4
  *
4
- * Privacy-facing reads and mutations over the user identity graph:
5
- * fact listing/deletion, a full-identity data export, and the
6
- * memory-audit trail that records every mutation to a user's facts,
7
- * memories, and synthesized profile snapshot. Ported from Ignite's
8
- * `actions/identity.ts` (ADR-0008/ADR-0009 precedent — see
9
- * `../documents/service.ts` and `../conversations/service.ts` for the
10
- * same move): the tables (`user_facts`, `user_memories`,
11
- * `user_profile_snapshots`, `user_memory_audit`) always lived in
12
- * `@intelligo-dev/core`'s schema (`../db/schema/identity.ts`, documented
13
- * there as "a platform-level memory primitive — separate from any
14
- * single product"); only the service layer sat in the product
15
- * application.
5
+ * `deleteFact` does not touch the cached profile snapshot; profile synthesis
6
+ * is the product's AI code, so a caller that owns it re-triggers it.
16
7
  *
17
- * What did NOT come with it (stays product/agents-side):
18
- * - `updateMyFactImportance` and the `synthesizeProfile()` re-trigger
19
- * Ignite's `deleteMyFact` ran after deleting — synthesis is
20
- * `@intelligo-dev/agents`' concern (deprecated, dissolving under
21
- * ADR-0008), and this package cannot depend on it. `deleteFact`
22
- * below does not touch the cached snapshot; a caller that also
23
- * owns a synthesis engine re-triggers it after calling this.
24
- *
25
- * Callers pass a resolved actor (workspaceId, userId) rather than this
26
- * module resolving one itself — `@intelligo-dev/core` cannot depend on
27
- * `@intelligo-dev/auth` (see tests/architecture/dependency-direction.test.ts).
28
- * Every query filters by workspaceId AND userId internally; the actor
29
- * is never trusted to have done that itself.
30
- *
31
- * Every mutation writes a `user_memory_audit` row via the internal
32
- * `recordMemoryAudit` (./audit.ts). See that file's doc comment for
33
- * why the writer lives here rather than in `@intelligo-dev/audit`, which
34
- * is where ADR-0008 names its destination — the allowlist only grants
35
- * audit -> core, never core -> audit
36
- * (tests/architecture/dependency-direction.test.ts), so
37
- * `@intelligo-dev/audit` exports the event *contract* only.
38
- *
39
- * Failure is reported by throwing `IdentityServiceError` rather than
40
- * returning a `{ success, error }` envelope — see ./errors.ts.
41
- *
42
- * 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`. Every query filters by both ids. Every mutation
10
+ * writes a `user_memory_audit` row. Failures throw `IdentityServiceError`.
43
11
  */
44
12
  import { and, desc, eq } from "drizzle-orm";
45
- import { db } from "../db";
46
- import { userFacts, userMemories, userProfileSnapshots, userMemoryAudit, } from "../db/schema";
47
- import { recordMemoryAudit } from "./audit";
48
- import { IdentityServiceError } from "./errors";
49
- // ---------------------------------------------------------------------------
50
- // Internal helpers
51
- // ---------------------------------------------------------------------------
13
+ import { db } from "../db/index.js";
14
+ import { userFacts, userMemories, userProfileSnapshots, userMemoryAudit, } from "../db/schema/index.js";
15
+ import { recordMemoryAudit } from "./audit.js";
16
+ import { IdentityServiceError } from "./errors.js";
52
17
  /**
53
- * Verify fact ownership and return the row. Throws
54
- * IdentityServiceError("not_found") for both a missing fact and one
55
- * owned by a different user/workspace — a fact belonging to someone
56
- * else should be indistinguishable from one that doesn't exist at all
57
- * (same reasoning as `../conversations/service.ts`'s
58
- * `verifyConversation`).
18
+ * Returns the fact if the actor owns it. Throws
19
+ * IdentityServiceError("not_found") otherwise — another user's fact is
20
+ * indistinguishable from a missing one.
59
21
  */
60
22
  async function verifyFact(actor, factId) {
61
23
  const [fact] = await db
@@ -70,9 +32,6 @@ async function verifyFact(actor, factId) {
70
32
  }
71
33
  return fact;
72
34
  }
73
- // ---------------------------------------------------------------------------
74
- // Reads
75
- // ---------------------------------------------------------------------------
76
35
  /** List the actor's facts, most important and most confident first. */
77
36
  export async function listFacts(actor) {
78
37
  return db
@@ -98,41 +57,35 @@ export async function getAuditTrail(actor, options) {
98
57
  .orderBy(desc(userMemoryAudit.createdAt))
99
58
  .limit(limit);
100
59
  }
101
- // ---------------------------------------------------------------------------
102
- // Mutations
103
- // ---------------------------------------------------------------------------
104
60
  /**
105
61
  * Delete a fact and record the deletion in the audit trail. Throws
106
62
  * `invalid_input` for an empty id and `not_found` for anything outside
107
- * the actor's scope (see `verifyFact`). Does NOT re-trigger profile
108
- * synthesis — see the module doc comment.
63
+ * the actor's scope. Does not re-trigger profile synthesis.
109
64
  */
110
65
  export async function deleteFact(actor, factId) {
111
66
  if (!factId || factId.trim().length === 0) {
112
67
  throw new IdentityServiceError("invalid_input", "factId is required");
113
68
  }
114
69
  const existing = await verifyFact(actor, factId);
115
- await db.delete(userFacts).where(eq(userFacts.id, factId));
116
- await recordMemoryAudit({
117
- userId: actor.userId,
118
- workspaceId: actor.workspaceId,
119
- targetKind: "fact",
120
- targetId: factId,
121
- action: "delete",
122
- actorKind: "user",
123
- actorId: actor.userId,
124
- beforeValue: existing,
125
- reason: "user requested deletion",
70
+ await db.transaction(async (tx) => {
71
+ await tx.delete(userFacts).where(eq(userFacts.id, factId));
72
+ await recordMemoryAudit({
73
+ userId: actor.userId,
74
+ workspaceId: actor.workspaceId,
75
+ targetKind: "fact",
76
+ targetId: factId,
77
+ action: "delete",
78
+ actorKind: "user",
79
+ actorId: actor.userId,
80
+ beforeValue: existing,
81
+ reason: "user requested deletion",
82
+ }, tx);
126
83
  });
127
84
  }
128
- // ---------------------------------------------------------------------------
129
- // Export — full identity dump for GDPR / "download my data"
130
- // ---------------------------------------------------------------------------
131
85
  /**
132
- * Aggregate the actor's full identity graph — facts, memories, latest
133
- * profile snapshot, and full audit trail — for a data-export flow.
134
- * Records its own audit row (action "export"): the export operation
135
- * audits itself, same as the ported Ignite implementation.
86
+ * The actor's full identity graph — facts, memories, latest profile
87
+ * snapshot and audit trail — for a "download my data" flow. Records its own
88
+ * audit row (action "export").
136
89
  */
137
90
  export async function exportIdentity(actor) {
138
91
  // Recorded before the reads so the export's own audit row is part of
@@ -1 +1 @@
1
- {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/identity/service.ts"],"names":[],"mappings":"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CAAC,YAAY,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAChD,CACF;QACH,EAAE;aACC,MAAM,EAAE;aACR,IAAI,CAAC,oBAAoB,CAAC;aAC1B,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAC7C,EAAE,CAAC,oBAAoB,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CACxD,CACF;aACA,KAAK,CAAC,CAAC,CAAC;QACX,EAAE;aACC,MAAM,EAAE;aACR,IAAI,CAAC,eAAe,CAAC;aACrB,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACxC,EAAE,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CACnD,CACF;aACA,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;KAC5C,CAAC,CAAC;IAEH,OAAO;QACL,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE;QAC1D,KAAK;QACL,QAAQ;QACR,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,IAAI;QACjC,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -1,7 +1,4 @@
1
- /**
2
- * Shared types for the identity service.
3
- */
4
- import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema";
1
+ import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema/index.js";
5
2
  export type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow };
6
3
  /** Resolved actor identity — every query is scoped to this pair. */
7
4
  export type IdentityActor = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAE9E,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;AAE9E,oEAAoE;AACpE,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1C,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACrC,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC"}
@@ -1,5 +1,2 @@
1
- /**
2
- * Shared types for the identity service.
3
- */
4
1
  export {};
5
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
- export declare const version = "0.0.0";
2
- export * from "./db";
1
+ export * from "./db/index.js";
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,cAAc,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -1,11 +1,4 @@
1
- export const version = "0.0.0";
2
- // Re-export database client
3
- export * from "./db";
4
- // Email module -- use subpath import: @intelligo-dev/core/email
5
- // Notifications module -- use subpath import: @intelligo-dev/core/notifications
6
- // Conversations module -- use subpath import: @intelligo-dev/core/conversations
7
- // Documents module -- use subpath import: @intelligo-dev/core/documents
8
- // Identity module -- use subpath import: @intelligo-dev/core/identity
9
- // Logger -- use subpath import: @intelligo-dev/core/logger
10
- // Env -- use subpath import: @intelligo-dev/core/env
1
+ export * from "./db/index.js";
2
+ // Everything else is a subpath import: @intelligo-dev/core/email,
3
+ // /notifications, /conversations, /documents, /identity, /logger, /env.
11
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,4BAA4B;AAC5B,cAAc,MAAM,CAAC;AAErB,gEAAgE;AAChE,gFAAgF;AAChF,gFAAgF;AAChF,wEAAwE;AACxE,sEAAsE;AACtE,2DAA2D;AAC3D,qDAAqD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AAErB,kEAAkE;AAClE,wEAAwE"}
package/dist/logger.d.ts CHANGED
@@ -1,13 +1,7 @@
1
1
  /**
2
- * Structured Logger with PII Redaction (Pino-backed)
2
+ * Structured pino logger. Emails and ids are redacted in production and
3
+ * passed through in development; credential fields are always redacted.
3
4
  *
4
- * A structured logger that:
5
- * - Uses pino for high-performance JSON logging in production
6
- * - Redacts PII in production (emails, workspace IDs, UUIDs)
7
- * - Passes through unredacted in development for debugging
8
- * - Maintains the same API as the previous custom logger
9
- *
10
- * Usage:
11
5
  * ```typescript
12
6
  * import { createLogger } from "@intelligo-dev/core/logger";
13
7
  * const log = createLogger("MyModule");
@@ -18,14 +12,9 @@
18
12
  */
19
13
  import pino from "pino";
20
14
  /**
21
- * Field name fragments whose values are always replaced with [REDACTED]
22
- * regardless of environment. These cover credentials and secrets — never
23
- * appropriate to log even in development. Email/id redaction is a
24
- * separate concern (production-only PII protection).
25
- *
26
- * Exported so a consumer's Sentry PII scrubber
27
- * shares the same field list — a secret name added here is stripped
28
- * from both the log stream and the Sentry event in one move.
15
+ * Field name fragments whose values are always replaced with [REDACTED], in
16
+ * every environment. Exported so an error reporter's scrubber can share the
17
+ * list.
29
18
  */
30
19
  export declare const CREDENTIAL_KEY_FRAGMENTS: readonly ["password", "passwd", "secret", "token", "apikey", "api_key", "authorization", "auth_header", "cookie", "session_token", "session_secret", "credit_card", "creditcard", "card_number", "cvv"];
31
20
  /** True when `key` contains any credential fragment (case-insensitive substring). */
@@ -40,8 +29,8 @@ declare class Logger {
40
29
  }
41
30
  export declare function createLogger(context: string): Logger;
42
31
  /**
43
- * Create a logger that writes to a custom pino destination.
44
- * Used for testing — allows capturing log output in a writable stream.
32
+ * A logger writing to a custom pino destination, for capturing output in
33
+ * tests.
45
34
  * @internal
46
35
  */
47
36
  export declare function _createLoggerWithStream(context: string, stream: pino.DestinationStream): Logger;
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AA0BxB;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,yMAgB3B,CAAC;AAEX,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpD;AAiDD,cAAM,MAAM;IACV,OAAO,CAAC,IAAI,CAAc;gBAEd,OAAO,EAAE,MAAM;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOtD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,IAAI,CAAC,iBAAiB,GAC7B,MAAM,CAiBR;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,eAAO,MAAM,MAAM,QAAsB,CAAC"}
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AA0BxB;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,yMAgB3B,CAAC;AAEX,qFAAqF;AACrF,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpD;AA4DD,cAAM,MAAM;IACV,OAAO,CAAC,IAAI,CAAc;gBAEd,OAAO,EAAE,MAAM;IAI3B,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQpD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAQrD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAOtD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,IAAI,CAAC,iBAAiB,GAC7B,MAAM,CAgBR;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,eAAO,MAAM,MAAM,QAAsB,CAAC"}
package/dist/logger.js CHANGED
@@ -1,13 +1,7 @@
1
1
  /**
2
- * Structured Logger with PII Redaction (Pino-backed)
2
+ * Structured pino logger. Emails and ids are redacted in production and
3
+ * passed through in development; credential fields are always redacted.
3
4
  *
4
- * A structured logger that:
5
- * - Uses pino for high-performance JSON logging in production
6
- * - Redacts PII in production (emails, workspace IDs, UUIDs)
7
- * - Passes through unredacted in development for debugging
8
- * - Maintains the same API as the previous custom logger
9
- *
10
- * Usage:
11
5
  * ```typescript
12
6
  * import { createLogger } from "@intelligo-dev/core/logger";
13
7
  * const log = createLogger("MyModule");
@@ -43,14 +37,9 @@ function redactId(id) {
43
37
  return `${id.slice(0, 4)}...${id.slice(-4)}`;
44
38
  }
45
39
  /**
46
- * Field name fragments whose values are always replaced with [REDACTED]
47
- * regardless of environment. These cover credentials and secrets — never
48
- * appropriate to log even in development. Email/id redaction is a
49
- * separate concern (production-only PII protection).
50
- *
51
- * Exported so a consumer's Sentry PII scrubber
52
- * shares the same field list — a secret name added here is stripped
53
- * from both the log stream and the Sentry event in one move.
40
+ * Field name fragments whose values are always replaced with [REDACTED], in
41
+ * every environment. Exported so an error reporter's scrubber can share the
42
+ * list.
54
43
  */
55
44
  export const CREDENTIAL_KEY_FRAGMENTS = [
56
45
  "password",
@@ -74,41 +63,49 @@ export function isCredentialKey(key) {
74
63
  const lower = key.toLowerCase();
75
64
  return CREDENTIAL_KEY_FRAGMENTS.some((needle) => lower.includes(needle));
76
65
  }
77
- function redactData(data) {
78
- const redacted = {};
79
- for (const [key, value] of Object.entries(data)) {
80
- // Always-redacted fields: credentials, tokens, secrets — these
81
- // never appear in logs, even in dev. Catches accidental
82
- // log.info("login attempt", { password: ... }) drift.
83
- if (isCredentialKey(key)) {
84
- redacted[key] = "[REDACTED]";
85
- continue;
86
- }
87
- // PII redaction (email/id) is production-only so dev debugging
88
- // still works against real values.
89
- if (!isProduction) {
90
- redacted[key] = value;
91
- continue;
92
- }
93
- if (typeof value === "string") {
94
- if (key.toLowerCase().includes("email")) {
95
- redacted[key] = redactEmail(value);
96
- }
97
- else if (key.toLowerCase().includes("id") ||
98
- key.toLowerCase().includes("workspace")) {
99
- redacted[key] = redactId(value);
100
- }
101
- else {
102
- redacted[key] = value;
103
- }
66
+ /**
67
+ * An identifier's key: `id`, `userId`, `workspace_id`. Matched as a
68
+ * suffix, not a substring, so `provider` or `paid` keep their values.
69
+ */
70
+ function isIdKey(key) {
71
+ return /^id$|[a-z0-9]Id$|[_-]id$/.test(key) || /workspace/i.test(key);
72
+ }
73
+ /** Nested objects and arrays are walked, to this depth, so a credential inside one is still found. */
74
+ const MAX_REDACT_DEPTH = 6;
75
+ function redactValue(key, value, depth) {
76
+ if (isCredentialKey(key))
77
+ return "[REDACTED]";
78
+ if (value !== null && typeof value === "object") {
79
+ if (depth >= MAX_REDACT_DEPTH)
80
+ return "[TRUNCATED]";
81
+ if (Array.isArray(value)) {
82
+ return value.map((item) => redactValue(key, item, depth + 1));
104
83
  }
105
- else {
106
- redacted[key] = value;
84
+ if (Object.getPrototypeOf(value) === Object.prototype) {
85
+ return redactObject(value, depth + 1);
107
86
  }
87
+ return value;
88
+ }
89
+ // Email and id redaction is production-only, so development logs show
90
+ // real values.
91
+ if (!isProduction || typeof value !== "string")
92
+ return value;
93
+ if (key.toLowerCase().includes("email"))
94
+ return redactEmail(value);
95
+ if (isIdKey(key))
96
+ return redactId(value);
97
+ return value;
98
+ }
99
+ function redactObject(data, depth) {
100
+ const redacted = {};
101
+ for (const [key, value] of Object.entries(data)) {
102
+ redacted[key] = redactValue(key, value, depth);
108
103
  }
109
104
  return redacted;
110
105
  }
111
- /** Base pino instance */
106
+ function redactData(data) {
107
+ return redactObject(data, 0);
108
+ }
112
109
  const baseLogger = pino({
113
110
  level: isProduction ? "info" : "debug",
114
111
  formatters: {
@@ -159,8 +156,8 @@ export function createLogger(context) {
159
156
  return new Logger(context);
160
157
  }
161
158
  /**
162
- * Create a logger that writes to a custom pino destination.
163
- * Used for testing — allows capturing log output in a writable stream.
159
+ * A logger writing to a custom pino destination, for capturing output in
160
+ * tests.
164
161
  * @internal
165
162
  */
166
163
  export function _createLoggerWithStream(context, stream) {
@@ -174,7 +171,6 @@ export function _createLoggerWithStream(context, stream) {
174
171
  timestamp: false,
175
172
  }, stream);
176
173
  const instance = new Logger(context);
177
- // Override the internal pino child with one writing to custom stream
178
174
  instance.pino = customBase.child({ module: context });
179
175
  return instance;
180
176
  }
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,CAAC;AAE3D;;;GAGG;AACH,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAChC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,CAAC,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,MAAM,EAAE,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,SAAS,QAAQ,CAAC,EAAU;IAC1B,IAAI,CAAC,YAAY;QAAE,OAAO,EAAE,CAAC;IAC7B,IAAI,EAAE,CAAC,MAAM,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,eAAe;IACf,aAAa;IACb,QAAQ;IACR,eAAe;IACf,gBAAgB;IAChB,aAAa;IACb,YAAY;IACZ,aAAa;IACb,KAAK;CACG,CAAC;AAEX,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,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,CAAC;AAClB,CAAC;AAED,OAAO,EAAE,MAAM,EAAE,CAAC;AAClB,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Money, in one unit, with the currency attached. Imports nothing:
3
+ * `@intelligo-dev/executions/pricing` is a zero-import leaf that client
4
+ * bundles reach, and it needs these types.
5
+ *
6
+ * **Micros, not minor units.** A chat turn on a cheap model costs a
7
+ * fraction of a cent; rounding it to whole cents overcharges by more than a
8
+ * third on every request.
9
+ *
10
+ * **Currency on the amount, not in a global.** A bare `number` lets one
11
+ * unit be sold as another; here the currency travels with the amount and
12
+ * `add` refuses to mix two.
13
+ */
14
+ declare const isoTag: unique symbol;
15
+ declare const microsTag: unique symbol;
16
+ /** An ISO-4217 alphabetic code, upper-cased and validated. */
17
+ export type CurrencyCode = string & {
18
+ readonly [isoTag]: true;
19
+ };
20
+ /** An integer number of millionths of one major currency unit. */
21
+ export type Micros = number & {
22
+ readonly [microsTag]: true;
23
+ };
24
+ /** An amount and the currency it is denominated in. */
25
+ export type Money = {
26
+ readonly amount: Micros;
27
+ readonly currency: CurrencyCode;
28
+ };
29
+ /** Thrown for every misuse in this module, so callers can catch one type. */
30
+ export declare class MoneyError extends Error {
31
+ readonly code: string;
32
+ constructor(code: string, message: string);
33
+ }
34
+ /**
35
+ * Validates and normalises an ISO-4217 code. Shape only: a list would go
36
+ * stale and block a deployment selling in a code it does not know.
37
+ * `minorExponent` gives an unknown code its default.
38
+ */
39
+ export declare function currency(code: string): CurrencyCode;
40
+ /**
41
+ * An integer count of micros, up to `Number.MAX_SAFE_INTEGER` (about 9
42
+ * billion major units) — low enough to catch a value in the wrong unit.
43
+ */
44
+ export declare function micros(value: number): Micros;
45
+ export declare function money(amount: number, code: string | CurrencyCode): Money;
46
+ /** How many decimal places this currency's minor unit has. */
47
+ export declare function minorExponent(code: CurrencyCode): 0 | 2 | 3;
48
+ /** `12.34` USD → `12_340_000` micros. */
49
+ export declare function fromMajor(value: number, code: string | CurrencyCode): Money;
50
+ /** `1234` cents → `12_340_000` micros. */
51
+ export declare function fromMinor(value: number, code: string | CurrencyCode): Money;
52
+ /**
53
+ * The integer a payment provider wants: whole units for a zero-decimal
54
+ * currency, hundredths for most, thousandths for a few.
55
+ *
56
+ * Rounds up. A fraction of a minor unit is money the deployment has
57
+ * already spent, and rounding it away means eating the difference on
58
+ * every transaction.
59
+ */
60
+ export declare function toMinor(value: Money): number;
61
+ /** The amount as a plain decimal number, for display and for charts. */
62
+ export declare function toMajor(value: Money): number;
63
+ export declare const zero: (code: string | CurrencyCode) => Money;
64
+ export declare function add(a: Money, b: Money): Money;
65
+ export declare function subtract(a: Money, b: Money): Money;
66
+ /** Scale by a plain factor — a margin multiplier, a percentage, a count. */
67
+ export declare function multiply(value: Money, factor: number): Money;
68
+ export declare function compare(a: Money, b: Money): number;
69
+ export declare const isZero: (value: Money) => boolean;
70
+ export declare const isNegative: (value: Money) => boolean;
71
+ /**
72
+ * Convert at an explicit rate, expressed in micros so the rate itself
73
+ * carries no float error: `3_450_000_000` is 3450.0.
74
+ *
75
+ * There is no ambient rate and no default. A framework that guesses an
76
+ * exchange rate is inventing money.
77
+ */
78
+ export declare function convert(value: Money, to: string | CurrencyCode, rateMicros: number): Money;
79
+ /**
80
+ * How many decimals an amount needs to be legible.
81
+ *
82
+ * The currency's own minor unit, except when that would render a real
83
+ * charge as nothing: one chat turn costs a fraction of a cent, and a
84
+ * usage page that says every request cost `$0.00` is worse than one
85
+ * that says `$0.0048`. Below the minor unit the amount is shown to two
86
+ * significant digits, capped at the six decimals micros can hold.
87
+ */
88
+ export declare function displayFractionDigits(value: Money): number;
89
+ /**
90
+ * Formats for a human, in their locale. `Intl` owns the symbol, its
91
+ * position and the separators.
92
+ */
93
+ export declare function formatMoney(value: Money, locale: string, options?: Intl.NumberFormatOptions): string;
94
+ export {};
95
+ //# sourceMappingURL=money.d.ts.map
@@ -0,0 +1 @@
1
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