import { GlobalMailbox } from '../coordination/global-mailbox.js'; import type { EventBus } from '../kernel/events.js'; import type { HqClientConfig } from '../types/config.js'; import type { Logger } from '../types/logger.js'; import type { HqClientCapability, HqClientIdentity, HqRedactionPolicy } from './protocol.js'; import { HqPublisher, type HqPublisherCommandHandler, type HqPublisherOptions, type HqSocketFactory } from './publisher.js'; export interface HqPublisherEnvConfig { url: string; token?: string; enabled?: boolean; rawContent?: boolean; projectAlias?: string; /** * Same-machine auto-discovery mode: no explicit URL was configured, so the * publisher should re-resolve the endpoint from `/runtime.json` * (+ the first client token in `auth.json`) before every connect attempt. * This lets every client on the machine attach to a `wstack --hq` that is * already running, starts later, or restarts on a different port. */ discover?: boolean; /** Resolved HQ data dir the discovery reads from. */ dataDir?: string; } /** * Discover a locally running `wstack --hq` endpoint: reads the runtime * marker (pid-liveness-checked) and the first client token. Returns * `undefined` when no live HQ is advertised on this machine. */ export declare function discoverLocalHqEndpoint(options?: { dataDir?: string | undefined; env?: NodeJS.ProcessEnv | undefined; }): { url: string; token?: string | undefined; } | undefined; export declare function resolveHqConfigFromEnv(env?: NodeJS.ProcessEnv): HqPublisherEnvConfig | undefined; export declare function resolveHqConfig(options?: { env?: NodeJS.ProcessEnv | undefined; config?: HqClientConfig | undefined; }): HqPublisherEnvConfig | undefined; export declare function deriveHqProjectId(projectRoot: string, projectAlias?: string): string; export interface CreateHqPublisherOptions { clientKind: HqClientIdentity['kind']; projectRoot: string; projectName?: string; machineId?: string; hostnameOverride?: string; socketFactory?: HqSocketFactory; config?: HqPublisherEnvConfig; appConfig?: { hq?: HqClientConfig | undefined; } | undefined; redactionPolicy?: Partial; /** Forwarded to the HqPublisher constructor (Phase 4 control plane). */ capabilities?: readonly HqClientCapability[]; /** Bound offline telemetry retained by this client. */ maxQueuedMessages?: number; /** Forwarded to the HqPublisher constructor (Phase 4 control plane). */ onCommand?: HqPublisherCommandHandler; /** Receives the latest merged Kanban snapshot from HQ. */ onKanbanSnapshot?: HqPublisherOptions['onKanbanSnapshot']; /** Dormant discovery re-check interval override (tests / tight loops). */ discoveryPollMs?: number; /** Logger for structured connect-failure diagnostics. */ logger?: Logger | undefined; } export declare function createHqPublisherFromEnv(options: CreateHqPublisherOptions): HqPublisher | undefined; export interface CreateGlobalMailboxOptions { projectDir: string; events?: EventBus; hqPublisher?: HqPublisher; } export declare function createGlobalMailbox(options: CreateGlobalMailboxOptions): GlobalMailbox; //# sourceMappingURL=factory.d.ts.map