@agent-native/core 0.138.0 → 0.140.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (100) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/server/lib/dashboard-report.ts +2 -0
  3. package/corpus/templates/analytics/server/lib/emails.ts +51 -0
  4. package/corpus/templates/analytics/server/plugins/transactional-emails.ts +5 -0
  5. package/corpus/templates/calendar/server/lib/booking-emails.ts +154 -70
  6. package/corpus/templates/calendar/server/lib/emails.ts +167 -0
  7. package/corpus/templates/calendar/server/lib/event-guest-notifications.ts +64 -28
  8. package/corpus/templates/calendar/server/plugins/transactional-emails.ts +5 -0
  9. package/corpus/templates/clips/actions/invite-member.ts +39 -15
  10. package/corpus/templates/clips/server/lib/emails.ts +256 -0
  11. package/corpus/templates/clips/server/lib/transactional-email-templates.ts +24 -0
  12. package/corpus/templates/clips/server/plugins/transactional-email-catalog.ts +5 -0
  13. package/corpus/templates/content/server/lib/comment-notifications.ts +57 -26
  14. package/corpus/templates/content/server/lib/emails.ts +70 -0
  15. package/corpus/templates/content/server/plugins/transactional-emails.ts +5 -0
  16. package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +44 -1
  17. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +265 -1
  18. package/corpus/templates/design/actions/create-design-system.ts +9 -10
  19. package/corpus/templates/design/actions/get-design-system.ts +53 -0
  20. package/corpus/templates/design/actions/import-design-tokens.ts +5 -71
  21. package/corpus/templates/design/actions/index-design-tokens.ts +61 -80
  22. package/corpus/templates/design/actions/update-design-system.ts +7 -10
  23. package/corpus/templates/design/app/components/design/EditPanel.tsx +45 -2
  24. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +12 -0
  25. package/corpus/templates/design/app/components/design/edit-panel/design-system-swatches.ts +215 -0
  26. package/corpus/templates/design/app/components/design/edit-panel/document-colors.ts +10 -6
  27. package/corpus/templates/design/app/components/design/edit-panel/effects-properties.tsx +19 -3
  28. package/corpus/templates/design/app/components/design/edit-panel/fill-properties.tsx +36 -10
  29. package/corpus/templates/design/app/components/design/edit-panel/interaction-state-helpers.ts +15 -0
  30. package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +19 -1
  31. package/corpus/templates/design/app/components/design/edit-panel/position-helpers.ts +6 -0
  32. package/corpus/templates/design/app/components/design/edit-panel/stroke-properties.tsx +53 -10
  33. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +142 -4
  34. package/corpus/templates/design/app/components/design/types.ts +6 -0
  35. package/corpus/templates/design/app/i18n-data.ts +20 -0
  36. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +1 -1
  37. package/corpus/templates/design/app/pages/DesignSystems.tsx +78 -1
  38. package/corpus/templates/design/app/pages/design-editor/html-layer-positioning.ts +6 -1
  39. package/corpus/templates/design/changelog/2026-08-04-design-system-tokens-show-by-name-in-the-editor.md +6 -0
  40. package/corpus/templates/design/e2e/helpers.ts +17 -0
  41. package/corpus/templates/design/server/lib/design-system-tokens.ts +35 -0
  42. package/corpus/templates/design/shared/authored-color-styles.ts +401 -0
  43. package/corpus/templates/design/shared/resolve-tweaks.ts +10 -18
  44. package/corpus/templates/dispatch/app/routes/transactional-email.$appId.$id.tsx +4 -0
  45. package/corpus/templates/dispatch/app/routes/transactional-email.tsx +4 -0
  46. package/corpus/templates/forms/server/lib/emails.ts +52 -0
  47. package/corpus/templates/forms/server/lib/response-email.ts +2 -0
  48. package/corpus/templates/forms/server/plugins/transactional-emails.ts +5 -0
  49. package/corpus/templates/plan/actions/request-plan-access.ts +33 -12
  50. package/corpus/templates/plan/server/lib/comment-notifications.ts +53 -27
  51. package/corpus/templates/plan/server/lib/emails.ts +67 -0
  52. package/corpus/templates/plan/server/plugins/transactional-emails.ts +5 -0
  53. package/corpus/templates/slides/server/lib/comment-notifications.ts +44 -21
  54. package/corpus/templates/slides/server/lib/emails.ts +40 -0
  55. package/corpus/templates/slides/server/plugins/transactional-emails.ts +5 -0
  56. package/dist/brand-kit/index.d.ts +1 -0
  57. package/dist/brand-kit/index.js +1 -0
  58. package/dist/brand-kit/tokens.d.ts +92 -0
  59. package/dist/brand-kit/tokens.js +280 -0
  60. package/dist/brand-kit/types.d.ts +25 -0
  61. package/dist/collab/awareness.d.ts +2 -2
  62. package/dist/collab/routes.d.ts +2 -2
  63. package/dist/email-catalog/actions/list-email-activity.d.ts +6 -0
  64. package/dist/email-catalog/actions/list-email-activity.js +15 -0
  65. package/dist/email-catalog/actions/list-email-engagement.d.ts +6 -0
  66. package/dist/email-catalog/actions/list-email-engagement.js +15 -0
  67. package/dist/email-catalog/actions/list-email-log.d.ts +8 -0
  68. package/dist/email-catalog/actions/list-email-log.js +22 -0
  69. package/dist/email-catalog/actions/list-transactional-emails.d.ts +23 -0
  70. package/dist/email-catalog/actions/list-transactional-emails.js +61 -0
  71. package/dist/email-catalog/actions/render-transactional-email-preview.d.ts +10 -0
  72. package/dist/email-catalog/actions/render-transactional-email-preview.js +24 -0
  73. package/dist/email-catalog/authorize.d.ts +2 -0
  74. package/dist/email-catalog/authorize.js +10 -0
  75. package/dist/email-catalog/log.d.ts +57 -0
  76. package/dist/email-catalog/log.js +117 -0
  77. package/dist/email-catalog/provider-metrics.d.ts +34 -0
  78. package/dist/email-catalog/provider-metrics.js +165 -0
  79. package/dist/email-catalog/registry.d.ts +79 -0
  80. package/dist/email-catalog/registry.js +71 -0
  81. package/dist/email-catalog/schema.d.ts +212 -0
  82. package/dist/email-catalog/schema.js +49 -0
  83. package/dist/email-catalog/system-emails.d.ts +14 -0
  84. package/dist/email-catalog/system-emails.js +68 -0
  85. package/dist/localization/default-messages.d.ts +45 -0
  86. package/dist/localization/default-messages.js +45 -0
  87. package/dist/notifications/routes.d.ts +6 -6
  88. package/dist/org/handlers.js +8 -1
  89. package/dist/progress/routes.d.ts +1 -1
  90. package/dist/provider-api/actions/custom-provider-registration.d.ts +7 -7
  91. package/dist/provider-api/actions/provider-api.d.ts +7 -7
  92. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  93. package/dist/resources/handlers.d.ts +1 -1
  94. package/dist/server/action-discovery.js +22 -0
  95. package/dist/server/better-auth-instance.js +17 -2
  96. package/dist/server/email.d.ts +9 -0
  97. package/dist/server/email.js +44 -3
  98. package/dist/server/index.d.ts +1 -0
  99. package/dist/server/index.js +1 -0
  100. package/package.json +3 -1
