@agent-native/core 0.86.0 → 0.86.1

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 (183) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +9 -0
  3. package/corpus/core/package.json +2 -1
  4. package/corpus/core/src/client/AgentPanel.tsx +10 -0
  5. package/corpus/core/src/client/AssistantChat.tsx +91 -27
  6. package/corpus/core/src/client/ErrorBoundary.tsx +67 -12
  7. package/corpus/core/src/client/ErrorReportActions.tsx +69 -0
  8. package/corpus/core/src/client/FeedbackButton.tsx +8 -4
  9. package/corpus/core/src/client/db-admin/DbAdminPage.tsx +41 -13
  10. package/corpus/core/src/client/db-admin/SqlEditor.tsx +10 -3
  11. package/corpus/core/src/client/db-admin/TableEditor.tsx +12 -5
  12. package/corpus/core/src/client/db-admin/useAgentSync.ts +10 -3
  13. package/corpus/core/src/client/db-admin/useDbAdmin.ts +65 -16
  14. package/corpus/core/src/client/error-reporting.ts +100 -0
  15. package/corpus/core/src/client/index.ts +11 -0
  16. package/corpus/core/src/client/org/RequireActiveOrg.tsx +12 -0
  17. package/corpus/core/src/client/visual-style-controls.tsx +615 -2
  18. package/corpus/core/src/db-admin/index.ts +26 -0
  19. package/corpus/core/src/db-admin/operations.ts +87 -49
  20. package/corpus/core/src/localization/default-messages.ts +4 -0
  21. package/corpus/core/src/server/builder-design-systems.ts +328 -9
  22. package/corpus/core/src/server/index.ts +15 -0
  23. package/corpus/core/src/templates/default/app/root.tsx +47 -0
  24. package/corpus/templates/analytics/AGENTS.md +6 -4
  25. package/corpus/templates/analytics/actions/delete-db-admin-connection.ts +19 -0
  26. package/corpus/templates/analytics/actions/list-db-admin-connections.ts +18 -0
  27. package/corpus/templates/analytics/actions/navigate.ts +17 -3
  28. package/corpus/templates/analytics/actions/save-db-admin-connection.ts +33 -0
  29. package/corpus/templates/analytics/actions/view-screen.ts +11 -3
  30. package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +11 -2
  31. package/corpus/templates/analytics/app/i18n/zh-TW.ts +23 -2
  32. package/corpus/templates/analytics/app/i18n-data.ts +230 -20
  33. package/corpus/templates/analytics/app/pages/Agents.tsx +398 -4
  34. package/corpus/templates/analytics/changelog/2026-07-03-connect-other-app-databases-from-analytics.md +6 -0
  35. package/corpus/templates/analytics/server/db/schema.ts +27 -0
  36. package/corpus/templates/analytics/server/lib/db-admin-connections.ts +458 -0
  37. package/corpus/templates/analytics/server/plugins/db.ts +35 -0
  38. package/corpus/templates/analytics/server/routes/[base]/_agent-native/analytics-db-admin/[...path].ts +1 -0
  39. package/corpus/templates/analytics/server/routes/_agent-native/analytics-db-admin/[...path].ts +160 -0
  40. package/corpus/templates/content/app/root.tsx +9 -0
  41. package/corpus/templates/content/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
  42. package/corpus/templates/design/AGENTS.md +13 -7
  43. package/corpus/templates/design/actions/get-design-system.ts +21 -0
  44. package/corpus/templates/design/actions/index-design-system-with-builder.ts +14 -37
  45. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +3 -3
  46. package/corpus/templates/design/app/components/design/code-workbench/SideBar.tsx +70 -9
  47. package/corpus/templates/design/app/components/design/code-workbench/editor/EditorTabs.tsx +11 -2
  48. package/corpus/templates/design/app/components/design/code-workbench/editor/MonacoHost.tsx +1 -1
  49. package/corpus/templates/design/app/components/design/code-workbench/editor/StatusBar.tsx +1 -1
  50. package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +8 -2
  51. package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +7 -3
  52. package/corpus/templates/design/app/components/design/code-workbench/store.tsx +48 -0
  53. package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +6 -0
  54. package/corpus/templates/design/app/i18n/zh-TW.ts +15 -14
  55. package/corpus/templates/design/app/i18n-data.ts +154 -142
  56. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +32 -14
  57. package/corpus/templates/design/changelog/2026-07-03-design-system-setup-now-indexes-figma-code-and-design-md-sou.md +6 -0
  58. package/corpus/templates/design/changelog/2026-07-03-the-code-editor-is-easier-to-use-with-top-sidebar-tabs-clear.md +6 -0
  59. package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +16 -106
  60. package/corpus/templates/mail/app/root.tsx +60 -1
  61. package/corpus/templates/mail/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
  62. package/corpus/templates/plan/app/i18n/ar-SA.ts +3 -0
  63. package/corpus/templates/plan/app/i18n/de-DE.ts +4 -0
  64. package/corpus/templates/plan/app/i18n/en-US.ts +4 -0
  65. package/corpus/templates/plan/app/i18n/es-ES.ts +4 -0
  66. package/corpus/templates/plan/app/i18n/fr-FR.ts +4 -0
  67. package/corpus/templates/plan/app/i18n/hi-IN.ts +3 -0
  68. package/corpus/templates/plan/app/i18n/ja-JP.ts +4 -0
  69. package/corpus/templates/plan/app/i18n/ko-KR.ts +4 -0
  70. package/corpus/templates/plan/app/i18n/pt-BR.ts +4 -0
  71. package/corpus/templates/plan/app/i18n/zh-CN.ts +3 -0
  72. package/corpus/templates/plan/app/i18n/zh-TW.ts +3 -0
  73. package/corpus/templates/plan/app/pages/PlansPage.tsx +74 -3
  74. package/corpus/templates/plan/changelog/2026-07-03-error-screens-now-include-a-feedback-button-with-debug-info.md +6 -0
  75. package/corpus/templates/slides/AGENTS.md +7 -3
  76. package/corpus/templates/slides/actions/get-design-system.ts +21 -0
  77. package/corpus/templates/slides/actions/import-file.ts +15 -7
  78. package/corpus/templates/slides/actions/index-design-system-with-builder.ts +14 -37
  79. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +32 -8
  80. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +2 -2
  81. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +2 -4
  82. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +163 -154
  83. package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +19 -15
  84. package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +56 -6
  85. package/corpus/templates/slides/app/components/layout/Layout.tsx +6 -1
  86. package/corpus/templates/slides/app/i18n/ar-SA.ts +8 -7
  87. package/corpus/templates/slides/app/i18n/de-DE.ts +7 -8
  88. package/corpus/templates/slides/app/i18n/en-US.ts +8 -7
  89. package/corpus/templates/slides/app/i18n/es-ES.ts +7 -8
  90. package/corpus/templates/slides/app/i18n/fr-FR.ts +7 -8
  91. package/corpus/templates/slides/app/i18n/hi-IN.ts +8 -7
  92. package/corpus/templates/slides/app/i18n/ja-JP.ts +7 -8
  93. package/corpus/templates/slides/app/i18n/ko-KR.ts +7 -7
  94. package/corpus/templates/slides/app/i18n/pt-BR.ts +7 -8
  95. package/corpus/templates/slides/app/i18n/zh-CN.ts +8 -7
  96. package/corpus/templates/slides/app/i18n/zh-TW.ts +8 -7
  97. package/corpus/templates/slides/app/lib/canvas-zoom.ts +16 -1
  98. package/corpus/templates/slides/app/pages/DeckEditor.tsx +3 -3
  99. package/corpus/templates/slides/changelog/2026-07-03-design-system-setup-now-indexes-figma-code-and-design-md-sou.md +6 -0
  100. package/corpus/templates/slides/changelog/2026-07-03-slide-editing-now-keeps-thumbnails-speaker-notes-styling-and.md +6 -0
  101. package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +16 -104
  102. package/dist/client/AgentPanel.d.ts.map +1 -1
  103. package/dist/client/AgentPanel.js +2 -1
  104. package/dist/client/AgentPanel.js.map +1 -1
  105. package/dist/client/AssistantChat.d.ts.map +1 -1
  106. package/dist/client/AssistantChat.js +77 -25
  107. package/dist/client/AssistantChat.js.map +1 -1
  108. package/dist/client/ErrorBoundary.d.ts.map +1 -1
  109. package/dist/client/ErrorBoundary.js +37 -2
  110. package/dist/client/ErrorBoundary.js.map +1 -1
  111. package/dist/client/ErrorReportActions.d.ts +13 -0
  112. package/dist/client/ErrorReportActions.d.ts.map +1 -0
  113. package/dist/client/ErrorReportActions.js +14 -0
  114. package/dist/client/ErrorReportActions.js.map +1 -0
  115. package/dist/client/FeedbackButton.d.ts +3 -1
  116. package/dist/client/FeedbackButton.d.ts.map +1 -1
  117. package/dist/client/FeedbackButton.js +6 -5
  118. package/dist/client/FeedbackButton.js.map +1 -1
  119. package/dist/client/db-admin/DbAdminPage.d.ts +9 -1
  120. package/dist/client/db-admin/DbAdminPage.d.ts.map +1 -1
  121. package/dist/client/db-admin/DbAdminPage.js +17 -13
  122. package/dist/client/db-admin/DbAdminPage.js.map +1 -1
  123. package/dist/client/db-admin/SqlEditor.d.ts +3 -1
  124. package/dist/client/db-admin/SqlEditor.d.ts.map +1 -1
  125. package/dist/client/db-admin/SqlEditor.js +3 -3
  126. package/dist/client/db-admin/SqlEditor.js.map +1 -1
  127. package/dist/client/db-admin/TableEditor.d.ts +3 -1
  128. package/dist/client/db-admin/TableEditor.d.ts.map +1 -1
  129. package/dist/client/db-admin/TableEditor.js +6 -6
  130. package/dist/client/db-admin/TableEditor.js.map +1 -1
  131. package/dist/client/db-admin/useAgentSync.d.ts +3 -2
  132. package/dist/client/db-admin/useAgentSync.d.ts.map +1 -1
  133. package/dist/client/db-admin/useAgentSync.js +8 -4
  134. package/dist/client/db-admin/useAgentSync.js.map +1 -1
  135. package/dist/client/db-admin/useDbAdmin.d.ts +11 -7
  136. package/dist/client/db-admin/useDbAdmin.d.ts.map +1 -1
  137. package/dist/client/db-admin/useDbAdmin.js +45 -20
  138. package/dist/client/db-admin/useDbAdmin.js.map +1 -1
  139. package/dist/client/error-reporting.d.ts +19 -0
  140. package/dist/client/error-reporting.d.ts.map +1 -0
  141. package/dist/client/error-reporting.js +71 -0
  142. package/dist/client/error-reporting.js.map +1 -0
  143. package/dist/client/index.d.ts +3 -1
  144. package/dist/client/index.d.ts.map +1 -1
  145. package/dist/client/index.js +3 -1
  146. package/dist/client/index.js.map +1 -1
  147. package/dist/client/org/RequireActiveOrg.d.ts.map +1 -1
  148. package/dist/client/org/RequireActiveOrg.js +2 -1
  149. package/dist/client/org/RequireActiveOrg.js.map +1 -1
  150. package/dist/client/visual-style-controls.d.ts +11 -0
  151. package/dist/client/visual-style-controls.d.ts.map +1 -1
  152. package/dist/client/visual-style-controls.js +350 -1
  153. package/dist/client/visual-style-controls.js.map +1 -1
  154. package/dist/collab/routes.d.ts +1 -1
  155. package/dist/collab/struct-routes.d.ts +1 -1
  156. package/dist/db-admin/index.d.ts +3 -0
  157. package/dist/db-admin/index.d.ts.map +1 -0
  158. package/dist/db-admin/index.js +2 -0
  159. package/dist/db-admin/index.js.map +1 -0
  160. package/dist/db-admin/operations.d.ts +26 -5
  161. package/dist/db-admin/operations.d.ts.map +1 -1
  162. package/dist/db-admin/operations.js +66 -55
  163. package/dist/db-admin/operations.js.map +1 -1
  164. package/dist/localization/default-messages.d.ts +3 -0
  165. package/dist/localization/default-messages.d.ts.map +1 -1
  166. package/dist/localization/default-messages.js +3 -0
  167. package/dist/localization/default-messages.js.map +1 -1
  168. package/dist/notifications/routes.d.ts +1 -1
  169. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  170. package/dist/resources/handlers.d.ts +1 -1
  171. package/dist/secrets/routes.d.ts +9 -9
  172. package/dist/server/builder-design-systems.d.ts +61 -0
  173. package/dist/server/builder-design-systems.d.ts.map +1 -1
  174. package/dist/server/builder-design-systems.js +219 -14
  175. package/dist/server/builder-design-systems.js.map +1 -1
  176. package/dist/server/index.d.ts +1 -1
  177. package/dist/server/index.d.ts.map +1 -1
  178. package/dist/server/index.js +1 -1
  179. package/dist/server/index.js.map +1 -1
  180. package/dist/server/transcribe-voice.d.ts +1 -1
  181. package/dist/templates/default/app/root.tsx +47 -0
  182. package/package.json +2 -1
  183. package/src/templates/default/app/root.tsx +47 -0
