@adminide-stack/yantra-mobile 12.0.142-alpha.0 → 12.0.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/lib/features/attachments/displayUserMessageText.js +2 -2
  2. package/lib/features/attachments/displayUserMessageText.js.map +1 -1
  3. package/lib/features/devices/bodyComposition.js +116 -0
  4. package/lib/features/devices/bodyComposition.js.map +1 -0
  5. package/lib/features/devices/readings.js.map +1 -1
  6. package/lib/features/devices/session.js +22 -2
  7. package/lib/features/devices/session.js.map +1 -1
  8. package/lib/features/notion/NotionAgentPanel.js +987 -0
  9. package/lib/features/notion/NotionAgentPanel.js.map +1 -0
  10. package/lib/features/notion/NotionAskAiSheet.js +362 -0
  11. package/lib/features/notion/NotionAskAiSheet.js.map +1 -0
  12. package/lib/features/notion/NotionBlockView.js +4 -3
  13. package/lib/features/notion/NotionBlockView.js.map +1 -1
  14. package/lib/features/notion/NotionConnectionsSheet.js +47 -13
  15. package/lib/features/notion/NotionConnectionsSheet.js.map +1 -1
  16. package/lib/features/notion/NotionPageView.js +68 -8
  17. package/lib/features/notion/NotionPageView.js.map +1 -1
  18. package/lib/features/notion/NotionSidebarSections.js +1 -1
  19. package/lib/features/notion/NotionSidebarSections.js.map +1 -1
  20. package/lib/features/notion/NotionWorkspaceView.js +14 -9
  21. package/lib/features/notion/NotionWorkspaceView.js.map +1 -1
  22. package/lib/features/notion/database/DatabaseCells.js +3 -1
  23. package/lib/features/notion/database/DatabaseCells.js.map +1 -1
  24. package/lib/features/notion/database/DatabaseDateLayouts.js +1 -1
  25. package/lib/features/notion/database/DatabaseDateLayouts.js.map +1 -1
  26. package/lib/features/notion/database/NotionDatabaseView.js +1 -1
  27. package/lib/features/notion/database/NotionDatabaseView.js.map +1 -1
  28. package/lib/features/notion/notionAgentRunStatus.js +2 -2
  29. package/lib/features/notion/notionAgentRunStatus.js.map +1 -1
  30. package/lib/features/notion/notionAgentRuns.js +57 -0
  31. package/lib/features/notion/notionAgentRuns.js.map +1 -0
  32. package/lib/features/notion/notionAiContext.js +91 -0
  33. package/lib/features/notion/notionAiContext.js.map +1 -0
  34. package/lib/features/notion/notionConnections.js +42 -4
  35. package/lib/features/notion/notionConnections.js.map +1 -1
  36. package/lib/features/notion/notionDocuments.js +61 -1
  37. package/lib/features/notion/notionDocuments.js.map +1 -1
  38. package/lib/features/notion/notionNotesAgent.js +173 -3
  39. package/lib/features/notion/notionNotesAgent.js.map +1 -1
  40. package/lib/features/notion/notionPageKinds.js +1 -1
  41. package/lib/features/webbuilder/WebBuilderExperience.js +229 -97
  42. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  43. package/lib/features/webbuilder/buildFragments.js +33 -7
  44. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  45. package/lib/features/webbuilder/buildJob.js +2 -2
  46. package/lib/features/webbuilder/buildJob.js.map +1 -1
  47. package/lib/features/webbuilder/codeFiles.js +18 -1
  48. package/lib/features/webbuilder/codeFiles.js.map +1 -1
  49. package/lib/features/webbuilder/components/BottomTabs.js.map +1 -1
  50. package/lib/features/webbuilder/components/CodeView.js +134 -56
  51. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  52. package/lib/features/webbuilder/components/Composer.js +2 -2
  53. package/lib/features/webbuilder/components/Composer.js.map +1 -1
  54. package/lib/features/webbuilder/components/PreviewFrame.js +19 -3
  55. package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
  56. package/lib/features/webbuilder/components/PreviewScreen.js +310 -46
  57. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  58. package/lib/features/webbuilder/components/ProjectChat.js +141 -12
  59. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  60. package/lib/features/webbuilder/components/ProjectSheets.js +792 -0
  61. package/lib/features/webbuilder/components/ProjectSheets.js.map +1 -0
  62. package/lib/features/webbuilder/components/ProjectsScreen.js +14 -2
  63. package/lib/features/webbuilder/components/ProjectsScreen.js.map +1 -1
  64. package/lib/features/webbuilder/components/PublishSheet.js +914 -58
  65. package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
  66. package/lib/features/webbuilder/components/TemplateCard.js +9 -6
  67. package/lib/features/webbuilder/components/TemplateCard.js.map +1 -1
  68. package/lib/features/webbuilder/components/TemplatesSheet.js +5 -17
  69. package/lib/features/webbuilder/components/TemplatesSheet.js.map +1 -1
  70. package/lib/features/webbuilder/connectorTemplates.js +171 -0
  71. package/lib/features/webbuilder/connectorTemplates.js.map +1 -0
  72. package/lib/features/webbuilder/fileTree.js +163 -0
  73. package/lib/features/webbuilder/fileTree.js.map +1 -0
  74. package/lib/features/webbuilder/followUps.js +67 -0
  75. package/lib/features/webbuilder/followUps.js.map +1 -0
  76. package/lib/features/webbuilder/previewProbe.js +49 -0
  77. package/lib/features/webbuilder/previewProbe.js.map +1 -0
  78. package/lib/features/webbuilder/previewRoutes.js +156 -0
  79. package/lib/features/webbuilder/previewRoutes.js.map +1 -0
  80. package/lib/features/webbuilder/projectTools.js +341 -0
  81. package/lib/features/webbuilder/projectTools.js.map +1 -0
  82. package/lib/features/webbuilder/publishTools.js +475 -0
  83. package/lib/features/webbuilder/publishTools.js.map +1 -0
  84. package/lib/features/webbuilder/sleepNotice.js +13 -0
  85. package/lib/features/webbuilder/sleepNotice.js.map +1 -0
  86. package/lib/features/webbuilder/stepLabels.js +37 -7
  87. package/lib/features/webbuilder/stepLabels.js.map +1 -1
  88. package/lib/features/webbuilder/studioCatalog.js +5 -1
  89. package/lib/features/webbuilder/studioCatalog.js.map +1 -1
  90. package/lib/features/webbuilder/templateCatalog.js +140 -0
  91. package/lib/features/webbuilder/templateCatalog.js.map +1 -0
  92. package/lib/features/webbuilder/webbuilderPrompts.js +31 -5
  93. package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
  94. package/lib/features/webbuilder/workflow.js +8 -4
  95. package/lib/features/webbuilder/workflow.js.map +1 -1
  96. package/lib/screens/Devices/index.js +205 -3
  97. package/lib/screens/Devices/index.js.map +1 -1
  98. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js +9 -6
  99. package/lib/screens/WebBuilderNative/codeWorkspaceApi.js.map +1 -1
  100. package/lib/screens/WebBuilderNative/index.js +1 -1
  101. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  102. package/lib/screens/WebBuilderNative/keepAlive.js +53 -3
  103. package/lib/screens/WebBuilderNative/keepAlive.js.map +1 -1
  104. package/lib/screens/WebBuilderNative/unreachableRetry.js +23 -0
  105. package/lib/screens/WebBuilderNative/unreachableRetry.js.map +1 -0
  106. package/lib/screens/WebBuilderNative/useConnectorTemplates.js +37 -0
  107. package/lib/screens/WebBuilderNative/useConnectorTemplates.js.map +1 -0
  108. package/lib/screens/WebBuilderNative/useSandboxKeepAlive.js +6 -0
  109. package/lib/screens/WebBuilderNative/useSandboxKeepAlive.js.map +1 -1
  110. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +302 -40
  111. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  112. package/lib/screens/WebBuilderNative/useWebBuilderJobs.js +2 -2
  113. package/lib/screens/WebBuilderNative/useWebBuilderJobs.js.map +1 -1
  114. package/lib/screens/WebBuilderNative/versionUndo.js +1 -1
  115. package/lib/screens/WebBuilderNative/versionUndo.js.map +1 -1
  116. package/lib/screens/WebBuilderNative/webbuilderTransport.js +147 -77
  117. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  118. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"buildFragments.js","sources":["../../../src/features/webbuilder/buildFragments.ts"],"sourcesContent":["/**\n * Reads builds out of a build chat's posts.\n *\n * The build workflow posts its result as a \"fragment\" on an assistant post:\n * sandbox id and preview URL, the source files, and after a publish the live\n * address. Native twin of the web host's `creationsFromMessages`\n * (browser `pages/webbuilder/remoteWebbuilder.ts`) and the surface's\n * `extractFragmentFromSource` lookup order: `propsConfiguration.contents`\n * first (where the real fragment lives; `props` is account-scoped), then the\n * post's own fields. Pure but for the platform's sandbox domain, read from\n * config (publicSandboxDomain), so the host and jest can both use it.\n */\nimport type { WebBuilderBuild, WebBuilderProject } from './types';\nimport { rewritePagesDevLinks, shownLiveUrl, siteAddress } from './siteAddress';\nimport { publicSandboxDomain } from './publicSandboxDomain';\nimport {\n DEFAULT_E2B_SANDBOX_DOMAIN,\n previewDomainFor,\n sandboxPreviewDomainsSource,\n sandboxPreviewLinkRe,\n sandboxPreviewUrlFor,\n withPublicSandboxHosts,\n} from './sandboxPublicHost';\nimport { renderWidgetBlocks } from './widgetBlocks';\nimport { stripAskUser } from '../chat/askUser';\n\ntype Loose = Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n\ninterface Fragment {\n sandboxUrl?: string;\n sandboxId?: string;\n liveUrl?: string;\n files?: Record<string, string> | null;\n title?: string;\n projectId?: string;\n /** Stack the build was made from (`vite-react`, `nextjs`), shown on the tile. */\n template?: string;\n /** Screenshot of the build: an object key or a full URL. */\n coverImageUrl?: string;\n /** CDN origin the cover key was stored under. */\n coverImagePath?: string;\n /** The agent's restore point for this build (design-pro snapshots after each turn). */\n snapshotId?: string;\n /** Read from the agent's words (the agent-chat lane), not a workflow fragment. */\n fromReply?: boolean;\n isCreatingSandbox: boolean;\n isDeploying: boolean;\n}\n\n/** `contents` arrives as an object or, from some resolvers, as JSON text. */\nfunction asObject(value: unknown): Loose | null {\n if (!value) return null;\n if (typeof value === 'object') return Array.isArray(value) ? null : (value as Loose);\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (!trimmed.startsWith('{')) return null;\n try {\n const parsed = JSON.parse(trimmed);\n return parsed && typeof parsed === 'object' ? (parsed as Loose) : null;\n } catch {\n return null;\n }\n }\n return null;\n}\n\nfunction str(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n}\n\n/** `props` is account-scoped (`props[\"<accountId>\"] = {…}`): the records one level down. */\nfunction accountRecords(record: Loose): Loose[] {\n return Object.values(record)\n .map((v) => asObject(v))\n .filter((v): v is Loose => v !== null);\n}\n\n/** First non-empty string among `key` on each record (and on its `fragment`). */\nfunction pick(records: Loose[], key: string): string | undefined {\n for (const record of records) {\n const value = str(record[key]) || str(asObject(record.fragment)?.[key]);\n if (value) return value;\n }\n return undefined;\n}\n\n/** A live sandbox URL (`https://3000-<id>.sb.yantra.app`, `.e2b.dev`, any domain) - never a cover. */\nconst LIVE_SANDBOX = /^https?:\\/\\/\\d+-[a-z0-9]+(\\.|\\/|$)/i;\n\n/**\n * The preview origin for a sandbox. A bare `https://3000-<id>` (no domain) is\n * the E2B default domain, as the surface's `liveSandboxIframeSrc` maps it. An\n * e2b cloud preview is shown on the platform's sandbox domain when one is set\n * (`E2B_SANDBOX_DOMAIN`), and so is a preview named only by its sandbox id.\n */\nexport function sandboxPreviewUrl(url: string | undefined, sandboxId: string | undefined): string | null {\n const domain = publicSandboxDomain();\n const given = str(url);\n if (given) {\n if (/^https?:\\/\\/\\d+-[a-z0-9]+\\/?$/i.test(given)) {\n return `${given.replace(/\\/$/, '')}.${previewDomainFor(DEFAULT_E2B_SANDBOX_DOMAIN, domain)}`;\n }\n return withPublicSandboxHosts(given, domain);\n }\n const id = str(sandboxId);\n return id ? sandboxPreviewUrlFor(id, domain) : null;\n}\n\nfunction httpOrigin(value: string | undefined): string | null {\n const match = /^(https?:\\/\\/[^/?#]+)/i.exec((value ?? '').trim());\n return match && !LIVE_SANDBOX.test(match[1]) ? match[1] : null;\n}\n\n/**\n * The image to show for a cover - the web `resolveCoverDisplayUrl`: an object\n * key joined to the origin it was stored under, else to the app's CDN, else a\n * full https URL as given. A live sandbox URL is never a cover.\n */\nexport function coverDisplayUrl(cover: string | undefined, path?: string, cdnOrigin?: string): string | null {\n const raw = str(cover);\n if (!raw || LIVE_SANDBOX.test(raw)) return null;\n if (/^https?:\\/\\//i.test(raw)) return raw.split('?')[0];\n const key = raw.replace(/^\\/+/, '');\n if (!/\\/uploads\\//i.test(`/${key}`) && !/\\.(png|jpe?g|webp|gif|svg)$/i.test(key)) return null;\n const origin = httpOrigin(path) || httpOrigin(cdnOrigin);\n return origin ? `${origin}/${key}` : null;\n}\n\nexport function readFragment(post: unknown): Fragment | null {\n if (!post || typeof post !== 'object') return null;\n const p = post as Loose;\n const cfg: Loose = p.propsConfiguration || {};\n const contents: Loose = asObject(cfg.contents) || asObject(cfg.content) || {};\n const contentsProps: Loose = asObject(contents.props) || {};\n const props: Loose = asObject(p.props) || {};\n const fragment: Loose | null =\n asObject(contentsProps.fragment) ||\n asObject(contents.fragment) ||\n asObject(cfg.fragment) ||\n asObject(props.fragment) ||\n asObject(p.fragment) ||\n null;\n const f: Loose = fragment || {};\n const sandboxUrl = str(f.sandboxUrl) || str(f.url) || str(p.sandboxUrl) || str(contents.sandboxUrl);\n const sandboxId = str(f.sandboxId) || str(p.sandboxId) || str(contents.sandboxId) || str(cfg.sandboxId);\n const publish = asObject(f.publish);\n // Shown on the custom or company domain, never pages.dev (web `siteAddress`, #446).\n const liveUrl =\n siteAddress({\n customDomainUrl: str(f.customDomainUrl),\n urls: [str(f.cloudflareUrl), str(f.deployUrl), str(publish?.url)],\n projectName: str(publish?.projectName) || str(f.projectName),\n }) || undefined;\n const attachment = asObject(props.attachment) || asObject(contents.attachment) || {};\n const isCreatingSandbox =\n f.isCreatingSandbox === true || contents.isCreatingSandbox === true || p.isCreatingSandbox === true;\n const isDeploying = attachment.isDeploying === true || f.isDeploying === true;\n if (!sandboxUrl && !sandboxId && !liveUrl && !fragment && !isCreatingSandbox && !isDeploying) return null;\n const files = f.files && typeof f.files === 'object' ? (f.files as Record<string, string>) : null;\n // The cover rides on the fragment, the post's props, or an account record of either.\n const coverSources = [f, props, contents, contentsProps, p, ...accountRecords(props), ...accountRecords(contents)];\n const coverImageUrl = [\n pick(coverSources, 'coverImageUrl'),\n pick(coverSources, 'previewImageUrl'),\n str(f.cover),\n ].find((c) => c && !LIVE_SANDBOX.test(c));\n return {\n sandboxUrl,\n sandboxId,\n liveUrl,\n files,\n title: str(f.title),\n projectId: str(f.projectId) || str(contentsProps.projectId),\n template: str(f.templateId) || str(f.template) || str(contentsProps.template) || str(contents.template),\n coverImageUrl,\n coverImagePath: pick(coverSources, 'coverImagePath'),\n isCreatingSandbox,\n isDeploying,\n };\n}\n\n/**\n * Published addresses the agent names (web `chat/agentBuild.ts`); its sandbox previews are\n * `sandboxPreviewLinkRe`: on e2b's domains or the platform's sandbox domain, never another host.\n */\nconst LIVE_URL_RE = /https:\\/\\/([a-z0-9][a-z0-9-]{1,60})\\.(?:pages\\.dev|yarntra\\.com)\\b[^\\s)\\]\"'<>*`]*/gi;\nconst RESTORE_POINT_RE = /restore point \\(snapshot `([^`\\s]{4,200})`\\)/gi;\n\nconst trimUrl = (url: string) => url.replace(/[.,;:!?]+$/, '');\n\n/**\n * The last sandbox preview link in the text (the agent's latest), with its sandbox id.\n * An e2b link comes back on the platform's sandbox domain when one is set.\n */\nexport function previewFrom(text: string): { url: string; sandboxId: string } | null {\n const domain = publicSandboxDomain();\n const all = Array.from(text.matchAll(sandboxPreviewLinkRe(domain)));\n const last = all[all.length - 1];\n return last ? { url: withPublicSandboxHosts(trimUrl(last[0]), domain), sandboxId: last[2] } : null;\n}\n\n/** The published address the agent reports: `<name>.yarntra.com` first, pages.dev only when it is the only one (web #428). */\nexport function liveUrlFrom(text: string): string | null {\n const hits = Array.from(text.matchAll(LIVE_URL_RE)).map((m) => trimUrl(m[0]));\n if (!hits.length) return null;\n const hit = hits.find((h) => h.includes('.yarntra.com')) ?? hits[0];\n return shownLiveUrl(hit) ?? hit;\n}\n\n/** The restore point the skill reports: \"Saved a restore point (snapshot `<id>`).\" (design-pro 3.3, #388). */\nexport function snapshotFrom(text: string): string | null {\n const all = Array.from(text.matchAll(RESTORE_POINT_RE));\n return all.length ? all[all.length - 1][1] : null;\n}\n\n/** \"Your Lotus Flow site is built…\", \"**Lotus Flow** is live\" -> \"Lotus Flow\". */\nexport function siteNameFrom(text: string): string | null {\n const m =\n text.match(\n /\\bYour ([A-Z][\\w&'’ .-]{1,40}?)(?: (?:yoga|coffee|wedding|photography|bakery))? (?:site|website|app) is (?:built|ready|live|running)/,\n ) ??\n text.match(/\\*\\*([A-Z][^*\\n]{1,40})\\*\\* is (?:live|ready|built)/) ??\n text.match(/^([A-Z][\\w&'’ .-]{1,40}?) is live at\\b/m);\n return m ? m[1].trim() : null;\n}\n\n/** A sandbox preview link (e2b's or the platform's domain), without the sentence's closing punctuation. */\nfunction sandboxLinkSource(domain: string): string {\n return String.raw`https:\\/\\/\\d{2,5}-[a-z0-9]{8,40}\\.${sandboxPreviewDomainsSource(domain)}\\b(?:[^\\s)\\]\"'<>*\\x60]*[^\\s)\\]\"'<>*\\x60.,;:!?])?`;\n}\n\n/**\n * The agent's reply as the reader sees it. The restore point's id and the sandbox\n * preview are for the builder, not them (web `assistantBubbleContent`, design-pro\n * 3.11): a sandbox link dies with the sandbox (\"Sandbox not found\"), so the site\n * card's Preview, which can wake it, is the way in. Replies from before 3.11 wrote\n * the link in the prose; it goes too, keeping a markdown link's words.\n */\nexport function displayAgentText(text: string): string {\n const link = sandboxLinkSource(publicSandboxDomain());\n // Widget blocks (logo designs) show as their picture, not JSON (web #469); pages.dev is\n // shown as the site's company address (web #446).\n return (\n // The agent's [ASK_USER] question is a card, not prose (also while it streams).\n rewritePagesDevLinks(renderWidgetBlocks(stripAskUser(text)))\n .replace(/(restore point) \\(snapshot `[^`]+`\\)/gi, '$1')\n .replace(/\\s*\\(preview `[^`]+`\\)/gi, '')\n // cdecli's \"billing policy check unavailable … allowing metered action\" is an operator\n // notice, not the answer (a real refusal says \"billing policy blocks\" and stays).\n .replace(/^[ \\t>]*⚠?\\s*billing policy check unavailable\\b[^\\n]*\\n?/gim, '')\n .replace(new RegExp(String.raw`\\[([^\\]]+)\\]\\(${link}\\)`, 'gi'), '$1')\n .replace(new RegExp(String.raw`:?[ \\t]*<?${link}>?`, 'gi'), '')\n .trim()\n );\n}\n\n/**\n * A build named only in the agent's words: the agent-chat lane (template remix,\n * building from chat) replies with the preview link, the live address once it\n * publishes, and its restore point - no fragment - so those are the build.\n */\nfunction linkFragment(post: unknown): Fragment | null {\n const p = (post ?? {}) as Loose;\n const text = typeof p.message === 'string' ? p.message : '';\n const preview = previewFrom(text);\n const liveUrl = liveUrlFrom(text) ?? undefined;\n const snapshotId = snapshotFrom(text) ?? undefined;\n if (!preview && !liveUrl && !snapshotId) return null;\n return {\n sandboxUrl: preview?.url,\n sandboxId: preview?.sandboxId,\n liveUrl,\n snapshotId,\n title: siteNameFrom(text) ?? undefined,\n fromReply: true,\n isCreatingSandbox: false,\n isDeploying: false,\n };\n}\n\nfunction postTime(post: unknown): number {\n const p = (post ?? {}) as Loose;\n const raw = p.updatedAt || p.createdAt;\n const ms = typeof raw === 'number' ? raw : Date.parse(String(raw ?? ''));\n return Number.isFinite(ms) ? ms : 0;\n}\n\n/** Posts in the order they happened (the query is not sorted). */\nfunction chronological(posts: readonly unknown[]): unknown[] {\n return [...posts].sort((a, b) => postTime(a) - postTime(b));\n}\n\nfunction isUserPost(post: unknown): boolean {\n const p = (post ?? {}) as Loose;\n const contents = asObject(p.propsConfiguration?.contents) || {};\n const props = asObject(p.props) || {};\n const role = String(props.role ?? contents.role ?? asObject(contents.props)?.role ?? '').toUpperCase();\n return role === 'USER';\n}\n\n/** The stack label the web tile shows when a build does not name one. */\nexport const DEFAULT_TEMPLATE = 'vite-react';\n\n/**\n * Newest-first builds of one site. A later post about the same sandbox (a\n * publish, a re-post, its screenshot) updates that build.\n */\nexport function buildsFromPosts(\n posts: readonly unknown[],\n fallbackTitle?: string,\n cdnOrigin?: string,\n): WebBuilderBuild[] {\n const fallback = fallbackTitle ?? 'Web app';\n const byKey = new Map<string, WebBuilderBuild>();\n let lastKey: string | null = null;\n // The web hydrate's rule: a build is an ASSISTANT post with something to show - a\n // preview URL, a live address or a screenshot. A user turn carries the sandbox it\n // edits (and a bare sandbox id is a turn in flight), neither is a build.\n const fragments = chronological(posts)\n .filter((post) => !isUserPost(post))\n .map((post) => ({ post, fragment: readFragment(post) ?? linkFragment(post) }))\n .filter(\n (row): row is { post: unknown; fragment: Fragment } =>\n row.fragment !== null &&\n Boolean(\n row.fragment.sandboxUrl ||\n row.fragment.liveUrl ||\n row.fragment.coverImageUrl ||\n row.fragment.snapshotId,\n ),\n );\n for (const { post, fragment } of fragments) {\n const previewUrl = sandboxPreviewUrl(fragment.sandboxUrl, fragment.sandboxId);\n const key = fragment.sandboxId || previewUrl || '';\n // A publish or screenshot post may name no sandbox: it belongs to the latest build.\n const target: string | null =\n key || (fragment.liveUrl || fragment.coverImageUrl || fragment.snapshotId ? lastKey : null);\n if (target) {\n const existing = byKey.get(target);\n byKey.set(target, {\n key: target,\n // A workflow fragment names the build; a reply's site name only names a build with none yet.\n title:\n (fragment.fromReply ? existing?.title || fragment.title : fragment.title || existing?.title) ||\n fallback,\n previewUrl: previewUrl || existing?.previewUrl || null,\n sandboxId: fragment.sandboxId || existing?.sandboxId || null,\n projectId: fragment.projectId || existing?.projectId || null,\n liveUrl: fragment.liveUrl || existing?.liveUrl || null,\n files: fragment.files || existing?.files || null,\n snapshotId: fragment.snapshotId || existing?.snapshotId || null,\n origin: existing?.origin === 'workflow' || !fragment.fromReply ? 'workflow' : 'agent',\n templateId: fragment.template || existing?.templateId || DEFAULT_TEMPLATE,\n coverUrl:\n coverDisplayUrl(fragment.coverImageUrl, fragment.coverImagePath, cdnOrigin) ||\n existing?.coverUrl ||\n null,\n updatedAt: Math.max(postTime(post), existing?.updatedAt ?? 0),\n });\n lastKey = target;\n }\n }\n return [...byKey.values()].filter((b) => b.previewUrl || b.liveUrl).sort((a, b) => b.updatedAt - a.updatedAt);\n}\n\n/** The newest post flags a sandbox still being created or a publish still running. */\nexport function pendingWork(posts: readonly unknown[]): 'creating' | 'publishing' | null {\n const newest = chronological(posts)\n .map((post) => readFragment(post))\n .filter((f): f is Fragment => f !== null)\n .pop();\n if (!newest) return null;\n if (newest.isCreatingSandbox && !newest.sandboxUrl && !newest.sandboxId) return 'creating';\n if (newest.isDeploying && !newest.liveUrl) return 'publishing';\n return null;\n}\n\n// ── Titles: the web surface's `resolveArtifactTitle` rules ─────────────────\n\n/** Not a product name: what the workflow and the chat call a site before it has one. */\nexport function isGenericTitle(title?: string | null): boolean {\n const t = (title || '').trim().toLowerCase();\n return (\n !t ||\n t === 'generated page' ||\n t === 'generated project' ||\n t === 'generated with cdecli' ||\n t === 'ai assistant' ||\n t === 'web app' ||\n /^build \\d+$/.test(t) ||\n /^build\\s+me\\b/.test(t) ||\n /^remix\\s+the\\b/.test(t) ||\n /^(build|chat)[- ]channel\\b/.test(t) ||\n t.startsWith('selected skill') ||\n /^code[\\s_-]?assist/.test(t)\n );\n}\n\nconst TITLE_STOP_WORDS = new Set([\n 'a',\n 'an',\n 'the',\n 'create',\n 'build',\n 'make',\n 'please',\n 'me',\n 'my',\n 'for',\n 'with',\n 'simple',\n 'using',\n 'from',\n 'template',\n 'to',\n 'and',\n 'or',\n 'remix',\n 'yantra',\n]);\n\nfunction titleCase(words: string[]): string {\n return words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(' ');\n}\n\n/** The person's words, without the internal lines a turn carries. */\nexport function cleanPrompt(text: string): string {\n return text\n .replace(/^\\[webbuilder context:[^\\]]*\\]\\s*/i, '')\n .replace(/^build\\s*me\\s*:\\s*/i, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n/**\n * Product name from a brief: \"Build me: todo app\" -> \"Todo App\". An edit\n * (\"make the header blue\") is not a name.\n */\nexport function titleFromPrompt(message?: string | null): string | null {\n const raw = (message || '').replace(/^\\[webbuilder context:[^\\]]*\\]\\s*/i, '').trim();\n if (!raw) return null;\n const buildMe = raw.match(/^\\s*Build me:\\s*(.+)$/im)?.[1]?.trim();\n if (!buildMe && /^(change|update|rename|fix|edit|add|remove|delete|improve|make|refactor)\\b/i.test(raw)) {\n return null;\n }\n const source = (buildMe || raw.split(/\\n+/)[0] || '').replace(/^[\"']|[\"']$/g, '');\n const words = source\n .replace(/[^\\w\\s-]/g, ' ')\n .split(/\\s+/)\n .filter((w) => w.length > 1 && !TITLE_STOP_WORDS.has(w.toLowerCase()))\n .slice(0, 3);\n if (!words.length) return null;\n const title = titleCase(words);\n return isGenericTitle(title) ? null : title;\n}\n\n/** `package.json` name of the build (\"bakery-site\" -> \"Bakery Site\"). */\nfunction titleFromPackageJson(files?: Record<string, string> | null): string | null {\n if (!files) return null;\n const raw = Object.entries(files).find(([path]) => /(^|\\/)package\\.json$/.test(path))?.[1];\n if (!raw) return null;\n try {\n const name = String((JSON.parse(raw) as { name?: string }).name || '').trim();\n if (!name || name === 'vite-react' || name === 'project') return null;\n return name\n .replace(/^@[^/]+\\//, '')\n .replace(/[-_]+/g, ' ')\n .replace(/\\b\\w/g, (c) => c.toUpperCase());\n } catch {\n return null;\n }\n}\n\n/** The build's own title, then the brief's product name, the chat's name, the package name. */\nexport function resolveSiteTitle(opts: {\n fragmentTitle?: string | null;\n channelTitle?: string | null;\n userPrompt?: string | null;\n files?: Record<string, string> | null;\n}): string {\n const candidates = [\n opts.fragmentTitle,\n titleFromPrompt(opts.userPrompt),\n opts.channelTitle,\n titleFromPackageJson(opts.files),\n ];\n const found = candidates.find((c) => c && !isGenericTitle(c));\n return (found || 'Generated Page').trim();\n}\n\n// ── Sites ──────────────────────────────────────────────────────────────────\n\nexport interface ChannelLike {\n id?: string | null;\n title?: string | null;\n displayName?: string | null;\n updatedAt?: unknown;\n createdAt?: unknown;\n lastMessage?: unknown;\n}\n\n/** True when the newest build in `lastMessage` already carries a cover - the web skips the thread read then. */\nexport function lastMessageHasCover(channel: ChannelLike): boolean {\n return Boolean(readFragment(channel.lastMessage)?.coverImageUrl);\n}\n\n/**\n * A site from one chat's posts, the way the web gallery hydrates a tile: only\n * a chat with a build is a site; its name follows `resolveSiteTitle`.\n */\nexport function projectFromPosts(\n channel: ChannelLike,\n posts: readonly unknown[],\n cdnOrigin?: string,\n): WebBuilderProject | null {\n const channelId = str(channel.id);\n if (!channelId) return null;\n const builds = buildsFromPosts(posts, '', cdnOrigin);\n const latest = builds[0];\n if (!latest) return null;\n const userPrompts = chronological(posts)\n .filter((post) => isUserPost(post) && str((post as Loose).message))\n .map((post) => String((post as Loose).message));\n // The brief names the product (\"Build me: …\"); a later message (\"the live preview is\n // not loading\") never does, so only the brief - or failing that the first ask - counts.\n const brief = userPrompts.find((m) => /build\\s*me\\s*:/i.test(m)) ?? userPrompts[0];\n const rawChannelTitle = [channel.displayName, channel.title]\n .map((t) => str(t))\n .find((t) => t && !isGenericTitle(t));\n // A chat named after its brief (\"Build simple calculator app\") gives the product name, not the sentence.\n const channelTitle =\n rawChannelTitle && /^(build|create|make)\\b/i.test(rawChannelTitle)\n ? (titleFromPrompt(rawChannelTitle) ?? rawChannelTitle)\n : rawChannelTitle;\n const title = resolveSiteTitle({\n fragmentTitle: latest.title,\n channelTitle,\n userPrompt: brief,\n files: latest.files,\n });\n const updated = Date.parse(String(channel.updatedAt ?? channel.createdAt ?? ''));\n return {\n channelId,\n title,\n updatedAt: Math.max(Number.isFinite(updated) ? updated : 0, latest.updatedAt),\n previewUrl: latest.previewUrl,\n liveUrl: builds.find((b) => b.liveUrl)?.liveUrl ?? null,\n coverUrl: builds.find((b) => b.coverUrl)?.coverUrl ?? null,\n templateId: latest.templateId,\n };\n}\n\n/** `?wb=<n>` on the preview so a rebuilt sandbox is fetched again, not served from cache. */\nexport function cacheBustedUrl(url: string, nonce: number | string): string {\n const [base, hash = ''] = url.split('#');\n const clean = base.replace(/([?&])wb=[^&]*(&|$)/, '$1').replace(/[?&]$/, '');\n const sep = clean.includes('?') ? '&' : '?';\n return `${clean}${sep}wb=${nonce}${hash ? `#${hash}` : ''}`;\n}\n\n/**\n * The publish name the web dialog suggests: the site's title as a slug,\n * `[a-z0-9-]`, at most 58 characters (`<name>.yarntra.com`).\n */\nexport function publishSlug(title: string): string {\n const slug = title\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 58)\n .replace(/-+$/, '');\n return slug || 'my-site';\n}\n\nexport function isValidPublishSlug(value: string): boolean {\n return /^[a-z0-9](?:[a-z0-9-]{0,56}[a-z0-9])?$/.test(value);\n}\n\n/** Display host of a URL: `https://bakery.pages.dev/` -> `bakery.pages.dev`. */\nexport function displayHost(url: string | null | undefined): string {\n const match = /^https?:\\/\\/([^/?#]+)/i.exec((url ?? '').trim());\n return match ? match[1] : (url ?? '').trim();\n}\n\n/** \"just now\", \"5 min ago\", \"3 h ago\", \"Yesterday\", \"12 Oct\". */\nexport function relativeTime(ms: number, now = Date.now()): string {\n if (!ms) return '';\n const diff = Math.max(0, now - ms);\n const min = Math.floor(diff / 60_000);\n if (min < 1) return 'just now';\n if (min < 60) return `${min} min ago`;\n const hours = Math.floor(min / 60);\n if (hours < 24) return `${hours} h ago`;\n if (hours < 48) return 'Yesterday';\n const d = new Date(ms);\n const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n return `${d.getDate()} ${months[d.getMonth()]}`;\n}\n\n// ── The agent transcript: the build chat's posts, as the web Agent pane shows them ──\n\n/** A live progress row (web `isThinkingPost`): shown as the agent's status, never kept. */\nexport function isThinkingPost(post: unknown): boolean {\n const p = (post ?? {}) as Loose;\n const props = asObject(p.props) || {};\n const attachment = asObject(props.attachment) || {};\n const msg = String(p.message ?? '')\n .trim()\n .toLowerCase();\n return (\n String(p.type ?? '').toUpperCase() === 'THINKING' ||\n Boolean(props.thinking ?? props.isThinking) ||\n props.kind === 'thinking' ||\n Boolean(attachment.isThinking) ||\n msg === 'thinking...' ||\n msg === 'initializing...' ||\n msg === 'initializing…'\n );\n}\n\nfunction readFragmentStatus(p: Loose): string | undefined {\n const contents = asObject(p.propsConfiguration?.contents) || {};\n return (\n str(asObject(asObject(contents.props)?.fragment)?.statusText) || str(asObject(contents.fragment)?.statusText)\n );\n}\n\n/** The workflow's progress line on a post: its thought, else the fragment's status. */\nexport function progressText(post: unknown): string | null {\n const p = (post ?? {}) as Loose;\n const props = asObject(p.props) || {};\n const thought = str(asObject(props.attachment)?.thought);\n if (thought) return thought;\n const status = str(asObject(props.fragment)?.statusText) || str(readFragmentStatus(p));\n if (status) return status;\n return isThinkingPost(post) ? (str(p.message) ?? null) : null;\n}\n\n/** A post the workflow wrote when the build failed (`fragment.isError` / `type: 'error'`). */\nexport function isErrorPost(post: unknown): boolean {\n const p = (post ?? {}) as Loose;\n const props = asObject(p.props) || {};\n const contents = asObject(p.propsConfiguration?.contents) || {};\n const f =\n asObject(props.fragment) || asObject(asObject(contents.props)?.fragment) || asObject(contents.fragment) || {};\n return f.isError === true || f.type === 'error';\n}\n\nexport interface TranscriptMessage {\n id: string;\n role: 'user' | 'assistant';\n content: string;\n createdAt: number;\n}\n\n/**\n * The conversation in a build chat: the person's turns and the agent's replies,\n * oldest first, without progress rows or empty build markers.\n */\nexport function transcriptFromPosts(posts: readonly unknown[]): TranscriptMessage[] {\n const out: TranscriptMessage[] = [];\n for (const post of chronological(posts)) {\n const p = post as Loose;\n const text = str(p.message);\n if (text && !isThinkingPost(post)) {\n const user = isUserPost(post);\n out.push({\n id: String(p.id ?? `${user ? 'u' : 'a'}-${out.length}`),\n role: user ? 'user' : 'assistant',\n content: user ? cleanPrompt(text) || text : text,\n createdAt: postTime(post),\n });\n }\n }\n return out;\n}\n\n/**\n * How a turn started at `since` is going, read from the posts that arrived after it.\n * `heard` is whether the build posted anything back yet (a progress row, an answer).\n */\nexport function turnState(\n posts: readonly unknown[],\n since: number,\n): { status: 'running' | 'done' | 'failed'; progress: string | null; error: string | null; heard: boolean } {\n // A clock skew allowance, as the web ignores posts older than start - 2 s.\n const after = chronological(posts).filter((post) => postTime(post) >= since - 2_000);\n let progress: string | null = null;\n for (const post of after) {\n if (!isUserPost(post)) {\n if (isErrorPost(post)) {\n const p = post as Loose;\n return { status: 'failed', progress: null, error: str(p.message) ?? 'The build failed.', heard: true };\n }\n const fragment = readFragment(post);\n if (fragment && (fragment.sandboxUrl || fragment.liveUrl) && !isThinkingPost(post)) {\n return { status: 'done', progress: null, error: null, heard: true };\n }\n progress = progressText(post) ?? progress;\n }\n }\n // A plain answer (the agent asked a question, or replied without building) ends\n // the turn too - unless progress rows keep arriving after it.\n const newest = after.filter((post) => !isUserPost(post)).pop() as Loose | undefined;\n if (newest && !isThinkingPost(newest) && !progressText(newest) && str(newest.message)) {\n return { status: 'done', progress: null, error: null, heard: true };\n }\n return { status: 'running', progress, error: null, heard: Boolean(newest) };\n}\n\n/**\n * A turn sent through the build workflow: its USER post carries the workflow's\n * route (`templateTarget`). A blank build sends an empty fragment, which\n * the server drops, so this post is the only workflow mark until a build lands.\n */\nfunction isWorkflowTurnPost(post: unknown): boolean {\n if (!post || typeof post !== 'object') return false;\n const p = post as Loose;\n const contents = asObject(p.propsConfiguration?.contents) || {};\n return Boolean(str(asObject(p.props)?.templateTarget) || str(asObject(contents.props)?.templateTarget));\n}\n\n/**\n * The chat was built through the build workflow (its posts carry fragments or\n * the workflow's route): edits go back through the workflow. A chat without\n * any is an agent-chat site (a template remix), and its turns stay in the\n * agent chat.\n */\nexport function hasWorkflowPosts(posts: readonly unknown[]): boolean {\n return posts.some((post) => readFragment(post) !== null || isWorkflowTurnPost(post));\n}\n\n/** The person's words, without the agent-only template note a remix turn carries. */\nexport function stripAgentNote(content: string): string {\n return content.replace(/\\n*\\[(?:Template|Open build|Export|Hand edits)\\][\\s\\S]*$/, '').trim();\n}\n"],"names":["_a"],"mappings":"uZA0CA,SAAS,SAAS,KAA8B,EAAA;AAC9C,EAAI,IAAA,CAAC,OAAc,OAAA,IAAA;AACnB,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA,OAAO,MAAM,OAAQ,CAAA,KAAK,IAAI,IAAO,GAAA,KAAA;AACpE,EAAI,IAAA,OA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,EAAA;AACnE,EAAO,OAAA,KAAA,CAAM,KAAK,CAAQ,IAAA,KAAA,YAAA,CAAa,IAAI,CAAM,KAAA,IAAA,IAAQ,kBAAmB,CAAA,IAAI,CAAC,CAAA;AACnF;AAGO,SAAS,eAAe,OAAyB,EAAA;AACtD,EAAA,OAAO,OAAQ,CAAA,OAAA,CAAQ,0DAA4D,EAAA,EAAE,EAAE,IAAK,EAAA;AAC9F"}
