///
///
import { AddAgentInfoRequest, AgentPubKey, AppBundleSource, AppInfoRequest, AppSignalCb, AttachAppInterfaceRequest, CallZomeRequest, CreateCloneCellRequest, DisableAppRequest, DnaHash, DnaSource, DumpFullStateRequest, DumpStateRequest, EnableAppRequest, FullStateDump, InstallAppBundleRequest, InstallAppRequest, ListAppsRequest, MembraneProof, RegisterDnaRequest, RequestAgentInfoRequest, StartAppRequest, UninstallAppRequest } from "@holochain/client";
import { URL } from "node:url";
import { TryCpClient, TryCpConductorLogLevel } from "../index.js";
import { AgentHapp, IConductor } from "../../types.js";
/**
* The default partial config for a TryCP conductor.
*
* @public
*/
export declare const DEFAULT_PARTIAL_PLAYER_CONFIG = "signing_service_uri: ~\nencryption_service_uri: ~\ndecryption_service_uri: ~\ndpki: ~\nnetwork: ~";
/**
* @public
*/
export declare type ConductorId = string;
/**
* @public
*/
export interface TryCpConductorOptions {
/**
* Identifier for the conductor (optional).
*/
id?: ConductorId;
/**
* Configuration for the conductor (optional).
*/
partialConfig?: string;
/**
* Start up conductor after creation.
*
* default: true
*/
startup?: boolean;
/**
* Log level of the conductor (optional).
*
* default: "info"
*/
logLevel?: TryCpConductorLogLevel;
/**
* Timeout for requests to Admin and App API.
*/
timeout?: number;
}
/**
* The function to create a TryCP Conductor (aka "Player").
*
* @param serverUrl - The URL of the TryCP server to connect to.
* @returns A configured Conductor instance.
*
* @public
*/
export declare const createTryCpConductor: (serverUrl: URL, options?: TryCpConductorOptions) => Promise;
/**
* A class to manage a conductor running on a TryCP server.
*
* @public
*/
export declare class TryCpConductor implements IConductor {
private readonly id;
private readonly tryCpClient;
private appInterfacePort;
constructor(tryCpClient: TryCpClient, id?: ConductorId);
/**
* Create conductor configuration.
*
* @param partialConfig - The configuration to add to the default configuration.
* @returns An empty success response.
*/
configure(partialConfig?: string): Promise;
/**
* Start a configured conductor.
*
* @param options - Log level of the conductor. Defaults to "info".
* @returns An empty success response.
*
* @public
*/
startUp(options?: {
logLevel?: TryCpConductorLogLevel;
}): Promise;
/**
* Disconnect App interface and shut down the conductor.
*
* @returns An empty success response.
*
* @public
*/
shutDown(): Promise;
/**
* Disconnect the TryCP client from the TryCP server.
*
* @returns The web socket close code.
*/
disconnectClient(): Promise;
/**
* Download a DNA from a URL to the server's file system.
*
* @returns The relative path to the downloaded DNA file.
*/
downloadDna(url: URL): Promise;
/**
* Upload a DNA file from the local file system to the server.
*
* @param dnaContent - The DNA as binary content.
* @returns The relative path to the saved DNA file.
*/
saveDna(dnaContent: Buffer): Promise;
/**
* Connect a web socket to the App API.
*
* @param signalHandler - A callback function to handle signals.
* @returns An empty success response.
*/
connectAppInterface(signalHandler?: AppSignalCb): Promise;
/**
* Disconnect the web socket from the App API.
*
* @returns An empty success response.
*/
disconnectAppInterface(): Promise;
/**
* Send a call to the Admin API.
*
* @param message - The call to send to the Admin API.
* @returns The response of the call.
*
* @internal
*/
private callAdminApi;
/**
* Get all
* {@link https://github.com/holochain/holochain-client-js/blob/develop/docs/API_adminwebsocket.md | Admin API methods}
* of the Holochain client.
*
* @returns The Admin API web socket.
*/
adminWs(): {
addAgentInfo: (request: AddAgentInfoRequest) => Promise;
attachAppInterface: (request?: AttachAppInterfaceRequest) => Promise<{
port: number;
}>;
createCloneCell: (request: CreateCloneCellRequest) => Promise;
disableApp: (request: DisableAppRequest) => Promise;
dumpFullState: (request: DumpFullStateRequest) => Promise;
dumpState: (request: DumpStateRequest) => Promise<[FullStateDump, string]>;
enableApp: (request: EnableAppRequest) => Promise;
generateAgentPubKey: () => Promise;
installApp: (data: InstallAppRequest) => Promise;
installAppBundle: (data: InstallAppBundleRequest) => Promise;
listAppInterfaces: () => Promise;
listApps: (request: ListAppsRequest) => Promise;
listCellIds: () => Promise;
listDnas: () => Promise;
registerDna: (request: RegisterDnaRequest & DnaSource) => Promise;
requestAgentInfo: (req: RequestAgentInfoRequest) => Promise;
startApp: (request: StartAppRequest) => Promise;
uninstallApp: (request: UninstallAppRequest) => Promise;
};
/**
* Call to the conductor's App API.
*/
private callAppApi;
/**
* Get all
* {@link https://github.com/holochain/holochain-client-js/blob/develop/docs/API_appwebsocket.md | App API methods}
* of the Holochain client.
*
* @returns The App API web socket.
*/
appWs(): {
appInfo: (request: AppInfoRequest) => Promise;
callZome: (request: CallZomeRequest) => Promise;
};
/**
* 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 hApp.
*/
installAgentsHapps(options: {
agentsDnas: DnaSource[][];
signalHandler?: AppSignalCb;
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?: {
agentPubKey?: AgentPubKey;
installedAppId?: string;
uid?: string;
membraneProofs?: Record;
}): Promise;
}
/**
* Run the `reset` command on the TryCP server to delete all conductor data.
*
* @param serverUrl - The TryCP server to connect to.
* @returns An empty success response.
*
* @public
*/
export declare const cleanAllTryCpConductors: (serverUrl: URL) => Promise;