@usejunior/docx-mcp 0.15.0 → 0.16.0

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 (50) hide show
  1. package/README.md +1 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/cli/commands/compare.js +1 -1
  4. package/dist/cli/commands/compare.js.map +1 -1
  5. package/dist/server.d.ts +6 -70
  6. package/dist/server.d.ts.map +1 -1
  7. package/dist/server.js +9 -0
  8. package/dist/server.js.map +1 -1
  9. package/dist/session/manager.d.ts +37 -7
  10. package/dist/session/manager.d.ts.map +1 -1
  11. package/dist/session/manager.js +10 -0
  12. package/dist/session/manager.js.map +1 -1
  13. package/dist/tool_catalog.d.ts +125 -85
  14. package/dist/tool_catalog.d.ts.map +1 -1
  15. package/dist/tool_catalog.js +125 -13
  16. package/dist/tool_catalog.js.map +1 -1
  17. package/dist/tools/accept_ai_edits.d.ts +13 -0
  18. package/dist/tools/accept_ai_edits.d.ts.map +1 -0
  19. package/dist/tools/accept_ai_edits.js +41 -0
  20. package/dist/tools/accept_ai_edits.js.map +1 -0
  21. package/dist/tools/add_comment.d.ts.map +1 -1
  22. package/dist/tools/add_comment.js +40 -0
  23. package/dist/tools/add_comment.js.map +1 -1
  24. package/dist/tools/add_footnote.d.ts.map +1 -1
  25. package/dist/tools/add_footnote.js +21 -0
  26. package/dist/tools/add_footnote.js.map +1 -1
  27. package/dist/tools/compare_documents.js +1 -1
  28. package/dist/tools/compare_documents.js.map +1 -1
  29. package/dist/tools/comparison_defaults.d.ts +1 -1
  30. package/dist/tools/comparison_defaults.d.ts.map +1 -1
  31. package/dist/tools/delete_comment.d.ts.map +1 -1
  32. package/dist/tools/delete_comment.js +34 -0
  33. package/dist/tools/delete_comment.js.map +1 -1
  34. package/dist/tools/get_document_outline.d.ts +29 -0
  35. package/dist/tools/get_document_outline.d.ts.map +1 -0
  36. package/dist/tools/get_document_outline.js +67 -0
  37. package/dist/tools/get_document_outline.js.map +1 -0
  38. package/dist/tools/read_file.d.ts +1 -0
  39. package/dist/tools/read_file.d.ts.map +1 -1
  40. package/dist/tools/read_file.js +46 -2
  41. package/dist/tools/read_file.js.map +1 -1
  42. package/dist/tools/reject_ai_edits.d.ts +14 -0
  43. package/dist/tools/reject_ai_edits.d.ts.map +1 -0
  44. package/dist/tools/reject_ai_edits.js +42 -0
  45. package/dist/tools/reject_ai_edits.js.map +1 -0
  46. package/dist/tools/save.d.ts +1 -21
  47. package/dist/tools/save.d.ts.map +1 -1
  48. package/dist/tools/save.js +84 -129
  49. package/dist/tools/save.js.map +1 -1
  50. package/package.json +10 -9
@@ -1,6 +1,32 @@
1
1
  import { z } from 'zod';
2
+ type ToolAnnotations = {
3
+ readOnlyHint: boolean;
4
+ destructiveHint: boolean;
5
+ };
6
+ /**
7
+ * Contract-surface classification for a tool's writes (#118 / #122).
8
+ *
9
+ * - `revisionable` — AI-attributed writes land as native OOXML tracked-change
10
+ * markup (Table A of SUPPORT.md). Enforced by the write-time emitter (#120)
11
+ * and validator (#121); exercised by the revisionable-surface property test.
12
+ * - `package-mutation` — writes mutate package-level parts with no native
13
+ * revision wrapper (Table B). Recorded in the session non-revision change
14
+ * manifest and surfaced in the save report rather than tracked.
15
+ * - `internal` — outside the AI-authoring contract: read-only utilities,
16
+ * tracked-change consumers (accept_changes), and derived-output tools
17
+ * (export, convert_to_odt). Matches SUPPORT.md's "Internal / non-contract".
18
+ *
19
+ * A tool may be primarily `revisionable` yet also touch package parts; those
20
+ * set `emitsNonRevisionChanges` and record manifest entries for the untracked
21
+ * portion (e.g. add_comment tracks the body reference but writes comment text
22
+ * to comments.xml).
23
+ *
24
+ * @see packages/docx-core/SUPPORT.md for the ratified per-tool inventory (#119).
25
+ */
26
+ type ToolSurface = 'revisionable' | 'package-mutation' | 'internal';
2
27
  export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
