Commit Graph
15076 Commits
Author SHA1 Message Date
davotoula d8e4ada781 Code reviewP
- Collapse filterSettings' two identical lookup lambdas into one stringLookup
- Rebuild via SettingsCategory.copy() so new fields aren't silently dropped
- Memoize buildSettingsCatalog with remember(hasPrivateKey, nav, uriHandler);
  onResetMarmot reads isResettingMarmot via rememberUpdatedState to avoid a
  stale-capture, eliminating ~60 allocations per keystroke
2026-06-03 09:21:24 +02:00
davotoula 4446b12972 feat(settings): add settings catalog data model + filterSettings
feat(settings): add search box that filters settings rows by title + keywords
refactor(settings): expose legal section as legalSettingsCategory factory
feat(settings): add search placeholder, empty-state, and keyword strings
test(settings): cover filterSettings (blank/title/keyword/category/empty/danger)
refactor(settings): match category title in search; use data classes
2026-06-03 09:20:54 +02:00
nrobi144 599a16193a fix(desktop): collapsed sidebar — tighter ripple + hover tooltip
Two related polish fixes on the collapsed sidebar:

1. The hover/active highlight on each nav item used to span the full
   sidebar width (minus 8dp outer padding), producing ~12dp of empty
   highlight either side of the 24dp icon. Now the highlight clips to
   a 40dp square centered on the icon (24dp icon + 8dp padding on each
   side), so the ripple sits tight against the glyph.

2. When the sidebar is collapsed, the label was already supplied as
   `contentDescription` for screen readers but had no visual
   affordance. Added a `TooltipArea` that surfaces the label on hover
   (Surface + inverseSurface tonal style, matching the existing
   TorStatusIndicator tooltip pattern), so mouse users can also see
   what each icon means without expanding the sidebar.

Applied to both `SidebarNavItem` and `SidebarFeedItem` since both
suffer the same issue. Expanded behaviour is unchanged.
2026-06-03 09:46:15 +03:00
nrobi144 e5b210d4e1 fix(desktop): make first-pinned-feed default actually take effect
Two bugs that together caused HomeFeed to always open on Following:

1. FeedScreen was reading feedRepo.pinnedFeeds.value as the source of
   truth for the first pinned feed. That's a stateIn-derived flow with
   initial value persistentListOf(); the underlying _feeds StateFlow
   IS loaded synchronously by FeedDefinitionRepository on construction,
   but the derived pinnedFeeds doesn't reflect it until the first flow
   emission propagates — which is too late for `remember` to see.
   Fixed by reading feedRepo.feeds.value directly and filtering /
   sorting by pinOrder ourselves.

2. DeckColumnContainer was passing initialFeedMode = FeedMode.FOLLOWING
   when rendering DeckColumnType.HomeFeed, which overrode FeedScreen's
   first-pinned logic entirely. Removed the hardcode so the deck's
   home column inherits FeedScreen's default.

With both fixed, a user who has only Global pinned now opens to Global
on launch instead of Following.
2026-06-03 09:36:18 +03:00
nrobi144 99af0f75e1 fix(desktop): default home tab to first pinned feed, not last-saved mode
If the user has pinned only Global (or only a custom feed), the app
should open to that on launch instead of showing Following just
because DesktopPreferences.feedMode happened to be saved as
Following. The "pinned feeds" list is the user's stated ordering;
the first item should drive the initial tab.

Resolution order (most specific wins):
  1. explicit customFeedSource/customFeedId from the caller
  2. explicit initialFeedMode from the caller
  3. first pinned feed in feedRepo.pinnedFeeds (NEW)
  4. DesktopPreferences.feedMode (last-saved, previous default)

For a pinned Filter feed, this also seeds activeFeedId and
activeFeedSource so the feed mounts in CUSTOM mode with the right
source.
2026-06-03 09:31:02 +03:00
nrobi144 37662eea45 fix(desktop): port StickToTopOnPrepend to commons and apply on home feed
Real root cause of the "stale feed on launch" perception bug: when
fresh events prepend to the desktop home feed, Compose's stable-key
diff (`items(loadedState.list, key = { it.idHex })`) preserves the
visual anchor on whatever item was already visible. The user's
previously-visible top item — once at index 0 — silently shifts to
index N as N new items are inserted above the viewport. From the
user's perspective the feed looks frozen on stale items even though
the underlying state HAS updated; switching screens unmounts
FeedScreen, recreates lazyListState at index 0, and on remount paints
from the now-current top.

Android already handles this with StickToTopOnPrepend
(amethyst/.../WatchScrollToTop.kt:133-152), but the helper lived in
the Android module and Desktop had no equivalent.

Changes:

- New commons/.../ui/feeds/StickToTopOnPrepend.kt with the same
  observer + snapshotFlow trick, ported to use plain `collectAsState`
  (replacing the Android-only `collectAsStateWithLifecycle` — the
  effect's lifecycle is already bound to composition via
  LaunchedEffect). Provides the same overloads:
    * StickToTopOnPrepend(LazyListState, firstItemKey)
    * StickToTopOnPrepend(LazyGridState, firstItemKey)
    * StickToTopOnPrepend(FeedContentState, LazyListState)
    * StickToTopOnPrepend(FeedContentState, LazyGridState)
- FeedScreen wires StickToTopOnPrepend(viewModel.feedState,
  homeFeedLazyListState) at the same scope as the hoisted lazy list
  state and the NewPostsChip.

Mutually exclusive with the NewPostsChip: the chip's visibility
predicate fires when isAtTop is false, the auto-snap fires when
isAtTop is true. Together they cover both cases:
  * user at top → events arrive → auto-snap shows them
  * user scrolled down → events arrive → chip announces them

The Android version in amethyst/.../WatchScrollToTop.kt is left in
place to avoid a wider refactor; it can be reduced to a thin delegate
in a follow-up.
2026-06-03 07:33:39 +03:00
nrobi144 44febcc77f feat(desktop): add Amethyst logo to Tor and account-loading splashes
Both loading splashes (the Tor-connect gate and the account-loading
screen between Tor active and LoginScreen) now show the Amethyst
icon tinted to the theme primary, anchored below the status text.

Layout pattern (status-forward, both splashes):
  spinner → status text → Amethyst logo (96.dp, primary tint)

Brief research summary backing the choice:
- Apple HIG argues against splash branding, but its model assumes
  near-instant launch — not applicable here where the Tor gate
  can block for seconds.
- Material Design 2's branded-launch-screen pattern endorses
  logo + brand color while a placeholder UI loads.
- The status-forward order keeps the dynamic info (what we're
  waiting on) leading and the brand as the anchor below — the
  right call when the wait is non-trivial.
2026-06-03 07:31:49 +03:00
nrobi144 38a191341f fix(desktop): bump new-posts chip top margin to 16dp
Tighter 8dp gap clipped visually too close to the search header card.
2026-06-03 07:31:34 +03:00
Claude af193e03ab refactor: tidy DM history assembler + restore per-relay diagnostics
Audit follow-up on the per-relay paging work:

- Restore DmRelayLog in the convo history loadMore (every other nip04 /
  giftwrap assembler logs it) and add per-relay milestone logs: which
  relay reached the bottom, which stalled and why, plus a one-line
  done/still-trying breakdown when the window settles — the snapshot to
  reach for when a chat doesn't load.
- Extract markStalled() (dedupes onClosed/onCannotConnect, logs once per
  relay) and relaysFor() (dedupes the active-convo relay lookup).
- relayCount now counts the relays still being paged (done ones drop out)
  instead of staying frozen at the total.
- Drop the unused loadEverything().
- Fix WindowLoadTracker docs/log that claimed it 'gives up' on silent
  relays: it only stops waiting and reports them; the owner decides (the
  convo keeps them open and retries). Fix a dangling KDoc link in
  RelayReachMarker.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-03 02:26:46 +00:00
Claude afa02df3a0 feat: in-stream per-relay paging markers for NIP-04 conversations
Visualises the per-relay-independent engine: each relay gets a thin
marker in the message stream at the depth (createdAt) it has paged down
to, sitting just below the oldest message it has loaded. As a relay
pages older its reached-back cursor drops and the marker slides down; a
relay that races ahead leaves its marker deep while slower relays' trail
higher and converge as they catch up — ✓ done (empty-EOSE), … stalled
(auth CLOSE / unreachable, still trying), ↓ reaching. Hidden once the
conversation is fully converged (every relay done or stalled).

Adds an optional markersInGap slot to the shared chat feed view
(no-op for public-chat callers) invoked per message gap with its
createdAt bounds; ChatroomView renders the markers from the
relayProgress flow.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-03 00:39:00 +00:00
Claude cbee966bb7 feat: page each NIP-04 DM relay independently to converge on one window
Replaces the lock-step round model (every relay advanced one page per
global round, gated by the slowest) with per-relay continuous paging:
each relay continues to its next page the instant it EOSEs, off its own
cursor. The subscription layer diffs per relay, so re-issuing only
re-REQs the relay whose cursor moved — others' in-flight REQs are
untouched. Fast relays race to the bottom in back-to-back pages while
slow / auth-walled relays catch up at their own pace; none are
abandoned (this reverts the give-up behaviour — slow relays keep their
subscription open and keep trying), so every relay converges on the same
window.

A relay is done on an empty page; one that won't answer (auth CLOSE,
unreachable, silent) is marked stalled but keeps trying. loadingMore
clears once every relay is done or stalled. Exposes per-relay
RelayPagingProgress (reached-back / done / stalled) for the upcoming
in-stream progress markers.

Splits the convo widen loop so each protocol pages on its own loader
state — NIP-04's continuous loading no longer starves gift-wrap paging.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-03 00:29:53 +00:00
Claude 07b0c87c38 fix: stop giftwrap/rooms loads completing before their REQs are sent
The silence + connect-grace backstops are only meaningful when the owner
feeds onReqSent, which only the convo NIP-04 path does. But connectStalled
keyed off the ABSENCE of a recorded REQ, so for giftwrap/rooms (which never
call onReqSent) every relay looked connect-stalled after connectGrace —
the window completed at ~15s before its REQs had even gone out during a
slow connect storm ('giftwrap.live load done: settled/silent' 45s before
the REQ), prematurely declaring an empty round done and tripping the
no-progress guard, so giftwraps stopped loading.

Gate both REQ-aware backstops behind a tracksReqSends flag that only the
convo manager sets; everyone else keeps the plain settle / idle / cap
behavior. Adds a regression test that a non-tracking tracker keeps
blocking a never-heard-from relay until it actually settles.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-03 00:04:09 +00:00
Claude 0d27477c4d fix: mark a DM conversation done when its last relays stop making progress
After the connect-grace fix the convo history no longer hangs, but it
could linger forever showing 'N relays' with no progress bar and
exhausted=false: a correspondent's auth-walled relay (ditto, which only
ever CLOSEs 'all authors must be authenticated') never reaches the
pager's done/given-up state, and the no-progress guard merely *skipped*
re-issuing the round — stopping the loop without ever reflecting that
we're finished.

When the guard trips (same active relays, zero events two rounds
running) give up on those relays and recompute exhaustion, so the
conversation reports as fully loaded and the relay count clears. My own
reachable relays empty-EOSE to 'done' and never reach this branch, so
only genuinely stuck correspondent relays are dropped.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 23:43:12 +00:00
Claude d658ae2414 fix: don't let a relay stuck before its REQ hold the DM load for 5 min
The convo history spinner could sit for the full 5-minute absoluteCap
('load done: cap' in the logs). A correspondent relay (ditto) dropped
after its auth-required CLOSEs and got stuck reconnecting on a flaky
network, so its round-2 REQ was never delivered. It therefore reached
neither a terminal signal (no CLOSE without a REQ) nor the silence
backstop (which measures from REQ-delivery), and blocked the round until
the cap.

Add a connect-grace backstop: a relay that has been expected past
connectGrace (15s) without even receiving its REQ — i.e. stuck
connecting — stops blocking the round. Unlike the silence backstop it
does NOT give the relay up (it may be a genuinely slow connect), so the
owner keeps it and retries it next round; only relays that accepted a
REQ and then went silent are abandoned.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 22:31:42 +00:00
Claude 3cb6613cd7 fix: give up on DM relays that accept a REQ but never answer
The convo NIP-04 history spinner stayed up for minutes against 9 relays
even when the conversation was fully loaded. Auth-walled relays (ditto,
nostr.wine, …) accept the REQ (success=true) and then send nothing — no
event, no EOSE, no CLOSED. WindowLoadTracker only completed once every
relay reached a terminal signal, an idle gate that required hearing from
*all* relays, or the 5-minute cap; a silent relay armed none of those,
so only the cap freed the spinner. The pager likewise kept the silent
relay 'active' every round, so the count never dropped and exhaustion
never completed.

