diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index b4b45f98d..b625567c0 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -34,7 +34,7 @@ shipped binary. | Crate | Kind | Tier | Owns | Allowed workspace dependencies | |---|---|---|---|---| -| `efr-stdx` | lib | 0 | XDG paths, `Clock` and `Rng` traits, `process::command`, atomic and 0600 writes, files changed through a link, named threads, UUIDv7 | none | +| `efr-stdx` | lib | 0 | XDG paths, `Clock` and `Rng` traits, `process::command`, atomic and 0600 writes, files changed through a link, named threads, UUIDv7, the text helpers (`one_line`, format characters) and the one body rule of a desktop notice (`text::notice_body`) | none | | `efr-protocol` | lib | 0 | everything on the wire: frames, `Method`, params and results, `Event`, ids, `Scope`, `ShellContext`, framing, `PROTOCOL_VERSION`; no tokio, no IO | `efr-stdx` | | `efr-store` | lib | 1 | the only SQLite owner: migrations, the single writer, readers, events, projections, receipts, outbox, recording index, turn messages, the search index (FTS5) with its reads, its search lanes and the indexer's read connection, the tombstones and steps of conversation deletes, the enrolled devices with the feed of their revokes | `efr-protocol`, `efr-stdx` | | `efr-credentials` | lib | 1 | `SecretStore` and the 0600 file store; optional keyring | `efr-stdx` | @@ -57,7 +57,7 @@ shipped binary. | `efr-snapshot` | lib | 2 | efr's own snapshot store: one bare git repository per project or `$SCRATCH` in the data root, hardened git through `efr_scope::Git::command`, the trees before and after each call that can write, the turn's `pre`, `last` and `post` refs and the paths that its calls touched, the mirror of a project's refs and objects from the git dirs that efrd trusts, the check that a snapshot covers each file below a target, the changes of a call or a turn, the diff of a turn, the plan of an undo or a redo (pure: it writes no file of a root), the home store of the files outside the roots, the collector | `efr-scope`, `efr-protocol`, `efr-stdx` | | `efr-config` | lib | 2 | `config.toml` for `efrd` and `efr`: the schema of every key, defaults, validation, the effective view with sources, the JSON schema, the example file and the format-preserving writer; no async, no network | `efr-permissions`, `efr-protocol`, `efr-stdx` | | `efr-proxy` | lib | 2 | the network proxy of the `auto` sandbox, as tokio tasks in efrd: one listener per contained call, the request head and ClientHello parsers, the allow and deny lists before any lookup, the call's host grants, the address guard, the SNI check, plain `GET` and `HEAD` for http hosts, the upload budget and the refusal records; the resolver, the connector and the host's addresses are seams | `efr-protocol`, `efr-stdx`, `efr-permissions` | -| `efr-conversation` | lib | 3 | one actor per conversation: queue, turn loop, the single permission check point, approvals, interrupt, steer, withdraw; in `auto` the launch of each shell call, exit questions and their records (in full mode too, with the judge `full`, the timed question of a guarded delete and the gate before each call), the review of an exit by the `ExitJudge` before the user with the allow rule and the naming rule, the denial pause, the away wait through `PresenceReader`, the cache delete questions, the quarantine question and the fallback to `cautious`; the undo of a turn between turns; the gate of web search (`web.rs`: which hosted tools a turn's requests carry, by the mode and `[web]`, because a hosted search never reaches the check point); the index redaction of search (`redact_for_index`, `REDACTION_VERSION`); drives tools through its own `Toolbox` trait, implemented by `efr-daemon` | `efr-provider`, `efr-permissions`, `efr-scope`, `efr-store`, `efr-sandbox`, `efr-protocol`, `efr-stdx` | +| `efr-conversation` | lib | 3 | one actor per conversation: queue, turn loop, the single permission check point, approvals, interrupt, steer, withdraw; the model's question (the tool `ask_user`, which it owns, and the one wait loop of every question, `turn/wait.rs`); in `auto` the launch of each shell call, exit questions and their records (in full mode too, with the judge `full`, the timed question of a guarded delete and the gate before each call), the review of an exit by the `ExitJudge` before the user with the allow rule and the naming rule, the denial pause, the away wait through `PresenceReader`, the cache delete questions, the quarantine question and the fallback to `cautious`; the undo of a turn between turns; the gate of web search (`web.rs`: which hosted tools a turn's requests carry, by the mode and `[web]`, because a hosted search never reaches the check point); the index redaction of search (`redact_for_index`, `REDACTION_VERSION`); drives tools through its own `Toolbox` trait, implemented by `efr-daemon` | `efr-provider`, `efr-permissions`, `efr-scope`, `efr-store`, `efr-sandbox`, `efr-protocol`, `efr-stdx` | | `efr-transport` | lib | 3 | the protocol edge: codec, Unix listener, the WebSocket entry of the phone (handshake, frames, pings; efrd owns its TCP listener and peer check), connection table, subscriptions, the `Dispatcher` trait; `client`: the client side of the protocol for `efr`, tests and the proxy | `efr-protocol`, `efr-stdx` | | `efr-daemon` | bin `efrd` | 4 | the composition root; one file per protocol method; the settings tool, which needs `efr-config` and so cannot live in `efr-tools`; the `auto` sandbox service: the launcher's copy, the probe, the spec of each call, the plan lock, the facts of a line (with the git remotes), the turn-end report, the read-only scope of model-side socket peers, the gate of full mode (`full.rs`: whether efrd allows or refuses it, the count of running full work) and the config hold (`loosens.rs`, `reload.rs`), and the network proxy's socket for each call with its lifetime, its host list and the hosts that a token in a project file denies; the bus filter: an `xdg-dbus-proxy` for each filtered bus of a call or a job, with its self-test and the refusals of its log; the writer of always-allow rules, which checks a rule and appends it to `config.toml`; the judge of `auto` exits (the reviewer's request and its chain of models), the presence of each conversation, the table of background jobs (the launch, the output file, the time limit, the stops, the sweep of a job's session and the port forwards of a contained job on `127.0.0.1`), the home copies of the files that an approved exit, or an exit that full mode let through, writes outside the roots, the apply of an undo or a redo with the undo trash, and the deletes in the real tool caches; the search indexer (a background task with its text rules and its duty cycle) and the search methods with their time caps; the open pairings of new devices, in memory (`pairing.rs`), and the device methods; the heap trim (`heap_trim.rs`: one `malloc_trim` after the actors' idle trims), and its one `unsafe` module `malloc.rs` (ADR 0020); the recorder of model streams (`stream_record.rs`, `EFR_RECORD_STREAMS`) | every library crate above except the test crates | | `efr-cli` | bin `efr` | 4 | `efr send`, `new`, `status`, `history`, `resume`, `conversation delete`, `diff`, `compact`, `context`, `jobs` (list, stop), `shell`, `settings`, `models`, `login` (openai, openai-api, anthropic), `logout`, `config` (show, check, edit, set, unset, schema, reload), `project` (list, add, remove, through the daemon), `paths`, `sandbox` (check, explain, allow), `undo`, `search`, `device` (add with its QR code, list, revoke); the fzf picker of `resume`, inline below the command line; renders replies through `efr-render` | `efr-transport`, `efr-config`, `efr-render`, `efr-protocol`, `efr-stdx` | @@ -254,8 +254,9 @@ and adds `efr-daemon -> efr-pty` to the forbidden edges. eval of the corpus lines and of the auto prompt is in `crates/efr-daemon/tests/it/classifier_eval.rs`. - Presence and the away wait: the seam `PresenceReader` in - `crates/efr-conversation/src/presence.rs`; the wait of a question while the user is - away in `crates/efr-conversation/src/turn.rs`; the state of each conversation in + `crates/efr-conversation/src/presence.rs`; the one wait loop of every question (an + approval, the quarantine question, the model's question) in + `crates/efr-conversation/src/turn/wait.rs`; the state of each conversation in `crates/efr-daemon/src/presence.rs`; `presence.set` in `crates/efr-daemon/src/methods/presence_set.rs`; `efr away` in `crates/efr-cli/src/commands/away.rs`; `[presence]` in @@ -321,7 +322,36 @@ and adds `efr-daemon -> efr-pty` to the forbidden edges. `crates/efr-conversation/src/actor/notices.rs`. `efr jobs` in `crates/efr-cli/src/commands/jobs.rs`, and the lines of the view and of `efr history` in `crates/efr-cli/src/format/jobs.rs`. The fake launcher of the tests is - `crates/efr-test-daemon/src/fake_launcher.rs`. + `crates/efr-test-daemon/src/fake_launcher.rs`. The watch batches (v0.0.12): the + batch follower `JobTable::follow_matches` in `crates/efr-daemon/src/jobs.rs`; + `MatchWindow` and `Matched` in `crates/efr-daemon/src/jobs/output.rs`; the text and + the rows of a notice in `crates/efr-conversation/src/notice.rs` (`batch_rows`); + `BATCH_HEAD` and `BATCH_TAIL` in `crates/efr-protocol/src/jobs.rs`. +- The model's question (ADR 0025): the wire types in + `crates/efr-protocol/src/question.rs` and `methods/question_respond.rs`; the tool, + its input check and its results in `crates/efr-conversation/src/ask.rs`; the call in + `crates/efr-conversation/src/turn.rs` and its wait in `turn/wait.rs`; the answer in + `crates/efr-conversation/src/actor.rs` (`respond_question`); the reserved name in + `crates/efr-tools/src/registry.rs`; `question.respond` in + `crates/efr-daemon/src/methods/question_respond.rs`; who can answer + (`answers_questions`) in `crates/efr-daemon/src/methods/conversation_subscribe.rs`, + `connections.rs` and `presence.rs`; the card and its end line in + `crates/efr-cli/src/format/card.rs` (`user_question`, `question_end`) and the keys + in `crates/efr-cli/src/follow/view/asking.rs`; the phone in + `app/src/features/conversation/`. +- Who can act on a conversation (the row states): `status` and `attention` in + `crates/efr-store/src/conversations.rs` (`refresh_status`, `changes_status`) and the + `waits` projection in `crates/efr-store/src/waits.rs`; the words in + `crates/efr-cli/src/format/status.rs` (`row_state`) and + `app/src/lib/protocol/status.ts` (`rowState`). +- Desktop notices and the wake of a waiting prompt: the body rule in + `crates/efr-stdx/src/text.rs` (`notice_body`); efrd's bodies in + `crates/efr-daemon/src/notices.rs` (`desktop_what`, `place`) and the FIFO in + `crates/efr-daemon/src/notices/wake_fifo.rs`; the plugin's reader in + `shell/zsh/efr.plugin.zsh`, section "the wake of a waiting prompt" + (`_efr_open_wake`, `_efr_notice_wake`, `_efr_notify_wanted`); `efr`'s notices of a + wait and of the end of a turn in `crates/efr-cli/src/notify.rs`; `[notify]` in + `crates/efr-config/src/tables/notify.rs`. - Job port forwards (ADR 0016). Trust: efrd decodes bytes that come from the sandbox, so the frames have a fixed size and a hand decoder with property tests, and every other byte is copied opaque. The pure rules (the parse of the TCP tables, the diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ae5a3f6b..9dd249d51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,64 @@ into the GitHub release notes, and it stops when the section is missing. ## [Unreleased] +## [0.0.12] - 2026-11-18 + +### Added + +- The model can monitor a log, a build, a test run or a deploy: it starts a background + job with a `watch` pattern and ends its turn. Lines of the job that match the + pattern within 1 second reach the model as one notice of at most 20 lines (the first + 10 and the last 10). A watch gives 3 notices by default and 10 at most. Lines that + match just before the job ends go into the notice of its end, so a burst and an exit + start one wake turn. The turn view and `efr history` show a batch as one row, such + as `job j3 matched 20 lines (19 not shown): `. +- efr sends a desktop notice through the terminal (OSC 777, `[notify]`) when a + question or an answer line waited 10 seconds and you typed no key, and when a turn + that took at least `notify.after_secs` (30) ends: `app: done in 4m 12s` or + `app: failed after 1m 3s`. An interrupted turn sends none, and no notice goes out + within 10 seconds after a key, such as the answer to a card. `notify.terminal = "auto"` + sends it only in Ghostty and never through tmux, GNU screen or zellij. Leave + Ghostty's `notify-on-command-finish` at `never` for efr, or you get two notices at + the end of a turn. +- The notices of efrd now show above a waiting zsh prompt at once, and the text that + you typed stays. Before, they waited for your next Enter. A notice that needs you, + such as a question, the end of a job notice turn or job notices that wait at the + wake limit, also sends a desktop notice through the same `notify.terminal` rule. +- The model can ask you a question with 2 to 4 options (the tool `ask_user`). Press a + digit to pick an option, `t` to type an answer of your own, or Esc to skip. The + phone app can answer too: tap the strip or the row of the question, then pick an + option in the action sheet, skip, or type an answer in the composer. An answer is + information for the model: it approves nothing, and efr never reads it as your + message for its own rules. While nobody who can answer follows the conversation, the + question waits `presence.away_wait_secs` (300 s), and then the model goes on with a + choice that is safe and easy to undo. `conversation.ask_user = false` turns the tool + off. `efr search` and the search of the phone find the question, its option labels + and an answer that you typed. +- `efr history --list` and the conversations sheet of the phone app show who must act: + "needs approval", "needs an answer", "answer in the terminal", "running" and + "failed". The sheet shows a banner when a machine is offline, with the age of the + rows that the phone keeps, such as `homelab offline · rows from 2h ago`, and its + times move once a minute. The strip of the phone for another conversation says what + it waits for: "Approval waiting", "Question waiting", "Answer in the terminal", or a + count such as "3 conversations need you". + +### Changed + +- A watch of a job counts notices, not lines. `jobs.max_wakes_per_watch` is 10 by + default (it was 3), and a watch that names no `max_wakes` gives 3 notices (it was 1). + After the last notice the job runs on until it ends or its time limit passes, and + the notice of its end always comes. +- The first start of efrd after the update rebuilds the lists from the log once. +- A question of the model in a terminal that does not follow the turn leaves a notice + row, as an approval does. The row of a failed job notice turn has its head in the + error colour. +- The lists count a quarantine question as "needs approval". Before, they showed the + conversation as running. + ### Fixed +- A quarantine question no longer waits without end while you are away. It waits + `presence.away_wait_secs`, and the change stays in quarantine. - The quarantine sheet of the phone app shows Next after its question closed while another question waits, as the approval sheet does. Before, it showed only Close. @@ -2573,7 +2629,8 @@ The first release, on the AUR as `efr-code` and `efr-code-bin`. - Settings in `config.toml` with live reload, `efr config` commands and `efr paths`. - The AUR packages `efr-code` and `efr-code-bin`. -[Unreleased]: https://github.com/eggfriedrice24/eggfriedrice.code/compare/v0.0.11...HEAD +[Unreleased]: https://github.com/eggfriedrice24/eggfriedrice.code/compare/v0.0.12...HEAD +[0.0.12]: https://github.com/eggfriedrice24/eggfriedrice.code/compare/v0.0.11...v0.0.12 [0.0.11]: https://github.com/eggfriedrice24/eggfriedrice.code/compare/v0.0.10...v0.0.11 [0.0.10]: https://github.com/eggfriedrice24/eggfriedrice.code/compare/v0.0.9...v0.0.10 [0.0.9]: https://github.com/eggfriedrice24/eggfriedrice.code/compare/v0.0.8...v0.0.9 diff --git a/Cargo.lock b/Cargo.lock index 7f61e34fe..83272d79f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -700,7 +700,7 @@ checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "efr-cli" -version = "0.0.11" +version = "0.0.12" dependencies = [ "assert_cmd", "clap", @@ -735,7 +735,7 @@ dependencies = [ [[package]] name = "efr-config" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-permissions", "efr-protocol", @@ -753,7 +753,7 @@ dependencies = [ [[package]] name = "efr-conversation" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "efr-permissions", @@ -781,7 +781,7 @@ dependencies = [ [[package]] name = "efr-credentials" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-stdx", "jiff", @@ -798,7 +798,7 @@ dependencies = [ [[package]] name = "efr-daemon" -version = "0.0.11" +version = "0.0.12" dependencies = [ "anyhow", "async-trait", @@ -859,7 +859,7 @@ dependencies = [ [[package]] name = "efr-holder" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "efr-protocol", @@ -873,7 +873,7 @@ dependencies = [ [[package]] name = "efr-http" -version = "0.0.11" +version = "0.0.12" dependencies = [ "base64 0.23.1", "bytes", @@ -903,7 +903,7 @@ dependencies = [ [[package]] name = "efr-oauth-openai" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "base64 0.23.1", @@ -934,7 +934,7 @@ dependencies = [ [[package]] name = "efr-permissions" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-protocol", "efr-test-support", @@ -949,7 +949,7 @@ dependencies = [ [[package]] name = "efr-protocol" -version = "0.0.11" +version = "0.0.12" dependencies = [ "base64 0.23.1", "jiff", @@ -966,7 +966,7 @@ dependencies = [ [[package]] name = "efr-provider" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "efr-protocol", @@ -983,7 +983,7 @@ dependencies = [ [[package]] name = "efr-providers" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "efr-http", @@ -1009,7 +1009,7 @@ dependencies = [ [[package]] name = "efr-proxy" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-permissions", "efr-protocol", @@ -1027,7 +1027,7 @@ dependencies = [ [[package]] name = "efr-pty" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "efr-holder", @@ -1044,7 +1044,7 @@ dependencies = [ [[package]] name = "efr-render" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-test-support", "insta", @@ -1060,7 +1060,7 @@ dependencies = [ [[package]] name = "efr-sandbox" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-protocol", "pretty_assertions", @@ -1072,7 +1072,7 @@ dependencies = [ [[package]] name = "efr-sbx" -version = "0.0.11" +version = "0.0.12" dependencies = [ "clap", "efr-protocol", @@ -1094,7 +1094,7 @@ dependencies = [ [[package]] name = "efr-scope" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-protocol", "efr-stdx", @@ -1111,7 +1111,7 @@ dependencies = [ [[package]] name = "efr-screen" -version = "0.0.11" +version = "0.0.12" dependencies = [ "bytes", "efr-protocol", @@ -1131,7 +1131,7 @@ dependencies = [ [[package]] name = "efr-screen-ghostty" -version = "0.0.11" +version = "0.0.12" dependencies = [ "bytes", "efr-render", @@ -1145,7 +1145,7 @@ dependencies = [ [[package]] name = "efr-shell" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "bytes", @@ -1169,7 +1169,7 @@ dependencies = [ [[package]] name = "efr-snapshot" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-protocol", "efr-scope", @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "efr-stdx" -version = "0.0.11" +version = "0.0.12" dependencies = [ "etcetera", "jiff", @@ -1211,7 +1211,7 @@ dependencies = [ [[package]] name = "efr-store" -version = "0.0.11" +version = "0.0.12" dependencies = [ "efr-protocol", "efr-stdx", @@ -1230,7 +1230,7 @@ dependencies = [ [[package]] name = "efr-test-daemon" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "aws-lc-rs", @@ -1256,7 +1256,7 @@ dependencies = [ [[package]] name = "efr-test-support" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "base64 0.23.1", @@ -1277,7 +1277,7 @@ dependencies = [ [[package]] name = "efr-tools" -version = "0.0.11" +version = "0.0.12" dependencies = [ "async-trait", "efr-protocol", @@ -1300,7 +1300,7 @@ dependencies = [ [[package]] name = "efr-transport" -version = "0.0.11" +version = "0.0.12" dependencies = [ "base64 0.23.1", "bytes", @@ -4193,7 +4193,7 @@ checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" [[package]] name = "xtask" -version = "0.0.11" +version = "0.0.12" dependencies = [ "anyhow", "cargo_metadata", diff --git a/Cargo.toml b/Cargo.toml index 4dff99290..7b2732cd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ default-members = [ ] [workspace.package] -version = "0.0.11" +version = "0.0.12" edition = "2024" rust-version = "1.99" license = "MIT" diff --git a/app/README.md b/app/README.md index 590c4b748..b5eb4a7e6 100644 --- a/app/README.md +++ b/app/README.md @@ -589,6 +589,53 @@ Uniwind draws some classes only on the iPhone: `shrink-[1000000]`, `line-through of the machine ("desktop default" in the quiet line) and takes the item away. It never shows next to "desktop default". +### The model's question, the row states and the offline banner (0.0.12) + +`src/lib/protocol/status.ts` (`rowState`, `waitsForUser`) is the one rule of the row +state, in the order of `row_state` in efr-cli. `src/features/navigation/use-now.ts` is +one shared minute timer for every reader. These checks need the iPhone: + +48. SH-Offline: with one machine offline, the banner is the header of the sheet's + native list, with `wifi.slash` in text_subtle and one line in text_muted, such as + `homelab offline · rows from 2h ago`. With two machines, it names both; with + three, it counts them. The footer "1 machine did not answer" is gone, also from + the search results. VoiceOver reads the line in full words ("2 hours ago"). +49. S-Rows: the rows "needs an answer" and "answer in the terminal" have the yolk "!" + mark and stand in Needs you; "✗ failed" is in state_error with no mark and stays + in its day. Leave the sheet open over a minute: the times move from "now" to "1m" + with no tap. +50. S-Ask 1 and 2: a question of the model shows in the strip with the yolk dot, the + question and "Answer". A tap opens the native action sheet, anchored to the strip + on iOS 26, with the question as the title, the `label: description` lines as the + message, one button per option, "Type an answer", "Skip" and Cancel. Check a + question of 300 characters and labels of 60 at the largest Dynamic Type size (AX5). + With an approval and a question, the older goes first and "1 of 2" counts both. +51. S-Ask 3: "Type an answer" opens the keyboard at once. The answer row (`Answer · + · xmark`) and the hint `Do not type a password or a token here.` stand + above the keyboard, the field says "Your answer", and VoiceOver reads "Send the + answer". Past 1024 bytes, Send dims. The xmark leaves and keeps the text as a draft. + An answer from the terminal ends the answer state by itself. +52. S-Ask 4: the row of the call says "waiting for you" with the yolk dot, and a tap + opens the sheet; after the answer it says "answered ·