@intelligo-dev/core 1.0.0-beta.2 → 1.0.0-beta.5

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 (79) hide show
  1. package/README.md +44 -0
  2. package/dist/conversations/index.d.ts +3 -3
  3. package/dist/conversations/index.js +2 -2
  4. package/dist/conversations/service.d.ts +4 -5
  5. package/dist/conversations/service.d.ts.map +1 -1
  6. package/dist/conversations/service.js +6 -7
  7. package/dist/conversations/service.js.map +1 -1
  8. package/dist/conversations/types.d.ts +1 -1
  9. package/dist/db/client.js +1 -1
  10. package/dist/db/index.d.ts +3 -3
  11. package/dist/db/index.js +3 -3
  12. package/dist/db/schema/agents.js +4 -4
  13. package/dist/db/schema/agents.js.map +1 -1
  14. package/dist/db/schema/ai.d.ts +8 -9
  15. package/dist/db/schema/ai.d.ts.map +1 -1
  16. package/dist/db/schema/ai.js +14 -15
  17. package/dist/db/schema/ai.js.map +1 -1
  18. package/dist/db/schema/billing.js +1 -1
  19. package/dist/db/schema/identity.js +1 -1
  20. package/dist/db/schema/index.d.ts +9 -9
  21. package/dist/db/schema/index.js +9 -9
  22. package/dist/db/schema/rag.d.ts +3 -4
  23. package/dist/db/schema/rag.d.ts.map +1 -1
  24. package/dist/db/schema/rag.js +3 -4
  25. package/dist/db/schema/rag.js.map +1 -1
  26. package/dist/db/schema/usage.js +3 -3
  27. package/dist/db/validate.js +1 -1
  28. package/dist/documents/classifier.d.ts +3 -2
  29. package/dist/documents/classifier.d.ts.map +1 -1
  30. package/dist/documents/classifier.js +16 -7
  31. package/dist/documents/classifier.js.map +1 -1
  32. package/dist/documents/index.d.ts +4 -4
  33. package/dist/documents/index.js +3 -3
  34. package/dist/documents/service.d.ts +1 -1
  35. package/dist/documents/service.js +4 -4
  36. package/dist/email/index.d.ts +4 -4
  37. package/dist/email/index.js +4 -4
  38. package/dist/email/send.d.ts +1 -1
  39. package/dist/email/send.js +1 -1
  40. package/dist/email/senders.d.ts +1 -1
  41. package/dist/email/senders.js +2 -2
  42. package/dist/email/templates/index.d.ts +10 -10
  43. package/dist/email/templates/index.js +10 -10
  44. package/dist/email/templates/password-reset.js +1 -1
  45. package/dist/email/templates/payment-failed.js +1 -1
  46. package/dist/email/templates/quota-warning.js +1 -1
  47. package/dist/email/templates/subscription-confirmed.js +1 -1
  48. package/dist/email/templates/trial-expiry.js +1 -1
  49. package/dist/email/templates/trial-warning.js +1 -1
  50. package/dist/email/templates/verify-email.js +1 -1
  51. package/dist/email/templates/welcome.js +1 -1
  52. package/dist/email/templates/workspace-invitation.js +1 -1
  53. package/dist/identity/audit.d.ts +1 -1
  54. package/dist/identity/audit.js +3 -3
  55. package/dist/identity/index.d.ts +3 -3
  56. package/dist/identity/index.js +2 -2
  57. package/dist/identity/service.d.ts +10 -10
  58. package/dist/identity/service.js +12 -12
  59. package/dist/identity/types.d.ts +1 -1
  60. package/dist/index.d.ts +1 -2
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +6 -2
  63. package/dist/index.js.map +1 -1
  64. package/dist/money.d.ts +112 -0
  65. package/dist/money.d.ts.map +1 -0
  66. package/dist/money.js +217 -0
  67. package/dist/money.js.map +1 -0
  68. package/dist/notifications/index.d.ts +3 -3
  69. package/dist/notifications/index.js +3 -3
  70. package/dist/notifications/triggers.js +2 -2
  71. package/dist/registry.d.ts +61 -0
  72. package/dist/registry.d.ts.map +1 -0
  73. package/dist/registry.js +92 -0
  74. package/dist/registry.js.map +1 -0
  75. package/dist/request-context.d.ts +66 -0
  76. package/dist/request-context.d.ts.map +1 -0
  77. package/dist/request-context.js +99 -0
  78. package/dist/request-context.js.map +1 -0
  79. package/package.json +35 -10
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * RAG documents schema (Phase H).
3
3
  *
