mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-22 03:14:57 +00:00
fix: standardize ESM import extensions across 35 production files (#2827)
Add .js extensions to 124 relative imports that were missing them. The codebase is "type": "module" (ESM) and the dominant pattern already used .js extensions, but 35 files had a mix of extensionless and .js imports — sometimes within the same file. Standardize to .js everywhere. Agent: code-health Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f4e2cd80a4
commit
1dc9c04eeb
33 changed files with 121 additions and 121 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// aws/agents.ts — AWS Lightsail agent configs (thin wrapper over shared)
|
||||
|
||||
import { createCloudAgents } from "../shared/agent-setup";
|
||||
import { downloadFile, runServer, uploadFile } from "./aws";
|
||||
import { createCloudAgents } from "../shared/agent-setup.js";
|
||||
import { downloadFile, runServer, uploadFile } from "./aws.js";
|
||||
|
||||
export const { agents, resolveAgent } = createCloudAgents({
|
||||
runServer,
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
// aws/aws.ts — Core AWS Lightsail provider: auth, provisioning, SSH execution
|
||||
|
||||
import type { CloudInstance, VMConnection } from "../history.js";
|
||||
import type { CloudInitTier } from "../shared/agents";
|
||||
import type { CloudInitTier } from "../shared/agents.js";
|
||||
|
||||
import { createHash, createHmac } from "node:crypto";
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, normalize } from "node:path";
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import * as v from "valibot";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init";
|
||||
import { parseJsonWith } from "../shared/parse";
|
||||
import { getSpawnCloudConfigPath } from "../shared/paths";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js";
|
||||
import { parseJsonWith } from "../shared/parse.js";
|
||||
import { getSpawnCloudConfigPath } from "../shared/paths.js";
|
||||
import { asyncTryCatch, isFileError, tryCatch, tryCatchIf, unwrapOr } from "../shared/result.js";
|
||||
import {
|
||||
killWithTimeout,
|
||||
|
|
@ -20,8 +20,8 @@ import {
|
|||
waitForSsh as sharedWaitForSsh,
|
||||
sleep,
|
||||
spawnInteractive,
|
||||
} from "../shared/ssh";
|
||||
import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys";
|
||||
} from "../shared/ssh.js";
|
||||
import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys.js";
|
||||
import {
|
||||
getServerNameFromEnv,
|
||||
jsonEscape,
|
||||
|
|
@ -38,8 +38,8 @@ import {
|
|||
selectFromList,
|
||||
shellQuote,
|
||||
validateRegionName,
|
||||
} from "../shared/ui";
|
||||
import { awsBilling } from "./billing";
|
||||
} from "../shared/ui.js";
|
||||
import { awsBilling } from "./billing.js";
|
||||
|
||||
const DASHBOARD_URL = "https://lightsail.aws.amazon.com/";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { BillingConfig } from "../shared/billing-guidance";
|
||||
import type { BillingConfig } from "../shared/billing-guidance.js";
|
||||
|
||||
export const awsBilling: BillingConfig = {
|
||||
billingUrl: "https://lightsail.aws.amazon.com/",
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
// aws/main.ts — Orchestrator: deploys an agent on AWS Lightsail
|
||||
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate";
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate.js";
|
||||
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { runOrchestration } from "../shared/orchestrate";
|
||||
import { agents, resolveAgent } from "./agents";
|
||||
import { runOrchestration } from "../shared/orchestrate.js";
|
||||
import { agents, resolveAgent } from "./agents.js";
|
||||
import {
|
||||
authenticate,
|
||||
createInstance,
|
||||
|
|
@ -23,7 +23,7 @@ import {
|
|||
uploadFile,
|
||||
waitForCloudInit,
|
||||
waitForSshOnly,
|
||||
} from "./aws";
|
||||
} from "./aws.js";
|
||||
|
||||
async function main() {
|
||||
const agentName = process.argv[2];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// digitalocean/agents.ts — DigitalOcean agent configs (thin wrapper over shared)
|
||||
|
||||
import { createCloudAgents } from "../shared/agent-setup";
|
||||
import { downloadFile, runServer, uploadFile } from "./digitalocean";
|
||||
import { createCloudAgents } from "../shared/agent-setup.js";
|
||||
import { downloadFile, runServer, uploadFile } from "./digitalocean.js";
|
||||
|
||||
export const { agents, resolveAgent } = createCloudAgents({
|
||||
runServer,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { BillingConfig } from "../shared/billing-guidance";
|
||||
import type { BillingConfig } from "../shared/billing-guidance.js";
|
||||
|
||||
export const digitaloceanBilling: BillingConfig = {
|
||||
billingUrl: "https://cloud.digitalocean.com/account/billing",
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
// digitalocean/digitalocean.ts — Core DigitalOcean provider: API, auth, SSH, provisioning
|
||||
|
||||
import type { CloudInstance, VMConnection } from "../history.js";
|
||||
import type { CloudInitTier } from "../shared/agents";
|
||||
import type { CloudInitTier } from "../shared/agents.js";
|
||||
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, normalize } from "node:path";
|
||||
import * as p from "@clack/prompts";
|
||||
import { getErrorMessage, isNumber, isString, toObjectArray, toRecord } from "@openrouter/spawn-shared";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init";
|
||||
import { generateCsrfState, OAUTH_CSS } from "../shared/oauth";
|
||||
import { parseJsonObj } from "../shared/parse";
|
||||
import { getSpawnCloudConfigPath } from "../shared/paths";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js";
|
||||
import { generateCsrfState, OAUTH_CSS } from "../shared/oauth.js";
|
||||
import { parseJsonObj } from "../shared/parse.js";
|
||||
import { getSpawnCloudConfigPath } from "../shared/paths.js";
|
||||
import {
|
||||
asyncTryCatch,
|
||||
asyncTryCatchIf,
|
||||
|
|
@ -29,8 +29,8 @@ import {
|
|||
sleep,
|
||||
spawnInteractive,
|
||||
waitForSshSnapshotBoot,
|
||||
} from "../shared/ssh";
|
||||
import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys";
|
||||
} from "../shared/ssh.js";
|
||||
import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys.js";
|
||||
import {
|
||||
defaultSpawnName,
|
||||
getServerNameFromEnv,
|
||||
|
|
@ -50,8 +50,8 @@ import {
|
|||
toKebabCase,
|
||||
validateRegionName,
|
||||
validateServerName,
|
||||
} from "../shared/ui";
|
||||
import { digitaloceanBilling } from "./billing";
|
||||
} from "../shared/ui.js";
|
||||
import { digitaloceanBilling } from "./billing.js";
|
||||
|
||||
const DO_API_BASE = "https://api.digitalocean.com/v2";
|
||||
const DO_DASHBOARD_URL = "https://cloud.digitalocean.com/droplets";
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
// digitalocean/main.ts — Orchestrator: deploys an agent on DigitalOcean
|
||||
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate";
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate.js";
|
||||
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { runOrchestration } from "../shared/orchestrate";
|
||||
import { logInfo } from "../shared/ui";
|
||||
import { agents, resolveAgent } from "./agents";
|
||||
import { runOrchestration } from "../shared/orchestrate.js";
|
||||
import { logInfo } from "../shared/ui.js";
|
||||
import { agents, resolveAgent } from "./agents.js";
|
||||
import {
|
||||
checkAccountStatus,
|
||||
createServer as createDroplet,
|
||||
|
|
@ -24,7 +24,7 @@ import {
|
|||
uploadFile,
|
||||
waitForCloudInit,
|
||||
waitForSshOnly,
|
||||
} from "./digitalocean";
|
||||
} from "./digitalocean.js";
|
||||
|
||||
/** Agents that need more than the default 2GB RAM (e.g. openclaw-plugins OOMs on 2GB) */
|
||||
const AGENT_MIN_SIZE: Record<string, string> = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// gcp/agents.ts — GCP Compute Engine agent configs (thin wrapper over shared)
|
||||
|
||||
import { createCloudAgents } from "../shared/agent-setup";
|
||||
import { downloadFile, runServer, uploadFile } from "./gcp";
|
||||
import { createCloudAgents } from "../shared/agent-setup.js";
|
||||
import { downloadFile, runServer, uploadFile } from "./gcp.js";
|
||||
|
||||
export const { agents, resolveAgent } = createCloudAgents({
|
||||
runServer,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { BillingConfig } from "../shared/billing-guidance";
|
||||
import type { BillingConfig } from "../shared/billing-guidance.js";
|
||||
|
||||
export const gcpBilling: BillingConfig = {
|
||||
billingUrl: "https://console.cloud.google.com/billing",
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
// gcp/gcp.ts — Core GCP Compute Engine provider: gcloud CLI wrapper, auth, provisioning, SSH
|
||||
|
||||
import type { CloudInstance, VMConnection } from "../history.js";
|
||||
import type { CloudInitTier } from "../shared/agents";
|
||||
import type { CloudInitTier } from "../shared/agents.js";
|
||||
|
||||
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { join, normalize } from "node:path";
|
||||
import { isString, toObjectArray } from "@openrouter/spawn-shared";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init";
|
||||
import { getUserHome } from "../shared/paths";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js";
|
||||
import { getUserHome } from "../shared/paths.js";
|
||||
import { asyncTryCatch, tryCatch } from "../shared/result.js";
|
||||
import {
|
||||
killWithTimeout,
|
||||
|
|
@ -17,8 +17,8 @@ import {
|
|||
waitForSsh as sharedWaitForSsh,
|
||||
sleep,
|
||||
spawnInteractive,
|
||||
} from "../shared/ssh";
|
||||
import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys";
|
||||
} from "../shared/ssh.js";
|
||||
import { ensureSshKeys, getSshKeyOpts } from "../shared/ssh-keys.js";
|
||||
import {
|
||||
getServerNameFromEnv,
|
||||
logError,
|
||||
|
|
@ -34,8 +34,8 @@ import {
|
|||
sanitizeTermValue,
|
||||
selectFromList,
|
||||
shellQuote,
|
||||
} from "../shared/ui";
|
||||
import { gcpBilling } from "./billing";
|
||||
} from "../shared/ui.js";
|
||||
import { gcpBilling } from "./billing.js";
|
||||
|
||||
const DASHBOARD_URL = "https://console.cloud.google.com/compute/instances";
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
// gcp/main.ts — Orchestrator: deploys an agent on GCP Compute Engine
|
||||
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate";
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate.js";
|
||||
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { runOrchestration } from "../shared/orchestrate";
|
||||
import { agents, resolveAgent } from "./agents";
|
||||
import { runOrchestration } from "../shared/orchestrate.js";
|
||||
import { agents, resolveAgent } from "./agents.js";
|
||||
import {
|
||||
authenticate,
|
||||
checkBillingEnabled,
|
||||
|
|
@ -24,7 +24,7 @@ import {
|
|||
uploadFile,
|
||||
waitForCloudInit,
|
||||
waitForSshOnly,
|
||||
} from "./gcp";
|
||||
} from "./gcp.js";
|
||||
|
||||
async function main() {
|
||||
const agentName = process.argv[2];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// hetzner/agents.ts — Hetzner Cloud agent configs (thin wrapper over shared)
|
||||
|
||||
import { createCloudAgents } from "../shared/agent-setup";
|
||||
import { downloadFile, runServer, uploadFile } from "./hetzner";
|
||||
import { createCloudAgents } from "../shared/agent-setup.js";
|
||||
import { downloadFile, runServer, uploadFile } from "./hetzner.js";
|
||||
|
||||
export const { agents, resolveAgent } = createCloudAgents({
|
||||
runServer,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import type { BillingConfig } from "../shared/billing-guidance";
|
||||
import type { BillingConfig } from "../shared/billing-guidance.js";
|
||||
|
||||
export const hetznerBilling: BillingConfig = {
|
||||
billingUrl: "https://console.hetzner.cloud/",
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
// hetzner/hetzner.ts — Core Hetzner Cloud provider: API, auth, SSH, provisioning
|
||||
|
||||
import type { CloudInstance, VMConnection } from "../history.js";
|
||||
import type { CloudInitTier } from "../shared/agents";
|
||||
import type { CloudInitTier } from "../shared/agents.js";
|
||||
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
||||
import { dirname, normalize } from "node:path";
|
||||
import { getErrorMessage, isNumber, isString, toObjectArray, toRecord } from "@openrouter/spawn-shared";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init";
|
||||
import { parseJsonObj } from "../shared/parse";
|
||||
import { getSpawnCloudConfigPath } from "../shared/paths";
|
||||
import { handleBillingError, isBillingError, showNonBillingError } from "../shared/billing-guidance.js";
|
||||
import { getPackagesForTier, NODE_INSTALL_CMD, needsBun, needsNode } from "../shared/cloud-init.js";
|
||||
import { parseJsonObj } from "../shared/parse.js";
|
||||
import { getSpawnCloudConfigPath } from "../shared/paths.js";
|
||||
import { asyncTryCatch, asyncTryCatchIf, isNetworkError, unwrapOr } from "../shared/result.js";
|
||||
import {
|
||||
killWithTimeout,
|
||||
|
|
@ -19,8 +19,8 @@ import {
|
|||
sleep,
|
||||
spawnInteractive,
|
||||
waitForSshSnapshotBoot,
|
||||
} from "../shared/ssh";
|
||||
import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys";
|
||||
} from "../shared/ssh.js";
|
||||
import { ensureSshKeys, getSshFingerprint, getSshKeyOpts } from "../shared/ssh-keys.js";
|
||||
import {
|
||||
getServerNameFromEnv,
|
||||
jsonEscape,
|
||||
|
|
@ -38,8 +38,8 @@ import {
|
|||
selectFromList,
|
||||
shellQuote,
|
||||
validateRegionName,
|
||||
} from "../shared/ui";
|
||||
import { hetznerBilling } from "./billing";
|
||||
} from "../shared/ui.js";
|
||||
import { hetznerBilling } from "./billing.js";
|
||||
|
||||
const HETZNER_API_BASE = "https://api.hetzner.cloud/v1";
|
||||
const HETZNER_DASHBOARD_URL = "https://console.hetzner.cloud/";
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
// hetzner/main.ts — Orchestrator: deploys an agent on Hetzner Cloud
|
||||
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate";
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate.js";
|
||||
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { runOrchestration } from "../shared/orchestrate";
|
||||
import { agents, resolveAgent } from "./agents";
|
||||
import { runOrchestration } from "../shared/orchestrate.js";
|
||||
import { agents, resolveAgent } from "./agents.js";
|
||||
import {
|
||||
createServer as createHetznerServer,
|
||||
downloadFile,
|
||||
|
|
@ -23,7 +23,7 @@ import {
|
|||
uploadFile,
|
||||
waitForCloudInit,
|
||||
waitForSshOnly,
|
||||
} from "./hetzner";
|
||||
} from "./hetzner.js";
|
||||
|
||||
async function main() {
|
||||
const agentName = process.argv[2];
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// local/agents.ts — Local machine agent configs (thin wrapper over shared)
|
||||
|
||||
import { createCloudAgents } from "../shared/agent-setup";
|
||||
import { downloadFile, runLocal, uploadFile } from "./local";
|
||||
import { createCloudAgents } from "../shared/agent-setup.js";
|
||||
import { downloadFile, runLocal, uploadFile } from "./local.js";
|
||||
|
||||
export const { agents, resolveAgent } = createCloudAgents({
|
||||
runServer: runLocal,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
import { copyFileSync, mkdirSync } from "node:fs";
|
||||
import { dirname } from "node:path";
|
||||
import { getUserHome } from "../shared/paths";
|
||||
import { getLocalShell } from "../shared/shell";
|
||||
import { spawnInteractive } from "../shared/ssh";
|
||||
import { getUserHome } from "../shared/paths.js";
|
||||
import { getLocalShell } from "../shared/shell.js";
|
||||
import { spawnInteractive } from "../shared/ssh.js";
|
||||
|
||||
// ─── Execution ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
// local/main.ts — Orchestrator: deploys an agent on the local machine
|
||||
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate";
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate.js";
|
||||
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { runOrchestration } from "../shared/orchestrate";
|
||||
import { agents, resolveAgent } from "./agents";
|
||||
import { downloadFile, interactiveSession, runLocal, uploadFile } from "./local";
|
||||
import { runOrchestration } from "../shared/orchestrate.js";
|
||||
import { agents, resolveAgent } from "./agents.js";
|
||||
import { downloadFile, interactiveSession, runLocal, uploadFile } from "./local.js";
|
||||
|
||||
async function main() {
|
||||
const agentName = process.argv[2];
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
// shared/agent-setup.ts — Shared agent helpers + definitions for SSH-based clouds
|
||||
// Cloud-agnostic: receives runServer/uploadFile via CloudRunner interface.
|
||||
|
||||
import type { AgentConfig } from "./agents";
|
||||
import type { Result } from "./ui";
|
||||
import type { AgentConfig } from "./agents.js";
|
||||
import type { Result } from "./ui.js";
|
||||
|
||||
import { unlinkSync, writeFileSync } from "node:fs";
|
||||
import { join, normalize } from "node:path";
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { getTmpDir } from "./paths";
|
||||
import { getTmpDir } from "./paths.js";
|
||||
import { asyncTryCatch, asyncTryCatchIf, isOperationalError, tryCatchIf } from "./result.js";
|
||||
import { Err, jsonEscape, logError, logInfo, logStep, logWarn, Ok, prompt, shellQuote, withRetry } from "./ui";
|
||||
import { Err, jsonEscape, logError, logInfo, logStep, logWarn, Ok, prompt, shellQuote, withRetry } from "./ui.js";
|
||||
|
||||
/**
|
||||
* Wrap an SSH-based async operation into a Result for use with withRetry.
|
||||
|
|
|
|||
|
|
@ -2,15 +2,15 @@
|
|||
// Downloads a nightly tarball from GitHub Releases and extracts it on the remote VM.
|
||||
// Falls back gracefully (returns false) on any failure so the caller can use live install.
|
||||
|
||||
import type { CloudRunner } from "./agent-setup";
|
||||
import type { CloudRunner } from "./agent-setup.js";
|
||||
|
||||
import { unlinkSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import * as v from "valibot";
|
||||
import { asyncTryCatch, tryCatch } from "./result";
|
||||
import { logDebug, logInfo, logStep, logWarn } from "./ui";
|
||||
import { asyncTryCatch, tryCatch } from "./result.js";
|
||||
import { logDebug, logInfo, logStep, logWarn } from "./ui.js";
|
||||
|
||||
const REPO = "OpenRouterTeam/spawn";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// shared/agents.ts — AgentConfig interface + shared helpers (cloud-agnostic)
|
||||
|
||||
import { logError, shellQuote } from "./ui";
|
||||
import { logError, shellQuote } from "./ui.js";
|
||||
|
||||
// ─── Types ───────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// shared/billing-guidance.ts — Billing error detection, guidance, and browser-based retry flow
|
||||
|
||||
import { asyncTryCatch, unwrapOr } from "./result.js";
|
||||
import { logInfo, logStep, logWarn, openBrowser, prompt } from "./ui";
|
||||
import { logInfo, logStep, logWarn, openBrowser, prompt } from "./ui.js";
|
||||
|
||||
// ─── BillingConfig interface ────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// shared/cloud-init.ts — Tier-based cloud-init package selection
|
||||
|
||||
import type { CloudInitTier } from "./agents";
|
||||
import type { CloudInitTier } from "./agents.js";
|
||||
|
||||
const MINIMAL = [
|
||||
"curl",
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|||
import { dirname } from "node:path";
|
||||
import { getErrorMessage, isString } from "@openrouter/spawn-shared";
|
||||
import * as v from "valibot";
|
||||
import { OAUTH_CODE_REGEX } from "./oauth-constants";
|
||||
import { parseJsonObj, parseJsonWith } from "./parse";
|
||||
import { getSpawnCloudConfigPath } from "./paths";
|
||||
import { OAUTH_CODE_REGEX } from "./oauth-constants.js";
|
||||
import { parseJsonObj, parseJsonWith } from "./parse.js";
|
||||
import { getSpawnCloudConfigPath } from "./paths.js";
|
||||
import { asyncTryCatchIf, isFileError, isNetworkError, tryCatch } from "./result.js";
|
||||
import { logDebug, logError, logInfo, logStep, logWarn, openBrowser, prompt, retryOrQuit } from "./ui";
|
||||
import { logDebug, logError, logInfo, logStep, logWarn, openBrowser, prompt, retryOrQuit } from "./ui.js";
|
||||
|
||||
// ─── Schemas ─────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@
|
|||
// Each cloud implements CloudOrchestrator and calls runOrchestration().
|
||||
|
||||
import type { VMConnection } from "../history.js";
|
||||
import type { CloudRunner } from "./agent-setup";
|
||||
import type { AgentConfig } from "./agents";
|
||||
import type { SshTunnelHandle } from "./ssh";
|
||||
import type { CloudRunner } from "./agent-setup.js";
|
||||
import type { AgentConfig } from "./agents.js";
|
||||
import type { SshTunnelHandle } from "./ssh.js";
|
||||
|
||||
import { readFileSync } from "node:fs";
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import * as v from "valibot";
|
||||
import { generateSpawnId, saveLaunchCmd, saveMetadata, saveSpawnRecord } from "../history.js";
|
||||
import { offerGithubAuth, setupAutoUpdate, wrapSshCall } from "./agent-setup";
|
||||
import { downloadTarballLocally, tryTarballInstall, uploadAndExtractTarball } from "./agent-tarball";
|
||||
import { generateEnvConfig } from "./agents";
|
||||
import { getOrPromptApiKey } from "./oauth";
|
||||
import { getSpawnPreferencesPath } from "./paths";
|
||||
import { offerGithubAuth, setupAutoUpdate, wrapSshCall } from "./agent-setup.js";
|
||||
import { downloadTarballLocally, tryTarballInstall, uploadAndExtractTarball } from "./agent-tarball.js";
|
||||
import { generateEnvConfig } from "./agents.js";
|
||||
import { getOrPromptApiKey } from "./oauth.js";
|
||||
import { getSpawnPreferencesPath } from "./paths.js";
|
||||
import { asyncTryCatch, asyncTryCatchIf, isOperationalError, tryCatch } from "./result.js";
|
||||
import { isWindows } from "./shell";
|
||||
import { sleep, startSshTunnel } from "./ssh";
|
||||
import { ensureSshKeys, getSshKeyOpts } from "./ssh-keys";
|
||||
import { isWindows } from "./shell.js";
|
||||
import { sleep, startSshTunnel } from "./ssh.js";
|
||||
import { ensureSshKeys, getSshKeyOpts } from "./ssh-keys.js";
|
||||
import {
|
||||
logDebug,
|
||||
logError,
|
||||
|
|
@ -32,7 +32,7 @@ import {
|
|||
shellQuote,
|
||||
validateModelId,
|
||||
withRetry,
|
||||
} from "./ui";
|
||||
} from "./ui.js";
|
||||
|
||||
export interface CloudOrchestrator {
|
||||
cloudName: string;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
// shared/ssh-keys.ts — SSH key discovery, selection, and generation
|
||||
|
||||
import { existsSync, mkdirSync, readdirSync } from "node:fs";
|
||||
import { getSshDir } from "./paths";
|
||||
import { getSshDir } from "./paths.js";
|
||||
import { isFileError, tryCatch, tryCatchIf, unwrapOr } from "./result.js";
|
||||
import { logInfo, logStep } from "./ui";
|
||||
import { logInfo, logStep } from "./ui.js";
|
||||
|
||||
// ─── Types ──────────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import { spawnSync as nodeSpawnSync } from "node:child_process";
|
||||
import { connect } from "node:net";
|
||||
import { asyncTryCatch, tryCatch } from "./result.js";
|
||||
import { logError, logInfo, logStep, logStepDone, logStepInline } from "./ui";
|
||||
import { logError, logInfo, logStep, logStepDone, logStepInline } from "./ui.js";
|
||||
|
||||
// ─── Shared SSH Options ──────────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
import { readFileSync } from "node:fs";
|
||||
import * as p from "@clack/prompts";
|
||||
import { isString } from "@openrouter/spawn-shared";
|
||||
import { parseJsonObj } from "./parse";
|
||||
import { getSpawnCloudConfigPath } from "./paths";
|
||||
import { parseJsonObj } from "./parse.js";
|
||||
import { getSpawnCloudConfigPath } from "./paths.js";
|
||||
import { asyncTryCatch, tryCatch, unwrapOr } from "./result.js";
|
||||
|
||||
const RED = "\x1b[0;31m";
|
||||
|
|
@ -218,9 +218,9 @@ export async function retryOrQuit(message: string): Promise<void> {
|
|||
|
||||
// ─── Result-based retry ────────────────────────────────────────────────
|
||||
|
||||
import type { Result } from "./result";
|
||||
import type { Result } from "./result.js";
|
||||
|
||||
export { Err, Ok, type Result } from "./result";
|
||||
export { Err, Ok, type Result } from "./result.js";
|
||||
|
||||
/**
|
||||
* Phase-aware retry helper using the Result monad.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// sprite/agents.ts — Sprite agent configs (thin wrapper over shared)
|
||||
|
||||
import { createCloudAgents } from "../shared/agent-setup";
|
||||
import { downloadFileSprite, runSprite, uploadFileSprite } from "./sprite";
|
||||
import { createCloudAgents } from "../shared/agent-setup.js";
|
||||
import { downloadFileSprite, runSprite, uploadFileSprite } from "./sprite.js";
|
||||
|
||||
export const { agents, resolveAgent } = createCloudAgents({
|
||||
runServer: runSprite,
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
// sprite/main.ts — Orchestrator: deploys an agent on Sprite
|
||||
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate";
|
||||
import type { CloudOrchestrator } from "../shared/orchestrate.js";
|
||||
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { runOrchestration } from "../shared/orchestrate";
|
||||
import { agents, resolveAgent } from "./agents";
|
||||
import { runOrchestration } from "../shared/orchestrate.js";
|
||||
import { agents, resolveAgent } from "./agents.js";
|
||||
import {
|
||||
createSprite,
|
||||
downloadFileSprite,
|
||||
|
|
@ -21,7 +21,7 @@ import {
|
|||
setupShellEnvironment,
|
||||
uploadFileSprite,
|
||||
verifySpriteConnectivity,
|
||||
} from "./sprite";
|
||||
} from "./sprite.js";
|
||||
|
||||
async function main() {
|
||||
const agentName = process.argv[2];
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import type { VMConnection } from "../history.js";
|
|||
import { existsSync } from "node:fs";
|
||||
import { join, normalize } from "node:path";
|
||||
import { getErrorMessage } from "@openrouter/spawn-shared";
|
||||
import { getUserHome } from "../shared/paths";
|
||||
import { getUserHome } from "../shared/paths.js";
|
||||
import { asyncTryCatch } from "../shared/result.js";
|
||||
import { killWithTimeout, sleep, spawnInteractive } from "../shared/ssh";
|
||||
import { killWithTimeout, sleep, spawnInteractive } from "../shared/ssh.js";
|
||||
import {
|
||||
getServerNameFromEnv,
|
||||
logError,
|
||||
|
|
@ -17,7 +17,7 @@ import {
|
|||
logStepInline,
|
||||
logWarn,
|
||||
promptSpawnNameShared,
|
||||
} from "../shared/ui";
|
||||
} from "../shared/ui.js";
|
||||
|
||||
// ─── Configurable Constants ──────────────────────────────────────────────────
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ import { getErrorMessage, hasStatus } from "@openrouter/spawn-shared";
|
|||
import pc from "picocolors";
|
||||
import pkg from "../package.json" with { type: "json" };
|
||||
import { RAW_BASE, SPAWN_CDN, VERSION_URL } from "./manifest.js";
|
||||
import { PkgVersionSchema, parseJsonWith } from "./shared/parse";
|
||||
import { getUpdateCheckedPath, getUpdateFailedPath } from "./shared/paths";
|
||||
import { asyncTryCatchIf, isFileError, isNetworkError, tryCatch, tryCatchIf, unwrapOr } from "./shared/result";
|
||||
import { getInstallCmd, getInstallScriptUrl, getWhichCommand, isWindows } from "./shared/shell";
|
||||
import { logDebug, logWarn } from "./shared/ui";
|
||||
import { PkgVersionSchema, parseJsonWith } from "./shared/parse.js";
|
||||
import { getUpdateCheckedPath, getUpdateFailedPath } from "./shared/paths.js";
|
||||
import { asyncTryCatchIf, isFileError, isNetworkError, tryCatch, tryCatchIf, unwrapOr } from "./shared/result.js";
|
||||
import { getInstallCmd, getInstallScriptUrl, getWhichCommand, isWindows } from "./shared/shell.js";
|
||||
import { logDebug, logWarn } from "./shared/ui.js";
|
||||
|
||||
const VERSION = pkg.version;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue