Skip to main content

muse_code_sdk/msp/method/lifecycle/
session_list.rs

1// @generated from the MSP stable schema and protocol sources; do not edit by hand.
2
3use crate::msp::method::session::Session;
4use serde::Deserialize;
5use serde::Serialize;
6
7/// `session/list` params. Read-only; never touches leases.
8#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
9#[serde(rename_all = "camelCase")]
10pub struct SessionListParams {
11    /// Opaque page cursor from a prior result. Page cursors are a distinct
12    /// opaque-string family from view cursors and stream cursors, valid only
13    /// for re-issuing the same listing. Omitted and explicit `null` both mean
14    /// "first page".
15    #[serde(skip_serializing_if = "Option::is_none")]
16    pub cursor: Option<String>,
17    /// Page size; default 50, max 200 — the schema publishes the cap.
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub limit: Option<u32>,
20    /// Only sessions whose metadata workspace root equals this path.
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub workspace_root: Option<String>,
23    /// Only sessions with log activity after this RFC3339 instant.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub updated_after: Option<String>,
26    /// Optional structured selection applied inside the bounded index query
27    /// before paging. Present — including `{}` — makes a supporting server echo
28    /// its canonical form as `appliedFilter`; omitted keeps the earlier
29    /// behavior.
30    #[serde(skip_serializing_if = "Option::is_none")]
31    pub filter: Option<SessionListFilter>,
32}
33
34/// `session/list` result. The default order is content activity:
35/// `lastActivityAt` descending, then `sessionId` ascending. The order is the
36/// session index's key, so a row's displayed timestamps do not always show its
37/// position: a row the index has not yet derived keeps its `updatedAt`
38/// position, a derived row with no content orders by `createdAt`, and a loaded
39/// row can show newer values. Do not re-sort or validate a page from them.
40/// `updatedAfter` still filters on `updatedAt`.
41#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
42#[serde(rename_all = "camelCase")]
43#[non_exhaustive]
44pub struct SessionListResult {
45    /// The page of stored sessions.
46    pub sessions: Vec<Session>,
47    /// The next page's cursor; `null` on the last page.
48    pub next_cursor: Option<String>,
49    /// The canonical filter the server applied, present exactly when the
50    /// request carried `filter`. The probe is per-predicate PRESENCE: a client
51    /// that requires filtering checks that every predicate it sent comes back
52    /// as a member here, and treats a missing member as unsupported. Value
53    /// equality is the wrong test — canonicalization trims, lowercases,
54    /// NFC-normalizes, dedupes and sorts, so the echoed values often differ
55    /// from the sent ones on a correctly filtered page.
56    #[serde(skip_serializing_if = "Option::is_none")]
57    pub applied_filter: Option<SessionListFilter>,
58}
59
60/// The `session/list` filter. Members are ANDed with each other and with the
61/// top-level `workspaceRoot` and `updatedAfter`; values inside each `anyOf` are
62/// ORed. The canonical form the server echoes deduplicates and sorts every set,
63/// spells session IDs as canonical UUIDs, lowercases text terms, and orders
64/// `text.fields` `name` then `title`.
65#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
66#[serde(rename_all = "camelCase")]
67pub struct SessionListFilter {
68    /// Only sessions whose ID is one of these.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub session_id: Option<SessionListSessionIdFilter>,
71    /// Only sessions whose branch is one of these.
72    #[serde(skip_serializing_if = "Option::is_none")]
73    pub branch: Option<SessionListBranchFilter>,
74    /// Only sessions whose served name or title matches these token prefixes.
75    #[serde(skip_serializing_if = "Option::is_none")]
76    pub text: Option<SessionListTextFilter>,
77}
78
79/// Exact session-ID selection.
80#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
81#[serde(rename_all = "camelCase")]
82pub struct SessionListSessionIdFilter {
83    /// 1–200 session UUIDs, counted before deduplication.
84    pub any_of: Vec<String>,
85}
86
87/// Exact branch selection.
88#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
89#[serde(rename_all = "camelCase")]
90pub struct SessionListBranchFilter {
91    /// 1–32 nonempty branch names, each 1–256 UTF-8 bytes, counted before
92    /// deduplication; `null` selects sessions with no branch.
93    pub any_of: Vec<Option<String>>,
94}
95
96/// Name/title token-prefix search. Each term is trimmed, lowercased with
97/// ordinary Unicode lowercase, then NFC- normalized, and matches the beginning
98/// of an alphanumeric token, accent-sensitively (`check` matches `Checkout`;
99/// `eck` does not). NFC means a decomposed and a precomposed spelling of one
100/// term are the same term, and the echo returns the composed form. Matching
101/// never reorders rows.
102#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
103#[serde(rename_all = "camelCase")]
104pub struct SessionListTextFilter {
105    /// The 1–2 unique served fields searched.
106    pub fields: Vec<SessionListTextField>,
107    /// Every term must match at least one selected field.
108    #[serde(skip_serializing_if = "Option::is_none")]
109    pub all_of: Option<Vec<String>>,
110    /// At least one term must match a selected field. `allOf` plus `anyOf`
111    /// carry 1–16 terms in total, each 1–128 UTF-8 bytes in its canonical
112    /// form (trimmed, lowercased, NFC) — the bytes `appliedFilter` echoes.
113    /// Lowercasing and NFC can both lengthen a term, so a term inside the
114    /// bound raw may still exceed it canonically.
115    #[serde(skip_serializing_if = "Option::is_none")]
116    pub any_of: Option<Vec<String>>,
117}
118
119/// A served session field `session/list` text search reads. The client selects
120/// it, so the set is closed.
121#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
122#[serde(rename_all = "camelCase")]
123pub enum SessionListTextField {
124    /// The session's current served `name`.
125    Name,
126    /// The session's current served `title`.
127    Title,
128}