@@ -2,6 +2,7 @@ import {
2
2
  SIDEBAR_STATE_CHANGE_EVENT,
3
3
  PromptComposer,
4
4
  BuilderSetupCard,
5
+ ErrorReportActions,
5
6
  ShareButton,
6
7
  appPath,
7
8
  agentNativePath,
@@ -15,6 +16,7 @@ import {
15
16
  emailToColor,
16
17
  emailToName,
17
18
  type AgentSidebarStateChangeDetail,
19
+ type ErrorReportDebugItem,
18
20
  type RichMarkdownCollabUser,
19
21
  } from "@agent-native/core/client";
20
22
  import {
@@ -5904,6 +5906,7 @@ export function PlansPage({ localPlanSlug }: { localPlanSlug?: string } = {}) {
5904
5906
  ) : showPlanLoadError ? (
5905
5907
  <PlanLoadError
5906
5908
  error={planQuery.error}
5909
+ planId={selectedId}
5907
5910
  accessStatus={planAccessStatus}
5908
5911
  onRetry={() => void planQuery.refetch()}
5909
5912
  onSignIn={() => openSignIn()}
@@ -7617,6 +7620,35 @@ function ReviewMarkupToolbar({
7617
7620
  );
7618
7621
  }
7619
7622
 
7623
+ function PlanErrorFeedbackActions({
7624
+ title,
7625
+ message,
7626
+ status,
7627
+ extraDebug,
7628
+ }: {
7629
+ title: string;
7630
+ message: string;
7631
+ status?: number;
7632
+ extraDebug?: ErrorReportDebugItem[];
7633
+ }) {
7634
+ const t = useT();
7635
+ return (
7636
+ <ErrorReportActions
7637
+ appName="Plan"
7638
+ title={title}
7639
+ details={message}
7640
+ status={status}
7641
+ issueTitle={`Plan error: ${title}`}
7642
+ feedbackLabel={t("plansPage.loadError.sendFeedback")}
7643
+ feedbackPlaceholder={t("plansPage.loadError.feedbackPlaceholder")}
7644
+ githubLabel={t("plansPage.loadError.openGitHubIssue")}
7645
+ align="start"
7646
+ className="justify-start"
7647
+ extraDebug={extraDebug}
7648
+ />
7649
+ );
7650
+ }
7651
+
7620
7652
  function LocalPlanLoadError({
7621
7653
  error,
7622
7654
  slug,
@@ -7631,6 +7663,7 @@ function LocalPlanLoadError({
7631
7663
  error instanceof Error && error.message
7632
7664
  ? error.message.replace(/^Action [\w-]+ failed:\s*/, "")
7633
7665
  : t("plansPage.localPlanLoadError.message", { slug });
7666
+ const title = t("plansPage.localPlanLoadError.title");
7634
7667
 
7635
7668
  return (
7636
7669
  <div className="flex min-h-0 flex-1 items-center justify-center px-6 py-12">
@@ -7640,9 +7673,7 @@ function LocalPlanLoadError({
7640
7673
  <IconAlertTriangle className="size-5" />
7641
7674
  </div>
7642
7675
  <div>
7643
- <h1 className="text-lg font-semibold tracking-tight">
7644
- {t("plansPage.localPlanLoadError.title")}
7645
- </h1>
7676
+ <h1 className="text-lg font-semibold tracking-tight">{title}</h1>
7646
7677
  <p className="mt-1 text-sm text-muted-foreground">{message}</p>
7647
7678
  </div>
7648
7679
  </div>
@@ -7658,6 +7689,15 @@ function LocalPlanLoadError({
7658
7689
  </Link>
7659
7690
  </Button>
7660
7691
  </div>
7692
+ <div className="mt-4 border-t border-border/70 pt-3">
7693
+ <PlanErrorFeedbackActions
7694
+ title={title}
7695
+ message={message}
7696
+ extraDebug={[
7697
+ { label: "Local plan slug", value: slug }, // i18n-ignore debug label
7698
+ ]}
7699
+ />
7700
+ </div>
7661
7701
  </div>
7662
7702
  </div>
7663
7703
  );
@@ -7665,6 +7705,7 @@ function LocalPlanLoadError({
7665
7705
 
7666
7706
  function PlanLoadError({
7667
7707
  error,
7708
+ planId,
7668
7709
  accessStatus,
7669
7710
  onRetry,
7670
7711
  onSignIn,
@@ -7675,6 +7716,7 @@ function PlanLoadError({
7675
7716
  viewerEmail,
7676
7717
  }: {
7677
7718
  error?: unknown;
7719
+ planId?: string | null;
7678
7720
  accessStatus?: PlanAccessStatusResponse | null;
7679
7721
  onRetry: () => void;
7680
7722
  onSignIn: () => void;
@@ -7822,6 +7864,7 @@ function PlanLoadError({
7822
7864
  : t("plansPage.loadError.maybeOtherOrgBody")
7823
7865
  : t("plansPage.loadError.privateBody")
7824
7866
  : message;
7867
+ const reportMessage = `${body}${message && message !== body ? `\n${message}` : ""}`;
7825
7868
 
7826
7869
  return (
7827
7870
  <div className="flex h-full flex-col items-center justify-center bg-background p-8">
@@ -8007,6 +8050,34 @@ function PlanLoadError({
8007
8050
  )}
8008
8051
  </div>
8009
8052
  ) : null}
8053
+ <div className="mt-4 border-t border-border/70 pt-3">
8054
+ <PlanErrorFeedbackActions
8055
+ title={title}
8056
+ message={reportMessage}
8057
+ status={status}
8058
+ extraDebug={[
8059
+ { label: "Plan id", value: planId }, // i18n-ignore debug label
8060
+ accessStatus?.visibility
8061
+ ? {
8062
+ label: "Plan visibility", // i18n-ignore debug label
8063
+ value: accessStatus.visibility,
8064
+ }
8065
+ : {
8066
+ label: "Plan visibility", // i18n-ignore debug label
8067
+ value: null,
8068
+ },
8069
+ accessStatus?.hasAccess !== undefined
8070
+ ? {
8071
+ label: "Has access", // i18n-ignore debug label
8072
+ value: accessStatus.hasAccess,
8073
+ }
8074
+ : {
8075
+ label: "Has access", // i18n-ignore debug label
8076
+ value: null,
8077
+ },
8078
+ ]}
8079
+ />
8080
+ </div>
8010
8081
  </div>
8011
8082
  <Button
8012
8083
  type="button"
@@ -0,0 +1,6 @@
1
+ ---
2
+ type: improved
3
+ date: 2026-07-03
4
+ ---
5
+
6
+ Plan error screens now include a feedback button with debug context and a prefilled GitHub issue fallback.
@@ -19,9 +19,13 @@ Detailed deck, slide-editing, image, design-system, and export workflows live in
19
19
  - Preserve deck structure and visual consistency. Prefer focused slide edits over
20
20
  regenerating whole decks unless requested.
21
21
  - Follow linked design-system tokens and custom instructions.
22
- - For raw Figma `.fig` uploads, call `import-file --format fig` to start
23
- Builder design-system indexing. Do not create a local design system from raw
24
- `.fig` output.
22
+ - For reusable design-system setup from Figma, connected code/GitHub, local
23
+ code/design files, or optional `design.md`, use Builder-backed DSI indexing
24
+ through `index-design-system-with-builder` or `import-file --format fig`.
25
+ Pass readable `design.md` content as `designMd`, use the returned local design
26
+ system id in Slides flows, and call `get-design-system` before generation to
27
+ hydrate Builder docs/tokens when available. Do not create a duplicate local
28
+ design system from raw Figma/code sources.
25
29
  - Treat import/export actions as shortcuts, not capability limits. When the
26
30
  exact Google Drive endpoint, file metadata field, export format, pagination
27
31
  mode, or API version matters, use `provider-api-catalog`,
@@ -1,4 +1,8 @@
1
1
  import { defineAction } from "@agent-native/core";
2
+ import {
3
+ hydrateBuilderDesignSystemReference,
4
+ parseBuilderDesignSystemProxyReference,
5
+ } from "@agent-native/core/server";
2
6
  import { resolveAccess } from "@agent-native/core/sharing";
3
7
  import { z } from "zod";
4
8
 
@@ -19,6 +23,22 @@ export default defineAction({
19
23
  }
20
24
 
21
25
  const row = access.resource;
26
+ const builderReference = parseBuilderDesignSystemProxyReference(row.data);
27
+ const builder = builderReference
28
+ ? await hydrateBuilderDesignSystemReference(builderReference).catch(
29
+ (error) => ({
30
+ ...builderReference,
31
+ docs: [],
32
+ tokenValues: {},
33
+ docCount: 0,
34
+ warning:
35
+ error instanceof Error
36
+ ? error.message
37
+ : "Builder design-system docs could not be loaded.",
38
+ }),
39
+ )
40
+ : null;
41
+
22
42
  return {
23
43
  id: row.id,
24
44
  title: row.title,
@@ -30,6 +50,7 @@ export default defineAction({
30
50
  visibility: row.visibility,
31
51
  createdAt: row.createdAt,
32
52
  updatedAt: row.updatedAt,
53
+ builder,
33
54
  };
34
55
  },
35
56
  });
@@ -4,12 +4,17 @@ import path from "path";
4
4
  import { defineAction } from "@agent-native/core";
5
5
  import { writeAppState } from "@agent-native/core/application-state";
6
6
  import { startBuilderDesignSystemIndex } from "@agent-native/core/server";
7
+ import {
8
+ getRequestOrgId,
9
+ getRequestUserEmail,
10
+ } from "@agent-native/core/server/request-context";
7
11
  import { assertAccess } from "@agent-native/core/sharing";
8
12
  import { eq } from "drizzle-orm";
9
13
  import { z } from "zod";
10
14
 
11
15
  import { getDb, schema } from "../server/db/index.js";
12
16
  import { notifyClients } from "../server/handlers/decks.js";
17
+ import { upsertBuilderProxyDesignSystem } from "../server/lib/builder-design-system-proxy.js";
13
18
  import { resolveUserUploadedFile } from "./_uploaded-files.js";
14
19
 
15
20
  const DEFAULT_MAX_SOURCE_CHARS = 60_000;
@@ -92,6 +97,14 @@ export default defineAction({
92
97
  },
93
98
  ],
94
99
  });
100
+ const ownerEmail = getRequestUserEmail();
101
+ if (!ownerEmail) throw new Error("no authenticated user");
102
+ const proxy = await upsertBuilderProxyDesignSystem({
103
+ result,
104
+ ownerEmail,
105
+ orgId: getRequestOrgId(),
106
+ projectName: title,
107
+ });
95
108
  return {
96
109
  format: "fig",
97
110
  title,
@@ -99,16 +112,11 @@ export default defineAction({
99
112
  projectId: result.projectId,
100
113
  jobId: result.jobId,
101
114
  designSystemId: result.designSystemId,
115
+ localDesignSystemId: proxy.localDesignSystemId,
102
116
  builderUrl: result.builderUrl,
103
117
  status: result.status,
104
118
  deckId,
105
- instructions: [
106
- "Sent the .fig file to Builder design-system indexing.",
107
- `Builder design system: ${result.designSystemId}`,
108
- `Builder job: ${result.jobId}`,
109
- `Open: ${result.builderUrl}`,
110
- "Do not call create-design-system locally for this .fig file; Builder owns the indexed design-system docs and generated usage guidance.",
111
- ].join("\n"),
119
+ instructions: proxy.instructions,
112
120
  };
113
121
  }
114
122
 
@@ -1,7 +1,7 @@
1
1
  import { defineAction } from "@agent-native/core";
2
2
  import {
3
+ buildBuilderDesignSystemIndexFiles,
3
4
  startBuilderDesignSystemIndex,
4
- type BuilderDesignSystemIndexFile,
5
5
  } from "@agent-native/core/server";
6
6
  import {
7
7
  getRequestOrgId,
@@ -11,50 +11,17 @@ import { z } from "zod";
11
11
 
12
12
  import { upsertBuilderProxyDesignSystem } from "../server/lib/builder-design-system-proxy.js";
13
13
 
14
- const MAX_CODE_FILES = 50;
15
- const MAX_TOTAL_CODE_BYTES = 2 * 1024 * 1024;
16
-
17
14
  const codeFileSchema = z.object({
18
15
  filename: z.string().trim().min(1).describe("File name or relative path"),
19
16
  content: z.string().describe("Raw text content of the code/design file"),
20
17
  mimeType: z.string().trim().optional().describe("Optional MIME type"),
21
18
  });
22
19
 
23
- function mimeTypeForFilename(filename: string, explicit?: string): string {
24
- if (explicit?.trim()) return explicit.trim();
25
- const lower = filename.toLowerCase();
26
- if (lower.endsWith(".css")) return "text/css";
27
- if (lower.endsWith(".json")) return "application/json";
28
- if (lower.endsWith(".md") || lower.endsWith(".mdx")) return "text/markdown";
29
- if (lower.endsWith(".html")) return "text/html";
30
- if (lower.endsWith(".svg")) return "image/svg+xml";
31
- return "text/plain";
32
- }
33
-
34
- function makeFiles(
35
- codeFiles: Array<z.infer<typeof codeFileSchema>> | undefined,
36
- ): BuilderDesignSystemIndexFile[] {
37
- const encoder = new TextEncoder();
38
- const files: BuilderDesignSystemIndexFile[] = [];
39
- let totalBytes = 0;
40
- for (const file of (codeFiles ?? []).slice(0, MAX_CODE_FILES)) {
41
- const data = encoder.encode(file.content);
42
- if (totalBytes + data.byteLength > MAX_TOTAL_CODE_BYTES) break;
43
- totalBytes += data.byteLength;
44
- files.push({
45
- name: file.filename.replace(/^\/+/, "") || "code.txt",
46
- data,
47
- mimeType: mimeTypeForFilename(file.filename, file.mimeType),
48
- });
49
- }
50
- return files;
51
- }
52
-
53
20
  export default defineAction({
54
21
  description:
55
- "Start Builder design-system indexing from a GitHub repository and/or code files. " +
22
+ "Start Builder DSI design-system indexing from connected code, a GitHub repository, code/design files, and optional design.md guidance. " +
56
23
  "Use this instead of local import-code/import-github when the user wants a reusable brand kit or slide design system. " +
57
- "Requires Builder.io to be connected; Builder owns the indexed design-system docs, generated guidance, and job state.",
24
+ "Requires Builder.io to be connected; Builder owns the indexed design-system docs, generated guidance, token/component extraction, and job state.",
58
25
  schema: z.object({
59
26
  projectName: z
60
27
  .string()
@@ -76,6 +43,12 @@ export default defineAction({
76
43
  .array(codeFileSchema)
77
44
  .optional()
78
45
  .describe("Optional inlined code/design files to upload to Builder"),
46
+ designMd: z
47
+ .string()
48
+ .optional()
49
+ .describe(
50
+ "Optional design.md guidance to upload to Builder DSI alongside Figma/code sources",
51
+ ),
79
52
  }),
80
53
  run: async ({
81
54
  projectName,
@@ -83,8 +56,12 @@ export default defineAction({
83
56
  githubRepoUrl,
84
57
  connectedProjectId,
85
58
  codeFiles,
59
+ designMd,
86
60
  }) => {
87
- const files = makeFiles(codeFiles);
61
+ const files = buildBuilderDesignSystemIndexFiles({
62
+ codeFiles,
63
+ designMd,
64
+ });
88
65
  const result = await startBuilderDesignSystemIndex({
89
66
  projectName,
90
67
  description,
@@ -87,6 +87,11 @@ function normalizeWebsiteUrlInput(input: string): string | null {
87
87
  }
88
88
  }
89
89
 
90
+ function isDesignMdFile(file: UploadedFile) {
91
+ const name = file.name.split(/[\\/]/).pop()?.toLowerCase() ?? file.name;
92
+ return name === "design.md" || name === "design.mdx";
93
+ }
94
+
90
95
  export function DesignSystemSetup({
91
96
  open,
92
97
  onClose,
@@ -328,7 +333,7 @@ export function DesignSystemSetup({
328
333
 
329
334
  const parts: string[] = [];
330
335
  parts.push(
331
- "Set up a design system from the following sources. Analyze each source, extract design tokens (colors, fonts, spacing, borders), and create a cohesive design system for my slide decks.",
336
+ "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 for my slide decks.",
332
337
  );
333
338
 
334
339
  if (companyName.trim()) {
@@ -343,15 +348,21 @@ export function DesignSystemSetup({
343
348
 
344
349
  if (githubLinks.length > 0) {
345
350
  parts.push(
346
- `\n## GitHub Repositories\nStart Builder design-system indexing for each repository with \`index-design-system-with-builder\`:\n${githubLinks.map((l) => `- ${l.url}`).join("\n")}\n\nBuilder is the source of truth for repo/code design-system indexing. The action also creates a local selectable proxy design system for Slides flows. If Builder is not connected, stop and tell me to connect Builder from Settings.`,
351
+ `\n## Connect Code: GitHub Repositories\nStart Builder DSI indexing for each repository with \`index-design-system-with-builder\`:\n${githubLinks.map((l) => `- ${l.url}`).join("\n")}\n\nBuilder is the source of truth for repo/code design-system indexing. The action also creates a local selectable proxy design system for Slides flows. If Builder is not connected, stop and tell me to connect Builder from Settings.`,
347
352
  );
348
353
  }
349
354
 
355
+ const designMdFiles = [...codeFiles, ...docFiles].filter(
356
+ (file) => file.textContent && isDesignMdFile(file),
357
+ );
358
+
350
359
  if (codeFiles.length > 0) {
351
- const withContent = codeFiles.filter((f) => f.textContent);
360
+ const withContent = codeFiles.filter(
361
+ (f) => f.textContent && !isDesignMdFile(f),
362
+ );
352
363
  if (withContent.length > 0) {
353
364
  parts.push(
354
- `\n## Code Files (${withContent.length} files)\nStart Builder design-system indexing with \`index-design-system-with-builder\` using these files:`,
365
+ `\n## Connect Code: Code Files (${withContent.length} files)\nStart Builder DSI indexing with \`index-design-system-with-builder\` using these files as the \`codeFiles\` argument:`,
355
366
  );
356
367
  for (const f of withContent) {
357
368
  parts.push(
@@ -361,14 +372,27 @@ export function DesignSystemSetup({
361
372
  }
362
373
  }
363
374
 
375
+ if (designMdFiles.length > 0) {
376
+ parts.push(
377
+ `\n## Optional design.md (${designMdFiles.length} file${designMdFiles.length === 1 ? "" : "s"})\nPass this content as the \`designMd\` argument to \`index-design-system-with-builder\` alongside any Figma/code sources:`,
378
+ );
379
+ for (const f of designMdFiles) {
380
+ parts.push(
381
+ `\n### ${f.name}\n\`\`\`md\n${inlineText(f.textContent!)}\n\`\`\``,
382
+ );
383
+ }
384
+ }
385
+
364
386
  if (builderIndexResult) {
365
387
  parts.push(
366
- `\n## Builder-Indexed Figma File\nBuilder design-system indexing has already started.\n- Design system: ${builderIndexResult.designSystemId}\n- Local selectable design system: ${builderIndexResult.localDesignSystemId ?? "(not returned)"}\n- Project: ${builderIndexResult.projectId}\n- Job: ${builderIndexResult.jobId}\n- URL: ${builderIndexResult.builderUrl}\n\nUse Builder as the source of truth for extracted tokens, assets, and guidance. Do not call \`create-design-system\` again for this Builder-indexed source.`,
388
+ `\n## Connect Figma: Builder-Indexed Figma File\nBuilder DSI indexing has already started.\n- Design system: ${builderIndexResult.designSystemId}\n- Local selectable design system: ${builderIndexResult.localDesignSystemId ?? "(not returned)"}\n- Project: ${builderIndexResult.projectId}\n- Job: ${builderIndexResult.jobId}\n- URL: ${builderIndexResult.builderUrl}\n\nUse Builder as the source of truth for extracted tokens, assets, components, and guidance. Do not call \`create-design-system\` again for this Builder-indexed source.`,
367
389
  );
368
390
  }
369
391
 
370
392
  if (docFiles.length > 0) {
371
- const inlined = docFiles.filter((f) => f.textContent);
393
+ const inlined = docFiles.filter(
394
+ (f) => f.textContent && !isDesignMdFile(f),
395
+ );
372
396
  const binary = docFiles.filter((f) => !f.textContent);
373
397
  if (inlined.length > 0) {
374
398
  parts.push(
@@ -413,7 +437,7 @@ export function DesignSystemSetup({
413
437
  }
414
438
 
415
439
  parts.push(
416
- `\n---\nAfter processing all sources, if you started Builder design-system indexing, report the Builder job/design-system URL plus the local selectable design-system id returned by \`index-design-system-with-builder\`. Do not call \`create-design-system\` again for those Builder-indexed sources. If you processed non-Builder sources into concrete tokens, call \`create-design-system\` with the combined tokens${
440
+ `\n---\nAfter processing all sources, if you started Builder DSI indexing, report the Builder job/design-system URL plus the local selectable design-system id returned by \`index-design-system-with-builder\`. Do not call \`create-design-system\` again for Builder-indexed Figma/code/design.md sources. If you processed non-Builder sources into concrete tokens, call \`create-design-system\` with the combined tokens${
417
441
  customInstructions.trim()
418
442
  ? " AND the verbatim --customInstructions string from above"
419
443
  : ""
@@ -624,7 +648,7 @@ export function DesignSystemSetup({
624
648
  ref={codeInputRef}
625
649
  type="file"
626
650
  multiple
627
- accept=".css,.scss,.sass,.less,.ts,.tsx,.js,.jsx,.json,.html"
651
+ accept=".css,.scss,.sass,.less,.ts,.tsx,.js,.jsx,.json,.html,.svg,.xml,.md,.markdown,.mdx,.txt"
628
652
  onChange={(e) => {
629
653
  if (e.target.files)
630
654
  readTextFiles(e.target.files, setCodeFiles);
@@ -638,7 +638,7 @@ export default function EditorSidebar({
638
638
  }, [slides, activeSlideId, onSelectSlide]);
639
639
 
640
640
  return (
641
- <div className="flex h-full w-56 flex-shrink-0 flex-col border-r border-border/70 bg-background/95 sm:w-64">
641
+ <div className="flex h-full min-h-0 w-56 flex-shrink-0 flex-col border-r border-border/70 bg-background/95 sm:w-64">
642
642
  <div className="flex items-center justify-between border-b border-border/70 p-3">
643
643
  <span className="text-xs font-medium text-muted-foreground uppercase tracking-wider">
644
644
  {t("editorSidebar.slides")}
@@ -664,7 +664,7 @@ export default function EditorSidebar({
664
664
 
665
665
  <div
666
666
  ref={thumbScrollRef}
667
- className="relative flex-1 space-y-1 overflow-y-auto p-2"
667
+ className="relative min-h-0 flex-1 space-y-1 overflow-y-auto overscroll-contain p-2"
668
668
  >
669
669
  <SortableContext
670
670
  items={slides.map((s) => s.id)}
@@ -6,7 +6,6 @@ import {
6
6
  } from "@agent-native/core/client";
7
7
  import {
8
8
  AgentToggleButton,
9
- NotificationsBell,
10
9
  ShareButton,
11
10
  PresenceBar,
12
11
  type CollabUser,
@@ -35,7 +34,7 @@ import {
35
34
  IconUpload,
36
35
  IconSun,
37
36
  IconMoon,
38
- IconDots,
37
+ IconDotsVertical,
39
38
  IconPalette,
40
39
  IconLoader2,
41
40
  } from "@tabler/icons-react";
@@ -977,7 +976,7 @@ graph TD
977
976
  className="p-2.5 sm:p-1.5 rounded-md hover:bg-accent transition-colors flex-shrink-0 text-muted-foreground hover:text-foreground/70 cursor-pointer"
978
977
  aria-label={t("editorToolbar.more")}
979
978
  >
980
- <IconDots className="w-4 h-4" />
979
+ <IconDotsVertical className="w-4 h-4" />
981
980
  </button>
982
981
  </DropdownMenuTrigger>
983
982
  </TooltipTrigger>
@@ -1015,7 +1014,6 @@ graph TD
1015
1014
  </DropdownMenuContent>
1016
1015
  </DropdownMenu>
1017
1016
 
1018
- <NotificationsBell />
1019
1017
  <RunsTray pollMs={1500} />
1020
1018
  <AgentToggleButton />
1021
1019
  </div>