@eigenpal/docx-editor-agents 0.5.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/LICENSE +204 -672
  2. package/README.md +74 -42
  3. package/dist/agent-types-C8RvQB7n.d.mts +36 -0
  4. package/dist/agent-types-C8RvQB7n.d.ts +36 -0
  5. package/dist/ai-sdk/react.d.mts +29 -39
  6. package/dist/ai-sdk/react.d.ts +29 -39
  7. package/dist/ai-sdk/react.js +1 -1
  8. package/dist/ai-sdk/react.mjs +1 -1
  9. package/dist/ai-sdk/server.d.mts +42 -4
  10. package/dist/ai-sdk/server.d.ts +42 -4
  11. package/dist/ai-sdk/vue.d.ts +32 -0
  12. package/dist/ai-sdk/vue.js +1 -0
  13. package/dist/ai-sdk/vue.mjs +31 -0
  14. package/dist/bridge.d.mts +18 -1
  15. package/dist/bridge.d.ts +18 -1
  16. package/dist/bridge.js +1 -1
  17. package/dist/bridge.mjs +1 -1
  18. package/dist/chunk-BJPVVT5W.mjs +1 -0
  19. package/dist/{chunk-CPJV53R6.mjs → chunk-DEDOV3KL.mjs} +1 -1
  20. package/dist/chunk-DQH7AV5E.js +71 -0
  21. package/dist/chunk-DZYPK4JQ.mjs +2 -0
  22. package/dist/chunk-JH5VOTEK.js +2 -0
  23. package/dist/chunk-LSPYEWWJ.js +1 -0
  24. package/dist/chunk-NISW2GF6.js +1 -0
  25. package/dist/chunk-NX2KNBB6.mjs +71 -0
  26. package/dist/{chunk-LVRKZUG4.js → chunk-TFIRB2ZB.js} +3 -3
  27. package/dist/chunk-X4YGLGUM.mjs +1 -0
  28. package/dist/docx-editor-agents.css +1 -0
  29. package/dist/executor-QBMOTUCJ.js +1 -0
  30. package/dist/executor-RSQI3VOF.mjs +1 -0
  31. package/dist/{headless-JRF2KBID.mjs → headless-J5TF46GZ.mjs} +1 -1
  32. package/dist/headless-ULW7Q5F4.js +1 -0
  33. package/dist/index.d.mts +32 -2
  34. package/dist/index.d.ts +32 -2
  35. package/dist/index.js +1 -1
  36. package/dist/index.mjs +1 -1
  37. package/dist/mcp.d.mts +20 -1
  38. package/dist/mcp.d.ts +20 -1
  39. package/dist/react.d.mts +175 -3
  40. package/dist/react.d.ts +175 -3
  41. package/dist/react.js +9 -1
  42. package/dist/react.mjs +9 -1
  43. package/dist/{server-DH5eszkm.d.mts → server-B7RHNVSu.d.mts} +970 -753
  44. package/dist/{server-DH5eszkm.d.ts → server-B7RHNVSu.d.ts} +970 -753
  45. package/dist/server.d.mts +34 -1
  46. package/dist/server.d.ts +34 -1
  47. package/dist/server.js +1 -1
  48. package/dist/server.mjs +1 -1
  49. package/dist/vue/components/AIContextMenu.d.ts +33 -0
  50. package/dist/vue/components/AIResponsePreview.d.ts +40 -0
  51. package/dist/vue/components/AgentChatLog.d.ts +37 -0
  52. package/dist/vue/components/AgentComposer.d.ts +30 -0
  53. package/dist/vue/components/AgentPanel.d.ts +49 -0
  54. package/dist/vue/components/AgentSuggestionChip.d.ts +10 -0
  55. package/dist/vue/components/AgentTimeline.d.ts +19 -0
  56. package/dist/vue/composables/useAgentBridge.d.ts +19 -0
  57. package/dist/vue/types.d.ts +5 -0
  58. package/dist/vue.d.ts +72 -0
  59. package/dist/vue.js +21 -0
  60. package/dist/vue.mjs +1857 -0
  61. package/package.json +52 -9
  62. package/dist/chunk-6NWAUIGY.js +0 -1
  63. package/dist/chunk-A6ANAWKH.js +0 -1
  64. package/dist/chunk-BDHS4WRJ.mjs +0 -1
  65. package/dist/chunk-G46D3GDJ.js +0 -71
  66. package/dist/chunk-N2TKFYHU.js +0 -2
  67. package/dist/chunk-QALBLABE.mjs +0 -2
  68. package/dist/chunk-U7BWZ7DG.mjs +0 -1
  69. package/dist/chunk-XZHZXQO5.mjs +0 -71
  70. package/dist/executor-OYRPTNBR.mjs +0 -1
  71. package/dist/executor-SJAFSXKL.js +0 -1
  72. package/dist/headless-FE3K7ABO.js +0 -1
@@ -8,7 +8,13 @@
8
8
  */
9
9
  type ThemeColorSlot = 'dk1' | 'lt1' | 'dk2' | 'lt2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6' | 'hlink' | 'folHlink' | 'background1' | 'text1' | 'background2' | 'text2';
10
10
  /**
11
- * Color value - can be direct RGB, theme reference, or auto
11
+ * ECMA-376 color reference either a direct RGB hex, a theme slot
12
+ * reference (with optional tint/shade), or `auto` for context-dependent
13
+ * defaults (usually black for text on light backgrounds). When both
14
+ * `rgb` and `themeColor` are set, the theme wins on Word import and the
15
+ * `rgb` acts as a fallback for renderers without theme support.
16
+ *
17
+ * See ECMA-376 §17.18.39 (`ST_ThemeColor`).
12
18
  */
