refactor(agents): narrow runtime guard exports · openclaw/openclaw@d1ea170
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -27,7 +27,7 @@ export function truncateErrorDetail(detail: string, limit = 220): string {
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** Redacts secrets before preserving a bounded provider error body preview. */ |
30 | | -export function redactProviderErrorBody(body: string): string { |
| 30 | +function redactProviderErrorBody(body: string): string { |
31 | 31 | return truncateErrorDetail(redactSensitiveText(body), ERROR_BODY_METADATA_LIMIT); |
32 | 32 | } |
33 | 33 | |
@@ -145,7 +145,7 @@ function extractProviderErrorPayloadMetadata(payload: unknown): ProviderErrorPay
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** Metadata extracted from a non-2xx provider response body and headers. */ |
148 | | -export type ProviderHttpErrorInfo = { |
| 148 | +type ProviderHttpErrorInfo = { |
149 | 149 | detail?: string; |
150 | 150 | code?: string; |
151 | 151 | type?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,8 +9,8 @@ import { parseStrictPositiveInteger } from "../infra/parse-finite-number.js";
|
9 | 9 | // Cleanup steps must not block run completion forever. This module bounds each |
10 | 10 | // cleanup step and logs enough context to debug late failures. |
11 | 11 | export const AGENT_CLEANUP_STEP_TIMEOUT_MS = 10_000; |
12 | | -export const AGENT_CLEANUP_STEP_TIMEOUT_ENV = "OPENCLAW_AGENT_CLEANUP_TIMEOUT_MS"; |
13 | | -export const TRAJECTORY_FLUSH_TIMEOUT_ENV = "OPENCLAW_TRAJECTORY_FLUSH_TIMEOUT_MS"; |
| 12 | +const AGENT_CLEANUP_STEP_TIMEOUT_ENV = "OPENCLAW_AGENT_CLEANUP_TIMEOUT_MS"; |
| 13 | +const TRAJECTORY_FLUSH_TIMEOUT_ENV = "OPENCLAW_TRAJECTORY_FLUSH_TIMEOUT_MS"; |
14 | 14 | export const CLEANUP_TIMEOUT_DETAILS_MAX_CHARS = 512; |
15 | 15 | |
16 | 16 | const CLEANUP_TIMEOUT_DETAILS_TRUNCATED_SUFFIX = "...[truncated]"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,7 @@
|
5 | 5 | * controller aborts without matching free-form error text. |
6 | 6 | */ |
7 | 7 | /** Stop reason emitted when an agent run is aborted. */ |
8 | | -export const AGENT_RUN_ABORTED_STOP_REASON = "aborted" as const; |
| 8 | +const AGENT_RUN_ABORTED_STOP_REASON = "aborted" as const; |
9 | 9 | /** Error text used for aborted agent runs. */ |
10 | 10 | export const AGENT_RUN_ABORTED_ERROR = "agent run aborted" as const; |
11 | 11 | export const AGENT_RUN_RESTART_ABORT_STOP_REASON = "restart" as const; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | /** Agent run phases used when attributing timeout/cancellation sources. */ |
2 | | -export const AGENT_RUN_TIMEOUT_PHASES = [ |
| 2 | +const AGENT_RUN_TIMEOUT_PHASES = [ |
3 | 3 | "queue", |
4 | 4 | "preflight", |
5 | 5 | "provider", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -46,9 +46,9 @@ type CleanupSignal = (typeof CLEANUP_SIGNALS)[number];
|
46 | 46 | const CLEANUP_STATE_KEY = Symbol.for("openclaw.sessionWriteLockCleanupState"); |
47 | 47 | const WATCHDOG_STATE_KEY = Symbol.for("openclaw.sessionWriteLockWatchdogState"); |
48 | 48 | |
49 | | -export const DEFAULT_SESSION_WRITE_LOCK_STALE_MS = 30 * 60 * 1000; |
50 | | -export const DEFAULT_SESSION_WRITE_LOCK_MAX_HOLD_MS = 5 * 60 * 1000; |
51 | | -export const DEFAULT_SESSION_WRITE_LOCK_ACQUIRE_TIMEOUT_MS = 60_000; |
| 49 | +const DEFAULT_SESSION_WRITE_LOCK_STALE_MS = 30 * 60 * 1000; |
| 50 | +const DEFAULT_SESSION_WRITE_LOCK_MAX_HOLD_MS = 5 * 60 * 1000; |
| 51 | +const DEFAULT_SESSION_WRITE_LOCK_ACQUIRE_TIMEOUT_MS = 60_000; |
52 | 52 | const DEFAULT_WATCHDOG_INTERVAL_MS = 60_000; |
53 | 53 | const DEFAULT_TIMEOUT_GRACE_MS = 2 * 60 * 1000; |
54 | 54 | const REPORT_ONLY_STALE_LOCK_REASONS = new Set(["too-old", "hold-exceeded"]); |
@@ -189,7 +189,7 @@ export function resolveSessionWriteLockStaleMs(
|
189 | 189 | }); |
190 | 190 | } |
191 | 191 | |
192 | | -export function resolveSessionWriteLockMaxHoldMs( |
| 192 | +function resolveSessionWriteLockMaxHoldMs( |
193 | 193 | config?: SessionWriteLockAcquireTimeoutConfig, |
194 | 194 | params: { env?: NodeJS.ProcessEnv; fallback?: number } = {}, |
195 | 195 | ): number { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。