@jsprismarine/script-host 0.0.0 → 0.23.0-unstable-20261120210452
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/CHANGELOG.md +99 -0
- package/LICENSE +21 -0
- package/README.md +667 -28
- package/dist/ScriptEngine.d.ts +250 -0
- package/dist/ScriptEngine.d.ts.map +1 -0
- package/dist/ScriptEngine.js +427 -0
- package/dist/ScriptEngine.js.map +1 -0
- package/dist/absentGlobals.d.ts +29 -0
- package/dist/absentGlobals.d.ts.map +1 -0
- package/dist/absentGlobals.js +94 -0
- package/dist/absentGlobals.js.map +1 -0
- package/dist/debugger/DebugSession.d.ts +189 -0
- package/dist/debugger/DebugSession.d.ts.map +1 -0
- package/dist/debugger/DebugSession.js +588 -0
- package/dist/debugger/DebugSession.js.map +1 -0
- package/dist/debugger/EngineDebugger.d.ts +158 -0
- package/dist/debugger/EngineDebugger.d.ts.map +1 -0
- package/dist/debugger/EngineDebugger.js +174 -0
- package/dist/debugger/EngineDebugger.js.map +1 -0
- package/dist/debugger/channel.d.ts +67 -0
- package/dist/debugger/channel.d.ts.map +1 -0
- package/dist/debugger/channel.js +120 -0
- package/dist/debugger/channel.js.map +1 -0
- package/dist/debugger/connectionWorker.d.ts +2 -0
- package/dist/debugger/connectionWorker.d.ts.map +1 -0
- package/dist/debugger/connectionWorker.js +98 -0
- package/dist/debugger/connectionWorker.js.map +1 -0
- package/dist/debugger/framing.d.ts +46 -0
- package/dist/debugger/framing.d.ts.map +1 -0
- package/dist/debugger/framing.js +106 -0
- package/dist/debugger/framing.js.map +1 -0
- package/dist/debugger/profiler.d.ts +72 -0
- package/dist/debugger/profiler.d.ts.map +1 -0
- package/dist/debugger/profiler.js +92 -0
- package/dist/debugger/profiler.js.map +1 -0
- package/dist/debugger/protocol.d.ts +170 -0
- package/dist/debugger/protocol.d.ts.map +1 -0
- package/dist/debugger/protocol.js +141 -0
- package/dist/debugger/protocol.js.map +1 -0
- package/dist/debugger/thread.d.ts +85 -0
- package/dist/debugger/thread.d.ts.map +1 -0
- package/dist/debugger/thread.js +134 -0
- package/dist/debugger/thread.js.map +1 -0
- package/dist/debugger/transport.d.ts +80 -0
- package/dist/debugger/transport.d.ts.map +1 -0
- package/dist/debugger/transport.js +150 -0
- package/dist/debugger/transport.js.map +1 -0
- package/dist/engineSource.d.ts +14 -0
- package/dist/engineSource.d.ts.map +1 -0
- package/dist/engineSource.js +17 -0
- package/dist/engineSource.js.map +1 -0
- package/dist/errors.d.ts +62 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +62 -0
- package/dist/errors.js.map +1 -0
- package/dist/ffi.d.ts +63 -0
- package/dist/ffi.d.ts.map +1 -0
- package/dist/ffi.js +156 -0
- package/dist/ffi.js.map +1 -0
- package/dist/generated/script-modules/common.d.ts +2 -0
- package/dist/generated/script-modules/common.js +262 -0
- package/dist/generated/script-modules/common.js.map +1 -0
- package/dist/generated/script-modules/common.json.d.ts +2 -0
- package/dist/generated/script-modules/debug-utilities.d.ts +2 -0
- package/dist/generated/script-modules/debug-utilities.js +23 -0
- package/dist/generated/script-modules/debug-utilities.js.map +1 -0
- package/dist/generated/script-modules/debug-utilities.json.d.ts +2 -0
- package/dist/generated/script-modules/diagnostics.d.ts +2 -0
- package/dist/generated/script-modules/diagnostics.js +281 -0
- package/dist/generated/script-modules/diagnostics.js.map +1 -0
- package/dist/generated/script-modules/diagnostics.json.d.ts +2 -0
- package/dist/generated/script-modules/server-admin.d.ts +2 -0
- package/dist/generated/script-modules/server-admin.js +23 -0
- package/dist/generated/script-modules/server-admin.js.map +1 -0
- package/dist/generated/script-modules/server-admin.json.d.ts +2 -0
- package/dist/generated/script-modules/server-gametest.d.ts +2 -0
- package/dist/generated/script-modules/server-gametest.js +23 -0
- package/dist/generated/script-modules/server-gametest.js.map +1 -0
- package/dist/generated/script-modules/server-gametest.json.d.ts +2 -0
- package/dist/generated/script-modules/server-graphics.d.ts +2 -0
- package/dist/generated/script-modules/server-graphics.js +30 -0
- package/dist/generated/script-modules/server-graphics.js.map +1 -0
- package/dist/generated/script-modules/server-graphics.json.d.ts +2 -0
- package/dist/generated/script-modules/server-net.d.ts +2 -0
- package/dist/generated/script-modules/server-net.js +24 -0
- package/dist/generated/script-modules/server-net.js.map +1 -0
- package/dist/generated/script-modules/server-net.json.d.ts +2 -0
- package/dist/generated/script-modules/server-ui.d.ts +2 -0
- package/dist/generated/script-modules/server-ui.js +110 -0
- package/dist/generated/script-modules/server-ui.js.map +1 -0
- package/dist/generated/script-modules/server-ui.json.d.ts +2 -0
- package/dist/generated/script-modules/server.d.ts +2 -0
- package/dist/generated/script-modules/server.js +251 -0
- package/dist/generated/script-modules/server.js.map +1 -0
- package/dist/generated/script-modules/server.json.d.ts +2 -0
- package/dist/generated/scriptApi.d.ts +3233 -0
- package/dist/generated/scriptApi.d.ts.map +1 -0
- package/dist/generated/scriptApi.js +0 -0
- package/dist/generated/scriptModules.d.ts +13 -0
- package/dist/generated/scriptModules.d.ts.map +1 -0
- package/dist/generated/scriptModules.js +34 -0
- package/dist/generated/scriptModules.js.map +1 -0
- package/dist/host/PackForms.d.ts +71 -0
- package/dist/host/PackForms.d.ts.map +1 -0
- package/dist/host/PackForms.js +164 -0
- package/dist/host/PackForms.js.map +1 -0
- package/dist/host/ScriptForms.d.ts +51 -0
- package/dist/host/ScriptForms.d.ts.map +1 -0
- package/dist/host/ScriptForms.js +103 -0
- package/dist/host/ScriptForms.js.map +1 -0
- package/dist/host/ScriptHttp.d.ts +54 -0
- package/dist/host/ScriptHttp.d.ts.map +1 -0
- package/dist/host/ScriptHttp.js +82 -0
- package/dist/host/ScriptHttp.js.map +1 -0
- package/dist/host/WorldScripts.d.ts +350 -0
- package/dist/host/WorldScripts.d.ts.map +1 -0
- package/dist/host/WorldScripts.js +1421 -0
- package/dist/host/WorldScripts.js.map +1 -0
- package/dist/host/blocksItems/blockComponents.d.ts +27 -0
- package/dist/host/blocksItems/blockComponents.d.ts.map +1 -0
- package/dist/host/blocksItems/blockComponents.js +73 -0
- package/dist/host/blocksItems/blockComponents.js.map +1 -0
- package/dist/host/blocksItems/blocks.d.ts +12 -0
- package/dist/host/blocksItems/blocks.d.ts.map +1 -0
- package/dist/host/blocksItems/blocks.js +247 -0
- package/dist/host/blocksItems/blocks.js.map +1 -0
- package/dist/host/blocksItems/componentFacts.d.ts +14 -0
- package/dist/host/blocksItems/componentFacts.d.ts.map +1 -0
- package/dist/host/blocksItems/componentFacts.js +34 -0
- package/dist/host/blocksItems/componentFacts.js.map +1 -0
- package/dist/host/blocksItems/containers.d.ts +18 -0
- package/dist/host/blocksItems/containers.d.ts.map +1 -0
- package/dist/host/blocksItems/containers.js +128 -0
- package/dist/host/blocksItems/containers.js.map +1 -0
- package/dist/host/blocksItems/handles.d.ts +10 -0
- package/dist/host/blocksItems/handles.d.ts.map +1 -0
- package/dist/host/blocksItems/handles.js +30 -0
- package/dist/host/blocksItems/handles.js.map +1 -0
- package/dist/host/blocksItems/implement.d.ts +22 -0
- package/dist/host/blocksItems/implement.d.ts.map +1 -0
- package/dist/host/blocksItems/implement.js +23 -0
- package/dist/host/blocksItems/implement.js.map +1 -0
- package/dist/host/blocksItems/itemExtras.d.ts +8 -0
- package/dist/host/blocksItems/itemExtras.d.ts.map +1 -0
- package/dist/host/blocksItems/itemExtras.js +106 -0
- package/dist/host/blocksItems/itemExtras.js.map +1 -0
- package/dist/host/blocksItems/itemLink.d.ts +12 -0
- package/dist/host/blocksItems/itemLink.d.ts.map +1 -0
- package/dist/host/blocksItems/itemLink.js +38 -0
- package/dist/host/blocksItems/itemLink.js.map +1 -0
- package/dist/host/blocksItems/items.d.ts +25 -0
- package/dist/host/blocksItems/items.d.ts.map +1 -0
- package/dist/host/blocksItems/items.js +427 -0
- package/dist/host/blocksItems/items.js.map +1 -0
- package/dist/host/blocksItems/tags.d.ts +24 -0
- package/dist/host/blocksItems/tags.d.ts.map +1 -0
- package/dist/host/blocksItems/tags.js +27 -0
- package/dist/host/blocksItems/tags.js.map +1 -0
- package/dist/host/blocksItems/types.d.ts +13 -0
- package/dist/host/blocksItems/types.d.ts.map +1 -0
- package/dist/host/blocksItems/types.js +83 -0
- package/dist/host/blocksItems/types.js.map +1 -0
- package/dist/host/blocksItems/volumes.d.ts +37 -0
- package/dist/host/blocksItems/volumes.d.ts.map +1 -0
- package/dist/host/blocksItems/volumes.js +361 -0
- package/dist/host/blocksItems/volumes.js.map +1 -0
- package/dist/host/coverage.d.ts +28 -0
- package/dist/host/coverage.d.ts.map +1 -0
- package/dist/host/coverage.js +45 -0
- package/dist/host/coverage.js.map +1 -0
- package/dist/host/customContent.d.ts +81 -0
- package/dist/host/customContent.d.ts.map +1 -0
- package/dist/host/customContent.js +213 -0
- package/dist/host/customContent.js.map +1 -0
- package/dist/host/debugUtilities.d.ts +192 -0
- package/dist/host/debugUtilities.d.ts.map +1 -0
- package/dist/host/debugUtilities.js +503 -0
- package/dist/host/debugUtilities.js.map +1 -0
- package/dist/host/entities/aimAssist.d.ts +11 -0
- package/dist/host/entities/aimAssist.d.ts.map +1 -0
- package/dist/host/entities/aimAssist.js +195 -0
- package/dist/host/entities/aimAssist.js.map +1 -0
- package/dist/host/entities/area.d.ts +14 -0
- package/dist/host/entities/area.d.ts.map +1 -0
- package/dist/host/entities/area.js +19 -0
- package/dist/host/entities/area.js.map +1 -0
- package/dist/host/entities/components.d.ts +61 -0
- package/dist/host/entities/components.d.ts.map +1 -0
- package/dist/host/entities/components.js +642 -0
- package/dist/host/entities/components.js.map +1 -0
- package/dist/host/entities/entityMembers.d.ts +35 -0
- package/dist/host/entities/entityMembers.d.ts.map +1 -0
- package/dist/host/entities/entityMembers.js +494 -0
- package/dist/host/entities/entityMembers.js.map +1 -0
- package/dist/host/entities/playerMembers.d.ts +23 -0
- package/dist/host/entities/playerMembers.d.ts.map +1 -0
- package/dist/host/entities/playerMembers.js +576 -0
- package/dist/host/entities/playerMembers.js.map +1 -0
- package/dist/host/entities/world.d.ts +315 -0
- package/dist/host/entities/world.d.ts.map +1 -0
- package/dist/host/entities/world.js +0 -0
- package/dist/host/events/componentEvents.d.ts +11 -0
- package/dist/host/events/componentEvents.d.ts.map +1 -0
- package/dist/host/events/componentEvents.js +23 -0
- package/dist/host/events/componentEvents.js.map +1 -0
- package/dist/host/events/eventOptions.d.ts +14 -0
- package/dist/host/events/eventOptions.d.ts.map +1 -0
- package/dist/host/events/eventOptions.js +224 -0
- package/dist/host/events/eventOptions.js.map +1 -0
- package/dist/host/events/eventValues.d.ts +41 -0
- package/dist/host/events/eventValues.d.ts.map +1 -0
- package/dist/host/events/eventValues.js +89 -0
- package/dist/host/events/eventValues.js.map +1 -0
- package/dist/host/events/worldEvents.d.ts +30 -0
- package/dist/host/events/worldEvents.d.ts.map +1 -0
- package/dist/host/events/worldEvents.js +207 -0
- package/dist/host/events/worldEvents.js.map +1 -0
- package/dist/host/formJson.d.ts +35 -0
- package/dist/host/formJson.d.ts.map +1 -0
- package/dist/host/formJson.js +84 -0
- package/dist/host/formJson.js.map +1 -0
- package/dist/host/formKit.d.ts +40 -0
- package/dist/host/formKit.d.ts.map +1 -0
- package/dist/host/formKit.js +124 -0
- package/dist/host/formKit.js.map +1 -0
- package/dist/host/forms.d.ts +92 -0
- package/dist/host/forms.d.ts.map +1 -0
- package/dist/host/forms.js +361 -0
- package/dist/host/forms.js.map +1 -0
- package/dist/host/gametest.d.ts +202 -0
- package/dist/host/gametest.d.ts.map +1 -0
- package/dist/host/gametest.js +316 -0
- package/dist/host/gametest.js.map +1 -0
- package/dist/host/inputs.d.ts +29 -0
- package/dist/host/inputs.d.ts.map +1 -0
- package/dist/host/inputs.js +110 -0
- package/dist/host/inputs.js.map +1 -0
- package/dist/host/jobs.d.ts +48 -0
- package/dist/host/jobs.d.ts.map +1 -0
- package/dist/host/jobs.js +62 -0
- package/dist/host/jobs.js.map +1 -0
- package/dist/host/jsprismarineServer.d.ts +65 -0
- package/dist/host/jsprismarineServer.d.ts.map +1 -0
- package/dist/host/jsprismarineServer.js +83 -0
- package/dist/host/jsprismarineServer.js.map +1 -0
- package/dist/host/minecraftServer.d.ts +229 -0
- package/dist/host/minecraftServer.d.ts.map +1 -0
- package/dist/host/minecraftServer.js +304 -0
- package/dist/host/minecraftServer.js.map +1 -0
- package/dist/host/minecraftServerUi.d.ts +30 -0
- package/dist/host/minecraftServerUi.d.ts.map +1 -0
- package/dist/host/minecraftServerUi.js +89 -0
- package/dist/host/minecraftServerUi.js.map +1 -0
- package/dist/host/netKit.d.ts +44 -0
- package/dist/host/netKit.d.ts.map +1 -0
- package/dist/host/netKit.js +87 -0
- package/dist/host/netKit.js.map +1 -0
- package/dist/host/pack.d.ts +71 -0
- package/dist/host/pack.d.ts.map +1 -0
- package/dist/host/pack.js +157 -0
- package/dist/host/pack.js.map +1 -0
- package/dist/host/serverAdmin.d.ts +44 -0
- package/dist/host/serverAdmin.d.ts.map +1 -0
- package/dist/host/serverAdmin.js +96 -0
- package/dist/host/serverAdmin.js.map +1 -0
- package/dist/host/serverBlocks.d.ts +32 -0
- package/dist/host/serverBlocks.d.ts.map +1 -0
- package/dist/host/serverBlocks.js +93 -0
- package/dist/host/serverBlocks.js.map +1 -0
- package/dist/host/serverComponents.d.ts +46 -0
- package/dist/host/serverComponents.d.ts.map +1 -0
- package/dist/host/serverComponents.js +297 -0
- package/dist/host/serverComponents.js.map +1 -0
- package/dist/host/serverCustom.d.ts +16 -0
- package/dist/host/serverCustom.d.ts.map +1 -0
- package/dist/host/serverCustom.js +161 -0
- package/dist/host/serverCustom.js.map +1 -0
- package/dist/host/serverEntities.d.ts +49 -0
- package/dist/host/serverEntities.d.ts.map +1 -0
- package/dist/host/serverEntities.js +358 -0
- package/dist/host/serverEntities.js.map +1 -0
- package/dist/host/serverFeedback.d.ts +15 -0
- package/dist/host/serverFeedback.d.ts.map +1 -0
- package/dist/host/serverFeedback.js +413 -0
- package/dist/host/serverFeedback.js.map +1 -0
- package/dist/host/serverGametest.d.ts +43 -0
- package/dist/host/serverGametest.d.ts.map +1 -0
- package/dist/host/serverGametest.js +246 -0
- package/dist/host/serverGametest.js.map +1 -0
- package/dist/host/serverItems.d.ts +17 -0
- package/dist/host/serverItems.d.ts.map +1 -0
- package/dist/host/serverItems.js +71 -0
- package/dist/host/serverItems.js.map +1 -0
- package/dist/host/serverNet.d.ts +41 -0
- package/dist/host/serverNet.d.ts.map +1 -0
- package/dist/host/serverNet.js +289 -0
- package/dist/host/serverNet.js.map +1 -0
- package/dist/host/serverObjects.d.ts +142 -0
- package/dist/host/serverObjects.d.ts.map +1 -0
- package/dist/host/serverObjects.js +326 -0
- package/dist/host/serverObjects.js.map +1 -0
- package/dist/host/serverProperties.d.ts +48 -0
- package/dist/host/serverProperties.d.ts.map +1 -0
- package/dist/host/serverProperties.js +193 -0
- package/dist/host/serverProperties.js.map +1 -0
- package/dist/host/serverScoreboard.d.ts +9 -0
- package/dist/host/serverScoreboard.d.ts.map +1 -0
- package/dist/host/serverScoreboard.js +198 -0
- package/dist/host/serverScoreboard.js.map +1 -0
- package/dist/host/serverStructures.d.ts +9 -0
- package/dist/host/serverStructures.d.ts.map +1 -0
- package/dist/host/serverStructures.js +243 -0
- package/dist/host/serverStructures.js.map +1 -0
- package/dist/host/tasks.d.ts +66 -0
- package/dist/host/tasks.d.ts.map +1 -0
- package/dist/host/tasks.js +107 -0
- package/dist/host/tasks.js.map +1 -0
- package/dist/host/world.d.ts +1359 -0
- package/dist/host/world.d.ts.map +1 -0
- package/dist/host/world.js +10 -0
- package/dist/host/world.js.map +1 -0
- package/dist/host/worldsystem/gameRules.d.ts +189 -0
- package/dist/host/worldsystem/gameRules.d.ts.map +1 -0
- package/dist/host/worldsystem/gameRules.js +86 -0
- package/dist/host/worldsystem/gameRules.js.map +1 -0
- package/dist/host/worldsystem/memoryWorldSystem.d.ts +18 -0
- package/dist/host/worldsystem/memoryWorldSystem.d.ts.map +1 -0
- package/dist/host/worldsystem/memoryWorldSystem.js +223 -0
- package/dist/host/worldsystem/memoryWorldSystem.js.map +1 -0
- package/dist/host/worldsystem/seam.d.ts +163 -0
- package/dist/host/worldsystem/seam.d.ts.map +1 -0
- package/dist/host/worldsystem/seam.js +0 -0
- package/dist/host/worldsystem/serverClocks.d.ts +18 -0
- package/dist/host/worldsystem/serverClocks.d.ts.map +1 -0
- package/dist/host/worldsystem/serverClocks.js +166 -0
- package/dist/host/worldsystem/serverClocks.js.map +1 -0
- package/dist/host/worldsystem/serverDimension.d.ts +10 -0
- package/dist/host/worldsystem/serverDimension.d.ts.map +1 -0
- package/dist/host/worldsystem/serverDimension.js +388 -0
- package/dist/host/worldsystem/serverDimension.js.map +1 -0
- package/dist/host/worldsystem/serverFog.d.ts +15 -0
- package/dist/host/worldsystem/serverFog.d.ts.map +1 -0
- package/dist/host/worldsystem/serverFog.js +66 -0
- package/dist/host/worldsystem/serverFog.js.map +1 -0
- package/dist/host/worldsystem/serverLoot.d.ts +9 -0
- package/dist/host/worldsystem/serverLoot.d.ts.map +1 -0
- package/dist/host/worldsystem/serverLoot.js +255 -0
- package/dist/host/worldsystem/serverLoot.js.map +1 -0
- package/dist/host/worldsystem/serverPrimitiveShapes.d.ts +9 -0
- package/dist/host/worldsystem/serverPrimitiveShapes.d.ts.map +1 -0
- package/dist/host/worldsystem/serverPrimitiveShapes.js +149 -0
- package/dist/host/worldsystem/serverPrimitiveShapes.js.map +1 -0
- package/dist/host/worldsystem/serverTickingAreas.d.ts +11 -0
- package/dist/host/worldsystem/serverTickingAreas.d.ts.map +1 -0
- package/dist/host/worldsystem/serverTickingAreas.js +176 -0
- package/dist/host/worldsystem/serverTickingAreas.js.map +1 -0
- package/dist/host/worldsystem/serverVolumes.d.ts +9 -0
- package/dist/host/worldsystem/serverVolumes.d.ts.map +1 -0
- package/dist/host/worldsystem/serverVolumes.js +248 -0
- package/dist/host/worldsystem/serverVolumes.js.map +1 -0
- package/dist/host/worldsystem/serverWorld.d.ts +18 -0
- package/dist/host/worldsystem/serverWorld.d.ts.map +1 -0
- package/dist/host/worldsystem/serverWorld.js +199 -0
- package/dist/host/worldsystem/serverWorld.js.map +1 -0
- package/dist/host/worldsystem/tags.d.ts +40 -0
- package/dist/host/worldsystem/tags.d.ts.map +1 -0
- package/dist/host/worldsystem/tags.js +43 -0
- package/dist/host/worldsystem/tags.js.map +1 -0
- package/dist/install.d.ts +39 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +83 -0
- package/dist/install.js.map +1 -0
- package/dist/isRecord.d.ts +3 -0
- package/dist/isRecord.d.ts.map +1 -0
- package/dist/isRecord.js +6 -0
- package/dist/isRecord.js.map +1 -0
- package/dist/library.d.ts +40 -0
- package/dist/library.d.ts.map +1 -0
- package/dist/library.js +101 -0
- package/dist/library.js.map +1 -0
- package/dist/manifest.d.ts +37 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +40 -0
- package/dist/manifest.js.map +1 -0
- package/dist/native/manifest.json.js +45 -0
- package/dist/native/manifest.json.js.map +1 -0
- package/dist/nativeHash.d.ts +16 -0
- package/dist/nativeHash.d.ts.map +1 -0
- package/dist/nativeHash.js +52 -0
- package/dist/nativeHash.js.map +1 -0
- package/dist/platform.d.ts +50 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +77 -0
- package/dist/platform.js.map +1 -0
- package/dist/shape/binding.d.ts +112 -0
- package/dist/shape/binding.d.ts.map +1 -0
- package/dist/shape/binding.js +558 -0
- package/dist/shape/binding.js.map +1 -0
- package/dist/shape/engineRuntime.d.ts +55 -0
- package/dist/shape/engineRuntime.d.ts.map +1 -0
- package/dist/shape/engineRuntime.js +451 -0
- package/dist/shape/engineRuntime.js.map +1 -0
- package/dist/shape/format.d.ts +249 -0
- package/dist/shape/format.d.ts.map +1 -0
- package/dist/shape/format.js +43 -0
- package/dist/shape/format.js.map +1 -0
- package/dist/shape/history.d.ts +24 -0
- package/dist/shape/history.d.ts.map +1 -0
- package/dist/shape/history.js +65 -0
- package/dist/shape/history.js.map +1 -0
- package/dist/shape/implementations.d.ts +105 -0
- package/dist/shape/implementations.d.ts.map +1 -0
- package/dist/shape/implementations.js +62 -0
- package/dist/shape/implementations.js.map +1 -0
- package/dist/shape/plan.d.ts +138 -0
- package/dist/shape/plan.d.ts.map +1 -0
- package/dist/shape/plan.js +0 -0
- package/dist/shape/resolve.d.ts +56 -0
- package/dist/shape/resolve.d.ts.map +1 -0
- package/dist/shape/resolve.js +78 -0
- package/dist/shape/resolve.js.map +1 -0
- package/dist/shape/version.d.ts +15 -0
- package/dist/shape/version.d.ts.map +1 -0
- package/dist/shape/version.js +35 -0
- package/dist/shape/version.js.map +1 -0
- package/dist/testing/debuggerWorker.d.ts +15 -0
- package/dist/testing/debuggerWorker.d.ts.map +1 -0
- package/dist/testing/debuggerWorker.js +29 -0
- package/dist/testing/debuggerWorker.js.map +1 -0
- package/dist/testing/engineWorker.d.ts +7 -0
- package/dist/testing/engineWorker.d.ts.map +1 -0
- package/dist/testing/engineWorker.js +31 -0
- package/dist/testing/engineWorker.js.map +1 -0
- package/dist/values.d.ts +94 -0
- package/dist/values.d.ts.map +1 -0
- package/dist/values.js +204 -0
- package/dist/values.js.map +1 -0
- package/native/manifest.json +49 -0
- package/package.json +177 -6
- package/scripts/postinstall.mjs +54 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import "../ScriptEngine.js";
|
|
2
|
+
import { ScriptHandle } from "../values.js";
|
|
3
|
+
import { ScriptProfiler, profilerClock } from "./profiler.js";
|
|
4
|
+
import { DIAGNOSTICS_TABS, LogLevel, parseExtensionMessage, requestedBreakpointLines } from "./protocol.js";
|
|
5
|
+
import { ScriptError, ScriptHostErrors } from "@jsprismarine/errors/script-host";
|
|
6
|
+
// src/debugger/DebugSession.ts
|
|
7
|
+
/**
|
|
8
|
+
* One debugger connection, from the handshake to the detach, run on the engine's thread. It
|
|
9
|
+
* answers the VS Code extension's requests from an {@link EngineDebugger}, and blocks the thread
|
|
10
|
+
* while a script is stopped. The bytes travel elsewhere: a {@link DebuggerChannel} hands this
|
|
11
|
+
* session whole messages.
|
|
12
|
+
*/
|
|
13
|
+
/** The thread id a session reports when none is given. */
|
|
14
|
+
var DEFAULT_THREAD_ID = 1;
|
|
15
|
+
/** The largest array index, 2^32 - 2, one less than the longest array length. */
|
|
16
|
+
var MAX_ARRAY_INDEX = 2 ** 32 - 2;
|
|
17
|
+
/** Whether a property name is an array index: a canonical integer from 0 to {@link MAX_ARRAY_INDEX}. */
|
|
18
|
+
var isArrayIndex = (name) => /^(?:0|[1-9]\d*)$/.test(name) && Number(name) <= MAX_ARRAY_INDEX;
|
|
19
|
+
var scopeNames = {
|
|
20
|
+
local: "Local",
|
|
21
|
+
closure: "Closure",
|
|
22
|
+
global: "Global"
|
|
23
|
+
};
|
|
24
|
+
var resumeCommands = {
|
|
25
|
+
continue: "continue",
|
|
26
|
+
next: "stepOver",
|
|
27
|
+
stepIn: "stepIn",
|
|
28
|
+
stepOut: "stepOut"
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* One debugger connection over a {@link DebuggerChannel}. The world host runs {@link handshake},
|
|
32
|
+
* then {@link attach} with the engine and context of the pack the extension picked, then calls {@link poll}
|
|
33
|
+
* between ticks until the connection closes or {@link detach} ends it. Every method blocks the
|
|
34
|
+
* calling thread for as long as the extension keeps a script stopped, which is how a stopped
|
|
35
|
+
* script stops its world's tick.
|
|
36
|
+
*/
|
|
37
|
+
var ScriptDebugSession = class {
|
|
38
|
+
channel;
|
|
39
|
+
options;
|
|
40
|
+
threadId;
|
|
41
|
+
engine;
|
|
42
|
+
debug;
|
|
43
|
+
closedValue = false;
|
|
44
|
+
offered = false;
|
|
45
|
+
/** Set once the handshake has passed; only such a session ends with `terminated`. */
|
|
46
|
+
accepted = false;
|
|
47
|
+
/** The reason the script is stopped for, while it is. */
|
|
48
|
+
stopped;
|
|
49
|
+
/** Set while a script runs and polls, when no request may run script. */
|
|
50
|
+
running = false;
|
|
51
|
+
resumeMode;
|
|
52
|
+
terminateRequested = false;
|
|
53
|
+
references = /* @__PURE__ */ new Map();
|
|
54
|
+
nextReference = 1;
|
|
55
|
+
/** Set once the extension's configuration has ended with `resume`; a later attach does not wait for it. */
|
|
56
|
+
configured = false;
|
|
57
|
+
/** The breakpoints the extension set, by engine file, which an attach to a new engine sets again. */
|
|
58
|
+
breakpoints = /* @__PURE__ */ new Map();
|
|
59
|
+
stopOnException = false;
|
|
60
|
+
/** The profile `startProfiler` began, until `stopProfiler`. */
|
|
61
|
+
profiler;
|
|
62
|
+
constructor(channel, options) {
|
|
63
|
+
this.channel = channel;
|
|
64
|
+
this.options = options;
|
|
65
|
+
this.threadId = options.threadId ?? 1;
|
|
66
|
+
}
|
|
67
|
+
/** Whether the connection has closed or the session has detached. */
|
|
68
|
+
get closed() {
|
|
69
|
+
return this.closedValue;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sends the protocol event, with the plugins and whether a passcode is needed, without waiting
|
|
73
|
+
* for the answer. A host that must not block until the extension answers offers first and
|
|
74
|
+
* calls {@link handshake} once a message has arrived. Only the first call sends anything.
|
|
75
|
+
*/
|
|
76
|
+
offer() {
|
|
77
|
+
if (this.offered) return;
|
|
78
|
+
this.offered = true;
|
|
79
|
+
this.event({
|
|
80
|
+
type: "ProtocolEvent",
|
|
81
|
+
version: 11,
|
|
82
|
+
plugins: this.options.plugins,
|
|
83
|
+
...(this.options.passcode ?? "") === "" ? {} : { require_passcode: true }
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Offers the protocol and the plugins, unless {@link offer} already did, and checks the
|
|
88
|
+
* extension's answer as Bedrock Dedicated Server does: the same version, the passcode when one
|
|
89
|
+
* is set, and a target among the plugins.
|
|
90
|
+
* @returns The script module UUID the extension picked, lowercase, or undefined when it picked none.
|
|
91
|
+
* @throws {DebuggerConnectionError} With Bedrock Dedicated Server's message when the answer is refused or never comes.
|
|
92
|
+
*/
|
|
93
|
+
handshake() {
|
|
94
|
+
const passcode = this.options.passcode ?? "";
|
|
95
|
+
this.offer();
|
|
96
|
+
for (;;) {
|
|
97
|
+
const message = this.next(this.channel.receive());
|
|
98
|
+
if (message === void 0) {
|
|
99
|
+
this.close();
|
|
100
|
+
throw new ScriptHostErrors.DebuggerClosedConnection();
|
|
101
|
+
}
|
|
102
|
+
if (message.type !== "protocol") continue;
|
|
103
|
+
if (message.version !== 11) throw new ScriptHostErrors.DebuggerProtocolVersionMismatch();
|
|
104
|
+
if (passcode !== "" && message.passcode !== passcode) throw new ScriptHostErrors.DebuggerPasscodeMismatch();
|
|
105
|
+
const target = message.targetModuleUuid?.toLowerCase();
|
|
106
|
+
if (target !== void 0 && !this.options.plugins.some((plugin) => plugin.module_uuid.toLowerCase() === target)) throw new ScriptHostErrors.DebuggerPluginNotFound({ uuid: message.targetModuleUuid ?? "" });
|
|
107
|
+
this.accepted = true;
|
|
108
|
+
this.event({
|
|
109
|
+
type: "SchemaEvent",
|
|
110
|
+
descriptors: this.options.diagnosticsTabs ?? DIAGNOSTICS_TABS
|
|
111
|
+
});
|
|
112
|
+
return target;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Attaches to the picked pack's context, and handles the extension's configuration, its
|
|
117
|
+
* breakpoints and exception setting, until it sends `resume`. The engine runs no script until
|
|
118
|
+
* then. Only that context's scripts stop: another pack's file of the same name never does.
|
|
119
|
+
*
|
|
120
|
+
* After {@link detachEngine}, an attach to the new engine sets the breakpoints and the
|
|
121
|
+
* exception setting the extension sent before, and returns at once: the extension configures
|
|
122
|
+
* a session only once.
|
|
123
|
+
* @param engine - The engine the pack runs in.
|
|
124
|
+
* @param context - The pack's context in the engine.
|
|
125
|
+
*/
|
|
126
|
+
attach(engine, context = 0) {
|
|
127
|
+
if (this.engine !== void 0) throw new ScriptHostErrors.DebugSessionAlreadyAttached();
|
|
128
|
+
if (this.closedValue) return;
|
|
129
|
+
this.engine = engine;
|
|
130
|
+
const debug = engine.attachDebugger({
|
|
131
|
+
paused: (reason) => this.paused(reason),
|
|
132
|
+
poll: () => this.pollRunning()
|
|
133
|
+
}, {
|
|
134
|
+
context,
|
|
135
|
+
pollLines: this.options.pollLines
|
|
136
|
+
});
|
|
137
|
+
this.debug = debug;
|
|
138
|
+
for (const [file, lines] of this.breakpoints) debug.setBreakpoints(file, lines);
|
|
139
|
+
if (this.stopOnException) debug.setStopOnException(true);
|
|
140
|
+
this.event({
|
|
141
|
+
type: "ThreadEvent",
|
|
142
|
+
reason: "new",
|
|
143
|
+
thread: this.threadId
|
|
144
|
+
});
|
|
145
|
+
if (this.configured) return;
|
|
146
|
+
for (;;) {
|
|
147
|
+
const message = this.next(this.channel.receive());
|
|
148
|
+
if (message === void 0) {
|
|
149
|
+
this.close();
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (message.type === "resume") {
|
|
153
|
+
this.configured = true;
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.handle(message);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Detaches from the engine and tells the extension the scripts' thread has exited, while the
|
|
161
|
+
* session stays open, as BDS does around `/reload`. {@link attach} with the new engine starts
|
|
162
|
+
* the thread again.
|
|
163
|
+
*/
|
|
164
|
+
detachEngine() {
|
|
165
|
+
if (this.closedValue || this.debug === void 0) return;
|
|
166
|
+
this.event({
|
|
167
|
+
type: "ThreadEvent",
|
|
168
|
+
reason: "exited",
|
|
169
|
+
thread: this.threadId
|
|
170
|
+
});
|
|
171
|
+
this.releaseReferences();
|
|
172
|
+
if (this.debug.isAttached) this.debug.detach();
|
|
173
|
+
this.debug = void 0;
|
|
174
|
+
this.engine = void 0;
|
|
175
|
+
}
|
|
176
|
+
/** Whether the session is attached to an engine. */
|
|
177
|
+
get attached() {
|
|
178
|
+
return this.debug !== void 0;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Sends one tick's statistics, as BDS streams a `StatEvent2` each tick to an attached
|
|
182
|
+
* extension. Nothing is sent while no engine is attached.
|
|
183
|
+
*/
|
|
184
|
+
stats(tick, stats) {
|
|
185
|
+
if (!this.closedValue && this.debug !== void 0) this.event({
|
|
186
|
+
type: "StatEvent2",
|
|
187
|
+
tick,
|
|
188
|
+
stats
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Handles what the extension has sent while no script ran, without waiting. A pause request
|
|
193
|
+
* stops the next script the engine runs at its first line. Once the connection has closed and
|
|
194
|
+
* its last messages are handled, the session closes and detaches.
|
|
195
|
+
*/
|
|
196
|
+
poll() {
|
|
197
|
+
if (this.closedValue) return;
|
|
198
|
+
const disconnected = this.channel.closed;
|
|
199
|
+
for (let message = this.next(this.channel.poll()); message !== void 0; message = this.next(this.channel.poll())) this.handle(message);
|
|
200
|
+
if (disconnected) this.close();
|
|
201
|
+
}
|
|
202
|
+
/** Shows script output in the extension's debug console. */
|
|
203
|
+
print(message, logLevel = LogLevel.log) {
|
|
204
|
+
if (!this.closedValue) this.event({
|
|
205
|
+
type: "PrintEvent",
|
|
206
|
+
message,
|
|
207
|
+
logLevel
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Ends the session and detaches from the engine. A session whose handshake passed tells the
|
|
212
|
+
* extension it has terminated, as BDS does just before it closes the connection; after a
|
|
213
|
+
* refused handshake BDS sends its error line and closes.
|
|
214
|
+
*/
|
|
215
|
+
detach() {
|
|
216
|
+
if (this.closedValue) return;
|
|
217
|
+
if (this.accepted) this.event({ type: "terminated" });
|
|
218
|
+
this.close();
|
|
219
|
+
}
|
|
220
|
+
/** Ends the session after the connection closed or the session detached. */
|
|
221
|
+
close() {
|
|
222
|
+
this.closedValue = true;
|
|
223
|
+
this.profiler = void 0;
|
|
224
|
+
this.releaseReferences();
|
|
225
|
+
if (this.debug?.isAttached === true) this.debug.detach();
|
|
226
|
+
this.debug = void 0;
|
|
227
|
+
}
|
|
228
|
+
/** Parses a received message; marks the session closed when there is none because the connection closed. */
|
|
229
|
+
next(message) {
|
|
230
|
+
if (message === void 0) return void 0;
|
|
231
|
+
try {
|
|
232
|
+
return parseExtensionMessage(message);
|
|
233
|
+
} catch {
|
|
234
|
+
return {
|
|
235
|
+
type: "other",
|
|
236
|
+
name: ""
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/** The engine's stop: tells the extension, then answers it until it resumes or goes away. */
|
|
241
|
+
paused(reason) {
|
|
242
|
+
this.stopped = reason;
|
|
243
|
+
this.resumeMode = void 0;
|
|
244
|
+
this.terminateRequested = false;
|
|
245
|
+
this.event({
|
|
246
|
+
type: "StoppedEvent",
|
|
247
|
+
reason,
|
|
248
|
+
thread: this.threadId
|
|
249
|
+
});
|
|
250
|
+
while (this.resumeMode === void 0 && !this.closedValue) {
|
|
251
|
+
const received = this.channel.receive();
|
|
252
|
+
if (received === void 0) {
|
|
253
|
+
this.close();
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
const message = this.next(received);
|
|
257
|
+
if (message !== void 0) this.handle(message);
|
|
258
|
+
}
|
|
259
|
+
this.releaseReferences();
|
|
260
|
+
this.stopped = void 0;
|
|
261
|
+
if (this.debug?.isAttached === true) this.debug.resume(this.resumeMode ?? "continue");
|
|
262
|
+
return this.terminateRequested ? "terminate" : "resume";
|
|
263
|
+
}
|
|
264
|
+
/** The engine's poll while a script runs: handles what has arrived without running script. */
|
|
265
|
+
pollRunning() {
|
|
266
|
+
if (this.profiler !== void 0 && this.debug !== void 0) this.profiler.sample(this.debug.frames());
|
|
267
|
+
this.running = true;
|
|
268
|
+
try {
|
|
269
|
+
this.poll();
|
|
270
|
+
} finally {
|
|
271
|
+
this.running = false;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
handle(message) {
|
|
275
|
+
switch (message.type) {
|
|
276
|
+
case "request":
|
|
277
|
+
this.request(message.request);
|
|
278
|
+
return;
|
|
279
|
+
case "breakpoints":
|
|
280
|
+
this.setBreakpoints(message.path, message.lines);
|
|
281
|
+
return;
|
|
282
|
+
case "stopOnException":
|
|
283
|
+
this.stopOnException = message.stop;
|
|
284
|
+
this.debug?.setStopOnException(message.stop);
|
|
285
|
+
return;
|
|
286
|
+
case "resume":
|
|
287
|
+
if (this.stopped !== void 0) this.resumeMode = "continue";
|
|
288
|
+
return;
|
|
289
|
+
case "minecraftCommand":
|
|
290
|
+
this.options.runCommand?.(message.command, message.dimension);
|
|
291
|
+
return;
|
|
292
|
+
case "startProfiler":
|
|
293
|
+
this.profiler = new ScriptProfiler(this.options.profilerClock ?? profilerClock, this.options.toDebuggerPath);
|
|
294
|
+
return;
|
|
295
|
+
case "stopProfiler": {
|
|
296
|
+
const profile = this.profiler?.finish();
|
|
297
|
+
this.profiler = void 0;
|
|
298
|
+
if (profile === void 0) return;
|
|
299
|
+
this.event({
|
|
300
|
+
type: "ProfilerCapture",
|
|
301
|
+
capture_base_path: message.capturesPath,
|
|
302
|
+
capture_data: Buffer.from(JSON.stringify(profile)).toString("base64")
|
|
303
|
+
});
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
case "debugger-request":
|
|
307
|
+
this.channel.send({
|
|
308
|
+
type: "debuggee-response",
|
|
309
|
+
event: {
|
|
310
|
+
type: "debuggee-response",
|
|
311
|
+
request_seq: message.request_seq,
|
|
312
|
+
success: false,
|
|
313
|
+
response_message: `JSPrismarine does not support the debugger request '${message.request}'.`
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
return;
|
|
317
|
+
default: return;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
request(request) {
|
|
321
|
+
try {
|
|
322
|
+
const mode = resumeCommands[request.command];
|
|
323
|
+
if (mode !== void 0) {
|
|
324
|
+
this.requireStopped();
|
|
325
|
+
this.resumeMode = mode;
|
|
326
|
+
this.respond(request, void 0);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
switch (request.command) {
|
|
330
|
+
case "setBreakpoints": {
|
|
331
|
+
const path = typeof request.args.path === "string" ? request.args.path : "";
|
|
332
|
+
const lines = requestedBreakpointLines(request.args);
|
|
333
|
+
const verified = this.setBreakpoints(path, lines);
|
|
334
|
+
this.respond(request, { breakpoints: lines.map(() => ({ verified })) });
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
case "pause":
|
|
338
|
+
this.respond(request, void 0);
|
|
339
|
+
if (this.stopped !== void 0) this.event({
|
|
340
|
+
type: "StoppedEvent",
|
|
341
|
+
reason: "pause",
|
|
342
|
+
thread: this.threadId
|
|
343
|
+
});
|
|
344
|
+
else this.debug?.pause();
|
|
345
|
+
return;
|
|
346
|
+
case "stackTrace":
|
|
347
|
+
this.respond(request, this.stackTrace());
|
|
348
|
+
return;
|
|
349
|
+
case "scopes":
|
|
350
|
+
this.respond(request, this.scopes(request.args));
|
|
351
|
+
return;
|
|
352
|
+
case "variables":
|
|
353
|
+
this.respond(request, this.variables(request.args));
|
|
354
|
+
return;
|
|
355
|
+
case "evaluate":
|
|
356
|
+
this.respond(request, this.evaluate(request.args));
|
|
357
|
+
return;
|
|
358
|
+
default: throw new ScriptHostErrors.UnhandledDebuggerCommand({ command: request.command });
|
|
359
|
+
}
|
|
360
|
+
} catch (error) {
|
|
361
|
+
this.channel.send({
|
|
362
|
+
type: "response",
|
|
363
|
+
request_seq: request.request_seq,
|
|
364
|
+
error: error instanceof Error ? error.message : String(error)
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
setBreakpoints(path, lines) {
|
|
369
|
+
const file = this.options.fromDebuggerPath?.(path) ?? path;
|
|
370
|
+
if (lines.length === 0) this.breakpoints.delete(file);
|
|
371
|
+
else this.breakpoints.set(file, lines);
|
|
372
|
+
this.debug?.setBreakpoints(file, lines);
|
|
373
|
+
return this.options.knowsFile?.(file) ?? true;
|
|
374
|
+
}
|
|
375
|
+
requireStopped() {
|
|
376
|
+
if (this.stopped === void 0 || this.debug === void 0) throw new ScriptHostErrors.NoScriptStopped();
|
|
377
|
+
return this.debug;
|
|
378
|
+
}
|
|
379
|
+
/** The `stackTrace` body: koush's frame objects, innermost first, with their index as id. */
|
|
380
|
+
stackTrace() {
|
|
381
|
+
return this.requireStopped().frames().map((frame, id) => ({
|
|
382
|
+
id,
|
|
383
|
+
name: frame.name === "" ? "<anonymous>" : frame.name,
|
|
384
|
+
filename: frame.file === "" ? "" : this.options.toDebuggerPath?.(frame.file) ?? frame.file,
|
|
385
|
+
line: frame.line,
|
|
386
|
+
column: frame.column
|
|
387
|
+
}));
|
|
388
|
+
}
|
|
389
|
+
/** The `scopes` body, which the extension reads as `{ name, reference, expensive }` objects. */
|
|
390
|
+
scopes(args) {
|
|
391
|
+
this.requireStopped();
|
|
392
|
+
const frame = typeof args.frameId === "number" ? args.frameId : 0;
|
|
393
|
+
return [
|
|
394
|
+
"local",
|
|
395
|
+
"closure",
|
|
396
|
+
"global"
|
|
397
|
+
].map((scope) => ({
|
|
398
|
+
name: scopeNames[scope],
|
|
399
|
+
reference: this.reference({
|
|
400
|
+
kind: "scope",
|
|
401
|
+
frame,
|
|
402
|
+
scope
|
|
403
|
+
}),
|
|
404
|
+
expensive: scope === "global"
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* The `variables` body: one page of an object's or a scope's properties. A scope is a copy of
|
|
409
|
+
* the frame's variables, so each request reads a new one, which an evaluation may have changed.
|
|
410
|
+
*/
|
|
411
|
+
variables(args) {
|
|
412
|
+
const debug = this.requireStopped();
|
|
413
|
+
const id = typeof args.variablesReference === "number" ? args.variablesReference : 0;
|
|
414
|
+
const reference = this.references.get(id);
|
|
415
|
+
if (reference === void 0) throw new ScriptHostErrors.UnknownVariablesReference({ id });
|
|
416
|
+
if (reference.kind === "value") return this.page(debug, reference.handle, args);
|
|
417
|
+
const scope = debug.scope(reference.frame, reference.scope);
|
|
418
|
+
try {
|
|
419
|
+
const variables = this.page(debug, scope, args);
|
|
420
|
+
if (reference.scope === "local" && reference.frame === 0 && this.stopped === "exception") variables.unshift(this.variable("<exception>", debug.exception()));
|
|
421
|
+
return variables;
|
|
422
|
+
} finally {
|
|
423
|
+
this.engine?.free(scope);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* One page of a value's properties, as the `variables` arguments ask for it. The `indexed` and
|
|
428
|
+
* `named` filters each page within their own group: the array indices, or every other name.
|
|
429
|
+
* Without a filter, `start` and `count` page through every name.
|
|
430
|
+
*/
|
|
431
|
+
page(debug, handle, args) {
|
|
432
|
+
const start = typeof args.start === "number" && args.start > 0 ? args.start : 0;
|
|
433
|
+
const count = typeof args.count === "number" && args.count > 0 ? args.count : void 0;
|
|
434
|
+
let page;
|
|
435
|
+
if (args.filter === "indexed" || args.filter === "named") {
|
|
436
|
+
const indices = this.indexCount(debug, handle);
|
|
437
|
+
page = args.filter === "indexed" ? debug.properties(handle, start, Math.min(count ?? indices, Math.max(indices - start, 0))) : debug.properties(handle, indices + start, count);
|
|
438
|
+
} else page = debug.properties(handle, start, count);
|
|
439
|
+
return page.properties.map((property) => property.accessor ? {
|
|
440
|
+
name: property.name,
|
|
441
|
+
value: "(accessor)",
|
|
442
|
+
type: "accessor",
|
|
443
|
+
variablesReference: 0
|
|
444
|
+
} : this.variable(property.name, property.value));
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* How many of a value's own property names are array indices. QuickJS lists those first, in
|
|
448
|
+
* ascending order, so they are a prefix of the names, and a binary search finds where it ends
|
|
449
|
+
* by reading one name at a time.
|
|
450
|
+
*/
|
|
451
|
+
indexCount(debug, handle) {
|
|
452
|
+
let low = 0;
|
|
453
|
+
let high = debug.properties(handle, 0, 0).total;
|
|
454
|
+
while (low < high) {
|
|
455
|
+
const middle = Math.floor((low + high) / 2);
|
|
456
|
+
const [property] = debug.properties(handle, middle, 1).properties;
|
|
457
|
+
if (property?.value instanceof ScriptHandle) this.engine?.free(property.value);
|
|
458
|
+
if (property !== void 0 && isArrayIndex(property.name)) low = middle + 1;
|
|
459
|
+
else high = middle;
|
|
460
|
+
}
|
|
461
|
+
return low;
|
|
462
|
+
}
|
|
463
|
+
/** The `evaluate` body. A failed evaluation is a result too: the extension never answers an error here. */
|
|
464
|
+
evaluate(args) {
|
|
465
|
+
if (this.running || this.debug === void 0) throw new ScriptHostErrors.EvaluateWhileRunning();
|
|
466
|
+
const expression = typeof args.expression === "string" ? args.expression : "";
|
|
467
|
+
const frame = this.stopped !== void 0 && typeof args.frameId === "number" ? args.frameId : -1;
|
|
468
|
+
try {
|
|
469
|
+
const { value, type, variablesReference, indexedVariables } = this.variable("", this.debug.evaluate(frame, expression));
|
|
470
|
+
return {
|
|
471
|
+
result: value,
|
|
472
|
+
type,
|
|
473
|
+
variablesReference,
|
|
474
|
+
...indexedVariables === void 0 ? {} : { indexedVariables }
|
|
475
|
+
};
|
|
476
|
+
} catch (error) {
|
|
477
|
+
if (!(error instanceof ScriptError)) throw error;
|
|
478
|
+
return {
|
|
479
|
+
result: error.scriptName === "" ? error.scriptMessage : `${error.scriptName}: ${error.scriptMessage}`,
|
|
480
|
+
type: "error",
|
|
481
|
+
variablesReference: 0
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
/** Formats a value as VS Code shows it, giving an object a reference to expand it by. */
|
|
486
|
+
variable(name, value) {
|
|
487
|
+
if (value === void 0) return {
|
|
488
|
+
name,
|
|
489
|
+
value: "undefined",
|
|
490
|
+
type: "undefined",
|
|
491
|
+
variablesReference: 0
|
|
492
|
+
};
|
|
493
|
+
if (value === null) return {
|
|
494
|
+
name,
|
|
495
|
+
value: "null",
|
|
496
|
+
type: "null",
|
|
497
|
+
variablesReference: 0
|
|
498
|
+
};
|
|
499
|
+
if (typeof value === "boolean") return {
|
|
500
|
+
name,
|
|
501
|
+
value: String(value),
|
|
502
|
+
type: "boolean",
|
|
503
|
+
variablesReference: 0
|
|
504
|
+
};
|
|
505
|
+
if (typeof value === "number") return {
|
|
506
|
+
name,
|
|
507
|
+
value: Object.is(value, -0) ? "-0" : String(value),
|
|
508
|
+
type: "number",
|
|
509
|
+
variablesReference: 0
|
|
510
|
+
};
|
|
511
|
+
if (typeof value === "string") return {
|
|
512
|
+
name,
|
|
513
|
+
value: JSON.stringify(value),
|
|
514
|
+
type: "string",
|
|
515
|
+
variablesReference: 0
|
|
516
|
+
};
|
|
517
|
+
if (this.debug === void 0) throw new ScriptHostErrors.DebugSessionDetached();
|
|
518
|
+
const { kind, name: label, detail } = this.debug.describe(value);
|
|
519
|
+
if (kind === "symbol" || kind === "bigint") {
|
|
520
|
+
this.engine?.free(value);
|
|
521
|
+
return {
|
|
522
|
+
name,
|
|
523
|
+
value: kind === "bigint" ? `${label ?? ""}n` : label ?? "Symbol()",
|
|
524
|
+
type: kind,
|
|
525
|
+
variablesReference: 0
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
const reference = kind === "proxy" ? 0 : this.reference({
|
|
529
|
+
kind: "value",
|
|
530
|
+
handle: value
|
|
531
|
+
});
|
|
532
|
+
if (kind === "proxy") this.engine?.free(value);
|
|
533
|
+
switch (kind) {
|
|
534
|
+
case "array": return {
|
|
535
|
+
name,
|
|
536
|
+
value: `${label ?? "Array"}(${detail ?? 0})`,
|
|
537
|
+
type: label ?? "Array",
|
|
538
|
+
variablesReference: reference,
|
|
539
|
+
indexedVariables: typeof detail === "number" ? detail : 0
|
|
540
|
+
};
|
|
541
|
+
case "function": return {
|
|
542
|
+
name,
|
|
543
|
+
value: `function ${label ?? ""}`.trimEnd(),
|
|
544
|
+
type: "function",
|
|
545
|
+
variablesReference: reference
|
|
546
|
+
};
|
|
547
|
+
case "error": return {
|
|
548
|
+
name,
|
|
549
|
+
value: detail === void 0 || detail === "" ? label ?? "Error" : `${label ?? "Error"}: ${detail}`,
|
|
550
|
+
type: label ?? "Error",
|
|
551
|
+
variablesReference: reference
|
|
552
|
+
};
|
|
553
|
+
default: return {
|
|
554
|
+
name,
|
|
555
|
+
value: label ?? "Object",
|
|
556
|
+
type: label ?? "object",
|
|
557
|
+
variablesReference: reference
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
reference(reference) {
|
|
562
|
+
const id = this.nextReference++;
|
|
563
|
+
this.references.set(id, reference);
|
|
564
|
+
return id;
|
|
565
|
+
}
|
|
566
|
+
/** Frees every handle the stop handed out; references last only until the script goes on. */
|
|
567
|
+
releaseReferences() {
|
|
568
|
+
for (const reference of this.references.values()) if (reference.kind === "value") this.engine?.free(reference.handle);
|
|
569
|
+
this.references = /* @__PURE__ */ new Map();
|
|
570
|
+
this.nextReference = 1;
|
|
571
|
+
}
|
|
572
|
+
respond(request, body) {
|
|
573
|
+
this.channel.send({
|
|
574
|
+
type: "response",
|
|
575
|
+
request_seq: request.request_seq,
|
|
576
|
+
body
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
event(event) {
|
|
580
|
+
this.channel.send({
|
|
581
|
+
type: "event",
|
|
582
|
+
event
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
export { DEFAULT_THREAD_ID, ScriptDebugSession };
|
|
587
|
+
|
|
588
|
+
//# sourceMappingURL=DebugSession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DebugSession.js","names":[],"sources":["../../src/debugger/DebugSession.ts"],"sourcesContent":["/**\n * One debugger connection, from the handshake to the detach, run on the engine's thread. It\n * answers the VS Code extension's requests from an {@link EngineDebugger}, and blocks the thread\n * while a script is stopped. The bytes travel elsewhere: a {@link DebuggerChannel} hands this\n * session whole messages.\n */\n\nimport { ScriptError, ScriptHostErrors } from '@jsprismarine/errors/script-host';\n\nimport { DEFAULT_CONTEXT } from '../ScriptEngine';\nimport type { ScriptContextId, ScriptEngine } from '../ScriptEngine';\nimport { ScriptHandle } from '../values';\nimport type { ScriptValue } from '../values';\nimport type { EngineDebugger, PauseOutcome, PauseReason, PropertyPage, ResumeMode, ScopeKind } from './EngineDebugger';\nimport { ScriptProfiler, profilerClock } from './profiler';\nimport {\n DEBUGGER_PROTOCOL_VERSION,\n DIAGNOSTICS_TABS,\n LogLevel,\n parseExtensionMessage,\n requestedBreakpointLines\n} from './protocol';\nimport type {\n DebuggerEvent,\n DebuggerPlugin,\n DebuggerStat,\n DiagnosticsTab,\n ExtensionMessage,\n ForwardedRequest,\n HostMessage\n} from './protocol';\n\n/**\n * Carries whole messages between a session and the extension. A session calls it only on the\n * engine's thread.\n */\nexport interface DebuggerChannel {\n /** Sends one message to the extension. */\n send(message: HostMessage): void;\n /** Returns the next message, waiting as long as it takes; undefined once the connection has closed. */\n receive(): unknown;\n /** Returns the next message if one has arrived, without waiting; undefined otherwise. */\n poll(): unknown;\n /**\n * Whether the connection has closed. `receive` and `poll` still return the messages that\n * arrived before it closed.\n */\n readonly closed: boolean;\n}\n\n/** How a {@link ScriptDebugSession} presents the world's scripts to the extension. */\nexport interface DebugSessionOptions {\n /** The script packs the extension may pick, by the UUID of each pack's script module. */\n readonly plugins: readonly DebuggerPlugin[];\n /** The `script-debugger-passcode` the extension must send. None when absent or empty. */\n readonly passcode?: string;\n /** The thread id the extension shows for the scripts. */\n readonly threadId?: number;\n /** Turns an engine file name into the path the extension knows it by. The same name when absent. */\n readonly toDebuggerPath?: (file: string) => string;\n /** Turns a path from the extension into the engine's file name. The same path when absent. */\n readonly fromDebuggerPath?: (path: string) => string;\n /** Whether the engine knows a file, so a breakpoint in it is verified. Every file when absent. */\n readonly knowsFile?: (file: string) => boolean;\n /**\n * Runs a command the extension's command box sent, in the named dimension. It is called while\n * the session handles a message, which can be inside a stopped or running script, so a host\n * whose commands reach the scripts queues it for later.\n */\n readonly runCommand?: (command: string, dimension: string) => void;\n /**\n * The lines a running script runs between polls, {@link DebuggerOptions.pollLines}. The\n * profiler samples the stack at each poll.\n */\n readonly pollLines?: number;\n /** The tabs the `SchemaEvent` after the handshake describes; BDS's {@link DIAGNOSTICS_TABS} when absent. */\n readonly diagnosticsTabs?: readonly DiagnosticsTab[];\n /** The time in microseconds, which labels the profiler's samples; the system clock when absent. */\n readonly profilerClock?: () => number;\n}\n\n/** The thread id a session reports when none is given. */\nexport const DEFAULT_THREAD_ID = 1;\n\n/** What a `variablesReference` names during one stop. */\ntype Reference =\n | { readonly kind: 'scope'; readonly frame: number; readonly scope: ScopeKind }\n | { readonly kind: 'value'; readonly handle: ScriptHandle };\n\n/** A variable as the extension's `variables` and `evaluate` bodies carry it (koush's `js_debugger_get_variable`). */\ninterface VariableBody {\n readonly name: string;\n readonly value: string;\n readonly type: string;\n readonly variablesReference: number;\n readonly indexedVariables?: number;\n}\n\n/** The largest array index, 2^32 - 2, one less than the longest array length. */\nconst MAX_ARRAY_INDEX = 2 ** 32 - 2;\n\n/** Whether a property name is an array index: a canonical integer from 0 to {@link MAX_ARRAY_INDEX}. */\nconst isArrayIndex = (name: string): boolean => /^(?:0|[1-9]\\d*)$/.test(name) && Number(name) <= MAX_ARRAY_INDEX;\n\nconst scopeNames: Readonly<Record<ScopeKind, string>> = { local: 'Local', closure: 'Closure', global: 'Global' };\n\nconst resumeCommands: Readonly<Record<string, ResumeMode>> = {\n continue: 'continue',\n next: 'stepOver',\n stepIn: 'stepIn',\n stepOut: 'stepOut'\n};\n\n/**\n * One debugger connection over a {@link DebuggerChannel}. The world host runs {@link handshake},\n * then {@link attach} with the engine and context of the pack the extension picked, then calls {@link poll}\n * between ticks until the connection closes or {@link detach} ends it. Every method blocks the\n * calling thread for as long as the extension keeps a script stopped, which is how a stopped\n * script stops its world's tick.\n */\nexport class ScriptDebugSession {\n private readonly channel: DebuggerChannel;\n private readonly options: DebugSessionOptions;\n private readonly threadId: number;\n private engine: ScriptEngine | undefined;\n private debug: EngineDebugger | undefined;\n private closedValue = false;\n private offered = false;\n /** Set once the handshake has passed; only such a session ends with `terminated`. */\n private accepted = false;\n /** The reason the script is stopped for, while it is. */\n private stopped: PauseReason | undefined;\n /** Set while a script runs and polls, when no request may run script. */\n private running = false;\n private resumeMode: ResumeMode | undefined;\n private terminateRequested = false;\n private references = new Map<number, Reference>();\n private nextReference = 1;\n /** Set once the extension's configuration has ended with `resume`; a later attach does not wait for it. */\n private configured = false;\n /** The breakpoints the extension set, by engine file, which an attach to a new engine sets again. */\n private readonly breakpoints = new Map<string, readonly number[]>();\n private stopOnException = false;\n /** The profile `startProfiler` began, until `stopProfiler`. */\n private profiler: ScriptProfiler | undefined;\n\n public constructor(channel: DebuggerChannel, options: DebugSessionOptions) {\n this.channel = channel;\n this.options = options;\n this.threadId = options.threadId ?? DEFAULT_THREAD_ID;\n }\n\n /** Whether the connection has closed or the session has detached. */\n public get closed(): boolean {\n return this.closedValue;\n }\n\n /**\n * Sends the protocol event, with the plugins and whether a passcode is needed, without waiting\n * for the answer. A host that must not block until the extension answers offers first and\n * calls {@link handshake} once a message has arrived. Only the first call sends anything.\n */\n public offer(): void {\n if (this.offered) return;\n this.offered = true;\n this.event({\n type: 'ProtocolEvent',\n version: DEBUGGER_PROTOCOL_VERSION,\n plugins: this.options.plugins,\n ...((this.options.passcode ?? '') === '' ? {} : { require_passcode: true })\n });\n }\n\n /**\n * Offers the protocol and the plugins, unless {@link offer} already did, and checks the\n * extension's answer as Bedrock Dedicated Server does: the same version, the passcode when one\n * is set, and a target among the plugins.\n * @returns The script module UUID the extension picked, lowercase, or undefined when it picked none.\n * @throws {DebuggerConnectionError} With Bedrock Dedicated Server's message when the answer is refused or never comes.\n */\n public handshake(): string | undefined {\n const passcode = this.options.passcode ?? '';\n this.offer();\n for (;;) {\n const message = this.next(this.channel.receive());\n if (message === undefined) {\n this.close();\n throw new ScriptHostErrors.DebuggerClosedConnection();\n }\n if (message.type !== 'protocol') continue;\n if (message.version !== DEBUGGER_PROTOCOL_VERSION) {\n throw new ScriptHostErrors.DebuggerProtocolVersionMismatch();\n }\n if (passcode !== '' && message.passcode !== passcode) {\n throw new ScriptHostErrors.DebuggerPasscodeMismatch();\n }\n const target = message.targetModuleUuid?.toLowerCase();\n if (\n target !== undefined &&\n !this.options.plugins.some((plugin) => plugin.module_uuid.toLowerCase() === target)\n ) {\n throw new ScriptHostErrors.DebuggerPluginNotFound({ uuid: message.targetModuleUuid ?? '' });\n }\n // BDS describes its diagnostics tabs once the handshake has passed, before the attach.\n this.accepted = true;\n this.event({ type: 'SchemaEvent', descriptors: this.options.diagnosticsTabs ?? DIAGNOSTICS_TABS });\n return target;\n }\n }\n\n /**\n * Attaches to the picked pack's context, and handles the extension's configuration, its\n * breakpoints and exception setting, until it sends `resume`. The engine runs no script until\n * then. Only that context's scripts stop: another pack's file of the same name never does.\n *\n * After {@link detachEngine}, an attach to the new engine sets the breakpoints and the\n * exception setting the extension sent before, and returns at once: the extension configures\n * a session only once.\n * @param engine - The engine the pack runs in.\n * @param context - The pack's context in the engine.\n */\n public attach(engine: ScriptEngine, context: ScriptContextId = DEFAULT_CONTEXT): void {\n if (this.engine !== undefined) throw new ScriptHostErrors.DebugSessionAlreadyAttached();\n if (this.closedValue) return;\n this.engine = engine;\n const debug = engine.attachDebugger(\n { paused: (reason) => this.paused(reason), poll: () => this.pollRunning() },\n { context, pollLines: this.options.pollLines }\n );\n this.debug = debug;\n for (const [file, lines] of this.breakpoints) debug.setBreakpoints(file, lines);\n if (this.stopOnException) debug.setStopOnException(true);\n this.event({ type: 'ThreadEvent', reason: 'new', thread: this.threadId });\n if (this.configured) return;\n for (;;) {\n const message = this.next(this.channel.receive());\n if (message === undefined) {\n this.close();\n return;\n }\n if (message.type === 'resume') {\n this.configured = true;\n return;\n }\n this.handle(message);\n }\n }\n\n /**\n * Detaches from the engine and tells the extension the scripts' thread has exited, while the\n * session stays open, as BDS does around `/reload`. {@link attach} with the new engine starts\n * the thread again.\n */\n public detachEngine(): void {\n if (this.closedValue || this.debug === undefined) return;\n this.event({ type: 'ThreadEvent', reason: 'exited', thread: this.threadId });\n this.releaseReferences();\n if (this.debug.isAttached) this.debug.detach();\n this.debug = undefined;\n this.engine = undefined;\n }\n\n /** Whether the session is attached to an engine. */\n public get attached(): boolean {\n return this.debug !== undefined;\n }\n\n /**\n * Sends one tick's statistics, as BDS streams a `StatEvent2` each tick to an attached\n * extension. Nothing is sent while no engine is attached.\n */\n public stats(tick: number, stats: readonly DebuggerStat[]): void {\n if (!this.closedValue && this.debug !== undefined) this.event({ type: 'StatEvent2', tick, stats });\n }\n\n /**\n * Handles what the extension has sent while no script ran, without waiting. A pause request\n * stops the next script the engine runs at its first line. Once the connection has closed and\n * its last messages are handled, the session closes and detaches.\n */\n public poll(): void {\n if (this.closedValue) return;\n // Read before draining: when the connection closes mid-drain, the next poll reads what came first.\n const disconnected = this.channel.closed;\n for (\n let message = this.next(this.channel.poll());\n message !== undefined;\n message = this.next(this.channel.poll())\n ) {\n this.handle(message);\n }\n if (disconnected) this.close();\n }\n\n /** Shows script output in the extension's debug console. */\n public print(message: string, logLevel: number = LogLevel.log): void {\n if (!this.closedValue) this.event({ type: 'PrintEvent', message, logLevel });\n }\n\n /**\n * Ends the session and detaches from the engine. A session whose handshake passed tells the\n * extension it has terminated, as BDS does just before it closes the connection; after a\n * refused handshake BDS sends its error line and closes.\n */\n public detach(): void {\n if (this.closedValue) return;\n if (this.accepted) this.event({ type: 'terminated' });\n this.close();\n }\n\n /** Ends the session after the connection closed or the session detached. */\n private close(): void {\n this.closedValue = true;\n this.profiler = undefined;\n this.releaseReferences();\n if (this.debug?.isAttached === true) this.debug.detach();\n this.debug = undefined;\n }\n\n /** Parses a received message; marks the session closed when there is none because the connection closed. */\n private next(message: unknown): ExtensionMessage | undefined {\n if (message === undefined) return undefined;\n try {\n return parseExtensionMessage(message);\n } catch {\n return { type: 'other', name: '' };\n }\n }\n\n /** The engine's stop: tells the extension, then answers it until it resumes or goes away. */\n private paused(reason: PauseReason): PauseOutcome {\n this.stopped = reason;\n this.resumeMode = undefined;\n this.terminateRequested = false;\n this.event({ type: 'StoppedEvent', reason, thread: this.threadId });\n while (this.resumeMode === undefined && !this.closedValue) {\n const received = this.channel.receive();\n if (received === undefined) {\n this.close();\n break;\n }\n const message = this.next(received);\n if (message !== undefined) this.handle(message);\n }\n this.releaseReferences();\n this.stopped = undefined;\n if (this.debug?.isAttached === true) this.debug.resume(this.resumeMode ?? 'continue');\n return this.terminateRequested ? 'terminate' : 'resume';\n }\n\n /** The engine's poll while a script runs: handles what has arrived without running script. */\n private pollRunning(): void {\n if (this.profiler !== undefined && this.debug !== undefined) this.profiler.sample(this.debug.frames());\n this.running = true;\n try {\n this.poll();\n } finally {\n this.running = false;\n }\n }\n\n private handle(message: ExtensionMessage): void {\n switch (message.type) {\n case 'request':\n this.request(message.request);\n return;\n case 'breakpoints':\n this.setBreakpoints(message.path, message.lines);\n return;\n case 'stopOnException':\n this.stopOnException = message.stop;\n this.debug?.setStopOnException(message.stop);\n return;\n case 'resume':\n if (this.stopped !== undefined) this.resumeMode = 'continue';\n return;\n case 'minecraftCommand':\n this.options.runCommand?.(message.command, message.dimension);\n return;\n case 'startProfiler':\n this.profiler = new ScriptProfiler(\n this.options.profilerClock ?? profilerClock,\n this.options.toDebuggerPath\n );\n return;\n case 'stopProfiler': {\n const profile = this.profiler?.finish();\n this.profiler = undefined;\n if (profile === undefined) return;\n this.event({\n type: 'ProfilerCapture',\n capture_base_path: message.capturesPath,\n capture_data: Buffer.from(JSON.stringify(profile)).toString('base64')\n });\n return;\n }\n case 'debugger-request':\n this.channel.send({\n type: 'debuggee-response',\n event: {\n type: 'debuggee-response',\n request_seq: message.request_seq,\n success: false,\n response_message: `JSPrismarine does not support the debugger request '${message.request}'.`\n }\n });\n return;\n default:\n return;\n }\n }\n\n private request(request: ForwardedRequest): void {\n try {\n const mode = resumeCommands[request.command];\n if (mode !== undefined) {\n this.requireStopped();\n this.resumeMode = mode;\n this.respond(request, undefined);\n return;\n }\n switch (request.command) {\n case 'setBreakpoints': {\n const path = typeof request.args.path === 'string' ? request.args.path : '';\n const lines = requestedBreakpointLines(request.args);\n const verified = this.setBreakpoints(path, lines);\n this.respond(request, { breakpoints: lines.map(() => ({ verified })) });\n return;\n }\n case 'pause':\n this.respond(request, undefined);\n if (this.stopped !== undefined) {\n this.event({ type: 'StoppedEvent', reason: 'pause', thread: this.threadId });\n } else {\n this.debug?.pause();\n }\n return;\n case 'stackTrace':\n this.respond(request, this.stackTrace());\n return;\n case 'scopes':\n this.respond(request, this.scopes(request.args));\n return;\n case 'variables':\n this.respond(request, this.variables(request.args));\n return;\n case 'evaluate':\n this.respond(request, this.evaluate(request.args));\n return;\n default:\n throw new ScriptHostErrors.UnhandledDebuggerCommand({ command: request.command });\n }\n } catch (error) {\n this.channel.send({\n type: 'response',\n request_seq: request.request_seq,\n error: error instanceof Error ? error.message : String(error)\n });\n }\n }\n\n private setBreakpoints(path: string, lines: readonly number[]): boolean {\n const file = this.options.fromDebuggerPath?.(path) ?? path;\n if (lines.length === 0) this.breakpoints.delete(file);\n else this.breakpoints.set(file, lines);\n this.debug?.setBreakpoints(file, lines);\n return this.options.knowsFile?.(file) ?? true;\n }\n\n private requireStopped(): EngineDebugger {\n if (this.stopped === undefined || this.debug === undefined) throw new ScriptHostErrors.NoScriptStopped();\n return this.debug;\n }\n\n /** The `stackTrace` body: koush's frame objects, innermost first, with their index as id. */\n private stackTrace(): object[] {\n return this.requireStopped()\n .frames()\n .map((frame, id) => ({\n id,\n name: frame.name === '' ? '<anonymous>' : frame.name,\n filename: frame.file === '' ? '' : (this.options.toDebuggerPath?.(frame.file) ?? frame.file),\n line: frame.line,\n column: frame.column\n }));\n }\n\n /** The `scopes` body, which the extension reads as `{ name, reference, expensive }` objects. */\n private scopes(args: Record<string, unknown>): object[] {\n this.requireStopped();\n const frame = typeof args.frameId === 'number' ? args.frameId : 0;\n return (['local', 'closure', 'global'] as const).map((scope) => ({\n name: scopeNames[scope],\n reference: this.reference({ kind: 'scope', frame, scope }),\n expensive: scope === 'global'\n }));\n }\n\n /**\n * The `variables` body: one page of an object's or a scope's properties. A scope is a copy of\n * the frame's variables, so each request reads a new one, which an evaluation may have changed.\n */\n private variables(args: Record<string, unknown>): VariableBody[] {\n const debug = this.requireStopped();\n const id = typeof args.variablesReference === 'number' ? args.variablesReference : 0;\n const reference = this.references.get(id);\n if (reference === undefined) throw new ScriptHostErrors.UnknownVariablesReference({ id });\n if (reference.kind === 'value') return this.page(debug, reference.handle, args);\n const scope = debug.scope(reference.frame, reference.scope);\n try {\n const variables = this.page(debug, scope, args);\n if (reference.scope === 'local' && reference.frame === 0 && this.stopped === 'exception') {\n variables.unshift(this.variable('<exception>', debug.exception()));\n }\n return variables;\n } finally {\n this.engine?.free(scope);\n }\n }\n\n /**\n * One page of a value's properties, as the `variables` arguments ask for it. The `indexed` and\n * `named` filters each page within their own group: the array indices, or every other name.\n * Without a filter, `start` and `count` page through every name.\n */\n private page(debug: EngineDebugger, handle: ScriptHandle, args: Record<string, unknown>): VariableBody[] {\n const start = typeof args.start === 'number' && args.start > 0 ? args.start : 0;\n const count = typeof args.count === 'number' && args.count > 0 ? args.count : undefined;\n let page: PropertyPage;\n if (args.filter === 'indexed' || args.filter === 'named') {\n const indices = this.indexCount(debug, handle);\n page =\n args.filter === 'indexed'\n ? debug.properties(handle, start, Math.min(count ?? indices, Math.max(indices - start, 0)))\n : debug.properties(handle, indices + start, count);\n } else {\n page = debug.properties(handle, start, count);\n }\n\n return page.properties.map((property) =>\n property.accessor\n ? { name: property.name, value: '(accessor)', type: 'accessor', variablesReference: 0 }\n : this.variable(property.name, property.value)\n );\n }\n\n /**\n * How many of a value's own property names are array indices. QuickJS lists those first, in\n * ascending order, so they are a prefix of the names, and a binary search finds where it ends\n * by reading one name at a time.\n */\n private indexCount(debug: EngineDebugger, handle: ScriptHandle): number {\n let low = 0;\n let high = debug.properties(handle, 0, 0).total;\n while (low < high) {\n const middle = Math.floor((low + high) / 2);\n const [property] = debug.properties(handle, middle, 1).properties;\n if (property?.value instanceof ScriptHandle) this.engine?.free(property.value);\n if (property !== undefined && isArrayIndex(property.name)) {\n low = middle + 1;\n } else {\n high = middle;\n }\n }\n return low;\n }\n\n /** The `evaluate` body. A failed evaluation is a result too: the extension never answers an error here. */\n private evaluate(args: Record<string, unknown>): object {\n if (this.running || this.debug === undefined) throw new ScriptHostErrors.EvaluateWhileRunning();\n const expression = typeof args.expression === 'string' ? args.expression : '';\n const frame = this.stopped !== undefined && typeof args.frameId === 'number' ? args.frameId : -1;\n try {\n const { value, type, variablesReference, indexedVariables } = this.variable(\n '',\n this.debug.evaluate(frame, expression)\n );\n return {\n result: value,\n type,\n variablesReference,\n ...(indexedVariables === undefined ? {} : { indexedVariables })\n };\n } catch (error) {\n if (!(error instanceof ScriptError)) throw error;\n const text = error.scriptName === '' ? error.scriptMessage : `${error.scriptName}: ${error.scriptMessage}`;\n return { result: text, type: 'error', variablesReference: 0 };\n }\n }\n\n /** Formats a value as VS Code shows it, giving an object a reference to expand it by. */\n private variable(name: string, value: ScriptValue): VariableBody {\n if (value === undefined) return { name, value: 'undefined', type: 'undefined', variablesReference: 0 };\n if (value === null) return { name, value: 'null', type: 'null', variablesReference: 0 };\n if (typeof value === 'boolean') return { name, value: String(value), type: 'boolean', variablesReference: 0 };\n if (typeof value === 'number') {\n return { name, value: Object.is(value, -0) ? '-0' : String(value), type: 'number', variablesReference: 0 };\n }\n if (typeof value === 'string')\n return { name, value: JSON.stringify(value), type: 'string', variablesReference: 0 };\n\n if (this.debug === undefined) throw new ScriptHostErrors.DebugSessionDetached();\n const { kind, name: label, detail } = this.debug.describe(value);\n if (kind === 'symbol' || kind === 'bigint') {\n this.engine?.free(value);\n const text = kind === 'bigint' ? `${label ?? ''}n` : (label ?? 'Symbol()');\n return { name, value: text, type: kind, variablesReference: 0 };\n }\n const reference = kind === 'proxy' ? 0 : this.reference({ kind: 'value', handle: value });\n if (kind === 'proxy') this.engine?.free(value);\n switch (kind) {\n case 'array':\n return {\n name,\n value: `${label ?? 'Array'}(${detail ?? 0})`,\n type: label ?? 'Array',\n variablesReference: reference,\n indexedVariables: typeof detail === 'number' ? detail : 0\n };\n case 'function':\n return {\n name,\n value: `function ${label ?? ''}`.trimEnd(),\n type: 'function',\n variablesReference: reference\n };\n case 'error':\n return {\n name,\n value:\n detail === undefined || detail === '' ? (label ?? 'Error') : `${label ?? 'Error'}: ${detail}`,\n type: label ?? 'Error',\n variablesReference: reference\n };\n default:\n return { name, value: label ?? 'Object', type: label ?? 'object', variablesReference: reference };\n }\n }\n\n private reference(reference: Reference): number {\n const id = this.nextReference++;\n this.references.set(id, reference);\n return id;\n }\n\n /** Frees every handle the stop handed out; references last only until the script goes on. */\n private releaseReferences(): void {\n for (const reference of this.references.values()) {\n if (reference.kind === 'value') this.engine?.free(reference.handle);\n }\n this.references = new Map();\n this.nextReference = 1;\n }\n\n private respond(request: ForwardedRequest, body: unknown): void {\n this.channel.send({ type: 'response', request_seq: request.request_seq, body });\n }\n\n private event(event: DebuggerEvent): void {\n this.channel.send({ type: 'event', event });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAkFA,IAAa,oBAAoB;;AAiBjC,IAAM,kBAAkB,KAAK,KAAK;;AAGlC,IAAM,gBAAgB,SAA0B,mBAAmB,KAAK,IAAI,KAAK,OAAO,IAAI,KAAK;AAEjG,IAAM,aAAkD;CAAE,OAAO;CAAS,SAAS;CAAW,QAAQ;AAAS;AAE/G,IAAM,iBAAuD;CACzD,UAAU;CACV,MAAM;CACN,QAAQ;CACR,SAAS;AACb;;;;;;;;AASA,IAAa,qBAAb,MAAgC;CAC5B;CACA;CACA;CACA;CACA;CACA,cAAsB;CACtB,UAAkB;;CAElB,WAAmB;;CAEnB;;CAEA,UAAkB;CAClB;CACA,qBAA6B;CAC7B,6BAAqB,IAAI,IAAuB;CAChD,gBAAwB;;CAExB,aAAqB;;CAErB,8BAA+B,IAAI,IAA+B;CAClE,kBAA0B;;CAE1B;CAEA,YAAmB,SAA0B,SAA8B;EACvE,KAAK,UAAU;EACf,KAAK,UAAU;EACf,KAAK,WAAW,QAAQ,YAAA;CAC5B;;CAGA,IAAW,SAAkB;EACzB,OAAO,KAAK;CAChB;;;;;;CAOA,QAAqB;EAC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