Commit Graph
181 Commits
Author SHA1 Message Date
Michael Neale 5afc0e0266 fix(serverless): agent subscribes to ALL relays + dedup (damus RelayPool pattern)
The agent connected to a single relay, so a message stored only on relay B
(because relay A rate-limited the write) was invisible to it — the split-brain.
Relays don't gossip (verified against damus RelayPool.swift, NIP-01/65/17,
nostr-tools SimplePool): clients must publish-to-many AND subscribe-to-many +
dedup by event id. The harness now spawns one background task per relay sharing
one event stream, fans out commands to all, and dedups in next_event() via a
bounded seen-id ring (like damus seenEvents).

Proven live: agent on [damus,nos.lol] receives a kind-9 published ONLY to
nos.lol (agent_multi_relay_subscribe_no_split_brain), plus the existing
encrypted-receive test now runs against a comma relay list.
2026-06-02 16:56:56 +10:00
Michael Neale bc92b752e0 fix(serverless): agent re-discovers channels (no 44100 push) + split comma relay list
The sprout-acp harness is single-relay but serverless workspaces pass a
comma-separated relay list, causing a DNS crash on the raw string. Split to the
first relay (matching the desktop live-WS convention).

Also: a generic public relay never emits the kind:44100 'member added'
notification the agent relies on to learn it was added to a new channel (that's
a Sprout-relay side effect). In serverless mode, periodically re-run
discover_channels (kind:39002 #p=agent) and subscribe to newly-joined channels.
Without this, a channel created/joined after the agent started is never watched.

Live test now passes a comma-separated relay list through connect_with_mode.
2026-06-02 16:39:07 +10:00
Michael Neale 0b679ccfb1 fix(serverless): agent connects to first relay of comma list (DNS crash)
The ACP harness is single-relay but serverless workspaces pass a
comma-separated relay LIST (wss://a,wss://b,...). connect_with_mode fed
the raw comma string to connect_async, which failed DNS lookup
("nodename nor servname provided") and crashed the agent before it ever
subscribed — so it never saw mentions and never responded.

Split to the first (primary) relay, matching the desktop live-WS
convention. Regression-covered by the live agent test now using a
comma-separated RELAY_URL.
2026-06-02 15:43:31 +10:00
Michael Neale a568920cf9 test(serverless): live agent encrypted-receive test + RELAY_URL override
Add a live, #[ignore]d end-to-end test proving a HarnessRelay in serverless
mode (as a managed agent runs) receives + decrypts a NIP-17 gift-wrapped
message over a real public relay and surfaces it via next_event() with the
verified sender preserved. Matches the repo's e2e convention (RELAY_URL env,
default damus). Also wire RELAY_URL into the existing serverless live tests so
they aren't hardcoded to damus.
2026-06-02 12:47:00 +10:00
Michael Neale ba335aed2a refactor(serverless): remove dead code introduced on branch
- Delete orphaned HarnessRelay::connect() wrapper (callers use
  connect_with_mode); fold its doc into connect_with_mode.
- Gate BgState::new() behind #[cfg(test)] (test-only now that the
  runtime path uses with_serverless) instead of #[allow(dead_code)].
- Move KIND_GIFT_WRAP into the encrypted test module (test-only).

