@agent-native/core 0.101.13 → 0.101.14
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.
- package/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +7 -0
- package/corpus/core/package.json +4 -2
- package/corpus/core/src/cli/create.ts +32 -10
- package/corpus/core/src/client/AgentPanel.tsx +61 -48
- package/corpus/core/src/client/chat/message-components.tsx +1 -0
- package/corpus/core/src/client/chat/tool-call-display.tsx +12 -2
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +1 -1
- package/corpus/templates/clips/app/i18n/ar-SA.ts +1 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +1 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +1 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +1 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +1 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +1 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +1 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +1 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +1 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +1 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +1 -0
- package/corpus/templates/clips/changelog/2026-07-15-public-clip-links-are-labeled-share-with-humans-for-clarity.md +6 -0
- package/corpus/templates/forms/actions/delete-form.ts +4 -0
- package/corpus/templates/forms/actions/patch-form-fields.ts +3 -0
- package/corpus/templates/forms/actions/restore-form.ts +3 -0
- package/corpus/templates/forms/actions/update-form.ts +3 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +2 -2
- package/corpus/templates/forms/app/pages/ResponsesPage.tsx +2 -2
- package/corpus/templates/forms/changelog/2026-07-15-published-forms-now-reflect-field-updates-immediately-at-the.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-15-response-rows-now-keep-every-column-aligned-to-the-top-for-c.md +6 -0
- package/corpus/templates/forms/server/handlers/forms.ts +1 -0
- package/corpus/templates/forms/server/lib/public-form-ssr.ts +47 -4
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +189 -82
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +1 -1
- package/dist/cli/create.d.ts +5 -2
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +22 -11
- package/dist/cli/create.js.map +1 -1
- package/dist/client/AgentPanel.d.ts +2 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +24 -13
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +1 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +3 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +6 -5
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +492 -0
- package/dist/templates/chat/.agents/skills/adding-a-feature/SKILL.md +189 -0
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +76 -0
- package/dist/templates/chat/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/dist/templates/chat/.agents/skills/create-skill/SKILL.md +221 -0
- package/dist/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +112 -0
- package/dist/templates/chat/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/dist/templates/chat/.agents/skills/security/SKILL.md +280 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +106 -0
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +95 -0
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/dist/templates/chat/.env.example +5 -0
- package/dist/templates/chat/.ignore +0 -0
- package/dist/templates/chat/.oxfmtrc.json +8 -0
- package/dist/templates/chat/.react-router/types/+server-build.d.ts +18 -0
- package/dist/templates/chat/.react-router/types/app/+types/root.ts +68 -0
- package/dist/templates/chat/AGENTS.md +62 -0
- package/dist/templates/chat/CHANGELOG.md +10 -0
- package/dist/templates/chat/DEVELOPING.md +185 -0
- package/dist/templates/chat/README.md +32 -0
- package/dist/templates/chat/_gitignore +43 -0
- package/dist/templates/chat/actions/hello.ts +13 -0
- package/dist/templates/chat/actions/navigate.ts +41 -0
- package/dist/templates/chat/actions/run.ts +2 -0
- package/dist/templates/chat/actions/view-screen.ts +31 -0
- package/dist/templates/chat/app/components/layout/Header.tsx +59 -0
- package/dist/templates/chat/app/components/layout/Layout.tsx +184 -0
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +580 -0
- package/dist/templates/chat/app/components/ui/button.tsx +1 -0
- package/dist/templates/chat/app/components/ui/card.tsx +1 -0
- package/dist/templates/chat/app/components/ui/dropdown-menu.tsx +1 -0
- package/dist/templates/chat/app/components/ui/input.tsx +1 -0
- package/dist/templates/chat/app/components/ui/label.tsx +1 -0
- package/dist/templates/chat/app/components/ui/sheet.tsx +1 -0
- package/dist/templates/chat/app/components/ui/toolkit-provider.tsx +12 -0
- package/dist/templates/chat/app/components/ui/tooltip.tsx +1 -0
- package/dist/templates/chat/app/entry.client.tsx +19 -0
- package/dist/templates/chat/app/entry.server.tsx +10 -0
- package/dist/templates/chat/app/global.css +93 -0
- package/dist/templates/chat/app/hooks/use-navigation-state.ts +111 -0
- package/dist/templates/chat/app/i18n/ar-SA.ts +68 -0
- package/dist/templates/chat/app/i18n/de-DE.ts +71 -0
- package/dist/templates/chat/app/i18n/en-US.ts +70 -0
- package/dist/templates/chat/app/i18n/es-ES.ts +71 -0
- package/dist/templates/chat/app/i18n/fr-FR.ts +71 -0
- package/dist/templates/chat/app/i18n/hi-IN.ts +69 -0
- package/dist/templates/chat/app/i18n/index.ts +34 -0
- package/dist/templates/chat/app/i18n/ja-JP.ts +70 -0
- package/dist/templates/chat/app/i18n/ko-KR.ts +70 -0
- package/dist/templates/chat/app/i18n/pt-BR.ts +71 -0
- package/dist/templates/chat/app/i18n/zh-CN.ts +67 -0
- package/dist/templates/chat/app/i18n/zh-TW.ts +67 -0
- package/dist/templates/chat/app/i18n-data.ts +556 -0
- package/dist/templates/chat/app/lib/agent-page.tsx +40 -0
- package/dist/templates/chat/app/lib/app-config.ts +11 -0
- package/dist/templates/chat/app/lib/tab-id.ts +1 -0
- package/dist/templates/chat/app/lib/utils.ts +1 -0
- package/dist/templates/chat/app/root.tsx +172 -0
- package/dist/templates/chat/app/routes/_index.tsx +91 -0
- package/dist/templates/chat/app/routes/agent.tsx +17 -0
- package/dist/templates/chat/app/routes/chat.$threadId.tsx +1 -0
- package/dist/templates/chat/app/routes/database.tsx +17 -0
- package/dist/templates/chat/app/routes/extensions.$id.$slug.tsx +2 -0
- package/dist/templates/chat/app/routes/extensions.$id.tsx +11 -0
- package/dist/templates/chat/app/routes/extensions._index.tsx +11 -0
- package/dist/templates/chat/app/routes/extensions.tsx +5 -0
- package/dist/templates/chat/app/routes/observability.tsx +18 -0
- package/dist/templates/chat/app/routes/settings.tsx +88 -0
- package/dist/templates/chat/app/routes/team.tsx +11 -0
- package/dist/templates/chat/app/routes.ts +4 -0
- package/dist/templates/chat/app/vite-env.d.ts +6 -0
- package/dist/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/dist/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/dist/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/dist/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/dist/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/dist/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/dist/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/dist/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/dist/templates/chat/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/dist/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/dist/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/dist/templates/chat/components.json +20 -0
- package/dist/templates/chat/data/.gitkeep +0 -0
- package/dist/templates/chat/data/sync-config.json +1 -0
- package/dist/templates/chat/learnings.defaults.md +5 -0
- package/dist/templates/chat/netlify.toml +10 -0
- package/dist/templates/chat/package.json +92 -0
- package/dist/templates/chat/public/agent-native-icon-dark.svg +10 -0
- package/dist/templates/chat/public/agent-native-icon-light.svg +10 -0
- package/dist/templates/chat/public/agent-native-logo-dark.svg +21 -0
- package/dist/templates/chat/public/agent-native-logo-light.svg +21 -0
- package/dist/templates/chat/public/favicon.svg +1 -0
- package/dist/templates/chat/public/icon-180.svg +1 -0
- package/dist/templates/chat/public/icon-192.svg +1 -0
- package/dist/templates/chat/public/icon-512.svg +1 -0
- package/dist/templates/chat/public/manifest.json +21 -0
- package/dist/templates/chat/react-router.config.ts +7 -0
- package/dist/templates/chat/server/middleware/auth.ts +15 -0
- package/dist/templates/chat/server/plugins/agent-chat.ts +21 -0
- package/dist/templates/chat/server/plugins/auth.ts +17 -0
- package/dist/templates/chat/server/routes/[...page].get.ts +5 -0
- package/dist/templates/chat/ssr-entry.ts +15 -0
- package/dist/templates/chat/tsconfig.json +21 -0
- package/dist/templates/chat/vite.config.ts +19 -0
- package/package.json +2 -1
- package/src/templates/chat/.agents/skills/actions/SKILL.md +492 -0
- package/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +189 -0
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +76 -0
- package/src/templates/chat/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/src/templates/chat/.agents/skills/create-skill/SKILL.md +221 -0
- package/src/templates/chat/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +112 -0
- package/src/templates/chat/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/src/templates/chat/.agents/skills/security/SKILL.md +280 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +106 -0
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +95 -0
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/src/templates/chat/.env.example +5 -0
- package/src/templates/chat/.ignore +0 -0
- package/src/templates/chat/.oxfmtrc.json +8 -0
- package/src/templates/chat/.react-router/types/+server-build.d.ts +18 -0
- package/src/templates/chat/.react-router/types/app/+types/root.ts +68 -0
- package/src/templates/chat/AGENTS.md +62 -0
- package/src/templates/chat/CHANGELOG.md +10 -0
- package/src/templates/chat/DEVELOPING.md +185 -0
- package/src/templates/chat/README.md +32 -0
- package/src/templates/chat/_gitignore +43 -0
- package/src/templates/chat/actions/hello.spec.ts +23 -0
- package/src/templates/chat/actions/hello.ts +13 -0
- package/src/templates/chat/actions/navigate.spec.ts +68 -0
- package/src/templates/chat/actions/navigate.ts +41 -0
- package/src/templates/chat/actions/run.ts +2 -0
- package/src/templates/chat/actions/view-screen.spec.ts +40 -0
- package/src/templates/chat/actions/view-screen.ts +31 -0
- package/src/templates/chat/app/components/layout/Header.tsx +59 -0
- package/src/templates/chat/app/components/layout/Layout.tsx +184 -0
- package/src/templates/chat/app/components/layout/Sidebar.tsx +580 -0
- package/src/templates/chat/app/components/ui/button.tsx +1 -0
- package/src/templates/chat/app/components/ui/card.tsx +1 -0
- package/src/templates/chat/app/components/ui/dropdown-menu.tsx +1 -0
- package/src/templates/chat/app/components/ui/input.tsx +1 -0
- package/src/templates/chat/app/components/ui/label.tsx +1 -0
- package/src/templates/chat/app/components/ui/sheet.tsx +1 -0
- package/src/templates/chat/app/components/ui/toolkit-provider.tsx +12 -0
- package/src/templates/chat/app/components/ui/tooltip.tsx +1 -0
- package/src/templates/chat/app/entry.client.tsx +19 -0
- package/src/templates/chat/app/entry.server.tsx +10 -0
- package/src/templates/chat/app/global.css +93 -0
- package/src/templates/chat/app/hooks/use-navigation-state.ts +111 -0
- package/src/templates/chat/app/i18n/ar-SA.ts +68 -0
- package/src/templates/chat/app/i18n/de-DE.ts +71 -0
- package/src/templates/chat/app/i18n/en-US.ts +70 -0
- package/src/templates/chat/app/i18n/es-ES.ts +71 -0
- package/src/templates/chat/app/i18n/fr-FR.ts +71 -0
- package/src/templates/chat/app/i18n/hi-IN.ts +69 -0
- package/src/templates/chat/app/i18n/index.ts +34 -0
- package/src/templates/chat/app/i18n/ja-JP.ts +70 -0
- package/src/templates/chat/app/i18n/ko-KR.ts +70 -0
- package/src/templates/chat/app/i18n/pt-BR.ts +71 -0
- package/src/templates/chat/app/i18n/zh-CN.ts +67 -0
- package/src/templates/chat/app/i18n/zh-TW.ts +67 -0
- package/src/templates/chat/app/i18n-data.ts +556 -0
- package/src/templates/chat/app/lib/agent-page.spec.tsx +52 -0
- package/src/templates/chat/app/lib/agent-page.tsx +40 -0
- package/src/templates/chat/app/lib/app-config.ts +11 -0
- package/src/templates/chat/app/lib/tab-id.ts +1 -0
- package/src/templates/chat/app/lib/utils.ts +1 -0
- package/src/templates/chat/app/root.tsx +172 -0
- package/src/templates/chat/app/routes/_index.tsx +91 -0
- package/src/templates/chat/app/routes/agent.tsx +17 -0
- package/src/templates/chat/app/routes/chat.$threadId.tsx +1 -0
- package/src/templates/chat/app/routes/database.tsx +17 -0
- package/src/templates/chat/app/routes/extensions.$id.$slug.tsx +2 -0
- package/src/templates/chat/app/routes/extensions.$id.tsx +11 -0
- package/src/templates/chat/app/routes/extensions._index.tsx +11 -0
- package/src/templates/chat/app/routes/extensions.tsx +5 -0
- package/src/templates/chat/app/routes/observability.tsx +18 -0
- package/src/templates/chat/app/routes/settings.tsx +88 -0
- package/src/templates/chat/app/routes/team.tsx +11 -0
- package/src/templates/chat/app/routes.ts +4 -0
- package/src/templates/chat/app/vite-env.d.ts +6 -0
- package/src/templates/chat/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/src/templates/chat/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/src/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/src/templates/chat/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/src/templates/chat/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/src/templates/chat/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/src/templates/chat/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/src/templates/chat/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/src/templates/chat/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/src/templates/chat/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/src/templates/chat/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/src/templates/chat/components.json +20 -0
- package/src/templates/chat/data/.gitkeep +0 -0
- package/src/templates/chat/data/sync-config.json +1 -0
- package/src/templates/chat/learnings.defaults.md +5 -0
- package/src/templates/chat/netlify.toml +10 -0
- package/src/templates/chat/package.json +92 -0
- package/src/templates/chat/public/agent-native-icon-dark.svg +10 -0
- package/src/templates/chat/public/agent-native-icon-light.svg +10 -0
- package/src/templates/chat/public/agent-native-logo-dark.svg +21 -0
- package/src/templates/chat/public/agent-native-logo-light.svg +21 -0
- package/src/templates/chat/public/favicon.svg +1 -0
- package/src/templates/chat/public/icon-180.svg +1 -0
- package/src/templates/chat/public/icon-192.svg +1 -0
- package/src/templates/chat/public/icon-512.svg +1 -0
- package/src/templates/chat/public/manifest.json +21 -0
- package/src/templates/chat/react-router.config.ts +7 -0
- package/src/templates/chat/server/middleware/auth.ts +15 -0
- package/src/templates/chat/server/plugins/agent-chat.ts +21 -0
- package/src/templates/chat/server/plugins/auth.ts +17 -0
- package/src/templates/chat/server/routes/[...page].get.ts +5 -0
- package/src/templates/chat/ssr-entry.ts +15 -0
- package/src/templates/chat/tsconfig.json +21 -0
- package/src/templates/chat/vite.config.ts +19 -0
|
@@ -22,14 +22,38 @@ import { getDb, schema } from "../db/index.js";
|
|
|
22
22
|
const cache = new Map<string, { data: any; ts: number }>();
|
|
23
23
|
const TTL = 60_000;
|
|
24
24
|
|
|
25
|
+
type PublicFormCacheKeys = {
|
|
26
|
+
id?: string | null;
|
|
27
|
+
slug?: string | null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function invalidatePublicFormCache(
|
|
31
|
+
...forms: Array<PublicFormCacheKeys | null | undefined>
|
|
32
|
+
) {
|
|
33
|
+
for (const form of forms) {
|
|
34
|
+
for (const key of [form?.id, form?.slug]) {
|
|
35
|
+
if (!key) continue;
|
|
36
|
+
cache.delete(key);
|
|
37
|
+
const versionPrefix = `${key}?v=`;
|
|
38
|
+
for (const cachedKey of cache.keys()) {
|
|
39
|
+
if (cachedKey.startsWith(versionPrefix)) cache.delete(cachedKey);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
function getCached(key: string) {
|
|
26
46
|
const entry = cache.get(key);
|
|
27
47
|
if (entry && Date.now() - entry.ts < TTL) return entry.data;
|
|
28
48
|
return null;
|
|
29
49
|
}
|
|
30
50
|
|
|
31
|
-
export async function getPublicFormBySlugOrId(
|
|
32
|
-
|
|
51
|
+
export async function getPublicFormBySlugOrId(
|
|
52
|
+
slugOrId: string,
|
|
53
|
+
version?: string,
|
|
54
|
+
) {
|
|
55
|
+
const cacheKey = version ? `${slugOrId}?v=${version}` : slugOrId;
|
|
56
|
+
const cached = getCached(cacheKey);
|
|
33
57
|
if (cached) return cached;
|
|
34
58
|
|
|
35
59
|
const db = getDb();
|
|
@@ -66,7 +90,7 @@ export async function getPublicFormBySlugOrId(slugOrId: string) {
|
|
|
66
90
|
settings: toPublicFormSettings(settings),
|
|
67
91
|
};
|
|
68
92
|
|
|
69
|
-
cache.set(
|
|
93
|
+
cache.set(cacheKey, { data: result, ts: Date.now() });
|
|
70
94
|
return result;
|
|
71
95
|
}
|
|
72
96
|
|
|
@@ -103,6 +127,7 @@ const FALLBACK_PUBLIC_FORM_ORIGIN = "http://agent-native.local";
|
|
|
103
127
|
function parsePublicFormUrl(url: string): {
|
|
104
128
|
pathname: string;
|
|
105
129
|
origin?: string;
|
|
130
|
+
version?: string;
|
|
106
131
|
} {
|
|
107
132
|
try {
|
|
108
133
|
const parsed = new URL(url, FALLBACK_PUBLIC_FORM_ORIGIN);
|
|
@@ -110,6 +135,7 @@ function parsePublicFormUrl(url: string): {
|
|
|
110
135
|
return {
|
|
111
136
|
pathname: parsed.pathname,
|
|
112
137
|
origin: isAbsolute ? parsed.origin : undefined,
|
|
138
|
+
version: parsed.searchParams.get("v") || undefined,
|
|
113
139
|
};
|
|
114
140
|
} catch {
|
|
115
141
|
return { pathname: url.split("?")[0] || "/" };
|
|
@@ -261,7 +287,9 @@ export async function renderPublicFormHtml(
|
|
|
261
287
|
? pathname.slice(basePath.length)
|
|
262
288
|
: pathname;
|
|
263
289
|
const slugOrId = decodeURIComponent(pathWithoutBase.replace(/^\/f\//, ""));
|
|
264
|
-
const form = slugOrId
|
|
290
|
+
const form = slugOrId
|
|
291
|
+
? await getPublicFormBySlugOrId(slugOrId, parsedUrl.version)
|
|
292
|
+
: null;
|
|
265
293
|
|
|
266
294
|
if (!form) {
|
|
267
295
|
return { html: notFoundPage(parsedUrl.origin), status: 404 };
|
|
@@ -402,10 +430,25 @@ function renderFormPage(
|
|
|
402
430
|
<script>
|
|
403
431
|
(function(){
|
|
404
432
|
var FORM_ID = ${JSON.stringify(form.id)};
|
|
433
|
+
var FORM_VERSION = ${JSON.stringify(form.updatedAt || "")};
|
|
434
|
+
var PUBLIC_FORM_API = ${JSON.stringify(`${appBasePath}/api/forms/public/${encodeURIComponent(form.slug || form.id)}`)};
|
|
405
435
|
var REDIRECT = ${JSON.stringify(safeRedirectUrl(settings.redirectUrl))};
|
|
406
436
|
var TURNSTILE_KEY = ${JSON.stringify(turnstileSiteKey)};
|
|
407
437
|
var FIELDS = ${JSON.stringify(fields.map((f) => ({ id: f.id, type: f.type, required: f.required, validation: f.validation, label: f.label, conditional: f.conditional })))};
|
|
408
438
|
|
|
439
|
+
function revalidateFormVersion() {
|
|
440
|
+
fetch(PUBLIC_FORM_API, { cache: "no-store" })
|
|
441
|
+
.then(function(response) { return response.ok ? response.json() : null; })
|
|
442
|
+
.then(function(latest) {
|
|
443
|
+
if (!latest || typeof latest.updatedAt !== "string" || !latest.updatedAt || latest.updatedAt === FORM_VERSION) return;
|
|
444
|
+
var currentUrl = new URL(window.location.href);
|
|
445
|
+
currentUrl.searchParams.set("v", latest.updatedAt);
|
|
446
|
+
window.location.replace(currentUrl.toString());
|
|
447
|
+
})
|
|
448
|
+
.catch(function() {});
|
|
449
|
+
}
|
|
450
|
+
revalidateFormVersion();
|
|
451
|
+
|
|
409
452
|
// Theme toggle
|
|
410
453
|
var html = document.documentElement;
|
|
411
454
|
var saved = localStorage.getItem("theme");
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
useRef,
|
|
25
25
|
useEffect,
|
|
26
26
|
type MouseEvent as ReactMouseEvent,
|
|
27
|
+
type ReactNode,
|
|
27
28
|
} from "react";
|
|
28
29
|
import { createPortal } from "react-dom";
|
|
29
30
|
|
|
@@ -475,111 +476,175 @@ function SameSlidePresenceIndicator({ users }: { users: CollabUser[] }) {
|
|
|
475
476
|
}
|
|
476
477
|
|
|
477
478
|
/** Selection outline rendered over a selected image */
|
|
478
|
-
function
|
|
479
|
-
|
|
479
|
+
function SelectionOverlayPortal({
|
|
480
|
+
viewportRect,
|
|
481
|
+
zIndex,
|
|
482
|
+
children,
|
|
483
|
+
}: {
|
|
484
|
+
viewportRect: DOMRect | null;
|
|
485
|
+
zIndex: number;
|
|
486
|
+
children: ReactNode;
|
|
487
|
+
}) {
|
|
488
|
+
if (!viewportRect) return null;
|
|
489
|
+
|
|
490
|
+
const viewportWidth = window.innerWidth;
|
|
491
|
+
const viewportHeight = window.innerHeight;
|
|
492
|
+
const top = Math.max(0, Math.min(viewportHeight, viewportRect.top));
|
|
493
|
+
const right = Math.max(
|
|
494
|
+
0,
|
|
495
|
+
Math.min(viewportWidth, viewportWidth - viewportRect.right),
|
|
496
|
+
);
|
|
497
|
+
const bottom = Math.max(
|
|
498
|
+
0,
|
|
499
|
+
Math.min(viewportHeight, viewportHeight - viewportRect.bottom),
|
|
500
|
+
);
|
|
501
|
+
const left = Math.max(0, Math.min(viewportWidth, viewportRect.left));
|
|
502
|
+
|
|
480
503
|
return createPortal(
|
|
481
504
|
<div
|
|
482
505
|
style={{
|
|
483
506
|
position: "fixed",
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
width: rect.width + pad * 2,
|
|
487
|
-
height: rect.height + pad * 2,
|
|
507
|
+
inset: 0,
|
|
508
|
+
overflow: "hidden",
|
|
488
509
|
pointerEvents: "none",
|
|
489
|
-
zIndex
|
|
490
|
-
|
|
491
|
-
|
|
510
|
+
zIndex,
|
|
511
|
+
// Selection rects use viewport coordinates, so keep the portal for
|
|
512
|
+
// accurate zoom/scroll tracking while clipping it to the canvas
|
|
513
|
+
// viewport. This prevents outlines from painting over either sidebar.
|
|
514
|
+
clipPath: `inset(${top}px ${right}px ${bottom}px ${left}px)`,
|
|
492
515
|
}}
|
|
493
|
-
|
|
516
|
+
>
|
|
517
|
+
{children}
|
|
518
|
+
</div>,
|
|
494
519
|
document.body,
|
|
495
520
|
);
|
|
496
521
|
}
|
|
497
522
|
|
|
498
|
-
function
|
|
523
|
+
function ImageSelectionOutline({
|
|
524
|
+
rect,
|
|
525
|
+
viewportRect,
|
|
526
|
+
}: {
|
|
527
|
+
rect: DOMRect;
|
|
528
|
+
viewportRect: DOMRect | null;
|
|
529
|
+
}) {
|
|
530
|
+
const pad = 2;
|
|
531
|
+
return (
|
|
532
|
+
<SelectionOverlayPortal viewportRect={viewportRect} zIndex={50}>
|
|
533
|
+
<div
|
|
534
|
+
style={{
|
|
535
|
+
position: "absolute",
|
|
536
|
+
top: rect.top - pad,
|
|
537
|
+
left: rect.left - pad,
|
|
538
|
+
width: rect.width + pad * 2,
|
|
539
|
+
height: rect.height + pad * 2,
|
|
540
|
+
pointerEvents: "none",
|
|
541
|
+
border: "2px solid #609FF8",
|
|
542
|
+
borderRadius: 2,
|
|
543
|
+
}}
|
|
544
|
+
/>
|
|
545
|
+
</SelectionOverlayPortal>
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
function ElementSelectionOutline({
|
|
550
|
+
rect,
|
|
551
|
+
viewportRect,
|
|
552
|
+
}: {
|
|
553
|
+
rect: DOMRect;
|
|
554
|
+
viewportRect: DOMRect | null;
|
|
555
|
+
}) {
|
|
499
556
|
const pad = 2;
|
|
500
557
|
const handle = 7;
|
|
501
558
|
const handleClass =
|
|
502
559
|
"absolute size-[7px] rounded-sm border border-background bg-[#609FF8] shadow-sm";
|
|
503
|
-
return
|
|
504
|
-
<
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
560
|
+
return (
|
|
561
|
+
<SelectionOverlayPortal viewportRect={viewportRect} zIndex={51}>
|
|
562
|
+
<div
|
|
563
|
+
style={{
|
|
564
|
+
position: "absolute",
|
|
565
|
+
top: rect.top - pad,
|
|
566
|
+
left: rect.left - pad,
|
|
567
|
+
width: rect.width + pad * 2,
|
|
568
|
+
height: rect.height + pad * 2,
|
|
569
|
+
pointerEvents: "none",
|
|
570
|
+
border: "1.5px solid #609FF8",
|
|
571
|
+
borderRadius: 3,
|
|
572
|
+
boxShadow: "0 0 0 1px rgba(96, 159, 248, 0.2)",
|
|
573
|
+
}}
|
|
574
|
+
>
|
|
575
|
+
<span
|
|
576
|
+
className={handleClass}
|
|
577
|
+
style={{ left: -handle / 2, top: -handle / 2 }}
|
|
578
|
+
/>
|
|
579
|
+
<span
|
|
580
|
+
className={handleClass}
|
|
581
|
+
style={{ right: -handle / 2, top: -handle / 2 }}
|
|
582
|
+
/>
|
|
583
|
+
<span
|
|
584
|
+
className={handleClass}
|
|
585
|
+
style={{ left: -handle / 2, bottom: -handle / 2 }}
|
|
586
|
+
/>
|
|
587
|
+
<span
|
|
588
|
+
className={handleClass}
|
|
589
|
+
style={{ right: -handle / 2, bottom: -handle / 2 }}
|
|
590
|
+
/>
|
|
591
|
+
</div>
|
|
592
|
+
</SelectionOverlayPortal>
|
|
536
593
|
);
|
|
537
594
|
}
|
|
538
595
|
|
|
539
596
|
/** Outline rendered around a multi-select element */
|
|
540
|
-
function MultiSelectOutline({
|
|
597
|
+
function MultiSelectOutline({
|
|
598
|
+
rect,
|
|
599
|
+
viewportRect,
|
|
600
|
+
}: {
|
|
601
|
+
rect: DOMRect;
|
|
602
|
+
viewportRect: DOMRect | null;
|
|
603
|
+
}) {
|
|
541
604
|
const pad = 1;
|
|
542
|
-
return
|
|
543
|
-
<
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
605
|
+
return (
|
|
606
|
+
<SelectionOverlayPortal viewportRect={viewportRect} zIndex={49}>
|
|
607
|
+
<div
|
|
608
|
+
style={{
|
|
609
|
+
position: "absolute",
|
|
610
|
+
top: rect.top - pad,
|
|
611
|
+
left: rect.left - pad,
|
|
612
|
+
width: rect.width + pad * 2,
|
|
613
|
+
height: rect.height + pad * 2,
|
|
614
|
+
pointerEvents: "none",
|
|
615
|
+
border: "2px solid #609FF8",
|
|
616
|
+
borderRadius: 2,
|
|
617
|
+
boxShadow: "0 0 0 1px rgba(96, 159, 248, 0.25)",
|
|
618
|
+
}}
|
|
619
|
+
/>
|
|
620
|
+
</SelectionOverlayPortal>
|
|
558
621
|
);
|
|
559
622
|
}
|
|
560
623
|
|
|
561
624
|
/** Translucent rectangle drawn while marquee-dragging */
|
|
562
625
|
function MarqueeRect({
|
|
563
626
|
rect,
|
|
627
|
+
viewportRect,
|
|
564
628
|
}: {
|
|
565
629
|
rect: { x: number; y: number; w: number; h: number };
|
|
630
|
+
viewportRect: DOMRect | null;
|
|
566
631
|
}) {
|
|
567
|
-
return
|
|
568
|
-
<
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
632
|
+
return (
|
|
633
|
+
<SelectionOverlayPortal viewportRect={viewportRect} zIndex={48}>
|
|
634
|
+
<div
|
|
635
|
+
style={{
|
|
636
|
+
position: "absolute",
|
|
637
|
+
top: rect.y,
|
|
638
|
+
left: rect.x,
|
|
639
|
+
width: rect.w,
|
|
640
|
+
height: rect.h,
|
|
641
|
+
pointerEvents: "none",
|
|
642
|
+
background: "rgba(96, 159, 248, 0.12)",
|
|
643
|
+
border: "1px solid #609FF8",
|
|
644
|
+
borderRadius: 1,
|
|
645
|
+
}}
|
|
646
|
+
/>
|
|
647
|
+
</SelectionOverlayPortal>
|
|
583
648
|
);
|
|
584
649
|
}
|
|
585
650
|
|
|
@@ -690,6 +755,8 @@ export default function SlideEditor({
|
|
|
690
755
|
} | null>(null);
|
|
691
756
|
const [selectedImg, setSelectedImg] = useState<HTMLImageElement | null>(null);
|
|
692
757
|
const [selectionRect, setSelectionRect] = useState<DOMRect | null>(null);
|
|
758
|
+
const [selectionViewportRect, setSelectionViewportRect] =
|
|
759
|
+
useState<DOMRect | null>(null);
|
|
693
760
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
694
761
|
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
|
695
762
|
// Wraps the rendered slide; used as the positioning container for the
|
|
@@ -784,6 +851,34 @@ export default function SlideEditor({
|
|
|
784
851
|
max: MAX_CANVAS_ZOOM,
|
|
785
852
|
});
|
|
786
853
|
|
|
854
|
+
// Selection outlines are portaled to the document so their viewport
|
|
855
|
+
// coordinates stay aligned with the zoomed/scrolling slide. Keep a live
|
|
856
|
+
// viewport rect so that portal can clip itself to the central canvas when
|
|
857
|
+
// either sidebar or the style inspector changes the available width.
|
|
858
|
+
useEffect(() => {
|
|
859
|
+
const scrollContainer = scrollContainerRef.current;
|
|
860
|
+
if (!scrollContainer) return;
|
|
861
|
+
|
|
862
|
+
const updateViewportRect = () => {
|
|
863
|
+
setSelectionViewportRect(scrollContainer.getBoundingClientRect());
|
|
864
|
+
};
|
|
865
|
+
|
|
866
|
+
updateViewportRect();
|
|
867
|
+
const observer =
|
|
868
|
+
typeof ResizeObserver === "undefined"
|
|
869
|
+
? null
|
|
870
|
+
: new ResizeObserver(updateViewportRect);
|
|
871
|
+
observer?.observe(scrollContainer);
|
|
872
|
+
window.addEventListener("resize", updateViewportRect);
|
|
873
|
+
window.addEventListener("scroll", updateViewportRect, true);
|
|
874
|
+
|
|
875
|
+
return () => {
|
|
876
|
+
observer?.disconnect();
|
|
877
|
+
window.removeEventListener("resize", updateViewportRect);
|
|
878
|
+
window.removeEventListener("scroll", updateViewportRect, true);
|
|
879
|
+
};
|
|
880
|
+
}, []);
|
|
881
|
+
|
|
787
882
|
useEffect(() => {
|
|
788
883
|
const scrollContainer = scrollContainerRef.current;
|
|
789
884
|
if (!scrollContainer) return;
|
|
@@ -1959,7 +2054,7 @@ export default function SlideEditor({
|
|
|
1959
2054
|
</div>
|
|
1960
2055
|
|
|
1961
2056
|
{selectedStyleSnapshot && !readOnly && (
|
|
1962
|
-
<div className="hidden h-full w-[17rem] shrink-0 border-l border-border/70 bg-background/95 lg:block">
|
|
2057
|
+
<div className="relative z-[70] hidden h-full w-[17rem] shrink-0 border-l border-border/70 bg-background/95 lg:block">
|
|
1963
2058
|
<SlideStyleInspector
|
|
1964
2059
|
snapshot={selectedStyleSnapshot}
|
|
1965
2060
|
designSystem={designSystem}
|
|
@@ -1981,19 +2076,31 @@ export default function SlideEditor({
|
|
|
1981
2076
|
slideCount={slideCount}
|
|
1982
2077
|
/>
|
|
1983
2078
|
|
|
1984
|
-
{selectionRect &&
|
|
2079
|
+
{selectionRect && (
|
|
2080
|
+
<ImageSelectionOutline
|
|
2081
|
+
rect={selectionRect}
|
|
2082
|
+
viewportRect={selectionViewportRect}
|
|
2083
|
+
/>
|
|
2084
|
+
)}
|
|
1985
2085
|
{selectedElementRect && (
|
|
1986
|
-
<ElementSelectionOutline
|
|
2086
|
+
<ElementSelectionOutline
|
|
2087
|
+
rect={selectedElementRect}
|
|
2088
|
+
viewportRect={selectionViewportRect}
|
|
2089
|
+
/>
|
|
1987
2090
|
)}
|
|
1988
2091
|
|
|
1989
2092
|
{/* Multi-select outlines */}
|
|
1990
2093
|
{Array.from(multiSelectionRects.entries()).map(([id, v]) => (
|
|
1991
|
-
<MultiSelectOutline
|
|
2094
|
+
<MultiSelectOutline
|
|
2095
|
+
key={id}
|
|
2096
|
+
rect={v.rect}
|
|
2097
|
+
viewportRect={selectionViewportRect}
|
|
2098
|
+
/>
|
|
1992
2099
|
))}
|
|
1993
2100
|
|
|
1994
2101
|
{/* Active marquee rectangle */}
|
|
1995
2102
|
{marquee && (marquee.w > 1 || marquee.h > 1) && (
|
|
1996
|
-
<MarqueeRect rect={marquee} />
|
|
2103
|
+
<MarqueeRect rect={marquee} viewportRect={selectionViewportRect} />
|
|
1997
2104
|
)}
|
|
1998
2105
|
|
|
1999
2106
|
{/* Floating "N selected" chip */}
|
|
@@ -875,7 +875,7 @@ export default function DeckEditor() {
|
|
|
875
875
|
className="md:hidden fixed inset-0 bg-black/50 z-30"
|
|
876
876
|
onClick={() => setSidebarOpen(false)}
|
|
877
877
|
/>
|
|
878
|
-
<div className="absolute z-
|
|
878
|
+
<div className="absolute z-[70] h-full min-h-0 md:relative">
|
|
879
879
|
<DndContext
|
|
880
880
|
sensors={sensors}
|
|
881
881
|
collisionDetection={closestCenter}
|
package/dist/cli/create.d.ts
CHANGED
|
@@ -47,9 +47,11 @@ export declare function addAppToWorkspace(name?: string, opts?: CreateAppOptions
|
|
|
47
47
|
* Scaffold a single app template into `targetDir`. Resolves:
|
|
48
48
|
* - "headless" / legacy "blank" → bundled action-first template
|
|
49
49
|
* - "github:user/repo" → download the whole repo
|
|
50
|
-
* - first-party template name → download
|
|
50
|
+
* - first-party template name → use a bundled copy or download its subdir
|
|
51
|
+
* from BuilderIO/agent-native
|
|
51
52
|
*/
|
|
52
53
|
declare function scaffoldAppTemplate(targetDir: string, template: string): Promise<void>;
|
|
54
|
+
declare function findLocalTemplateFrom(startDir: string, name: string): string | undefined;
|
|
53
55
|
/**
|
|
54
56
|
* Scaffold internal workspace packages required by the selected templates.
|
|
55
57
|
* Deduplicates so each package is only copied once even if multiple
|
|
@@ -72,10 +74,11 @@ export declare function detectWorkspace(startDir: string): {
|
|
|
72
74
|
} | null;
|
|
73
75
|
export { parseWorkspaceScope };
|
|
74
76
|
/** @internal — exported for E2E tests */
|
|
75
|
-
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, };
|
|
77
|
+
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, };
|
|
76
78
|
declare function tarExtractArgs(tarPath: string, destDir: string, options?: {
|
|
77
79
|
skipAgentSymlinks?: boolean;
|
|
78
80
|
}): string[];
|
|
81
|
+
declare function githubTarballUrl(repo: string, ref: string, kind: "branch" | "tag"): string;
|
|
79
82
|
/**
|
|
80
83
|
* Load the pnpm workspace catalog.
|
|
81
84
|
* First tries the build-time snapshot at dist/catalog.json (works when
|
package/dist/cli/create.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AA8BvE;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAO,EAAE,MAAM,EAG1B;CACF;AA6BD,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;;;;;GAQG;AACH,wBAAsB,SAAS,CAC7B,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CAwEf;AA2OD,iBAAS,oCAAoC,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAa1E;AAiBD,iBAAe,qBAAqB,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,CAAC,CA4Cf;AAiDD;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,gBAAgB,GACtB,OAAO,CAAC,IAAI,CAAC,CA8Cf;AAoLD
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"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"}
|
package/dist/cli/create.js
CHANGED
|
@@ -620,7 +620,8 @@ function cleanupOnFailure(targetDir) {
|
|
|
620
620
|
* Scaffold a single app template into `targetDir`. Resolves:
|
|
621
621
|
* - "headless" / legacy "blank" → bundled action-first template
|
|
622
622
|
* - "github:user/repo" → download the whole repo
|
|
623
|
-
* - first-party template name → download
|
|
623
|
+
* - first-party template name → use a bundled copy or download its subdir
|
|
624
|
+
* from BuilderIO/agent-native
|
|
624
625
|
*/
|
|
625
626
|
async function scaffoldAppTemplate(targetDir, template) {
|
|
626
627
|
fs.mkdirSync(path.dirname(targetDir), { recursive: true });
|
|
@@ -661,15 +662,22 @@ function templateSourceName(name) {
|
|
|
661
662
|
return name;
|
|
662
663
|
}
|
|
663
664
|
/**
|
|
664
|
-
*
|
|
665
|
-
*
|
|
665
|
+
* Prefer a nearby templates/<name> or src/templates/<name> directory. This
|
|
666
|
+
* covers the framework checkout, the dist/templates copy bundled into
|
|
667
|
+
* published CLI packages, and source templates included in package files;
|
|
668
|
+
* packages that do not bundle a template fall back to GitHub.
|
|
666
669
|
*/
|
|
667
670
|
function findLocalTemplate(name) {
|
|
668
|
-
|
|
671
|
+
return findLocalTemplateFrom(path.resolve(__dirname), name);
|
|
672
|
+
}
|
|
673
|
+
function findLocalTemplateFrom(startDir, name) {
|
|
674
|
+
let dir = path.resolve(startDir);
|
|
669
675
|
for (let i = 0; i < 10; i++) {
|
|
670
|
-
const
|
|
671
|
-
|
|
672
|
-
|
|
676
|
+
for (const templatesDir of ["templates", "src/templates"]) {
|
|
677
|
+
const candidate = path.join(dir, templatesDir, name);
|
|
678
|
+
if (fs.existsSync(path.join(candidate, "package.json"))) {
|
|
679
|
+
return candidate;
|
|
680
|
+
}
|
|
673
681
|
}
|
|
674
682
|
const parent = path.dirname(dir);
|
|
675
683
|
if (parent === dir)
|
|
@@ -1084,7 +1092,7 @@ export function detectWorkspace(startDir) {
|
|
|
1084
1092
|
}
|
|
1085
1093
|
export { parseWorkspaceScope };
|
|
1086
1094
|
/** @internal — exported for E2E tests */
|
|
1087
|
-
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, };
|
|
1095
|
+
export { scaffoldWorkspaceRoot as _scaffoldWorkspaceRoot, scaffoldAppTemplate as _scaffoldAppTemplate, scaffoldRequiredPackages as _scaffoldRequiredPackages, postProcessStandalone as _postProcessStandalone, loadCatalog as _loadCatalog, fixPackageJsonName as _fixPackageJsonName, renameGitignore as _renameGitignore, rewriteNetlifyToml as _rewriteNetlifyToml, getCoreDependencyVersion as _getCoreDependencyVersion, getDispatchDependencyVersion as _getDispatchDependencyVersion, getToolkitDependencyVersion as _getToolkitDependencyVersion, getGitHubTemplateRef as _getGitHubTemplateRef, getGitHubTemplateRefCandidates as _getGitHubTemplateRefCandidates, githubTarballUrl as _githubTarballUrl, findLocalTemplateFrom as _findLocalTemplateFrom, workspaceAppNameForTemplateSelection as _workspaceAppNameForTemplateSelection, shouldSkipScaffoldEntry as _shouldSkipScaffoldEntry, tarExtractArgs as _tarExtractArgs, };
|
|
1088
1096
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
1089
1097
|
* Download / copy helpers
|
|
1090
1098
|
* ───────────────────────────────────────────────────────────────────────── */
|
|
@@ -1129,7 +1137,7 @@ async function downloadAndExtract(url, destDir, options = {}) {
|
|
|
1129
1137
|
"10",
|
|
1130
1138
|
"--max-time",
|
|
1131
1139
|
"120",
|
|
1132
|
-
"-
|
|
1140
|
+
"-sSL",
|
|
1133
1141
|
url,
|
|
1134
1142
|
], { maxBuffer: 100 * 1024 * 1024 });
|
|
1135
1143
|
const tarPath = path.join(destDir, ".download.tar.gz");
|
|
@@ -1151,7 +1159,7 @@ async function downloadGitHubSubdir(repo, subdir, targetDir) {
|
|
|
1151
1159
|
}
|
|
1152
1160
|
const errors = [];
|
|
1153
1161
|
for (const ref of refs) {
|
|
1154
|
-
const tarUrl =
|
|
1162
|
+
const tarUrl = githubTarballUrl(repo, ref, "tag");
|
|
1155
1163
|
const tmpDir = path.join(targetDir, "..", `.agent-native-tmp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`);
|
|
1156
1164
|
try {
|
|
1157
1165
|
await downloadAndExtract(tarUrl, tmpDir, {
|
|
@@ -1175,9 +1183,12 @@ async function downloadGitHubSubdir(repo, subdir, targetDir) {
|
|
|
1175
1183
|
}
|
|
1176
1184
|
async function downloadGitHubRepo(repo, targetDir) {
|
|
1177
1185
|
validateRepoName(repo);
|
|
1178
|
-
const tarUrl =
|
|
1186
|
+
const tarUrl = githubTarballUrl(repo, "main", "branch");
|
|
1179
1187
|
await downloadAndExtract(tarUrl, targetDir);
|
|
1180
1188
|
}
|
|
1189
|
+
function githubTarballUrl(repo, ref, kind) {
|
|
1190
|
+
return `https://codeload.github.com/${repo}/tar.gz/refs/${kind === "tag" ? "tags" : "heads"}/${encodeURIComponent(ref)}`;
|
|
1191
|
+
}
|
|
1181
1192
|
/* ─────────────────────────────────────────────────────────────────────────
|
|
1182
1193
|
* Text / filesystem helpers
|
|
1183
1194
|
* ───────────────────────────────────────────────────────────────────────── */
|