Commit Graph

1904 Commits

Author SHA1 Message Date
kshitij 9d76d48d0a fix(lint): import sort + eslint-disable for timer-handle ref clear in effect
CI-caught: cron-jobs-section had an extra blank line between sorted imports; use-message-stream's visibility-flush effect assigns flushHandleRef.current=null inside a useEffect (legitimate timer-clear, not an atom mirror) — eslint-disable-next-line per the rule's documented convention.
2026-08-03 20:29:58 +05:30
kshitij aece98c5f3 refactor(desktop): shared pulse beat + fully-gated cron peek (simplify folds)
Two findings from the simplify pass on the final trio diff:

- status-pulse: one pause controller + one aligned period timer shared by all StatusPulse instances (ref-counted), instead of N x (document/window/bridge listeners + unsynchronized 5s wakes) — a sidebar can show dozens of pulsing dots. Pause still cancels in-flight animations so the compositor sleeps immediately.
- cron-jobs-section: the runs-peek effect created its interval even while the pane was hidden (callback no-oped but the timer still woke the renderer every 8s/60s per expanded job). Early-return when hidden — visibility is already in the dep array, so becoming visible restarts load + timer.
2026-08-03 20:29:58 +05:30
kshitij e2a2149df4 style(desktop): restore alphabetical import order in agents/index.tsx 2026-08-03 20:29:58 +05:30
Daisuke Suzuki 52fb96de4b perf(desktop): pause hidden-pane timers in agents view, cron sidebar, and floating pet
Partial pick of the surviving renderer hunks from #75395 (perf commit
6502e441d plus fixup 3fbbc9c1d): gate the 500ms subagent now-ticker and
the cron sidebar 1s ticker/run-poll on usePaneVisible, and skip the
legacy floating-pet poll while the document is hidden. Dropped hunks
(electron/main.ts, vitest.setup.ts/config) intentionally excluded.
2026-08-03 20:29:58 +05:30
Mykola Bashmakov 7700597a17 perf(desktop): stop scroll and status loops in busy sessions 2026-08-03 20:29:58 +05:30
M S 416b56b7eb fix(desktop): flush queued deltas on window focus 2026-08-03 20:29:58 +05:30
brooklyn! c2c95f5339
Merge pull request #77713 from NousResearch/bb/review-76744-fold
fix(desktop): stop the inflight dump sandwiching structured mid-turn rows
2026-08-03 08:39:39 -05:00
brooklyn! b536f0697d
Merge pull request #77644 from NousResearch/bb/review-75967
fix(desktop): keep a mid-turn reply on screen when its session is reopened
2026-08-03 08:16:10 -05:00
kshitij c4ac62a7ee fix(desktop): cancel the pending commit-cost measurement rAF
Follow-up to #77652: each runFlush registered a fresh requestAnimationFrame and never cancelled it. Chromium parks rAF callbacks for hidden renderers, so a long hidden stream at the 33ms floor accumulates thousands of parked closures that all fire in the first frame on refocus (all but one no-oping through the stale-frame guard). Track the pending handle, cancel it before requesting a new one (only the newest flush's measurement matters), and cancel on unmount.
2026-08-03 18:45:38 +05:30
Brooklyn Nicholson 7a4d047e37 refactor(desktop): one live-tail vocabulary for transcript reconciliation
Two fixes landed overlapping helpers on the same statement: the mid-turn
reply guard grew `isLiveProjectionRow` / `hasStreamedContent`, while the
inflight-dump guard grew `isLiveTailRow` / `hasStructuralParts`. Two
definitions of "is this row live" and "does it carry content" in one
function is how the next change silently reshapes one of them.

Collapse to a single module-level pair. `isLiveTailRow` now covers pending,
stream ids, inflight projections and sealed interim rows, so the reply guard
also stops treating an interim row as committed history; `hasStreamedContent`
is defined in terms of `hasStructuralParts`. Both text-extension checks route
through `isStrictAnswerTextExtension` rather than a bare `startsWith`.

Also hoists the live-tail lookup out of an inline IIFE and fixes the lint
warnings it carried.

Co-authored-by: 686f6c61 <github@00b.tech>
2026-08-03 08:13:57 -05:00
686f6c61 dbefd27ffb fix(desktop): require structure-bearing row for live-tail same-turn carry
Structure-only same-turn carry used (live(previous) || live(message)), so a
new live text-only assistant at a compression-rewritten ordinal could inherit
reasoning/tool parts from an unrelated historical structured row.

