Repository navigation
feat(tui,cli): clipboard pictures and a workspace browser; DNS resolution of our own - #1379
Merged
Merged
Conversation
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 ).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
resolv.confourselves (and following its search domains and nameservers) keeps the CLI and its remote connections working where libc gives up.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 indocs/guide/dns-resolution.mdand its Chinese pairfeat(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 updatesVerification
Local self-test at
5f19b9ff7with the pinned toolchain (rustc/clippy 1.99.1), in the repository checkout:cargo fmt --all -- --check→ cleancargo clippy -p future-cli -p future-tui -p future-rpc --all-targets -- -D warnings→ cleancargo test -p future-tui --lib→ 1301 passedcargo test -p future-cli --lib→ 1438 passed (first run reported 98 EMFILE panics with the shell's defaultulimit -n 256; re-run withulimit -n 8192is green, so that was the environment, not the code)cargo test -p future-rpc→ 6 passedmake check-docs→ 354 docs checked, provider matrix matches (13 rows)Notes
Cargo.lock.