@mudlet/mudlet-web 0.5.0 → 1.0.1

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 (301) hide show
  1. package/README.md +1 -1
  2. package/dist-lib/analytics.d.ts +27 -0
  3. package/dist-lib/assets/fonts/Vera.woff2 +0 -0
  4. package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
  5. package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
  6. package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
  7. package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
  8. package/dist-lib/backupImport-wt8r7JXI.js +233 -0
  9. package/dist-lib/branding.d.ts +111 -13
  10. package/dist-lib/db/sqliteClient.d.ts +195 -7
  11. package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
  12. package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
  13. package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
  14. package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
  15. package/dist-lib/import/applyMudletProfile.d.ts +35 -9
  16. package/dist-lib/import/backupImport.d.ts +118 -0
  17. package/dist-lib/import/collectProfileExport.d.ts +33 -2
  18. package/dist-lib/import/defaultPackages.d.ts +57 -14
  19. package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
  20. package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
  21. package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
  22. package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
  23. package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
  24. package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
  25. package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
  26. package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
  27. package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
  28. package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
  29. package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
  30. package/dist-lib/import/mudletControlChars.d.ts +14 -0
  31. package/dist-lib/import/mudletHost.d.ts +73 -10
  32. package/dist-lib/import/mudletLink.d.ts +53 -2
  33. package/dist-lib/import/mudletProfileExport.d.ts +38 -5
  34. package/dist-lib/import/mudletProfileImport.d.ts +110 -12
  35. package/dist-lib/import/mudletVariables.d.ts +4 -3
  36. package/dist-lib/import/mudletWriteback.d.ts +15 -1
  37. package/dist-lib/import/mudletXmlImport.d.ts +46 -0
  38. package/dist-lib/import/packageFonts.d.ts +33 -0
  39. package/dist-lib/import/packageInstaller.d.ts +111 -7
  40. package/dist-lib/import/qtProfileData.d.ts +10 -0
  41. package/dist-lib/import/remotePackageInstall.d.ts +23 -7
  42. package/dist-lib/import/zipEntries.d.ts +45 -0
  43. package/dist-lib/index.d.ts +7 -3
  44. package/dist-lib/index.js +50508 -29836
  45. package/dist-lib/logging/SessionLogger.d.ts +75 -15
  46. package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
  47. package/dist-lib/map/MapStore.d.ts +387 -60
  48. package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
  49. package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
  50. package/dist-lib/map/areaGraph.d.ts +120 -0
  51. package/dist-lib/map/environmentKit.d.ts +36 -0
  52. package/dist-lib/map/labelPixmap.d.ts +90 -0
  53. package/dist-lib/map/mapImageExport.d.ts +36 -2
  54. package/dist-lib/map/mapStyle.d.ts +11 -0
  55. package/dist-lib/map/mapVersion.d.ts +66 -0
  56. package/dist-lib/map/pathfinding.d.ts +2 -2
  57. package/dist-lib/mud/CharLoginController.d.ts +230 -0
  58. package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
  59. package/dist-lib/mud/MudSession.d.ts +279 -22
  60. package/dist-lib/mud/PatternEngine.d.ts +153 -14
  61. package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
  62. package/dist-lib/mud/autoLogin.d.ts +59 -0
  63. package/dist-lib/mud/commandSplit.d.ts +9 -0
  64. package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
  65. package/dist-lib/mud/connection/MudClient.d.ts +291 -53
  66. package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
  67. package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
  68. package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
  69. package/dist-lib/mud/events.d.ts +102 -23
  70. package/dist-lib/mud/games/bundledGames.d.ts +12 -7
  71. package/dist-lib/mud/games/gameLinks.d.ts +40 -0
  72. package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
  73. package/dist-lib/mud/games/icons/3Scapes.png +0 -0
  74. package/dist-lib/mud/games/icons/achaea.png +0 -0
  75. package/dist-lib/mud/games/icons/aetolia.png +0 -0
  76. package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
  77. package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
  78. package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
  79. package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
  80. package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
  81. package/dist-lib/mud/games/icons/blackmud.png +0 -0
  82. package/dist-lib/mud/games/icons/carrionfields.png +0 -0
  83. package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
  84. package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
  85. package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
  86. package/dist-lib/mud/games/icons/imperian.png +0 -0
  87. package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
  88. package/dist-lib/mud/games/icons/lusternia.png +0 -0
  89. package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
  90. package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
  91. package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
  92. package/dist-lib/mud/games/icons/starmourn.png +0 -0
  93. package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
  94. package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
  95. package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
  96. package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
  97. package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
  98. package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
  99. package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
  100. package/dist-lib/mud/protocol/atcp.d.ts +19 -0
  101. package/dist-lib/mud/protocol/byteString.d.ts +24 -0
  102. package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
  103. package/dist-lib/mud/protocol/charset.d.ts +111 -46
  104. package/dist-lib/mud/protocol/codePages.d.ts +10 -0
  105. package/dist-lib/mud/protocol/constants.d.ts +17 -10
  106. package/dist-lib/mud/protocol/echo.d.ts +23 -27
  107. package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
  108. package/dist-lib/mud/protocol/index.d.ts +3 -2
  109. package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
  110. package/dist-lib/mud/protocol/mccp.d.ts +83 -1
  111. package/dist-lib/mud/protocol/mnes.d.ts +41 -58
  112. package/dist-lib/mud/protocol/msdp.d.ts +11 -4
  113. package/dist-lib/mud/protocol/msp.d.ts +3 -2
  114. package/dist-lib/mud/protocol/mssp.d.ts +9 -4
  115. package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
  116. package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
  117. package/dist-lib/mud/protocol/mxp.d.ts +193 -14
  118. package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
  119. package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
  120. package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
  121. package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
  122. package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
  123. package/dist-lib/mud/text/Console.d.ts +255 -49
  124. package/dist-lib/mud/text/FormatState.d.ts +137 -14
  125. package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
  126. package/dist-lib/mud/text/colorParsers.d.ts +14 -2
  127. package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
  128. package/dist-lib/mud/text/colors.d.ts +17 -10
  129. package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
  130. package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
  131. package/dist-lib/mud/text/lineBreak.d.ts +5 -0
  132. package/dist-lib/mud/text/serverWrap.d.ts +2 -2
  133. package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
  134. package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
  135. package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
  136. package/dist-lib/mud/text/wcwidth.d.ts +27 -22
  137. package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
  138. package/dist-lib/mud/timers/workerClock.d.ts +67 -0
  139. package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
  140. package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
  141. package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
  142. package/dist-lib/oauth-callback.html +94 -0
  143. package/dist-lib/pcre2Wasm.d.ts +54 -0
  144. package/dist-lib/pcre2Wasm.js +241 -0
  145. package/dist-lib/scripting/EngineHost.d.ts +45 -21
  146. package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
  147. package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
  148. package/dist-lib/scripting/ScriptingAPI.d.ts +1030 -213
  149. package/dist-lib/scripting/ScriptingEngine.d.ts +727 -106
  150. package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
  151. package/dist-lib/scripting/http/HttpService.d.ts +9 -1
  152. package/dist-lib/scripting/http/userUrl.d.ts +41 -0
  153. package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
  154. package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
  155. package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
  156. package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
  157. package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
  158. package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
  159. package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
  160. package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
  161. package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
  162. package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
  163. package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
  164. package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
  165. package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
  166. package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
  167. package/dist-lib/scripting/lua/rex.d.ts +4 -2
  168. package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
  169. package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
  170. package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
  171. package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
  172. package/dist-lib/scripting/lua/yajl.d.ts +43 -5
  173. package/dist-lib/scripting/profilesPresence.d.ts +20 -2
  174. package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
  175. package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
  176. package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
  177. package/dist-lib/storage/appStore.d.ts +24 -9
  178. package/dist-lib/storage/hooks.d.ts +5 -1
  179. package/dist-lib/storage/index.d.ts +2 -2
  180. package/dist-lib/storage/mapStorage.d.ts +2 -0
  181. package/dist-lib/storage/persistentStorage.d.ts +3 -1
  182. package/dist-lib/storage/profileStorage.d.ts +15 -0
  183. package/dist-lib/storage/profileVfsData.d.ts +3 -3
  184. package/dist-lib/storage/schema.d.ts +512 -40
  185. package/dist-lib/storage/storageMigration.d.ts +82 -0
  186. package/dist-lib/storage-g5V1b-c1.js +2039 -0
  187. package/dist-lib/styles.css +1 -1
  188. package/dist-lib/ui/AboutModal.d.ts +1 -1
  189. package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
  190. package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
  191. package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
  192. package/dist-lib/ui/CommandBar.d.ts +8 -8
  193. package/dist-lib/ui/ConnectionFormModal.d.ts +20 -1
  194. package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
  195. package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
  196. package/dist-lib/ui/HelpModal.d.ts +5 -1
  197. package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
  198. package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
  199. package/dist-lib/ui/NotepadModal.d.ts +22 -0
  200. package/dist-lib/ui/ResizableModal.d.ts +16 -1
  201. package/dist-lib/ui/SettingsModal.d.ts +10 -1
  202. package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
  203. package/dist-lib/ui/Toolbar.d.ts +22 -1
  204. package/dist-lib/ui/VaultManageButton.d.ts +10 -5
  205. package/dist-lib/ui/VaultModal.d.ts +3 -0
  206. package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
  207. package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
  208. package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
  209. package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
  210. package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
  211. package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
  212. package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
  213. package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
  214. package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
  215. package/dist-lib/ui/codemirror/options.d.ts +33 -0
  216. package/dist-lib/ui/codemirror/theme.d.ts +29 -5
  217. package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
  218. package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
  219. package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
  220. package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
  221. package/dist-lib/ui/commands/keySequence.d.ts +57 -0
  222. package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
  223. package/dist-lib/ui/components/FontPicker.d.ts +5 -1
  224. package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
  225. package/dist-lib/ui/helpTopics.d.ts +15 -0
  226. package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
  227. package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
  228. package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
  229. package/dist-lib/ui/labels/labelModel.d.ts +64 -0
  230. package/dist-lib/ui/labels/qColor.d.ts +13 -0
  231. package/dist-lib/ui/labels/qtCss.d.ts +12 -4
  232. package/dist-lib/ui/landmarks.d.ts +9 -0
  233. package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
  234. package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
  235. package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
  236. package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
  237. package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
  238. package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
  239. package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
  240. package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
  241. package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
  242. package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
  243. package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
  244. package/dist-lib/ui/menu/appMenus.d.ts +65 -0
  245. package/dist-lib/ui/menu/menuModel.d.ts +88 -0
  246. package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
  247. package/dist-lib/ui/notepad.d.ts +76 -0
  248. package/dist-lib/ui/openSignInPage.d.ts +14 -0
  249. package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
  250. package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
  251. package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
  252. package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
  253. package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
  254. package/dist-lib/ui/output/caretMode.d.ts +3 -2
  255. package/dist-lib/ui/output/clearSplit.d.ts +11 -0
  256. package/dist-lib/ui/output/outputCopy.d.ts +41 -2
  257. package/dist-lib/ui/output/outputRows.d.ts +43 -0
  258. package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
  259. package/dist-lib/ui/output/wordSelection.d.ts +33 -0
  260. package/dist-lib/ui/search/matcher.d.ts +14 -4
  261. package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
  262. package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
  263. package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
  264. package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
  265. package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
  266. package/dist-lib/ui/tabCompletion.d.ts +53 -0
  267. package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
  268. package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
  269. package/dist-lib/ui/video/VideoManager.d.ts +7 -0
  270. package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
  271. package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
  272. package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
  273. package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
  274. package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
  275. package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
  276. package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
  277. package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
  278. package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
  279. package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
  280. package/dist-lib/utils/appShellCache.d.ts +25 -0
  281. package/dist-lib/utils/fontFamilyName.d.ts +13 -0
  282. package/dist-lib/utils/fontLoader.d.ts +31 -0
  283. package/dist-lib/utils/formatBytes.d.ts +4 -0
  284. package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
  285. package/dist-lib/utils/profileLock.d.ts +1 -1
  286. package/dist-lib/utils/systemTheme.d.ts +24 -0
  287. package/dist-lib/utils/timeZone.d.ts +10 -0
  288. package/dist-lib/vault/CredentialVault.d.ts +51 -5
  289. package/dist-lib/vault/deviceUnlock.d.ts +47 -0
  290. package/dist-lib/vault/vaultAccess.d.ts +24 -2
  291. package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
  292. package/dist-lib/vault/vaultRecord.d.ts +33 -1
  293. package/dist-lib/vfs-sw.js +220 -11
  294. package/dist-lib/vite.d.ts +1 -1
  295. package/dist-lib/vite.js +66 -43
  296. package/package.json +23 -15
  297. package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
  298. package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
  299. package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
  300. package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
  301. package/dist-lib/ui/bufferWords.d.ts +0 -38
