mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-25 23:47:20 +00:00
Gateway: treat scope-limited probe RPC as degraded reachability (#45622)
* Gateway: treat scope-limited probe RPC as degraded * Docs: clarify gateway probe degraded scope output * test: fix CI type regressions in gateway and outbound suites * Tests: fix Node24 diffs theme loading and Windows assertions * Tests: fix extension typing after main rebase * Tests: fix Windows CI regressions after rebase * Tests: normalize executable path assertions on Windows * Tests: remove duplicate gateway daemon result alias * Tests: stabilize Windows approval path assertions * Tests: fix Discord rate-limit startup fixture typing * Tests: use Windows-friendly relative exec fixtures --------- Co-authored-by: Mainframe <mainframe@MainfraacStudio.localdomain>
This commit is contained in:
@@ -1,5 +1,12 @@
|
||||
import type { FileContents, FileDiffMetadata, SupportedLanguages } from "@pierre/diffs";
|
||||
import { parsePatchFiles } from "@pierre/diffs";
|
||||
import fs from "node:fs/promises";
|
||||
import { createRequire } from "node:module";
|
||||
import type {
|
||||
FileContents,
|
||||
FileDiffMetadata,
|
||||
SupportedLanguages,
|
||||
ThemeRegistrationResolved,
|
||||
} from "@pierre/diffs";
|
||||
import { RegisteredCustomThemes, parsePatchFiles } from "@pierre/diffs";
|
||||
import { preloadFileDiff, preloadMultiFileDiff } from "@pierre/diffs/ssr";
|
||||
import type {
|
||||
DiffInput,
|
||||
@@ -13,6 +20,45 @@ import { VIEWER_LOADER_PATH } from "./viewer-assets.js";
|
||||
const DEFAULT_FILE_NAME = "diff.txt";
|
||||
const MAX_PATCH_FILE_COUNT = 128;
|
||||
const MAX_PATCH_TOTAL_LINES = 120_000;
|
||||
const diffsRequire = createRequire(import.meta.resolve("@pierre/diffs"));
|
||||
|
||||
let pierreThemesPatched = false;
|
||||
|
||||
function createThemeLoader(
|
||||
themeName: "pierre-dark" | "pierre-light",
|
||||
themePath: string,
|
||||
): () => Promise<ThemeRegistrationResolved> {
|
||||
let cachedTheme: ThemeRegistrationResolved | undefined;
|
||||
return async () => {
|
||||
if (cachedTheme) {
|
||||
return cachedTheme;
|
||||
}
|
||||
const raw = await fs.readFile(themePath, "utf8");
|
||||
const parsed = JSON.parse(raw) as Record<string, unknown>;
|
||||
cachedTheme = {
|
||||
...parsed,
|
||||
name: themeName,
|
||||
} as ThemeRegistrationResolved;
|
||||
return cachedTheme;
|
||||
};
|
||||
}
|
||||
|
||||
function patchPierreThemeLoadersForNode24(): void {
|
||||
if (pierreThemesPatched) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const darkThemePath = diffsRequire.resolve("@pierre/theme/themes/pierre-dark.json");
|
||||
const lightThemePath = diffsRequire.resolve("@pierre/theme/themes/pierre-light.json");
|
||||
RegisteredCustomThemes.set("pierre-dark", createThemeLoader("pierre-dark", darkThemePath));
|
||||
RegisteredCustomThemes.set("pierre-light", createThemeLoader("pierre-light", lightThemePath));
|
||||
pierreThemesPatched = true;
|
||||
} catch {
|
||||
// Keep upstream loaders if theme files cannot be resolved.
|
||||
}
|
||||
}
|
||||
|
||||
patchPierreThemeLoadersForNode24();
|
||||
|
||||
function escapeCssString(value: string): string {
|
||||
return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"');
|
||||
|
||||
Reference in New Issue
Block a user