No #[allow(dead_code)] / cfg_attr dead-code suppressions remain on
branch-new code. Verified with RUSTFLAGS='-D dead_code -D unused'.
2026-06-02 11:32:39 +10:00
Michael Neale b93eb61570 feat(serverless): agents receive NIP-17 encrypted messages (sprout-acp)
The agent harness now subscribes to its own gift-wrap inbox (kind 1059,
#p = agent) alongside membership notifications, unwraps each, recovers
the inner kind-9 rumor (verified sender + h tag), and forwards it as a
normal SproutEvent. The respond-to allowlist gate and rule matching run
unchanged — so an agent in an encrypted private channel only responds to
blessed npubs, exactly as on the Sprout server.

- send_gift_wrap_subscribe (mirrors observer-control), tied to membership
  sub (active + reconnect restore)
- dispatch: 1059 on GIFT_WRAP_SUB_ID -> UnwrappedGift -> rumor_to_event
- rumor_to_event: UnsignedEvent -> Event (seal already verified sender;
  pipeline never reads .sig)
- nip59 enabled workspace-wide; unit test covers unwrap->channel event
2026-06-02 10:15:56 +10:00
Michael Neale 858cb3b02a fix(serverless): allow self-tagging on channel membership events
The 'join to participate, nothing happens' bug: when a user creates or
joins a serverless channel they p-tag themselves (the signer). nostr 0.44
strips self-referencing p tags at sign time unless .allow_self_tagging()
is set, so kind:39002 membership events were published with an EMPTY
member list. get_channels then queries 39002 by #p:[me], finds nothing,
and the UI stays stuck on 'join to participate' forever.

(This worked in the old TS/slackest codebase because nostr-tools does not
perform that scrub.)

Fix: add .allow_self_tagging() to the serverless 39000 + 39002 builders
in both desktop events.rs and the shared sprout-sdk builders (CLI/agents).

Reproduced and verified end-to-end against wss://relay.damus.io via a new
#[ignore] integration test (serverless_create_join_roundtrip): create ->
join -> both members visible. Added no-network unit regression guards
(serverless_{members,metadata}_keeps_self_p_tag) in both crates.

clippy clean (desktop+sdk+cli); desktop + sdk tests pass; file-size gate ok.
2026-06-02 08:43:09 +10:00
Michael Neale fc832f4d5d fix(serverless): membership via direct kind:39002 (join/leave/add/remove) + CLI channel ops
In serverless mode there's no relay to process membership command kinds
(9021 join, 9022 leave, 9000/9001 add/remove member). The client now mutates
the replaceable kind:39002 member-list event directly (read-modify-write).

- desktop: join/leave/add/remove_channel_member publish 39002 directly
- sprout-sdk: build_channel_metadata_serverless (39000) +
  build_channel_members_serverless (39002), shared builders
- sprout-cli: channels create/join/leave/add-member/remove-member serverless
  branches (fixes agent replies + CLI parity with desktop)

Verified end-to-end against wss://relay.damus.io: create -> list -> send ->
read all round-trip with zero Sprout infrastructure.
2026-06-02 08:33:06 +10:00
Michael Neale 84f84931f1 feat(serverless): run channels, DMs, messages, and agents against a generic Nostr relay
Adds a 'serverless' workspace mode that points the desktop app at any generic
public Nostr relay (e.g. wss://relay.damus.io) with zero Sprout server
infrastructure — no Postgres, no HTTP /query|/events bridge, no NIP-98 auth.
Reuses Sprout's native event kinds (39000 channel metadata, 39002 membership,
kind 9 messages, h-tag scoping); 'serverless' is purely a transport + auth
concern, so the server-mode path is untouched.

Transport: reads/writes go over plain WebSocket (REQ/EOSE, EVENT/OK) instead
of the HTTP bridge; NIP-42 AUTH is answered only if the relay challenges.

Desktop backend:
- AppState.serverless flag + is_serverless(); apply_workspace gains a flag
- ws_relay.rs: query_relay_ws / submit_event_ws / publish_signed_event_ws
- relay.rs: query_relay/submit_event + agent profile sync branch to WS
- events.rs: build_channel_metadata_serverless (39000) + members (39002)
- create_channel/open_dm publish those events directly (DM ids = UUIDv5 over
  sorted participants so both sides converge without a server)
- managed agents inherit SPROUT_SERVERLESS into the ACP subprocess env

Agents (full support, not a follow-up):
- sprout-acp: RestClient + HarnessRelay gain serverless mode; query/submit use
  plain WS, NIP-42 handshake skipped on (re)connect; SPROUT_SERVERLESS env/arg
- sprout-cli: SproutClient serverless WS query/submit; --serverless flag,
  to_ws_url helper, NetworkMsg error variant
- npub respond-to permissions are in-process and work unchanged

Frontend:
- Workspace.mode + workspaceMode()/isServerlessWorkspace() helpers
- relayClient.setServerless() skips the AUTH-wait on connect; late challenges
  still answered so writes succeed on relays that require auth
- ServerlessContext/useIsServerless() hides search, pulse, projects, workflows
- Serverless toggle in the Add Workspace dialog and Welcome screen

Docs: docs/SPROUT_LITE_MODE.md updated with the implementation + testing steps.
2026-06-01 20:42:29 +10:00
Will PflegerandGitHub 2a03851527 refactor: consolidate infra management into justfile + add mobile-dev (#797) 2026-05-29 18:26:24 -04:00
Will PflegerandGitHub f34a21d32f feat(sprout-agent): load AGENTS.md and SKILL.md into system prompt (#762) 2026-05-29 14:44:33 -04:00
tlongwell-blockandGitHub 61297ac80a fix(agent): keep parallel tool-result messages contiguous on OpenAI Chat (Databricks image fix) (#770)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-05-28 15:25:51 -04:00
Will PflegerandGitHub b13db17faf feat(desktop): two-layer agent prompts + dynamic AGENTS.md + MCP gating + harness-agnostic skill path (#584)
Signed-off-by: Will Pfleger <wpfleger@block.xyz>
2026-05-26 17:46:30 -04:00
WesandGitHub 7ac0466e12 fix: agent management UI fixes (permissions, parallelism, form validation) (#750) 2026-05-26 13:39:49 -07:00
6d50090c01 feat(cli): add channels search for human-readable channel lookup (#712)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
2026-05-26 11:41:49 -04:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>Will PflegerWill Pfleger
efa93c4383 chore(deps): update rust crate sqlx to 0.9 (#740)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Will Pfleger <wpfleger@block.xyz>
Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
2026-05-25 21:32:34 +00:00
tlongwell-blockandGitHub 90192d8d48 chore: remove verified dead code (#745)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-05-25 08:12:02 -07:00
tlongwell-blockandGitHub 86f4c5d9a9 docs: fix stale claims, remove counts, purge LiveKit references (#742)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-05-24 13:09:34 -04:00
tlongwell-blockandGitHub 79399d9b8e feat: NIP-IA identity archival (relay backend + desktop) (#733)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-05-23 12:03:38 -04:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
4278eb5202 fix(deps): update rust crate similar to v3 (#690)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-05-23 03:19:20 +00:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
0de910f14d fix(deps): update rust crate toml to v1 (#691)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-05-22 21:45:59 -04:00
tlongwell-blockandGitHub 2a8b765c45 feat(notes): add --latest to notes get for ambiguous slugs (#730)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
2026-05-22 21:16:48 -04:00
Will PflegerandGitHub a65b7fc06f fix(deps): migrate nostr crate from 0.36 to 0.44 (#708) 2026-05-22 17:17:11 -04:00
8e26836015 Allow owners to read agent memories (#727)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Max (sprout agent) <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>
2026-05-22 16:52:02 -04:00
8bc94413eb feat(relay/git): git on Sprout, S3-backed (#726)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@users.noreply.sprout>
Co-authored-by: Sami <sami@users.noreply.sprout>
Co-authored-by: Quinn <quinn@users.noreply.sprout>
Co-authored-by: Mari <95cae996907d7cab9f5dbf43c0f53edeac6ab0b032a6feae4abfd784e467b3f5@users.noreply.sprout>
Co-authored-by: Eva <eva@users.noreply.sprout>
Co-authored-by: Tyler Longwell <tyler@block.xyz>
2026-05-22 15:05:07 -04:00
7b33c47eb4 fix(sprout-agent): retry on pre-response transport errors (#700)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
2026-05-22 10:35:39 -04:00
Will PflegerandGitHub 6dcb04bcd9 Fix CLI output normalization and wrong Nostr kinds (MCP parity) (#612) 2026-05-22 10:32:20 -04:00
504cfea20d feat: sprout notes NIP-23 long-form CLI + relay a-tag deletion (#719)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Max (sprout agent) <d8473ee32b973aa31a21a65adddcc4b69cc2a8a4dee8121ecd51926e0cddbc02@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Quinn (sprout agent) <96f056ad5f2305c8ddf637dc65d048aa4c12d7daeb8867690e34fca46b0ef64c@sprout-oss.stage.blox.sqprod.co>
2026-05-21 22:30:21 -04:00
Will PflegerandGitHub d4f55cee3c fix(deps): upgrade getrandom to 0.4 with fill() rename (#704) 2026-05-21 17:40:18 -04:00
tlongwell-blockandGitHub 962dd7dced feat(sprout-agent): auto-fallback to Databricks OAuth (#699)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-05-21 13:05:58 -04:00
fa9e26fa5c feat(sprout-agent): Databricks provider with OAuth 2.0 PKCE auth (#698)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
2026-05-21 12:08:24 -04:00
renovate[bot]GitHubrenovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
0dd9a05948 fix(deps): update rust crate sha2 to 0.11 (#665)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-05-20 22:54:25 +00:00
Will PflegerandGitHub c8f99bbc31 fix: surface swallowed errors across crates and emit turn failures to activity log (#628) 2026-05-20 14:55:20 -04:00
c9dd97ba1a feat(cli/mem): add mem patch, mem hash, and reject empty-stdin in mem set (#627)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
2026-05-20 14:51:30 -04:00
23c8fa72c7 Add relay support for NIP-51 lists (#616)
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
2026-05-20 13:59:22 -04:00
2a69f285e7 cli(mem): clarify 'no memories' wording to note core is excluded (#622)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn <dawn@sprout-agents.local>
2026-05-20 14:10:39 +00:00
c0c9cf9271 cli(messages): allow --content - to read body from stdin (#624)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: Dawn (sprout agent) <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
2026-05-20 02:38:17 +00:00
tlongwell-blockandGitHub 24520aa2b1 NIP-AE: agent engrams (kind:30174) — core memory injection + sprout mem CLI (#593)
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
2026-05-19 13:16:37 -04:00
tlongwell-blockandGitHub 6e1418e571 feat(huddle): fix concurrent-speaker mixing + jitter buffer + protocol v2 (up to 10 peers) (#609)
Signed-off-by: tlongwell-block <109685178+tlongwell-block@users.noreply.github.com>
2026-05-18 16:34:52 -04:00
tlongwell-blockandGitHub 70cb53e2c7 Add Sprig all-in-one agent binary (#605)
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
2026-05-17 13:31:58 -04:00
tlongwell-blockandGitHub e4e9923799 feat(agent): add OpenAI Responses API with auto endpoint detection (#604)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
2026-05-16 21:23:33 -04:00
tlongwell-blockandGitHub 92c859043c dev-mcp: add view_image tool (#602)
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
2026-05-15 16:21:16 -04:00
tlongwell-blockandGitHub 7171d4954d fix(relay,desktop): only advertise NIP-43 when enforced; probe pairing by supported_nips (#601)
Signed-off-by: Tyler Longwell <tlongwell@squareup.com>
2026-05-15 15:11:37 -04:00
tlongwell-blockandGitHub 9e94a7c475 fix(agent): fix OpenAI-compat request body serialization and max_tokens (#595) 2026-05-15 11:07:14 -04:00
Will PflegerandGitHub 1d8a130b32 refactor(cli): restructure flat commands into 12 subcommand groups (#585) 2026-05-14 19:13:49 -04:00
Will PflegerandGitHub 01a3df7f1f feat(sdk): add builder functions for workflows, DMs, and presence (#589) 2026-05-14 18:49:57 -04:00
1b87a0905f refactor: extract shared @mention resolver into sprout-sdk (#580)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
Co-authored-by: npub1cc3ha7z055mu0rwwu7806t2wt8mj3pvu0uv5mfp2c50dahaqhczshdalg6 <c6237ef84fa537c78dcee78efd2d4e59f728859c7f194da42ac51ededfa0be05@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: Dawn <dawn@sprout.local>
2026-05-14 11:38:52 -04:00
2ee7356424 fix: add default-run to sprout-relay so cargo run -p sprout-relay works (#577)
Signed-off-by: Matt Toohey <contact@matttoohey.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-14 08:34:23 -07:00
tlongwell-blockandGitHub 9a403d3e8a fix: channel member search via NIP-50 + Typesense indexer fix for kind:0 (#569)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
2026-05-13 15:03:35 -04:00
tlongwell-blockandGitHub 8d5abb7a09 chore(acp): raise default idle timeout from 320s to 620s (#566)
Signed-off-by: Tyler Longwell <109685178+tlongwell-block@users.noreply.github.com>
2026-05-13 11:04:53 -04:00