@a3s-lab/office 0.7.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/COLLABORATION_ROADMAP.md +81 -26
  2. package/README.md +48 -4
  3. package/dist/0~document-editor.js +414 -247
  4. package/dist/8928.js +689 -49
  5. package/dist/9787.js +14 -4
  6. package/dist/core.d.ts +2 -2
  7. package/dist/internal/collaboration/office-collaboration.d.ts +4 -2
  8. package/dist/internal/collaboration/office-document-collaboration-change-decisions.d.ts +7 -0
  9. package/dist/internal/collaboration/office-document-collaboration-claims.d.ts +2 -1
  10. package/dist/internal/collaboration/office-document-collaboration-comment-permissions.d.ts +3 -0
  11. package/dist/internal/collaboration/office-document-collaboration-sidecars.d.ts +3 -1
  12. package/dist/internal/collaboration/office-document-collaboration-suggestions.d.ts +6 -0
  13. package/dist/internal/collaboration/office-document-collaboration.d.ts +6 -2
  14. package/dist/internal/features/work/editors/document-changes-panel.d.ts +7 -1
  15. package/dist/internal/features/work/editors/document-comment-composer.d.ts +1 -0
  16. package/dist/internal/features/work/editors/document-comments-panel.d.ts +3 -1
  17. package/dist/internal/features/work/editors/document-selection-toolbar.d.ts +2 -1
  18. package/dist/internal/features/work/editors/document-toolbar.d.ts +5 -1
  19. package/dist/internal/features/work/editors/use-document-comments.d.ts +6 -1
  20. package/dist/internal/features/work/work-document-changes.d.ts +5 -2
  21. package/dist/internal/features/work/work-document-comments.d.ts +5 -1
  22. package/dist/internal/features/work/work-document-extensions.d.ts +1 -0
  23. package/dist/internal/features/work/work-document-paragraph-identity.d.ts +1 -0
  24. package/dist/internal/features/work/work-document-table-row-identity.d.ts +5 -1
  25. package/dist/internal/features/work/work-types.d.ts +22 -0
  26. package/dist/office-kernel.wasm +0 -0
  27. package/dist/styles.css +76 -0
  28. package/package.json +12 -3
@@ -22,8 +22,9 @@ which tracks editor capability parity with WPS.
22
22
  the local binding origin, so one participant cannot undo another
23
23
  participant's operation.
24
24
  - `view`, `comment`, `suggest`, and `edit` are explicit session modes. A format
25
- enables a mode only after its durable model exists; until then, unsupported
26
- non-edit modes remain read-only.
25
+ enables a mode only after its durable model exists. Document enables durable
26
+ review-only `comment` plus actor-attributed `suggest`; unsupported
27
+ mode/format pairs remain read-only.
27
28
  - Editors never collaborate by repeatedly replacing one serialized OOXML file
28
29
  or one universal JSON blob. Each format gets a typed, conflict-local model.
29
30
 
@@ -43,6 +44,7 @@ Protocol v1 reserves the `a3s.office` namespace.
43
44
  | `document.content` | `Y.XmlFragment` | ProseMirror document, including section layout, comment anchors, and tracked-change marks. |
44
45
  | `document.options` | `Y.Map` | Document-level editable options such as page color and tracking mode. |
45
46
  | `document.comments` / `document.comment-order` | `Y.Map` / `Y.Array` | ID-keyed durable comment/reply records and deterministic presentation order. |
47
+ | `document.change-decisions` / `document.change-decision-order` | `Y.Map` / `Y.Array` | Immutable accept/reject audit records and deterministic decision order. |
46
48
  | `document.bibliography*` | Typed maps/arrays | Bibliography settings and ID-keyed citation sources. |
47
49
  | `spreadsheet.*` | Typed maps/arrays | Sheet order, field-addressed sparse cells, formulas, styles, objects, names, and print state. |
48
50
  | `presentation.*` | Typed maps/arrays | Slide/master/layout order, ID-keyed scene objects, notes, transitions, and comments. |
@@ -90,8 +92,12 @@ Status: implemented in the browser library.
90
92
  - A runnable A3S Boot reference backend now provides signed room tickets,
91
93
  Origin validation, permission enforcement, WebSocket rooms, durable Yrs
92
94
  persistence, ephemeral Awareness relay, reconnect repair, and service-owned