13
19
  interface ColorValue {
14
20
  /** RGB hex value without # (e.g., "FF0000") */
@@ -23,7 +29,12 @@ interface ColorValue {
23
29
  auto?: boolean;
24
30
  }
25
31
  /**
26
- * Border specification for any border (paragraph, table, page)
32
+ * One side of a border — style, color, width, spacing. Used by paragraph
33
+ * borders, table borders (per-cell or whole-table), and page borders.
34
+ * `size` is in eighths of a point (Word's wire format); `space` is in
35
+ * points.
36
+ *
37
+ * See ECMA-376 §17.18.2 (`ST_Border`).
27
38
  */
28
39
  interface BorderSpec {
29
40
  /** Border style */
@@ -40,7 +51,12 @@ interface BorderSpec {
40
51
  frame?: boolean;
41
52
  }
42
53
  /**
43
- * Shading/background properties
54
+ * Cell/paragraph/run shading — Word's combined "fill + pattern overlay"
55
+ * model. `fill` is the solid background; `color` is the pattern overlay
56
+ * drawn on top; `pattern` selects the pattern type (defaults to
57
+ * `'clear'` = solid `fill`, no pattern).
58
+ *
59
+ * See ECMA-376 §17.4.32 (`CT_Shd`).
44
60
  */
45
61
  interface ShadingProperties {
46
62
  /** Pattern fill color */
@@ -71,7 +87,14 @@ type TextEffect = 'none' | 'blinkBackground' | 'lights' | 'antsBlack' | 'antsRed
71
87
  */
72
88
  type EmphasisMark = 'none' | 'dot' | 'comma' | 'circle' | 'underDot';
73
89
  /**
74
- * Complete text formatting properties (w:rPr)
90
+ * Character-level formatting (`w:rPr`) — the full set of run properties
91
+ * Word supports: weight, slant, font, size, color, highlight, underline,
92
+ * strikethrough, vertical position, language, complex-script variants,
93
+ * spacing/kerning, emphasis marks, and more.
94
+ *
95
+ * Most fields mirror their ECMA-376 element names (see §17.3.2). Missing
96
+ * keys inherit from the run's paragraph style → linked style → document
97
+ * defaults chain.
75
98
  */
76
99
  interface TextFormatting {
77
100
  /** Bold (w:b) */
@@ -176,15 +199,24 @@ type LineSpacingRule = 'auto' | 'exact' | 'atLeast';
176
199
  */
177
200
  type ParagraphAlignment = 'left' | 'center' | 'right' | 'both' | 'distribute' | 'mediumKashida' | 'highKashida' | 'lowKashida' | 'thaiDistribute';
178
201
  /**
179
- * Complete paragraph formatting properties (w:pPr)
202
+ * Per-side flags identifying which `<w:spacing>` attrs were inline (not
203
+ * inherited from a style chain). Used to suppress style-only spacing on
204
+ * empty paragraphs per Word's behavior.
180
205
  */
181
- /** Per-side flags identifying which `<w:spacing>` attrs were inline (not
182
- * inherited from a style chain). Used to suppress style-only spacing on
183
- * empty paragraphs per Word's behavior. */
184
206
  type SpacingExplicit = {
185
207
  before?: boolean;
186
208
  after?: boolean;
187
209
  };
210
+ /**
211
+ * Paragraph-level formatting (`w:pPr`) — alignment, indentation, spacing
212
+ * (before/after, line height), pagination flags (keepNext, keepLines,
213
+ * pageBreakBefore, widowControl), tabs, borders, shading, numbering
214
+ * reference, style reference, and frame/anchored-text properties.
215
+ *
216
+ * Most fields mirror their ECMA-376 element names (see §17.3.1).
217
+ * Inheritance: direct formatting beats the linked style which beats
218
+ * document defaults.
219
+ */
188
220
  interface ParagraphFormatting {
189
221
  /** Paragraph alignment (w:jc) */
190
222
  alignment?: ParagraphAlignment;
@@ -457,7 +489,12 @@ type NumberFormat = 'decimal' | 'upperRoman' | 'lowerRoman' | 'upperLetter' | 'l
457
489
  */
458
490
  type LevelSuffix = 'tab' | 'space' | 'nothing';
459
491
  /**
460
- * List level definition
492
+ * One indentation level of an abstract numbering definition (`w:lvl`).
493
+ * Carries the number format, the marker template (`lvlText` — e.g.
494
+ * `"%1.%2."`), the level's paragraph properties (indent, hanging) and
495
+ * character properties (font, size, color for the marker itself).
496
+ *
497
+ * `ilvl` ranges 0-8 in standard Word documents.
461
498
  */
462
499
  interface ListLevel {
463
500
  /** Level index (0-8) */
@@ -488,7 +525,13 @@ interface ListLevel {
488
525
  };
489
526
  }
490
527
  /**
491
- * Abstract numbering definition (w:abstractNum)
528
+ * Abstract numbering definition (`w:abstractNum`) — the reusable template
529
+ * for a list: which `NumberFormat` at each indentation level, what
530
+ * marker text, what paragraph/character formatting. Multiple
531
+ * `NumberingInstance`s (`w:num`) can reference one abstract numbering
532
+ * to share the template while keeping independent counters.
533
+ *
534
+ * See ECMA-376 §17.9.
492
535
  */
493
536
  interface AbstractNumbering {
494
537
  /** Abstract numbering ID */
@@ -520,7 +563,10 @@ interface NumberingInstance {
520
563
  }>;
521
564
  }
522
565
  /**
523
- * Computed list rendering info
566
+ * Computed list marker for one paragraph — what the layout engine and
567
+ * painter need to render the "1.", "a)", "•" prefix. Not part of the
568
+ * wire format; the parser fills this from the `numbering.xml` chain plus
569
+ * the paragraph's `numPr`. Paragraphs without list rendering omit it.
524
570
  */
525
571
  interface ListRendering {
526
572
  /** Computed marker text (e.g., "1.", "a)", "•") */
@@ -555,7 +601,10 @@ interface ListRendering {
555
601
  startOverride?: number;
556
602
  }
557
603
  /**
558
- * Complete numbering definitions
604
+ * Top-level numbering data from `numbering.xml` — the set of abstract
605
+ * templates and the per-document `NumberingInstance`s that reference
606
+ * them. Paragraphs reference a `numId` (instance), not an
607
+ * `abstractNumId` directly.
559
608
  */
560
609
  interface NumberingDefinitions {
561
610
  /** Abstract numbering definitions */
@@ -571,130 +620,20 @@ interface NumberingDefinitions {
571
620
  * - `square` / `tight` / `through` — text wraps around the image
572
621
  * - `topAndBottom` — text breaks above and below
573
622
  * - `behind` / `inFront` (`wp:wrapNone`) — image paints out of flow
623
+ * @packageDocumentation
624
+ * @public
574
625
  */
575
626
  type WrapType = 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'inFront';
576
627
 
577
628
  /**
578
- * Document Content Model
579
- *
580
- * All content-bearing types: runs, hyperlinks, bookmarks, fields,
581
- * images, shapes, tables, lists, paragraphs, headers/footers,
582
- * footnotes/endnotes, and sections.
583
- *
584
- * These types form a deeply interrelated tree (Paragraph ↔ Table ↔ ShapeTextBody)
585
- * and are kept together to avoid circular import issues.
629
+ * Hyperlinks (`w:hyperlink`), bookmark markers (`w:bookmarkStart`/`End`),
630
+ * and field types (`w:fldSimple`, complex `w:fldChar` runs).
586
631
  */
587
632
 
588
633
  /**
589
- * Plain text content
590
- */
591
- interface TextContent {
592
- type: 'text';
593
- /** The text string */
594
- text: string;
595
- /** Preserve whitespace (xml:space="preserve") */
596
- preserveSpace?: boolean;
597
- }
598
- /**
599
- * Tab character
600
- */
601
- interface TabContent {
602
- type: 'tab';
603
- }
604
- /**
605
- * Line break
606
- */
607
- interface BreakContent {
608
- type: 'break';
609
- /** Break type */
610
- breakType?: 'page' | 'column' | 'textWrapping';
611
- /** Clear type for text wrapping break */
612
- clear?: 'none' | 'left' | 'right' | 'all';
613
- }
614
- /**
615
- * Symbol character (special font character)
616
- */
617
- interface SymbolContent {
618
- type: 'symbol';
619
- /** Font name */
620
- font: string;
621
- /** Character code */
622
- char: string;
623
- }
624
- /**
625
- * Footnote or endnote reference
626
- */
627
- interface NoteReferenceContent {
628
- type: 'footnoteRef' | 'endnoteRef';
629
- /** Note ID */
630
- id: number;
631
- }
632
- /**
633
- * Field character (begin/separate/end)
634
- */
635
- interface FieldCharContent {
636
- type: 'fieldChar';
637
- /** Field character type */
638
- charType: 'begin' | 'separate' | 'end';
639
- /** Field is locked */
640
- fldLock?: boolean;
641
- /** Field is dirty (needs update) */
642
- dirty?: boolean;
643
- }
644
- /**
645
- * Field instruction text
646
- */
647
- interface InstrTextContent {
648
- type: 'instrText';
649
- /** Field instruction */
650
- text: string;
651
- }
652
- /**
653
- * Soft hyphen
654
- */
655
- interface SoftHyphenContent {
656
- type: 'softHyphen';
657
- }
658
- /**
659
- * Non-breaking hyphen
660
- */
661
- interface NoBreakHyphenContent {
662
- type: 'noBreakHyphen';
663
- }
664
- /**
665
- * Drawing/image reference
666
- */
667
- interface DrawingContent {
668
- type: 'drawing';
669
- /** Image data */
670
- image: Image;
671
- }
672
- /**
673
- * Shape reference
674
- */
675
- interface ShapeContent {
676
- type: 'shape';
677
- /** Shape data */
678
- shape: Shape;
679
- }
680
- /**
681
- * All possible run content types
682
- */
683
- type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
684
- /**
685
- * A run is a contiguous region of text with the same formatting
686
- */
687
- interface Run {
688
- type: 'run';
689
- /** Text formatting properties */
690
- formatting?: TextFormatting;
691
- /** Run-level tracked property changes (w:rPrChange) */
692
- propertyChanges?: RunPropertyChange[];
693
- /** Run content (text, tabs, breaks, etc.) */
694
- content: RunContent[];
695
- }
696
- /**
697
- * Hyperlink (w:hyperlink)
634
+ * Hyperlink (`w:hyperlink`) — wraps runs in a clickable link. External
635
+ * targets resolve through the relationships part (`rId` → `href`);
636
+ * internal targets reference a `BookmarkStart` anchor by name.
698
637
  */
699
638
  interface Hyperlink {
700
639
  type: 'hyperlink';
@@ -774,241 +713,199 @@ interface ComplexField {
774
713
  /** Field is dirty */
775
714
  dirty?: boolean;
776
715
  }
716
+
777
717
  /**
778
- * Image size specification
718
+ * Math equations (`m:oMath`, `m:oMathPara`). OMML XML is round-tripped
719
+ * verbatim to preserve fidelity Word/Pages/Docs can disagree on.
779
720
  */
780
- interface ImageSize {
781
- /** Width in EMUs (English Metric Units) */
782
- width: number;
783
- /** Height in EMUs */
784
- height: number;
721
+ /**
722
+ * Math equation content (m:oMath or m:oMathPara)
723
+ */
724
+ interface MathEquation {
725
+ type: 'mathEquation';
726
+ /** Whether this is a block (oMathPara) or inline (oMath) equation */
727
+ display: 'inline' | 'block';
728
+ /** Raw OMML XML for round-trip preservation */
729
+ ommlXml: string;
730
+ /** Plain text representation for accessibility/fallback */
731
+ plainText?: string;
785
732
  }
733
+
786
734
  /**
787
- * Image wrap type for floating images
735
+ * Tracked-changes model insertion/deletion/move wrappers, range
736
+ * markers, and per-element property-change wrappers (`w:rPrChange`,
737
+ * `w:pPrChange`, `w:tblPrChange`, `w:trPrChange`, `w:tcPrChange`) plus
738
+ * structural changes (row/cell insert/delete/merge).
788
739
  */
789
- interface ImageWrap {
790
- type: WrapType;
791
- /** Wrap text direction */
792
- wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
793
- /** Distance from text */
794
- distT?: number;
795
- distB?: number;
796
- distL?: number;
797
- distR?: number;
740
+
741
+ /**
742
+ * Tracked change metadata (w:ins, w:del attributes)
743
+ */
744
+ interface TrackedChangeInfo {
745
+ /** Revision ID */
746
+ id: number;
747
+ /** Author who made the change */
748
+ author: string;
749
+ /** Date of the change */
750
+ date?: string;
798
751
  }
799
752
  /**
800
- * Position for floating images
753
+ * Generic tracked property-change wrapper metadata (w:*PrChange)
801
754
  */
802
- interface ImagePosition {
803
- /** Horizontal positioning */
804
- horizontal: {
805
- relativeTo: 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
806
- alignment?: 'left' | 'right' | 'center' | 'inside' | 'outside';
807
- posOffset?: number;
808
- };
809
- /** Vertical positioning */
810
- vertical: {
811
- relativeTo: 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin' | 'bottomMargin';
812
- alignment?: 'top' | 'bottom' | 'center' | 'inside' | 'outside';
813
- posOffset?: number;
814
- };
755
+ interface PropertyChangeInfo extends TrackedChangeInfo {
756
+ /** Optional revision session ID */
757
+ rsid?: string;
815
758
  }
816
759
  /**
817
- * Image transformation
760
+ * Insertion wrapper (w:ins) — runs inserted by tracked changes
818
761
  */
819
- interface ImageTransform {
820
- /** Rotation in degrees */
821
- rotation?: number;
822
- /** Flip horizontal */
823
- flipH?: boolean;
824
- /** Flip vertical */
825
- flipV?: boolean;
762
+ interface Insertion {
763
+ type: 'insertion';
764
+ /** Tracked change metadata */
765
+ info: TrackedChangeInfo;
766
+ /** Inserted content */
767
+ content: (Run | Hyperlink)[];
826
768
  }
827
769
  /**
828
- * Image padding/margins
770
+ * Deletion wrapper (w:del) — runs deleted by tracked changes
829
771
  */
830
- interface ImagePadding {
831
- top?: number;
832
- bottom?: number;
833
- left?: number;
834
- right?: number;
772
+ interface Deletion {
773
+ type: 'deletion';
774
+ /** Tracked change metadata */
775
+ info: TrackedChangeInfo;
776
+ /** Deleted content */
777
+ content: (Run | Hyperlink)[];
835
778
  }
836
779
  /**
837
- * Image crop, expressed as fractions of the source image to trim from each
838
- * edge. OOXML's `<a:srcRect l="10000" t="0" r="5000" b="0"/>` uses units of
839
- * 1/100000 (so 10000 → 0.1 → 10% trimmed from the left). We store the
840
- * normalised fraction so both the renderer and the saver can read it
841
- * directly without re-parsing units.
780
+ * Move-from wrapper (w:moveFrom) — content moved away from this position
842
781
  */
843
- interface ImageCrop {
844
- left?: number;
845
- top?: number;
846
- right?: number;
847
- bottom?: number;
782
+ interface MoveFrom {
783
+ type: 'moveFrom';
784
+ /** Tracked change metadata */
785
+ info: TrackedChangeInfo;
786
+ /** Moved content */
787
+ content: (Run | Hyperlink)[];
848
788
  }
849
789
  /**
850
- * Embedded image (w:drawing)
790
+ * Move-to wrapper (w:moveTo) — content moved into this position
851
791
  */
852
- interface Image {
853
- type: 'image';
854
- /** Unique ID */
855
- id?: string;
856
- /** Relationship ID for the image data */
857
- rId: string;
858
- /** Resolved image data (base64 or blob URL) */
859
- src?: string;
860
- /** Image MIME type */
861
- mimeType?: string;
862
- /** Original filename */
863
- filename?: string;
864
- /** Alt text for accessibility */
865
- alt?: string;
866
- /** Title/description */
867
- title?: string;
868
- /** Image size */
869
- size: ImageSize;
870
- /** Original size before any transforms */
871
- originalSize?: ImageSize;
872
- /** Wrap settings */
873
- wrap: ImageWrap;
874
- /** Position for floating images */
875
- position?: ImagePosition;
876
- /** Image transformations */
877
- transform?: ImageTransform;
878
- /** Padding around image */
879
- padding?: ImagePadding;
880
- /** Source-image crop (fractional, OOXML `a:srcRect`). */
881
- crop?: ImageCrop;
882
- /** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
883
- opacity?: number;
884
- /** Whether this is a decorative image */
885
- decorative?: boolean;
886
- /**
887
- * `wp:anchor layoutInCell` — when true (default), an anchored image inside
888
- * a table cell is constrained to the cell. When false, the image escapes
889
- * the cell into the page area. Round-tripped on save.
890
- */
891
- layoutInCell?: boolean;
892
- /**
893
- * `wp:anchor allowOverlap` — when true (default), anchored objects may
894
- * overlap; when false, Word repositions them to avoid collisions. We
895
- * don't currently reposition; we round-trip the flag so saving preserves
896
- * the author's intent.
897
- */
898
- allowOverlap?: boolean;
899
- /** Hyperlink URL for clickable image */
900
- hlinkHref?: string;
901
- /** Image outline/border */
902
- outline?: ShapeOutline;
903
- /** Image effects */
904
- effects?: {
905
- brightness?: number;
906
- contrast?: number;
907
- saturation?: number;
908
- };
792
+ interface MoveTo {
793
+ type: 'moveTo';
794
+ /** Tracked change metadata */
795
+ info: TrackedChangeInfo;
796
+ /** Moved content */
797
+ content: (Run | Hyperlink)[];
909
798
  }
910
799
  /**
911
- * Shape types
800
+ * Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
801
+ * Pairs with moveFromRangeEnd to delimit the source of a move in the document.
912
802
  */
913
- type ShapeType = 'rect' | 'roundRect' | 'ellipse' | 'triangle' | 'rtTriangle' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'decagon' | 'dodecagon' | 'star4' | 'star5' | 'star6' | 'star7' | 'star8' | 'star10' | 'star12' | 'star16' | 'star24' | 'star32' | 'line' | 'straightConnector1' | 'bentConnector2' | 'bentConnector3' | 'bentConnector4' | 'bentConnector5' | 'curvedConnector2' | 'curvedConnector3' | 'curvedConnector4' | 'curvedConnector5' | 'rightArrow' | 'leftArrow' | 'upArrow' | 'downArrow' | 'leftRightArrow' | 'upDownArrow' | 'quadArrow' | 'leftRightUpArrow' | 'bentArrow' | 'uturnArrow' | 'leftUpArrow' | 'bentUpArrow' | 'curvedRightArrow' | 'curvedLeftArrow' | 'curvedUpArrow' | 'curvedDownArrow' | 'stripedRightArrow' | 'notchedRightArrow' | 'homePlate' | 'chevron' | 'rightArrowCallout' | 'downArrowCallout' | 'leftArrowCallout' | 'upArrowCallout' | 'leftRightArrowCallout' | 'quadArrowCallout' | 'circularArrow' | 'flowChartProcess' | 'flowChartAlternateProcess' | 'flowChartDecision' | 'flowChartInputOutput' | 'flowChartPredefinedProcess' | 'flowChartInternalStorage' | 'flowChartDocument' | 'flowChartMultidocument' | 'flowChartTerminator' | 'flowChartPreparation' | 'flowChartManualInput' | 'flowChartManualOperation' | 'flowChartConnector' | 'flowChartOffpageConnector' | 'flowChartPunchedCard' | 'flowChartPunchedTape' | 'flowChartSummingJunction' | 'flowChartOr' | 'flowChartCollate' | 'flowChartSort' | 'flowChartExtract' | 'flowChartMerge' | 'flowChartOnlineStorage' | 'flowChartDelay' | 'flowChartMagneticTape' | 'flowChartMagneticDisk' | 'flowChartMagneticDrum' | 'flowChartDisplay' | 'wedgeRectCallout' | 'wedgeRoundRectCallout' | 'wedgeEllipseCallout' | 'cloudCallout' | 'borderCallout1' | 'borderCallout2' | 'borderCallout3' | 'accentCallout1' | 'accentCallout2' | 'accentCallout3' | 'callout1' | 'callout2' | 'callout3' | 'accentBorderCallout1' | 'accentBorderCallout2' | 'accentBorderCallout3' | 'actionButtonBlank' | 'actionButtonHome' | 'actionButtonHelp' | 'actionButtonInformation' | 'actionButtonBackPrevious' | 'actionButtonForwardNext' | 'actionButtonBeginning' | 'actionButtonEnd' | 'actionButtonReturn' | 'actionButtonDocument' | 'actionButtonSound' | 'actionButtonMovie' | 'irregularSeal1' | 'irregularSeal2' | 'frame' | 'halfFrame' | 'corner' | 'diagStripe' | 'chord' | 'arc' | 'bracketPair' | 'bracePair' | 'leftBracket' | 'rightBracket' | 'leftBrace' | 'rightBrace' | 'can' | 'cube' | 'bevel' | 'donut' | 'noSmoking' | 'blockArc' | 'foldedCorner' | 'smileyFace' | 'heart' | 'lightningBolt' | 'sun' | 'moon' | 'cloud' | 'snip1Rect' | 'snip2SameRect' | 'snip2DiagRect' | 'snipRoundRect' | 'round1Rect' | 'round2SameRect' | 'round2DiagRect' | 'plaque' | 'teardrop' | 'mathPlus' | 'mathMinus' | 'mathMultiply' | 'mathDivide' | 'mathEqual' | 'mathNotEqual' | 'gear6' | 'gear9' | 'funnel' | 'pieWedge' | 'pie' | 'leftCircularArrow' | 'leftRightCircularArrow' | 'swooshArrow' | 'textBox';
803
+ interface MoveFromRangeStart {
804
+ type: 'moveFromRangeStart';
805
+ id: number;
806
+ name: string;
807
+ }
914
808
  /**
915
- * Shape fill type
809
+ * Move-from range end marker (w:moveFromRangeEnd)
916
810
  */
917
- interface ShapeFill {
918
- type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
919
- /** Solid fill color */
920
- color?: ColorValue;
921
- /** Gradient stops for gradient fill */
922
- gradient?: {
923
- type: 'linear' | 'radial' | 'rectangular' | 'path';
924
- angle?: number;
925
- stops: Array<{
926
- position: number;
927
- color: ColorValue;
928
- }>;
929
- };
811
+ interface MoveFromRangeEnd {
812
+ type: 'moveFromRangeEnd';
813
+ id: number;
930
814
  }
931
815
  /**
932
- * Shape outline/stroke
816
+ * Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
817
+ * Pairs with moveToRangeEnd to delimit the destination of a move.
933
818
  */
934
- interface ShapeOutline {
935
- /** Line width in EMUs */
936
- width?: number;
937
- /** Line color */
938
- color?: ColorValue;
939
- /** Line style */
940
- style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
941
- /** Line cap */
942
- cap?: 'flat' | 'round' | 'square';
943
- /** Line join */
944
- join?: 'bevel' | 'miter' | 'round';
945
- /** Head arrow */
946
- headEnd?: {
947
- type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
948
- width?: 'sm' | 'med' | 'lg';
949
- length?: 'sm' | 'med' | 'lg';
950
- };
951
- /** Tail arrow */
952
- tailEnd?: {
953
- type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
954
- width?: 'sm' | 'med' | 'lg';
955
- length?: 'sm' | 'med' | 'lg';
956
- };
819
+ interface MoveToRangeStart {
820
+ type: 'moveToRangeStart';
821
+ id: number;
822
+ name: string;
957
823
  }
958
824
  /**
959
- * Text body inside a shape
825
+ * Move-to range end marker (w:moveToRangeEnd)
960
826
  */
961
- interface ShapeTextBody {
962
- /** Text direction */
963
- vertical?: boolean;
964
- /** Rotation */
965
- rotation?: number;
966
- /** Anchor/vertical alignment */
967
- anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
968
- /** Anchor center */
969
- anchorCenter?: boolean;
970
- /** Auto fit */
971
- autoFit?: 'none' | 'normal' | 'shape';
972
- /** Text margins */
973
- margins?: {
974
- top?: number;
975
- bottom?: number;
976
- left?: number;
977
- right?: number;
978
- };
979
- /** Paragraphs inside the shape */
980
- content: Paragraph[];
827
+ interface MoveToRangeEnd {
828
+ type: 'moveToRangeEnd';
829
+ id: number;
981
830
  }
982
831
  /**
983
- * Shape/drawing object (wps:wsp)
832
+ * Run property change (w:rPrChange)
984
833
  */
985
- interface Shape {
986
- type: 'shape';
987
- /** Shape type preset */
988
- shapeType: ShapeType;
989
- /** Unique ID */
990
- id?: string;
991
- /** Name */
992
- name?: string;
993
- /** Size in EMUs */
994
- size: ImageSize;
995
- /** Position for floating shapes */
996
- position?: ImagePosition;
997
- /** Wrap settings */
998
- wrap?: ImageWrap;
999
- /** Fill */
1000
- fill?: ShapeFill;
1001
- /** Outline/stroke */
1002
- outline?: ShapeOutline;
1003
- /** Transform */
1004
- transform?: ImageTransform;
1005
- /** Text content inside the shape */
1006
- textBody?: ShapeTextBody;
1007
- /** Custom geometry points */
1008
- customGeometry?: string;
834
+ interface RunPropertyChange {
835
+ type: 'runPropertyChange';
836
+ /** Tracked change metadata */
837
+ info: PropertyChangeInfo;
838
+ /** Run properties before the tracked change */
839
+ previousFormatting?: TextFormatting;
840
+ /** Run properties after the tracked change (editor model convenience) */
841
+ currentFormatting?: TextFormatting;
842
+ }
843
+ /**
844
+ * Paragraph property change (w:pPrChange)
845
+ */
846
+ interface ParagraphPropertyChange {
847
+ type: 'paragraphPropertyChange';
848
+ /** Tracked change metadata */
849
+ info: PropertyChangeInfo;
850
+ /** Paragraph properties before the tracked change */
851
+ previousFormatting?: ParagraphFormatting;
852
+ /** Paragraph properties after the tracked change (editor model convenience) */
853
+ currentFormatting?: ParagraphFormatting;
854
+ }
855
+ /**
856
+ * Table property change (w:tblPrChange)
857
+ */
858
+ interface TablePropertyChange {
859
+ type: 'tablePropertyChange';
860
+ /** Tracked change metadata */
861
+ info: PropertyChangeInfo;
862
+ /** Table properties before the tracked change */
863
+ previousFormatting?: TableFormatting;
864
+ /** Table properties after the tracked change (editor model convenience) */
865
+ currentFormatting?: TableFormatting;
866
+ }
867
+ /**
868
+ * Table row property change (w:trPrChange)
869
+ */
870
+ interface TableRowPropertyChange {
871
+ type: 'tableRowPropertyChange';
872
+ /** Tracked change metadata */
873
+ info: PropertyChangeInfo;
874
+ /** Row properties before the tracked change */
875
+ previousFormatting?: TableRowFormatting;
876
+ /** Row properties after the tracked change (editor model convenience) */
877
+ currentFormatting?: TableRowFormatting;
878
+ }
879
+ /**
880
+ * Table cell property change (w:tcPrChange)
881
+ */
882
+ interface TableCellPropertyChange {
883
+ type: 'tableCellPropertyChange';
884
+ /** Tracked change metadata */
885
+ info: PropertyChangeInfo;
886
+ /** Cell properties before the tracked change */
887
+ previousFormatting?: TableCellFormatting;
888
+ /** Cell properties after the tracked change (editor model convenience) */
889
+ currentFormatting?: TableCellFormatting;
1009
890
  }
1010
891
  /**
1011
- * Table cell
892
+ * Table structural tracked change metadata (row/cell insert/delete/merge)
893
+ */
894
+ interface TableStructuralChangeInfo {
895
+ type: 'tableRowInsertion' | 'tableRowDeletion' | 'tableCellInsertion' | 'tableCellDeletion' | 'tableCellMerge';
896
+ /** Tracked change metadata */
897
+ info: TrackedChangeInfo;
898
+ }
899
+
900
+ /**
901
+ * Tables (`w:tbl`), rows (`w:tr`), and cells (`w:tc`).
902
+ */
903
+
904
+ /**
905
+ * Table cell (`w:tc`). Holds nested block content (paragraphs and nested
906
+ * tables), cell-level formatting (borders, shading, vertical merge),
907
+ * tracked property changes, and tracked structural changes for cell
908
+ * insert/delete/merge operations.
1012
909
  */
1013
910
  interface TableCell {
1014
911
  type: 'tableCell';
@@ -1022,7 +919,9 @@ interface TableCell {
1022
919
  content: (Paragraph | Table)[];
1023
920
  }
1024
921
  /**
1025
- * Table row
922
+ * Table row (`w:tr`) — an ordered list of `TableCell` plus row-level
923
+ * formatting (height, repeated header, cantSplit) and tracked changes
924
+ * for inserts/deletes.
1026
925
  */
1027
926
  interface TableRow {
1028
927
  type: 'tableRow';
@@ -1036,7 +935,12 @@ interface TableRow {
1036
935
  cells: TableCell[];
1037
936
  }
1038
937
  /**
1039
- * Table (w:tbl)
938
+ * Table (`w:tbl`) — a block-level grid of rows × cells. Tables carry
939
+ * their own formatting layer (borders, shading, alignment, indent,
940
+ * floating placement) and an explicit column-width grid in twips. Tables
941
+ * can nest arbitrarily through `TableCell.content`.
942
+ *
943
+ * See ECMA-376 §17.4.
1040
944
  */
1041
945
  interface Table {
1042
946
  type: 'table';
@@ -1049,265 +953,404 @@ interface Table {
1049
953
  /** Table rows */
1050
954
  rows: TableRow[];
1051
955
  }
956
+
1052
957
  /**
1053
- * A comment (w:comment) from comments.xml
958
+ * Structured Document Tags / content controls (`w:sdt`) inline and
959
+ * block variants, plus properties (alias, tag, lock, list items,
960
+ * checkbox state) for the supported SDT types.
1054
961
  */
1055
- interface Comment {
1056
- /** Comment ID (matches commentRangeStart/End) */
1057
- id: number;
1058
- /** Author name */
1059
- author: string;
1060
- /** Author initials */
1061
- initials?: string;
1062
- /** Date */
1063
- date?: string;
1064
- /** Comment content (paragraphs) */
1065
- content: Paragraph[];
1066
- /** Parent comment ID (for replies) */
1067
- parentId?: number;
1068
- /** Whether the comment is resolved/done */
1069
- done?: boolean;
1070
- }
962
+
1071
963
  /**
1072
- * Comment range start marker in paragraph content
964
+ * SDT type (content control type)
1073
965
  */
1074
- interface CommentRangeStart {
1075
- type: 'commentRangeStart';
1076
- id: number;
966
+ type SdtType = 'richText' | 'plainText' | 'date' | 'dropdown' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'unknown';
967
+ /**
968
+ * SDT properties (w:sdtPr)
969
+ */
970
+ interface SdtProperties {
971
+ /** SDT type */
972
+ sdtType: SdtType;
973
+ /** Alias (friendly name) */
974
+ alias?: string;
975
+ /** Tag (developer identifier) */
976
+ tag?: string;
977
+ /** Lock content editing */
978
+ lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
979
+ /** Placeholder text */
980
+ placeholder?: string;
981
+ /** Whether showing placeholder */
982
+ showingPlaceholder?: boolean;
983
+ /** Date format for date controls */
984
+ dateFormat?: string;
985
+ /** Dropdown/combobox list items */
986
+ listItems?: {
987
+ displayText: string;
988
+ value: string;
989
+ }[];
990
+ /** Checkbox checked state */
991
+ checked?: boolean;
1077
992
  }
1078
993
  /**
1079
- * Comment range end marker in paragraph content
994
+ * Inline SDT (content control within a paragraph)
1080
995
  */
1081
- interface CommentRangeEnd {
1082
- type: 'commentRangeEnd';
1083
- id: number;
996
+ interface InlineSdt {
997
+ type: 'inlineSdt';
998
+ /** SDT properties */
999
+ properties: SdtProperties;
1000
+ /**
1001
+ * Inline content held inside the control. OOXML allows runs,
1002
+ * hyperlinks, simple/complex fields, nested SDTs, and math at this
1003
+ * level; the renderer must descend into all of them so docProps-bound
1004
+ * fields and similar template content survive paged rendering.
1005
+ */
1006
+ content: (Run | Hyperlink | SimpleField | ComplexField | InlineSdt | MathEquation)[];
1084
1007
  }
1085
1008
  /**
1086
- * Math equation content (m:oMath or m:oMathPara)
1009
+ * Block-level SDT (content control wrapping paragraphs/tables)
1087
1010
  */
1088
- interface MathEquation {
1089
- type: 'mathEquation';
1090
- /** Whether this is a block (oMathPara) or inline (oMath) equation */
1091
- display: 'inline' | 'block';
1092
- /** Raw OMML XML for round-trip preservation */
1093
- ommlXml: string;
1094
- /** Plain text representation for accessibility/fallback */
1095
- plainText?: string;
1011
+ interface BlockSdt {
1012
+ type: 'blockSdt';
1013
+ /** SDT properties */
1014
+ properties: SdtProperties;
1015
+ /** Block content inside the control */
1016
+ content: (Paragraph | Table)[];
1096
1017
  }
1018
+
1097
1019
  /**
1098
- * Tracked change metadata (w:ins, w:del attributes)
1020
+ * Comments (`w:comment` in `comments.xml`) and the inline range markers
1021
+ * (`w:commentRangeStart`/`End`) that anchor them inside paragraphs.
1099
1022
  */
1100
- interface TrackedChangeInfo {
1101
- /** Revision ID */
1023
+
1024
+ /**
1025
+ * A comment from `comments.xml` — the top-level entity for review
1026
+ * comments and replies. `id` matches the inline `CommentRangeStart` /
1027
+ * `CommentRangeEnd` markers that anchor it inside a paragraph; `parentId`
1028
+ * threads replies under their parent; `done` reflects Word's "Resolve"
1029
+ * state (`w15:done`).
1030
+ */
1031
+ interface Comment {
1032
+ /** Comment ID (matches commentRangeStart/End) */
1102
1033
  id: number;
1103
- /** Author who made the change */
1034
+ /** Author name */
1104
1035
  author: string;
1105
- /** Date of the change */
1036
+ /** Author initials */
1037
+ initials?: string;
1038
+ /** Date */
1106
1039
  date?: string;
1040
+ /** Comment content (paragraphs) */
1041
+ content: Paragraph[];
1042
+ /** Parent comment ID (for replies) */
1043
+ parentId?: number;
1044
+ /** Whether the comment is resolved/done */
1045
+ done?: boolean;
1107
1046
  }
1108
1047
  /**
1109
- * Generic tracked property-change wrapper metadata (w:*PrChange)
1048
+ * Comment range start marker in paragraph content
1110
1049
  */
1111
- interface PropertyChangeInfo extends TrackedChangeInfo {
1112
- /** Optional revision session ID */
1113
- rsid?: string;
1050
+ interface CommentRangeStart {
1051
+ type: 'commentRangeStart';
1052
+ id: number;
1114
1053
  }
1115
1054
  /**
1116
- * Insertion wrapper (w:ins) runs inserted by tracked changes
1055
+ * Comment range end marker in paragraph content
1117
1056
  */
1118
- interface Insertion {
1119
- type: 'insertion';
1120
- /** Tracked change metadata */
1121
- info: TrackedChangeInfo;
1122
- /** Inserted content */
1123
- content: (Run | Hyperlink)[];
1057
+ interface CommentRangeEnd {
1058
+ type: 'commentRangeEnd';
1059
+ id: number;
1124
1060
  }
1061
+
1125
1062
  /**
1126
- * Deletion wrapper (w:del) runs deleted by tracked changes
1063
+ * Page furniture — headers (`w:hdr`), footers (`w:ftr`), footnotes
1064
+ * (`w:footnote`), and endnotes (`w:endnote`), plus the section-level
1065
+ * properties (`w:footnotePr`/`w:endnotePr`) that configure note layout.
1127
1066
  */
1128
- interface Deletion {
1129
- type: 'deletion';
1130
- /** Tracked change metadata */
1131
- info: TrackedChangeInfo;
1132
- /** Deleted content */
1133
- content: (Run | Hyperlink)[];
1134
- }
1067
+
1135
1068
  /**
1136
- * Move-from wrapper (w:moveFrom) — content moved away from this position
1069
+ * Header/footer type
1137
1070
  */
1138
- interface MoveFrom {
1139
- type: 'moveFrom';
1140
- /** Tracked change metadata */
1141
- info: TrackedChangeInfo;
1142
- /** Moved content */
1143
- content: (Run | Hyperlink)[];
1144
- }
1071
+ type HeaderFooterType = 'default' | 'first' | 'even';
1145
1072
  /**
1146
- * Move-to wrapper (w:moveTo) — content moved into this position
1073
+ * Header or footer reference
1147
1074
  */
1148
- interface MoveTo {
1149
- type: 'moveTo';
1150
- /** Tracked change metadata */
1151
- info: TrackedChangeInfo;
1152
- /** Moved content */
1153
- content: (Run | Hyperlink)[];
1075
+ interface HeaderReference {
1076
+ type: HeaderFooterType;
1077
+ rId: string;
1078
+ }
1079
+ interface FooterReference {
1080
+ type: HeaderFooterType;
1081
+ rId: string;
1154
1082
  }
1155
1083
  /**
1156
- * Move-from range start marker (w:moveFromRangeStart) — ECMA-376 §17.13.5.22
1157
- * Pairs with moveFromRangeEnd to delimit the source of a move in the document.
1084
+ * Header or footer content
1158
1085
  */
1159
- interface MoveFromRangeStart {
1160
- type: 'moveFromRangeStart';
1161
- id: number;
1162
- name: string;
1086
+ interface HeaderFooter {
1087
+ type: 'header' | 'footer';
1088
+ /** Header/footer type */
1089
+ hdrFtrType: HeaderFooterType;
1090
+ /** Content (paragraphs, tables, etc.) */
1091
+ content: (Paragraph | Table)[];
1163
1092
  }
1164
1093
  /**
1165
- * Move-from range end marker (w:moveFromRangeEnd)
1094
+ * Footnote position
1166
1095
  */
1167
- interface MoveFromRangeEnd {
1168
- type: 'moveFromRangeEnd';
1169
- id: number;
1096
+ type FootnotePosition = 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
1097
+ /**
1098
+ * Endnote position
1099
+ */
1100
+ type EndnotePosition = 'sectEnd' | 'docEnd';
1101
+ /**
1102
+ * Number restart type
1103
+ */
1104
+ type NoteNumberRestart = 'continuous' | 'eachSect' | 'eachPage';
1105
+ /**
1106
+ * Footnote properties
1107
+ */
1108
+ interface FootnoteProperties {
1109
+ position?: FootnotePosition;
1110
+ numFmt?: NumberFormat;
1111
+ numStart?: number;
1112
+ numRestart?: NoteNumberRestart;
1170
1113
  }
1171
1114
  /**
1172
- * Move-to range start marker (w:moveToRangeStart) — ECMA-376 §17.13.5.24
1173
- * Pairs with moveToRangeEnd to delimit the destination of a move.
1115
+ * Endnote properties
1174
1116
  */
1175
- interface MoveToRangeStart {
1176
- type: 'moveToRangeStart';
1177
- id: number;
1178
- name: string;
1117
+ interface EndnoteProperties {
1118
+ position?: EndnotePosition;
1119
+ numFmt?: NumberFormat;
1120
+ numStart?: number;
1121
+ numRestart?: NoteNumberRestart;
1179
1122
  }
1180
1123
  /**
1181
- * Move-to range end marker (w:moveToRangeEnd)
1124
+ * Footnote (w:footnote)
1182
1125
  */
1183
- interface MoveToRangeEnd {
1184
- type: 'moveToRangeEnd';
1126
+ interface Footnote {
1127
+ type: 'footnote';
1128
+ /** Footnote ID */
1185
1129
  id: number;
1130
+ /** Special footnote type */
1131
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1132
+ /**
1133
+ * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
1134
+ * the body — paragraphs and tables. The parser previously only collected
1135
+ * <w:p> children which silently dropped any <w:tbl> inside a footnote;
1136
+ * widened to match HeaderFooter / TableCell shape so the body pipeline
1137
+ * (toProseDoc → toFlowBlocks) can render them uniformly.
1138
+ */
1139
+ content: (Paragraph | Table)[];
1186
1140
  }
1187
1141
  /**
1188
- * Run property change (w:rPrChange)
1142
+ * Endnote (w:endnote)
1189
1143
  */
1190
- interface RunPropertyChange {
1191
- type: 'runPropertyChange';
1192
- /** Tracked change metadata */
1193
- info: PropertyChangeInfo;
1194
- /** Run properties before the tracked change */
1195
- previousFormatting?: TextFormatting;
1196
- /** Run properties after the tracked change (editor model convenience) */
1197
- currentFormatting?: TextFormatting;
1144
+ interface Endnote {
1145
+ type: 'endnote';
1146
+ /** Endnote ID */
1147
+ id: number;
1148
+ /** Special endnote type */
1149
+ noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1150
+ /**
1151
+ * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
1152
+ * the body — paragraphs and tables. See note on `Footnote.content`.
1153
+ */
1154
+ content: (Paragraph | Table)[];
1198
1155
  }
1156
+
1199
1157
  /**
1200
- * Paragraph property change (w:pPrChange)
1158
+ * Section properties (`w:sectPr`) — page size and margins, columns,
1159
+ * header/footer references, line numbers, page borders, document grid,
1160
+ * paper sources — plus the section and document-body containers that
1161
+ * group block-level content.
1201
1162
  */
1202
- interface ParagraphPropertyChange {
1203
- type: 'paragraphPropertyChange';
1204
- /** Tracked change metadata */
1205
- info: PropertyChangeInfo;
1206
- /** Paragraph properties before the tracked change */
1207
- previousFormatting?: ParagraphFormatting;
1208
- /** Paragraph properties after the tracked change (editor model convenience) */
1209
- currentFormatting?: ParagraphFormatting;
1210
- }
1163
+
1211
1164
  /**
1212
- * Table property change (w:tblPrChange)
1165
+ * Page orientation
1213
1166
  */
1214
- interface TablePropertyChange {
1215
- type: 'tablePropertyChange';
1216
- /** Tracked change metadata */
1217
- info: PropertyChangeInfo;
1218
- /** Table properties before the tracked change */
1219
- previousFormatting?: TableFormatting;
1220
- /** Table properties after the tracked change (editor model convenience) */
1221
- currentFormatting?: TableFormatting;
1222
- }
1167
+ type PageOrientation = 'portrait' | 'landscape';
1223
1168
  /**
1224
- * Table row property change (w:trPrChange)
1169
+ * Section start type
1225
1170
  */
1226
- interface TableRowPropertyChange {
1227
- type: 'tableRowPropertyChange';
1228
- /** Tracked change metadata */
1229
- info: PropertyChangeInfo;
1230
- /** Row properties before the tracked change */
1231
- previousFormatting?: TableRowFormatting;
1232
- /** Row properties after the tracked change (editor model convenience) */
1233
- currentFormatting?: TableRowFormatting;
1234
- }
1171
+ type SectionStart = 'continuous' | 'nextPage' | 'oddPage' | 'evenPage' | 'nextColumn';
1235
1172
  /**
1236
- * Table cell property change (w:tcPrChange)
1173
+ * Vertical alignment
1237
1174
  */
1238
- interface TableCellPropertyChange {
1239
- type: 'tableCellPropertyChange';
1240
- /** Tracked change metadata */
1241
- info: PropertyChangeInfo;
1242
- /** Cell properties before the tracked change */
1243
- previousFormatting?: TableCellFormatting;
1244
- /** Cell properties after the tracked change (editor model convenience) */
1245
- currentFormatting?: TableCellFormatting;
1246
- }
1175
+ type VerticalAlign = 'top' | 'center' | 'both' | 'bottom';
1247
1176
  /**
1248
- * Table structural tracked change metadata (row/cell insert/delete/merge)
1177
+ * Line number restart type
1249
1178
  */
1250
- interface TableStructuralChangeInfo {
1251
- type: 'tableRowInsertion' | 'tableRowDeletion' | 'tableCellInsertion' | 'tableCellDeletion' | 'tableCellMerge';
1252
- /** Tracked change metadata */
1253
- info: TrackedChangeInfo;
1254
- }
1179
+ type LineNumberRestart = 'continuous' | 'newPage' | 'newSection';
1255
1180
  /**
1256
- * SDT type (content control type)
1181
+ * Column definition
1257
1182
  */
1258
- type SdtType = 'richText' | 'plainText' | 'date' | 'dropdown' | 'comboBox' | 'checkbox' | 'picture' | 'buildingBlockGallery' | 'group' | 'unknown';
1183
+ interface Column {
1184
+ /** Column width in twips */
1185
+ width?: number;
1186
+ /** Space after column in twips */
1187
+ space?: number;
1188
+ }
1259
1189
  /**
1260
- * SDT properties (w:sdtPr)
1190
+ * Section properties (`w:sectPr`) — page geometry, margins, columns,
1191
+ * header/footer references, and page numbering for one section of the
1192
+ * document. Sections are introduced by inline `sectPr` markers on the
1193
+ * terminating paragraph (`Paragraph.sectionProperties`) and the body's
1194
+ * final `sectPr`.
1195
+ *
1196
+ * All distance units are twips (1/20 of a point) on the wire. The layout
1197
+ * engine converts to pixels.
1198
+ *
1199
+ * See ECMA-376 §17.6.
1261
1200
  */
1262
- interface SdtProperties {
1263
- /** SDT type */
1264
- sdtType: SdtType;
1265
- /** Alias (friendly name) */
1266
- alias?: string;
1267
- /** Tag (developer identifier) */
1268
- tag?: string;
1269
- /** Lock content editing */
1270
- lock?: 'sdtLocked' | 'contentLocked' | 'sdtContentLocked' | 'unlocked';
1271
- /** Placeholder text */
1272
- placeholder?: string;
1273
- /** Whether showing placeholder */
1274
- showingPlaceholder?: boolean;
1275
- /** Date format for date controls */
1276
- dateFormat?: string;
1277
- /** Dropdown/combobox list items */
1278
- listItems?: {
1279
- displayText: string;
1280
- value: string;
1281
- }[];
1282
- /** Checkbox checked state */
1283
- checked?: boolean;
1201
+ interface SectionProperties {
1202
+ /** Page width in twips */
1203
+ pageWidth?: number;
1204
+ /** Page height in twips */
1205
+ pageHeight?: number;
1206
+ /** Page orientation */
1207
+ orientation?: PageOrientation;
1208
+ /** Top margin in twips */
1209
+ marginTop?: number;
1210
+ /** Bottom margin in twips */
1211
+ marginBottom?: number;
1212
+ /** Left margin in twips */
1213
+ marginLeft?: number;
1214
+ /** Right margin in twips */
1215
+ marginRight?: number;
1216
+ /** Header distance from top in twips */
1217
+ headerDistance?: number;
1218
+ /** Footer distance from bottom in twips */
1219
+ footerDistance?: number;
1220
+ /** Gutter margin in twips */
1221
+ gutter?: number;
1222
+ /** Number of columns */
1223
+ columnCount?: number;
1224
+ /** Space between columns in twips */
1225
+ columnSpace?: number;
1226
+ /** Equal width columns */
1227
+ equalWidth?: boolean;
1228
+ /** Separator line between columns */
1229
+ separator?: boolean;
1230
+ /** Individual column definitions */
1231
+ columns?: Column[];
1232
+ /** Section start type */
1233
+ sectionStart?: SectionStart;
1234
+ /** Vertical alignment of text */
1235
+ verticalAlign?: VerticalAlign;
1236
+ /** Right-to-left section */
1237
+ bidi?: boolean;
1238
+ /** Header references */
1239
+ headerReferences?: HeaderReference[];
1240
+ /** Footer references */
1241
+ footerReferences?: FooterReference[];
1242
+ /** Different first page header/footer */
1243
+ titlePg?: boolean;
1244
+ /** Different odd/even page headers/footers */
1245
+ evenAndOddHeaders?: boolean;
1246
+ /** Line numbering settings */
1247
+ lineNumbers?: {
1248
+ start?: number;
1249
+ countBy?: number;
1250
+ distance?: number;
1251
+ restart?: LineNumberRestart;
1252
+ };
1253
+ /** Page borders */
1254
+ pageBorders?: {
1255
+ top?: BorderSpec;
1256
+ bottom?: BorderSpec;
1257
+ left?: BorderSpec;
1258
+ right?: BorderSpec;
1259
+ /** Display setting */
1260
+ display?: 'allPages' | 'firstPage' | 'notFirstPage';
1261
+ /** Offset from */
1262
+ offsetFrom?: 'page' | 'text';
1263
+ /** Z-order */
1264
+ zOrder?: 'front' | 'back';
1265
+ };
1266
+ /** Page background */
1267
+ background?: {
1268
+ color?: ColorValue;
1269
+ themeColor?: ThemeColorSlot;
1270
+ themeTint?: string;
1271
+ themeShade?: string;
1272
+ };
1273
+ /** Footnote properties for this section */
1274
+ footnotePr?: FootnoteProperties;
1275
+ /** Endnote properties for this section */
1276
+ endnotePr?: EndnoteProperties;
1277
+ /** Document grid */
1278
+ docGrid?: {
1279
+ type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars';
1280
+ linePitch?: number;
1281
+ charSpace?: number;
1282
+ };
1283
+ /** First page paper source */
1284
+ paperSrcFirst?: number;
1285
+ /** Other pages paper source */
1286
+ paperSrcOther?: number;
1284
1287
  }
1285
1288
  /**
1286
- * Inline SDT (content control within a paragraph)
1289
+ * Block-level content types
1287
1290
  */
1288
- interface InlineSdt {
1289
- type: 'inlineSdt';
1290
- /** SDT properties */
1291
- properties: SdtProperties;
1292
- /** Content runs inside the control */
1293
- content: (Run | Hyperlink)[];
1291
+ type BlockContent = Paragraph | Table | BlockSdt;
1292
+ /**
1293
+ * One section of the document — a `SectionProperties` plus the block
1294
+ * content (`Paragraph`s and `Table`s) that lives under those properties.
1295
+ *
1296
+ * Sections are derived during parse: every paragraph carrying an inline
1297
+ * `sectPr` ends a section, and the body's final `sectPr` defines the
1298
+ * last section. Each section may carry its own headers/footers map.
1299
+ */
1300
+ interface Section {
1301
+ /** Section properties */
1302
+ properties: SectionProperties;
1303
+ /** Content in this section */
1304
+ content: BlockContent[];
1305
+ /** Headers for this section */
1306
+ headers?: Map<HeaderFooterType, HeaderFooter>;
1307
+ /** Footers for this section */
1308
+ footers?: Map<HeaderFooterType, HeaderFooter>;
1294
1309
  }
1295
1310
  /**
1296
- * Block-level SDT (content control wrapping paragraphs/tables)
1311
+ * Document body (`w:body`) — the editable content of the document.
1312
+ *
1313
+ * Contains the ordered block content (paragraphs and tables), the section
1314
+ * layout chain derived from inline `sectPr` markers, the final `sectPr`,
1315
+ * and any document-level comments. This is what most edit operations
1316
+ * mutate; headers/footers/styles live elsewhere in the package.
1297
1317
  */
1298
- interface BlockSdt {
1299
- type: 'blockSdt';
1300
- /** SDT properties */
1301
- properties: SdtProperties;
1302
- /** Block content inside the control */
1303
- content: (Paragraph | Table)[];
1318
+ interface DocumentBody {
1319
+ /** All content (paragraphs, tables) */
1320
+ content: BlockContent[];
1321
+ /** Sections (derived from sectPr in paragraphs and final sectPr) */
1322
+ sections?: Section[];
1323
+ /** Final section properties (from body's sectPr) */
1324
+ finalSectionProperties?: SectionProperties;
1325
+ /** Comments from comments.xml */
1326
+ comments?: Comment[];
1304
1327
  }
1328
+
1329
+ /**
1330
+ * Paragraph (`w:p`) — the union of inline content that can sit inside a
1331
+ * paragraph (runs, hyperlinks, bookmarks, fields, SDT, comment ranges,
1332
+ * tracked-change wrappers, math) plus paragraph-level metadata
1333
+ * (formatting, list rendering, optional terminating section properties).
1334
+ */
1335
+
1305
1336
  /**
1306
- * Paragraph content types
1337
+ * Inline content that can appear inside a paragraph. Covers runs (text),
1338
+ * hyperlinks, bookmarks, fields, structured document tags, comment range
1339
+ * markers, tracked-change wrappers, and math equations. Every node in
1340
+ * this union carries a `type` discriminator so consumers can narrow at
1341
+ * runtime.
1307
1342
  */
1308
1343
  type ParagraphContent = Run | Hyperlink | BookmarkStart | BookmarkEnd | SimpleField | ComplexField | InlineSdt | CommentRangeStart | CommentRangeEnd | Insertion | Deletion | MoveFrom | MoveTo | MoveFromRangeStart | MoveFromRangeEnd | MoveToRangeStart | MoveToRangeEnd | MathEquation;
1309
1344
  /**
1310
- * Paragraph (w:p)
1345
+ * Paragraph (`w:p`) — the primary block-level container in a Word document.
1346
+ *
1347
+ * Every paragraph carries direct formatting (`formatting`), tracked
1348
+ * property changes (`propertyChanges`), inline content (`content`), and
1349
+ * optional list rendering / section break metadata. `paraId` is Word's
1350
+ * stable identifier (`w14:paraId`) and is what `EditorBridge` and the
1351
+ * agent toolkit use to address paragraphs.
1352
+ *
1353
+ * See ECMA-376 §17.3.1.
1311
1354
  */
1312
1355
  interface Paragraph {
1313
1356
  type: 'paragraph';
@@ -1328,238 +1371,387 @@ interface Paragraph {
1328
1371
  /** Section properties (if this paragraph ends a section) */
1329
1372
  sectionProperties?: SectionProperties;
1330
1373
  }
1374
+
1331
1375
  /**
1332
- * Header/footer type
1376
+ * DrawingML shapes (`wps:wsp`) and text boxes — preset shape types,
1377
+ * fill, outline, shape text body, transform.
1333
1378
  */
1334
- type HeaderFooterType = 'default' | 'first' | 'even';
1379
+
1335
1380
  /**
1336
- * Header or footer reference
1381
+ * Shape types
1337
1382
  */
1338
- interface HeaderReference {
1339
- type: HeaderFooterType;
1340
- rId: string;
1383
+ type ShapeType = 'rect' | 'roundRect' | 'ellipse' | 'triangle' | 'rtTriangle' | 'parallelogram' | 'trapezoid' | 'pentagon' | 'hexagon' | 'heptagon' | 'octagon' | 'decagon' | 'dodecagon' | 'star4' | 'star5' | 'star6' | 'star7' | 'star8' | 'star10' | 'star12' | 'star16' | 'star24' | 'star32' | 'line' | 'straightConnector1' | 'bentConnector2' | 'bentConnector3' | 'bentConnector4' | 'bentConnector5' | 'curvedConnector2' | 'curvedConnector3' | 'curvedConnector4' | 'curvedConnector5' | 'rightArrow' | 'leftArrow' | 'upArrow' | 'downArrow' | 'leftRightArrow' | 'upDownArrow' | 'quadArrow' | 'leftRightUpArrow' | 'bentArrow' | 'uturnArrow' | 'leftUpArrow' | 'bentUpArrow' | 'curvedRightArrow' | 'curvedLeftArrow' | 'curvedUpArrow' | 'curvedDownArrow' | 'stripedRightArrow' | 'notchedRightArrow' | 'homePlate' | 'chevron' | 'rightArrowCallout' | 'downArrowCallout' | 'leftArrowCallout' | 'upArrowCallout' | 'leftRightArrowCallout' | 'quadArrowCallout' | 'circularArrow' | 'flowChartProcess' | 'flowChartAlternateProcess' | 'flowChartDecision' | 'flowChartInputOutput' | 'flowChartPredefinedProcess' | 'flowChartInternalStorage' | 'flowChartDocument' | 'flowChartMultidocument' | 'flowChartTerminator' | 'flowChartPreparation' | 'flowChartManualInput' | 'flowChartManualOperation' | 'flowChartConnector' | 'flowChartOffpageConnector' | 'flowChartPunchedCard' | 'flowChartPunchedTape' | 'flowChartSummingJunction' | 'flowChartOr' | 'flowChartCollate' | 'flowChartSort' | 'flowChartExtract' | 'flowChartMerge' | 'flowChartOnlineStorage' | 'flowChartDelay' | 'flowChartMagneticTape' | 'flowChartMagneticDisk' | 'flowChartMagneticDrum' | 'flowChartDisplay' | 'wedgeRectCallout' | 'wedgeRoundRectCallout' | 'wedgeEllipseCallout' | 'cloudCallout' | 'borderCallout1' | 'borderCallout2' | 'borderCallout3' | 'accentCallout1' | 'accentCallout2' | 'accentCallout3' | 'callout1' | 'callout2' | 'callout3' | 'accentBorderCallout1' | 'accentBorderCallout2' | 'accentBorderCallout3' | 'actionButtonBlank' | 'actionButtonHome' | 'actionButtonHelp' | 'actionButtonInformation' | 'actionButtonBackPrevious' | 'actionButtonForwardNext' | 'actionButtonBeginning' | 'actionButtonEnd' | 'actionButtonReturn' | 'actionButtonDocument' | 'actionButtonSound' | 'actionButtonMovie' | 'irregularSeal1' | 'irregularSeal2' | 'frame' | 'halfFrame' | 'corner' | 'diagStripe' | 'chord' | 'arc' | 'bracketPair' | 'bracePair' | 'leftBracket' | 'rightBracket' | 'leftBrace' | 'rightBrace' | 'can' | 'cube' | 'bevel' | 'donut' | 'noSmoking' | 'blockArc' | 'foldedCorner' | 'smileyFace' | 'heart' | 'lightningBolt' | 'sun' | 'moon' | 'cloud' | 'snip1Rect' | 'snip2SameRect' | 'snip2DiagRect' | 'snipRoundRect' | 'round1Rect' | 'round2SameRect' | 'round2DiagRect' | 'plaque' | 'teardrop' | 'mathPlus' | 'mathMinus' | 'mathMultiply' | 'mathDivide' | 'mathEqual' | 'mathNotEqual' | 'gear6' | 'gear9' | 'funnel' | 'pieWedge' | 'pie' | 'leftCircularArrow' | 'leftRightCircularArrow' | 'swooshArrow' | 'textBox';
1384
+ /**
1385
+ * Shape fill type
1386
+ */
1387
+ interface ShapeFill {
1388
+ type: 'none' | 'solid' | 'gradient' | 'pattern' | 'picture';
1389
+ /** Solid fill color */
1390
+ color?: ColorValue;
1391
+ /** Gradient stops for gradient fill */
1392
+ gradient?: {
1393
+ type: 'linear' | 'radial' | 'rectangular' | 'path';
1394
+ angle?: number;
1395
+ stops: Array<{
1396
+ position: number;
1397
+ color: ColorValue;
1398
+ }>;
1399
+ };
1341
1400
  }
1342
- interface FooterReference {
1343
- type: HeaderFooterType;
1344
- rId: string;
1401
+ /**
1402
+ * Shape outline/stroke
1403
+ */
1404
+ interface ShapeOutline {
1405
+ /** Line width in EMUs */
1406
+ width?: number;
1407
+ /** Line color */
1408
+ color?: ColorValue;
1409
+ /** Line style */
1410
+ style?: 'solid' | 'dot' | 'dash' | 'lgDash' | 'dashDot' | 'lgDashDot' | 'lgDashDotDot' | 'sysDot' | 'sysDash' | 'sysDashDot' | 'sysDashDotDot';
1411
+ /** Line cap */
1412
+ cap?: 'flat' | 'round' | 'square';
1413
+ /** Line join */
1414
+ join?: 'bevel' | 'miter' | 'round';
1415
+ /** Head arrow */
1416
+ headEnd?: {
1417
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
1418
+ width?: 'sm' | 'med' | 'lg';
1419
+ length?: 'sm' | 'med' | 'lg';
1420
+ };
1421
+ /** Tail arrow */
1422
+ tailEnd?: {
1423
+ type: 'none' | 'triangle' | 'stealth' | 'diamond' | 'oval' | 'arrow';
1424
+ width?: 'sm' | 'med' | 'lg';
1425
+ length?: 'sm' | 'med' | 'lg';
1426
+ };
1345
1427
  }
1346
1428
  /**
1347
- * Header or footer content
1429
+ * Text body inside a shape
1348
1430
  */
1349
- interface HeaderFooter {
1350
- type: 'header' | 'footer';
1351
- /** Header/footer type */
1352
- hdrFtrType: HeaderFooterType;
1353
- /** Content (paragraphs, tables, etc.) */
1354
- content: (Paragraph | Table)[];
1431
+ interface ShapeTextBody {
1432
+ /** Text direction */
1433
+ vertical?: boolean;
1434
+ /** Rotation */
1435
+ rotation?: number;
1436
+ /** Anchor/vertical alignment */
1437
+ anchor?: 'top' | 'middle' | 'bottom' | 'distributed' | 'justified';
1438
+ /** Anchor center */
1439
+ anchorCenter?: boolean;
1440
+ /** Auto fit */
1441
+ autoFit?: 'none' | 'normal' | 'shape';
1442
+ /** Text margins */
1443
+ margins?: {
1444
+ top?: number;
1445
+ bottom?: number;
1446
+ left?: number;
1447
+ right?: number;
1448
+ };
1449
+ /** Paragraphs inside the shape */
1450
+ content: Paragraph[];
1355
1451
  }
1356
1452
  /**
1357
- * Footnote position
1453
+ * Shape/drawing object (wps:wsp)
1358
1454
  */
1359
- type FootnotePosition = 'pageBottom' | 'beneathText' | 'sectEnd' | 'docEnd';
1455
+ interface Shape {
1456
+ type: 'shape';
1457
+ /** Shape type preset */
1458
+ shapeType: ShapeType;
1459
+ /** Unique ID */
1460
+ id?: string;
1461
+ /** Name */
1462
+ name?: string;
1463
+ /** Size in EMUs */
1464
+ size: ImageSize;
1465
+ /** Position for floating shapes */
1466
+ position?: ImagePosition;
1467
+ /** Wrap settings */
1468
+ wrap?: ImageWrap;
1469
+ /** Fill */
1470
+ fill?: ShapeFill;
1471
+ /** Outline/stroke */
1472
+ outline?: ShapeOutline;
1473
+ /** Transform */
1474
+ transform?: ImageTransform;
1475
+ /** Text content inside the shape */
1476
+ textBody?: ShapeTextBody;
1477
+ /** Custom geometry points */
1478
+ customGeometry?: string;
1479
+ }
1480
+
1360
1481
  /**
1361
- * Endnote position
1482
+ * Embedded images (`w:drawing` → `pic:pic`): size, wrap, position,
1483
+ * transform, padding, crop.
1362
1484
  */
1363
- type EndnotePosition = 'sectEnd' | 'docEnd';
1485
+
1364
1486
  /**
1365
- * Number restart type
1487
+ * Image size specification
1366
1488
  */
1367
- type NoteNumberRestart = 'continuous' | 'eachSect' | 'eachPage';
1489
+ interface ImageSize {
1490
+ /** Width in EMUs (English Metric Units) */
1491
+ width: number;
1492
+ /** Height in EMUs */
1493
+ height: number;
1494
+ }
1368
1495
  /**
1369
- * Footnote properties
1496
+ * Image wrap type for floating images
1370
1497
  */
1371
- interface FootnoteProperties {
1372
- position?: FootnotePosition;
1373
- numFmt?: NumberFormat;
1374
- numStart?: number;
1375
- numRestart?: NoteNumberRestart;
1498
+ interface ImageWrap {
1499
+ type: WrapType;
1500
+ /** Wrap text direction */
1501
+ wrapText?: 'bothSides' | 'left' | 'right' | 'largest';
1502
+ /** Distance from text */
1503
+ distT?: number;
1504
+ distB?: number;
1505
+ distL?: number;
1506
+ distR?: number;
1376
1507
  }
1377
1508
  /**
1378
- * Endnote properties
1509
+ * Position for floating images
1379
1510
  */
1380
- interface EndnoteProperties {
1381
- position?: EndnotePosition;
1382
- numFmt?: NumberFormat;
1383
- numStart?: number;
1384
- numRestart?: NoteNumberRestart;
1511
+ interface ImagePosition {
1512
+ /** Horizontal positioning */
1513
+ horizontal: {
1514
+ relativeTo: 'character' | 'column' | 'insideMargin' | 'leftMargin' | 'margin' | 'outsideMargin' | 'page' | 'rightMargin';
1515
+ alignment?: 'left' | 'right' | 'center' | 'inside' | 'outside';
1516
+ posOffset?: number;
1517
+ };
1518
+ /** Vertical positioning */
1519
+ vertical: {
1520
+ relativeTo: 'insideMargin' | 'line' | 'margin' | 'outsideMargin' | 'page' | 'paragraph' | 'topMargin' | 'bottomMargin';
1521
+ alignment?: 'top' | 'bottom' | 'center' | 'inside' | 'outside';
1522
+ posOffset?: number;
1523
+ };
1524
+ }
1525
+ /**
1526
+ * Image transformation
1527
+ */
1528
+ interface ImageTransform {
1529
+ /** Rotation in degrees */
1530
+ rotation?: number;
1531
+ /** Flip horizontal */
1532
+ flipH?: boolean;
1533
+ /** Flip vertical */
1534
+ flipV?: boolean;
1535
+ }
1536
+ /**
1537
+ * Image padding/margins
1538
+ */
1539
+ interface ImagePadding {
1540
+ top?: number;
1541
+ bottom?: number;
1542
+ left?: number;
1543
+ right?: number;
1544
+ }
1545
+ /**
1546
+ * Image crop, expressed as fractions of the source image to trim from each
1547
+ * edge. OOXML's `<a:srcRect l="10000" t="0" r="5000" b="0"/>` uses units of
1548
+ * 1/100000 (so 10000 → 0.1 → 10% trimmed from the left). We store the
1549
+ * normalised fraction so both the renderer and the saver can read it
1550
+ * directly without re-parsing units.
1551
+ */
1552
+ interface ImageCrop {
1553
+ left?: number;
1554
+ top?: number;
1555
+ right?: number;
1556
+ bottom?: number;
1557
+ }
1558
+ /**
1559
+ * Embedded image (`w:drawing` with an inline or anchored picture). Carries
1560
+ * the relationship-id pointer to the binary in `word/media/`, its
1561
+ * resolved data URL (`src`), display dimensions, optional crop /
1562
+ * transform / wrap behaviors, and anchor positioning for floating
1563
+ * images.
1564
+ *
1565
+ * See ECMA-376 §20.4 (DrawingML wordprocessingDrawing).
1566
+ */
1567
+ interface Image {
1568
+ type: 'image';
1569
+ /** Unique ID */
1570
+ id?: string;
1571
+ /** Relationship ID for the image data */
1572
+ rId: string;
1573
+ /** Resolved image data (base64 or blob URL) */
1574
+ src?: string;
1575
+ /** Image MIME type */
1576
+ mimeType?: string;
1577
+ /** Original filename */
1578
+ filename?: string;
1579
+ /** Alt text for accessibility */
1580
+ alt?: string;
1581
+ /** Title/description */
1582
+ title?: string;
1583
+ /** Image size */
1584
+ size: ImageSize;
1585
+ /** Original size before any transforms */
1586
+ originalSize?: ImageSize;
1587
+ /** Wrap settings */
1588
+ wrap: ImageWrap;
1589
+ /** Position for floating images */
1590
+ position?: ImagePosition;
1591
+ /** Image transformations */
1592
+ transform?: ImageTransform;
1593
+ /** Padding around image */
1594
+ padding?: ImagePadding;
1595
+ /** Source-image crop (fractional, OOXML `a:srcRect`). */
1596
+ crop?: ImageCrop;
1597
+ /** Opacity in [0, 1] (OOXML `a:alphaModFix amt`). Undefined = fully opaque. */
1598
+ opacity?: number;
1599
+ /** Whether this is a decorative image */
1600
+ decorative?: boolean;
1601
+ /**
1602
+ * `wp:anchor layoutInCell` — when true (default), an anchored image inside
1603
+ * a table cell is constrained to the cell. When false, the image escapes
1604
+ * the cell into the page area. Round-tripped on save.
1605
+ */
1606
+ layoutInCell?: boolean;
1607
+ /**
1608
+ * `wp:anchor allowOverlap` — when true (default), anchored objects may
1609
+ * overlap; when false, Word repositions them to avoid collisions. We
1610
+ * don't currently reposition; we round-trip the flag so saving preserves
1611
+ * the author's intent.
1612
+ */
1613
+ allowOverlap?: boolean;
1614
+ /** Hyperlink URL for clickable image */
1615
+ hlinkHref?: string;
1616
+ /** Image outline/border */
1617
+ outline?: ShapeOutline;
1618
+ /** Image effects */
1619
+ effects?: {
1620
+ brightness?: number;
1621
+ contrast?: number;
1622
+ saturation?: number;
1623
+ };
1624
+ }
1625
+
1626
+ /**
1627
+ * Run content (`w:r`) and the inline pieces that live inside a run —
1628
+ * text, tab, break, symbol, footnote/endnote references, field chars,
1629
+ * instruction text, soft/no-break hyphens, drawings, shapes.
1630
+ */
1631
+
1632
+ /**
1633
+ * Plain text run content (`w:t`). `preserveSpace` mirrors the
1634
+ * `xml:space="preserve"` attribute and matters for runs that begin or end
1635
+ * with whitespace — without it, Word collapses leading/trailing spaces.
1636
+ */
1637
+ interface TextContent {
1638
+ type: 'text';
1639
+ /** The text string */
1640
+ text: string;
1641
+ /** Preserve whitespace (xml:space="preserve") */
1642
+ preserveSpace?: boolean;
1643
+ }
1644
+ /**
1645
+ * Tab character
1646
+ */
1647
+ interface TabContent {
1648
+ type: 'tab';
1649
+ }
1650
+ /**
1651
+ * Line break
1652
+ */
1653
+ interface BreakContent {
1654
+ type: 'break';
1655
+ /** Break type */
1656
+ breakType?: 'page' | 'column' | 'textWrapping';
1657
+ /** Clear type for text wrapping break */
1658
+ clear?: 'none' | 'left' | 'right' | 'all';
1385
1659
  }
1386
1660
  /**
1387
- * Footnote (w:footnote)
1661
+ * Symbol character (special font character)
1388
1662
  */
1389
- interface Footnote {
1390
- type: 'footnote';
1391
- /** Footnote ID */
1392
- id: number;
1393
- /** Special footnote type */
1394
- noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1395
- /**
1396
- * Content. Per ECMA-376 §17.11.10 footnotes can hold the same blocks as
1397
- * the body — paragraphs and tables. The parser previously only collected
1398
- * <w:p> children which silently dropped any <w:tbl> inside a footnote;
1399
- * widened to match HeaderFooter / TableCell shape so the body pipeline
1400
- * (toProseDoc → toFlowBlocks) can render them uniformly.
1401
- */
1402
- content: (Paragraph | Table)[];
1663
+ interface SymbolContent {
1664
+ type: 'symbol';
1665
+ /** Font name */
1666
+ font: string;
1667
+ /** Character code */
1668
+ char: string;
1403
1669
  }
1404
1670
  /**
1405
- * Endnote (w:endnote)
1671
+ * Footnote or endnote reference
1406
1672
  */
1407
- interface Endnote {
1408
- type: 'endnote';
1409
- /** Endnote ID */
1673
+ interface NoteReferenceContent {
1674
+ type: 'footnoteRef' | 'endnoteRef';
1675
+ /** Note ID */
1410
1676
  id: number;
1411
- /** Special endnote type */
1412
- noteType?: 'normal' | 'separator' | 'continuationSeparator' | 'continuationNotice';
1413
- /**
1414
- * Content. Per ECMA-376 §17.11.4 endnotes can hold the same blocks as
1415
- * the body — paragraphs and tables. See note on `Footnote.content`.
1416
- */
1417
- content: (Paragraph | Table)[];
1418
1677
  }
1419
1678
  /**
1420
- * Page orientation
1421
- */
1422
- type PageOrientation = 'portrait' | 'landscape';
1423
- /**
1424
- * Section start type
1679
+ * Field character (begin/separate/end)
1425
1680
  */
1426
- type SectionStart = 'continuous' | 'nextPage' | 'oddPage' | 'evenPage' | 'nextColumn';
1681
+ interface FieldCharContent {
1682
+ type: 'fieldChar';
1683
+ /** Field character type */
1684
+ charType: 'begin' | 'separate' | 'end';
1685
+ /** Field is locked */
1686
+ fldLock?: boolean;
1687
+ /** Field is dirty (needs update) */
1688
+ dirty?: boolean;
1689
+ }
1427
1690
  /**
1428
- * Vertical alignment
1691
+ * Field instruction text
1429
1692
  */
1430
- type VerticalAlign = 'top' | 'center' | 'both' | 'bottom';
1693
+ interface InstrTextContent {
1694
+ type: 'instrText';
1695
+ /** Field instruction */
1696
+ text: string;
1697
+ }
1431
1698
  /**
1432
- * Line number restart type
1699
+ * Soft hyphen
1433
1700
  */
1434
- type LineNumberRestart = 'continuous' | 'newPage' | 'newSection';
1701
+ interface SoftHyphenContent {
1702
+ type: 'softHyphen';
1703
+ }
1435
1704
  /**
1436
- * Column definition
1705
+ * Non-breaking hyphen
1437
1706
  */
1438
- interface Column {
1439
- /** Column width in twips */
1440
- width?: number;
1441
- /** Space after column in twips */
1442
- space?: number;
1707
+ interface NoBreakHyphenContent {
1708
+ type: 'noBreakHyphen';
1443
1709
  }
1444
1710
  /**
1445
- * Section properties (w:sectPr)
1711
+ * Drawing/image reference
1446
1712
  */
1447
- interface SectionProperties {
1448
- /** Page width in twips */
1449
- pageWidth?: number;
1450
- /** Page height in twips */
1451
- pageHeight?: number;
1452
- /** Page orientation */
1453
- orientation?: PageOrientation;
1454
- /** Top margin in twips */
1455
- marginTop?: number;
1456
- /** Bottom margin in twips */
1457
- marginBottom?: number;
1458
- /** Left margin in twips */
1459
- marginLeft?: number;
1460
- /** Right margin in twips */
1461
- marginRight?: number;
1462
- /** Header distance from top in twips */
1463
- headerDistance?: number;
1464
- /** Footer distance from bottom in twips */
1465
- footerDistance?: number;
1466
- /** Gutter margin in twips */
1467
- gutter?: number;
1468
- /** Number of columns */
1469
- columnCount?: number;
1470
- /** Space between columns in twips */
1471
- columnSpace?: number;
1472
- /** Equal width columns */
1473
- equalWidth?: boolean;
1474
- /** Separator line between columns */
1475
- separator?: boolean;
1476
- /** Individual column definitions */
1477
- columns?: Column[];
1478
- /** Section start type */
1479
- sectionStart?: SectionStart;
1480
- /** Vertical alignment of text */
1481
- verticalAlign?: VerticalAlign;
1482
- /** Right-to-left section */
1483
- bidi?: boolean;
1484
- /** Header references */
1485
- headerReferences?: HeaderReference[];
1486
- /** Footer references */
1487
- footerReferences?: FooterReference[];
1488
- /** Different first page header/footer */
1489
- titlePg?: boolean;
1490
- /** Different odd/even page headers/footers */
1491
- evenAndOddHeaders?: boolean;
1492
- /** Line numbering settings */
1493
- lineNumbers?: {
1494
- start?: number;
1495
- countBy?: number;
1496
- distance?: number;
1497
- restart?: LineNumberRestart;
1498
- };
1499
- /** Page borders */
1500
- pageBorders?: {
1501
- top?: BorderSpec;
1502
- bottom?: BorderSpec;
1503
- left?: BorderSpec;
1504
- right?: BorderSpec;
1505
- /** Display setting */
1506
- display?: 'allPages' | 'firstPage' | 'notFirstPage';
1507
- /** Offset from */
1508
- offsetFrom?: 'page' | 'text';
1509
- /** Z-order */
1510
- zOrder?: 'front' | 'back';
1511
- };
1512
- /** Page background */
1513
- background?: {
1514
- color?: ColorValue;
1515
- themeColor?: ThemeColorSlot;
1516
- themeTint?: string;
1517
- themeShade?: string;
1518
- };
1519
- /** Footnote properties for this section */
1520
- footnotePr?: FootnoteProperties;
1521
- /** Endnote properties for this section */
1522
- endnotePr?: EndnoteProperties;
1523
- /** Document grid */
1524
- docGrid?: {
1525
- type?: 'default' | 'lines' | 'linesAndChars' | 'snapToChars';
1526
- linePitch?: number;
1527
- charSpace?: number;
1528
- };
1529
- /** First page paper source */
1530
- paperSrcFirst?: number;
1531
- /** Other pages paper source */
1532
- paperSrcOther?: number;
1713
+ interface DrawingContent {
1714
+ type: 'drawing';
1715
+ /** Image data */
1716
+ image: Image;
1533
1717
  }
1534
1718
  /**
1535
- * Block-level content types
1719
+ * Shape reference
1536
1720
  */
1537
- type BlockContent = Paragraph | Table | BlockSdt;
1721
+ interface ShapeContent {
1722
+ type: 'shape';
1723
+ /** Shape data */
1724
+ shape: Shape;
1725
+ }
1538
1726
  /**
1539
- * Section (implicit or explicit based on sectPr)
1727
+ * All possible run content types
1540
1728
  */
1541
- interface Section {
1542
- /** Section properties */
1543
- properties: SectionProperties;
1544
- /** Content in this section */
1545
- content: BlockContent[];
1546
- /** Headers for this section */
1547
- headers?: Map<HeaderFooterType, HeaderFooter>;
1548
- /** Footers for this section */
1549
- footers?: Map<HeaderFooterType, HeaderFooter>;
1550
- }
1729
+ type RunContent = TextContent | TabContent | BreakContent | SymbolContent | NoteReferenceContent | FieldCharContent | InstrTextContent | SoftHyphenContent | NoBreakHyphenContent | DrawingContent | ShapeContent;
1551
1730
  /**
1552
- * Document body (w:body)
1731
+ * A run (`w:r`) — a contiguous span of inline content sharing one set of
1732
+ * character properties (bold, italic, font, color, etc.). Runs are the
1733
+ * atomic unit of character formatting; toggling bold on a selection that
1734
+ * spans different formatting creates new runs.
1735
+ *
1736
+ * See ECMA-376 §17.3.2.
1737
+ *
1738
+ * @example
1739
+ * ```ts
1740
+ * const run: Run = {
1741
+ * type: 'run',
1742
+ * formatting: { bold: true },
1743
+ * content: [{ type: 'text', text: 'Hello' }],
1744
+ * };
1745
+ * ```
1553
1746
  */
1554
- interface DocumentBody {
1555
- /** All content (paragraphs, tables) */
1556
- content: BlockContent[];
1557
- /** Sections (derived from sectPr in paragraphs and final sectPr) */
1558
- sections?: Section[];
1559
- /** Final section properties (from body's sectPr) */
1560
- finalSectionProperties?: SectionProperties;
1561
- /** Comments from comments.xml */
1562
- comments?: Comment[];
1747
+ interface Run {
1748
+ type: 'run';
1749
+ /** Text formatting properties */
1750
+ formatting?: TextFormatting;
1751
+ /** Run-level tracked property changes (w:rPrChange) */
1752
+ propertyChanges?: RunPropertyChange[];
1753
+ /** Run content (text, tabs, breaks, etc.) */
1754
+ content: RunContent[];
1563
1755
  }
1564
1756
 
1565
1757
  /**
@@ -1573,7 +1765,13 @@ interface DocumentBody {
1573
1765
  */
1574
1766
  type StyleType = 'paragraph' | 'character' | 'numbering' | 'table';
1575
1767
  /**
1576
- * Style definition
1768
+ * Style definition from `styles.xml` — a named, reusable bundle of
1769
+ * paragraph and/or character formatting. Word's "Heading 1", "Normal",
1770
+ * "Title", and "List Bullet" are styles; user-defined styles look the
1771
+ * same. `basedOn` chains styles for inheritance; `link` pairs a paragraph
1772
+ * style with a matching character style.
1773
+ *
1774
+ * See ECMA-376 §17.7.4.
1577
1775
  */
1578
1776
  interface Style {
1579
1777
  /** Style ID */
@@ -1798,6 +1996,8 @@ interface MediaFile {
1798
1996
  * - lists.ts — Numbering and list definitions
1799
1997
  * - content.ts — Content model (runs, images, shapes, tables, paragraphs, sections)
1800
1998
  * - styles.ts — Styles, theme, fonts, relationships, media
1999
+ * @packageDocumentation
2000
+ * @public
1801
2001
  */
1802
2002
 
1803
2003
  /**
@@ -1840,22 +2040,30 @@ interface DocxPackage {
1840
2040
  };
1841
2041
  }
1842
2042
  /**
1843
- * Complete parsed DOCX document
2043
+ * Top-level parsed DOCX document — the result of `parseDocx(buffer)`.
2044
+ *
2045
+ * Wraps the unzipped DOCX package (`document.xml`, `styles.xml`, etc.),
2046
+ * the original buffer for round-trip saves, and any template variables /
2047
+ * parse warnings detected during ingestion.
2048
+ *
2049
+ * @example
2050
+ * ```ts
2051
+ * import { parseDocx } from '@eigenpal/docx-editor-core/headless';
2052
+ * const doc = await parseDocx(buffer);
2053
+ * console.log(doc.package.document.content.length);
2054
+ * ```
1844
2055
  */
1845
2056
  interface Document {
1846
- /** DOCX package with all parsed content */
2057
+ /** Parsed DOCX package body, styles, numbering, theme, media, headers/footers. */
1847
2058
  package: DocxPackage;
1848
- /** Original ArrayBuffer for round-trip */
2059
+ /** Original DOCX buffer. Kept for round-trip saves that preserve untouched parts. */
1849
2060
  originalBuffer?: ArrayBuffer;
1850
- /** Detected template variables ({{...}}) */
2061
+ /** Detected docxtemplater variables (e.g. `{name}`, `{address}`). Populated when the document is recognized as a template. */
1851
2062
  templateVariables?: string[];
1852
- /** Parsing warnings/errors */
2063
+ /** Non-fatal parser diagnostics — malformed parts, unsupported features, fallbacks. */
1853
2064
  warnings?: string[];
1854
2065
  }
1855
2066
 
1856
- /**
1857
- * Types for @eigenpal/docx-editor-agents
1858
- */
1859
2067
  interface HeadingBlock {
1860
2068
  type: 'heading';
1861
2069
  index: number;
@@ -1990,7 +2198,7 @@ interface FoundMatch {
1990
2198
  before: string;
1991
2199
  after: string;
1992
2200
  }
1993
- /** Snapshot of the user's current selection / cursor. */
2201
+ /** @public */
1994
2202
  interface SelectionInfo {
1995
2203
  paraId: string | null;
1996
2204
  selectedText: string;
@@ -2063,6 +2271,8 @@ interface PageContent {
2063
2271
  * Snapshot of what the user is looking at — pass this to your agent's system
2064
2272
  * prompt so it knows the current selection / page without an extra
2065
2273
  * `read_selection` round-trip.
2274
+ *
2275
+ * @public
2066
2276
  */
2067
2277
  interface AgentContextSnapshot {
2068
2278
  /** User's current selection or cursor (null if editor isn't focused). */
@@ -2097,25 +2307,28 @@ interface BatchResult {
2097
2307
  }
2098
2308
 
2099
2309
  /**
2100
- * DocxReviewerWord-like API for AI document review.
2310
+ * Headless DOCX reviewer parse a file, read/comment/track changes
2311
+ * against the document model, write the modified DOCX back out. No DOM,
2312
+ * no editor instance. Pair with `createReviewerBridge()` to drive the
2313
+ * built-in agent tools against a file on disk.
2101
2314
  *
2102
2315
  * @example
2103
2316
  * ```ts
2104
2317
  * const reviewer = await DocxReviewer.fromBuffer(buffer, 'AI Reviewer');
2105
- * const text = reviewer.getContentAsText();
2106
2318
  * reviewer.addComment(5, 'Fix this paragraph.');
2107
2319
  * reviewer.replace(5, '$50k', '$500k');
2108
2320
  * const output = await reviewer.toBuffer();
2109
2321
  * ```
2322
+ *
2323
+ * @public
2110
2324
  */
2111
-
2112
2325
  declare class DocxReviewer {
2113
2326
  private doc;
2114
2327
  /** Default author for comments and tracked changes. Set once, used everywhere. */
2115
2328
  readonly author: string;
2116
2329
  /**
2117
2330
  * Create a reviewer from a parsed Document.
2118
- * @param document - Parsed Document from @eigenpal/docx-core
2331
+ * @param document - Parsed Document from the core package
2119
2332
  * @param author - Default author name for comments and changes. (default: 'AI')
2120
2333
  * @param originalBuffer - Original DOCX buffer, needed for toBuffer()
2121
2334
  */
@@ -2204,37 +2417,6 @@ declare class DocxReviewer {
2204
2417
  toBuffer(): Promise<ArrayBuffer>;
2205
2418
  }
2206
2419
 
2207
- /**
2208
- * useAgentChat — React hook that wires agent tools to a live DocxEditor.
2209
- *
2210
- * @example
2211
- * ```tsx
2212
- * import { useAgentChat } from '@eigenpal/docx-editor-agents/bridge';
2213
- *
2214
- * const { executeToolCall, toolSchemas } = useAgentChat({ editorRef, author: 'Assistant' });
2215
- *
2216
- * // Pass toolSchemas to your AI provider, execute tool calls on the client
2217
- * const result = executeToolCall('add_comment', { paragraphIndex: 3, text: 'Fix this.' });
2218
- * ```
2219
- */
2220
-
2221
- interface UseAgentChatOptions {
2222
- /** Reference to the DocxEditor (must match EditorRefLike interface). */
2223
- editorRef: React.RefObject<EditorRefLike | null>;
2224
- /** Default author name for comments and changes. Default: 'AI' */
2225
- author?: string;
2226
- }
2227
- interface UseAgentChatReturn {
2228
- /** Execute a tool call through the bridge. */
2229
- executeToolCall: (toolName: string, input: Record<string, unknown>) => AgentToolResult;
2230
- /** Tool schemas in OpenAI function calling format. Pass to your AI provider. */
2231
- toolSchemas: ReturnType<typeof getToolSchemas>;
2232
- }
2233
- /**
2234
- * Hook that creates an EditorBridge and provides tool execution.
2235
- */
2236
- declare function useAgentChat(options: UseAgentChatOptions): UseAgentChatReturn;
2237
-
2238
2420
  /**
2239
2421
  * Reviewer bridge — wraps a `DocxReviewer` (static document) in the same
2240
2422
  * `EditorBridge` interface the live editor exposes. Lets the same MCP server
@@ -2262,12 +2444,16 @@ declare function useAgentChat(options: UseAgentChatOptions): UseAgentChatReturn;
2262
2444
  * disk. Call `reviewer.toBuffer()` afterwards to get the modified DOCX.
2263
2445
  *
2264
2446
  * @param reviewer - A DocxReviewer instance. The bridge mutates it in place.
2447
+ *
2448
+ * @public
2265
2449
  */
2266
2450
  declare function createReviewerBridge(reviewer: DocxReviewer): EditorBridge;
2267
2451
 
2268
2452
  /**
2269
- * Minimal DocxEditorRef interface only the methods the bridge needs.
2270
- * This avoids importing the full React package at type level.
2453
+ * Agent-bridge contract every editor adapter (React, Vue, future) MUST satisfy.
2454
+ * Versioning: additions are coordinated minor bumps across the fixed group;
2455
+ * signature changes / removals are major. See
2456
+ * `openspec/changes/vue-editor-robust-implementation/design.md` Decision 18.
2271
2457
  */
2272
2458
  interface EditorRefLike {
2273
2459
  getDocument(): unknown | null;
@@ -2322,6 +2508,13 @@ interface EditorRefLike {
2322
2508
  onContentChange(listener: (doc: unknown) => void): () => void;
2323
2509
  onSelectionChange(listener: (selection: unknown) => void): () => void;
2324
2510
  }
2511
+ /**
2512
+ * High-level agent surface over a live editor (or a headless reviewer).
2513
+ * Every built-in tool calls into this contract — implement it once and
2514
+ * the agent toolkit works against your editor.
2515
+ *
2516
+ * @public
2517
+ */
2325
2518
  interface EditorBridge {
2326
2519
  /** Get document content as paraId-tagged text lines for LLM prompts. */
2327
2520
  getContentAsText(options?: GetContentOptions): string;
@@ -2400,6 +2593,12 @@ declare function createEditorBridge(editorRef: EditorRefLike, author?: string):
2400
2593
  * Agent tool type definitions.
2401
2594
  */
2402
2595
 
2596
+ /**
2597
+ * Definition of an agent tool — name, JSON-schema input, handler.
2598
+ * Use this to build custom tools alongside the built-in `agentTools`.
2599
+ *
2600
+ * @public
2601
+ */
2403
2602
  interface AgentToolDefinition<TInput = Record<string, unknown>> {
2404
2603
  /** Tool name (used in tool_use blocks) */
2405
2604
  name: string;
@@ -2417,6 +2616,12 @@ interface AgentToolDefinition<TInput = Record<string, unknown>> {
2417
2616
  /** Handler — receives parsed input + bridge, returns result */
2418
2617
  handler: (input: TInput, bridge: EditorBridge) => AgentToolResult;
2419
2618
  }
2619
+ /**
2620
+ * Result returned by a tool handler. `success: false` carries an `error`
2621
+ * message; `success: true` may carry tool-specific `data`.
2622
+ *
2623
+ * @public
2624
+ */
2420
2625
  interface AgentToolResult {
2421
2626
  success: boolean;
2422
2627
  data?: unknown;
@@ -2432,11 +2637,19 @@ interface AgentToolResult {
2432
2637
  * `resolve_comment` / `scroll`). paraId anchors are stable across edits.
2433
2638
  */
2434
2639
 
2435
- /** All built-in agent tools. */
2640
+ /**
2641
+ * All built-in agent tools — read/write document content, comments, and
2642
+ * tracked changes. Use `getToolSchemas()` to feed them to an LLM and
2643
+ * `executeToolCall()` to run the handlers against an `EditorBridge`.
2644
+ *
2645
+ * @public
2646
+ */
2436
2647
  declare const agentTools: AgentToolDefinition<any>[];
2437
2648
  /**
2438
2649
  * Execute a tool call against an EditorBridge.
2439
2650
  * Returns the result (never throws).
2651
+ *
2652
+ * @public
2440
2653
  */
2441
2654
  declare function executeToolCall(toolName: string, input: Record<string, unknown>, bridge: EditorBridge): AgentToolResult;
2442
2655
  /**
@@ -2446,6 +2659,8 @@ declare function executeToolCall(toolName: string, input: Record<string, unknown
2446
2659
  *
2447
2660
  * @example getToolDisplayName('add_comment') // → 'Adding comment'
2448
2661
  * @example getToolDisplayName('fetch_clause_template') // → 'Fetch clause template'
2662
+ *
2663
+ * @public
2449
2664
  */
2450
2665
  declare function getToolDisplayName(name: string): string;
2451
2666
  /**
@@ -2454,6 +2669,8 @@ declare function getToolDisplayName(name: string): string;
2454
2669
  * LangChain, or other agent runtimes, transform this output to that
2455
2670
  * runtime's required shape — see `examples/agent-chat-demo/` for a
2456
2671
  * Vercel AI SDK example. The package stays runtime-agnostic.
2672
+ *
2673
+ * @public
2457
2674
  */
2458
2675
  declare function getToolSchemas(): {
2459
2676
  type: "function";
@@ -2464,4 +2681,4 @@ declare function getToolSchemas(): {
2464
2681
  };
2465
2682
  }[];
2466
2683
 
2467
- export { type AgentToolDefinition as A, type BatchError as B, type ContentBlock as C, DocxReviewer as D, type EditorRefLike as E, type FoundMatch as F, type GetContentOptions as G, type ProposeChangeOptions as P, type ReviewComment as R, type SelectionInfo as S, type UseAgentChatOptions as U, type AgentToolResult as a, type AgentContextSnapshot as b, type UseAgentChatReturn as c, getToolDisplayName as d, type CommentFilter as e, type ChangeFilter as f, getToolSchemas as g, type ReviewChange as h, type AddCommentByParaIdOptions as i, type ReplyOptions as j, type ApplyFormattingOptions as k, type SetParagraphStyleOptions as l, type PageContent as m, type ContentChangeEvent as n, type SelectionChangeEvent as o, type BatchResult as p, type BatchReviewOptions as q, agentTools as r, createReviewerBridge as s, executeToolCall as t, useAgentChat as u, type EditorBridge as v, createEditorBridge as w };
2684
+ export { type AddCommentByParaIdOptions as A, type BatchError as B, type ContentBlock as C, DocxReviewer as D, type EditorBridge as E, type FoundMatch as F, type GetContentOptions as G, type ProposeChangeOptions as P, type ReviewComment as R, type SelectionInfo as S, type CommentFilter as a, type ChangeFilter as b, type ReviewChange as c, type ReplyOptions as d, type ApplyFormattingOptions as e, type SetParagraphStyleOptions as f, type PageContent as g, type ContentChangeEvent as h, type SelectionChangeEvent as i, type AgentToolDefinition as j, type AgentToolResult as k, type BatchResult as l, type BatchReviewOptions as m, agentTools as n, createReviewerBridge as o, executeToolCall as p, getToolSchemas as q, type EditorRefLike as r, type AgentContextSnapshot as s, getToolDisplayName as t, createEditorBridge as u };