@@ -7,19 +7,207 @@ type ExecResult = {
7
7
  kind: 'changes';
8
8
  changes: number;
9
9
  };
10
+ /** A cell as LuaSQL hands it to Lua: a number (INTEGER and REAL alike — Lua 5.1
11
+ * has only doubles, and desktop converts an int64 with a plain C cast), the raw
12
+ * bytes of a TEXT or BLOB, or null. */
13
+ export type LuasqlCell = number | Uint8Array | null;
14
+ export type LuasqlExecResult =
15
+ /** A statement with result columns: a cursor's shape. Its rows are read by
16
+ * {@link SqliteClient.cursorFetch}, one step per fetch as LuaSQL reads them. */
17
+ {
18
+ kind: 'cursor';
19
+ cursorId: number;
20
+ columns: Uint8Array[];
21
+ declTypes: (Uint8Array | null)[];
22
+ wrote: boolean;
23
+ } | {
24
+ kind: 'changes';
25
+ changes: number;
26
+ } | {
27
+ kind: 'error';
28
+ message: Uint8Array;
29
+ };
30
+ export type LuasqlFetchResult = {
31
+ kind: 'row';
32
+ row: LuasqlCell[];
33
+ }
34
+ /** The rows ran out; the statement is finalized and the cursor gone. */
35
+ | {
36
+ kind: 'done';
37
+ }
38
+ /** The step failed, as sqlite3_errmsg reports it; the cursor is gone. */
39
+ | {
40
+ kind: 'error';
41
+ message: Uint8Array;
42
+ };
43
+ /** Where databases a statement opens by name (ATTACH, VACUUM INTO) live. */
44
+ export interface FileHost {
45
+ /** The absolute path a database name stands for (relative names are
46
+ * relative to the Lua working directory). */
47
+ resolve(name: string): string;
48
+ /** The file at `abs`: its bytes, null when there is none but one can be
49
+ * created there, or false when it cannot be opened (no such directory, or
50
+ * a directory). */
51
+ read(abs: string): Uint8Array | null | false;
52
+ /** Write `abs`'s committed bytes to its durable home. */
53
+ persist(abs: string, bytes: Uint8Array): void;
54
+ }
55
+ export interface OpenOptions {
56
+ readOnly?: boolean;
57
+ /** Writes the store's committed bytes to its durable home. */
58
+ persist?: (bytes: Uint8Array) => void;
59
+ }
60
+ /** How long a committed write waits to be written out once writes stop.
61
+ * Writing out is a whole-database export plus a rewrite of the whole file, so
62
+ * a script that writes a row per incoming line (a chat or loot logger) paid
63
+ * that on every line — 50-280 ms per write on a 12-48 MB database (#443).
64
+ * Writes now coalesce: each one pushes the export back by this much, up to
65
+ * {@link SNAPSHOT_MAX_WAIT_MS} after the first. Nothing that reads the file
66
+ * waits on it — the VFS read barrier flushes before any read of the file, and
67
+ * the page hiding or unloading, saveProfile(), the last connection closing
68
+ * and the runtime going (profile switch, closeMudlet) all flush at once. */
69
+ export declare const SNAPSHOT_DELAY_MS = 1000;
70
+ /** The longest a write stream may hold its database back from being written
71
+ * out, so a crash mid-stream loses at most this much. */
72
+ export declare const SNAPSHOT_MAX_WAIT_MS = 3000;
73
+ /**
74
+ * round(X, Y) as the SQLite desktop Mudlet links (3.37) computes it: Y=0 adds
75
+ * a half and truncates; otherwise the value goes through its printf("%.*f"),
76
+ * which adds the half-unit rounder plus a 3e-16 relative fudge and then
77
+ * truncates to at most 16 significant digits. That fudge is why round(1.005, 2)
78
+ * is 1.01 and round(2.675, 2) is 2.68 there, where 3.53's exact decimal
79
+ * rounding gives 1.0 and 2.67. (3.37's printf sums in long double; the sum here
80
+ * is a double, which only matters within an ulp of a rounding boundary.)
81
+ */
82
+ export declare function round337(r: number, n: number): number;
10
83
  export declare const sqliteReady: Promise<void>;
