@beyondwork/docx-react-component 1.0.0 → 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 (704) hide show
  1. package/dist/chunk-32W6IVQE.js +7725 -0
  2. package/dist/chunk-32W6IVQE.js.map +1 -0
  3. package/dist/index.cjs +23722 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +7 -0
  6. package/dist/index.d.ts +7 -0
  7. package/dist/index.js +16011 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/public-types-DqCURAz8.d.cts +1152 -0
  10. package/dist/public-types-DqCURAz8.d.ts +1152 -0
  11. package/dist/tailwind.cjs +8295 -0
  12. package/dist/tailwind.cjs.map +1 -0
  13. package/dist/tailwind.d.cts +323 -0
  14. package/dist/tailwind.d.ts +323 -0
  15. package/dist/tailwind.js +553 -0
  16. package/dist/tailwind.js.map +1 -0
  17. package/package.json +52 -31
  18. package/.codex/config.toml +0 -5
  19. package/.corepack/v1/pnpm/10.30.3/.corepack +0 -1
  20. package/.corepack/v1/pnpm/10.30.3/LICENSE +0 -22
  21. package/.corepack/v1/pnpm/10.30.3/README.md +0 -240
  22. package/.corepack/v1/pnpm/10.30.3/dist/node-gyp-bin/node-gyp +0 -6
  23. package/.corepack/v1/pnpm/10.30.3/dist/node-gyp-bin/node-gyp.cmd +0 -5
  24. package/.corepack/v1/pnpm/10.30.3/dist/pnpm.cjs +0 -195400
  25. package/.corepack/v1/pnpm/10.30.3/dist/pnpmrc +0 -2
  26. package/.corepack/v1/pnpm/10.30.3/dist/reflink.darwin-arm64-2HJ4WGO6.node +0 -0
  27. package/.corepack/v1/pnpm/10.30.3/dist/reflink.darwin-x64-3G3H6IW4.node +0 -0
  28. package/.corepack/v1/pnpm/10.30.3/dist/reflink.win32-arm64-msvc-Q6BARPPB.node +0 -0
  29. package/.corepack/v1/pnpm/10.30.3/dist/reflink.win32-x64-msvc-J2TZHRQI.node +0 -0
  30. package/.corepack/v1/pnpm/10.30.3/dist/templates/completion.bash +0 -31
  31. package/.corepack/v1/pnpm/10.30.3/dist/templates/completion.fish +0 -22
  32. package/.corepack/v1/pnpm/10.30.3/dist/templates/completion.ps1 +0 -193
  33. package/.corepack/v1/pnpm/10.30.3/dist/templates/completion.zsh +0 -27
  34. package/.corepack/v1/pnpm/10.30.3/dist/vendor/fastlist-0.3.0-x64.exe +0 -0
  35. package/.corepack/v1/pnpm/10.30.3/dist/vendor/fastlist-0.3.0-x86.exe +0 -0
  36. package/.corepack/v1/pnpm/10.30.3/dist/worker.js +0 -10119
  37. package/.corepack/v1/pnpm/10.30.3/package.json +0 -192
  38. package/.cursor/mcp.json +0 -7
  39. package/.github/workflows/ci.yml +0 -35
  40. package/.mcp.json +0 -7
  41. package/.openclaw/workspace-state.json +0 -4
  42. package/.pnpmrc.json +0 -1
  43. package/.wave-launch.sh +0 -7
  44. package/.workspace-marker +0 -1
  45. package/AGENTS.md +0 -78
  46. package/CHANGELOG.md +0 -177
  47. package/DESIGN.md +0 -929
  48. package/HEARTBEAT.md +0 -7
  49. package/IDENTITY.md +0 -23
  50. package/SOUL.md +0 -36
  51. package/TOOLS.md +0 -40
  52. package/USER.md +0 -17
  53. package/docs/README.md +0 -107
  54. package/docs/agents/wave-cont-eval-role.md +0 -36
  55. package/docs/agents/wave-cont-qa-role.md +0 -52
  56. package/docs/agents/wave-deploy-verifier-role.md +0 -34
  57. package/docs/agents/wave-design-role.md +0 -47
  58. package/docs/agents/wave-documentation-role.md +0 -34
  59. package/docs/agents/wave-infra-role.md +0 -34
  60. package/docs/agents/wave-integration-role.md +0 -37
  61. package/docs/agents/wave-launcher-role.md +0 -41
  62. package/docs/agents/wave-orchestrator-role.md +0 -52
  63. package/docs/agents/wave-planner-role.md +0 -39
  64. package/docs/agents/wave-security-role.md +0 -40
  65. package/docs/architecture/docx/README.md +0 -10
  66. package/docs/architecture/future/README.md +0 -8
  67. package/docs/architecture/ooxml-upgrade-analysis.md +0 -134
  68. package/docs/architecture/platform/shared-openxml-editor-platform.md +0 -153
  69. package/docs/architecture/xlsx/canonical-workbook-model-and-commands.md +0 -187
  70. package/docs/architecture/xlsx/spreadsheet-editor-frontend-architecture.md +0 -150
  71. package/docs/comment-redline-overview.md +0 -350
  72. package/docs/concepts/context7-vs-skills.md +0 -118
  73. package/docs/concepts/operating-modes.md +0 -91
  74. package/docs/concepts/runtime-agnostic-orchestration.md +0 -111
  75. package/docs/concepts/what-is-a-wave.md +0 -217
  76. package/docs/context7/bundles.json +0 -222
  77. package/docs/context7/planner-agent/README.md +0 -28
  78. package/docs/context7/planner-agent/manifest.json +0 -83
  79. package/docs/context7/planner-agent/papers/cooperbench-why-coding-agents-cannot-be-your-teammates-yet.md +0 -3283
  80. package/docs/context7/planner-agent/papers/dova-deliberation-first-multi-agent-orchestration-for-autonomous-research-automation.md +0 -1699
  81. package/docs/context7/planner-agent/papers/dpbench-large-language-models-struggle-with-simultaneous-coordination.md +0 -2251
  82. package/docs/context7/planner-agent/papers/incremental-planning-to-control-a-blackboard-based-problem-solver.md +0 -1729
  83. package/docs/context7/planner-agent/papers/silo-bench-a-scalable-environment-for-evaluating-distributed-coordination-in-multi-agent-llm-systems.md +0 -3747
  84. package/docs/context7/planner-agent/papers/todoevolve-learning-to-architect-agent-planning-systems.md +0 -1675
  85. package/docs/context7/planner-agent/papers/verified-multi-agent-orchestration-a-plan-execute-verify-replan-framework-for-complex-query-resolution.md +0 -1173
  86. package/docs/context7/planner-agent/papers/why-do-multi-agent-llm-systems-fail.md +0 -5211
  87. package/docs/context7/planner-agent/topics/planning-and-orchestration.md +0 -24
  88. package/docs/evals/arm-templates/README.md +0 -13
  89. package/docs/evals/arm-templates/full-wave.json +0 -15
  90. package/docs/evals/arm-templates/single-agent.json +0 -15
  91. package/docs/evals/benchmark-catalog.json +0 -670
  92. package/docs/evals/cases/README.md +0 -47
  93. package/docs/evals/cases/wave-blackboard-inbox-targeting.json +0 -73
  94. package/docs/evals/cases/wave-contradiction-conflict.json +0 -104
  95. package/docs/evals/cases/wave-expert-routing-preservation.json +0 -69
  96. package/docs/evals/cases/wave-hidden-profile-private-evidence.json +0 -81
  97. package/docs/evals/cases/wave-premature-closure-guard.json +0 -71
  98. package/docs/evals/cases/wave-silo-cross-agent-state.json +0 -77
  99. package/docs/evals/cases/wave-simultaneous-lockstep.json +0 -92
  100. package/docs/evals/external-benchmarks.json +0 -85
  101. package/docs/evals/external-command-config.sample.json +0 -9
  102. package/docs/evals/external-command-config.swe-bench-pro.json +0 -8
  103. package/docs/evals/pilots/README.md +0 -47
  104. package/docs/evals/pilots/swe-bench-pro-public-full-wave-review-10.json +0 -64
  105. package/docs/evals/pilots/swe-bench-pro-public-pilot.json +0 -111
  106. package/docs/evals/wave-benchmark-program.md +0 -302
  107. package/docs/guides/planner.md +0 -220
  108. package/docs/guides/recommendations-0.8.9.md +0 -133
  109. package/docs/guides/signal-wrappers.md +0 -165
  110. package/docs/guides/terminal-surfaces.md +0 -96
  111. package/docs/image copy.png +0 -0
  112. package/docs/image.png +0 -0
  113. package/docs/images/image.png +0 -0
  114. package/docs/legal-feedback-architecture.md +0 -498
  115. package/docs/plans/component-cutover-matrix.json +0 -1072
  116. package/docs/plans/component-cutover-matrix.md +0 -307
  117. package/docs/plans/context7-wave-orchestrator.md +0 -155
  118. package/docs/plans/current-state.md +0 -198
  119. package/docs/plans/docx/README.md +0 -9
  120. package/docs/plans/examples/wave-benchmark-improvement.md +0 -108
  121. package/docs/plans/examples/wave-example-live-proof.md +0 -435
  122. package/docs/plans/master-plan.md +0 -224
  123. package/docs/plans/migration.md +0 -538
  124. package/docs/plans/operations/README.md +0 -7
  125. package/docs/plans/operations/wave-10-word-certification.md +0 -87
  126. package/docs/plans/operations/wave-8-railway-staging.md +0 -153
  127. package/docs/plans/operations/wave-9-manual-certification.md +0 -73
  128. package/docs/plans/platform/README.md +0 -9
  129. package/docs/plans/reference/legal-checklist-coverage.md +0 -258
  130. package/docs/plans/wave-orchestrator.md +0 -423
  131. package/docs/plans/waves/README.md +0 -75
  132. package/docs/plans/waves/completed/wave-0.md +0 -195
  133. package/docs/plans/waves/completed/wave-1.md +0 -379
  134. package/docs/plans/waves/completed/wave-10.md +0 -670
  135. package/docs/plans/waves/completed/wave-11.md +0 -335
  136. package/docs/plans/waves/completed/wave-12.md +0 -417
  137. package/docs/plans/waves/completed/wave-13.md +0 -316
  138. package/docs/plans/waves/completed/wave-14.md +0 -319
  139. package/docs/plans/waves/completed/wave-15.md +0 -321
  140. package/docs/plans/waves/completed/wave-16.md +0 -316
  141. package/docs/plans/waves/completed/wave-17.md +0 -331
  142. package/docs/plans/waves/completed/wave-18.md +0 -328
  143. package/docs/plans/waves/completed/wave-2.md +0 -438
  144. package/docs/plans/waves/completed/wave-3.md +0 -435
  145. package/docs/plans/waves/completed/wave-4.md +0 -430
  146. package/docs/plans/waves/completed/wave-5.md +0 -430
  147. package/docs/plans/waves/completed/wave-6.md +0 -430
  148. package/docs/plans/waves/completed/wave-7.md +0 -526
  149. package/docs/plans/waves/completed/wave-8.md +0 -596
  150. package/docs/plans/waves/completed/wave-9.md +0 -552
  151. package/docs/plans/waves/deferred/README.md +0 -14
  152. package/docs/plans/waves/deferred/encrypted-intake-contracts.md +0 -282
  153. package/docs/plans/waves/deferred/legal-feedback-wave-expansion.md +0 -308
  154. package/docs/plans/waves/deferred/wave-encrypted-intake.md +0 -451
  155. package/docs/plans/waves/design/README.md +0 -5
  156. package/docs/plans/waves/design/wave-1-a1.md +0 -309
  157. package/docs/plans/waves/reviews/README.md +0 -5
  158. package/docs/plans/waves/reviews/wave-0-cont-qa.md +0 -151
  159. package/docs/plans/waves/reviews/wave-1-cont-qa.md +0 -46
  160. package/docs/plans/waves/reviews/wave-10-accessibility-and-design.md +0 -51
  161. package/docs/plans/waves/reviews/wave-10-cont-qa.md +0 -24
  162. package/docs/plans/waves/reviews/wave-10-dashboard-proof.md +0 -46
  163. package/docs/plans/waves/reviews/wave-10-performance-signoff.md +0 -55
  164. package/docs/plans/waves/reviews/wave-10-regression-proof.md +0 -23
  165. package/docs/plans/waves/reviews/wave-10-release-audit.md +0 -31
  166. package/docs/plans/waves/reviews/wave-10-service-proof.md +0 -83
  167. package/docs/plans/waves/reviews/wave-10-word-certification.md +0 -31
  168. package/docs/plans/waves/reviews/wave-18-ai-contract-closure.md +0 -277
  169. package/docs/plans/waves/reviews/wave-18-cont-qa.md +0 -255
  170. package/docs/plans/waves/reviews/wave-18-parity-proof.md +0 -271
  171. package/docs/plans/waves/reviews/wave-19-cont-qa.md +0 -59
  172. package/docs/plans/waves/reviews/wave-2-cont-qa.md +0 -72
  173. package/docs/plans/waves/reviews/wave-20-cont-qa.md +0 -60
  174. package/docs/plans/waves/reviews/wave-25-cont-qa.md +0 -48
  175. package/docs/plans/waves/reviews/wave-28-cont-qa.md +0 -46
  176. package/docs/plans/waves/reviews/wave-29-cont-qa.md +0 -53
  177. package/docs/plans/waves/reviews/wave-3-cont-qa.md +0 -53
  178. package/docs/plans/waves/reviews/wave-3-core-proof.md +0 -77
  179. package/docs/plans/waves/reviews/wave-3-validator-proof.md +0 -73
  180. package/docs/plans/waves/reviews/wave-32-cont-qa.md +0 -43
  181. package/docs/plans/waves/reviews/wave-33-cont-qa.md +0 -526
  182. package/docs/plans/waves/reviews/wave-34-cont-qa.md +0 -100
  183. package/docs/plans/waves/reviews/wave-35-cont-qa.md +0 -145
  184. package/docs/plans/waves/reviews/wave-4-cont-qa.md +0 -47
  185. package/docs/plans/waves/reviews/wave-4-structure-proof.md +0 -69
  186. package/docs/plans/waves/reviews/wave-5-comment-proof.md +0 -158
  187. package/docs/plans/waves/reviews/wave-5-cont-qa.md +0 -68
  188. package/docs/plans/waves/reviews/wave-6-cont-qa.md +0 -416
  189. package/docs/plans/waves/reviews/wave-6-redline-proof.md +0 -130
  190. package/docs/plans/waves/reviews/wave-7-cont-qa.md +0 -82
  191. package/docs/plans/waves/reviews/wave-7-ooxml-compliance.md +0 -85
  192. package/docs/plans/waves/reviews/wave-7-preservation-proof.md +0 -119
  193. package/docs/plans/waves/reviews/wave-7-trust-ux.md +0 -87
  194. package/docs/plans/waves/reviews/wave-8-accessibility-and-design.md +0 -128
  195. package/docs/plans/waves/reviews/wave-8-cont-qa.md +0 -92
  196. package/docs/plans/waves/reviews/wave-8-live-proof.md +0 -140
  197. package/docs/plans/waves/reviews/wave-8-security.md +0 -47
  198. package/docs/plans/waves/reviews/wave-9-editor-embedding.md +0 -39
  199. package/docs/plans/waves/reviews/wave-9-fixture-runner.md +0 -56
  200. package/docs/plans/waves/reviews/wave-9-live-proof.md +0 -105
  201. package/docs/plans/waves/reviews/wave-9-usability-and-performance.md +0 -152
  202. package/docs/plans/waves/specs/README.md +0 -5
  203. package/docs/plans/waves/specs/wave-1-component-boundaries.md +0 -322
  204. package/docs/plans/waves/specs/wave-1-ooxml-contracts.md +0 -323
  205. package/docs/plans/waves/specs/wave-1-review-and-ui-contracts.md +0 -339
  206. package/docs/plans/waves/specs/wave-1-runtime-contracts.md +0 -509
  207. package/docs/plans/waves/wave-19.md +0 -341
  208. package/docs/plans/waves/wave-20.md +0 -308
  209. package/docs/plans/waves/wave-21.md +0 -289
  210. package/docs/plans/waves/wave-22.md +0 -221
  211. package/docs/plans/waves/wave-23.md +0 -295
  212. package/docs/plans/waves/wave-24.md +0 -286
  213. package/docs/plans/waves/wave-25.md +0 -313
  214. package/docs/plans/waves/wave-26.md +0 -300
  215. package/docs/plans/waves/wave-27.md +0 -299
  216. package/docs/plans/waves/wave-28.md +0 -368
  217. package/docs/plans/waves/wave-29.md +0 -303
  218. package/docs/plans/waves/wave-30.md +0 -307
  219. package/docs/plans/waves/wave-31.md +0 -231
  220. package/docs/plans/waves/wave-32.md +0 -152
  221. package/docs/plans/waves/wave-33.md +0 -147
  222. package/docs/plans/waves/wave-34.md +0 -148
  223. package/docs/plans/waves/wave-35.md +0 -141
  224. package/docs/plans/waves/wave-36.md +0 -146
  225. package/docs/plans/xlsx/README.md +0 -14
  226. package/docs/plans/xlsx/xlsx-fixture-corpus-and-certification-plan.md +0 -126
  227. package/docs/reference/cli-reference.md +0 -600
  228. package/docs/reference/coordination-and-closure.md +0 -487
  229. package/docs/reference/deep-research-report (15).md +0 -25
  230. package/docs/reference/docx/README.md +0 -10
  231. package/docs/reference/legal-checklist.md +0 -445
  232. package/docs/reference/live-proof-waves.md +0 -199
  233. package/docs/reference/ooxml-compliance.md +0 -129
  234. package/docs/reference/ooxml-feature-parity-matrix.md +0 -172
  235. package/docs/reference/platform/shared-ooxml-platform-guidance.md +0 -77
  236. package/docs/reference/prototype-agent-prompt-legal-fidelity.md +0 -155
  237. package/docs/reference/public-api.md +0 -456
  238. package/docs/reference/repository-guidance.md +0 -58
  239. package/docs/reference/runtime-config/README.md +0 -182
  240. package/docs/reference/runtime-config/claude.md +0 -110
  241. package/docs/reference/runtime-config/codex.md +0 -82
  242. package/docs/reference/runtime-config/opencode.md +0 -93
  243. package/docs/reference/sample-waves.md +0 -105
  244. package/docs/reference/skills.md +0 -237
  245. package/docs/reference/templates/AGENTS.md +0 -78
  246. package/docs/reference/templates/HEARTBEAT.md +0 -7
  247. package/docs/reference/templates/IDENTITY.md +0 -23
  248. package/docs/reference/templates/SOUL.md +0 -36
  249. package/docs/reference/templates/TOOLS.md +0 -40
  250. package/docs/reference/templates/USER.md +0 -17
  251. package/docs/reference/wave-control.md +0 -184
  252. package/docs/reference/wave-planning-lessons.md +0 -167
  253. package/docs/reference/word-review-editor-frontend-architecture.md +0 -479
  254. package/docs/reference/word-review-editor-ux-guide.md +0 -253
  255. package/docs/reference/xlsx/xlsx-ooxml-compliance.md +0 -137
  256. package/docs/research/agent-context-sources.md +0 -178
  257. package/docs/research/coordination-failure-review.md +0 -290
  258. package/docs/research/docx-react-component/Canonical Document Schema Specification for a React-based Word-compatible Editor.md +0 -2317
  259. package/docs/research/docx-react-component/Feature Compatibility Matrix for a React Word Compatible Legal Editor v1.md +0 -219
  260. package/docs/research/docx-react-component/React Component Architecture and Front-End Structure Specification for a Word-Compatible Legal Review Editor.md +0 -1112
  261. package/docs/research/docx-react-component/document_compatibility_and_testing_spec.md +0 -751
  262. package/docs/research/xlsx/raw/README.md +0 -13
  263. package/docs/roadmap.md +0 -174
  264. package/docs/superpowers/plans/2026-03-28-harness-control-bar.md +0 -677
  265. package/docs/superpowers/specs/2026-03-28-harness-control-bar-design.md +0 -274
  266. package/docs/xlsx-react/README.md +0 -38
  267. package/docs/xlsx-react/agent-llm-interaction-layer-docx-xlsx.md +0 -621
  268. package/docs/xlsx-react/canonical-workbook-model-and-commands.md +0 -948
  269. package/docs/xlsx-react/shared-openxml-editor-platform-docx-xlsx.md +0 -228
  270. package/docs/xlsx-react/spreadsheet-editor-component-architecture.md +0 -809
  271. package/docs/xlsx-react/spreadsheet-editor-frontend-architecture.md +0 -537
  272. package/docs/xlsx-react/spreadsheet-editor-ux-guide.md +0 -520
  273. package/docs/xlsx-react/xlsx-editor-research-pack.md +0 -871
  274. package/docs/xlsx-react/xlsx-fixture-corpus-and-certification-plan.md +0 -436
  275. package/docs/xlsx-react/xlsx-ooxml-compliance.md +0 -320
  276. package/examples/README.md +0 -16
  277. package/memory/MEMORY.md +0 -24
  278. package/pnpm-workspace.yaml +0 -4
  279. package/scripts/check-no-authored-js.sh +0 -13
  280. package/scripts/context7-api-check.sh +0 -65
  281. package/scripts/context7-export-env.sh +0 -42
  282. package/scripts/run-context7-mcp.sh +0 -8
  283. package/scripts/run-workspace-tests.sh +0 -15
  284. package/scripts/start-wave-10-local.sh +0 -189
  285. package/scripts/wave-agent-attach.sh +0 -47
  286. package/scripts/wave-auto-answer.sh +0 -118
  287. package/scripts/wave-dashboard-attach.sh +0 -13
  288. package/scripts/wave-launch.sh +0 -273
  289. package/scripts/wave-overnight-supervisor.sh +0 -145
  290. package/scripts/wave-status.sh +0 -379
  291. package/scripts/wave-watch.sh +0 -231
  292. package/services/README.md +0 -17
  293. package/services/openxml-validator/Dockerfile +0 -29
  294. package/services/openxml-validator/OpenXmlValidator.Api.csproj +0 -12
  295. package/services/openxml-validator/Program.cs +0 -436
  296. package/services/openxml-validator/README.md +0 -152
  297. package/services/openxml-validator/railway.json +0 -16
  298. package/services/react-word-editor/.tmp-a4/src/api/public-types.ts +0 -318
  299. package/services/react-word-editor/.tmp-a4/src/ui/WordReviewEditor.tsx +0 -1302
  300. package/services/react-word-editor/.tmp-a4/src/ui/editor-surface/editor-surface.tsx +0 -546
  301. package/services/react-word-editor/.tmp-a4/test/ui/word-review-editor.test.tsx +0 -146
  302. package/services/react-word-editor/.tmp-a4-build/src/api/public-types.js +0 -2
  303. package/services/react-word-editor/.tmp-a4-build/src/ui/WordReviewEditor.js +0 -818
  304. package/services/react-word-editor/.tmp-a4-build/src/ui/editor-surface/editor-surface.js +0 -229
  305. package/services/react-word-editor/.tmp-a4-build/test/ui/word-review-editor.test.js +0 -121
  306. package/services/react-word-editor/.tmp-wave-4-a3-tsconfig.json +0 -21
  307. package/services/react-word-editor/.tmp-wave-4-a3-tsconfig.tsbuildinfo +0 -1
  308. package/services/react-word-editor/Dockerfile +0 -26
  309. package/services/react-word-editor/README.md +0 -254
  310. package/services/react-word-editor/app/api/certification/route.ts +0 -79
  311. package/services/react-word-editor/app/api/demo-sessions/route.ts +0 -109
  312. package/services/react-word-editor/app/api/deploy-health/route.ts +0 -23
  313. package/services/react-word-editor/app/api/exports/[exportId]/route.ts +0 -34
  314. package/services/react-word-editor/app/api/exports/route.ts +0 -81
  315. package/services/react-word-editor/app/api/fixtures/[fixtureId]/run/route.ts +0 -100
  316. package/services/react-word-editor/app/api/health/route.ts +0 -70
  317. package/services/react-word-editor/app/api/runs/[runId]/route.ts +0 -36
  318. package/services/react-word-editor/app/api/scenarios/[scenarioId]/run/route.ts +0 -85
  319. package/services/react-word-editor/app/api/sessions/[sessionId]/route.ts +0 -199
  320. package/services/react-word-editor/app/api/sessions/[sessionId]/source/route.ts +0 -45
  321. package/services/react-word-editor/app/api/uploads/route.ts +0 -70
  322. package/services/react-word-editor/app/api/validate/route.ts +0 -310
  323. package/services/react-word-editor/app/certification/[runId]/page.tsx +0 -14
  324. package/services/react-word-editor/app/certification/page.tsx +0 -32
  325. package/services/react-word-editor/app/dashboard/page.tsx +0 -7
  326. package/services/react-word-editor/app/demo/page.tsx +0 -30
  327. package/services/react-word-editor/app/demo/prototype-client.tsx +0 -1080
  328. package/services/react-word-editor/app/editor/[sessionId]/page.tsx +0 -33
  329. package/services/react-word-editor/app/fixtures/page.tsx +0 -7
  330. package/services/react-word-editor/app/globals.css +0 -121
  331. package/services/react-word-editor/app/layout.tsx +0 -32
  332. package/services/react-word-editor/app/page.tsx +0 -30
  333. package/services/react-word-editor/app/runs/[runId]/page.tsx +0 -34
  334. package/services/react-word-editor/app/wave-10-word-review/page.tsx +0 -7
  335. package/services/react-word-editor/components/harness-control-bar.tsx +0 -289
  336. package/services/react-word-editor/components/harness-editor-session-client.tsx +0 -1214
  337. package/services/react-word-editor/components/harness-workspace-page.tsx +0 -715
  338. package/services/react-word-editor/components/reduced-motion-toggle.tsx +0 -79
  339. package/services/react-word-editor/components/workspace-certification-panel.tsx +0 -307
  340. package/services/react-word-editor/lib/certification-bundle.ts +0 -796
  341. package/services/react-word-editor/lib/certification-store.ts +0 -661
  342. package/services/react-word-editor/lib/demo-fixtures.test.mjs +0 -195
  343. package/services/react-word-editor/lib/demo-fixtures.ts +0 -1519
  344. package/services/react-word-editor/lib/editor-session-summary.test.mjs +0 -68
  345. package/services/react-word-editor/lib/editor-session-summary.ts +0 -14
  346. package/services/react-word-editor/lib/editor-session.ts +0 -228
  347. package/services/react-word-editor/lib/exports-route.test.mjs +0 -32
  348. package/services/react-word-editor/lib/harness-client.ts +0 -347
  349. package/services/react-word-editor/lib/harness-config.json +0 -30
  350. package/services/react-word-editor/lib/harness-config.test.mjs +0 -31
  351. package/services/react-word-editor/lib/harness-config.ts +0 -21
  352. package/services/react-word-editor/lib/harness-editor-datastore.test.mjs +0 -220
  353. package/services/react-word-editor/lib/harness-editor-datastore.ts +0 -161
  354. package/services/react-word-editor/lib/private-mode.test.mjs +0 -42
  355. package/services/react-word-editor/lib/private-mode.ts +0 -61
  356. package/services/react-word-editor/lib/regression-report.test.mjs +0 -352
  357. package/services/react-word-editor/lib/regression-report.ts +0 -896
  358. package/services/react-word-editor/lib/run-artifacts.ts +0 -934
  359. package/services/react-word-editor/lib/run-history.ts +0 -755
  360. package/services/react-word-editor/lib/scenario-artifacts.test.mjs +0 -41
  361. package/services/react-word-editor/lib/scenario-artifacts.ts +0 -44
  362. package/services/react-word-editor/lib/storage.ts +0 -953
  363. package/services/react-word-editor/lib/validator-client.test.mjs +0 -54
  364. package/services/react-word-editor/lib/validator-client.ts +0 -95
  365. package/services/react-word-editor/lib/workspace-navigation.ts +0 -79
  366. package/services/react-word-editor/middleware.ts +0 -35
  367. package/services/react-word-editor/next-env.d.ts +0 -6
  368. package/services/react-word-editor/next.config.mjs +0 -15
  369. package/services/react-word-editor/package.json +0 -38
  370. package/services/react-word-editor/postcss.config.mjs +0 -8
  371. package/services/react-word-editor/railway.json +0 -21
  372. package/services/react-word-editor/scripts/wave-10-certification.mjs +0 -101
  373. package/services/react-word-editor/scripts/wave-9-live-usability-pilot.mjs +0 -911
  374. package/services/react-word-editor/tsconfig.json +0 -39
  375. package/services/react-word-editor/tsconfig.tsbuildinfo +0 -1
  376. package/skills/README.md +0 -48
  377. package/skills/domain-docx-compatibility/SKILL.md +0 -44
  378. package/skills/domain-docx-compatibility/skill.json +0 -19
  379. package/skills/domain-editor-architecture/SKILL.md +0 -49
  380. package/skills/domain-editor-architecture/skill.json +0 -19
  381. package/skills/domain-legal-review/SKILL.md +0 -39
  382. package/skills/domain-legal-review/skill.json +0 -19
  383. package/skills/provider-aws/SKILL.md +0 -117
  384. package/skills/provider-aws/adapters/claude.md +0 -1
  385. package/skills/provider-aws/adapters/codex.md +0 -1
  386. package/skills/provider-aws/references/service-verification.md +0 -39
  387. package/skills/provider-aws/skill.json +0 -54
  388. package/skills/provider-custom-deploy/SKILL.md +0 -64
  389. package/skills/provider-custom-deploy/skill.json +0 -50
  390. package/skills/provider-docker-compose/SKILL.md +0 -96
  391. package/skills/provider-docker-compose/adapters/local.md +0 -1
  392. package/skills/provider-docker-compose/skill.json +0 -53
  393. package/skills/provider-github-release/SKILL.md +0 -121
  394. package/skills/provider-github-release/adapters/claude.md +0 -1
  395. package/skills/provider-github-release/adapters/codex.md +0 -1
  396. package/skills/provider-github-release/skill.json +0 -55
  397. package/skills/provider-kubernetes/SKILL.md +0 -143
  398. package/skills/provider-kubernetes/adapters/claude.md +0 -1
  399. package/skills/provider-kubernetes/adapters/codex.md +0 -1
  400. package/skills/provider-kubernetes/references/kubectl-patterns.md +0 -58
  401. package/skills/provider-kubernetes/skill.json +0 -52
  402. package/skills/provider-railway/SKILL.md +0 -123
  403. package/skills/provider-railway/adapters/claude.md +0 -1
  404. package/skills/provider-railway/adapters/codex.md +0 -1
  405. package/skills/provider-railway/adapters/local.md +0 -1
  406. package/skills/provider-railway/adapters/opencode.md +0 -1
  407. package/skills/provider-railway/references/verification-commands.md +0 -39
  408. package/skills/provider-railway/skill.json +0 -71
  409. package/skills/provider-ssh-manual/SKILL.md +0 -97
  410. package/skills/provider-ssh-manual/skill.json +0 -54
  411. package/skills/repo-coding-rules/SKILL.md +0 -55
  412. package/skills/repo-coding-rules/skill.json +0 -34
  413. package/skills/role-cont-eval/SKILL.md +0 -91
  414. package/skills/role-cont-eval/adapters/codex.md +0 -1
  415. package/skills/role-cont-eval/skill.json +0 -36
  416. package/skills/role-cont-qa/SKILL.md +0 -100
  417. package/skills/role-cont-qa/adapters/claude.md +0 -1
  418. package/skills/role-cont-qa/skill.json +0 -36
  419. package/skills/role-deploy/SKILL.md +0 -97
  420. package/skills/role-deploy/skill.json +0 -36
  421. package/skills/role-design/SKILL.md +0 -50
  422. package/skills/role-design/skill.json +0 -36
  423. package/skills/role-documentation/SKILL.md +0 -76
  424. package/skills/role-documentation/skill.json +0 -36
  425. package/skills/role-implementation/SKILL.md +0 -45
  426. package/skills/role-implementation/skill.json +0 -36
  427. package/skills/role-infra/SKILL.md +0 -81
  428. package/skills/role-infra/skill.json +0 -36
  429. package/skills/role-integration/SKILL.md +0 -91
  430. package/skills/role-integration/skill.json +0 -36
  431. package/skills/role-planner/SKILL.md +0 -39
  432. package/skills/role-planner/skill.json +0 -21
  433. package/skills/role-research/SKILL.md +0 -65
  434. package/skills/role-research/skill.json +0 -36
  435. package/skills/role-security/SKILL.md +0 -60
  436. package/skills/role-security/skill.json +0 -36
  437. package/skills/runtime-claude/SKILL.md +0 -66
  438. package/skills/runtime-claude/skill.json +0 -36
  439. package/skills/runtime-codex/SKILL.md +0 -58
  440. package/skills/runtime-codex/skill.json +0 -36
  441. package/skills/runtime-local/SKILL.md +0 -46
  442. package/skills/runtime-local/skill.json +0 -36
  443. package/skills/runtime-opencode/SKILL.md +0 -58
  444. package/skills/runtime-opencode/skill.json +0 -36
  445. package/skills/signal-hygiene/SKILL.md +0 -51
  446. package/skills/signal-hygiene/skill.json +0 -20
  447. package/skills/tui-design/SKILL.md +0 -77
  448. package/skills/tui-design/references/tui-design.md +0 -259
  449. package/skills/tui-design/skill.json +0 -36
  450. package/skills/wave-core/SKILL.md +0 -141
  451. package/skills/wave-core/references/marker-syntax.md +0 -70
  452. package/skills/wave-core/skill.json +0 -35
  453. package/src/README.md +0 -85
  454. package/src/api/README.md +0 -22
  455. package/src/api/public-types.ts +0 -525
  456. package/src/component-inventory.md +0 -99
  457. package/src/core/README.md +0 -10
  458. package/src/core/commands/README.md +0 -3
  459. package/src/core/commands/formatting-commands.ts +0 -161
  460. package/src/core/commands/image-commands.ts +0 -144
  461. package/src/core/commands/index.ts +0 -1013
  462. package/src/core/commands/list-commands.ts +0 -370
  463. package/src/core/commands/review-commands.ts +0 -108
  464. package/src/core/commands/text-commands.ts +0 -119
  465. package/src/core/schema/README.md +0 -3
  466. package/src/core/schema/text-schema.ts +0 -512
  467. package/src/core/selection/README.md +0 -3
  468. package/src/core/selection/mapping.ts +0 -238
  469. package/src/core/selection/review-anchors.ts +0 -94
  470. package/src/core/state/README.md +0 -3
  471. package/src/core/state/editor-state.ts +0 -580
  472. package/src/core/state/text-transaction.ts +0 -276
  473. package/src/formats/xlsx/io/parse-shared-strings.ts +0 -41
  474. package/src/formats/xlsx/io/parse-sheet.ts +0 -289
  475. package/src/formats/xlsx/io/parse-styles.ts +0 -57
  476. package/src/formats/xlsx/io/parse-workbook.ts +0 -75
  477. package/src/formats/xlsx/io/xlsx-session.ts +0 -306
  478. package/src/formats/xlsx/model/cell.ts +0 -189
  479. package/src/formats/xlsx/model/sheet.ts +0 -244
  480. package/src/formats/xlsx/model/styles.ts +0 -118
  481. package/src/formats/xlsx/model/workbook.ts +0 -449
  482. package/src/io/README.md +0 -10
  483. package/src/io/docx-session.ts +0 -1763
  484. package/src/io/export/README.md +0 -3
  485. package/src/io/export/export-session.ts +0 -165
  486. package/src/io/export/minimal-docx.ts +0 -115
  487. package/src/io/export/reattach-preserved-parts.ts +0 -54
  488. package/src/io/export/serialize-comments.ts +0 -876
  489. package/src/io/export/serialize-footnotes.ts +0 -217
  490. package/src/io/export/serialize-headers-footers.ts +0 -200
  491. package/src/io/export/serialize-main-document.ts +0 -982
  492. package/src/io/export/serialize-numbering.ts +0 -97
  493. package/src/io/export/serialize-revisions.ts +0 -389
  494. package/src/io/export/serialize-runtime-revisions.ts +0 -265
  495. package/src/io/export/serialize-tables.ts +0 -147
  496. package/src/io/export/split-review-boundaries.ts +0 -194
  497. package/src/io/normalize/README.md +0 -3
  498. package/src/io/normalize/normalize-text.ts +0 -437
  499. package/src/io/ooxml/README.md +0 -3
  500. package/src/io/ooxml/parse-comments.ts +0 -779
  501. package/src/io/ooxml/parse-complex-content.ts +0 -287
  502. package/src/io/ooxml/parse-fields.ts +0 -438
  503. package/src/io/ooxml/parse-footnotes.ts +0 -403
  504. package/src/io/ooxml/parse-headers-footers.ts +0 -483
  505. package/src/io/ooxml/parse-inline-media.ts +0 -431
  506. package/src/io/ooxml/parse-main-document.ts +0 -1846
  507. package/src/io/ooxml/parse-numbering.ts +0 -425
  508. package/src/io/ooxml/parse-revisions.ts +0 -658
  509. package/src/io/ooxml/parse-shapes.ts +0 -271
  510. package/src/io/ooxml/parse-tables.ts +0 -568
  511. package/src/io/ooxml/parse-theme.ts +0 -314
  512. package/src/io/ooxml/part-manifest.ts +0 -136
  513. package/src/io/ooxml/revision-boundaries.ts +0 -351
  514. package/src/io/opc/README.md +0 -3
  515. package/src/io/opc/corrupt-package.ts +0 -166
  516. package/src/io/opc/docx-package.ts +0 -74
  517. package/src/io/opc/package-reader.ts +0 -320
  518. package/src/io/opc/package-writer.ts +0 -273
  519. package/src/model/README.md +0 -3
  520. package/src/model/canonical-document.ts +0 -1911
  521. package/src/model/cds-1.0.0.ts +0 -196
  522. package/src/model/snapshot.ts +0 -393
  523. package/src/preservation/README.md +0 -3
  524. package/src/preservation/markup-compatibility.ts +0 -48
  525. package/src/preservation/opaque-fragment-store.ts +0 -89
  526. package/src/preservation/opaque-region.ts +0 -233
  527. package/src/preservation/package-preservation.ts +0 -120
  528. package/src/preservation/preserved-part-manifest.ts +0 -56
  529. package/src/preservation/relationship-retention.ts +0 -57
  530. package/src/preservation/store.ts +0 -185
  531. package/src/review/README.md +0 -16
  532. package/src/review/store/README.md +0 -3
  533. package/src/review/store/comment-anchors.ts +0 -70
  534. package/src/review/store/comment-remapping.ts +0 -154
  535. package/src/review/store/comment-store.ts +0 -331
  536. package/src/review/store/comment-thread.ts +0 -109
  537. package/src/review/store/revision-actions.ts +0 -394
  538. package/src/review/store/revision-store.ts +0 -303
  539. package/src/review/store/revision-types.ts +0 -168
  540. package/src/review/store/runtime-comment-store.ts +0 -43
  541. package/src/runtime/README.md +0 -3
  542. package/src/runtime/ai-action-policy.ts +0 -764
  543. package/src/runtime/document-runtime.ts +0 -969
  544. package/src/runtime/read-only-diagnostics-runtime.ts +0 -232
  545. package/src/runtime/review-runtime.ts +0 -44
  546. package/src/runtime/revision-runtime.ts +0 -107
  547. package/src/runtime/session-capabilities.ts +0 -138
  548. package/src/runtime/surface-projection.ts +0 -570
  549. package/src/runtime/table-commands.ts +0 -84
  550. package/src/runtime/table-schema.ts +0 -125
  551. package/src/ui/README.md +0 -30
  552. package/src/ui/WordReviewEditor.tsx +0 -1283
  553. package/src/ui/comments/README.md +0 -3
  554. package/src/ui/compatibility/README.md +0 -3
  555. package/src/ui/editor-surface/README.md +0 -3
  556. package/src/ui/headless/comment-decoration-model.ts +0 -124
  557. package/src/ui/headless/revision-decoration-model.ts +0 -128
  558. package/src/ui/headless/selection-helpers.ts +0 -34
  559. package/src/ui/headless/use-editor-keyboard.ts +0 -98
  560. package/src/ui/review/README.md +0 -3
  561. package/src/ui/shared/revision-filters.ts +0 -31
  562. package/src/ui/status/README.md +0 -3
  563. package/src/ui/theme/README.md +0 -3
  564. package/src/ui/toolbar/README.md +0 -3
  565. package/src/ui-tailwind/chrome/tw-alert-banner.tsx +0 -48
  566. package/src/ui-tailwind/chrome/tw-selection-toolbar.tsx +0 -44
  567. package/src/ui-tailwind/chrome/tw-unsaved-modal.tsx +0 -58
  568. package/src/ui-tailwind/chrome/use-before-unload.ts +0 -20
  569. package/src/ui-tailwind/editor-surface/pm-command-bridge.ts +0 -139
  570. package/src/ui-tailwind/editor-surface/pm-decorations.ts +0 -98
  571. package/src/ui-tailwind/editor-surface/pm-position-map.ts +0 -123
  572. package/src/ui-tailwind/editor-surface/pm-schema.ts +0 -452
  573. package/src/ui-tailwind/editor-surface/pm-state-from-snapshot.ts +0 -327
  574. package/src/ui-tailwind/editor-surface/search-plugin.ts +0 -157
  575. package/src/ui-tailwind/editor-surface/tw-caret.tsx +0 -12
  576. package/src/ui-tailwind/editor-surface/tw-editor-surface.tsx +0 -150
  577. package/src/ui-tailwind/editor-surface/tw-inline-token.tsx +0 -118
  578. package/src/ui-tailwind/editor-surface/tw-opaque-block.tsx +0 -52
  579. package/src/ui-tailwind/editor-surface/tw-paragraph-block.tsx +0 -151
  580. package/src/ui-tailwind/editor-surface/tw-prosemirror-surface.tsx +0 -215
  581. package/src/ui-tailwind/editor-surface/tw-segment-view.tsx +0 -111
  582. package/src/ui-tailwind/editor-surface/tw-table-node-view.tsx +0 -108
  583. package/src/ui-tailwind/index.ts +0 -61
  584. package/src/ui-tailwind/review/tw-comment-sidebar.tsx +0 -276
  585. package/src/ui-tailwind/review/tw-health-panel.tsx +0 -120
  586. package/src/ui-tailwind/review/tw-review-rail.tsx +0 -120
  587. package/src/ui-tailwind/review/tw-revision-sidebar.tsx +0 -164
  588. package/src/ui-tailwind/status/tw-status-bar.tsx +0 -58
  589. package/src/ui-tailwind/theme/editor-theme.css +0 -190
  590. package/src/ui-tailwind/toolbar/tw-toolbar-icon-button.tsx +0 -48
  591. package/src/ui-tailwind/toolbar/tw-toolbar.tsx +0 -231
  592. package/src/ui-tailwind/tw-review-workspace.tsx +0 -140
  593. package/src/validation/README.md +0 -3
  594. package/src/validation/compatibility-engine.ts +0 -317
  595. package/src/validation/compatibility-report.ts +0 -160
  596. package/src/validation/diagnostics.ts +0 -203
  597. package/src/validation/import-diagnostics.ts +0 -128
  598. package/src/validation/low-priority-word-surfaces.ts +0 -373
  599. package/test/README.md +0 -16
  600. package/test/core/formatting-commands.test.ts +0 -285
  601. package/test/core/image-commands.test.ts +0 -298
  602. package/test/core/mapping.test.ts +0 -186
  603. package/test/core/text-commands.test.ts +0 -176
  604. package/test/fixtures/docx/F01-basic-contract.docx +0 -0
  605. package/test/fixtures/docx/F01-basic-contract.md +0 -33
  606. package/test/fixtures/docx/F02-headings-styles.docx +0 -0
  607. package/test/fixtures/docx/F02-headings-styles.md +0 -33
  608. package/test/fixtures/docx/F03-legal-outline-numbering.docx +0 -0
  609. package/test/fixtures/docx/F03-legal-outline-numbering.md +0 -34
  610. package/test/fixtures/docx/F04-restart-numbering-schedules.docx +0 -0
  611. package/test/fixtures/docx/F04-restart-numbering-schedules.md +0 -33
  612. package/test/fixtures/docx/F05-table-heavy-agreement.docx +0 -0
  613. package/test/fixtures/docx/F05-table-heavy-agreement.md +0 -34
  614. package/test/fixtures/docx/F06-merged-cells-signature-table.docx +0 -0
  615. package/test/fixtures/docx/F06-merged-cells-signature-table.md +0 -34
  616. package/test/fixtures/docx/F07-inline-images-exhibit.docx +0 -0
  617. package/test/fixtures/docx/F07-inline-images-exhibit.md +0 -34
  618. package/test/fixtures/docx/F08-hyperlinks.docx +0 -0
  619. package/test/fixtures/docx/F08-hyperlinks.md +0 -33
  620. package/test/fixtures/docx/F09-comments-single-paragraph.docx +0 -0
  621. package/test/fixtures/docx/F09-comments-single-paragraph.md +0 -33
  622. package/test/fixtures/docx/F10-threaded-comments-resolve.docx +0 -0
  623. package/test/fixtures/docx/F10-threaded-comments-resolve.md +0 -33
  624. package/test/fixtures/docx/F11-redlines-basic.docx +0 -0
  625. package/test/fixtures/docx/F11-redlines-basic.md +0 -33
  626. package/test/fixtures/docx/F12-redlines-paragraph-joins-splits.docx +0 -0
  627. package/test/fixtures/docx/F12-redlines-paragraph-joins-splits.md +0 -33
  628. package/test/fixtures/docx/F13-comments-on-deleted-text.docx +0 -0
  629. package/test/fixtures/docx/F13-comments-on-deleted-text.md +0 -33
  630. package/test/fixtures/docx/F14-revisions-in-tables-and-lists.docx +0 -0
  631. package/test/fixtures/docx/F14-revisions-in-tables-and-lists.md +0 -33
  632. package/test/fixtures/docx/F15-sections-headers-footers.docx +0 -0
  633. package/test/fixtures/docx/F15-sections-headers-footers.md +0 -33
  634. package/test/fixtures/docx/F16-footnotes-endnotes.docx +0 -0
  635. package/test/fixtures/docx/F16-footnotes-endnotes.md +0 -33
  636. package/test/fixtures/docx/F17-fields-and-toc.docx +0 -0
  637. package/test/fixtures/docx/F17-fields-and-toc.md +0 -33
  638. package/test/fixtures/docx/F18-content-controls-template.docx +0 -0
  639. package/test/fixtures/docx/F18-content-controls-template.md +0 -33
  640. package/test/fixtures/docx/F19-custom-xml-doc-assembly.docx +0 -0
  641. package/test/fixtures/docx/F19-custom-xml-doc-assembly.md +0 -35
  642. package/test/fixtures/docx/F20-unknown-ooxml-and-alternatecontent.docx +0 -0
  643. package/test/fixtures/docx/F20-unknown-ooxml-and-alternatecontent.md +0 -33
  644. package/test/fixtures/docx/F21-malformed-broken-docx.docx +0 -0
  645. package/test/fixtures/docx/F21-malformed-broken-docx.md +0 -33
  646. package/test/fixtures/docx/README.md +0 -74
  647. package/test/fixtures/docx/certification-manifest.json +0 -104
  648. package/test/fixtures/docx/fixtures.manifest.json +0 -196
  649. package/test/fixtures/encrypted-docx/README.md +0 -27
  650. package/test/fixtures/encrypted-docx/certification-manifest.json +0 -9
  651. package/test/fixtures/encrypted-docx/fixtures.manifest.json +0 -47
  652. package/test/fixtures/scenarios/docx/README.md +0 -25
  653. package/test/fixtures/scenarios/docx/S01-sow-template.docx +0 -0
  654. package/test/fixtures/scenarios/docx/S01-sow-template.md +0 -30
  655. package/test/fixtures/scenarios/docx/S02-bw-partner-user-licence-agreement-redlines.docx +0 -0
  656. package/test/fixtures/scenarios/docx/S02-bw-partner-user-licence-agreement-redlines.md +0 -32
  657. package/test/fixtures/scenarios/docx/scenario-manifest.json +0 -53
  658. package/test/formats/xlsx/io/xlsx-import.test.ts +0 -766
  659. package/test/formats/xlsx/model/workbook.test.ts +0 -669
  660. package/test/helpers/dom-setup.ts +0 -124
  661. package/test/io/comment-roundtrip.test.ts +0 -272
  662. package/test/io/complex-content-roundtrip.test.ts +0 -632
  663. package/test/io/docx-compatibility-regression.test.ts +0 -199
  664. package/test/io/docx-session.test.ts +0 -1495
  665. package/test/io/footnotes-roundtrip.test.ts +0 -318
  666. package/test/io/headers-footers-roundtrip.test.ts +0 -547
  667. package/test/io/numbering-roundtrip.test.ts +0 -234
  668. package/test/io/package-reader.test.ts +0 -199
  669. package/test/io/paragraph-properties-roundtrip.test.ts +0 -129
  670. package/test/io/preserved-package-roundtrip.test.ts +0 -365
  671. package/test/io/property-completeness.test.ts +0 -292
  672. package/test/io/revision-roundtrip.test.ts +0 -347
  673. package/test/io/structural-blocks.test.ts +0 -202
  674. package/test/io/table-media-roundtrip.test.ts +0 -448
  675. package/test/io/table-properties-roundtrip.test.ts +0 -569
  676. package/test/io/table-roundtrip.test.ts +0 -302
  677. package/test/io/text-roundtrip.test.ts +0 -344
  678. package/test/model/canonical-document.test.ts +0 -285
  679. package/test/preservation/opaque-fragment-store.test.ts +0 -121
  680. package/test/preservation/package-preservation.test.ts +0 -395
  681. package/test/preservation/store.test.ts +0 -84
  682. package/test/review/comment-remapping.test.ts +0 -220
  683. package/test/review/comment-store.test.ts +0 -180
  684. package/test/review/move-revisions.test.ts +0 -143
  685. package/test/review/property-change-revisions.test.ts +0 -225
  686. package/test/review/revision-actions.test.ts +0 -330
  687. package/test/review/revision-store.test.ts +0 -193
  688. package/test/runtime/session-capabilities.test.ts +0 -260
  689. package/test/runtime/table-commands.test.ts +0 -356
  690. package/test/runtime/table-schema.test.ts +0 -221
  691. package/test/runtime/tracked-changes-toggle.test.ts +0 -107
  692. package/test/ui/comment-review-surface.test.tsx +0 -114
  693. package/test/ui/reduced-motion-toggle.test.tsx +0 -137
  694. package/test/ui/word-review-editor.imported-scenarios.test.tsx +0 -169
  695. package/test/ui/word-review-editor.interaction.test.tsx +0 -1198
  696. package/test/ui/word-review-editor.test.js +0 -188
  697. package/test/ui/word-review-editor.test.tsx +0 -280
  698. package/test/ui-tailwind/search-plugin.test.ts +0 -286
  699. package/test/validation/compatibility-engine.test.ts +0 -336
  700. package/test/validation/compatibility-report.test.ts +0 -189
  701. package/test/validation/low-priority-word-surfaces.test.ts +0 -282
  702. package/test/validation/malformed-doc.test.ts +0 -113
  703. package/test-results/.last-run.json +0 -4
  704. package/wave.config.json +0 -406