4
- * Single shared table that backs every collection in
5
- * @intelligo-dev/agents/rag. Each collection (e.g., career.universities,
6
- * career.scholarships, career.majors) lives as a `collection` slug
7
- * filter on this table — so adding a new collection means writing a
4
+ * Single shared table that backs every RAG collection a product
5
+ * defines. Each collection (e.g., `catalogue.products`,
6
+ * `docs.articles`) lives as a `collection` slug filter on this table — so adding a new collection means writing a
8
7
  * Collection<TMeta> instance, not a migration.
9
8
  *
10
9
  * Schema choices:
@@ -1 +1 @@
1
- {"version":3,"file":"rag.js","sourceRoot":"","sources":["../../../src/db/schema/rag.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,KAAK,EACL,KAAK,EACL,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,qDAAqD,CAAC;AAE7E,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CACjC,eAAe,EACf;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACxC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;IAE/B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE;IAClC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACjD,SAAS,EAAE,MAAM,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IAEvC,SAAS,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;IACzD,SAAS,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CAC1D,EACD,CAAC,KAAK,EAAE,EAAE,CAAC;IACT,KAAK,CAAC,8BAA8B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1D,WAAW,CAAC,wCAAwC,CAAC,CAAC,EAAE,CACtD,KAAK,CAAC,UAAU,EAChB,KAAK,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8,7 @@
8
8
  * Pattern: snake_case columns in PostgreSQL, camelCase TypeScript API (via Drizzle mapping)
9
9
  */
10
10
  import { pgTable, text, timestamp, integer, real, index, unique, jsonb, } from "drizzle-orm/pg-core";
11
- import { organization, users } from "./auth";
11
+ import { organization, users } from "./auth.js";
12
12
  /**
13
13
  * Usage Records table - Per-request token tracking (QUOTA-05)
14
14
  *
@@ -26,7 +26,7 @@ export const usageRecords = pgTable("usage_records", {
26
26
  .references(() => users.id, { onDelete: "cascade" }),
27
27
  type: text("type").notNull(), // "ai_tokens", "api_call"
28
28
  model: text("model"), // "gpt-4o", "gpt-4o-mini"
29
- agent: text("agent"), // "career-advisor", "sesh"
29
+ agent: text("agent"), // the product's agent slug
30
30
  inputTokens: integer("input_tokens").notNull().default(0),
31
31
  outputTokens: integer("output_tokens").notNull().default(0),
32
32
  totalTokens: integer("total_tokens").notNull().default(0),
@@ -206,7 +206,7 @@ export const userQuotas = pgTable("user_quotas", {
206
206
  * Per-action counter map, keyed by the product's own action slugs
207
207
  * (`usage["chat"] = 42`). This is the only counter storage.
208
208
  *
209
- * Three career-specific integer columns — chat_messages_used,
209
+ * Three product-specific integer columns — chat_messages_used,
210
210
  * assessments_used, reports_used — used to sit beside it, written
211
211
  * by every product and read in preference to this map. Migration
212
212
  * 0038 backfilled them into the map and dropped them: a public
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Validates that the database is connected and tables exist before allowing the app to start.
5
5
  */
6
- import { db } from "./client";
6
+ import { db } from "./client.js";
7
7
  import { sql } from "drizzle-orm";
8
8
  /**
9
9
  * Check if database connection is valid and tables exist
@@ -4,8 +4,9 @@
4
4
  * Vertical product packages register their title patterns here; the
5
5
  * document persistence API (./service.ts) uses the same registry to
6
6
  * derive agent labels and the "report" filter. Kept in its own module
7
- * with zero imports so client-safe code and tests can load it without
8
- * dragging in the server-only persistence chain (db).
7
+ * so client-safe code and tests can load it without dragging in the
8
+ * server-only persistence chain (db) — its one import, ../registry, is
9
+ * itself dependency-free for the same reason.
9
10
  *
10
11
  * Ported from @intelligo-dev/agents/documents/classifier (ADR-0009) —
11
12
  * unchanged.
@@ -1 +1 @@
1
- {"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../src/documents/classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB;kDAC8C;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAIF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAE1E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG;IACpD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAQA;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAKT;AAED,wBAAgB,8BAA8B,IAAI,SAAS,oBAAoB,EAAE,CAEhF;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
1
+ {"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../src/documents/classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,MAAM,MAAM,oBAAoB,GAAG;IACjC,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB;kDAC8C;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAWF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,CAE1E;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG;IACpD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;CACpB,CAQA;AAED,sFAAsF;AACtF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAKT;AAED,wBAAgB,8BAA8B,IAAI,SAAS,oBAAoB,EAAE,CAEhF;AAED,wBAAgB,4BAA4B,IAAI,IAAI,CAEnD"}
@@ -4,19 +4,28 @@
4
4
  * Vertical product packages register their title patterns here; the
5
5
  * document persistence API (./service.ts) uses the same registry to
6
6
  * derive agent labels and the "report" filter. Kept in its own module
7
- * with zero imports so client-safe code and tests can load it without
8
- * dragging in the server-only persistence chain (db).
7
+ * so client-safe code and tests can load it without dragging in the
8
+ * server-only persistence chain (db) — its one import, ../registry, is
9
+ * itself dependency-free for the same reason.
9
10
  *
10
11
  * Ported from @intelligo-dev/agents/documents/classifier (ADR-0009) —
11
12
  * unchanged.
12
13
  */
13
- const registry = [];
14
+ import { createRegistry } from "../registry.js";
15
+ /**
16
+ * Keyed by product slug rather than appended, so a composition root
17
+ * that runs twice — or two copies of it, which is the case this
18
+ * registry now survives — replaces the entry instead of matching the
19
+ * same patterns twice. Insertion order is preserved, so first-match
20
+ * classification is unchanged.
21
+ */
22
+ const registry = createRegistry("core/document-patterns");
14
23
  export function registerDocumentPatterns(entry) {
15
- registry.push(entry);
24
+ registry.set(entry.productSlug, entry);
16
25
  }
17
26
  export function classifyDocumentTitle(title) {
18
27
  const lower = title.toLowerCase();
19
- for (const entry of registry) {
28
+ for (const entry of registry.values()) {
20
29
  if (entry.patterns.some((p) => lower.includes(p))) {
21
30
  return { productSlug: entry.productSlug, agentLabel: entry.agentLabel };
22
31
  }
@@ -33,9 +42,9 @@ export function isProductDocument(title, productSlug) {
33
42
  return true;
34
43
  }
35
44
  export function listRegisteredDocumentPatterns() {
36
- return registry;
45
+ return [...registry.values()];
37
46
  }
38
47
  export function clearDocumentPatternRegistry() {
39
- registry.length = 0;
48
+ registry.clear();
40
49
  }
41
50
  //# sourceMappingURL=classifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"classifier.js","sourceRoot":"","sources":["../../src/documents/classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAYH,MAAM,QAAQ,GAA2B,EAAE,CAAC;AAE5C,MAAM,UAAU,wBAAwB,CAAC,KAA2B;IAClE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAa;IAIjD,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,KAAK,MAAM,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClD,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,CAAC;QAC1E,CAAC;IACH,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;AAC3D,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,WAAoB;IAEpB,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC9D,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,WAAW;QAAE,OAAO,OAAO,KAAK,WAAW,CAAC;IAChD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,8BAA8B;IAC5C,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,4BAA4B;IAC1C,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;AACtB,CAAC"}
1
+ {"version":3,"file":"classifier.js","sour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IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * Use via subpath import: @intelligo-dev/core/documents
9
9
  */
10
- export { getUserDocuments, getDocument, saveDocument, deleteDocumentVersions, } from "./service";
11
- export { DocumentServiceError, isDocumentServiceError, type DocumentServiceErrorCode, } from "./errors";
12
- export type { DocumentActor, DocumentFilter, DocumentListItem } from "./types";
13
- export { registerDocumentPatterns, classifyDocumentTitle, isProductDocument, listRegisteredDocumentPatterns, clearDocumentPatternRegistry, type DocumentPatternEntry, } from "./classifier";
10
+ export { getUserDocuments, getDocument, saveDocument, deleteDocumentVersions, } from "./service.js";
11
+ export { DocumentServiceError, isDocumentServiceError, type DocumentServiceErrorCode, } from "./errors.js";
12
+ export type { DocumentActor, DocumentFilter, DocumentListItem } from "./types.js";
13
+ export { registerDocumentPatterns, classifyDocumentTitle, isProductDocument, listRegisteredDocumentPatterns, clearDocumentPatternRegistry, type DocumentPatternEntry, } from "./classifier.js";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -7,7 +7,7 @@
7
7
  *
8
8
  * Use via subpath import: @intelligo-dev/core/documents
9
9
  */
10
- export { getUserDocuments, getDocument, saveDocument, deleteDocumentVersions, } from "./service";
11
- export { DocumentServiceError, isDocumentServiceError, } from "./errors";
12
- export { registerDocumentPatterns, classifyDocumentTitle, isProductDocument, listRegisteredDocumentPatterns, clearDocumentPatternRegistry, } from "./classifier";
10
+ export { getUserDocuments, getDocument, saveDocument, deleteDocumentVersions, } from "./service.js";
11
+ export { DocumentServiceError, isDocumentServiceError, } from "./errors.js";
12
+ export { registerDocumentPatterns, classifyDocumentTitle, isProductDocument, listRegisteredDocumentPatterns, clearDocumentPatternRegistry, } from "./classifier.js";
13
13
  //# sourceMappingURL=index.js.map
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This module is SERVER-ONLY. Do not import from client components.
24
24
  */
25
- import type { DocumentActor, DocumentFilter, DocumentListItem } from "./types";
25
+ import type { DocumentActor, DocumentFilter, DocumentListItem } from "./types.js";
26
26
  /**
27
27
  * Get all documents for the actor. Ordered by most recently created
28
28
  * first. Uses DISTINCT ON to get the latest version of each document.
@@ -23,10 +23,10 @@
23
23
  * This module is SERVER-ONLY. Do not import from client components.
24
24
  */
25
25
  import { and, desc, eq, gt } from "drizzle-orm";
26
- import { db } from "../db";
27
- import { documents } from "../db/schema";
28
- import { classifyDocumentTitle, isProductDocument } from "./classifier";
29
- import { DocumentServiceError } from "./errors";
26
+ import { db } from "../db/index.js";
27
+ import { documents } from "../db/schema/index.js";
28
+ import { classifyDocumentTitle, isProductDocument } from "./classifier.js";
29
+ import { DocumentServiceError } from "./errors.js";
30
30
  function toListItem(doc) {
31
31
  return {
32
32
  id: doc.id,
@@ -1,5 +1,5 @@
1
- export { sendEmail, type SendEmailParams, type SendEmailWithComponentParams, type SendEmailResult, } from "./send";
2
- export { getEmailProvider, resetEmailProviderCache, type EmailProvider, type EmailProviderName, type EmailSendParams, type EmailTemplateRef, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider";
3
- export * from "./templates";
4
- export * from "./senders";
1
+ export { sendEmail, type SendEmailParams, type SendEmailWithComponentParams, type SendEmailResult, } from "./send.js";
2
+ export { getEmailProvider, resetEmailProviderCache, type EmailProvider, type EmailProviderName, type EmailSendParams, type EmailTemplateRef, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider.js";
3
+ export * from "./templates/index.js";
4
+ export * from "./senders.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
- export { sendEmail, } from "./send";
2
- export { getEmailProvider, resetEmailProviderCache, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider";
3
- export * from "./templates";
4
- export * from "./senders";
1
+ export { sendEmail, } from "./send.js";
2
+ export { getEmailProvider, resetEmailProviderCache, ResendProvider, LoopsProvider, ConsoleProvider, } from "./provider.js";
3
+ export * from "./templates/index.js";
4
+ export * from "./senders.js";
5
5
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
1
  import type React from "react";
2
- import { type EmailTemplateRef } from "./provider";
2
+ import { type EmailTemplateRef } from "./provider.js";
3
3
  export interface SendEmailParams {
4
4
  to: string | string[];
5
5
  subject: string;
@@ -1,5 +1,5 @@
1
1
  import { render } from "@react-email/components";
2
- import { getEmailProvider } from "./provider";
2
+ import { getEmailProvider } from "./provider.js";
3
3
  const MAX_ATTEMPTS = 3;
4
4
  const BASE_DELAY_MS = 1000;
5
5
  /**
@@ -19,7 +19,7 @@
19
19
  * (quota-warning / quota-exceeded, trial-warning / trial-depleted) because
20
20
  * template providers branch per template, not per variable.
21
21
  */
22
- import { type SendEmailResult } from "./send";
22
+ import { type SendEmailResult } from "./send.js";
23
23
  /** Send welcome email after signup (EMAIL-03) */
24
24
  export declare function sendWelcomeEmail(params: {
25
25
  to: string;
@@ -20,8 +20,8 @@
20
20
  * template providers branch per template, not per variable.
21
21
  */
22
22
  import * as React from "react";
23
- import { sendEmail } from "./send";
24
- import { WelcomeEmail, VerifyEmailEmail, PasswordResetEmail, WorkspaceInvitationEmail, QuotaWarningEmail, TrialWarningEmail, TrialExpiryEmail, PaymentFailedEmail, SubscriptionConfirmedEmail, } from "./templates";
23
+ import { sendEmail } from "./send.js";
24
+ import { WelcomeEmail, VerifyEmailEmail, PasswordResetEmail, WorkspaceInvitationEmail, QuotaWarningEmail, TrialWarningEmail, TrialExpiryEmail, PaymentFailedEmail, SubscriptionConfirmedEmail, } from "./templates/index.js";
25
25
  // ---------------------------------------------------------------------------
26
26
  // Auth Emails
27
27
  // ---------------------------------------------------------------------------
@@ -1,11 +1,11 @@
1
- export { BaseLayout, type BaseLayoutProps } from "./base-layout";
2
- export { WelcomeEmail, type WelcomeEmailProps } from "./welcome";
3
- export { VerifyEmailEmail, type VerifyEmailEmailProps } from "./verify-email";
4
- export { PasswordResetEmail, type PasswordResetEmailProps, } from "./password-reset";
5
- export { WorkspaceInvitationEmail, type WorkspaceInvitationEmailProps, } from "./workspace-invitation";
6
- export { QuotaWarningEmail, type QuotaWarningEmailProps, } from "./quota-warning";
7
- export { TrialWarningEmail, type TrialWarningEmailProps, } from "./trial-warning";
8
- export { PaymentFailedEmail, type PaymentFailedEmailProps, } from "./payment-failed";
9
- export { SubscriptionConfirmedEmail, type SubscriptionConfirmedEmailProps, } from "./subscription-confirmed";
10
- export { TrialExpiryEmail, type TrialExpiryEmailProps } from "./trial-expiry";
1
+ export { BaseLayout, type BaseLayoutProps } from "./base-layout.js";
2
+ export { WelcomeEmail, type WelcomeEmailProps } from "./welcome.js";
3
+ export { VerifyEmailEmail, type VerifyEmailEmailProps } from "./verify-email.js";
4
+ export { PasswordResetEmail, type PasswordResetEmailProps, } from "./password-reset.js";
5
+ export { WorkspaceInvitationEmail, type WorkspaceInvitationEmailProps, } from "./workspace-invitation.js";
6
+ export { QuotaWarningEmail, type QuotaWarningEmailProps, } from "./quota-warning.js";
7
+ export { TrialWarningEmail, type TrialWarningEmailProps, } from "./trial-warning.js";
8
+ export { PaymentFailedEmail, type PaymentFailedEmailProps, } from "./payment-failed.js";
9
+ export { SubscriptionConfirmedEmail, type SubscriptionConfirmedEmailProps, } from "./subscription-confirmed.js";
10
+ export { TrialExpiryEmail, type TrialExpiryEmailProps } from "./trial-expiry.js";
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -4,14 +4,14 @@
4
4
  // All React Email templates with Intelligo branding. Each template wraps
5
5
  // content in BaseLayout for consistent styling.
6
6
  // ---------------------------------------------------------------------------
7
- export { BaseLayout } from "./base-layout";
8
- export { WelcomeEmail } from "./welcome";
9
- export { VerifyEmailEmail } from "./verify-email";
10
- export { PasswordResetEmail, } from "./password-reset";
11
- export { WorkspaceInvitationEmail, } from "./workspace-invitation";
12
- export { QuotaWarningEmail, } from "./quota-warning";
13
- export { TrialWarningEmail, } from "./trial-warning";
14
- export { PaymentFailedEmail, } from "./payment-failed";
15
- export { SubscriptionConfirmedEmail, } from "./subscription-confirmed";
16
- export { TrialExpiryEmail } from "./trial-expiry";
7
+ export { BaseLayout } from "./base-layout.js";
8
+ export { WelcomeEmail } from "./welcome.js";
9
+ export { VerifyEmailEmail } from "./verify-email.js";
10
+ export { PasswordResetEmail, } from "./password-reset.js";
11
+ export { WorkspaceInvitationEmail, } from "./workspace-invitation.js";
12
+ export { QuotaWarningEmail, } from "./quota-warning.js";
13
+ export { TrialWarningEmail, } from "./trial-warning.js";
14
+ export { PaymentFailedEmail, } from "./payment-failed.js";
15
+ export { SubscriptionConfirmedEmail, } from "./subscription-confirmed.js";
16
+ export { TrialExpiryEmail } from "./trial-expiry.js";
17
17
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function PasswordResetEmail({ userName, resetUrl, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function PaymentFailedEmail({ workspaceName, amount, updatePaymentUrl, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function QuotaWarningEmail({ workspaceName, percentageUsed, tokensUsed, tokensLimit, upgradeUrl, isExceeded, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function SubscriptionConfirmedEmail({ workspaceName, planName, amount, dashboardUrl, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function TrialExpiryEmail({ workspaceName, expiryDate, daysRemaining, upgradeUrl, locale = "en", }) {
5
5
  const isExpired = daysRemaining <= 0;
6
6
  const isUrgent = daysRemaining <= 1 && daysRemaining > 0;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function TrialWarningEmail({ workspaceName, creditsRemaining, totalCredits, percentageRemaining, upgradeUrl, isDepleted, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function VerifyEmailEmail({ userName, verificationUrl, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function WelcomeEmail({ userName, dashboardUrl, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button, Section, Text } from "@react-email/components";
3
- import { BaseLayout } from "./base-layout";
3
+ import { BaseLayout } from "./base-layout.js";
4
4
  export function WorkspaceInvitationEmail({ inviterName, workspaceName, role, acceptUrl, declineUrl, locale = "en", }) {
5
5
  const text = locale === "mn"
6
6
  ? {
@@ -22,7 +22,7 @@
22
22
  * Not re-exported from `./index.ts`: it is this module's own
23
23
  * implementation detail, not identity's public API.
24
24
  */
25
- import type { AuditTargetKind, AuditAction, AuditActorKind, UserMemoryAuditRow } from "../db/schema";
25
+ import type { AuditTargetKind, AuditAction, AuditActorKind, UserMemoryAuditRow } from "../db/schema/index.js";
26
26
  export type RecordMemoryAuditInput = {
27
27
  userId: string;
28
28
  workspaceId: string;
@@ -22,9 +22,9 @@
22
22
  * Not re-exported from `./index.ts`: it is this module's own
23
23
  * implementation detail, not identity's public API.
24
24
  */
25
- import { db } from "../db";
26
- import { userMemoryAudit } from "../db/schema";
27
- import { IdentityServiceError } from "./errors";
25
+ import { db } from "../db/index.js";
26
+ import { userMemoryAudit } from "../db/schema/index.js";
27
+ import { IdentityServiceError } from "./errors.js";
28
28
  export async function recordMemoryAudit(input) {
29
29
  const [row] = await db
30
30
  .insert(userMemoryAudit)
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * Use via subpath import: @intelligo-dev/core/identity
12
12
  */
13
- export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service";
14
- export { IdentityServiceError, isIdentityServiceError, type IdentityServiceErrorCode, } from "./errors";
15
- export type { IdentityActor, IdentityExport, UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow, } from "./types";
13
+ export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service.js";
14
+ export { IdentityServiceError, isIdentityServiceError, type IdentityServiceErrorCode, } from "./errors.js";
15
+ export type { IdentityActor, IdentityExport, UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow, } from "./types.js";
16
16
  //# sourceMappingURL=index.d.ts.map
@@ -10,6 +10,6 @@
10
10
  *
11
11
  * Use via subpath import: @intelligo-dev/core/identity
12
12
  */
13
- export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service";
14
- export { IdentityServiceError, isIdentityServiceError, } from "./errors";
13
+ export { listFacts, deleteFact, exportIdentity, getAuditTrail, } from "./service.js";
14
+ export { IdentityServiceError, isIdentityServiceError, } from "./errors.js";
15
15
  //# sourceMappingURL=index.js.map
@@ -4,8 +4,8 @@
4
4
  * Privacy-facing reads and mutations over the user identity graph:
5
5
  * fact listing/deletion, a full-identity data export, and the
6
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
7
+ * memories, and synthesized profile snapshot. Ported from the first
8
+ * product's `actions/identity.ts` (ADR-0008/ADR-0009 precedent — see
9
9
  * `../documents/service.ts` and `../conversations/service.ts` for the
10
10
  * same move): the tables (`user_facts`, `user_memories`,
11
11
  * `user_profile_snapshots`, `user_memory_audit`) always lived in
@@ -16,11 +16,11 @@
16
16
  *
17
17
  * What did NOT come with it (stays product/agents-side):
18
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.
19
+ * the product's `deleteMyFact` ran after deleting — synthesis is
20
+ * the product's AI code (ADR-0003), and this package cannot depend
21
+ * on it. `deleteFact` below does not touch the cached snapshot; a
22
+ * caller that also owns a synthesis engine re-triggers it after
23
+ * calling this.
24
24
  *
25
25
  * Callers pass a resolved actor (workspaceId, userId) rather than this
26
26
  * module resolving one itself — `@intelligo-dev/core` cannot depend on
@@ -41,8 +41,8 @@
41
41
  *
42
42
  * This module is SERVER-ONLY. Do not import from client components.
43
43
  */
44
- import type { UserFact, UserMemoryAuditRow } from "../db/schema";
45
- import type { IdentityActor, IdentityExport } from "./types";
44
+ import type { UserFact, UserMemoryAuditRow } from "../db/schema/index.js";
45
+ import type { IdentityActor, IdentityExport } from "./types.js";
46
46
  /** List the actor's facts, most important and most confident first. */
47
47
  export declare function listFacts(actor: IdentityActor): Promise<UserFact[]>;
48
48
  /**
@@ -64,7 +64,7 @@ export declare function deleteFact(actor: IdentityActor, factId: string): Promis
64
64
  * Aggregate the actor's full identity graph — facts, memories, latest
65
65
  * profile snapshot, and full audit trail — for a data-export flow.
66
66
  * Records its own audit row (action "export"): the export operation
67
- * audits itself, same as the ported Ignite implementation.
67
+ * audits itself, same as the implementation it was ported from.
68
68
  */
69
69
  export declare function exportIdentity(actor: IdentityActor): Promise<IdentityExport>;
70
70
  //# sourceMappingURL=service.d.ts.map
@@ -4,8 +4,8 @@
4
4
  * Privacy-facing reads and mutations over the user identity graph:
5
5
  * fact listing/deletion, a full-identity data export, and the
6
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
7
+ * memories, and synthesized profile snapshot. Ported from the first
8
+ * product's `actions/identity.ts` (ADR-0008/ADR-0009 precedent — see
9
9
  * `../documents/service.ts` and `../conversations/service.ts` for the
10
10
  * same move): the tables (`user_facts`, `user_memories`,
11
11
  * `user_profile_snapshots`, `user_memory_audit`) always lived in
@@ -16,11 +16,11 @@
16
16
  *
17
17
  * What did NOT come with it (stays product/agents-side):
18
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.
19
+ * the product's `deleteMyFact` ran after deleting — synthesis is
20
+ * the product's AI code (ADR-0003), and this package cannot depend
21
+ * on it. `deleteFact` below does not touch the cached snapshot; a
22
+ * caller that also owns a synthesis engine re-triggers it after
23
+ * calling this.
24
24
  *
25
25
  * Callers pass a resolved actor (workspaceId, userId) rather than this
26
26
  * module resolving one itself — `@intelligo-dev/core` cannot depend on
@@ -42,10 +42,10 @@
42
42
  * This module is SERVER-ONLY. Do not import from client components.
43
43
  */
44
44
  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";
45
+ import { db } from "../db/index.js";
46
+ import { userFacts, userMemories, userProfileSnapshots, userMemoryAudit, } from "../db/schema/index.js";
47
+ import { recordMemoryAudit } from "./audit.js";
48
+ import { IdentityServiceError } from "./errors.js";
49
49
  // ---------------------------------------------------------------------------
50
50
  // Internal helpers
51
51
  // ---------------------------------------------------------------------------
@@ -132,7 +132,7 @@ export async function deleteFact(actor, factId) {
132
132
  * Aggregate the actor's full identity graph — facts, memories, latest
133
133
  * profile snapshot, and full audit trail — for a data-export flow.
134
134
  * Records its own audit row (action "export"): the export operation
135
- * audits itself, same as the ported Ignite implementation.
135
+ * audits itself, same as the implementation it was ported from.
136
136
  */
137
137
  export async function exportIdentity(actor) {
138
138
  // Recorded before the reads so the export's own audit row is part of
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared types for the identity service.
3
3
  */
4
- import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema";
4
+ import type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow } from "../db/schema/index.js";
5
5
  export type { UserFact, UserMemory, UserProfileSnapshot, UserMemoryAuditRow };
6
6
  /** Resolved actor identity — every query is scoped to this pair. */
7
7
  export type IdentityActor = {
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":"AAOA,cAAc,MAAM,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,10 @@
1
- export const version = "0.0.0";
1
+ // There was an `export const version = "0.0.0"` here, on a package
2
+ // published as 1.0.0-beta.3, read by nothing. A version constant that
3
+ // has to be kept in step with the manifest by hand will not be; the
4
+ // manifest is the one place that cannot drift, and consumers who need
5
+ // it can read it from there.
2
6
  // Re-export database client
3
- export * from "./db";
7
+ export * from "./db/index.js";
4
8
  // Email module -- use subpath import: @intelligo-dev/core/email
5
9
  // Notifications module -- use subpath import: @intelligo-dev/core/notifications
6
10
  // Conversations module -- use subpath import: @intelligo-dev/core/conversations
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,mEAAmE;AACnE,sEAAsE;AACtE,oEAAoE;AACpE,sEAAsE;AACtE,6BAA6B;AAE7B,4BAA4B;AAC5B,cAAc,MAAM,CAAC;AAErB,gEAAgE;AAChE,gFAAgF;AAChF,gFAAgF;AAChF,wEAAwE;AACxE,sEAAsE;AACtE,2DAA2D;AAC3D,qDAAqD"}