Require the structure-bearing cached row itself to be live-tail (pending /
assistant-stream-* / interim). Add regressions for non-extending live dump
carry and the compression graft rejection.

Addresses salvage path on #76744 / #76444.
2026-08-03 08:08:47 -05:00
686f6c61 2ecc1db276 fix(desktop): scope inflight dump suppression to the live turn tail
Only skip/graft structure for the current live assistant (stream id,
pending, or after the latest user), not completed historical tool rows.
Require live-tail identity for same-turn structure carry. Align journal
overlay with strict answer-text extension.

Addresses review + CI on #76744.
2026-08-03 08:08:47 -05:00
686f6c61 53398ff485 fix(desktop): do not sandwich structured mid-turn rows with inflight dump
Skip pure-text inflight.assistant projections when the transcript already
has reasoning/tool-call structure, and only overlay journal answer text
on strict extension.

Fixes #76444
2026-08-03 08:08:47 -05:00
kshitij 1f692a8be2 refactor(desktop): hoist the reference-line matcher; drop dead textWithoutImageRefs
Follow-up to #77653: textWithoutReferenceLines built a fresh /g RegExp per call and hand-managed lastIndex — but it runs on both sides of every message comparison in the reconcile loops. An anchored non-global regex has no shared-lastIndex hazard and can be hoisted to module scope. Also removes textWithoutImageRefs, whose last production consumer #77653 replaced (kept IMAGE_REF_LINE_RE for extractImageRefs), and retargets its now-stale comment.
2026-08-03 18:37:31 +05:30
Brooklyn Nicholson 34f0427f7f fix(desktop): stop a finished reply rendering twice after history catches up
When a turn's reply commits under its own id, the settled local
`assistant-stream-*` row shifts one assistant ordinal earlier, so ordinal
pairing finds nothing at its slot and re-appends it — the same answer twice.

Drop a settled stream row only when the authoritative transcript already
carries that exact text. Keying `isPendingAssistant` on the explicit pending
flag alone would also have fixed this, but it discards the sibling case in
the same report: a reply that finished locally before the gateway committed
it, where the local row is the only copy that exists.

Co-authored-by: Dolverin <59100064+Dolverin@users.noreply.github.com>
2026-08-03 07:57:33 -05:00
Brooklyn Nicholson b6f15f546d fix(desktop): keep a mid-turn reply on screen when its session is reopened
Switching sessions while a turn streams (or right as it completes) could
leave the assistant reply missing until restart. Resume merges stored
history with the gateway's `inflight` projection, whose assistant row is
text-only and often an empty `assistant-stream-${sessionId}` shell; both
reconcile paths then dropped the local pending row that held the only copy
of the streamed text, reasoning and tool calls.

A shared pair of guards replaces the ad-hoc comparisons at all three sites.
`localPendingSupersedes` accepts the cached row only when it is the same
reply further along — an empty shell it has content for, or text it strictly
extends — so a longer unrelated row can no longer hijack an ordinal or reuse
a stream id, and a retained `inflight.error` snapshot is never mistaken for
an empty shell. `withAuthoritativeTurnState` then takes content from the
renderer while liveness, row id and reactions stay the backend's call, so a
settled shell cannot leave a finished reply spinning.

Co-authored-by: arimu1 <19286898+arimu1@users.noreply.github.com>
2026-08-03 07:52:37 -05:00
Lex 82fd574bad perf(desktop): stop idle chat re-renders — memo ChatView, stable tile props, gated adapter re-sync
Re-derive of PR #38470 on today's main (its target file desktop-controller.tsx no longer exists after the contrib/ refactor; the three surviving ideas are applied at their new homes):

- incremental-external-store-runtime: the dep-less setAdapter effect ran every render; gate on [runtime, store] — behavior-preserving because __internal_setAdapter early-exits on identical store.
- ChatView is now memo()d, and session-tile hoists its inline arrow props to useCallbacks/module constants so the memo actually holds.
- Render-count regression test (mocked Thread) proves an unrelated parent re-render no longer re-renders the chat shell.