1
+ {"version":3,"file":"buildFragments.js","sources":["../../../src/features/webbuilder/buildFragments.ts"],"sourcesContent":["/**\n * Reads builds out of a build chat's posts.\n *\n * The build workflow posts its result as a \"fragment\" on an assistant post:\n * sandbox id and preview URL, the source files, and after a publish the live\n * address. Native twin of the web host's `creationsFromMessages`\n * (browser `pages/webbuilder/remoteWebbuilder.ts`) and the surface's\n * `extractFragmentFromSource` lookup order: `propsConfiguration.contents`\n * first (where the real fragment lives; `props` is account-scoped), then the\n * post's own fields. Pure but for the platform's sandbox domain, read from\n * config (publicSandboxDomain), so the host and jest can both use it.\n */\nimport type { WebBuilderBuild, WebBuilderProject } from './types';\nimport { rewritePagesDevLinks, shownLiveUrl, siteAddress } from './siteAddress';\nimport { publicSandboxDomain } from './publicSandboxDomain';\nimport {\n DEFAULT_E2B_SANDBOX_DOMAIN,\n previewDomainFor,\n sandboxPreviewDomainsSource,\n sandboxPreviewLinkRe,\n sandboxPreviewUrlFor,\n withPublicSandboxHosts,\n} from './sandboxPublicHost';\nimport { renderWidgetBlocks } from './widgetBlocks';\nimport { stripAskUser } from '../chat/askUser';\n\ntype Loose = Record<string, any>; // eslint-disable-line @typescript-eslint/no-explicit-any\n\ninterface Fragment {\n sandboxUrl?: string;\n sandboxId?: string;\n liveUrl?: string;\n files?: Record<string, string> | null;\n title?: string;\n projectId?: string;\n /** Stack the build was made from (`vite-react`, `nextjs`), shown on the tile. */\n template?: string;\n /** Screenshot of the build: an object key or a full URL. */\n coverImageUrl?: string;\n /** CDN origin the cover key was stored under. */\n coverImagePath?: string;\n /** The agent's restore point for this build (design-pro snapshots after each turn). */\n snapshotId?: string;\n /** Read from the agent's words (the agent-chat lane), not a workflow fragment. */\n fromReply?: boolean;\n isCreatingSandbox: boolean;\n isDeploying: boolean;\n}\n\n/** `contents` arrives as an object or, from some resolvers, as JSON text. */\nfunction asObject(value: unknown): Loose | null {\n if (!value) return null;\n if (typeof value === 'object') return Array.isArray(value) ? null : (value as Loose);\n if (typeof value === 'string') {\n const trimmed = value.trim();\n if (!trimmed.startsWith('{')) return null;\n try {\n const parsed = JSON.parse(trimmed);\n return parsed && typeof parsed === 'object' ? (parsed as Loose) : null;\n } catch {\n return null;\n }\n }\n return null;\n}\n\nfunction str(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n}\n\n/** `props` is account-scoped (`props[\"<accountId>\"] = {…}`): the records one level down. */\nfunction accountRecords(record: Loose): Loose[] {\n return Object.values(record)\n .map((v) => asObject(v))\n .filter((v): v is Loose => v !== null);\n}\n\n/** First non-empty string among `key` on each record (and on its `fragment`). */\nfunction pick(records: Loose[], key: string): string | undefined {\n for (const record of records) {\n const value = str(record[key]) || str(asObject(record.fragment)?.[key]);\n if (value) return value;\n }\n return undefined;\n}\n\n/** A live sandbox URL (`https://3000-<id>.sb.yantra.app`, `.e2b.dev`, any domain) - never a cover. */\nconst LIVE_SANDBOX = /^https?:\\/\\/\\d+-[a-z0-9]+(\\.|\\/|$)/i;\n\n/**\n * The preview origin for a sandbox. A bare `https://3000-<id>` (no domain) is\n * the E2B default domain, as the surface's `liveSandboxIframeSrc` maps it. An\n * e2b cloud preview is shown on the platform's sandbox domain when one is set\n * (`E2B_SANDBOX_DOMAIN`), and so is a preview named only by its sandbox id.\n */\nexport function sandboxPreviewUrl(url: string | undefined, sandboxId: string | undefined): string | null {\n const domain = publicSandboxDomain();\n const given = str(url);\n if (given) {\n if (/^https?:\\/\\/\\d+-[a-z0-9]+\\/?$/i.test(given)) {\n return `${given.replace(/\\/$/, '')}.${previewDomainFor(DEFAULT_E2B_SANDBOX_DOMAIN, domain)}`;\n }\n return withPublicSandboxHosts(given, domain);\n }\n const id = str(sandboxId);\n return id ? sandboxPreviewUrlFor(id, domain) : null;\n}\n\nfunction httpOrigin(value: string | undefined): string | null {\n const match = /^(https?:\\/\\/[^/?#]+)/i.exec((value ?? '').trim());\n return match && !LIVE_SANDBOX.test(match[1]) ? match[1] : null;\n}\n\n/**\n * The image to show for a cover - the web `resolveCoverDisplayUrl`: an object\n * key joined to the origin it was stored under, else to the app's CDN, else a\n * full https URL as given. A live sandbox URL is never a cover.\n */\nexport function coverDisplayUrl(cover: string | undefined, path?: string, cdnOrigin?: string): string | null {\n const raw = str(cover);\n if (!raw || LIVE_SANDBOX.test(raw)) return null;\n if (/^https?:\\/\\//i.test(raw)) return raw.split('?')[0];\n const key = raw.replace(/^\\/+/, '');\n if (!/\\/uploads\\//i.test(`/${key}`) && !/\\.(png|jpe?g|webp|gif|svg)$/i.test(key)) return null;\n const origin = httpOrigin(path) || httpOrigin(cdnOrigin);\n return origin ? `${origin}/${key}` : null;\n}\n\nexport function readFragment(post: unknown): Fragment | null {\n if (!post || typeof post !== 'object') return null;\n const p = post as Loose;\n const cfg: Loose = p.propsConfiguration || {};\n const contents: Loose = asObject(cfg.contents) || asObject(cfg.content) || {};\n const contentsProps: Loose = asObject(contents.props) || {};\n const props: Loose = asObject(p.props) || {};\n const fragment: Loose | null =\n asObject(contentsProps.fragment) ||\n asObject(contents.fragment) ||\n asObject(cfg.fragment) ||\n asObject(props.fragment) ||\n asObject(p.fragment) ||\n null;\n const f: Loose = fragment || {};\n const sandboxUrl = str(f.sandboxUrl) || str(f.url) || str(p.sandboxUrl) || str(contents.sandboxUrl);\n const sandboxId = str(f.sandboxId) || str(p.sandboxId) || str(contents.sandboxId) || str(cfg.sandboxId);\n const publish = asObject(f.publish);\n // Shown on the custom or company domain, never pages.dev (web `siteAddress`, #446).\n const liveUrl =\n siteAddress({\n customDomainUrl: str(f.customDomainUrl),\n urls: [str(f.cloudflareUrl), str(f.deployUrl), str(publish?.url)],\n projectName: str(publish?.projectName) || str(f.projectName),\n }) || undefined;\n const attachment = asObject(props.attachment) || asObject(contents.attachment) || {};\n const isCreatingSandbox =\n f.isCreatingSandbox === true || contents.isCreatingSandbox === true || p.isCreatingSandbox === true;\n const isDeploying = attachment.isDeploying === true || f.isDeploying === true;\n if (!sandboxUrl && !sandboxId && !liveUrl && !fragment && !isCreatingSandbox && !isDeploying) return null;\n const files = f.files && typeof f.files === 'object' ? (f.files as Record<string, string>) : null;\n // The cover rides on the fragment, the post's props, or an account record of either.\n const coverSources = [f, props, contents, contentsProps, p, ...accountRecords(props), ...accountRecords(contents)];\n const coverImageUrl = [\n pick(coverSources, 'coverImageUrl'),\n pick(coverSources, 'previewImageUrl'),\n str(f.cover),\n ].find((c) => c && !LIVE_SANDBOX.test(c));\n return {\n sandboxUrl,\n sandboxId,\n liveUrl,\n files,\n title: str(f.title),\n projectId: str(f.projectId) || str(contentsProps.projectId),\n template: str(f.templateId) || str(f.template) || str(contentsProps.template) || str(contents.template),\n coverImageUrl,\n coverImagePath: pick(coverSources, 'coverImagePath'),\n isCreatingSandbox,\n isDeploying,\n };\n}\n\n/**\n * Published addresses the agent names (web `chat/agentBuild.ts`); its sandbox previews are\n * `sandboxPreviewLinkRe`: on e2b's domains or the platform's sandbox domain, never another host.\n */\nconst LIVE_URL_RE = /https:\\/\\/([a-z0-9][a-z0-9-]{1,60})\\.(?:pages\\.dev|yarntra\\.com)\\b[^\\s)\\]\"'<>*`]*/gi;\nconst RESTORE_POINT_RE = /restore point \\(snapshot `([^`\\s]{4,200})`\\)/gi;\n\nconst trimUrl = (url: string) => url.replace(/[.,;:!?]+$/, '');\n\n/**\n * The last sandbox preview link in the text (the agent's latest), with its sandbox id.\n * An e2b link comes back on the platform's sandbox domain when one is set.\n */\nexport function previewFrom(text: string): { url: string; sandboxId: string } | null {\n const domain = publicSandboxDomain();\n const all = Array.from(text.matchAll(sandboxPreviewLinkRe(domain)));\n const last = all[all.length - 1];\n return last ? { url: withPublicSandboxHosts(trimUrl(last[0]), domain), sandboxId: last[2] } : null;\n}\n\n/** The published address the agent reports: `<name>.yarntra.com` first, pages.dev only when it is the only one (web #428). */\nexport function liveUrlFrom(text: string): string | null {\n const hits = Array.from(text.matchAll(LIVE_URL_RE)).map((m) => trimUrl(m[0]));\n if (!hits.length) return null;\n const hit = hits.find((h) => h.includes('.yarntra.com')) ?? hits[0];\n return shownLiveUrl(hit) ?? hit;\n}\n\n/** The restore point the skill reports: \"Saved a restore point (snapshot `<id>`).\" (design-pro 3.3, #388). */\nexport function snapshotFrom(text: string): string | null {\n const all = Array.from(text.matchAll(RESTORE_POINT_RE));\n return all.length ? all[all.length - 1][1] : null;\n}\n\n/** \"Your Lotus Flow site is built…\", \"**Lotus Flow** is live\" -> \"Lotus Flow\". */\nexport function siteNameFrom(text: string): string | null {\n const m =\n text.match(\n /\\bYour ([A-Z][\\w&'’ .-]{1,40}?)(?: (?:yoga|coffee|wedding|photography|bakery))? (?:site|website|app) is (?:built|ready|live|running)/,\n ) ??\n text.match(/\\*\\*([A-Z][^*\\n]{1,40})\\*\\* is (?:live|ready|built)/) ??\n text.match(/^([A-Z][\\w&'’ .-]{1,40}?) is live at\\b/m);\n return m ? m[1].trim() : null;\n}\n\n/** A sandbox preview link (e2b's or the platform's domain), without the sentence's closing punctuation. */\nfunction sandboxLinkSource(domain: string): string {\n return String.raw`https:\\/\\/\\d{2,5}-[a-z0-9]{8,40}\\.${sandboxPreviewDomainsSource(domain)}\\b(?:[^\\s)\\]\"'<>*\\x60]*[^\\s)\\]\"'<>*\\x60.,;:!?])?`;\n}\n\n/**\n * The agent's reply as the reader sees it. The restore point's id and the sandbox\n * preview are for the builder, not them (web `assistantBubbleContent`, design-pro\n * 3.11): a sandbox link dies with the sandbox (\"Sandbox not found\"), so the site\n * card's Preview, which can wake it, is the way in. Replies from before 3.11 wrote\n * the link in the prose; it goes too, keeping a markdown link's words.\n */\nexport function displayAgentText(text: string): string {\n const link = sandboxLinkSource(publicSandboxDomain());\n // Widget blocks (logo designs) show as their picture, not JSON (web #469); pages.dev is\n // shown as the site's company address (web #446).\n return (\n // The agent's [ASK_USER] question is a card, not prose (also while it streams).\n rewritePagesDevLinks(renderWidgetBlocks(stripAskUser(text)))\n .replace(/(restore point) \\(snapshot `[^`]+`\\)/gi, '$1')\n .replace(/\\s*\\(preview `[^`]+`\\)/gi, '')\n // cdecli's \"billing policy check unavailable … allowing metered action\" is an operator\n // notice, not the answer (a real refusal says \"billing policy blocks\" and stays).\n .replace(/^[ \\t>]*⚠?\\s*billing policy check unavailable\\b[^\\n]*\\n?/gim, '')\n .replace(new RegExp(String.raw`\\[([^\\]]+)\\]\\(${link}\\)`, 'gi'), '$1')\n .replace(new RegExp(String.raw`:?[ \\t]*<?${link}>?`, 'gi'), '')\n .trim()\n );\n}\n\n/**\n * A build named only in the agent's words: the agent-chat lane (template remix,\n * building from chat) replies with the preview link, the live address once it\n * publishes, and its restore point - no fragment - so those are the build.\n */\nfunction linkFragment(post: unknown): Fragment | null {\n const p = (post ?? {}) as Loose;\n const text = typeof p.message === 'string' ? p.message : '';\n const preview = previewFrom(text);\n const liveUrl = liveUrlFrom(text) ?? undefined;\n const snapshotId = snapshotFrom(text) ?? undefined;\n if (!preview && !liveUrl && !snapshotId) return null;\n return {\n sandboxUrl: preview?.url,\n sandboxId: preview?.sandboxId,\n liveUrl,\n snapshotId,\n title: siteNameFrom(text) ?? undefined,\n fromReply: true,\n isCreatingSandbox: false,\n isDeploying: false,\n };\n}\n\nfunction postTime(post: unknown): number {\n const p = (post ?? {}) as Loose;\n const raw = p.updatedAt || p.createdAt;\n const ms = typeof raw === 'number' ? raw : Date.parse(String(raw ?? ''));\n return Number.isFinite(ms) ? ms : 0;\n}\n\n/** Posts in the order they happened (the query is not sorted). */\nfunction chronological(posts: readonly unknown[]): unknown[] {\n return [...posts].sort((a, b) => postTime(a) - postTime(b));\n}\n\nfunction isUserPost(post: unknown): boolean {\n const p = (post ?? {}) as Loose;\n const contents = asObject(p.propsConfiguration?.contents) || {};\n const props = asObject(p.props) || {};\n const role = String(props.role ?? contents.role ?? asObject(contents.props)?.role ?? '').toUpperCase();\n return role === 'USER';\n}\n\n/** The stack label the web tile shows when a build does not name one. */\nexport const DEFAULT_TEMPLATE = 'vite-react';\n\n/**\n * Newest-first builds of one site. A later post about the same sandbox (a\n * publish, a re-post, its screenshot) updates that build.\n */\nexport function buildsFromPosts(\n posts: readonly unknown[],\n fallbackTitle?: string,\n cdnOrigin?: string,\n): WebBuilderBuild[] {\n const fallback = fallbackTitle ?? 'Web app';\n const byKey = new Map<string, WebBuilderBuild>();\n let lastKey: string | null = null;\n // The web hydrate's rule: a build is an ASSISTANT post with something to show - a\n // preview URL, a live address or a screenshot. A user turn carries the sandbox it\n // edits (and a bare sandbox id is a turn in flight), neither is a build.\n const fragments = chronological(posts)\n .filter((post) => !isUserPost(post))\n .map((post) => ({ post, fragment: readFragment(post) ?? linkFragment(post) }))\n .filter(\n (row): row is { post: unknown; fragment: Fragment } =>\n row.fragment !== null &&\n Boolean(\n row.fragment.sandboxUrl ||\n row.fragment.liveUrl ||\n row.fragment.coverImageUrl ||\n row.fragment.snapshotId,\n ),\n );\n for (const { post, fragment } of fragments) {\n const previewUrl = sandboxPreviewUrl(fragment.sandboxUrl, fragment.sandboxId);\n const key = fragment.sandboxId || previewUrl || '';\n // A publish or screenshot post may name no sandbox: it belongs to the latest build.\n const target: string | null =\n key || (fragment.liveUrl || fragment.coverImageUrl || fragment.snapshotId ? lastKey : null);\n if (target) {\n const existing = byKey.get(target);\n byKey.set(target, {\n key: target,\n // A workflow fragment names the build; a reply's site name only names a build with none yet.\n title:\n (fragment.fromReply ? existing?.title || fragment.title : fragment.title || existing?.title) ||\n fallback,\n previewUrl: previewUrl || existing?.previewUrl || null,\n sandboxId: fragment.sandboxId || existing?.sandboxId || null,\n projectId: fragment.projectId || existing?.projectId || null,\n liveUrl: fragment.liveUrl || existing?.liveUrl || null,\n files: fragment.files || existing?.files || null,\n snapshotId: fragment.snapshotId || existing?.snapshotId || null,\n origin: existing?.origin === 'workflow' || !fragment.fromReply ? 'workflow' : 'agent',\n templateId: fragment.template || existing?.templateId || DEFAULT_TEMPLATE,\n coverUrl:\n coverDisplayUrl(fragment.coverImageUrl, fragment.coverImagePath, cdnOrigin) ||\n existing?.coverUrl ||\n null,\n updatedAt: Math.max(postTime(post), existing?.updatedAt ?? 0),\n });\n lastKey = target;\n }\n }\n return [...byKey.values()].filter((b) => b.previewUrl || b.liveUrl).sort((a, b) => b.updatedAt - a.updatedAt);\n}\n\n/** The newest post flags a sandbox still being created or a publish still running. */\nexport function pendingWork(posts: readonly unknown[]): 'creating' | 'publishing' | null {\n const newest = chronological(posts)\n .map((post) => readFragment(post))\n .filter((f): f is Fragment => f !== null)\n .pop();\n if (!newest) return null;\n if (newest.isCreatingSandbox && !newest.sandboxUrl && !newest.sandboxId) return 'creating';\n if (newest.isDeploying && !newest.liveUrl) return 'publishing';\n return null;\n}\n\n// ── Titles: the web surface's `resolveArtifactTitle` rules ─────────────────\n\n/** Not a product name: what the workflow and the chat call a site before it has one. */\nexport function isGenericTitle(title?: string | null): boolean {\n const t = (title || '').trim().toLowerCase();\n return (\n !t ||\n t === 'generated page' ||\n t === 'generated project' ||\n t === 'generated with cdecli' ||\n t === 'ai assistant' ||\n t === 'web app' ||\n // The placeholder a site carries before it has a name; a saved one is not a rename.\n /^new (site|app)$/.test(t) ||\n /^build \\d+$/.test(t) ||\n /^build\\s+me\\b/.test(t) ||\n /^remix\\s+the\\b/.test(t) ||\n /^(build|chat)[- ]channel\\b/.test(t) ||\n t.startsWith('selected skill') ||\n /^code[\\s_-]?assist/.test(t)\n );\n}\n\nconst TITLE_STOP_WORDS = new Set([\n 'a',\n 'an',\n 'the',\n 'create',\n 'build',\n 'make',\n 'please',\n 'me',\n 'my',\n 'for',\n 'with',\n 'simple',\n 'using',\n 'from',\n 'template',\n 'to',\n 'and',\n 'or',\n 'remix',\n 'yantra',\n]);\n\nfunction titleCase(words: string[]): string {\n return words.map((w) => w.charAt(0).toUpperCase() + w.slice(1).toLowerCase()).join(' ');\n}\n\n// Every note a turn carries after the person's words (the web's and this app's); older posts too.\nconst KNOWN_NOTE_RE =\n /^\\[(?:Project channelId=[^\\]\\n]*|Database slug=[^\\]\\n]*|\\d+ attachment\\(s\\)|Mode: [a-z]+|Project instructions|Approved plan|Reference site|UI kit|Style direction|Database|AI in the app|Integrations|Element|Fix error|Hand edits|Open build|Open site|Inspired by|New site|Template|Brand kit|Imported project|Export|Asset|Figma|File text)\\]/;\nconst NOTE_LINE_RE = /^\\[(?:[A-Z][A-Za-z]*(?: [A-Za-z]+){0,3}|[A-Z][A-Za-z ]*=[^\\]\\n]*|\\d+ attachment\\(s\\))\\]/;\n// The studio's old brand block, sent as part of the message before it became a note.\nconst LEGACY_BRAND_BLOCK_RE = /^Brand kit \\(follow it\\):\\s*$/;\n// The web's \"New from this\" wrapper around a remix ask.\nconst REFERENCE_WRAPPER_RE =\n /^Using “[^”]*” as reference \\(do not edit that sandbox\\)\\.\\nCreate a new app from the user request below\\.\\n\\n/;\n\n/**\n * The person's words, without the notes a turn carries for the agent (web `stripSurfaceNotes`):\n * everything from the first note on - a known `[Tag]` line, the old brand block, or any\n * `[Tag]` line after a blank one (notes follow one). A \"Build me:\" brief keeps its prefix.\n */\nexport function stripAgentNote(content: string): string {\n const lines = String(content || '')\n .replace(REFERENCE_WRAPPER_RE, '')\n .replace(/\\r\\n?/g, '\\n')\n .split('\\n');\n let cut = lines.length;\n for (let i = 0; i < lines.length; i++) {\n const line = lines[i].trimStart();\n if (\n KNOWN_NOTE_RE.test(line) ||\n LEGACY_BRAND_BLOCK_RE.test(line) ||\n (i > 0 && !lines[i - 1].trim() && NOTE_LINE_RE.test(line))\n ) {\n cut = i;\n break;\n }\n }\n return lines.slice(0, cut).join('\\n').trim();\n}\n\n/** What the person wrote, as their bubble shows it: no notes, no studio \"Build me:\" prefix. */\nexport function userBubbleText(content: string): string {\n return stripAgentNote(content).replace(/^\\s*Build me:\\s*/i, '');\n}\n\n/** The person's words, without the internal lines a turn carries. */\nexport function cleanPrompt(text: string): string {\n return text\n .replace(/^\\[webbuilder context:[^\\]]*\\]\\s*/i, '')\n .replace(/^build\\s*me\\s*:\\s*/i, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\n/**\n * Product name from a brief: \"Build me: todo app\" -> \"Todo App\". An edit\n * (\"make the header blue\") is not a name.\n */\nexport function titleFromPrompt(message?: string | null): string | null {\n const raw = (message || '').replace(/^\\[webbuilder context:[^\\]]*\\]\\s*/i, '').trim();\n if (!raw) return null;\n const buildMe = raw.match(/^\\s*Build me:\\s*(.+)$/im)?.[1]?.trim();\n if (!buildMe && /^(change|update|rename|fix|edit|add|remove|delete|improve|make|refactor)\\b/i.test(raw)) {\n return null;\n }\n const source = (buildMe || raw.split(/\\n+/)[0] || '').replace(/^[\"']|[\"']$/g, '');\n const words = source\n .replace(/[^\\w\\s-]/g, ' ')\n .split(/\\s+/)\n .filter((w) => w.length > 1 && !TITLE_STOP_WORDS.has(w.toLowerCase()))\n .slice(0, 3);\n if (!words.length) return null;\n const title = titleCase(words);\n return isGenericTitle(title) ? null : title;\n}\n\n/** `package.json` name of the build (\"bakery-site\" -> \"Bakery Site\"). */\nfunction titleFromPackageJson(files?: Record<string, string> | null): string | null {\n if (!files) return null;\n const raw = Object.entries(files).find(([path]) => /(^|\\/)package\\.json$/.test(path))?.[1];\n if (!raw) return null;\n try {\n const name = String((JSON.parse(raw) as { name?: string }).name || '').trim();\n if (!name || name === 'vite-react' || name === 'project') return null;\n return name\n .replace(/^@[^/]+\\//, '')\n .replace(/[-_]+/g, ' ')\n .replace(/\\b\\w/g, (c) => c.toUpperCase());\n } catch {\n return null;\n }\n}\n\n/** The build's own title, then the brief's product name, the chat's name, the package name. */\n/** \"a bakery called Crumb & Co\", \"named 'Lotus Flow'\", \"Brand name: Crumb & Co\" -> the name the person gave the site (web). */\nexport function siteNameFromRequest(text: string | null | undefined): string | null {\n const t = String(text ?? '');\n const m =\n t.match(/^[ \\t-]*Brand name:\\s*([^\\n]{2,40})$/im) ??\n t.match(/\\b(?:called|named)\\s+[\"“'‘]([^\"”'’\\n]{2,40})[\"”'’]/i) ??\n t.match(/\\b(?:called|named)\\s+([A-Z0-9][\\w&'’.-]*(?:\\s+(?:&|and|[A-Z0-9][\\w&'’.-]*))*)/);\n const name = m?.[1]\n ?.split(/[.!?]\\s/)[0]\n .replace(/\\s+(?:&|and)$/i, '')\n .replace(/[.,;:!?]+$/, '')\n .trim();\n return name && name.length >= 2 ? name : null;\n}\n\nexport function resolveSiteTitle(opts: {\n fragmentTitle?: string | null;\n channelTitle?: string | null;\n userPrompt?: string | null;\n /** The first request as sent (its brand kit note too): the name the person gave the site. */\n requestText?: string | null;\n files?: Record<string, string> | null;\n}): string {\n const candidates = [\n opts.fragmentTitle,\n siteNameFromRequest(opts.requestText),\n titleFromPrompt(opts.userPrompt),\n opts.channelTitle,\n titleFromPackageJson(opts.files),\n ];\n const found = candidates.find((c) => c && !isGenericTitle(c));\n return (found || 'Generated Page').trim();\n}\n\n// ── Sites ──────────────────────────────────────────────────────────────────\n\nexport interface ChannelLike {\n id?: string | null;\n title?: string | null;\n displayName?: string | null;\n updatedAt?: unknown;\n createdAt?: unknown;\n lastMessage?: unknown;\n}\n\n/** True when the newest build in `lastMessage` already carries a cover - the web skips the thread read then. */\nexport function lastMessageHasCover(channel: ChannelLike): boolean {\n return Boolean(readFragment(channel.lastMessage)?.coverImageUrl);\n}\n\n/**\n * A site from one chat's posts, the way the web gallery hydrates a tile: only\n * a chat with a build is a site; its name follows `resolveSiteTitle`.\n */\nexport function projectFromPosts(\n channel: ChannelLike,\n posts: readonly unknown[],\n cdnOrigin?: string,\n): WebBuilderProject | null {\n const channelId = str(channel.id);\n if (!channelId) return null;\n const builds = buildsFromPosts(posts, '', cdnOrigin);\n const latest = builds[0];\n if (!latest) return null;\n const userPosts = chronological(posts).filter((post) => isUserPost(post) && str((post as Loose).message));\n const userPrompts = userPosts\n // The person's own words: a note sent along (a brand kit) is not a title source.\n .map((post) => stripAgentNote(String((post as Loose).message)))\n .filter(Boolean);\n // The brief names the product (\"Build me: …\"); a later message (\"the live preview is\n // not loading\") never does, so only the brief - or failing that the first ask - counts.\n const brief = userPrompts.find((m) => /build\\s*me\\s*:/i.test(m)) ?? userPrompts[0];\n const rawChannelTitle = [channel.displayName, channel.title]\n .map((t) => str(t))\n .find((t) => t && !isGenericTitle(t));\n // A chat named after its brief (\"Build simple calculator app\") gives the product name, not the sentence.\n const channelTitle =\n rawChannelTitle && /^(build|create|make)\\b/i.test(rawChannelTitle)\n ? (titleFromPrompt(rawChannelTitle) ?? rawChannelTitle)\n : rawChannelTitle;\n const title = resolveSiteTitle({\n fragmentTitle: latest.title,\n channelTitle,\n userPrompt: brief,\n requestText: userPosts.length ? String((userPosts[0] as Loose).message) : null,\n files: latest.files,\n });\n const updated = Date.parse(String(channel.updatedAt ?? channel.createdAt ?? ''));\n return {\n channelId,\n title,\n updatedAt: Math.max(Number.isFinite(updated) ? updated : 0, latest.updatedAt),\n previewUrl: latest.previewUrl,\n liveUrl: builds.find((b) => b.liveUrl)?.liveUrl ?? null,\n coverUrl: builds.find((b) => b.coverUrl)?.coverUrl ?? null,\n templateId: latest.templateId,\n };\n}\n\n/** `?wb=<n>` on the preview so a rebuilt sandbox is fetched again, not served from cache. */\nexport function cacheBustedUrl(url: string, nonce: number | string): string {\n const [base, hash = ''] = url.split('#');\n const clean = base.replace(/([?&])wb=[^&]*(&|$)/, '$1').replace(/[?&]$/, '');\n const sep = clean.includes('?') ? '&' : '?';\n return `${clean}${sep}wb=${nonce}${hash ? `#${hash}` : ''}`;\n}\n\n/**\n * The publish name the web dialog suggests: the site's title as a slug,\n * `[a-z0-9-]`, at most 58 characters (`<name>.yarntra.com`).\n */\nexport function publishSlug(title: string): string {\n const slug = title\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 58)\n .replace(/-+$/, '');\n return slug || 'my-site';\n}\n\nexport function isValidPublishSlug(value: string): boolean {\n return /^[a-z0-9](?:[a-z0-9-]{0,56}[a-z0-9])?$/.test(value);\n}\n\n/** Display host of a URL: `https://bakery.pages.dev/` -> `bakery.pages.dev`. */\nexport function displayHost(url: string | null | undefined): string {\n const match = /^https?:\\/\\/([^/?#]+)/i.exec((url ?? '').trim());\n return match ? match[1] : (url ?? '').trim();\n}\n\n/** \"just now\", \"5 min ago\", \"3 h ago\", \"Yesterday\", \"12 Oct\". */\nexport function relativeTime(ms: number, now = Date.now()): string {\n if (!ms) return '';\n const diff = Math.max(0, now - ms);\n const min = Math.floor(diff / 60_000);\n if (min < 1) return 'just now';\n if (min < 60) return `${min} min ago`;\n const hours = Math.floor(min / 60);\n if (hours < 24) return `${hours} h ago`;\n if (hours < 48) return 'Yesterday';\n const d = new Date(ms);\n const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n return `${d.getDate()} ${months[d.getMonth()]}`;\n}\n\n// ── The agent transcript: the build chat's posts, as the web Agent pane shows them ──\n\n/** A live progress row (web `isThinkingPost`): shown as the agent's status, never kept. */\nexport function isThinkingPost(post: unknown): boolean {\n const p = (post ?? {}) as Loose;\n const props = asObject(p.props) || {};\n const attachment = asObject(props.attachment) || {};\n const msg = String(p.message ?? '')\n .trim()\n .toLowerCase();\n return (\n String(p.type ?? '').toUpperCase() === 'THINKING' ||\n Boolean(props.thinking ?? props.isThinking) ||\n props.kind === 'thinking' ||\n Boolean(attachment.isThinking) ||\n msg === 'thinking...' ||\n msg === 'initializing...' ||\n msg === 'initializing…'\n );\n}\n\nfunction readFragmentStatus(p: Loose): string | undefined {\n const contents = asObject(p.propsConfiguration?.contents) || {};\n return (\n str(asObject(asObject(contents.props)?.fragment)?.statusText) || str(asObject(contents.fragment)?.statusText)\n );\n}\n\n/** The workflow's progress line on a post: its thought, else the fragment's status. */\nexport function progressText(post: unknown): string | null {\n const p = (post ?? {}) as Loose;\n const props = asObject(p.props) || {};\n const thought = str(asObject(props.attachment)?.thought);\n if (thought) return thought;\n const status = str(asObject(props.fragment)?.statusText) || str(readFragmentStatus(p));\n if (status) return status;\n return isThinkingPost(post) ? (str(p.message) ?? null) : null;\n}\n\n/** A post the workflow wrote when the build failed (`fragment.isError` / `type: 'error'`). */\nexport function isErrorPost(post: unknown): boolean {\n const p = (post ?? {}) as Loose;\n const props = asObject(p.props) || {};\n const contents = asObject(p.propsConfiguration?.contents) || {};\n const f =\n asObject(props.fragment) || asObject(asObject(contents.props)?.fragment) || asObject(contents.fragment) || {};\n return f.isError === true || f.type === 'error';\n}\n\nexport interface TranscriptMessage {\n id: string;\n role: 'user' | 'assistant';\n content: string;\n createdAt: number;\n}\n\n/**\n * The conversation in a build chat: the person's turns and the agent's replies,\n * oldest first, without progress rows or empty build markers.\n */\nexport function transcriptFromPosts(posts: readonly unknown[]): TranscriptMessage[] {\n const out: TranscriptMessage[] = [];\n for (const post of chronological(posts)) {\n const p = post as Loose;\n const text = str(p.message);\n if (text && !isThinkingPost(post)) {\n const user = isUserPost(post);\n out.push({\n id: String(p.id ?? `${user ? 'u' : 'a'}-${out.length}`),\n role: user ? 'user' : 'assistant',\n content: user ? cleanPrompt(text) || text : text,\n createdAt: postTime(post),\n });\n }\n }\n return out;\n}\n\n/**\n * How a turn started at `since` is going, read from the posts that arrived after it.\n * `heard` is whether the build posted anything back yet (a progress row, an answer).\n */\nexport function turnState(\n posts: readonly unknown[],\n since: number,\n): { status: 'running' | 'done' | 'failed'; progress: string | null; error: string | null; heard: boolean } {\n // A clock skew allowance, as the web ignores posts older than start - 2 s.\n const after = chronological(posts).filter((post) => postTime(post) >= since - 2_000);\n let progress: string | null = null;\n for (const post of after) {\n if (!isUserPost(post)) {\n if (isErrorPost(post)) {\n const p = post as Loose;\n return { status: 'failed', progress: null, error: str(p.message) ?? 'The build failed.', heard: true };\n }\n const fragment = readFragment(post);\n if (fragment && (fragment.sandboxUrl || fragment.liveUrl) && !isThinkingPost(post)) {\n return { status: 'done', progress: null, error: null, heard: true };\n }\n progress = progressText(post) ?? progress;\n }\n }\n // A plain answer (the agent asked a question, or replied without building) ends\n // the turn too - unless progress rows keep arriving after it.\n const newest = after.filter((post) => !isUserPost(post)).pop() as Loose | undefined;\n if (newest && !isThinkingPost(newest) && !progressText(newest) && str(newest.message)) {\n return { status: 'done', progress: null, error: null, heard: true };\n }\n return { status: 'running', progress, error: null, heard: Boolean(newest) };\n}\n\n/**\n * A turn sent through the build workflow: its USER post carries the workflow's\n * route (`templateTarget`). A blank build sends an empty fragment, which\n * the server drops, so this post is the only workflow mark until a build lands.\n */\nfunction isWorkflowTurnPost(post: unknown): boolean {\n if (!post || typeof post !== 'object') return false;\n const p = post as Loose;\n const contents = asObject(p.propsConfiguration?.contents) || {};\n return Boolean(str(asObject(p.props)?.templateTarget) || str(asObject(contents.props)?.templateTarget));\n}\n\n/**\n * The chat was built through the build workflow (its posts carry fragments or\n * the workflow's route): edits go back through the workflow. A chat without\n * any is an agent-chat site (a template remix), and its turns stay in the\n * agent chat.\n */\nexport function hasWorkflowPosts(posts: readonly unknown[]): boolean {\n return posts.some((post) => readFragment(post) !== null || isWorkflowTurnPost(post));\n}\n"],"names":["_a"],"mappings":"uZA0CA,SAAS,SAAS,KAA8B,EAAA;AAC9C,EAAI,IAAA,CAAC,OAAc,OAAA,IAAA;AACnB,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA,OAAO,MAAM,OAAQ,CAAA,KAAK,IAAI,IAAO,GAAA,KAAA;AACpE,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAM,MAAA,OAAA,GAAU,MAAM,IAAK,EAAA;AAC3B,IAAA,IAAI,CAAC,OAAA,CAAQ,UAAW,C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ACV,KAAO,EAAA,IAAA;AAAA,MACP,KAAO,EAAA;AAAA,KACT;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,SAAA;AAAA,IACR,QAAA;AAAA,IACA,KAAO,EAAA,IAAA;AAAA,IACP,KAAA,EAAO,QAAQ,MAAM;AAAA,GACvB;AACF;AAOA,SAAS,mBAAmB,IAAwB,EAAA;AA7oBpD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AA8oBE,EAAA,IAAI,CAAC,IAAA,IAAQ,OAAO,IAAA,KAAS,UAAiB,OAAA,KAAA;AAC9C,EAAA,MAAM,CAAI,GAAA,IAAA;AACV,EAAA,MAAM,WAAW,QAAS,CAAA,CAAA,EAAA,GAAA,CAAA,CAAE,uBAAF,IAAsB,GAAA,MAAA,GAAA,EAAA,CAAA,QAAQ,KAAK,EAAC;AAC9D,EAAA,OAAO,QAAQ,GAAI,CAAA,CAAA,EAAA,GAAA,QAAA,CAAS,CAAE,CAAA,KAAK,MAAhB,IAAmB,GAAA,MAAA,GAAA,EAAA,CAAA,cAAc,CAAK,IAAA,GAAA,CAAA,CAAI,cAAS,QAAS,CAAA,KAAK,CAAvB,KAAA,IAAA,GAAA,MAAA,GAAA,EAAA,CAA0B,cAAc,CAAC,CAAA;AACxG;AAQO,SAAS,iBAAiB,KAAoC,EAAA;AACnE,EAAO,OAAA,KAAA,CAAM,KAAK,CAAQ,IAAA,KAAA,YAAA,CAAa,IAAI,CAAM,KAAA,IAAA,IAAQ,kBAAmB,CAAA,IAAI,CAAC,CAAA;AACnF"}
@@ -1,4 +1,4 @@
1
- import {titleFromPrompt,stripAgentNote,cleanPrompt}from'./buildFragments.js';import {publicSandboxDomain}from'./publicSandboxDomain.js';import {withPublicSandboxHosts}from'./sandboxPublicHost.js';var __defProp = Object.defineProperty;
1
+ import {siteNameFromRequest,titleFromPrompt,stripAgentNote,cleanPrompt}from'./buildFragments.js';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;
@@ -32,7 +32,7 @@ function webBuilderPageUrl(webOrigin, channelId) {
32
32
  }
