## 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
export type AgentCommand = InsertTextCommand | ReplaceTextCommand | DeleteTextCommand | FormatTextCommand | FormatParagraphCommand | ApplyStyleCommand | InsertTableCommand | InsertImageCommand | InsertHyperlinkCommand | RemoveHyperlinkCommand | InsertParagraphBreakCommand | MergeParagraphsCommand | SplitParagraphCommand | SetVariableCommand | ApplyVariablesCommand;

// @public
export interface AgentContent {
    formatting?: Partial<TextFormatting>;
    imageSrc?: string;
    paragraphFormatting?: Partial<ParagraphFormatting>;
    tableData?: string[][];
    text?: string;
    type: 'text' | 'paragraph' | 'table' | 'image';
}

// @public
export interface AgentContext {
    availableStyles: StyleInfo[];
    characterCount: number;
    hasHyperlinks: boolean;
    hasImages: boolean;
    hasTables: boolean;
    language?: string;
    outline: ParagraphOutline[];
    paragraphCount: number;
    sections: SectionInfo[];
    variableCount: number;
    variables: string[];
    wordCount: number;
}

// @public
export interface AgentResponse {
    commands?: AgentCommand[];
    error?: string;
    metadata?: Record<string, unknown>;
    newContent?: AgentContent[];
    newText?: string;
    success: boolean;
    warnings?: string[];
}

// @public
export type AIAction = 'askAI' | 'rewrite' | 'expand' | 'summarize' | 'translate' | 'explain' | 'fixGrammar' | 'makeFormal' | 'makeCasual' | 'custom';

// @public
export interface AIActionRequest {
    action: AIAction;
    context: SelectionContext;
    customPrompt?: string;
    options?: Record<string, unknown>;
    targetLanguage?: string;
}

// @public
export type AIRequestHandler = (request: AIActionRequest) => Promise<AgentResponse>;

// @public
export interface ApplyStyleCommand extends BaseCommand {
    paragraphIndex: number;
    styleId: string;
    // (undocumented)
    type: 'applyStyle';
}

// @public
export interface ApplyVariablesCommand extends BaseCommand {
    // (undocumented)
    type: 'applyVariables';
    values: Record<string, string>;
}

// @public
export interface BaseCommand {
    id?: string;
    type: string;
}

// @public
export type CommandHandler<T extends AgentCommand = AgentCommand> = (command: T) => Promise<boolean>;

// @public
export type CommandType = AgentCommand['type'];

// @public
export function comparePositions(a: Position_2, b: Position_2): -1 | 0 | 1;

// @public
export function createCollapsedRange(position: Position_2): Range_2;

// @public
export function createCommand<T extends AgentCommand>(command: Omit<T, 'id'>): T;

// @public
export function createRange(start: Position_2, end: Position_2): Range_2;

// @public (undocumented)
const _default: {
    createCollapsedRange: typeof createCollapsedRange;
    createRange: typeof createRange;
    isPositionInRange: typeof isPositionInRange;
    comparePositions: typeof comparePositions;
    getActionLabel: typeof getActionLabel;
    getActionDescription: typeof getActionDescription;
    createCommand: typeof createCommand;
    DEFAULT_AI_ACTIONS: AIAction[];
};
export default _default;

// @public
export const DEFAULT_AI_ACTIONS: AIAction[];

// @public
export interface DeleteTextCommand extends BaseCommand {
    range: Range_2;
    // (undocumented)
    type: 'deleteText';
}

// @public
export interface FormatParagraphCommand extends BaseCommand {
    formatting: Partial<ParagraphFormatting>;
    paragraphIndex: number;
    // (undocumented)
    type: 'formatParagraph';
}

// @public
export interface FormatTextCommand extends BaseCommand {
    formatting: Partial<TextFormatting>;
    range: Range_2;
    // (undocumented)
    type: 'formatText';
}

// @public
export function getActionDescription(action: AIAction): string;

// @public
export function getActionLabel(action: AIAction): string;

// @public
export interface InsertHyperlinkCommand extends BaseCommand {
    displayText?: string;
    range: Range_2;
    tooltip?: string;
    // (undocumented)
    type: 'insertHyperlink';
    url: string;
}

// @public
export interface InsertImageCommand extends BaseCommand {
    alt?: string;
    height?: number;
    position: Position_2;
    src: string;
    // (undocumented)
    type: 'insertImage';
    width?: number;
}

// @public
export interface InsertParagraphBreakCommand extends BaseCommand {
    position: Position_2;
    // (undocumented)
    type: 'insertParagraphBreak';
}

// @public
export interface InsertTableCommand extends BaseCommand {
    columns: number;
    data?: string[][];
    hasHeader?: boolean;
    position: Position_2;
    rows: number;
    // (undocumented)
    type: 'insertTable';
}

// @public
export interface InsertTextCommand extends BaseCommand {
    formatting?: TextFormatting;
    position: Position_2;
    text: string;
    // (undocumented)
    type: 'insertText';
}

// @public
export function isPositionInRange(position: Position_2, range: Range_2): boolean;

// @public
export interface MergeParagraphsCommand extends BaseCommand {
    count: number;
    paragraphIndex: number;
    // (undocumented)
    type: 'mergeParagraphs';
}

// @public
export interface ParagraphContext {
    fullText: string;
    index: number;
    style?: string;
    wordCount: number;
}

// @public
export interface ParagraphOutline {
    headingLevel?: number;
    index: number;
    isEmpty?: boolean;
    isHeading?: boolean;
    isListItem?: boolean;
    preview: string;
    style?: string;
}

// @public
interface Position_2 {
    contentIndex?: number;
    offset: number;
    paragraphIndex: number;
    sectionIndex?: number;
}
export { Position_2 as Position }

// @public
interface Range_2 {
    collapsed?: boolean;
    end: Position_2;
    start: Position_2;
}
export { Range_2 as Range }

// @public
export interface RemoveHyperlinkCommand extends BaseCommand {
    range: Range_2;
    // (undocumented)
    type: 'removeHyperlink';
}

// @public
export interface ReplaceTextCommand extends BaseCommand {
    formatting?: TextFormatting;
    range: Range_2;
    text: string;
    // (undocumented)
    type: 'replaceText';
}

// @public
export interface SectionInfo {
    hasFooter?: boolean;
    hasHeader?: boolean;
    index: number;
    isLandscape?: boolean;
    pageSize?: {
        width: number;
        height: number;
    };
    paragraphCount: number;
}

// @public
export interface SelectionContext {
    formatting: Partial<TextFormatting>;
    inHyperlink?: boolean;
    inTable?: boolean;
    paragraph: ParagraphContext;
    paragraphFormatting: Partial<ParagraphFormatting>;
    range: Range_2;
    selectedText: string;
    suggestedActions?: SuggestedAction[];
    textAfter: string;
    textBefore: string;
}

// @public
export interface SetVariableCommand extends BaseCommand {
    name: string;
    // (undocumented)
    type: 'setVariable';
    value: string;
}

// @public
export interface SplitParagraphCommand extends BaseCommand {
    position: Position_2;
    // (undocumented)
    type: 'splitParagraph';
}

// @public
export interface StyleInfo {
    builtIn?: boolean;
    id: string;
    name: string;
    type: 'paragraph' | 'character' | 'table';
}

// @public
export interface SuggestedAction {
    description?: string;
    icon?: string;
    id: string;
    label: string;
    priority?: number;
}

```
