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
fix(acp): never offer Claude subscription sign-in, API key only (#5973)
Louis Beaumontbc47b7d27107
diff --git a/apps/screenpipe-app-tauri/lib/acp/agents.json b/apps/screenpipe-app-tauri/lib/acp/agents.jsonindex f2db705ea..def6ff843 100644--- a/apps/screenpipe-app-tauri/lib/acp/agents.json+++ b/apps/screenpipe-app-tauri/lib/acp/agents.json@@ -21,7 +21,11 @@"imageSrc": "/images/claude-ai.svg","presetName": "claude code","description": "Use your existing Claude Code account and configuration.",- "launch": { "kind": "npx", "package": "@agentclientprotocol/[email protected]", "args": [] }+ "launch": {+ "kind": "npx",+ "package": "@agentclientprotocol/[email protected]",+ "args": ["--hide-claude-auth"]+ }},{"id": "opencode",diff --git a/apps/screenpipe-app-tauri/src-tauri/src/acp_runtime.rs b/apps/screenpipe-app-tauri/src-tauri/src/acp_runtime.rsindex 0dbac89e2..f3806e6be 100644--- a/apps/screenpipe-app-tauri/src-tauri/src/acp_runtime.rs+++ b/apps/screenpipe-app-tauri/src-tauri/src/acp_runtime.rs@@ -2233,10 +2233,31 @@ fn terminal_auth_args(method: &Value) -> Option<Vec<String>> {Some(args.iter().filter_map(Value::as_str).map(str::to_owned).collect())}+/// Consumer Claude subscription sign-in, which Screenpipe must never offer.+///+/// Anthropic's guidance to third-party developers is that a product embedding+/// Claude Code uses an API key (Anthropic Console) or a supported cloud, and+/// does not put users through Claude.ai login or route Free/Pro/Max credentials+/// on their behalf. The adapter is launched with `--hide-claude-auth`+/// (agents.json), which drops exactly these methods and keeps the Console+/// method. This is the second layer: an adapter upgrade that renames the flag,+/// ignores it, or advertises the method anyway must not silently put the+/// subscription option back in front of a user.+fn is_claude_subscription_auth(id: &str, name: &str) -> bool {+ let id = id.to_ascii_lowercase();+ let name = name.to_ascii_lowercase();+ // Codex's ChatGPT method is deliberately not matched: OpenAI supports+ // signing into Codex with a ChatGPT plan, so it is not the same boundary.+ id == "claude-ai-login" || id == "claude-login" || name.contains("claude subscription")+}+fn available_auth_methods(init: &InitializeResponse,) -> Vec<&agent_client_protocol::schema::v1::AuthMethod> {- init.auth_methods.iter().collect()+ init.auth_methods+ .iter()+ .filter(|method| !is_claude_subscription_auth(&method.id().to_string(), method.name()))+ .collect()}async fn authenticate(@@ -3660,6 +3681,57 @@ mod tests {assert_eq!(default_option_value(&session, "gone", "a"), None);}+ /// Anthropic's guidance is that an embedding product uses an API key or a+ /// supported cloud, not Claude.ai login on the user's behalf. Both layers+ /// are pinned: the launch flag that makes the adapter withhold the method,+ /// and the filter that drops it if an adapter advertises it anyway.+ #[test]+ fn claude_adapter_launches_with_subscription_auth_hidden() {+ let claude = agent_catalog()+ .into_iter()+ .find(|agent| agent.id == "claude-acp")+ .expect("claude-acp in catalog");++ match claude.launch {+ AgentLaunch::Npx { ref args, .. } => {+ assert!(+ args.iter().any(|arg| arg == "--hide-claude-auth"),+ "claude-acp must launch with --hide-claude-auth, got {args:?}"+ );+ }+ AgentLaunch::Binary { .. } => panic!("claude-acp should launch via npx"),+ }+ }++ #[test]+ fn claude_subscription_auth_methods_are_never_offered() {+ // The adapter's own ids/labels for consumer sign-in.+ assert!(is_claude_subscription_auth(+ "claude-ai-login",+ "Claude Subscription"+ ));+ assert!(is_claude_subscription_auth(+ "claude-login",+ "Log in with Claude"+ ));+ // Matched by label too, so a renamed id still cannot slip through.+ assert!(is_claude_subscription_auth(+ "something-new",+ "Claude subscription "+ ));++ // The API-key path must survive: hiding every method would leave the+ // agent unusable rather than compliant.+ assert!(!is_claude_subscription_auth(+ "console-login",+ "Anthropic Console"+ ));+ // Codex signs in with a ChatGPT plan, which OpenAI supports. Not the+ // same boundary, and filtering it would break Codex sign-in.+ assert!(!is_claude_subscription_auth("chatgpt", "ChatGPT"));+ assert!(!is_claude_subscription_auth("cursor-login", "Cursor Login"));+ }+#[test]fn bundled_tools_mcp_server_is_registered_alongside_screenpipe() {let dir = tempfile::tempdir().expect("tempdir");