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. Ordering is `updatedAt` descending.
35#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
36#[serde(rename_all = "camelCase")]
37#[non_exhaustive]
38pub struct SessionListResult {
39    /// The page of stored sessions.
40    pub sessions: Vec<Session>,
41    /// The next page's cursor; `null` on the last page.
42    pub next_cursor: Option<String>,
43    /// The canonical filter the server applied, present exactly when the
44    /// request carried `filter`. The probe is per-predicate PRESENCE: a client
45    /// that requires filtering checks that every predicate it sent comes back
46    /// as a member here, and treats a missing member as unsupported. Value
47    /// equality is the wrong test — canonicalization trims, lowercases,
48    /// NFC-normalizes, dedupes and sorts, so the echoed values often differ
49    /// from the sent ones on a correctly filtered page.
50    #[serde(skip_serializing_if = "Option::is_none")]
51    pub applied_filter: Option<SessionListFilter>,
52}
53
54/// The `session/list` filter. Members are ANDed with each other and with the
55/// top-level `workspaceRoot` and `updatedAfter`; values inside each `anyOf` are
56/// ORed. The canonical form the server echoes deduplicates and sorts every set,
57/// spells session IDs as canonical UUIDs, lowercases text terms, and orders
58/// `text.fields` `name` then `title`.
59#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
60#[serde(rename_all = "camelCase")]
61pub struct SessionListFilter {
62    /// Only sessions whose ID is one of these.
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub session_id: Option<SessionListSessionIdFilter>,
65    /// Only sessions whose branch is one of these.
66    #[serde(skip_serializing_if = "Option::is_none")]
67    pub branch: Option<SessionListBranchFilter>,
68    /// Only sessions whose served name or title matches these token prefixes.
69    #[serde(skip_serializing_if = "Option::is_none")]
70    pub text: Option<SessionListTextFilter>,
71}
72
73/// Exact session-ID selection.
74#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
75#[serde(rename_all = "camelCase")]
76pub struct SessionListSessionIdFilter {
77    /// 1–200 session UUIDs, counted before deduplication.
78    pub any_of: Vec<String>,
79}
80
81/// Exact branch selection.
82#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
83#[serde(rename_all = "camelCase")]
84pub struct SessionListBranchFilter {
85    /// 1–32 nonempty branch names, each 1–256 UTF-8 bytes, counted before
86    /// deduplication; `null` selects sessions with no branch.
87    pub any_of: Vec<Option<String>>,
88}
89
90/// Name/title token-prefix search. Each term is trimmed, lowercased with
91/// ordinary Unicode lowercase, then NFC- normalized, and matches the beginning
92/// of an alphanumeric token, accent-sensitively (`check` matches `Checkout`;
93/// `eck` does not). NFC means a decomposed and a precomposed spelling of one
94/// term are the same term, and the echo returns the composed form. Matching
95/// never reorders rows.
96#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
97#[serde(rename_all = "camelCase")]
98pub struct SessionListTextFilter {
99    /// The 1–2 unique served fields searched.
100    pub fields: Vec<SessionListTextField>,
101    /// Every term must match at least one selected field.
102    #[serde(skip_serializing_if = "Option::is_none")]
103    pub all_of: Option<Vec<String>>,
104    /// At least one term must match a selected field. `allOf` plus `anyOf`
105    /// carry 1–16 terms in total, each 1–128 UTF-8 bytes in its canonical
106    /// form (trimmed, lowercased, NFC) — the bytes `appliedFilter` echoes.
107    /// Lowercasing and NFC can both lengthen a term, so a term inside the
108    /// bound raw may still exceed it canonically.
109    #[serde(skip_serializing_if = "Option::is_none")]
110    pub any_of: Option<Vec<String>>,
111}
112
113/// A served session field `session/list` text search reads. The client selects
114/// it, so the set is closed.
115#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
116#[serde(rename_all = "camelCase")]
117pub enum SessionListTextField {
118    /// The session's current served `name`.
119    Name,
120    /// The session's current served `title`.
121    Title,
122}