fix(ui): unblock docker onboarding build

This commit is contained in:
Peter Steinberger
2026-02-19 16:32:14 +01:00
parent 30e36c30d4
commit 3077c35831
7 changed files with 241 additions and 22 deletions

View File

@@ -1,4 +1,3 @@
import { inspect } from "node:util";
import { Chalk } from "chalk";
import type { Logger as TsLogger } from "tslog";
import { CHAT_CHANNEL_ORDER } from "../channels/registry.js";
@@ -36,6 +35,39 @@ function shouldLogToConsole(level: LogLevel, settings: { level: LogLevel }): boo
type ChalkInstance = InstanceType<typeof Chalk>;
const inspectValue: ((value: unknown) => string) | null = (() => {
const getBuiltinModule = (
process as NodeJS.Process & {
getBuiltinModule?: (id: string) => unknown;
}
).getBuiltinModule;
if (typeof getBuiltinModule !== "function") {
return null;
}
try {
const utilNamespace = getBuiltinModule("util") as {
inspect?: (value: unknown) => string;
};
return typeof utilNamespace.inspect === "function" ? utilNamespace.inspect : null;
} catch {
return null;
}
})();
function formatRuntimeArg(arg: unknown): string {
if (typeof arg === "string") {
return arg;
}
if (inspectValue) {
return inspectValue(arg);
}
try {
return JSON.stringify(arg);
} catch {
return String(arg);
}
}
function isRichConsoleEnv(): boolean {
const term = (process.env.TERM ?? "").toLowerCase();
if (process.env.COLORTERM || process.env.TERM_PROGRAM) {
@@ -323,7 +355,7 @@ export function runtimeForLogger(
): RuntimeEnv {
const formatArgs = (...args: unknown[]) =>
args
.map((arg) => (typeof arg === "string" ? arg : inspect(arg)))
.map((arg) => formatRuntimeArg(arg))
.join(" ")
.trim();
return {