refactor: trim logging helper exports

This commit is contained in:
Peter Steinberger
2026-05-02 00:01:18 +01:00
parent f64b660b24
commit e165b75958
12 changed files with 21 additions and 21 deletions

View File

@@ -22,7 +22,7 @@ export type InteractiveReplyTextBlock = {
text: string;
};
export type InteractiveReplyButtonsBlock = {
type InteractiveReplyButtonsBlock = {
type: "buttons";
buttons: InteractiveReplyButton[];
};

View File

@@ -4,7 +4,7 @@ import type { OpenClawConfig } from "../config/types.openclaw.js";
import { formatLinkUnderstandingBody } from "./format.js";
import { runLinkUnderstanding } from "./runner.js";
export type ApplyLinkUnderstandingResult = {
type ApplyLinkUnderstandingResult = {
outputs: string[];
urls: string[];
};

View File

@@ -13,7 +13,7 @@ import { runExec } from "../process/exec.js";
import { DEFAULT_LINK_TIMEOUT_SECONDS } from "./defaults.js";
import { extractLinksFromMessage } from "./detect.js";
export type LinkUnderstandingResult = {
type LinkUnderstandingResult = {
urls: string[];
outputs: string[];
};

View File

@@ -14,7 +14,7 @@ const DEFAULT_RSS_GROWTH_CRITICAL_BYTES = 1024 * MB;
const DEFAULT_GROWTH_WINDOW_MS = 10 * 60 * 1000;
const DEFAULT_PRESSURE_REPEAT_MS = 5 * 60 * 1000;
export type DiagnosticMemoryThresholds = {
type DiagnosticMemoryThresholds = {
rssWarningBytes?: number;
rssCriticalBytes?: number;
heapUsedWarningBytes?: number;

View File

@@ -4,8 +4,8 @@ import {
type DiagnosticMemoryUsage,
} from "../infra/diagnostic-events.js";
export const DEFAULT_DIAGNOSTIC_STABILITY_CAPACITY = 1000;
export const DEFAULT_DIAGNOSTIC_STABILITY_LIMIT = 50;
const DEFAULT_DIAGNOSTIC_STABILITY_CAPACITY = 1000;
const DEFAULT_DIAGNOSTIC_STABILITY_LIMIT = 50;
export const MAX_DIAGNOSTIC_STABILITY_LIMIT = DEFAULT_DIAGNOSTIC_STABILITY_CAPACITY;
const SAFE_REASON_CODE = /^[A-Za-z0-9_.:-]{1,120}$/u;
@@ -103,13 +103,13 @@ export type DiagnosticStabilitySnapshot = {
};
};
export type DiagnosticStabilityQueryInput = {
type DiagnosticStabilityQueryInput = {
limit?: unknown;
type?: unknown;
sinceSeq?: unknown;
};
export type NormalizedDiagnosticStabilityQuery = {
type NormalizedDiagnosticStabilityQuery = {
limit: number;
type: string | undefined;
sinceSeq: number | undefined;

View File

@@ -13,7 +13,7 @@ export type DiagnosticSupportBundleContent = {
bytes: number;
};
export function supportBundleByteLength(content: string): number {
function supportBundleByteLength(content: string): number {
return Buffer.byteLength(content, "utf8");
}
@@ -60,7 +60,7 @@ export function supportBundleContents(
}));
}
export function assertSafeBundleRelativePath(pathName: string): string {
function assertSafeBundleRelativePath(pathName: string): string {
const normalized = pathName.replaceAll("\\", "/");
if (
!normalized ||
@@ -72,12 +72,12 @@ export function assertSafeBundleRelativePath(pathName: string): string {
return normalized;
}
export function prepareSupportBundleDirectory(outputDir: string): void {
function prepareSupportBundleDirectory(outputDir: string): void {
fs.mkdirSync(path.dirname(outputDir), { recursive: true, mode: 0o700 });
fs.mkdirSync(outputDir, { mode: 0o700 });
}
export function resolveSupportBundleFilePath(outputDir: string, pathName: string): string {
function resolveSupportBundleFilePath(outputDir: string, pathName: string): string {
const safePath = assertSafeBundleRelativePath(pathName);
const resolvedBase = path.resolve(outputDir);
const resolvedFile = path.resolve(resolvedBase, safePath);
@@ -88,7 +88,7 @@ export function resolveSupportBundleFilePath(outputDir: string, pathName: string
return resolvedFile;
}
export function writeSupportBundleFile(outputDir: string, file: DiagnosticSupportBundleFile): void {
function writeSupportBundleFile(outputDir: string, file: DiagnosticSupportBundleFile): void {
const filePath = resolveSupportBundleFilePath(outputDir, file.path);
fs.mkdirSync(path.dirname(filePath), { recursive: true, mode: 0o700 });
fs.writeFileSync(filePath, file.content, {

View File

@@ -31,7 +31,7 @@ function formatLocalDate(date: Date): string {
return `${year}-${month}-${day}`;
}
export function resolveDefaultRollingLogFile(date = new Date()): string {
function resolveDefaultRollingLogFile(date = new Date()): string {
const logDir = canUseNodeFs() ? resolvePreferredOpenClawTmpDir() : POSIX_OPENCLAW_TMP_DIR;
return path.join(logDir, `${LOG_PREFIX}-${formatLocalDate(date)}${LOG_SUFFIX}`);
}

View File

@@ -1,6 +1,6 @@
import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js";
export type ParsedLogLine = {
type ParsedLogLine = {
time?: string;
level?: string;
subsystem?: string;

View File

@@ -1,5 +1,5 @@
export const REDACT_REGEX_CHUNK_THRESHOLD = 32_768;
export const REDACT_REGEX_CHUNK_SIZE = 16_384;
const REDACT_REGEX_CHUNK_THRESHOLD = 32_768;
const REDACT_REGEX_CHUNK_SIZE = 16_384;
type BoundedRedactOptions = {
chunkThreshold?: number;

View File

@@ -7,9 +7,9 @@ export function isValidTimeZone(tz: string): boolean {
}
}
export type TimestampStyle = "short" | "medium" | "long";
type TimestampStyle = "short" | "medium" | "long";
export type FormatTimestampOptions = {
type FormatTimestampOptions = {
style?: TimestampStyle;
timeZone?: string;
};

View File

@@ -14,7 +14,7 @@ type InlineCodeSpansResult = {
state: InlineCodeState;
};
export type CodeSpanIndex = {
type CodeSpanIndex = {
inlineState: InlineCodeState;
isInside: (index: number) => boolean;
};

View File

@@ -1,6 +1,6 @@
import YAML from "yaml";
export type ParsedFrontmatter = Record<string, string>;
type ParsedFrontmatter = Record<string, string>;
type ParsedFrontmatterLineEntry = {
value: string;