Add a silence backstop keyed off onSubscriptionStarted (REQ delivered,
post-connect — so a slow connect isn't mistaken for a dead relay): a
relay that received its REQ but stays silent past silenceTimeout (10s)
no longer blocks completion and is reported via onAbandoned, which the
convo assembler uses to giveUp() the relay in its pager so it leaves the
active set and lets exhaustion finish. finish() applies the give-up
before flipping loading, so the round collector recomputes exhaustion
after the silent relays are dropped.

Tests cover the pager give-up/exhaustion and the tracker's silence +
connection-gap behavior.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 22:10:16 +00:00
Claude 0430fd176c refactor: scope NIP-04 DM filters per relay to the keys that own each relay
Nip04DmRelays held two flat relay sets and every filter named the whole
conversation group, so a relay that belongs to only one counterpart was
still asked about all of them (e.g. {authors:[bob,charlie]} sent to a
relay that is only charlie's). Restructure it into per-relay key maps so
each relay sees exactly the keys it owns:

  fromMe: my outbox             -> {authors:[me], #p:[whole group]}
          each counterpart inbox -> {authors:[me], #p:[keys reading there]}
  toMe:   my inbox              -> {authors:[whole group], #p:[me]}
          each counterpart outbox-> {authors:[keys publishing there], #p:[me]}

Relays shared across roles union their key sets, so my own relays still
carry the full group while a counterpart's relay only ever names that
counterpart.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 21:48:06 +00:00
Claude 772355d2fc fix: don't ask a correspondent's relays for my own NIP-04 messages
A conversation's NIP-04 relay set folded the correspondent's inbox
(read) relays into the from-me filter set, so we sent {authors:[me]} to
relays that belong to the other party (e.g. ditto). Those relays have no
reason to hold my authored messages and auth-walled ones reject the
filter outright ("all authors must be authenticated"), stalling the
load. Scope filters to relay owners: my outbox carries my messages; the
correspondent's outbox (plus my own inbox as a legacy safety net)
carries theirs. Drops groupInbox from the from-me set.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 21:28:30 +00:00
Claude 5bd7b765d6 chore: log which account contributes which relays to the DM filters
Adds DmRelayLog, a diagnostic that prints — per DM subscription — the
account whose relays are being used and breaks the relay set down by the
source list each relay comes from (NIP-65 inbox/outbox, DM-relay-list,
private-storage outbox, local relays). Wired into all six DM assemblers
(NIP-17 live/history, NIP-04 rooms live/history, NIP-04 convo live/history).

The existing REQ lines now also print the resolved relay URLs (split into
fromMe/outbox and toMe/inbox for the NIP-04 paths), so an unexpected relay
— e.g. a write-only NIP-65 relay that only the NIP-04 home+dm path queries —
can be traced back to the list it leaks in from.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 20:57:34 +00:00
Claude 5080ab08c5 fix: give up on relays that keep rejecting us so a chat can finish loading
With "exhausted only when every relay empty-EOSEs", a relay that demands auth we
can't satisfy — e.g. relay.ditto.pub answering "auth-required: all authors must
be authenticated" for a correspondent's pubkey we can't authenticate as — CLOSEs
every round, never finishes, and the conversation loads forever.

UntilLimitPager now tracks a per-relay CLOSED streak; after GIVE_UP_AFTER_CLOSES
(3) consecutive CLOSEDs with no answer in between (so the pool's auth handshake +
a retry have already failed), the relay is marked "given up" and excluded from
activeRelays. It is NOT counted as done (it didn't empty-EOSE — we just can't
read it), but it no longer blocks exhaustion. The streak resets on any event or
EOSE, so a relay whose auth succeeds is never abandoned. onClosed wires into the
pager and re-checks exhaustion when a relay tips into given-up.

NIP-17 only queries the user's own DM relays (auth = self), so it rarely hits
this; it's the NIP-04 conversation fan-out to the correspondent's relays that
trips author-auth-required relays.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 20:24:23 +00:00
Claude ae62968160 fix: mark DM history exhausted only when every relay empty-EOSEs
Exhaustion was decided by "the round returned zero events," but a round can
return zero because relays CLOSED (auth) or never answered — not because they
reached the end. So "All caught up" appeared before slow/auth relays had
actually finished.

A relay is finished only when it returns an empty page followed by EOSE — the
pager already records exactly that in its per-relay `done` flag (CLOSED /
cannot-connect deliberately don't set it). So the chat is now exhausted only
when every relay is done (activeRelays is empty), per the rule "all relays must
return that EOSE." A post-auth empty EOSE that lands after the round already
settled on the earlier CLOSED now flips exhausted immediately too
(markExhaustedIfAllDone in onEose), not just at the next round boundary.

Because a chat is no longer "done" while a relay keeps CLOSING, the conversation
auto-fill (no stall-gate) would otherwise re-issue identical rounds and hammer
that relay. A no-progress guard skips re-issuing a round whose relay set and
zero-event result are unchanged; the pool re-auths on the open subscription and
its EOSE clears the guard and finishes the relay. All the new single-valued
state resets on account/conversation switch alongside the existing display flows.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 20:00:31 +00:00
Claude baad77a966 refactor: key the conversation history pager by a (account, ChatroomKey) type
Replaces the "pubkey/listId" string key with a small ConvoKey data class holding
the account pubkey and the ChatroomKey. ChatroomKey is a data class over the
participant set, so it's a collision-free key — unlike listId, which is its
32-bit hashCode as a string and can collide. Including the account keeps the two
accounts' views of the same correspondent on separate cursors (the manager is a
singleton shared across logged-in accounts).

Also lighter on allocation than the string it replaces: the per-relay-event hot
path captures the key once per subscription (no per-event construction), and the
remaining call sites build one small object instead of concatenating + hashing a
string.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 19:18:38 +00:00
Claude 0f0644200d fix: don't leak DM history state across logged-in accounts
The DM managers live in a single shared coordinator (Amethyst.instance.sources),
so every logged-in account uses the same instances. The per-account paging state
(pager cursors, started set, accounts map) was keyed by pubkey and fine, but the
single display flows — exhausted, relayCount, reachedBack, autoFillRoomMark —
were not. Switching from an account that had exhausted its history to another
left exhausted=true, so the second account's auto-fill was gated shut and its
chats never paged in.

Each history manager now tracks the active account/conversation and repoints its
display flows on switch: exhausted is restored per-account (kept in a small
exhaustedByUser/exhaustedByList map so an already-finished account shows "all
caught up" rather than re-paging), and the cosmetic flows + stall mark reset.
Paging cursors stay in the per-account pager, so progress is preserved.

Also scopes the conversation history pager key by account pubkey: a ChatroomKey
(hence listId) is identical for the same correspondent across accounts, so two
logged-in users viewing the same person would otherwise share one cursor.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 19:11:40 +00:00
Claude 0d0857c2e9 feat: modern DM history status card with "all caught up" finish
Replaces the bare spinner + "Load entire history" link with a status card that
tells the user what the app is actually reaching for: per protocol, it shows
"Older <encrypted|legacy> messages" with a subtitle of "<NIP-17|NIP-04> · N
relays · back to <month>" while it pages. When that protocol runs dry the card
doesn't just vanish — it crossfades to "All caught up · Reached the start of
your <…> messages", holds for a beat, then collapses away.

The history managers now surface the live status the card needs: relayCount
(relays the current page is asking) and reachedBack (oldest point paged to, from
the deepest per-relay cursor), added to all three history managers and computed
via UntilLimitPager.deepestUntil. The "load entire history" action is dropped —
scroll-driven paging already walks to exhaustion, so the link was redundant.

Each protocol's card sits at its own oldest-loaded boundary (rooms list) or both
stack at the conversation's oldest end, so the two protocols' loading is shown
independently at their real depths. New strings use a <plurals> for the relay
count.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 18:38:49 +00:00
Claude 5e67fe913f fix: page NIP-17 and NIP-04 history independently in the rooms list
The rooms list had a single auto-fill trigger and a single loading boundary,
both pinned to the oldest private room of EITHER protocol. When NIP-04 history
ran far deeper than NIP-17 (e.g. NIP-04 back to 2023, NIP-17 shallow), that
oldest room was a 2023 NIP-04 row at the very bottom, so gift-wrap loadMore only
fired when the user scrolled all the way down to it — NIP-17 never paged on the
way, and the loading indicator was only visible at the bottom.

Split the trigger and the boundary per protocol. Each protocol now widens on its
OWN oldest-loaded room (gated only on its own loader and its own room-count
stall-gate) and shows its OWN loading indicator at its own depth, so NIP-17 and
NIP-04 page independently as the user scrolls — matching their very different
histories. WidenPrivateWindowWhen is generalized to a per-protocol WidenHistoryWhen
called once per protocol (and once per protocol for the empty-feed hunt). Each
history manager carries its own auto-fill stall mark (autoFillRoomMark).

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 17:57:56 +00:00
Claude 030f2fdbfa Merge remote-tracking branch 'origin/main' into claude/relay-message-pagination-LMqSQ
# Conflicts:
#	amethyst/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/chats/privateDM/ChatroomView.kt
2026-06-02 14:59:28 +00:00
nrobi144 098a74ca53 feat(desktop): add "New posts" chip with slide-from-top animation
Fixes the perceptual "stale feed on launch" bug: on cold launch the
desktop feed paints with whatever local cache had (up to 7 days old)
before relays catch up. The live updateFeedWith() path already prepends
fresh events silently, but users had no signal that fresh content
arrived unless they were already at the top of the feed (auto-snap via
StickToTopOnPrepend).

This adds a Twitter/Mastodon-style floating pill chip that slides down
from above the search header when fresh events have prepended AND the
user is scrolled below position 0. Tapping it smooth-scrolls to top
and slides the chip back up off-screen. Scrolling to top manually
also dismisses it.

Implementation:

- NewPostsChip + rememberNewPostsChipState in commons/commonMain so any
  future feed surface (incl. Android, iOS) can adopt it. Desktop wires
  it today; Android continues with the existing auto-stick + bottom-nav
  dot pattern.
- Visibility predicate is pure-function and unit-tested (5 cases).
- Predicate mirrors the inverse of StickToTopOnPrepend's "at top" check
  so the two systems are mutually exclusive — auto-snap when at top,
  chip when not.
- Chip placement: floating Alignment.TopCenter inside FeedScreen's outer
  Box, offset by the animated headerSpacerHeight (60.dp normal,
  300.dp when search is expanded) so it tracks the header card.
- Hoisted lazyListState + headerSpacerHeight one level so the chip can
  share scroll state with the LazyColumn. Existing viewport-aware
  metadata loading is unchanged (same lazyListState reference).
- Animation: slideInVertically(tween(280, FastOutSlowInEasing)) + fadeIn
  for enter; slideOutVertically(tween(220, FastOutLinearInEasing)) +
  fadeOut for exit. Initial/target offset of -fullHeight-16 guarantees
  the chip is fully off-screen above its rest position.
- Per-column scope by construction: each FeedScreen instance has its
  own chip state (deck mode shows one chip per column).
- Resets cleanly on feed mode switch (Following ↔ Global ↔ Custom)
  because rememberNewPostsChipState is keyed on FeedContentState,
  which is recreated when viewModel = remember(feedMode, activeFeedId)
  recomposes.

Plan: docs/plans/2026-06-02-feat-new-posts-chip-desktop-feed-plan.md
2026-06-02 17:16:58 +03:00
Vitor PamplonaandGitHub a4aff84897 Merge pull request #3124 from nrobi144/feat/desktop-feed-ui-refresh
feat(desktop): Feed UI refresh — inline expansion, comments, related content
2026-06-02 08:02:50 -04:00
Vitor PamplonaandGitHub 3de0fdc4c5 Merge pull request #3122 from davotoula/feat/share-as-dm
Share content directly to a DM ("Send as DM" share target)
2026-06-02 08:00:35 -04:00
nrobi144andClaude Opus 4.7 aeb49c3cac fix(desktop): address PR review findings on feed UI refresh
5 issues from davotoula's review on PR #3124:

- #3 (protocol): inline reply emitted a minimal e/p tag set instead of
  NIP-10. Extract `commons/actions/ReplyActions.replyTo` wrapping
  `TextNoteEvent.build(replyingTo=)` (which already encodes root marker,
  reply marker, parent root-e-tag carry) + carry parent's p-tag chain via
  `notify(...)`. Replies to deep-thread notes now thread correctly in
  Damus/Primal/Coracle. Covered by `ReplyActionsTest`.

- #4 (architecture): reaction/follow/reply each inlined
  `localCache.consume + relayManager.broadcastToAll` in 5 sites with
  inconsistent ordering. Extract `desktopApp/cache/dispatch(...)` —
  canonical local-first order — and route all 5 sites through it.

- #1 (UX): related-content section scanned the cache once via
  `DisposableEffect(noteId)` and never refreshed. Switch to `produceState`
  collecting `DesktopLocalCache.eventStream.newEventBundles`; re-scan only
  when an arriving bundle contains a candidate (matching hashtag or
  author). `LargeCache.notes` is a ConcurrentSkipListMap (weakly consistent
  iterator) so the scan stays safe on the composition coroutine.

- #2 (UX): `DeckColumnContainer` re-requested focus on every
  `currentOverlay` change, stealing focus from sibling columns whenever
  any column mutated overlay state. Drop to `LaunchedEffect(Unit)` and
  wrap the column in `key(column.id)` in `DeckLayout` so the one-shot
  effect survives column reordering.

- #5 (consistency): zap totals bypassed the shared `ZapFormatter`. Wire
  `RelatedContentRow`, `CommentItem`, and `NoteActions` to
  `commons/util/ZapFormatter.{showAmount,toZapAmount}`; delete
  `formatZapAmount` and `formatSats` desktop-local helpers.
  `WalletColumnScreen.formatSats` intentionally kept — locale-aware full
  precision for wallet balance is by design.

Plan: docs/plans/2026-06-02-fix-desktop-feed-review-findings-plan.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 13:45:00 +03:00
Róbert NagyandGitHub 1f81a7fb25 Merge branch 'main' into fix/desktop-log-noise 2026-06-02 10:51:59 +03:00
nrobi144andClaude Opus 4.6 2ca8eb31dc fix: address root causes of 6 runtime log noise issues
1. LocalRelayStore: use batchInsert() with per-row savepoints instead of
   manual transaction — UNIQUE constraint violations skip that row instead
   of failing the whole batch

2. Robohash empty hex: guard blank input in CachedRobohash.get() with a
   fallback all-zeros hex key instead of passing empty string to assembler

3. GiftWrapEvent decrypt: downgrade from WARN to DEBUG — expected when
   gift wraps from local relay cache aren't addressed to current user
   (subscription filter is correct, but hydration doesn't filter by p-tag)

4. Relay URL %20: decode percent-encoded spaces before rejection check in
   RelayUrlNormalizer.fix() — wss://relay.example.com/%20 now normalizes
   to wss://relay.example.com/ instead of being rejected

5. NIP19 Parser: downgrade from ERROR/WARN to DEBUG — malformed bech32
   from relay content is expected in the wild, catch+log is correct

6. VLC macOS: add --avcodec-hw=none (disables VideoToolbox that causes
   CVPN chroma failures) and --reset-plugins-cache (rebuilds stale cache
   on startup instead of logging hundreds of stale-cache errors)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-02 10:47:58 +03:00
Róbert NagyandGitHub 70636c0f9a Merge branch 'main' into feat/desktop-feed-ui-refresh 2026-06-02 10:01:10 +03:00
Claude 77d8657b62 feat: page DM history by until+limit per relay (gap-proof stop signal)
The time-slice history bounded re-downloads but couldn't tell "this relay is
empty" from "this is a gap" — an empty time slice can sit above older messages,
so the only stop was the 10-year maxLookback, and a wide late slice could pull a
20k-event firehose in one request.

History now pages backward by until+limit, per relay (UntilLimitPager). Each
round asks every not-yet-empty relay for up to 10000 events older than its own
cursor, no since, so gaps are skipped: an empty page + EOSE is a gap-proof
"nothing older on this relay" signal. A relay returning fewer than the limit is
treated as its own cap, not exhaustion — only an empty page ends it. A relay
answering CLOSED isn't "empty" (it may answer after the auth handshake), so the
global exhausted flag flips only when a whole round advances no relay at all,
which also stops the loop on a relay that keeps CLOSing. limit caps per-request
volume too.

Both NIP-04 history managers now paginate themselves (per relay, scoped) instead
of following the gift-wrap slice; loadEverything pages to the end by auto-issuing
the next round until exhausted. The live tail and the rooms-list stall-gate are
unchanged. Filter builders gained an optional limit; the conversation NIP-04
helper exposes its outbox relay set + a per-relay until builder.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 03:54:09 +00:00
Claude bc86813cbc fix: load older history at the start of a short conversation
The conversation auto-fill only fired when the thread overflowed the screen, so
a one-message room sat at its load-more boundary without ever advancing — you
were at the start of the chat but it wouldn't reach for older messages. That
overflow guard was added back when each widen re-downloaded the whole window
(to stop a short thread auto-walking the gift-wrap firehose); now that history
loads in bounded, non-re-downloading slices that reason is gone.

Drop the overflow requirement: load the next slice whenever the oldest end is in
view, including a thread too short to scroll. A one-message room now walks
history back to its real beginning (or until the window is exhausted), one
bounded slice at a time, gated on both loaders being idle.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-02 01:18:53 +00:00
Claude 793860170f feat: split DM loading into a live tail + bounded history slices
Every widen re-requested the whole DM window (the filters carried `since` only,
no `until`), so a relay re-streamed the entire history from the new floor — a few
pixels of scroll walked the window to the 10-year backstop, re-downloading
exponentially more each step (589 → 1486 → 2609 events in one session). This
splits each DM protocol into two responsibilities:

- Live tail (existing managers, now fixed): a one-week floor with no `until`,
  always open to the future. Never widens, so new messages keep arriving.
- History slices (new managers): load the past in bounded `since`+`until`
  one-shot slices. Widening fetches only the new band `[newFloor, prevFloor]`;
  consecutive slices are disjoint so advancing the filter never re-streams an
  earlier slice — they live in the cache. The NIP-17 2-day wrapper-timestamp
  margin is applied to the slice `since`, overlapping adjacent slices so a
  randomized outer timestamp can't open a gap. NIP-04 (exact timestamps) needs
  no margin.

New: AccountGiftWrapsHistoryEoseManager owns the geometric window and the
bounded slices; ChatroomListNip04HistorySubAssembler / ChatroomNip04History-
SubAssembler follow its slice bounds so both protocols page to the same depth.
The live managers (AccountGiftWrapsEoseManager and the NIP-04 followers) are
reduced to the fixed one-week tail.

Also adds the rooms-list stall-gate: the auto-fill remembers the private-room
count at the last widen (on the history manager, so it survives reopening the
screen) and stops widening once a step brings in no new private room — widening
pulls older messages, not rooms, so a few busy correspondents would otherwise
flood events without ever filling the list. "Fill until full OR nothing new
found", instead of walking to the 10-year backstop.

Design: amethyst/plans/2026-06-01-dm-live-tail-and-history-slices.md

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-01 23:43:02 +00:00
Claude 9e2e595cac feat: log NIP-04 (kind 4) REQs in the DM relay diagnostics trail
The wire-level diagnostics logger only recognized gift-wrap kinds (1059/21059),
so kind:4 NIP-04 REQs never produced a `REQ -> wss://…` line and their relays'
connect/CLOSED/NOTICE lines were filtered out — even though the kind:4 REQs are
issued (the `[rooms.nip04] REQ` manager logs show them going out). Broaden the
match to the whole DM path (1059/21059/4) so the wire trail covers both
protocols, and rename the gift-wrap-specific identifiers to dm-path.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-01 23:12:19 +00:00
Claude a2033499c9 fix: measure out-of-window events against the margined REQ floor
The load summary's "before floor" count compared incoming gift wraps against the
un-margined window floor (window.since), but filterGiftWrapsToPubkey actually
asks relays for `since = window.since - 2 days` to catch wraps whose randomized
outer timestamp dips below the real message time. So the deliberate 2-day margin
band showed up as "before floor" (a boot reported "6 before floor" that were all
legitimate margin-band wraps), conflating the intended margin with a relay that
ignores `since`. Compare against window.since - twoDays() so only a relay that
under-shoots the floor we actually requested is flagged.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-01 23:06:10 +00:00
Claude c33a10c945 fix: complete a window load only when every relay has settled
A boot trace reported `[giftwrap] load summary: 1 event(s)` for a 7-day window
that actually holds ~100, because the DM relays connect over a ~35s spread: one
fast relay delivered a single event at +7s, the next 3s were quiet only because
the other four relays were still mid-connect, and the idle heuristic mistook
that gap for "done". The rest streamed in afterwards, past the load boundary.

The clean "all relays answered" completion was also unreachable: relays that
answer `CLOSED auth-required` (and unreachable relays) never produced an EOSE,
and WindowLoadTracker ignored onClosed/onCannotConnect entirely — so the only
completion path was the too-eager idle timer firing in a connection gap.

Completion is now per-relay terminal-state based. A relay is "settled" once it
sends a terminal signal — EOSE, CLOSED, or cannot-connect — and the load is done
when every targeted relay has settled. This is fast when relays are fast
(everyone EOSEs in a couple seconds) and correctly patient when they are not
(waits for the slowest relay), and it cannot trip in a connection-stagger gap.
The idle timer is kept only as a backstop for a relay that streams without ever
EOSE'ing, gated behind "every relay has been heard from" so it too can't fire in
a gap; the absolute cap still bounds a relay that connects then hangs forever.

WindowLoadTracker.trackingListener now wires onClosed and onCannotConnect into
the tracker, and a live event no longer settles a relay (its preceding EOSE
does); forward (newEose) semantics are unchanged.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-01 22:59:52 +00:00
Vitor PamplonaandGitHub 063da53ffd Merge pull request #3123 from vitorpamplona/claude/relaxed-edison-N0F4J
Support ephemeral signers for anonymous post uploads
2026-06-01 18:57:22 -04:00
Claude e8a50bfa11 fix: use ephemeral signer for media uploads in anonymous posts
When composing an anonymous post (tap pfp to go anon on the short-note
or comment screens), media uploads still authorized against the Blossom /
NIP-96 server with the real account's signer. The server echoes that
pubkey back in the returned media URL (e.g. Blossom's `as=<pubkey>`),
linking the real identity to the supposedly anonymous post.

Thread an optional `forcedSigner` through the upload chain
(MultiOrchestrator -> UploadOrchestrator -> NIP-96/Blossom auth). Both
ShortNotePostViewModel and CommentPostViewModel now hold a single
ephemeral signer per compose session, reused for every photo/voice
upload and for the final anonymous broadcast, so the upload auth event
and the post share one throwaway key. signAnonymouslyAndBroadcast accepts
that signer so the media author matches the post author. Non-anonymous
callers are unaffected (forcedSigner defaults to null).

The signer is reset in cancel() so each new compose session gets a fresh
anonymous identity.
2026-06-01 22:33:42 +00:00
Claude 5fb0cc9dd4 fix: don't declare a window load done while relays are still connecting
A cold boot trace showed `[giftwrap] load done: idle` firing with 0 events at
+3s while the DM relays had not even connected yet (nos.lol first connected at
+14s). The idle watchdog could not tell "quiet because the relays answered"
from "quiet because nothing has connected", so a slow boot looked finished with
an empty result — and with the Messages screen open that false "done, 0 events"
would trip the auto-fill into widening the window over and over.

WindowLoadTracker now only arms the idle path after the first event or EOSE
(sawActivity). Before that first sign of life, the load can only end via a
generous no-response bound (30s) or the absolute cap, so a still-connecting
boot stays "loading" instead of falsely completing empty. The clean paths are
unchanged: relays that EOSE complete via "all relays", and a stream that starts
then quiets still completes via "idle".

Also makes the gift-wrap load-summary collector a singleton: the tracker is
shared across accounts, so launching it per newSub double-logged every summary
when a second account was logged in. Per-load counters are now reset
synchronously at load start (beginWindowLoad) rather than on the collector's
rising edge, so no in-flight event is counted against the wrong load.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-01 22:24:16 +00:00
Claude 923ad500a7 feat: count per-load gift-wraps and flag out-of-window events
Removes the EVENT <- and AUTH <- per-message lines from the DM diagnostics
logger (too busy, and auth is not relevant to the pagination trail), and adds
a per-load tally to the gift-wrap manager so a relay that ignores `since` and
re-streams the whole history every widen becomes visible.

Each load now counts the gift-wrap events the relays push and, separately,
those whose outer created_at falls before the floor the REQ asked for. A
collector on the window-load flag resets the counters when a load starts and
logs `[giftwrap] load summary: N event(s), X before floor (since=…)` when it
finishes. A total that keeps growing across widens (with a large out-of-window
share) is the fingerprint of "getting all the events over and over again".

The WindowLoadTracker.trackingListener gains an optional onEachEvent hook so
the manager can observe every event (stored or live) for this instrumentation
without changing the EOSE forwarding path.

https://claude.ai/code/session_01B1fmmmX8JjQWH3amMLdvcW
2026-06-01 21:44:45 +00:00
Claude 4d234788df chore: DMPagination logs for window/auto-fill behavior
Add a focused, low-noise log trail (tag "DMPagination") so DM windowing and
auto-fill can be observed while opening/closing rooms and scrolling. Per-event
noise stays off (onActivity is silent).

- WindowLoadTracker: takes a name ("giftwrap" / "rooms.nip04" / "convo.nip04")
  and logs "load start" and "load done: <reason>" where reason is one of
  all relays / idle / cap / no relays — the key signal for whether a load is
  stuck or looping.
- AccountGiftWrapsEoseManager: logs window open, REQ floor (since + days back),
  loadMore (from→to days, exhausted), loadEverything.
- NIP-04 followers: log their REQ floor and reload.
- Rooms list: logs OPEN/CLOSE and each widen with its trigger (empty/scroll).
- Conversation: logs room OPEN/CLOSE, each scroll-driven widen, and the
  "Load entire history" tap.
2026-06-01 20:55:11 +00:00
Claude b23dcdf468 fix: conversation showed only a spinner / loaded everything (drop gap-free clip)
The gap-free display floor was hiding the whole thread: until `coveredSince`
settled the floor was Long.MAX_VALUE (reveal nothing), but a thread clipped to
empty made the auto-fill fire (total == 0), which kept the loaders busy so
coveredSince never settled — a vicious cycle that walked the account-wide
gift-wrap window to exhaustion ("loads everything") while the thread stayed
blank ("loading sign and no message whatsoever").

- Remove the display-floor clipping (ChatFeedView no longer takes
  oldestVisibleTime; ChatroomView drops rememberConversationDisplayFloor). The
  thread renders the cached messages directly again, like before.
- Bound the conversation auto-fill: only load the next older window when the
  thread already overflows the screen AND the user has scrolled near the oldest
  loaded message, so a short thread is never auto-walked to the start of
  history. The oldest-end boundary still offers an explicit "Load entire
  history".

The kept-it-honest gap-free guarantee wasn't worth a blank inbox; the transient
NIP-04-before-NIP-17 ordering is the lesser evil. The loading spinner + load-all
boundary added last commit stays.
2026-06-01 20:25:34 +00:00
Claude 9118a757e3 Merge remote-tracking branch 'origin/main' into claude/relay-message-pagination-LMqSQ 2026-06-01 19:38:01 +00:00
davotoulaandClaude Opus 4.8 ae271d0ba7 refactor(sonar): extract NOT_STARTED_MESSAGE constant in CashuWalletState
Replace the literal "CashuWalletState.start() not called" duplicated across
9 call sites (8 check guards + the publish default lambda) with a single
private companion constant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 21:34:18 +02:00
davotoula e6a512db42 Code review and testing fixes:
- fix(dm-share): kotlin-review fixes (alias dot-boundary match + transient feed doc)
- fix(dm-share): address code-review findings (intent consume, media helper, manifest sync)
- fix(dm-share): make the picker one-shot so backing out doesn't duplicate drafts
- fix(dm): avoid duplicate drafts on abort by rotating draft tag after the async save
2026-06-01 21:29:41 +02:00
davotoula 8d715e5730 feat(dm-share): add ShareToDM route and attachment param on Room route 2026-06-01 21:29:41 +02:00
Vitor PamplonaandGitHub d8fba6a342 Merge pull request #3121 from vitorpamplona/claude/blissful-babbage-fFHRt
Fix inverted guard in TagArrayBuilder.addUniqueValueIfNew
2026-06-01 15:23:04 -04:00
Claude ec5245c81e feat: consistent DM "load more" boundary in the chat (spinner only when loading)
The conversation showed a perpetual spinner at the oldest end (it was tied to
`!exhausted`, not to actual loading) and had no "load all" escape, while the
rooms list showed a spinner only while loading plus a "Load entire history"
button. Make them consistent and share one component.

- Extract DmLoadMoreIndicator (spinner while loadingMore + "Load entire
  history" button while not exhausted), used by both screens.
- ChatFeedView: replace the loadingOlder: Boolean flag with an opt-in
  olderBoundary slot rendered at the oldest end; public-chat / channel callers
  pass null (unchanged).
- ChatroomView: supply that boundary — spinner only when a window is actually
  loading (gift wraps OR this room's NIP-04), button while there's older
  history to reach, nothing once exhausted.
- Rooms list: drop its local PrivateChatsLoadMoreFooter in favor of the shared
  one.
2026-06-01 19:17:21 +00:00