@adminide-stack/yantra-mobile 12.0.137 → 12.0.139-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/CustomDrawer.js +17 -1
- package/lib/components/CustomDrawer.js.map +1 -1
- package/lib/compute.js +106 -1
- package/lib/compute.js.map +1 -1
- package/lib/config/env-config.js +12 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/features/chat/ChatTranscript.js +2 -2
- package/lib/features/chat/ChatTranscript.js.map +1 -1
- package/lib/features/chat/surfaceNotes.js +4 -0
- package/lib/features/chat/surfaceNotes.js.map +1 -0
- package/lib/features/devices/readings.js.map +1 -1
- package/lib/features/devices/session.js +2 -22
- package/lib/features/devices/session.js.map +1 -1
- package/lib/features/dictate/backgroundRecording.js.map +1 -1
- package/lib/features/dictate/useDictationRecorder.js +42 -1
- package/lib/features/dictate/useDictationRecorder.js.map +1 -1
- package/lib/features/home/useHomeWeather.js +85 -0
- package/lib/features/home/useHomeWeather.js.map +1 -0
- package/lib/features/home/weather.js +139 -0
- package/lib/features/home/weather.js.map +1 -0
- package/lib/features/notion/NotionPageView.js +819 -0
- package/lib/features/notion/NotionPageView.js.map +1 -0
- package/lib/features/notion/NotionSheets.js +452 -0
- package/lib/features/notion/NotionSheets.js.map +1 -0
- package/lib/features/notion/NotionTrashSheet.js +415 -0
- package/lib/features/notion/NotionTrashSheet.js.map +1 -0
- package/lib/features/notion/NotionWorkspaceView.js +837 -0
- package/lib/features/notion/NotionWorkspaceView.js.map +1 -0
- package/lib/features/notion/notionBlocks.js +203 -0
- package/lib/features/notion/notionBlocks.js.map +1 -0
- package/lib/features/notion/notionDocuments.js +182 -0
- package/lib/features/notion/notionDocuments.js.map +1 -0
- package/lib/features/notion/notionEditorModel.js +180 -0
- package/lib/features/notion/notionEditorModel.js.map +1 -0
- package/lib/features/notion/notionTemplates.js +406 -0
- package/lib/features/notion/notionTemplates.js.map +1 -0
- package/lib/features/notion/notionTheme.js +34 -0
- package/lib/features/notion/notionTheme.js.map +1 -0
- package/lib/features/notion/notionTrash.js +100 -0
- package/lib/features/notion/notionTrash.js.map +1 -0
- package/lib/features/notion/notionUi.js +310 -0
- package/lib/features/notion/notionUi.js.map +1 -0
- package/lib/features/notion/useNotionWorkspace.js +181 -0
- package/lib/features/notion/useNotionWorkspace.js.map +1 -0
- package/lib/features/webbuilder/buildFragments.js +15 -9
- package/lib/features/webbuilder/buildFragments.js.map +1 -1
- package/lib/features/webbuilder/buildJob.js +3 -3
- package/lib/features/webbuilder/buildJob.js.map +1 -1
- package/lib/features/webbuilder/publicSandboxDomain.js +5 -0
- package/lib/features/webbuilder/publicSandboxDomain.js.map +1 -0
- package/lib/features/webbuilder/sandboxPublicHost.js +74 -0
- package/lib/features/webbuilder/sandboxPublicHost.js.map +1 -0
- package/lib/features/webbuilder/siteAddress.js +2 -1
- package/lib/features/webbuilder/siteAddress.js.map +1 -1
- package/lib/features/webbuilder/webbuilderPrompts.js +3 -2
- package/lib/features/webbuilder/webbuilderPrompts.js.map +1 -1
- package/lib/features/webbuilder/workflow.js +2 -2
- package/lib/features/webbuilder/workflow.js.map +1 -1
- package/lib/hooks/useChatApi.js +15 -3
- package/lib/hooks/useChatApi.js.map +1 -1
- package/lib/hooks/usePrerequisiteIds.js +15 -2
- package/lib/hooks/usePrerequisiteIds.js.map +1 -1
- package/lib/routes.json +107 -0
- package/lib/screens/Devices/index.js +3 -205
- package/lib/screens/Devices/index.js.map +1 -1
- package/lib/screens/Home/HomeScreen.js +20 -5
- package/lib/screens/Home/HomeScreen.js.map +1 -1
- package/lib/screens/Home/components/HomeHero.js +117 -0
- package/lib/screens/Home/components/HomeHero.js.map +1 -0
- package/lib/screens/Home/components/HomeSuggestions.js +108 -85
- package/lib/screens/Home/components/HomeSuggestions.js.map +1 -1
- package/lib/screens/Home/components/HomeWash.js +44 -0
- package/lib/screens/Home/components/HomeWash.js.map +1 -0
- package/lib/screens/Home/components/homeCatalog.js +125 -0
- package/lib/screens/Home/components/homeCatalog.js.map +1 -0
- package/lib/screens/Notion/index.js +18 -0
- package/lib/screens/Notion/index.js.map +1 -0
- package/lib/screens/NotionPage/index.js +19 -0
- package/lib/screens/NotionPage/index.js.map +1 -0
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js +2 -2
- package/lib/screens/WebBuilderNative/sandboxProxyApi.js.map +1 -1
- package/lib/screens/WebBuilderNative/useRestoredSandboxes.js +16 -8
- package/lib/screens/WebBuilderNative/useRestoredSandboxes.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js +6 -5
- package/lib/screens/WebBuilderNative/useWebBuilderGallery.js.map +1 -1
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js +5 -4
- package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
- package/lib/screens/WebBuilderNative/webbuilderTransport.js +4 -3
- package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
- package/lib/services/savedWorkspace.js +44 -0
- package/lib/services/savedWorkspace.js.map +1 -0
- package/lib/theme/mobileTokens.js +1 -0
- package/lib/theme/mobileTokens.js.map +1 -1
- package/package.json +4 -4
- package/lib/features/devices/bodyComposition.js +0 -116
- package/lib/features/devices/bodyComposition.js.map +0 -1
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import {useState,useEffect,useMemo,useCallback}from'react';import {useApolloClient,useQuery}from'@apollo/client/index.js';import {NATIVE_NOTION_WORKSPACES,NATIVE_NOTION_CHILDREN,NATIVE_NOTION_CREATE_WORKSPACE,NATIVE_NOTION_CREATE_BLOCK}from'./notionDocuments.js';import {livePagesByRecent,meetingRowOf,pageKindOf,toTitleProperty,meetingEmbedChild,newMeetingProperties}from'./notionBlocks.js';import {isTemplateLibrary,buildTemplateCreatePlan}from'./notionTemplates.js';var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var _a;
|
|
21
|
+
let AsyncStorage = null;
|
|
22
|
+
try {
|
|
23
|
+
AsyncStorage = (_a = require("@react-native-async-storage/async-storage").default) != null ? _a : null;
|
|
24
|
+
} catch (e) {
|
|
25
|
+
AsyncStorage = null;
|
|
26
|
+
}
|
|
27
|
+
const LAST_WORKSPACE_KEY = "yantra.notion.lastWorkspace.v1";
|
|
28
|
+
function useNotionWorkspace() {
|
|
29
|
+
var _a2, _b, _c;
|
|
30
|
+
const client = useApolloClient();
|
|
31
|
+
const [selectedId, setSelectedId] = useState(null);
|
|
32
|
+
const [remembered, setRemembered] = useState(void 0);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
var _a3;
|
|
35
|
+
let alive = true;
|
|
36
|
+
((_a3 = AsyncStorage == null ? void 0 : AsyncStorage.getItem(LAST_WORKSPACE_KEY)) != null ? _a3 : Promise.resolve(null)).catch(() => null).then((id) => alive && setRemembered(id || null));
|
|
37
|
+
return () => {
|
|
38
|
+
alive = false;
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
const workspacesQuery = useQuery(NATIVE_NOTION_WORKSPACES, {
|
|
42
|
+
fetchPolicy: "cache-and-network"
|
|
43
|
+
});
|
|
44
|
+
const workspaces = useMemo(() => {
|
|
45
|
+
var _a3, _b2;
|
|
46
|
+
return (_b2 = (_a3 = workspacesQuery.data) == null ? void 0 : _a3.listWorkspaces) != null ? _b2 : [];
|
|
47
|
+
}, [workspacesQuery.data]);
|
|
48
|
+
const workspace = useMemo(() => {
|
|
49
|
+
var _a3;
|
|
50
|
+
if (!workspaces.length) return null;
|
|
51
|
+
const wanted = selectedId != null ? selectedId : remembered;
|
|
52
|
+
return (_a3 = workspaces.find((w) => w.id === wanted)) != null ? _a3 : workspaces[0];
|
|
53
|
+
}, [workspaces, selectedId, remembered]);
|
|
54
|
+
const selectWorkspace = useCallback((id) => {
|
|
55
|
+
setSelectedId(id);
|
|
56
|
+
AsyncStorage == null ? void 0 : AsyncStorage.setItem(LAST_WORKSPACE_KEY, id).catch(() => void 0);
|
|
57
|
+
}, []);
|
|
58
|
+
const rootQuery = useQuery(NATIVE_NOTION_CHILDREN, {
|
|
59
|
+
variables: {
|
|
60
|
+
blockId: (_a2 = workspace == null ? void 0 : workspace.id) != null ? _a2 : "",
|
|
61
|
+
pageSize: 200
|
|
62
|
+
},
|
|
63
|
+
skip: !(workspace == null ? void 0 : workspace.id),
|
|
64
|
+
fetchPolicy: "cache-and-network"
|
|
65
|
+
});
|
|
66
|
+
const {
|
|
67
|
+
pages,
|
|
68
|
+
meetings,
|
|
69
|
+
templateLibraryId
|
|
70
|
+
} = useMemo(() => {
|
|
71
|
+
var _a3, _b2, _c2, _d, _e;
|
|
72
|
+
const roots = (_c2 = (_b2 = (_a3 = rootQuery.data) == null ? void 0 : _a3.getBlockChildren) == null ? void 0 : _b2.results) != null ? _c2 : [];
|
|
73
|
+
const live = livePagesByRecent(roots);
|
|
74
|
+
const now = Date.now();
|
|
75
|
+
return {
|
|
76
|
+
pages: live.filter((b) => pageKindOf(b.properties) === "page"),
|
|
77
|
+
meetings: live.map((b) => meetingRowOf(b, now)).filter((r) => Boolean(r)),
|
|
78
|
+
templateLibraryId: (_e = (_d = roots.find((b) => !b.inTrash && isTemplateLibrary(b.properties))) == null ? void 0 : _d.id) != null ? _e : null
|
|
79
|
+
};
|
|
80
|
+
}, [rootQuery.data]);
|
|
81
|
+
const refetchRoots = useCallback(() => {
|
|
82
|
+
rootQuery.refetch().catch(() => void 0);
|
|
83
|
+
}, [rootQuery]);
|
|
84
|
+
const createWorkspace = useCallback(async (name) => {
|
|
85
|
+
var _a3;
|
|
86
|
+
const res = await client.mutate({
|
|
87
|
+
mutation: NATIVE_NOTION_CREATE_WORKSPACE,
|
|
88
|
+
variables: {
|
|
89
|
+
input: {
|
|
90
|
+
name: name.trim() || "Untitled workspace",
|
|
91
|
+
icon: {
|
|
92
|
+
type: "emoji",
|
|
93
|
+
emoji: "\u{1F4D2}"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const created = (_a3 = res.data) == null ? void 0 : _a3.createWorkspace;
|
|
99
|
+
await workspacesQuery.refetch();
|
|
100
|
+
if (created == null ? void 0 : created.id) selectWorkspace(created.id);
|
|
101
|
+
return created != null ? created : null;
|
|
102
|
+
}, [client, selectWorkspace, workspacesQuery]);
|
|
103
|
+
const createRoot = useCallback(async (input) => {
|
|
104
|
+
var _a3, _b2;
|
|
105
|
+
if (!(workspace == null ? void 0 : workspace.id)) return null;
|
|
106
|
+
const res = await client.mutate({
|
|
107
|
+
mutation: NATIVE_NOTION_CREATE_BLOCK,
|
|
108
|
+
variables: {
|
|
109
|
+
input: __spreadProps(__spreadValues({}, input), {
|
|
110
|
+
parent: {
|
|
111
|
+
type: "workspace",
|
|
112
|
+
id: workspace.id
|
|
113
|
+
}
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
refetchRoots();
|
|
118
|
+
return (_b2 = (_a3 = res.data) == null ? void 0 : _a3.createBlock) != null ? _b2 : null;
|
|
119
|
+
}, [client, refetchRoots, workspace == null ? void 0 : workspace.id]);
|
|
120
|
+
const createPage = useCallback((title = "") => createRoot({
|
|
121
|
+
type: "page",
|
|
122
|
+
properties: {
|
|
123
|
+
title: toTitleProperty(title)
|
|
124
|
+
}
|
|
125
|
+
}), [createRoot]);
|
|
126
|
+
const createMeeting = useCallback(() => createRoot({
|
|
127
|
+
type: "page",
|
|
128
|
+
properties: newMeetingProperties(),
|
|
129
|
+
children: [meetingEmbedChild()]
|
|
130
|
+
}), [createRoot]);
|
|
131
|
+
const createFromTemplate = useCallback(async (template) => {
|
|
132
|
+
var _a3, _b2, _c2;
|
|
133
|
+
if (!(workspace == null ? void 0 : workspace.id)) return null;
|
|
134
|
+
const plan = buildTemplateCreatePlan(template, {
|
|
135
|
+
type: "workspace",
|
|
136
|
+
id: workspace.id
|
|
137
|
+
});
|
|
138
|
+
const res = await client.mutate({
|
|
139
|
+
mutation: NATIVE_NOTION_CREATE_BLOCK,
|
|
140
|
+
variables: {
|
|
141
|
+
input: plan.root
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
let failedRows = 0;
|
|
145
|
+
for (const row of plan.rows) {
|
|
146
|
+
try {
|
|
147
|
+
await client.mutate({
|
|
148
|
+
mutation: NATIVE_NOTION_CREATE_BLOCK,
|
|
149
|
+
variables: {
|
|
150
|
+
input: row
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
} catch (e) {
|
|
154
|
+
failedRows += 1;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
refetchRoots();
|
|
158
|
+
return {
|
|
159
|
+
id: String((_c2 = (_b2 = (_a3 = res.data) == null ? void 0 : _a3.createBlock) == null ? void 0 : _b2.id) != null ? _c2 : plan.rootId),
|
|
160
|
+
failedRows
|
|
161
|
+
};
|
|
162
|
+
}, [client, refetchRoots, workspace == null ? void 0 : workspace.id]);
|
|
163
|
+
const refresh = useCallback(async () => {
|
|
164
|
+
await Promise.all([workspacesQuery.refetch(), (workspace == null ? void 0 : workspace.id) ? rootQuery.refetch() : null]);
|
|
165
|
+
}, [rootQuery, workspace == null ? void 0 : workspace.id, workspacesQuery]);
|
|
166
|
+
return {
|
|
167
|
+
workspaces,
|
|
168
|
+
workspace,
|
|
169
|
+
selectWorkspace,
|
|
170
|
+
pages,
|
|
171
|
+
meetings,
|
|
172
|
+
templateLibraryId,
|
|
173
|
+
loading: workspacesQuery.loading && !workspacesQuery.data || rootQuery.loading && !rootQuery.data,
|
|
174
|
+
error: (_c = (_b = workspacesQuery.error) != null ? _b : rootQuery.error) != null ? _c : null,
|
|
175
|
+
createWorkspace,
|
|
176
|
+
createPage,
|
|
177
|
+
createMeeting,
|
|
178
|
+
createFromTemplate,
|
|
179
|
+
refresh
|
|
180
|
+
};
|
|
181
|
+
}export{useNotionWorkspace};//# sourceMappingURL=useNotionWorkspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNotionWorkspace.js","sources":["../../../src/features/notion/useNotionWorkspace.ts"],"sourcesContent":["/**\n * Workspace state for the native Notion surface - the web flow\n * (NotionWorkspaceFlow): list workspaces, pick the one used last (else the\n * first), load its root blocks and split them like the web sidebar (My pages,\n * Meetings, the hidden template library), create workspaces, pages, meetings\n * and pages from templates.\n */\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useApolloClient, useQuery } from '@apollo/client';\nimport {\n NATIVE_NOTION_CHILDREN,\n NATIVE_NOTION_CREATE_BLOCK,\n NATIVE_NOTION_CREATE_WORKSPACE,\n NATIVE_NOTION_WORKSPACES,\n} from './notionDocuments';\nimport {\n livePagesByRecent,\n meetingEmbedChild,\n meetingRowOf,\n newMeetingProperties,\n pageKindOf,\n toTitleProperty,\n type MeetingRow,\n type NotionBlock,\n type NotionWorkspace,\n} from './notionBlocks';\nimport { buildTemplateCreatePlan, isTemplateLibrary, type PageTemplate } from './notionTemplates';\n\ntype StorageLike = {\n getItem(key: string): Promise<string | null>;\n setItem(key: string, value: string): Promise<void>;\n};\n\nlet AsyncStorage: StorageLike | null = null;\ntry {\n // eslint-disable-next-line @typescript-eslint/no-var-requires, global-require\n AsyncStorage = require('@react-native-async-storage/async-storage').default ?? null;\n} catch {\n AsyncStorage = null;\n}\n\nconst LAST_WORKSPACE_KEY = 'yantra.notion.lastWorkspace.v1';\n\ntype CreatedBlock = { createBlock?: NotionBlock | null };\n\nexport function useNotionWorkspace() {\n const client = useApolloClient();\n const [selectedId, setSelectedId] = useState<string | null>(null);\n const [remembered, setRemembered] = useState<string | null | undefined>(undefined);\n\n useEffect(() => {\n let alive = true;\n (AsyncStorage?.getItem(LAST_WORKSPACE_KEY) ?? Promise.resolve(null))\n .catch(() => null)\n .then((id) => alive && setRemembered(id || null));\n return () => {\n alive = false;\n };\n }, []);\n\n const workspacesQuery = useQuery<{ listWorkspaces?: NotionWorkspace[] | null }>(NATIVE_NOTION_WORKSPACES, {\n fetchPolicy: 'cache-and-network',\n });\n const workspaces = useMemo(() => workspacesQuery.data?.listWorkspaces ?? [], [workspacesQuery.data]);\n\n const workspace = useMemo<NotionWorkspace | null>(() => {\n if (!workspaces.length) return null;\n const wanted = selectedId ?? remembered;\n return workspaces.find((w) => w.id === wanted) ?? workspaces[0];\n }, [workspaces, selectedId, remembered]);\n\n const selectWorkspace = useCallback((id: string) => {\n setSelectedId(id);\n AsyncStorage?.setItem(LAST_WORKSPACE_KEY, id).catch(() => undefined);\n }, []);\n\n const rootQuery = useQuery<{ getBlockChildren?: { results?: NotionBlock[] | null } | null }>(\n NATIVE_NOTION_CHILDREN,\n {\n variables: { blockId: workspace?.id ?? '', pageSize: 200 },\n skip: !workspace?.id,\n fetchPolicy: 'cache-and-network',\n },\n );\n\n const { pages, meetings, templateLibraryId } = useMemo(() => {\n const roots = rootQuery.data?.getBlockChildren?.results ?? [];\n const live = livePagesByRecent(roots);\n const now = Date.now();\n return {\n pages: live.filter((b) => pageKindOf(b.properties) === 'page'),\n meetings: live.map((b) => meetingRowOf(b, now)).filter((r): r is MeetingRow => Boolean(r)),\n templateLibraryId: roots.find((b) => !b.inTrash && isTemplateLibrary(b.properties))?.id ?? null,\n };\n }, [rootQuery.data]);\n\n const refetchRoots = useCallback(() => {\n rootQuery.refetch().catch(() => undefined);\n }, [rootQuery]);\n\n const createWorkspace = useCallback(\n async (name: string) => {\n const res = await client.mutate<{ createWorkspace?: NotionWorkspace | null }>({\n mutation: NATIVE_NOTION_CREATE_WORKSPACE,\n variables: {\n input: { name: name.trim() || 'Untitled workspace', icon: { type: 'emoji', emoji: '📒' } },\n },\n });\n const created = res.data?.createWorkspace;\n await workspacesQuery.refetch();\n if (created?.id) selectWorkspace(created.id);\n return created ?? null;\n },\n [client, selectWorkspace, workspacesQuery],\n );\n\n const createRoot = useCallback(\n async (input: Record<string, unknown>) => {\n if (!workspace?.id) return null;\n const res = await client.mutate<CreatedBlock>({\n mutation: NATIVE_NOTION_CREATE_BLOCK,\n variables: { input: { ...input, parent: { type: 'workspace', id: workspace.id } } },\n });\n refetchRoots();\n return res.data?.createBlock ?? null;\n },\n [client, refetchRoots, workspace?.id],\n );\n\n /** A new top-level page in the active workspace (web \"New page\"). */\n const createPage = useCallback(\n (title = '') => createRoot({ type: 'page', properties: { title: toTitleProperty(title) } }),\n [createRoot],\n );\n\n /** Web \"New meeting\": a meeting page with the meeting recorder widget inside. */\n const createMeeting = useCallback(\n () => createRoot({ type: 'page', properties: newMeetingProperties(), children: [meetingEmbedChild()] }),\n [createRoot],\n );\n\n /**\n * Web `createPageFromTemplate` (per-block path): one nested createBlock for the page,\n * then each database row parented to its database. Returns the new page id.\n */\n const createFromTemplate = useCallback(\n async (template: Pick<PageTemplate, 'root'>) => {\n if (!workspace?.id) return null;\n const plan = buildTemplateCreatePlan(template, { type: 'workspace', id: workspace.id });\n const res = await client.mutate<CreatedBlock>({\n mutation: NATIVE_NOTION_CREATE_BLOCK,\n variables: { input: plan.root },\n });\n let failedRows = 0;\n // Sequential on purpose: rows keep their template order.\n // eslint-disable-next-line no-restricted-syntax\n for (const row of plan.rows) {\n try {\n // eslint-disable-next-line no-await-in-loop\n await client.mutate({ mutation: NATIVE_NOTION_CREATE_BLOCK, variables: { input: row } });\n } catch {\n failedRows += 1;\n }\n }\n refetchRoots();\n return { id: String(res.data?.createBlock?.id ?? plan.rootId), failedRows };\n },\n [client, refetchRoots, workspace?.id],\n );\n\n const refresh = useCallback(async () => {\n await Promise.all([workspacesQuery.refetch(), workspace?.id ? rootQuery.refetch() : null]);\n }, [rootQuery, workspace?.id, workspacesQuery]);\n\n return {\n workspaces,\n workspace,\n selectWorkspace,\n pages,\n meetings,\n templateLibraryId,\n loading: (workspacesQuery.loading && !workspacesQuery.data) || (rootQuery.loading && !rootQuery.data),\n error: workspacesQuery.error ?? rootQuery.error ?? null,\n createWorkspace,\n createPage,\n createMeeting,\n createFromTemplate,\n refresh,\n };\n}\n\nexport type NotionWorkspaceState = ReturnType<typeof useNotionWorkspace>;\n"],"names":["_a","_b","_c"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAA,EAAA;AAgBA,IAAI,YAAmC,GAAA,IAAA;AACvC,IAAI;AAEF,EAAA,YAAA,GAAA,CAAe,EAAQ,GAAA,OAAA,CAAA,2CAA2C,CAAE,CAAA,OAAA,KAArD,IAAgE,GAAA,EAAA,GAAA,IAAA;AACjF,CAAQ,CAAA,OAAA,CAAA,EAAA;AACN,EAAe,YAAA,GAAA,IAAA;AACjB;AACA,MAAM,kBAAqB,GAAA,gCAAA;AAIpB,SAAS,kBAAqB,GAAA;AA3BrC,EAAA,IAAAA,GAAA,EAAA,EAAA,EAAA,EAAA;AA4BE,EAAA,MAAM,SAAS,eAAgB,EAAA;AAC/B,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAwB,IAAI,CAAA;AAChE,EAAA,MAAM,CAAC,UAAA,EAAY,aAAa,CAAA,GAAI,SAAoC,MAAS,CAAA;AACjF,EAAA,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AskUser}from'../chat/askUser.js';function asObject(value) {
|
|
1
|
+
import {rewritePagesDevLinks,siteAddress,shownLiveUrl}from'./siteAddress.js';import {publicSandboxDomain}from'./publicSandboxDomain.js';import {previewDomainFor,withPublicSandboxHosts,sandboxPreviewUrlFor,sandboxPreviewDomainsSource,sandboxPreviewLinkRe,DEFAULT_E2B_SANDBOX_DOMAIN}from'./sandboxPublicHost.js';import {renderWidgetBlocks}from'./widgetBlocks.js';import {stripAskUser}from'../chat/askUser.js';function asObject(value) {
|
|
2
2
|
if (!value) return null;
|
|
3
3
|
if (typeof value === "object") return Array.isArray(value) ? null : value;
|
|
4
4
|
if (typeof value === "string") {
|
|
@@ -29,13 +29,16 @@ function pick(records, key) {
|
|
|
29
29
|
}
|
|
30
30
|
const LIVE_SANDBOX = /^https?:\/\/\d+-[a-z0-9]+(\.|\/|$)/i;
|
|
31
31
|
function sandboxPreviewUrl(url, sandboxId) {
|
|
32
|
+
const domain = publicSandboxDomain();
|
|
32
33
|
const given = str(url);
|
|
33
34
|
if (given) {
|
|
34
|
-
if (/^https?:\/\/\d+-[a-z0-9]+\/?$/i.test(given))
|
|
35
|
-
|
|
35
|
+
if (/^https?:\/\/\d+-[a-z0-9]+\/?$/i.test(given)) {
|
|
36
|
+
return `${given.replace(/\/$/, "")}.${previewDomainFor(DEFAULT_E2B_SANDBOX_DOMAIN, domain)}`;
|
|
37
|
+
}
|
|
38
|
+
return withPublicSandboxHosts(given, domain);
|
|
36
39
|
}
|
|
37
40
|
const id = str(sandboxId);
|
|
38
|
-
return id ?
|
|
41
|
+
return id ? sandboxPreviewUrlFor(id, domain) : null;
|
|
39
42
|
}
|
|
40
43
|
function httpOrigin(value) {
|
|
41
44
|
const match = /^(https?:\/\/[^/?#]+)/i.exec((value != null ? value : "").trim());
|
|
@@ -88,15 +91,15 @@ function readFragment(post) {
|
|
|
88
91
|
isDeploying
|
|
89
92
|
};
|
|
90
93
|
}
|
|
91
|
-
const E2B_PREVIEW_RE = /https:\/\/(\d{2,5})-([a-z0-9]{8,40})\.e2b\.(?:dev|app)\b[^\s)\]"'<>*`]*/gi;
|
|
92
94
|
const LIVE_URL_RE = /https:\/\/([a-z0-9][a-z0-9-]{1,60})\.(?:pages\.dev|yarntra\.com)\b[^\s)\]"'<>*`]*/gi;
|
|
93
95
|
const RESTORE_POINT_RE = /restore point \(snapshot `([^`\s]{4,200})`\)/gi;
|
|
94
96
|
const trimUrl = (url) => url.replace(/[.,;:!?]+$/, "");
|
|
95
97
|
function previewFrom(text) {
|
|
96
|
-
const
|
|
98
|
+
const domain = publicSandboxDomain();
|
|
99
|
+
const all = Array.from(text.matchAll(sandboxPreviewLinkRe(domain)));
|
|
97
100
|
const last = all[all.length - 1];
|
|
98
101
|
return last ? {
|
|
99
|
-
url: trimUrl(last[0]),
|
|
102
|
+
url: withPublicSandboxHosts(trimUrl(last[0]), domain),
|
|
100
103
|
sandboxId: last[2]
|
|
101
104
|
} : null;
|
|
102
105
|
}
|
|
@@ -116,11 +119,14 @@ function siteNameFrom(text) {
|
|
|
116
119
|
const m = (_b = (_a = text.match(/\bYour ([A-Z][\w&'’ .-]{1,40}?)(?: (?:yoga|coffee|wedding|photography|bakery))? (?:site|website|app) is (?:built|ready|live|running)/)) != null ? _a : text.match(/\*\*([A-Z][^*\n]{1,40})\*\* is (?:live|ready|built)/)) != null ? _b : text.match(/^([A-Z][\w&'’ .-]{1,40}?) is live at\b/m);
|
|
117
120
|
return m ? m[1].trim() : null;
|
|
118
121
|
}
|
|
119
|
-
|
|
122
|
+
function sandboxLinkSource(domain) {
|
|
123
|
+
return String.raw`https:\/\/\d{2,5}-[a-z0-9]{8,40}\.${sandboxPreviewDomainsSource(domain)}\b(?:[^\s)\]"'<>*\x60]*[^\s)\]"'<>*\x60.,;:!?])?`;
|
|
124
|
+
}
|
|
120
125
|
function displayAgentText(text) {
|
|
126
|
+
const link = sandboxLinkSource(publicSandboxDomain());
|
|
121
127
|
return (
|
|
122
128
|
// The agent's [ASK_USER] question is a card, not prose (also while it streams).
|
|
123
|
-
rewritePagesDevLinks(renderWidgetBlocks(stripAskUser(text))).replace(/(restore point) \(snapshot `[^`]+`\)/gi, "$1").replace(/\s*\(preview `[^`]+`\)/gi, "").replace(/^[ \t>]*⚠?\s*billing policy check unavailable\b[^\n]*\n?/gim, "").replace(new RegExp(String.raw`\[([^\]]+)\]\(${
|
|
129
|
+
rewritePagesDevLinks(renderWidgetBlocks(stripAskUser(text))).replace(/(restore point) \(snapshot `[^`]+`\)/gi, "$1").replace(/\s*\(preview `[^`]+`\)/gi, "").replace(/^[ \t>]*⚠?\s*billing policy check unavailable\b[^\n]*\n?/gim, "").replace(new RegExp(String.raw`\[([^\]]+)\]\(${link}\)`, "gi"), "$1").replace(new RegExp(String.raw`:?[ \t]*<?${link}>?`, "gi"), "").trim()
|
|
124
130
|
);
|
|
125
131
|
}
|
|
126
132
|
function linkFragment(post) {
|
|
@@ -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, so the host and jest can both use it.\n */\nimport type { WebBuilderBuild, WebBuilderProject } from './types';\nimport { rewritePagesDevLinks, shownLiveUrl, siteAddress } from './siteAddress';\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>.e2b.dev`) - 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.\n */\nexport function sandboxPreviewUrl(url: string | undefined, sandboxId: string | undefined): string | null {\n const given = str(url);\n if (given) {\n if (/^https?:\\/\\/\\d+-[a-z0-9]+\\/?$/i.test(given)) return `${given.replace(/\\/$/, '')}.e2b.dev`;\n return given;\n }\n const id = str(sandboxId);\n return id ? `https://3000-${id}.e2b.dev` : 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/** Sandbox previews and published addresses the agent names (web `chat/agentBuild.ts`). */\nconst E2B_PREVIEW_RE = /https:\\/\\/(\\d{2,5})-([a-z0-9]{8,40})\\.e2b\\.(?:dev|app)\\b[^\\s)\\]\"'<>*`]*/gi;\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/** The last sandbox preview link in the text (the agent's latest), with its sandbox id. */\nexport function previewFrom(text: string): { url: string; sandboxId: string } | null {\n const all = Array.from(text.matchAll(E2B_PREVIEW_RE));\n const last = all[all.length - 1];\n return last ? { url: trimUrl(last[0]), 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, without the sentence's closing punctuation. */\nconst E2B_LINK = String.raw`https:\\/\\/\\d{2,5}-[a-z0-9]{8,40}\\.e2b\\.(?:dev|app)\\b(?:[^\\s)\\]\"'<>*\\x60]*[^\\s)\\]\"'<>*\\x60.,;:!?])?`;\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 // 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`\\[([^\\]]+)\\]\\(${E2B_LINK}\\)`, 'gi'), '$1')\n .replace(new RegExp(String.raw`:?[ \\t]*<?${E2B_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)\\][\\s\\S]*$/, '').trim();\n}\n"],"names":["_a"],"mappings":"8KAuCA,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,CAAA,GAAG,GAAU,OAAA,IAAA;AACrC,IAAI,IAAA;AACF,MAAM,MAAA,MAAA,GAAS,IAAK,CAAA,KAAA,CAAM,OAAO,CAAA;AACjC,MAAA,OAAO,MAAU,IAAA,OAAO,MAAW,KAAA,QAAA,GAAW,MAAkB,GAAA,IAAA;AAAA,KAC1D,CAAA,OAAA,CAAA,EAAA;AACN,MAAO,OAAA,IAAA;AAAA;AACT;AAEF,EAAO,OAAA,IAAA;AACT;AACA,SAAS,IAAI,KAAoC,EAAA;AAC/C,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,CAAM,MAAS,GAAA,KAAA,CAAM,MAAS,GAAA,MAAA;AACpE;AAGA,SAAS,eAAe,MAAwB,EAAA;AAC9C,EAAA,OAAO,MAAO,CAAA,MAAA,CAAO,MAAM,CAAA,CAAE,IAAI,CAAK,CAAA,KAAA,QAAA,CAAS,CAAC,CAAC,CAAE,CAAA,MAAA,CAAO,CAAC,CAAA,KAAkB,MAAM,IAAI,CAAA;AACzF;AAGA,SAAS,IAAA,CAAK,SAAkB,GAAiC,EAAA;AAhEjE,EAAA,IAAA,EAAA;AAiEE,EAAA,KAA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,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;AAGO,SAAS,eAAe,OAAyB,EAAA;AACtD,EAAA,OAAO,OAAQ,CAAA,OAAA,CAAQ,+CAAiD,EAAA,EAAE,EAAE,IAAK,EAAA;AACnF"}
|
|
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)\\][\\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,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAM,MAAA,OAAA,GAAU,MAAM,IAAK,EAAA;AAC3B,IAAA,IAAI,CAAC,OAAA,CAAQ,UAAW,CAAA,GAAG,GAAU,OAAA,IAAA;AACrC,IAAI,IAAA;AACF,MAAM,MAAA,MAAA,GAAS,IAAK,CAAA,KAAA,CAAM,OAAO,CAAA;AACjC,MAAA,OAAO,MAAU,IAAA,OAAO,MAAW,KAAA,QAAA,GAAW,MAAkB,GAAA,IAAA;AAAA,KAC1D,CAAA,OAAA,CAAA,EAAA;AACN,MAAO,OAAA,IAAA;AAAA;AACT;AAEF,EAAO,OAAA,IAAA;AACT;AACA,SAAS,IAAI,KAAoC,EAAA;AAC/C,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,CAAM,MAAS,GAAA,KAAA,CAAM,MAAS,GAAA,MAAA;AACpE;AAGA,SAAS,eAAe,MAAwB,EAAA;AAC9C,EAAA,OAAO,MAA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AAA,GACvB;AACF;AAOA,SAAS,mBAAmB,IAAwB,EAAA;AA/lBpD,EAAA,IAAA,EAAA,EAAA,EAAA,EAAA,EAAA;AAgmBE,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;AAGO,SAAS,eAAe,OAAyB,EAAA;AACtD,EAAA,OAAO,OAAQ,CAAA,OAAA,CAAQ,+CAAiD,EAAA,EAAE,EAAE,IAAK,EAAA;AACnF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {titleFromPrompt,stripAgentNote,cleanPrompt}from'./buildFragments.js';var __defProp = Object.defineProperty;
|
|
1
|
+
import {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;
|
|
@@ -58,7 +58,7 @@ function webBuilderJobRecord(start) {
|
|
|
58
58
|
}
|
|
59
59
|
function webBuilderJobFinish(outcome) {
|
|
60
60
|
var _a, _b, _c, _d;
|
|
61
|
-
if (
|
|
61
|
+
if (outcome.ok === false) {
|
|
62
62
|
return {
|
|
63
63
|
state: "failed",
|
|
64
64
|
endedAt: outcome.endedAt,
|
|
@@ -80,7 +80,7 @@ function webBuilderJobFinish(outcome) {
|
|
|
80
80
|
}, results.length ? {
|
|
81
81
|
results
|
|
82
82
|
} : {}), site && /^https?:\/\//i.test(site) ? {
|
|
83
|
-
resultUrl: site
|
|
83
|
+
resultUrl: withPublicSandboxHosts(site, publicSandboxDomain())
|
|
84
84
|
} : {});
|
|
85
85
|
}
|
|
86
86
|
function surfaceJobRef(record) {
|