@@ -1,1495 +0,0 @@
1
- import assert from "node:assert/strict";
2
- import { readFileSync } from "node:fs";
3
- import test from "node:test";
4
-
5
- import type { PersistedEditorSnapshot } from "../../src/api/public-types.ts";
6
- import { parseTextStory } from "../../src/core/schema/text-schema.ts";
7
- import { loadDocxEditorSession } from "../../src/io/docx-session.ts";
8
- import { normalizeParsedTextDocument } from "../../src/io/normalize/normalize-text.ts";
9
- import { parseMainDocumentXml } from "../../src/io/ooxml/parse-main-document.ts";
10
- import { writeDocxPackage } from "../../src/io/opc/docx-package.ts";
11
- import type { OpcPackage } from "../../src/io/opc/package-reader.ts";
12
- import { readOpcPackage } from "../../src/io/opc/package-reader.ts";
13
- import { writeOpcPackage } from "../../src/io/opc/package-writer.ts";
14
- import { assertPersistedEditorSnapshot } from "../../src/model/snapshot.ts";
15
- import { createDocumentRuntime } from "../../src/runtime/document-runtime.ts";
16
-
17
- test("package-backed DOCX sessions import existing comments and revisions into runtime-owned state", () => {
18
- const commentSession = loadDocxEditorSession({
19
- documentId: "docx-comments",
20
- sourceLabel: "commented.docx",
21
- bytes: createCommentedDocxPackage(),
22
- editorBuild: "test",
23
- });
24
- const revisionSession = loadDocxEditorSession({
25
- documentId: "docx-revisions",
26
- sourceLabel: "F11-redlines-basic.docx",
27
- bytes: new Uint8Array(readFileSync("test/fixtures/docx/F11-redlines-basic.docx")),
28
- editorBuild: "test",
29
- });
30
-
31
- assert.equal(commentSession.readOnly, false);
32
- assert.equal(revisionSession.readOnly, false);
33
- assert.equal(commentSession.fatalError, undefined);
34
- assert.equal(revisionSession.fatalError, undefined);
35
- assert.ok(
36
- Object.keys(
37
- (commentSession.initialSnapshot as PersistedEditorSnapshot).canonicalDocument.review.comments,
38
- ).length > 0,
39
- );
40
- assert.ok(
41
- Object.keys(
42
- (revisionSession.initialSnapshot as PersistedEditorSnapshot).canonicalDocument.review.revisions,
43
- ).length > 0,
44
- );
45
- });
46
-
47
- test("package-backed DOCX sessions produce persisted snapshots that satisfy the strict model contract", () => {
48
- const session = loadDocxEditorSession({
49
- documentId: "docx-f01-strict-snapshot",
50
- sourceLabel: "F01-basic-contract.docx",
51
- bytes: new Uint8Array(readFileSync("test/fixtures/docx/F01-basic-contract.docx")),
52
- editorBuild: "test",
53
- });
54
-
55
- assert.equal(session.readOnly, false);
56
- assert.doesNotThrow(() => {
57
- assertPersistedEditorSnapshot(session.initialSnapshot);
58
- });
59
- });
60
-
61
- test("diagnostics-mode sessions produce persisted snapshots that satisfy the strict model contract", () => {
62
- const session = loadDocxEditorSession({
63
- documentId: "docx-broken-strict-snapshot",
64
- sourceLabel: "broken.docx",
65
- bytes: new Uint8Array([0x00, 0x01, 0x02, 0x03]),
66
- editorBuild: "test",
67
- });
68
-
69
- assert.equal(session.readOnly, true);
70
- assert.doesNotThrow(() => {
71
- assertPersistedEditorSnapshot(session.initialSnapshot);
72
- });
73
- });
74
-
75
- test("threaded comment fixtures import replies and resolution metadata into one runtime thread", async () => {
76
- const session = loadDocxEditorSession({
77
- documentId: "docx-f10-threaded-comments",
78
- sourceLabel: "F10-threaded-comments-resolve.docx",
79
- bytes: new Uint8Array(readFileSync("test/fixtures/docx/F10-threaded-comments-resolve.docx")),
80
- editorBuild: "test",
81
- });
82
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
83
- const importedComments = Object.values(snapshot.canonicalDocument.review.comments);
84
- const rootThread = importedComments[0];
85
-
86
- assert.equal(session.readOnly, false);
87
- assert.equal(session.fatalError, undefined);
88
- assert.equal(importedComments.length, 1);
89
- assert.equal(rootThread?.status, "resolved");
90
- assert.equal(rootThread?.entries?.length, 2);
91
- assert.equal(rootThread?.entries?.[0]?.body, "Root comment requesting review.");
92
- assert.equal(rootThread?.entries?.[1]?.body, "Reply confirming the change is resolved.");
93
- assert.equal(rootThread?.resolution?.resolvedBy, "Reviewer B");
94
- assert.equal(rootThread?.metadata?.rootOoxmlCommentId, "0");
95
- assert.equal(rootThread?.entries?.[1]?.metadata?.ooxmlCommentId, "1");
96
-
97
- const runtime = createDocumentRuntime({
98
- documentId: "runtime-f10-threaded-comments",
99
- initialSnapshot: session.initialSnapshot,
100
- sourceKind: "docx",
101
- sourceLabel: "F10-threaded-comments-resolve.docx",
102
- editorBuild: session.initialSnapshot.editorBuild,
103
- exportDocx: session.exportDocx,
104
- });
105
- const runtimeThread = runtime.getRenderSnapshot().comments.threads[0];
106
- assert.equal(runtimeThread?.entryCount, 2);
107
- assert.equal(runtimeThread?.entries.length, 2);
108
- assert.equal(
109
- runtimeThread?.entries[1]?.body,
110
- "Reply confirming the change is resolved.",
111
- );
112
-
113
- if (rootThread?.entries?.[0]) {
114
- rootThread.entries[0].body = "Root comment edited after import.";
115
- }
116
- if (rootThread) {
117
- rootThread.body = rootThread.entries?.map((entry) => entry.body).join("\n");
118
- }
119
- snapshot.updatedAt = "2026-03-27T00:00:00.000Z";
120
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
121
-
122
- const result = await session.exportDocx(snapshot, {
123
- fileName: "f10-threaded-export.docx",
124
- });
125
- const exportedPackage = readOpcPackage(result.bytes);
126
- const exportedCommentsXml = Buffer.from(
127
- exportedPackage.parts.get("/word/comments.xml")?.bytes ?? new Uint8Array(),
128
- ).toString("utf8");
129
- const exportedCommentsExtendedXml = Buffer.from(
130
- exportedPackage.parts.get("/word/commentsExtended.xml")?.bytes ?? new Uint8Array(),
131
- ).toString("utf8");
132
- const exportedCommentsIdsXml = Buffer.from(
133
- exportedPackage.parts.get("/word/commentsIds.xml")?.bytes ?? new Uint8Array(),
134
- ).toString("utf8");
135
- const exportedPeopleXml = Buffer.from(
136
- exportedPackage.parts.get("/word/people.xml")?.bytes ?? new Uint8Array(),
137
- ).toString("utf8");
138
-
139
- assert.match(exportedCommentsXml, /Root comment edited after import/);
140
- assert.match(exportedCommentsExtendedXml, /w15:done="true"/);
141
- assert.match(exportedCommentsExtendedXml, /w15:paraIdParent=/);
142
- assert.match(exportedCommentsIdsXml, /durableId=/);
143
- assert.match(exportedPeopleXml, /Reviewer A/);
144
- assert.match(exportedPeopleXml, /Reviewer B/);
145
-
146
- const reloaded = loadDocxEditorSession({
147
- documentId: "docx-f10-threaded-comments-reloaded",
148
- sourceLabel: "f10-threaded-export.docx",
149
- bytes: result.bytes,
150
- editorBuild: "test",
151
- });
152
- const reloadedThread = Object.values(
153
- (reloaded.initialSnapshot as PersistedEditorSnapshot).canonicalDocument.review.comments,
154
- )[0];
155
-
156
- assert.equal(reloaded.readOnly, false);
157
- assert.equal(reloaded.fatalError, undefined);
158
- assert.equal(reloadedThread?.entries?.length, 2);
159
- assert.equal(reloadedThread?.status, "resolved");
160
- assert.equal(reloadedThread?.entries?.[0]?.body, "Root comment edited after import.");
161
- assert.equal(reloadedThread?.entries?.[1]?.metadata?.parentParaId, reloadedThread?.entries?.[0]?.metadata?.paraId);
162
- });
163
-
164
- test("comment fixture runtime exports keep the Open XML comments extension content types", async () => {
165
- for (const fixtureName of [
166
- "F09-comments-single-paragraph.docx",
167
- "F13-comments-on-deleted-text.docx",
168
- ]) {
169
- const session = loadDocxEditorSession({
170
- documentId: `docx-${fixtureName}`,
171
- sourceLabel: fixtureName,
172
- bytes: new Uint8Array(readFileSync(`test/fixtures/docx/${fixtureName}`)),
173
- editorBuild: "test",
174
- });
175
- const runtime = createDocumentRuntime({
176
- documentId: `runtime-${fixtureName}`,
177
- initialSnapshot: session.initialSnapshot,
178
- sourceKind: "docx",
179
- sourceLabel: fixtureName,
180
- editorBuild: session.initialSnapshot.editorBuild,
181
- exportDocx: session.exportDocx,
182
- defaultAuthorId: "test-operator",
183
- });
184
-
185
- const result = await runtime.exportDocx({
186
- fileName: `exported-${fixtureName}`,
187
- });
188
- const exportedPackage = readOpcPackage(result.bytes);
189
- const commentsExtendedPart = exportedPackage.parts.get("/word/commentsExtended.xml");
190
- const commentsIdsPart = exportedPackage.parts.get("/word/commentsIds.xml");
191
- const peoplePart = exportedPackage.parts.get("/word/people.xml");
192
- const commentsXml = Buffer.from(
193
- exportedPackage.parts.get("/word/comments.xml")?.bytes ?? new Uint8Array(),
194
- ).toString("utf8");
195
-
196
- assert.ok(commentsExtendedPart, `${fixtureName} should export commentsExtended.xml`);
197
- assert.ok(commentsIdsPart, `${fixtureName} should export commentsIds.xml`);
198
- assert.ok(peoplePart, `${fixtureName} should export people.xml`);
199
- assert.match(commentsXml, /<w:comments\b[^>]*xmlns:w14=/);
200
- assert.equal(
201
- commentsExtendedPart?.contentType,
202
- "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",
203
- );
204
- assert.equal(
205
- commentsIdsPart?.contentType,
206
- "application/vnd.openxmlformats-officedocument.wordprocessingml.commentsIds+xml",
207
- );
208
- assert.equal(
209
- peoplePart?.contentType,
210
- "application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml",
211
- );
212
- }
213
- });
214
-
215
- test("package-backed export preserves imported comments that remain inside opaque OOXML", async () => {
216
- const session = loadDocxEditorSession({
217
- documentId: "docx-opaque-comment",
218
- sourceLabel: "opaque-comment.docx",
219
- bytes: createOpaqueCommentedDocxPackage(),
220
- editorBuild: "test",
221
- });
222
- const importedComments = Object.values(
223
- (session.initialSnapshot as PersistedEditorSnapshot).canonicalDocument.review.comments,
224
- );
225
-
226
- assert.equal(session.readOnly, false);
227
- assert.equal(importedComments.length, 1);
228
- assert.equal(importedComments[0]?.anchor.kind, "detached");
229
-
230
- const result = await session.exportDocx(session.initialSnapshot, {
231
- fileName: "opaque-comment-export.docx",
232
- });
233
- const exportedPackage = readOpcPackage(result.bytes);
234
- const documentXml = Buffer.from(
235
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
236
- ).toString("utf8");
237
- const commentsXml = Buffer.from(
238
- exportedPackage.parts.get("/word/comments.xml")?.bytes ?? new Uint8Array(),
239
- ).toString("utf8");
240
-
241
- assert.match(documentXml, /<w:commentRangeStart w:id="17"\/>/);
242
- assert.match(documentXml, /<w:commentRangeEnd w:id="17"\/>/);
243
- assert.match(documentXml, /<w:commentReference w:id="17"\/>/);
244
- assert.match(commentsXml, /<w:comment w:id="17"/);
245
- assert.match(commentsXml, /<w:bookmarkStart w:id="1" w:name="opaque-comment-bookmark"\/>/);
246
- assert.match(commentsXml, /<w:bookmarkEnd w:id="1"\/>/);
247
- });
248
-
249
- test("package-backed export strips styled comment reference runs before reserializing owned comments", async () => {
250
- const session = loadDocxEditorSession({
251
- documentId: "docx-styled-comment-reference",
252
- sourceLabel: "styled-comment-reference.docx",
253
- bytes: createStyledCommentReferenceDocxPackage(),
254
- editorBuild: "test",
255
- });
256
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
257
- const comment = snapshot.canonicalDocument.review.comments["23"];
258
-
259
- assert.equal(session.readOnly, false);
260
- assert.ok(comment);
261
- if (comment?.entries?.[0]) {
262
- comment.entries[0].body = "Styled reference comment edited after import.";
263
- }
264
- if (comment) {
265
- comment.body = comment.entries?.map((entry) => entry.body).join("\n");
266
- }
267
- snapshot.updatedAt = "2026-03-28T00:10:00.000Z";
268
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
269
-
270
- const result = await session.exportDocx(snapshot, {
271
- fileName: "styled-comment-reference-export.docx",
272
- });
273
- const exportedPackage = readOpcPackage(result.bytes);
274
- const documentXml = Buffer.from(
275
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
276
- ).toString("utf8");
277
-
278
- assert.equal((documentXml.match(/<w:commentRangeStart\b/g) ?? []).length, 1);
279
- assert.equal((documentXml.match(/<w:commentRangeEnd\b/g) ?? []).length, 1);
280
- assert.equal((documentXml.match(/<w:commentReference\b/g) ?? []).length, 1);
281
- });
282
-
283
- test("package-backed DOCX sessions export edited body content instead of echoing the source bytes", async () => {
284
- const sourceBytes = new Uint8Array(readFileSync("test/fixtures/docx/F01-basic-contract.docx"));
285
- const session = loadDocxEditorSession({
286
- documentId: "docx-edit-export",
287
- sourceLabel: "F01-basic-contract.docx",
288
- bytes: sourceBytes,
289
- editorBuild: "test",
290
- });
291
- const nextSnapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
292
- const firstParagraph = (nextSnapshot.canonicalDocument.content as {
293
- children: Array<{ children: Array<{ text?: string }> }>;
294
- }).children[0];
295
- const firstText = firstParagraph?.children[0];
296
- assert.ok(firstText);
297
- firstText.text = `${firstText.text ?? ""} Edited`;
298
- nextSnapshot.updatedAt = "2026-03-26T23:59:00.000Z";
299
- nextSnapshot.canonicalDocument.updatedAt = nextSnapshot.updatedAt;
300
-
301
- const result = await session.exportDocx(nextSnapshot, {
302
- fileName: "edited.docx",
303
- });
304
- const exportedPackage = readOpcPackage(result.bytes);
305
- const documentXml = Buffer.from(
306
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
307
- ).toString("utf8");
308
-
309
- assert.notDeepEqual(Buffer.from(result.bytes), Buffer.from(sourceBytes));
310
- assert.match(documentXml, /Edited/);
311
- });
312
-
313
- test("F03 numbering imports numbering.xml into runtime state and preserves list bindings on export", async () => {
314
- const sourceBytes = new Uint8Array(readFileSync("test/fixtures/docx/F03-legal-outline-numbering.docx"));
315
- const session = loadDocxEditorSession({
316
- documentId: "docx-f03-numbering",
317
- sourceLabel: "F03-legal-outline-numbering.docx",
318
- bytes: sourceBytes,
319
- editorBuild: "test",
320
- });
321
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
322
- const content = snapshot.canonicalDocument.content as {
323
- type: "doc";
324
- children: Array<{
325
- type: string;
326
- numbering?: { numberingInstanceId: string; level: number };
327
- }>;
328
- };
329
- const numbering = snapshot.canonicalDocument.numbering as {
330
- abstractDefinitions: Record<string, unknown>;
331
- instances: Record<string, unknown>;
332
- };
333
-
334
- assert.equal(session.readOnly, false);
335
- assert.ok(
336
- content.children.filter((block) => block.type === "paragraph" && block.numbering).length >= 6,
337
- );
338
- assert.ok(numbering.instances["num:1"]);
339
- assert.ok(numbering.instances["num:2"]);
340
-
341
- appendSuffixToFirstTextNode(snapshot, " Edited");
342
- snapshot.updatedAt = "2026-03-27T01:00:00.000Z";
343
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
344
-
345
- const result = await session.exportDocx(snapshot, {
346
- fileName: "f03-numbering-export.docx",
347
- });
348
- const exportedPackage = readOpcPackage(result.bytes);
349
- const documentXml = Buffer.from(
350
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
351
- ).toString("utf8");
352
- const numberingXml = Buffer.from(
353
- exportedPackage.parts.get("/word/numbering.xml")?.bytes ?? new Uint8Array(),
354
- ).toString("utf8");
355
-
356
- assert.match(documentXml, /Legal outline numbering proof Edited/);
357
- assert.match(documentXml, /<w:numPr><w:ilvl w:val="0"\/><w:numId w:val="1"\/><\/w:numPr>/);
358
- assert.match(numberingXml, /<w:abstractNum w:abstractNumId="1">/);
359
- assert.match(numberingXml, /<w:num w:numId="2">/);
360
-
361
- const reloaded = loadDocxEditorSession({
362
- documentId: "docx-f03-numbering-reloaded",
363
- sourceLabel: "f03-numbering-export.docx",
364
- bytes: result.bytes,
365
- editorBuild: "test",
366
- });
367
- const reloadedContent = reloaded.initialSnapshot.canonicalDocument.content as {
368
- type: "doc";
369
- children: Array<{
370
- type: string;
371
- numbering?: { numberingInstanceId: string; level: number };
372
- }>;
373
- };
374
- const reloadedNumbering = reloaded.initialSnapshot.canonicalDocument.numbering as {
375
- instances: Record<string, unknown>;
376
- };
377
-
378
- assert.equal(reloaded.readOnly, false);
379
- assert.ok(
380
- reloadedContent.children.filter((block) => block.type === "paragraph" && block.numbering)
381
- .length >= 6,
382
- );
383
- assert.ok(reloadedNumbering.instances["num:1"]);
384
- assert.ok(reloadedNumbering.instances["num:2"]);
385
- });
386
-
387
- test("F04 restart numbering fixture preserves numbering restart overrides on export", async () => {
388
- const sourceBytes = new Uint8Array(
389
- readFileSync("test/fixtures/docx/F04-restart-numbering-schedules.docx"),
390
- );
391
- const session = loadDocxEditorSession({
392
- documentId: "docx-f04-numbering-restart",
393
- sourceLabel: "F04-restart-numbering-schedules.docx",
394
- bytes: sourceBytes,
395
- editorBuild: "test",
396
- });
397
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
398
- const content = snapshot.canonicalDocument.content as {
399
- type: "doc";
400
- children: Array<{
401
- type: string;
402
- numbering?: { numberingInstanceId: string; level: number };
403
- }>;
404
- };
405
- const numbering = snapshot.canonicalDocument.numbering as {
406
- abstractDefinitions: Record<string, unknown>;
407
- instances: Record<
408
- string,
409
- {
410
- overrides?: Array<{ level: number; startAt?: number }>;
411
- }
412
- >;
413
- };
414
-
415
- assert.equal(session.readOnly, false);
416
- assert.equal(
417
- content.children.filter((block) => block.type === "paragraph" && block.numbering).length,
418
- 4,
419
- );
420
- assert.ok(numbering.instances["num:1"]);
421
- assert.deepEqual(numbering.instances["num:2"]?.overrides, [{ level: 0, startAt: 1 }]);
422
-
423
- appendSuffixToFirstTextNode(snapshot, " Edited");
424
- snapshot.updatedAt = "2026-03-27T03:00:00.000Z";
425
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
426
-
427
- const result = await session.exportDocx(snapshot, {
428
- fileName: "f04-numbering-restart-export.docx",
429
- });
430
- const exportedPackage = readOpcPackage(result.bytes);
431
- const documentXml = Buffer.from(
432
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
433
- ).toString("utf8");
434
- const numberingXml = Buffer.from(
435
- exportedPackage.parts.get("/word/numbering.xml")?.bytes ?? new Uint8Array(),
436
- ).toString("utf8");
437
-
438
- assert.match(documentXml, /Restart numbering proof Edited/);
439
- assert.match(numberingXml, /<w:startOverride w:val="1"\/>/);
440
- assert.match(numberingXml, /<w:num w:numId="2">/);
441
-
442
- const reloaded = loadDocxEditorSession({
443
- documentId: "docx-f04-numbering-restart-reloaded",
444
- sourceLabel: "f04-numbering-restart-export.docx",
445
- bytes: result.bytes,
446
- editorBuild: "test",
447
- });
448
- const reloadedNumbering = reloaded.initialSnapshot.canonicalDocument.numbering as {
449
- instances: Record<string, { overrides?: Array<{ level: number; startAt?: number }> }>;
450
- };
451
-
452
- assert.equal(reloaded.readOnly, false);
453
- assert.deepEqual(reloadedNumbering.instances["num:2"]?.overrides, [{ level: 0, startAt: 1 }]);
454
- });
455
-
456
- test("F05 and F06 remain preserve-only table fixtures on the live package-backed session path", async () => {
457
- const fixtures = [
458
- {
459
- fixturePath: "test/fixtures/docx/F05-table-heavy-agreement.docx",
460
- documentId: "docx-f05-preserve-only-table",
461
- expectedPatterns: [/<w:tbl>/, /<w:tblGrid>/],
462
- },
463
- {
464
- fixturePath: "test/fixtures/docx/F06-merged-cells-signature-table.docx",
465
- documentId: "docx-f06-preserve-only-table",
466
- expectedPatterns: [/<w:gridSpan\b/, /<w:vMerge\b/],
467
- },
468
- ] as const;
469
-
470
- for (const fixture of fixtures) {
471
- const sourceBytes = new Uint8Array(readFileSync(fixture.fixturePath));
472
- const session = loadDocxEditorSession({
473
- documentId: fixture.documentId,
474
- sourceLabel: fixture.fixturePath.split("/").at(-1),
475
- bytes: sourceBytes,
476
- editorBuild: "test",
477
- });
478
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
479
- const root = snapshot.canonicalDocument.content as {
480
- type: "doc";
481
- children: Array<{ type: string; fragmentId?: string }>;
482
- };
483
- const opaqueTableBlocks = root.children.filter(
484
- (block) => block.type === "opaque_block",
485
- );
486
-
487
- assert.equal(session.readOnly, false);
488
- assert.ok(opaqueTableBlocks.length >= 1);
489
-
490
- appendSuffixToFirstTextNode(snapshot, " Edited");
491
- snapshot.updatedAt = "2026-03-27T02:00:00.000Z";
492
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
493
-
494
- const result = await session.exportDocx(snapshot, {
495
- fileName: `${fixture.documentId}-edited.docx`,
496
- });
497
- const exportedPackage = readOpcPackage(result.bytes);
498
- const documentXml = Buffer.from(
499
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
500
- ).toString("utf8");
501
-
502
- assert.match(documentXml, /Edited/);
503
- for (const pattern of fixture.expectedPatterns) {
504
- assert.match(documentXml, pattern);
505
- }
506
-
507
- const reloaded = loadDocxEditorSession({
508
- documentId: `${fixture.documentId}-reloaded`,
509
- sourceLabel: `${fixture.documentId}-edited.docx`,
510
- bytes: result.bytes,
511
- editorBuild: "test",
512
- });
513
- const reloadedRoot = reloaded.initialSnapshot.canonicalDocument.content as {
514
- type: "doc";
515
- children: Array<{ type: string }>;
516
- };
517
-
518
- assert.equal(reloaded.readOnly, false);
519
- assert.ok(
520
- reloadedRoot.children.some((block) => block.type === "opaque_block"),
521
- );
522
- }
523
- });
524
-
525
- test("F07 inline images survive package-backed edits and reload with their media relationship intact", async () => {
526
- const sourceBytes = new Uint8Array(readFileSync("test/fixtures/docx/F07-inline-images-exhibit.docx"));
527
- const session = loadDocxEditorSession({
528
- documentId: "docx-f07-inline-images",
529
- sourceLabel: "F07-inline-images-exhibit.docx",
530
- bytes: sourceBytes,
531
- editorBuild: "test",
532
- });
533
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
534
- const imageNode = findFirstImageNode(snapshot);
535
- const media = snapshot.canonicalDocument.media as {
536
- items: Record<string, { relationshipId?: string; packagePartName?: string }>;
537
- };
538
-
539
- assert.equal(session.readOnly, false);
540
- assert.ok(imageNode);
541
- assert.equal(imageNode?.mediaId, "media:word/media/image1.png");
542
- assert.equal(media.items[imageNode!.mediaId]?.relationshipId, "rIdImage1");
543
- assert.equal(media.items[imageNode!.mediaId]?.packagePartName, "/word/media/image1.png");
544
-
545
- appendSuffixToFirstTextNode(snapshot, " Edited");
546
- snapshot.updatedAt = "2026-03-27T01:10:00.000Z";
547
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
548
-
549
- const result = await session.exportDocx(snapshot, {
550
- fileName: "f07-inline-images-export.docx",
551
- });
552
- const exportedPackage = readOpcPackage(result.bytes);
553
- const documentXml = Buffer.from(
554
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
555
- ).toString("utf8");
556
-
557
- assert.match(documentXml, /Execution exhibit image Edited/);
558
- assert.match(documentXml, /<w:drawing>/);
559
- assert.match(documentXml, /r:embed="rIdImage1"/);
560
- assert.ok(exportedPackage.parts.get("/word/media/image1.png"));
561
-
562
- const reloaded = loadDocxEditorSession({
563
- documentId: "docx-f07-inline-images-reloaded",
564
- sourceLabel: "f07-inline-images-export.docx",
565
- bytes: result.bytes,
566
- editorBuild: "test",
567
- });
568
- const reloadedImageNode = findFirstImageNode(
569
- reloaded.initialSnapshot as PersistedEditorSnapshot,
570
- );
571
-
572
- assert.equal(reloaded.readOnly, false);
573
- assert.ok(reloadedImageNode);
574
- assert.equal(reloadedImageNode?.mediaId, "media:word/media/image1.png");
575
- });
576
-
577
- test("unchanged S02 sessions export the original source bytes instead of reserializing the package", async () => {
578
- const sourceBytes = new Uint8Array(
579
- readFileSync("test/fixtures/scenarios/docx/S02-bw-partner-user-licence-agreement-redlines.docx"),
580
- );
581
- const session = loadDocxEditorSession({
582
- documentId: "docx-s02-unchanged-export",
583
- sourceLabel: "S02-bw-partner-user-licence-agreement-redlines.docx",
584
- bytes: sourceBytes,
585
- editorBuild: "test",
586
- });
587
-
588
- const result = await session.exportDocx(session.initialSnapshot, {
589
- fileName: "s02-unchanged.docx",
590
- });
591
-
592
- assert.deepEqual(Buffer.from(result.bytes), Buffer.from(sourceBytes));
593
- });
594
-
595
- test("unchanged exports stay on the source-byte fast path across canonical key insertion order", async () => {
596
- const sourceBytes = new Uint8Array(readFileSync("test/fixtures/docx/F01-basic-contract.docx"));
597
- const session = loadDocxEditorSession({
598
- documentId: "docx-f01-deterministic-fast-path",
599
- sourceLabel: "F01-basic-contract.docx",
600
- bytes: sourceBytes,
601
- editorBuild: "test",
602
- });
603
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
604
- const originalDocument = snapshot.canonicalDocument;
605
-
606
- snapshot.canonicalDocument = {
607
- diagnostics: originalDocument.diagnostics,
608
- preservation: originalDocument.preservation,
609
- review: {
610
- revisions: { ...originalDocument.review.revisions },
611
- comments: { ...originalDocument.review.comments },
612
- },
613
- content: originalDocument.content,
614
- media: {
615
- items: { ...originalDocument.media.items },
616
- },
617
- numbering: {
618
- instances: { ...originalDocument.numbering.instances },
619
- abstractDefinitions: { ...originalDocument.numbering.abstractDefinitions },
620
- },
621
- styles: {
622
- tables: { ...originalDocument.styles.tables },
623
- characters: { ...originalDocument.styles.characters },
624
- paragraphs: { ...originalDocument.styles.paragraphs },
625
- },
626
- metadata: {
627
- ...originalDocument.metadata,
628
- customProperties: { ...originalDocument.metadata.customProperties },
629
- },
630
- updatedAt: originalDocument.updatedAt,
631
- createdAt: originalDocument.createdAt,
632
- docId: originalDocument.docId,
633
- schemaVersion: originalDocument.schemaVersion,
634
- };
635
-
636
- const result = await session.exportDocx(snapshot, {
637
- fileName: "f01-deterministic-fast-path.docx",
638
- });
639
-
640
- assert.deepEqual(Buffer.from(result.bytes), Buffer.from(sourceBytes));
641
- });
642
-
643
- test("S02 runtime single-item accept reduces actionable pending revisions", () => {
644
- const session = loadDocxEditorSession({
645
- documentId: "docx-s02-runtime-accept",
646
- sourceLabel: "S02-bw-partner-user-licence-agreement-redlines.docx",
647
- bytes: new Uint8Array(
648
- readFileSync("test/fixtures/scenarios/docx/S02-bw-partner-user-licence-agreement-redlines.docx"),
649
- ),
650
- editorBuild: "test",
651
- });
652
- const runtime = createDocumentRuntime({
653
- documentId: "docx-s02-runtime-accept",
654
- initialSnapshot: session.initialSnapshot,
655
- sourceKind: "docx",
656
- editorBuild: session.initialSnapshot.editorBuild,
657
- exportDocx: session.exportDocx,
658
- });
659
-
660
- const before = runtime.getRenderSnapshot().trackedChanges;
661
- const actionableRevision = before.revisions.find(
662
- (revision) =>
663
- revision.status === "active" && revision.actionability === "actionable",
664
- );
665
-
666
- assert.ok(actionableRevision);
667
- const beforePending = before.revisions.filter(
668
- (revision) =>
669
- revision.status === "active" && revision.actionability === "actionable",
670
- ).length;
671
-
672
- runtime.acceptChange(actionableRevision.revisionId);
673
-
674
- const after = runtime.getRenderSnapshot().trackedChanges;
675
- const afterPending = after.revisions.filter(
676
- (revision) =>
677
- revision.status === "active" && revision.actionability === "actionable",
678
- ).length;
679
- const updatedRevision = after.revisions.find(
680
- (revision) => revision.revisionId === actionableRevision.revisionId,
681
- );
682
-
683
- assert.ok(updatedRevision);
684
- assert.equal(updatedRevision?.status, "accepted");
685
- assert.ok(afterPending < beforePending);
686
- });
687
-
688
- test("source-backed paragraph-mark review actions export F12 with merged paragraph boundaries", async () => {
689
- const session = loadDocxEditorSession({
690
- documentId: "docx-f12",
691
- sourceLabel: "F12-redlines-paragraph-joins-splits.docx",
692
- bytes: new Uint8Array(readFileSync("test/fixtures/docx/F12-redlines-paragraph-joins-splits.docx")),
693
- editorBuild: "test",
694
- });
695
- const runtime = createDocumentRuntime({
696
- documentId: "docx-f12",
697
- initialSnapshot: session.initialSnapshot,
698
- sourceKind: "docx",
699
- editorBuild: session.initialSnapshot.editorBuild,
700
- exportDocx: session.exportDocx,
701
- });
702
-
703
- const initialRevisions = Object.values(runtime.getPersistedSnapshot().canonicalDocument.review.revisions);
704
- const paragraphDeletion = initialRevisions.find(
705
- (revision) => revision.metadata?.originalRevisionType === "paragraph-del",
706
- );
707
- const paragraphInsertion = initialRevisions.find(
708
- (revision) => revision.metadata?.originalRevisionType === "paragraph-ins",
709
- );
710
-
711
- assert.ok(paragraphDeletion, "Expected imported paragraph deletion revision in F12.");
712
- assert.ok(paragraphInsertion, "Expected imported paragraph insertion revision in F12.");
713
-
714
- runtime.acceptChange(paragraphDeletion.changeId);
715
- runtime.rejectChange(paragraphInsertion.changeId);
716
-
717
- const updatedSnapshot = runtime.getPersistedSnapshot();
718
- const initialBreakCount = parseTextStory(session.initialSnapshot.canonicalDocument.content).units.filter(
719
- (unit) => unit.kind === "paragraph_break",
720
- ).length;
721
- const updatedBreakCount = parseTextStory(updatedSnapshot.canonicalDocument.content).units.filter(
722
- (unit) => unit.kind === "paragraph_break",
723
- ).length;
724
- assert.ok(updatedBreakCount < initialBreakCount);
725
-
726
- const result = await runtime.exportDocx({
727
- fileName: "f12-edited.docx",
728
- });
729
- const exportedPackage = readOpcPackage(result.bytes);
730
- const documentPart = exportedPackage.parts.get("/word/document.xml");
731
- assert.ok(documentPart);
732
-
733
- const normalized = normalizeParsedTextDocument(
734
- parseMainDocumentXml(
735
- Buffer.from(documentPart.bytes).toString("utf8"),
736
- documentPart.relationships,
737
- ),
738
- "/word/document.xml",
739
- );
740
-
741
- assert.deepEqual(normalized.content, updatedSnapshot.canonicalDocument.content);
742
- });
743
-
744
- test("imported redlined sessions allow freeform plain-text edits and preserve active run-level revisions on export", async () => {
745
- const sourceBytes = new Uint8Array(readFileSync("test/fixtures/docx/F11-redlines-basic.docx"));
746
- const session = loadDocxEditorSession({
747
- documentId: "docx-f11-edit",
748
- sourceLabel: "F11-redlines-basic.docx",
749
- bytes: sourceBytes,
750
- editorBuild: "test",
751
- });
752
- const runtime = createDocumentRuntime({
753
- documentId: "docx-f11-edit",
754
- initialSnapshot: session.initialSnapshot,
755
- sourceKind: "docx",
756
- editorBuild: session.initialSnapshot.editorBuild,
757
- exportDocx: session.exportDocx,
758
- });
759
-
760
- runtime.dispatch({
761
- type: "selection.set",
762
- selection: {
763
- anchor: 0,
764
- head: 0,
765
- isCollapsed: true,
766
- activeRange: {
767
- kind: "range",
768
- from: 0,
769
- to: 0,
770
- assoc: { start: -1, end: 1 },
771
- },
772
- },
773
- });
774
- runtime.dispatch({
775
- type: "text.insert",
776
- text: "Updated ",
777
- origin: {
778
- source: "keyboard",
779
- timestamp: "2026-03-26T23:00:00.000Z",
780
- },
781
- });
782
-
783
- const result = await runtime.exportDocx({
784
- fileName: "f11-freeform-edit.docx",
785
- });
786
- const exportedPackage = readOpcPackage(result.bytes);
787
- const documentXml = Buffer.from(
788
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
789
- ).toString("utf8");
790
-
791
- assert.notDeepEqual(Buffer.from(result.bytes), Buffer.from(sourceBytes));
792
- assert.match(documentXml, /Updated The Supplier/);
793
- assert.match(documentXml, /<w:ins\b[^>]*w:id="11"/);
794
- assert.match(documentXml, /<w:del\b[^>]*w:id="12"/);
795
-
796
- const reloaded = loadDocxEditorSession({
797
- documentId: "docx-f11-reloaded",
798
- sourceLabel: "f11-freeform-edit.docx",
799
- bytes: result.bytes,
800
- editorBuild: "test",
801
- });
802
-
803
- assert.equal(reloaded.readOnly, false);
804
- assert.equal(reloaded.fatalError, undefined);
805
- assert.ok(
806
- Object.keys(
807
- (reloaded.initialSnapshot as PersistedEditorSnapshot).canonicalDocument.review.revisions,
808
- ).length >= 2,
809
- );
810
- });
811
-
812
- test("package-backed exports remap newly added comments to numeric OOXML ids", async () => {
813
- const sourceBytes = new Uint8Array(readFileSync("test/fixtures/docx/F11-redlines-basic.docx"));
814
- const session = loadDocxEditorSession({
815
- documentId: "docx-f11-comment-export",
816
- sourceLabel: "F11-redlines-basic.docx",
817
- bytes: sourceBytes,
818
- editorBuild: "test",
819
- });
820
- const runtime = createDocumentRuntime({
821
- documentId: "docx-f11-comment-export",
822
- initialSnapshot: session.initialSnapshot,
823
- sourceKind: "docx",
824
- editorBuild: session.initialSnapshot.editorBuild,
825
- exportDocx: session.exportDocx,
826
- });
827
-
828
- runtime.addComment({
829
- authorId: "user:operator",
830
- body: "Wave 8 operator comment",
831
- anchor: {
832
- kind: "range",
833
- from: 0,
834
- to: 1,
835
- assoc: {
836
- start: -1,
837
- end: 1,
838
- },
839
- },
840
- });
841
- runtime.acceptAllChanges();
842
-
843
- const result = await runtime.exportDocx({
844
- fileName: "f11-comment-export.docx",
845
- });
846
- const exportedPackage = readOpcPackage(result.bytes);
847
- const documentXml = Buffer.from(
848
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
849
- ).toString("utf8");
850
- const commentsXml = Buffer.from(
851
- exportedPackage.parts.get("/word/comments.xml")?.bytes ?? new Uint8Array(),
852
- ).toString("utf8");
853
-
854
- assert.match(documentXml, /<w:commentRangeStart w:id="\d+"\/>/);
855
- assert.match(documentXml, /<w:commentRangeEnd w:id="\d+"\/>/);
856
- assert.match(documentXml, /<w:commentReference w:id="\d+"\/>/);
857
- assert.match(commentsXml, /<w:comment w:id="\d+"/);
858
- assert.doesNotMatch(documentXml, /comment-\d{14,}-\d+/);
859
- assert.doesNotMatch(commentsXml, /comment-\d{14,}-\d+/);
860
-
861
- const reloaded = loadDocxEditorSession({
862
- documentId: "docx-f11-comment-reloaded",
863
- sourceLabel: "f11-comment-export.docx",
864
- bytes: result.bytes,
865
- editorBuild: "test",
866
- });
867
- const reloadedComments = Object.values(
868
- (reloaded.initialSnapshot as PersistedEditorSnapshot).canonicalDocument.review.comments,
869
- );
870
-
871
- assert.equal(reloaded.readOnly, false);
872
- assert.equal(reloaded.fatalError, undefined);
873
- assert.ok(reloadedComments.length >= 1);
874
- assert.equal(reloadedComments[0]?.body, "Wave 8 operator comment");
875
- });
876
-
877
- test("imported revisions with unsupported descendants downgrade to preserve-only and export unchanged", async () => {
878
- const session = loadDocxEditorSession({
879
- documentId: "docx-preserve-only-revision",
880
- sourceLabel: "preserve-only-revision.docx",
881
- bytes: createRevisionWithBookmarkDocxPackage(),
882
- editorBuild: "test",
883
- });
884
- const runtime = createDocumentRuntime({
885
- documentId: "docx-preserve-only-revision",
886
- initialSnapshot: session.initialSnapshot,
887
- sourceKind: "docx",
888
- editorBuild: session.initialSnapshot.editorBuild,
889
- exportDocx: session.exportDocx,
890
- });
891
- const importedRevisions = Object.values(
892
- runtime.getPersistedSnapshot().canonicalDocument.review.revisions,
893
- );
894
- const preserveOnlyRevision = importedRevisions.find(
895
- (revision) => revision.metadata?.ooxmlRevisionId === "55",
896
- );
897
-
898
- assert.ok(preserveOnlyRevision);
899
- assert.match(
900
- preserveOnlyRevision.metadata?.preserveOnlyReason ?? "",
901
- /preserve-only/i,
902
- );
903
-
904
- runtime.dispatch({
905
- type: "selection.set",
906
- selection: {
907
- anchor: 0,
908
- head: 0,
909
- isCollapsed: true,
910
- activeRange: {
911
- kind: "range",
912
- from: 0,
913
- to: 0,
914
- assoc: { start: -1, end: 1 },
915
- },
916
- },
917
- });
918
- runtime.dispatch({
919
- type: "text.insert",
920
- text: "Draft ",
921
- origin: {
922
- source: "keyboard",
923
- timestamp: "2026-03-26T23:20:00.000Z",
924
- },
925
- });
926
-
927
- const result = await runtime.exportDocx({
928
- fileName: "preserve-only-revision-export.docx",
929
- });
930
- const exportedPackage = readOpcPackage(result.bytes);
931
- const documentXml = Buffer.from(
932
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
933
- ).toString("utf8");
934
-
935
- assert.match(documentXml, /Draft Lead /);
936
- assert.match(documentXml, /<w:ins\b[^>]*w:id="55"/);
937
- assert.match(documentXml, /<w:bookmarkStart w:id="9" w:name="review-bookmark"\/>/);
938
- assert.match(documentXml, /<w:bookmarkEnd w:id="9"\/>/);
939
- });
940
-
941
- test("unsupported pict-only runs stay wrapped as runs when edited imports are exported", async () => {
942
- const session = loadDocxEditorSession({
943
- documentId: "docx-pict-run",
944
- sourceLabel: "pict-run.docx",
945
- bytes: createPictSeparatorDocxPackage(),
946
- editorBuild: "test",
947
- });
948
- const nextSnapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
949
- const firstParagraph = (nextSnapshot.canonicalDocument.content as {
950
- children: Array<{ children: Array<{ text?: string }> }>;
951
- }).children[0];
952
- const firstText = firstParagraph?.children[0];
953
-
954
- assert.ok(firstText);
955
- firstText.text = `${firstText.text ?? ""} Edited`;
956
- nextSnapshot.updatedAt = "2026-03-27T01:15:00.000Z";
957
- nextSnapshot.canonicalDocument.updatedAt = nextSnapshot.updatedAt;
958
-
959
- const result = await session.exportDocx(nextSnapshot, {
960
- fileName: "pict-run-edited.docx",
961
- });
962
- const exportedPackage = readOpcPackage(result.bytes);
963
- const documentXml = Buffer.from(
964
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
965
- ).toString("utf8");
966
-
967
- assert.match(documentXml, /Editable intro\. Edited/);
968
- assert.match(
969
- documentXml,
970
- /<w:r>\s*<w:rPr><w:noProof\/><\/w:rPr>\s*<w:pict\b[\s\S]*?<v:rect\b[\s\S]*?<\/w:pict>\s*<\/w:r>/,
971
- );
972
- assert.doesNotMatch(documentXml, /<w:p><w:pict\b/);
973
- });
974
-
975
- test("S02 freeform edits fail closed when preserve-only comment anchors would be lost", async () => {
976
- const sourceBytes = new Uint8Array(
977
- readFileSync("test/fixtures/scenarios/docx/S02-bw-partner-user-licence-agreement-redlines.docx"),
978
- );
979
- const session = loadDocxEditorSession({
980
- documentId: "docx-s02-edit",
981
- sourceLabel: "S02-bw-partner-user-licence-agreement-redlines.docx",
982
- bytes: sourceBytes,
983
- editorBuild: "test",
984
- });
985
- const runtime = createDocumentRuntime({
986
- documentId: "docx-s02-edit",
987
- initialSnapshot: session.initialSnapshot,
988
- sourceKind: "docx",
989
- editorBuild: session.initialSnapshot.editorBuild,
990
- exportDocx: session.exportDocx,
991
- });
992
-
993
- runtime.dispatch({
994
- type: "selection.set",
995
- selection: {
996
- anchor: 0,
997
- head: 0,
998
- isCollapsed: true,
999
- activeRange: {
1000
- kind: "range",
1001
- from: 0,
1002
- to: 0,
1003
- assoc: { start: -1, end: 1 },
1004
- },
1005
- },
1006
- });
1007
- runtime.dispatch({
1008
- type: "text.insert",
1009
- text: "Draft ",
1010
- origin: {
1011
- source: "keyboard",
1012
- timestamp: "2026-03-26T23:10:00.000Z",
1013
- },
1014
- });
1015
-
1016
- await assert.rejects(
1017
- () =>
1018
- runtime.exportDocx({
1019
- fileName: "s02-freeform-edit.docx",
1020
- }),
1021
- /preserve-only comment anchors/i,
1022
- );
1023
- });
1024
-
1025
- test("F16 through F18 preserve-only fixtures survive edited exports with their critical OOXML intact", async () => {
1026
- const fixtures = [
1027
- {
1028
- fixturePath: "test/fixtures/docx/F16-footnotes-endnotes.docx",
1029
- documentId: "docx-f16",
1030
- expectedDocumentPatterns: [
1031
- /<w:footnoteReference w:id="2"\/>/,
1032
- /<w:endnoteReference w:id="3"\/>/,
1033
- ],
1034
- expectedParts: ["/word/footnotes.xml", "/word/endnotes.xml"],
1035
- },
1036
- {
1037
- fixturePath: "test/fixtures/docx/F17-fields-and-toc.docx",
1038
- documentId: "docx-f17",
1039
- expectedDocumentPatterns: [
1040
- /<w:fldChar w:fldCharType="begin"\/>/,
1041
- /<w:fldSimple w:instr=" PAGE ">/,
1042
- ],
1043
- expectedParts: [],
1044
- },
1045
- {
1046
- fixturePath: "test/fixtures/docx/F18-content-controls-template.docx",
1047
- documentId: "docx-f18",
1048
- expectedDocumentPatterns: [
1049
- /<w:sdt>/,
1050
- /<w:lock w:val="sdtLocked"\/>/,
1051
- ],
1052
- expectedParts: [],
1053
- },
1054
- ] as const;
1055
-
1056
- for (const fixture of fixtures) {
1057
- const sourceBytes = new Uint8Array(readFileSync(fixture.fixturePath));
1058
- const session = loadDocxEditorSession({
1059
- documentId: fixture.documentId,
1060
- sourceLabel: fixture.fixturePath.split("/").at(-1),
1061
- bytes: sourceBytes,
1062
- editorBuild: "test",
1063
- });
1064
- const snapshot = structuredClone(session.initialSnapshot) as PersistedEditorSnapshot;
1065
-
1066
- appendSuffixToFirstTextNode(snapshot, " Edited");
1067
- snapshot.updatedAt = "2026-03-27T01:20:00.000Z";
1068
- snapshot.canonicalDocument.updatedAt = snapshot.updatedAt;
1069
-
1070
- const result = await session.exportDocx(snapshot, {
1071
- fileName: `${fixture.documentId}-edited.docx`,
1072
- });
1073
- const exportedPackage = readOpcPackage(result.bytes);
1074
- const documentXml = Buffer.from(
1075
- exportedPackage.parts.get("/word/document.xml")?.bytes ?? new Uint8Array(),
1076
- ).toString("utf8");
1077
-
1078
- assert.match(documentXml, /Edited/);
1079
- for (const pattern of fixture.expectedDocumentPatterns) {
1080
- assert.match(documentXml, pattern);
1081
- }
1082
- for (const partPath of fixture.expectedParts) {
1083
- assert.ok(exportedPackage.parts.get(partPath), `Expected preserved package part ${partPath}.`);
1084
- }
1085
-
1086
- const reloaded = loadDocxEditorSession({
1087
- documentId: `${fixture.documentId}-reloaded`,
1088
- sourceLabel: `${fixture.documentId}-edited.docx`,
1089
- bytes: result.bytes,
1090
- editorBuild: "test",
1091
- });
1092
- assert.equal(reloaded.readOnly, false);
1093
- assert.equal(reloaded.fatalError, undefined);
1094
- }
1095
- });
1096
-
1097
- test("malformed package bytes open in diagnostics mode and block export", async () => {
1098
- const session = loadDocxEditorSession({
1099
- documentId: "docx-broken",
1100
- sourceLabel: "broken.docx",
1101
- bytes: new Uint8Array([0x00, 0x01, 0x02, 0x03]),
1102
- editorBuild: "test",
1103
- });
1104
-
1105
- assert.equal(session.readOnly, true);
1106
- assert.ok(session.fatalError);
1107
- assert.equal(session.fatalError.code, "package_corrupt");
1108
- assert.equal(session.fatalError.details?.stage, "package");
1109
- assert.equal(session.initialSnapshot.compatibility.blockExport, true);
1110
- assert.equal(
1111
- session.initialSnapshot.canonicalDocument.metadata.importMode,
1112
- "read-only-diagnostics",
1113
- );
1114
- assert.equal(
1115
- session.initialSnapshot.compatibility.featureEntries[0]?.details?.stage,
1116
- "package",
1117
- );
1118
- assert.match(
1119
- String(session.initialSnapshot.compatibility.featureEntries[0]?.details?.diagnosticsToken),
1120
- /^pkg-[0-9a-f]{8}$/u,
1121
- );
1122
- await assert.rejects(() => session.exportDocx(session.initialSnapshot));
1123
- });
1124
-
1125
- function createCommentedDocxPackage(): Uint8Array {
1126
- const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1127
- <w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1128
- <w:body>
1129
- <w:p>
1130
- <w:r><w:t>Alpha </w:t></w:r>
1131
- <w:commentRangeStart w:id="7"/>
1132
- <w:r><w:t>Beta</w:t></w:r>
1133
- <w:commentRangeEnd w:id="7"/>
1134
- <w:r><w:commentReference w:id="7"/></w:r>
1135
- </w:p>
1136
- <w:sectPr/>
1137
- </w:body>
1138
- </w:document>`;
1139
- const commentsXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1140
- <w:comments xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1141
- <w:comment w:id="7" w:author="user:a" w:date="2026-03-26T12:00:00.000Z">
1142
- <w:p><w:r><w:t>Imported comment body</w:t></w:r></w:p>
1143
- </w:comment>
1144
- </w:comments>`;
1145
- const basePackage = readOpcPackage(writeDocxPackage({ documentXml }));
1146
- const documentPart = basePackage.parts.get("/word/document.xml");
1147
- assert.ok(documentPart);
1148
-
1149
- const nextPackage: OpcPackage = {
1150
- manifest: {
1151
- ...basePackage.manifest,
1152
- contentTypes: {
1153
- defaults: {
1154
- ...basePackage.manifest.contentTypes.defaults,
1155
- },
1156
- overrides: {
1157
- ...basePackage.manifest.contentTypes.overrides,
1158
- "/word/comments.xml":
1159
- "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
1160
- },
1161
- },
1162
- parts: [
1163
- ...basePackage.manifest.parts.map((part) =>
1164
- part.path === "/word/document.xml"
1165
- ? {
1166
- ...part,
1167
- relationships: [
1168
- ...part.relationships,
1169
- {
1170
- id: "rIdComments1",
1171
- type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
1172
- target: "comments.xml",
1173
- targetMode: "internal" as const,
1174
- },
1175
- ],
1176
- }
1177
- : part,
1178
- ),
1179
- {
1180
- path: "/word/comments.xml",
1181
- surfaceKind: "content",
1182
- contentType:
1183
- "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
1184
- relationshipsPartPath: "/word/_rels/comments.xml.rels",
1185
- relationships: [],
1186
- compression: "deflate",
1187
- byteLength: new TextEncoder().encode(commentsXml).byteLength,
1188
- },
1189
- ],
1190
- packageRelationships: basePackage.manifest.packageRelationships,
1191
- },
1192
- parts: new Map([
1193
- ...basePackage.parts.entries(),
1194
- [
1195
- "/word/document.xml",
1196
- {
1197
- ...documentPart,
1198
- relationships: [
1199
- ...documentPart.relationships,
1200
- {
1201
- id: "rIdComments1",
1202
- type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
1203
- target: "comments.xml",
1204
- targetMode: "internal" as const,
1205
- },
1206
- ],
1207
- },
1208
- ],
1209
- [
1210
- "/word/comments.xml",
1211
- {
1212
- path: "/word/comments.xml",
1213
- surfaceKind: "content",
1214
- contentType:
1215
- "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
1216
- relationshipsPartPath: "/word/_rels/comments.xml.rels",
1217
- relationships: [],
1218
- compression: "deflate",
1219
- bytes: new TextEncoder().encode(commentsXml),
1220
- crc32: 0,
1221
- },
1222
- ],
1223
- ]),
1224
- sourceByteLength: 0,
1225
- };
1226
-
1227
- return writeOpcPackage(nextPackage);
1228
- }
1229
-
1230
- function createStyledCommentReferenceDocxPackage(): Uint8Array {
1231
- const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1232
- <w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1233
- <w:body>
1234
- <w:p>
1235
- <w:r><w:t>Alpha </w:t></w:r>
1236
- <w:commentRangeStart w:id="23"/>
1237
- <w:r><w:rPr><w:rStyle w:val="Emphasis"/></w:rPr><w:t>Beta</w:t></w:r>
1238
- <w:commentRangeEnd w:id="23"/>
1239
- <w:r>
1240
- <w:rPr><w:rStyle w:val="CommentReference"/></w:rPr>
1241
- <w:commentReference w:id="23"/>
1242
- </w:r>
1243
- </w:p>
1244
- <w:sectPr/>
1245
- </w:body>
1246
- </w:document>`;
1247
- const commentsXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1248
- <w:comments xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1249
- <w:comment w:id="23" w:author="user:styled" w:date="2026-03-28T00:00:00.000Z">
1250
- <w:p><w:r><w:t>Styled reference comment</w:t></w:r></w:p>
1251
- </w:comment>
1252
- </w:comments>`;
1253
-
1254
- return createCommentedPackage(documentXml, commentsXml, "rIdCommentsStyled");
1255
- }
1256
-
1257
- function appendSuffixToFirstTextNode(
1258
- snapshot: PersistedEditorSnapshot,
1259
- suffix: string,
1260
- ): void {
1261
- const content = snapshot.canonicalDocument.content as {
1262
- type?: string;
1263
- children?: Array<{
1264
- type?: string;
1265
- children?: Array<{
1266
- type?: string;
1267
- text?: string;
1268
- }>;
1269
- }>;
1270
- };
1271
-
1272
- for (const block of content.children ?? []) {
1273
- if (block.type !== "paragraph") {
1274
- continue;
1275
- }
1276
-
1277
- for (const child of block.children ?? []) {
1278
- if (child.type !== "text") {
1279
- continue;
1280
- }
1281
-
1282
- child.text = `${child.text ?? ""}${suffix}`;
1283
- return;
1284
- }
1285
- }
1286
-
1287
- throw new Error("Expected an editable text node in the fixture snapshot.");
1288
- }
1289
-
1290
- function findFirstImageNode(
1291
- snapshot: PersistedEditorSnapshot,
1292
- ): { mediaId: string; altText?: string } | undefined {
1293
- const content = snapshot.canonicalDocument.content as {
1294
- type?: string;
1295
- children?: Array<{
1296
- type?: string;
1297
- children?: Array<{
1298
- type?: string;
1299
- mediaId?: string;
1300
- altText?: string;
1301
- }>;
1302
- }>;
1303
- };
1304
-
1305
- for (const block of content.children ?? []) {
1306
- if (block.type !== "paragraph") {
1307
- continue;
1308
- }
1309
-
1310
- for (const child of block.children ?? []) {
1311
- if (child.type === "image" && typeof child.mediaId === "string") {
1312
- return {
1313
- mediaId: child.mediaId,
1314
- altText: child.altText,
1315
- };
1316
- }
1317
- }
1318
- }
1319
-
1320
- return undefined;
1321
- }
1322
-
1323
- function createOpaqueCommentedDocxPackage(): Uint8Array {
1324
- const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1325
- <w:document xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1326
- <w:body>
1327
- <w:p>
1328
- <w:pPr>
1329
- <w:pPrChange w:id="41" w:author="user:format" w:date="2026-03-26T12:10:00.000Z">
1330
- <w:pPr><w:jc w:val="center"/></w:pPr>
1331
- </w:pPrChange>
1332
- </w:pPr>
1333
- <w:r><w:t>Alpha </w:t></w:r>
1334
- <w:commentRangeStart w:id="17"/>
1335
- <w:r><w:t>Beta</w:t></w:r>
1336
- <w:commentRangeEnd w:id="17"/>
1337
- <w:r><w:commentReference w:id="17"/></w:r>
1338
- </w:p>
1339
- <w:p>
1340
- <w:r><w:t>Tail paragraph.</w:t></w:r>
1341
- </w:p>
1342
- <w:sectPr/>
1343
- </w:body>
1344
- </w:document>`;
1345
- const commentsXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1346
- <w:comments xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1347
- <w:comment w:id="17" w:author="user:opaque" w:date="2026-03-26T12:11:00.000Z">
1348
- <w:p>
1349
- <w:bookmarkStart w:id="1" w:name="opaque-comment-bookmark"/>
1350
- <w:r><w:t>Opaque comment body</w:t></w:r>
1351
- <w:bookmarkEnd w:id="1"/>
1352
- </w:p>
1353
- </w:comment>
1354
- </w:comments>`;
1355
-
1356
- return createCommentedPackage(documentXml, commentsXml, "rIdCommentsOpaque");
1357
- }
1358
-
1359
- function createRevisionWithBookmarkDocxPackage(): Uint8Array {
1360
- const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1361
- <w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
1362
- <w:body>
1363
- <w:p>
1364
- <w:r><w:t>Lead </w:t></w:r>
1365
- <w:ins w:id="55" w:author="user:revision" w:date="2026-03-26T12:15:00.000Z">
1366
- <w:bookmarkStart w:id="9" w:name="review-bookmark"/>
1367
- <w:r><w:t>Marked</w:t></w:r>
1368
- <w:bookmarkEnd w:id="9"/>
1369
- </w:ins>
1370
- <w:r><w:t> Tail</w:t></w:r>
1371
- </w:p>
1372
- <w:p>
1373
- <w:r><w:t>Trailing paragraph.</w:t></w:r>
1374
- </w:p>
1375
- <w:sectPr/>
1376
- </w:body>
1377
- </w:document>`;
1378
-
1379
- return writeDocxPackage({ documentXml });
1380
- }
1381
-
1382
- function createPictSeparatorDocxPackage(): Uint8Array {
1383
- const documentXml = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1384
- <w:document xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
1385
- <w:body>
1386
- <w:p>
1387
- <w:r><w:t>Editable intro.</w:t></w:r>
1388
- </w:p>
1389
- <w:p w14:paraId="45590ACA" w14:textId="77777777">
1390
- <w:r>
1391
- <w:rPr><w:noProof/></w:rPr>
1392
- <w:pict w14:anchorId="1E251FC2">
1393
- <v:rect id="_x0000_i1043" alt="" style="width:451.15pt;height:.05pt" o:hrpct="964" o:hralign="center" o:hrstd="t" o:hr="t" fillcolor="#a0a0a0" stroked="f"/>
1394
- </w:pict>
1395
- </w:r>
1396
- </w:p>
1397
- <w:p>
1398
- <w:r><w:t>Tail paragraph.</w:t></w:r>
1399
- </w:p>
1400
- <w:sectPr/>
1401
- </w:body>
1402
- </w:document>`;
1403
-
1404
- return writeDocxPackage({ documentXml });
1405
- }
1406
-
1407
- function createCommentedPackage(
1408
- documentXml: string,
1409
- commentsXml: string,
1410
- relationshipId: string,
1411
- ): Uint8Array {
1412
- const basePackage = readOpcPackage(writeDocxPackage({ documentXml }));
1413
- const documentPart = basePackage.parts.get("/word/document.xml");
1414
- assert.ok(documentPart);
1415
-
1416
- const nextPackage: OpcPackage = {
1417
- manifest: {
1418
- ...basePackage.manifest,
1419
- contentTypes: {
1420
- defaults: {
1421
- ...basePackage.manifest.contentTypes.defaults,
1422
- },
1423
- overrides: {
1424
- ...basePackage.manifest.contentTypes.overrides,
1425
- "/word/comments.xml":
1426
- "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
1427
- },
1428
- },
1429
- parts: [
1430
- ...basePackage.manifest.parts.map((part) =>
1431
- part.path === "/word/document.xml"
1432
- ? {
1433
- ...part,
1434
- relationships: [
1435
- ...part.relationships,
1436
- {
1437
- id: relationshipId,
1438
- type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
1439
- target: "comments.xml",
1440
- targetMode: "internal" as const,
1441
- },
1442
- ],
1443
- }
1444
- : part,
1445
- ),
1446
- {
1447
- path: "/word/comments.xml",
1448
- surfaceKind: "content",
1449
- contentType:
1450
- "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
1451
- relationshipsPartPath: "/word/_rels/comments.xml.rels",
1452
- relationships: [],
1453
- compression: "deflate",
1454
- byteLength: new TextEncoder().encode(commentsXml).byteLength,
1455
- },
1456
- ],
1457
- packageRelationships: basePackage.manifest.packageRelationships,
1458
- },
1459
- parts: new Map([
1460
- ...basePackage.parts.entries(),
1461
- [
1462
- "/word/document.xml",
1463
- {
1464
- ...documentPart,
1465
- relationships: [
1466
- ...documentPart.relationships,
1467
- {
1468
- id: relationshipId,
1469
- type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",
1470
- target: "comments.xml",
1471
- targetMode: "internal" as const,
1472
- },
1473
- ],
1474
- },
1475
- ],
1476
- [
1477
- "/word/comments.xml",
1478
- {
1479
- path: "/word/comments.xml",
1480
- surfaceKind: "content",
1481
- contentType:
1482
- "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",
1483
- relationshipsPartPath: "/word/_rels/comments.xml.rels",
1484
- relationships: [],
1485
- compression: "deflate",
1486
- bytes: new TextEncoder().encode(commentsXml),
1487
- crc32: 0,
1488
- },
1489
- ],
1490
- ]),
1491
- sourceByteLength: 0,
1492
- };
1493
-
1494
- return writeOpcPackage(nextPackage);
1495
- }