93
- durable update polling. Its browser adapter converts bounded base64 wire
94
- payloads back to the package's typed `Uint8Array` transport envelope.
95
+ durable update polling. Version-2 tickets bind actor display name and the
96
+ durable store semantically authorizes Document comment- and suggestion-mode
97
+ updates under the room lock before persistence or broadcast. Its browser
98
+ adapter converts bounded base64 wire payloads back to the package's typed
99
+ `Uint8Array` transport envelope and verifies the ready identity against the
100
+ local session.
95
101
  - Convergence, offline/reconnect, transport-boundary, presence, permission,
96
102
  StrictMode, framework-parity, ownership, backend persistence, room broadcast,
97
103
  ticket tamper, and read-only authorization tests.
@@ -103,9 +109,10 @@ Redis/NATS fan-out plus a distributed writer/lock policy.
103
109
  ### Phase 2: Document
104
110
 
105
111
  Status: browser collaboration foundation, participant roster, remote
106
- selection/caret projection, participant navigation, and native
107
- text/options/bounded structural paragraph mutations implemented; rich native
108
- parity and the remaining review authorization matrix are pending.
112
+ selection/caret projection, participant navigation, durable review-only
113
+ comment and suggestion modes, immutable suggestion-decision audit, and native
114
+ text/options/bounded structural paragraph/comment mutations implemented; rich
115
+ native mutation parity remains pending.
109
116
 
110
117
  - TipTap is bound to `document.content` through
111
118
  `@tiptap/extension-collaboration`; StarterKit undo/redo is disabled and the
@@ -139,11 +146,47 @@ parity and the remaining review authorization matrix are pending.
139
146
  after durable restart and replay, including concurrent native and browser
140
147
  paragraph insertion across nested lists and nested tables. Real CLI and MCP
141
148
  subprocess tests exercise the same bounded structural mutations.
149
+ - Document `comment` sessions now create selection-anchored threads, append
150
+ replies, resolve or reopen threads, and delete only their actor's own comment
151
+ or reply records while canonical text, structure, options, bibliography, and
152
+ non-comment formatting stay read-only. Records persist by stable ID and
153
+ immutable creation claim; removing an anchor through an authorized content
154
+ edit retains a detached thread. Remote review changes do not enter local undo
155
+ history.
156
+ - Authenticated Document `suggest` sessions create attributed insertion,
157
+ deletion, and replacement proposals as `documentChange` marks. Their
158
+ canonical projection is unchanged until an `edit` participant decides the
159
+ proposal. Suggesters may withdraw their own insertion proposals, but cannot
160
+ change canonical text, structure, non-suggestion formatting, options,
161
+ comments, bibliography, another actor's proposal, or a deletion proposal's
162
+ targeted canonical text.
163
+ - Accepting or rejecting a suggestion applies the tracked change and appends
164
+ one immutable actor-attributed record to `document.change-decisions` plus its
165
+ deterministic order root in the same transaction. Identical offline retries
166
+ converge, a second conflicting final decision fails closed, old Documents
167
+ without the additive roots remain readable, and a final decision clears
168
+ local history that could otherwise resurrect the decided mark.
169
+ - Rust, CLI, MCP, and A3S Code expose `document-comment-create`,
170
+ `document-comment-reply`, `document-comment-set-resolved`, and
171
+ `document-comment-delete`. Projection schema v2 returns attributable threads,
172
+ replies, anchor text, paragraph/text identities, browser-compatible UTF-16
173
+ offsets, resolution, and detached state. Native and browser fixtures cover
174
+ restart, reordered delivery, stale anchor guards, idempotent retries,
175
+ ownership failures, and cross-language convergence.
176
+ - The A3S Boot backend permits `edit` content/review updates, semantically
177
+ validated Document `comment` review-only updates, and semantically validated
178
+ Document `suggest` proposal updates. Signed actor identity and display name
179
+ must match every new comment, reply, or suggestion. Forged roots, canonical
180
+ content, structure, options, non-suggestion formatting, authorship, order,
181
+ claims, anchors, foreign deletion, or foreign suggestion changes fail before
182
+ the durable store changes.
142
183
 
143
184
  Remaining:
144
185
 
145
- - Add suggestion-only authorization and durable accept/reject decision audit
146
- records; `comment` and `suggest` remain read-only until those models exist.
186
+ - Add closed typed native projection and mutation variants for creating
187
+ Document suggestions and deciding them through CLI/MCP/A3S Code. The current
188
+ typed native mutation set can synchronize the resulting Yjs state but does
189
+ not originate these two workflows.
147
190
  - Prove concurrent full-table, list-restructure, section, comment, and revision
