@adminide-stack/yantra-mobile 12.0.172 → 12.0.174-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.
Files changed (213) hide show
  1. package/lib/compute.js +54 -1
  2. package/lib/compute.js.map +1 -1
  3. package/lib/features/apps/AppsCatalog.js +10 -0
  4. package/lib/features/apps/AppsCatalog.js.map +1 -1
  5. package/lib/features/apps/mobileAppCatalog.js +8 -3
  6. package/lib/features/apps/mobileAppCatalog.js.map +1 -1
  7. package/lib/features/apps/nativeAppHandoff.js +4 -1
  8. package/lib/features/apps/nativeAppHandoff.js.map +1 -1
  9. package/lib/features/apps/nativeSurfaceTwin.js +2 -1
  10. package/lib/features/apps/nativeSurfaceTwin.js.map +1 -1
  11. package/lib/features/channels/ChannelIcon.js +13 -3
  12. package/lib/features/channels/ChannelIcon.js.map +1 -1
  13. package/lib/features/channels/ConnectAppsSheet.js +5 -5
  14. package/lib/features/channels/ConnectAppsSheet.js.map +1 -1
  15. package/lib/features/channels/HomeImessage.js +5 -3
  16. package/lib/features/channels/HomeImessage.js.map +1 -1
  17. package/lib/features/channels/channelLinks.js +13 -1
  18. package/lib/features/channels/channelLinks.js.map +1 -1
  19. package/lib/features/chat/NotionPageWidgetCard.js +98 -0
  20. package/lib/features/chat/NotionPageWidgetCard.js.map +1 -0
  21. package/lib/features/chat/hostTranscriptProtocol.js +5 -1
  22. package/lib/features/chat/hostTranscriptProtocol.js.map +1 -1
  23. package/lib/features/chat/notionPageWidget.js +34 -0
  24. package/lib/features/chat/notionPageWidget.js.map +1 -0
  25. package/lib/features/computer/ComputerAgentChatPane.js +45 -0
  26. package/lib/features/computer/ComputerAgentChatPane.js.map +1 -0
  27. package/lib/features/computer/ComputerDesktop.js +164 -0
  28. package/lib/features/computer/ComputerDesktop.js.map +1 -0
  29. package/lib/features/computer/ComputerExperience.js +79 -0
  30. package/lib/features/computer/ComputerExperience.js.map +1 -0
  31. package/lib/features/computer/ComputerHandoff.js +142 -0
  32. package/lib/features/computer/ComputerHandoff.js.map +1 -0
  33. package/lib/features/computer/FilesPane.js +179 -0
  34. package/lib/features/computer/FilesPane.js.map +1 -0
  35. package/lib/features/computer/LivePage.js +1093 -0
  36. package/lib/features/computer/LivePage.js.map +1 -0
  37. package/lib/features/computer/TerminalPane.js +139 -0
  38. package/lib/features/computer/TerminalPane.js.map +1 -0
  39. package/lib/features/computer/computerApi.js +819 -0
  40. package/lib/features/computer/computerApi.js.map +1 -0
  41. package/lib/features/computer/computerChat.js +42 -0
  42. package/lib/features/computer/computerChat.js.map +1 -0
  43. package/lib/features/computer/computerControls.js +227 -0
  44. package/lib/features/computer/computerControls.js.map +1 -0
  45. package/lib/features/computer/computerStyles.js +384 -0
  46. package/lib/features/computer/computerStyles.js.map +1 -0
  47. package/lib/features/computer/computerTheme.js +133 -0
  48. package/lib/features/computer/computerTheme.js.map +1 -0
  49. package/lib/features/computer/handoff.js +73 -0
  50. package/lib/features/computer/handoff.js.map +1 -0
  51. package/lib/features/computer/inputLane.js +171 -0
  52. package/lib/features/computer/inputLane.js.map +1 -0
  53. package/lib/features/computer/inputPump.js +77 -0
  54. package/lib/features/computer/inputPump.js.map +1 -0
  55. package/lib/features/computer/inputSocket.js +148 -0
  56. package/lib/features/computer/inputSocket.js.map +1 -0
  57. package/lib/features/computer/keyboardBridge.js +176 -0
  58. package/lib/features/computer/keyboardBridge.js.map +1 -0
  59. package/lib/features/computer/pageCoordinates.js +19 -0
  60. package/lib/features/computer/pageCoordinates.js.map +1 -0
  61. package/lib/features/computer/pageZoom.js +12 -0
  62. package/lib/features/computer/pageZoom.js.map +1 -0
  63. package/lib/features/computer/pictureGeometry.js +68 -0
  64. package/lib/features/computer/pictureGeometry.js.map +1 -0
  65. package/lib/features/computer/tabsState.js +7 -0
  66. package/lib/features/computer/tabsState.js.map +1 -0
  67. package/lib/features/computer/useComputerHooks.js +146 -0
  68. package/lib/features/computer/useComputerHooks.js.map +1 -0
  69. package/lib/features/games/cubeforge3D.js +11 -6
  70. package/lib/features/games/cubeforge3D.js.map +1 -1
  71. package/lib/features/games/vendored/core/cubeforge/items.js +2 -8
  72. package/lib/features/games/vendored/core/cubeforge/items.js.map +1 -1
  73. package/lib/features/games/vendored/core/cubeforge/recipes.js +1 -4
  74. package/lib/features/games/vendored/core/cubeforge/recipes.js.map +1 -1
  75. package/lib/features/games/vendored/core/cubeforge/skin.js +83 -0
  76. package/lib/features/games/vendored/core/cubeforge/skin.js.map +1 -0
  77. package/lib/features/games/vendored/core/cubeforge/worldgen.js +2 -38
  78. package/lib/features/games/vendored/core/cubeforge/worldgen.js.map +1 -1
  79. package/lib/features/games/vendored/core/engine/palette.js +2 -9
  80. package/lib/features/games/vendored/core/engine/palette.js.map +1 -1
  81. package/lib/features/games/vendored/core/lessons/lessons.js +2 -96
  82. package/lib/features/games/vendored/core/lessons/lessons.js.map +1 -1
  83. package/lib/features/games/vendored/ui/GamesRoot.js +87 -144
  84. package/lib/features/games/vendored/ui/GamesRoot.js.map +1 -1
  85. package/lib/features/games/vendored/ui/components/primitives.js +2 -50
  86. package/lib/features/games/vendored/ui/components/primitives.js.map +1 -1
  87. package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js +20 -3
  88. package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js.map +1 -1
  89. package/lib/features/games/vendored/ui/screens/SkinEditorScreen.js +169 -0
  90. package/lib/features/games/vendored/ui/screens/SkinEditorScreen.js.map +1 -0
  91. package/lib/features/games/vendored/ui/theme.js +1 -3
  92. package/lib/features/games/vendored/ui/theme.js.map +1 -1
  93. package/lib/features/links/openInApp.js +10 -1
  94. package/lib/features/links/openInApp.js.map +1 -1
  95. package/lib/features/notion/notionEditorModel.js +3 -1
  96. package/lib/features/notion/notionEditorModel.js.map +1 -1
  97. package/lib/features/webbuilder/WebBuilderExperience.js +180 -44
  98. package/lib/features/webbuilder/WebBuilderExperience.js.map +1 -1
  99. package/lib/features/webbuilder/buildFragments.js +16 -3
  100. package/lib/features/webbuilder/buildFragments.js.map +1 -1
  101. package/lib/features/webbuilder/codezenHandoff.js +29 -1
  102. package/lib/features/webbuilder/codezenHandoff.js.map +1 -1
  103. package/lib/features/webbuilder/components/CodeView.js +69 -23
  104. package/lib/features/webbuilder/components/CodeView.js.map +1 -1
  105. package/lib/features/webbuilder/components/PreviewFrame.js +62 -2
  106. package/lib/features/webbuilder/components/PreviewFrame.js.map +1 -1
  107. package/lib/features/webbuilder/components/PreviewScreen.js +37 -2
  108. package/lib/features/webbuilder/components/PreviewScreen.js.map +1 -1
  109. package/lib/features/webbuilder/components/ProjectChat.js +2 -1
  110. package/lib/features/webbuilder/components/ProjectChat.js.map +1 -1
  111. package/lib/features/webbuilder/components/ProjectSheets.js +147 -57
  112. package/lib/features/webbuilder/components/ProjectSheets.js.map +1 -1
  113. package/lib/features/webbuilder/components/PublishSheet.js +106 -2
  114. package/lib/features/webbuilder/components/PublishSheet.js.map +1 -1
  115. package/lib/features/webbuilder/components/ReferenceModeChoice.js +105 -0
  116. package/lib/features/webbuilder/components/ReferenceModeChoice.js.map +1 -0
  117. package/lib/features/webbuilder/components/RetentionBanner.js +17 -6
  118. package/lib/features/webbuilder/components/RetentionBanner.js.map +1 -1
  119. package/lib/features/webbuilder/components/SiteUploadSheet.js +327 -0
  120. package/lib/features/webbuilder/components/SiteUploadSheet.js.map +1 -0
  121. package/lib/features/webbuilder/components/StreamStallNote.js +38 -0
  122. package/lib/features/webbuilder/components/StreamStallNote.js.map +1 -0
  123. package/lib/features/webbuilder/components/StudioHome.js +18 -8
  124. package/lib/features/webbuilder/components/StudioHome.js.map +1 -1
  125. package/lib/features/webbuilder/previewRoutes.js +30 -1
  126. package/lib/features/webbuilder/previewRoutes.js.map +1 -1
  127. package/lib/features/webbuilder/studioCatalog.js +9 -2
  128. package/lib/features/webbuilder/studioCatalog.js.map +1 -1
  129. package/lib/features/webbuilder/web/chat/referenceMode.js +11 -0
  130. package/lib/features/webbuilder/web/chat/referenceMode.js.map +1 -0
  131. package/lib/features/webbuilder/web/chat/siteCopy.js +5 -2
  132. package/lib/features/webbuilder/web/chat/siteCopy.js.map +1 -1
  133. package/lib/features/webbuilder/web/chat/streamStall.js +6 -0
  134. package/lib/features/webbuilder/web/chat/streamStall.js.map +1 -0
  135. package/lib/features/webbuilder/web/code/savedCode.js +7 -0
  136. package/lib/features/webbuilder/web/code/savedCode.js.map +1 -0
  137. package/lib/features/webbuilder/web/design/directions.js.map +1 -1
  138. package/lib/features/webbuilder/web/history/versions.js.map +1 -1
  139. package/lib/features/webbuilder/web/import/websiteImport.js +27 -0
  140. package/lib/features/webbuilder/web/import/websiteImport.js.map +1 -0
  141. package/lib/features/webbuilder/web/preview/setupPhase.js +31 -0
  142. package/lib/features/webbuilder/web/preview/setupPhase.js.map +1 -0
  143. package/lib/features/webbuilder/web/publish/siteInsights.js +23 -1
  144. package/lib/features/webbuilder/web/publish/siteInsights.js.map +1 -1
  145. package/lib/features/webbuilder/web/upload/sitePhotos.js +102 -0
  146. package/lib/features/webbuilder/web/upload/sitePhotos.js.map +1 -0
  147. package/lib/routes.json +54 -0
  148. package/lib/screens/ComputerNative/index.js +124 -0
  149. package/lib/screens/ComputerNative/index.js.map +1 -0
  150. package/lib/screens/ComputerNative/useComputerHostChat.js +83 -0
  151. package/lib/screens/ComputerNative/useComputerHostChat.js.map +1 -0
  152. package/lib/screens/GamesNative/index.js +1 -1
  153. package/lib/screens/Home/components/homeCatalog.js +4 -3
  154. package/lib/screens/Home/components/homeCatalog.js.map +1 -1
  155. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js +6 -2
  156. package/lib/screens/WebBuilder/nativeWebBuilderRedirect.js.map +1 -1
  157. package/lib/screens/WebBuilderNative/index.js +15 -3
  158. package/lib/screens/WebBuilderNative/index.js.map +1 -1
  159. package/lib/screens/WebBuilderNative/useWebBuilderHost.js +18 -3
  160. package/lib/screens/WebBuilderNative/useWebBuilderHost.js.map +1 -1
  161. package/lib/screens/WebBuilderNative/webbuilderTransport.js +16 -7
  162. package/lib/screens/WebBuilderNative/webbuilderTransport.js.map +1 -1
  163. package/package.json +4 -4
  164. package/lib/features/games/vendored/core/classroom/permissions.js +0 -76
  165. package/lib/features/games/vendored/core/classroom/permissions.js.map +0 -1
  166. package/lib/features/games/vendored/core/classroom/resourceLink.js +0 -101
  167. package/lib/features/games/vendored/core/classroom/resourceLink.js.map +0 -1
  168. package/lib/features/games/vendored/core/classroom/rules.js +0 -83
  169. package/lib/features/games/vendored/core/classroom/rules.js.map +0 -1
  170. package/lib/features/games/vendored/core/classroom/worldSettings.js +0 -49
  171. package/lib/features/games/vendored/core/classroom/worldSettings.js.map +0 -1
  172. package/lib/features/games/vendored/core/cubeforge/cycle.js +0 -15
  173. package/lib/features/games/vendored/core/cubeforge/cycle.js.map +0 -1
  174. package/lib/features/games/vendored/core/cubeforge/inventory.js +0 -75
  175. package/lib/features/games/vendored/core/cubeforge/inventory.js.map +0 -1
  176. package/lib/features/games/vendored/core/cubeforge/save.js +0 -92
  177. package/lib/features/games/vendored/core/cubeforge/save.js.map +0 -1
  178. package/lib/features/games/vendored/core/cubeforge/session.js +0 -154
  179. package/lib/features/games/vendored/core/cubeforge/session.js.map +0 -1
  180. package/lib/features/games/vendored/core/engine/iso.js +0 -41
  181. package/lib/features/games/vendored/core/engine/iso.js.map +0 -1
  182. package/lib/features/games/vendored/core/engine/world.js +0 -148
  183. package/lib/features/games/vendored/core/engine/world.js.map +0 -1
  184. package/lib/features/games/vendored/core/games/catalog.js +0 -34
  185. package/lib/features/games/vendored/core/games/catalog.js.map +0 -1
  186. package/lib/features/games/vendored/core/logging/events.js +0 -24
  187. package/lib/features/games/vendored/core/logging/events.js.map +0 -1
  188. package/lib/features/games/vendored/core/logging/logger.js +0 -54
  189. package/lib/features/games/vendored/core/logging/logger.js.map +0 -1
  190. package/lib/features/games/vendored/core/session/gameSession.js +0 -317
  191. package/lib/features/games/vendored/core/session/gameSession.js.map +0 -1
  192. package/lib/features/games/vendored/core/storage/worldRepository.js +0 -192
  193. package/lib/features/games/vendored/core/storage/worldRepository.js.map +0 -1
  194. package/lib/features/games/vendored/core/store/reactive.js +0 -78
  195. package/lib/features/games/vendored/core/store/reactive.js.map +0 -1
  196. package/lib/features/games/vendored/ui/components/BlockPalette.js +0 -64
  197. package/lib/features/games/vendored/ui/components/BlockPalette.js.map +0 -1
  198. package/lib/features/games/vendored/ui/components/IsoCanvas.js +0 -124
  199. package/lib/features/games/vendored/ui/components/IsoCanvas.js.map +0 -1
  200. package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js +0 -3
  201. package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js.map +0 -1
  202. package/lib/features/games/vendored/ui/screens/ActivityScreen.js +0 -68
  203. package/lib/features/games/vendored/ui/screens/ActivityScreen.js.map +0 -1
  204. package/lib/features/games/vendored/ui/screens/BuilderScreen.js +0 -227
  205. package/lib/features/games/vendored/ui/screens/BuilderScreen.js.map +0 -1
  206. package/lib/features/games/vendored/ui/screens/ClassroomScreen.js +0 -95
  207. package/lib/features/games/vendored/ui/screens/ClassroomScreen.js.map +0 -1
  208. package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js +0 -342
  209. package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js.map +0 -1
  210. package/lib/features/games/vendored/ui/screens/HubScreen.js +0 -131
  211. package/lib/features/games/vendored/ui/screens/HubScreen.js.map +0 -1
  212. package/lib/features/games/vendored/ui/screens/WorldListScreen.js +0 -134
  213. package/lib/features/games/vendored/ui/screens/WorldListScreen.js.map +0 -1