Credit: idea and original implementation by @hdd69 in #38470.
2026-08-03 18:17:24 +05:30
rerdi92 1306ac0897 fix(desktop): un-break the .btn-arc rule — '*/' inside a CSS comment ended it early
The comment above .btn-arc contained 'bg-*/', whose */ terminated the comment mid-sentence, leaving 'text-* variant utilities. */ .btn-arc {' as an invalid prelude — CSS error recovery can drop the whole .btn-arc rule. Reword so no */ appears inside the comment.

Extracted from #59352 by @rerdi92 (the rest of that PR — a month-stale icons.ts rewrite and a chunk-size warning-ceiling bump — is superseded/masking and was not salvaged).
2026-08-03 18:16:46 +05:30
kshitij 5ffbea81e9 fix(desktop): escalate gateway reconnect on elapsed time, not attempt count
With the full-jitter backoff (300ms base) six attempts can elapse in ~9s,
so the old RECONNECT_ESCALATE_AFTER=6 attempt threshold raised the
recoverable boot error during a brief post-boot blip — breaking the
'a remote that drops post-boot keeps looping with NO boot.error' contract.
Escalate after RECONNECT_ESCALATE_AFTER_MS (45s, matching the old
deterministic 1->15s ladder's calibration) elapsed since the first failed
reconnect of the episode. Reset on clean open, manual/wake reconnect, and
soft switch, preserving the reset-on-success path.
2026-08-03 18:10:30 +05:30
Hermes Coder ed66ff17d8 fix(desktop): full-jitter backoff on gateway WS reconnect loops
All three desktop reconnect loops (primary gateway boot, secondary
multi-profile gateway pool, plugin event socket) used bare exponential
backoff with no jitter. After a gateway restart every disconnected
client redials on the exact same schedule, so the reconnect attempts
land in lockstep instead of spreading out -- a burst that can starve
the gateway's file descriptors while it's still coming back up.

Add reconnect-backoff.ts implementing AWS-style full-jitter backoff
(random delay in [0, min(cap, base * 2^attempt))) and wire it into all
three call sites in place of their local Math.min/2**attempt math.
Manual reconnect paths already reset the attempt counter and bypass
the timer entirely -- unchanged.
2026-08-03 18:10:30 +05:30
Paulo Nascimento 2ebe175dc1 fix(desktop): sort reference-kinds import per lint gate 2026-08-03 18:10:23 +05:30
Paulo Nascimento fed10fa245 test(desktop): cover wire reference normalization edges 2026-08-03 18:10:23 +05:30
Paulo Nascimento 3060beea07 fix(desktop): dedupe optimistic user turns for all wire references, not only images 2026-08-03 18:10:23 +05:30
Adolanium b9b0505cfc fix(desktop): measure adaptive stream flush through the deferred commit frame
scheduleDeltaFlush's adaptive floor is driven by lastFlushCostRef, but
runFlush only timed flushQueuedDeltas(), the synchronous store write.
While a session streams, syncSessionStateToView defers the $messages
publish (React commit + Streamdown re-parse) to its own rAF, so the
measured cost stayed near zero and the floor collapsed to the fixed
33ms path no matter how expensive the real commit was.

runFlush now records the write cost as a fallback, then extends the
measurement through a rAF registered after the view-sync one: it runs
in the same frame right after the deferred commit, and the rAF
timestamp marks frame start so only in-frame work is counted, not the
vsync wait. A stale callback from before a newer flush is ignored, and
a hidden renderer that never fires rAF keeps the write-cost fallback.
2026-08-03 18:10:18 +05:30
kshitijk4poor dd08277104 test: expect omit_messages in the tile-delegate resume call shape
Two more call-shape-pinning tests (cold tile resume, default-profile
resume) assert session.resume's exact params; the delegate passes
omit_messages: true like every other Desktop resume call site.
Swept all 5 desktop test files that reference session.resume/activate:
380 of 381 files green (the one failure is a pre-existing locale-
dependent number-grouping test that fails identically on clean main).
2026-08-03 13:45:08 +05:30
kshitijk4poor 67fb0d7c2e test: expect omit_messages in the queue-drain resume call shape
Two queue-drain tests added on main pin session.resume's exact params;
the drain path now passes omit_messages: true. Assertion-only update.
2026-08-03 13:45:08 +05:30
Daniel Blank cd41454dfc fix(gateway): let Desktop omit duplicate transcripts on session resume
Salvage of #69926: omit_messages support ported from the PR's
tui_gateway/server.py base onto the post-split methods_session.py
layout. When a Desktop client passes omit_messages=true on
session.resume / session.activate, the RPC returns messages: [] with
messages_omitted: true and an accurate message_count, skipping the
potentially multi-megabyte compression-lineage serialization over the
WebSocket; Desktop hydrates the transcript via the authenticated REST
route in parallel.

The PR's bundled cron-outputs endpoint and codex quiet-timeout bump
were dropped from this salvage as unrelated (invited back separately).
2026-08-03 13:45:08 +05:30
kshitijk4poor e1843c7d08 style: fix the type-import sort position in pet-gallery.test.ts
perfectionist/sort-named-imports orders 'type GatewayRequest' by its
name, so it belongs before loadPetGallery (eslint error, not warning).
2026-08-03 13:41:12 +05:30
kshitij b0089e8bfa perf(desktop): skip store update when pet metadata is unchanged
mergePetInfoMeta now returns the same object reference when all fields
match, and callers skip setPetInfo on reference equality. Without this,
every 15s poll and window-focus refetch fired a nanostores set with a
new-allocated object, triggering a React re-render of FloatingPet even
when nothing changed — a regression from the old samePetRevision guard
which returned without calling setPetInfo.
2026-08-03 13:41:12 +05:30
kshitijk4poor cb0226d4ae docs: update stale samePetRevision comment reference
The helper was extracted and renamed to hasPetSpriteForMeta +
mergePetInfoMeta; the pet.changed comment still cited the old name.
2026-08-03 13:41:12 +05:30
embwl0x 1573829a7c fix(desktop): avoid repeated pet spritesheet fetches 2026-08-03 13:41:12 +05:30
Johnny 51defb9e29 fix(desktop): adapt right pane probe to per-cwd status 2026-08-03 13:39:33 +05:30
Johnny 1051434325 perf(desktop): isolate right pane layout work 2026-08-03 13:39:33 +05:30
kshitij 372494fdf9 style(desktop): eslint --fix import order in sessions-section test
Review follow-up on the #75714 salvage: perfectionist/sort-imports
would fail lint CI; autofixed.
2026-08-03 10:00:20 +05:30
StanleyStetson 416f91d271 fix(test): export VirtualSessionListProps and assert sessions array identity change 2026-08-03 10:00:20 +05:30
StanleyStetson 09ed1ac950 fix(desktop): memoize sidebar flatRows and row renderers to prevent scroll jitter (fixes #73629)
Fix direction inspired by PR #73674 by @drbronson with added Vitest component unit tests.
2026-08-03 10:00:20 +05:30
hermes-seaeye[bot] d79a6f0e3e
fmt(js): `npm run fix` on merge (#77300)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-03 03:44:44 +00:00
Brooklyn Nicholson 9e373b3828 fix(desktop): paste rich text with images as text, not blank attachments
Copying a Discord thread (or any rich-text selection with images) attached
one or more blank thumbnails and dropped the message text entirely.

Two causes. The clipboard's `text/html` was scraped for inline
`<img src="data:…">` regardless of whether the copy carried its own text —
and what Discord ships beside each image embed is a 32x5 blurhash
placeholder, which is exactly the blank attachment. Then, because any image
blob short-circuited the paste handler, the prose that came with it never
reached the composer.

Inline HTML images now only count for an image-only copy, and are ignored
below a thumbnail-sized floor so spacers and trackers don't attach either. A
mixed paste attaches its real images and still inserts its text.

Also registers pasteAndMatchStyle in the Edit menu — Cmd+Shift+V had no menu
entry, so the chord was never translated into an editor command anywhere in
the app.
2026-08-02 22:28:28 -05:00
Brooklyn Nicholson 17bdc99db4 feat(desktop): reload a tab from its right-click menu
Right-click any tab and pick Reload: the pane's content remounts in
place — effects re-run, state resets, measurements are retaken — while
the tab keeps its slot and every other tab is untouched.

A per-pane epoch atom keys the contribution inside the zone body, so
reload never rewrites the layout tree. Both tab menus offer it: the
zone strip menu (tool panels, the file tree, a fresh draft's main tab)
and the session tab menu (tiles + the loaded main tab).
2026-08-02 22:08:09 -05:00
Jason Chai c5829fbb34 fix(desktop): account for transcript payload size 2026-08-03 00:08:30 +05:30
Brooklyn Nicholson f979e47eba fix(desktop): the branch-bar path copy confirms in place
The glyph sat at the far end of the row instead of beside the path it
copies, and it fired a toast for a one-word confirmation. It's the shared
CopyButton now — same inline checkmark as every other copy in the app —
and the path label sizes to its content so the pair reads as one unit.
2026-08-01 21:46:19 -05:00
brooklyn! eca996aa33
Merge pull request #76401 from NousResearch/bb/composer-link-open
Act on composer directive chips from a hover pill
2026-08-01 20:29:14 -05:00
hermes-seaeye[bot] 777512b760
fmt(js): `npm run fix` on merge (#76498)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-02 01:23:45 +00:00
Brooklyn Nicholson 5ba2564ca0 feat(desktop): act on composer directive chips from a hover pill
A directive chip (`@url:`, `@session:`) reads as the thing it points at and is
coloured like one, but a composer is an editor — a click inside the
contenteditable only places the caret, so there was no way to actually act on
the reference.

Hovering a chip whose kind has an action now floats a pill above it that runs
it: `@url:` opens in the browser, `@session:` opens the session as a tab. It's
a small registry (`DIRECTIVE_ACTIONS`), so a new actionable kind is one entry,
not another watcher.

The pill portals to `<body>` and anchors to the chip's rect, so it can't end
up inside the submitted draft, and it re-anchors on scroll and resize rather
than stranding itself over a reference that moved or was deleted. The press is
swallowed before it reaches the editor — mousedown in a contenteditable moves
the caret, and the edit composer reads a blur as "cancel".

Listeners bind to `document`, not the editor: the edit composer's
contenteditable isn't reliably attached when the effect first runs, so an
editor-bound listener never fired there. A document listener that reads the
editor lazily works in both composers, and each instance filters to its own
editor so one chip never shows two pills.
2026-08-01 20:21:28 -05:00
brooklyn! baec57de66
Merge pull request #76429 from NousResearch/bb/composer-placeholder
fix(desktop): the composer hint stops acting like text you typed
2026-08-01 20:14:06 -05:00
Brooklyn Nicholson 93ec02bf79 fix(desktop): keep the hint off the text during IME composition
Input events are deliberately skipped for the duration of an IME composition
(they carry uncommitted preedit text), so nothing clears the empty marker
until compositionend — the hint kept painting behind the hiragana the user was
composing. Drop the marker as composition starts; the normalizer restores it
if composition ends with nothing committed.

Taking the hint out of the text flow fixed the displacement half of #75960 on
its own — preedit now starts at the field's left edge either way — but the
overlap needed this too.

Co-authored-by: Ryuichi Natori <to-na@users.noreply.github.com>
2026-08-01 16:56:48 -05:00
brooklyn! 97971643ab
Merge pull request #76417 from NousResearch/bb/kanban-model-picker
Pick a kanban task's model and thinking depth from the board
2026-08-01 16:55:01 -05:00
Brooklyn Nicholson 414e5af114 fix(desktop): the composer hint stops acting like text you typed
The empty-composer prompt was painted with an inline `::before`, which puts a
real box in the contenteditable's text flow. Click an empty composer and the
caret lands past the hint instead of at the field's left edge, and a hint that
wraps — a narrow composer, a long locale string — makes the empty composer two
lines tall. It is a hint, so it now sits out of flow: absolutely positioned,
clipped to one line, unselectable and untouchable by the pointer. Measured in
Chromium against the built stylesheet, the caret lands at the left edge for a
wide composer, a narrow one, and a Japanese hint alike.

Backspace on a fresh `@folder:` chip had a second, related problem. Committing
a completion empties the typed token's text node rather than removing it, and
`Range.insertNode` splits the line around the caret, so the chip ends up
between zero-length text nodes. Those read as content: the atomic chip-delete
declined, Chromium's own backspace bounced between the leftovers, and the chip
took extra presses to remove — leaving a `"\n"` draft with the hint still
hidden behind it. Emptiness, the chip-delete, and the DOM normalizer now all
step over that litter.

The stylesheet owns the rule now that it needs `position: relative` on the
editor, so the utility-class constant both composers imported is gone.
2026-08-01 16:34:46 -05:00
Cad from Arca d6be88fbc8 fix(desktop): map SSH profiles to remote profiles 2026-08-01 14:30:16 -07:00
Flownium 53b8f44e75 feat(desktop): add notch wake indicator 2026-08-01 14:30:11 -07:00