Skip to main content

lean_ctx/http_server/team/
state.rs

1#[allow(clippy::wildcard_imports)]
2use super::*;
3
4#[derive(Clone)]
5pub(super) struct TeamAuthContext {
6    pub(super) token_id: String,
7    pub(super) scopes: BTreeSet<TeamScope>,
8}
9
10#[derive(Clone)]
11pub struct TeamRequestContext {
12    pub workspace_id: String,
13}
14
15#[derive(Clone)]
16pub struct TeamState {
17    pub(super) auth: Arc<Vec<TeamTokenConfig>>,
18    pub(super) engine: Arc<TeamContextEngine>,
19    pub(super) audit: Arc<tokio::sync::Mutex<tokio::fs::File>>,
20    pub savings_store_dir: Arc<tokio::sync::Mutex<std::path::PathBuf>>,
21    /// Measurement roots for the billing-plane storage report (GL #463).
22    pub storage_roots: crate::http_server::team_billing::StorageRoots,
23    /// 60 s cache for the measured storage report.
24    pub storage_cache: Arc<tokio::sync::Mutex<crate::http_server::team_billing::StorageCache>>,
25    /// Configured managed connectors (#281), secret-bearing — never serialized
26    /// back out; [`connectors::v1_connectors`] exposes a secret-free view.
27    pub connectors: Arc<Vec<connectors::ConnectorConfig>>,
28    /// Directory holding each connector's persisted run state (one file per id).
29    pub connectors_state_dir: Arc<std::path::PathBuf>,
30}
31
32#[derive(Clone)]
33pub struct TeamAppState {
34    pub(super) concurrency: Arc<tokio::sync::Semaphore>,
35    pub(super) rate: Arc<crate::http_server::RateLimiter>,
36    pub(super) timeout: Duration,
37    pub team: Arc<TeamState>,
38    pub(super) max_body_bytes: usize,
39}
40
41#[derive(Debug, Deserialize)]
42#[serde(rename_all = "camelCase")]
43pub(super) struct ToolCallBody {
44    pub(super) name: String,
45    #[serde(default)]
46    pub(super) arguments: Option<Value>,
47    #[serde(default)]
48    pub(super) workspace_id: Option<String>,
49    #[serde(default)]
50    pub(super) channel_id: Option<String>,
51}
52
53#[derive(Debug, Deserialize)]
54#[serde(rename_all = "camelCase")]
55pub(super) struct ToolsQuery {
56    #[serde(default)]
57    pub(super) offset: Option<usize>,
58    #[serde(default)]
59    pub(super) limit: Option<usize>,
60}
61
62#[derive(Debug, Deserialize)]
63#[serde(rename_all = "camelCase")]
64pub(super) struct EventsQuery {
65    #[serde(default)]
66    pub(super) since: Option<i64>,
67    #[serde(default)]
68    pub(super) limit: Option<usize>,
69    #[serde(default)]
70    pub(super) channel_id: Option<String>,
71}