## API Report File for "@eigenpal/docx-editor-core"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

// @public
type CommandHandler = (doc: Document_2, command: PluginCommand) => Document_2;
export { CommandHandler }
export { CommandHandler as PluginCommandHandler }

// @public
export interface CommandResult {
    document: Document_2;
    error?: string;
    metadata?: Record<string, unknown>;
    success: boolean;
}

// @public
interface CorePlugin {
    commandHandlers?: Record<string, CommandHandler>;
    dependencies?: string[];
    description?: string;
    destroy?: () => void | Promise<void>;
    id: string;
    initialize?: () => void | Promise<void>;
    mcpTools?: McpToolDefinition[];
    name: string;
    version?: string;
}
export { CorePlugin }
export { CorePlugin as Plugin }

// @public
export function createPluginRegistrar(options: PluginOptions): (plugin: CorePlugin) => PluginRegistrationResult;

// @public
export const docxtemplaterPlugin: CorePlugin;

// @public
export type ExtractCommand<T extends AgentCommand, Type extends string> = T extends {
    type: Type;
} ? T : never;

// @public
export function isZodSchema(schema: unknown): schema is ZodSchemaLike;

// @public
export interface JsonSchema {
    // (undocumented)
    $ref?: string;
    // (undocumented)
    additionalProperties?: boolean | JsonSchema;
    // (undocumented)
    allOf?: JsonSchema[];
    // (undocumented)
    anyOf?: JsonSchema[];
    // (undocumented)
    default?: unknown;
    // (undocumented)
    description?: string;
    // (undocumented)
    enum?: unknown[];
    // (undocumented)
    format?: string;
    // (undocumented)
    items?: JsonSchema;
    // (undocumented)
    maximum?: number;
    // (undocumented)
    maxLength?: number;
    // (undocumented)
    minimum?: number;
    // (undocumented)
    minLength?: number;
    // (undocumented)
    oneOf?: JsonSchema[];
    // (undocumented)
    pattern?: string;
    // (undocumented)
    properties?: Record<string, JsonSchema>;
    // (undocumented)
    required?: string[];
    // (undocumented)
    type?: string | string[];
}

// @public
export interface LoadedDocument {
    buffer?: ArrayBuffer;
    document: Document_2;
    id: string;
    lastModified: number;
    source?: string;
}

// @public
export interface McpSession {
    data: Map<string, unknown>;
    documents: Map<string, LoadedDocument>;
    id: string;
}

// @public
export interface McpToolAnnotations {
    category?: string;
    complexity?: 'low' | 'medium' | 'high';
    examples?: McpToolExample[];
    readOnly?: boolean;
}

// @public
export type McpToolContent = {
    type: 'text';
    text: string;
} | {
    type: 'image';
    data: string;
    mimeType: string;
} | {
    type: 'resource';
    uri: string;
    mimeType?: string;
    text?: string;
};

// @public
export interface McpToolContext {
    document?: Document_2;
    documentBuffer?: ArrayBuffer;
    log: (message: string, data?: unknown) => void;
    session: McpSession;
}

// @public
interface McpToolDefinition {
    annotations?: McpToolAnnotations;
    description: string;
    handler: McpToolHandler;
    inputSchema: JsonSchema | ZodSchemaLike;
    name: string;
}
export { McpToolDefinition }
export { McpToolDefinition as ToolDefinition }

// @public
export interface McpToolExample {
    description: string;
    input: unknown;
    output?: string;
}

// @public
type McpToolHandler = (input: unknown, context: McpToolContext) => Promise<McpToolResult> | McpToolResult;
export { McpToolHandler }
export { McpToolHandler as ToolHandler }

// @public
interface McpToolResult {
    content: McpToolContent[];
    isError?: boolean;
}
export { McpToolResult }
export { McpToolResult as ToolResult }

// @public
export interface PluginCommand {
    [key: string]: unknown;
    id?: string;
    position?: Position_2;
    range?: Range_2;
    type: string;
}

// @public
export type PluginEvent = {
    type: 'registered';
    plugin: CorePlugin;
} | {
    type: 'unregistered';
    pluginId: string;
} | {
    type: 'error';
    pluginId: string;
    error: Error;
};

// @public
export type PluginEventListener = (event: PluginEvent) => void;

// @public
export interface PluginOptions {
    config?: Record<string, unknown>;
    debug?: boolean;
}

// @public
export interface PluginRegistrationResult {
    error?: string;
    plugin?: CorePlugin;
    success: boolean;
    warnings?: string[];
}

// @public
export class PluginRegistry {
    addEventListener(listener: PluginEventListener): void;
    clear(): void;
    get(id: string): CorePlugin | undefined;
    getAll(): CorePlugin[];
    getCommandHandler(commandType: string): CommandHandler | undefined;
    getCommandTypes(): string[];
    getDebugInfo(): {
        plugins: string[];
        commandTypes: string[];
        mcpTools: string[];
        initialized: string[];
    };
    getMcpTool(toolName: string): McpToolDefinition | undefined;
    getMcpTools(): McpToolDefinition[];
    getMcpToolsForPlugin(pluginId: string): McpToolDefinition[];
    has(id: string): boolean;
    hasCommandHandler(commandType: string): boolean;
    register(plugin: CorePlugin, options?: PluginOptions): PluginRegistrationResult;
    removeEventListener(listener: PluginEventListener): void;
    get size(): number;
    unregister(pluginId: string): boolean;
}

// @public
export const pluginRegistry: PluginRegistry;

// @public
export function registerPlugins(plugins: CorePlugin[], options?: PluginOptions): PluginRegistrationResult[];

// @public
export type TypedCommandHandler<T extends PluginCommand> = (doc: Document_2, command: T) => Document_2;

// @public
export interface ZodSchemaLike {
    // (undocumented)
    _def?: unknown;
    // (undocumented)
    parse?: (data: unknown) => unknown;
    // (undocumented)
    safeParse?: (data: unknown) => {
        success: boolean;
        data?: unknown;
        error?: unknown;
    };
}

```
