Skip to main content

systemprompt_models/documents/
collab_events.rs

1//! The live-session events: an engine update, and a checkpoint that saved
2//! less than the live document holds.
3//!
4//! Copyright (c) systemprompt.io — Business Source License 1.1.
5//! See <https://systemprompt.io> for licensing details.
6
7use schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
9use systemprompt_identifiers::{DocumentEditSessionId, DocumentId, UserId};
10
11#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
12pub struct DocumentCollabUpdateEvent {
13    pub document_id: DocumentId,
14    pub edit_session_id: DocumentEditSessionId,
15    pub seq: i64,
16    pub update_b64: String,
17    pub author_id: UserId,
18}
19
20impl DocumentCollabUpdateEvent {
21    pub const NAME: &'static str = "document.collab.update";
22}
23
24/// A checkpoint saved placeholders for `images`: uploaded images no
25/// inserting editor of the session may place. The live document still
26/// holds them, so a later checkpoint saves them once they are admitted.
27#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
28pub struct DocumentCollabDegradedEvent {
29    pub document_id: DocumentId,
30    pub edit_session_id: DocumentEditSessionId,
31    pub images: Vec<String>,
32}
33
34impl DocumentCollabDegradedEvent {
35    pub const NAME: &'static str = "document.collab.degraded";
36}