@@ -330,6 +330,7 @@ async function connectAndStart(call, sandboxId, builder, savedCopyParams = {}) {
330
330
  }
331
331
  const EXTEND_OPEN_TIMEOUT_MS = 3e4;
332
332
  const EXTEND_ASKED_TIMEOUT_MS = 9e4;
333
+ const STATUS_ON_GONE_TIMEOUT_MS = 3e4;
333
334
  async function wakeSandbox(call, target, probe = waitForPreview) {
334
335
  var _a, _b;
335
336
  const builder = builderFor(target.templateId);
@@ -357,15 +358,23 @@ async function wakeSandbox(call, target, probe = waitForPreview) {
357
358
  previewUrl: url
358
359
  } : {});
359
360
  }
360
- if (extendState === "gone") return {
361
- outcome: "gone",
362
- savedCopy: savedCopyFrom(extended)
361
+ const goneWith = async (named) => {
362
+ var _a2;
363
+ if ((named == null ? void 0 : named.snapshotId) || savedCopyParams.snapshotId) return {
364
+ outcome: "gone",
365
+ savedCopy: named
366
+ };
367
+ const status = await runAction(call, "WEBBUILDER_STATUS", __spreadValues({
368
+ sandbox_id: target.sandboxId
369
+ }, savedCopyParams), STATUS_ON_GONE_TIMEOUT_MS);
370
+ return {
371
+ outcome: "gone",
372
+ savedCopy: (_a2 = status.savedCopy) != null ? _a2 : named
373
+ };
363
374
  };
375
+ if (extendState === "gone") return goneWith(savedCopyFrom(extended));
364
376
  const woken = await connectAndStart(call, target.sandboxId, builder, savedCopyParams);
365
- if (woken.outcome === "gone") return {
366
- outcome: "gone",
367
- savedCopy: woken.savedCopy
368
- };
377
+ if (woken.outcome === "gone") return goneWith(woken.savedCopy);
369
378
  return {
370
379
  outcome: woken.outcome
371
380
  };
@@ -1 +1 @@
1
- {"version":3,"file":"webbuilderTransport.js","sources":["../../../src/screens/WebBuilderNative/webbuilderTransport.ts"],"sourcesContent":["/**\n * The calls the native Web Builder makes the way the web surface makes them: the\n * build workflow trigger on cdecli-agent and turn attachments, both on the app's\n * surface session - the same JWT the web surface holds as its cdecli token.\n */\nimport {\n createRemoteConnectorExec,\n createRemoteUploadMedia,\n} from '../../features/canvas/videoEditor/remoteMediaClient';\nimport { WEBBUILDER_CONNECTOR_ID, WEBBUILDER_TRIGGER_WORKFLOW_ACTION } from '../../features/webbuilder/workflow';\nimport { publicSandboxDomain } from '../../features/webbuilder/publicSandboxDomain';\nimport { sandboxPreviewUrlFor, withPublicSandboxHosts } from '../../features/webbuilder/sandboxPublicHost';\nimport {\n KEEPALIVE_EXTEND_MS,\n SANDBOX_GONE_RE,\n WEBBUILDER_EXTEND_ACTION,\n extendOutcome,\n isSandboxGoneResult,\n savedCopyFrom,\n type SavedCopy,\n} from './keepAlive';\n\n/** The trigger answers in seconds; the build itself runs on and reports on the chat. */\nconst TRIGGER_TIMEOUT_MS = 90_000;\n\n/** `error` and `auth` (the agent refused the session) are set when `ok` is false. */\nexport interface TriggerOutcome {\n ok: boolean;\n error?: string;\n auth?: boolean;\n}\n\n/** Runs `yantra-webbuilder/WEBBUILDER_TRIGGER_WORKFLOW` with the web's params. */\nexport async function triggerBuild(\n token: string,\n indexUrl: string,\n params: Record<string, unknown>,\n): Promise<TriggerOutcome> {\n try {\n const result = await createRemoteConnectorExec(token, indexUrl)(\n WEBBUILDER_CONNECTOR_ID,\n WEBBUILDER_TRIGGER_WORKFLOW_ACTION,\n params,\n { timeoutMs: TRIGGER_TIMEOUT_MS },\n );\n if (result.successful === false) {\n const error = String(result.error ?? 'The build did not start.');\n return { ok: false, error, auth: /\\b401\\b|unauthori[sz]ed/i.test(error) };\n }\n return { ok: true };\n } catch (err) {\n const error = err instanceof Error ? err.message : String(err);\n return { ok: false, error, auth: /\\b401\\b|unauthori[sz]ed/i.test(error) };\n }\n}\n\nexport const STORAGE_CONNECTOR_ID = 'yantra-storage';\nexport const PUBLIC_URL_ACTION = 'YANTRA_STORAGE_GET_PUBLIC_URL';\nexport const DOWNLOAD_LINK_ACTION = 'YANTRA_STORAGE_CREATE_DOWNLOAD_LINK';\n/** SigV4 presigned URLs cap at 7 days. */\nconst DOWNLOAD_LINK_EXPIRES_SEC = 7 * 24 * 60 * 60;\nconst RESOLVE_TIMEOUT_MS = 30_000;\n\nfunction httpsLinkFrom(data: unknown, key: 'publicUrl' | 'downloadUrl'): string | null {\n const rec = (data && typeof data === 'object' ? data : {}) as Record<string, unknown>;\n const inner = (rec.data && typeof rec.data === 'object' ? rec.data : rec) as Record<string, unknown>;\n const url = inner[key];\n return typeof url === 'string' && /^https:\\/\\//i.test(url.trim()) ? url.trim() : null;\n}\n\n/**\n * An uploaded object is private: a 7-day GET signed by the storage that holds it, else its CDN link;\n * null when neither resolves. The signed link comes first (web 0.9.2): the agent's configured CDN can\n * serve another bucket, so a CDN link pieced together from it answered 403 Access Denied.\n */\nexport async function resolveFetchableUrl(\n exec: (\n connector: string,\n action: string,\n params: Record<string, unknown>,\n options?: { timeoutMs?: number },\n ) => Promise<Record<string, unknown>>,\n objectUrl: string,\n): Promise<string | null> {\n const attempt = async (action: string, params: Record<string, unknown>, key: 'publicUrl' | 'downloadUrl') => {\n const r = await exec(STORAGE_CONNECTOR_ID, action, params, { timeoutMs: RESOLVE_TIMEOUT_MS }).catch(() => null);\n return r && r.successful !== false ? httpsLinkFrom(r.data, key) : null;\n };\n const signed = await attempt(\n DOWNLOAD_LINK_ACTION,\n { s3KeyOrUrl: objectUrl, expiresIn: DOWNLOAD_LINK_EXPIRES_SEC },\n 'downloadUrl',\n );\n if (signed) return signed;\n return attempt(PUBLIC_URL_ACTION, { s3KeyOrUrl: objectUrl }, 'publicUrl');\n}\n\n/** A photo or file for the turn as a URL the workflow can fetch (the web posts URLs, never base64). */\nexport async function uploadAttachment(\n token: string,\n indexUrl: string,\n file: { url?: string; dataUrl?: string; name: string; mimeType?: string },\n): Promise<{ name: string; url: string; mimeType?: string } | null> {\n if (file.url && /^https?:\\/\\//i.test(file.url)) return { name: file.name, url: file.url, mimeType: file.mimeType };\n const local = file.url || file.dataUrl;\n if (!local) return null;\n try {\n const objectUrl = await createRemoteUploadMedia(token, indexUrl)(local);\n // The object URL answers 403 publicly, so the agent could not fetch it (web #459).\n const url = (await resolveFetchableUrl(createRemoteConnectorExec(token, indexUrl), objectUrl)) ?? objectUrl;\n return { name: file.name, url, mimeType: file.mimeType };\n } catch (err) {\n console.warn('[WebBuilderNative] attachment upload failed:', err);\n return null;\n }\n}\n\n/** The folders a build's project may live in (web `PREVIEW_START_WORKDIRS`). */\nconst PREVIEW_START_WORKDIRS = ['/home/yantra/repo', '/home/user/repo', '/home/yantra', '/home/user'];\nconst LIVE_PREVIEW_RE = /^https?:\\/\\/\\d+-[a-z0-9]+[^\\s\"']*/i;\nconst RESUME_TIMEOUT_MS = 3 * 60 * 1000;\n/** Booting a restore point into a new VM takes longer (web: 10 min for CREATE). */\nconst CREATE_TIMEOUT_MS = 10 * 60 * 1000;\n\nexport type ResumeOutcome = 'ok' | 'gone' | 'failed';\n\n/** What waking a preview did: `previewUrl` when EXTEND named another; `savedCopy` when it is gone. */\nexport interface WakeResult {\n outcome: ResumeOutcome;\n previewUrl?: string;\n savedCopy?: SavedCopy | null;\n}\n\n/**\n * What restoring from the saved copy did: the new sandbox and its preview (on the platform's\n * sandbox domain when one is set - it is saved), or why it could not, in one sentence.\n */\nexport type RestoreResult =\n | { outcome: 'ok'; sandboxId: string; previewUrl: string }\n | { outcome: 'failed'; reason: string };\n\n/** One connector call's answer, the same on both paths: `{ successful, data, error }`. */\nexport interface SandboxCallResult {\n successful: boolean;\n data?: unknown;\n error?: string;\n}\n\n/** `outdated`: this server has no proxy field; otherwise `result` is the connector's answer. */\nexport interface SandboxProxyAnswer {\n outdated: boolean;\n result?: SandboxCallResult;\n}\n\n/**\n * The guarded proxy `aiCodeSandboxAction(channelId, sandboxId, action, params)`:\n * the server checks the caller's role and that the sandbox belongs to the\n * channel, then adds the sandbox key from the channel's settings (an agent\n * build's key included). `outdated` = this server has no such field.\n */\nexport type SandboxProxyCall = (\n variables: { channelId: string; sandboxId: string; action: string; params: Record<string, unknown> },\n timeoutMs: number,\n) => Promise<SandboxProxyAnswer>;\n\nexport type SandboxRun = (\n action: string,\n params: Record<string, unknown>,\n timeoutMs: number,\n) => Promise<SandboxCallResult>;\n\n/** Connector actions the proxy allows (web `sandboxProxy.SANDBOX_BOUND`); the rest go direct. */\nconst SANDBOX_BOUND = new Set([\n 'WEBBUILDER_EXTEND',\n 'WEBBUILDER_CONNECT',\n // A private sandbox answers STATUS only with its key, which the proxy adds.\n 'WEBBUILDER_STATUS',\n 'WEBBUILDER_START',\n 'WEBBUILDER_LIST_VERSIONS',\n 'WEBBUILDER_CREATE_SANDBOX',\n 'WEBBUILDER_READ_FILE',\n 'WEBBUILDER_WRITE_FILES',\n 'WEBBUILDER_RUN_COMMAND',\n 'WEBBUILDER_SNAPSHOT',\n 'WEBBUILDER_RESTORE_VERSION',\n 'WEBBUILDER_BOOKMARK_VERSION',\n 'WEBBUILDER_UPLOAD_ASSET',\n 'WEBBUILDER_RELOAD_GITHUB',\n 'WEBBUILDER_CLONE',\n // Editor+ on the server; an older server refuses them and callers fall back.\n 'WEBBUILDER_EXPORT_ZIP',\n 'WEBBUILDER_LIST_FILES',\n 'WEBBUILDER_FINISH',\n 'WEBBUILDER_DEPLOY_FLY',\n 'WEBBUILDER_DEPLOY_VERCEL',\n 'WEBBUILDER_DEPLOY_NETLIFY',\n // The server picks the repo and attaches the caller's own GitHub credential.\n 'WEBBUILDER_PUSH_GITHUB',\n 'WEBBUILDER_PULL_GITHUB',\n]);\n\n/** A server without the proxy (web `isOutdatedServerError`). */\nexport const OUTDATED_SERVER_RE =\n /Cannot query field|Unknown argument|Unknown type|is not defined by type|Cannot return null for non-nullable field Query\\.aiCode/i;\n\nfunction withoutKey(rec: Record<string, unknown>): Record<string, unknown> {\n const { sandboxKey: _key, sandbox_key: _key2, ...rest } = rec;\n return rest;\n}\n\n/** The proxy's JSON answer as a connector result, with any key dropped (web `proxyResult`). */\nexport function proxyResult(raw: unknown): SandboxCallResult {\n let value = raw;\n if (typeof value === 'string') {\n try {\n value = JSON.parse(value);\n } catch {\n value = null;\n }\n }\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return { successful: false, error: 'The server sent an empty answer.' };\n }\n const rec = value as Record<string, unknown>;\n const data =\n rec.data && typeof rec.data === 'object' && !Array.isArray(rec.data)\n ? withoutKey(rec.data as Record<string, unknown>)\n : rec.data;\n const error = typeof rec.error === 'string' && rec.error ? rec.error : undefined;\n return { successful: rec.successful === true, data, ...(error ? { error } : {}) };\n}\n\n/** The proxy's answer when the caller has no project on the channel (missing, not a member, no role). */\nexport function isNoProjectRefusal(error: string | null | undefined): boolean {\n return /^Project not found\\.?($| \\()/i.test(String(error ?? '').trim());\n}\n\n/**\n * The proxy's \"Sandbox not found in this project.\": the sandbox exists, the project just has\n * not recorded it yet (a fresh agent build before its record lands). It is not gone - the call\n * goes direct, where the connector lets the sandbox's creator act on it.\n */\nexport function isUnrecordedSandboxRefusal(error: string | null | undefined): boolean {\n return /\\b(?:not found|not recorded|unknown) (?:in|for|on) this project\\b/i.test(String(error ?? ''));\n}\n\n/**\n * Channels with no server project for this person (an agent-chat build the AI made through\n * the cdecli agent), learnt from the proxy's \"Project not found.\" for the session: their\n * sandbox calls go direct - the connector lets a sandbox's creator act on it and boot their\n * own restore points without a key. Adopting the channel as a project switches it back.\n */\nexport const directChannels = new Set<string>();\n\n/**\n * Every sandbox call for one site, the web's `createSandboxRouter`: through the\n * proxy when the server has it (the app never holds a sandbox key), else straight\n * to cdecli-agent. A server found without the proxy stays direct for the session,\n * and so does a channel the proxy has no project for.\n */\nexport function createSandboxRouter(deps: {\n channelId: string | null | undefined;\n proxy: SandboxProxyCall | null;\n direct: SandboxRun;\n proxyMissing: { current: boolean };\n}): SandboxRun {\n const channelId = String(deps.channelId ?? '').trim();\n const { proxyMissing } = deps;\n return async (action, rawParams, timeoutMs) => {\n const params = withoutKey(rawParams);\n const sandboxId = String(params.sandbox_id ?? '').trim();\n const isCreate = action === 'WEBBUILDER_CREATE_SANDBOX';\n // `restoreFromBackup` is for the project proxy only (its templates-only check); the connector never sees it.\n const { restoreFromBackup: _proxyOnly, ...directParams } = params;\n const proxied =\n deps.proxy &&\n !proxyMissing.current &&\n channelId &&\n !directChannels.has(channelId) &&\n SANDBOX_BOUND.has(action) &&\n (sandboxId || isCreate);\n if (!proxied || !deps.proxy) return deps.direct(action, directParams, timeoutMs);\n const answer = await deps.proxy({ channelId, sandboxId, action, params }, timeoutMs);\n if (!answer.outdated) {\n const result = answer.result ?? { successful: false, error: 'The server sent an empty answer.' };\n // No project to hold the key: the connector lets the sandbox's creator act on it directly.\n if (!result.successful && isNoProjectRefusal(result.error)) {\n directChannels.add(channelId);\n return deps.direct(action, directParams, timeoutMs);\n }\n // Not recorded on the project yet: this call goes direct; the next tries the proxy again.\n if (!result.successful && isUnrecordedSandboxRefusal(result.error)) {\n return deps.direct(action, directParams, timeoutMs);\n }\n return result;\n }\n proxyMissing.current = true;\n return deps.direct(action, directParams, timeoutMs);\n };\n}\n\n/** The direct path: `yantra-webbuilder` on cdecli-agent with the surface session. */\nexport function directSandboxRun(token: string, indexUrl: string): SandboxRun {\n const exec = createRemoteConnectorExec(token, indexUrl);\n return async (action, params, timeoutMs) => {\n const result = await exec(WEBBUILDER_CONNECTOR_ID, action, params, { timeoutMs });\n return {\n successful: result.successful !== false,\n data: result.data,\n ...(typeof result.error === 'string' ? { error: result.error } : {}),\n };\n };\n}\n\n/** The connector's own output (web `connectorData`: the result's `data`, or `data.data`). */\nfunction connectorData(result: unknown): Record<string, unknown> {\n const raw = (result as { data?: unknown } | null)?.data;\n if (!raw || typeof raw !== 'object') return {};\n const rec = raw as Record<string, unknown>;\n return rec.data && typeof rec.data === 'object' && !Array.isArray(rec.data)\n ? (rec.data as Record<string, unknown>)\n : rec;\n}\n\nfunction livePreviewUrl(data: Record<string, unknown>): string | null {\n for (const value of [data.previewUrl, data.preview_url, data.sandboxUrl, data.sandbox_url, data.url]) {\n const match = typeof value === 'string' ? LIVE_PREVIEW_RE.exec(value.trim()) : null;\n if (match) return match[0];\n }\n return null;\n}\n\n/** The preview's dev server answers (not a 5xx \"Sandbox not found\" / \"Closed Port\" page), within `withinMs`. */\nexport async function waitForPreview(url: string, withinMs = 20_000): Promise<boolean> {\n const until = Date.now() + withinMs;\n while (Date.now() < until) {\n try {\n // eslint-disable-next-line no-await-in-loop -- one probe at a time\n const res = await fetch(url, { method: 'GET' });\n if (res.status < 500) return true;\n } catch {\n // not answering yet\n }\n // eslint-disable-next-line no-await-in-loop\n await new Promise((resolve) => {\n setTimeout(resolve, 2_000);\n });\n }\n return false;\n}\n\n/** One connector call, read the same on both paths: ok, gone (typed or worded), the raw text and `data`. */\nconst blobOf = (result: SandboxCallResult) => JSON.stringify(result);\n\nasync function runAction(call: SandboxRun, action: string, params: Record<string, unknown>, timeoutMs: number) {\n try {\n const result = await call(action, params, timeoutMs);\n return {\n ok: result.successful !== false,\n gone:\n isSandboxGoneResult(result) ||\n (!result.successful &&\n SANDBOX_GONE_RE.test(blobOf(result)) &&\n !/sandbox is private/i.test(blobOf(result))),\n blob: JSON.stringify(result),\n error: result.error ?? '',\n data: connectorData(result),\n savedCopy: savedCopyFrom(result),\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const failed = { successful: false, error: message };\n return {\n ok: false,\n gone: isSandboxGoneResult(failed),\n blob: message,\n error: message,\n data: {} as Record<string, unknown>,\n savedCopy: savedCopyFrom(failed),\n };\n }\n}\n\nconst builderFor = (templateId?: string | null) => (/next/i.test(templateId ?? '') ? 'next' : 'vite');\n\n/** CONNECT then START across the workdirs; the URL is the one START (or CONNECT) reports. */\nasync function connectAndStart(\n call: SandboxRun,\n sandboxId: string,\n builder: string,\n savedCopyParams: Record<string, unknown> = {},\n): Promise<{ outcome: ResumeOutcome; url: string | null; savedCopy: SavedCopy | null }> {\n const connected = await runAction(\n call,\n 'WEBBUILDER_CONNECT',\n { sandbox_id: sandboxId, autoResume: true, builder, ...savedCopyParams },\n RESUME_TIMEOUT_MS,\n );\n if (connected.gone) return { outcome: 'gone', url: null, savedCopy: connected.savedCopy };\n const seen = livePreviewUrl(connected.data);\n for (const workDir of PREVIEW_START_WORKDIRS) {\n // eslint-disable-next-line no-await-in-loop -- one folder at a time, like the web\n const started = await runAction(\n call,\n 'WEBBUILDER_START',\n { sandbox_id: sandboxId, workDir, builder },\n RESUME_TIMEOUT_MS,\n );\n if (started.gone) return { outcome: 'gone', url: null, savedCopy: started.savedCopy };\n if (started.ok) return { outcome: 'ok', url: livePreviewUrl(started.data) || seen, savedCopy: null };\n // Only \"no package.json here\" means try the next folder.\n if (!/no package\\.json/i.test(started.blob)) break;\n }\n return { outcome: connected.ok ? 'ok' : 'failed', url: seen, savedCopy: null };\n}\n\n/** EXTEND's wait when the person opened the build (a quick answer) and when they asked to wake it. */\nconst EXTEND_OPEN_TIMEOUT_MS = 30_000;\nconst EXTEND_ASKED_TIMEOUT_MS = 90_000;\n\n/**\n * Brings a sleeping preview back without the agent, in the web's `ensurePreview` order:\n * EXTEND (it resumes a paused sandbox), then resume the sandbox (`WEBBUILDER_CONNECT` with\n * `autoResume`) and start its dev server (`WEBBUILDER_START`) in the folder the project lives\n * in. Waking never boots a new sandbox: `gone` means it was reclaimed, and restoring it from\n * its saved copy is the person's call ({@link restoreFromSavedCopy}). The wake calls name the\n * restore point and backup, so a gone answer says where to restore from (`savedCopy`).\n */\nexport async function wakeSandbox(\n call: SandboxRun,\n target: {\n sandboxId: string;\n snapshotId?: string | null;\n backupRepo?: string | null;\n templateId?: string | null;\n /** The build's preview, checked after EXTEND resumes the sandbox. */\n previewUrl?: string | null;\n /** The person asked to wake it (EXTEND may take longer); else it is opening. */\n asked?: boolean;\n },\n probe: (url: string) => Promise<boolean> = waitForPreview,\n): Promise<WakeResult> {\n const builder = builderFor(target.templateId);\n const savedCopyParams = {\n ...(String(target.snapshotId ?? '').trim() ? { snapshotId: String(target.snapshotId).trim() } : {}),\n ...(String(target.backupRepo ?? '').trim() ? { backupRepo: String(target.backupRepo).trim() } : {}),\n };\n const extended = await call(\n WEBBUILDER_EXTEND_ACTION,\n { sandbox_id: target.sandboxId, timeoutMs: KEEPALIVE_EXTEND_MS, ...savedCopyParams },\n target.asked ? EXTEND_ASKED_TIMEOUT_MS : EXTEND_OPEN_TIMEOUT_MS,\n ).catch((err: unknown) => ({ successful: false, error: err instanceof Error ? err.message : String(err) }));\n const extendState = extendOutcome(extended);\n const domain = publicSandboxDomain();\n const previewUrl = target.previewUrl || sandboxPreviewUrlFor(target.sandboxId, domain);\n if (extendState === 'resumed' || extendState === 'alive') {\n // EXTEND may name the preview it resumed.\n const extendedUrl = livePreviewUrl(connectorData(extended));\n const url = extendedUrl ? withPublicSandboxHosts(extendedUrl, domain) || previewUrl : previewUrl;\n if (await probe(url)) return { outcome: 'ok', ...(url !== previewUrl ? { previewUrl: url } : {}) };\n }\n // Gone for good: waking cannot help.\n if (extendState === 'gone') return { outcome: 'gone', savedCopy: savedCopyFrom(extended) };\n const woken = await connectAndStart(call, target.sandboxId, builder, savedCopyParams);\n if (woken.outcome === 'gone') return { outcome: 'gone', savedCopy: woken.savedCopy };\n return { outcome: woken.outcome };\n}\n\n/** A failed restore's reason as one plain sentence: no `[CODE]` tags, CLI wrappers or repeats (web `restoreReasonText`). */\nexport function restoreReasonText(raw: string | null | undefined): string {\n const lines = String(raw || '')\n .split('\\n')\n .map((l) =>\n l\n .replace(/^\\s*(?:Error:\\s*)?exit status \\d+:\\s*/i, '')\n .replace(/^\\s*Error:\\s*/i, '')\n .replace(/\\s*\\[[A-Z][A-Z0-9_]*(?:;[^\\]]*)?\\]\\s*$/, '')\n .replace(/[;,]?\\s*the user (?:cannot|can't|can not) fix this\\.?/i, '.')\n .replace(/\\.\\.$/, '.')\n .replace(/\\s+/g, ' ')\n .trim(),\n )\n .filter(Boolean);\n const first = lines[0] || '';\n if (!first) return 'The saved copy could not be opened.';\n if (/not one of yours and was not shared/i.test(first) || /SNAPSHOT_OWNER_UNKNOWN/.test(String(raw))) {\n return \"This saved copy isn't linked to your account yet, so it can't be reopened here.\";\n }\n if (/^at\\s/.test(first)) return 'The saved copy could not be opened.';\n const text = first.length > 220 ? `${first.slice(0, 219)}…` : first;\n return /[.!?…]$/.test(text) ? text : `${text}.`;\n}\n\n/**\n * Restore from saved copy (web): boot the build's latest restore point (the\n * one the connector named when it found the sandbox gone, else the build's) into a new sandbox\n * (`WEBBUILDER_CREATE_SANDBOX`, naming the sandbox it was saved from so an older restore point\n * can be proven ours) and start it. Without a restore point the agent restores it from its backup.\n */\nexport async function restoreFromSavedCopy(\n call: SandboxRun,\n target: { sandboxId: string; snapshotId?: string | null; templateId?: string | null },\n): Promise<RestoreResult> {\n const snapshotId = String(target.snapshotId ?? '').trim();\n if (!snapshotId) return { outcome: 'failed', reason: 'This build has no restore point the app can open.' };\n const builder = builderFor(target.templateId);\n const domain = publicSandboxDomain();\n // waitBridge:false - the new id comes back as soon as E2B creates the VM; CONNECT waits for the daemon.\n const created = await runAction(\n call,\n 'WEBBUILDER_CREATE_SANDBOX',\n { snapshotId, sourceSandboxId: target.sandboxId, builder, waitBridge: false },\n CREATE_TIMEOUT_MS,\n );\n const createdUrl = livePreviewUrl(created.data);\n const nextId =\n String(created.data.sandboxId || created.data.sandbox_id || created.data.id || '').trim() ||\n /^https?:\\/\\/\\d+-([a-z0-9]+)/i.exec(createdUrl ?? '')?.[1] ||\n '';\n if (!created.ok || !nextId) return { outcome: 'failed', reason: restoreReasonText(created.error || created.blob) };\n const started = await connectAndStart(call, nextId, builder);\n if (started.outcome !== 'ok') return { outcome: 'failed', reason: 'The restored copy did not start.' };\n return {\n outcome: 'ok',\n sandboxId: nextId,\n previewUrl:\n withPublicSandboxHosts(started.url || createdUrl || '', domain) || sandboxPreviewUrlFor(nextId, domain),\n };\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,kBAAqB,GAAA,GAAA;AAUL,eAAA,YAAA,CAAa,KAAe,EAAA,QAAA,EAAkB,MAA0D,EAAA;AAtB9H,EAAA,IAAA,EAAA;AAuBE,EAAI,IAAA;AACF,IAAM,MAAA,MAAA,GAAS,MAAM,yBAA0B,CAAA,KAAA,EAAO,QAAQ,CAAE,CAAA,uBAAA,EAAyB,oCAAoC,MAAQ,EAAA;AAAA,MACnI,SAAW,EAAA;AAAA,KACZ,CAAA;AACD,IAAI,IAAA,MAAA,CAAO,eAAe,KAAO,EAAA;AAC/B,MAAA,MAAM,KAAQ,GAAA,MAAA,CAAA,CAAO,EAAO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AA,GACV;AACA,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,IAAA;AAAA,IACT,SAAW,EAAA,MAAA;AAAA,IACX,UAAA,EAAY,sBAAuB,CAAA,OAAA,CAAQ,GAAO,IAAA,UAAA,IAAc,IAAI,MAAM,CAAA,IAAK,oBAAqB,CAAA,MAAA,EAAQ,MAAM;AAAA,GACpH;AACF"}
1
+ {"version":3,"file":"webbuilderTransport.js","sources":["../../../src/screens/WebBuilderNative/webbuilderTransport.ts"],"sourcesContent":["/**\n * The calls the native Web Builder makes the way the web surface makes them: the\n * build workflow trigger on cdecli-agent and turn attachments, both on the app's\n * surface session - the same JWT the web surface holds as its cdecli token.\n */\nimport {\n createRemoteConnectorExec,\n createRemoteUploadMedia,\n} from '../../features/canvas/videoEditor/remoteMediaClient';\nimport { WEBBUILDER_CONNECTOR_ID, WEBBUILDER_TRIGGER_WORKFLOW_ACTION } from '../../features/webbuilder/workflow';\nimport { publicSandboxDomain } from '../../features/webbuilder/publicSandboxDomain';\nimport { sandboxPreviewUrlFor, withPublicSandboxHosts } from '../../features/webbuilder/sandboxPublicHost';\nimport {\n KEEPALIVE_EXTEND_MS,\n SANDBOX_GONE_RE,\n WEBBUILDER_EXTEND_ACTION,\n extendOutcome,\n isSandboxGoneResult,\n savedCopyFrom,\n type SavedCopy,\n} from './keepAlive';\n\n/** The trigger answers in seconds; the build itself runs on and reports on the chat. */\nconst TRIGGER_TIMEOUT_MS = 90_000;\n\n/** `error` and `auth` (the agent refused the session) are set when `ok` is false. */\nexport interface TriggerOutcome {\n ok: boolean;\n error?: string;\n auth?: boolean;\n}\n\n/** Runs `yantra-webbuilder/WEBBUILDER_TRIGGER_WORKFLOW` with the web's params. */\nexport async function triggerBuild(\n token: string,\n indexUrl: string,\n params: Record<string, unknown>,\n): Promise<TriggerOutcome> {\n try {\n const result = await createRemoteConnectorExec(token, indexUrl)(\n WEBBUILDER_CONNECTOR_ID,\n WEBBUILDER_TRIGGER_WORKFLOW_ACTION,\n params,\n { timeoutMs: TRIGGER_TIMEOUT_MS },\n );\n if (result.successful === false) {\n const error = String(result.error ?? 'The build did not start.');\n return { ok: false, error, auth: /\\b401\\b|unauthori[sz]ed/i.test(error) };\n }\n return { ok: true };\n } catch (err) {\n const error = err instanceof Error ? err.message : String(err);\n return { ok: false, error, auth: /\\b401\\b|unauthori[sz]ed/i.test(error) };\n }\n}\n\nexport const STORAGE_CONNECTOR_ID = 'yantra-storage';\nexport const PUBLIC_URL_ACTION = 'YANTRA_STORAGE_GET_PUBLIC_URL';\nexport const DOWNLOAD_LINK_ACTION = 'YANTRA_STORAGE_CREATE_DOWNLOAD_LINK';\n/** SigV4 presigned URLs cap at 7 days. */\nconst DOWNLOAD_LINK_EXPIRES_SEC = 7 * 24 * 60 * 60;\nconst RESOLVE_TIMEOUT_MS = 30_000;\n\nfunction httpsLinkFrom(data: unknown, key: 'publicUrl' | 'downloadUrl'): string | null {\n const rec = (data && typeof data === 'object' ? data : {}) as Record<string, unknown>;\n const inner = (rec.data && typeof rec.data === 'object' ? rec.data : rec) as Record<string, unknown>;\n const url = inner[key];\n return typeof url === 'string' && /^https:\\/\\//i.test(url.trim()) ? url.trim() : null;\n}\n\n/**\n * An uploaded object is private: a 7-day GET signed by the storage that holds it, else its CDN link;\n * null when neither resolves. The signed link comes first (web 0.9.2): the agent's configured CDN can\n * serve another bucket, so a CDN link pieced together from it answered 403 Access Denied.\n */\nexport async function resolveFetchableUrl(\n exec: (\n connector: string,\n action: string,\n params: Record<string, unknown>,\n options?: { timeoutMs?: number },\n ) => Promise<Record<string, unknown>>,\n objectUrl: string,\n): Promise<string | null> {\n const attempt = async (action: string, params: Record<string, unknown>, key: 'publicUrl' | 'downloadUrl') => {\n const r = await exec(STORAGE_CONNECTOR_ID, action, params, { timeoutMs: RESOLVE_TIMEOUT_MS }).catch(() => null);\n return r && r.successful !== false ? httpsLinkFrom(r.data, key) : null;\n };\n const signed = await attempt(\n DOWNLOAD_LINK_ACTION,\n { s3KeyOrUrl: objectUrl, expiresIn: DOWNLOAD_LINK_EXPIRES_SEC },\n 'downloadUrl',\n );\n if (signed) return signed;\n return attempt(PUBLIC_URL_ACTION, { s3KeyOrUrl: objectUrl }, 'publicUrl');\n}\n\n/** A photo or file for the turn as a URL the workflow can fetch (the web posts URLs, never base64). */\nexport async function uploadAttachment(\n token: string,\n indexUrl: string,\n file: { url?: string; dataUrl?: string; name: string; mimeType?: string },\n): Promise<{ name: string; url: string; mimeType?: string } | null> {\n if (file.url && /^https?:\\/\\//i.test(file.url)) return { name: file.name, url: file.url, mimeType: file.mimeType };\n const local = file.url || file.dataUrl;\n if (!local) return null;\n try {\n const objectUrl = await createRemoteUploadMedia(token, indexUrl)(local);\n // The object URL answers 403 publicly, so the agent could not fetch it (web #459).\n const url = (await resolveFetchableUrl(createRemoteConnectorExec(token, indexUrl), objectUrl)) ?? objectUrl;\n return { name: file.name, url, mimeType: file.mimeType };\n } catch (err) {\n console.warn('[WebBuilderNative] attachment upload failed:', err);\n return null;\n }\n}\n\n/** The folders a build's project may live in (web `PREVIEW_START_WORKDIRS`). */\nconst PREVIEW_START_WORKDIRS = ['/home/yantra/repo', '/home/user/repo', '/home/yantra', '/home/user'];\nconst LIVE_PREVIEW_RE = /^https?:\\/\\/\\d+-[a-z0-9]+[^\\s\"']*/i;\nconst RESUME_TIMEOUT_MS = 3 * 60 * 1000;\n/** Booting a restore point into a new VM takes longer (web: 10 min for CREATE). */\nconst CREATE_TIMEOUT_MS = 10 * 60 * 1000;\n\nexport type ResumeOutcome = 'ok' | 'gone' | 'failed';\n\n/** What waking a preview did: `previewUrl` when EXTEND named another; `savedCopy` when it is gone. */\nexport interface WakeResult {\n outcome: ResumeOutcome;\n previewUrl?: string;\n savedCopy?: SavedCopy | null;\n}\n\n/**\n * What restoring from the saved copy did: the new sandbox and its preview (on the platform's\n * sandbox domain when one is set - it is saved), or why it could not, in one sentence.\n */\nexport type RestoreResult =\n | { outcome: 'ok'; sandboxId: string; previewUrl: string }\n | { outcome: 'failed'; reason: string };\n\n/** One connector call's answer, the same on both paths: `{ successful, data, error }`. */\nexport interface SandboxCallResult {\n successful: boolean;\n data?: unknown;\n error?: string;\n}\n\n/** `outdated`: this server has no proxy field; otherwise `result` is the connector's answer. */\nexport interface SandboxProxyAnswer {\n outdated: boolean;\n result?: SandboxCallResult;\n}\n\n/**\n * The guarded proxy `aiCodeSandboxAction(channelId, sandboxId, action, params)`:\n * the server checks the caller's role and that the sandbox belongs to the\n * channel, then adds the sandbox key from the channel's settings (an agent\n * build's key included). `outdated` = this server has no such field.\n */\nexport type SandboxProxyCall = (\n variables: { channelId: string; sandboxId: string; action: string; params: Record<string, unknown> },\n timeoutMs: number,\n) => Promise<SandboxProxyAnswer>;\n\nexport type SandboxRun = (\n action: string,\n params: Record<string, unknown>,\n timeoutMs: number,\n) => Promise<SandboxCallResult>;\n\n/** Connector actions the proxy allows (web `sandboxProxy.SANDBOX_BOUND`); the rest go direct. */\nconst SANDBOX_BOUND = new Set([\n 'WEBBUILDER_EXTEND',\n 'WEBBUILDER_CONNECT',\n // A private sandbox answers STATUS only with its key, which the proxy adds.\n 'WEBBUILDER_STATUS',\n 'WEBBUILDER_START',\n 'WEBBUILDER_LIST_VERSIONS',\n 'WEBBUILDER_CREATE_SANDBOX',\n 'WEBBUILDER_READ_FILE',\n 'WEBBUILDER_WRITE_FILES',\n 'WEBBUILDER_RUN_COMMAND',\n 'WEBBUILDER_SNAPSHOT',\n 'WEBBUILDER_RESTORE_VERSION',\n 'WEBBUILDER_BOOKMARK_VERSION',\n 'WEBBUILDER_UPLOAD_ASSET',\n 'WEBBUILDER_RELOAD_GITHUB',\n 'WEBBUILDER_CLONE',\n // Editor+ on the server; an older server refuses them and callers fall back.\n 'WEBBUILDER_EXPORT_ZIP',\n 'WEBBUILDER_LIST_FILES',\n 'WEBBUILDER_FINISH',\n 'WEBBUILDER_DEPLOY_FLY',\n 'WEBBUILDER_DEPLOY_VERCEL',\n 'WEBBUILDER_DEPLOY_NETLIFY',\n // The server picks the repo and attaches the caller's own GitHub credential.\n 'WEBBUILDER_PUSH_GITHUB',\n 'WEBBUILDER_PULL_GITHUB',\n]);\n\n/** A server without the proxy (web `isOutdatedServerError`). */\nexport const OUTDATED_SERVER_RE =\n /Cannot query field|Unknown argument|Unknown type|is not defined by type|Cannot return null for non-nullable field Query\\.aiCode/i;\n\nfunction withoutKey(rec: Record<string, unknown>): Record<string, unknown> {\n const { sandboxKey: _key, sandbox_key: _key2, ...rest } = rec;\n return rest;\n}\n\n/** The proxy's JSON answer as a connector result, with any key dropped (web `proxyResult`). */\nexport function proxyResult(raw: unknown): SandboxCallResult {\n let value = raw;\n if (typeof value === 'string') {\n try {\n value = JSON.parse(value);\n } catch {\n value = null;\n }\n }\n if (!value || typeof value !== 'object' || Array.isArray(value)) {\n return { successful: false, error: 'The server sent an empty answer.' };\n }\n const rec = value as Record<string, unknown>;\n const data =\n rec.data && typeof rec.data === 'object' && !Array.isArray(rec.data)\n ? withoutKey(rec.data as Record<string, unknown>)\n : rec.data;\n const error = typeof rec.error === 'string' && rec.error ? rec.error : undefined;\n return { successful: rec.successful === true, data, ...(error ? { error } : {}) };\n}\n\n/** The proxy's answer when the caller has no project on the channel (missing, not a member, no role). */\nexport function isNoProjectRefusal(error: string | null | undefined): boolean {\n return /^Project not found\\.?($| \\()/i.test(String(error ?? '').trim());\n}\n\n/**\n * The proxy's \"Sandbox not found in this project.\": the sandbox exists, the project just has\n * not recorded it yet (a fresh agent build before its record lands). It is not gone - the call\n * goes direct, where the connector lets the sandbox's creator act on it.\n */\nexport function isUnrecordedSandboxRefusal(error: string | null | undefined): boolean {\n return /\\b(?:not found|not recorded|unknown) (?:in|for|on) this project\\b/i.test(String(error ?? ''));\n}\n\n/**\n * Channels with no server project for this person (an agent-chat build the AI made through\n * the cdecli agent), learnt from the proxy's \"Project not found.\" for the session: their\n * sandbox calls go direct - the connector lets a sandbox's creator act on it and boot their\n * own restore points without a key. Adopting the channel as a project switches it back.\n */\nexport const directChannels = new Set<string>();\n\n/**\n * Every sandbox call for one site, the web's `createSandboxRouter`: through the\n * proxy when the server has it (the app never holds a sandbox key), else straight\n * to cdecli-agent. A server found without the proxy stays direct for the session,\n * and so does a channel the proxy has no project for.\n */\nexport function createSandboxRouter(deps: {\n channelId: string | null | undefined;\n proxy: SandboxProxyCall | null;\n direct: SandboxRun;\n proxyMissing: { current: boolean };\n}): SandboxRun {\n const channelId = String(deps.channelId ?? '').trim();\n const { proxyMissing } = deps;\n return async (action, rawParams, timeoutMs) => {\n const params = withoutKey(rawParams);\n const sandboxId = String(params.sandbox_id ?? '').trim();\n const isCreate = action === 'WEBBUILDER_CREATE_SANDBOX';\n // `restoreFromBackup` is for the project proxy only (its templates-only check); the connector never sees it.\n const { restoreFromBackup: _proxyOnly, ...directParams } = params;\n const proxied =\n deps.proxy &&\n !proxyMissing.current &&\n channelId &&\n !directChannels.has(channelId) &&\n SANDBOX_BOUND.has(action) &&\n (sandboxId || isCreate);\n if (!proxied || !deps.proxy) return deps.direct(action, directParams, timeoutMs);\n const answer = await deps.proxy({ channelId, sandboxId, action, params }, timeoutMs);\n if (!answer.outdated) {\n const result = answer.result ?? { successful: false, error: 'The server sent an empty answer.' };\n // No project to hold the key: the connector lets the sandbox's creator act on it directly.\n if (!result.successful && isNoProjectRefusal(result.error)) {\n directChannels.add(channelId);\n return deps.direct(action, directParams, timeoutMs);\n }\n // Not recorded on the project yet: this call goes direct; the next tries the proxy again.\n if (!result.successful && isUnrecordedSandboxRefusal(result.error)) {\n return deps.direct(action, directParams, timeoutMs);\n }\n return result;\n }\n proxyMissing.current = true;\n return deps.direct(action, directParams, timeoutMs);\n };\n}\n\n/** The direct path: `yantra-webbuilder` on cdecli-agent with the surface session. */\nexport function directSandboxRun(token: string, indexUrl: string): SandboxRun {\n const exec = createRemoteConnectorExec(token, indexUrl);\n return async (action, params, timeoutMs) => {\n const result = await exec(WEBBUILDER_CONNECTOR_ID, action, params, { timeoutMs });\n return {\n successful: result.successful !== false,\n data: result.data,\n ...(typeof result.error === 'string' ? { error: result.error } : {}),\n };\n };\n}\n\n/** The connector's own output (web `connectorData`: the result's `data`, or `data.data`). */\nfunction connectorData(result: unknown): Record<string, unknown> {\n const raw = (result as { data?: unknown } | null)?.data;\n if (!raw || typeof raw !== 'object') return {};\n const rec = raw as Record<string, unknown>;\n return rec.data && typeof rec.data === 'object' && !Array.isArray(rec.data)\n ? (rec.data as Record<string, unknown>)\n : rec;\n}\n\nfunction livePreviewUrl(data: Record<string, unknown>): string | null {\n for (const value of [data.previewUrl, data.preview_url, data.sandboxUrl, data.sandbox_url, data.url]) {\n const match = typeof value === 'string' ? LIVE_PREVIEW_RE.exec(value.trim()) : null;\n if (match) return match[0];\n }\n return null;\n}\n\n/** The preview's dev server answers (not a 5xx \"Sandbox not found\" / \"Closed Port\" page), within `withinMs`. */\nexport async function waitForPreview(url: string, withinMs = 20_000): Promise<boolean> {\n const until = Date.now() + withinMs;\n while (Date.now() < until) {\n try {\n // eslint-disable-next-line no-await-in-loop -- one probe at a time\n const res = await fetch(url, { method: 'GET' });\n if (res.status < 500) return true;\n } catch {\n // not answering yet\n }\n // eslint-disable-next-line no-await-in-loop\n await new Promise((resolve) => {\n setTimeout(resolve, 2_000);\n });\n }\n return false;\n}\n\n/** One connector call, read the same on both paths: ok, gone (typed or worded), the raw text and `data`. */\nconst blobOf = (result: SandboxCallResult) => JSON.stringify(result);\n\nasync function runAction(call: SandboxRun, action: string, params: Record<string, unknown>, timeoutMs: number) {\n try {\n const result = await call(action, params, timeoutMs);\n return {\n ok: result.successful !== false,\n gone:\n isSandboxGoneResult(result) ||\n (!result.successful &&\n SANDBOX_GONE_RE.test(blobOf(result)) &&\n !/sandbox is private/i.test(blobOf(result))),\n blob: JSON.stringify(result),\n error: result.error ?? '',\n data: connectorData(result),\n savedCopy: savedCopyFrom(result),\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n const failed = { successful: false, error: message };\n return {\n ok: false,\n gone: isSandboxGoneResult(failed),\n blob: message,\n error: message,\n data: {} as Record<string, unknown>,\n savedCopy: savedCopyFrom(failed),\n };\n }\n}\n\nconst builderFor = (templateId?: string | null) => (/next/i.test(templateId ?? '') ? 'next' : 'vite');\n\n/** CONNECT then START across the workdirs; the URL is the one START (or CONNECT) reports. */\nasync function connectAndStart(\n call: SandboxRun,\n sandboxId: string,\n builder: string,\n savedCopyParams: Record<string, unknown> = {},\n): Promise<{ outcome: ResumeOutcome; url: string | null; savedCopy: SavedCopy | null }> {\n const connected = await runAction(\n call,\n 'WEBBUILDER_CONNECT',\n { sandbox_id: sandboxId, autoResume: true, builder, ...savedCopyParams },\n RESUME_TIMEOUT_MS,\n );\n if (connected.gone) return { outcome: 'gone', url: null, savedCopy: connected.savedCopy };\n const seen = livePreviewUrl(connected.data);\n for (const workDir of PREVIEW_START_WORKDIRS) {\n // eslint-disable-next-line no-await-in-loop -- one folder at a time, like the web\n const started = await runAction(\n call,\n 'WEBBUILDER_START',\n { sandbox_id: sandboxId, workDir, builder },\n RESUME_TIMEOUT_MS,\n );\n if (started.gone) return { outcome: 'gone', url: null, savedCopy: started.savedCopy };\n if (started.ok) return { outcome: 'ok', url: livePreviewUrl(started.data) || seen, savedCopy: null };\n // Only \"no package.json here\" means try the next folder.\n if (!/no package\\.json/i.test(started.blob)) break;\n }\n return { outcome: connected.ok ? 'ok' : 'failed', url: seen, savedCopy: null };\n}\n\n/** EXTEND's wait when the person opened the build (a quick answer) and when they asked to wake it. */\nconst EXTEND_OPEN_TIMEOUT_MS = 30_000;\nconst EXTEND_ASKED_TIMEOUT_MS = 90_000;\n/** The STATUS asked of a gone sandbox for its restore point. */\nconst STATUS_ON_GONE_TIMEOUT_MS = 30_000;\n\n/**\n * Brings a sleeping preview back without the agent, in the web's `ensurePreview` order:\n * EXTEND (it resumes a paused sandbox), then resume the sandbox (`WEBBUILDER_CONNECT` with\n * `autoResume`) and start its dev server (`WEBBUILDER_START`) in the folder the project lives\n * in. Waking never boots a new sandbox: `gone` means it was reclaimed, and restoring it from\n * its saved copy is the person's call ({@link restoreFromSavedCopy}). The wake calls name the\n * restore point and backup, so a gone answer says where to restore from (`savedCopy`).\n */\nexport async function wakeSandbox(\n call: SandboxRun,\n target: {\n sandboxId: string;\n snapshotId?: string | null;\n backupRepo?: string | null;\n templateId?: string | null;\n /** The build's preview, checked after EXTEND resumes the sandbox. */\n previewUrl?: string | null;\n /** The person asked to wake it (EXTEND may take longer); else it is opening. */\n asked?: boolean;\n },\n probe: (url: string) => Promise<boolean> = waitForPreview,\n): Promise<WakeResult> {\n const builder = builderFor(target.templateId);\n const savedCopyParams = {\n ...(String(target.snapshotId ?? '').trim() ? { snapshotId: String(target.snapshotId).trim() } : {}),\n ...(String(target.backupRepo ?? '').trim() ? { backupRepo: String(target.backupRepo).trim() } : {}),\n };\n const extended = await call(\n WEBBUILDER_EXTEND_ACTION,\n { sandbox_id: target.sandboxId, timeoutMs: KEEPALIVE_EXTEND_MS, ...savedCopyParams },\n target.asked ? EXTEND_ASKED_TIMEOUT_MS : EXTEND_OPEN_TIMEOUT_MS,\n ).catch((err: unknown) => ({ successful: false, error: err instanceof Error ? err.message : String(err) }));\n const extendState = extendOutcome(extended);\n const domain = publicSandboxDomain();\n const previewUrl = target.previewUrl || sandboxPreviewUrlFor(target.sandboxId, domain);\n if (extendState === 'resumed' || extendState === 'alive') {\n // EXTEND may name the preview it resumed.\n const extendedUrl = livePreviewUrl(connectorData(extended));\n const url = extendedUrl ? withPublicSandboxHosts(extendedUrl, domain) || previewUrl : previewUrl;\n if (await probe(url)) return { outcome: 'ok', ...(url !== previewUrl ? { previewUrl: url } : {}) };\n }\n // Gone for good: waking cannot help. Without a named restore point, one quick STATUS first (web a7153134):\n // its answer names the saved copy, so Restore can boot from it.\n const goneWith = async (named: SavedCopy | null): Promise<WakeResult> => {\n if (named?.snapshotId || savedCopyParams.snapshotId) return { outcome: 'gone', savedCopy: named };\n const status = await runAction(\n call,\n 'WEBBUILDER_STATUS',\n { sandbox_id: target.sandboxId, ...savedCopyParams },\n STATUS_ON_GONE_TIMEOUT_MS,\n );\n return { outcome: 'gone', savedCopy: status.savedCopy ?? named };\n };\n if (extendState === 'gone') return goneWith(savedCopyFrom(extended));\n const woken = await connectAndStart(call, target.sandboxId, builder, savedCopyParams);\n if (woken.outcome === 'gone') return goneWith(woken.savedCopy);\n return { outcome: woken.outcome };\n}\n\n/** A failed restore's reason as one plain sentence: no `[CODE]` tags, CLI wrappers or repeats (web `restoreReasonText`). */\nexport function restoreReasonText(raw: string | null | undefined): string {\n const lines = String(raw || '')\n .split('\\n')\n .map((l) =>\n l\n .replace(/^\\s*(?:Error:\\s*)?exit status \\d+:\\s*/i, '')\n .replace(/^\\s*Error:\\s*/i, '')\n .replace(/\\s*\\[[A-Z][A-Z0-9_]*(?:;[^\\]]*)?\\]\\s*$/, '')\n .replace(/[;,]?\\s*the user (?:cannot|can't|can not) fix this\\.?/i, '.')\n .replace(/\\.\\.$/, '.')\n .replace(/\\s+/g, ' ')\n .trim(),\n )\n .filter(Boolean);\n const first = lines[0] || '';\n if (!first) return 'The saved copy could not be opened.';\n if (/not one of yours and was not shared/i.test(first) || /SNAPSHOT_OWNER_UNKNOWN/.test(String(raw))) {\n return \"This saved copy isn't linked to your account yet, so it can't be reopened here.\";\n }\n if (/^at\\s/.test(first)) return 'The saved copy could not be opened.';\n const text = first.length > 220 ? `${first.slice(0, 219)}…` : first;\n return /[.!?…]$/.test(text) ? text : `${text}.`;\n}\n\n/**\n * Restore from saved copy (web): boot the build's latest restore point (the\n * one the connector named when it found the sandbox gone, else the build's) into a new sandbox\n * (`WEBBUILDER_CREATE_SANDBOX`, naming the sandbox it was saved from so an older restore point\n * can be proven ours) and start it. Without a restore point the agent restores it from its backup.\n */\nexport async function restoreFromSavedCopy(\n call: SandboxRun,\n target: { sandboxId: string; snapshotId?: string | null; templateId?: string | null },\n): Promise<RestoreResult> {\n const snapshotId = String(target.snapshotId ?? '').trim();\n if (!snapshotId) return { outcome: 'failed', reason: 'This build has no restore point the app can open.' };\n const builder = builderFor(target.templateId);\n const domain = publicSandboxDomain();\n // waitBridge:false - the new id comes back as soon as E2B creates the VM; CONNECT waits for the daemon.\n const created = await runAction(\n call,\n 'WEBBUILDER_CREATE_SANDBOX',\n { snapshotId, sourceSandboxId: target.sandboxId, builder, waitBridge: false },\n CREATE_TIMEOUT_MS,\n );\n const createdUrl = livePreviewUrl(created.data);\n const nextId =\n String(created.data.sandboxId || created.data.sandbox_id || created.data.id || '').trim() ||\n /^https?:\\/\\/\\d+-([a-z0-9]+)/i.exec(createdUrl ?? '')?.[1] ||\n '';\n if (!created.ok || !nextId) return { outcome: 'failed', reason: restoreReasonText(created.error || created.blob) };\n const started = await connectAndStart(call, nextId, builder);\n if (started.outcome !== 'ok') return { outcome: 'failed', reason: 'The restored copy did not start.' };\n return {\n outcome: 'ok',\n sandboxId: nextId,\n previewUrl:\n withPublicSandboxHosts(started.url || createdUrl || '', domain) || sandboxPreviewUrlFor(nextId, domain),\n };\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAM,kBAAqB,GAAA,GAAA;AAUL,eAAA,YAAA,CAAa,KAAe,EAAA,QAAA,EAAkB,MAA0D,EAAA;AAtB9H,EAAA,IAAA,EAAA;AAuBE,EAAI,IAAA;AACF,IAAM,MAAA,MAAA,GAAS,MAAM,yBAA0B,CAAA,KAAA,EAAO,QAAQ,CAAE,CAAA,uBAAA,EAAyB,oCAAoC,MAAQ,EAAA;AAAA,MACnI,SAAW,EAAA;AAAA,KACZ,CAAA;AACD,IAAI,IAAA,MAAA,CAAO,eAAe,KAAO,EAAA;AAC/B,MAAA,MAAM,KAAQ,GAAA,MAAA,CAAA,CAAO,EAAO,GAAA,MAAA,CAAA,KAAA,KAAP,YAAgB,0BAA0B,CAAA;AAC/D,MAAO,OAAA;AAAA,QACL,EAAI,EAAA,KAAA;AAAA,QACJ,KAAA;AAAA,QACA,IAAA,EAAM,0BA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AC1K,EAAA,IAAI,CAAC,OAAA,CAAQ,EAAM,IAAA,CAAC,QAAe,OAAA;AAAA,IACjC,OAAS,EAAA,QAAA;AAAA,IACT,MAAQ,EAAA,iBAAA,CAAkB,OAAQ,CAAA,KAAA,IAAS,QAAQ,IAAI;AAAA,GACzD;AACA,EAAA,MAAM,OAAU,GAAA,MAAM,eAAgB,CAAA,IAAA,EAAM,QAAQ,OAAO,CAAA;AAC3D,EAAI,IAAA,OAAA,CAAQ,OAAY,KAAA,IAAA,EAAa,OAAA;AAAA,IACnC,OAAS,EAAA,QAAA;AAAA,IACT,MAAQ,EAAA;AAAA,GACV;AACA,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,IAAA;AAAA,IACT,SAAW,EAAA,MAAA;AAAA,IACX,UAAA,EAAY,sBAAuB,CAAA,OAAA,CAAQ,GAAO,IAAA,UAAA,IAAc,IAAI,MAAM,CAAA,IAAK,oBAAqB,CAAA,MAAA,EAAQ,MAAM;AAAA,GACpH;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminide-stack/yantra-mobile",
3
- "version": "12.0.172",
3
+ "version": "12.0.174-alpha.0",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -27,7 +27,7 @@
27
27
  "uuid": "^9.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "common": "12.0.170",
30
+ "common": "12.0.174-alpha.0",
31
31
  "libphonenumber-js": "^1.13.3"
32
32
  },
33
33
  "peerDependencies": {
@@ -45,7 +45,7 @@
45
45
  "@messenger-box/platform-mobile": "*",
46
46
  "@react-native-async-storage/async-storage": "*",
47
47
  "@react-navigation/native": "*",
48
- "common": "12.0.170",
48
+ "common": "12.0.170-alpha.0",
49
49
  "expo-background-task": "*",
50
50
  "expo-constants": "*",
51
51
  "expo-secure-store": "*",
@@ -67,5 +67,5 @@
67
67
  "typescript": {
68
68
  "definition": "lib/index.d.ts"
69
69
  },
70
- "gitHead": "d7fafbb425c3c7c299be0e1b2fb13b2d8ad27f8b"
70
+ "gitHead": "8165437ca9c4aa55ee2b4c4e9c80449998e99537"
71
71
  }
@@ -1,76 +0,0 @@
1
- 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
- const PERMISSION_LEVELS = ["visitor", "member", "operator"];
21
- const PERMISSION_LABELS = {
22
- visitor: "Visitor",
23
- member: "Member",
24
- operator: "Operator"
25
- };
26
- const PERMISSION_DESCRIPTIONS = {
27
- visitor: "Can look around and interact, but cannot build.",
28
- member: "Can build, break, and use items.",
29
- operator: "Full control: build anywhere, teleport, use commands, and manage others."
30
- };
31
- function baseCapabilities(level) {
32
- switch (level) {
33
- case "visitor":
34
- return {
35
- canInteract: true,
36
- canBuild: false,
37
- canUseItems: false,
38
- canTeleport: false,
39
- canUseCommands: false,
40
- canManagePermissions: false
41
- };
42
- case "member":
43
- return {
44
- canInteract: true,
45
- canBuild: true,
46
- canUseItems: true,
47
- canTeleport: false,
48
- canUseCommands: false,
49
- canManagePermissions: false
50
- };
51
- case "operator":
52
- return {
53
- canInteract: true,
54
- canBuild: true,
55
- canUseItems: true,
56
- canTeleport: true,
57
- canUseCommands: true,
58
- canManagePermissions: true
59
- };
60
- }
61
- }
62
- function effectiveCapabilities(level, settings) {
63
- const caps = baseCapabilities(level);
64
- if (settings.immutableWorld && level !== "operator") {
65
- return __spreadProps(__spreadValues({}, caps), {
66
- canBuild: false
67
- });
68
- }
69
- return caps;
70
- }
71
- function defaultPermissionModel() {
72
- return {
73
- hostEnabled: false,
74
- defaultLevel: "member"
75
- };
76
- }export{PERMISSION_DESCRIPTIONS,PERMISSION_LABELS,PERMISSION_LEVELS,baseCapabilities,defaultPermissionModel,effectiveCapabilities};//# sourceMappingURL=permissions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permissions.js","sources":["../../../../../../src/features/games/vendored/core/classroom/permissions.ts"],"sourcesContent":["/**\n * Player permission model.\n *\n * A world host can set a default permission level for players who join, and each\n * level grants a fixed set of capabilities. \"Immutable world\" additionally\n * removes build rights from everyone below Operator, so a teacher can lock a\n * world for a demo while keeping their own ability to edit it.\n */\n\nimport type { WorldSettings } from './worldSettings';\n\nexport type PermissionLevel = 'visitor' | 'member' | 'operator';\n\nexport const PERMISSION_LEVELS: readonly PermissionLevel[] = ['visitor', 'member', 'operator'];\n\nexport const PERMISSION_LABELS: Record<PermissionLevel, string> = {\n visitor: 'Visitor',\n member: 'Member',\n operator: 'Operator',\n};\n\nexport const PERMISSION_DESCRIPTIONS: Record<PermissionLevel, string> = {\n visitor: 'Can look around and interact, but cannot build.',\n member: 'Can build, break, and use items.',\n operator: 'Full control: build anywhere, teleport, use commands, and manage others.',\n};\n\nexport interface Capabilities {\n /** Interact with blocks (buttons, doors) without changing the world. */\n canInteract: boolean;\n /** Place and break blocks. */\n canBuild: boolean;\n /** Use items from the palette. */\n canUseItems: boolean;\n canTeleport: boolean;\n canUseCommands: boolean;\n canManagePermissions: boolean;\n}\n\nexport function baseCapabilities(level: PermissionLevel): Capabilities {\n switch (level) {\n case 'visitor':\n return {\n canInteract: true,\n canBuild: false,\n canUseItems: false,\n canTeleport: false,\n canUseCommands: false,\n canManagePermissions: false,\n };\n case 'member':\n return {\n canInteract: true,\n canBuild: true,\n canUseItems: true,\n canTeleport: false,\n canUseCommands: false,\n canManagePermissions: false,\n };\n case 'operator':\n return {\n canInteract: true,\n canBuild: true,\n canUseItems: true,\n canTeleport: true,\n canUseCommands: true,\n canManagePermissions: true,\n };\n }\n}\n\n/** Capabilities after world rules are applied (e.g. immutable world). */\nexport function effectiveCapabilities(level: PermissionLevel, settings: WorldSettings): Capabilities {\n const caps = baseCapabilities(level);\n if (settings.immutableWorld && level !== 'operator') {\n return { ...caps, canBuild: false };\n }\n return caps;\n}\n\nexport interface PermissionModel {\n /** Whether the host has opened the world for others to join. */\n hostEnabled: boolean;\n /** The permission level assigned to players by default. */\n defaultLevel: PermissionLevel;\n}\n\nexport function defaultPermissionModel(): PermissionModel {\n return { hostEnabled: false, defaultLevel: 'member' };\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAWO,MAAM,iBAAgD,GAAA,CAAC,SAAW,EAAA,QAAA,EAAU,UAAU;AACtF,MAAM,iBAAqD,GAAA;AAAA,EAChE,OAAS,EAAA,SAAA;AAAA,EACT,MAAQ,EAAA,QAAA;AAAA,EACR,QAAU,EAAA;AACZ;AACO,MAAM,uBAA2D,GAAA;AAAA,EACtE,OAAS,EAAA,iDAAA;AAAA,EACT,MAAQ,EAAA,kCAAA;AAAA,EACR,QAAU,EAAA;AACZ;AAYO,SAAS,iBAAiB,KAAsC,EAAA;AACrE,EAAA,QAAQ,KAAO;AAAA,IACb,KAAK,SAAA;AACH,MAAO,OAAA;AAAA,QACL,WAAa,EAAA,IAAA;AAAA,QACb,QAAU,EAAA,KAAA;AAAA,QACV,WAAa,EAAA,KAAA;AAAA,QACb,WAAa,EAAA,KAAA;AAAA,QACb,cAAgB,EAAA,KAAA;AAAA,QAChB,oBAAsB,EAAA;AAAA,OACxB;AAAA,IACF,KAAK,QAAA;AACH,MAAO,OAAA;AAAA,QACL,WAAa,EAAA,IAAA;AAAA,QACb,QAAU,EAAA,IAAA;AAAA,QACV,WAAa,EAAA,IAAA;AAAA,QACb,WAAa,EAAA,KAAA;AAAA,QACb,cAAgB,EAAA,KAAA;AAAA,QAChB,oBAAsB,EAAA;AAAA,OACxB;AAAA,IACF,KAAK,UAAA;AACH,MAAO,OAAA;AAAA,QACL,WAAa,EAAA,IAAA;AAAA,QACb,QAAU,EAAA,IAAA;AAAA,QACV,WAAa,EAAA,IAAA;AAAA,QACb,WAAa,EAAA,IAAA;AAAA,QACb,cAAgB,EAAA,IAAA;AAAA,QAChB,oBAAsB,EAAA;AAAA,OACxB;AAAA;AAEN;AAGgB,SAAA,qBAAA,CAAsB,OAAwB,QAAuC,EAAA;AACnG,EAAM,MAAA,IAAA,GAAO,iBAAiB,KAAK,CAAA;AACnC,EAAI,IAAA,QAAA,CAAS,cAAkB,IAAA,KAAA,KAAU,UAAY,EAAA;AACnD,IAAA,OAAO,iCACF,IADE,CAAA,EAAA;AAAA,MAEL,QAAU,EAAA;AAAA,KACZ,CAAA;AAAA;AAEF,EAAO,OAAA,IAAA;AACT;AAOO,SAAS,sBAA0C,GAAA;AACxD,EAAO,OAAA;AAAA,IACL,WAAa,EAAA,KAAA;AAAA,IACb,YAAc,EAAA;AAAA,GAChB;AACF"}
@@ -1,101 +0,0 @@
1
- const RESOURCE_LINK_MAX_URL = 1024;
2
- const RESOURCE_LINK_MAX_BUTTON_NAME = 48;
3
- function emptyResourceLink() {
4
- return {
5
- buttonName: "",
6
- url: ""
7
- };
8
- }
9
- const ALLOWED_SCHEMES = /* @__PURE__ */ new Set(["http:", "https:"]);
10
- function validateResourceLinkUrl(raw) {
11
- const trimmed = raw.trim();
12
- if (trimmed === "") return {
13
- ok: true,
14
- url: "",
15
- empty: true
16
- };
17
- if (trimmed.length > RESOURCE_LINK_MAX_URL) {
18
- return {
19
- ok: false,
20
- code: "too-long",
21
- message: `Link must be ${RESOURCE_LINK_MAX_URL} characters or fewer.`
22
- };
23
- }
24
- let parsed;
25
- try {
26
- parsed = new URL(trimmed);
27
- } catch (e) {
28
- return {
29
- ok: false,
30
- code: "invalid-url",
31
- message: "Enter a full web address, like https://example.com/page."
32
- };
33
- }
34
- if (!ALLOWED_SCHEMES.has(parsed.protocol)) {
35
- return {
36
- ok: false,
37
- code: "unsupported-scheme",
38
- message: "Only http and https links are allowed."
39
- };
40
- }
41
- const host = parsed.hostname.toLowerCase();
42
- if (host === "") {
43
- return {
44
- ok: false,
45
- code: "missing-host",
46
- message: "The link is missing a website address."
47
- };
48
- }
49
- if (isBlockedHost(host)) {
50
- return {
51
- ok: false,
52
- code: "blocked-host",
53
- message: "Internal and private addresses are not allowed for student links."
54
- };
55
- }
56
- return {
57
- ok: true,
58
- url: parsed.toString(),
59
- empty: false
60
- };
61
- }
62
- function normalizeResourceLink(link) {
63
- const validation = validateResourceLinkUrl(link.url);
64
- const url = validation.ok && !validation.empty ? validation.url : "";
65
- const buttonName = link.buttonName.trim().slice(0, RESOURCE_LINK_MAX_BUTTON_NAME);
66
- return {
67
- buttonName,
68
- url
69
- };
70
- }
71
- function isBlockedHost(host) {
72
- const h = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
73
- if (h === "localhost" || h.endsWith(".localhost")) return true;
74
- if (h.endsWith(".local")) return true;
75
- if (h === "::1" || h === "::" || h.startsWith("fe80:") || h.startsWith("fc") || h.startsWith("fd")) {
76
- return true;
77
- }
78
- const v4 = parseIpv4(h);
79
- if (v4) {
80
- const [a, b] = v4;
81
- if (a === 10) return true;
82
- if (a === 127) return true;
83
- if (a === 0) return true;
84
- if (a === 169 && b === 254) return true;
85
- if (a === 192 && b === 168) return true;
86
- if (a === 172 && b >= 16 && b <= 31) return true;
87
- }
88
- return false;
89
- }
90
- function parseIpv4(host) {
91
- const parts = host.split(".");
92
- if (parts.length !== 4) return null;
93
- const octets = [];
94
- for (const part of parts) {
95
- if (!/^\d{1,3}$/.test(part)) return null;
96
- const n = Number(part);
97
- if (n > 255) return null;
98
- octets.push(n);
99
- }
100
- return [octets[0], octets[1], octets[2], octets[3]];
101
- }export{RESOURCE_LINK_MAX_BUTTON_NAME,RESOURCE_LINK_MAX_URL,emptyResourceLink,normalizeResourceLink,validateResourceLinkUrl};//# sourceMappingURL=resourceLink.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resourceLink.js","sources":["../../../../../../src/features/games/vendored/core/classroom/resourceLink.ts"],"sourcesContent":["/**\n * The teacher resource link.\n *\n * A teacher can set a button name plus a URL; students see that button in the\n * in-world menu and tapping it opens the link. The feature study of a comparable\n * classroom product found its UI shipped with NO scheme/host validation on this\n * field (only a 1024-char cap), leaving it to a native handler. Yantra Games\n * validates here, in shared logic, so an unsafe link can never be stored:\n *\n * - only http / https are accepted (javascript:, data:, file:, etc. are rejected);\n * - loopback, link-local, and private-network hosts are rejected so a link can\n * never point students at an internal/admin address;\n * - the URL is length-capped.\n */\n\nexport interface ResourceLink {\n /** Teacher-chosen button label. Empty => a sensible default label is shown. */\n buttonName: string;\n /** The URL to open. Empty => no resource-link button is shown. */\n url: string;\n}\n\nexport const RESOURCE_LINK_MAX_URL = 1024;\nexport const RESOURCE_LINK_MAX_BUTTON_NAME = 48;\nexport const RESOURCE_LINK_DEFAULT_BUTTON_NAME = 'Open Link';\n\nexport function emptyResourceLink(): ResourceLink {\n return { buttonName: '', url: '' };\n}\n\nexport type ResourceLinkErrorCode = 'too-long' | 'invalid-url' | 'unsupported-scheme' | 'missing-host' | 'blocked-host';\n\nexport type ResourceLinkValidation =\n | { ok: true; url: string; empty: boolean }\n | { ok: false; code: ResourceLinkErrorCode; message: string };\n\nconst ALLOWED_SCHEMES = new Set(['http:', 'https:']);\n\n/**\n * Validate a resource-link URL. An empty string is valid and means \"no link\".\n */\nexport function validateResourceLinkUrl(raw: string): ResourceLinkValidation {\n const trimmed = raw.trim();\n if (trimmed === '') return { ok: true, url: '', empty: true };\n\n if (trimmed.length > RESOURCE_LINK_MAX_URL) {\n return {\n ok: false,\n code: 'too-long',\n message: `Link must be ${RESOURCE_LINK_MAX_URL} characters or fewer.`,\n };\n }\n\n let parsed: URL;\n try {\n parsed = new URL(trimmed);\n } catch {\n return {\n ok: false,\n code: 'invalid-url',\n message: 'Enter a full web address, like https://example.com/page.',\n };\n }\n\n if (!ALLOWED_SCHEMES.has(parsed.protocol)) {\n return {\n ok: false,\n code: 'unsupported-scheme',\n message: 'Only http and https links are allowed.',\n };\n }\n\n const host = parsed.hostname.toLowerCase();\n if (host === '') {\n return { ok: false, code: 'missing-host', message: 'The link is missing a website address.' };\n }\n if (isBlockedHost(host)) {\n return {\n ok: false,\n code: 'blocked-host',\n message: 'Internal and private addresses are not allowed for student links.',\n };\n }\n\n return { ok: true, url: parsed.toString(), empty: false };\n}\n\n/** The label to show on the resource-link button. */\nexport function resourceLinkButtonLabel(link: ResourceLink): string {\n const name = link.buttonName.trim();\n return name === '' ? RESOURCE_LINK_DEFAULT_BUTTON_NAME : name;\n}\n\n/** Whether the resource link is set and valid (and therefore shown to students). */\nexport function isResourceLinkActive(link: ResourceLink): boolean {\n const result = validateResourceLinkUrl(link.url);\n return result.ok && !result.empty;\n}\n\n/**\n * Normalise a resource link for storage: a valid URL is canonicalised, the\n * button name is capped, and an invalid or empty URL collapses to \"no link\".\n */\nexport function normalizeResourceLink(link: ResourceLink): ResourceLink {\n const validation = validateResourceLinkUrl(link.url);\n const url = validation.ok && !validation.empty ? validation.url : '';\n const buttonName = link.buttonName.trim().slice(0, RESOURCE_LINK_MAX_BUTTON_NAME);\n return { buttonName, url };\n}\n\n/** Reject loopback, link-local, and private-network hosts. */\nfunction isBlockedHost(host: string): boolean {\n // Strip IPv6 brackets if present.\n const h = host.startsWith('[') && host.endsWith(']') ? host.slice(1, -1) : host;\n\n if (h === 'localhost' || h.endsWith('.localhost')) return true;\n if (h.endsWith('.local')) return true;\n if (h === '::1' || h === '::' || h.startsWith('fe80:') || h.startsWith('fc') || h.startsWith('fd')) {\n return true;\n }\n\n const v4 = parseIpv4(h);\n if (v4) {\n const [a, b] = v4;\n if (a === 10) return true; // 10.0.0.0/8\n if (a === 127) return true; // loopback\n if (a === 0) return true; // 0.0.0.0/8\n if (a === 169 && b === 254) return true; // link-local\n if (a === 192 && b === 168) return true; // private\n if (a === 172 && b >= 16 && b <= 31) return true; // private\n }\n return false;\n}\n\n/** Parse a dotted IPv4 string into four octets, or null if it is not one. */\nfunction parseIpv4(host: string): [number, number, number, number] | null {\n const parts = host.split('.');\n if (parts.length !== 4) return null;\n const octets: number[] = [];\n for (const part of parts) {\n if (!/^\\d{1,3}$/.test(part)) return null;\n const n = Number(part);\n if (n > 255) return null;\n octets.push(n);\n }\n return [octets[0]!, octets[1]!, octets[2]!, octets[3]!];\n}\n"],"names":[],"mappings":"AAqBO,MAAM,qBAAwB,GAAA;AAC9B,MAAM,6BAAgC,GAAA;AAEtC,SAAS,iBAAkC,GAAA;AAChD,EAAO,OAAA;AAAA,IACL,UAAY,EAAA,EAAA;AAAA,IACZ,GAAK,EAAA;AAAA,GACP;AACF;AAWA,MAAM,kCAAsB,IAAA,GAAA,CAAI,CAAC,OAAA,EAAS,QAAQ,CAAC,CAAA;AAK5C,SAAS,wBAAwB,GAAqC,EAAA;AAC3E,EAAM,MAAA,OAAA,GAAU,IAAI,IAAK,EAAA;AACzB,EAAI,IAAA,OAAA,KAAY,IAAW,OAAA;AAAA,IACzB,EAAI,EAAA,IAAA;AAAA,IACJ,GAAK,EAAA,EAAA;AAAA,IACL,KAAO,EAAA;AAAA,GACT;AACA,EAAI,IAAA,OAAA,CAAQ,SAAS,qBAAuB,EAAA;AAC1C,IAAO,OAAA;AAAA,MACL,EAAI,EAAA,KAAA;AAAA,MACJ,IAAM,EAAA,UAAA;AAAA,MACN,OAAA,EAAS,gBAAgB,qBAAqB,CAAA,qBAAA;AAAA,KAChD;AAAA;AAEF,EAAI,IAAA,MAAA;AACJ,EAAI,IAAA;AACF,IAAS,MAAA,GAAA,IAAI,IAAI,OAAO,CAAA;AAAA,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AAI,IAAA,KAAA,CAAM,MAAW,KAAA,CAAA,EAAU,OAAA,IAAA;AAC/B,EAAA,MAAM,SAAmB,EAAC;AAC1B,EAAA,KAAA,MAAW,QAAQ,KAAO,EAAA;AACxB,IAAA,IAAI,CAAC,WAAA,CAAY,IAAK,CAAA,IAAI,GAAU,OAAA,IAAA;AACpC,IAAM,MAAA,CAAA,GAAI,OAAO,IAAI,CAAA;AACrB,IAAI,IAAA,CAAA,GAAI,KAAY,OAAA,IAAA;AACpB,IAAA,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA;AAEf,EAAA,OAAO,CAAC,MAAA,CAAO,CAAC,CAAA,EAAI,MAAO,CAAA,CAAC,CAAI,EAAA,MAAA,CAAO,CAAC,CAAA,EAAI,MAAO,CAAA,CAAC,CAAE,CAAA;AACxD"}
@@ -1,83 +0,0 @@
1
- import {BOOLEAN_SETTING_KEYS}from'./worldSettings.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
- const COUPLINGS = [{
21
- parent: "destructiveItems",
22
- when: false,
23
- children: ["tntExplodes", "respawnBlocksExplode", "fireSpreads"],
24
- force: false,
25
- reason: "Destructive items are turned off"
26
- }, {
27
- parent: "playerDamage",
28
- when: false,
29
- children: ["pvp", "friendlyFire"],
30
- force: false,
31
- reason: "Player damage is turned off"
32
- }, {
33
- parent: "mobsRestricted",
34
- when: true,
35
- children: ["mobSpawning"],
36
- force: false,
37
- reason: "Mobs are restricted"
38
- }, {
39
- parent: "perfectWeather",
40
- when: true,
41
- children: ["weatherCycle"],
42
- force: false,
43
- reason: "Perfect weather is on"
44
- }];
45
- function evaluateRules(settings) {
46
- const result = {};
47
- for (const key of BOOLEAN_SETTING_KEYS) {
48
- result[key] = {
49
- value: settings[key],
50
- locked: false
51
- };
52
- }
53
- for (const coupling of COUPLINGS) {
54
- if (settings[coupling.parent] !== coupling.when) continue;
55
- for (const child of coupling.children) {
56
- result[child] = {
57
- value: coupling.force,
58
- locked: true,
59
- lockedReason: coupling.reason
60
- };
61
- }
62
- }
63
- return result;
64
- }
65
- function applyRuleConstraints(settings) {
66
- const rules = evaluateRules(settings);
67
- let next = null;
68
- for (const key of BOOLEAN_SETTING_KEYS) {
69
- const state = rules[key];
70
- if (state.locked && settings[key] !== state.value) {
71
- if (!next) next = __spreadValues({}, settings);
72
- next[key] = state.value;
73
- }
74
- }
75
- return next != null ? next : settings;
76
- }
77
- function setBooleanSetting(settings, key, value) {
78
- if (evaluateRules(settings)[key].locked) return settings;
79
- if (settings[key] === value) return applyRuleConstraints(settings);
80
- return applyRuleConstraints(__spreadProps(__spreadValues({}, settings), {
81
- [key]: value
82
- }));
83
- }export{applyRuleConstraints,evaluateRules,setBooleanSetting};//# sourceMappingURL=rules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules.js","sources":["../../../../../../src/features/games/vendored/core/classroom/rules.ts"],"sourcesContent":["/**\n * The world-rule coupling engine.\n *\n * Some master classroom rules force dependent rules into a fixed state and lock\n * them. For example, turning \"Destructive items\" off forces explosions and fire\n * spread off and prevents the teacher from turning them back on while it stays\n * off. This module is the single authority for those couplings.\n *\n * Crucially, `setBooleanSetting` and `applyRuleConstraints` *normalise* the\n * stored settings so a forced rule is actually stored in its forced state. That\n * means a saved-and-reloaded world can never come back with a locked toggle in a\n * contradictory position - the UI and the enforced state stay in agreement.\n */\n\nimport { BOOLEAN_SETTING_KEYS, type BooleanSettingKey, type WorldSettings } from './worldSettings';\n\nexport interface RuleState {\n /** The effective value, after couplings are applied. */\n value: boolean;\n /** Whether the teacher is allowed to change it right now. */\n locked: boolean;\n /** Why it is locked, if it is. */\n lockedReason?: string;\n}\n\nexport type EvaluatedRules = Record<BooleanSettingKey, RuleState>;\n\ninterface Coupling {\n readonly parent: BooleanSettingKey;\n /** The parent value that activates this coupling. */\n readonly when: boolean;\n readonly children: readonly BooleanSettingKey[];\n /** The value each child is forced to while the coupling is active. */\n readonly force: boolean;\n readonly reason: string;\n}\n\nconst COUPLINGS: readonly Coupling[] = [\n {\n parent: 'destructiveItems',\n when: false,\n children: ['tntExplodes', 'respawnBlocksExplode', 'fireSpreads'],\n force: false,\n reason: 'Destructive items are turned off',\n },\n {\n parent: 'playerDamage',\n when: false,\n children: ['pvp', 'friendlyFire'],\n force: false,\n reason: 'Player damage is turned off',\n },\n {\n parent: 'mobsRestricted',\n when: true,\n children: ['mobSpawning'],\n force: false,\n reason: 'Mobs are restricted',\n },\n {\n parent: 'perfectWeather',\n when: true,\n children: ['weatherCycle'],\n force: false,\n reason: 'Perfect weather is on',\n },\n];\n\n/** Compute the effective value and lock state of every boolean rule. */\nexport function evaluateRules(settings: WorldSettings): EvaluatedRules {\n const result = {} as EvaluatedRules;\n for (const key of BOOLEAN_SETTING_KEYS) {\n result[key] = { value: settings[key], locked: false };\n }\n for (const coupling of COUPLINGS) {\n if (settings[coupling.parent] !== coupling.when) continue;\n for (const child of coupling.children) {\n result[child] = {\n value: coupling.force,\n locked: true,\n lockedReason: coupling.reason,\n };\n }\n }\n return result;\n}\n\n/** Whether a given rule is currently locked by a master rule. */\nexport function isLocked(settings: WorldSettings, key: BooleanSettingKey): boolean {\n return evaluateRules(settings)[key].locked;\n}\n\n/**\n * Return settings normalised so every locked rule holds its forced value.\n * Returns the same reference when nothing needed changing.\n */\nexport function applyRuleConstraints(settings: WorldSettings): WorldSettings {\n const rules = evaluateRules(settings);\n let next: WorldSettings | null = null;\n for (const key of BOOLEAN_SETTING_KEYS) {\n const state = rules[key];\n if (state.locked && settings[key] !== state.value) {\n if (!next) next = { ...settings };\n next[key] = state.value;\n }\n }\n return next ?? settings;\n}\n\n/**\n * Set a boolean rule, respecting locks and re-normalising couplings.\n * A write to a currently-locked rule is ignored (returns the input unchanged).\n */\nexport function setBooleanSetting(settings: WorldSettings, key: BooleanSettingKey, value: boolean): WorldSettings {\n if (evaluateRules(settings)[key].locked) return settings;\n if (settings[key] === value) return applyRuleConstraints(settings);\n return applyRuleConstraints({ ...settings, [key]: value });\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAiCA,MAAM,YAAiC,CAAC;AAAA,EACtC,MAAQ,EAAA,kBAAA;AAAA,EACR,IAAM,EAAA,KAAA;AAAA,EACN,QAAU,EAAA,CAAC,aAAe,EAAA,sBAAA,EAAwB,aAAa,CAAA;AAAA,EAC/D,KAAO,EAAA,KAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,MAAQ,EAAA,cAAA;AAAA,EACR,IAAM,EAAA,KAAA;AAAA,EACN,QAAA,EAAU,CAAC,KAAA,EAAO,cAAc,CAAA;AAAA,EAChC,KAAO,EAAA,KAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,MAAQ,EAAA,gBAAA;AAAA,EACR,IAAM,EAAA,IAAA;AAAA,EACN,QAAA,EAAU,CAAC,aAAa,CAAA;AAAA,EACxB,KAAO,EAAA,KAAA;AAAA,EACP,MAAQ,EAAA;AACV,CAAG,EAAA;AAAA,EACD,MAAQ,EAAA,gBAAA;AAAA,EACR,IAAM,EAAA,IAAA;AAAA,EACN,QAAA,EAAU,CAAC,cAAc,CAAA;AAAA,EACzB,KAA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AA;AAChH,EAAA,IAAI,cAAc,QAAQ,CAAA,CAAE,GAAG,CAAA,CAAE,QAAe,OAAA,QAAA;AAChD,EAAA,IAAI,SAAS,GAAG,CAAA,KAAM,KAAO,EAAA,OAAO,qBAAqB,QAAQ,CAAA;AACjE,EAAO,OAAA,oBAAA,CAAqB,iCACvB,QADuB,CAAA,EAAA;AAAA,IAE1B,CAAC,GAAG,GAAG;AAAA,GACR,CAAA,CAAA;AACH"}
@@ -1,49 +0,0 @@
1
- import {emptyResourceLink}from'./resourceLink.js';const BOOLEAN_SETTING_KEYS = ["destructiveItems", "playerDamage", "immutableWorld", "mobsRestricted", "perfectWeather", "showBorderEffects", "tntExplodes", "respawnBlocksExplode", "fireSpreads", "pvp", "friendlyFire", "mobSpawning", "weatherCycle"];
2
- function defaultWorldSettings() {
3
- return {
4
- destructiveItems: true,
5
- playerDamage: true,
6
- immutableWorld: false,
7
- mobsRestricted: false,
8
- perfectWeather: false,
9
- showBorderEffects: false,
10
- tntExplodes: true,
11
- respawnBlocksExplode: true,
12
- fireSpreads: true,
13
- pvp: true,
14
- friendlyFire: false,
15
- mobSpawning: true,
16
- weatherCycle: true,
17
- resourceLink: emptyResourceLink()
18
- };
19
- }
20
- const SETTING_LABELS = {
21
- destructiveItems: "Destructive items",
22
- playerDamage: "Player damage",
23
- immutableWorld: "Immutable world",
24
- mobsRestricted: "Mobs restricted",
25
- perfectWeather: "Perfect weather",
26
- showBorderEffects: "Show border effects",
27
- tntExplodes: "Explosives detonate",
28
- respawnBlocksExplode: "Respawn blocks explode",
29
- fireSpreads: "Fire spreads",
30
- pvp: "Player vs player",
31
- friendlyFire: "Friendly fire",
32
- mobSpawning: "Creature spawning",
33
- weatherCycle: "Weather cycle"
34
- };
35
- const SETTING_DESCRIPTIONS = {
36
- destructiveItems: "Allow explosives and harmful items. Off also disables explosions and fire spread.",
37
- playerDamage: "Players can take damage. Off makes everyone invulnerable and disables combat.",
38
- immutableWorld: "Players can interact but cannot break or place blocks. Great for demos and assessments.",
39
- mobsRestricted: "No creatures spawn anywhere in the world.",
40
- perfectWeather: "Keep the sky clear. Stops the weather from changing.",
41
- showBorderEffects: "Show a visible effect on the edges of the build area.",
42
- tntExplodes: "Explosives can detonate and damage the world.",
43
- respawnBlocksExplode: "Respawn blocks can explode when used in the wrong place.",
44
- fireSpreads: "Fire can spread from block to block.",
45
- pvp: "Players can damage one another.",
46
- friendlyFire: "Players on the same team can damage one another.",
47
- mobSpawning: "Creatures spawn naturally over time.",
48
- weatherCycle: "Weather changes on its own over time."
49
- };export{BOOLEAN_SETTING_KEYS,SETTING_DESCRIPTIONS,SETTING_LABELS,defaultWorldSettings};//# sourceMappingURL=worldSettings.js.map