148
191
  workflows, plus DOCX import/export after merged edits.
149
192
  - Expand native convergence from bounded paragraph edits to complete table,
@@ -344,11 +387,12 @@ destructive actions remain attributable, reviewable, and non-retryable.
344
387
  ### Phase 6: CLI, MCP, and coding agents
345
388
 
346
389
  Status: native Yrs replica store, resumable CLI/MCP event streams, `a3s code`
347
- projection, a host-injected live CLI transport session, and typed Markdown,
348
- Document, Spreadsheet cell, Presentation scene-element, PDF
349
- annotation/form-value, and PDF redaction/page-operation review mutation
350
- surfaces are implemented; the remaining format mutations and native presence
351
- projection are pending.
390
+ projection, a host-injected live CLI transport session, authenticated browser
391
+ suggestion-update authorization, and typed Markdown, Document content/comment,
392
+ Spreadsheet cell, Presentation scene-element, PDF annotation/form-value, and
393
+ PDF redaction/page-operation review mutation surfaces are implemented; typed
394
+ native Document suggestion/decision mutations, the remaining format mutations,
395
+ and native presence projection are pending.
352
396
 
353
397
  - Yrs `0.27.3` now uses 53-bit Yjs-compatible client IDs and exchanges standard
354
398
  Yjs v1 updates, state vectors, and y-sync `SyncStep1`/`Update` messages with
@@ -390,16 +434,27 @@ projection are pending.
390
434
  if the declared match count is stale. Bounded section/list/table/blockquote
391
435
  paragraph insert/delete uses explicit stable identities and exact deletion
392
436
  guards, while table-contained edits rotate all ancestor row text identities;
393
- page color and track-changes write their typed option fields. All emit minimal
394
- incremental updates through the same durable
395
- receipt/checkpoint path. Canonical typed mutations require `edit`; raw remote
396
- updates remain receivable in every mode so read-only peers still converge.
437
+ page color and track-changes write their typed option fields. Document comment
438
+ create/reply/resolve/delete writes attributable browser-compatible review
439
+ records and exact selection marks. All emit minimal incremental updates
440
+ through the same durable receipt/checkpoint path. Canonical content mutations
441
+ require `edit`; Document review mutations accept `edit` or `comment`, with
442
+ ownership-restricted deletion in `comment`. Raw remote updates remain
443
+ receivable in every mode so read-only peers still converge.
444
+ - Host-authenticated Document `suggest` transport updates are semantically
445
+ checked in Yrs before commit: only attributed insertion/deletion/replacement
446
+ proposals owned by the authenticated actor may be added or withdrawn, while
447
+ canonical state and every non-suggestion root remain protected. This is a
448
+ transport authorization path, not a `NativeOfficeCollaborationMutation`;
449
+ `collab mutate`, `office_collaboration_mutate`, and projection v2 do not yet
450
+ expose native typed suggestion creation or final-decision operations.
397
451
  - Rust `project`, `collab read`, and `office_collaboration_read` interpret the
398
452
  Office-owned browser schema inside Office rather than in a product host.
399
453
  Markdown returns its exact canonical source. Document returns bounded
400
454
  traversal-order paragraph records, stable `paragraphId`/`textId` pairs,
401
- structural ancestry, option fields, and subordinate plain text together
402
- with the exact state vector. `document-replace-paragraph` uses those stable
455
+ structural ancestry, option fields, subordinate plain text, and projection-v2
456
+ comment/reply/anchor/detached records together with the exact state vector.
457
+ `document-replace-paragraph` uses those stable
403
458
  identities plus complete expected text to reject a stale same-paragraph
404
459
  browser/agent edit before writing, while unrelated changes can proceed
405
460
  without replacing the full document.
@@ -441,7 +496,7 @@ projection are pending.
441
496
  source browser operation, and source attribution is audit data rather than
442
497
  an authorization token.
443
498
  - Cross-language tests apply deterministic native UTF-16 Markdown, ProseMirror
444
- Document text/options/paragraph, Spreadsheet cell, Presentation
499
+ Document text/options/paragraph/comment, Spreadsheet cell, Presentation
445
500
  scene-element content/z-order, and PDF annotation/form-value updates in browser Yjs,
446
501
  including concurrent browser/native paragraph, cell-leaf, element-field,
447
502
  annotation-leaf, and PDF form edits, in addition to importing browser Yjs
@@ -454,9 +509,9 @@ Remaining:
454
509
 
455
510
  - Extend typed format-model mutations to Spreadsheet and remaining Presentation
456
511
  structural/rich-text operations plus PDF signatures; deepen Document
457
- mutations to additional nested structures and review operations, and add
458
- durable comment/suggest operations before enabling those modes for local
459
- mutation.
512
+ mutations to additional nested structures and add typed suggestion creation,
513
+ suggestion projection, and tracked final-decision operations for native
514
+ clients.
460
515
  - Project editor-visible presence and selection state while keeping Awareness
461
516
  ephemeral and outside native replica persistence.
462
517
 
@@ -478,5 +533,5 @@ valid update delivery orders.
478
533
  - Shipping a hosted collaboration backend inside the component package.
479
534
  - Treating awareness as authorization or durable audit history.
480
535
  - Hiding provider synchronization behind editor mount.
481
- - Claiming comments or suggestions are supported by a format until its durable
482
- review schema and accept/reject semantics are implemented.
536
+ - Claiming comments or suggestions are supported by a format that lacks a
537
+ durable review schema and, for suggestions, explicit accept/reject semantics.
package/README.md CHANGED
@@ -46,6 +46,9 @@ workflows, and a separate Rust automation plane.
46
46
  permissions, collaboration, and model providers.
47
47
  - **Collaborate across every editor** with shared Yjs/Yrs content, Awareness
48
48
  participants and remote locations, plus browser, CLI, MCP, and A3S Code peers.
49
+ Document reviewers can submit attributed insertions, deletions, and
50
+ replacements without directly changing canonical text; editors accept or
51
+ reject each proposal with an immutable shared decision record.
49
52
  - **Automate deterministically** through the native CLI, standard MCP server,
50
53
  or packaged Office Skill.
51
54
 
@@ -143,8 +146,9 @@ The images below are committed visual-regression baselines from the real
143
146
  also keep a durable Yrs replica, exchange standard Yjs v1 updates and state
144
147
  vectors, perform authorized typed Markdown, Document, Spreadsheet cell,
145
148
  Presentation scene-element and z-order, and PDF annotation, form-value, and
146
- review changes, retain browser/native actor attribution, and checkpoint
147
- without replacing a whole Office file.
149
+ review changes, including attributable Document selection comments and
150
+ replies, retain browser/native actor attribution, and checkpoint without
151
+ replacing a whole Office file.
148
152
 
149
153
  ## Real-time collaboration
150
154
 
@@ -158,6 +162,18 @@ through the CLI, standard MCP server, or A3S Code.
158
162
  The host owns rooms, authentication, authorization, network delivery, offline
159
163
  buffering, persistence, and the `Y.Doc`; A3S Office owns format-specific
160
164
  bindings, local undo, validated presence, and conflict-local typed mutations.