11
84
  export declare class SqliteClient {
12
- private readonly dbs;
13
- private readonly idByPath;
14
- private readonly pathById;
85
+ private readonly handles;
86
+ private readonly stores;
87
+ private readonly cursors;
15
88
  private nextId;
16
- liveId(path: string): number | undefined;
89
+ private nextCursorId;
90
+ private nextFile;
91
+ private flushing;
92
+ private unlinkFn;
93
+ private host;
94
+ /** The connection whose statement is running, so a database it opens by
95
+ * name is counted as open by it. */
96
+ private active;
97
+ private vfsName;
98
+ private roundPtr;
99
+ private readonly clientId;
17
100
  private get s();
18
- open(path: string, preload?: Uint8Array): number;
101
+ private get x();
102
+ private get raw();
103
+ /** Why sqlite cannot be used (its wasm failed to load), or null when it
104
+ * can. Callers that run during startup check this rather than touching
105
+ * the module, so a failed load costs only the database API. */
106
+ unavailable(): string | null;
107
+ /** The SQLite library version, or null when sqlite failed to load. */
108
+ version(): string | null;
109
+ /** Where databases opened by name from SQL live; null leaves such names to
110
+ * the wasm filesystem. */
111
+ setFileHost(host: FileHost | null): void;
112
+ /** Clear `host`, unless another has replaced it since. */
113
+ releaseFileHost(host: FileHost): void;
114
+ /** Whether a connection to `path` is open, i.e. its live state is here and
115
+ * not (only) in its durable home. */
116
+ isLive(path: string): boolean;
117
+ /**
118
+ * Open a new connection to the database at `path`. Every call is its own
119
+ * handle. `preload` seeds the database only when no connection to it is
120
+ * open; an open one is authoritative.
121
+ */
122
+ open(path: string, preload?: Uint8Array, options?: OpenOptions): number;
123
+ /** A private in-memory database (LuaSQL's ":memory:"). Through the shim
124
+ * all the same, so a database it ATTACHes by name is a profile file. */
125
+ openMemory(): number;
126
+ private createStore;
127
+ private register;
128
+ /** round() with desktop's arithmetic ({@link round337}); an application
129
+ * function of a built-in's name takes its place. */
130
+ private installRound;
131
+ /** The name of the unix-VFS shim connections open through, registered on
132
+ * first use. */
133
+ private shimVfs;
134
+ /** The in-memory file (as a C string) standing for `path`, a live store's
135
+ * database or one of its journals; 0 for a name no store has. */
136
+ private mapName;
137
+ private cname;
138
+ private handle;
139
+ /** Run every statement in `sql` (the file browser's read-only queries). */
19
140
  exec(dbId: number, sql: string): ExecResult;
20
- exportFile(dbId: number): Uint8Array;
141
+ /** NUL-terminated C string at `ptr`, as raw bytes. */
142
+ private cstrBytes;
143
+ private errmsg;
144
+ /**
145
+ * LuaSQL's conn:execute (ls_sqlite3.c conn_execute): prepare the FIRST
146
+ * statement in `sql` — anything after it is ignored, as sqlite3_prepare's
147
+ * tail is — and step it once. A statement with result columns becomes a
148
+ * cursor (reset, to be run by cursorFetch); otherwise the result is
149
+ * sqlite3_changes(). `sql` is bytes, so text that is not UTF-8 reaches
150
+ * sqlite unchanged.
151
+ */
152
+ luasqlExec(dbId: number, sql: Uint8Array): LuasqlExecResult;
153
+ private luasqlExecOn;
154
+ /**
155
+ * LuaSQL's cur:fetch: step the cursor's statement once and hand back that
156
+ * row. One row per call, as desktop's cursor reads them, so whatever the
157
+ * connection writes between two fetches — deleting a row the cursor has not
158
+ * reached yet, updating one, inserting one — shows in what the cursor goes
159
+ * on to return; and the statement, mid-step, holds the read lock until its
160
+ * rows run out. The step that finds none finalizes it.
161
+ */
162
+ cursorFetch(cursorId: number): LuasqlFetchResult;
163
+ /** The cursor is closed: finalize its statement, letting its lock go. */
164
+ cursorClose(cursorId: number): void;
165
+ private dropCursor;
166
+ /** sqlite3_exec of fixed transaction-control SQL; the error text as raw
167
+ * bytes, or null on success. */
168
+ script(dbId: number, sql: string): Uint8Array | null;
169
+ lastInsertRowid(dbId: number): number;
170
+ /** Note that `dbId` may have changed its database, or one it has attached;
171
+ * they are written out once its writes settle, or sooner by flush(). */
172
+ markDirty(dbId: number): void;
173
+ /** Debounced: every write moves the export back to {@link SNAPSHOT_DELAY_MS}
174
+ * from now, but never past {@link SNAPSHOT_MAX_WAIT_MS} from the first
175
+ * write it is waiting for. A retry passes its own fixed delay. */
176
+ private schedule;
177
+ /** Write `path`'s committed state out now if it has changed. Cheap when it
178
+ * has not, so it can sit in front of every read of the file. */
179
+ flush(path: string): void;
180
+ flushAll(): void;
181
+ private flushStore;
182
+ /**
183
+ * Bytes were written over `path` from outside sqlite (io, a restore, the
184
+ * file browser). An open database takes them as its file's new contents,
185
+ * written into the same in-memory file so every connection on it sees them
186
+ * from its next statement, and what it had not yet written out is dropped:
187
+ * the file is what was just written.
188
+ */
189
+ fileReplaced(path: string, read: () => Uint8Array): void;
190
+ /**
191
+ * sqlite tells that another writer changed a file by its header: a
192
+ * connection keeps its cached pages while the change counter matches, and
193
+ * its parsed schema while the schema cookie does. Bytes copied over a
194
+ * database can carry the same values as the file they replace (a backup
195
+ * taken after as many commits), so where they match, the copy the
196
+ * connections read gets them one higher than the file's current ones.
197
+ */
198
+ private markChanged;
199
+ /**
200
+ * `path` (or a directory holding it) was removed or renamed away. Every
201
+ * database there leaves its connections on the unlinked file, as a disk
202
+ * file's do: they read what it held, sqlite refuses their writes, nothing
203
+ * is written back, and the next connection to the path starts afresh.
204
+ */
205
+ fileRemoved(path: string): void;
206
+ /** Close one connection: sqlite3_close, which rolls back whatever it never
207
+ * committed. The last connection to a database writes it out first. */
21
208
  close(dbId: number): void;
22
- escape(s: string): string;
209
+ private teardown;
210
+ private unlink;
23
211
  }
