/** The debug tools: breakpoints, object snapshots and debugger sessions on a kept game. */ import { existsSync, readFileSync, statSync } from 'node:fs'; import { join } from 'node:path'; import { ProtocolError, ProtocolErrorCode } from '@modelcontextprotocol/server'; import type { ToolResponse } from '../answer-json.js'; import { writeBreakpointNoteAsync } from '../breakpoint-note.js'; import type { GodotDAPClient } from '../dap_client.js'; import { dictionary } from '../dictionary.js'; import { errorMessage } from '../errors.js'; import { type DebugRequest, READ_MS } from '../game-debugger.js'; import { codeOf, neverStopsOn } from '../gdscript-source.js'; import type { GodotProcess } from '../godot-process.js'; import { askTheKeepersDebugger } from '../keeper-channel.js'; import { diffAnswer, isSnapshotCounts, type KeptSnapshot, mismatchedRuns, SnapshotStore, SPAWNING_START, snapshotAnswer, } from '../object-snapshot.js'; import { isSameDirectory, listedSpelling, realAsFarAsItExists, resolveWithinProject } from '../paths.js'; import { lateAnswer } from '../runtime-client.js'; import type { GodotServer } from '../server.js'; import { asParams, type OperationParams, readNonEmptyString, readPositiveNumber, readString, } from '../tool-args.js'; import { editorHasAnotherThan } from './editor-connection.js'; import { evaluateInAPlayedGame } from './editor-play.js'; import { pickRun } from './game-pick.js'; import { askTheKeptGame, breakpointsAsProjectSpells, breakpointsAtRisk, dap, dapHoldingBreakpointsOf, handleDAP, KEEPER_DEBUG_MS, keptRun, } from './language-servers.js'; import { type Checked, checkedProject } from './project-checks.js'; import { PATH_SOLUTIONS, projectSpelling } from './refusals.js'; import { exited, howItExited, runCallOf } from './run-facts.js'; import { runStillGoing } from './run-polling.js'; import { holdOf } from './runtime-calls.js'; import { missingScript } from './script-diagnostics.js'; /** Object snapshots taken on a kept game. */ export class DebugState { /** The object snapshots taken while this server runs, by the id each answer named. */ readonly objectSnapshots = new SnapshotStore(); } /** A debug_control or debug_state call as the question it puts to a kept game's debugger. */ function keptGameRequest(tool: string, op: string, args: OperationParams): DebugRequest { if (tool === 'debug_state') { if (op === 'output') { return { op: 'output' }; } const frame = args['frameId']; if (op === 'variables') { return { op: 'variables', frame: typeof frame === 'number' ? frame : 0 }; } if (op === 'evaluate') { return { op: 'evaluate', frame: typeof frame === 'number' ? frame : 0, expression: readString(args, 'expression') ?? '', }; } return { op: 'stack' }; } switch (op) { case 'pause': return { op: 'pause' }; case 'step_over': return { op: 'resume', how: 'next' }; case 'step_into': return { op: 'resume', how: 'step' }; case 'step_out': return { op: 'resume', how: 'out' }; default: return { op: 'resume', how: 'continue' }; } } /** How long a snapshot is given: the game's own wait to serialise, then its slices. */ const SNAPSHOT_ASK_MS = 120_000; /** * The refusal for a breakpoint on [param line] of the script at [param absolutePath] when nothing * can stop there, or null: a line past the script's end, one holding no code, or one `neverStopsOn` * reads as never marked. Lines are counted as an editor counts them, without one for the newline * that ends the last. Neither the adapter nor a game refuses such a line: a breakpoint on a func * line was answered verified and never stopped anything. */ function lineNothingStopsOn(absolutePath: string, relativePath: string, line: number): string | null { const text = readFileSync(absolutePath, 'utf8'); const count = text === '' ? 0 : text.split('\n').length - (text.endsWith('\n') ? 1 : 0); if (line > count) { return `res://${relativePath} has ${count} line${count === 1 ? '' : 's'}, so there is no line ${line} to stop on.`; } const code = codeOf(text); const lines = code.split('\n'); const stops = (at: number): boolean => (lines[at - 1] ?? '').trim() !== '' && neverStopsOn(text, at, code) === null; if (stops(line)) { return null; } let next = line + 1; while (next <= lines.length && !stops(next)) { next += 1; } const after = next > lines.length ? ', and no line after it is one' : `. The next line it stops on is ${next}`; const at = `res://${relativePath} line ${line}`; if ((lines[line - 1] ?? '').trim() === '') { return `${at} holds no code, so nothing stops there${after}.`; } const never = neverStopsOn(text, line, code); if (never?.kind === 'continuation' && stops(never.of)) { return `${at} continues the statement that starts on line ${never.of}, and the engine stops only where a statement starts, so nothing stops there. A breakpoint on line ${never.of} stops before that statement runs.`; } const why = never?.kind === 'else' ? 'is an else, which the engine passes without stopping: it stops on the statements under it' : 'declares rather than runs, and the engine stops only on statements and on member variables with a type or a value, so nothing stops there'; return `${at} ${why}${after}.`; } /** Which debug adapter call each debug_state op is. */ const DEBUG_STATE_CALLS: Readonly> = dictionary({ stack: 'dap_get_stack_trace', output: 'dap_get_output', variables: 'dap_get_variables', evaluate: 'dap_evaluate', }); /** What setting or removing one breakpoint is working on, passed from step to step. */ interface BreakpointCall { readonly op: string; readonly args: OperationParams; readonly project: { readonly value: { readonly path: string } }; readonly session: GodotDAPClient; readonly located: { readonly relativePath: string; readonly absolutePath: string }; readonly scriptPath: string; readonly line: number; /** Said where the script lies behind a link out of the project and so was not read. */ readonly lineNotChecked?: string; } /** What a breakpoint answer says of the game this server started: not told, not taken, or taken. */ function runningGameSaid( told: NonNullable>>, op: string, pid: number | string, ): string { if ('unreached' in told || typeof told['refused'] === 'string') { return `The game this server started is running, and its debugger was not told: ${String('unreached' in told ? told.unreached : told['refused'])}. It takes the line when it is started again.`; } if (told['taken'] === false) { return `Told to the running game (pid ${pid}), which this server started, and not taken by it within ${READ_MS / 1000}s: a game reads its debugger between frames and every 2048 lines of script, so one inside a long frame takes the change once that frame ends.`; } return op === 'set' ? `Told to the running game (pid ${pid}), which this server started, and taken by it: anything it runs from now on stops there.` : `Told to the running game (pid ${pid}), which this server started, and taken by it: it no longer stops on that line.`; } /** One tool call to the code that does it, for the debug tools. */ export async function dispatchDebugTool( server: GodotServer, tool: string, op: string, args: OperationParams, ): Promise { switch (tool) { case 'debug_breakpoint': return await handleDebugBreakpoint(server, op, args); case 'debug_control': case 'debug_state': return await handleDebugSession(server, tool, op, args); case 'debug_objects': return await handleDebugObjects(server, op, args); default: throw new ProtocolError(ProtocolErrorCode.MethodNotFound, `Unknown tool: ${tool}`); } } /** The breakpoints of the debug adapter and of a game this server started, listed, set or removed. */ async function handleDebugBreakpoint( server: GodotServer, op: string, args: OperationParams, ): Promise { // The adapter names the file the way this machine spells it, not the way the project // does, so the projectPath every other tool takes is what turns `res://main.gd` into one. const project = checkedProject(server, args); if (!project.ok) { return project.response; } if (op === 'list') { const session = dapHoldingBreakpointsOf(server, project.value.path); const editor = editorHasProject(server, project.value.path); return server.jsonTextResponse({ held: breakpointsAsProjectSpells(project.value.path, session.breakpointsHeld()), ...(editor ? { setInEditor: breakpointsAsProjectSpells(project.value.path, session.breakpointsInEditor()), ...breakpointsAtRisk(server), } : {}), }); } return await setOrRemoveBreakpoint(server, op, args, project); } /** A breakpoint set on one line of a script, or taken off it. */ async function setOrRemoveBreakpoint( server: GodotServer, op: string, args: OperationParams, project: { readonly value: { readonly path: string } }, ): Promise { const given = readString(args, 'scriptPath') ?? ''; // The engine loads a script behind a link out of the project, so a breakpoint on one is taken. const located = resolveWithinProject(project.value.path, given, { forTheEngine: true }); if (!located.ok) { return server.createErrorResponse(located.reason, PATH_SOLUTIONS); } // The project's real root, because the adapter refuses a path that does not start with the // project as it holds it, and on macOS /var/folders is /private/var/folders. The tail follows // no link, as the engine loads it, in its folders' case, since a game matches the exact path. const session = dapHoldingBreakpointsOf(server, project.value.path); const root = realAsFarAsItExists(project.value.path); const scriptPath = join(root, listedSpelling(root, located.relativePath)); const line = readPositiveNumber(args, 'line'); if (line === undefined) { return server.createErrorResponse('line is required: the one-based line to stop on.'); } // Neither the adapter nor a game refuses a line nothing stops on, and a breakpoint held there // is kept in the project's set and never stops anything. Removing one is left alone, so a // breakpoint on a script since deleted or shortened can still be taken off. const checked = op === 'set' ? checkedSetLine(server, project.value.path, given, located, line) : {}; if ('refusal' in checked) { return checked.refusal; } return await applyBreakpoint(server, { op, args, project, session, located, scriptPath, line, ...checked }); } /** * What a set on [param line] of the script [param given] answers before it is taken: the refusal * of a missing script or a line nothing stops on, or the note that the line went unchecked for a * script behind a link out of the project, which is not read. */ function checkedSetLine( server: GodotServer, projectPath: string, given: string, located: { readonly relativePath: string; readonly absolutePath: string }, line: number, ): { refusal: ToolResponse } | { lineNotChecked?: string } { const gate = resolveWithinProject(projectPath, given); const link = gate.ok ? null : (gate.link ?? null); if (!existsSync(located.absolutePath)) { // A link whose target is gone leaves nothing to name a missing script in. if (!gate.ok && link !== null && !existsSync(join(projectPath, link.slice('res://'.length)))) { return { refusal: server.createErrorResponse(gate.reason, PATH_SOLUTIONS) }; } return { refusal: missingScript(server, projectPath, located.relativePath) }; } if (link === null) { if (statSync(located.absolutePath, { throwIfNoEntry: false })?.isDirectory() === true) { return { refusal: server.createErrorResponse(`res://${located.relativePath} is a folder, not a script.`), }; } const nothing = lineNothingStopsOn(located.absolutePath, located.relativePath, line); return nothing === null ? {} : { refusal: server.createErrorResponse(nothing) }; } const root = realAsFarAsItExists(projectPath); const linkSteps = listedSpelling(root, link.slice('res://'.length).replace(/\/$/, '')); const script = projectSpelling(projectPath, join(root, listedSpelling(root, located.relativePath))); return { lineNotChecked: `Line ${line} of ${script} was not checked, since the script lies behind the link res://${linkSteps}${link.endsWith('/') ? '/' : ''}, which leads out of the project.`, }; } /** * Whether the connected editor is the one to ask about [param projectPath]'s breakpoints. An * editor with another project open refuses a path outside its own, so a breakpoint of this * project is held here as with no editor. */ function editorHasProject(server: GodotServer, projectPath: string): boolean { return server.godotBridge.isConnected() && !editorHasAnotherThan(server, projectPath); } /** A breakpoint handed to the editor's adapter when it has the project open, and otherwise held here. */ async function applyBreakpoint(server: GodotServer, call: BreakpointCall): Promise { const { op, args, session, located, scriptPath, line } = call; const editor = editorHasProject(server, call.project.value.path); let answer: Record; if (editor) { const answered = await handleDAP(server, op === 'set' ? 'dap_set_breakpoint' : 'dap_remove_breakpoint', { ...args, scriptPath, }); if (answered.isError === true) { return answered; } answer = asParams(JSON.parse(answered.content[0]?.text ?? '{}')); } else if (op === 'set') { // Held here for whoever plays next: a game this server starts takes them as it starts, and // an editor that connects is given them before its first play. session.holdBreakpoints([{ scriptPath, lines: [line] }]); answer = { set: true }; } else { answer = session.forgetBreakpoint(scriptPath, line) ? { removed: true } : { removed: false, why: `No breakpoint was held on line ${line} of res://${located.relativePath}, so there was nothing to remove. held lists the ones that are.`, }; } return await breakpointResponse(server, call, editor, answer); } /** Why a breakpoint is held here and not given to an editor, as the start of a sentence. */ function noEditorForBreakpoints(server: GodotServer): string { return server.godotBridge.isConnected() ? `The connected editor has another project open (${server.godotBridge.getStatus().projectPath ?? ''})` : 'No editor is connected'; } /** What a set or removed breakpoint answers: the adapter's answer, every breakpoint held and what a running game was told. */ async function breakpointResponse( server: GodotServer, call: BreakpointCall, editor: boolean, answer: Record, ): Promise { const { op, project, session, scriptPath, line } = call; // Written after the adapter has taken it, so the note never claims a line the editor // refused, and beside the adapter's answer so the caller sees the whole set it now holds. const held = session.breakpointsHeld(); await writeBreakpointNoteAsync(project.value.path, held); // Only a game of this project takes the line: another project's game would stop on its own // script of the same name. const picked = pickRun(server, { ...runCallOf(call.args), projectPath: project.value.path }); const running = 'run' in picked ? keptRun(picked.run) : null; const kept = running === null || (typeof running.projectPath === 'string' && !isSameDirectory(running.projectPath, project.value.path)) ? null : running; const told = kept === null ? null : await askTheKeepersDebugger( kept.keeper, { op: 'breakpoint', script: projectSpelling(project.value.path, scriptPath), line, set: op === 'set', }, KEEPER_DEBUG_MS, ); return server.jsonTextResponse({ ...answer, ...(call.lineNotChecked === undefined ? {} : { lineNotChecked: call.lineNotChecked }), held: breakpointsAsProjectSpells(project.value.path, held), // The editor's own, as it reported them to this session, so a caller reading the whole // set sees the lines the user set by hand as well as the ones set here. ...(editor ? { setInEditor: breakpointsAsProjectSpells(project.value.path, session.breakpointsInEditor()), } : {}), ...(told === null ? {} : { runningGame: runningGameSaid(told, op, kept?.pid ?? '?') }), ...('refusal' in picked ? { runningGame: 'Several runs are going, so none was told. Call again with pid to hand the line to one of them.', } : {}), note: editor ? 'The editor keeps a breakpoint set this way for one play. Every breakpoint held here is sent again before each play editor_run starts, handed to every game this server starts itself, and kept in the project for the server after a reconnect.' : held.length === 0 ? `${noEditorForBreakpoints(server)} and no breakpoint is held here, so the next game this server starts and the next editor to connect are given none.` : `${noEditorForBreakpoints(server)}, so the breakpoints under held are kept here: every game this server starts is handed them as it starts, an editor that connects is sent them before its first play, and they are kept in the project for the server after a reconnect.`, ...(editor ? breakpointsAtRisk(server) : {}), }); } /** A snapshot of the running game's objects, or the classes that changed between two kept ones. */ async function handleDebugObjects( server: GodotServer, op: string, args: OperationParams, ): Promise { if (op !== 'diff') { const taken = await takeObjectSnapshot(server, args); return 'refusal' in taken ? taken.refusal : server.jsonTextResponse(snapshotAnswer(taken)); } const before = server.debug.objectSnapshots.find(readString(args, 'before') ?? ''); if ('refused' in before) { return server.createErrorResponse(before.refused, [...before.solutions]); } const afterId = readNonEmptyString(args, 'after'); const after = afterId === undefined ? await takeObjectSnapshot(server, args) : server.debug.objectSnapshots.find(afterId); if ('refusal' in after) { return after.refusal; } if ('refused' in after) { return server.createErrorResponse(after.refused, [...after.solutions]); } const refused = mismatchedRuns(before, after); if (refused !== null) { return server.createErrorResponse(refused.refused, [...refused.solutions]); } return server.jsonTextResponse(diffAnswer(before, after)); } /** A snapshot of the game this server started, kept, or the refusal saying what it needs. */ async function takeObjectSnapshot( server: GodotServer, args: OperationParams, ): Promise { const picked = pickRun(server, runCallOf(args)); if ('refusal' in picked) { return picked; } const kept = keptRun(picked.run); if (kept === null) { return { refusal: noSnapshotToTake(server, picked.run) }; } const answered = await askTheKeepersDebugger(kept.keeper, { op: 'snapshot' }, SNAPSHOT_ASK_MS); if ('unreached' in answered) { return { refusal: server.createErrorResponse( `The debugger of the running game did not answer: ${String(answered.unreached)}.`, ['editor_status says whether it is still running'], ), }; } if (typeof answered['refused'] === 'string') { const next = answered['next']; return { refusal: server.createErrorResponse(answered['refused'], typeof next === 'string' ? [next] : []), }; } if (!isSnapshotCounts(answered)) { return { refusal: server.createErrorResponse( `The game's debugger answered a snapshot with ${JSON.stringify(answered).slice(0, 200)}, which holds no counts.`, ), }; } return server.debug.objectSnapshots.keep(kept.keeper, kept.pid, answered, kept.projectPath ?? ''); } /** Why no snapshot can be taken now: no game, one that has ended, or one the editor plays. */ function noSnapshotToTake(server: GodotServer, game: GodotProcess | null): ToolResponse { const start = SPAWNING_START; if (game?.throughEditor === true && !exited(game)) { return server.createErrorResponse( "The game is one the editor plays, so the editor is its debugger, and the editor's ObjectDB Profiler answers every snapshot such a game sends in its own way.", [ `editor_run stop, then ${start}`, "The editor's ObjectDB Profiler tab takes and compares snapshots of the played game by hand", ], ); } return server.createErrorResponse( game === null || exited(game) ? 'No game is running, so there are no objects to count.' : 'The running game has no debugger here to ask for a snapshot.', [start], ); } /** The debug controls and the debug state, answered by the game's keeper or by the editor's adapter. */ async function handleDebugSession( server: GodotServer, tool: string, op: string, args: OperationParams, ): Promise { if (op === 'evaluate') { for (const requestId of server.runtimeCalls.heldWhilePending) { if (lateAnswer(requestId)?.state === 'waiting') { server.runtimeCalls.evaluatedWhilePending.add(requestId); } } } // A game this server started has its keeper for a debugger, which answers everything the // editor's adapter does and also breaks into a game and steps out of a function. const picked = pickRun(server, runCallOf(args)); if ('refusal' in picked) { return picked.refusal; } const kept = keptRun(picked.run); if (kept !== null) { return await askTheKeptGame(server, kept.keeper, keptGameRequest(tool, op, args), kept.projectPath ?? ''); } return await debugWithoutAKeptGame(server, tool, op, args, picked.run); } /** A debug call when no game this server started is running: its console, or the editor's adapter. */ async function debugWithoutAKeptGame( server: GodotServer, tool: string, op: string, args: OperationParams, last: GodotProcess | null, ): Promise { // A kept game's console lived in its keeper, which ends with it. The adapter's buffer holds // nothing of that run, so reading it answered no lines, or an earlier played run's. if ( tool === 'debug_state' && op === 'output' && last !== null && !last.throughEditor && last.keeper !== undefined ) { return server.createErrorResponse( 'The game this server started has ended, and its debugger, which held its console output, ended with it.', ['editor_output reads what the game printed, with the errors and warnings it reported'], ); } // The console the adapter buffered outlives the game it came from, so reading it needs // no session. A stack, a scope and a step all need one, and one that is stopped. if (tool === 'debug_state' && op === 'output') { return await handleDAP(server, 'dap_get_output', args); } const played = last; if ((op === 'pause' || op === 'step_out') && played?.throughEditor === true && !exited(played)) { return server.createErrorResponse( op === 'pause' ? "A game the editor plays cannot be paused from here: Godot's debug adapter answers a pause by reporting the game stopped and leaving it running." : "A game the editor plays cannot be stepped out of a function from here: Godot's debug adapter implements no stepOut.", [ 'Set a breakpoint where it should stop, then step over or into from there', 'A game this server starts, as editor_run start does with args, savesIn or env, has a debugger here that pauses and steps out', ], ); } return await debugAnAdapterSession(server, tool, op, args, played); } /** A debug call to the editor's adapter, once a game is held stopped for it. */ async function debugAnAdapterSession( server: GodotServer, tool: string, op: string, args: OperationParams, played: GodotProcess | null, ): Promise { const held = await debuggedGame(server, played, tool === 'debug_control' ? 'move' : 'read'); if (!held.ok) { return held.response; } if (tool === 'debug_state' && op === 'evaluate') { return await evaluateInAPlayedGame(server, played?.throughEditor === true ? played : null, args); } return tool === 'debug_control' ? await handleDAP(server, `dap_${op}`, args) : await handleDAP(server, DEBUG_STATE_CALLS[op] ?? 'dap_get_stack_trace', args); } /** * The game the editor's debugger is holding, stopped, or the refusal saying which part is * missing. * * Every one of these used to answer with an empty stack, and an empty stack reads the same * whether nothing is running, the game this server spawned has no debugger behind it, or the * game is running freely and was never going to have a frame to show. * * [param intent] separates reading the game from moving it, for the one state where they part: * a game held at a stop this session was not told about. Its stack cannot be read from here, * and letting it go or stepping it is exactly what can be done, and what the next stop this * session is told about comes from. */ async function debuggedGame( server: GodotServer, game: GodotProcess | null, intent: 'read' | 'move', ): Promise> { // A finished run is kept so its output can still be read, and a readable log is not a debug // session. Said apart from "nothing is running", because the two are answered by different // things: one wants a run started, the other has its answer waiting in editor_output. if (game !== null && exited(game)) { return { ok: false, response: server.createErrorResponse( `The last run has already finished (${howItExited(game)}), so there is no debug session to answer for.`, [ 'editor_output still reads what it printed, until the next run starts', 'editor_run start plays another, which the debugger can hold', ], ), }; } if (game === null) { return { ok: false, response: server.createErrorResponse( 'No game is running, so there is no debug session to answer for.', ['Start one with editor_run start, which has the editor play it'], ), }; } return await debuggedGameStillGoing(server, game, intent); } /** The game of a run still going, held for the debugger when it is one the editor plays. */ async function debuggedGameStillGoing( server: GodotServer, game: GodotProcess, intent: 'read' | 'move', ): Promise> { // A run the editor plays keeps `exitCode` null for as long as the record lasts, so the refusal // above never fires for one that has ended. The editor is asked instead: attaching to the // adapter of a game that has gone answered "the editor is playing the game but its debug // adapter did not answer", which is two things wrong about one game that was simply over. const going = await runStillGoing(server, game); if (!going) { return { ok: false, response: server.createErrorResponse( 'The last run has already ended, so there is no debug session to answer for.', [ 'editor_output still reads what it printed, until the next run starts', 'editor_run start plays another, which the debugger can hold', ], ), }; } if (!game.throughEditor) { return { ok: false, response: server.createErrorResponse( 'The running game has no debugger: it was started with none, or by a keeper that could not take questions, so breakpoints never hit and there is no stack to read.', [ 'editor_run start starts it again, and the keeper holding a game this server starts is its debugger', 'editor_status says whether an editor has reached this server', ], ), }; } // A session, because the stack and the scopes are answered to one and a stop is not. The stop // reaches any connection open when it happens, attached or not, so a server that played the // scene already knows. What it cannot do without attaching is read where. try { await dap(server).attach(); } catch (error) { return { ok: false, response: server.createErrorResponse( `The editor is playing the game but its debug adapter did not answer: ${errorMessage(error)}`, [ `This asked on port ${dap(server).port}, which is where the connected editor says it serves`, 'GDHARNESS_DAP_PORT points this server at another one', ], ), }; } return await debuggedGameIfStopped(server, game, going, intent); } /** The game when the adapter has it stopped, and otherwise what is known of why it cannot be read. */ async function debuggedGameIfStopped( server: GodotServer, game: GodotProcess, going: true, intent: 'read' | 'move', ): Promise> { if (!dap(server).isStopped()) { // Not held as far as this session knows, and whether it knows is the question: a session // that attached after the stop is shown no stack by the adapter, so the runtime is asked // before "running" is said about a game that may be sitting at a breakpoint. const hold = await holdOf(server, game, going); if (hold.heldAt !== null) { if (intent === 'move') { return { ok: true, value: game }; } return { ok: false, response: server.createErrorResponse( hold.heldAt === undefined ? `Whether the game is held cannot be told from here, so there is no stack to read. ${hold.heldNote ?? ''}` : `The game is held, and this server cannot read its stack: ${hold.heldAt.description}.`, [ 'debug_control continue lets a held game go, and the next stop is one this session is told about', 'editor_output says what it printed on the way to where it is', ], ), }; } return { ok: false, response: server.createErrorResponse( 'The game is running, not stopped, so it has no stack and no scope to read.', [ 'Set a breakpoint with debug_breakpoint set before the run', 'Or, for a game this server started, stop it where it is with debug_control pause', 'editor_output reads what the running game is printing', ], ), }; } return { ok: true, value: game }; }