@agent-native/core 0.128.0 → 0.128.2

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 (132) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +27 -0
  3. package/corpus/core/package.json +3 -1
  4. package/corpus/core/src/server/builder-design-systems.ts +299 -82
  5. package/corpus/core/src/server/email-template.ts +33 -0
  6. package/corpus/core/src/server/index.ts +8 -0
  7. package/corpus/templates/analytics/_gitignore +2 -0
  8. package/corpus/templates/assets/_gitignore +2 -0
  9. package/corpus/templates/calendar/_gitignore +2 -0
  10. package/corpus/templates/chat/_gitignore +2 -0
  11. package/corpus/templates/clips/AGENTS.md +6 -1
  12. package/corpus/templates/clips/_gitignore +2 -0
  13. package/corpus/templates/clips/actions/complete-transactional-email-summary.ts +56 -0
  14. package/corpus/templates/clips/actions/import-loom-recording.ts +258 -76
  15. package/corpus/templates/clips/actions/lib/direct-video.ts +96 -0
  16. package/corpus/templates/clips/actions/lib/loom-import-job.ts +53 -2
  17. package/corpus/templates/clips/actions/lib/loom-video.ts +2 -62
  18. package/corpus/templates/clips/actions/lib/video-download-limits.ts +62 -0
  19. package/corpus/templates/clips/actions/list-transactional-email-ai-requests.ts +249 -0
  20. package/corpus/templates/clips/app/components/library/library-grid.tsx +65 -0
  21. package/corpus/templates/clips/app/components/library/library-layout.tsx +55 -0
  22. package/corpus/templates/clips/app/components/recorder/pre-record-panel.tsx +28 -126
  23. package/corpus/templates/clips/app/global.css +23 -0
  24. package/corpus/templates/clips/app/hooks/use-transactional-email-bridge.ts +98 -0
  25. package/corpus/templates/clips/app/i18n/en-US.ts +20 -0
  26. package/corpus/templates/clips/app/routes/_app.tsx +2 -0
  27. package/corpus/templates/clips/app/routes/import.tsx +396 -0
  28. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +8 -6
  29. package/corpus/templates/clips/app/routes/record.tsx +13 -71
  30. package/corpus/templates/clips/changelog/2026-07-25-two-clip-emails-now-include-a-concise-summary-generated-secu.md +6 -0
  31. package/corpus/templates/clips/data/clips-transactional-emails/config.json +3 -0
  32. package/corpus/templates/clips/server/jobs/transactional-emails.ts +1034 -0
  33. package/corpus/templates/clips/server/lib/transactional-email-store.ts +865 -0
  34. package/corpus/templates/clips/server/lib/transactional-email-templates.ts +270 -0
  35. package/corpus/templates/clips/server/plugins/calendar-jobs.ts +2 -0
  36. package/corpus/templates/clips/server/routes/api/view-event.post.ts +59 -2
  37. package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +8 -2
  38. package/corpus/templates/content/AGENTS.md +8 -0
  39. package/corpus/templates/content/_gitignore +2 -0
  40. package/corpus/templates/content/actions/_content-database-personal-view.ts +28 -3
  41. package/corpus/templates/content/actions/_property-utils.ts +32 -2
  42. package/corpus/templates/content/actions/configure-document-property.ts +12 -2
  43. package/corpus/templates/content/actions/delete-document-property.ts +13 -3
  44. package/corpus/templates/content/actions/duplicate-document-property.ts +13 -3
  45. package/corpus/templates/content/actions/list-content-spaces.ts +5 -2
  46. package/corpus/templates/content/actions/list-document-properties.ts +12 -3
  47. package/corpus/templates/content/actions/move-database-item.ts +74 -55
  48. package/corpus/templates/content/actions/reorder-document-property.ts +20 -4
  49. package/corpus/templates/content/actions/set-document-property.ts +10 -1
  50. package/corpus/templates/content/actions/update-content-database-personal-view.ts +7 -0
  51. package/corpus/templates/content/app/components/editor/DocumentBlockFields.tsx +31 -21
  52. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +30 -3
  53. package/corpus/templates/content/app/components/editor/DocumentInfoPanel.tsx +8 -1
  54. package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +72 -20
  55. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +79 -10
  56. package/corpus/templates/content/app/components/editor/database/TimelineView.tsx +8 -1
  57. package/corpus/templates/content/app/components/editor/database/settings.tsx +6 -0
  58. package/corpus/templates/content/app/components/editor/database/sidebar.tsx +246 -26
  59. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +491 -197
  60. package/corpus/templates/content/app/components/sidebar/DocumentTreeItem.tsx +3 -3
  61. package/corpus/templates/content/app/components/sidebar/sidebar-reorder.tsx +409 -0
  62. package/corpus/templates/content/app/hooks/use-content-database.ts +117 -3
  63. package/corpus/templates/content/app/hooks/use-content-spaces.ts +1 -0
  64. package/corpus/templates/content/app/hooks/use-document-properties.ts +62 -18
  65. package/corpus/templates/content/app/hooks/use-documents.ts +13 -5
  66. package/corpus/templates/content/app/i18n-data.ts +261 -3
  67. package/corpus/templates/content/app/routes/_app.page.$id.tsx +9 -2
  68. package/corpus/templates/content/changelog/2026-07-24-database-page-properties-keep-their-context.md +6 -0
  69. package/corpus/templates/content/changelog/2026-07-26-sidebar-references-can-now-be-personally-reordered.md +6 -0
  70. package/corpus/templates/content/docs/solutions/2026-07-24-database-property-context-switch-diagnosis.md +249 -0
  71. package/corpus/templates/content/docs/solutions/content-sidebar-order-shape.md +389 -0
  72. package/corpus/templates/content/shared/api.ts +28 -0
  73. package/corpus/templates/design/_gitignore +2 -0
  74. package/corpus/templates/design/app/i18n-data.ts +10 -0
  75. package/corpus/templates/design/app/lib/builder-design-system-upload.ts +280 -0
  76. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +90 -54
  77. package/corpus/templates/design/changelog/2026-07-28-figma-fig-uploads-now-show-indexing-progress-and-an-open-in-.md +6 -0
  78. package/corpus/templates/design/server/handlers/design-system-decode-job-status.ts +49 -0
  79. package/corpus/templates/design/server/handlers/design-system-upload-start.ts +87 -0
  80. package/corpus/templates/design/server/handlers/index-design-system-sources.ts +82 -0
  81. package/corpus/templates/design/server/routes/api/design-system-decode-job-status.get.ts +1 -0
  82. package/corpus/templates/design/server/routes/api/design-system-upload-start.post.ts +1 -0
  83. package/corpus/templates/design/server/routes/api/index-design-system-sources.post.ts +1 -0
  84. package/corpus/templates/dispatch/_gitignore +2 -0
  85. package/corpus/templates/forms/_gitignore +2 -0
  86. package/corpus/templates/macros/_gitignore +2 -0
  87. package/corpus/templates/mail/_gitignore +2 -0
  88. package/corpus/templates/plan/_gitignore +2 -0
  89. package/corpus/templates/slides/_gitignore +2 -0
  90. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +126 -53
  91. package/corpus/templates/slides/app/components/design-system/builder-design-system-upload.ts +271 -0
  92. package/corpus/templates/slides/app/components/design-system/builder-index-response.ts +1 -1
  93. package/corpus/templates/slides/app/i18n/en-US.ts +1 -0
  94. package/corpus/templates/slides/server/handlers/design-system-decode-job-status.ts +49 -0
  95. package/corpus/templates/slides/server/handlers/design-system-upload-start.ts +87 -0
  96. package/corpus/templates/slides/server/handlers/index-design-system-sources.ts +79 -0
  97. package/corpus/templates/slides/server/routes/api/design-system-decode-job-status.get.ts +1 -0
  98. package/corpus/templates/slides/server/routes/api/design-system-upload-start.post.ts +1 -0
  99. package/corpus/templates/slides/server/routes/api/index-design-system-sources.post.ts +1 -0
  100. package/corpus/templates/tasks/_gitignore +2 -0
  101. package/corpus/toolkit/CHANGELOG.md +6 -0
  102. package/corpus/toolkit/package.json +1 -1
  103. package/corpus/toolkit/src/editor/DragHandle.ts +63 -9
  104. package/dist/collab/routes.d.ts +1 -1
  105. package/dist/collab/struct-routes.d.ts +1 -1
  106. package/dist/observability/routes.d.ts +3 -3
  107. package/dist/progress/routes.d.ts +1 -1
  108. package/dist/provider-api/actions/custom-provider-registration.d.ts +10 -10
  109. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  110. package/dist/server/builder-design-systems.d.ts +49 -0
  111. package/dist/server/builder-design-systems.d.ts.map +1 -1
  112. package/dist/server/builder-design-systems.js +221 -69
  113. package/dist/server/builder-design-systems.js.map +1 -1
  114. package/dist/server/email-template.d.ts +7 -0
  115. package/dist/server/email-template.d.ts.map +1 -1
  116. package/dist/server/email-template.js +24 -0
  117. package/dist/server/email-template.js.map +1 -1
  118. package/dist/server/index.d.ts +1 -1
  119. package/dist/server/index.d.ts.map +1 -1
  120. package/dist/server/index.js +1 -1
  121. package/dist/server/index.js.map +1 -1
  122. package/dist/server/transcribe-voice.d.ts +1 -1
  123. package/dist/templates/chat/_gitignore +2 -0
  124. package/package.json +5 -3
  125. package/src/server/builder-design-systems.ts +299 -82
  126. package/src/server/email-template.ts +33 -0
  127. package/src/server/index.ts +8 -0
  128. package/src/templates/chat/_gitignore +2 -0
  129. package/corpus/templates/design/server/handlers/index-design-system-with-builder.ts +0 -151
  130. package/corpus/templates/design/server/routes/api/index-design-system-with-builder.post.ts +0 -1
  131. package/corpus/templates/slides/server/handlers/index-design-system-with-builder.ts +0 -119
  132. package/corpus/templates/slides/server/routes/api/index-design-system-with-builder.post.ts +0 -1
