/** * Extension manifests — `extension.toml` discovery, merge, and `${env:VAR}` * expansion. The TS sibling of the Rust host's `extension/manifest.rs`. * * - An extension lives in a directory holding an `extension.toml`. * - Global extensions: `~/.smooth/extensions//extension.toml` * (or `$SMOOTH_HOME/extensions/...`). * - Project extensions: `/.smooth/extensions//extension.toml`. * - On a name collision the **project entry wins** (the mcp.toml / plugin.toml * merge rule). * - `[run] env` values support `${env:VAR}` expansion so secrets stay out of the * manifest. * - A single malformed manifest is tolerated: it is collected as a failure and * the rest still load. */ /** * Where a manifest was discovered. Project extensions only load in trusted * workspaces; the host uses this to apply that policy. */ export type Scope = 'global' | 'project'; /** How to launch the extension subprocess. */ export interface RunSpec { /** Executable to spawn (e.g. `node`, `python3`, an absolute path). */ command: string; args: string[]; /** Extra env vars; values may reference `${env:VAR}`. */ env: Record; } /** * Capability declarations. The `events` list doubles as the host's dispatch * filter — an extension only receives events it names here. */ export interface Capabilities { events: string[]; tools: boolean; commands: boolean; ui: boolean; exec: boolean; kv: boolean; bus: boolean; session: boolean; } /** Resource directories the extension contributes (skills, prompts, themes). */ export interface Resources { skills?: string; prompts?: string; themes?: string; } /** A parsed `extension.toml`. */ export interface ExtensionManifest { name: string; version: string; /** Highest SEP protocol version the extension declares. Defaults to 1. */ protocol: number; run: RunSpec; capabilities: Capabilities; resources: Resources; /** Per-extension hook timeout override, in milliseconds. */ hookTimeoutMs?: number; /** Optional: skip this extension without deleting its manifest. */ disabled: boolean; } /** * A discovered extension: its manifest plus the directory it was found in * (relative resources and `args` resolve against this root) and its scope. */ export interface DiscoveredExtension { manifest: ExtensionManifest; root: string; scope: Scope; } /** A `(source, error message)` pair for a manifest that failed to parse. */ export type ManifestFailure = [source: string, error: string]; /** * Parse a manifest from TOML text. Throws when the TOML is malformed or the * required `name` / `version` / `[run] command` fields are missing — the same * required set the Rust serde struct enforces. */ export declare function parseManifest(tomlText: string): ExtensionManifest; /** Load a manifest from `/extension.toml`. Throws if missing or malformed. */ export declare function loadManifestDir(dir: string): ExtensionManifest; /** * Return the `[run] env` map with `${env:VAR}` references expanded against the * host's current environment. Unset variables expand to empty strings. */ export declare function resolvedEnv(manifest: ExtensionManifest): Record; /** * Default global extensions directory: `$SMOOTH_HOME/extensions` if set, else * `~/.smooth/extensions`. */ export declare function defaultGlobalDir(): string | undefined; /** The project extensions directory for a workspace root. */ export declare function projectDir(workspaceRoot: string): string; /** * Discover every extension under `globalDir` and `projectDir`, merging by name * with **project winning**. Either directory may be `undefined` or missing * (treated as empty). Returns the chosen extensions plus a list of * `(source, error)` for manifests that failed to parse — a single bad manifest * never aborts discovery. */ export declare function discover(globalDir: string | undefined, projectDirPath: string | undefined): { extensions: DiscoveredExtension[]; failures: ManifestFailure[]; }; /** * Expand `${env:VAR}` references using the host's current environment. Unset * variables expand to empty strings. Mirrors the Rust/MCP loader so the two * config surfaces behave identically. */ export declare function expandEnv(input: string): string; //# sourceMappingURL=manifest.d.ts.map