24
212
  export declare function getSqliteClient(): SqliteClient;
25
213
  export {};
@@ -0,0 +1,61 @@
1
+ import type { MudSession } from '../mud/MudSession';
2
+ /**
3
+ * Mudlet's "Reconnect automatically" profile option, ported from `cTelnet`.
4
+ *
5
+ * It covers two different endings, and treats them differently:
6
+ *
7
+ * **A connection that was made and then lost** — the end of
8
+ * `slot_socketDisconnected`:
9
+ *
10
+ * ```cpp
11
+ * if (mAutoReconnect && !mDontReconnect && timeOffset >= 5000) {
12
+ * connectIt(mHostUrl, mHostPort);
13
+ * }
14
+ * mDontReconnect = false;
15
+ * ```
16
+ *
17
+ * **One** redial, immediately, with nothing printed — a session that ran for an
18
+ * hour and blipped should come back without narrating it. A drop inside five
19
+ * seconds (`timeOffset < 5000`) is the server turning the login away, and is
20
+ * left alone.
21
+ *
22
+ * **An attempt that never reached the game** — refused, unknown host, the
23
+ * proxy unreachable — `handleFailedConnection`: "Trying again in N seconds...",
24
+ * after 5 s, doubling with each failure in a row up to 60 s
25
+ * (`FAILED_CONNECTION_RETRY_DELAY` / `_MAX_DELAY`). The wait and its timer live
26
+ * on {@link MudSession.scheduleFailedConnectionRetry}, so that Connect,
27
+ * Disconnect and closing the profile all call a pending retry off.
28
+ *
29
+ * Common to both:
30
+ *
31
+ * - **`mAutoReconnect`** is the profile's own `autoreconnect` flag — here
32
+ * `MudConnection.reconnectOnDrop`, a *different* option from the badly-named
33
+ * `autoReconnect`, which is Mudlet's `autologin` and only decides whether
34
+ * opening the profile dials.
35
+ * - **`!mDontReconnect`** — a disconnect the player asked for is never undone.
36
+ * {@link MudSession.dontReconnect} is that flag: raised by `disconnect()`, so
37
+ * it covers the toolbar button, Lua `disconnect()` and closing the profile
38
+ * alike, and raised again by a rejected certificate and a failed GMCP login
39
+ * exactly as Mudlet does (ctelnet.cpp:819, GMCPAuthenticator.cpp:613) —
40
+ * neither of those gets better by being retried.
41
+ *
42
+ * `timeOffset` is `mConnectionTimer`, started when the *game* socket connects —
43
+ * here `client.established`, never the WebSocket to the proxy opening, which
44
+ * happens for a game that is down too (issue #130).
45
+ */
46
+ /** Mudlet's `timeOffset >= 5000`: how long the game link has to have been up
47
+ * for its loss to count as a drop worth redialing rather than an attempt that
48
+ * never really got anywhere. Shares its value, and its reasoning, with
49
+ * MudSession's `CONNECTION_REJECTED_WINDOW_MS`. */
50
+ export declare const SETTLED_SESSION_MS = 5000;
51
+ interface Options {
52
+ session: MudSession;
53
+ /** The profile's `reconnectOnDrop`. */
54
+ enabled: boolean;
55
+ /** Dial again, from the connection as it stands in the store — Mudlet
56
+ * redials `mHostUrl`/`mHostPort`, i.e. the address as last dialled, which
57
+ * after a TLS upgrade is not the one the profile started with. */
58
+ redial: () => void;
59
+ }
60
+ export declare function useAutoReconnect({ session, enabled, redial }: Options): void;
61
+ export {};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Real fullscreen — the browser's own, over the whole screen.
3
+ *
4
+ * This used to be a profile setting that hid the top toolbar and called that
5
+ * "fullscreen mode". It was never fullscreen: the browser's chrome, tab strip
6
+ * and the operating system's own furniture all stayed put, and what the player
7
+ * actually got back was 44 pixels. Hiding the client's own bars is now what the
8
+ * menu-bar and toolbar settings are for, and this is the Fullscreen API.
9
+ *
10
+ * Deliberately not persisted. Requesting fullscreen needs a user gesture, so a
11
+ * profile that stored "fullscreen: true" could not honour it on load anyway —
12
+ * it would come back as a setting that is on and visibly not in effect.
13
+ */
14
+ export interface DocumentFullscreen {
15
+ /** Whether the document is in fullscreen right now. */
16
+ active: boolean;
17
+ /** Whether the browser will allow it at all — false inside an iframe that
18
+ * was not given `allow="fullscreen"`, which is how this client is embedded
19
+ * in someone else's page. */
20
+ available: boolean;
21
+ toggle: () => void;
22
+ }
23
+ export declare function useDocumentFullscreen(): DocumentFullscreen;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Dispatching the client's own keyboard shortcuts, and any a package placed
3
+ * with `addCommand`.
4
+ *
5
+ * Two things make this more than a switch on `event.key`:
6
+ *
7
+ * - **It must fire while the player is typing.** The command line is a
8
+ * textarea and has the keyboard essentially all the time; a handler that
9
+ * bailed out on text-entry targets would be a shortcut system that never
10
+ * ran. So the guard is on the shortcut instead: a combination with a
11
+ * modifier is dispatched wherever focus is, a bare key only outside text
12
+ * entry — nobody should lose the letter E because a command is bound to it.
13
+ *
14
+ * - **Qt sequences can have up to four steps** ("Ctrl+Alt+F1, Ctrl+Alt+F2"),
15
+ * and `addCommand` accepts them, so a keypress can be the start of something
16
+ * rather than the whole of it. Steps matched so far are held until one
17
+ * sequence completes, nothing can still match, or the player pauses.
18
+ */
19
+ export interface ShortcutBinding {
20
+ /** The Qt-style sequence, as written by a default or by the player. */
21
+ shortcut: string;
22
+ run: () => void;
23
+ }
24
+ /**
25
+ * Whether one of the client's shortcuts (or an `addCommand` one) would take
26
+ * this press: it completes or continues a sequence. Desktop resolves a
27
+ * QAction's shortcut before the focused widget sees the key, so a key binding
28
+ * on Alt+K does not run while the Mute action holds it (mudlet-web#340).
29
+ */
30
+ export declare function claimedByAppShortcut(e: KeyboardEvent): boolean;
31
+ /**
32
+ * Hold keys for a client action that is not a ShortcutBinding — the buffer
33
+ * search's F3 while `f3SearchEnabled` is on — so the Lua keybinding listener
34
+ * yields them the way it yields a menu accelerator's. Returns the release.
35
+ */
36
+ export declare function claimShortcutKeys(claims: (e: KeyboardEvent) => boolean): () => void;
37
+ export declare function useKeyboardShortcuts(bindings: readonly ShortcutBinding[], enabled?: boolean): void;
@@ -0,0 +1,10 @@
1
+ import type { MudSession } from '../mud/MudSession';
2
+ /**
3
+ * Stamp `lastConnectedAt` on the profile each time its session reaches the
4
+ * game, so the launcher can lead with the profile played most recently.
5
+ *
6
+ * `client.established`, not `client.connect`: the latter fires when the
7
+ * WebSocket to the proxy opens, before the proxy has reached the game — a
8
+ * profile whose server is down would still jump to the front of the list.
9
+ */
10
+ export declare function useRecordLastPlayed(session: MudSession | null, connectionId: string): void;
@@ -3,7 +3,7 @@ import type { MudConnection } from '../storage/schema';
3
3
  /** The per-connection store slices a bundle maps to. Pure — no side effects, so
4
4
  * it's unit-testable; `importMudletProfile` applies it. Automation is imported
5
5
  * profile-owned (as authored in Mudlet), not package-tagged. */
