1use kindling_types::{CapsuleType, Id, Observation, ObservationInput, PinTargetType, ScopeIds};
8use serde::{Deserialize, Serialize};
9
10#[derive(Debug, Clone, Serialize)]
12#[serde(rename_all = "camelCase")]
13pub(crate) struct OpenCapsuleBody {
14 pub kind: CapsuleType,
15 pub intent: String,
16 pub scope_ids: ScopeIds,
17 #[serde(skip_serializing_if = "Option::is_none")]
18 pub id: Option<Id>,
19}
20
21#[derive(Debug, Clone, Default, Serialize)]
23#[serde(rename_all = "camelCase")]
24pub struct CloseCapsuleBody {
25 #[serde(skip_serializing_if = "Option::is_none")]
27 pub generate_summary: Option<bool>,
28 #[serde(skip_serializing_if = "Option::is_none")]
30 pub summary_content: Option<String>,
31 #[serde(skip_serializing_if = "Option::is_none")]
33 pub confidence: Option<f64>,
34}
35
36#[derive(Debug, Clone, Serialize)]
39#[serde(rename_all = "camelCase")]
40pub(crate) struct AppendObservationBody {
41 #[serde(flatten)]
42 pub input: ObservationInput,
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub capsule_id: Option<Id>,
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub validate: Option<bool>,
47}
48
49#[derive(Debug, Clone, Deserialize)]
53#[serde(rename_all = "camelCase")]
54pub(crate) struct AppendObservationResponseBody {
55 #[serde(flatten)]
56 pub observation: Observation,
57 #[serde(default)]
61 pub deduplicated: bool,
62}
63
64#[derive(Debug, Clone, Serialize)]
66#[serde(rename_all = "camelCase")]
67pub struct CreatePinBody {
68 pub target_type: PinTargetType,
70 pub target_id: Id,
72 #[serde(skip_serializing_if = "Option::is_none")]
74 pub note: Option<String>,
75 #[serde(skip_serializing_if = "Option::is_none")]
77 pub ttl_ms: Option<i64>,
78 #[serde(skip_serializing_if = "Option::is_none")]
80 pub scope_ids: Option<ScopeIds>,
81}
82
83impl CreatePinBody {
84 pub fn new(target_type: PinTargetType, target_id: impl Into<Id>) -> Self {
86 Self {
87 target_type,
88 target_id: target_id.into(),
89 note: None,
90 ttl_ms: None,
91 scope_ids: None,
92 }
93 }
94}
95
96#[derive(Debug, Clone, Serialize)]
100#[serde(rename_all = "camelCase")]
101pub(crate) struct SessionStartContextBody {
102 #[serde(skip_serializing_if = "Option::is_none")]
103 pub max_results: Option<u32>,
104 pub scope_ids: ScopeIds,
105}
106
107#[derive(Debug, Clone, Serialize)]
109#[serde(rename_all = "camelCase")]
110pub(crate) struct PreCompactContextBody {
111 pub scope_ids: ScopeIds,
112}