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