mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-11 13:20:05 +00:00
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:
parent
27996f20d4
commit
fe6fd20143
3 changed files with 3 additions and 11 deletions
|
|
@ -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. */
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue