Rust Session Protocol — 28 команд
Полный перечень команд документного сеанса: параметры, предусловия и результат каждой из 28 команд.
| Поле | Команды | Что принимает |
|---|---|---|
tracked_change_markup_mode |
print, print-delta |
in-line — исправления показываются в тексте, это значение по умолчанию; balloon — выносками на полях. Режим относится к показу сцены, а не к самому документу. |
page_indexes |
print-window |
Номера страниц, сцены которых нужно построить. Нумерация с нуля. |
include_page_stack |
print-window |
Добавить в ответ геометрию страниц и краткие данные навигации. Нужно при первом открытии документа. |
known_fingerprints |
print-delta |
Отпечатки сцен, которые у клиента уже есть, по номерам страниц. Ядро вернёт только изменившееся. |
id |
все | Метка запроса, выбранная клиентом. Возвращается без изменений — по ней ответ сопоставляется с запросом. |
| ::: |
| cmd | изм. | params | предусловие | result |
|---|---|---|---|---|
| apply-composition | да | request: json (required) | open | CompositionReceipt |
| apply-text-transaction | да | request: json (required) | open | AcceptedEditTerminal { dirty, receipt, model_delta, model_projection_patch, owner_state, typing_attributes } |
| commit-snapshot | да | document_id: string (required); path: string (required); transaction_order: integer (required); transition_kind: string (required) | open | legacy commit/history receipt |
| commit-structural-snapshot | да | path: string (required); request: json (required) | open | structural edit terminal/receipt |
| compatibility-inspect | нет | — | open | fastdoc.docx-compatibility-command.v1 |
| compose | нет | — | open | ParagraphCompositionSnapshot[] |
| model | нет | — | open | CanonicalDocument |
| mutate | да | after_caret_slot_index: integer-or-null (optional); before_caret_slot_index: integer-or-null (optional); before_selection_end_slot_index: integer-or-null (optional); before_selection_start_slot_index: integer-or-null (optional); delete_count: integer (optional, default=0); document_id: string-or-null (optional); offset: integer (optional, default=0); operation_kind: string (required); paragraph_index: integer (required); revision_author: string-or-null (optional); revision_date: string-or-null (optional); revision_date_utc: string-or-null (optional); text: string-or-null (optional); transaction_order: integer (optional, default=0); transition_kind: string-or-null (optional) | open | { mutation: BodyTextMutationSnapshot, mutation_count, history } |
| open | да | document_id: string-or-null (optional); path: string (required) | нет | { opened, byte_count, digital_signature_present, session_id, document_id, revision, accepted_revision, dirty, history, open_stage_timings_ms } |
| paginate | нет | — | open | PaginationSnapshot |
| ping | нет | — | нет | { pong: true } |
| нет | tracked_change_markup_mode: string-or-null (optional) | open | PrintParitySnapshot | |
| print-delta | нет | known_fingerprints: json-array (optional); tracked_change_markup_mode: string-or-null (optional) | open | snapshot metadata + changed_pages[] + unchanged_page_indexes[] |
| print-summary | нет | — | open | { page_count, line_item_count, scene_fingerprints[] } |
| print-window | нет | include_page_stack: boolean (optional); page_indexes: json-array (required) | open | Print window + materialized pages; optional page_stack/windowed model |
| redo | да | document_id: string-or-null (optional); transaction_order: integer (optional, default=0) | open | history + transition + redone=true + receipt |
| report | нет | — | open | SupportReport |
| review | нет | — | open | ReviewSnapshot |
| save | да | path: string-or-null (optional) | open | { saved, saved_document_itself?, byte_count, history_preserved, history } |
| save-checkpoint | да | expected_revision: integer (required); request_id: string (required); session_id: string (required); target: json (required) | open | fastdoc.persistent-save-checkpoint-receipt.v1 |
| set-selection | да | request: json (required) | open | SelectionUpdateReceipt |
| shutdown | да | — | нет | { id, ok:true, shutdown:true } |
| simple-field-inventory | нет | — | open | SimpleFieldInventorySnapshot |
| squash-history | да | base_undo_depth: integer (required); document_id: string (required); transition_kind: string-or-null (optional) | open | history state |
| status | нет | — | open | session/path/cache/history/revision/dirty/model_hash state |
| style | нет | — | open | StyleSnapshot |
| track-revisions-state | нет | — | open | TrackRevisionsStateSnapshot |
| undo | да | document_id: string-or-null (optional); transaction_order: integer (optional, default=0) | open | history + transition + undone=true + receipt |
apply-composition
Заголовок раздела «apply-composition»Параметры: request: json (required)
Результат: CompositionReceipt
{ "id": "req-1", "cmd": "apply-composition", "request": { "...": "типы правки — см. «Типы типизированной правки»" }}Concurrency. expected_revision и expected_selection_revision обязательны; stale request отклоняется.
apply-text-transaction
Заголовок раздела «apply-text-transaction»Параметры: request: json (required)
Результат: AcceptedEditTerminal { dirty, receipt, model_delta, model_projection_patch, owner_state, typing_attributes }
{ "id": "req-1", "cmd": "apply-text-transaction", "request": { "...": "типы правки — см. «Типы типизированной правки»" }}Concurrency. expected_revision и expected_selection_revision обязательны; stale request отклоняется.
commit-snapshot
Заголовок раздела «commit-snapshot»Параметры: document_id: string (required); path: string (required); transaction_order: integer (required); transition_kind: string (required)
Результат: legacy commit/history receipt
{ "id": "req-1", "cmd": "commit-snapshot", "document_id": "document_id-1", "path": "/absolute/document.docx", "transaction_order": 1, "transition_kind": "transition_kind-1"}commit-structural-snapshot
Заголовок раздела «commit-structural-snapshot»Параметры: path: string (required); request: json (required)
Результат: structural edit terminal/receipt
{ "id": "req-1", "cmd": "commit-structural-snapshot", "path": "/absolute/document.docx", "request": { "...": "типы правки — см. «Типы типизированной правки»" }}compatibility-inspect
Заголовок раздела «compatibility-inspect»Параметры: —
Результат: fastdoc.docx-compatibility-command.v1
{ "id": "req-1", "cmd": "compatibility-inspect"}compose
Заголовок раздела «compose»Параметры: —
Результат: ParagraphCompositionSnapshot[]
{ "id": "req-1", "cmd": "compose"}Параметры: —
Результат: CanonicalDocument
{ "id": "req-1", "cmd": "model"}Параметры: after_caret_slot_index: integer-or-null (optional); before_caret_slot_index: integer-or-null (optional); before_selection_end_slot_index: integer-or-null (optional); before_selection_start_slot_index: integer-or-null (optional); delete_count: integer (optional, default=0); document_id: string-or-null (optional); offset: integer (optional, default=0); operation_kind: string (required); paragraph_index: integer (required); revision_author: string-or-null (optional); revision_date: string-or-null (optional); revision_date_utc: string-or-null (optional); text: string-or-null (optional); transaction_order: integer (optional, default=0); transition_kind: string-or-null (optional)
Результат: { mutation: BodyTextMutationSnapshot, mutation_count, history }
{ "id": "req-1", "cmd": "mutate", "operation_kind": "insert-text", "paragraph_index": 0}Единицы. offset/delete_count — Unicode scalar indexes. Для JS используйте Array.from(text).length, не string.length.
Параметры: document_id: string-or-null (optional); path: string (required)
Результат: { opened, byte_count, digital_signature_present, session_id, document_id, revision, accepted_revision, dirty, history, open_stage_timings_ms }
{ "id": "req-1", "cmd": "open", "path": "/absolute/document.docx"}paginate
Заголовок раздела «paginate»Параметры: —
Результат: PaginationSnapshot
{ "id": "req-1", "cmd": "paginate"}Параметры: —
Результат: { pong: true }
{ "id": "req-1", "cmd": "ping"}Параметры: tracked_change_markup_mode: string-or-null (optional)
Результат: PrintParitySnapshot
{ "id": "req-1", "cmd": "print"}print-delta
Заголовок раздела «print-delta»Параметры: known_fingerprints: json-array (optional); tracked_change_markup_mode: string-or-null (optional)
Результат: snapshot metadata + changed_pages[] + unchanged_page_indexes[]
{ "id": "req-1", "cmd": "print-delta"}print-summary
Заголовок раздела «print-summary»Параметры: —
Результат: { page_count, line_item_count, scene_fingerprints[] }
{ "id": "req-1", "cmd": "print-summary"}print-window
Заголовок раздела «print-window»Параметры: include_page_stack: boolean (optional); page_indexes: json-array (required)
Результат: Print window + materialized pages; optional page_stack/windowed model
{ "id": "req-1", "cmd": "print-window", "page_indexes": [ 0 ]}Параметры: document_id: string-or-null (optional); transaction_order: integer (optional, default=0)
Результат: history + transition + redone=true + receipt
{ "id": "req-1", "cmd": "redo"}Параметры: —
Результат: SupportReport
{ "id": "req-1", "cmd": "report"}Параметры: —
Результат: ReviewSnapshot
{ "id": "req-1", "cmd": "review"}Параметры: path: string-or-null (optional)
Результат: { saved, saved_document_itself?, byte_count, history_preserved, history }
{ "id": "req-1", "cmd": "save"}save-checkpoint
Заголовок раздела «save-checkpoint»Параметры: expected_revision: integer (required); request_id: string (required); session_id: string (required); target: json (required)
Результат: fastdoc.persistent-save-checkpoint-receipt.v1
{ "id": "req-1", "cmd": "save-checkpoint", "expected_revision": 1, "request_id": "request_id-1", "session_id": "session_id-1", "target": { "path": "/absolute/document.docx", "expected_hash": "sha256:..." }}set-selection
Заголовок раздела «set-selection»Параметры: request: json (required)
Результат: SelectionUpdateReceipt
{ "id": "req-1", "cmd": "set-selection", "request": { "...": "типы правки — см. «Типы типизированной правки»" }}Concurrency. expected_revision и expected_selection_revision обязательны; stale request отклоняется.
shutdown
Заголовок раздела «shutdown»Параметры: —
Результат: { id, ok:true, shutdown:true }
{ "id": "req-1", "cmd": "shutdown"}simple-field-inventory
Заголовок раздела «simple-field-inventory»Параметры: —
Результат: SimpleFieldInventorySnapshot
{ "id": "req-1", "cmd": "simple-field-inventory"}squash-history
Заголовок раздела «squash-history»Параметры: base_undo_depth: integer (required); document_id: string (required); transition_kind: string-or-null (optional)
Результат: history state
{ "id": "req-1", "cmd": "squash-history", "base_undo_depth": 1, "document_id": "document_id-1"}Параметры: —
Результат: session/path/cache/history/revision/dirty/model_hash state
{ "id": "req-1", "cmd": "status"}Параметры: —
Результат: StyleSnapshot
{ "id": "req-1", "cmd": "style"}track-revisions-state
Заголовок раздела «track-revisions-state»Параметры: —
Результат: TrackRevisionsStateSnapshot
{ "id": "req-1", "cmd": "track-revisions-state"}Параметры: document_id: string-or-null (optional); transaction_order: integer (optional, default=0)
Результат: history + transition + undone=true + receipt
{ "id": "req-1", "cmd": "undo"}