;
/**
* Convert a parsed JSON value into a `{ uri, tree }` pair.
* Exported for tests; not part of the public API.
*/
declare function normaliseEntry(parsed: unknown, absFile: string, absDir: string): {
uri: string;
tree: SduiNode;
};
/**
* Render a self-contained HTML page that mounts {@link DeclarativeMockHost}
* with a debug registry (every primitive renders to a labelled ``).
*
* Returned as a string so the Vite middleware can serve it from memory without
* touching the consumer's filesystem.
*/
declare function renderIndexHtml(resourceUris: string[]): string;
/**
* Build the virtual entry module the browser loads. Embeds the resource map
* inline so the dev server does not have to serve JSON over a separate
* endpoint — Vite HMR re-evaluates this module whenever resources change.
*/
declare function renderEntryModule(resources: ResourceMap, tools?: ToolResultMap): string;
/** Discriminated union of the two render modes the CLI knows about. */
type RenderMode = "host-rendered" | "remote-runtime";
/**
* Parsed CLI arguments. `path` is the positional argument — its meaning
* depends on {@link renderMode}:
*
* - `host-rendered`: a directory of SDUI resource JSON files.
* - `remote-runtime`: a path (or URL) to a built worker bundle.
*/
interface ParsedArgs {
renderMode: RenderMode;
path: string;
}
/**
* Parse the CLI's argv-slice. Exported so the test suite can assert flag
* handling without booting a Vite server.
*
* Accepts both `--render-mode ` and `--render-mode=`. Defaults
* to `host-rendered` to preserve Wave 0 behaviour for existing users.
*/
declare function parseArgs(args: readonly string[]): ParsedArgs;
/**
* Render the HTML shell for the Contract B mock host. The page hosts a
* receiver that mounts the Remote DOM tree produced by the worker — each
* Contract B primitive renders to a labelled placeholder.
*/
declare function renderWorkerBundleIndexHtml(bundlePath: string): string;
/**
* Build the inline entry module the browser loads for Contract B.
*
* The module:
* 1. Constructs a {@link WorkerRemoteDomTransport} pointing at the bundle.
* 2. Registers a placeholder for every Contract B semantic primitive — the
* test-injectable seam from E2.S4. Production hosts would substitute
* gogo-ui components here.
* 3. Wires the receiver onto the host's `` slot.
*
* In-page wiring is deliberately minimal — the goal is observability, not a
* production receiver implementation. Authors iterate against the same
* surface their plugins will mount into when the platform host is finished.
*/
declare function renderWorkerBundleEntryModule(bundleUrl: string): string;
/**
* Construction options for {@link bootContractBHost}.
*/
interface BootContractBHostOptions {
/**
* Path or canonical URL to the plugin's worker bundle. The mock host
* serves it from the configured Vite root — production hosts always use
* a path-pinned host-origin URL.
*/
bundleUrl: string;
/**
* Injectable Worker constructor. Tests pass a fake; the production CLI
* path uses the global `Worker`. The transport itself defaults to
* `globalThis.Worker` when omitted — but the mock-host CLI passes through
* the caller's choice so test seams compose cleanly.
*/
workerCtor?: WorkerCtor;
/**
* Optional capability token provider. Defaults to a marker string so
* authors don't need to wire token plumbing into local-dev.
*/
capabilityToken?: () => Promise;
/**
* Optional MCP HTTP client. Defaults to a stub that echoes the request
* shape — authors who need real MCP traffic compose the platform host.
*/
mcpClient?: McpHttpClient;
}
/**
* Spawn the in-process worker that drives the Contract B mock host.
*
* Returns the constructed transport so callers (production CLI: the dev page;
* tests: assertions) can observe spawn shape, dispose the worker on shutdown,
* and inspect coalescing behaviour. Reuses
* {@link WorkerRemoteDomTransport} so the capability-token isolation rules
* documented in E2.S3 apply without re-implementation.
*/
declare function bootContractBHost(options: BootContractBHostOptions): WorkerRemoteDomTransport;
/**
* Boot the Vite dev server with an in-memory entry + virtual page.
*
* Side-effectful: imports `vite` lazily so the pure `loadResources` export
* stays usable from environments that lack a Vite install (e.g., the unit
* tests in this package).
*
* Dispatches on `--render-mode`:
* - `host-rendered` (default): Wave 0 declarative-mock-host behaviour.
* - `remote-runtime`: Wave 1 Contract B — spawns a worker pointing at the
* supplied bundle path and serves the placeholder dev page.
*/
declare function run(args: string[]): Promise<{
url: string;
close: () => Promise;
}>;
export { type BootContractBHostOptions, type ParsedArgs, type RenderMode, type ResourceMap, type ToolResultMap, bootContractBHost, loadResources, loadTools, normaliseEntry, parseArgs, renderEntryModule, renderIndexHtml, renderWorkerBundleEntryModule, renderWorkerBundleIndexHtml, run };