33
33
  function webBuilderJobRecord(start) {
34
34
  const brief = briefFrom(start.ask);
35
- const name = start.siteTitle || titleFromPrompt(stripAgentNote(start.ask)) || "New site";
35
+ const name = start.siteTitle || siteNameFromRequest(start.ask) || titleFromPrompt(stripAgentNote(start.ask)) || "New site";
36
36
  const pageUrl = webBuilderPageUrl(start.webOrigin, start.channelId);
37
37
  return __spreadProps(__spreadValues({
38
38
  // One job per turn; the server keys it on `<surface>:<id>`, so a retry records nothing new.
@@ -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 { 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,MAAM,sBAAyB,GAAA;AAEzB,MAAA,wBAAA,GAA2B,KAAK,EAAK,GAAA;AAErC,MAAA,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AAA,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"}
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, siteNameFromRequest, 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 =\n start.siteTitle || siteNameFromRequest(start.ask) || 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,MAAM,sBAAyB,GAAA;AAEzB,MAAA,wBAAA,GAA2B,KAAK,EAAK,GAAA;AAErC,MAAA,uBAAA,GAA0B,KAAK,EAAK,GAAA;AAEjD,MAAM,SAAY,GAAA,GAAA;AAsBlB,SAAS,UAAU,GAAqB,EAAA;AACtC,EAAA,MAAM,IAAO,GAAA,WAAA,CAAY,cAAe,CAAA,GAAG,CAAC,CAAA;AAC5C,EAAA,OAAO,IAAK,CAAA,MAAA,GAAS,SAAY,GAAA,CAAA,EAAG,IAAK,CAAA,KAAA,CAAM,CAAG,EAAA,SAAA,GAAY,CAAC,CAAA,CAAE,OAAQ,EAAC,CAAM,MAAA,CAAA,GAAA,IAAA;AAClF;AAGgB,SAAA,iBAAA,CAAkB,WAAsC,SAAuC,EAAA;AAC7G,EAAA,MAAM,UAAU,SAAa,IAAA,EAAA,EAAI,MAAO,CAAA,OAAA,CAAQ,QAAQ,EAAE,CAAA;AAC1D,EAAA,IAAI,CAAC,qBAAA,CAAsB,IAAK,CAAA,MAAM,GAAU,OAAA,MAAA;AAChD,EAAA,OAAO,CAAG,EAAA,MAAM,CAAM,GAAA,EAAA,kBAAA,CAAmB,SAAS,CAAC,CAAA,WAAA,CAAA;AACrD;AAGO,SAAS,oBAAoB,KAAoD,EAAA;AACtF,EAAM,MAAA,KAAA,GAAQ,SAAU,CAAA,KAAA,CAAM,GAAG,CAAA;AAGjC,EAAA,MAAM,IAAO,GAAA,KAAA,CAAM,SAAa,IAAA,mBAAA,CAAoB,KAAM,CAAA,GA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AA;AAAA,IAChB,cAAc,MAAO,CAAA;AAAA,GACvB;AACF"}
@@ -299,4 +299,21 @@ function isSavedCodeRead(data) {
299
299
  }
300
300
  function isSandboxUnavailableError(message) {
301
301
  return /sandbox not found|not found \(404\)|no sandbox|does not exist|sandbox.*(paused|expired|killed)|not running anymore|timed? ?out|ETIMEDOUT|\b502\b/i.test(String(message || ""));
302
- }export{MAX_EDITABLE_BYTES,MAX_SEARCH_CHARS,MAX_SEARCH_LINES,MAX_TREE_FILES,MIN_SEARCH_CHARS,READ_FILE_MAX_BYTES,buildListFilesCommand,buildSearchCommand,codeEditSummary,decideSave,handEditsNote,isBinaryPath,isListablePath,isSandboxUnavailableError,isSavedCodeRead,lineDelta,matchFileNames,matchRanges,normalizeEditorPath,normalizeQuery,openModeFor,parseListFilesOutput,parseListFilesResult,parseSearchOutput,preferredFile,savedCodeSource,searchDocs,shellQuote,sortTree};//# sourceMappingURL=codeFiles.js.map
302
+ }
303
+ function codeUnavailableText(opts) {
304
+ if (opts.busy) return "The AI is still building this site. Its files show here once the build is saved.";
305
+ const open = opts.openUrl ? ` You can also open the live preview: ${opts.openUrl}` : "";
306
+ if (opts.agentBuild) {
307
+ return `This build's workspace isn't running and there is no saved copy of its files yet, so they can't be opened here. Ask in the chat to bring it back or change anything.${open}`;
308
+ }
309
+ return `The code for this build isn't available here.${open}`;
310
+ }
311
+ function listErrorText(error) {
312
+ const first = String(error != null ? error : "").split("\n")[0].replace(/\s*\[[A-Z][A-Z0-9_]*(?:;[^\]]*)?\]\s*$/, "").trim();
313
+ if (!first || /^at\s/.test(first)) return "Could not list the project files.";
314
+ if (/no connector result|connector (?:is )?(?:not|un)available|remote connector|cdecli/i.test(first)) {
315
+ return "The build service didn't answer. Try again in a moment.";
316
+ }
317
+ const text = first.length > 200 ? `${first.slice(0, 199)}\u2026` : first;
318
+ return /[.!?…]$/.test(text) ? text : `${text}.`;
319
+ }export{MAX_EDITABLE_BYTES,MAX_SEARCH_CHARS,MAX_SEARCH_LINES,MAX_TREE_FILES,MIN_SEARCH_CHARS,READ_FILE_MAX_BYTES,buildListFilesCommand,buildSearchCommand,codeEditSummary,codeUnavailableText,decideSave,handEditsNote,isBinaryPath,isListablePath,isSandboxUnavailableError,isSavedCodeRead,lineDelta,listErrorText,matchFileNames,matchRanges,normalizeEditorPath,normalizeQuery,openModeFor,parseListFilesOutput,parseListFilesResult,parseSearchOutput,preferredFile,savedCodeSource,searchDocs,shellQuote,sortTree};//# sourceMappingURL=codeFiles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codeFiles.js","sources":["../../../src/features/webbuilder/codeFiles.ts"],"sourcesContent":["/**\n * The Code view's rules, ported from the web surface (`code/codeFiles.ts`,\n * `code/codeSearch.ts`, `code/savedCode.ts`). Pure: the host runs the commands.\n *\n * - The file tree is a `WEBBUILDER_RUN_COMMAND` listing (`git ls-files` plus\n * untracked, non-ignored files; `find` without a repo), never node_modules,\n * .git, dist, .output or any .env* file.\n * - A file opens editable, read-only (over 1 MB) or as \"can't show\" (binary).\n * - Before a save the file is read again: if it changed on disk since it was\n * opened, the person chooses Overwrite or Reload.\n * - Search is one capped, read-only, case-insensitive `git grep`.\n * - Without a sandbox the code comes from the backup repo (`fromRepo`), read-only.\n */\nimport { siteProjectName } from './siteAddress';\n\n/** Files over this size open read-only. */\nexport const MAX_EDITABLE_BYTES = 1_048_576;\n/** READ_FILE's own cap (2 MB). */\nexport const READ_FILE_MAX_BYTES = 2_097_152;\nexport const MAX_TREE_FILES = 2000;\n\nconst SKIP_DIRS = new Set(['node_modules', '.git', 'dist', '.output']);\n\n/** True for a path that may appear in the tree (and be read or written by the editor). */\nexport function isListablePath(path: string): boolean {\n const p = path.trim();\n if (!p || p.includes('\\0') || p.startsWith('/')) return false;\n const segments = p.split('/');\n if (segments.some((s) => s === '' || s === '.' || s === '..')) return false;\n if (segments.some((s) => SKIP_DIRS.has(s))) return false;\n return !segments.some((s) => s.startsWith('.env'));\n}\n\n/** Normalised relative path for READ/WRITE, or null when it isn't allowed. */\nexport function normalizeEditorPath(path: string | null | undefined): string | null {\n const p = (path || '')\n .trim()\n .replace(/\\\\/g, '/')\n .replace(/^(\\.\\/)+/, '');\n return isListablePath(p) ? p : null;\n}\n\nconst TREE_EXCLUDE =\n \"':!node_modules' ':!**/node_modules/**' ':!dist' ':!**/dist/**' ':!.output' ':!.env*' ':!**/.env*'\";\n\n/** RUN_COMMAND script (project folder): one path per line between markers. */\nexport function buildListFilesCommand(): string {\n return [\n 'echo \"__FILES_BEGIN\"',\n 'if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then',\n ` git -c core.quotepath=off ls-files --cached --others --exclude-standard -- . ${TREE_EXCLUDE} 2>/dev/null | head -n ${MAX_TREE_FILES + 1}`,\n 'else',\n ` find . -type d \\\\( -name node_modules -o -name .git -o -name dist -o -name .output \\\\) -prune -o -type f ! -name '.env*' -print 2>/dev/null | sed 's|^\\\\./||' | head -n ${MAX_TREE_FILES + 1}`,\n 'fi',\n 'echo \"__FILES_END\"',\n 'exit 0',\n ].join('\\n');\n}\n\nexport interface FileTree {\n files: string[];\n /** More files exist than are shown. */\n partial: boolean;\n}\n\n/** Folders first, then files, case-insensitive - the order a file tree shows. */\nexport function sortTree(paths: string[]): string[] {\n return [...paths].sort((a, b) => {\n const pa = a.split('/');\n const pb = b.split('/');\n const n = Math.min(pa.length, pb.length);\n for (let i = 0; i < n; i += 1) {\n if (pa[i] !== pb[i]) {\n const aDir = i < pa.length - 1;\n const bDir = i < pb.length - 1;\n if (aDir !== bDir) return aDir ? -1 : 1;\n return pa[i].localeCompare(pb[i], undefined, { sensitivity: 'base' }) || (pa[i] < pb[i] ? -1 : 1);\n }\n }\n return pa.length - pb.length;\n });\n}\n\nfunction betweenMarkers(stdout: string, begin: string, end: string): { lines: string[]; cut: boolean } | null {\n const text = String(stdout || '');\n const at = text.indexOf(begin);\n if (at < 0) return null;\n const endIdx = text.indexOf(end, at);\n const lines = text\n .slice(at + begin.length, endIdx < 0 ? undefined : endIdx)\n .split('\\n')\n .map((l) => l.replace(/\\r$/, ''));\n // Output cut off mid-line: the last line may be partial.\n if (endIdx < 0) lines.pop();\n return { lines, cut: endIdx < 0 };\n}\n\nexport function parseListFilesOutput(stdout: string, opts?: { truncated?: boolean }): FileTree | null {\n const body = betweenMarkers(stdout, '__FILES_BEGIN', '__FILES_END');\n if (!body) return null;\n const seen = new Set<string>();\n for (const line of body.lines) {\n const p = normalizeEditorPath(line);\n if (p) seen.add(p);\n }\n const all = sortTree([...seen]);\n return {\n files: all.slice(0, MAX_TREE_FILES),\n partial: body.cut || Boolean(opts?.truncated) || all.length > MAX_TREE_FILES,\n };\n}\n\n/** LIST_FILES `{source, files, truncated}` (the saved code) as a file tree, same filters. */\nexport function parseListFilesResult(data: unknown): FileTree | null {\n if (!data || typeof data !== 'object') return null;\n const d = data as Record<string, unknown>;\n if (!Array.isArray(d.files)) return null;\n const seen = new Set<string>();\n for (const f of d.files) {\n const p = typeof f === 'string' ? normalizeEditorPath(f) : null;\n if (p) seen.add(p);\n }\n const all = sortTree([...seen]);\n return { files: all.slice(0, MAX_TREE_FILES), partial: d.truncated === true || all.length > MAX_TREE_FILES };\n}\n\n/** Default file to open: the app entry when present. */\nexport function preferredFile(paths: string[]): string {\n const preferred = [\n 'src/App.tsx',\n 'src/App.jsx',\n 'src/main.tsx',\n 'src/main.jsx',\n 'app/page.tsx',\n 'pages/index.tsx',\n 'index.html',\n 'package.json',\n ];\n return preferred.find((p) => paths.includes(p)) || paths[0] || '';\n}\n\nconst BINARY_EXT =\n /\\.(png|jpe?g|gif|webp|avif|ico|bmp|tiff?|psd|woff2?|ttf|otf|eot|mp3|mp4|m4a|wav|ogg|webm|mov|avi|zip|gz|tgz|bz2|xz|7z|rar|tar|pdf|wasm|exe|dll|so|dylib|bin|class|jar|sqlite|db|lockb)$/i;\n\nexport function isBinaryPath(path: string): boolean {\n return BINARY_EXT.test(path);\n}\n\nexport type OpenMode =\n | { kind: 'edit' }\n | { kind: 'readonly'; reason: 'large' }\n | { kind: 'binary' }\n | { kind: 'error'; message: string };\n\n/** How a READ_FILE result opens. */\nexport function openModeFor(path: string, data: Record<string, unknown>): OpenMode {\n if (isBinaryPath(path) || data.binary === true || data.encoding === 'base64') return { kind: 'binary' };\n if (typeof data.content !== 'string') return { kind: 'error', message: 'The file came back empty.' };\n const size = typeof data.size === 'number' ? data.size : data.content.length;\n if (data.truncated === true || size > MAX_EDITABLE_BYTES) return { kind: 'readonly', reason: 'large' };\n return { kind: 'edit' };\n}\n\nexport type SaveDecision = 'write' | 'unchanged' | 'conflict' | 'missing';\n\n/**\n * Before writing: `base` is what was loaded, `disk` what is on disk now (null =\n * gone), `draft` the edited text. A file changed on disk since it was opened is\n * a conflict (the person chooses: overwrite or reload).\n */\nexport function decideSave(base: string, disk: string | null, draft: string): SaveDecision {\n if (disk === null) return 'missing';\n if (disk !== base) return disk === draft ? 'unchanged' : 'conflict';\n return draft === base ? 'unchanged' : 'write';\n}\n\n/** Changed line counts (common prefix/suffix trimmed - cheap and good enough for a summary). */\nexport function lineDelta(before: string, after: string): { added: number; removed: number } {\n const a = before.split('\\n');\n const b = after.split('\\n');\n let start = 0;\n while (start < a.length && start < b.length && a[start] === b[start]) start += 1;\n let endA = a.length - 1;\n let endB = b.length - 1;\n while (endA >= start && endB >= start && a[endA] === b[endB]) {\n endA -= 1;\n endB -= 1;\n }\n return { removed: Math.max(0, endA - start + 1), added: Math.max(0, endB - start + 1) };\n}\n\n/** The hand-edit summary for a file saved from the Code view. */\nexport function codeEditSummary(before: string, after: string): string {\n const { added, removed } = lineDelta(before, after);\n const parts: string[] = [];\n if (added) parts.push(`+${added}`);\n if (removed) parts.push(`-${removed}`);\n return `edited in the code view (${parts.join(' / ') || 'whitespace'} lines)`;\n}\n\n/** The note the next agent turn carries, so it keeps hand edits (web `agentTurnNotes`). */\nexport function handEditsNote(edits: ReadonlyArray<{ file: string; summary: string }>): string {\n if (!edits.length) return '';\n return `[Hand edits] The user already changed these by hand (keep them): ${edits\n .map((m) => `${m.file}: ${m.summary}`)\n .join('; ')}.`;\n}\n\n// ── Search ─────────────────────────────────────────────────────────────────\n\nexport const MIN_SEARCH_CHARS = 2;\nexport const MAX_SEARCH_CHARS = 200;\nexport const MAX_SEARCH_LINES = 400;\nconst MAX_RAW_LINE_CHARS = 400;\nconst PREVIEW_CHARS = 160;\nconst MAX_NAME_MATCHES = 50;\n\nexport interface SearchMatch {\n line: number;\n /** The preview text (whitespace trimmed, long lines cut around the first match). */\n text: string;\n /** [start, end) offsets of the query in `text`. */\n ranges: Array<[number, number]>;\n}\n\nexport interface ContentSearchResult {\n files: Array<{ path: string; matches: SearchMatch[] }>;\n total: number;\n /** More matches exist than are shown. */\n truncated: boolean;\n}\n\n/** The query as searched: one line, trimmed, bounded; null when too short. */\nexport function normalizeQuery(query: string): string | null {\n const q = String(query || '')\n .replace(/[\\r\\n\\0]+/g, ' ')\n .trim()\n .slice(0, MAX_SEARCH_CHARS);\n return q.length >= MIN_SEARCH_CHARS ? q : null;\n}\n\n/** POSIX single-quoting: safe for any text. */\nexport function shellQuote(s: string): string {\n return `'${s.replace(/'/g, `'\\\\''`)}'`;\n}\n\n/** RUN_COMMAND script: fixed-string, case-insensitive, text files only, the tree's exclusions, capped. */\nexport function buildSearchCommand(query: string): string {\n const q = normalizeQuery(query);\n if (!q) throw new Error('query too short');\n const pattern = shellQuote(q);\n const exclude = `${TREE_EXCLUDE} ':!**/.output/**'`;\n const cap = `cut -c1-${MAX_RAW_LINE_CHARS} | head -n ${MAX_SEARCH_LINES + 1}`;\n return [\n 'echo \"__GREP_BEGIN\"',\n 'if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then',\n ` git -c core.quotepath=off grep --untracked -n -I -i -F --no-color -e ${pattern} -- . ${exclude} 2>/dev/null | ${cap}`,\n 'else',\n ` grep -rnIiF --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist --exclude-dir=.output --exclude='.env*' -e ${pattern} . 2>/dev/null | sed 's|^\\\\./||' | ${cap}`,\n 'fi',\n 'echo \"__GREP_END\"',\n 'exit 0',\n ].join('\\n');\n}\n\n/** Case-insensitive offsets of `query` in `text`. */\nexport function matchRanges(text: string, query: string): Array<[number, number]> {\n const q = query.toLowerCase();\n if (!q) return [];\n const hay = text.toLowerCase();\n const out: Array<[number, number]> = [];\n let at = hay.indexOf(q);\n while (at >= 0 && out.length < 20) {\n out.push([at, at + q.length]);\n at = hay.indexOf(q, at + q.length);\n }\n return out;\n}\n\nfunction previewLine(raw: string, query: string): Omit<SearchMatch, 'line'> {\n let text = raw.replace(/\\t/g, ' ').replace(/\\s+$/, '');\n text = text.slice(text.length - text.trimStart().length);\n if (text.length > PREVIEW_CHARS) {\n const first = text.toLowerCase().indexOf(query.toLowerCase());\n const start = first > PREVIEW_CHARS / 3 ? first - Math.floor(PREVIEW_CHARS / 3) : 0;\n text = `${start > 0 ? '…' : ''}${text.slice(start, start + PREVIEW_CHARS)}${start + PREVIEW_CHARS < text.length ? '…' : ''}`;\n }\n return { text, ranges: matchRanges(text, query) };\n}\n\nfunction groupRows(\n rows: Array<{ path: string; line: number; raw: string }>,\n query: string,\n truncated: boolean,\n): ContentSearchResult {\n const byPath = new Map<string, SearchMatch[]>();\n for (const r of rows) {\n const list = byPath.get(r.path) ?? [];\n list.push({ line: r.line, ...previewLine(r.raw, query) });\n byPath.set(r.path, list);\n }\n return { files: [...byPath].map(([path, matches]) => ({ path, matches })), total: rows.length, truncated };\n}\n\nconst GREP_LINE = /^(.+?):(\\d+):(.*)$/;\n\n/** The search command's output (`path:line:text`); null when the markers are missing. */\nexport function parseSearchOutput(\n stdout: string,\n query: string,\n opts?: { truncated?: boolean },\n): ContentSearchResult | null {\n const body = betweenMarkers(stdout, '__GREP_BEGIN', '__GREP_END');\n if (!body) return null;\n const rows: Array<{ path: string; line: number; raw: string }> = [];\n for (const l of body.lines) {\n const m = GREP_LINE.exec(l);\n const path = m ? m[1].replace(/^\\.\\//, '') : '';\n if (m && isListablePath(path)) rows.push({ path, line: Number(m[2]), raw: m[3] });\n }\n const truncated = body.cut || Boolean(opts?.truncated) || rows.length > MAX_SEARCH_LINES;\n return groupRows(rows.slice(0, MAX_SEARCH_LINES), query, truncated);\n}\n\n/** Search contents already in memory (open files, drafts) when the project can't be searched. */\nexport function searchDocs(docs: Record<string, string>, query: string): ContentSearchResult {\n const q = normalizeQuery(query);\n if (!q) return { files: [], total: 0, truncated: false };\n const needle = q.toLowerCase();\n const rows: Array<{ path: string; line: number; raw: string }> = [];\n let truncated = false;\n Object.keys(docs)\n .sort()\n .filter(isListablePath)\n .forEach((path) => {\n docs[path].split('\\n').forEach((text, i) => {\n if (!text.toLowerCase().includes(needle)) return;\n if (rows.length >= MAX_SEARCH_LINES) {\n truncated = true;\n return;\n }\n rows.push({ path, line: i + 1, raw: text.slice(0, MAX_RAW_LINE_CHARS) });\n });\n });\n return groupRows(rows, q, truncated);\n}\n\n/** Files whose name or path contains the query: names that match first, then shorter paths. */\nexport function matchFileNames(files: readonly string[], query: string): string[] {\n const q = normalizeQuery(query)?.toLowerCase();\n if (!q) return [];\n const scored: Array<{ path: string; score: number }> = [];\n for (const path of files) {\n const lower = path.toLowerCase();\n if (lower.includes(q)) {\n const base = lower.slice(lower.lastIndexOf('/') + 1);\n let rank = 2;\n if (base.startsWith(q)) rank = 0;\n else if (base.includes(q)) rank = 1;\n scored.push({ path, score: rank * 1000 + path.length });\n }\n }\n return scored\n .sort((a, b) => a.score - b.score || a.path.localeCompare(b.path))\n .slice(0, MAX_NAME_MATCHES)\n .map((s) => s.path);\n}\n\n// ── Saved code (the backup repo, when the sandbox is gone) ─────────────────\n\nexport interface FromRepo {\n /** The project name the backup repo was made for (the connector adds `<userId>-`). */\n projectName: string;\n}\n\n/**\n * `fromRepo` for the saved code (web `savedCodeSource`): the published name or address,\n * else the backup repo recorded on the project (retention `backupRepo`). The proxy swaps\n * in the repo recorded on the channel - it never trusts the name - so this only has to\n * say \"read the saved code\". Null when none is known.\n */\nexport function savedCodeSource(opts: {\n backupRepo?: string | null;\n publishProjectName?: string | null;\n liveUrl?: string | null;\n}): FromRepo | null {\n const published = String(opts.publishProjectName || '').trim() || siteProjectName(opts.liveUrl);\n if (published) return { projectName: published };\n const repo = String(opts.backupRepo || '').trim();\n const name = repo.split('/').filter(Boolean).pop() || '';\n return name ? { projectName: name } : null;\n}\n\n/** A read answered from the backup repo (`readOnly` / `sandboxGone` / `source:\"repo\"`). */\nexport function isSavedCodeRead(data: unknown): boolean {\n if (!data || typeof data !== 'object') return false;\n const d = data as Record<string, unknown>;\n return d.readOnly === true || d.sandboxGone === true || d.source === 'repo';\n}\n\n/** The live listing failed because the sandbox is not there (switch to the saved code). */\nexport function isSandboxUnavailableError(message: string | null | undefined): boolean {\n return /sandbox not found|not found \\(404\\)|no sandbox|does not exist|sandbox.*(paused|expired|killed)|not running anymore|timed? ?out|ETIMEDOUT|\\b502\\b/i.test(\n String(message || ''),\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBO,MAAM,kBAAqB,GAAA;AAE3B,MAAM,mBAAsB,GAAA;AAC5B,MAAM,cAAiB,GAAA;AAC9B,MAAM,SAAA,uBAAgB,GAAI,CAAA,CAAC,gBAAgB,MAAQ,EAAA,MAAA,EAAQ,SAAS,CAAC,CAAA;AAG9D,SAAS,eAAe,IAAuB,EAAA;AACpD,EAAM,MAAA,CAAA,GAAI,KAAK,IAAK,EAAA;AACpB,EAAI,IAAA,CAAC,CAAK,IAAA,CAAA,CAAE,QAAS,CAAA,IAAI,KAAK,CAAE,CAAA,UAAA,CAAW,GAAG,CAAA,EAAU,OAAA,KAAA;AACxD,EAAM,MAAA,QAAA,GAAW,CAAE,CAAA,KAAA,CAAM,GAAG,CAAA;AAC5B,EAAI,IAAA,QAAA,CAAS,IAAK,CAAA,CAAA,CAAA,KAAK,CAAM,KAAA,EAAA,IAAM,MAAM,GAAO,IAAA,CAAA,KAAM,IAAI,CAAA,EAAU,OAAA,KAAA;AACpE,EAAI,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AAO,CAAA;AAC9F,EAAA,IAAI,WAAkB,OAAA;AAAA,IACpB,WAAa,EAAA;AAAA,GACf;AACA,EAAA,MAAM,OAAO,MAAO,CAAA,IAAA,CAAK,UAAc,IAAA,EAAE,EAAE,IAAK,EAAA;AAChD,EAAM,MAAA,IAAA,GAAO,KAAK,KAAM,CAAA,GAAG,EAAE,MAAO,CAAA,OAAO,CAAE,CAAA,GAAA,EAAS,IAAA,EAAA;AACtD,EAAA,OAAO,IAAO,GAAA;AAAA,IACZ,WAAa,EAAA;AAAA,GACX,GAAA,IAAA;AACN;AAGO,SAAS,gBAAgB,IAAwB,EAAA;AACtD,EAAA,IAAI,CAAC,IAAA,IAAQ,OAAO,IAAA,KAAS,UAAiB,OAAA,KAAA;AAC9C,EAAA,MAAM,CAAI,GAAA,IAAA;AACV,EAAA,OAAO,EAAE,QAAa,KAAA,IAAA,IAAQ,EAAE,WAAgB,KAAA,IAAA,IAAQ,EAAE,MAAW,KAAA,MAAA;AACvE;AAGO,SAAS,0BAA0B,OAA6C,EAAA;AACrF,EAAA,OAAO,mJAAoJ,CAAA,IAAA,CAAK,MAAO,CAAA,OAAA,IAAW,EAAE,CAAC,CAAA;AACvL"}
1
+ {"version":3,"file":"codeFiles.js","sources":["../../../src/features/webbuilder/codeFiles.ts"],"sourcesContent":["/**\n * The Code view's rules, ported from the web surface (`code/codeFiles.ts`,\n * `code/codeSearch.ts`, `code/savedCode.ts`). Pure: the host runs the commands.\n *\n * - The file tree is a `WEBBUILDER_RUN_COMMAND` listing (`git ls-files` plus\n * untracked, non-ignored files; `find` without a repo), never node_modules,\n * .git, dist, .output or any .env* file.\n * - A file opens editable, read-only (over 1 MB) or as \"can't show\" (binary).\n * - Before a save the file is read again: if it changed on disk since it was\n * opened, the person chooses Overwrite or Reload.\n * - Search is one capped, read-only, case-insensitive `git grep`.\n * - Without a sandbox the code comes from the backup repo (`fromRepo`), read-only.\n */\nimport { siteProjectName } from './siteAddress';\n\n/** Files over this size open read-only. */\nexport const MAX_EDITABLE_BYTES = 1_048_576;\n/** READ_FILE's own cap (2 MB). */\nexport const READ_FILE_MAX_BYTES = 2_097_152;\nexport const MAX_TREE_FILES = 2000;\n\nconst SKIP_DIRS = new Set(['node_modules', '.git', 'dist', '.output']);\n\n/** True for a path that may appear in the tree (and be read or written by the editor). */\nexport function isListablePath(path: string): boolean {\n const p = path.trim();\n if (!p || p.includes('\\0') || p.startsWith('/')) return false;\n const segments = p.split('/');\n if (segments.some((s) => s === '' || s === '.' || s === '..')) return false;\n if (segments.some((s) => SKIP_DIRS.has(s))) return false;\n return !segments.some((s) => s.startsWith('.env'));\n}\n\n/** Normalised relative path for READ/WRITE, or null when it isn't allowed. */\nexport function normalizeEditorPath(path: string | null | undefined): string | null {\n const p = (path || '')\n .trim()\n .replace(/\\\\/g, '/')\n .replace(/^(\\.\\/)+/, '');\n return isListablePath(p) ? p : null;\n}\n\nconst TREE_EXCLUDE =\n \"':!node_modules' ':!**/node_modules/**' ':!dist' ':!**/dist/**' ':!.output' ':!.env*' ':!**/.env*'\";\n\n/** RUN_COMMAND script (project folder): one path per line between markers. */\nexport function buildListFilesCommand(): string {\n return [\n 'echo \"__FILES_BEGIN\"',\n 'if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then',\n ` git -c core.quotepath=off ls-files --cached --others --exclude-standard -- . ${TREE_EXCLUDE} 2>/dev/null | head -n ${MAX_TREE_FILES + 1}`,\n 'else',\n ` find . -type d \\\\( -name node_modules -o -name .git -o -name dist -o -name .output \\\\) -prune -o -type f ! -name '.env*' -print 2>/dev/null | sed 's|^\\\\./||' | head -n ${MAX_TREE_FILES + 1}`,\n 'fi',\n 'echo \"__FILES_END\"',\n 'exit 0',\n ].join('\\n');\n}\n\nexport interface FileTree {\n files: string[];\n /** More files exist than are shown. */\n partial: boolean;\n}\n\n/** Folders first, then files, case-insensitive - the order a file tree shows. */\nexport function sortTree(paths: string[]): string[] {\n return [...paths].sort((a, b) => {\n const pa = a.split('/');\n const pb = b.split('/');\n const n = Math.min(pa.length, pb.length);\n for (let i = 0; i < n; i += 1) {\n if (pa[i] !== pb[i]) {\n const aDir = i < pa.length - 1;\n const bDir = i < pb.length - 1;\n if (aDir !== bDir) return aDir ? -1 : 1;\n return pa[i].localeCompare(pb[i], undefined, { sensitivity: 'base' }) || (pa[i] < pb[i] ? -1 : 1);\n }\n }\n return pa.length - pb.length;\n });\n}\n\nfunction betweenMarkers(stdout: string, begin: string, end: string): { lines: string[]; cut: boolean } | null {\n const text = String(stdout || '');\n const at = text.indexOf(begin);\n if (at < 0) return null;\n const endIdx = text.indexOf(end, at);\n const lines = text\n .slice(at + begin.length, endIdx < 0 ? undefined : endIdx)\n .split('\\n')\n .map((l) => l.replace(/\\r$/, ''));\n // Output cut off mid-line: the last line may be partial.\n if (endIdx < 0) lines.pop();\n return { lines, cut: endIdx < 0 };\n}\n\nexport function parseListFilesOutput(stdout: string, opts?: { truncated?: boolean }): FileTree | null {\n const body = betweenMarkers(stdout, '__FILES_BEGIN', '__FILES_END');\n if (!body) return null;\n const seen = new Set<string>();\n for (const line of body.lines) {\n const p = normalizeEditorPath(line);\n if (p) seen.add(p);\n }\n const all = sortTree([...seen]);\n return {\n files: all.slice(0, MAX_TREE_FILES),\n partial: body.cut || Boolean(opts?.truncated) || all.length > MAX_TREE_FILES,\n };\n}\n\n/** LIST_FILES `{source, files, truncated}` (the saved code) as a file tree, same filters. */\nexport function parseListFilesResult(data: unknown): FileTree | null {\n if (!data || typeof data !== 'object') return null;\n const d = data as Record<string, unknown>;\n if (!Array.isArray(d.files)) return null;\n const seen = new Set<string>();\n for (const f of d.files) {\n const p = typeof f === 'string' ? normalizeEditorPath(f) : null;\n if (p) seen.add(p);\n }\n const all = sortTree([...seen]);\n return { files: all.slice(0, MAX_TREE_FILES), partial: d.truncated === true || all.length > MAX_TREE_FILES };\n}\n\n/** Default file to open: the app entry when present. */\nexport function preferredFile(paths: string[]): string {\n const preferred = [\n 'src/App.tsx',\n 'src/App.jsx',\n 'src/main.tsx',\n 'src/main.jsx',\n 'app/page.tsx',\n 'pages/index.tsx',\n 'index.html',\n 'package.json',\n ];\n return preferred.find((p) => paths.includes(p)) || paths[0] || '';\n}\n\nconst BINARY_EXT =\n /\\.(png|jpe?g|gif|webp|avif|ico|bmp|tiff?|psd|woff2?|ttf|otf|eot|mp3|mp4|m4a|wav|ogg|webm|mov|avi|zip|gz|tgz|bz2|xz|7z|rar|tar|pdf|wasm|exe|dll|so|dylib|bin|class|jar|sqlite|db|lockb)$/i;\n\nexport function isBinaryPath(path: string): boolean {\n return BINARY_EXT.test(path);\n}\n\nexport type OpenMode =\n | { kind: 'edit' }\n | { kind: 'readonly'; reason: 'large' }\n | { kind: 'binary' }\n | { kind: 'error'; message: string };\n\n/** How a READ_FILE result opens. */\nexport function openModeFor(path: string, data: Record<string, unknown>): OpenMode {\n if (isBinaryPath(path) || data.binary === true || data.encoding === 'base64') return { kind: 'binary' };\n if (typeof data.content !== 'string') return { kind: 'error', message: 'The file came back empty.' };\n const size = typeof data.size === 'number' ? data.size : data.content.length;\n if (data.truncated === true || size > MAX_EDITABLE_BYTES) return { kind: 'readonly', reason: 'large' };\n return { kind: 'edit' };\n}\n\nexport type SaveDecision = 'write' | 'unchanged' | 'conflict' | 'missing';\n\n/**\n * Before writing: `base` is what was loaded, `disk` what is on disk now (null =\n * gone), `draft` the edited text. A file changed on disk since it was opened is\n * a conflict (the person chooses: overwrite or reload).\n */\nexport function decideSave(base: string, disk: string | null, draft: string): SaveDecision {\n if (disk === null) return 'missing';\n if (disk !== base) return disk === draft ? 'unchanged' : 'conflict';\n return draft === base ? 'unchanged' : 'write';\n}\n\n/** Changed line counts (common prefix/suffix trimmed - cheap and good enough for a summary). */\nexport function lineDelta(before: string, after: string): { added: number; removed: number } {\n const a = before.split('\\n');\n const b = after.split('\\n');\n let start = 0;\n while (start < a.length && start < b.length && a[start] === b[start]) start += 1;\n let endA = a.length - 1;\n let endB = b.length - 1;\n while (endA >= start && endB >= start && a[endA] === b[endB]) {\n endA -= 1;\n endB -= 1;\n }\n return { removed: Math.max(0, endA - start + 1), added: Math.max(0, endB - start + 1) };\n}\n\n/** The hand-edit summary for a file saved from the Code view. */\nexport function codeEditSummary(before: string, after: string): string {\n const { added, removed } = lineDelta(before, after);\n const parts: string[] = [];\n if (added) parts.push(`+${added}`);\n if (removed) parts.push(`-${removed}`);\n return `edited in the code view (${parts.join(' / ') || 'whitespace'} lines)`;\n}\n\n/** The note the next agent turn carries, so it keeps hand edits (web `agentTurnNotes`). */\nexport function handEditsNote(edits: ReadonlyArray<{ file: string; summary: string }>): string {\n if (!edits.length) return '';\n return `[Hand edits] The user already changed these by hand (keep them): ${edits\n .map((m) => `${m.file}: ${m.summary}`)\n .join('; ')}.`;\n}\n\n// ── Search ─────────────────────────────────────────────────────────────────\n\nexport const MIN_SEARCH_CHARS = 2;\nexport const MAX_SEARCH_CHARS = 200;\nexport const MAX_SEARCH_LINES = 400;\nconst MAX_RAW_LINE_CHARS = 400;\nconst PREVIEW_CHARS = 160;\nconst MAX_NAME_MATCHES = 50;\n\nexport interface SearchMatch {\n line: number;\n /** The preview text (whitespace trimmed, long lines cut around the first match). */\n text: string;\n /** [start, end) offsets of the query in `text`. */\n ranges: Array<[number, number]>;\n}\n\nexport interface ContentSearchResult {\n files: Array<{ path: string; matches: SearchMatch[] }>;\n total: number;\n /** More matches exist than are shown. */\n truncated: boolean;\n}\n\n/** The query as searched: one line, trimmed, bounded; null when too short. */\nexport function normalizeQuery(query: string): string | null {\n const q = String(query || '')\n .replace(/[\\r\\n\\0]+/g, ' ')\n .trim()\n .slice(0, MAX_SEARCH_CHARS);\n return q.length >= MIN_SEARCH_CHARS ? q : null;\n}\n\n/** POSIX single-quoting: safe for any text. */\nexport function shellQuote(s: string): string {\n return `'${s.replace(/'/g, `'\\\\''`)}'`;\n}\n\n/** RUN_COMMAND script: fixed-string, case-insensitive, text files only, the tree's exclusions, capped. */\nexport function buildSearchCommand(query: string): string {\n const q = normalizeQuery(query);\n if (!q) throw new Error('query too short');\n const pattern = shellQuote(q);\n const exclude = `${TREE_EXCLUDE} ':!**/.output/**'`;\n const cap = `cut -c1-${MAX_RAW_LINE_CHARS} | head -n ${MAX_SEARCH_LINES + 1}`;\n return [\n 'echo \"__GREP_BEGIN\"',\n 'if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then',\n ` git -c core.quotepath=off grep --untracked -n -I -i -F --no-color -e ${pattern} -- . ${exclude} 2>/dev/null | ${cap}`,\n 'else',\n ` grep -rnIiF --exclude-dir=node_modules --exclude-dir=.git --exclude-dir=dist --exclude-dir=.output --exclude='.env*' -e ${pattern} . 2>/dev/null | sed 's|^\\\\./||' | ${cap}`,\n 'fi',\n 'echo \"__GREP_END\"',\n 'exit 0',\n ].join('\\n');\n}\n\n/** Case-insensitive offsets of `query` in `text`. */\nexport function matchRanges(text: string, query: string): Array<[number, number]> {\n const q = query.toLowerCase();\n if (!q) return [];\n const hay = text.toLowerCase();\n const out: Array<[number, number]> = [];\n let at = hay.indexOf(q);\n while (at >= 0 && out.length < 20) {\n out.push([at, at + q.length]);\n at = hay.indexOf(q, at + q.length);\n }\n return out;\n}\n\nfunction previewLine(raw: string, query: string): Omit<SearchMatch, 'line'> {\n let text = raw.replace(/\\t/g, ' ').replace(/\\s+$/, '');\n text = text.slice(text.length - text.trimStart().length);\n if (text.length > PREVIEW_CHARS) {\n const first = text.toLowerCase().indexOf(query.toLowerCase());\n const start = first > PREVIEW_CHARS / 3 ? first - Math.floor(PREVIEW_CHARS / 3) : 0;\n text = `${start > 0 ? '…' : ''}${text.slice(start, start + PREVIEW_CHARS)}${start + PREVIEW_CHARS < text.length ? '…' : ''}`;\n }\n return { text, ranges: matchRanges(text, query) };\n}\n\nfunction groupRows(\n rows: Array<{ path: string; line: number; raw: string }>,\n query: string,\n truncated: boolean,\n): ContentSearchResult {\n const byPath = new Map<string, SearchMatch[]>();\n for (const r of rows) {\n const list = byPath.get(r.path) ?? [];\n list.push({ line: r.line, ...previewLine(r.raw, query) });\n byPath.set(r.path, list);\n }\n return { files: [...byPath].map(([path, matches]) => ({ path, matches })), total: rows.length, truncated };\n}\n\nconst GREP_LINE = /^(.+?):(\\d+):(.*)$/;\n\n/** The search command's output (`path:line:text`); null when the markers are missing. */\nexport function parseSearchOutput(\n stdout: string,\n query: string,\n opts?: { truncated?: boolean },\n): ContentSearchResult | null {\n const body = betweenMarkers(stdout, '__GREP_BEGIN', '__GREP_END');\n if (!body) return null;\n const rows: Array<{ path: string; line: number; raw: string }> = [];\n for (const l of body.lines) {\n const m = GREP_LINE.exec(l);\n const path = m ? m[1].replace(/^\\.\\//, '') : '';\n if (m && isListablePath(path)) rows.push({ path, line: Number(m[2]), raw: m[3] });\n }\n const truncated = body.cut || Boolean(opts?.truncated) || rows.length > MAX_SEARCH_LINES;\n return groupRows(rows.slice(0, MAX_SEARCH_LINES), query, truncated);\n}\n\n/** Search contents already in memory (open files, drafts) when the project can't be searched. */\nexport function searchDocs(docs: Record<string, string>, query: string): ContentSearchResult {\n const q = normalizeQuery(query);\n if (!q) return { files: [], total: 0, truncated: false };\n const needle = q.toLowerCase();\n const rows: Array<{ path: string; line: number; raw: string }> = [];\n let truncated = false;\n Object.keys(docs)\n .sort()\n .filter(isListablePath)\n .forEach((path) => {\n docs[path].split('\\n').forEach((text, i) => {\n if (!text.toLowerCase().includes(needle)) return;\n if (rows.length >= MAX_SEARCH_LINES) {\n truncated = true;\n return;\n }\n rows.push({ path, line: i + 1, raw: text.slice(0, MAX_RAW_LINE_CHARS) });\n });\n });\n return groupRows(rows, q, truncated);\n}\n\n/** Files whose name or path contains the query: names that match first, then shorter paths. */\nexport function matchFileNames(files: readonly string[], query: string): string[] {\n const q = normalizeQuery(query)?.toLowerCase();\n if (!q) return [];\n const scored: Array<{ path: string; score: number }> = [];\n for (const path of files) {\n const lower = path.toLowerCase();\n if (lower.includes(q)) {\n const base = lower.slice(lower.lastIndexOf('/') + 1);\n let rank = 2;\n if (base.startsWith(q)) rank = 0;\n else if (base.includes(q)) rank = 1;\n scored.push({ path, score: rank * 1000 + path.length });\n }\n }\n return scored\n .sort((a, b) => a.score - b.score || a.path.localeCompare(b.path))\n .slice(0, MAX_NAME_MATCHES)\n .map((s) => s.path);\n}\n\n// ── Saved code (the backup repo, when the sandbox is gone) ─────────────────\n\nexport interface FromRepo {\n /** The project name the backup repo was made for (the connector adds `<userId>-`). */\n projectName: string;\n}\n\n/**\n * `fromRepo` for the saved code (web `savedCodeSource`): the published name or address,\n * else the backup repo recorded on the project (retention `backupRepo`). The proxy swaps\n * in the repo recorded on the channel - it never trusts the name - so this only has to\n * say \"read the saved code\". Null when none is known.\n */\nexport function savedCodeSource(opts: {\n backupRepo?: string | null;\n publishProjectName?: string | null;\n liveUrl?: string | null;\n}): FromRepo | null {\n const published = String(opts.publishProjectName || '').trim() || siteProjectName(opts.liveUrl);\n if (published) return { projectName: published };\n const repo = String(opts.backupRepo || '').trim();\n const name = repo.split('/').filter(Boolean).pop() || '';\n return name ? { projectName: name } : null;\n}\n\n/** A read answered from the backup repo (`readOnly` / `sandboxGone` / `source:\"repo\"`). */\nexport function isSavedCodeRead(data: unknown): boolean {\n if (!data || typeof data !== 'object') return false;\n const d = data as Record<string, unknown>;\n return d.readOnly === true || d.sandboxGone === true || d.source === 'repo';\n}\n\n/** The live listing failed because the sandbox is not there (switch to the saved code). */\nexport function isSandboxUnavailableError(message: string | null | undefined): boolean {\n return /sandbox not found|not found \\(404\\)|no sandbox|does not exist|sandbox.*(paused|expired|killed)|not running anymore|timed? ?out|ETIMEDOUT|\\b502\\b/i.test(\n String(message || ''),\n );\n}\n\n/** What the Code view says when it has no files to list: why, and what to do instead (web `codeUnavailableText`). */\nexport function codeUnavailableText(opts: { agentBuild: boolean; busy: boolean; openUrl?: string | null }): string {\n if (opts.busy) return 'The AI is still building this site. Its files show here once the build is saved.';\n const open = opts.openUrl ? ` You can also open the live preview: ${opts.openUrl}` : '';\n if (opts.agentBuild) {\n return `This build's workspace isn't running and there is no saved copy of its files yet, so they can't be opened here. Ask in the chat to bring it back or change anything.${open}`;\n }\n return `The code for this build isn't available here.${open}`;\n}\n\n/** A listing failure as one plain sentence: connector plumbing, tags and stack frames are not for people. */\nexport function listErrorText(error: string | null | undefined): string {\n const first = String(error ?? '')\n .split('\\n')[0]\n .replace(/\\s*\\[[A-Z][A-Z0-9_]*(?:;[^\\]]*)?\\]\\s*$/, '')\n .trim();\n if (!first || /^at\\s/.test(first)) return 'Could not list the project files.';\n if (/no connector result|connector (?:is )?(?:not|un)available|remote connector|cdecli/i.test(first)) {\n return \"The build service didn't answer. Try again in a moment.\";\n }\n const text = first.length > 200 ? `${first.slice(0, 199)}…` : first;\n return /[.!?…]$/.test(text) ? text : `${text}.`;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAgBO,MAAM,kBAAqB,GAAA;AAE3B,MAAM,mBAAsB,GAAA;AAC5B,MAAM,cAAiB,GAAA;AAC9B,MAAM,SAAA,uBAAgB,GAAI,CAAA,CAAC,gBAAgB,MAAQ,EAAA,MAAA,EAAQ,SAAS,CAAC,CAAA;AAG9D,SAAS,eAAe,IAAuB,EAAA;AACpD,EAAM,MAAA,CAAA,GAAI,KAAK,IAAK,EAAA;AACpB,EAAI,IAAA,CAAC,CAAK,IAAA,CAAA,CAAE,QAAS,CAAA,IAAI,KAAK,CAAE,CAAA,UAAA,CAAW,GAAG,CAAA,EAAU,OAAA,KAAA;AACxD,EAAM,MAAA,QAAA,GAAW,CAAE,CAAA,KAAA,CAAM,GAAG,CAAA;AAC5B,EAAI,IAAA,QAAA,CAAS,IAAK,CAAA,CAAA,CAAA,KAAK,CAAM,KAAA,EAAA,IAAM,MAAM,GAAO,IAAA,CAAA,KAAM,IAAI,CAAA,EAAU,OAAA,KAAA;AACpE,EAAI,IAAA,QAAA,CAAS,KAAK,CAAK,CAAA,KAAA,SAAA,CAAU,IAAI,CAAC,CAAC,GAAU,OAAA,KAAA;AACjD,EAAA,OAAO,CAAC,QAAS,C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AAA,KAAK,GAAU,OAAA,mCAAA;AAC1C,EAAI,IAAA,oFAAA,CAAqF,IAAK,CAAA,KAAK,CAAG,EAAA;AACpG,IAAO,OAAA,yDAAA;AAAA;AAET,EAAM,MAAA,IAAA,GAAO,KAAM,CAAA,MAAA,GAAS,GAAM,GAAA,CAAA,EAAG,MAAM,KAAM,CAAA,CAAA,EAAG,GAAG,CAAC,CAAM,MAAA,CAAA,GAAA,KAAA;AAC9D,EAAA,OAAO,UAAU,IAAK,CAAA,IAAI,CAAI,GAAA,IAAA,GAAO,GAAG,IAAI,CAAA,CAAA,CAAA;AAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomTabs.js","sources":["../../../../src/features/webbuilder/components/BottomTabs.tsx"],"sourcesContent":["/**\n * Web Builder's two places - Create and Projects - as the Lovable app shows\n * them: an icon-only pill floating over the content, the current place on a\n * soft capsule. Labels stay for screen readers.\n */\nimport React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport { MaterialCommunityIcons } from '@expo/vector-icons';\nimport { Tap } from '../../inbox/components/Tap';\nimport type { WebBuilderTheme } from '../webbuilderTheme';\nimport type { IconName } from './ui';\n\nexport type HomeTab = 'create' | 'projects';\n\n/** Height the pill takes over the content, for the screens' bottom padding. */\nexport const BOTTOM_TABS_SPACE = 92;\n\nconst TABS: Array<{ id: HomeTab; label: string; icon: IconName; iconActive: IconName }> = [\n { id: 'create', label: 'Create', icon: 'home-outline', iconActive: 'home' },\n { id: 'projects', label: 'Projects', icon: 'view-grid-outline', iconActive: 'view-grid' },\n];\n\nexport function BottomTabs({\n tab,\n onTab,\n theme,\n bottomInset,\n}: {\n tab: HomeTab;\n onTab: (tab: HomeTab) => void;\n theme: WebBuilderTheme;\n bottomInset: number;\n}) {\n return (\n <View pointerEvents=\"box-none\" style={[styles.dock, { bottom: Math.max(bottomInset, 12) }]}>\n <View\n style={[\n styles.pill,\n {\n backgroundColor: theme.card,\n borderColor: theme.border,\n shadowColor: theme.isDark ? '#000' : '#1c1917',\n },\n ]}\n accessibilityRole=\"tablist\"\n >\n {TABS.map((t) => {\n const active = t.id === tab;\n return (\n <Tap\n key={t.id}\n onPress={() => onTab(t.id)}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: active }}\n accessibilityLabel={t.label}\n style={[styles.tab, active && { backgroundColor: theme.accent }]}\n pressedStyle={styles.pressed}\n testID={`webbuilder-tab-${t.id}`}\n >\n <MaterialCommunityIcons\n name={active ? t.iconActive : t.icon}\n size={25}\n color={active ? theme.accentInk : theme.muted}\n />\n </Tap>\n );\n })}\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n dock: { position: 'absolute', left: 0, right: 0, alignItems: 'center' },\n pill: {\n flexDirection: 'row',\n gap: 6,\n padding: 6,\n borderRadius: 999,\n borderWidth: StyleSheet.hairlineWidth,\n shadowOpacity: 0.12,\n shadowRadius: 20,\n shadowOffset: { width: 0, height: 8 },\n elevation: 8,\n },\n tab: { width: 88, height: 52, borderRadius: 999, alignItems: 'center', justifyContent: 'center' },\n pressed: { opacity: 0.6 },\n});\n"],"names":[],"mappings":"uLAcO,MAAM,iBAAoB,GAAA;AACjC,MAAM,OAKD,CAAC;AAAA,EACJ,EAAI,EAAA,QAAA;AAAA,EACJ,KAAO,EAAA,QAAA;AAAA,EACP,IAAM,EAAA,cAAA;AAAA,EACN,UAAY,EAAA;AACd,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,UAAA;AAAA,EACJ,KAAO,EAAA,UAAA;AAAA,EACP,IAAM,EAAA,mBAAA;AAAA,EACN,UAAY,EAAA;AACd,CAAC,CAAA;AACM,SAAS,UAAW,CAAA;AAAA,EACzB,GAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAKG,EAAA;AACD,EAAA,2BAAQ,IAAK,EAAA,EAAA,aAAA,EAAc,YAAW,KAAO,EAAA,CAAC,OAAO,IAAM,EAAA;AAAA,IACzD,MAAQ,EAAA,IAAA,CAAK,GAAI,CAAA,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AAA,CAAA;AAAA,IACN,KAAO,EAAA,CAAA;AAAA,IACP,UAAY,EAAA;AAAA,GACd;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,aAAe,EAAA,KAAA;AAAA,IACf,GAAK,EAAA,CAAA;AAAA,IACL,OAAS,EAAA,CAAA;AAAA,IACT,YAAc,EAAA,GAAA;AAAA,IACd,aAAa,UAAW,CAAA,aAAA;AAAA,IACxB,aAAe,EAAA,IAAA;AAAA,IACf,YAAc,EAAA,EAAA;AAAA,IACd,YAAc,EAAA;AAAA,MACZ,KAAO,EAAA,CAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,SAAW,EAAA;AAAA,GACb;AAAA,EACA,GAAK,EAAA;AAAA,IACH,KAAO,EAAA,EAAA;AAAA,IACP,MAAQ,EAAA,EAAA;AAAA,IACR,YAAc,EAAA,GAAA;AAAA,IACd,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA;AAAA;AAEb,CAAC,CAAA"}
1
+ {"version":3,"file":"BottomTabs.js","sources":["../../../../src/features/webbuilder/components/BottomTabs.tsx"],"sourcesContent":["/**\n * Web Builder's two places - Create and Projects - as app builders show\n * them: an icon-only pill floating over the content, the current place on a\n * soft capsule. Labels stay for screen readers.\n */\nimport React from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport { MaterialCommunityIcons } from '@expo/vector-icons';\nimport { Tap } from '../../inbox/components/Tap';\nimport type { WebBuilderTheme } from '../webbuilderTheme';\nimport type { IconName } from './ui';\n\nexport type HomeTab = 'create' | 'projects';\n\n/** Height the pill takes over the content, for the screens' bottom padding. */\nexport const BOTTOM_TABS_SPACE = 92;\n\nconst TABS: Array<{ id: HomeTab; label: string; icon: IconName; iconActive: IconName }> = [\n { id: 'create', label: 'Create', icon: 'home-outline', iconActive: 'home' },\n { id: 'projects', label: 'Projects', icon: 'view-grid-outline', iconActive: 'view-grid' },\n];\n\nexport function BottomTabs({\n tab,\n onTab,\n theme,\n bottomInset,\n}: {\n tab: HomeTab;\n onTab: (tab: HomeTab) => void;\n theme: WebBuilderTheme;\n bottomInset: number;\n}) {\n return (\n <View pointerEvents=\"box-none\" style={[styles.dock, { bottom: Math.max(bottomInset, 12) }]}>\n <View\n style={[\n styles.pill,\n {\n backgroundColor: theme.card,\n borderColor: theme.border,\n shadowColor: theme.isDark ? '#000' : '#1c1917',\n },\n ]}\n accessibilityRole=\"tablist\"\n >\n {TABS.map((t) => {\n const active = t.id === tab;\n return (\n <Tap\n key={t.id}\n onPress={() => onTab(t.id)}\n accessibilityRole=\"tab\"\n accessibilityState={{ selected: active }}\n accessibilityLabel={t.label}\n style={[styles.tab, active && { backgroundColor: theme.accent }]}\n pressedStyle={styles.pressed}\n testID={`webbuilder-tab-${t.id}`}\n >\n <MaterialCommunityIcons\n name={active ? t.iconActive : t.icon}\n size={25}\n color={active ? theme.accentInk : theme.muted}\n />\n </Tap>\n );\n })}\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n dock: { position: 'absolute', left: 0, right: 0, alignItems: 'center' },\n pill: {\n flexDirection: 'row',\n gap: 6,\n padding: 6,\n borderRadius: 999,\n borderWidth: StyleSheet.hairlineWidth,\n shadowOpacity: 0.12,\n shadowRadius: 20,\n shadowOffset: { width: 0, height: 8 },\n elevation: 8,\n },\n tab: { width: 88, height: 52, borderRadius: 999, alignItems: 'center', justifyContent: 'center' },\n pressed: { opacity: 0.6 },\n});\n"],"names":[],"mappings":"uLAcO,MAAM,iBAAoB,GAAA;AACjC,MAAM,OAKD,CAAC;AAAA,EACJ,EAAI,EAAA,QAAA;AAAA,EACJ,KAAO,EAAA,QAAA;AAAA,EACP,IAAM,EAAA,cAAA;AAAA,EACN,UAAY,EAAA;AACd,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,UAAA;AAAA,EACJ,KAAO,EAAA,UAAA;AAAA,EACP,IAAM,EAAA,mBAAA;AAAA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