@@ -1,151 +0,0 @@
1
- import { getOrgContext } from "@agent-native/core/org";
2
- import {
3
- FeatureNotConfiguredError,
4
- getSession,
5
- runWithRequestContext,
6
- startBuilderDesignSystemIndex,
7
- } from "@agent-native/core/server";
8
- import {
9
- defineEventHandler,
10
- getRequestHeader,
11
- readMultipartFormData,
12
- setResponseStatus,
13
- } from "h3";
14
-
15
- import { upsertBuilderProxyDesignSystem } from "../lib/builder-design-system-proxy.js";
16
-
17
- const MAX_FIG_BYTES = 200 * 1024 * 1024;
18
- const MULTIPART_OVERHEAD_BYTES = 1024 * 1024;
19
-
20
- function requestContentLength(event: Parameters<typeof getRequestHeader>[0]) {
21
- const raw = getRequestHeader(event, "content-length");
22
- if (!raw) return null;
23
- const parsed = Number(raw);
24
- return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
25
- }
26
-
27
- /**
28
- * Builder-indexing endpoint: accepts a `.fig` upload (multipart field `file`)
29
- * and starts Builder's design-system indexing pipeline. The app does not
30
- * process `.fig` files locally; Builder owns the generated docs and the
31
- * asynchronous indexing job.
32
- */
33
- export const indexDesignSystemWithBuilder = defineEventHandler(
34
- async (event) => {
35
- const session = await getSession(event).catch(() => null);
36
- if (!session?.email) {
37
- setResponseStatus(event, 401);
38
- return { error: "Unauthorized" };
39
- }
40
-
41
- const contentLength = requestContentLength(event);
42
- if (contentLength === null) {
43
- setResponseStatus(event, 411);
44
- return { error: "A valid Content-Length header is required." };
45
- }
46
- if (contentLength > MAX_FIG_BYTES + MULTIPART_OVERHEAD_BYTES) {
47
- setResponseStatus(event, 413);
48
- return {
49
- error: `File too large (max ${Math.round(MAX_FIG_BYTES / 1024 / 1024)} MB).`,
50
- };
51
- }
52
-
53
- let parts;
54
- try {
55
- parts = await readMultipartFormData(event);
56
- } catch {
57
- setResponseStatus(event, 413);
58
- return { error: "Upload too large or malformed." };
59
- }
60
- const part = parts?.find(
61
- (p) => (p.name === "file" || p.name === "fig") && p.data,
62
- );
63
- if (!part) {
64
- setResponseStatus(event, 400);
65
- return {
66
- error: "No .fig file uploaded (expected multipart field 'file').",
67
- };
68
- }
69
- if (part.data.length > MAX_FIG_BYTES) {
70
- setResponseStatus(event, 413);
71
- return {
72
- error: `File too large (max ${Math.round(MAX_FIG_BYTES / 1024 / 1024)} MB).`,
73
- };
74
- }
75
- const filename = part.filename || "brand.fig";
76
- const uploadedBytes = Buffer.from(part.data);
77
- const isFigName = filename.toLowerCase().endsWith(".fig");
78
- const isFigBytes =
79
- uploadedBytes.subarray(0, 8).toString("utf8") === "fig-kiwi" ||
80
- uploadedBytes
81
- .subarray(0, 4)
82
- .equals(Buffer.from([0x50, 0x4b, 0x03, 0x04]));
83
- if (!isFigName || !isFigBytes) {
84
- setResponseStatus(event, 400);
85
- return { error: "Uploaded file is not a valid .fig container." };
86
- }
87
-
88
- const suggestedTitle =
89
- (part.filename || "Imported brand")
90
- .replace(/\.fig$/i, "")
91
- .replace(/[-_]+/g, " ")
92
- .trim() || "Imported brand";
93
-
94
- // `session.orgId` is set at sign-in and not refreshed when the user
95
- // switches orgs; `getOrgContext` resolves the live active-org setting.
96
- let orgId: string | undefined;
97
- try {
98
- orgId = (await getOrgContext(event)).orgId ?? undefined;
99
- } catch {
100
- // Org tables can be unavailable during first boot; fall back below.
101
- }
102
- orgId ??= session.orgId ?? undefined;
103
-
104
- try {
105
- return await runWithRequestContext(
106
- { userEmail: session.email, orgId },
107
- async () => {
108
- const result = await startBuilderDesignSystemIndex({
109
- projectName: suggestedTitle,
110
- files: [
111
- {
112
- name: filename,
113
- data: part.data,
114
- mimeType: "application/octet-stream",
115
- },
116
- ],
117
- });
118
- const proxy = await upsertBuilderProxyDesignSystem({
119
- result,
120
- ownerEmail: session.email,
121
- orgId: orgId ?? null,
122
- projectName: suggestedTitle,
123
- });
124
- return {
125
- ...result,
126
- ...proxy,
127
- uploadedFileCount: 1,
128
- };
129
- },
130
- );
131
- } catch (err) {
132
- if (err instanceof FeatureNotConfiguredError) {
133
- setResponseStatus(event, 412);
134
- return {
135
- error:
136
- err.message ||
137
- "Connect Builder.io before indexing a design system from Figma.",
138
- builderConnectUrl:
139
- err.builderConnectUrl ?? "/_agent-native/builder/connect",
140
- };
141
- }
142
- setResponseStatus(event, 502);
143
- return {
144
- error:
145
- err instanceof Error
146
- ? err.message
147
- : "Builder design-system indexing failed.",
148
- };
149
- }
150
- },
151
- );
@@ -1 +0,0 @@
1
- export { indexDesignSystemWithBuilder as default } from "../../handlers/index-design-system-with-builder";
@@ -1,119 +0,0 @@
1
- import {
2
- FeatureNotConfiguredError,
3
- getSession,
4
- startBuilderDesignSystemIndex,
5
- } from "@agent-native/core/server";
6
- import {
7
- defineEventHandler,
8
- getRequestHeader,
9
- readMultipartFormData,
10
- setResponseStatus,
11
- } from "h3";
12
-
13
- import { upsertBuilderProxyDesignSystem } from "../lib/builder-design-system-proxy.js";
14
- import { withSlidesRequestContext } from "./request-auth-context.js";
15
-
16
- const MAX_FIG_BYTES = 200 * 1024 * 1024;
17
- const MULTIPART_OVERHEAD_BYTES = 1024 * 1024;
18
-
19
- function requestContentLength(event: Parameters<typeof getRequestHeader>[0]) {
20
- const raw = getRequestHeader(event, "content-length");
21
- if (!raw) return null;
22
- const parsed = Number(raw);
23
- return Number.isFinite(parsed) && parsed >= 0 ? parsed : null;
24
- }
25
-
26
- export const indexDesignSystemWithBuilder = defineEventHandler(
27
- async (event) => {
28
- const session = await getSession(event).catch(() => null);
29
- if (!session?.email) {
30
- setResponseStatus(event, 401);
31
- return { error: "Unauthorized" };
32
- }
33
-
34
- const contentLength = requestContentLength(event);
35
- if (
36
- contentLength !== null &&
37
- contentLength > MAX_FIG_BYTES + MULTIPART_OVERHEAD_BYTES
38
- ) {
39
- setResponseStatus(event, 413);
40
- return {
41
- error: `File too large (max ${Math.round(MAX_FIG_BYTES / 1024 / 1024)} MB).`,
42
- };
43
- }
44
-
45
- let parts;
46
- try {
47
- parts = await readMultipartFormData(event);
48
- } catch {
49
- setResponseStatus(event, 413);
50
- return { error: "Upload too large or malformed." };
51
- }
52
-
53
- const part = parts?.find(
54
- (p) => (p.name === "file" || p.name === "fig") && p.data,
55
- );
56
- if (!part) {
57
- setResponseStatus(event, 400);
58
- return {
59
- error: "No .fig file uploaded (expected multipart field 'file').",
60
- };
61
- }
62
- if (part.data.length > MAX_FIG_BYTES) {
63
- setResponseStatus(event, 413);
64
- return {
65
- error: `File too large (max ${Math.round(MAX_FIG_BYTES / 1024 / 1024)} MB).`,
66
- };
67
- }
68
-
69
- const suggestedTitle =
70
- (part.filename || "Imported brand")
71
- .replace(/\.fig$/i, "")
72
- .replace(/[-_]+/g, " ")
73
- .trim() || "Imported brand";
74
-
75
- try {
76
- return await withSlidesRequestContext(event, async ({ orgId }) => {
77
- const result = await startBuilderDesignSystemIndex({
78
- projectName: suggestedTitle,
79
- files: [
80
- {
81
- name: part.filename || "brand.fig",
82
- data: part.data,
83
- mimeType: "application/octet-stream",
84
- },
85
- ],
86
- });
87
- const proxy = await upsertBuilderProxyDesignSystem({
88
- result,
89
- ownerEmail: session.email,
90
- orgId: orgId ?? null,
91
- projectName: suggestedTitle,
92
- });
93
- return {
94
- ...result,
95
- ...proxy,
96
- uploadedFileCount: 1,
97
- };
98
- });
99
- } catch (err) {
100
- if (err instanceof FeatureNotConfiguredError) {
101
- setResponseStatus(event, 412);
102
- return {
103
- error:
104
- err.message ||
105
- "Connect Builder.io before indexing a design system from Figma.",
106
- builderConnectUrl:
107
- err.builderConnectUrl ?? "/_agent-native/builder/connect",
108
- };
109
- }
110
- setResponseStatus(event, 502);
111
- return {
112
- error:
113
- err instanceof Error
114
- ? err.message
115
- : "Builder design-system indexing failed.",
116
- };
117
- }
118
- },
119
- );
@@ -1 +0,0 @@
1
- export { indexDesignSystemWithBuilder as default } from "../../handlers/index-design-system-with-builder";