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
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
Bump app to v2.4.145, Bump CLI to v0.3.316 — feat(connections,posthog): default host=us.posthog.com when blank — release-app release-cli
Louis Beaumont3be22ea6fae9
diff --git a/Cargo.lock b/Cargo.lockindex 111e4c5ba..888a3ef6d 100644--- a/Cargo.lock+++ b/Cargo.lock@@ -6899,7 +6899,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","audiopipe",@@ -6960,7 +6960,7 @@ dependencies = [[[package]]name = "screenpipe-audio-eval"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","clap",@@ -6975,7 +6975,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.315"+version = "0.3.316"dependencies = ["dirs 6.0.0","serde",@@ -6988,7 +6988,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","async-trait",@@ -7021,7 +7021,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.315"+version = "0.3.316"dependencies = ["accessibility","accessibility-sys",@@ -7069,7 +7069,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","chrono",@@ -7095,7 +7095,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","arc-swap",@@ -7168,7 +7168,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","chrono",@@ -7186,7 +7186,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.315"+version = "0.3.316"dependencies = ["accessibility-sys","anyhow",@@ -7244,7 +7244,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.315"+version = "0.3.316"dependencies = ["argon2","chacha20poly1305",diff --git a/Cargo.toml b/Cargo.tomlindex 1fb653577..6e6412488 100644--- a/Cargo.toml+++ b/Cargo.toml@@ -6,7 +6,7 @@ exclude = ["apps/screenpipe-app-tauri/src-tauri", "crates/screenpipe-integrationresolver = "2"[workspace.package]-version = "0.3.315"+version = "0.3.316"authors = ["louis030195 <[email protected]>"]description = ""repository = "https://github.com/screenpipe/screenpipe"diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock b/apps/screenpipe-app-tauri/src-tauri/Cargo.lockindex eddcc4346..1e03ad209 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.lock+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.lock@@ -9754,7 +9754,7 @@ dependencies = [[[package]]name = "screenpipe-app"-version = "2.4.144"+version = "2.4.145"dependencies = ["anyhow","arboard",@@ -9861,7 +9861,7 @@ dependencies = [[[package]]name = "screenpipe-audio"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","audiopipe",@@ -9917,7 +9917,7 @@ dependencies = [[[package]]name = "screenpipe-config"-version = "0.3.315"+version = "0.3.316"dependencies = ["dirs 6.0.0","serde",@@ -9929,7 +9929,7 @@ dependencies = [[[package]]name = "screenpipe-connect"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","async-trait",@@ -9962,7 +9962,7 @@ dependencies = [[[package]]name = "screenpipe-core"-version = "0.3.315"+version = "0.3.316"dependencies = ["accessibility","accessibility-sys",@@ -10010,7 +10010,7 @@ dependencies = [[[package]]name = "screenpipe-db"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","chrono",@@ -10035,7 +10035,7 @@ dependencies = [[[package]]name = "screenpipe-engine"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","arc-swap",@@ -10101,7 +10101,7 @@ dependencies = [[[package]]name = "screenpipe-events"-version = "0.3.315"+version = "0.3.316"dependencies = ["anyhow","chrono",@@ -10117,7 +10117,7 @@ dependencies = [[[package]]name = "screenpipe-screen"-version = "0.3.315"+version = "0.3.316"dependencies = ["accessibility-sys","anyhow",@@ -10170,7 +10170,7 @@ dependencies = [[[package]]name = "screenpipe-vault"-version = "0.3.315"+version = "0.3.316"dependencies = ["argon2","chacha20poly1305",diff --git a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml b/apps/screenpipe-app-tauri/src-tauri/Cargo.tomlindex 53b9c0b34..0efedb80c 100644--- a/apps/screenpipe-app-tauri/src-tauri/Cargo.toml+++ b/apps/screenpipe-app-tauri/src-tauri/Cargo.toml@@ -1,6 +1,6 @@[package]name = "screenpipe-app"-version = "2.4.144"+version = "2.4.145"description = "24/7 memory for your desktop. 100% local."authors = ["you"]license = ""diff --git a/crates/screenpipe-connect/src/connections/posthog.rs b/crates/screenpipe-connect/src/connections/posthog.rsindex a2f4fbc0e..f45ff5425 100644--- a/crates/screenpipe-connect/src/connections/posthog.rs+++ b/crates/screenpipe-connect/src/connections/posthog.rs@@ -13,7 +13,7 @@ static DEF: IntegrationDef = IntegrationDef {name: "PostHog",icon: "posthog",category: Category::Productivity,- description: "Query PostHog analytics — events, insights, cohorts, feature flags. Use the PostHog API at https://{host} with Authorization: Bearer <api_key>. Project-scoped endpoints: GET /api/projects/{project_id}/events/, POST /api/projects/{project_id}/query/. Org endpoints: GET /api/users/@me/.",+ description: "Query PostHog analytics — events, insights, cohorts, feature flags. Use the PostHog API with Authorization: Bearer <api_key>. Project-scoped endpoints: GET /api/projects/{project_id}/events/, POST /api/projects/{project_id}/query/. Org endpoints: GET /api/users/@me/.",fields: &[FieldDef {key: "api_key",@@ -31,7 +31,7 @@ static DEF: IntegrationDef = IntegrationDef {},FieldDef {key: "host",- label: "Host",+ label: "Host (leave blank for US Cloud)",secret: false,placeholder: "us.posthog.com",help_url: "https://posthog.com/docs/api#regions",@@ -39,6 +39,17 @@ static DEF: IntegrationDef = IntegrationDef {],};+const DEFAULT_HOST: &str = "us.posthog.com";++fn host_or_default(creds: &Map<String, Value>) -> &str {+ creds+ .get("host")+ .and_then(|v| v.as_str())+ .map(str::trim)+ .filter(|s| !s.is_empty())+ .unwrap_or(DEFAULT_HOST)+}+pub struct PostHog;#[async_trait]@@ -48,8 +59,10 @@ impl Integration for PostHog {}fn proxy_config(&self) -> Option<&'static ProxyConfig> {+ // {host|default} — blank field falls back to us.posthog.com so most+ // users never have to think about regions; EU / self-hosted override.static CFG: ProxyConfig = ProxyConfig {- base_url: "https://{host}",+ base_url: "https://{host|us.posthog.com}",auth: ProxyAuth::Bearer {credential_key: "api_key",},@@ -66,7 +79,7 @@ impl Integration for PostHog {) -> Result<String> {let api_key = require_str(creds, "api_key")?;let project_id = require_str(creds, "project_id")?;- let host = require_str(creds, "host")?;+ let host = host_or_default(creds);let resp: Value = client.get(format!("https://{}/api/projects/{}/",diff --git a/crates/screenpipe-engine/src/connections_api.rs b/crates/screenpipe-engine/src/connections_api.rsindex 48b19df41..74650db61 100644--- a/crates/screenpipe-engine/src/connections_api.rs+++ b/crates/screenpipe-engine/src/connections_api.rs@@ -1023,38 +1023,61 @@ fn resolve_base_url(creds: Option<&Map<String, Value>>,oauth_extras: Option<&Value>,) -> Result<String, String> {- let mut url = template.to_string();- if url.contains('{') {+ // Substitute placeholders of the form `{key}` or `{key|default}`. Empty+ // credential values are treated as missing so a blank "host" field falls+ // through to the integration's default rather than producing `https:///`.+ fn lookup<'a>(+ name: &str,+ creds: Option<&'a Map<String, Value>>,+ oauth_extras: Option<&'a Value>,+ ) -> Option<&'a str> {if let Some(c) = creds {- for (key, value) in c.iter() {- if let Some(s) = value.as_str() {- url = url.replace(&format!("{{{}}}", key), s);+ if let Some(s) = c.get(name).and_then(|v| v.as_str()) {+ if !s.is_empty() {+ return Some(s);}}}- if url.contains('{') {+ if !OAUTH_URL_SKIP_FIELDS.contains(&name) {if let Some(obj) = oauth_extras.and_then(|v| v.as_object()) {- for (key, value) in obj.iter() {- if OAUTH_URL_SKIP_FIELDS.contains(&key.as_str()) {- continue;- }- if let Some(s) = value.as_str() {- url = url.replace(&format!("{{{}}}", key), s);+ if let Some(s) = obj.get(name).and_then(|v| v.as_str()) {+ if !s.is_empty() {+ return Some(s);}}}}- // Check for unresolved placeholders- if let Some(start) = url.find('{') {- let end = url[start..].find('}').unwrap_or(0) + start + 1;- let field = &url[start..end];- return Err(format!(- "unresolved placeholder {} in base_url — credential field missing",- field- ));+ None+ }++ let mut out = String::with_capacity(template.len());+ let mut rest = template;+ while let Some(open) = rest.find('{') {+ out.push_str(&rest[..open]);+ let after_open = &rest[open + 1..];+ let close_rel = after_open+ .find('}')+ .ok_or_else(|| format!("unmatched '{{' in base_url: {}", template))?;+ let inner = &after_open[..close_rel];+ let (name, default) = match inner.split_once('|') {+ Some((n, d)) => (n, Some(d)),+ None => (inner, None),+ };+ let value = lookup(name, creds, oauth_extras).map(str::to_owned);+ match (value, default) {+ (Some(v), _) => out.push_str(&v),+ (None, Some(d)) => out.push_str(d),+ (None, None) => {+ return Err(format!(+ "unresolved placeholder {{{}}} in base_url — credential field missing",+ name+ ));+ }}+ rest = &after_open[close_rel + 1..];}- Ok(url)+ out.push_str(rest);+ Ok(out)}/// Resolve auth from proxy config + stored credentials/OAuth token.@@ -1901,6 +1924,29 @@ mod tests {assert!(result.unwrap_err().contains("{access_token}"));}+ #[test]+ fn test_resolve_base_url_default_used_when_field_missing() {+ let creds = Map::new();+ let result = resolve_base_url("https://{host|us.posthog.com}", Some(&creds), None);+ assert_eq!(result.unwrap(), "https://us.posthog.com");+ }++ #[test]+ fn test_resolve_base_url_default_used_when_field_empty() {+ let mut creds = Map::new();+ creds.insert("host".into(), json!(""));+ let result = resolve_base_url("https://{host|us.posthog.com}", Some(&creds), None);+ assert_eq!(result.unwrap(), "https://us.posthog.com");+ }++ #[test]+ fn test_resolve_base_url_default_overridden_by_value() {+ let mut creds = Map::new();+ creds.insert("host".into(), json!("eu.posthog.com"));+ let result = resolve_base_url("https://{host|us.posthog.com}", Some(&creds), None);+ assert_eq!(result.unwrap(), "https://eu.posthog.com");+ }+// -- resolve_auth -------------------------------------------------------#[test]