165
+ An authenticated Document `comment` session can select text, create a durable
166
+ thread, reply, resolve or reopen it, and delete only review records owned by
167
+ its actor while canonical content remains read-only. The server independently
168
+ validates that review-only boundary before persistence and broadcast. An
169
+ authenticated Document `suggest` session can submit attributed insertions,
170
+ deletions, and replacements while canonical text, structure, formatting,
171
+ options, comments, and other actors' suggestions remain protected. An `edit`
172
+ participant accepts or rejects a proposal and appends the final actor-attributed
173
+ decision to the immutable `document.change-decisions` audit trail. The A3S Boot
174
+ service validates both comment and suggestion semantics under the durable room
175
+ lock before it persists or broadcasts caller-supplied Yjs bytes. `suggest` on
176
+ non-Document formats remains receive-only.
161
177
  See the bilingual [real-time collaboration guide](https://a3s-lab.github.io/Office/docs/components/collaboration.html)
162
178
  for React, Vue, Web Component, reconnect, security, and native-agent setup.
163
179
  The repository also ships a runnable
@@ -1046,6 +1062,19 @@ cargo run -p a3s-office-cli -- collab mutate .a3s/report.replica \
1046
1062
  --operation-id edit-44 \
1047
1063
  --mutation '{"type":"document-insert-paragraph","anchorParagraphId":"00000001","position":"after","paragraphId":"00000012","textId":"00000013","text":"Native paragraph"}' --json
1048
1064
 
1065
+ # Add a durable selection comment from a comment-mode native replica. Read the
1066
+ # projection first and use its exact paragraph/text IDs, anchor text, and UTF-16
1067
+ # offsets. The author must match the authenticated actor display name.
1068
+ cargo run -p a3s-office-cli -- collab join .a3s/report-review.replica \
1069
+ --artifact-id report --kind document --actor-id agent-7 \
1070
+ --actor-kind agent --mode comment --operation-id comment-join-1 \
1071
+ --input browser.update --json
1072
+ cargo run -p a3s-office-cli -- collab read .a3s/report-review.replica --json
1073
+ cargo run -p a3s-office-cli -- collab mutate .a3s/report-review.replica \
1074
+ --artifact-id report --kind document --actor-id agent-7 --mode comment \
1075
+ --operation-id comment-45 \
1076
+ --mutation '{"type":"document-comment-create","commentId":"comment-1","paragraphId":"00000001","expectedTextId":"00000002","startUtf16":6,"endUtf16":12,"expectedText":"review","author":"Ada Reviewer","createdAt":"2026-08-17T00:00:00.000Z","text":"Clarify this review point."}' --json
1077
+
1049
1078
  # Recursively patch one Spreadsheet cell after matching the observed value.
1050
1079
  # Zero-based row/column coordinates follow the browser collaboration model.
1051
1080
  cargo run -p a3s-office-cli -- collab mutate .a3s/plan.replica \
@@ -1118,8 +1147,10 @@ suppression, without opening its own network provider. Native Rust `project`,
1118
1147
  `collab read`, and `office_collaboration_read` return the exact canonical
1119
1148
  Markdown source or an Office-owned bounded Document projection with stable
1120
1149
  paragraph/text identities, structural ancestry, option fields, subordinate
1121
- plain text, and the current state vector. Product hosts therefore do not need
1122
- to interpret Office's private Yjs schema. Typed Markdown
1150
+ plain text, durable comments, replies, resolution and detached state, exact
1151
+ paragraph-local UTF-16 anchors, and the current state vector. Projection schema
1152
+ version 2 is the contract for these review fields. Product hosts therefore do
1153
+ not need to interpret Office's private Yjs schema. Typed Markdown
1123
1154
  replace/splice operations use browser UTF-16 offsets. Document mutations edit
1124
1155
  ProseMirror `Y.XmlText` in place, rotate the affected Word `textId`, replace one
1125
1156
  stable plain paragraph only after its `paragraphId`, `textId`, and complete
@@ -1164,6 +1195,17 @@ targets, or a second final decision. None of these paths puts source or
1164
1195
  signature bytes in Yjs. Validated browser source origins survive native
1165
1196
  persistence and are re-emitted separately from host delivery IDs.
1166
1197
 
1198
+ Document review mutations use `document-comment-create`,
1199
+ `document-comment-reply`, `document-comment-set-resolved`, and
1200
+ `document-comment-delete`. Create validates an exact paragraph/text identity,
1201
+ UTF-16 range, and selected text before writing both the thread and its
1202
+ `documentComment` mark. Replies append to the stable thread; resolution can be
1203
+ set or cleared; and `comment` mode can delete only records attributed to its
1204
+ own actor. Removing selected text through a separately authorized edit keeps
1205
+ the thread as a detached review record. Browser and native comment changes
1206
+ share immutable claims and remain isolated from another participant's undo
1207
+ history.
1208
+
1167
1209
  Read the [native engine design](docs/latest/en/native-office-engine.md), the
1168
1210
  complete [CLI reference](docs/latest/en/cli-reference.md), or the published
1169
1211
  [CLI and Skill guide](https://a3s-lab.github.io/Office/docs/automation/).
@@ -1227,6 +1269,8 @@ without hard-coded return URLs.
1227
1269
 
1228
1270
  - [Live Playground](https://a3s-lab.github.io/Office/)
1229
1271
  - [Documentation center](https://a3s-lab.github.io/Office/docs/)
1272
+ - [A3S Office 0.8.0 documentation](https://a3s-lab.github.io/Office/docs/0.8.0/)
1273
+ - [A3S Office 0.7.3 documentation](https://a3s-lab.github.io/Office/docs/0.7.3/)
1230
1274
  - [A3S Office 0.7.2 documentation](https://a3s-lab.github.io/Office/docs/0.7.2/)
1231
1275
  - [A3S Office 0.7.1 documentation](https://a3s-lab.github.io/Office/docs/0.7.1/)
1232
1276
  - [A3S Office 0.7.0 documentation](https://a3s-lab.github.io/Office/docs/0.7.0/)