@@ -1641,6 +1641,8 @@ const enUS = {
1641
1641
  description:
1642
1642
  "A snapshot of the colors, type, spacing, and assets currently stored.",
1643
1643
  colors: "Colors",
1644
+ namedTokens: "Design system tokens",
1645
+ colorRoles: "Color roles",
1644
1646
  noColors: "No color tokens saved.",
1645
1647
  typography: "Typography",
1646
1648
  details: "Details",
@@ -2107,6 +2109,8 @@ const designLocaleOverrides = {
2107
2109
  title: "代币预览",
2108
2110
  description: "当前存储的颜色、类型、间距和资源的快照。",
2109
2111
  colors: "颜色",
2112
+ namedTokens: "设计系统令牌",
2113
+ colorRoles: "颜色角色",
2110
2114
  noColors: "没有保存颜色标记。",
2111
2115
  typography: "版式",
2112
2116
  details: "细节",
@@ -2533,6 +2537,8 @@ const designLocaleOverrides = {
2533
2537
  description:
2534
2538
  "Una instantánea de los colores, tipos, espacios y recursos almacenados actualmente.",
2535
2539
  colors: "Bandera",
2540
+ namedTokens: "Tokens del sistema de diseño",
2541
+ colorRoles: "Roles de color",
2536
2542
  noColors: "No se guardaron fichas de color.",
2537
2543
  typography: "Tipografía",
2538
2544
  details: "Detalles",
@@ -2964,6 +2970,8 @@ const designLocaleOverrides = {
2964
2970
  description:
2965
2971
  "Un instantané des couleurs, du type, de l'espacement et des ressources actuellement stockés.",
2966
2972
  colors: "Couleurs",
2973
+ namedTokens: "Jetons du système de design",
2974
+ colorRoles: "Rôles de couleur",
2967
2975
  noColors: "Aucun jeton de couleur enregistré.",
2968
2976
  typography: "Typographie",
2969
2977
  details: "Détails",
@@ -3396,6 +3404,8 @@ const designLocaleOverrides = {
3396
3404
  description:
3397
3405
  "Eine Momentaufnahme der Farben, des Typs, der Abstände und der aktuell gespeicherten Elemente.",
3398
3406
  colors: "Farben",
3407
+ namedTokens: "Design-System-Tokens",
3408
+ colorRoles: "Farbrollen",
3399
3409
  noColors: "Keine Farbtokens gespeichert.",
3400
3410
  typography: "Typografie",
3401
3411
  details: "Details",
@@ -3823,6 +3833,8 @@ const designLocaleOverrides = {
3823
3833
  description:
3824
3834
  "現在保存されている色、タイプ、間隔、アセットのスナップショット。",
3825
3835
  colors: "色",
3836
+ namedTokens: "デザインシステムのトークン",
3837
+ colorRoles: "カラーロール",
3826
3838
  noColors: "カラートークンは保存されません。",
3827
3839
  typography: "タイポグラフィ",
3828
3840
  details: "詳細",
@@ -4243,6 +4255,8 @@ const designLocaleOverrides = {
4243
4255
  title: "토큰 미리보기",
4244
4256
  description: "현재 저장된 색상, 유형, 간격 및 자산의 스냅샷입니다.",
4245
4257
  colors: "그림 물감",
4258
+ namedTokens: "디자인 시스템 토큰",
4259
+ colorRoles: "색상 역할",
4246
4260
  noColors: "저장된 색상 토큰이 없습니다.",
4247
4261
  typography: "타이포그래피",
4248
4262
  details: "세부",
@@ -4670,6 +4684,8 @@ const designLocaleOverrides = {
4670
4684
  description:
4671
4685
  "Um instantâneo das cores, tipo, espaçamento e ativos armazenados atualmente.",
4672
4686
  colors: "Cores",
4687
+ namedTokens: "Tokens do sistema de design",
4688
+ colorRoles: "Funções de cor",
4673
4689
  noColors: "Nenhum token de cor salvo.",
4674
4690
  typography: "Tipografia",
4675
4691
  details: "Detalhes",
@@ -5088,6 +5104,8 @@ const designLocaleOverrides = {
5088
5104
  description:
5089
5105
  "वर्तमान में संग्रहीत रंग, प्रकार, रिक्ति और संपत्तियों का एक स्नैपशॉट।",
5090
5106
  colors: "रंग",
5107
+ namedTokens: "डिज़ाइन सिस्टम टोकन",
5108
+ colorRoles: "रंग भूमिकाएँ",
5091
5109
  noColors: "कोई रंग टोकन सहेजा नहीं गया.",
5092
5110
  typography: "टाइपोग्राफी",
5093
5111
  details: "विवरण",
@@ -5505,6 +5523,8 @@ const designLocaleOverrides = {
5505
5523
  title: "معاينة الرمز المميز",
5506
5524
  description: "لقطة للألوان والنوع والتباعد والأصول المخزنة حاليًا.",
5507
5525
  colors: "الألوان",
5526
+ namedTokens: "رموز نظام التصميم",
5527
+ colorRoles: "أدوار الألوان",
5508
5528
  noColors: "لم يتم حفظ أي رموز ملونة.",
5509
5529
  typography: "الطباعة",
5510
5530
  details: "تفاصيل",
@@ -433,7 +433,7 @@ export default function DesignSystemSetup() {
433
433
 
434
434
  const parts: string[] = [];
435
435
  parts.push(
436
- "Set up a design system from the following sources. Use Builder Design System Intelligence (DSI) as the source of truth for reusable Figma/code/design.md indexing. Analyze each source, extract design tokens (colors, fonts, spacing, borders), and create a cohesive design system.",
436
+ "Set up a design system from the following sources. Use Builder Design System Intelligence (DSI) as the source of truth for reusable Figma/code/design.md indexing. Analyze each source, extract design tokens (colors, fonts, spacing, borders), and create a cohesive design system. Keep each token under the name its source gives it: put the full named vocabulary in `data.tokens` (name, cssVar, value, type, group, source) as well as filling the seven `colors` roles, so tokens like `interactive-01` are not collapsed into `secondary`.",
437
437
  );
438
438
 
439
439
  if (companyInfo.trim()) {
@@ -1,3 +1,9 @@
1
+ import {
2
+ groupBrandKitTokens,
3
+ isColorTokenValue,
4
+ resolveBrandKitTokens,
5
+ type BrandKitTokenGroup,
6
+ } from "@agent-native/core/brand-kit/tokens";
1
7
  import {
2
8
  useActionQuery,
3
9
  useActionMutation,
@@ -109,6 +115,8 @@ interface DesignSystemData {
109
115
  borders?: Record<string, unknown>;
110
116
  logos?: Array<{ url?: string; name?: string; variant?: string }>;
111
117
  defaults?: Record<string, unknown>;
118
+ tokens?: unknown;
119
+ customCSS?: unknown;
112
120
  notes?: unknown;
113
121
  }
114
122
 
@@ -939,6 +947,7 @@ function TokenPreview({
939
947
  const colors = getColorTokens(data, t);
940
948
  const typeTokens = getTypographyTokens(data, t);
941
949
  const detailTokens = getDetailTokens(data, assets, t);
950
+ const namedGroups = groupBrandKitTokens(resolveBrandKitTokens(data));
942
951
 
943
952
  return (
944
953
  <section className="space-y-6 border-t border-border pt-6">
@@ -951,9 +960,15 @@ function TokenPreview({
951
960
  </p>
952
961
  </div>
953
962
 
963
+ {namedGroups.length > 0 ? (
964
+ <NamedTokenGroups groups={namedGroups} />
965
+ ) : null}
966
+
954
967
  <div className="space-y-3">
955
968
  <h4 className="text-xs font-medium uppercase text-muted-foreground">
956
- {t("designSystems.tokenPreview.colors")}
969
+ {namedGroups.length > 0
970
+ ? t("designSystems.tokenPreview.colorRoles")
971
+ : t("designSystems.tokenPreview.colors")}
957
972
  </h4>
958
973
  {colors.length > 0 ? (
959
974
  <div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
@@ -1002,6 +1017,68 @@ function TokenPreview({
1002
1017
  );
1003
1018
  }
1004
1019
 
1020
+ function NamedTokenGroups({ groups }: { groups: BrandKitTokenGroup[] }) {
1021
+ const t = useT();
1022
+ const total = groups.reduce((sum, group) => sum + group.tokens.length, 0);
1023
+
1024
+ return (
1025
+ <div className="space-y-4">
1026
+ <div className="flex items-baseline justify-between gap-3">
1027
+ <h4 className="text-xs font-medium uppercase text-muted-foreground">
1028
+ {t("designSystems.tokenPreview.namedTokens")}
1029
+ </h4>
1030
+ <span className="!text-[11px] text-muted-foreground">
1031
+ {t("designSystems.tokenPreview.savedCount", { count: total })}
1032
+ </span>
1033
+ </div>
1034
+
1035
+ {groups.map((group) => (
1036
+ <div key={`${group.type}:${group.label}`} className="space-y-2">
1037
+ <div className="flex items-center gap-2">
1038
+ <span className="text-xs font-medium text-foreground">
1039
+ {group.label}
1040
+ </span>
1041
+ <span className="!text-[11px] text-muted-foreground">
1042
+ {group.tokens.length}
1043
+ </span>
1044
+ </div>
1045
+ <div className="grid grid-cols-1 gap-2 sm:grid-cols-2">
1046
+ {group.tokens.map((token) => (
1047
+ <div
1048
+ key={token.cssVar}
1049
+ className="flex min-w-0 items-center gap-3 rounded-lg border border-border bg-muted/30 p-2"
1050
+ >
1051
+ {isColorTokenValue(token.value) ? (
1052
+ <div
1053
+ className="h-9 w-9 shrink-0 rounded-md border border-border"
1054
+ style={{ backgroundColor: token.value }}
1055
+ />
1056
+ ) : null}
1057
+ <div className="min-w-0 flex-1">
1058
+ <div className="truncate text-xs font-medium text-foreground">
1059
+ {token.name}
1060
+ </div>
1061
+ <div className="truncate font-mono !text-[11px] text-muted-foreground">
1062
+ {token.cssVar}
1063
+ </div>
1064
+ <div className="truncate font-mono !text-[11px] text-muted-foreground">
1065
+ {token.value}
1066
+ </div>
1067
+ </div>
1068
+ {token.source ? (
1069
+ <span className="shrink-0 rounded border border-border px-1.5 py-0.5 !text-[10px] text-muted-foreground">
1070
+ {token.source}
1071
+ </span>
1072
+ ) : null}
1073
+ </div>
1074
+ ))}
1075
+ </div>
1076
+ </div>
1077
+ ))}
1078
+ </div>
1079
+ );
1080
+ }
1081
+
1005
1082
  function PreviewList({
1006
1083
  title,
1007
1084
  items,
@@ -1,3 +1,4 @@
1
+ import { collectAuthoredColorStyles } from "@shared/authored-color-styles";
1
2
  import { normalizePoisonedBoardNestedCoords } from "@shared/board-file";
2
3
  import type { CodeLayerNode } from "@shared/code-layer";
3
4
 
@@ -211,8 +212,12 @@ export function getBodyInlineStyles(content: string): Record<string, string> {
211
212
  const doc = new DOMParser().parseFromString(content, "text/html");
212
213
  const body = doc.body;
213
214
  if (!body) return {};
215
+ // A generated screen sets its page background in a `body { … }` rule, and a
216
+ // `background:` shorthand holding var() leaves the longhand empty, so the
217
+ // inline style alone reports an unstyled page.
218
+ const authored = collectAuthoredColorStyles(body);
214
219
  return {
215
- backgroundColor: body.style.backgroundColor,
220
+ backgroundColor: body.style.backgroundColor || authored.backgroundColor,
216
221
  backgroundImage: body.style.backgroundImage,
217
222
  backgroundPosition: body.style.backgroundPosition,
218
223
  backgroundRepeat: body.style.backgroundRepeat,
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: added
3
+ date: 2026-08-04
4
+ ---
5
+
6
+ Design system tokens now show by name across the Brand Kit page and the fill, stroke, effects, page background and selection colour rows, so a colour reads as `cds-link-primary` instead of `0F62FE`.
@@ -66,6 +66,23 @@ async function postAction(
66
66
  return res.json();
67
67
  }
68
68
 
69
+ /** Create a Brand Kit from a production template and return its title. */
70
+ export async function createDesignSystemFromTemplate(
71
+ page: Page,
72
+ templateId: string,
73
+ ): Promise<string> {
74
+ const created = await postAction(page, "create-design-system", {
75
+ templateId,
76
+ });
77
+ const title: string | undefined = created?.title ?? created?.data?.title;
78
+ if (!title) {
79
+ throw new Error(
80
+ `create-design-system did not return a title: ${JSON.stringify(created)}`,
81
+ );
82
+ }
83
+ return title;
84
+ }
85
+
69
86
  export async function createFixtureDesign(
70
87
  page: Page,
71
88
  title = SEED_TITLE,
@@ -0,0 +1,35 @@
1
+ import {
2
+ describeBrandKitTokenRejections,
3
+ normalizeBrandKitTokens,
4
+ } from "@agent-native/core/brand-kit/tokens";
5
+
6
+ /**
7
+ * Reject a write whose named tokens cannot be stored verbatim. Keeping the
8
+ * storable subset would read downstream as a genuinely smaller design system.
9
+ */
10
+ export function assertStorableDesignSystemTokens(dataJson: string): void {
11
+ let parsed: unknown;
12
+ try {
13
+ parsed = JSON.parse(dataJson);
14
+ } catch {
15
+ throw new Error("data must be a valid JSON object string");
16
+ }
17
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
18
+ throw new Error("data must be a valid JSON object string");
19
+ }
20
+
21
+ const tokens = (parsed as Record<string, unknown>).tokens;
22
+ if (tokens === undefined) return;
23
+
24
+ const { rejected } = normalizeBrandKitTokens(tokens);
25
+ if (rejected.length > 0) {
26
+ throw new Error(
27
+ `data.tokens contains ${rejected.length} entr${
28
+ rejected.length === 1 ? "y" : "ies"
29
+ } that cannot be stored: ${describeBrandKitTokenRejections(rejected)}. ` +
30
+ "Each token needs a name, a CSS custom property (-- followed by " +
31
+ "letters, digits, hyphens or underscores), and a value with no " +
32
+ '";", "{", "}", "<", ">", or CSS comment.',
33
+ );
34
+ }
35
+ }