#!/usr/bin/env tsx import { spawn, type ChildProcess } from "node:child_process"; import http from "node:http"; import { type WorkspaceAppAudience } from "../shared/workspace-app-audience.js"; export interface WorkspaceApp { id: string; name: string; description: string; audience: WorkspaceAppAudience; publicPaths: string[]; protectedPaths: string[]; homePath: string; dir: string; port: number; process?: ChildProcess; restartTimer?: NodeJS.Timeout; restartAttempts?: number; lastFailure?: { code: number | null; signal: NodeJS.Signals | null; at: number; installing: boolean; output: string; nextRetryAt: number; }; outputTail?: string; installing?: boolean; installAttempted?: boolean; ready?: boolean; readinessProbe?: Promise; } export interface WorkspaceDevOptions { args?: string[]; env?: NodeJS.ProcessEnv; root?: string; spawnProcess?: typeof spawn; openBrowser?: boolean; stdout?: Pick; stderr?: Pick; } export interface WorkspaceDevHandle { apps: WorkspaceApp[]; defaultApp: string; gatewayUrl: () => string; ready: Promise<{ port: number; url: string; }>; server: http.Server; shutdown: () => void; } export declare const DEFAULT_PROXY_READY_TIMEOUT_MS = 60000; export declare function workspaceGatewayUrl(host: string, port: number): string; export declare function isWorkspaceWatcherLimitError(err: Pick): boolean; export declare function shouldEagerStartWorkspaceApps(args?: string[], env?: NodeJS.ProcessEnv): boolean; export declare function shouldPrewarmWorkspaceApps(args?: string[], env?: NodeJS.ProcessEnv): boolean; export declare function shouldOpenWorkspaceBrowser(args?: string[], env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean; export declare function workspacePrewarmConcurrency(args?: string[], env?: NodeJS.ProcessEnv): number; export declare function workspacePrewarmDelayMs(env?: NodeJS.ProcessEnv): number; export type PollingFileWatcherMode = "enable" | "disable-explicit" | "disable-default"; export declare function pollingFileWatcherMode(env?: NodeJS.ProcessEnv, root?: string): PollingFileWatcherMode; export declare function shouldUsePollingFileWatcher(env?: NodeJS.ProcessEnv, root?: string): boolean; export declare function initialWorkspaceAppIds(apps: Array>, defaultApp: string, eager: boolean, startDefault?: boolean): string[]; export declare function runWorkspaceDev(options?: WorkspaceDevOptions): Promise;