Session types in TypeScript
31 types generated from the session contract: this is the shape requests and responses take over the connection to the Rust core.
The types are generated from the session contract — your code uses them to build requests and parse responses. Command names are listed in session commands.
SessionCommandName
Section titled “SessionCommandName”type SessionCommandName = | "apply-composition" | "apply-text-transaction" | "commit-snapshot" | "commit-structural-snapshot" | "compatibility-inspect" | "compose" | "model" | "mutate" | "open" | "paginate" | "ping" | "print" | "print-delta" | "print-summary" | "print-window" | "redo" | "report" | "review" | "save" | "save-checkpoint" | "set-selection" | "shutdown" | "simple-field-inventory" | "squash-history" | "status" | "style" | "track-revisions-state" | "undo";SessionApplyCompositionRequest
Section titled “SessionApplyCompositionRequest”interface SessionApplyCompositionRequest {cmd: "apply-composition";id?: unknown;request: unknown;}SessionApplyTextTransactionRequest
Section titled “SessionApplyTextTransactionRequest”interface SessionApplyTextTransactionRequest {cmd: "apply-text-transaction";id?: unknown;request: unknown;}SessionCommitSnapshotRequest
Section titled “SessionCommitSnapshotRequest”interface SessionCommitSnapshotRequest {cmd: "commit-snapshot";id?: unknown;document_id: string;path: string;transaction_order: number;transition_kind: string;}SessionCommitStructuralSnapshotRequest
Section titled “SessionCommitStructuralSnapshotRequest”interface SessionCommitStructuralSnapshotRequest {cmd: "commit-structural-snapshot";id?: unknown;path: string;request: unknown;}SessionCompatibilityInspectRequest
Section titled “SessionCompatibilityInspectRequest”interface SessionCompatibilityInspectRequest {cmd: "compatibility-inspect";id?: unknown;}SessionComposeRequest
Section titled “SessionComposeRequest”interface SessionComposeRequest {cmd: "compose";id?: unknown;}SessionModelRequest
Section titled “SessionModelRequest”interface SessionModelRequest {cmd: "model";id?: unknown;}SessionMutateRequest
Section titled “SessionMutateRequest”interface SessionMutateRequest {cmd: "mutate";id?: unknown;after_caret_slot_index?: number | null;before_caret_slot_index?: number | null;before_selection_end_slot_index?: number | null;before_selection_start_slot_index?: number | null;delete_count?: number;document_id?: string | null;offset?: number;operation_kind: string;paragraph_index: number;revision_author?: string | null;revision_date?: string | null;revision_date_utc?: string | null;text?: string | null;transaction_order?: number;transition_kind?: string | null;}SessionOpenRequest
Section titled “SessionOpenRequest”interface SessionOpenRequest {cmd: "open";id?: unknown;document_id?: string | null;path: string;}SessionPaginateRequest
Section titled “SessionPaginateRequest”interface SessionPaginateRequest {cmd: "paginate";id?: unknown;}SessionPingRequest
Section titled “SessionPingRequest”interface SessionPingRequest {cmd: "ping";id?: unknown;}SessionPrintRequest
Section titled “SessionPrintRequest”interface SessionPrintRequest {cmd: "print";id?: unknown;tracked_change_markup_mode?: string | null;}SessionPrintDeltaRequest
Section titled “SessionPrintDeltaRequest”interface SessionPrintDeltaRequest {cmd: "print-delta";id?: unknown;known_fingerprints?: unknown[];tracked_change_markup_mode?: string | null;}SessionPrintSummaryRequest
Section titled “SessionPrintSummaryRequest”interface SessionPrintSummaryRequest {cmd: "print-summary";id?: unknown;}SessionPrintWindowRequest
Section titled “SessionPrintWindowRequest”interface SessionPrintWindowRequest {cmd: "print-window";id?: unknown;include_page_stack?: boolean;page_indexes: unknown[];}SessionRedoRequest
Section titled “SessionRedoRequest”interface SessionRedoRequest {cmd: "redo";id?: unknown;document_id?: string | null;transaction_order?: number;}SessionReportRequest
Section titled “SessionReportRequest”interface SessionReportRequest {cmd: "report";id?: unknown;}SessionReviewRequest
Section titled “SessionReviewRequest”interface SessionReviewRequest {cmd: "review";id?: unknown;}SessionSaveRequest
Section titled “SessionSaveRequest”interface SessionSaveRequest {cmd: "save";id?: unknown;path?: string | null;}SessionSaveCheckpointRequest
Section titled “SessionSaveCheckpointRequest”interface SessionSaveCheckpointRequest {cmd: "save-checkpoint";id?: unknown;expected_revision: number;request_id: string;session_id: string;target: unknown;}SessionSetSelectionRequest
Section titled “SessionSetSelectionRequest”interface SessionSetSelectionRequest {cmd: "set-selection";id?: unknown;request: unknown;}SessionShutdownRequest
Section titled “SessionShutdownRequest”interface SessionShutdownRequest {cmd: "shutdown";id?: unknown;}SessionSimpleFieldInventoryRequest
Section titled “SessionSimpleFieldInventoryRequest”interface SessionSimpleFieldInventoryRequest {cmd: "simple-field-inventory";id?: unknown;}SessionSquashHistoryRequest
Section titled “SessionSquashHistoryRequest”interface SessionSquashHistoryRequest {cmd: "squash-history";id?: unknown;base_undo_depth: number;document_id: string;transition_kind?: string | null;}SessionStatusRequest
Section titled “SessionStatusRequest”interface SessionStatusRequest {cmd: "status";id?: unknown;}SessionStyleRequest
Section titled “SessionStyleRequest”interface SessionStyleRequest {cmd: "style";id?: unknown;}SessionTrackRevisionsStateRequest
Section titled “SessionTrackRevisionsStateRequest”interface SessionTrackRevisionsStateRequest {cmd: "track-revisions-state";id?: unknown;}SessionUndoRequest
Section titled “SessionUndoRequest”interface SessionUndoRequest {cmd: "undo";id?: unknown;document_id?: string | null;transaction_order?: number;}SessionRequest
Section titled “SessionRequest”type SessionRequest = SessionApplyCompositionRequest | SessionApplyTextTransactionRequest | SessionCommitSnapshotRequest | SessionCommitStructuralSnapshotRequest | SessionCompatibilityInspectRequest | SessionComposeRequest | SessionModelRequest | SessionMutateRequest | SessionOpenRequest | SessionPaginateRequest | SessionPingRequest | SessionPrintRequest | SessionPrintDeltaRequest | SessionPrintSummaryRequest | SessionPrintWindowRequest | SessionRedoRequest | SessionReportRequest | SessionReviewRequest | SessionSaveRequest | SessionSaveCheckpointRequest | SessionSetSelectionRequest | SessionShutdownRequest | SessionSimpleFieldInventoryRequest | SessionSquashHistoryRequest | SessionStatusRequest | SessionStyleRequest | SessionTrackRevisionsStateRequest | SessionUndoRequest;SessionResponse
Section titled “SessionResponse”interface SessionResponse {cmd?: string;elapsed_ms?: number;error?: string;id?: unknown;ok?: boolean;result?: unknown;}