From c2eb854c66b7d2f62677dde3284d0c6defadbfb4 Mon Sep 17 00:00:00 2001 From: Michael Neale Date: Wed, 30 Sep 2026 11:39:03 +0000 Subject: [PATCH] Remove Nostr session sharing from goose core (#12453) --- Cargo.lock | 336 +--------------- crates/goose-cli/Cargo.toml | 2 - crates/goose-cli/src/cli.rs | 39 +- crates/goose-cli/src/commands/session.rs | 49 +-- crates/goose-sdk-types/src/custom_requests.rs | 33 +- crates/goose/Cargo.toml | 3 - crates/goose/acp-meta.json | 5 - crates/goose/acp-schema.json | 82 +--- .../goose/src/acp/server/custom_dispatch.rs | 8 - .../goose/src/acp/server/manage_sessions.rs | 88 +---- crates/goose/src/session/mod.rs | 2 - crates/goose/src/session/nostr_share.rs | 372 ------------------ ui/desktop/src/App.tsx | 44 --- ui/desktop/src/acp/sessions.ts | 11 +- .../components/sessions/SessionListView.tsx | 230 +---------- ui/desktop/src/i18n/messages/de.json | 30 -- ui/desktop/src/i18n/messages/en.json | 30 -- ui/desktop/src/i18n/messages/es.json | 30 -- ui/desktop/src/i18n/messages/fr.json | 30 -- ui/desktop/src/i18n/messages/hi.json | 30 -- ui/desktop/src/i18n/messages/id.json | 30 -- ui/desktop/src/i18n/messages/it.json | 30 -- ui/desktop/src/i18n/messages/ja.json | 30 -- ui/desktop/src/i18n/messages/ko.json | 30 -- ui/desktop/src/i18n/messages/ms.json | 30 -- ui/desktop/src/i18n/messages/pt.json | 30 -- ui/desktop/src/i18n/messages/ru.json | 30 -- ui/desktop/src/i18n/messages/tr.json | 30 -- ui/desktop/src/i18n/messages/vi.json | 30 -- ui/desktop/src/i18n/messages/zh-CN.json | 30 -- ui/desktop/src/i18n/messages/zh-TW.json | 30 -- ui/desktop/src/main.ts | 56 +-- ui/desktop/src/sessionLinks.ts | 8 - .../src/generated/client.gen.ts | 15 - ui/goose-acp-client/src/generated/index.ts | 7 +- .../src/generated/types.gen.ts | 24 +- ui/goose-acp-client/src/generated/zod.gen.ts | 28 +- 37 files changed, 33 insertions(+), 1889 deletions(-) delete mode 100644 crates/goose/src/session/nostr_share.rs delete mode 100644 ui/desktop/src/sessionLinks.ts diff --git a/Cargo.lock b/Cargo.lock index b896ad5f6..0bea9dfe1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -551,38 +551,6 @@ dependencies = [ "syn 3.0.5", ] -[[package]] -name = "async-utility" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "188f83b9a198af8c336e505611edb00d6d2ac5c694241c5a4f9a12316938cfe9" -dependencies = [ - "futures-util", - "gloo-timers", - "tokio", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-wsocket" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c713e1f14c7b82e32ea159af1c6e2f070cfadbdf23fb2512acce9af0a26f1a2" -dependencies = [ - "futures", - "futures-util", - "js-sys", - "tokio", - "tokio-happy-eyeballs", - "tokio-rustls", - "tokio-socks", - "tokio-tungstenite 0.28.0", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "async_io_stream" version = "0.3.3" @@ -1326,12 +1294,6 @@ dependencies = [ "walkdir", ] -[[package]] -name = "bech32" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efbd3e1070bbdf4cd88a75264e18e8a26f7cb5c6949eadf0ceb85fb159cf08f8" - [[package]] name = "better_scoped_tls" version = "1.0.1" @@ -1633,17 +1595,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bip39" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90dbd31c98227229239363921e60fcf5e558e43ec69094d46fc4996f08d1d5bc" -dependencies = [ - "bitcoin_hashes 0.14.101", - "serde", - "unicode-normalization", -] - [[package]] name = "bit-set" version = "0.8.0" @@ -1674,54 +1625,6 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" -[[package]] -name = "bitcoin-consensus-encoding" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6712f9c6fd6785b3b270884e57c441c403dc5d7e19ca45368c97c7a1de3000ec" -dependencies = [ - "bitcoin-internals", - "hex-conservative 1.3.0", - "serde", -] - -[[package]] -name = "bitcoin-internals" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d573f4cf32996a8dce612e4348cece65a241f1882ed594047c9ba348e8869fa5" - -[[package]] -name = "bitcoin-io" -version = "0.1.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb5de036369d1ac59d3c1819ebc4d850f89466f5401c571a285b6ed564a4cb78" -dependencies = [ - "bitcoin-consensus-encoding", -] - -[[package]] -name = "bitcoin_hashes" -version = "0.14.101" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca4c7abb40c8817d77403c880988cfd484f23ab2365726afb2f798363e2c4a2" -dependencies = [ - "bitcoin-io", - "hex-conservative 0.2.3", -] - -[[package]] -name = "bitcoin_hashes" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5304e53726dbe5f93141535e102ed97b5bf4714fbecefdda8f9fb98d7fdaff0e" -dependencies = [ - "bitcoin-consensus-encoding", - "bitcoin-internals", - "hex-conservative 1.3.0", - "serde", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -1786,15 +1689,6 @@ dependencies = [ "hybrid-array", ] -[[package]] -name = "block-padding" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" -dependencies = [ - "generic-array", -] - [[package]] name = "block-padding" version = "0.4.2" @@ -2205,15 +2099,6 @@ dependencies = [ "rustversion", ] -[[package]] -name = "cbc" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" -dependencies = [ - "cipher 0.4.4", -] - [[package]] name = "cbc" version = "0.2.1" @@ -2273,17 +2158,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" -[[package]] -name = "chacha20" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" -dependencies = [ - "cfg-if", - "cipher 0.4.4", - "cpufeatures 0.2.17", -] - [[package]] name = "chacha20" version = "0.10.2" @@ -2295,19 +2169,6 @@ dependencies = [ "rand_core 0.10.1", ] -[[package]] -name = "chacha20poly1305" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" -dependencies = [ - "aead", - "chacha20 0.9.1", - "cipher 0.4.4", - "poly1305", - "zeroize", -] - [[package]] name = "chrono" version = "0.4.45" @@ -2340,7 +2201,6 @@ checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ "crypto-common 0.1.7", "inout 0.1.4", - "zeroize", ] [[package]] @@ -4339,16 +4199,6 @@ dependencies = [ "regex-syntax", ] -[[package]] -name = "faster-hex" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7223ae2d2f179b803433d9c830478527e92b8117eab39460edae7f1614d9fb73" -dependencies = [ - "heapless", - "serde", -] - [[package]] name = "fastrand" version = "2.5.0" @@ -5228,8 +5078,6 @@ dependencies = [ "minijinja", "mockall", "nanoid", - "nostr", - "nostr-sdk", "ntapi", "oauth2", "once_cell", @@ -5697,15 +5545,6 @@ dependencies = [ "thiserror 2.0.20", ] -[[package]] -name = "hash32" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" -dependencies = [ - "byteorder", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -5761,16 +5600,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0049b265b7f201ca9ab25475b22b47fe444060126a51abe00f77d986fc5cc52e" -[[package]] -name = "heapless" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" -dependencies = [ - "hash32", - "stable_deref_trait", -] - [[package]] name = "heck" version = "0.5.0" @@ -5789,24 +5618,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hex-conservative" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3fef046dca3ca91ee1408a8c1b80ab777e80a4d308d1bf4e7adb3fcb047e08" -dependencies = [ - "arrayvec", -] - -[[package]] -name = "hex-conservative" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271e0d19bcb473b6675739a2b536076b24a082316cb5199ad918edce10c599e8" -dependencies = [ - "arrayvec", -] - [[package]] name = "hf-hub" version = "1.0.0" @@ -6448,7 +6259,6 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ - "block-padding 0.3.3", "generic-array", ] @@ -6458,7 +6268,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4250ce6452e92010fdf7268ccc5d14faa80bb12fc741938534c58f16804e03c7" dependencies = [ - "block-padding 0.4.2", + "block-padding", "hybrid-array", ] @@ -7255,7 +7065,7 @@ dependencies = [ "aes 0.9.3", "bitflags 2.13.2", "brotli-decompressor", - "cbc 0.2.1", + "cbc", "ecb", "encoding_rs", "flate2", @@ -7704,12 +7514,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "negentropy" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81c353b400a5503efdcf398f11a83fb7aa84f59f5d76fc4bf5bbc1e4f5366caa" - [[package]] name = "netdev" version = "0.45.1" @@ -8019,74 +7823,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "nostr" -version = "0.45.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ca5c25a6df8d4d78fdf39b42792438f6ce22b4809ccbfdb27582ed9ca45407" -dependencies = [ - "base64 0.22.1", - "bech32", - "bip39", - "bitcoin_hashes 1.2.0", - "cbc 0.1.2", - "chacha20 0.9.1", - "chacha20poly1305", - "faster-hex", - "opaquerr", - "rand 0.10.2", - "secp256k1", - "serde", - "serde_json", - "unicode-normalization", - "universal-time", - "url", - "zeroize", -] - -[[package]] -name = "nostr-database" -version = "0.45.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "309950383c9854ca413d195705400e78b1376aedc48f3256754a86c609c047e8" -dependencies = [ - "nostr", - "opaquerr", -] - -[[package]] -name = "nostr-gossip" -version = "0.45.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea822fd48ff6b84b81ddf84169e6edf1dc0bc9b312c8e41685b2278debaac3d" -dependencies = [ - "nostr", - "opaquerr", -] - -[[package]] -name = "nostr-sdk" -version = "0.45.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53a37469ce2df8fe6471b6a4d1c4da833f86c7ba0138ac95299b6f37f69ec84" -dependencies = [ - "async-utility", - "async-wsocket", - "faster-hex", - "futures", - "lru", - "negentropy", - "nostr", - "nostr-database", - "nostr-gossip", - "opaquerr", - "rand 0.10.2", - "tokio", - "tokio-stream", - "tracing", - "universal-time", -] - [[package]] name = "ntapi" version = "0.4.3" @@ -8525,12 +8261,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "opaquerr" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f933a4265d5cdad61d19bbdfc972ea5726d56cd8d3d57b8f2d3c365dd42bee9" - [[package]] name = "open" version = "5.4.4" @@ -9379,17 +9109,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "poly1305" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" -dependencies = [ - "cpufeatures 0.2.17", - "opaque-debug", - "universal-hash", -] - [[package]] name = "polyval" version = "0.6.2" @@ -9863,7 +9582,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" dependencies = [ - "chacha20 0.10.2", + "chacha20", "getrandom 0.4.3", "rand_core 0.10.1", ] @@ -10869,26 +10588,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.30.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" -dependencies = [ - "bitcoin_hashes 0.14.101", - "rand 0.8.8", - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" version = "2.11.1" @@ -13174,15 +12873,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "tokio-happy-eyeballs" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8564c32dfb6f4257f8bc6edfc178a34af97520e0b7b9815500c55eb3d092f29f" -dependencies = [ - "tokio", -] - [[package]] name = "tokio-macros" version = "2.7.2" @@ -13264,18 +12954,6 @@ dependencies = [ "x509-parser", ] -[[package]] -name = "tokio-socks" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e2948f60dbe26b35f2c7fb74ac2854c1fddded0fe9d7548fcc674a246f7615" -dependencies = [ - "either", - "futures-util", - "thiserror 1.0.69", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.19" @@ -13931,7 +13609,7 @@ dependencies = [ "aes 0.9.3", "base64 0.22.1", "byteorder", - "cbc 0.2.1", + "cbc", "cfb", "chrono", "encoding_rs", @@ -14184,12 +13862,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "universal-time" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a939edecc3c5a7b83c02e5f6b3c31d2bc69eabcc9a87ab12c6d37ee6dbc856" - [[package]] name = "unsafe-libyaml" version = "0.2.11" diff --git a/crates/goose-cli/Cargo.toml b/crates/goose-cli/Cargo.toml index 892bff33f..c7f53d614 100644 --- a/crates/goose-cli/Cargo.toml +++ b/crates/goose-cli/Cargo.toml @@ -98,7 +98,6 @@ default = [ "local-inference", "aws-providers", "telemetry", - "nostr", "otel", "rustls-tls", "live-voice", @@ -122,7 +121,6 @@ cuda = ["goose/cuda", "local-inference"] vulkan = ["goose/vulkan", "local-inference"] mlx = ["goose/mlx", "local-inference"] telemetry = ["goose/telemetry"] -nostr = ["goose/nostr"] otel = ["goose/otel"] system-keyring = ["goose/system-keyring"] update = ["dep:sigstore-verify", "dep:snap"] diff --git a/crates/goose-cli/src/cli.rs b/crates/goose-cli/src/cli.rs index c726ce37e..cde8c852e 100644 --- a/crates/goose-cli/src/cli.rs +++ b/crates/goose-cli/src/cli.rs @@ -575,32 +575,13 @@ enum SessionCommand { default_value = "markdown" )] format: String, - - #[arg( - long = "nostr", - help = "Publish the JSON session export as an encrypted Nostr event and print a Goose share link" - )] - nostr: bool, - - #[arg( - long = "relay", - value_name = "RELAY", - help = "Nostr relay URL to publish to (can be specified multiple times)", - action = clap::ArgAction::Append - )] - relays: Vec, }, - #[command( - about = "Import a session from JSON, a Claude Code / Codex / Pi .jsonl, or an encrypted Nostr share link" - )] + #[command(about = "Import a session from JSON or a Claude Code / Codex / Pi .jsonl")] Import { #[arg( - help = "Path to a goose session export, a Claude Code, Codex, or Pi .jsonl transcript, or a goose://sessions/nostr share link" + help = "Path to a goose session export, or a Claude Code, Codex, or Pi .jsonl transcript" )] input: String, - - #[arg(long = "nostr", help = "Treat input as an encrypted Nostr share link")] - nostr: bool, }, #[command(name = "diagnostics")] Diagnostics { @@ -1961,8 +1942,6 @@ async fn handle_session_subcommand(command: SessionCommand) -> Result<()> { identifier, output, format, - nostr, - relays, } => { let session_manager = SessionManager::instance(); let session_identifier = if let Some(id) = identifier { @@ -1980,17 +1959,11 @@ async fn handle_session_subcommand(command: SessionCommand) -> Result<()> { } } }; - crate::commands::session::handle_session_export( - session_identifier, - output, - format, - nostr, - relays, - ) - .await?; + crate::commands::session::handle_session_export(session_identifier, output, format) + .await?; } - SessionCommand::Import { input, nostr } => { - crate::commands::session::handle_session_import(input, nostr).await?; + SessionCommand::Import { input } => { + crate::commands::session::handle_session_import(input).await?; } SessionCommand::Diagnostics { identifier, output } => { let session_manager = SessionManager::instance(); diff --git a/crates/goose-cli/src/commands/session.rs b/crates/goose-cli/src/commands/session.rs index e931483b8..067a3b650 100644 --- a/crates/goose-cli/src/commands/session.rs +++ b/crates/goose-cli/src/commands/session.rs @@ -2,10 +2,6 @@ use anyhow::{Context, Result}; use cliclack::{confirm, multiselect, select}; use etcetera::home_dir; -#[cfg(feature = "nostr")] -use goose::config::Config; -#[cfg(feature = "nostr")] -use goose::session::nostr_share; use goose::session::{ export_session_to_markdown, generate_diagnostics, DiagnosticsLevel, Session, SessionManager, SessionType, @@ -298,8 +294,6 @@ pub async fn handle_session_export( session_id: String, output_path: Option, format: String, - nostr: bool, - #[cfg_attr(not(feature = "nostr"), allow(unused_variables))] relays: Vec, ) -> Result<()> { let session_manager = SessionManager::instance(); let session = match session_manager.get_session(&session_id, true).await { @@ -325,34 +319,6 @@ pub async fn handle_session_export( _ => return Err(anyhow::anyhow!("Unsupported format: {}", format)), }; - #[cfg(feature = "nostr")] - if nostr { - if format != "json" { - return Err(anyhow::anyhow!( - "Nostr session sharing only supports --format json" - )); - } - if output_path.is_some() { - return Err(anyhow::anyhow!( - "Nostr session sharing cannot be combined with --output" - )); - } - - let relays = nostr_share::resolve_relays(relays, Config::global()); - let share = nostr_share::publish_session_json(&output, relays).await?; - println!("Session published to Nostr relays:"); - for relay in &share.relays { - println!("- {}", relay); - } - println!("\nShare link:"); - println!("{}", share.deeplink); - return Ok(()); - } - #[cfg(not(feature = "nostr"))] - if nostr { - return Err(anyhow::anyhow!("goose was not built with nostr support")); - } - if let Some(output_path) = output_path { fs::write(&output_path, output).with_context(|| { format!("Failed to write to output file: {}", output_path.display()) @@ -365,18 +331,9 @@ pub async fn handle_session_export( Ok(()) } -pub async fn handle_session_import(input: String, nostr: bool) -> Result<()> { - let json = if nostr || input.starts_with("goose://sessions/nostr") { - #[cfg(feature = "nostr")] - { - nostr_share::import_session_json_from_deeplink(&input).await? - } - #[cfg(not(feature = "nostr"))] - return Err(anyhow::anyhow!("goose was not built with nostr support")); - } else { - fs::read_to_string(&input) - .with_context(|| format!("Failed to read session import file: {input}"))? - }; +pub async fn handle_session_import(input: String) -> Result<()> { + let json = fs::read_to_string(&input) + .with_context(|| format!("Failed to read session import file: {input}"))?; let format = goose::session::import_formats::detect_format(&json); let label = match format { diff --git a/crates/goose-sdk-types/src/custom_requests.rs b/crates/goose-sdk-types/src/custom_requests.rs index 9f2cd902a..9b21ae349 100644 --- a/crates/goose-sdk-types/src/custom_requests.rs +++ b/crates/goose-sdk-types/src/custom_requests.rs @@ -826,43 +826,12 @@ pub struct ExportSessionResponse { pub data: String, } -/// Import a session from a JSON string or share link. +/// Import a session from a serialized session JSON string. #[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema, JsonRpcRequest)] #[request(method = "_goose/unstable/session/import", response = ImportSessionResponse)] #[serde(rename_all = "camelCase")] pub struct ImportSessionRequest { pub input: String, - pub source: SessionImportSource, -} - -#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema)] -#[serde(rename_all = "snake_case")] -pub enum SessionImportSource { - #[default] - Auto, - Json, - Nostr, -} - -/// Share a session through Nostr and return its share links. -#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema, JsonRpcRequest)] -#[request( - method = "_goose/unstable/session/share/nostr", - response = ShareSessionNostrResponse -)] -#[serde(rename_all = "camelCase")] -pub struct ShareSessionNostrRequest { - pub session_id: String, - pub relays: Vec, -} - -#[derive(Debug, Default, Clone, Serialize, Deserialize, JsonSchema, JsonRpcResponse)] -#[serde(rename_all = "camelCase")] -pub struct ShareSessionNostrResponse { - pub deeplink: String, - pub nevent: String, - pub event_id: String, - pub relays: Vec, } /// Import session response — metadata about the newly created session. diff --git a/crates/goose/Cargo.toml b/crates/goose/Cargo.toml index b7f15ee1f..59d699ad2 100644 --- a/crates/goose/Cargo.toml +++ b/crates/goose/Cargo.toml @@ -105,7 +105,6 @@ portable-default = [ "chat-recall", "acp-http", ] -nostr = ["dep:nostr", "dep:nostr-sdk"] platform-apps = [] chat-recall = [] scheduler = ["dep:tokio-cron-scheduler"] @@ -246,8 +245,6 @@ goose-acp-macros = { path = "../goose-acp-macros", default-features = false } tower-http = { workspace = true, features = ["cors"] } tracing-appender = { workspace = true } process-wrap = { version = "9", default-features = false, features = ["std", "process-session"] } -nostr = { version = "0.45.1", default-features = false, features = ["nip44", "os-rng", "std"], optional = true } -nostr-sdk = { version = "0.45.1", default-features = false, optional = true } rustls = { workspace = true, optional = true } rcgen = { version = "0.14", default-features = false, features = ["crypto", "pem"], optional = true } axum-server = { workspace = true, optional = true } diff --git a/crates/goose/acp-meta.json b/crates/goose/acp-meta.json index ec89d600a..9d9f7c90a 100644 --- a/crates/goose/acp-meta.json +++ b/crates/goose/acp-meta.json @@ -290,11 +290,6 @@ "requestType": "ImportSessionRequest_unstable", "responseType": "ImportSessionResponse_unstable" }, - { - "method": "_goose/unstable/session/share/nostr", - "requestType": "ShareSessionNostrRequest_unstable", - "responseType": "ShareSessionNostrResponse_unstable" - }, { "method": "_goose/unstable/recipes/encode", "requestType": "EncodeRecipeRequest_unstable", diff --git a/crates/goose/acp-schema.json b/crates/goose/acp-schema.json index 363687391..66d60a136 100644 --- a/crates/goose/acp-schema.json +++ b/crates/goose/acp-schema.json @@ -3597,27 +3597,15 @@ "properties": { "input": { "type": "string" - }, - "source": { - "$ref": "#/$defs/SessionImportSource" } }, "required": [ - "input", - "source" + "input" ], - "description": "Import a session from a JSON string or share link.", + "description": "Import a session from a serialized session JSON string.", "x-side": "agent", "x-method": "_goose/unstable/session/import" }, - "SessionImportSource": { - "type": "string", - "enum": [ - "auto", - "json", - "nostr" - ] - }, "ImportSessionResponse_unstable": { "type": "object", "properties": { @@ -3649,55 +3637,6 @@ "x-side": "agent", "x-method": "_goose/unstable/session/import" }, - "ShareSessionNostrRequest_unstable": { - "type": "object", - "properties": { - "sessionId": { - "type": "string" - }, - "relays": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "sessionId", - "relays" - ], - "description": "Share a session through Nostr and return its share links.", - "x-side": "agent", - "x-method": "_goose/unstable/session/share/nostr" - }, - "ShareSessionNostrResponse_unstable": { - "type": "object", - "properties": { - "deeplink": { - "type": "string" - }, - "nevent": { - "type": "string" - }, - "eventId": { - "type": "string" - }, - "relays": { - "type": "array", - "items": { - "type": "string" - } - } - }, - "required": [ - "deeplink", - "nevent", - "eventId", - "relays" - ], - "x-side": "agent", - "x-method": "_goose/unstable/session/share/nostr" - }, "EncodeRecipeRequest_unstable": { "type": "object", "properties": { @@ -7642,15 +7581,6 @@ "description": "Params for _goose/unstable/session/import", "title": "ImportSessionRequest_unstable" }, - { - "allOf": [ - { - "$ref": "#/$defs/ShareSessionNostrRequest_unstable" - } - ], - "description": "Params for _goose/unstable/session/share/nostr", - "title": "ShareSessionNostrRequest_unstable" - }, { "allOf": [ { @@ -8485,14 +8415,6 @@ ], "title": "ImportSessionResponse_unstable" }, - { - "allOf": [ - { - "$ref": "#/$defs/ShareSessionNostrResponse_unstable" - } - ], - "title": "ShareSessionNostrResponse_unstable" - }, { "allOf": [ { diff --git a/crates/goose/src/acp/server/custom_dispatch.rs b/crates/goose/src/acp/server/custom_dispatch.rs index 86aeda17f..e4843de00 100644 --- a/crates/goose/src/acp/server/custom_dispatch.rs +++ b/crates/goose/src/acp/server/custom_dispatch.rs @@ -494,14 +494,6 @@ impl GooseAcpAgent { self.on_import_session(req).await } - #[custom_method(ShareSessionNostrRequest)] - async fn dispatch_share_session_nostr( - &self, - req: ShareSessionNostrRequest, - ) -> Result { - self.on_share_session_nostr(req).await - } - #[custom_method(EncodeRecipeRequest)] async fn dispatch_encode_recipe( &self, diff --git a/crates/goose/src/acp/server/manage_sessions.rs b/crates/goose/src/acp/server/manage_sessions.rs index a7d3c2750..949c20c46 100644 --- a/crates/goose/src/acp/server/manage_sessions.rs +++ b/crates/goose/src/acp/server/manage_sessions.rs @@ -134,23 +134,9 @@ impl GooseAcpAgent { &self, req: ImportSessionRequest, ) -> Result { - let is_nostr = match req.source { - SessionImportSource::Auto => is_nostr_session_link(&req.input), - SessionImportSource::Json => false, - SessionImportSource::Nostr => true, - }; - let (data, session_type) = if is_nostr { - ( - import_nostr_session_json(&req.input).await?, - Some(SessionType::User), - ) - } else { - (req.input, None) - }; - let session = self .session_manager - .import_session(&data, session_type) + .import_session(&req.input, None) .await .internal_err()?; @@ -164,26 +150,6 @@ impl GooseAcpAgent { }) } - pub(super) async fn on_share_session_nostr( - &self, - req: ShareSessionNostrRequest, - ) -> Result { - let data = self - .session_manager - .export_session(&req.session_id) - .await - .internal_err()?; - - let share = publish_session_to_nostr(&data, req.relays).await?; - - Ok(ShareSessionNostrResponse { - deeplink: share.deeplink, - nevent: share.nevent, - event_id: share.event_id, - relays: share.relays, - }) - } - pub(super) async fn on_get_session_info( &self, req: GetSessionInfoRequest, @@ -295,55 +261,3 @@ impl GooseAcpAgent { Ok(EmptyResponse {}) } } - -fn is_nostr_session_link(input: &str) -> bool { - input.trim_start().starts_with("goose://sessions/nostr") -} - -#[cfg(feature = "nostr")] -async fn import_nostr_session_json(deeplink: &str) -> Result { - crate::session::nostr_share::import_session_json_from_deeplink(deeplink) - .await - .invalid_params_err() -} - -#[cfg(not(feature = "nostr"))] -async fn import_nostr_session_json( - _deeplink: &str, -) -> Result { - Err(agent_client_protocol::Error::invalid_params() - .data("Nostr session import is not available in this build")) -} - -#[cfg(feature = "nostr")] -async fn publish_session_to_nostr( - data: &str, - relays: Vec, -) -> Result { - let relays = crate::session::nostr_share::resolve_relays(relays, Config::global()); - let share = crate::session::nostr_share::publish_session_json(data, relays) - .await - .internal_err()?; - Ok(NostrSessionShare { - deeplink: share.deeplink, - nevent: share.nevent, - event_id: share.event_id, - relays: share.relays, - }) -} - -#[cfg(not(feature = "nostr"))] -async fn publish_session_to_nostr( - _data: &str, - _relays: Vec, -) -> Result { - Err(agent_client_protocol::Error::invalid_params() - .data("Nostr session sharing is not available in this build")) -} - -struct NostrSessionShare { - deeplink: String, - nevent: String, - event_id: String, - relays: Vec, -} diff --git a/crates/goose/src/session/mod.rs b/crates/goose/src/session/mod.rs index edbd3c577..f4d729026 100644 --- a/crates/goose/src/session/mod.rs +++ b/crates/goose/src/session/mod.rs @@ -5,8 +5,6 @@ pub mod extension_data; pub mod import_formats; mod last_message_snippet; mod legacy; -#[cfg(feature = "nostr")] -pub mod nostr_share; pub mod session_manager; mod session_naming; diff --git a/crates/goose/src/session/nostr_share.rs b/crates/goose/src/session/nostr_share.rs deleted file mode 100644 index 416982ee4..000000000 --- a/crates/goose/src/session/nostr_share.rs +++ /dev/null @@ -1,372 +0,0 @@ -use std::time::Duration; - -use anyhow::{anyhow, Context, Result}; -use async_trait::async_trait; -use nostr::nips::nip19::{FromBech32, Nip19Event, ToBech32}; -use nostr::nips::nip44; -use nostr::prelude::*; -use nostr_sdk::client::Client; - -use crate::config::{Config, ConfigError}; - -pub const EVENT_KIND: u16 = 30278; -pub const CONFIG_RELAYS_KEY: &str = "GOOSE_NOSTR_RELAYS"; - -const DEFAULT_RELAYS: &[&str] = &[ - "wss://relay.damus.io", - "wss://relay.primal.net", - "wss://nos.lol", - "wss://relay.nostr.band", -]; - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct NostrShare { - pub deeplink: String, - pub nevent: String, - pub event_id: String, - pub relays: Vec, -} - -#[derive(Debug, Clone, PartialEq, Eq)] -pub struct ParsedShareLink { - pub nevent: String, - pub decryption_key: String, -} - -#[async_trait] -pub trait NostrPublisher { - async fn publish(&self, event: Event, relays: &[String]) -> Result<()>; -} - -#[async_trait] -pub trait NostrFetcher { - async fn fetch(&self, event_id: EventId, relays: &[String]) -> Result; -} - -pub struct LiveNostrClient; - -#[async_trait] -impl NostrPublisher for LiveNostrClient { - async fn publish(&self, event: Event, relays: &[String]) -> Result<()> { - install_rustls_crypto_provider(); - let client = Client::default(); - for relay in relays { - client - .add_relay(relay) - .await - .with_context(|| format!("Failed to add relay {relay}"))?; - } - - client.try_connect().timeout(Duration::from_secs(8)).await; - let output = client - .send_event(&event) - .to(relays.iter().map(String::as_str)) - .await - .context("Failed to publish session to Nostr relays")?; - client.shutdown().await; - - if output.success.is_empty() { - return Err(anyhow!( - "Failed to publish session to any Nostr relay: {:?}", - output.failed - )); - } - - Ok(()) - } -} - -#[async_trait] -impl NostrFetcher for LiveNostrClient { - async fn fetch(&self, event_id: EventId, relays: &[String]) -> Result { - install_rustls_crypto_provider(); - let client = Client::default(); - for relay in relays { - client - .add_relay(relay) - .await - .with_context(|| format!("Failed to add relay {relay}"))?; - } - - client.try_connect().timeout(Duration::from_secs(8)).await; - let filter = Filter::new() - .id(event_id) - .kind(Kind::Custom(EVENT_KIND)) - .limit(1); - let targets = relays - .iter() - .map(|relay| (relay.as_str(), vec![filter.clone()])) - .collect::>(); - let events = client - .fetch_events(targets) - .timeout(Duration::from_secs(10)) - .await - .context("Failed to fetch shared session from Nostr relays")?; - client.shutdown().await; - - events - .into_iter() - .next() - .ok_or_else(|| anyhow!("Shared session event not found")) - } -} - -#[cfg(feature = "rustls-tls")] -fn install_rustls_crypto_provider() { - let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); -} - -#[cfg(not(feature = "rustls-tls"))] -fn install_rustls_crypto_provider() {} - -pub fn default_relays() -> Vec { - DEFAULT_RELAYS - .iter() - .map(|relay| relay.to_string()) - .collect() -} - -pub fn relays_from_config(config: &Config) -> Vec { - match config.get_param::>(CONFIG_RELAYS_KEY) { - Ok(relays) if !relays.is_empty() => normalize_relays(relays), - Err(ConfigError::NotFound(_)) => default_relays(), - _ => default_relays(), - } -} - -pub fn resolve_relays(cli_relays: Vec, config: &Config) -> Vec { - if cli_relays.is_empty() { - relays_from_config(config) - } else { - normalize_relays(cli_relays) - } -} - -pub async fn publish_session_json(session_json: &str, relays: Vec) -> Result { - publish_session_json_with(session_json, relays, &LiveNostrClient).await -} - -pub async fn publish_session_json_with

( - session_json: &str, - relays: Vec, - publisher: &P, -) -> Result -where - P: NostrPublisher + Sync, -{ - let relays = normalize_relays(relays); - if relays.is_empty() { - return Err(anyhow!("At least one Nostr relay is required")); - } - let relay_urls = relays - .iter() - .map(|relay| RelayUrl::parse(relay)) - .collect::, _>>()?; - - let publish_keys = Keys::generate(); - let encryption_key = SecretKey::generate(); - let encryption_keys = Keys::new(encryption_key.clone()); - let encrypted = nip44::encrypt( - &encryption_key, - &encryption_keys.public_key(), - session_json, - nip44::Version::V2, - )?; - - let event = EventBuilder::new(Kind::Custom(EVENT_KIND), encrypted) - .tag(Tag::identifier(format!( - "goose-session-{}", - uuid::Uuid::now_v7() - ))) - .tag(Tag::parse(["client", "goose"])?) - .finalize(&publish_keys)?; - - publisher.publish(event.clone(), &relays).await?; - - let nevent = Nip19Event::new(event.id) - .author(event.pubkey) - .kind(Kind::Custom(EVENT_KIND)) - .relays(relay_urls) - .to_bech32()?; - let decryption_key = encryption_key.to_secret_hex(); - let deeplink = build_deeplink(&nevent, &decryption_key); - - Ok(NostrShare { - deeplink, - nevent, - event_id: event.id.to_hex(), - relays, - }) -} - -pub async fn import_session_json_from_deeplink(deeplink: &str) -> Result { - import_session_json_from_deeplink_with(deeplink, &LiveNostrClient).await -} - -pub async fn import_session_json_from_deeplink_with( - deeplink: &str, - fetcher: &F, -) -> Result -where - F: NostrFetcher + Sync, -{ - let ParsedShareLink { - nevent, - decryption_key, - } = parse_deeplink(deeplink)?; - let event_ref = Nip19Event::from_bech32(&nevent)?; - let relays = event_ref - .relays - .iter() - .map(ToString::to_string) - .collect::>(); - - if relays.is_empty() { - return Err(anyhow!("Shared session link does not include any relays")); - } - - let event = fetcher.fetch(event_ref.event_id, &relays).await?; - if event.kind != Kind::Custom(EVENT_KIND) { - return Err(anyhow!( - "Unexpected Nostr event kind: {}", - u16::from(event.kind) - )); - } - - let secret_key = SecretKey::parse(&decryption_key)?; - let encryption_keys = Keys::new(secret_key.clone()); - nip44::decrypt(&secret_key, &encryption_keys.public_key(), event.content).map_err(Into::into) -} - -pub fn build_deeplink(nevent: &str, decryption_key: &str) -> String { - format!( - "goose://sessions/nostr?nevent={}&key={}", - urlencoding::encode(nevent), - urlencoding::encode(decryption_key) - ) -} - -pub fn parse_deeplink(deeplink: &str) -> Result { - let parsed = url::Url::parse(deeplink).context("Invalid Goose session share link")?; - if parsed.scheme() != "goose" - || parsed.host_str() != Some("sessions") - || parsed.path() != "/nostr" - { - return Err(anyhow!("Invalid Goose Nostr session share link")); - } - - let nevent = parsed - .query_pairs() - .find_map(|(key, value)| (key == "nevent").then(|| value.into_owned())) - .ok_or_else(|| anyhow!("Missing nevent parameter"))?; - let decryption_key = parsed - .query_pairs() - .find_map(|(key, value)| (key == "key").then(|| value.into_owned())) - .ok_or_else(|| anyhow!("Missing decryption key parameter"))?; - - Ok(ParsedShareLink { - nevent, - decryption_key, - }) -} - -fn normalize_relays(relays: Vec) -> Vec { - let mut normalized = Vec::new(); - for relay in relays { - let relay = relay.trim(); - if relay.is_empty() || normalized.iter().any(|existing| existing == relay) { - continue; - } - normalized.push(relay.to_string()); - } - normalized -} - -#[cfg(test)] -mod tests { - use super::*; - use std::sync::{Arc, Mutex}; - - struct RecordingPublisher { - event: Arc>>, - relays: Arc>>, - } - - #[async_trait] - impl NostrPublisher for RecordingPublisher { - async fn publish(&self, event: Event, relays: &[String]) -> Result<()> { - *self.event.lock().unwrap() = Some(event); - *self.relays.lock().unwrap() = relays.to_vec(); - Ok(()) - } - } - - struct StaticFetcher(Event); - - #[async_trait] - impl NostrFetcher for StaticFetcher { - async fn fetch(&self, _event_id: EventId, _relays: &[String]) -> Result { - Ok(self.0.clone()) - } - } - - #[tokio::test] - async fn publish_builds_deeplink_and_encrypted_kind_30278_event() { - let event = Arc::new(Mutex::new(None)); - let relays = Arc::new(Mutex::new(Vec::new())); - let publisher = RecordingPublisher { - event: event.clone(), - relays: relays.clone(), - }; - - let share = publish_session_json_with( - r#"{"id":"session-id","conversation":{"messages":[]}}"#, - vec!["wss://relay.example".to_string()], - &publisher, - ) - .await - .unwrap(); - - assert!(share.deeplink.starts_with("goose://sessions/nostr?")); - assert!(share.nevent.starts_with("nevent1")); - assert_eq!(share.relays, vec!["wss://relay.example"]); - assert_eq!(*relays.lock().unwrap(), vec!["wss://relay.example"]); - - let event = event.lock().unwrap().clone().unwrap(); - assert_eq!(event.kind, Kind::Custom(EVENT_KIND)); - assert_ne!( - event.content, - r#"{"id":"session-id","conversation":{"messages":[]}}"# - ); - } - - #[tokio::test] - async fn publish_and_import_round_trips_session_json() { - let event = Arc::new(Mutex::new(None)); - let publisher = RecordingPublisher { - event: event.clone(), - relays: Arc::new(Mutex::new(Vec::new())), - }; - let json = r#"{"id":"session-id","name":"shared"}"#; - - let share = - publish_session_json_with(json, vec!["wss://relay.example".to_string()], &publisher) - .await - .unwrap(); - - let fetched_event = event.lock().unwrap().clone().unwrap(); - let imported = - import_session_json_from_deeplink_with(&share.deeplink, &StaticFetcher(fetched_event)) - .await - .unwrap(); - - assert_eq!(imported, json); - } - - #[test] - fn parses_deeplink() { - let parsed = parse_deeplink("goose://sessions/nostr?nevent=abc&key=def").unwrap(); - assert_eq!(parsed.nevent, "abc"); - assert_eq!(parsed.decryption_key, "def"); - } -} diff --git a/ui/desktop/src/App.tsx b/ui/desktop/src/App.tsx index 313d3d65a..90cb3a3db 100644 --- a/ui/desktop/src/App.tsx +++ b/ui/desktop/src/App.tsx @@ -1,7 +1,6 @@ import { useEffect, useState, useRef, type RefObject } from 'react'; import { IpcRendererEvent } from 'electron'; import { HashRouter, Routes, Route, useNavigate, useLocation, useSearchParams } from 'react-router'; -import { importNostrSessionFromDeepLink } from './sessionLinks'; import { ErrorUI } from './components/ErrorBoundary'; import { ExtensionInstallModal } from './components/ExtensionInstallModal'; import RecipeParamsModalContainer from './components/RecipeParamsModalContainer'; @@ -332,8 +331,6 @@ const ExtensionsRoute = () => { export function AppInner() { const [fatalError, setFatalError] = useState(null); - const nostrImportInFlight = useRef(null); - const navigate = useNavigate(); const location = useLocation(); const setView = useNavigation(); @@ -456,47 +453,6 @@ export function AppInner() { .catch(() => {}); }, []); - useEffect(() => { - const handleOpenSharedSession = async (_event: IpcRendererEvent, ...args: unknown[]) => { - const link = args[0] as string; - window.electron.logInfo('Opening session share link'); - - if (!link.startsWith('goose://sessions/nostr')) { - toast.error('Unsupported session share link'); - navigate('/sessions'); - return; - } - - if (nostrImportInFlight.current === link) { - window.electron.logInfo('Skipping duplicate Nostr deep link import'); - return; - } - nostrImportInFlight.current = link; - - try { - await importNostrSessionFromDeepLink(link); - navigate('/sessions'); - } catch (error) { - console.error('Unexpected error opening Nostr session share:', error); - trackErrorWithContext(error, { - component: 'AppInner', - action: 'open_nostr_session_share', - recoverable: true, - }); - toast.error(`Failed to import Nostr session: ${errorMessage(error, 'Unknown error')}`); - navigate('/sessions'); - } finally { - if (nostrImportInFlight.current === link) { - nostrImportInFlight.current = null; - } - } - }; - window.electron.on('open-shared-session', handleOpenSharedSession); - return () => { - window.electron.off('open-shared-session', handleOpenSharedSession); - }; - }, [navigate]); - useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { const isMac = window.electron.platform === 'darwin'; diff --git a/ui/desktop/src/acp/sessions.ts b/ui/desktop/src/acp/sessions.ts index 298b35b93..9800f23e4 100644 --- a/ui/desktop/src/acp/sessions.ts +++ b/ui/desktop/src/acp/sessions.ts @@ -6,7 +6,7 @@ import { type NewSessionRequest, type SessionInfo, } from '@agentclientprotocol/sdk'; -import type { GooseExtension, SessionExportFormat, SessionImportSource } from '@aaif/goose-acp-client'; +import type { GooseExtension, SessionExportFormat } from '@aaif/goose-acp-client'; import { getAcpClient } from './acpConnection'; import type { ExtensionLoadResult } from '../types/extensions'; import type { Session } from '../types/session'; @@ -322,12 +322,7 @@ export async function acpExportSession( return response.data; } -export async function acpImportSession(input: string, source: SessionImportSource): Promise { +export async function acpImportSession(input: string): Promise { const client = await getAcpClient(); - await client.goose.sessionImport_unstable({ input, source }); -} - -export async function acpShareSessionNostr(sessionId: string, relays: string[]) { - const client = await getAcpClient(); - return await client.goose.sessionShareNostr_unstable({ sessionId, relays }); + await client.goose.sessionImport_unstable({ input }); } diff --git a/ui/desktop/src/components/sessions/SessionListView.tsx b/ui/desktop/src/components/sessions/SessionListView.tsx index 4baa3cfa2..3f00ea37f 100644 --- a/ui/desktop/src/components/sessions/SessionListView.tsx +++ b/ui/desktop/src/components/sessions/SessionListView.tsx @@ -10,8 +10,6 @@ import { Trash2, Download, Upload, - Share2, - LoaderCircle, ExternalLink, Copy, ChevronDown, @@ -30,14 +28,6 @@ import { errorMessage } from '../../utils/conversionUtils'; import { Skeleton } from '../ui/skeleton'; import { toast } from 'react-toastify'; import { ConfirmationModal } from '../ui/ConfirmationModal'; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, -} from '../ui/dialog'; import { DropdownMenu, DropdownMenuContent, @@ -51,7 +41,6 @@ import { acpImportSession, acpListSessions, acpRenameSession, - acpShareSessionNostr, type SessionListItem, } from '../../acp/sessions'; import type { SessionExportFormat } from '@aaif/goose-acp-client'; @@ -79,17 +68,6 @@ const i18n = defineMessages({ }, chatHistory: { id: 'sessions.chatHistory', defaultMessage: 'Chat history' }, importSession: { id: 'sessions.import', defaultMessage: 'Import Session' }, - importNostrSession: { id: 'sessions.importNostr', defaultMessage: 'Import Link' }, - importNostrTitle: { id: 'sessions.importNostr.title', defaultMessage: 'Import Nostr Session' }, - importNostrDesc: { - id: 'sessions.importNostr.description', - defaultMessage: 'Paste a Goose Nostr share link to fetch, decrypt, and import the session.', - }, - importNostrPlaceholder: { - id: 'sessions.importNostr.placeholder', - defaultMessage: 'goose://sessions/nostr?nevent=...&key=...', - }, - importing: { id: 'sessions.importing', defaultMessage: 'Importing...' }, chatHistoryDesc: { id: 'sessions.chatHistoryDesc', defaultMessage: 'View and search your past conversations with Goose. {shortcut} to search.', @@ -137,14 +115,6 @@ const i18n = defineMessages({ id: 'sessions.toast.exportFailed', defaultMessage: 'Failed to export session: {error}', }, - shareNostrSuccess: { - id: 'sessions.toast.shareNostr', - defaultMessage: 'Encrypted Nostr share link created', - }, - shareNostrFailed: { - id: 'sessions.toast.shareNostrFailed', - defaultMessage: 'Failed to create Nostr share link: {error}', - }, copied: { id: 'sessions.toast.copied', defaultMessage: 'Copied to clipboard' }, openInNewWindow: { id: 'sessions.action.openNewWindow', defaultMessage: 'Open in new window' }, editSessionName: { id: 'sessions.action.editName', defaultMessage: 'Edit session name' }, @@ -153,19 +123,6 @@ const i18n = defineMessages({ exportSession: { id: 'sessions.action.export', defaultMessage: 'Export session' }, exportAsJson: { id: 'sessions.action.exportJson', defaultMessage: 'JSON' }, exportAsMarkdown: { id: 'sessions.action.exportMarkdown', defaultMessage: 'Markdown' }, - shareNostrSession: { - id: 'sessions.action.shareNostr', - defaultMessage: 'Share encrypted Nostr link', - }, - shareNostrTitle: { - id: 'sessions.shareNostr.title', - defaultMessage: 'Encrypted Nostr Share Link', - }, - shareNostrDesc: { - id: 'sessions.shareNostr.description', - defaultMessage: - 'Anyone with this link can fetch and decrypt the session. Treat it like a secret.', - }, close: { id: 'sessions.close', defaultMessage: 'Close' }, scheduledJobs: { id: 'sessions.scheduledJobs', @@ -343,14 +300,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe const [showDeleteConfirmation, setShowDeleteConfirmation] = useState(false); const [sessionToDelete, setSessionToDelete] = useState(null); - const [showImportLinkModal, setShowImportLinkModal] = useState(false); - const [nostrImportLink, setNostrImportLink] = useState(''); - const [isImportingNostr, setIsImportingNostr] = useState(false); - const [shareLink, setShareLink] = useState(''); - const [showShareLinkModal, setShowShareLinkModal] = useState(false); - const [sharingSessionId, setSharingSessionId] = useState(null); - const [nostrEnabled, setNostrEnabled] = useState(true); - const [includeAcpSessions, setIncludeAcpSessions] = useState( () => localStorage.getItem(INCLUDE_ACP_SESSIONS_KEY) === 'true' ); @@ -492,14 +441,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe }; }, [loadSessions, debouncedSearchTerm, includeAcpSessions]); - // Hide Nostr sharing when explicitly disabled via env var (restricted/enterprise bundles) - useEffect(() => { - const config = window.electron.getConfig(); - if (config.GOOSE_DISABLE_NOSTR_SHARING === true) { - setNostrEnabled(false); - } - }, []); - // Timing logic to prevent flicker between skeleton and content on initial load useEffect(() => { if (!isLoading && showSkeleton) { @@ -665,26 +606,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe [intl] ); - const handleShareSessionNostr = useCallback( - async (session: SessionListItem, e: React.MouseEvent) => { - e.stopPropagation(); - setSharingSessionId(session.id); - try { - const response = await acpShareSessionNostr(session.id, []); - setShareLink(response.deeplink); - setShowShareLinkModal(true); - toast.success(intl.formatMessage(i18n.shareNostrSuccess)); - } catch (error) { - toast.error( - intl.formatMessage(i18n.shareNostrFailed, { error: errorMessage(error, 'Unknown error') }) - ); - } finally { - setSharingSessionId(null); - } - }, - [intl] - ); - const handleImportClick = useCallback(async () => { const native = window.electron?.selectImportSessionFile; if (typeof native === 'function') { @@ -695,7 +616,7 @@ const SessionListView: React.FC = React.memo(({ onSelectSe toast.error(intl.formatMessage(i18n.importFailed, { error: result.error })); return; } - await acpImportSession(result.contents, 'json'); + await acpImportSession(result.contents); toast.success(intl.formatMessage(i18n.importSuccess)); window.dispatchEvent(new CustomEvent(AppEvents.SESSION_CREATED)); await loadSessions(); @@ -710,36 +631,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe fileInputRef.current?.click(); }, [intl, loadSessions]); - const handleImportNostrLink = useCallback(async () => { - const deeplink = nostrImportLink.trim(); - if (!deeplink) return; - - setIsImportingNostr(true); - try { - await acpImportSession(deeplink, 'nostr'); - setNostrImportLink(''); - setShowImportLinkModal(false); - toast.success(intl.formatMessage(i18n.importSuccess)); - window.dispatchEvent(new CustomEvent(AppEvents.SESSION_CREATED)); - await loadSessions(); - } catch (error) { - toast.error( - intl.formatMessage(i18n.importFailed, { error: errorMessage(error, 'Unknown error') }) - ); - } finally { - setIsImportingNostr(false); - } - }, [intl, loadSessions, nostrImportLink]); - - const handleCopyShareLink = useCallback(async () => { - try { - await navigator.clipboard.writeText(shareLink); - toast.success(intl.formatMessage(i18n.copied)); - } catch (error) { - toast.error(`Failed to copy: ${errorMessage(error, 'Unknown error')}`); - } - }, [intl, shareLink]); - const handleImportSession = useCallback( async (e: React.ChangeEvent) => { const file = e.target.files?.[0]; @@ -747,7 +638,7 @@ const SessionListView: React.FC = React.memo(({ onSelectSe try { const json = await file.text(); - await acpImportSession(json, 'json'); + await acpImportSession(json); toast.success(intl.formatMessage(i18n.importSuccess)); window.dispatchEvent(new CustomEvent(AppEvents.SESSION_CREATED)); @@ -778,18 +669,14 @@ const SessionListView: React.FC = React.memo(({ onSelectSe onDuplicateClick, onDeleteClick, onExportClick, - onShareClick, onOpenInNewWindow, - isSharing, }: { session: SessionListItem; onEditClick: (session: SessionListItem) => void; onDuplicateClick: (session: SessionListItem) => void; onDeleteClick: (session: SessionListItem) => void; onExportClick: (session: SessionListItem, format: SessionExportFormat) => void; - onShareClick: (session: SessionListItem, e: React.MouseEvent) => void; onOpenInNewWindow: (session: SessionListItem, e: React.MouseEvent) => void; - isSharing: boolean; }) { const handleEditClick = useCallback( (e: React.MouseEvent) => { @@ -826,13 +713,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe [onExportClick, session] ); - const handleShareClick = useCallback( - (e: React.MouseEvent) => { - onShareClick(session, e); - }, - [onShareClick, session] - ); - const handleOpenInNewWindowClick = useCallback( (e: React.MouseEvent) => { onOpenInNewWindow(session, e); @@ -925,20 +805,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe - {nostrEnabled && ( - - )} ); @@ -1032,9 +898,7 @@ const SessionListView: React.FC = React.memo(({ onSelectSe onDuplicateClick={handleDuplicateSession} onDeleteClick={handleDeleteSession} onExportClick={handleExportSession} - onShareClick={handleShareSessionNostr} onOpenInNewWindow={handleOpenInNewWindow} - isSharing={sharingSessionId === session.id} /> ))} @@ -1083,9 +947,7 @@ const SessionListView: React.FC = React.memo(({ onSelectSe onDuplicateClick={handleDuplicateSession} onDeleteClick={handleDeleteSession} onExportClick={handleExportSession} - onShareClick={handleShareSessionNostr} onOpenInNewWindow={handleOpenInNewWindow} - isSharing={sharingSessionId === session.id} /> ))} @@ -1117,17 +979,6 @@ const SessionListView: React.FC = React.memo(({ onSelectSe

{intl.formatMessage(i18n.chatHistory)}

- {nostrEnabled && ( - - )}