Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

style: cargo fmt screenpipe-engine

Louis Beaumont33027f9d55ff
diff --git a/crates/screenpipe-engine/src/cli/mod.rs b/crates/screenpipe-engine/src/cli/mod.rs
index a30ad1c18..08a8d5e36 100644
--- a/crates/screenpipe-engine/src/cli/mod.rs
+++ b/crates/screenpipe-engine/src/cli/mod.rs
@@ -16,9 +16,9 @@ pub mod presets;
pub mod search;
pub mod status;
mod store_file;
-pub mod team;
pub mod survey;
pub mod sync;
+pub mod team;
pub mod vault;
pub mod vision;
diff --git a/crates/screenpipe-engine/src/cli/search.rs b/crates/screenpipe-engine/src/cli/search.rs
index 914214054..1bfd0dda0 100644
--- a/crates/screenpipe-engine/src/cli/search.rs
+++ b/crates/screenpipe-engine/src/cli/search.rs
@@ -38,9 +38,8 @@ pub async fn handle_search_command(args: &SearchArgs) -> anyhow::Result<()> {
);
}
- let content_type = parse_content_type(&args.content_type).map_err(|e| {
- anyhow::anyhow!("invalid --content-type '{}': {}", args.content_type, e)
- })?;
+ let content_type = parse_content_type(&args.content_type)
+ .map_err(|e| anyhow::anyhow!("invalid --content-type '{}': {}", args.content_type, e))?;
let start = parse_time_opt(args.start.as_deref(), "--start")?;
let end = parse_time_opt(args.end.as_deref(), "--end")?;
diff --git a/crates/screenpipe-engine/src/cli/team.rs b/crates/screenpipe-engine/src/cli/team.rs
index a57b9da15..0450bcba6 100644
--- a/crates/screenpipe-engine/src/cli/team.rs
+++ b/crates/screenpipe-engine/src/cli/team.rs
@@ -84,10 +84,10 @@ fn read_token_from_enterprise_json() -> anyhow::Result<String> {
if !path.exists() {
anyhow::bail!("{TOKEN_HELP}");
}
- let raw = std::fs::read_to_string(&path)
- .with_context(|| format!("reading {}", path.display()))?;
- let parsed: Value = serde_json::from_str(&raw)
- .with_context(|| format!("parsing {}", path.display()))?;
+ let raw =
+ std::fs::read_to_string(&path).with_context(|| format!("reading {}", path.display()))?;
+ let parsed: Value =
+ serde_json::from_str(&raw).with_context(|| format!("parsing {}", path.display()))?;
let tok = parsed
.get("team_api_token")
.and_then(|v| v.as_str())
@@ -112,17 +112,20 @@ async fn search(
env: &TeamEnv,
args: &TeamSearchArgs,
) -> anyhow::Result<()> {
- let mut params: Vec<(&str, String)> = vec![
- ("q", args.query.clone()),
- ("limit", args.limit.to_string()),
- ];
+ let mut params: Vec<(&str, String)> =
+ vec![("q", args.query.clone()), ("limit", args.limit.to_string())];
if let Some(d) = &args.device_id {
params.push(("device_id", d.clone()));
}
if let Some(a) = &args.app {
params.push(("app_name", a.clone()));
}
- push_time_params(&mut params, args.since.as_deref(), args.start.as_deref(), args.end.as_deref())?;
+ push_time_params(
+ &mut params,
+ args.since.as_deref(),
+ args.start.as_deref(),
+ args.end.as_deref(),
+ )?;
let url = format!("{}/api/enterprise/v1/search", env.base_url);
let body = get_json(client, &env.token, &url, &params).await?;
@@ -157,7 +160,12 @@ async fn records(
("kind", args.kind.clone()),
("limit", args.limit.to_string()),
];
- push_time_params(&mut params, args.since.as_deref(), args.start.as_deref(), args.end.as_deref())?;
+ push_time_params(
+ &mut params,
+ args.since.as_deref(),
+ args.start.as_deref(),
+ args.end.as_deref(),
+ )?;
let url = format!("{}/api/enterprise/v1/records", env.base_url);
let body = get_json(client, &env.token, &url, &params).await?;
@@ -178,8 +186,9 @@ fn push_time_params(
anyhow::bail!("--since and --start are mutually exclusive");
}
if let Some(d) = since {
- let dur = parse_duration(d)
- .ok_or_else(|| anyhow::anyhow!("invalid --since '{}': expected `30m`, `4h`, `2d`, `1w`", d))?;
+ let dur = parse_duration(d).ok_or_else(|| {
+ anyhow::anyhow!("invalid --since '{}': expected `30m`, `4h`, `2d`, `1w`", d)
+ })?;
let ts = (Utc::now() - dur).to_rfc3339();
params.push(("since", ts));
}
@@ -195,8 +204,12 @@ fn push_time_params(
}
fn parse_iso(s: &str) -> Result<DateTime<Utc>, String> {
- s.parse::<DateTime<Utc>>()
- .map_err(|_| format!("invalid ISO 8601 timestamp '{}' — expected e.g. 2026-01-15T10:00:00Z", s))
+ s.parse::<DateTime<Utc>>().map_err(|_| {
+ format!(
+ "invalid ISO 8601 timestamp '{}' — expected e.g. 2026-01-15T10:00:00Z",
+ s
+ )
+ })
}
/// Parse `30m`, `4h`, `2d`, `1w` into a `chrono::Duration`. Returns None on
@@ -242,13 +255,19 @@ async fn get_json(
// Map known failure modes to actionable messages.
let hint = match status {
- StatusCode::UNAUTHORIZED => "token is invalid, expired, or revoked. \
- Re-mint at https://screenpi.pe/enterprise?tab=tokens.",
- StatusCode::FORBIDDEN => "token is missing a required scope. \
- Re-mint with `read:devices`, `read:search`, `read:records`.",
+ StatusCode::UNAUTHORIZED => {
+ "token is invalid, expired, or revoked. \
+ Re-mint at https://screenpi.pe/enterprise?tab=tokens."
+ }
+ StatusCode::FORBIDDEN => {
+ "token is missing a required scope. \
+ Re-mint with `read:devices`, `read:search`, `read:records`."
+ }
StatusCode::PAYMENT_REQUIRED => "team plan required for this endpoint.",
- StatusCode::TOO_MANY_REQUESTS => "rate limited — narrow your query \
- (`--since`, `--app`) or retry shortly.",
+ StatusCode::TOO_MANY_REQUESTS => {
+ "rate limited — narrow your query \
+ (`--since`, `--app`) or retry shortly."
+ }
_ => "",
};
let server_msg = trim(&text);
diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rs
index 129568246..1ba7161e8 100644
--- a/crates/screenpipe-engine/src/connections_api.rs
+++ b/crates/screenpipe-engine/src/connections_api.rs
@@ -853,8 +853,7 @@ async fn gmail_json_or_upstream(resp: reqwest::Response) -> anyhow::Result<Value
/// return, forwarding the upstream Gmail status when present.
fn gmail_err(e: anyhow::Error) -> (StatusCode, Json<Value>) {
if let Some(up) = e.downcast_ref::<GmailUpstreamError>() {
- let status = StatusCode::from_u16(up.status.as_u16())
- .unwrap_or(StatusCode::BAD_GATEWAY);
+ let status = StatusCode::from_u16(up.status.as_u16()).unwrap_or(StatusCode::BAD_GATEWAY);
return (
status,
Json(json!({
diff --git a/crates/screenpipe-engine/src/meeting_detector.rs b/crates/screenpipe-engine/src/meeting_detector.rs
index 39c6ba7b7..d9b8332c4 100644
--- a/crates/screenpipe-engine/src/meeting_detector.rs
+++ b/crates/screenpipe-engine/src/meeting_detector.rs
@@ -3383,7 +3383,6 @@ mod tests {
}
}
-
// ── State machine tests ────────────────────────────────────────────
fn make_scan_result(app: &str, in_call: bool, signals: usize) -> ScanResult {