From 77f1c71e8c5271e6654e6527a62eecffd69f6450 Mon Sep 17 00:00:00 2001 From: thororen <78185467+thororen1234@users.noreply.github.com> Date: Tue, 22 Sep 2026 23:38:25 -0400 Subject: [PATCH] dev companion updates --- src/plugins/devCompanion.dev/index.tsx | 2 +- src/plugins/devCompanion.dev/initWs.tsx | 19 ++++++++++++++++--- src/plugins/devCompanion.dev/types/send.ts | 7 ++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/plugins/devCompanion.dev/index.tsx b/src/plugins/devCompanion.dev/index.tsx index da7b42ebd..1b921f596 100644 --- a/src/plugins/devCompanion.dev/index.tsx +++ b/src/plugins/devCompanion.dev/index.tsx @@ -23,7 +23,7 @@ import definePlugin, { OptionType, ReporterTestable } from "@utils/types"; import { initWs, socket, stopWs } from "./initWs"; export const PORT = 8485; -export const CLIENT_VERSION: readonly [major: number, minor: number, patch: number] = [0, 1, 2]; +export const CLIENT_VERSION: readonly [major: number, minor: number, patch: number] = [0, 1, 3]; export const logger = new Logger("DevCompanion"); diff --git a/src/plugins/devCompanion.dev/initWs.tsx b/src/plugins/devCompanion.dev/initWs.tsx index 4908524d1..b54218e8e 100644 --- a/src/plugins/devCompanion.dev/initWs.tsx +++ b/src/plugins/devCompanion.dev/initWs.tsx @@ -122,12 +122,25 @@ export function initWs(isManual = false) { /** * @param error the error to reply with. if there is no error, the reply is a sucess */ - function reply(error?: string) { - const toSend = { nonce: d.nonce, ok: !error } as Record; - if (error) toSend.error = error; + function replyError(error: string) { + const toSend = { nonce: d.nonce, ok: false, error } as Record; logger.debug("Replying with:", toSend); ws.send(JSON.stringify(toSend)); } + function replyOk() { + const toSend = { + nonce: d.nonce, + ok: true, + type: "genericOk", + data: {}, + } as Record; + logger.debug("Replying with:", toSend); + ws.send(JSON.stringify(toSend)); + } + function reply(error?: string) { + if (error) replyError(error); + else replyOk(); + } function replyData(data: OutgoingMessage) { const toSend: FullOutgoingMessage = { ...data, diff --git a/src/plugins/devCompanion.dev/types/send.ts b/src/plugins/devCompanion.dev/types/send.ts index e9439e631..3f954579b 100644 --- a/src/plugins/devCompanion.dev/types/send.ts +++ b/src/plugins/devCompanion.dev/types/send.ts @@ -6,7 +6,7 @@ import { ReporterData } from "@debug/reporterData"; -export type OutgoingMessage = Base; +export type OutgoingMessage = Base; export type FullOutgoingMessage = OutgoingMessage & Nonce; export type Base = ({ @@ -32,6 +32,11 @@ export type ModuleResult = { patchedBy: string[]; }; +export type GenericOk = { + type: "genericOk"; + data: {}; +}; + // #region valid payloads export type I18nValue = { type: "i18n";