6
- export declare function bundleToConnectionData(bundle: MudletProfileBundle, installedAt: string): {
6
+ export declare function bundleToConnectionData(bundle: MudletProfileBundle, installedAt: string, profilePath?: string): {
7
7
  scripts: import("../storage/schema").ScriptNode[];
8
8
  aliases: import("../storage/schema").AliasNode[];
9
9
  triggers: import("..").TriggerNode[];
@@ -11,26 +11,39 @@ export declare function bundleToConnectionData(bundle: MudletProfileBundle, inst
11
11
  keybindings: import("../storage/schema").KeyNode[];
12
12
  buttons: import("../storage/schema").ButtonNode[];
13
13
  packages: import("../storage/schema").PackageManifest[];
14
- profile: Partial<import("../storage").ProfileSettings>;
14
+ profile: Partial<import("..").ProfileSettings>;
15
15
  variables: {
16
16
  saveList: string[];
17
17
  values: import("./mudletVariables").MudletVariable[];
18
+ hidden: string[];
18
19
  };
19
20
  };
20
21
  /**
21
22
  * The connection record for an imported bundle.
22
23
  *
23
24
  * A Mudlet `<Host>` only models a telnet host/port, so that's the default. A
24
- * profile exported *from mudix* also carries `.mudix/connection.json`, which
25
+ * profile exported from Mudlet Web also carries `.mudlet/connection.json`, which
25
26
  * restores what Mudlet can't express — websocket mode and its ws(s):// URL, the
26
27
  * per-profile proxy override, auto-reconnect. Unknown/aliased sidecar values are
27
28
  * ignored field by field, so a hand-edited file can't produce a broken profile.
28
29
  */
29
30
  export declare function bundleToConnectionRecord(bundle: MudletProfileBundle): Omit<MudConnection, 'id'>;
30
31
  /**
31
- * Create a new mudix profile from a Mudlet profile bundle. Returns the new
32
+ * Seed a new profile's command-bar history from the bundle's
33
+ * `command_history_main`, so Up arrow recalls what it did on desktop. Capped at
34
+ * the profile's own `commandLineHistorySaveSize` when it has one, as every
35
+ * later save of that history is.
36
+ */
37
+ export declare function seedCommandHistory(connectionId: string, bundle: MudletProfileBundle): void;
38
+ /**
39
+ * Create a new Mudlet Web profile from a Mudlet profile bundle. Returns the new
32
40
  * connection id. The profile opens offline like any other; its data is durable
33
- * in the new VFS (`.mudix/profile.json`) and map store before this resolves.
41
+ * in the new VFS (`.mudlet/profile.json`) and map store before this resolves.
42
+ *
43
+ * Anything that could not be carried over is appended to `bundle.warnings` for
44
+ * the caller to show — a copy that quietly loses a package's files or the map
45
+ * still "succeeds", so the console warnings below are not a surface any user
46
+ * ever looks at (issue #45).
34
47
  */
35
48
  export declare function importMudletProfile(bundle: MudletProfileBundle): Promise<string>;
36
49
  /** Recursively read a picked directory into {path -> bytes} + {path -> mtime}
@@ -47,11 +60,24 @@ export declare function bundleFromDirectory(dir: FileSystemDirectoryHandle): Pro
47
60
  * handling — callers that need the upload/remove flow should use bundleFromDirectory
48
61
  * + resolveModulesFromTree first). */
49
62
  export declare function importMudletProfileFromDirectory(dir: FileSystemDirectoryHandle): Promise<string>;
63
+ /** What {@link linkMudletFolder} made, and what it leaves to the caller. */
64
+ export interface LinkedFolderResult {
65
+ connectionId: string;
66
+ /** Desktop's saved password (the folder's `password` file), for the
67
+ * caller to hand to the credential vault. The folder's copy is left
68
+ * where it is: desktop still reads it. */
69
+ password?: string;
70
+ /** What could not be carried over, for the import UI to show. */
71
+ warnings: string[];
72
+ }
50
73
  /**
51
- * Link a Mudlet profile *directory* as a new mudix profile (Link mode): the
74
+ * Link a Mudlet profile *directory* as a new Mudlet Web profile (Link mode): the
52
75
  * folder stays the source of truth — its `current/*.xml` is re-read on every
53
76
  * open — rather than being copied in. Reads the connection identity from the
54
- * newest save, registers the connection, persists the folder handle so the VFS
55
- * mounts it, and copies the current map. Returns the new connection id.
77
+ * newest save, and TLS and the character name from desktop's own files for
78
+ * them, as an import does (#450); registers the connection, persists the
79
+ * folder handle so the VFS mounts it, and copies the current map. The server
80
+ * encoding and command history are read when the profile opens
81
+ * (loadMudletLinkedProfile), every time, so desktop's later changes arrive too.
56
82
  */
57
- export declare function linkMudletFolder(dir: FileSystemDirectoryHandle): Promise<string>;
83
+ export declare function linkMudletFolder(dir: FileSystemDirectoryHandle): Promise<LinkedFolderResult>;
@@ -0,0 +1,118 @@
1
+ /**
2
+ * Importing a whole-origin backup taken from a previous Mudlet Web address.
3
+ *
4
+ * Browser storage is keyed per address. When the client moved from
5
+ * `mudlet-web.mudlet.org` to `web.mudlet.org` every profile, script, package
6
+ * and map stayed behind on the old origin, reachable by nothing — the app that
7
+ * could read them was no longer served there. The holding page left at the old
8
+ * address (Mudlet/mudlet-web-moved) writes all of it to one `mudlet-web-backup`
9
+ * JSON file; this module is the other half, and reads that file back in.
10
+ *
11
+ * The file is a verbatim dump of the old origin's storage, so nothing here has
12
+ * to understand the *meaning* of a profile's data. What it does have to do is
13
+ * re-address it:
14
+ *
15
+ * - Every profile is created through {@link AppSchema.addConnection}, so it
16
+ * gets a fresh id and a non-clashing name from the store rather than being
17
+ * forced in under the old one. Importing into a browser that already has
18
+ * profiles is therefore additive: nothing existing is overwritten, and
19
+ * importing the same file twice yields "Achaea" and "Achaea (2)" rather
20
+ * than a silent clobber.
21
+ * - Everything keyed by the *old* connection id is rewritten to the new one:
22
+ * the profile's ZenFS database, its map, its logs, its command history and
23
+ * its stopwatches. `profileStorage.ts` holds the same inventory from the
24
+ * deletion side; the two must stay in step.
25
+ *
26
+ * A profile's ZenFS database is restored by copying its records verbatim into a
27
+ * database named for the new id. The store is keyed by inode number and holds
28
+ * no reference to its own name, so the copy is the same filesystem — verified
29
+ * in a browser against the real ProfileVFS before this was written. Everything
30
+ * per-profile that is not the connection row itself (settings, layout, and the
31
+ * automation trees in `.mudix/profile.json`) rides along inside it.
32
+ */
33
+ /** The `format` string every backup file carries. */
34
+ export declare const BACKUP_FORMAT = "mudlet-web-backup";
35
+ /** The highest `version` this importer understands. */
36
+ export declare const BACKUP_MAX_VERSION = 1;
37
+ interface BackupRecord {
38
+ key: unknown;
39
+ value: unknown;
40
+ }
41
+ interface BackupStore {
42
+ keyPath: string | string[] | null;
43
+ autoIncrement: boolean;
44
+ records: BackupRecord[];
45
+ }
46
+ interface BackupDatabase {
47
+ version: number;
48
+ stores: Record<string, BackupStore>;
49
+ }
50
+ export interface MudletWebBackup {
51
+ format: string;
52
+ version: number;
53
+ createdAt?: string;
54
+ origin?: string;
55
+ localStorage: Record<string, string>;
56
+ indexedDB: Record<string, BackupDatabase>;
57
+ skipped?: {
58
+ where: string;
59
+ why: string;
60
+ }[];
61
+ }
62
+ /** What a file holds, for the confirmation the user sees before committing. */
63
+ export interface BackupSummary {
64
+ createdAt: string | null;
65
+ origin: string | null;
66
+ /** Profiles in the file, in the order they will be created. */
67
+ profiles: {
68
+ id: string;
69
+ name: string;
70
+ }[];
71
+ /** How many of those profiles have a stored map. */
72
+ maps: number;
73
+ logSessions: number;
74
+ /** Notes worth showing up front — things that will not come across. */
75
+ warnings: string[];
76
+ }
77
+ export interface BackupImportResult {
78
+ /** Profiles created, under the names they actually got. */
79
+ imported: {
80
+ id: string;
81
+ name: string;
82
+ }[];
83
+ warnings: string[];
84
+ }
85
+ /**
86
+ * Undo the exporter's tagging. Plain JSON passes through untouched; anything
87
+ * structured clone can hold that JSON cannot arrives as a `$`-tagged object.
88
+ *
89
+ * A value the exporter could not carry at all (`$: 'unsupported'`) decodes to
90
+ * `undefined` rather than throwing: one unreadable field in one log row must
91
+ * not cost the user the profile it belongs to.
92
+ */
93
+ export declare function decodeBackupValue(value: unknown): unknown;
94
+ /**
95
+ * Read and check a backup file.
96
+ *
97
+ * Deliberately strict about the envelope and forgiving about the contents: a
98
+ * file that is not a backup at all should say so plainly, while a backup with
99
+ * one unreadable section is still worth most of what it holds.
100
+ */
101
+ export declare function parseBackup(text: string): MudletWebBackup;
102
+ /**
103
+ * What the file holds, without changing anything.
104
+ *
105
+ * Profiles come from the store blob first; a VFS database with no row left in
106
+ * that blob is still offered, under a placeholder name, because the data in it
107
+ * is the part worth rescuing and a truncated store blob should not bury it.
108
+ */
109
+ export declare function summariseBackup(backup: MudletWebBackup): BackupSummary;
110
+ /**
111
+ * Import everything in a backup file.
112
+ *
113
+ * Additive by construction: every profile is created fresh through the store,
114
+ * so an import can be run into a browser that is already in use, and can be run
115
+ * twice, without losing anything that was already here.
116
+ */
117
+ export declare function importBackup(backup: MudletWebBackup): Promise<BackupImportResult>;
118
+ export {};
@@ -1,5 +1,36 @@
1
+ import { ProfileVFS } from '../scripting/vfs/ProfileVFS';
1
2
  import type { MudConnection } from '../storage/schema';
2
- import type { ProfileExportSource } from './mudletProfileExport';
3
+ import { type ProfileExportSource } from './mudletProfileExport';
4
+ import { type VfsReader } from './mudletLink';
5
+ /** The part of ProfileVFS the walk needs, so it's testable over any ZenFS. */
6
+ export type WalkableVfs = Pick<ProfileVFS, 'profilePath' | 'readdir' | 'stat' | 'readBinaryFile'>;
7
+ /**
8
+ * Every user file in the profile folder, keyed by its path relative to the
9
+ * profile root — packages, modules, and whatever scripts wrote with `io.*` /
10
+ * `table.save`, i.e. what desktop Mudlet's profile folder holds.
11
+ *
12
+ * Paths are resolved against `profilePath`, never passed bare: ProfileVFS reads
13
+ * a leading `/` as the ZenFS root, and a relative path resolves against the Lua
14
+ * working directory, which `lfs.chdir` can move (issue #261).
15
+ */
16
+ export declare function collectVfsFiles(vfs: WalkableVfs): Record<string, Uint8Array>;
17
+ /**
18
+ * The `<Host>` this profile's export should base on, so the ~100 Mudlet settings
19
+ * Mudlet Web doesn't model don't revert to Mudlet's defaults on the way out.
20
+ *
21
+ * The retained copy comes first. A profile that has one was imported from
22
+ * Mudlet, and any `current/*.xml` in its VFS is a save Mudlet Web itself wrote via
23
+ * `saveProfile()` — basing on that would just re-read our own output. A linked
24
+ * folder has no retained copy and its `current/*.xml` *is* the live original,
25
+ * kept current by write-back, so it's the right base there.
26
+ *
27
+ * Undefined for a profile born in Mudlet Web: nothing beyond the modeled settings to
28
+ * preserve, and the export falls back to the empty skeleton as before.
29
+ *
30
+ * Takes the same minimal reader surface as the link-mode loader, so it's
31
+ * testable without a mounted ZenFS.
32
+ */
33
+ export declare function readHostBase(vfs: VfsReader): string | undefined;
3
34
  export interface CollectOptions {
4
35
  /** Session logs aren't part of the Mudlet format; they ride along under
5
36
  * `logs/` so a migrating user doesn't leave history behind. */
@@ -8,7 +39,7 @@ export interface CollectOptions {
8
39
  /**
9
40
  * Read one profile out of storage, ready for export.
10
41
  *
11
- * The profile's `.mudix/profile.json` is the source of truth — not the Zustand
42
+ * The profile's `.mudlet/profile.json` is the source of truth — not the Zustand
12
43
  * store, which only holds slices for the *open* profile. A profile open in
13
44
  * another tab may therefore be up to one save-debounce stale; exporting from the
14
45
  * connection screen (where nothing is open) always sees the committed state.