Skip to content

feat(desktop,remote,make): composer history, a told control winner, sh-safe installs - #1329

Merged
huichen merged 5 commits into
mainfrom
pr/huichen
Oct 23, 2026
Merged

huichen merged 5 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Five commits merged into dev-huichen from separate worktrees, each verified on its
own; this PR carries them to main.

feat(desktop): composer history, reply copy, jump to latest, attach key

The composer now keeps a per-thread edit history (Up/Down through what you sent),
a reply can be copied as Markdown, a jump-to-latest affordance appears when the
transcript is scrolled away, and the attach action carries a keyboard shortcut
that the shortcuts catalog and cheat sheet agree on.

fix(make): run the Windows install targets under sh.exe again

install-cli / install-desktop had drifted into cmd syntax, which make cannot
run when Git for Windows puts sh.exe on PATH; the recipes are portable again
and install-local keeps its node-based copy.

fix(remote): tell the device that wins control, not only the one that loses

A control handover notified the losing peer and stayed silent towards the winner,
so a device that won could keep showing the old state until the next poll. The
event now goes to both sides.

fix(desktop): a local-only exchange keeps its own time

A send whose prompt never reached the agent (network or IPC failure) is persisted
nowhere, so its optimistic bubble stays local-only for good. The history
reconcile appended every local-only row after the freshly loaded tail, which put
an exchange from forty minutes ago below the newest reply. Local-only rows now
merge into the loaded history by createdAt, so the transcript reads in order.

test(desktop): the composer-history suite gets a sessionStorage everywhere

That suite touches the global sessionStorage, which exists on Node 26 (this
machine) but not on the Node 24 that CI pins, so all nine tests failed with
ReferenceError: sessionStorage is not defined. The shared test setup already
shimmed localStorage; it now shims both storages, still only when the global is
missing. No assertion, skip or only changed.

Commits

  • feat(desktop): composer history, reply copy, jump to latest, attach key
  • fix(make): run the Windows install targets under sh.exe again
  • fix(remote): tell the device that wins control, not only the one that loses
  • fix(desktop): place a local-only exchange at its own time instead of the transcript tail
  • test(desktop): give the suite a sessionStorage on Node versions that lack one

