Skip to content

Commit d1ea170

Browse files
committed
refactor(agents): narrow runtime guard exports
1 parent 9166165 commit d1ea170

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/agents/provider-http-errors.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function truncateErrorDetail(detail: string, limit = 220): string {
2727
}
2828

2929
/** Redacts secrets before preserving a bounded provider error body preview. */
30-
export function redactProviderErrorBody(body: string): string {
30+
function redactProviderErrorBody(body: string): string {
3131
return truncateErrorDetail(redactSensitiveText(body), ERROR_BODY_METADATA_LIMIT);
3232
}
3333

@@ -145,7 +145,7 @@ function extractProviderErrorPayloadMetadata(payload: unknown): ProviderErrorPay
145145
}
146146

147147
/** Metadata extracted from a non-2xx provider response body and headers. */
148-
export type ProviderHttpErrorInfo = {
148+
type ProviderHttpErrorInfo = {
149149
detail?: string;
150150
code?: string;
151151
type?: string;

src/agents/run-cleanup-timeout.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import { parseStrictPositiveInteger } from "../infra/parse-finite-number.js";
99
// Cleanup steps must not block run completion forever. This module bounds each
1010
// cleanup step and logs enough context to debug late failures.
1111
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";
1414
export const CLEANUP_TIMEOUT_DETAILS_MAX_CHARS = 512;
1515

1616
const CLEANUP_TIMEOUT_DETAILS_TRUNCATED_SUFFIX = "...[truncated]";

src/agents/run-termination.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* controller aborts without matching free-form error text.
66
*/
77
/** 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;
99
/** Error text used for aborted agent runs. */
1010
export const AGENT_RUN_ABORTED_ERROR = "agent run aborted" as const;
1111
export const AGENT_RUN_RESTART_ABORT_STOP_REASON = "restart" as const;

src/agents/run-timeout-attribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/** Agent run phases used when attributing timeout/cancellation sources. */
2-
export const AGENT_RUN_TIMEOUT_PHASES = [
2+
const AGENT_RUN_TIMEOUT_PHASES = [
33
"queue",
44
"preflight",
55
"provider",

src/agents/session-write-lock.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ type CleanupSignal = (typeof CLEANUP_SIGNALS)[number];
4646
const CLEANUP_STATE_KEY = Symbol.for("openclaw.sessionWriteLockCleanupState");
4747
const WATCHDOG_STATE_KEY = Symbol.for("openclaw.sessionWriteLockWatchdogState");
4848

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;
5252
const DEFAULT_WATCHDOG_INTERVAL_MS = 60_000;
5353
const DEFAULT_TIMEOUT_GRACE_MS = 2 * 60 * 1000;
5454
const REPORT_ONLY_STALE_LOCK_REASONS = new Set(["too-old", "hold-exceeded"]);
@@ -189,7 +189,7 @@ export function resolveSessionWriteLockStaleMs(
189189
});
190190
}
191191

192-
export function resolveSessionWriteLockMaxHoldMs(
192+
function resolveSessionWriteLockMaxHoldMs(
193193
config?: SessionWriteLockAcquireTimeoutConfig,
194194
params: { env?: NodeJS.ProcessEnv; fallback?: number } = {},
195195
): number {

0 commit comments

Comments
 (0)