@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.
- package/README.md +1 -1
- package/dist-lib/analytics.d.ts +27 -0
- package/dist-lib/assets/fonts/Vera.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBI.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraBd.woff2 +0 -0
- package/dist-lib/assets/fonts/VeraIt.woff2 +0 -0
- package/dist-lib/assets/mapParser.worker-DrVZ3wg_.js +9 -0
- package/dist-lib/backupImport-wt8r7JXI.js +233 -0
- package/dist-lib/branding.d.ts +111 -13
- package/dist-lib/db/sqliteClient.d.ts +195 -7
- package/dist-lib/hooks/useAutoReconnect.d.ts +61 -0
- package/dist-lib/hooks/useDocumentFullscreen.d.ts +23 -0
- package/dist-lib/hooks/useKeyboardShortcuts.d.ts +37 -0
- package/dist-lib/hooks/useRecordLastPlayed.d.ts +10 -0
- package/dist-lib/import/applyMudletProfile.d.ts +35 -9
- package/dist-lib/import/backupImport.d.ts +118 -0
- package/dist-lib/import/collectProfileExport.d.ts +33 -2
- package/dist-lib/import/defaultPackages.d.ts +57 -14
- package/dist-lib/import/defaults/CF-loader/CF-loader.mpackage +0 -0
- package/dist-lib/import/defaults/MedBootstrap/MedBootstrap.mpackage +0 -0
- package/dist-lib/import/defaults/deleteOldProfiles/deleteOldProfiles.mpackage +0 -0
- package/dist-lib/import/defaults/echo/echo.mpackage +0 -0
- package/dist-lib/import/defaults/enable-accessibility/enable-accessibility.mpackage +0 -0
- package/dist-lib/import/defaults/generic_mapper/generic_mapper.mpackage +0 -0
- package/dist-lib/import/defaults/gui-drop/gui-drop.mpackage +0 -0
- package/dist-lib/import/defaults/icesus-loader/icesus-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mg-loader/mg-loader.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-base-ui/mudlet-base-ui.mpackage +0 -0
- package/dist-lib/import/defaults/mudlet-mapper.xml +1215 -389
- package/dist-lib/import/mudletControlChars.d.ts +14 -0
- package/dist-lib/import/mudletHost.d.ts +73 -10
- package/dist-lib/import/mudletLink.d.ts +53 -2
- package/dist-lib/import/mudletProfileExport.d.ts +38 -5
- package/dist-lib/import/mudletProfileImport.d.ts +110 -12
- package/dist-lib/import/mudletVariables.d.ts +4 -3
- package/dist-lib/import/mudletWriteback.d.ts +15 -1
- package/dist-lib/import/mudletXmlImport.d.ts +46 -0
- package/dist-lib/import/packageFonts.d.ts +33 -0
- package/dist-lib/import/packageInstaller.d.ts +111 -7
- package/dist-lib/import/qtProfileData.d.ts +10 -0
- package/dist-lib/import/remotePackageInstall.d.ts +23 -7
- package/dist-lib/import/zipEntries.d.ts +45 -0
- package/dist-lib/index.d.ts +7 -3
- package/dist-lib/index.js +50508 -29836
- package/dist-lib/logging/SessionLogger.d.ts +75 -15
- package/dist-lib/map/MapSelectionOverlay.d.ts +2 -2
- package/dist-lib/map/MapStore.d.ts +387 -60
- package/dist-lib/map/MudletHighlightOverlay.d.ts +2 -2
- package/dist-lib/map/{MudixMapReader.d.ts → MudletMapReader.d.ts} +2 -2
- package/dist-lib/map/areaGraph.d.ts +120 -0
- package/dist-lib/map/environmentKit.d.ts +36 -0
- package/dist-lib/map/labelPixmap.d.ts +90 -0
- package/dist-lib/map/mapImageExport.d.ts +36 -2
- package/dist-lib/map/mapStyle.d.ts +11 -0
- package/dist-lib/map/mapVersion.d.ts +66 -0
- package/dist-lib/map/pathfinding.d.ts +2 -2
- package/dist-lib/mud/CharLoginController.d.ts +230 -0
- package/dist-lib/mud/ItemIdSequence.d.ts +1 -1
- package/dist-lib/mud/MudSession.d.ts +279 -22
- package/dist-lib/mud/PatternEngine.d.ts +153 -14
- package/dist-lib/mud/aliases/AliasEngine.d.ts +55 -9
- package/dist-lib/mud/autoLogin.d.ts +59 -0
- package/dist-lib/mud/commandSplit.d.ts +9 -0
- package/dist-lib/mud/connection/LineAssembler.d.ts +38 -11
- package/dist-lib/mud/connection/MudClient.d.ts +291 -53
- package/dist-lib/mud/connection/SubnegotiationRepair.d.ts +24 -0
- package/dist-lib/mud/connection/TelnetNegotiator.d.ts +208 -68
- package/dist-lib/mud/connection/telnetDebug.d.ts +8 -8
- package/dist-lib/mud/events.d.ts +102 -23
- package/dist-lib/mud/games/bundledGames.d.ts +12 -7
- package/dist-lib/mud/games/gameLinks.d.ts +40 -0
- package/dist-lib/mud/games/icons/3Kingdoms.png +0 -0
- package/dist-lib/mud/games/icons/3Scapes.png +0 -0
- package/dist-lib/mud/games/icons/achaea.png +0 -0
- package/dist-lib/mud/games/icons/aetolia.png +0 -0
- package/dist-lib/mud/games/icons/banner_astaria.png +0 -0
- package/dist-lib/mud/games/icons/banner_darkmists.png +0 -0
- package/dist-lib/mud/games/icons/banner_dreamland.png +0 -0
- package/dist-lib/mud/games/icons/banner_petria.jpg +0 -0
- package/dist-lib/mud/games/icons/banner_ropmud.png +0 -0
- package/dist-lib/mud/games/icons/blackmud.png +0 -0
- package/dist-lib/mud/games/icons/carrionfields.png +0 -0
- package/dist-lib/mud/games/icons/dragonfire_icon.png +0 -0
- package/dist-lib/mud/games/icons/fed2-logo.png +0 -0
- package/dist-lib/mud/games/icons/icesus_480x120.png +0 -0
- package/dist-lib/mud/games/icons/imperian.png +0 -0
- package/dist-lib/mud/games/icons/infinity_480x120.png +0 -0
- package/dist-lib/mud/games/icons/lusternia.png +0 -0
- package/dist-lib/mud/games/icons/morgengrauen_480x120.png +0 -0
- package/dist-lib/mud/games/icons/mudlet-tutorial.png +0 -0
- package/dist-lib/mud/games/icons/phoenixmud_480x120.png +0 -0
- package/dist-lib/mud/games/icons/starmourn.png +0 -0
- package/dist-lib/mud/games/icons/voidmud_icon.png +0 -0
- package/dist-lib/mud/games/icons/wotmudicon.png +0 -0
- package/dist-lib/mud/games/websiteLinks.d.ts +21 -0
- package/dist-lib/mud/keybindings/KeyEngine.d.ts +110 -4
- package/dist-lib/mud/keybindings/browserReservedKeys.d.ts +2 -2
- package/dist-lib/mud/keybindings/keyEventTarget.d.ts +61 -0
- package/dist-lib/mud/keybindings/qtKeys.d.ts +91 -12
- package/dist-lib/mud/protocol/atcp.d.ts +19 -0
- package/dist-lib/mud/protocol/byteString.d.ts +24 -0
- package/dist-lib/mud/protocol/charLoginFlow.d.ts +243 -16
- package/dist-lib/mud/protocol/charset.d.ts +111 -46
- package/dist-lib/mud/protocol/codePages.d.ts +10 -0
- package/dist-lib/mud/protocol/constants.d.ts +17 -10
- package/dist-lib/mud/protocol/echo.d.ts +23 -27
- package/dist-lib/mud/protocol/gmcp.d.ts +36 -6
- package/dist-lib/mud/protocol/index.d.ts +3 -2
- package/dist-lib/mud/protocol/luaLiteral.d.ts +12 -0
- package/dist-lib/mud/protocol/mccp.d.ts +83 -1
- package/dist-lib/mud/protocol/mnes.d.ts +41 -58
- package/dist-lib/mud/protocol/msdp.d.ts +11 -4
- package/dist-lib/mud/protocol/msp.d.ts +3 -2
- package/dist-lib/mud/protocol/mssp.d.ts +9 -4
- package/dist-lib/mud/protocol/multiByte.d.ts +51 -0
- package/dist-lib/mud/protocol/multiByteEncode.d.ts +42 -0
- package/dist-lib/mud/protocol/mxp.d.ts +193 -14
- package/dist-lib/mud/protocol/oauthClientFlow.d.ts +128 -0
- package/dist-lib/mud/protocol/qtCodePages.generated.d.ts +1 -0
- package/dist-lib/mud/protocol/tlsCodes.d.ts +40 -3
- package/dist-lib/mud/replay/ReplayPlayer.d.ts +16 -1
- package/dist-lib/mud/replay/replayFormat.d.ts +29 -2
- package/dist-lib/mud/text/Console.d.ts +255 -49
- package/dist-lib/mud/text/FormatState.d.ts +137 -14
- package/dist-lib/mud/text/ansiEscapes.d.ts +32 -16
- package/dist-lib/mud/text/colorParsers.d.ts +14 -2
- package/dist-lib/mud/text/colorSpaceId.d.ts +2 -0
- package/dist-lib/mud/text/colors.d.ts +17 -10
- package/dist-lib/mud/text/controlCharacterMode.d.ts +1 -1
- package/dist-lib/mud/text/hyperlinkVisibility.d.ts +1 -1
- package/dist-lib/mud/text/lineBreak.d.ts +5 -0
- package/dist-lib/mud/text/serverWrap.d.ts +2 -2
- package/dist-lib/mud/text/textAnalyzer.d.ts +79 -0
- package/dist-lib/mud/text/unicodeRuns.d.ts +11 -0
- package/dist-lib/mud/text/unicodeTables.generated.d.ts +3 -0
- package/dist-lib/mud/text/wcwidth.d.ts +27 -22
- package/dist-lib/mud/timers/TimerEngine.d.ts +163 -11
- package/dist-lib/mud/timers/workerClock.d.ts +67 -0
- package/dist-lib/mud/triggers/TriggerEngine.d.ts +449 -47
- package/dist-lib/mud/triggers/legacyColorPatterns.d.ts +58 -0
- package/dist-lib/mud/triggers/pcre/Pcre2.d.ts +83 -1
- package/dist-lib/oauth-callback.html +94 -0
- package/dist-lib/pcre2Wasm.d.ts +54 -0
- package/dist-lib/pcre2Wasm.js +241 -0
- package/dist-lib/scripting/EngineHost.d.ts +45 -21
- package/dist-lib/scripting/IScriptingRuntime.d.ts +103 -27
- package/dist-lib/scripting/MxpFrameManager.d.ts +10 -1
- package/dist-lib/scripting/ScriptingAPI.d.ts +1030 -213
- package/dist-lib/scripting/ScriptingEngine.d.ts +727 -106
- package/dist-lib/scripting/StopwatchManager.d.ts +97 -36
- package/dist-lib/scripting/http/HttpService.d.ts +9 -1
- package/dist-lib/scripting/http/userUrl.d.ts +41 -0
- package/dist-lib/scripting/lua/LuaRuntime.d.ts +352 -77
- package/dist-lib/scripting/lua/argContracts.d.ts +71 -0
- package/dist-lib/scripting/lua/bindings/automation.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/commands.d.ts +13 -0
- package/dist-lib/scripting/lua/bindings/context.d.ts +20 -2
- package/dist-lib/scripting/lua/bindings/diagnostics.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/map.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/media.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/output.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/session.d.ts +2 -2
- package/dist-lib/scripting/lua/bindings/textEdit.d.ts +1 -1
- package/dist-lib/scripting/lua/bindings/userWindows.d.ts +1 -1
- package/dist-lib/scripting/lua/byteArmor.d.ts +36 -0
- package/dist-lib/scripting/lua/imageSize.d.ts +7 -0
- package/dist-lib/scripting/lua/rex.d.ts +4 -2
- package/dist-lib/scripting/lua/sqlRowEncoder.d.ts +6 -1
- package/dist-lib/scripting/lua/utf8CaseMap.d.ts +1 -0
- package/dist-lib/scripting/lua/utf8Patterns.d.ts +21 -1
- package/dist-lib/scripting/lua/wellFormedStrings.d.ts +40 -0
- package/dist-lib/scripting/lua/yajl.d.ts +43 -5
- package/dist-lib/scripting/profilesPresence.d.ts +20 -2
- package/dist-lib/scripting/vfs/ProfileVFS.d.ts +164 -10
- package/dist-lib/scripting/vfs/fsErrors.d.ts +28 -0
- package/dist-lib/scripting/vfs/idbCommit.d.ts +20 -0
- package/dist-lib/storage/appStore.d.ts +24 -9
- package/dist-lib/storage/hooks.d.ts +5 -1
- package/dist-lib/storage/index.d.ts +2 -2
- package/dist-lib/storage/mapStorage.d.ts +2 -0
- package/dist-lib/storage/persistentStorage.d.ts +3 -1
- package/dist-lib/storage/profileStorage.d.ts +15 -0
- package/dist-lib/storage/profileVfsData.d.ts +3 -3
- package/dist-lib/storage/schema.d.ts +512 -40
- package/dist-lib/storage/storageMigration.d.ts +82 -0
- package/dist-lib/storage-g5V1b-c1.js +2039 -0
- package/dist-lib/styles.css +1 -1
- package/dist-lib/ui/AboutModal.d.ts +1 -1
- package/dist-lib/ui/BrandLoginFields.d.ts +1 -1
- package/dist-lib/ui/BrowserSignInModal.d.ts +23 -0
- package/dist-lib/ui/CmdLineMenuRegistry.d.ts +14 -5
- package/dist-lib/ui/CommandBar.d.ts +8 -8
- package/dist-lib/ui/ConnectionFormModal.d.ts +20 -1
- package/dist-lib/ui/ConnectionScreen.d.ts +9 -1
- package/dist-lib/ui/GameLinkPrompt.d.ts +28 -0
- package/dist-lib/ui/HelpModal.d.ts +5 -1
- package/dist-lib/ui/MapSymbolUsageModal.d.ts +32 -0
- package/dist-lib/ui/MouseEventRegistry.d.ts +31 -4
- package/dist-lib/ui/NotepadModal.d.ts +22 -0
- package/dist-lib/ui/ResizableModal.d.ts +16 -1
- package/dist-lib/ui/SettingsModal.d.ts +10 -1
- package/dist-lib/ui/TlsAlertBanner.d.ts +3 -1
- package/dist-lib/ui/Toolbar.d.ts +22 -1
- package/dist-lib/ui/VaultManageButton.d.ts +10 -5
- package/dist-lib/ui/VaultModal.d.ts +3 -0
- package/dist-lib/ui/buttons/ButtonsBar.d.ts +3 -1
- package/dist-lib/ui/buttons/inactiveButtons.d.ts +25 -0
- package/dist-lib/ui/cmdline/CommandLineManager.d.ts +19 -0
- package/dist-lib/ui/cmdline/plainText.d.ts +16 -0
- package/dist-lib/ui/cmdline/subCommandLine.d.ts +78 -0
- package/dist-lib/ui/cmdline/useCmdLineSelection.d.ts +26 -0
- package/dist-lib/ui/cmdline/useSubCommandLineKeys.d.ts +33 -0
- package/dist-lib/ui/codemirror/lineParagraphMarks.d.ts +19 -0
- package/dist-lib/ui/codemirror/luaHover.d.ts +7 -0
- package/dist-lib/ui/codemirror/options.d.ts +33 -0
- package/dist-lib/ui/codemirror/theme.d.ts +29 -5
- package/dist-lib/ui/commands/addonCommands.d.ts +134 -0
- package/dist-lib/ui/commands/appShortcuts.d.ts +86 -0
- package/dist-lib/ui/commands/hostCommands.d.ts +88 -0
- package/dist-lib/ui/commands/keyMatch.d.ts +20 -0
- package/dist-lib/ui/commands/keySequence.d.ts +57 -0
- package/dist-lib/ui/components/ContextMenu.d.ts +21 -1
- package/dist-lib/ui/components/FontPicker.d.ts +5 -1
- package/dist-lib/ui/components/useModalFocus.d.ts +13 -1
- package/dist-lib/ui/helpTopics.d.ts +15 -0
- package/dist-lib/ui/labels/LabelManager.d.ts +172 -9
- package/dist-lib/ui/labels/LabelOverlay.d.ts +19 -0
- package/dist-lib/ui/labels/backgroundImageSize.d.ts +19 -0
- package/dist-lib/ui/labels/labelModel.d.ts +64 -0
- package/dist-lib/ui/labels/qColor.d.ts +13 -0
- package/dist-lib/ui/labels/qtCss.d.ts +12 -4
- package/dist-lib/ui/landmarks.d.ts +9 -0
- package/dist-lib/ui/launcher/ActionMenu.d.ts +19 -0
- package/dist-lib/ui/launcher/GameDetails.d.ts +21 -0
- package/dist-lib/ui/launcher/GameSection.d.ts +18 -0
- package/dist-lib/ui/launcher/LauncherSearch.d.ts +23 -0
- package/dist-lib/ui/launcher/ProfileArt.d.ts +20 -0
- package/dist-lib/ui/launcher/ProfileSection.d.ts +43 -0
- package/dist-lib/ui/launcher/launcherModel.d.ts +72 -0
- package/dist-lib/ui/layout/overlayLayerOrder.d.ts +2 -2
- package/dist-lib/ui/menu/MenuBar.d.ts +31 -0
- package/dist-lib/ui/menu/SplitButton.d.ts +39 -0
- package/dist-lib/ui/menu/anchoredPopup.d.ts +74 -0
- package/dist-lib/ui/menu/appMenus.d.ts +65 -0
- package/dist-lib/ui/menu/menuModel.d.ts +88 -0
- package/dist-lib/ui/menu/toolbarModel.d.ts +56 -0
- package/dist-lib/ui/notepad.d.ts +76 -0
- package/dist-lib/ui/openSignInPage.d.ts +14 -0
- package/dist-lib/ui/output/OutputContextMenu.d.ts +14 -1
- package/dist-lib/ui/output/OutputRenderer.d.ts +5 -0
- package/dist-lib/ui/output/OutputSearchBar.d.ts +5 -1
- package/dist-lib/ui/output/StickyOutputPanel.d.ts +17 -3
- package/dist-lib/ui/output/TextAnalyzerModal.d.ts +25 -0
- package/dist-lib/ui/output/caretMode.d.ts +3 -2
- package/dist-lib/ui/output/clearSplit.d.ts +11 -0
- package/dist-lib/ui/output/outputCopy.d.ts +41 -2
- package/dist-lib/ui/output/outputRows.d.ts +43 -0
- package/dist-lib/ui/output/selectionGesture.d.ts +35 -0
- package/dist-lib/ui/output/wordSelection.d.ts +33 -0
- package/dist-lib/ui/search/matcher.d.ts +14 -4
- package/dist-lib/ui/settings/SettingsShell.d.ts +91 -0
- package/dist-lib/ui/settings/ShortcutEditor.d.ts +13 -0
- package/dist-lib/ui/sound/SoundManager.d.ts +210 -44
- package/dist-lib/ui/sound/closedCaption.d.ts +4 -1
- package/dist-lib/ui/sound/mediaDirection.d.ts +35 -0
- package/dist-lib/ui/tabCompletion.d.ts +53 -0
- package/dist-lib/ui/textedit/TextEditManager.d.ts +11 -2
- package/dist-lib/ui/useOpenProfiles.d.ts +1 -1
- package/dist-lib/ui/video/VideoManager.d.ts +7 -0
- package/dist-lib/ui/windows/WindowManager.d.ts +452 -37
- package/dist-lib/ui/windows/panels/ScriptEditorPanel.d.ts +14 -0
- package/dist-lib/ui/windows/panels/ScriptSearch.d.ts +6 -1
- package/dist-lib/ui/windows/panels/TextPanel.d.ts +4 -1
- package/dist-lib/ui/windows/panels/VariablesView.d.ts +37 -7
- package/dist-lib/ui/windows/panels/WindowCmdLine.d.ts +4 -2
- package/dist-lib/ui/windows/panels/aliasLoop.d.ts +24 -0
- package/dist-lib/ui/windows/panels/editorClipboard.d.ts +45 -0
- package/dist-lib/ui/windows/panels/editorUndo.d.ts +79 -0
- package/dist-lib/ui/windows/panels/mapAreaChange.d.ts +10 -0
- package/dist-lib/utils/appShellCache.d.ts +25 -0
- package/dist-lib/utils/fontFamilyName.d.ts +13 -0
- package/dist-lib/utils/fontLoader.d.ts +31 -0
- package/dist-lib/utils/formatBytes.d.ts +4 -0
- package/dist-lib/utils/mustBeOneOf.d.ts +9 -0
- package/dist-lib/utils/profileLock.d.ts +1 -1
- package/dist-lib/utils/systemTheme.d.ts +24 -0
- package/dist-lib/utils/timeZone.d.ts +10 -0
- package/dist-lib/vault/CredentialVault.d.ts +51 -5
- package/dist-lib/vault/deviceUnlock.d.ts +47 -0
- package/dist-lib/vault/vaultAccess.d.ts +24 -2
- package/dist-lib/vault/vaultHelpTopic.d.ts +9 -0
- package/dist-lib/vault/vaultRecord.d.ts +33 -1
- package/dist-lib/vfs-sw.js +220 -11
- package/dist-lib/vite.d.ts +1 -1
- package/dist-lib/vite.js +66 -43
- package/package.json +23 -15
- package/dist-lib/assets/mapParser.worker-t-3rd1zR.js +0 -9
- package/dist-lib/mud/connection/PingTracker.d.ts +0 -41
- package/dist-lib/ui/BundledGameGrid.d.ts +0 -21
- package/dist-lib/ui/ConnectionGrid.d.ts +0 -21
- package/dist-lib/ui/bufferWords.d.ts +0 -38
|
@@ -52,7 +52,9 @@ export declare class MudSession {
|
|
|
52
52
|
private client;
|
|
53
53
|
/** The most recent URL passed to connect() — replayed by reconnect(). */
|
|
54
54
|
private lastUrl;
|
|
55
|
-
|
|
55
|
+
/** How many times connect() has dialed, so a caller can tell whether a
|
|
56
|
+
* dial it asked for has been overtaken by another. */
|
|
57
|
+
private dials;
|
|
56
58
|
private stateUnsubs;
|
|
57
59
|
/** The profile's server encoding, as `getServerEncodingsList()` spells it.
|
|
58
60
|
* Lives here rather than on the client so it survives having none — see
|
|
@@ -67,6 +69,13 @@ export declare class MudSession {
|
|
|
67
69
|
* next connect(). Fed by the WindowManager's main-console resize callback
|
|
68
70
|
* and forwarded to the live client for NAWS (telnet option 31). */
|
|
69
71
|
private windowSize;
|
|
72
|
+
/** The main console's wrap column (Mudlet's `Host::mWrapAt`), held like
|
|
73
|
+
* `windowSize` so each new client starts with it — it caps the NAWS width
|
|
74
|
+
* and is the NEW-ENVIRON WORD_WRAP. Null until the scripting API reports
|
|
75
|
+
* the profile's value; the client then assumes desktop's default of 100. */
|
|
76
|
+
private wrapAt;
|
|
77
|
+
/** Whether the main console draws its timestamp gutter (off the NAWS width). */
|
|
78
|
+
private timestampsShown;
|
|
70
79
|
/** Active Mudlet-format replay recording, or null. Fed from the
|
|
71
80
|
* `socket.incoming` tap in the constructor — the post-MCCP,
|
|
72
81
|
* pre-telnet-parsing stream, the same point Mudlet records at. */
|
|
@@ -100,6 +109,39 @@ export declare class MudSession {
|
|
|
100
109
|
private static readonly SCRIPT_LOG_LIMIT;
|
|
101
110
|
private _scriptLog;
|
|
102
111
|
private readonly options;
|
|
112
|
+
/** True between a dial and the disconnect that answers it. Guards against
|
|
113
|
+
* narrating a teardown of something that was never dialed (an injected
|
|
114
|
+
* replay's parsing-only client, a second `destroy()`). */
|
|
115
|
+
private dialAnnounced;
|
|
116
|
+
/** Whether the outstanding dial asked the proxy for TLS (`&tls=1`) or is a
|
|
117
|
+
* `wss://` direct connection — Mudlet's `mCurrent_sslTsl`, sampled at dial
|
|
118
|
+
* time so a mid-session settings change can't rewrite the notices. */
|
|
119
|
+
private secureDial;
|
|
120
|
+
/** `performance`-independent stand-in for Mudlet's `mConnectionTimer`: when
|
|
121
|
+
* the link to the *game* came up (`client.established`), or null while
|
|
122
|
+
* nothing has. Not the WebSocket's own open: in `mud` mode that one is to
|
|
123
|
+
* the proxy, which accepts it before dialling the game at all. */
|
|
124
|
+
private connectedAt;
|
|
125
|
+
/** The socket-level failure behind the disconnect now in flight, stashed by
|
|
126
|
+
* {@link reportConnectionError}. cTelnet reads the equivalent straight off
|
|
127
|
+
* `mpSocket->errorString()` when it composes the message. */
|
|
128
|
+
private disconnectReason;
|
|
129
|
+
/** What the outstanding dial is reaching — kept for the failed-attempt
|
|
130
|
+
* notice, which names it as cTelnet's does. */
|
|
131
|
+
private dialTarget;
|
|
132
|
+
/** Whether the current dial's WebSocket opened. Through the proxy, a dial
|
|
133
|
+
* that failed without it never reached the proxy at all — Mudlet's "via
|
|
134
|
+
* proxy" failure — rather than the proxy failing to reach the game. */
|
|
135
|
+
private socketOpened;
|
|
136
|
+
/** The close frame that ended the current socket, when the other end ended
|
|
137
|
+
* it; null for a disconnect() of our own. */
|
|
138
|
+
private lastClose;
|
|
139
|
+
/** cTelnet's `mFailedConnectionCount`: attempts in a row that never reached
|
|
140
|
+
* the game, which is what the retry delay doubles on. Cleared by a
|
|
141
|
+
* connection being made and by a deliberate disconnect. */
|
|
142
|
+
private failedConnectionCount;
|
|
143
|
+
/** cTelnet's `mTimerFailedConnectionRetry`. */
|
|
144
|
+
private failedConnectionRetry;
|
|
103
145
|
/** Warn before the tab closes while a connection is live. Owned here rather
|
|
104
146
|
* than by MudClient — a fresh client is created on every connect(), so a
|
|
105
147
|
* per-client listener would accumulate one leaked closure per reconnect. */
|
|
@@ -112,7 +154,36 @@ export declare class MudSession {
|
|
|
112
154
|
get outputReady(): boolean;
|
|
113
155
|
markOutputReady(): void;
|
|
114
156
|
markOutputGone(): void;
|
|
157
|
+
/** The URL the session last dialed (and reconnect() would redial). */
|
|
158
|
+
get dialedUrl(): string | null;
|
|
159
|
+
/** The number of dials so far — see {@link dialedUrl}. */
|
|
160
|
+
get dialCount(): number;
|
|
115
161
|
connect(url: string): void;
|
|
162
|
+
/**
|
|
163
|
+
* Whether the last disconnect was asked for rather than suffered. The
|
|
164
|
+
* disconnect notice reads it to name the user rather than guessing at the
|
|
165
|
+
* server — cTelnet's `mDontReconnect` in its reason-naming role
|
|
166
|
+
* (ctelnet.cpp:803, :859). Cleared by {@link connect}.
|
|
167
|
+
*/
|
|
168
|
+
deliberateDisconnect: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Whether the disconnect now in flight must not be auto-reconnected —
|
|
171
|
+
* cTelnet's `mDontReconnect` in its *other* role (ctelnet.cpp:920).
|
|
172
|
+
*
|
|
173
|
+
* Mudlet uses the one flag for both, which is why a rejected GMCP login
|
|
174
|
+
* there reports the drop as "User Disconnected": GMCPAuthenticator raises
|
|
175
|
+
* `mDontReconnect` at rejection time (GMCPAuthenticator.cpp:613), long
|
|
176
|
+
* before the reason is composed. Splitting the two keeps "the user asked
|
|
177
|
+
* for it" honest while still suppressing the redial — the certificate and
|
|
178
|
+
* login paths in ProfileSession set this one alone, and Mudlet's own
|
|
179
|
+
* ordering makes the certificate case agree either way (it raises the flag
|
|
180
|
+
* *after* naming the reason, ctelnet.cpp:819).
|
|
181
|
+
*
|
|
182
|
+
* Set by {@link disconnect} too, so hanging up by hand is never undone, and
|
|
183
|
+
* cleared by {@link connect} — it only ever suppresses the one cycle it was
|
|
184
|
+
* raised for, as Mudlet's `mDontReconnect = false` at ctelnet.cpp:923 does.
|
|
185
|
+
*/
|
|
186
|
+
dontReconnect: boolean;
|
|
116
187
|
disconnect(): void;
|
|
117
188
|
/** Whether a send() carrying the given per-call `echo` flag should produce a
|
|
118
189
|
* local echo, under the current showSentText mode. `script` defers to the
|
|
@@ -123,10 +194,30 @@ export declare class MudSession {
|
|
|
123
194
|
* by {@link echoCommand}, which must not close a partial the deferral is
|
|
124
195
|
* about to emit itself. */
|
|
125
196
|
scriptEchoDeferred: boolean;
|
|
126
|
-
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
|
|
197
|
+
/** Set by ScriptingAPI alongside {@link scriptEchoDeferred}: where a command
|
|
198
|
+
* echoed while a trigger runs is queued, so it is drawn after the line the
|
|
199
|
+
* trigger fired on — in line with that trigger's `echo()` output — rather
|
|
200
|
+
* than above it (mudlet-web#452). The buffer already has it in the right
|
|
201
|
+
* place; only the 'message' event waits. */
|
|
202
|
+
deferCommandEcho: ((styled: string) => void) | null;
|
|
203
|
+
/**
|
|
204
|
+
* Host::send's echo stage: print a command the player (or an item acting
|
|
205
|
+
* for them) sent, under the showSentText mode. `wantPrint` is the per-call
|
|
206
|
+
* flag `script` mode defers to — `always` and `never` overrule it.
|
|
207
|
+
*
|
|
208
|
+
* Returns the command as Host::send goes on to split it, which is not
|
|
209
|
+
* always the text it was given: `TConsoleModel::printCommand` takes the
|
|
210
|
+
* command by reference and appends the line feed that ends the echoed line
|
|
211
|
+
* to it — unless it puts the echo on the end of a waiting prompt line, which
|
|
212
|
+
* needs no line feed — and inside a trigger it also puts one in front when
|
|
213
|
+
* the line being processed has text. Host::send then splits that on the
|
|
214
|
+
* separator, skips only parts that are empty BEFORE it strips line feeds,
|
|
215
|
+
* and so runs the aliases on an empty command where the text had nothing
|
|
216
|
+
* after its last separator. That is how an echoed empty Enter, `x;;` or
|
|
217
|
+
* `expandAlias("")` reaches a `^$` alias on desktop, while
|
|
218
|
+
* `expandAlias("", false)` goes out as a bare line feed without one.
|
|
219
|
+
*/
|
|
220
|
+
echoSentCommand(text: string, wantPrint: boolean): string;
|
|
130
221
|
echoCommand(text: string): void;
|
|
131
222
|
/** Wrap the echoed command in ANSI truecolor escapes from commandEchoColor
|
|
132
223
|
* so it renders in the configured foreground (and optional background). */
|
|
@@ -173,10 +264,27 @@ export declare class MudSession {
|
|
|
173
264
|
sendSecret(text: string): void;
|
|
174
265
|
sendGmcpRaw(message: string): void;
|
|
175
266
|
/** Reply to a GMCP `Char.Login.Default` request. Pass an account + password
|
|
176
|
-
* to authenticate, or no
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
|
|
267
|
+
* to authenticate, or no account for the hand-off to the game's own
|
|
268
|
+
* sign-in (the credentials popup's "Use text login"). `tokenStorage` is the
|
|
269
|
+
* honest answer to whether a sign-in token minted now would be kept. The
|
|
270
|
+
* password is relayed straight to the wire and never persisted here. */
|
|
271
|
+
sendCharLoginCredentials(account?: string, password?: string, tokenStorage?: boolean): void;
|
|
272
|
+
/** Replay a saved sign-in token (`Char.Login.Reconnect`). False when the
|
|
273
|
+
* client refused — see `MudClient.sendCharLoginReconnect`. */
|
|
274
|
+
sendCharLoginReconnect(account: string, token: string, secureOnly: boolean, tokenStorage?: boolean): boolean;
|
|
275
|
+
/** Ask the game to restart a remembered provider's browser sign-in. */
|
|
276
|
+
sendCharLoginResume(account: string, provider: string, tokenStorage?: boolean): void;
|
|
277
|
+
/** Complete a client-driven OAuth sign-in (`Char.Login.AuthCode`). False
|
|
278
|
+
* when refused over an unencrypted connection. */
|
|
279
|
+
sendCharLoginAuthCode(auth: {
|
|
280
|
+
code: string;
|
|
281
|
+
codeVerifier: string;
|
|
282
|
+
redirectUri: string;
|
|
283
|
+
nonce?: string;
|
|
284
|
+
}, tokenStorage?: boolean): boolean;
|
|
285
|
+
/** Whether the link to the *game* is encrypted right now — the gate on every
|
|
286
|
+
* `Char.Login` bearer secret. False with no socket. */
|
|
287
|
+
get gameTransportSecure(): boolean;
|
|
180
288
|
sendMSDP(variable: string, values: string[]): boolean;
|
|
181
289
|
sendSocket(data: string): boolean;
|
|
182
290
|
/** True when there is no live socket — see MudClient.isSocketUnconnected. */
|
|
@@ -191,11 +299,20 @@ export declare class MudSession {
|
|
|
191
299
|
* borrows the detached one replay playback already builds for the same
|
|
192
300
|
* reason: the telnet/ANSI/trigger path needs no socket to run. */
|
|
193
301
|
feedTelnet(data: string): void;
|
|
302
|
+
/** A feedTriggers() is text the buffer reads, so an encoding a trigger
|
|
303
|
+
* switched to part way through a read takes effect there, and for the
|
|
304
|
+
* rest of that read (see MudClient.setServerEncoding). */
|
|
305
|
+
adoptPendingEncoding(): void;
|
|
194
306
|
sendATCP(message: string): boolean;
|
|
195
307
|
sendTelnetChannel102(msg: string): boolean;
|
|
308
|
+
/** Whether GMCP is negotiated on the live connection. False with no client. */
|
|
309
|
+
isGmcpEnabled(): boolean;
|
|
196
310
|
/** Whether MSP was negotiated on the live connection. False with no client,
|
|
197
311
|
* which is what a never-connected profile should report. */
|
|
198
312
|
isMspNegotiated(): boolean;
|
|
313
|
+
/** Mudlet `Host::isRemoteEchoingActive` — the server is echoing (password
|
|
314
|
+
* entry), so no command is echoed locally. False with no client. */
|
|
315
|
+
isRemoteEchoingActive(): boolean;
|
|
199
316
|
get replaySpeed(): number;
|
|
200
317
|
get isReplayRecording(): boolean;
|
|
201
318
|
get isReplaying(): boolean;
|
|
@@ -216,8 +333,16 @@ export declare class MudSession {
|
|
|
216
333
|
/** Start playing a Mudlet-format replay (the Lua `loadReplay` core).
|
|
217
334
|
* Works offline — with no live connection the chunks feed a detached
|
|
218
335
|
* client's parsing pipeline. Returns null on success or a human-readable
|
|
219
|
-
* failure reason (mirroring Mudlet's loadReplay error strings).
|
|
220
|
-
|
|
336
|
+
* failure reason (mirroring Mudlet's loadReplay error strings).
|
|
337
|
+
*
|
|
338
|
+
* `readAt`, when given, reads the file the bytes came from as it is now:
|
|
339
|
+
* each chunk is read again from it as it comes up, as Mudlet reads its
|
|
340
|
+
* replay file a chunk at a time while playing (cTelnet::loadReplayChunk),
|
|
341
|
+
* and a chunk header that has gone bad since the load ends the replay as
|
|
342
|
+
* corrupt rather than playing on. It throws when the file cannot be read at
|
|
343
|
+
* all, and then the bytes loaded here are played: Mudlet holds the file
|
|
344
|
+
* open, and an open file outlives its name being removed. */
|
|
345
|
+
loadReplayData(bytes: Uint8Array, readAt?: (position: number, length: number) => Uint8Array): string | null;
|
|
221
346
|
/** Stop the active replay without delivering its remaining chunks.
|
|
222
347
|
* Returns false when no replay is running. */
|
|
223
348
|
abortReplay(): boolean;
|
|
@@ -248,9 +373,16 @@ export declare class MudSession {
|
|
|
248
373
|
getServerEncoding(): string;
|
|
249
374
|
setServerEncoding(name: string): boolean;
|
|
250
375
|
/** Called when CHARSET negotiation settles on a name, so the profile-level
|
|
251
|
-
* setting reflects what the connection actually agreed.
|
|
252
|
-
|
|
253
|
-
|
|
376
|
+
* setting reflects what the connection actually agreed.
|
|
377
|
+
*
|
|
378
|
+
* An encoding this client ACCEPTed from a server's REQUEST is also raised
|
|
379
|
+
* as `charset.accepted` for saving to the profile, as Mudlet's
|
|
380
|
+
* `setEncoding(acceptedEncoding, true)` saves it — and, like that, only
|
|
381
|
+
* when it changed the encoding: cTelnet::setEncoding writes nothing when
|
|
382
|
+
* the name is already the one in use. A REJECTED request never gets here,
|
|
383
|
+
* and neither does a server's ACCEPTED reply, which Mudlet ignores. */
|
|
384
|
+
noteNegotiatedEncoding(name: string, acceptedRequest?: boolean): void;
|
|
385
|
+
/** Mudlet `getServerEncodingsList()`. The fixed set of encodings Mudlet Web can
|
|
254
386
|
* decode — available even before a connection is dialed. */
|
|
255
387
|
getServerEncodingsList(): string[];
|
|
256
388
|
/** Mudlet `addSupportedTelnetOption(option)`. Forwards to the live
|
|
@@ -262,9 +394,32 @@ export declare class MudSession {
|
|
|
262
394
|
* setting survives a reconnect. */
|
|
263
395
|
setPromptTimeoutMs(ms: number): void;
|
|
264
396
|
getPromptTimeoutMs(): number | null;
|
|
397
|
+
/** True once this session's game has sent IAC GA / IAC EOR — Mudlet's
|
|
398
|
+
* `mGA_Driver`. False with no client, which is also what the editor wants:
|
|
399
|
+
* nothing has proved the game sends one. Latched per client, so it resets
|
|
400
|
+
* on reconnect; the `prompt` event fires on every marker, which is what the
|
|
401
|
+
* editor listens to for the transition. */
|
|
402
|
+
get promptMarkerSeen(): boolean;
|
|
265
403
|
/** Mudlet `setConfig("fixUnnecessaryLinebreaks", …)`. Updates the live client
|
|
266
404
|
* and the stored options so the setting survives a reconnect. */
|
|
267
405
|
setFixUnnecessaryLinebreaks(enabled: boolean): void;
|
|
406
|
+
/** Mudlet `mUSE_FORCE_LF_AFTER_PROMPT` — the "Force new line on empty
|
|
407
|
+
* commands" checkbox. Only consulted while the GA linebreak fix is on;
|
|
408
|
+
* see {@link shouldEchoEmptyCommand}. */
|
|
409
|
+
forceLfAfterPrompt: boolean;
|
|
410
|
+
/**
|
|
411
|
+
* Whether pressing Enter on an empty command line should echo a blank line.
|
|
412
|
+
*
|
|
413
|
+
* Mudlet's rule, from `Host::send` (Host.cpp:1461):
|
|
414
|
+
*
|
|
415
|
+
* if (!cmd.isEmpty() || !mUSE_IRE_DRIVER_BUGFIX || mUSE_FORCE_LF_AFTER_PROMPT)
|
|
416
|
+
*
|
|
417
|
+
* The GA linebreak fix exists because those servers already put the cursor
|
|
418
|
+
* on a fresh line after a prompt, so echoing the empty command adds a
|
|
419
|
+
* second blank one. With the fix off — the default, and every non-GA game —
|
|
420
|
+
* an empty command echoes exactly as it always did here.
|
|
421
|
+
*/
|
|
422
|
+
private shouldEchoEmptyCommand;
|
|
268
423
|
/** Mudlet `Host::mUndoServerWrap` / `mUndoServerWrapWidth`, as getConfig
|
|
269
424
|
* reads them back. */
|
|
270
425
|
get undoServerWrap(): boolean;
|
|
@@ -274,6 +429,30 @@ export declare class MudSession {
|
|
|
274
429
|
setUndoServerWrap(enabled: boolean): void;
|
|
275
430
|
/** Mudlet `setConfig("undoServerWrapWidth", …)`. */
|
|
276
431
|
setUndoServerWrapWidth(width: number): void;
|
|
432
|
+
private consoleBufferLines;
|
|
433
|
+
/** The preference pair a script's setConsoleBufferSize("main", …) just
|
|
434
|
+
* wrote, until the profile setting comes back carrying it. */
|
|
435
|
+
private scriptedBufferPreference;
|
|
436
|
+
/** The resolved scrollback cap for the main console, in lines. */
|
|
437
|
+
get consoleBufferSize(): number;
|
|
438
|
+
/**
|
|
439
|
+
* Mudlet's preference pair. `useMaximum` mirrors `checkBox_useMaxBufferSize`
|
|
440
|
+
* — desktop substitutes `TBuffer::getMaxBufferSize()`, a figure derived from
|
|
441
|
+
* physical memory; a browser tab gets {@link MAX_CONSOLE_BUFFER_SIZE}.
|
|
442
|
+
* Applies immediately to the main console when it exists.
|
|
443
|
+
*/
|
|
444
|
+
setConsoleBufferSize(lines: number, useMaximum?: boolean): void;
|
|
445
|
+
/**
|
|
446
|
+
* Record a size a script gave the main console (`Host::setMainConsoleBufferSize`,
|
|
447
|
+
* which sets `mConsoleBufferSize` and `mUseMaxConsoleBufferSize` as well as
|
|
448
|
+
* the live buffer), so the preference it saves is not then applied over the
|
|
449
|
+
* live buffer a second time. The caller has already resized the console.
|
|
450
|
+
*/
|
|
451
|
+
noteScriptedConsoleBufferSize(lines: number, useMaximum: boolean): void;
|
|
452
|
+
/** Push the resolved size onto a console, batch-deletion size and all —
|
|
453
|
+
* the `setBufferSize(bufferSize, max(100, bufferSize / 5))` of
|
|
454
|
+
* mudlet.cpp:2270-2271. */
|
|
455
|
+
applyConsoleBufferSize(console: Console): void;
|
|
277
456
|
/** Commit a line held for a wrap continuation whose flush delay has passed —
|
|
278
457
|
* the busted `pumpEvents` path, which cannot wait for a real timer. */
|
|
279
458
|
pumpServerWrap(): boolean;
|
|
@@ -286,9 +465,10 @@ export declare class MudSession {
|
|
|
286
465
|
* the change land early. See MudClient.setForceGaOff. */
|
|
287
466
|
setSpecialForceGAOff(enabled: boolean): void;
|
|
288
467
|
/** Mudlet `setConfig("versionInTTYPE", …)` / `("promptForVersionInTTYPE", …)`.
|
|
289
|
-
* Stored
|
|
290
|
-
*
|
|
291
|
-
*
|
|
468
|
+
* Stored for the next dial and applied to the live client too: desktop
|
|
469
|
+
* reads `mVersionInTTYPE` when it answers each `SB TTYPE SEND`, so the
|
|
470
|
+
* server's next request already carries (or drops) the version
|
|
471
|
+
* (mudlet-web#379). */
|
|
292
472
|
setVersionInTTYPE(enabled: boolean, prompted?: boolean): void;
|
|
293
473
|
/** Mudlet `setConfig("promptForMXPProcessorOn", …)` / `("specialForceMXPProcessorOn", …)`.
|
|
294
474
|
* Stored only — together they gate whether an in-band `ESC[<n>z` may still
|
|
@@ -300,9 +480,10 @@ export declare class MudSession {
|
|
|
300
480
|
* every console/text window re-renders control characters (and tab-stops)
|
|
301
481
|
* under the new mode on their next paint. */
|
|
302
482
|
setControlCharacterMode(mode: ControlCharacterMode): void;
|
|
303
|
-
/** Update the telnet protocol toggles
|
|
304
|
-
*
|
|
305
|
-
*
|
|
483
|
+
/** Update the telnet protocol toggles. A live client is told too, so a
|
|
484
|
+
* toggle switched off mid-session is obeyed by the next offer the server
|
|
485
|
+
* makes (Mudlet reads its equivalents at negotiation time). Options
|
|
486
|
+
* already negotiated are not retroactively withdrawn. */
|
|
306
487
|
setProtocolOptions(opts: {
|
|
307
488
|
gmcpEnabled?: boolean;
|
|
308
489
|
mttsEnabled?: boolean;
|
|
@@ -314,7 +495,6 @@ export declare class MudSession {
|
|
|
314
495
|
mxpEnabled?: boolean;
|
|
315
496
|
mnesEnabled?: boolean;
|
|
316
497
|
newEnvironEnabled?: boolean;
|
|
317
|
-
secureTransport?: boolean;
|
|
318
498
|
screenReaderAdvertised?: boolean;
|
|
319
499
|
osc8HyperlinksEnabled?: boolean;
|
|
320
500
|
nawsEnabled?: boolean;
|
|
@@ -325,15 +505,92 @@ export declare class MudSession {
|
|
|
325
505
|
* on a later connect() is seeded with the current size. Called by the
|
|
326
506
|
* WindowManager whenever the main console's grid changes. */
|
|
327
507
|
setWindowSize(cols: number, rows: number): void;
|
|
508
|
+
/** Record the main console's wrap column (0 for off) and pass it to the
|
|
509
|
+
* live client: desktop reports `min(columns, wrap)` as the NAWS width and
|
|
510
|
+
* the wrap itself as WORD_WRAP, and re-sends NAWS when it changes. Called
|
|
511
|
+
* by the scripting API whenever the profile's `outputWrapAt` is applied. */
|
|
512
|
+
setWrapAt(wrapAt: number): void;
|
|
513
|
+
/** Record whether the main console shows its timestamp gutter, which
|
|
514
|
+
* desktop takes off the NAWS width. Called by the main output view. */
|
|
515
|
+
setTimestampsShown(shown: boolean): void;
|
|
328
516
|
private teardownClient;
|
|
329
517
|
get destroyed(): boolean;
|
|
330
518
|
/** Release resources that live outside the JS heap. In-memory state (maps,
|
|
331
519
|
* arrays, sub-managers) is reclaimed by GC once the instance is dropped, so
|
|
332
520
|
* this only handles the three things that don't self-clean: the WebSocket
|
|
333
|
-
*
|
|
521
|
+
* (via `teardownClient`), Web Audio nodes, and any EventBus
|
|
334
522
|
* listeners with an AbortSignal cleanup still pending. Idempotent. */
|
|
335
523
|
destroy(): void;
|
|
336
524
|
private setStatus;
|
|
337
525
|
private setPing;
|
|
338
526
|
private reportConnectionError;
|
|
527
|
+
/** One of cTelnet's `postMessage()` notices. Emitted as a normal `message`,
|
|
528
|
+
* so it reaches the console, the session log and a saved replay alike —
|
|
529
|
+
* the whole point of the issue: a transcript that ends mid-sentence should
|
|
530
|
+
* say why. Prefix colours follow the ones already used for the TLS notices
|
|
531
|
+
* in ProfileSession. */
|
|
532
|
+
private postSocketMessage;
|
|
533
|
+
/** cTelnet's postMessage prints into the main console like anything else,
|
|
534
|
+
* so its notices are lines getLineCount() counts and getLines() returns —
|
|
535
|
+
* a script indexing lines after a connect or a disconnect lands where it
|
|
536
|
+
* does on desktop only if they are (mudlet-web#339). Stored as well as
|
|
537
|
+
* rendered, as {@link warnIfUnencodable} does, and wrapped at the main
|
|
538
|
+
* window's width like any other line. */
|
|
539
|
+
/** Host::postMessage for a notice from elsewhere in the client (a failed
|
|
540
|
+
* exportAreaImage save): a stored main-console line, as cTelnet's are. */
|
|
541
|
+
postMessageLine(styled: string): void;
|
|
542
|
+
private postSocketLine;
|
|
543
|
+
/** cTelnet's "[ INFO ] - Attempting an open connection to %1:%2 ..."
|
|
544
|
+
* (ctelnet.cpp:1485/1494 for IPv4, :1454/1463 for IPv6) and its secure
|
|
545
|
+
* variant (:1362-1430). `mud`-mode profiles reach
|
|
546
|
+
* the game through the telnet→WebSocket proxy, which is what Mudlet's
|
|
547
|
+
* "via proxy" wording describes, so it is used for exactly those. */
|
|
548
|
+
private announceConnecting;
|
|
549
|
+
/** cTelnet's open-connection notice (ctelnet.cpp:920-935). Desktop always
|
|
550
|
+
* names the address family it won the dual-stack race with — "Open
|
|
551
|
+
* connection made (IPv4)." / "(IPv6)." — because it opens both and reports
|
|
552
|
+
* whichever answered. A browser WebSocket exposes no such thing, so the
|
|
553
|
+
* suffix is dropped rather than guessed at; this is the one notice here
|
|
554
|
+
* that is not Mudlet's string verbatim. */
|
|
555
|
+
private announceConnected;
|
|
556
|
+
/** cTelnet's slot_socketError / host-lookup failure notice, for a dial that
|
|
557
|
+
* never reached the game (ctelnet.cpp slot_socketError,
|
|
558
|
+
* slot_socketHostFound). No "Socket got disconnected" and no connection
|
|
559
|
+
* time: nothing was connected. Posted before sysDisconnectionEvent, as
|
|
560
|
+
* handleFailedConnection raises it only after the player has been told.
|
|
561
|
+
* An attempt called off by the player is not news, and says nothing. */
|
|
562
|
+
private announceFailedConnection;
|
|
563
|
+
/** How many attempts in a row have failed to reach the game. */
|
|
564
|
+
get failedConnections(): number;
|
|
565
|
+
/**
|
|
566
|
+
* The retry half of cTelnet's `handleFailedConnection`, for a profile set to
|
|
567
|
+
* reconnect automatically: say when, then try again after 5 s, doubling per
|
|
568
|
+
* failure in a row up to 60 s. The caller decides whether a retry is wanted
|
|
569
|
+
* at all (the profile option, `dontReconnect`); the timer is ours, so that
|
|
570
|
+
* a Connect, a Disconnect or closing the profile calls it off, as each of
|
|
571
|
+
* them stops `mTimerFailedConnectionRetry`.
|
|
572
|
+
*/
|
|
573
|
+
scheduleFailedConnectionRetry(redial: () => void): void;
|
|
574
|
+
private cancelFailedConnectionRetry;
|
|
575
|
+
/** A `[ WARN ]` notice from the client, laid out as cTelnet::postMessage
|
|
576
|
+
* does: the prefix in cyan and the text in orange (here the ANSI yellow
|
|
577
|
+
* its other notices use), each further line indented to the end of the
|
|
578
|
+
* prefix. */
|
|
579
|
+
private postClientWarning;
|
|
580
|
+
/** The indented, yellow second row of a two-line notice — Mudlet's "%1\n%2"
|
|
581
|
+
* renders as two rows, and a `message` here is one. */
|
|
582
|
+
private postSocketContinuation;
|
|
583
|
+
/** cTelnet's disconnect pair: the reason (ctelnet.cpp:1073-1136) and then
|
|
584
|
+
* the connection time (ctelnet.cpp:994-999). Posted on *every* disconnect — a clean
|
|
585
|
+
* server close and an idle kick used to produce nothing at all, because
|
|
586
|
+
* they never reach the abnormal-close path. */
|
|
587
|
+
private announceDisconnected;
|
|
339
588
|
}
|
|
589
|
+
/** cTelnet's `FAILED_CONNECTION_RETRY_DELAY` / `_MAX_DELAY` (ctelnet.cpp):
|
|
590
|
+
* how long to leave a game that could not be reached before trying again,
|
|
591
|
+
* doubling with each failure in a row. */
|
|
592
|
+
export declare const FAILED_CONNECTION_RETRY_DELAY_MS = 5000;
|
|
593
|
+
export declare const FAILED_CONNECTION_RETRY_MAX_DELAY_MS = 60000;
|
|
594
|
+
/** The wait before retry number `failures` (1-based) —
|
|
595
|
+
* `min(DELAY * 2^min(failures - 1, 5), MAX_DELAY)`, as cTelnet computes it. */
|
|
596
|
+
export declare function failedConnectionRetryDelayMs(failures: number): number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Pcre2 from './triggers/pcre/Pcre2';
|
|
1
2
|
type TempFn = (matches: RegExpMatchArray) => void;
|
|
2
3
|
type PatternItem = {
|
|
3
4
|
id: string;
|
|
@@ -9,25 +10,163 @@ type PatternItem = {
|
|
|
9
10
|
isGroup: boolean;
|
|
10
11
|
parentId: string | null;
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* An alias pattern, compiled with PCRE2 the way TAlias::compileRegex does —
|
|
15
|
+
* not as a JS RegExp, whose dialect has no inline `(?i)`/`(?x)`, no atomic or
|
|
16
|
+
* possessive groups, no `\A`/`\Z`, and reads `\p{L}` as a literal `p{L}`.
|
|
17
|
+
*
|
|
18
|
+
* Compiled on first use rather than on construction: the PCRE wasm loads
|
|
19
|
+
* asynchronously, and aliases (saved ones, and temp ones a script makes while
|
|
20
|
+
* the profile loads) can be registered before it has. Nobody types a command
|
|
21
|
+
* before then, so the first match is the earliest a compile is ever needed.
|
|
22
|
+
* A pattern that fails to compile stays failed and never matches.
|
|
23
|
+
*/
|
|
24
|
+
export declare class AliasPattern {
|
|
25
|
+
readonly source: string;
|
|
26
|
+
private re;
|
|
27
|
+
private failed;
|
|
28
|
+
constructor(source: string);
|
|
29
|
+
/** The compiled pattern, or null while PCRE is still loading or when the
|
|
30
|
+
* pattern does not compile. */
|
|
31
|
+
compiled(): Pcre2 | null;
|
|
32
|
+
/** Whether PCRE has rejected the pattern — Mudlet's `mOK_init = false`,
|
|
33
|
+
* which leaves the alias inactive. False while PCRE is still loading. */
|
|
34
|
+
invalid(): boolean;
|
|
35
|
+
/** Free the wasm-side pattern. It never matches again afterwards. */
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
/** A temporary item: the temporary half of desktop's one tree per kind,
|
|
39
|
+
* keyed by the id the script was handed. A temp item is named after its id
|
|
40
|
+
* (startTempAlias: setName(QString::number(id))). */
|
|
41
|
+
export interface TempPatternItem {
|
|
42
|
+
/** A null pattern is an empty one, which can never match; an
|
|
43
|
+
* uncompilable one is an AliasPattern that never compiles. See
|
|
44
|
+
* {@link PatternEngine.addTemp}. */
|
|
45
|
+
pattern: AliasPattern | null;
|
|
46
|
+
fn: TempFn;
|
|
47
|
+
seq: number;
|
|
48
|
+
/** enableAlias/disableAlias — Tree::mActive. */
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
/** Killed, waiting for the deferred cleanup (mCleanupSet): no longer
|
|
51
|
+
* fires, and it and everything under it read as gone to exists/isActive/
|
|
52
|
+
* findItems, but it is still counted by getProfileStats until freed. */
|
|
53
|
+
dead: boolean;
|
|
54
|
+
/** Its script did not compile: made and findable, but never fires and
|
|
55
|
+
* isActive() says 0 (TAlias::setScript). */
|
|
56
|
+
uncompiled: boolean;
|
|
57
|
+
/** Run once when the item is killed or removed, to release its callback. */
|
|
58
|
+
onFree?: () => void;
|
|
59
|
+
freed?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/** What a caller can tell the engine about a temp item. */
|
|
62
|
+
export interface TempPatternOptions {
|
|
63
|
+
/** The id to file it under, drawn by the caller from the profile's shared
|
|
64
|
+
* sequence; the engine draws its own when absent (a bare test engine). */
|
|
65
|
+
id?: number;
|
|
66
|
+
uncompiled?: boolean;
|
|
67
|
+
onFree?: () => void;
|
|
68
|
+
}
|
|
12
69
|
export declare class PatternEngine<T extends PatternItem> {
|
|
13
|
-
protected readonly temp: Map<number,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
protected nextInternalId: number;
|
|
70
|
+
protected readonly temp: Map<number, TempPatternItem>;
|
|
71
|
+
/** Fallback id source for a bare engine — see TempPatternOptions.id. */
|
|
72
|
+
private idSeq;
|
|
73
|
+
/** Each permanent item hanging off a temporary one (as of the last
|
|
74
|
+
* loadPerm) → that temporary root's id; and the parent refs in use. */
|
|
75
|
+
protected permTempRoot: Map<string, number>;
|
|
76
|
+
private tempParentRefs;
|
|
77
|
+
private orphanedParents;
|
|
78
|
+
private onOrphans;
|
|
23
79
|
protected permCompiled: Array<{
|
|
24
80
|
item: T;
|
|
25
|
-
re:
|
|
81
|
+
re: AliasPattern;
|
|
82
|
+
}>;
|
|
83
|
+
/** {@link permCompiled} by item id — what is loaded and active right now. */
|
|
84
|
+
protected permById: Map<string, {
|
|
85
|
+
item: T;
|
|
86
|
+
re: AliasPattern;
|
|
26
87
|
}>;
|
|
27
|
-
/**
|
|
88
|
+
/** Every permanent item with a pattern, active or not, in tree order. A
|
|
89
|
+
* fresh array on each {@link loadPerm}, so a pass can keep walking the one
|
|
90
|
+
* it started with — Mudlet's `copyOfNodeList` — while a script it runs
|
|
91
|
+
* enables or disables items, which reloads this engine synchronously. */
|
|
92
|
+
protected permOrder: readonly string[];
|
|
93
|
+
protected regCounter: number;
|
|
94
|
+
private readonly permReg;
|
|
95
|
+
/** Each item in {@link permOrder} → the seq of the root it hangs under. */
|
|
96
|
+
protected permRootSeq: Map<string, number>;
|
|
97
|
+
/** Temp items in the tree — killed ones too, until the cleanup frees them
|
|
98
|
+
* (desktop's getProfileStats walks the root list unfiltered). */
|
|
28
99
|
get tempCount(): number;
|
|
29
|
-
|
|
30
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Register a temporary item. A pattern that will never match is still an
|
|
102
|
+
* item: TAlias::compileRegex records a compile failure rather than refusing
|
|
103
|
+
* to build the alias, and TAlias::match then returns false on every line
|
|
104
|
+
* (`if (re == nullptr)`, and `mRegexCode.isEmpty()` a few lines later). The
|
|
105
|
+
* caller gets a real id back either way, which is what lets a broken alias
|
|
106
|
+
* be seen in the editor and repaired instead of vanishing.
|
|
107
|
+
*
|
|
108
|
+
* Both cases used to leak: an uncompilable pattern threw the RegExp
|
|
109
|
+
* SyntaxError out through the Lua binding, and an EMPTY one compiled to
|
|
110
|
+
* //, which matches every command typed and consumed the lot. A pattern
|
|
111
|
+
* that PCRE rejects now simply never matches — see {@link AliasPattern}.
|
|
112
|
+
*/
|
|
113
|
+
addTemp(pattern: string, fn: TempFn, opts?: TempPatternOptions): () => void;
|
|
114
|
+
/** {@link addTemp}, handing back the item's id rather than a disposer. */
|
|
115
|
+
createTemp(pattern: string, fn: TempFn, opts?: TempPatternOptions): number;
|
|
116
|
+
/** Take a temp item out of the tree now, releasing its callback. Its
|
|
117
|
+
* permanent children are left for the owner to remove (see
|
|
118
|
+
* takeOrphanedParents). */
|
|
119
|
+
removeTemp(id: number): void;
|
|
120
|
+
private release;
|
|
121
|
+
/** Mudlet `killAlias` on a temp item: it stops at once and is queued for
|
|
122
|
+
* the deferred cleanup, which frees it with its whole subtree. False for
|
|
123
|
+
* an unknown id or one already waiting to be freed. */
|
|
124
|
+
killTemp(id: number): boolean;
|
|
125
|
+
/** `killAlias(name)` for the temporaries: the newest live one so named. */
|
|
126
|
+
killTempByName(name: string): boolean;
|
|
127
|
+
/** Free every temp item killed since the last call — the unit's
|
|
128
|
+
* doCleanup(). */
|
|
129
|
+
reapKilled(): void;
|
|
130
|
+
/** Tree keys of freed temp items that had permanent children, since the
|
|
131
|
+
* last call. Their owner removes those subtrees from the store. */
|
|
132
|
+
takeOrphanedParents(): string[];
|
|
133
|
+
/** Told when {@link takeOrphanedParents} has something to hand over. */
|
|
134
|
+
setOrphanListener(fn: (() => void) | null): void;
|
|
135
|
+
/** In the tree, killed or not. */
|
|
136
|
+
hasTemp(id: number): boolean;
|
|
137
|
+
/** In the tree and not killed — what exists() counts. */
|
|
138
|
+
hasLiveTemp(id: number): boolean;
|
|
139
|
+
/** Live, switched on and compiled — isActive(). */
|
|
140
|
+
tempIsActive(id: number): boolean;
|
|
141
|
+
/** Live temp ids, ascending, whose name — the id itself — passes `test`. */
|
|
142
|
+
liveTempIds(test: (name: string) => boolean): number[];
|
|
143
|
+
/** The temp item named `name` — its id's exact spelling — or null; a
|
|
144
|
+
* killed one only when `includeDead` (perm* parent resolution). */
|
|
145
|
+
newestTempByName(name: string, includeDead: boolean): number | null;
|
|
146
|
+
/** enable/disable a live temp item. False for an unknown or killed one —
|
|
147
|
+
* re-enabling a corpse would resurrect it. */
|
|
148
|
+
setTempEnabled(id: number, enabled: boolean): boolean;
|
|
149
|
+
/** The order seq of a permanent item's root: its own root's, or — for one
|
|
150
|
+
* hanging off a temporary item — that item's. */
|
|
151
|
+
protected rootSeqOf(id: string): number;
|
|
152
|
+
/** Whether a permanent item's temporary root (if it has one) is live and
|
|
153
|
+
* active: desktop reaches it only through that parent's match(). */
|
|
154
|
+
protected reachable(id: string): boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Give the profile's saved items their place in the firing order before
|
|
157
|
+
* any script can make a temporary one. Desktop builds them from the
|
|
158
|
+
* profile XML before a script runs, so a temp item a script makes at load
|
|
159
|
+
* time sorts after them — but here the scripts run before the first
|
|
160
|
+
* {@link loadPerm}, which then reuses the seqs reserved here.
|
|
161
|
+
*/
|
|
162
|
+
reserveOrder(items: readonly {
|
|
163
|
+
id: string;
|
|
164
|
+
}[]): void;
|
|
165
|
+
/** `blocked`: items whose code will not compile, which Mudlet leaves
|
|
166
|
+
* inactive — see buildEffectivelyEnabledIds. */
|
|
167
|
+
loadPerm(items: T[], blocked?: ReadonlySet<string>): void;
|
|
168
|
+
/** Whether the permanent item `id` is loaded with a pattern PCRE rejects. */
|
|
169
|
+
hasInvalidPattern(id: string): boolean;
|
|
31
170
|
destroy(): void;
|
|
32
171
|
}
|
|
33
172
|
export {};
|