Перейти к содержимому
FastOffice

Rust Session Protocol — 28 команд

Полный перечень команд документной сессии: параметры, предусловия и результат каждой из 28 команд.

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 }
print нет 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

Параметры: request: json (required)

Результат: CompositionReceipt

{
"id": "req-1",
"cmd": "apply-composition",
"request": {
"...": "typed DTO; см. раздел 4"
}
}

Concurrency. expected_revision и expected_selection_revision обязательны; stale request отклоняется.

Параметры: request: json (required)

Результат: AcceptedEditTerminal { dirty, receipt, model_delta, model_projection_patch, owner_state, typing_attributes }

{
"id": "req-1",
"cmd": "apply-text-transaction",
"request": {
"...": "typed DTO; см. раздел 4"
}
}

Concurrency. expected_revision и expected_selection_revision обязательны; stale request отклоняется.

Параметры: 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"
}

Параметры: path: string (required); request: json (required)

Результат: structural edit terminal/receipt

{
"id": "req-1",
"cmd": "commit-structural-snapshot",
"path": "/absolute/document.docx",
"request": {
"...": "typed DTO; см. раздел 4"
}
}

Параметры: —

Результат: fastdoc.docx-compatibility-command.v1

{
"id": "req-1",
"cmd": "compatibility-inspect"
}

Параметры: —

Результат: 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"
}

Параметры: —

Результат: 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"
}

Параметры: 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"
}

Параметры: —

Результат: { page_count, line_item_count, scene_fingerprints[] }

{
"id": "req-1",
"cmd": "print-summary"
}

Параметры: 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"
}

Параметры: 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:..."
}
}

Параметры: request: json (required)

Результат: SelectionUpdateReceipt

{
"id": "req-1",
"cmd": "set-selection",
"request": {
"...": "typed DTO; см. раздел 4"
}
}

Concurrency. expected_revision и expected_selection_revision обязательны; stale request отклоняется.

Параметры: —

Результат: { id, ok:true, shutdown:true }

{
"id": "req-1",
"cmd": "shutdown"
}

Параметры: —

Результат: SimpleFieldInventorySnapshot

{
"id": "req-1",
"cmd": "simple-field-inventory"
}

Параметры: 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"
}

Параметры: —

Результат: 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"
}

Ассистент документации

Ответ собран из документации и может быть неточным — сверяйтесь с источниками.