import { deploy } from "./deploy.js"; import { TailscaleLocal } from "./tailscale.js"; import type { Exposure, ResolvedConfig } from "./types.js"; export declare const OPENCODE_PERMISSION_CONFIG = "{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"permission\": \"allow\"\n}\n"; export declare const DEFAULT_OPENCODE_PORT = 3000; export interface OpenCodeRunner { kind: "path" | "npx"; command: string[]; version?: string; installedBy: "found" | "npx-resolved"; } export declare function tryVersion(command: string[]): Promise; /** * Locates the opencode runner: a real `opencode` on PATH is preferred, otherwise * `npx -y opencode-ai` is resolved (which installs/uses the npm cache — this is * the "install opencode when missing" step, and `--install` forces it). */ export declare function resolveOpenCodeRunner(options?: { install?: boolean; }): Promise; /** * `permission: "allow"` is the headless equivalent of `opencode --auto` * (serve has no --auto flag): every tool runs without approval — nothing is * blocked, exactly like auto mode. Explicit deny rules elsewhere still apply. */ export declare function writePermissionConfig(target?: string): { written: string[]; existing: string[]; }; export interface OpenCodeServeRecord { pid: number; command: string; port: number; startedAt: string; runnerVersion?: string; } export declare function readOpenCodeServeRecord(): OpenCodeServeRecord | undefined; export declare function serveHttpUp(port: number, timeoutMs: number): Promise; export declare function openCodeServeArgs(runner: OpenCodeRunner, port: number): string[]; export declare function startOpenCodeServe(options: { runner: OpenCodeRunner; port: number; configPath?: string; logPath: string; }): Promise<{ pid: number; command: string; }>; export declare function findOpenCodeServePids(port?: number): Promise; export declare function stopOpenCodeServe(): Promise<{ stopped: boolean; pid?: number; message: string; }>; /** Public FQDN of the funnel node: `tailscale funnel status` name, else the Self DNSName. */ export declare function funnelDnsName(local: TailscaleLocal): Promise; export declare function deriveUrls(dnsName: string | undefined, exposures: Exposure[], fallbackPort: number): string[]; export interface OpenCodeFlowOptions { config: ResolvedConfig; port: number; yes: boolean; dryRun: boolean; install: boolean; verify: boolean; verifyTimeout: number; opencodeConfigPath?: string; applyPolicy?: boolean; enableHttps?: boolean; credentialEnvName?: string; tagOwner?: string[]; backupDir?: string; logPath?: string; } export interface OpenCodeFlowResult { opencode: { runner: OpenCodeRunner; pid?: number; command?: string; port: number; configPath?: string; permissionConfig: string; permissionWritten: string[]; permissionExisting: string[]; logPath: string; }; deployment: Awaited>; dnsName?: string; urls: string[]; verified: boolean; verifyAttempts?: number; } export declare function runOpenCodeFlow(options: OpenCodeFlowOptions): Promise; export declare function stopOpenCodeFlow(): Promise<{ serve: { stopped: boolean; pid?: number; message: string; }; daemon: { stopped: boolean; pid?: number; message: string; }; }>; //# sourceMappingURL=opencode.d.ts.map