/// import { AdminWebsocket, AppBundleSource, AppSignalCb, AppWebsocket, AttachAppInterfaceRequest, DnaSource } from "@holochain/client"; import { URL } from "node:url"; import { AgentHapp, IConductor, HappBundleOptions } from "../types.js"; /** * The network type the conductor should use to communicate with peers. * * @public */ export declare enum NetworkType { Quic = "quic", Mdns = "mdns" } /** * @public */ export interface ConductorOptions { /** * Start up conductor after creation. * * @defaultValue true */ startup?: boolean; /** * Attach an app interface to the conductor and connect an app websocket * to it. * * @defaultValue true */ attachAppInterface?: boolean; /** * Register a signal handler on the app websocket. */ signalHandler?: AppSignalCb; /** * The network type the conductor should use * * @defaultValue quic */ networkType?: NetworkType; /** * A bootstrap service URL for peers to discover each other */ bootstrapUrl?: URL; /** * Network interface and port to bind to * * @defaultValue "kitsune-quic://0.0.0.0:0" */ bindTo?: URL; /** * Run through an external proxy */ proxy?: URL; /** * If you have port-forwarding set up or wish to apply a vanity domain name, * you may need to override the local IP. * * @defaultValue undefined = no override */ hostOverride?: URL; /** * If you have port-forwarding set up, you may need to override the local * port. * * @defaultValue undefined = no override */ portOverride?: number; /** * Timeout for requests to Admin and App API */ timeout?: number; } /** * Options for using the conductor factory. * * @public */ export declare type CreateConductorOptions = Pick; /** * The function to create a conductor. It starts a sandbox conductor via the * Holochain CLI. * * @returns A conductor instance. * * @public */ export declare const createConductor: (options?: ConductorOptions) => Promise; /** * A class to manage a conductor running on localhost. * * @public */ export declare class Conductor implements IConductor { private conductorProcess; private conductorDir; private adminApiUrl; private appApiUrl; private _adminWs; private _appWs; private readonly timeout; private constructor(); /** * Factory to create a conductor. * * @returns A configured instance of a conductor, not yet running. */ static create(options?: CreateConductorOptions): Promise; /** * Start the conductor and establish a web socket connection to the Admin * API. */ startUp(): Promise; /** * Close Admin and App API connections and kill the conductor process. */ shutDown(): Promise; private connectAdminWs; /** * Attach a web socket to the App API. * * @param request - Specify a port for the web socket (optional). */ attachAppInterface(request?: AttachAppInterfaceRequest): Promise; /** * Connect a web socket to the App API. * * @param signalHandler - A callback function to handle signals. */ connectAppInterface(signalHandler?: AppSignalCb): Promise; /** * Get the path of the directory that contains all files and folders of the * conductor. * * @returns The conductor's temporary directory. */ getTmpDirectory(): string; /** * Get all Admin API methods. * * @returns The Admin API web socket. */ adminWs(): AdminWebsocket; /** * Get all App API methods. * * @returns The App API web socket. */ appWs(): AppWebsocket; /** * Install a set of DNAs for multiple agents into the conductor. * * @param options - An array of DNAs for each agent, resulting in a * 2-dimensional array, and a UID for the DNAs (optional). * @returns An array with each agent's hApps. */ installAgentsHapps(options: { agentsDnas: DnaSource[][]; uid?: string; }): Promise; /** * Install a hApp bundle into the conductor. * * @param appBundleSource - The bundle or path to the bundle. * @param options - {@link HappBundleOptions} for the hApp bundle (optional). * @returns A hApp for the agent. */ installHappBundle(appBundleSource: AppBundleSource, options?: HappBundleOptions): Promise; } /** * Run the `hc` command to delete all conductor data. * * @returns A promise that resolves when the command is complete. * * @public */ export declare const cleanAllConductors: () => Promise;