mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
refactor(deadcode): localize Parallels helpers (#101889)
This commit is contained in:
parent
3d442153f6
commit
e7365d41d3
5 changed files with 9 additions and 9 deletions
|
|
@ -23,7 +23,7 @@ export function resolveHostIp(explicit = ""): string {
|
|||
return output;
|
||||
}
|
||||
|
||||
export function allocateHostPort(): number {
|
||||
function allocateHostPort(): number {
|
||||
return Number(
|
||||
run(
|
||||
"python3",
|
||||
|
|
@ -36,7 +36,7 @@ export function allocateHostPort(): number {
|
|||
);
|
||||
}
|
||||
|
||||
export async function isHostPortFree(port: number): Promise<boolean> {
|
||||
async function isHostPortFree(port: number): Promise<boolean> {
|
||||
return await new Promise((resolve) => {
|
||||
const server = createServer();
|
||||
server.once("error", () => resolve(false));
|
||||
|
|
|
|||
|
|
@ -17,13 +17,13 @@ export interface EnsureVmRunningOptions extends WaitForVmStatusOptions {
|
|||
transitionTimeoutMs?: () => number | undefined;
|
||||
}
|
||||
|
||||
export function listVmNames(): string[] {
|
||||
function listVmNames(): string[] {
|
||||
return listVms()
|
||||
.map((item) => (item.name ?? "").trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
export function vmStatus(vmName: string, timeoutMs?: number): string {
|
||||
function vmStatus(vmName: string, timeoutMs?: number): string {
|
||||
return listVms(timeoutMs).find((vm) => vm.name === vmName)?.status || "missing";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ export function windowsCodexPlatformPackageRepairFunction(): string {
|
|||
}`;
|
||||
}
|
||||
|
||||
export function providerOnlyPluginId(modelId: string, fallbackPluginId: string): string {
|
||||
function providerOnlyPluginId(modelId: string, fallbackPluginId: string): string {
|
||||
return providerIdFromModelId(modelId) || fallbackPluginId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export function resolveParallelsModelTimeoutSeconds(platform?: Platform): number
|
|||
return readPositiveIntEnv("OPENCLAW_PARALLELS_MODEL_TIMEOUT_S", defaultSeconds);
|
||||
}
|
||||
|
||||
export function providerTimeoutConfigJson(
|
||||
function providerTimeoutConfigJson(
|
||||
modelId: string,
|
||||
platform: Platform,
|
||||
timeoutSeconds = resolveParallelsModelTimeoutSeconds(platform),
|
||||
|
|
@ -128,7 +128,7 @@ export function providerTimeoutConfigJson(
|
|||
});
|
||||
}
|
||||
|
||||
export function modelTransportConfigJson(modelId: string): string {
|
||||
function modelTransportConfigJson(modelId: string): string {
|
||||
if (providerIdFromModelId(modelId) !== "openai") {
|
||||
return "";
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ export function modelTransportConfigJson(modelId: string): string {
|
|||
});
|
||||
}
|
||||
|
||||
export function configPathMapKey(key: string): string {
|
||||
function configPathMapKey(key: string): string {
|
||||
return `[${JSON.stringify(key)}]`;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export function resolveSnapshot(vmName: string, hint: string): SnapshotInfo {
|
|||
return best;
|
||||
}
|
||||
|
||||
export function stringSimilarity(a: string, b: string): number {
|
||||
function stringSimilarity(a: string, b: string): number {
|
||||
if (a === b) {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue