@adminide-stack/yantra-mobile 12.0.137 → 12.0.139
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/lib/components/CustomDrawer.js +17 -1
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +106 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +12 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/chat/ChatTranscript.js +2 -2
- package/lib/features/chat/ChatTranscript.js.map +1 -1
- package/lib/features/chat/surfaceNotes.js +4 -0
- package/lib/features/chat/surfaceNotes.js.map +1 -0
- package/lib/features/dictate/backgroundRecording.js.map +1 -1
- package/lib/features/dictate/useDictationRecorder.js +42 -1
- package/lib/features/dictate/useDictationRecorder.js.map +1 -1
- package/lib/features/home/useHomeWeather.js +85 -0
- package/lib/features/home/useHomeWeather.js.map +1 -0
- package/lib/features/home/weather.js +139 -0
- package/lib/features/home/weather.js.map +1 -0
- package/lib/features/notion/NotionPageView.js +819 -0
- package/lib/features/notion/NotionPageView.js.map +1 -0
- package/lib/features/notion/NotionSheets.js +452 -0
- package/lib/features/notion/NotionSheets.js.map +1 -0
- package/lib/features/notion/NotionTrashSheet.js +415 -0
- package/lib/features/notion/NotionTrashSheet.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceView.js +837 -0
- package/lib/features/notion/NotionWorkspaceView.js.map +1 -0
- package/lib/features/notion/notionBlocks.js +203 -0
- package/lib/features/notion/notionBlocks.js.map +1 -0
- package/lib/features/notion/notionDocuments.js +182 -0
- package/lib/features/notion/notionDocuments.js.map +1 -0
- package/lib/features/notion/notionEditorModel.js +180 -0
- package/lib/features/notion/notionEditorModel.js.map +1 -0
- package/lib/features/notion/notionTemplates.js +406 -0
- package/lib/features/notion/notionTemplates.js.map +1 -0
- package/lib/features/notion/notionTheme.js +34 -0
- package/lib/features/notion/notionTheme.js.map +1 -0
- package/lib/features/notion/notionTrash.js +100 -0
- package/lib/features/notion/notionTrash.js.map +1 -0
- package/lib/features/notion/notionUi.js +310 -0
- package/lib/features/notion/notionUi.js.map +1 -0
- package/lib/features/notion/useNotionWorkspace.js +181 -0
- package/lib/features/notion/useNotionWorkspace.js.map +1 -0
- package/lib/features/webbuilder/buildFragments.js +15 -9
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/buildJob.js +3 -3
- package/lib/features/webbuilder/buildJob.js.map +1 -1
- package/lib/features/webbuilder/publicSandboxDomain.js +5 -0
- package/lib/features/webbuilder/publicSandboxDomain.js.map +1 -0
- package/lib/features/webbuilder/sandboxPublicHost.js +74 -0
- package/lib/features/webbuilder/sandboxPublicHost.js.map +1 -0
- package/lib/features/webbuilder/siteAddress.js +2 -1
- package/lib/features/webbuilder/siteAddress.js.map +1 -1
- package/lib/features/webbuilder/webbuilderPrompts.js +3 -2
- package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
- package/lib/features/webbuilder/workflow.js +2 -2
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/hooks/useChatApi.js +15 -3
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/usePrerequisiteIds.js +15 -2
- package/lib/hooks/usePrerequisiteIds.js.map +1 -1
- package/lib/routes.json +107 -0
- package/lib/screens/Home/HomeScreen.js +20 -5
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeHero.js +117 -0
- package/lib/screens/Home/components/HomeHero.js.map +1 -0
- package/lib/screens/Home/components/HomeSuggestions.js +108 -85
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/Home/components/HomeWash.js +44 -0
- package/lib/screens/Home/components/HomeWash.js.map +1 -0
- package/lib/screens/Home/components/homeCatalog.js +125 -0
- package/lib/screens/Home/components/homeCatalog.js.map +1 -0
- package/lib/screens/Notion/index.js +18 -0
- package/lib/screens/Notion/index.js.map +1 -0
- package/lib/screens/NotionPage/index.js +19 -0
- package/lib/screens/NotionPage/index.js.map +1 -0
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js +2 -2
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/useRestoredSandboxes.js +16 -8
- package/lib/screens/WebBuilderNative/useRestoredSandboxes.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js +6 -5
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +5 -4
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/lib/screens/WebBuilderNative/webbuilderTransport.js +4 -3
- package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
- package/lib/services/savedWorkspace.js +44 -0
- package/lib/services/savedWorkspace.js.map +1 -0
- package/lib/theme/mobileTokens.js +1 -0
- package/lib/theme/mobileTokens.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildJob.js","sources":["../../../src/features/webbuilder/buildJob.ts"],"sourcesContent":["/**\n * A Web Builder turn (a new site, a remix or an edit) is a long-running job:\n * it is recorded as a server-owned surface job so it shows in the phone's Tasks\n * sheet and the web chat's Tasks panel while it runs, and after the app closes.\n *\n * Contract: adminIde project-mgmt `recordSurfaceJob(job)` / `updateSurfaceJob(id,\n * patch)` (surface-job-rules.ts); read back by common CENTRAL_TASKS_MODEL. The\n * agent settles a job whose ref rode on its chat turn (`job {task_id,\n * report_token}`); the app settles it too when it sees the turn end, and the\n * server's deadline sweep ends one nobody reported on.\n *\n * Pure (no React, no fetch): the host hook records and settles.\n */\nimport { cleanPrompt, stripAgentNote, titleFromPrompt } from './buildFragments';\nimport type { WebBuilderBuild } from './types';\n\n/** The slug every Web Builder job is recorded under. */\nexport const WEBBUILDER_JOB_SURFACE = 'webbuilder';\n/** A build or an edit finishes well inside this. */\nexport const WEBBUILDER_JOB_BUDGET_MS = 30 * 60 * 1000;\n/** Slack past the budget before a running job reads as stopped (surface-kit's grace). */\nexport const WEBBUILDER_JOB_GRACE_MS = 10 * 60 * 1000;\n/** The brief is a line under the title, not the whole ask. */\nconst BRIEF_MAX = 280;\n\n/** The ref a chat turn carries so the agent reports the job's verdict itself. */\nexport interface SurfaceJobRef {\n task_id: string;\n report_token: string;\n}\n\nexport type WebBuilderJobMode = 'new' | 'remix' | 'edit';\n\nexport interface WebBuilderJobStart {\n channelId: string;\n projectId?: string | null;\n /** The person's words for this turn, as sent (notes and prefixes are stripped). */\n ask: string;\n /** The site's name when it has one (an edit); else it is named from the ask. */\n siteTitle?: string | null;\n mode: WebBuilderJobMode;\n /** Who runs it: the agent chat, or the build workflow. */\n lane: 'agent' | 'workflow';\n startedAt: number;\n /** The web app's origin; the job opens this site's Web Builder there. */\n webOrigin?: string | null;\n}\n\nfunction briefFrom(ask: string): string {\n const text = cleanPrompt(stripAgentNote(ask));\n return text.length > BRIEF_MAX ? `${text.slice(0, BRIEF_MAX - 1).trimEnd()}…` : text;\n}\n\n/** `<origin>/c/<channelId>/webbuilder`, the web's Web Builder rail for this chat; http(s) only. */\nexport function webBuilderPageUrl(webOrigin: string | null | undefined, channelId: string): string | undefined {\n const origin = (webOrigin || '').trim().replace(/\\/+$/, '');\n if (!/^https?:\\/\\/[^/]+$/i.test(origin)) return undefined;\n return `${origin}/c/${encodeURIComponent(channelId)}/webbuilder`;\n}\n\n/** The `recordSurfaceJob` input for a turn that is starting. */\nexport function webBuilderJobRecord(start: WebBuilderJobStart): Record<string, unknown> {\n const brief = briefFrom(start.ask);\n // Named from the ask as sent: its \"Build me:\" marks the brief, so \"Build me: Make me a pin\n // board\" is \"Pin Board\" - without it \"Make me ...\" reads as an edit and gets no name.\n const name = start.siteTitle || titleFromPrompt(stripAgentNote(start.ask)) || 'New site';\n const pageUrl = webBuilderPageUrl(start.webOrigin, start.channelId);\n return {\n // One job per turn; the server keys it on `<surface>:<id>`, so a retry records nothing new.\n id: `${start.channelId}:${start.startedAt}`,\n surface: WEBBUILDER_JOB_SURFACE,\n lane: start.lane === 'agent' ? 'channel-turn' : 'workflow',\n title: start.mode === 'edit' ? `Update ${name}` : name,\n brief,\n state: 'running',\n createdAt: start.startedAt,\n startedAt: start.startedAt,\n deadlineAt: start.startedAt + WEBBUILDER_JOB_BUDGET_MS + WEBBUILDER_JOB_GRACE_MS,\n progress: start.mode === 'edit' ? 'Updating your app' : 'Starting your build',\n ...(pageUrl ? { pageUrl } : {}),\n handle: { channelId: start.channelId, ...(start.projectId ? { projectId: start.projectId } : {}) },\n };\n}\n\nexport type WebBuilderJobOutcome =\n | {\n ok: true;\n endedAt: number;\n build?: Pick<WebBuilderBuild, 'previewUrl' | 'liveUrl' | 'coverUrl' | 'title'> | null;\n }\n | { ok: false; endedAt: number; error: string };\n\n/** The `updateSurfaceJob` patch that ends a turn's job. */\nexport function webBuilderJobFinish(outcome: WebBuilderJobOutcome): Record<string, unknown> {\n if (
|
|
1
|
+
{"version":3,"file":"buildJob.js","sources":["../../../src/features/webbuilder/buildJob.ts"],"sourcesContent":["/**\n * A Web Builder turn (a new site, a remix or an edit) is a long-running job:\n * it is recorded as a server-owned surface job so it shows in the phone's Tasks\n * sheet and the web chat's Tasks panel while it runs, and after the app closes.\n *\n * Contract: adminIde project-mgmt `recordSurfaceJob(job)` / `updateSurfaceJob(id,\n * patch)` (surface-job-rules.ts); read back by common CENTRAL_TASKS_MODEL. The\n * agent settles a job whose ref rode on its chat turn (`job {task_id,\n * report_token}`); the app settles it too when it sees the turn end, and the\n * server's deadline sweep ends one nobody reported on.\n *\n * Pure (no React, no fetch): the host hook records and settles.\n */\nimport { cleanPrompt, stripAgentNote, titleFromPrompt } from './buildFragments';\nimport { publicSandboxDomain } from './publicSandboxDomain';\nimport { withPublicSandboxHosts } from './sandboxPublicHost';\nimport type { WebBuilderBuild } from './types';\n\n/** The slug every Web Builder job is recorded under. */\nexport const WEBBUILDER_JOB_SURFACE = 'webbuilder';\n/** A build or an edit finishes well inside this. */\nexport const WEBBUILDER_JOB_BUDGET_MS = 30 * 60 * 1000;\n/** Slack past the budget before a running job reads as stopped (surface-kit's grace). */\nexport const WEBBUILDER_JOB_GRACE_MS = 10 * 60 * 1000;\n/** The brief is a line under the title, not the whole ask. */\nconst BRIEF_MAX = 280;\n\n/** The ref a chat turn carries so the agent reports the job's verdict itself. */\nexport interface SurfaceJobRef {\n task_id: string;\n report_token: string;\n}\n\nexport type WebBuilderJobMode = 'new' | 'remix' | 'edit';\n\nexport interface WebBuilderJobStart {\n channelId: string;\n projectId?: string | null;\n /** The person's words for this turn, as sent (notes and prefixes are stripped). */\n ask: string;\n /** The site's name when it has one (an edit); else it is named from the ask. */\n siteTitle?: string | null;\n mode: WebBuilderJobMode;\n /** Who runs it: the agent chat, or the build workflow. */\n lane: 'agent' | 'workflow';\n startedAt: number;\n /** The web app's origin; the job opens this site's Web Builder there. */\n webOrigin?: string | null;\n}\n\nfunction briefFrom(ask: string): string {\n const text = cleanPrompt(stripAgentNote(ask));\n return text.length > BRIEF_MAX ? `${text.slice(0, BRIEF_MAX - 1).trimEnd()}…` : text;\n}\n\n/** `<origin>/c/<channelId>/webbuilder`, the web's Web Builder rail for this chat; http(s) only. */\nexport function webBuilderPageUrl(webOrigin: string | null | undefined, channelId: string): string | undefined {\n const origin = (webOrigin || '').trim().replace(/\\/+$/, '');\n if (!/^https?:\\/\\/[^/]+$/i.test(origin)) return undefined;\n return `${origin}/c/${encodeURIComponent(channelId)}/webbuilder`;\n}\n\n/** The `recordSurfaceJob` input for a turn that is starting. */\nexport function webBuilderJobRecord(start: WebBuilderJobStart): Record<string, unknown> {\n const brief = briefFrom(start.ask);\n // Named from the ask as sent: its \"Build me:\" marks the brief, so \"Build me: Make me a pin\n // board\" is \"Pin Board\" - without it \"Make me ...\" reads as an edit and gets no name.\n const name = start.siteTitle || titleFromPrompt(stripAgentNote(start.ask)) || 'New site';\n const pageUrl = webBuilderPageUrl(start.webOrigin, start.channelId);\n return {\n // One job per turn; the server keys it on `<surface>:<id>`, so a retry records nothing new.\n id: `${start.channelId}:${start.startedAt}`,\n surface: WEBBUILDER_JOB_SURFACE,\n lane: start.lane === 'agent' ? 'channel-turn' : 'workflow',\n title: start.mode === 'edit' ? `Update ${name}` : name,\n brief,\n state: 'running',\n createdAt: start.startedAt,\n startedAt: start.startedAt,\n deadlineAt: start.startedAt + WEBBUILDER_JOB_BUDGET_MS + WEBBUILDER_JOB_GRACE_MS,\n progress: start.mode === 'edit' ? 'Updating your app' : 'Starting your build',\n ...(pageUrl ? { pageUrl } : {}),\n handle: { channelId: start.channelId, ...(start.projectId ? { projectId: start.projectId } : {}) },\n };\n}\n\nexport type WebBuilderJobOutcome =\n | {\n ok: true;\n endedAt: number;\n build?: Pick<WebBuilderBuild, 'previewUrl' | 'liveUrl' | 'coverUrl' | 'title'> | null;\n }\n | { ok: false; endedAt: number; error: string };\n\n/** The `updateSurfaceJob` patch that ends a turn's job; a preview is kept on the platform's sandbox domain. */\nexport function webBuilderJobFinish(outcome: WebBuilderJobOutcome): Record<string, unknown> {\n if (outcome.ok === false) {\n return { state: 'failed', endedAt: outcome.endedAt, progress: null, error: outcome.error };\n }\n const cover = outcome.build?.coverUrl;\n const results =\n cover && /^https?:\\/\\//i.test(cover)\n ? [{ url: cover, kind: 'image', title: outcome.build?.title || 'Site' }]\n : [];\n const site = outcome.build?.liveUrl || outcome.build?.previewUrl;\n return {\n state: 'succeeded',\n endedAt: outcome.endedAt,\n progress: null,\n ...(results.length ? { results } : {}),\n ...(site && /^https?:\\/\\//i.test(site)\n ? { resultUrl: withPublicSandboxHosts(site, publicSandboxDomain()) }\n : {}),\n };\n}\n\n/** The job's ref for a chat turn, when the server gave it a report token. */\nexport function surfaceJobRef(\n record: { id?: string | null; reportToken?: string | null } | null | undefined,\n): SurfaceJobRef | null {\n if (!record?.id || !record.reportToken) return null;\n return { task_id: record.id, report_token: record.reportToken };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAmBO,MAA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,OAAA;AAAA,IACN,KAAO,EAAA,CAAA,CAAA,EAAA,GAAA,OAAA,CAAQ,KAAR,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAAe,KAAS,KAAA;AAAA,GAChC,IAAI,EAAC;AACN,EAAA,MAAM,SAAO,EAAQ,GAAA,OAAA,CAAA,KAAA,KAAR,mBAAe,OAAW,MAAA,CAAA,EAAA,GAAA,OAAA,CAAQ,UAAR,IAAe,GAAA,MAAA,GAAA,EAAA,CAAA,UAAA,CAAA;AACtD,EAAO,OAAA,cAAA,CAAA,cAAA,CAAA;AAAA,IACL,KAAO,EAAA,WAAA;AAAA,IACP,SAAS,OAAQ,CAAA,OAAA;AAAA,IACjB,QAAU,EAAA;AAAA,GAAA,EACN,QAAQ,MAAS,GAAA;AAAA,IACnB;AAAA,MACE,EAAC,CAAA,EACD,QAAQ,eAAgB,CAAA,IAAA,CAAK,IAAI,CAAI,GAAA;AAAA,IACvC,SAAW,EAAA,sBAAA,CAAuB,IAAM,EAAA,mBAAA,EAAqB;AAAA,MAC3D,EAAC,CAAA;AAET;AAGO,SAAS,cAAc,MAGc,EAAA;AAC1C,EAAA,IAAI,EAAC,MAAQ,IAAA,IAAA,GAAA,MAAA,GAAA,MAAA,CAAA,EAAA,CAAA,IAAM,CAAC,MAAA,CAAO,aAAoB,OAAA,IAAA;AAC/C,EAAO,OAAA;AAAA,IACL,SAAS,MAAO,CAAA,EAAA;AAAA,IAChB,cAAc,MAAO,CAAA;AAAA,GACvB;AACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {config}from'../../config/env-config.js';import {publicSandboxDomainFrom,DEFAULT_PUBLIC_SANDBOX_DOMAIN}from'./sandboxPublicHost.js';function publicSandboxDomain() {
|
|
2
|
+
var _a;
|
|
3
|
+
const configured = String((_a = config.E2B_SANDBOX_DOMAIN) != null ? _a : "").trim();
|
|
4
|
+
return configured ? publicSandboxDomainFrom(configured) : DEFAULT_PUBLIC_SANDBOX_DOMAIN;
|
|
5
|
+
}export{publicSandboxDomain};//# sourceMappingURL=publicSandboxDomain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publicSandboxDomain.js","sources":["../../../src/features/webbuilder/publicSandboxDomain.ts"],"sourcesContent":["/**\n * The platform's sandbox preview domain: `E2B_SANDBOX_DOMAIN` (`sandbox.cdebase.dev` on dev),\n * else prod's `sb.yantra.app`. An e2b domain there (`e2b.dev`) means no proxy and gives\n * '' - preview links keep e2b's host. Read on each call, not cached. The rules live in\n * sandboxPublicHost.ts.\n */\nimport { config } from '../../config/env-config';\nimport { DEFAULT_PUBLIC_SANDBOX_DOMAIN, publicSandboxDomainFrom } from './sandboxPublicHost';\n\nexport function publicSandboxDomain(): string {\n const configured = String(config.E2B_SANDBOX_DOMAIN ?? '').trim();\n return configured ? publicSandboxDomainFrom(configured) : DEFAULT_PUBLIC_SANDBOX_DOMAIN;\n}\n"],"names":[],"mappings":"2IAQO,SAAS,mBAA8B,GAAA;AAR9C,EAAA,IAAA,EAAA;AASE,EAAA,MAAM,aAAa,MAAO,CAAA,CAAA,EAAA,GAAA,MAAA,CAAO,uBAAP,IAA6B,GAAA,EAAA,GAAA,EAAE,EAAE,IAAK,EAAA;AAChE,EAAO,OAAA,UAAA,GAAa,uBAAwB,CAAA,UAAU,CAAI,GAAA,6BAAA;AAC5D"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const E2B_CLOUD_SANDBOX_DOMAINS = ["e2b.dev", "e2b.app"];
|
|
2
|
+
const DEFAULT_PUBLIC_SANDBOX_DOMAIN = "sb.yantra.app";
|
|
3
|
+
const DEFAULT_E2B_SANDBOX_DOMAIN = "e2b.dev";
|
|
4
|
+
const HOSTNAME_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/;
|
|
5
|
+
const E2B_SANDBOX_HOST_RE = /(^|[^a-z0-9.-])(\d{2,5}-[a-z0-9][a-z0-9-]{4,62})\.e2b\.(?:dev|app)(?![a-z0-9.-])/gi;
|
|
6
|
+
const SANDBOX_HOST_END = String.raw`(?![a-z0-9-]|\.[a-z0-9])`;
|
|
7
|
+
const SANDBOX_LINK_REST = String.raw`(?:[/?#][^\s)\]"'<>*\x60]*)?`;
|
|
8
|
+
function normalizeDomain(value) {
|
|
9
|
+
const d = String(value != null ? value : "").trim().toLowerCase().replace(/^[a-z]+:\/\//, "").replace(/[/.]+$/, "");
|
|
10
|
+
return HOSTNAME_RE.test(d) ? d : "";
|
|
11
|
+
}
|
|
12
|
+
function escapeRegExp(text) {
|
|
13
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
14
|
+
}
|
|
15
|
+
function isE2bCloudDomain(domain) {
|
|
16
|
+
return E2B_CLOUD_SANDBOX_DOMAINS.includes(normalizeDomain(domain));
|
|
17
|
+
}
|
|
18
|
+
function publicSandboxDomainFrom(value) {
|
|
19
|
+
const d = normalizeDomain(value);
|
|
20
|
+
return d && !isE2bCloudDomain(d) ? d : "";
|
|
21
|
+
}
|
|
22
|
+
function previewDomainFor(sdkDomain, publicDomain) {
|
|
23
|
+
const pub = normalizeDomain(publicDomain);
|
|
24
|
+
if (!pub || isE2bCloudDomain(pub)) return sdkDomain;
|
|
25
|
+
return !String(sdkDomain).trim() || isE2bCloudDomain(sdkDomain) ? pub : sdkDomain;
|
|
26
|
+
}
|
|
27
|
+
function sandboxPreviewUrlFor(sandboxId, publicDomain, port = 3e3) {
|
|
28
|
+
return `https://${port}-${sandboxId}.${previewDomainFor(DEFAULT_E2B_SANDBOX_DOMAIN, publicDomain)}`;
|
|
29
|
+
}
|
|
30
|
+
function withPublicSandboxHosts(text, publicDomain) {
|
|
31
|
+
const pub = normalizeDomain(publicDomain);
|
|
32
|
+
if (!pub || isE2bCloudDomain(pub) || typeof text !== "string" || !/\.e2b\./i.test(text)) return text;
|
|
33
|
+
return text.replace(E2B_SANDBOX_HOST_RE, (_m, lead, label) => `${lead}${label}.${pub}`);
|
|
34
|
+
}
|
|
35
|
+
function withPublicSandboxHostsDeep(value, publicDomain) {
|
|
36
|
+
const pub = normalizeDomain(publicDomain);
|
|
37
|
+
if (!pub || isE2bCloudDomain(pub)) return value;
|
|
38
|
+
const walk = (v, depth) => {
|
|
39
|
+
if (typeof v === "string") return withPublicSandboxHosts(v, pub);
|
|
40
|
+
if (!v || typeof v !== "object" || depth > 64) return v;
|
|
41
|
+
if (Array.isArray(v)) {
|
|
42
|
+
let changed2 = false;
|
|
43
|
+
const out2 = v.map((item) => {
|
|
44
|
+
const next = walk(item, depth + 1);
|
|
45
|
+
if (next !== item) changed2 = true;
|
|
46
|
+
return next;
|
|
47
|
+
});
|
|
48
|
+
return changed2 ? out2 : v;
|
|
49
|
+
}
|
|
50
|
+
if (Object.getPrototypeOf(v) !== Object.prototype && Object.getPrototypeOf(v) !== null) return v;
|
|
51
|
+
let changed = false;
|
|
52
|
+
const out = {};
|
|
53
|
+
for (const [k, item] of Object.entries(v)) {
|
|
54
|
+
const next = k === "files" ? item : walk(item, depth + 1);
|
|
55
|
+
if (next !== item) changed = true;
|
|
56
|
+
out[k] = next;
|
|
57
|
+
}
|
|
58
|
+
return changed ? out : v;
|
|
59
|
+
};
|
|
60
|
+
return walk(value, 0);
|
|
61
|
+
}
|
|
62
|
+
function sandboxPreviewDomainsSource(publicDomain) {
|
|
63
|
+
const pub = publicSandboxDomainFrom(publicDomain);
|
|
64
|
+
return pub ? String.raw`(?:e2b\.(?:dev|app)|${escapeRegExp(pub)})` : String.raw`e2b\.(?:dev|app)`;
|
|
65
|
+
}
|
|
66
|
+
function sandboxPreviewLinkRe(publicDomain) {
|
|
67
|
+
return new RegExp(String.raw`https:\/\/(\d{2,5})-([a-z0-9]{8,40})\.${sandboxPreviewDomainsSource(publicDomain)}${SANDBOX_HOST_END}${SANDBOX_LINK_REST}`, "gi");
|
|
68
|
+
}
|
|
69
|
+
function isSandboxPreviewHost(host, publicDomain) {
|
|
70
|
+
const h = normalizeDomain(host);
|
|
71
|
+
if (!h) return false;
|
|
72
|
+
const pub = publicSandboxDomainFrom(publicDomain);
|
|
73
|
+
return [...E2B_CLOUD_SANDBOX_DOMAINS, ...pub ? [pub] : []].some((d) => h === d || h.endsWith(`.${d}`));
|
|
74
|
+
}export{DEFAULT_E2B_SANDBOX_DOMAIN,DEFAULT_PUBLIC_SANDBOX_DOMAIN,E2B_CLOUD_SANDBOX_DOMAINS,isE2bCloudDomain,isSandboxPreviewHost,previewDomainFor,publicSandboxDomainFrom,sandboxPreviewDomainsSource,sandboxPreviewLinkRe,sandboxPreviewUrlFor,withPublicSandboxHosts,withPublicSandboxHostsDeep};//# sourceMappingURL=sandboxPublicHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sandboxPublicHost.js","sources":["../../../src/features/webbuilder/sandboxPublicHost.ts"],"sourcesContent":["/**\n * The address people reach a sandbox port on.\n *\n * e2b cloud serves port P of sandbox X at `P-X.e2b.app` (`e2b.dev` is the same\n * edge). The platform fronts that edge with its own wildcard domain -\n * kube-orchestration `helm-charts/e2b-custom-domain`: `*.sb.yantra.app` on\n * prod, `*.sandbox.cdebase.dev` on dev - a proxy that copies the left-most\n * label onto e2b.app, so `https://3000-X.sb.yantra.app` is the same site as\n * `https://3000-X.e2b.dev`. Every preview link a person sees or a record keeps\n * uses the platform's domain (`E2B_SANDBOX_DOMAIN`); the e2b SDK domain\n * (`formExtensionE2BDomain`, a build's `modelConfig.domain`) stays the API host\n * it is.\n *\n * The proxy only fronts e2b cloud: a self-hosted e2b domain is already ours and\n * is left as it is. With no platform domain configured every function here\n * leaves its input as it was.\n *\n * Pure, no imports (it is bundled into the federated Web Builder remote too).\n * The rules are yantra-extension's `shared/src/sandboxPublicHost.ts` (the\n * connectors that write preview links); the web keeps a twin at account/browser\n * `utils/sandboxPublicHost.ts` - change both together.\n */\n\n/** e2b cloud's own sandbox domains - the only ones the platform proxy fronts. */\nexport const E2B_CLOUD_SANDBOX_DOMAINS = ['e2b.dev', 'e2b.app'] as const;\n\n/** Prod's sandbox domain: the one used when E2B_SANDBOX_DOMAIN is unset (dev sets sandbox.cdebase.dev). */\nexport const DEFAULT_PUBLIC_SANDBOX_DOMAIN = 'sb.yantra.app';\n\n/** The e2b SDK's default domain: where a preview named without a domain lives. */\nexport const DEFAULT_E2B_SANDBOX_DOMAIN = 'e2b.dev';\n\ntype Loose = any; // eslint-disable-line @typescript-eslint/no-explicit-any\n\nconst HOSTNAME_RE = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)+$/;\n\n/**\n * `<port>-<sandboxId>.e2b.dev|app`, as a whole host. Only the port-prefixed\n * label is matched, so api.e2b.dev, docs and the like never are. The leading\n * group stands in for a lookbehind (Safari and Hermes have none).\n */\nconst E2B_SANDBOX_HOST_RE = /(^|[^a-z0-9.-])(\\d{2,5}-[a-z0-9][a-z0-9-]{4,62})\\.e2b\\.(?:dev|app)(?![a-z0-9.-])/gi;\n\n/**\n * What may follow a preview host in a link: no further label or character of\n * one, so `3000-X.e2b.dev.evil.com` is not an e2b host.\n */\nconst SANDBOX_HOST_END = String.raw`(?![a-z0-9-]|\\.[a-z0-9])`;\n\n/** The rest of a preview link after its host: a path, query or fragment, never `@` or `:`. */\nconst SANDBOX_LINK_REST = String.raw`(?:[/?#][^\\s)\\]\"'<>*\\x60]*)?`;\n\nfunction normalizeDomain(value: unknown): string {\n const d = String(value ?? '')\n .trim()\n .toLowerCase()\n .replace(/^[a-z]+:\\/\\//, '')\n .replace(/[/.]+$/, '');\n return HOSTNAME_RE.test(d) ? d : '';\n}\n\nfunction escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\nexport function isE2bCloudDomain(domain: unknown): boolean {\n return (E2B_CLOUD_SANDBOX_DOMAINS as readonly string[]).includes(normalizeDomain(domain));\n}\n\n/**\n * The platform's sandbox domain (`sb.yantra.app`) from a configured value, or ''\n * when none is set. An e2b domain is not one: it would make the rewrite a no-op loop.\n */\nexport function publicSandboxDomainFrom(value: unknown): string {\n const d = normalizeDomain(value);\n return d && !isE2bCloudDomain(d) ? d : '';\n}\n\n/**\n * Host suffix for the preview links of a sandbox the SDK reaches on\n * `sdkDomain`: the platform's domain for e2b cloud (an empty domain is the SDK\n * default, e2b cloud), otherwise `sdkDomain` itself.\n */\nexport function previewDomainFor(sdkDomain: string, publicDomain: string): string {\n const pub = normalizeDomain(publicDomain);\n if (!pub || isE2bCloudDomain(pub)) return sdkDomain;\n return !String(sdkDomain || '').trim() || isE2bCloudDomain(sdkDomain) ? pub : sdkDomain;\n}\n\n/** `https://<port>-<sandboxId>.<domain>` for an e2b cloud sandbox: the platform's domain when set, else e2b.dev. */\nexport function sandboxPreviewUrlFor(sandboxId: string, publicDomain: string, port: number | string = 3000): string {\n return `https://${port}-${sandboxId}.${previewDomainFor(DEFAULT_E2B_SANDBOX_DOMAIN, publicDomain)}`;\n}\n\n/**\n * Every e2b cloud sandbox host in `text` (a URL, a bare host, or prose with\n * links in it) moved onto `publicDomain`; the scheme, port, path and query stay.\n * Unchanged when no platform domain is configured.\n */\nexport function withPublicSandboxHosts(text: string, publicDomain: string): string {\n const pub = normalizeDomain(publicDomain);\n if (!pub || isE2bCloudDomain(pub) || typeof text !== 'string' || !/\\.e2b\\./i.test(text)) return text;\n return text.replace(E2B_SANDBOX_HOST_RE, (_m, lead: string, label: string) => `${lead}${label}.${pub}`);\n}\n\n/**\n * withPublicSandboxHosts over every string in a JSON-like value - for a record\n * about to be saved or read back whole. A `files` map is project source, the\n * person's own code, and is never rewritten. Returns the input itself when\n * nothing changed.\n */\nexport function withPublicSandboxHostsDeep<T>(value: T, publicDomain: string): T {\n const pub = normalizeDomain(publicDomain);\n if (!pub || isE2bCloudDomain(pub)) return value;\n const walk = (v: Loose, depth: number): Loose => {\n if (typeof v === 'string') return withPublicSandboxHosts(v, pub);\n if (!v || typeof v !== 'object' || depth > 64) return v;\n if (Array.isArray(v)) {\n let changed = false;\n const out = v.map((item) => {\n const next = walk(item, depth + 1);\n if (next !== item) changed = true;\n return next;\n });\n return changed ? out : v;\n }\n if (Object.getPrototypeOf(v) !== Object.prototype && Object.getPrototypeOf(v) !== null) return v;\n let changed = false;\n const out: Record<string, Loose> = {};\n for (const [k, item] of Object.entries(v)) {\n const next = k === 'files' ? item : walk(item, depth + 1);\n if (next !== item) changed = true;\n out[k] = next;\n }\n return changed ? out : v;\n };\n return walk(value, 0);\n}\n\n/**\n * Regex source for the domains a preview link may name: e2b cloud's and, when\n * one is set, the platform's. Never any other host - agent text would otherwise\n * point the preview at an arbitrary site.\n */\nexport function sandboxPreviewDomainsSource(publicDomain: string): string {\n const pub = publicSandboxDomainFrom(publicDomain);\n return pub ? String.raw`(?:e2b\\.(?:dev|app)|${escapeRegExp(pub)})` : String.raw`e2b\\.(?:dev|app)`;\n}\n\n/**\n * Sandbox preview links in text (`https://3000-<id>.e2b.app/path`, or on the\n * platform's domain): group 1 is the port, group 2 the sandbox id. Global, so\n * use it with matchAll; a new one per call.\n */\nexport function sandboxPreviewLinkRe(publicDomain: string): RegExp {\n return new RegExp(\n String.raw`https:\\/\\/(\\d{2,5})-([a-z0-9]{8,40})\\.${sandboxPreviewDomainsSource(publicDomain)}${SANDBOX_HOST_END}${SANDBOX_LINK_REST}`,\n 'gi',\n );\n}\n\n/** `host` is a sandbox preview host: under e2b cloud or the platform's sandbox domain. */\nexport function isSandboxPreviewHost(host: string, publicDomain: string): boolean {\n const h = normalizeDomain(host);\n if (!h) return false;\n const pub = publicSandboxDomainFrom(publicDomain);\n return [...E2B_CLOUD_SANDBOX_DOMAINS, ...(pub ? [pub] : [])].some((d) => h === d || h.endsWith(`.${d}`));\n}\n"],"names":["changed","out"],"mappings":"AAwBa,MAAA,yBAAA,GAA4B,CAAC,SAAA,EAAW,SAAS;AAGvD,MAAM,6BAAgC,GAAA;AAGtC,MAAM,0BAA6B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AA,CAAA,EAAI,IAAI,CAAA;AAC/J;AAGgB,SAAA,oBAAA,CAAqB,MAAc,YAA+B,EAAA;AAChF,EAAM,MAAA,CAAA,GAAI,gBAAgB,IAAI,CAAA;AAC9B,EAAI,IAAA,CAAC,GAAU,OAAA,KAAA;AACf,EAAM,MAAA,GAAA,GAAM,wBAAwB,YAAY,CAAA;AAChD,EAAO,OAAA,CAAC,GAAG,yBAA2B,EAAA,GAAI,MAAM,CAAC,GAAG,IAAI,EAAG,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,MAAM,CAAK,IAAA,CAAA,CAAE,SAAS,CAAI,CAAA,EAAA,CAAC,EAAE,CAAC,CAAA;AACvG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const COMPANY_SITE_SUFFIX = "yarntra.com";
|
|
1
|
+
import {publicSandboxDomain}from'./publicSandboxDomain.js';import {isSandboxPreviewHost}from'./sandboxPublicHost.js';const COMPANY_SITE_SUFFIX = "yarntra.com";
|
|
2
2
|
const PROJECT_NAME_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
3
3
|
const PAGES_DEV_RE = /\.pages\.dev$/i;
|
|
4
4
|
const PLATFORM_LABELS = /* @__PURE__ */ new Set(["www", "app", "api", "cdn", "cdecli-agent", "idefront", "ideback", "sb"]);
|
|
@@ -40,6 +40,7 @@ function shownDomainUrl(value) {
|
|
|
40
40
|
if (!raw) return "";
|
|
41
41
|
const host = hostOf(/^https?:\/\//i.test(raw) ? raw : `https://${raw}`);
|
|
42
42
|
if (!host || !/^[a-z0-9.-]+\.[a-z]{2,}$/.test(host) || PAGES_DEV_RE.test(host) || /\.e2b\./.test(host)) return "";
|
|
43
|
+
if (isSandboxPreviewHost(host, publicSandboxDomain())) return "";
|
|
43
44
|
if (host.endsWith(".yantra.app") && !isCompanySiteHost(host)) return "";
|
|
44
45
|
return `https://${host}`;
|
|
45
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"siteAddress.js","sources":["../../../src/features/webbuilder/siteAddress.ts"],"sourcesContent":["/**\n * The one place that knows site domains (web `publish/siteAddress.ts`, #446): a\n * published site is shown on its custom domain or the company domain\n * (`<projectName>.yarntra.com`), never `pages.dev`, which is only parsed for the\n * project name. Pure: hosts are read with a regex, not `URL
|
|
1
|
+
{"version":3,"file":"siteAddress.js","sources":["../../../src/features/webbuilder/siteAddress.ts"],"sourcesContent":["/**\n * The one place that knows site domains (web `publish/siteAddress.ts`, #446): a\n * published site is shown on its custom domain or the company domain\n * (`<projectName>.yarntra.com`), never `pages.dev`, which is only parsed for the\n * project name. Pure: hosts are read with a regex, not `URL` (the platform's\n * sandbox domain comes from config, publicSandboxDomain).\n */\nimport { publicSandboxDomain } from './publicSandboxDomain';\nimport { isSandboxPreviewHost } from './sandboxPublicHost';\n\nexport const COMPANY_SITE_SUFFIX = 'yarntra.com';\n\nconst PROJECT_NAME_RE = /^[a-z0-9][a-z0-9-]{0,62}$/;\nconst PAGES_DEV_RE = /\\.pages\\.dev$/i;\n// yantra.app is also the platform domain: these first labels are platform hosts, not sites.\nconst PLATFORM_LABELS = new Set(['www', 'app', 'api', 'cdn', 'cdecli-agent', 'idefront', 'ideback', 'sb']);\nconst PLATFORM_LABEL_RE = /-surface$|^sb-|^\\d+-/;\n\nfunction hostOf(url: string | null | undefined): string {\n const match = /^https?:\\/\\/([^/?#:\\s]+)/i.exec(String(url ?? '').trim());\n return match ? match[1].toLowerCase() : '';\n}\n\nfunction companySiteName(host: string): string {\n if (host.endsWith('.yarntra.com')) {\n const name = host.slice(0, -'.yarntra.com'.length).split('.').pop() || '';\n return PROJECT_NAME_RE.test(name) ? name : '';\n }\n if (host.endsWith('.yantra.app')) {\n const name = host.slice(0, -'.yantra.app'.length);\n if (!PROJECT_NAME_RE.test(name) || PLATFORM_LABELS.has(name) || PLATFORM_LABEL_RE.test(name)) return '';\n return name;\n }\n return '';\n}\n\nexport function isCompanySiteHost(host: string): boolean {\n return companySiteName(host) !== '';\n}\n\n/** The project name a live address carries (`lotus-flow.pages.dev`, `lotus-flow.yarntra.com`). */\nexport function siteProjectName(url: string | null | undefined): string {\n const host = hostOf(url);\n if (!host) return '';\n if (PAGES_DEV_RE.test(host)) {\n const name = host.replace(PAGES_DEV_RE, '').split('.').pop() || '';\n return PROJECT_NAME_RE.test(name) ? name : '';\n }\n return companySiteName(host);\n}\n\nexport function companySiteUrl(projectName: string | null | undefined): string {\n const name = String(projectName ?? '')\n .trim()\n .toLowerCase();\n return PROJECT_NAME_RE.test(name) ? `https://${name}.${COMPANY_SITE_SUFFIX}` : '';\n}\n\n/**\n * A custom domain to show as is: not pages.dev, not a platform host, not a sandbox - on\n * e2b's domains or the platform's sandbox domain (`*.sandbox.cdebase.dev` on dev).\n */\nfunction shownDomainUrl(value: string | null | undefined): string {\n const raw = String(value ?? '').trim();\n if (!raw) return '';\n const host = hostOf(/^https?:\\/\\//i.test(raw) ? raw : `https://${raw}`);\n if (!host || !/^[a-z0-9.-]+\\.[a-z]{2,}$/.test(host) || PAGES_DEV_RE.test(host) || /\\.e2b\\./.test(host)) return '';\n if (isSandboxPreviewHost(host, publicSandboxDomain())) return '';\n if (host.endsWith('.yantra.app') && !isCompanySiteHost(host)) return '';\n return `https://${host}`;\n}\n\n/** Custom domain > recorded company URL > `https://<projectName>.yarntra.com`; never pages.dev. */\nexport function siteAddress(input: {\n customDomainUrl?: string | null;\n urls?: Array<string | null | undefined>;\n projectName?: string | null;\n}): string {\n const custom = shownDomainUrl(input.customDomainUrl);\n if (custom) return custom;\n const urls = (input.urls ?? []).map((u) => String(u ?? '').trim()).filter(Boolean);\n const company = urls.find((u) => isCompanySiteHost(hostOf(u)));\n if (company) return `https://${hostOf(company)}`;\n const name = String(input.projectName ?? '').trim() || urls.map(siteProjectName).find(Boolean) || '';\n const built = companySiteUrl(name);\n if (built) return built;\n return urls.map(shownDomainUrl).find(Boolean) || '';\n}\n\n/** The address to show for a recorded live URL (pages.dev becomes the company domain). */\nexport function shownLiveUrl(url: string | null | undefined): string | null {\n if (!url) return null;\n return siteAddress({ urls: [url] }) || null;\n}\n\nconst PAGES_DEV_LINK_RE = /(https?:\\/\\/)?((?:[a-z0-9-]+\\.)*[a-z0-9][a-z0-9-]*)\\.pages\\.dev\\b/gi;\n\n/** Display only: `<name>.pages.dev[/path]` becomes the company address, path kept. */\nexport function rewritePagesDevLinks(text: string): string {\n return String(text ?? '').replace(PAGES_DEV_LINK_RE, (match, scheme: string | undefined, labels: string) => {\n const url = companySiteUrl(labels.toLowerCase().split('.').pop() || '');\n if (!url) return match;\n return scheme ? url : url.replace(/^https:\\/\\//, '');\n });\n}\n"],"names":[],"mappings":"qHASO,MAAM,mBAAsB,GAAA;AACnC,MAAM,eAAkB,GAAA,2BAAA;AACxB,MAAM,YAAe,GAAA,gBAAA;AAErB,MAAM,eAAkB,mBAAA,IAAI,GAAI,CAAA,CAAC,KAAO,EAAA,KAAA,EAAO,KAAO,EAAA,KAAA,EAAO,cAAgB,EAAA,UAAA,EAAY,SAAW,EAAA,IAAI,CAAC,CAAA;AACzG,MAAM,iBAAoB,GAAA,sBAAA;AAC1B,SAAS,OAAO,GAAwC,EAAA;AACtD,EAAM,MAAA,KAAA,GAAQ,4BAA4B,IAAK,CAAA,MAAA,CAAO,oBAAO,EAAE,CAAA,CAAE,MAAM,CAAA;AACvE,EAAA,OAAO,KAAQ,GAAA,KAAA,CAAM,CAAC,CAAA,CAAE,aAAgB,GAAA,EAAA;AAC1C;AACA,SAAS,gBAAgB,IAAsB,EAAA;AAC7C,EAAI,IAAA,IAAA,CAAK,QAAS,CAAA,cAAc,CAAG,EAAA;AACjC,IAAA,MAAM,IAAO,GAAA,IAAA,CAAK,KAAM,CAAA,CAAA,EAAG,CAAC,cAAA,CAAe,MAAM,CAAA,CAAE,KAAM,CAAA,GAAG,CAAE,CAAA,GAAA,EAAS,IAAA,EAAA;AACvE,IAAA,OAAO,eAAgB,CAAA,IAAA,CAAK,IAAI,CAAA,GAAI,IAAO,GAAA,E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id: "cafe",
|
|
3
3
|
label: "Caf\xE9 website with menu",
|
|
4
4
|
prompt: "Build a website for a neighbourhood specialty coffee shop: hero, menu with prices, opening hours, location map and an Instagram-style gallery. Warm, modern look."
|
|
@@ -40,7 +40,8 @@ function wakePreviewPrompt() {
|
|
|
40
40
|
return "Open a live preview of my latest build.";
|
|
41
41
|
}
|
|
42
42
|
function agentEditNote(build) {
|
|
43
|
-
|
|
43
|
+
const preview = build.previewUrl ? withPublicSandboxHosts(build.previewUrl, publicSandboxDomain()) : "";
|
|
44
|
+
return `[Open build] The user is looking at the live preview of "${build.title || "this site"}" that you built${build.sandboxId ? ` (sandbox ${build.sandboxId}${preview ? `, ${preview}` : ""})` : ""}. Apply their request to that site in that sandbox - do not start a new one - and reply with the preview link.${build.snapshotId ? ` If that sandbox is gone, boot from its latest restore point (snapshotId ${build.snapshotId}).` : ""}`;
|
|
44
45
|
}
|
|
45
46
|
function agentPublishMessage(build, projectName, customDomain) {
|
|
46
47
|
return `Publish "${build.title || "this site"}" as ${projectName}${""}.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webbuilderPrompts.js","sources":["../../../src/features/webbuilder/webbuilderPrompts.ts"],"sourcesContent":["/**\n * Follow-ups for the Web Builder agent: the first asks of a site with nothing\n * built yet, and the edits people make most after a first build.\n */\nimport type { AgentChatSuggestion } from '../agent-chat';\n\n/**\n * Starter prompts in an empty chat (web `CHAT_STARTERS`, Lovable): complete briefs\n * that build on one tap - specific enough that the agent asks nothing.\n */\nexport const CHAT_STARTERS: readonly AgentChatSuggestion[] = [\n {\n id: 'cafe',\n label: 'Café website with menu',\n prompt: 'Build a website for a neighbourhood specialty coffee shop: hero, menu with prices, opening hours, location map and an Instagram-style gallery. Warm, modern look.',\n },\n {\n id: 'saas',\n label: 'SaaS landing page',\n prompt: 'Build a landing page for a project-management SaaS: hero with product screenshot, features, pricing (3 tiers), testimonials, FAQ and a sign-up call to action.',\n },\n {\n id: 'portfolio',\n label: 'Photographer portfolio',\n prompt: 'Build a portfolio for a wedding photographer: full-bleed gallery, about, packages with prices, and a contact form for booking enquiries. Elegant, minimal.',\n },\n {\n id: 'booking',\n label: 'Booking app with database',\n prompt: 'Build a booking app for a yoga studio: class schedule, book a spot (saved in a database), and an admin page listing bookings.',\n },\n];\n\nexport function webbuilderAgentSuggestions(hasBuild: boolean, siteTitle: string | null): AgentChatSuggestion[] {\n if (!hasBuild) return [...CHAT_STARTERS];\n const name = siteTitle ? ` on ${siteTitle}` : '';\n return [\n { id: 'mobile', label: 'Make it great on phones', prompt: `Make every page${name} look great on phones.` },\n { id: 'colors', label: 'New color scheme', prompt: 'Give the site a fresh, modern color scheme.' },\n { id: 'section', label: 'Add a section', prompt: 'Add a testimonials section above the footer.' },\n { id: 'fix', label: 'Fix what is broken', prompt: 'Check the site for errors and fix anything broken.' },\n ];\n}\n\ntype BuildRef = {\n title?: string;\n previewUrl: string | null;\n sandboxId: string | null;\n snapshotId?: string | null;\n};\n\n/**\n * Sent when the preview does not answer and the app could not bring it back\n * itself: the sandbox slept or was reclaimed (E2B sandboxes live about an hour\n * after the last change). The words are the web's (#428); the host's\n * `[Open build]` note names this build's sandbox and restore point, so the agent\n * reopens THIS site, booting the snapshot when the sandbox is gone.\n */\nexport function wakePreviewPrompt(): string {\n return 'Open a live preview of my latest build.';\n}\n\n/**\n * The note a change to an agent-chat build carries (web `agentEditForChat`): the\n * site lives in the agent's sandbox, so the change goes to that sandbox - never a\n * new one - with the restore point for when it expired.\n */\nexport function agentEditNote(build: BuildRef): string {\n return `[Open build] The user is looking at the live preview of \"${build.title || 'this site'}\" that you built${\n build.sandboxId ? ` (sandbox ${build.sandboxId}${
|
|
1
|
+
{"version":3,"file":"webbuilderPrompts.js","sources":["../../../src/features/webbuilder/webbuilderPrompts.ts"],"sourcesContent":["/**\n * Follow-ups for the Web Builder agent: the first asks of a site with nothing\n * built yet, and the edits people make most after a first build.\n */\nimport type { AgentChatSuggestion } from '../agent-chat';\nimport { publicSandboxDomain } from './publicSandboxDomain';\nimport { withPublicSandboxHosts } from './sandboxPublicHost';\n\n/**\n * Starter prompts in an empty chat (web `CHAT_STARTERS`, Lovable): complete briefs\n * that build on one tap - specific enough that the agent asks nothing.\n */\nexport const CHAT_STARTERS: readonly AgentChatSuggestion[] = [\n {\n id: 'cafe',\n label: 'Café website with menu',\n prompt: 'Build a website for a neighbourhood specialty coffee shop: hero, menu with prices, opening hours, location map and an Instagram-style gallery. Warm, modern look.',\n },\n {\n id: 'saas',\n label: 'SaaS landing page',\n prompt: 'Build a landing page for a project-management SaaS: hero with product screenshot, features, pricing (3 tiers), testimonials, FAQ and a sign-up call to action.',\n },\n {\n id: 'portfolio',\n label: 'Photographer portfolio',\n prompt: 'Build a portfolio for a wedding photographer: full-bleed gallery, about, packages with prices, and a contact form for booking enquiries. Elegant, minimal.',\n },\n {\n id: 'booking',\n label: 'Booking app with database',\n prompt: 'Build a booking app for a yoga studio: class schedule, book a spot (saved in a database), and an admin page listing bookings.',\n },\n];\n\nexport function webbuilderAgentSuggestions(hasBuild: boolean, siteTitle: string | null): AgentChatSuggestion[] {\n if (!hasBuild) return [...CHAT_STARTERS];\n const name = siteTitle ? ` on ${siteTitle}` : '';\n return [\n { id: 'mobile', label: 'Make it great on phones', prompt: `Make every page${name} look great on phones.` },\n { id: 'colors', label: 'New color scheme', prompt: 'Give the site a fresh, modern color scheme.' },\n { id: 'section', label: 'Add a section', prompt: 'Add a testimonials section above the footer.' },\n { id: 'fix', label: 'Fix what is broken', prompt: 'Check the site for errors and fix anything broken.' },\n ];\n}\n\ntype BuildRef = {\n title?: string;\n previewUrl: string | null;\n sandboxId: string | null;\n snapshotId?: string | null;\n};\n\n/**\n * Sent when the preview does not answer and the app could not bring it back\n * itself: the sandbox slept or was reclaimed (E2B sandboxes live about an hour\n * after the last change). The words are the web's (#428); the host's\n * `[Open build]` note names this build's sandbox and restore point, so the agent\n * reopens THIS site, booting the snapshot when the sandbox is gone.\n */\nexport function wakePreviewPrompt(): string {\n return 'Open a live preview of my latest build.';\n}\n\n/**\n * The note a change to an agent-chat build carries (web `agentEditForChat`): the\n * site lives in the agent's sandbox, so the change goes to that sandbox - never a\n * new one - with the restore point for when it expired. The note is kept in the\n * chat, so its preview link is on the platform's sandbox domain when one is set.\n */\nexport function agentEditNote(build: BuildRef): string {\n const preview = build.previewUrl ? withPublicSandboxHosts(build.previewUrl, publicSandboxDomain()) : '';\n return `[Open build] The user is looking at the live preview of \"${build.title || 'this site'}\" that you built${\n build.sandboxId ? ` (sandbox ${build.sandboxId}${preview ? `, ${preview}` : ''})` : ''\n }. Apply their request to that site in that sandbox - do not start a new one - and reply with the preview link.${\n build.snapshotId\n ? ` If that sandbox is gone, boot from its latest restore point (snapshotId ${build.snapshotId}).`\n : ''\n }`;\n}\n\n/** What Publish asks the agent for an agent-chat build (web `agentPublishMessage`). */\nexport function agentPublishMessage(build: BuildRef, projectName: string, customDomain?: string): string {\n return `Publish \"${build.title || 'this site'}\" as ${projectName}${customDomain ? ` on ${customDomain}` : ''}.`;\n}\n"],"names":[],"mappings":"uHAYO,MAAM,gBAAgD,CAAC;AAAA,EAC5D,EAAI,EAAA,MAAA;AAAA,EACJ,KAAO,EAAA,2BAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,MAAA;AAAA,EACJ,KAAO,EAAA,mBAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,WAAA;AAAA,EACJ,KAAO,EAAA,wBAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,SAAA;AAAA,EACJ,KAAO,EAAA,2BAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAC;AACe,SAAA,0BAAA,CAA2B,UAAmB,SAAiD,EAAA;AAC7G,EAAA,IAAI,CAAC,QAAA,EAAiB,OAAA,CAAC,GAAG,aAAa,CAAA;AACvC,EAAA,MAAM,IAA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CAAA,KAAA,EAAQ,WAAW,CAAA,EAA0C,EAAE,CAAA,CAAA,CAAA;AAC9G"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
1
|
+
import {publicSandboxDomain}from'./publicSandboxDomain.js';import {withPublicSandboxHosts}from'./sandboxPublicHost.js';var __defProp = Object.defineProperty;
|
|
2
2
|
var __defProps = Object.defineProperties;
|
|
3
3
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
@@ -460,7 +460,7 @@ function buildTriggerParams(opts) {
|
|
|
460
460
|
};
|
|
461
461
|
const templateSnapshotId = ((_c = pickedTemplate == null ? void 0 : pickedTemplate.snapshotId) == null ? void 0 : _c.trim()) || "";
|
|
462
462
|
const sandboxId = isEditTurn ? ((_d = opts.edit) == null ? void 0 : _d.sandboxId) || sandboxIdFromUrl((_e = opts.edit) == null ? void 0 : _e.sandboxUrl) || null : null;
|
|
463
|
-
const sandboxUrl = isEditTurn ? (((_g = (_f = opts.edit) == null ? void 0 : _f.sandboxUrl) == null ? void 0 : _g.trim()) || "").split("?")[0] || null : null;
|
|
463
|
+
const sandboxUrl = isEditTurn ? withPublicSandboxHosts((((_g = (_f = opts.edit) == null ? void 0 : _f.sandboxUrl) == null ? void 0 : _g.trim()) || "").split("?")[0], publicSandboxDomain()) || null : null;
|
|
464
464
|
const remixFragment = {};
|
|
465
465
|
if (pickedTemplate == null ? void 0 : pickedTemplate.deployUrl) remixFragment.deployUrl = pickedTemplate.deployUrl;
|
|
466
466
|
if (isNewFromTemplate && templateSnapshotId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow.js","sources":["../../../src/features/webbuilder/workflow.ts"],"sourcesContent":["/**\n * Builds the payload that starts a Web Builder build.\n *\n * Native twin of the web surface's build trigger (aicode-stack\n * `surfaces/webbuilder/src/standalone/listCodeAssistantTemplates.ts` and the\n * send path of `realServices.tsx`). A build is started by running the\n * `yantra-webbuilder` connector's `WEBBUILDER_TRIGGER_WORKFLOW` action with a\n * `createChannelInput` (the AI Assistant channel + the user's post) and an\n * `extensionInput` (which form extension the backend dispatches to). Both are\n * derived from two org settings payloads:\n *\n * - `marketplace.templates.codeAssistant` (schema `uiLayout`): the starter /\n * remix template cards, plus the `projectType: codeassistant` workflow model\n * that carries formExtensionId / formId / E2B template ids;\n * - `appSettings.settings.aieditor` (schema `configuration`): per-org extras\n * merged under the workflow model.\n *\n * Pure (no React, no fetch, no `common`): it is bundled into the federated\n * Web Builder remote, so the host fetches the settings and hands them here.\n * Behavior is kept identical to the web so a build started from the phone\n * reaches the same pipeline with the same fields.\n */\n\n/** Same settings namespace the web Code Assistant cards load (schema `uiLayout`). */\nexport const CODE_ASSISTANT_TEMPLATE_CONFIG_KEY = 'marketplace.templates.codeAssistant';\nexport const CODE_ASSISTANT_TEMPLATE_SCHEMA_ID = 'uiLayout';\n/** Per-org AI editor app settings, merged under the workflow model (schema `configuration`). */\nexport const APP_SETTINGS_AIEDITOR_KEY = 'appSettings.settings.aieditor';\nexport const APP_SETTINGS_AIEDITOR_SCHEMA_ID = 'configuration';\n\n/** E2B stack used when nothing names one. */\nexport const DEFAULT_STACK_TEMPLATE = 'vite-react';\n/** The web picker's default model (`src/standalone/models.ts`). */\nexport const DEFAULT_MODEL_ID = 'yantra-router/medium';\n\nexport const WEBBUILDER_CONNECTOR_ID = 'yantra-webbuilder';\nexport const WEBBUILDER_TRIGGER_WORKFLOW_ACTION = 'WEBBUILDER_TRIGGER_WORKFLOW';\n\n/** Id of the synthetic defaults row, never sent as a picked `templateId`. */\nconst WORKFLOW_DEFAULTS_ID = 'codeassistant-workflow-defaults';\n\n/** E2B fields the workflow model puts on `modelConfig.metadata` + `extensionInput.metadata`. */\nexport interface WebBuilderTemplateMetadata {\n formExtensionE2BAPIKey?: string;\n formExtensionE2BClaudeTemplateId?: string;\n formExtensionE2BDomain?: string;\n formExtensionE2BTemplateId?: string;\n formExtensionE2BViteReactTemplateId?: string;\n formExtensionE2BVueTemplateId?: string;\n /** Build workflow route; the Web Builder always uses `github-model`. */\n templateTarget?: string;\n}\n\n/** One starter / remix card (the web `WebBuilderTemplateOption`). */\nexport interface WebBuilderTemplate {\n /** Picker id: the form's `formTemplateId`, else its form key. */\n id: string;\n title: string;\n description?: string;\n cover?: string;\n category?: string;\n /** E2B stack (`vite-react` | `nextjs` | `vue`), sent as `modelConfig.template`. */\n templateName?: string;\n formTemplateId?: string;\n /** Workflow model form extension; without it the backend has nothing to dispatch. */\n formExtensionId?: string;\n formId?: string;\n formFunctionId?: string;\n /** E2B sandbox domain. */\n domain?: string;\n apiKey?: string;\n metadata?: WebBuilderTemplateMetadata;\n /** Seed prompt for the composer when the card is picked. */\n chatPrompt?: string;\n previewUrl?: string;\n deployUrl?: string;\n /** E2B snapshot a remix boots from. */\n snapshotId?: string;\n usesSupabase?: boolean;\n skill?: string;\n}\n\ntype TemplateInfo = Record<string, unknown>;\n\nfunction str(v: unknown): string {\n if (typeof v === 'string') return v.trim();\n return v == null ? '' : String(v).trim();\n}\n\nfunction boolTrue(v: unknown): boolean {\n return v === true || v === 'true' || v === 1 || v === '1';\n}\n\nfunction humanizeFormKey(formKey: string): string {\n return formKey\n .replace(/[-_]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .map((word) => (word ? word[0].toUpperCase() + word.slice(1) : word))\n .join(' ');\n}\n\nfunction isDisabled(info: TemplateInfo): boolean {\n if (info.enabled === false || info.enabled === 'false') return true;\n if (info.enable === false || info.enable === 'false') return true;\n return false;\n}\n\n/**\n * A template gallery: an entry that lists `forms` cards. Its formExtensionId /\n * formId name the extension that contributed the cards (e.g. the WebBuilder\n * Templates `webbuilder` pack), which has no build functions - the backend\n * accepts the run, executes 0 functions and the build never starts. Only an\n * entry without cards can be the build workflow.\n */\nfunction isCardPack(info: TemplateInfo): boolean {\n const { forms } = info;\n return Boolean(forms) && typeof forms === 'object' && Object.keys(forms as object).length > 0;\n}\n\n/** Offline fallback: the Yantra starters (not vite/next/vue stack rows). */\nexport const FALLBACK_TEMPLATES: WebBuilderTemplate[] = [\n {\n id: 'assetwise',\n title: 'Assetwise',\n description: 'Yantra starter template',\n templateName: 'vite-react',\n formTemplateId: 'assetwise',\n },\n {\n id: 'arch-studio-v2-by-yantra',\n title: 'Arch Studio V2',\n description: 'Arch Studio v2 template by Yantra',\n templateName: 'vite-react',\n formTemplateId: 'arch-studio-v2-by-yantra',\n },\n {\n id: 'pinpost',\n title: 'Pinpost',\n description: 'Yantra starter template',\n templateName: 'vite-react',\n formTemplateId: 'pinpost',\n },\n {\n id: 'triage-by-yantra',\n title: 'Triage by Yantra',\n description: 'Yantra starter template',\n templateName: 'vite-react',\n formTemplateId: 'triage-by-yantra',\n },\n];\n\n/**\n * Normalize `pageSettings.settings` into the flat template map keyed by\n * template slug. The loader may hand back the full tree, the codeAssistant\n * subtree, or either wrapped as `{ settings: … }`.\n */\nfunction extractFlatMap(settings: unknown, preferCodeAssistant = false): Record<string, TemplateInfo> {\n if (!settings || typeof settings !== 'object') return {};\n const root = settings as Record<string, unknown>;\n\n const candidates: unknown[] = preferCodeAssistant\n ? [\n (root as { marketplace?: { templates?: { codeAssistant?: unknown } } }).marketplace?.templates\n ?.codeAssistant,\n (root as { templates?: { codeAssistant?: unknown } }).templates?.codeAssistant,\n (root as { codeAssistant?: unknown }).codeAssistant,\n (root as { settings?: unknown }).settings,\n root,\n ]\n : [(root as { settings?: unknown }).settings, root];\n\n const hit = candidates.find(\n (c) => c && typeof c === 'object' && !Array.isArray(c) && Object.keys(c as object).length > 0,\n );\n return (hit as Record<string, TemplateInfo> | undefined) ?? {};\n}\n\nfunction pickMetadata(info: TemplateInfo, templateTarget?: string): WebBuilderTemplateMetadata {\n return {\n // The E2B API key is only for local preview/deploy; buildWorkflowPayloadFromTemplate never forwards it.\n formExtensionE2BAPIKey: str(info.formExtensionE2BAPIKey) || undefined,\n formExtensionE2BClaudeTemplateId: str(info.formExtensionE2BClaudeTemplateId) || undefined,\n formExtensionE2BDomain: str(info.formExtensionE2BDomain) || undefined,\n formExtensionE2BTemplateId: str(info.formExtensionE2BTemplateId) || undefined,\n formExtensionE2BViteReactTemplateId: str(info.formExtensionE2BViteReactTemplateId) || undefined,\n formExtensionE2BVueTemplateId: str(info.formExtensionE2BVueTemplateId) || undefined,\n ...(templateTarget ? { templateTarget } : {}),\n };\n}\n\n/**\n * The marketplace entry that is the workflow model: `projectType: codeassistant`\n * first, github-model next. Never a card pack (see {@link isCardPack}).\n */\nfunction findWorkflowModel(map: Record<string, TemplateInfo>): { key: string; settings: TemplateInfo } | null {\n const ranked: Array<{ key: string; settings: TemplateInfo; rank: number }> = [];\n const eligible = Object.entries(map).filter(\n ([, info]) =>\n info &&\n typeof info === 'object' &&\n !isDisabled(info) &&\n !isCardPack(info) &&\n Boolean(str(info.formId)) &&\n Boolean(str(info.formExtensionId)),\n );\n for (const [key, info] of eligible) {\n const pt = str(info.projectType).toLowerCase();\n const tn = str(info.templateName).toLowerCase();\n const k = key.toLowerCase();\n let rank = 2;\n if (pt === 'codeassistant') rank = 0;\n else if (\n pt === 'github-model' ||\n tn === 'github-model' ||\n k.includes('github-model') ||\n k.includes('aieditor-form-code-extractor')\n ) {\n rank = 1;\n }\n ranked.push({ key, settings: info, rank });\n }\n ranked.sort((a, b) => a.rank - b.rank);\n return ranked[0] ?? null;\n}\n\nfunction resolveWorkflowModel(\n uiMap: Record<string, TemplateInfo>,\n appMap: Record<string, TemplateInfo>,\n): TemplateInfo | null {\n const found = findWorkflowModel(uiMap);\n if (!found) return null;\n const templateName = str(found.settings.templateName) || found.key;\n const appExtras = appMap[found.key] ?? appMap[templateName];\n // App settings first, marketplace form ids last so formId/extensionId always win.\n if (appExtras && typeof appExtras === 'object') {\n return { ...appExtras, ...found.settings };\n }\n return found.settings;\n}\n\n/** Marketplace ids that are routing markers, never an E2B stack. */\nconst NON_STACK_MARKERS = new Set([\n 'github-model',\n 'codeassistant',\n 'multi',\n 'aieditor-code-extractor',\n 'aieditor-form-code-extractor',\n]);\n\n/**\n * One marker -> stack id, or null when it is not a stack signal. `multi` packs\n * list both `vite` and `nextjs` in keywords, so they never pick a stack here.\n */\nfunction matchStackMarker(raw: string): string | null {\n const v = raw.toLowerCase().trim();\n if (!v || NON_STACK_MARKERS.has(v)) return null;\n\n if (\n v === 'nextjs' ||\n v === 'next' ||\n v === 'nextjs-base' ||\n v.includes('nextjs-base') ||\n v.startsWith('nextjs-') ||\n v.startsWith('next-js')\n ) {\n return 'nextjs';\n }\n\n if (v === 'vue' || v.startsWith('vue-') || v.includes('vue-')) return 'vue';\n\n if (\n v === 'vite-react' ||\n v === 'vitereact' ||\n v === 'react-base' ||\n v === 'vite-base' ||\n v === 'remix' ||\n v === 'vite' ||\n v.startsWith('vite') ||\n v.includes('react-base') ||\n v.includes('react-visual-base') ||\n v === 'react'\n ) {\n return 'vite-react';\n }\n\n return null;\n}\n\n/** Marketplace markers -> E2B stack (`vite-react` | `nextjs` | `vue`); vite-react when none match. */\nexport function normalizeStackTemplate(markers: string[]): string {\n for (const m of markers) {\n const hit = matchStackMarker(m);\n if (hit) return hit;\n }\n return DEFAULT_STACK_TEMPLATE;\n}\n\nfunction pushMarker(out: string[], value: unknown): void {\n const v = str(value).toLowerCase();\n if (!v || NON_STACK_MARKERS.has(v)) return;\n out.push(v);\n}\n\nfunction collectKeywordMarkers(source: TemplateInfo): string[] {\n const out: string[] = [];\n for (const listKey of ['keywords', 'tags'] as const) {\n const raw = source[listKey];\n if (Array.isArray(raw)) {\n for (const item of raw) pushMarker(out, item);\n } else if (raw && typeof raw === 'object') {\n for (const item of Object.values(raw as Record<string, unknown>)) pushMarker(out, item);\n } else if (typeof raw === 'string') {\n for (const part of raw.split(',')) pushMarker(out, part);\n }\n }\n return out;\n}\n\n/**\n * E2B stack for one form card: form-owned signals first; a `multi` pack is\n * vite-react (its parent keywords list both vite and nextjs, nextjs must not\n * win); then the pack key / parent fields / parent keywords.\n */\nfunction resolveCardStack(form: TemplateInfo, parent: TemplateInfo, formKey: string, templateKey?: string): string {\n const formOwned: string[] = [formKey];\n for (const key of ['templateName', 'projectType', 'modelTemplate'] as const) {\n pushMarker(formOwned, form[key]);\n }\n formOwned.push(...collectKeywordMarkers(form));\n\n for (const m of formOwned) {\n const hit = matchStackMarker(m);\n if (hit) return hit;\n }\n\n const projectType = (str(form.projectType) || str(parent.projectType)).toLowerCase();\n if (projectType === 'multi') {\n return DEFAULT_STACK_TEMPLATE;\n }\n\n const rest: string[] = [];\n if (templateKey) pushMarker(rest, templateKey);\n for (const key of ['templateName', 'projectType', 'modelTemplate'] as const) {\n pushMarker(rest, parent[key]);\n }\n rest.push(...collectKeywordMarkers(parent));\n return normalizeStackTemplate(rest);\n}\n\n/** The Web Builder always routes through the unified `github-model` build workflow route. */\nconst TEMPLATE_TARGET = 'github-model';\n\nfunction formHasOwnPreviewableUrl(form: TemplateInfo): boolean {\n return Boolean(str(form.previewUrl) || str(form.deployUrl) || str(form.figmaUrl));\n}\n\n/** Marketplace `projectType` values for blank visual-editor base starters. */\nconst BASE_PROJECT_TYPES = new Set(['react-base', 'nextjs-base']);\n\n/** Base starters (react-base / nextjs-base) are listed without a preview URL; remix cards need one. */\nfunction isBaseTemplateForm(form: TemplateInfo, formKey: string, group: TemplateInfo): boolean {\n const formPt = str(form.projectType).toLowerCase();\n if (BASE_PROJECT_TYPES.has(formPt)) return true;\n\n const key = formKey.toLowerCase();\n const title = str(form.title).toLowerCase();\n if (key.includes('nextjs-base') || key.includes('react-visual-base') || key.includes('react-base')) {\n return true;\n }\n if (\n title.includes('visual base') ||\n title.includes('base visual') ||\n /\\b(react|next\\s*js?)\\b.*\\bbase\\b/.test(title) ||\n /\\bbase\\b.*\\b(react|next\\s*js?)\\b/.test(title)\n ) {\n return true;\n }\n\n // A base-tagged parent only lifts forms that look like base starters, so\n // incomplete sibling cards sharing the parent stay hidden.\n const groupPt = str(group.projectType).toLowerCase();\n if (BASE_PROJECT_TYPES.has(groupPt) && (key.includes('base') || title.includes('base'))) {\n return true;\n }\n return false;\n}\n\n/** Thumbnail for a base template with no cover or deploy screenshot. */\nconst BASE_TEMPLATE_DEFAULT_COVER = `data:image/svg+xml,${encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"400\" height=\"225\" viewBox=\"0 0 400 225\">` +\n `<defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">` +\n `<stop offset=\"0%\" stop-color=\"#e2e8f0\"/><stop offset=\"100%\" stop-color=\"#f1f5f9\"/>` +\n `</linearGradient></defs>` +\n `<rect width=\"400\" height=\"225\" fill=\"url(#g)\"/>` +\n `<rect x=\"48\" y=\"48\" width=\"304\" height=\"129\" rx=\"12\" fill=\"#fff\" stroke=\"#cbd5e1\" stroke-width=\"2\"/>` +\n `<rect x=\"72\" y=\"72\" width=\"120\" height=\"10\" rx=\"5\" fill=\"#94a3b8\"/>` +\n `<rect x=\"72\" y=\"96\" width=\"200\" height=\"8\" rx=\"4\" fill=\"#cbd5e1\"/>` +\n `<rect x=\"72\" y=\"116\" width=\"160\" height=\"8\" rx=\"4\" fill=\"#cbd5e1\"/>` +\n `<rect x=\"72\" y=\"144\" width=\"72\" height=\"20\" rx=\"6\" fill=\"#64748b\"/>` +\n `</svg>`,\n)}`;\n\ntype RankedCard = WebBuilderTemplate & { hasOwnTitle?: boolean };\n\nfunction cardRichnessScore(card: RankedCard): number {\n return (card.hasOwnTitle ? 2 : 0) + (card.description ? 1 : 0) + (card.cover ? 1 : 0);\n}\n\nfunction previewUrlDedupeKey(card: WebBuilderTemplate): string {\n const urlKey = `${card.deployUrl ?? ''}|${card.previewUrl ?? ''}|`;\n // Base templates often share empty URLs; keep them distinct by id.\n if (urlKey === '||') return `id:${card.id}`;\n return urlKey;\n}\n\n/**\n * Every previewable `.forms.*` card under the codeAssistant settings, carrying\n * the workflow model's connector ids. Deduped by preview/deploy URL (richest\n * card wins) and sorted by title, as the web picker shows them.\n */\nfunction mapYantraFormCards(\n uiMap: Record<string, TemplateInfo>,\n workflowModel: TemplateInfo | null,\n): WebBuilderTemplate[] {\n const workflowFormId = workflowModel ? str(workflowModel.formId) : '';\n const workflowExtId = workflowModel ? str(workflowModel.formExtensionId) : '';\n const workflowFnId = workflowModel ? str(workflowModel.formFunctionId) : '';\n const workflowDomain = workflowModel ? str(workflowModel.formExtensionE2BDomain) : '';\n const workflowApiKey = workflowModel\n ? str(workflowModel.formExtensionModelConfigAPIKey) || str(workflowModel.apiKey)\n : '';\n\n const raw: RankedCard[] = [];\n // The workflow-model entry itself has no cards to show.\n const groups = Object.entries(uiMap).filter(\n ([, group]) =>\n group &&\n typeof group === 'object' &&\n !isDisabled(group) &&\n str(group.projectType).toLowerCase() !== 'codeassistant' &&\n group.forms &&\n typeof group.forms === 'object',\n );\n\n for (const [templateKey, group] of groups) {\n const forms = Object.entries(group.forms as Record<string, unknown>).filter(\n (entry): entry is [string, TemplateInfo] =>\n Boolean(entry[1]) && typeof entry[1] === 'object' && !isDisabled(entry[1] as TemplateInfo),\n );\n for (const [formKey, form] of forms) {\n const isBaseTemplate = isBaseTemplateForm(form, formKey, group);\n // Remix cards need a preview/deploy URL; base templates do not.\n if (formHasOwnPreviewableUrl(form) || isBaseTemplate) {\n const ownTitle = str(form.title);\n const title = ownTitle || humanizeFormKey(formKey) || 'Untitled';\n const formTemplateId = str(form.formTemplateId);\n const id = formTemplateId || formKey;\n const previewUrl = str(form.previewUrl) || str(group.previewUrl) || undefined;\n const deployUrl = str(form.deployUrl) || str(group.deployUrl) || undefined;\n const cover =\n str(form.coverImageUrl) ||\n str(form.previewImageUrl) ||\n str(group.coverImageUrl) ||\n (isBaseTemplate && !deployUrl ? BASE_TEMPLATE_DEFAULT_COVER : undefined);\n const snapshotId =\n str(form.snapshotId) || str(form.sourceSnapshotId) || str(group.snapshotId) || undefined;\n const usesSupabase = boolTrue(form.usesSupabase) || boolTrue(group.usesSupabase);\n const stack = resolveCardStack(form, group, formKey, templateKey);\n const metadata = pickMetadata(workflowModel || {}, TEMPLATE_TARGET);\n\n raw.push({\n id,\n title,\n description: str(form.description) || 'Yantra starter template',\n cover,\n category: str(form.category) || undefined,\n templateName: stack,\n formTemplateId: formTemplateId || undefined,\n // Only the workflow model runs builds; the pack's own ids name its gallery.\n formExtensionId: workflowExtId || undefined,\n formId: workflowFormId || undefined,\n formFunctionId: workflowFnId || undefined,\n domain: workflowDomain || undefined,\n apiKey: workflowApiKey || undefined,\n metadata,\n chatPrompt: str(form.chatPrompt) || undefined,\n previewUrl,\n deployUrl,\n snapshotId,\n usesSupabase,\n skill: str(form.skill) || str(group.skill) || undefined,\n hasOwnTitle: Boolean(ownTitle),\n });\n }\n }\n }\n\n const bestByUrl = new Map<string, RankedCard>();\n for (const card of raw) {\n const key = previewUrlDedupeKey(card);\n const existing = bestByUrl.get(key);\n if (!existing || cardRichnessScore(card) > cardRichnessScore(existing)) {\n bestByUrl.set(key, card);\n }\n }\n\n return [...bestByUrl.values()]\n .map(({ hasOwnTitle: _h, ...card }) => card)\n .sort((a, b) => a.title.localeCompare(b.title));\n}\n\n/** Template cards from the two settings payloads (web `listCodeAssistantTemplatesViaGraphql`, minus the fetch). */\nexport function templatesFromSettings(uiLayoutSettings: unknown, appSettings: unknown): WebBuilderTemplate[] {\n const uiMap = extractFlatMap(uiLayoutSettings, true);\n const appMap = extractFlatMap(appSettings, false);\n return mapYantraFormCards(uiMap, resolveWorkflowModel(uiMap, appMap));\n}\n\n/**\n * The connector ids a build uses when no card is picked (web\n * `loadCodeAssistantWorkflowDefaults`, minus the fetch): the workflow model.\n * Null when the org has none, which means the build workflow is not set up and\n * the host builds through the agent chat instead. A card pack's own\n * formExtensionId is never a fallback (see {@link isCardPack}).\n */\nexport function workflowDefaultsFromSettings(\n uiLayoutSettings: unknown,\n appSettings: unknown,\n stack: string = DEFAULT_STACK_TEMPLATE,\n): WebBuilderTemplate | null {\n const uiMap = extractFlatMap(uiLayoutSettings, true);\n const appMap = extractFlatMap(appSettings, false);\n const workflowModel = resolveWorkflowModel(uiMap, appMap);\n const formExtensionId = workflowModel ? str(workflowModel.formExtensionId) : '';\n if (!workflowModel || !formExtensionId) return null;\n return {\n id: WORKFLOW_DEFAULTS_ID,\n title: 'Code Assistant',\n templateName: normalizeStackTemplate([stack]),\n formExtensionId,\n formId: str(workflowModel.formId) || undefined,\n formFunctionId: str(workflowModel.formFunctionId) || undefined,\n domain: str(workflowModel.formExtensionE2BDomain) || undefined,\n apiKey: str(workflowModel.formExtensionModelConfigAPIKey) || str(workflowModel.apiKey) || undefined,\n metadata: pickMetadata(workflowModel, TEMPLATE_TARGET),\n };\n}\n\n/**\n * `modelConfig` + `extensionInput` for a template (web\n * `buildWorkflowPayloadFromTemplate`, unchanged). Form ids come from the\n * workflow model, the stack from the card; templateTarget is always\n * `github-model`. The E2B API key and GitHub credentials are never forwarded:\n * the agent's vault owns those.\n */\nexport function buildWorkflowPayloadFromTemplate(\n template: WebBuilderTemplate | undefined,\n extras?: {\n modelId?: string;\n systemId?: string;\n skill?: string;\n skillActionId?: string;\n editProjectId?: string;\n defaultTemplate?: string;\n },\n): {\n modelConfig: Record<string, unknown>;\n extensionInput: Record<string, unknown>;\n templateName: string;\n} {\n const rawName = template?.templateName || extras?.defaultTemplate || DEFAULT_STACK_TEMPLATE;\n const templateName = normalizeStackTemplate([rawName]) || DEFAULT_STACK_TEMPLATE;\n const m = template?.metadata || {};\n const templateTarget = TEMPLATE_TARGET;\n\n const metadata: Record<string, string> = {\n ...(m.formExtensionE2BClaudeTemplateId\n ? { formExtensionE2BClaudeTemplateId: m.formExtensionE2BClaudeTemplateId }\n : {}),\n ...(m.formExtensionE2BDomain ? { formExtensionE2BDomain: m.formExtensionE2BDomain } : {}),\n ...(m.formExtensionE2BTemplateId ? { formExtensionE2BTemplateId: m.formExtensionE2BTemplateId } : {}),\n ...(m.formExtensionE2BViteReactTemplateId\n ? { formExtensionE2BViteReactTemplateId: m.formExtensionE2BViteReactTemplateId }\n : {}),\n ...(m.formExtensionE2BVueTemplateId ? { formExtensionE2BVueTemplateId: m.formExtensionE2BVueTemplateId } : {}),\n templateTarget,\n };\n // The turn's toolbox skill wins over the template/pack skill.\n const skill = extras?.skill || template?.skill;\n if (skill) metadata.skill = skill;\n if (extras?.skillActionId) metadata.skillActionId = extras.skillActionId;\n if (template?.formTemplateId) metadata.formTemplateId = template.formTemplateId;\n\n // `template` is the stack; `templateTarget` is the workflow route and never goes in `template`.\n const modelConfig: Record<string, unknown> = {\n template: templateName,\n templateTarget,\n domain: template?.domain || 'e2b.dev',\n ...(template?.apiKey ? { apiKey: template.apiKey } : {}),\n metadata,\n };\n if (extras?.modelId) {\n modelConfig.model = extras.modelId;\n // `yantra-router/medium` -> provider `yantra-router`.\n const slash = extras.modelId.indexOf('/');\n if (slash > 0) modelConfig.provider = extras.modelId.slice(0, slash);\n }\n if (extras?.systemId) {\n modelConfig.system = extras.systemId;\n modelConfig.designSystem = extras.systemId;\n modelConfig.systemId = extras.systemId;\n }\n if (skill) {\n modelConfig.skill = skill;\n modelConfig.skillId = skill;\n }\n if (extras?.skillActionId) modelConfig.skillActionId = extras.skillActionId;\n if (extras?.editProjectId) modelConfig.editProjectId = extras.editProjectId;\n\n const extensionInput: Record<string, unknown> = {\n ...(template?.formExtensionId ? { extensionId: template.formExtensionId } : {}),\n stepName: 'extractCodeFromExtension',\n formId: template?.formId || 'form-builder-proxy',\n functionId: template?.formFunctionId || 'create-channel-function',\n metadata,\n source: 'final-submission',\n };\n\n return { modelConfig, extensionInput, templateName };\n}\n\n/** A Mongo-style 24-hex id (8 hex seconds + 16 random hex), as the web mints channel/project ids. */\nexport function newObjectId(): string {\n const ts = Math.floor(Date.now() / 1000)\n .toString(16)\n .padStart(8, '0');\n let rand = '';\n for (let i = 0; i < 16; i++) rand += Math.floor(Math.random() * 16).toString(16);\n return ts + rand;\n}\n\nfunction decodeBase64(b64: string): string {\n if (typeof atob === 'function') return atob(b64);\n // jest/node without atob.\n // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require\n const { Buffer } = require('buffer') as { Buffer: { from(s: string, e: string): { toString(e: string): string } } };\n return Buffer.from(b64, 'base64').toString('binary');\n}\n\n/**\n * The token's `tenant` (or `tid`) claim, unverified. The connector runs the\n * trigger against this tenant. Unlike the web this also accepts base64url\n * segments (`-`/`_`, no padding), which the web's bare `atob` would reject.\n */\nexport function tenantIdFromToken(token: string | null | undefined): string | undefined {\n if (!token) return undefined;\n try {\n const seg = (token.split('.')[1] || '').replace(/-/g, '+').replace(/_/g, '/');\n const padded = seg + '='.repeat((4 - (seg.length % 4)) % 4);\n const payload = JSON.parse(decodeBase64(padded)) as { tenant?: string; tid?: string };\n return payload.tenant || payload.tid;\n } catch {\n return undefined;\n }\n}\n\n/** Stack names and the defaults row are not a picked catalog card (web `explicitTemplateId`). */\nconst NON_PICK_TEMPLATE_IDS = new Set([WORKFLOW_DEFAULTS_ID, 'bundled', 'vite-react', 'nextjs', 'vue', '']);\n\nfunction explicitTemplateId(template: { id?: string | null } | null | undefined): string | undefined {\n const id = String(template?.id ?? '').trim();\n if (NON_PICK_TEMPLATE_IDS.has(id)) return undefined;\n return id;\n}\n\nconst LOCAL_HOST_RE = /^https?:\\/\\/(localhost|127\\.0\\.0\\.1)([:/]|$)/i;\n\n/** E2B preview hosts are `3000-<sandboxId>.<domain>`; recover the id when only the URL is known. */\nfunction sandboxIdFromUrl(url: string | null | undefined): string | null {\n return url?.match(/^https?:\\/\\/3000-([^.]+)\\./)?.[1] || null;\n}\n\nexport type WebBuilderTurnMode = 'new' | 'remix' | 'edit';\n\nexport interface WebBuilderTriggerOptions {\n channelId: string;\n projectId: string;\n /** The user's prompt, posted as the turn's content. */\n text: string;\n /** The card the user picked; any picked card makes this a fresh remix build. */\n template?: WebBuilderTemplate;\n /** From {@link workflowDefaultsFromSettings}; supplies the connector ids a card lacks. */\n defaults: WebBuilderTemplate | null;\n mode: WebBuilderTurnMode;\n /** The build being edited (mode `edit`). */\n edit?: { sandboxId?: string | null; sandboxUrl?: string | null; title?: string | null };\n /** Stack of the build being edited, when known (web `lastSandbox.templateId`). */\n stackHint?: string;\n modelId?: string;\n /** Look-alike site, already normalized to https by the caller. */\n referenceUrl?: string;\n /** Uploaded files (https URLs, never base64). */\n attachments?: Array<{ name: string; url: string; mimeType?: string }>;\n /** Backend the app reads builds from; forwarded so the connector writes to the same one. */\n graphqlUrl?: string;\n token?: string;\n /** The agent runs on this machine, so a localhost graphqlUrl is reachable from it. */\n agentLocal?: boolean;\n}\n\n/**\n * The `WEBBUILDER_TRIGGER_WORKFLOW` params for one turn, mirroring the web send\n * path: the picked card is merged over the workflow defaults (the card's stack\n * and metadata win, the defaults fill missing connector ids), and the fragment\n * says how the sandbox boots:\n * - picked card with a snapshot -> `remix` from that snapshot;\n * - edit -> `edit`, reconnecting the existing sandbox (no snapshot);\n * - otherwise a blank boot of the stack template.\n *\n * Returns `not-configured` when no form extension id is known: the backend\n * would accept the channel but have nothing to dispatch, and the build would\n * hang until timeout, so the caller fails fast instead.\n *\n * Omitted from the web turn (not wired on native yet): referenceArtifact\n * (`mode: 'reference'` + prompt rewrite), design system / skill / skillActionId,\n * canvas hand edits, project knowledge, integrations, aiInApp, design\n * direction, GitHub sync, database, app secrets, plan, follow-up answers, the\n * VITE_WEBBUILDER_EXTENSION_ID dev fallback, and the 401 re-mint retry.\n */\nexport function buildTriggerParams(\n opts: WebBuilderTriggerOptions,\n): { ok: true; params: Record<string, unknown> } | { ok: false; reason: 'not-configured' } {\n const { channelId, projectId, defaults } = opts;\n // A picked card always means a fresh remix build on the web; it never rides on an edit.\n const pickedTemplate = opts.mode === 'edit' ? undefined : opts.template;\n const isNewFromTemplate = Boolean(pickedTemplate);\n const isEditTurn =\n !isNewFromTemplate && opts.mode === 'edit' && Boolean(opts.edit?.sandboxId || opts.edit?.sandboxUrl);\n\n const stackHint =\n pickedTemplate?.templateName || (isEditTurn ? opts.stackHint : undefined) || DEFAULT_STACK_TEMPLATE;\n\n let templateForPayload: WebBuilderTemplate | undefined;\n if (pickedTemplate) {\n templateForPayload = {\n ...pickedTemplate,\n formExtensionId: pickedTemplate.formExtensionId || defaults?.formExtensionId,\n formId: pickedTemplate.formId || defaults?.formId,\n formFunctionId: pickedTemplate.formFunctionId || defaults?.formFunctionId,\n domain: pickedTemplate.domain || defaults?.domain,\n apiKey: pickedTemplate.apiKey || defaults?.apiKey,\n metadata: { ...(defaults?.metadata || {}), ...(pickedTemplate.metadata || {}) },\n // The card's stack wins; never inherit the workflow model's (often nextjs).\n templateName: pickedTemplate.templateName || stackHint,\n };\n } else if (defaults) {\n templateForPayload = { ...defaults, templateName: stackHint || defaults.templateName };\n }\n\n const resolvedModelId = opts.modelId || DEFAULT_MODEL_ID;\n const { modelConfig, extensionInput, templateName } = buildWorkflowPayloadFromTemplate(templateForPayload, {\n modelId: resolvedModelId,\n defaultTemplate: stackHint,\n });\n if (!extensionInput.extensionId) return { ok: false, reason: 'not-configured' };\n\n const templateSnapshotId = pickedTemplate?.snapshotId?.trim() || '';\n const sandboxId = isEditTurn ? opts.edit?.sandboxId || sandboxIdFromUrl(opts.edit?.sandboxUrl) || null : null;\n const sandboxUrl = isEditTurn ? (opts.edit?.sandboxUrl?.trim() || '').split('?')[0] || null : null;\n\n const remixFragment: Record<string, unknown> = {};\n if (pickedTemplate?.deployUrl) remixFragment.deployUrl = pickedTemplate.deployUrl;\n if (isNewFromTemplate && templateSnapshotId) {\n remixFragment.remix = true;\n remixFragment.mode = 'remix';\n remixFragment.snapshotId = templateSnapshotId;\n remixFragment.usesSupabase = pickedTemplate?.usesSupabase === true;\n } else if (isEditTurn && (sandboxId || sandboxUrl)) {\n // Server reconnect path: remix + sandboxId, no snapshotId.\n remixFragment.remix = true;\n remixFragment.mode = 'edit';\n if (sandboxId) remixFragment.sandboxId = sandboxId;\n if (sandboxUrl) remixFragment.sandboxUrl = sandboxUrl;\n if (opts.edit?.title) remixFragment.title = opts.edit.title;\n remixFragment.projectId = projectId;\n }\n\n const pickedTemplateId = explicitTemplateId(pickedTemplate);\n const referenceUrl = opts.referenceUrl?.trim();\n const attachments = opts.attachments?.filter((a) => a && a.url) ?? [];\n\n const createChannelInput = {\n channelId,\n title: 'AI Assistant',\n description: 'AI Assistant',\n displayName: 'AI Assistant',\n topic: 'AI Assistant',\n projectId,\n type: 'AIASSISTANT',\n postData: {\n type: 'AIASSISTANT',\n content: opts.text,\n props: {\n template: templateName,\n templateTarget: TEMPLATE_TARGET,\n projectId,\n role: 'USER',\n fragment: remixFragment,\n ...(sandboxId ? { sandboxId } : {}),\n ...(sandboxUrl ? { sandboxUrl } : {}),\n model: resolvedModelId,\n ...(attachments.length ? { attachments } : {}),\n // Only a card the user picked, never the defaults row or a stack name.\n ...(pickedTemplateId ? { templateId: pickedTemplateId } : {}),\n ...(referenceUrl ? { referenceUrl } : {}),\n },\n },\n additionalProperties: { modelConfig },\n };\n\n // Pin the connector to the same backend the app reads builds from. A\n // localhost URL rides along only when the agent is local too: a hosted\n // agent cannot reach a developer's machine.\n const authParams =\n opts.graphqlUrl && (opts.agentLocal || !LOCAL_HOST_RE.test(opts.graphqlUrl))\n ? { graphqlUrl: opts.graphqlUrl, accessToken: opts.token, tenantId: tenantIdFromToken(opts.token) }\n : {};\n\n return { ok: true, params: { createChannelInput, extensionInput, ...authParams } };\n}\n\n/**\n * The agent-only note a template pick sends with the person's words - the web's\n * `templateRemixForChat` (#384): template picks build through the agent chat\n * (webbuilder-design-pro \"Remix a template\"), not `WEBBUILDER_TRIGGER_WORKFLOW`, which\n * stalls when the workflow never posts back to the chat.\n */\nexport function templateRemixNote(template: Pick<WebBuilderTemplate, 'title' | 'snapshotId'>): string {\n const snapshot = template.snapshotId?.trim();\n const boot = snapshot\n ? `Boot it with WEBBUILDER_CREATE_SANDBOX {\"snapshotId\":\"${snapshot}\",\"builder\":\"vite\",\"timeoutMs\":3600000,\"private\":true}.`\n : `Find it with WEBBUILDER_LIST_TEMPLATES and boot it with that card's start.params.`;\n return [\n `[Template] The user picked the Yantra template \"${template.title}\" to start from - remix it (Remix a template).`,\n boot,\n 'They already chose this template: do not ask how to start. Ask only what you still need, then build and give the live preview link.',\n ].join(' ');\n}\n\n/** The skill the web Agent chat runs on (`chat/agentSkill.ts`): the whole website journey. */\nexport const WEBBUILDER_CHAT_SKILL = 'yantra-skills/webbuilder-design-pro';\n"],"names":["Buffer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBO,MAAM,kCAAqC,GAAA;AAG3C,MAAM,yBAA4B,GAAA;AAIlC,MAAM,sBAAyB,GAAA;AAE/B,MAAM,gBAAmB,GAAA;AACzB,MAAM,uBAA0B,GAAA;AAChC,MAAM,kCAAqC,GAAA;AAGlD,MAAM,oBAAuB,GAAA,iCAAA;AA2C7B,SAAS,IAAI,CAAoB,EAAA;AAC/B,EAAA,IAAI,OAAO,CAAA,KAAM,QAAU,EAAA,OAAO,EAAE,IAAK,EAAA;AACzC,EAAA,OAAO,KAAK,IAAO,GAAA,EAAA,GAAK,MAAO,CAAA,CAAC,EAAE,IAAK,EAAA;AACzC;AACA,SAAS,SAAS,CAAqB,EAAA;AACrC,EAAA,OAAO,MAAM,IAAQ,IAAA,CAAA,KAAM,MAAU,IAAA,CAAA,KAAM,KAAK,CAAM,KAAA,GAAA;AACxD;AACA,SAAS,gBAAgB,OAAyB,EAAA;AAChD,EAAO,OAAA,OAAA,CAAQ,OAAQ,CAAA,QAAA,EAAU,GAAG,CAAA,CAAE,MAAO,CAAA,KAAA,CAAM,KAAK,CAAA,CAAE,GAAI,CAAA,CAAA,IAAA,KAAQ,OAAO,IAAK,CAAA,CAAC,CAAE,CAAA,WAAA,EAAgB,GAAA,IAAA,CAAK,KAAM,CAAA,CAAC,CAAI,GAAA,IAAI,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA;AACrI;AACA,SAAS,WAAW,IAA6B,EAAA;AAC/C,EAAA,IAAI,KAAK,OAAY,KAAA,KAAA,IA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F;AAQO,SAAS,kBAAkB,QAAoE,EAAA;AA3xBtG,EAAA,IAAA,EAAA;AA4xBE,EAAM,MAAA,QAAA,GAAA,CAAW,EAAS,GAAA,QAAA,CAAA,UAAA,KAAT,IAAqB,GAAA,MAAA,GAAA,EAAA,CAAA,IAAA,EAAA;AACtC,EAAA,MAAM,IAAO,GAAA,QAAA,GAAW,CAAyD,sDAAA,EAAA,QAAQ,CAA4D,uDAAA,CAAA,GAAA,CAAA,iFAAA,CAAA;AACrJ,EAAO,OAAA,CAAC,mDAAmD,QAAS,CAAA,KAAK,kDAAkD,IAAM,EAAA,qIAAqI,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA;AAClR;AAGO,MAAM,qBAAwB,GAAA"}
|
|
1
|
+
{"version":3,"file":"workflow.js","sources":["../../../src/features/webbuilder/workflow.ts"],"sourcesContent":["/**\n * Builds the payload that starts a Web Builder build.\n *\n * Native twin of the web surface's build trigger (aicode-stack\n * `surfaces/webbuilder/src/standalone/listCodeAssistantTemplates.ts` and the\n * send path of `realServices.tsx`). A build is started by running the\n * `yantra-webbuilder` connector's `WEBBUILDER_TRIGGER_WORKFLOW` action with a\n * `createChannelInput` (the AI Assistant channel + the user's post) and an\n * `extensionInput` (which form extension the backend dispatches to). Both are\n * derived from two org settings payloads:\n *\n * - `marketplace.templates.codeAssistant` (schema `uiLayout`): the starter /\n * remix template cards, plus the `projectType: codeassistant` workflow model\n * that carries formExtensionId / formId / E2B template ids;\n * - `appSettings.settings.aieditor` (schema `configuration`): per-org extras\n * merged under the workflow model.\n *\n * Pure (no React, no fetch, no `common`): it is bundled into the federated\n * Web Builder remote, so the host fetches the settings and hands them here.\n * Behavior is kept identical to the web so a build started from the phone\n * reaches the same pipeline with the same fields. The one value read from\n * config is the platform's sandbox domain, which an edit's preview is saved on.\n */\nimport { publicSandboxDomain } from './publicSandboxDomain';\nimport { withPublicSandboxHosts } from './sandboxPublicHost';\n\n/** Same settings namespace the web Code Assistant cards load (schema `uiLayout`). */\nexport const CODE_ASSISTANT_TEMPLATE_CONFIG_KEY = 'marketplace.templates.codeAssistant';\nexport const CODE_ASSISTANT_TEMPLATE_SCHEMA_ID = 'uiLayout';\n/** Per-org AI editor app settings, merged under the workflow model (schema `configuration`). */\nexport const APP_SETTINGS_AIEDITOR_KEY = 'appSettings.settings.aieditor';\nexport const APP_SETTINGS_AIEDITOR_SCHEMA_ID = 'configuration';\n\n/** E2B stack used when nothing names one. */\nexport const DEFAULT_STACK_TEMPLATE = 'vite-react';\n/** The web picker's default model (`src/standalone/models.ts`). */\nexport const DEFAULT_MODEL_ID = 'yantra-router/medium';\n\nexport const WEBBUILDER_CONNECTOR_ID = 'yantra-webbuilder';\nexport const WEBBUILDER_TRIGGER_WORKFLOW_ACTION = 'WEBBUILDER_TRIGGER_WORKFLOW';\n\n/** Id of the synthetic defaults row, never sent as a picked `templateId`. */\nconst WORKFLOW_DEFAULTS_ID = 'codeassistant-workflow-defaults';\n\n/** E2B fields the workflow model puts on `modelConfig.metadata` + `extensionInput.metadata`. */\nexport interface WebBuilderTemplateMetadata {\n formExtensionE2BAPIKey?: string;\n formExtensionE2BClaudeTemplateId?: string;\n formExtensionE2BDomain?: string;\n formExtensionE2BTemplateId?: string;\n formExtensionE2BViteReactTemplateId?: string;\n formExtensionE2BVueTemplateId?: string;\n /** Build workflow route; the Web Builder always uses `github-model`. */\n templateTarget?: string;\n}\n\n/** One starter / remix card (the web `WebBuilderTemplateOption`). */\nexport interface WebBuilderTemplate {\n /** Picker id: the form's `formTemplateId`, else its form key. */\n id: string;\n title: string;\n description?: string;\n cover?: string;\n category?: string;\n /** E2B stack (`vite-react` | `nextjs` | `vue`), sent as `modelConfig.template`. */\n templateName?: string;\n formTemplateId?: string;\n /** Workflow model form extension; without it the backend has nothing to dispatch. */\n formExtensionId?: string;\n formId?: string;\n formFunctionId?: string;\n /** E2B sandbox domain. */\n domain?: string;\n apiKey?: string;\n metadata?: WebBuilderTemplateMetadata;\n /** Seed prompt for the composer when the card is picked. */\n chatPrompt?: string;\n previewUrl?: string;\n deployUrl?: string;\n /** E2B snapshot a remix boots from. */\n snapshotId?: string;\n usesSupabase?: boolean;\n skill?: string;\n}\n\ntype TemplateInfo = Record<string, unknown>;\n\nfunction str(v: unknown): string {\n if (typeof v === 'string') return v.trim();\n return v == null ? '' : String(v).trim();\n}\n\nfunction boolTrue(v: unknown): boolean {\n return v === true || v === 'true' || v === 1 || v === '1';\n}\n\nfunction humanizeFormKey(formKey: string): string {\n return formKey\n .replace(/[-_]+/g, ' ')\n .trim()\n .split(/\\s+/)\n .map((word) => (word ? word[0].toUpperCase() + word.slice(1) : word))\n .join(' ');\n}\n\nfunction isDisabled(info: TemplateInfo): boolean {\n if (info.enabled === false || info.enabled === 'false') return true;\n if (info.enable === false || info.enable === 'false') return true;\n return false;\n}\n\n/**\n * A template gallery: an entry that lists `forms` cards. Its formExtensionId /\n * formId name the extension that contributed the cards (e.g. the WebBuilder\n * Templates `webbuilder` pack), which has no build functions - the backend\n * accepts the run, executes 0 functions and the build never starts. Only an\n * entry without cards can be the build workflow.\n */\nfunction isCardPack(info: TemplateInfo): boolean {\n const { forms } = info;\n return Boolean(forms) && typeof forms === 'object' && Object.keys(forms as object).length > 0;\n}\n\n/** Offline fallback: the Yantra starters (not vite/next/vue stack rows). */\nexport const FALLBACK_TEMPLATES: WebBuilderTemplate[] = [\n {\n id: 'assetwise',\n title: 'Assetwise',\n description: 'Yantra starter template',\n templateName: 'vite-react',\n formTemplateId: 'assetwise',\n },\n {\n id: 'arch-studio-v2-by-yantra',\n title: 'Arch Studio V2',\n description: 'Arch Studio v2 template by Yantra',\n templateName: 'vite-react',\n formTemplateId: 'arch-studio-v2-by-yantra',\n },\n {\n id: 'pinpost',\n title: 'Pinpost',\n description: 'Yantra starter template',\n templateName: 'vite-react',\n formTemplateId: 'pinpost',\n },\n {\n id: 'triage-by-yantra',\n title: 'Triage by Yantra',\n description: 'Yantra starter template',\n templateName: 'vite-react',\n formTemplateId: 'triage-by-yantra',\n },\n];\n\n/**\n * Normalize `pageSettings.settings` into the flat template map keyed by\n * template slug. The loader may hand back the full tree, the codeAssistant\n * subtree, or either wrapped as `{ settings: … }`.\n */\nfunction extractFlatMap(settings: unknown, preferCodeAssistant = false): Record<string, TemplateInfo> {\n if (!settings || typeof settings !== 'object') return {};\n const root = settings as Record<string, unknown>;\n\n const candidates: unknown[] = preferCodeAssistant\n ? [\n (root as { marketplace?: { templates?: { codeAssistant?: unknown } } }).marketplace?.templates\n ?.codeAssistant,\n (root as { templates?: { codeAssistant?: unknown } }).templates?.codeAssistant,\n (root as { codeAssistant?: unknown }).codeAssistant,\n (root as { settings?: unknown }).settings,\n root,\n ]\n : [(root as { settings?: unknown }).settings, root];\n\n const hit = candidates.find(\n (c) => c && typeof c === 'object' && !Array.isArray(c) && Object.keys(c as object).length > 0,\n );\n return (hit as Record<string, TemplateInfo> | undefined) ?? {};\n}\n\nfunction pickMetadata(info: TemplateInfo, templateTarget?: string): WebBuilderTemplateMetadata {\n return {\n // The E2B API key is only for local preview/deploy; buildWorkflowPayloadFromTemplate never forwards it.\n formExtensionE2BAPIKey: str(info.formExtensionE2BAPIKey) || undefined,\n formExtensionE2BClaudeTemplateId: str(info.formExtensionE2BClaudeTemplateId) || undefined,\n formExtensionE2BDomain: str(info.formExtensionE2BDomain) || undefined,\n formExtensionE2BTemplateId: str(info.formExtensionE2BTemplateId) || undefined,\n formExtensionE2BViteReactTemplateId: str(info.formExtensionE2BViteReactTemplateId) || undefined,\n formExtensionE2BVueTemplateId: str(info.formExtensionE2BVueTemplateId) || undefined,\n ...(templateTarget ? { templateTarget } : {}),\n };\n}\n\n/**\n * The marketplace entry that is the workflow model: `projectType: codeassistant`\n * first, github-model next. Never a card pack (see {@link isCardPack}).\n */\nfunction findWorkflowModel(map: Record<string, TemplateInfo>): { key: string; settings: TemplateInfo } | null {\n const ranked: Array<{ key: string; settings: TemplateInfo; rank: number }> = [];\n const eligible = Object.entries(map).filter(\n ([, info]) =>\n info &&\n typeof info === 'object' &&\n !isDisabled(info) &&\n !isCardPack(info) &&\n Boolean(str(info.formId)) &&\n Boolean(str(info.formExtensionId)),\n );\n for (const [key, info] of eligible) {\n const pt = str(info.projectType).toLowerCase();\n const tn = str(info.templateName).toLowerCase();\n const k = key.toLowerCase();\n let rank = 2;\n if (pt === 'codeassistant') rank = 0;\n else if (\n pt === 'github-model' ||\n tn === 'github-model' ||\n k.includes('github-model') ||\n k.includes('aieditor-form-code-extractor')\n ) {\n rank = 1;\n }\n ranked.push({ key, settings: info, rank });\n }\n ranked.sort((a, b) => a.rank - b.rank);\n return ranked[0] ?? null;\n}\n\nfunction resolveWorkflowModel(\n uiMap: Record<string, TemplateInfo>,\n appMap: Record<string, TemplateInfo>,\n): TemplateInfo | null {\n const found = findWorkflowModel(uiMap);\n if (!found) return null;\n const templateName = str(found.settings.templateName) || found.key;\n const appExtras = appMap[found.key] ?? appMap[templateName];\n // App settings first, marketplace form ids last so formId/extensionId always win.\n if (appExtras && typeof appExtras === 'object') {\n return { ...appExtras, ...found.settings };\n }\n return found.settings;\n}\n\n/** Marketplace ids that are routing markers, never an E2B stack. */\nconst NON_STACK_MARKERS = new Set([\n 'github-model',\n 'codeassistant',\n 'multi',\n 'aieditor-code-extractor',\n 'aieditor-form-code-extractor',\n]);\n\n/**\n * One marker -> stack id, or null when it is not a stack signal. `multi` packs\n * list both `vite` and `nextjs` in keywords, so they never pick a stack here.\n */\nfunction matchStackMarker(raw: string): string | null {\n const v = raw.toLowerCase().trim();\n if (!v || NON_STACK_MARKERS.has(v)) return null;\n\n if (\n v === 'nextjs' ||\n v === 'next' ||\n v === 'nextjs-base' ||\n v.includes('nextjs-base') ||\n v.startsWith('nextjs-') ||\n v.startsWith('next-js')\n ) {\n return 'nextjs';\n }\n\n if (v === 'vue' || v.startsWith('vue-') || v.includes('vue-')) return 'vue';\n\n if (\n v === 'vite-react' ||\n v === 'vitereact' ||\n v === 'react-base' ||\n v === 'vite-base' ||\n v === 'remix' ||\n v === 'vite' ||\n v.startsWith('vite') ||\n v.includes('react-base') ||\n v.includes('react-visual-base') ||\n v === 'react'\n ) {\n return 'vite-react';\n }\n\n return null;\n}\n\n/** Marketplace markers -> E2B stack (`vite-react` | `nextjs` | `vue`); vite-react when none match. */\nexport function normalizeStackTemplate(markers: string[]): string {\n for (const m of markers) {\n const hit = matchStackMarker(m);\n if (hit) return hit;\n }\n return DEFAULT_STACK_TEMPLATE;\n}\n\nfunction pushMarker(out: string[], value: unknown): void {\n const v = str(value).toLowerCase();\n if (!v || NON_STACK_MARKERS.has(v)) return;\n out.push(v);\n}\n\nfunction collectKeywordMarkers(source: TemplateInfo): string[] {\n const out: string[] = [];\n for (const listKey of ['keywords', 'tags'] as const) {\n const raw = source[listKey];\n if (Array.isArray(raw)) {\n for (const item of raw) pushMarker(out, item);\n } else if (raw && typeof raw === 'object') {\n for (const item of Object.values(raw as Record<string, unknown>)) pushMarker(out, item);\n } else if (typeof raw === 'string') {\n for (const part of raw.split(',')) pushMarker(out, part);\n }\n }\n return out;\n}\n\n/**\n * E2B stack for one form card: form-owned signals first; a `multi` pack is\n * vite-react (its parent keywords list both vite and nextjs, nextjs must not\n * win); then the pack key / parent fields / parent keywords.\n */\nfunction resolveCardStack(form: TemplateInfo, parent: TemplateInfo, formKey: string, templateKey?: string): string {\n const formOwned: string[] = [formKey];\n for (const key of ['templateName', 'projectType', 'modelTemplate'] as const) {\n pushMarker(formOwned, form[key]);\n }\n formOwned.push(...collectKeywordMarkers(form));\n\n for (const m of formOwned) {\n const hit = matchStackMarker(m);\n if (hit) return hit;\n }\n\n const projectType = (str(form.projectType) || str(parent.projectType)).toLowerCase();\n if (projectType === 'multi') {\n return DEFAULT_STACK_TEMPLATE;\n }\n\n const rest: string[] = [];\n if (templateKey) pushMarker(rest, templateKey);\n for (const key of ['templateName', 'projectType', 'modelTemplate'] as const) {\n pushMarker(rest, parent[key]);\n }\n rest.push(...collectKeywordMarkers(parent));\n return normalizeStackTemplate(rest);\n}\n\n/** The Web Builder always routes through the unified `github-model` build workflow route. */\nconst TEMPLATE_TARGET = 'github-model';\n\nfunction formHasOwnPreviewableUrl(form: TemplateInfo): boolean {\n return Boolean(str(form.previewUrl) || str(form.deployUrl) || str(form.figmaUrl));\n}\n\n/** Marketplace `projectType` values for blank visual-editor base starters. */\nconst BASE_PROJECT_TYPES = new Set(['react-base', 'nextjs-base']);\n\n/** Base starters (react-base / nextjs-base) are listed without a preview URL; remix cards need one. */\nfunction isBaseTemplateForm(form: TemplateInfo, formKey: string, group: TemplateInfo): boolean {\n const formPt = str(form.projectType).toLowerCase();\n if (BASE_PROJECT_TYPES.has(formPt)) return true;\n\n const key = formKey.toLowerCase();\n const title = str(form.title).toLowerCase();\n if (key.includes('nextjs-base') || key.includes('react-visual-base') || key.includes('react-base')) {\n return true;\n }\n if (\n title.includes('visual base') ||\n title.includes('base visual') ||\n /\\b(react|next\\s*js?)\\b.*\\bbase\\b/.test(title) ||\n /\\bbase\\b.*\\b(react|next\\s*js?)\\b/.test(title)\n ) {\n return true;\n }\n\n // A base-tagged parent only lifts forms that look like base starters, so\n // incomplete sibling cards sharing the parent stay hidden.\n const groupPt = str(group.projectType).toLowerCase();\n if (BASE_PROJECT_TYPES.has(groupPt) && (key.includes('base') || title.includes('base'))) {\n return true;\n }\n return false;\n}\n\n/** Thumbnail for a base template with no cover or deploy screenshot. */\nconst BASE_TEMPLATE_DEFAULT_COVER = `data:image/svg+xml,${encodeURIComponent(\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"400\" height=\"225\" viewBox=\"0 0 400 225\">` +\n `<defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">` +\n `<stop offset=\"0%\" stop-color=\"#e2e8f0\"/><stop offset=\"100%\" stop-color=\"#f1f5f9\"/>` +\n `</linearGradient></defs>` +\n `<rect width=\"400\" height=\"225\" fill=\"url(#g)\"/>` +\n `<rect x=\"48\" y=\"48\" width=\"304\" height=\"129\" rx=\"12\" fill=\"#fff\" stroke=\"#cbd5e1\" stroke-width=\"2\"/>` +\n `<rect x=\"72\" y=\"72\" width=\"120\" height=\"10\" rx=\"5\" fill=\"#94a3b8\"/>` +\n `<rect x=\"72\" y=\"96\" width=\"200\" height=\"8\" rx=\"4\" fill=\"#cbd5e1\"/>` +\n `<rect x=\"72\" y=\"116\" width=\"160\" height=\"8\" rx=\"4\" fill=\"#cbd5e1\"/>` +\n `<rect x=\"72\" y=\"144\" width=\"72\" height=\"20\" rx=\"6\" fill=\"#64748b\"/>` +\n `</svg>`,\n)}`;\n\ntype RankedCard = WebBuilderTemplate & { hasOwnTitle?: boolean };\n\nfunction cardRichnessScore(card: RankedCard): number {\n return (card.hasOwnTitle ? 2 : 0) + (card.description ? 1 : 0) + (card.cover ? 1 : 0);\n}\n\nfunction previewUrlDedupeKey(card: WebBuilderTemplate): string {\n const urlKey = `${card.deployUrl ?? ''}|${card.previewUrl ?? ''}|`;\n // Base templates often share empty URLs; keep them distinct by id.\n if (urlKey === '||') return `id:${card.id}`;\n return urlKey;\n}\n\n/**\n * Every previewable `.forms.*` card under the codeAssistant settings, carrying\n * the workflow model's connector ids. Deduped by preview/deploy URL (richest\n * card wins) and sorted by title, as the web picker shows them.\n */\nfunction mapYantraFormCards(\n uiMap: Record<string, TemplateInfo>,\n workflowModel: TemplateInfo | null,\n): WebBuilderTemplate[] {\n const workflowFormId = workflowModel ? str(workflowModel.formId) : '';\n const workflowExtId = workflowModel ? str(workflowModel.formExtensionId) : '';\n const workflowFnId = workflowModel ? str(workflowModel.formFunctionId) : '';\n const workflowDomain = workflowModel ? str(workflowModel.formExtensionE2BDomain) : '';\n const workflowApiKey = workflowModel\n ? str(workflowModel.formExtensionModelConfigAPIKey) || str(workflowModel.apiKey)\n : '';\n\n const raw: RankedCard[] = [];\n // The workflow-model entry itself has no cards to show.\n const groups = Object.entries(uiMap).filter(\n ([, group]) =>\n group &&\n typeof group === 'object' &&\n !isDisabled(group) &&\n str(group.projectType).toLowerCase() !== 'codeassistant' &&\n group.forms &&\n typeof group.forms === 'object',\n );\n\n for (const [templateKey, group] of groups) {\n const forms = Object.entries(group.forms as Record<string, unknown>).filter(\n (entry): entry is [string, TemplateInfo] =>\n Boolean(entry[1]) && typeof entry[1] === 'object' && !isDisabled(entry[1] as TemplateInfo),\n );\n for (const [formKey, form] of forms) {\n const isBaseTemplate = isBaseTemplateForm(form, formKey, group);\n // Remix cards need a preview/deploy URL; base templates do not.\n if (formHasOwnPreviewableUrl(form) || isBaseTemplate) {\n const ownTitle = str(form.title);\n const title = ownTitle || humanizeFormKey(formKey) || 'Untitled';\n const formTemplateId = str(form.formTemplateId);\n const id = formTemplateId || formKey;\n const previewUrl = str(form.previewUrl) || str(group.previewUrl) || undefined;\n const deployUrl = str(form.deployUrl) || str(group.deployUrl) || undefined;\n const cover =\n str(form.coverImageUrl) ||\n str(form.previewImageUrl) ||\n str(group.coverImageUrl) ||\n (isBaseTemplate && !deployUrl ? BASE_TEMPLATE_DEFAULT_COVER : undefined);\n const snapshotId =\n str(form.snapshotId) || str(form.sourceSnapshotId) || str(group.snapshotId) || undefined;\n const usesSupabase = boolTrue(form.usesSupabase) || boolTrue(group.usesSupabase);\n const stack = resolveCardStack(form, group, formKey, templateKey);\n const metadata = pickMetadata(workflowModel || {}, TEMPLATE_TARGET);\n\n raw.push({\n id,\n title,\n description: str(form.description) || 'Yantra starter template',\n cover,\n category: str(form.category) || undefined,\n templateName: stack,\n formTemplateId: formTemplateId || undefined,\n // Only the workflow model runs builds; the pack's own ids name its gallery.\n formExtensionId: workflowExtId || undefined,\n formId: workflowFormId || undefined,\n formFunctionId: workflowFnId || undefined,\n domain: workflowDomain || undefined,\n apiKey: workflowApiKey || undefined,\n metadata,\n chatPrompt: str(form.chatPrompt) || undefined,\n previewUrl,\n deployUrl,\n snapshotId,\n usesSupabase,\n skill: str(form.skill) || str(group.skill) || undefined,\n hasOwnTitle: Boolean(ownTitle),\n });\n }\n }\n }\n\n const bestByUrl = new Map<string, RankedCard>();\n for (const card of raw) {\n const key = previewUrlDedupeKey(card);\n const existing = bestByUrl.get(key);\n if (!existing || cardRichnessScore(card) > cardRichnessScore(existing)) {\n bestByUrl.set(key, card);\n }\n }\n\n return [...bestByUrl.values()]\n .map(({ hasOwnTitle: _h, ...card }) => card)\n .sort((a, b) => a.title.localeCompare(b.title));\n}\n\n/** Template cards from the two settings payloads (web `listCodeAssistantTemplatesViaGraphql`, minus the fetch). */\nexport function templatesFromSettings(uiLayoutSettings: unknown, appSettings: unknown): WebBuilderTemplate[] {\n const uiMap = extractFlatMap(uiLayoutSettings, true);\n const appMap = extractFlatMap(appSettings, false);\n return mapYantraFormCards(uiMap, resolveWorkflowModel(uiMap, appMap));\n}\n\n/**\n * The connector ids a build uses when no card is picked (web\n * `loadCodeAssistantWorkflowDefaults`, minus the fetch): the workflow model.\n * Null when the org has none, which means the build workflow is not set up and\n * the host builds through the agent chat instead. A card pack's own\n * formExtensionId is never a fallback (see {@link isCardPack}).\n */\nexport function workflowDefaultsFromSettings(\n uiLayoutSettings: unknown,\n appSettings: unknown,\n stack: string = DEFAULT_STACK_TEMPLATE,\n): WebBuilderTemplate | null {\n const uiMap = extractFlatMap(uiLayoutSettings, true);\n const appMap = extractFlatMap(appSettings, false);\n const workflowModel = resolveWorkflowModel(uiMap, appMap);\n const formExtensionId = workflowModel ? str(workflowModel.formExtensionId) : '';\n if (!workflowModel || !formExtensionId) return null;\n return {\n id: WORKFLOW_DEFAULTS_ID,\n title: 'Code Assistant',\n templateName: normalizeStackTemplate([stack]),\n formExtensionId,\n formId: str(workflowModel.formId) || undefined,\n formFunctionId: str(workflowModel.formFunctionId) || undefined,\n domain: str(workflowModel.formExtensionE2BDomain) || undefined,\n apiKey: str(workflowModel.formExtensionModelConfigAPIKey) || str(workflowModel.apiKey) || undefined,\n metadata: pickMetadata(workflowModel, TEMPLATE_TARGET),\n };\n}\n\n/**\n * `modelConfig` + `extensionInput` for a template (web\n * `buildWorkflowPayloadFromTemplate`, unchanged). Form ids come from the\n * workflow model, the stack from the card; templateTarget is always\n * `github-model`. The E2B API key and GitHub credentials are never forwarded:\n * the agent's vault owns those.\n */\nexport function buildWorkflowPayloadFromTemplate(\n template: WebBuilderTemplate | undefined,\n extras?: {\n modelId?: string;\n systemId?: string;\n skill?: string;\n skillActionId?: string;\n editProjectId?: string;\n defaultTemplate?: string;\n },\n): {\n modelConfig: Record<string, unknown>;\n extensionInput: Record<string, unknown>;\n templateName: string;\n} {\n const rawName = template?.templateName || extras?.defaultTemplate || DEFAULT_STACK_TEMPLATE;\n const templateName = normalizeStackTemplate([rawName]) || DEFAULT_STACK_TEMPLATE;\n const m = template?.metadata || {};\n const templateTarget = TEMPLATE_TARGET;\n\n const metadata: Record<string, string> = {\n ...(m.formExtensionE2BClaudeTemplateId\n ? { formExtensionE2BClaudeTemplateId: m.formExtensionE2BClaudeTemplateId }\n : {}),\n ...(m.formExtensionE2BDomain ? { formExtensionE2BDomain: m.formExtensionE2BDomain } : {}),\n ...(m.formExtensionE2BTemplateId ? { formExtensionE2BTemplateId: m.formExtensionE2BTemplateId } : {}),\n ...(m.formExtensionE2BViteReactTemplateId\n ? { formExtensionE2BViteReactTemplateId: m.formExtensionE2BViteReactTemplateId }\n : {}),\n ...(m.formExtensionE2BVueTemplateId ? { formExtensionE2BVueTemplateId: m.formExtensionE2BVueTemplateId } : {}),\n templateTarget,\n };\n // The turn's toolbox skill wins over the template/pack skill.\n const skill = extras?.skill || template?.skill;\n if (skill) metadata.skill = skill;\n if (extras?.skillActionId) metadata.skillActionId = extras.skillActionId;\n if (template?.formTemplateId) metadata.formTemplateId = template.formTemplateId;\n\n // `template` is the stack; `templateTarget` is the workflow route and never goes in `template`.\n const modelConfig: Record<string, unknown> = {\n template: templateName,\n templateTarget,\n domain: template?.domain || 'e2b.dev',\n ...(template?.apiKey ? { apiKey: template.apiKey } : {}),\n metadata,\n };\n if (extras?.modelId) {\n modelConfig.model = extras.modelId;\n // `yantra-router/medium` -> provider `yantra-router`.\n const slash = extras.modelId.indexOf('/');\n if (slash > 0) modelConfig.provider = extras.modelId.slice(0, slash);\n }\n if (extras?.systemId) {\n modelConfig.system = extras.systemId;\n modelConfig.designSystem = extras.systemId;\n modelConfig.systemId = extras.systemId;\n }\n if (skill) {\n modelConfig.skill = skill;\n modelConfig.skillId = skill;\n }\n if (extras?.skillActionId) modelConfig.skillActionId = extras.skillActionId;\n if (extras?.editProjectId) modelConfig.editProjectId = extras.editProjectId;\n\n const extensionInput: Record<string, unknown> = {\n ...(template?.formExtensionId ? { extensionId: template.formExtensionId } : {}),\n stepName: 'extractCodeFromExtension',\n formId: template?.formId || 'form-builder-proxy',\n functionId: template?.formFunctionId || 'create-channel-function',\n metadata,\n source: 'final-submission',\n };\n\n return { modelConfig, extensionInput, templateName };\n}\n\n/** A Mongo-style 24-hex id (8 hex seconds + 16 random hex), as the web mints channel/project ids. */\nexport function newObjectId(): string {\n const ts = Math.floor(Date.now() / 1000)\n .toString(16)\n .padStart(8, '0');\n let rand = '';\n for (let i = 0; i < 16; i++) rand += Math.floor(Math.random() * 16).toString(16);\n return ts + rand;\n}\n\nfunction decodeBase64(b64: string): string {\n if (typeof atob === 'function') return atob(b64);\n // jest/node without atob.\n // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require\n const { Buffer } = require('buffer') as { Buffer: { from(s: string, e: string): { toString(e: string): string } } };\n return Buffer.from(b64, 'base64').toString('binary');\n}\n\n/**\n * The token's `tenant` (or `tid`) claim, unverified. The connector runs the\n * trigger against this tenant. Unlike the web this also accepts base64url\n * segments (`-`/`_`, no padding), which the web's bare `atob` would reject.\n */\nexport function tenantIdFromToken(token: string | null | undefined): string | undefined {\n if (!token) return undefined;\n try {\n const seg = (token.split('.')[1] || '').replace(/-/g, '+').replace(/_/g, '/');\n const padded = seg + '='.repeat((4 - (seg.length % 4)) % 4);\n const payload = JSON.parse(decodeBase64(padded)) as { tenant?: string; tid?: string };\n return payload.tenant || payload.tid;\n } catch {\n return undefined;\n }\n}\n\n/** Stack names and the defaults row are not a picked catalog card (web `explicitTemplateId`). */\nconst NON_PICK_TEMPLATE_IDS = new Set([WORKFLOW_DEFAULTS_ID, 'bundled', 'vite-react', 'nextjs', 'vue', '']);\n\nfunction explicitTemplateId(template: { id?: string | null } | null | undefined): string | undefined {\n const id = String(template?.id ?? '').trim();\n if (NON_PICK_TEMPLATE_IDS.has(id)) return undefined;\n return id;\n}\n\nconst LOCAL_HOST_RE = /^https?:\\/\\/(localhost|127\\.0\\.0\\.1)([:/]|$)/i;\n\n/** Preview hosts are `3000-<sandboxId>.<domain>` (e2b's or the platform's); recover the id when only the URL is known. */\nfunction sandboxIdFromUrl(url: string | null | undefined): string | null {\n return url?.match(/^https?:\\/\\/3000-([^.]+)\\./)?.[1] || null;\n}\n\nexport type WebBuilderTurnMode = 'new' | 'remix' | 'edit';\n\nexport interface WebBuilderTriggerOptions {\n channelId: string;\n projectId: string;\n /** The user's prompt, posted as the turn's content. */\n text: string;\n /** The card the user picked; any picked card makes this a fresh remix build. */\n template?: WebBuilderTemplate;\n /** From {@link workflowDefaultsFromSettings}; supplies the connector ids a card lacks. */\n defaults: WebBuilderTemplate | null;\n mode: WebBuilderTurnMode;\n /** The build being edited (mode `edit`). */\n edit?: { sandboxId?: string | null; sandboxUrl?: string | null; title?: string | null };\n /** Stack of the build being edited, when known (web `lastSandbox.templateId`). */\n stackHint?: string;\n modelId?: string;\n /** Look-alike site, already normalized to https by the caller. */\n referenceUrl?: string;\n /** Uploaded files (https URLs, never base64). */\n attachments?: Array<{ name: string; url: string; mimeType?: string }>;\n /** Backend the app reads builds from; forwarded so the connector writes to the same one. */\n graphqlUrl?: string;\n token?: string;\n /** The agent runs on this machine, so a localhost graphqlUrl is reachable from it. */\n agentLocal?: boolean;\n}\n\n/**\n * The `WEBBUILDER_TRIGGER_WORKFLOW` params for one turn, mirroring the web send\n * path: the picked card is merged over the workflow defaults (the card's stack\n * and metadata win, the defaults fill missing connector ids), and the fragment\n * says how the sandbox boots:\n * - picked card with a snapshot -> `remix` from that snapshot;\n * - edit -> `edit`, reconnecting the existing sandbox (no snapshot);\n * - otherwise a blank boot of the stack template.\n *\n * Returns `not-configured` when no form extension id is known: the backend\n * would accept the channel but have nothing to dispatch, and the build would\n * hang until timeout, so the caller fails fast instead.\n *\n * Omitted from the web turn (not wired on native yet): referenceArtifact\n * (`mode: 'reference'` + prompt rewrite), design system / skill / skillActionId,\n * canvas hand edits, project knowledge, integrations, aiInApp, design\n * direction, GitHub sync, database, app secrets, plan, follow-up answers, the\n * VITE_WEBBUILDER_EXTENSION_ID dev fallback, and the 401 re-mint retry.\n */\nexport function buildTriggerParams(\n opts: WebBuilderTriggerOptions,\n): { ok: true; params: Record<string, unknown> } | { ok: false; reason: 'not-configured' } {\n const { channelId, projectId, defaults } = opts;\n // A picked card always means a fresh remix build on the web; it never rides on an edit.\n const pickedTemplate = opts.mode === 'edit' ? undefined : opts.template;\n const isNewFromTemplate = Boolean(pickedTemplate);\n const isEditTurn =\n !isNewFromTemplate && opts.mode === 'edit' && Boolean(opts.edit?.sandboxId || opts.edit?.sandboxUrl);\n\n const stackHint =\n pickedTemplate?.templateName || (isEditTurn ? opts.stackHint : undefined) || DEFAULT_STACK_TEMPLATE;\n\n let templateForPayload: WebBuilderTemplate | undefined;\n if (pickedTemplate) {\n templateForPayload = {\n ...pickedTemplate,\n formExtensionId: pickedTemplate.formExtensionId || defaults?.formExtensionId,\n formId: pickedTemplate.formId || defaults?.formId,\n formFunctionId: pickedTemplate.formFunctionId || defaults?.formFunctionId,\n domain: pickedTemplate.domain || defaults?.domain,\n apiKey: pickedTemplate.apiKey || defaults?.apiKey,\n metadata: { ...(defaults?.metadata || {}), ...(pickedTemplate.metadata || {}) },\n // The card's stack wins; never inherit the workflow model's (often nextjs).\n templateName: pickedTemplate.templateName || stackHint,\n };\n } else if (defaults) {\n templateForPayload = { ...defaults, templateName: stackHint || defaults.templateName };\n }\n\n const resolvedModelId = opts.modelId || DEFAULT_MODEL_ID;\n const { modelConfig, extensionInput, templateName } = buildWorkflowPayloadFromTemplate(templateForPayload, {\n modelId: resolvedModelId,\n defaultTemplate: stackHint,\n });\n if (!extensionInput.extensionId) return { ok: false, reason: 'not-configured' };\n\n const templateSnapshotId = pickedTemplate?.snapshotId?.trim() || '';\n const sandboxId = isEditTurn ? opts.edit?.sandboxId || sandboxIdFromUrl(opts.edit?.sandboxUrl) || null : null;\n // Saved on the turn's post: on the platform's sandbox domain when one is set.\n const sandboxUrl = isEditTurn\n ? withPublicSandboxHosts((opts.edit?.sandboxUrl?.trim() || '').split('?')[0], publicSandboxDomain()) || null\n : null;\n\n const remixFragment: Record<string, unknown> = {};\n if (pickedTemplate?.deployUrl) remixFragment.deployUrl = pickedTemplate.deployUrl;\n if (isNewFromTemplate && templateSnapshotId) {\n remixFragment.remix = true;\n remixFragment.mode = 'remix';\n remixFragment.snapshotId = templateSnapshotId;\n remixFragment.usesSupabase = pickedTemplate?.usesSupabase === true;\n } else if (isEditTurn && (sandboxId || sandboxUrl)) {\n // Server reconnect path: remix + sandboxId, no snapshotId.\n remixFragment.remix = true;\n remixFragment.mode = 'edit';\n if (sandboxId) remixFragment.sandboxId = sandboxId;\n if (sandboxUrl) remixFragment.sandboxUrl = sandboxUrl;\n if (opts.edit?.title) remixFragment.title = opts.edit.title;\n remixFragment.projectId = projectId;\n }\n\n const pickedTemplateId = explicitTemplateId(pickedTemplate);\n const referenceUrl = opts.referenceUrl?.trim();\n const attachments = opts.attachments?.filter((a) => a && a.url) ?? [];\n\n const createChannelInput = {\n channelId,\n title: 'AI Assistant',\n description: 'AI Assistant',\n displayName: 'AI Assistant',\n topic: 'AI Assistant',\n projectId,\n type: 'AIASSISTANT',\n postData: {\n type: 'AIASSISTANT',\n content: opts.text,\n props: {\n template: templateName,\n templateTarget: TEMPLATE_TARGET,\n projectId,\n role: 'USER',\n fragment: remixFragment,\n ...(sandboxId ? { sandboxId } : {}),\n ...(sandboxUrl ? { sandboxUrl } : {}),\n model: resolvedModelId,\n ...(attachments.length ? { attachments } : {}),\n // Only a card the user picked, never the defaults row or a stack name.\n ...(pickedTemplateId ? { templateId: pickedTemplateId } : {}),\n ...(referenceUrl ? { referenceUrl } : {}),\n },\n },\n additionalProperties: { modelConfig },\n };\n\n // Pin the connector to the same backend the app reads builds from. A\n // localhost URL rides along only when the agent is local too: a hosted\n // agent cannot reach a developer's machine.\n const authParams =\n opts.graphqlUrl && (opts.agentLocal || !LOCAL_HOST_RE.test(opts.graphqlUrl))\n ? { graphqlUrl: opts.graphqlUrl, accessToken: opts.token, tenantId: tenantIdFromToken(opts.token) }\n : {};\n\n return { ok: true, params: { createChannelInput, extensionInput, ...authParams } };\n}\n\n/**\n * The agent-only note a template pick sends with the person's words - the web's\n * `templateRemixForChat` (#384): template picks build through the agent chat\n * (webbuilder-design-pro \"Remix a template\"), not `WEBBUILDER_TRIGGER_WORKFLOW`, which\n * stalls when the workflow never posts back to the chat.\n */\nexport function templateRemixNote(template: Pick<WebBuilderTemplate, 'title' | 'snapshotId'>): string {\n const snapshot = template.snapshotId?.trim();\n const boot = snapshot\n ? `Boot it with WEBBUILDER_CREATE_SANDBOX {\"snapshotId\":\"${snapshot}\",\"builder\":\"vite\",\"timeoutMs\":3600000,\"private\":true}.`\n : `Find it with WEBBUILDER_LIST_TEMPLATES and boot it with that card's start.params.`;\n return [\n `[Template] The user picked the Yantra template \"${template.title}\" to start from - remix it (Remix a template).`,\n boot,\n 'They already chose this template: do not ask how to start. Ask only what you still need, then build and give the live preview link.',\n ].join(' ');\n}\n\n/** The skill the web Agent chat runs on (`chat/agentSkill.ts`): the whole website journey. */\nexport const WEBBUILDER_CHAT_SKILL = 'yantra-skills/webbuilder-design-pro';\n"],"names":["Buffer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,kCAAqC,GAAA;AAG3C,MAAM,yBAA4B,GAAA;AAIlC,MAAM,sBAAyB,GAAA;AAE/B,MAAM,gBAAmB,GAAA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