3
28
  readonly name: "read_file";
29
+ readonly surface: "internal";
4
30
  readonly description: "Read document content (DOCX, ODT, or Google Doc). Output is token-limited (~14k tokens) by default with pagination metadata (has_more, next_offset). Use offset/limit to paginate.";
5
31
  readonly input: z.ZodObject<{
6
32
  offset: z.ZodOptional<z.ZodNumber>;
@@ -19,6 +45,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
19
45
  }>>;
20
46
  show_formatting: z.ZodOptional<z.ZodBoolean>;
21
47
  include_fingerprint: z.ZodOptional<z.ZodBoolean>;
48
+ include_fingerprint_ordinal: z.ZodOptional<z.ZodBoolean>;
22
49
  include_footnotes: z.ZodOptional<z.ZodBoolean>;
23
50
  google_doc_id: z.ZodOptional<z.ZodString>;
24
51
  file_path: z.ZodOptional<z.ZodString>;
@@ -27,8 +54,25 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
27
54
  readonly readOnlyHint: true;
28
55
  readonly destructiveHint: false;
29
56
  };
57
+ }, {
58
+ readonly name: "get_document_outline";
59
+ readonly surface: "internal";
60
+ readonly description: "Get a compact structural map of a document's headings (DOCX only). Returns one entry per heading paragraph with its text, outline level, source, and stable `_bk_*` paragraph_id — so an agent can read the cheap outline first, then scope a targeted read_file/replace_text to the right section instead of scanning the whole body. Style-based (Word HeadingN) headings only by default; set include_heuristic_headings=true to also include heuristic titles/run-in headers. Read-only.";
61
+ readonly input: z.ZodObject<{
62
+ format: z.ZodOptional<z.ZodEnum<{
63
+ json: "json";
64
+ markdown: "markdown";
65
+ }>>;
66
+ include_heuristic_headings: z.ZodOptional<z.ZodBoolean>;
67
+ file_path: z.ZodOptional<z.ZodString>;
68
+ }, z.core.$strip>;
69
+ readonly annotations: {
70
+ readonly readOnlyHint: true;
71
+ readonly destructiveHint: false;
72
+ };
30
73
  }, {
31
74
  readonly name: "grep";
75
+ readonly surface: "internal";
32
76
  readonly description: "Search paragraphs with regex. Use file_path for session-based search, file_paths for stateless multi-file search, or google_doc_id for Google Docs. ODT supported via file_path (single-file) only.";
33
77
  readonly input: z.ZodObject<{
34
78
  file_paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -50,7 +94,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
50
94
  };
51
95
  }, {
52
96
  readonly name: "batch_edit";
53
- readonly description: "Single-agent front door for applying multiple edit steps (replace_text, insert_paragraph) to a document in one call. Validates all steps first, rejects conflicts before applying anything, then executes valid steps sequentially. Accepts inline steps or a plan_file_path JSON array.";
97
+ readonly surface: "revisionable";
98
+ readonly description: "Single-agent front door for applying multiple edit steps (replace_text, insert_paragraph) to a document in one call. Validates all steps first, rejects conflicts before applying anything, then executes valid steps sequentially. Accepts inline steps or a plan_file_path JSON array. Surface: revisionable — every applied step emits native OOXML tracked changes.";
54
99
  readonly input: z.ZodObject<{
55
100
  steps: z.ZodOptional<z.ZodArray<z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>>>;
56
101
  plan_file_path: z.ZodOptional<z.ZodString>;
@@ -62,7 +107,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
62
107
  };
63
108
  }, {
64
109
  readonly name: "replace_text";
65
- readonly description: "Replace text in a paragraph by provider paragraph id, preserving formatting where supported. Supports DOCX, ODT, and Google Docs.";
110
+ readonly surface: "revisionable";
111
+ readonly description: "Replace text in a paragraph by provider paragraph id, preserving formatting where supported. Supports DOCX, ODT, and Google Docs. Surface: revisionable — DOCX edits emit native OOXML tracked changes (w:ins/w:del/w:rPrChange).";
66
112
  readonly input: z.ZodObject<{
67
113
  target_paragraph_id: z.ZodString;
68
114
  old_string: z.ZodString;
@@ -78,7 +124,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
78
124
  };
79
125
  }, {
80
126
  readonly name: "insert_paragraph";
81
- readonly description: "Insert a paragraph before/after an anchor paragraph by paragraph id. Supports DOCX, ODT, and Google Docs. (ODT paragraph ids are positional and shift after insertion — re-read before further edits.)";
127
+ readonly surface: "revisionable";
128
+ readonly description: "Insert a paragraph before/after an anchor paragraph by paragraph id. Supports DOCX, ODT, and Google Docs. (ODT paragraph ids are positional and shift after insertion — re-read before further edits.) Surface: revisionable — DOCX insertions emit native OOXML tracked changes.";
82
129
  readonly input: z.ZodObject<{
83
130
  positional_anchor_node_id: z.ZodString;
84
131
  new_string: z.ZodString;
@@ -97,7 +144,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
97
144
  };
98
145
  }, {
99
146
  readonly name: "save";
100
- readonly description: "Save document. For DOCX: saves clean and/or tracked changes output. For ODT: saves an .odt package. For Google Docs: checkpoint (default) returns revisionId, or snapshot exports as DOCX.";
147
+ readonly surface: "revisionable";
148
+ readonly description: "Save document. For DOCX: saves clean and/or tracked changes output. For ODT: saves an .odt package. For Google Docs: checkpoint (default) returns revisionId, or snapshot exports as DOCX. Surface: revisionable — the save report lists both the AI revisions applied and a non-revision change manifest of any package-level mutations (comment/footnote side parts, relationships) that have no tracked-change wrapper.";
101
149
  readonly input: z.ZodObject<{
102
150
  save_to_local_path: z.ZodString;
103
151
  clean_bookmarks: z.ZodOptional<z.ZodBoolean>;
@@ -123,6 +171,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
123
171
  };
124
172
  }, {
125
173
  readonly name: "export";
174
+ readonly surface: "internal";
126
175
  readonly description: "Export a document to a portable rendering (Markdown, semantic HTML, or plain text). Writes an output file (default: source path with the format extension, e.g. .md, .html, or .txt) and returns its path, byte count, and the rendered content (under `content`). Intentionally lossy (no round-trip); HTML is the semantic tier, not pixel-faithful. DOCX only — Google Docs is not supported.";
127
176
  readonly input: z.ZodObject<{
128
177
  format: z.ZodOptional<z.ZodEnum<{
@@ -141,6 +190,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
141
190
  };
142
191
  }, {
143
192
  readonly name: "convert_to_odt";
193
+ readonly surface: "internal";
144
194
  readonly description: "Convert a DOCX document to OpenDocument Text (.odt) using the native model-to-model converter (no LibreOffice involved). Writes the .odt (default: source path with the .odt extension), validates ODF packaging safety before writing, and returns the output path plus a `lossiness` summary itemizing every downgraded construct. Conversion is semantic and intentionally lossy: text, headings, bold/italic/underline, hyperlinks, lists, and tables are mapped; richer styling, tracked changes, comments, and headers/footers are not. DOCX in, ODT out — Google Docs and .odt inputs are not supported.";
145
195
  readonly input: z.ZodObject<{
146
196
  output_path: z.ZodOptional<z.ZodString>;
@@ -153,7 +203,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
153
203
  };
154
204
  }, {
155
205
  readonly name: "format_layout";
156
- readonly description: "Apply layout controls (paragraph spacing, table row height, cell padding). Google Docs supports paragraph spacing only.";
206
+ readonly surface: "revisionable";
207
+ readonly description: "Apply layout controls (paragraph spacing, table row height, cell padding). Google Docs supports paragraph spacing only. Surface: revisionable — DOCX geometry edits emit native property-change revisions (w:pPrChange/w:trPrChange/w:tcPrChange).";
157
208
  readonly input: z.ZodObject<{
158
209
  strict: z.ZodOptional<z.ZodBoolean>;
159
210
  paragraph_spacing: z.ZodOptional<z.ZodObject<{
@@ -162,8 +213,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
162
213
  after_twips: z.ZodOptional<z.ZodNumber>;
163
214
  line_twips: z.ZodOptional<z.ZodNumber>;
164
215
  line_rule: z.ZodOptional<z.ZodEnum<{
165
- auto: "auto";
166
216
  exact: "exact";
217
+ auto: "auto";
167
218
  atLeast: "atLeast";
168
219
  }>>;
169
220
  }, z.core.$strip>>;
@@ -172,8 +223,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
172
223
  row_indexes: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
173
224
  value_twips: z.ZodOptional<z.ZodNumber>;
174
225
  rule: z.ZodOptional<z.ZodEnum<{
175
- auto: "auto";
176
226
  exact: "exact";
227
+ auto: "auto";
177
228
  atLeast: "atLeast";
178
229
  }>>;
179
230
  }, z.core.$strip>>;
@@ -195,6 +246,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
195
246
  };
196
247
  }, {
197
248
  readonly name: "accept_changes";
249
+ readonly surface: "internal";
198
250
  readonly description: "Accept all tracked changes in the document body, producing a clean document with no revision markup. Returns acceptance stats.";
199
251
  readonly input: z.ZodObject<{
200
252
  file_path: z.ZodString;
@@ -203,8 +255,37 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
203
255
  readonly readOnlyHint: false;
204
256
  readonly destructiveHint: true;
205
257
  };
258
+ }, {
259
+ readonly name: "accept_ai_edits";
260
+ readonly surface: "internal";
261
+ readonly description: "Selectively accept tracked changes by revision id or author, leaving all other (e.g. third-party reviewer) revisions byte-untouched. Provide revision_ids (array of w:id values) to target specific revisions, or author to accept every revision by one actor. Sweeps document.xml and supported side-story parts (footnotes, endnotes, comments). An ambiguous overlap — a targeted revision structurally containing, or contained by, a non-targeted revision (nested ins/del/move) — hard-errors with code AMBIGUOUS_REVISION_OVERLAP and a structured `overlaps` list unless normalize_first is set (best-effort, no byte-identical promise).";
262
+ readonly input: z.ZodObject<{
263
+ revision_ids: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
264
+ author: z.ZodOptional<z.ZodString>;
265
+ normalize_first: z.ZodOptional<z.ZodBoolean>;
266
+ file_path: z.ZodString;
267
+ }, z.core.$strip>;
268
+ readonly annotations: {
269
+ readonly readOnlyHint: false;
270
+ readonly destructiveHint: true;
271
+ };
272
+ }, {
273
+ readonly name: "reject_ai_edits";
274
+ readonly surface: "internal";
275
+ readonly description: "Selectively reject tracked changes by revision id or author (restoring their pre-edit state), leaving all other revisions byte-untouched. Symmetric to accept_ai_edits: provide revision_ids or author, sweeps document.xml and supported side-story parts, and hard-errors on an ambiguous overlap (code AMBIGUOUS_REVISION_OVERLAP with a structured `overlaps` list) unless normalize_first is set.";
276
+ readonly input: z.ZodObject<{
277
+ revision_ids: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
278
+ author: z.ZodOptional<z.ZodString>;
279
+ normalize_first: z.ZodOptional<z.ZodBoolean>;
280
+ file_path: z.ZodString;
281
+ }, z.core.$strip>;
282
+ readonly annotations: {
283
+ readonly readOnlyHint: false;
284
+ readonly destructiveHint: true;
285
+ };
206
286
  }, {
207
287
  readonly name: "has_tracked_changes";
288
+ readonly surface: "internal";
208
289
  readonly description: "Check whether the document body contains tracked-change markers (insertions, deletions, moves, and property-change records). Read-only.";
209
290
  readonly input: z.ZodObject<{
210
291
  file_path: z.ZodString;
@@ -215,6 +296,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
215
296
  };
216
297
  }, {
217
298
  readonly name: "get_file_status";
299
+ readonly surface: "internal";
218
300
  readonly description: "Get file/session metadata including edit count, normalization stats, and cache info. Supports DOCX, ODT, and Google Docs.";
219
301
  readonly input: z.ZodObject<{
220
302
  google_doc_id: z.ZodOptional<z.ZodString>;
@@ -226,6 +308,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
226
308
  };
227
309
  }, {
228
310
  readonly name: "close_file";
311
+ readonly surface: "internal";
229
312
  readonly description: "Close an open file session, or close all sessions with explicit confirmation. Supports DOCX, ODT, and Google Docs.";
230
313
  readonly input: z.ZodObject<{
231
314
  clear_all: z.ZodOptional<z.ZodBoolean>;
@@ -239,7 +322,9 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
239
322
  };
240
323
  }, {
241
324
  readonly name: "add_comment";
242
- readonly description: "Add a comment or threaded reply to a document. Provide target_paragraph_id + anchor_text for root comments, or parent_comment_id for replies. Supports DOCX and ODT (ODT backs comments with office:annotation; threaded replies are DOCX-only).";
325
+ readonly surface: "revisionable";
326
+ readonly emitsNonRevisionChanges: true;
327
+ readonly description: "Add a comment or threaded reply to a document. Provide target_paragraph_id + anchor_text for root comments, or parent_comment_id for replies. Supports DOCX and ODT (ODT backs comments with office:annotation; threaded replies are DOCX-only). Surface: revisionable + package-mutation — the body-story comment reference is tracked (w:ins), while comment text and author metadata are recorded in the save report non-revision change manifest.";
243
328
  readonly input: z.ZodObject<{
244
329
  target_paragraph_id: z.ZodOptional<z.ZodString>;
245
330
  anchor_text: z.ZodOptional<z.ZodString>;
@@ -255,6 +340,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
255
340
  };
256
341
  }, {
257
342
  readonly name: "get_comments";
343
+ readonly surface: "internal";
258
344
  readonly description: "Get all comments from the document with IDs, authors, dates, text, and anchored paragraph IDs. Range-anchored DOCX comments also expose optional end_paragraph_id, start_run_index, start_char_offset, end_run_index, and end_char_offset fields describing the covered span. Includes threaded replies (DOCX). Supports DOCX and ODT. Read-only.";
259
345
  readonly input: z.ZodObject<{
260
346
  file_path: z.ZodString;
@@ -265,7 +351,9 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
265
351
  };
266
352
  }, {
267
353
  readonly name: "delete_comment";
268
- readonly description: "Delete a comment and all its threaded replies from the document. Cascade-deletes all descendants.";
354
+ readonly surface: "revisionable";
355
+ readonly emitsNonRevisionChanges: true;
356
+ readonly description: "Delete a comment and all its threaded replies from the document. Cascade-deletes all descendants. Surface: revisionable + package-mutation — the body-story comment reference removal is tracked (w:del), while comment/reply text cleanup is recorded in the save report non-revision change manifest.";
269
357
  readonly input: z.ZodObject<{
270
358
  comment_id: z.ZodNumber;
271
359
  file_path: z.ZodString;
@@ -276,6 +364,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
276
364
  };
277
365
  }, {
278
366
  readonly name: "compare_documents";
367
+ readonly surface: "revisionable";
279
368
  readonly description: "Compare two documents and produce a tracked-changes output document. Provide original_file_path + revised_file_path for standalone comparison, or file_path to compare session edits against the original. DOCX and ODF (.odt) support both modes. DOCX stats count insertions/deletions as contiguous ranges, expose atom totals as insertedAtoms/deletedAtoms, and report formatChanges separately from modifiedParagraphs. ODF compares at inline granularity (a modified paragraph is marked up in place — only the changed spans are struck or inserted).";
280
369
  readonly input: z.ZodObject<{
281
370
  save_to_local_path: z.ZodString;
@@ -294,6 +383,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
294
383
  };
295
384
  }, {
296
385
  readonly name: "get_footnotes";
386
+ readonly surface: "internal";
297
387
  readonly description: "Get all footnotes from the document with IDs, display numbers, text, and anchored paragraph IDs. Read-only.";
298
388
  readonly input: z.ZodObject<{
299
389
  file_path: z.ZodString;
@@ -304,7 +394,9 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
304
394
  };
305
395
  }, {
306
396
  readonly name: "add_footnote";
307
- readonly description: "Add a footnote anchored to a paragraph. Optionally position the reference after specific text using after_text. Note: [^N] markers in read_file output are display-only and not part of the editable text used by replace_text.";
397
+ readonly surface: "revisionable";
398
+ readonly emitsNonRevisionChanges: true;
399
+ readonly description: "Add a footnote anchored to a paragraph. Optionally position the reference after specific text using after_text. Note: [^N] markers in read_file output are display-only and not part of the editable text used by replace_text. Surface: revisionable + package-mutation — the footnote reference and note text are tracked (w:ins), while footnote-part creation and registration are recorded in the save report non-revision change manifest.";
308
400
  readonly input: z.ZodObject<{
309
401
  target_paragraph_id: z.ZodString;
310
402
  after_text: z.ZodOptional<z.ZodString>;
@@ -317,7 +409,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
317
409
  };
318
410
  }, {
319
411
  readonly name: "update_footnote";
320
- readonly description: "Update the text content of an existing footnote.";
412
+ readonly surface: "revisionable";
413
+ readonly description: "Update the text content of an existing footnote. Surface: revisionable — note-text changes emit native OOXML tracked changes (w:ins/w:del) inside the footnote body.";
321
414
  readonly input: z.ZodObject<{
322
415
  note_id: z.ZodNumber;
323
416
  new_text: z.ZodString;
@@ -329,7 +422,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
329
422
  };
330
423
  }, {
331
424
  readonly name: "delete_footnote";
332
- readonly description: "Delete a footnote and its reference from the document.";
425
+ readonly surface: "revisionable";
426
+ readonly description: "Delete a footnote and its reference from the document. Surface: revisionable — the reference and note text are removed as native OOXML tracked deletions (w:del).";
333
427
  readonly input: z.ZodObject<{
334
428
  note_id: z.ZodNumber;
335
429
  file_path: z.ZodString;
@@ -340,7 +434,8 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
340
434
  };
341
435
  }, {
342
436
  readonly name: "clear_formatting";
343
- readonly description: "Clear specific run-level formatting (bold, italic, underline, highlight, color, font) from paragraphs.";
437
+ readonly surface: "revisionable";
438
+ readonly description: "Clear specific run-level formatting (bold, italic, underline, highlight, color, font) from paragraphs. Surface: revisionable — clearing emits a native run-property-change revision (w:rPrChange).";
344
439
  readonly input: z.ZodObject<{
345
440
  paragraph_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
346
441
  clear_highlight: z.ZodOptional<z.ZodBoolean>;
@@ -357,6 +452,7 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
357
452
  };
358
453
  }, {
359
454
  readonly name: "extract_revisions";
455
+ readonly surface: "internal";
360
456
  readonly description: "Extract tracked changes as structured JSON with before/after text per paragraph, revision details, and comments. Supports pagination via offset and limit. Read-only - does not modify the document.";
361
457
  readonly input: z.ZodObject<{
362
458
  offset: z.ZodOptional<z.ZodNumber>;
@@ -369,79 +465,23 @@ export declare const SAFE_DOCX_TOOL_CATALOG: readonly [{
369
465
  };
370
466
  }];
371
467
  export declare const SAFE_DOCX_MCP_TOOLS: {
372
- name: "read_file" | "grep" | "batch_edit" | "replace_text" | "insert_paragraph" | "save" | "export" | "convert_to_odt" | "format_layout" | "accept_changes" | "has_tracked_changes" | "get_file_status" | "close_file" | "add_comment" | "get_comments" | "delete_comment" | "compare_documents" | "get_footnotes" | "add_footnote" | "update_footnote" | "delete_footnote" | "clear_formatting" | "extract_revisions";
373
- description: "Read document content (DOCX, ODT, or Google Doc). Output is token-limited (~14k tokens) by default with pagination metadata (has_more, next_offset). Use offset/limit to paginate." | "Search paragraphs with regex. Use file_path for session-based search, file_paths for stateless multi-file search, or google_doc_id for Google Docs. ODT supported via file_path (single-file) only." | "Single-agent front door for applying multiple edit steps (replace_text, insert_paragraph) to a document in one call. Validates all steps first, rejects conflicts before applying anything, then executes valid steps sequentially. Accepts inline steps or a plan_file_path JSON array." | "Replace text in a paragraph by provider paragraph id, preserving formatting where supported. Supports DOCX, ODT, and Google Docs." | "Insert a paragraph before/after an anchor paragraph by paragraph id. Supports DOCX, ODT, and Google Docs. (ODT paragraph ids are positional and shift after insertion — re-read before further edits.)" | "Save document. For DOCX: saves clean and/or tracked changes output. For ODT: saves an .odt package. For Google Docs: checkpoint (default) returns revisionId, or snapshot exports as DOCX." | "Export a document to a portable rendering (Markdown, semantic HTML, or plain text). Writes an output file (default: source path with the format extension, e.g. .md, .html, or .txt) and returns its path, byte count, and the rendered content (under `content`). Intentionally lossy (no round-trip); HTML is the semantic tier, not pixel-faithful. DOCX only — Google Docs is not supported." | "Convert a DOCX document to OpenDocument Text (.odt) using the native model-to-model converter (no LibreOffice involved). Writes the .odt (default: source path with the .odt extension), validates ODF packaging safety before writing, and returns the output path plus a `lossiness` summary itemizing every downgraded construct. Conversion is semantic and intentionally lossy: text, headings, bold/italic/underline, hyperlinks, lists, and tables are mapped; richer styling, tracked changes, comments, and headers/footers are not. DOCX in, ODT out — Google Docs and .odt inputs are not supported." | "Apply layout controls (paragraph spacing, table row height, cell padding). Google Docs supports paragraph spacing only." | "Accept all tracked changes in the document body, producing a clean document with no revision markup. Returns acceptance stats." | "Check whether the document body contains tracked-change markers (insertions, deletions, moves, and property-change records). Read-only." | "Get file/session metadata including edit count, normalization stats, and cache info. Supports DOCX, ODT, and Google Docs." | "Close an open file session, or close all sessions with explicit confirmation. Supports DOCX, ODT, and Google Docs." | "Add a comment or threaded reply to a document. Provide target_paragraph_id + anchor_text for root comments, or parent_comment_id for replies. Supports DOCX and ODT (ODT backs comments with office:annotation; threaded replies are DOCX-only)." | "Get all comments from the document with IDs, authors, dates, text, and anchored paragraph IDs. Range-anchored DOCX comments also expose optional end_paragraph_id, start_run_index, start_char_offset, end_run_index, and end_char_offset fields describing the covered span. Includes threaded replies (DOCX). Supports DOCX and ODT. Read-only." | "Delete a comment and all its threaded replies from the document. Cascade-deletes all descendants." | "Compare two documents and produce a tracked-changes output document. Provide original_file_path + revised_file_path for standalone comparison, or file_path to compare session edits against the original. DOCX and ODF (.odt) support both modes. DOCX stats count insertions/deletions as contiguous ranges, expose atom totals as insertedAtoms/deletedAtoms, and report formatChanges separately from modifiedParagraphs. ODF compares at inline granularity (a modified paragraph is marked up in place — only the changed spans are struck or inserted)." | "Get all footnotes from the document with IDs, display numbers, text, and anchored paragraph IDs. Read-only." | "Add a footnote anchored to a paragraph. Optionally position the reference after specific text using after_text. Note: [^N] markers in read_file output are display-only and not part of the editable text used by replace_text." | "Update the text content of an existing footnote." | "Delete a footnote and its reference from the document." | "Clear specific run-level formatting (bold, italic, underline, highlight, color, font) from paragraphs." | "Extract tracked changes as structured JSON with before/after text per paragraph, revision details, and comments. Supports pagination via offset and limit. Read-only - does not modify the document.";
468
+ name: string;
469
+ description: string;
374
470
  inputSchema: Record<string, unknown>;
375
- annotations: {
376
- readonly readOnlyHint: true;
377
- readonly destructiveHint: false;
378
- } | {
379
- readonly readOnlyHint: true;
380
- readonly destructiveHint: false;
381
- } | {
382
- readonly readOnlyHint: false;
383
- readonly destructiveHint: true;
384
- } | {
385
- readonly readOnlyHint: false;
386
- readonly destructiveHint: true;
387
- } | {
388
- readonly readOnlyHint: false;
389
- readonly destructiveHint: true;
390
- } | {
391
- readonly readOnlyHint: false;
392
- readonly destructiveHint: true;
393
- } | {
394
- readonly readOnlyHint: false;
395
- readonly destructiveHint: false;
396
- } | {
397
- readonly readOnlyHint: false;
398
- readonly destructiveHint: false;
399
- } | {
400
- readonly readOnlyHint: false;
401
- readonly destructiveHint: true;
402
- } | {
403
- readonly readOnlyHint: false;
404
- readonly destructiveHint: true;
405
- } | {
406
- readonly readOnlyHint: true;
407
- readonly destructiveHint: false;
408
- } | {
409
- readonly readOnlyHint: true;
410
- readonly destructiveHint: false;
411
- } | {
412
- readonly readOnlyHint: false;
413
- readonly destructiveHint: true;
414
- } | {
415
- readonly readOnlyHint: false;
416
- readonly destructiveHint: true;
417
- } | {
418
- readonly readOnlyHint: true;
419
- readonly destructiveHint: false;
420
- } | {
421
- readonly readOnlyHint: false;
422
- readonly destructiveHint: true;
423
- } | {
424
- readonly readOnlyHint: true;
425
- readonly destructiveHint: false;
426
- } | {
427
- readonly readOnlyHint: true;
428
- readonly destructiveHint: false;
429
- } | {
430
- readonly readOnlyHint: false;
431
- readonly destructiveHint: true;
432
- } | {
433
- readonly readOnlyHint: false;
434
- readonly destructiveHint: true;
435
- } | {
436
- readonly readOnlyHint: false;
437
- readonly destructiveHint: true;
438
- } | {
439
- readonly readOnlyHint: false;
440
- readonly destructiveHint: true;
441
- } | {
442
- readonly readOnlyHint: true;
443
- readonly destructiveHint: false;
444
- };
471
+ annotations: ToolAnnotations;
472
+ surface: ToolSurface;
473
+ emitsNonRevisionChanges: boolean;
445
474
  }[];
475
+ /**
476
+ * Programmatic index of the contract surface each tool writes to (#122),
477
+ * mirroring the ratified inventory in `packages/docx-core/SUPPORT.md`.
478
+ * Consumed by the revisionable-surface property test and by the classification
479
+ * coverage test.
480
+ */
481
+ export declare const TOOL_SURFACE_INDEX: Record<string, {
482
+ surface: ToolSurface;
483
+ emitsNonRevisionChanges: boolean;
484
+ }>;
446
485
  export type SafeDocxToolName = (typeof SAFE_DOCX_TOOL_CATALOG)[number]['name'];
486
+ export {};
447
487
  //# sourceMappingURL=tool_catalog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool_catalog.d.ts","sourceRoot":"","sources":["../src/tool_catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6BxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2Wa,CAAC;AAUjD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAK7B,CAAC;AAEJ,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"tool_catalog.d.ts","sourceRoot":"","sources":["../src/tool_catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,KAAK,eAAe,GAAG;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,KAAK,WAAW,GAAG,cAAc,GAAG,kBAAkB,GAAG,UAAU,CAAC;AAkCpE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8ca,CAAC;AAUjD,eAAO,MAAM,mBAAmB;;;;;;;GAU7B,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,WAAW,CAAC;IAAC,uBAAuB,EAAE,OAAO,CAAA;CAAE,CAMvG,CAAC;AAEJ,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC"}