refactor: remove duplicate sleep() definitions in fly and daytona modules (#1944)

Both fly.ts and daytona.ts defined a local `sleep` helper identical to the
one already exported from shared/ssh.ts. Remove the local copies and import
the shared function instead, consistent with all other cloud modules.

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
A 2026-02-26 00:51:03 -08:00 committed by GitHub
parent 27996f20d4
commit fe6fd20143
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 11 deletions

View file

@ -20,7 +20,7 @@ import { getPackagesForTier, needsNode, needsBun, NODE_INSTALL_CMD } from "../sh
import { parseJsonWith, parseJsonRaw, isString, toObjectArray, toRecord } from "@openrouter/spawn-shared";
import * as v from "valibot";
import { saveVmConnection } from "../history.js";
import { spawnInteractive } from "../shared/ssh";
import { sleep, spawnInteractive } from "../shared/ssh";
const DAYTONA_API_BASE = "https://app.daytona.io/api";
const DAYTONA_DASHBOARD_URL = "https://app.daytona.io/";
@ -45,10 +45,6 @@ export function getState() {
// ─── API Client ──────────────────────────────────────────────────────────────
function sleep(ms: number): Promise<void> {
return new Promise((r) => setTimeout(r, ms));
}
const LooseObject = v.record(v.string(), v.unknown());
/** Parse a JSON string into a Record<string, unknown> via valibot, or null. */

View file

@ -20,7 +20,7 @@ import type { CloudInitTier } from "../shared/agents";
import { getPackagesForTier, needsNode, needsBun, NODE_INSTALL_CMD } from "../shared/cloud-init";
import * as v from "valibot";
import { parseJsonWith, parseJsonRaw, isString, isNumber, toObjectArray } from "@openrouter/spawn-shared";
import { killWithTimeout, spawnInteractive } from "../shared/ssh";
import { killWithTimeout, sleep, spawnInteractive } from "../shared/ssh";
import { saveVmConnection } from "../history.js";
const FLY_API_BASE = "https://api.machines.dev/v1";
@ -159,10 +159,6 @@ async function flyApi(method: string, endpoint: string, body?: string, maxRetrie
// ─── Helpers ─────────────────────────────────────────────────────────────────
function sleep(ms: number): Promise<void> {
return new Promise((r) => setTimeout(r, ms));
}
const LooseObject = v.record(v.string(), v.unknown());
function parseJson(text: string): Record<string, unknown> | null {