From e165b7595832850866f344031dd54b8c670bddd3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 00:01:18 +0100 Subject: [PATCH] refactor: trim logging helper exports --- src/interactive/payload.ts | 2 +- src/link-understanding/apply.ts | 2 +- src/link-understanding/runner.ts | 2 +- src/logging/diagnostic-memory.ts | 2 +- src/logging/diagnostic-stability.ts | 8 ++++---- src/logging/diagnostic-support-bundle.ts | 10 +++++----- src/logging/log-file-path.ts | 2 +- src/logging/parse-log-line.ts | 2 +- src/logging/redact-bounded.ts | 4 ++-- src/logging/timestamps.ts | 4 ++-- src/markdown/code-spans.ts | 2 +- src/markdown/frontmatter.ts | 2 +- 12 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/interactive/payload.ts b/src/interactive/payload.ts index 71c7ae0828f..87947b1c888 100644 --- a/src/interactive/payload.ts +++ b/src/interactive/payload.ts @@ -22,7 +22,7 @@ export type InteractiveReplyTextBlock = { text: string; }; -export type InteractiveReplyButtonsBlock = { +type InteractiveReplyButtonsBlock = { type: "buttons"; buttons: InteractiveReplyButton[]; }; diff --git a/src/link-understanding/apply.ts b/src/link-understanding/apply.ts index 26f56d94711..f0cd15de248 100644 --- a/src/link-understanding/apply.ts +++ b/src/link-understanding/apply.ts @@ -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[]; }; diff --git a/src/link-understanding/runner.ts b/src/link-understanding/runner.ts index d3b3a8ef85c..1d2bb5b4ee7 100644 --- a/src/link-understanding/runner.ts +++ b/src/link-understanding/runner.ts @@ -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[]; }; diff --git a/src/logging/diagnostic-memory.ts b/src/logging/diagnostic-memory.ts index 957dab97a29..a01f96865bf 100644 --- a/src/logging/diagnostic-memory.ts +++ b/src/logging/diagnostic-memory.ts @@ -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; diff --git a/src/logging/diagnostic-stability.ts b/src/logging/diagnostic-stability.ts index 01bc9125b60..d47da20c15f 100644 --- a/src/logging/diagnostic-stability.ts +++ b/src/logging/diagnostic-stability.ts @@ -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; diff --git a/src/logging/diagnostic-support-bundle.ts b/src/logging/diagnostic-support-bundle.ts index 815e6921f93..f320efde35e 100644 --- a/src/logging/diagnostic-support-bundle.ts +++ b/src/logging/diagnostic-support-bundle.ts @@ -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, { diff --git a/src/logging/log-file-path.ts b/src/logging/log-file-path.ts index cb9b4b615f0..5ed54973966 100644 --- a/src/logging/log-file-path.ts +++ b/src/logging/log-file-path.ts @@ -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}`); } diff --git a/src/logging/parse-log-line.ts b/src/logging/parse-log-line.ts index 442357b8ef2..02761d11846 100644 --- a/src/logging/parse-log-line.ts +++ b/src/logging/parse-log-line.ts @@ -1,6 +1,6 @@ import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; -export type ParsedLogLine = { +type ParsedLogLine = { time?: string; level?: string; subsystem?: string; diff --git a/src/logging/redact-bounded.ts b/src/logging/redact-bounded.ts index ff1f4c2ae09..1451d1340d3 100644 --- a/src/logging/redact-bounded.ts +++ b/src/logging/redact-bounded.ts @@ -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; diff --git a/src/logging/timestamps.ts b/src/logging/timestamps.ts index c0937cb79fc..df78ee55cf1 100644 --- a/src/logging/timestamps.ts +++ b/src/logging/timestamps.ts @@ -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; }; diff --git a/src/markdown/code-spans.ts b/src/markdown/code-spans.ts index 1077ee75540..562bfa547fc 100644 --- a/src/markdown/code-spans.ts +++ b/src/markdown/code-spans.ts @@ -14,7 +14,7 @@ type InlineCodeSpansResult = { state: InlineCodeState; }; -export type CodeSpanIndex = { +type CodeSpanIndex = { inlineState: InlineCodeState; isInside: (index: number) => boolean; }; diff --git a/src/markdown/frontmatter.ts b/src/markdown/frontmatter.ts index 845c9cb6203..aa40bd32b69 100644 --- a/src/markdown/frontmatter.ts +++ b/src/markdown/frontmatter.ts @@ -1,6 +1,6 @@ import YAML from "yaml"; -export type ParsedFrontmatter = Record; +type ParsedFrontmatter = Record; type ParsedFrontmatterLineEntry = { value: string;