@ansonlai/docx-redline-js 0.5.4 → 0.6.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 (55) hide show
  1. package/AGENTS.md +82 -697
  2. package/ARCHITECTURE.md +13 -1
  3. package/CHANGELOG.md +8 -0
  4. package/README.md +177 -45
  5. package/core/paragraph-targeting.js +14 -2
  6. package/dist/docx-redline-js.esm.js +184 -51
  7. package/dist/docx-redline-js.esm.js.map +3 -3
  8. package/dist/docx-redline-js.esm.min.js +77 -77
  9. package/dist/docx-redline-js.esm.min.js.map +4 -4
  10. package/docs/AGENT_FAST_START.md +59 -0
  11. package/docs/AGENT_KNOWLEDGE_BASE.md +878 -0
  12. package/docs/SKILL_AUTHORING.md +126 -0
  13. package/docs/TESTING.md +35 -1
  14. package/docs/schemas/document-operations.schema.json +5 -1
  15. package/docs/validation-reports/2026-09-12-agent-cli-discovery-baseline.md +56 -0
  16. package/docs/validation-reports/2026-09-12-agent-protocol-rollout.md +86 -0
  17. package/docs/validation-reports/2026-09-13-agent-cli-efficiency-rollout.md +86 -0
  18. package/engine/oxml-engine.js +80 -13
  19. package/engine/run-builders.js +5 -15
  20. package/index.d.ts +28 -3
  21. package/node/cli-help.js +209 -0
  22. package/node/cli.js +323 -65
  23. package/node/docx-document.js +120 -69
  24. package/node/index.d.ts +6 -2
  25. package/package.json +15 -3
  26. package/scripts/generate-cross-author-slicing-fixtures.ps1 +25 -25
  27. package/services/batch-operation-orchestrator.js +215 -120
  28. package/services/document-inspection.js +89 -11
  29. package/services/document-operation-applier.js +52 -34
  30. package/services/document-operation-contract.js +10 -6
  31. package/services/document-operation-mutations.js +51 -5
  32. package/services/document-operation-session.js +4 -0
  33. package/services/error-recovery.js +174 -0
  34. package/services/operation-batch-compiler.js +394 -0
  35. package/services/operation-preflight.js +91 -72
  36. package/services/standalone-operation-runner.d.ts +17 -1
  37. package/docs/plans/2026-09-05-structural-revisions-and-fidelity-oracles.md +0 -1669
  38. package/docs/plans/2026-09-08-cross-author-revision-slicing.md +0 -1399
  39. package/docs/plans/completed/2026-03-01-release-0.1.4-design.md +0 -33
  40. package/docs/plans/completed/2026-03-01-release-0.1.4.md +0 -110
  41. package/docs/plans/completed/2026-05-31-architectural changes.md +0 -593
  42. package/docs/plans/completed/2026-08-02-reliability-improvements.md +0 -1155
  43. package/docs/plans/completed/2026-08-30-reliability-testing-improvements.md +0 -488
  44. package/docs/plans/completed/2026-09-01-performance-and-complexity-reduction.md +0 -669
  45. package/docs/plans/completed/2026-09-03-agent-friendly-document-workflows.md +0 -427
  46. package/docs/plans/completed/2026-09-04-comment-anchor-and-cli-reliability.md +0 -519
  47. package/docs/plans/completed/PERFORMANCE-CONSOLIDATION.md +0 -69
  48. package/docs/plans/completed/structural-revision-capability-matrix.md +0 -115
  49. package/docs/test-comparison-dashboard.html +0 -4338
  50. package/docs/validation-reports/2026-08-30-phase-1-word-visual-preflight.md +0 -22
  51. package/docs/validation-reports/2026-08-30-phase-2-word-visual-preflight.md +0 -24
  52. package/docs/validation-reports/2026-08-30-phase-3-coverage.md +0 -73
  53. package/docs/validation-reports/2026-09-02-multilevel-bullets-visual-review.md +0 -82
  54. package/docs/validation-reports/2026-09-02-multimodal-visual-samples.md +0 -114
  55. package/docs/validation-reports/2026-09-02-visual-failures-preflight.md +0 -79
@@ -0,0 +1,59 @@
1
+ # Agent Fast Start
2
+
3
+ Use this page for ordinary `.docx` edits. For source changes or unusual Word structures, follow the links at the end.
4
+
5
+ ## Structured agent tool
6
+
7
+ If your host provides a document-session wrapper:
8
+
9
+ 1. Inspect/search once with enough surrounding context to draft the change.
10
+ 2. Apply using the returned revision-bound target handle. Send either the
11
+ complete desired paragraph or exact replacements supported by that wrapper.
12
+ 3. Treat only `ok: true` as complete. A failed handle must be refreshed by
13
+ inspection; never reuse it against a changed document.
14
+
15
+ The repository's `examples/agent-session-wrapper.mjs` demonstrates this pattern.
16
+ It is a development sample, not a package API.
17
+
18
+ ## CLI fallback
19
+
20
+ 1. Extract only the relevant clause or range:
21
+
22
+ ```bash
23
+ docx-redline extract contract.docx --search "termination" --around 3
24
+ ```
25
+
26
+ Search is case-insensitive. Direct hits are capped; follow `selection.nextAfter` with `--after`, and cite `humanReference`, not `P42`.
27
+
28
+ 2. Copy `exactText` with `paragraphId` or `fingerprint`. Use a UTF-8 operations
29
+ file or serializer-backed stdin, then apply once:
30
+
31
+ ```bash
32
+ node emit-operations.mjs | docx-redline apply contract.docx --operations - --profile agent --compact --output reviewed.docx
33
+ ```
34
+
35
+ `emit-operations.mjs` should use `JSON.stringify`; do not interpolate legal
36
+ text through shell quoting. `modified` is the complete desired accepted-view
37
+ paragraph, not only the inserted words.
38
+
39
+ The `agent` profile preserves progressive execution and the ordinary revision policy while making incomplete work exit nonzero. Add `--atomic` deliberately; check `effectiveOptions`. Run `docx-redline apply --help` for redline, comment, and rejected-view restore shapes.
40
+
41
+ ## Batch and result rules
42
+
43
+ - Strong inspected targets are bound to the batch-start document. Independent
44
+ edits do not need bottom-up sorting around earlier paragraph splits.
45
+ - Consolidate multiple desired texts for the same source paragraph. Follow an
46
+ explicit capture dependency for non-unique content created earlier in a batch.
47
+ - Require `completion: true`, `written: true`, a non-null `outputPath`, and no
48
+ per-operation error. The source is not overwritten unless `--in-place` is
49
+ explicit.
50
+ - On failure, follow `error.recovery.action`. Never retry unchanged arguments.
51
+ - `retryPlan.base: "original"` means correct and replay the complete batch.
52
+ `base: "output"` means keep committed progressive work and retry only the
53
+ reported failed or unattempted indexes.
54
+ - Never accept/reject revisions or remove comments without user authorization.
55
+ `slice-cross-author` is the history-preserving option for a surgical edit
56
+ inside another reviewer's pending insertion.
57
+
58
+ Advanced operations and recovery: [Agent Knowledge Base](AGENT_KNOWLEDGE_BASE.md); canonical contract: [document-operations.schema.json](schemas/document-operations.schema.json)
59
+ Wrapper design: [README](../README.md#example-agent-session-wrapper-development-only)