refactor: trim system infra exports

This commit is contained in:
Peter Steinberger
2026-05-01 23:55:22 +01:00
parent bf0f4080ef
commit 536e4f49bc
12 changed files with 21 additions and 24 deletions

View File

@@ -194,12 +194,12 @@ function probeLoginShellEnv(params: {
}
}
export type ShellEnvFallbackResult =
type ShellEnvFallbackResult =
| { ok: true; applied: string[]; skippedReason?: never }
| { ok: true; applied: []; skippedReason: "already-has-keys" | "disabled" }
| { ok: false; error: string; applied: [] };
export type ShellEnvFallbackOptions = {
type ShellEnvFallbackOptions = {
enabled: boolean;
env: NodeJS.ProcessEnv;
expectedKeys: string[];

View File

@@ -51,7 +51,7 @@ const SHELL_WRAPPER_SPECS: ReadonlyArray<ShellWrapperSpec> = [
{ kind: "powershell", names: POWERSHELL_WRAPPER_CANONICAL },
];
export type ShellWrapperCommand = {
type ShellWrapperCommand = {
isWrapper: boolean;
command: string | null;
};
@@ -158,7 +158,7 @@ function findShellWrapperSpec(baseExecutable: string): ShellWrapperSpec | null {
return null;
}
export type ShellMultiplexerUnwrapResult =
type ShellMultiplexerUnwrapResult =
| { kind: "not-wrapper" }
| { kind: "blocked"; wrapper: string }
| { kind: "unwrapped"; wrapper: string; argv: string[] };

View File

@@ -26,7 +26,7 @@ export type SystemPresence = {
ts: number;
};
export type SystemPresenceUpdate = {
type SystemPresenceUpdate = {
key: string;
previous?: SystemPresence;
next: SystemPresence;

View File

@@ -11,7 +11,7 @@ import {
resolveInlineCommandMatch,
} from "./shell-inline-command.js";
export type SystemRunCommandValidation =
type SystemRunCommandValidation =
| {
ok: true;
shellPayload: string | null;
@@ -24,7 +24,7 @@ export type SystemRunCommandValidation =
details?: Record<string, unknown>;
};
export type ResolvedSystemRunCommand =
type ResolvedSystemRunCommand =
| {
ok: true;
argv: string[];

View File

@@ -1,7 +1,7 @@
import { isIpInCidr } from "../shared/net/ip.js";
import { listExternalInterfaceAddresses, readNetworkInterfaces } from "./network-interfaces.js";
export type TailnetAddresses = {
type TailnetAddresses = {
ipv4: string[];
ipv6: string[];
};

View File

@@ -166,7 +166,7 @@ export function getTestTailscaleBinaryOverride(
return null;
}
export async function getTailscaleBinary(): Promise<string> {
async function getTailscaleBinary(): Promise<string> {
const forcedBinary = getTestTailscaleBinaryOverride();
if (forcedBinary) {
cachedTailscaleBinary = forcedBinary;

View File

@@ -8,7 +8,7 @@ const logger = createSubsystemLogger("infra:temp-download");
export { resolvePreferredOpenClawTmpDir } from "./tmp-openclaw-dir.js";
export type TempDownloadTarget = {
type TempDownloadTarget = {
dir: string;
path: string;
cleanup: () => Promise<void>;

View File

@@ -21,7 +21,7 @@ export type CommandRunner = (
options: { timeoutMs: number; cwd?: string; env?: NodeJS.ProcessEnv },
) => Promise<{ stdout: string; stderr: string; code: number | null }>;
export type ResolvedGlobalInstallCommand = {
type ResolvedGlobalInstallCommand = {
manager: GlobalInstallManager;
command: string;
};

View File

@@ -4,9 +4,9 @@ import path from "node:path";
import { detectPackageManager as detectPackageManagerImpl } from "./detect-package-manager.js";
import { applyPathPrepend } from "./path-prepend.js";
export type BuildManager = "pnpm" | "bun" | "npm";
type BuildManager = "pnpm" | "bun" | "npm";
export type UpdatePackageManagerRequirement = "allow-fallback" | "require-preferred";
type UpdatePackageManagerRequirement = "allow-fallback" | "require-preferred";
export type UpdatePackageManagerFailureReason =
| "preferred-manager-unavailable"
@@ -19,7 +19,7 @@ export type PackageManagerCommandRunner = (
options: { timeoutMs: number; env?: NodeJS.ProcessEnv },
) => Promise<{ stdout: string; stderr: string; code: number | null }>;
export type ResolvedBuildManager =
type ResolvedBuildManager =
| {
kind: "resolved";
manager: BuildManager;
@@ -34,7 +34,7 @@ export type ResolvedBuildManager =
reason: UpdatePackageManagerFailureReason;
};
export async function detectBuildManager(root: string): Promise<BuildManager> {
async function detectBuildManager(root: string): Promise<BuildManager> {
return (await detectPackageManagerImpl(root)) ?? "npm";
}

View File

@@ -7,12 +7,12 @@ import {
} from "../routing/session-key.js";
import { createAsyncLock, readJsonFile, writeJsonAtomic } from "./json-files.js";
export type VoiceWakeRouteTarget =
type VoiceWakeRouteTarget =
| { mode: "current"; agentId?: undefined; sessionKey?: undefined }
| { agentId: string; sessionKey?: undefined; mode?: undefined }
| { sessionKey: string; agentId?: undefined; mode?: undefined };
export type VoiceWakeRouteRule = {
type VoiceWakeRouteRule = {
trigger: string;
target: VoiceWakeRouteTarget;
};
@@ -288,12 +288,9 @@ export async function setVoiceWakeRoutingConfig(
});
}
export type VoiceWakeResolvedRoute =
| { mode: "current" }
| { agentId: string }
| { sessionKey: string };
type VoiceWakeResolvedRoute = { mode: "current" } | { agentId: string } | { sessionKey: string };
export function resolveVoiceWakeRouteTarget(
function resolveVoiceWakeRouteTarget(
routeTarget: VoiceWakeRouteTarget | undefined,
): VoiceWakeResolvedRoute {
if (!routeTarget || ("mode" in routeTarget && routeTarget.mode === "current")) {

View File

@@ -3,7 +3,7 @@ import { resolveStateDir } from "../config/paths.js";
import { normalizeOptionalString } from "../shared/string-coerce.js";
import { createAsyncLock, readJsonFile, writeJsonAtomic } from "./json-files.js";
export type VoiceWakeConfig = {
type VoiceWakeConfig = {
triggers: string[];
updatedAtMs: number;
};

View File

@@ -18,7 +18,7 @@ type WindowsInstallRootsTestOverrides = {
isReadableFile?: IsReadableFile;
};
export type WindowsInstallRoots = {
type WindowsInstallRoots = {
systemRoot: string;
programFiles: string;
programFilesX86: string;