/** * The framework-neutral Lit devframe: RPC functions, shared state, and the * timeline stream. Talks to the page runtime only through the injected * {@link TimelineSource} port, so it runs unchanged under `createDevServer()`, * `createBuild()`, or an MCP server with no Vite in the loop. `vite.ts` wires * the real page-runtime bridge and mounts this via `createPluginFromDevframe`. * * Nothing reachable from here at module scope may import a `node:` module: * the definition also runs in a browser, with no server at all. Node-only * work (`open-source`, `export-snapshot`) imports what it needs inside its * handler, and a browser host never gets that far. * * @see plans/devframe-foundation.md */ import type { DevframeDefinition } from 'devframe'; import type { FeatureSettings } from '../../types/timeline.js'; import { type ComponentDocsArgs, type ComponentDocsResult } from './protocol.js'; import { type HostKind } from './host-profile.js'; import type { NodeActions } from './node-actions.js'; import type { TimelineSource } from './source.js'; import type { SessionSnapshot } from '../../types/snapshot.js'; export interface CreateLitDevframeOptions { /** Page-runtime bridge. Use `createNullSource()` when no page is attached. */ source: TimelineSource; /** Plugin version, surfaced by `get-meta` and the devframe's own `version`. */ version: string; /** Resolved feature settings, surfaced by `get-meta`. */ features?: () => FeatureSettings | null; /** The project's root on disk, surfaced by `get-meta` when known. */ projectRoot?: () => string | undefined; /** * Which host this runs on; decides the picker and what `get-meta` reports * the host can do. See `host-profile.ts`. */ host: HostKind; /** * Directory holding the built panel SPA, for hosts that serve it. No * default here: resolving the package's own `dist/client` takes `node:fs`, * and this module also has to load in a browser bundle (a host with no * dev server, where the panel is already the page). Node hosts pass * `PANEL_DIST_DIR` from `paths.ts` themselves. */ clientAssets?: string; /** * Opening files in an editor and writing snapshots to disk. Only Node * hosts pass these (see `node-actions.ts`); without them `open-source` * opens nothing and `export-snapshot` is unavailable. */ nodeActions?: NodeActions; /** * Answers `component-docs` on a host without Node actions: the extension * reads the manifests the page links to (`component-docs/linked.ts`). * Node actions win when a host has both. */ docsSource?: (args: ComponentDocsArgs) => Promise; /** * Hands {@link docsSource}'s host a function that tells the panel to ask * for the docs it shows again, as when the extension's user points it at * another manifest. */ onDocsSourceChanged?: (notify: () => void) => void; /** * Boot from a recorded session instead of a live one. Set only by the * static-snapshot build (see `lib/snapshot.ts`): the caches below start * populated, so the frozen panel has a timeline and a component tree to * render with no page and no dev server behind it. */ replay?: SessionSnapshot; /** * How long `list-components` and `component-details` wait for the page * before answering from the cache. Short on purpose: the null source never * answers, and an agent call must not hang. Tests lower it. */ inspectorTimeoutMs?: number; } /** * Builds the Lit devframe definition. Framework-neutral: everything here * runs the same whether the host is Vite (`vite.ts`), a standalone dev * server, a static build, or an MCP server. */ export declare function createLitDevframe(options: CreateLitDevframeOptions): DevframeDefinition; //# sourceMappingURL=definition.d.ts.map