import { Type } from "@sinclair/typebox"; import type { ExtensionAPI, ToolResult } from "../_shared/pi-api.js"; import { errorResult, textResult } from "../_shared/pi-api.js"; import { validateParams } from "../_shared/validation.js"; const DebugParams = Type.Object({ action: Type.Union([ Type.Literal("launch"), Type.Literal("attach"), Type.Literal("set_breakpoint"), Type.Literal("continue"), Type.Literal("pause"), Type.Literal("terminate"), Type.Literal("sessions"), ], { description: "Debug action" }), program: Type.Optional(Type.String({ maxLength: 1000, description: "Program path for launch" })), file: Type.Optional(Type.String({ maxLength: 1000 })), line: Type.Optional(Type.Integer({ minimum: 1 })), }); const DETAILS = { owner: "omp-debug-dap", ported: false, requestedSurface: "tools-debug.debug", redesignRequired: true, } as const; const REPORT = [ "debug is disabled in tools-debug.", "The previous local Node subprocess wrapper did not provide real debugger control.", "Port or thin-wrap the OMP DAP debug tool before enabling launch, attach, breakpoints, stepping, pause, output, or terminate.", ].join(" "); export default function debugTool(pi: ExtensionAPI): void { pi.registerTool({ name: "debug", description: "Disabled debug shell until the OMP DAP debug tool is ported.", parameters: DebugParams, execute(_toolCallId, params) { const valid = validateParams(DebugParams, params); if (!valid.ok) return valid.result; if (valid.value.action === "sessions") return debugStatus(); return debugBlocked(valid.value.action); }, }); } function debugStatus(): ToolResult { return textResult(REPORT, { ...DETAILS, requestedAction: "sessions" }); } function debugBlocked(action: string): ToolResult { return errorResult(REPORT, { ...DETAILS, requestedAction: action }); }