Verification

  • cargo clippy -p future-host -p future-remote-server --all-targets -- -D warnings: clean
  • cargo test -p future-host --lib remote: 576 passed, 0 failed (8 ignored)
  • cargo test -p future-remote-server --lib: 172 passed, 0 failed (5 ignored)
  • desktop npx tsc --noEmit: clean
  • desktop npm run lint (eslint + tsc): 0 errors (one pre-existing jsdoc warning in an untouched file)
  • desktop full vitest suite on Node 22.22.3 and on Node 26.3.0: 378 files / 5254 tests passed
    (Node 22 lacks both storage globals, i.e. the same starting point as CI's Node 24)
  • npx vitest run src/features/agent/composerHistory.test.ts on Node 22: 9 failed
    before the setup change, 9 passed after it
  • git diff --stat origin/main...dev-huichen: 27 files, 1084 insertions, 62 deletions

Four gaps against Codex and OpenCode, all of them controls a pointer could
reach and a keyboard could not:

- Up/Down in the composer put this conversation's already-sent messages back
  in the box (`composerHistory`, one sessionStorage entry per conversation).
  The key belongs to the editor, like Enter: on an empty box Up has no caret
  to move, and the walk ends at the first real edit.
- mod+alt+c copies the last reply's prose. The reply's own hover button and
  this key now share `replyCopyText`, so the two can never copy different
  things -- including the reading setting that folds the work away.
- mod+alt+g jumps to the live end of the transcript, the corner's button from
  the keys.
- mod+shift+o opens the composer's file picker.

The approval card gains the wider answer on the pair it already had:
mod+shift+Enter approves and stops asking here -- saving the capability rule
outright where the request offers one, opening the path editor where it does
not. The fixed-key list in Settings says so.
install-cli, install-desktop and install-desktop-headless wrote their Windows
branch in cmd syntax: `@if not exist ".." mkdir ".."` plus unquoted
`target\release\future.exe`. make hands every recipe to SHELL, and SHELL is
sh.exe whenever Git for Windows is on PATH, so on such a machine the documented
install commands died with `/usr/bin/bash: syntax error` before copying
anything. install-local already copies through node for exactly this reason; the
three older targets now do the same through one shared `copy_win_binaries`
macro.

Scope is the copy only: same PREFIX, same filenames, same targets, same
$(SUDO) usage. The POSIX branches are byte-identical - `git diff` touches only
lines inside `ifeq ($(OS),windows)`. The macro also creates PREFIX itself, which
the old mkdir did not: it hard-coded `$(USERPROFILE)\.future\bin` while the copy
went to `$(PREFIX)`, so any overridden PREFIX failed on the missing directory.
The default is unchanged ($(PREFIX) is $(USERPROFILE)/.future/bin on Windows).

Verified on Windows with temporary PREFIXes, never the live one:
  make install-cli PREFIX=D:\tmp\r1       427 s cold, future.exe 70 MB,
                                          `future --version` ok
  make install-desktop PREFIX=D:\tmp\r2   build 13m48s, installed
                                          future.exe 70 MB + futureos.exe 63.3 MB,
                                          `future --version` and `futureos --help` ok
  make -o <build> install-{cli,desktop,desktop-headless,local} PREFIX=D:\tmp\pN
                                          each recipe alone installs the expected
                                          files (this is the shell-agnostic check;
                                          `make -n` is useless here because this
                                          machine's GNU make 3.81 evaluates
                                          $(shell) empty under -n, which flips the
                                          platform branch)

`make check-docs` passes. `make desktop-sidecars` has the same cmd syntax and is
left alone: it is not an install target and is only reachable through the
release packaging path.
… loses

Pressing "take over" on a device that was in standby moved the machine on the
host immediately, but the device that asked was told nothing: only the previous
controller was sent `control: standby`. The claimant had to read control back
from its next presence heartbeat, which repeats it every three seconds — so for
up to that long the page still drew the machine as somebody else's, and the
takeover it had just made read as granted, withdrawn and granted again.

Both paths that hand a connected device the machine now announce it on the
winner's own channel as well, exactly as the desktop-side `takeover` command
already did: the client's `takeover` command and the first pairing confirmation
(whose answer is built before its claim, so a pairing that took a machine nobody
held was answered `standby` too).

The announcement is skipped when the device was already driving, so a controller
pressing take over twice still sends no handoff it did not make.

Tests drive both commands over the fake broker and assert the packet the
claimant receives; both fail without the change.
@huichen
huichen enabled auto-merge (squash) October 23, 2026 15:57
huichen and others added 2 commits October 24, 2026 00:12
…the transcript tail

A send whose prompt never reached the agent (network/IPC failure) is
persisted nowhere, so its optimistic bubble stays local-only for good. The
history reconcile appended every local-only row after the freshly loaded
tail, so an exchange from 40 minutes ago kept reappearing below the newest
reply and the transcript read newest-first.

Merge local-only rows into the loaded history by createdAt (stable, and an
undated row still lands last) instead of concatenating them at the end.
…lack one

The composer-history suite failed on CI (TypeScript test / @futureos/desktop)
with `ReferenceError: sessionStorage is not defined` while passing locally.
`desktop/vite.config.ts` sets no `test.environment`, so a file without a
`// @vitest-environment` directive runs in Vitest's `node` environment, and
Node only gained an experimental `sessionStorage` in 26: CI pins Node 24, which
has neither Web Storage global. A portability defect, not a flake.

Extend the existing Web Storage shim in `src/test/i18nTestSetup.ts` — it
already provided `localStorage`, because jsdom does not reliably expose Web
Storage — so whichever global the runtime is missing gets an in-memory
`Storage`. The shim only fills in an absent global, so jsdom keeps its real
storage, and `composerHistory` now runs the same code path on every Node
version instead of quietly returning an empty history through its defensive
catch.

Chosen over adding `// @vitest-environment jsdom` to the test file: the module
needs no DOM, and one shim for both storages removes the asymmetry that turned
into this bug, for any future storage-backed test as well.

Verified on Node 22.22.3, where `sessionStorage` and `localStorage` are both
undefined (the CI situation): the suite reproduces the same ReferenceError
before the change and passes 9/9 after; `src/features/agent/` 86 files / 1276
tests green under Node 22 and Node 26.3.0; the full desktop suite 378 files /
5254 tests green under both; `npm run lint` (eslint + tsc) clean.
@huichen
huichen merged commit b51c05d into main Oct 23, 2026
25 checks passed
@huichen
huichen deleted the pr/huichen branch October 23, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant