From 45dee50c28604a2b8e4ac8cfdaf6b304afce8880 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 23:33:55 +0100 Subject: [PATCH] refactor: trim exec infra exports --- src/infra/dispatch-wrapper-resolution.ts | 6 +++--- src/infra/exec-approval-forwarder.ts | 4 +--- src/infra/exec-approvals-effective.ts | 6 +++--- src/infra/exec-approvals-test-helpers.ts | 4 ++-- src/infra/exec-host.ts | 2 +- src/infra/exec-inline-eval.ts | 2 +- src/infra/exec-safe-bin-runtime-policy.ts | 2 +- src/infra/exec-safe-bin-semantics.ts | 4 ++-- src/infra/exec-wrapper-trust-plan.ts | 2 +- src/infra/executable-path.ts | 2 +- 10 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/infra/dispatch-wrapper-resolution.ts b/src/infra/dispatch-wrapper-resolution.ts index 91b75a38bcc..5f21f7ce0da 100644 --- a/src/infra/dispatch-wrapper-resolution.ts +++ b/src/infra/dispatch-wrapper-resolution.ts @@ -82,7 +82,7 @@ function isKnownArchNameToken(token: string): boolean { type WrapperScanDirective = "continue" | "consume-next" | "stop" | "invalid"; -export function isEnvAssignment(token: string): boolean { +function isEnvAssignment(token: string): boolean { return /^[A-Za-z_][A-Za-z0-9_]*=.*/.test(token); } @@ -531,12 +531,12 @@ const DISPATCH_WRAPPER_SPEC_BY_NAME = new Map( DISPATCH_WRAPPER_SPECS.map((spec) => [spec.name, spec] as const), ); -export type DispatchWrapperUnwrapResult = +type DispatchWrapperUnwrapResult = | { kind: "not-wrapper" } | { kind: "blocked"; wrapper: string } | { kind: "unwrapped"; wrapper: string; argv: string[] }; -export type DispatchWrapperTrustPlan = { +type DispatchWrapperTrustPlan = { argv: string[]; wrappers: string[]; policyBlocked: boolean; diff --git a/src/infra/exec-approval-forwarder.ts b/src/infra/exec-approval-forwarder.ts index 282249278aa..e439684ed05 100644 --- a/src/infra/exec-approval-forwarder.ts +++ b/src/infra/exec-approval-forwarder.ts @@ -40,8 +40,6 @@ import { } from "./plugin-approvals.js"; const log = createSubsystemLogger("gateway/exec-approvals"); -export type { ExecApprovalRequest, ExecApprovalResolved }; - type DeliverOutboundPayloads = typeof import("./outbound/deliver.js").deliverOutboundPayloads; type MaybePromise = T | Promise; type ResolveSessionTargetFn = (params: { @@ -126,7 +124,7 @@ export type ExecApprovalForwarder = { stop: () => void; }; -export type ExecApprovalForwarderDeps = { +type ExecApprovalForwarderDeps = { getConfig?: () => OpenClawConfig; deliver?: DeliverOutboundPayloads; nowMs?: () => number; diff --git a/src/infra/exec-approvals-effective.ts b/src/infra/exec-approvals-effective.ts index 4b23345e4a5..c5e082b2b2a 100644 --- a/src/infra/exec-approvals-effective.ts +++ b/src/infra/exec-approvals-effective.ts @@ -26,12 +26,12 @@ type ExecPolicyConfig = { ask?: ExecAsk; }; -export type ExecPolicyHostSummary = { +type ExecPolicyHostSummary = { requested: ExecTarget; requestedSource: string; }; -export type ExecPolicyFieldSummary = { +type ExecPolicyFieldSummary = { requested: TValue; requestedSource: string; host: TValue; @@ -54,7 +54,7 @@ export type ExecPolicyScopeSnapshot = { allowedDecisions: readonly ExecApprovalDecision[]; }; -export type ExecPolicyScopeSummary = Omit; +type ExecPolicyScopeSummary = Omit; type ExecPolicyRequestedField = "security" | "ask"; diff --git a/src/infra/exec-approvals-test-helpers.ts b/src/infra/exec-approvals-test-helpers.ts index e39e93c5e3c..850d27a88da 100644 --- a/src/infra/exec-approvals-test-helpers.ts +++ b/src/infra/exec-approvals-test-helpers.ts @@ -64,7 +64,7 @@ export function makeMockCommandResolution(params: { }); } -export type ShellParserParityFixtureCase = { +type ShellParserParityFixtureCase = { id: string; command: string; ok: boolean; @@ -75,7 +75,7 @@ type ShellParserParityFixture = { cases: ShellParserParityFixtureCase[]; }; -export type WrapperResolutionParityFixtureCase = { +type WrapperResolutionParityFixtureCase = { id: string; argv: string[]; expectedRawExecutable: string | null; diff --git a/src/infra/exec-host.ts b/src/infra/exec-host.ts index ee0a128d92b..df749c4f6d3 100644 --- a/src/infra/exec-host.ts +++ b/src/infra/exec-host.ts @@ -22,7 +22,7 @@ export type ExecHostRunResult = { error?: string | null; }; -export type ExecHostError = { +type ExecHostError = { code: string; message: string; reason?: string; diff --git a/src/infra/exec-inline-eval.ts b/src/infra/exec-inline-eval.ts index db7ee1907d3..68fd8776fe2 100644 --- a/src/infra/exec-inline-eval.ts +++ b/src/infra/exec-inline-eval.ts @@ -1,7 +1,7 @@ import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js"; import { normalizeExecutableToken } from "./exec-wrapper-resolution.js"; -export type InterpreterInlineEvalHit = { +type InterpreterInlineEvalHit = { executable: string; normalizedExecutable: string; flag: string; diff --git a/src/infra/exec-safe-bin-runtime-policy.ts b/src/infra/exec-safe-bin-runtime-policy.ts index af60fe0a71e..81f7c2447fd 100644 --- a/src/infra/exec-safe-bin-runtime-policy.ts +++ b/src/infra/exec-safe-bin-runtime-policy.ts @@ -14,7 +14,7 @@ import { type WritableTrustedSafeBinDir, } from "./exec-safe-bin-trust.js"; -export type ExecSafeBinConfigScope = { +type ExecSafeBinConfigScope = { safeBins?: string[] | null; safeBinProfiles?: SafeBinProfileFixtures | null; safeBinTrustedDirs?: string[] | null; diff --git a/src/infra/exec-safe-bin-semantics.ts b/src/infra/exec-safe-bin-semantics.ts index 7e97a38fcba..63eddfb1814 100644 --- a/src/infra/exec-safe-bin-semantics.ts +++ b/src/infra/exec-safe-bin-semantics.ts @@ -1,6 +1,6 @@ import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js"; -export type SafeBinSemanticValidationParams = { +type SafeBinSemanticValidationParams = { binName?: string; positional: readonly string[]; }; @@ -64,7 +64,7 @@ export function normalizeSafeBinName(raw: string): string { return normalized.replace(/\.(?:exe|cmd|bat|com)$/i, ""); } -export function getSafeBinSemanticRule(binName?: string): SafeBinSemanticRule | undefined { +function getSafeBinSemanticRule(binName?: string): SafeBinSemanticRule | undefined { const normalized = typeof binName === "string" ? normalizeSafeBinName(binName) : ""; return normalized ? SAFE_BIN_SEMANTIC_RULES[normalized] : undefined; } diff --git a/src/infra/exec-wrapper-trust-plan.ts b/src/infra/exec-wrapper-trust-plan.ts index 104db97e133..bad51530746 100644 --- a/src/infra/exec-wrapper-trust-plan.ts +++ b/src/infra/exec-wrapper-trust-plan.ts @@ -9,7 +9,7 @@ import { unwrapKnownShellMultiplexerInvocation, } from "./shell-wrapper-resolution.js"; -export type ExecWrapperTrustPlan = { +type ExecWrapperTrustPlan = { argv: string[]; policyArgv: string[]; wrapperChain: string[]; diff --git a/src/infra/executable-path.ts b/src/infra/executable-path.ts index 938c78c818e..39c5910d038 100644 --- a/src/infra/executable-path.ts +++ b/src/infra/executable-path.ts @@ -3,7 +3,7 @@ import path from "node:path"; import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js"; import { expandHomePrefix } from "./home-dir.js"; -export function isDriveLessWindowsRootedPath(value: string): boolean { +function isDriveLessWindowsRootedPath(value: string): boolean { return process.platform === "win32" && /^:[\\/]/.test(value); }