API reference / @jsprismarine/script-host / debugger/protocol
debugger/protocol
Interfaces
DebuggerPlugin
Defined in: script-host/src/debugger/protocol.ts:24
One script pack the extension may debug: its name and the UUID of its script module.
Properties
module_uuid
readonlymodule_uuid:string
Defined in: script-host/src/debugger/protocol.ts:26
name
readonlyname:string
Defined in: script-host/src/debugger/protocol.ts:25
DebuggerStat
Defined in: script-host/src/debugger/protocol.ts:33
One statistic of a StatEvent2, the extension's StatDataModel (src/stats/stats-provider.ts): a value for this tick, or a group of named children.
Properties
children?
readonlyoptionalchildren?: readonlyDebuggerStat[]
Defined in: script-host/src/debugger/protocol.ts:38
name
readonlyname:string
Defined in: script-host/src/debugger/protocol.ts:34
should_aggregate
readonlyshould_aggregate:boolean
Defined in: script-host/src/debugger/protocol.ts:35
values?
readonlyoptionalvalues?: readonly (string|number)[]
Defined in: script-host/src/debugger/protocol.ts:37
The values; the last one is this tick's.
DiagnosticsTab
Defined in: script-host/src/debugger/protocol.ts:45
A tab of the extension's diagnostics panel, the extension's DiagnosticsTabDescriptor (src/diagnostics-schema.ts), with the fields Bedrock Dedicated Server (BDS) fills.
Properties
data_source
readonlydata_source:"server"|"client"|"server_script"
Defined in: script-host/src/debugger/protocol.ts:48
display_type
readonlydisplay_type:string
Defined in: script-host/src/debugger/protocol.ts:49
is_empty_tab
readonlyis_empty_tab:boolean
Defined in: script-host/src/debugger/protocol.ts:50
key_label?
readonlyoptionalkey_label?:string
Defined in: script-host/src/debugger/protocol.ts:54
name
readonlyname:string
Defined in: script-host/src/debugger/protocol.ts:46
stat_group_id
readonlystat_group_id:string
Defined in: script-host/src/debugger/protocol.ts:47
tick_range?
readonlyoptionaltick_range?:number
Defined in: script-host/src/debugger/protocol.ts:52
value_scalar?
readonlyoptionalvalue_scalar?:number
Defined in: script-host/src/debugger/protocol.ts:53
y_label?
readonlyoptionaly_label?:string
Defined in: script-host/src/debugger/protocol.ts:51
ForwardedRequest
Defined in: script-host/src/debugger/protocol.ts:131
A Debug Adapter Protocol request the extension forwards: stackTrace, next and the rest.
Properties
args
readonlyargs:Record<string,unknown>
Defined in: script-host/src/debugger/protocol.ts:134
command
readonlycommand:string
Defined in: script-host/src/debugger/protocol.ts:133
request_seq
readonlyrequest_seq:number
Defined in: script-host/src/debugger/protocol.ts:132
Type Aliases
DebuggerEvent
DebuggerEvent = {
plugins: readonlyDebuggerPlugin[];require_passcode?:boolean;type:"ProtocolEvent";version:number; } | {reason:string;thread:number;type:"StoppedEvent"; } | {reason:"new"|"exited";thread:number;type:"ThreadEvent"; } | {logLevel:number;message:string;type:"PrintEvent"; } | {logLevel:number;message:string;type:"NotificationEvent"; } | {stats: readonlyDebuggerStat[];tick:number;type:"StatEvent2"; } | {descriptors: readonlyDiagnosticsTab[];type:"SchemaEvent"; } | {capture_base_path:string;capture_data:string;type:"ProfilerCapture"; } | {type:"terminated"; }
Defined in: script-host/src/debugger/protocol.ts:94
The events the host sends, each inside an { type: 'event', event } envelope.
Union Members
Type Literal
{ plugins: readonly DebuggerPlugin[]; require_passcode?: boolean; type: "ProtocolEvent"; version: number; }
Type Literal
{ reason: string; thread: number; type: "StoppedEvent"; }
Type Literal
{ reason: "new" | "exited"; thread: number; type: "ThreadEvent"; }
Type Literal
{ logLevel: number; message: string; type: "PrintEvent"; }
Type Literal
{ logLevel: number; message: string; type: "NotificationEvent"; }
Type Literal
{ stats: readonly DebuggerStat[]; tick: number; type: "StatEvent2"; }
Type Literal
{ descriptors: readonly DiagnosticsTab[]; type: "SchemaEvent"; }
Type Literal
{ capture_base_path: string; capture_data: string; type: "ProfilerCapture"; }
A CPU profile, .cpuprofile JSON in base64, for the extension to write under capture_base_path.
Type Literal
{ type: "terminated"; }
The host ends the session; BDS sends it just before it closes the connection.
ExtensionMessage
ExtensionMessage = {
passcode:string|undefined;targetModuleUuid:string|undefined;type:"protocol";version:number; } | {request:ForwardedRequest;type:"request"; } | {lines: readonlynumber[];path:string;type:"breakpoints"; } | {stop:boolean;type:"stopOnException"; } | {type:"resume"; } | {command:string;dimension:string;type:"minecraftCommand"; } | {request:string;request_seq:number;type:"debugger-request"; } | {type:"startProfiler"; } | {capturesPath:string;type:"stopProfiler"; } | {name:string;type:"other"; }
Defined in: script-host/src/debugger/protocol.ts:138
A message the extension sends, parsed into what the host acts on.
HostMessage
HostMessage = {
event:DebuggerEvent;type:"event"; } | {body?:unknown;error?:string;request_seq:number;type:"response"; } | {event: {request_seq:number;response_message?:string;success:boolean;type:"debuggee-response"; };type:"debuggee-response"; }
Defined in: script-host/src/debugger/protocol.ts:117
A message the host sends. A response answers a request by its request_seq, with a body or an error. debuggee-response answers a debugger-request; the extension reads it from the envelope's event field (receiveDebugeeMessage in src/session.ts).
Variables
DEBUGGER_PROTOCOL_VERSION
constDEBUGGER_PROTOCOL_VERSION:11=11
Defined in: script-host/src/debugger/protocol.ts:15
The protocol version the host offers. The extension echoes any version from 2 up to its own DEBUGGER_PROTOCOL_VERSION (src/protocol-events.ts), and 11 is that constant in v1.61.0.
DEFAULT_DEBUGGER_PORT
constDEFAULT_DEBUGGER_PORT:19144=19144
Defined in: script-host/src/debugger/protocol.ts:18
The port the extension and Bedrock Dedicated Server use when none is given.
DIAGNOSTICS_TABS
constDIAGNOSTICS_TABS: readonlyDiagnosticsTab[]
Defined in: script-host/src/debugger/protocol.ts:62
The tabs protocol 2193's pinned BDS sends in its SchemaEvent, captured from its wire: two for a client's frame timings and memory, which a dedicated server never fills, and the engine's memory table, which the scripting_engine statistic fills.
LogLevel
constLogLevel:object
Defined in: script-host/src/debugger/protocol.ts:21
The level of a printed or notified message, as the extension's LogLevel numbers them.
Type Declaration
error
readonlyerror:3=3
log
readonlylog:1=1
verbose
readonlyverbose:0=0
warn
readonlywarn:2=2
Functions
parseExtensionMessage()
parseExtensionMessage(
message):ExtensionMessage
Defined in: script-host/src/debugger/protocol.ts:173
Reads one message from the extension. The shapes of protocol 8 and later are flat, and the older ones nest their fields one level down (src/protocol-events.ts), so both are read.
Parameters
message
unknown
A parsed JSON message.
Returns
The message, or other for a type the host does not act on.
Throws
When the message is not an object with a type.
requestedBreakpointLines()
requestedBreakpointLines(
args):number[]
Defined in: script-host/src/debugger/protocol.ts:235
Reads the lines of a setBreakpoints request, which protocol 6 and later send as a request.
Parameters
args
Record<string, unknown>
Returns
number[]