Skip to content

feat(tui,cli): clipboard pictures and a workspace browser; DNS resolution of our own - #1379

Merged
huichen merged 3 commits into
mainfrom
pr/huichen
Oct 26, 2026
Merged

huichen merged 3 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Two independent features landed on the developer branch: the CLI now resolves host names itself when the platform libc has no usable resolver configuration, and the TUI workbench can paste an image from the clipboard, draw it, and browse the workspace as a file tree.

Why

  • On hosts without a resolver configuration the gRPC client could not reach a remote endpoint at all. Reading resolv.conf ourselves (and following its search domains and nameservers) keeps the CLI and its remote connections working where libc gives up.
  • The workbench had no way to look at a pasted picture or to move through the files of the session's workspace; both are now first-class panels with their own keys and translations.

Commits

  • feat(cli): resolve names ourselves when libc has no configuration — a self-contained DNS resolver (cli/src/dns/{config,mod,query}.rs) that reads the platform configuration, applies search domains, and is wired into the rpc transport (packages/rpc/src/{connection,transport}.rs); documented in docs/guide/dns-resolution.md and its Chinese pair
  • feat(tui): paste pictures from the clipboard, draw them, and browse the workspace — an image panel that renders a clipboard picture, a workspace file browser with its own panel and state, plus the matching input/paste handling, translations, examples and workbench spec updates

Verification

Local self-test at 5f19b9ff7 with the pinned toolchain (rustc/clippy 1.99.1), in the repository checkout:

  • cargo fmt --all -- --check → clean
  • cargo clippy -p future-cli -p future-tui -p future-rpc --all-targets -- -D warnings → clean
  • cargo test -p future-tui --lib → 1301 passed
  • cargo test -p future-cli --lib → 1438 passed (first run reported 98 EMFILE panics with the shell's default ulimit -n 256; re-run with ulimit -n 8192 is green, so that was the environment, not the code)
  • cargo test -p future-rpc → 6 passed
  • make check-docs → 354 docs checked, provider matrix matches (13 rows)

Notes

  • No wire-contract or migration change; the resolver only takes over when libc has no usable configuration and otherwise defers to the platform.
  • New TUI dependencies for image decoding are pinned in Cargo.lock.

huichen and others added 3 commits October 27, 2026 01:52
A binary linked against musl reads exactly two files, `/etc/hosts` and
`/etc/resolv.conf`, with no environment override and no NSS. On a system
without the second — a minimal rootfs, a container built without `/etc`, an
appliance image — every hostname lookup fails, so the CLI cannot reach the
platform API, the relay, or a remote Agent, however well the machine's DNS is
configured elsewhere. Measured on the real static binary: `getaddrinfo` returns
`EAI_AGAIN` after a 5.0 s stall, and the CLI then printed `transport error` /
`builder error` with nothing to act on.

The CLI now resolves names itself, and only when the default is unusable or
explicitly configured:

- `FUTURE_DNS_SERVER` (an IP, optionally with a port) is the sole nameserver;
  no `resolv.conf` is read at all.
- `FUTURE_RESOLV_CONF` names a file to read instead of the search path.
- otherwise the first existing candidate wins: `/etc/resolv.conf`,
  `/run/systemd/resolve/resolv.conf`, `/run/resolvconf/resolv.conf`,
  `$PREFIX/etc/resolv.conf`. Hosts files: `/etc/hosts`, `$PREFIX/etc/hosts`.

When `/etc/resolv.conf` exists and neither variable is set, the plan is
"system": no resolver is attached to reqwest, no connector is handed to tonic,
and every lookup is `getaddrinfo` exactly as before. Two tests pin that and
both were falsified once before landing.

The resolver is one function used by both clients: `reqwest::dns::Resolve` for
HTTP and a new `TcpNameResolver` parameter on
`future_rpc::connection::connect_verified_with` for gRPC. That parameter is a
caller-supplied value rather than a process-global hook, so the desktop, the
TUI and the host keep resolving through libc — they call the unchanged
`connect_verified`.

Failures now name the files that were checked, both settings and what to do
instead; request errors render their cause chain (`dns::describe`) because
`reqwest::Error`'s Display hides it, and the gRPC path resolves a TCP endpoint
before connecting because `tonic` flattens every connector error into
`transport error`.

Not solved, and documented as such: NSS-only names (mDNS, LDAP,
systemd-resolved's per-link views) stay unavailable in a static build, and a
truncated DNS reply is reported rather than retried over TCP.

Docs: `docs/guide/dns-resolution{,.zh-CN}.md` carry the measured behaviour, the
candidate paths, the two settings, the NSS limits and how the default is pinned.
…he workspace

Images
- ctrl+v (and /paste, for terminals that keep ctrl+v for themselves) reads the
  system clipboard: an image becomes a draft attachment through the existing
  [Image #N] marker, text is pasted. The capture runs on a blocking thread; the
  box's title counts the attachments so a waiting image is visible.
- alt+v previews the newest attached image.
- A picture is drawn as half blocks: one block per cell, top pixel as foreground
  and bottom as background, so it needs colour and nothing else - no kitty
  graphics, no iTerm2, no sixel - and 24-bit when the terminal reports it.
  Zoom (+/-/wheel, six steps), pan (arrows), reset (0). Decoding happens once per
  file in the adapter, downscaled to 1024 px on the long edge.

Files
- A third rail panel, 文件, browses the session workspace: one level at a time,
  a directory read when it opens (400 entries per level, said out loud when cut),
  so a node_modules never stalls the frame.
- Keyboard and pointer: up/down walk the rows, left/right close/open the tree
  (tabs are ctrl+1..3 here), enter opens a directory or previews a file, and a
  click does what enter does on the row it landed on.
- Preview box: markdown rendered, text as lines (bounded read, cut on a character
  boundary), a picture as above; a file it cannot show says why instead of
  opening empty. alt+r re-reads the tree.

Also: /sandbox's help line no longer spells another command's token, and the
perceptual harness compares command names as words ( /mode is a prefix of
/model ).
@huichen
huichen enabled auto-merge (squash) October 26, 2026 18:24
@huichen
huichen merged commit 7ffa7b1 into main Oct 26, 2026
33 checks passed
@huichen
huichen deleted the pr/huichen branch October 26, 2026 18:43
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