wherever-dev 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/CHANGELOG.md +1180 -0
  2. package/README.md +60 -0
  3. package/package.json +28 -8
  4. package/public/_app/immutable/chunks/{D7cniAcl.js → Be584n9t.js} +2 -2
  5. package/public/_app/immutable/chunks/{D7cniAcl.js.map → Be584n9t.js.map} +1 -1
  6. package/public/_app/immutable/chunks/CDh6N9EK.js +2 -0
  7. package/public/_app/immutable/chunks/{CMMpRRWm.js.map → CDh6N9EK.js.map} +1 -1
  8. package/public/_app/immutable/chunks/{B4u7MCsa.js → CHdncqe4.js} +2 -2
  9. package/public/_app/immutable/chunks/{B4u7MCsa.js.map → CHdncqe4.js.map} +1 -1
  10. package/public/_app/immutable/entry/{app.B09hP3rk.js → app.Bvi1whhV.js} +3 -3
  11. package/public/_app/immutable/entry/{app.B09hP3rk.js.map → app.Bvi1whhV.js.map} +1 -1
  12. package/public/_app/immutable/entry/start.DrBMY1f9.js +2 -0
  13. package/public/_app/immutable/entry/start.DrBMY1f9.js.map +1 -0
  14. package/public/_app/immutable/nodes/{0.Bl6oKVU5.js → 0.BXOlI-1A.js} +2 -2
  15. package/public/_app/immutable/nodes/{0.Bl6oKVU5.js.map → 0.BXOlI-1A.js.map} +1 -1
  16. package/public/_app/immutable/nodes/{1.H6kc-Qsz.js → 1.Dw59rM0a.js} +2 -2
  17. package/public/_app/immutable/nodes/{1.H6kc-Qsz.js.map → 1.Dw59rM0a.js.map} +1 -1
  18. package/public/_app/immutable/nodes/{2.B6sChdvF.js → 2.B4mmUgEN.js} +2 -2
  19. package/public/_app/immutable/nodes/{2.B6sChdvF.js.map → 2.B4mmUgEN.js.map} +1 -1
  20. package/public/_app/version.json +1 -1
  21. package/public/index.html +10 -10
  22. package/public/service-worker.js +1 -1
  23. package/public/_app/immutable/chunks/CMMpRRWm.js +0 -2
  24. package/public/_app/immutable/entry/start.DsunIvKH.js +0 -2
  25. package/public/_app/immutable/entry/start.DsunIvKH.js.map +0 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,1180 @@
1
+ # wherever-dev
2
+
3
+ ## 0.19.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 9573f1d: Publish a README with each npm package (they had none, so npmjs.com showed "No README data found"), and tidy the package metadata: clearer descriptions, keywords, `wherever.dev` as homepage, author, and the changelog in the tarball. `wherever-dev` now declares `engines.node >=22.19.0` (what the bundled pi SDK requires). `@wherever-dev/client` no longer ships its test suite and tsconfig (its `src/` stays, for the sourcemaps).
8
+
9
+ ## 0.19.0
10
+
11
+ ### Minor Changes
12
+
13
+ - ffbadb1: Upgrade the embedded pi SDK to 1.4 and give server-created (web) sessions pi's native MCP support (#69). The SDK does not load pi's built-in extensions by itself, so the server now loads the built-in MCP, codemode and tool search extensions the way the pi CLI does: the MCP servers in `~/.pi/agent/mcp.json` (and a trusted project's `.pi/mcp.json`) connect in web sessions, `-builtin:mcp` in the `extensions` setting still turns them off, and an installed replacement such as pi-mcp-adapter still takes over. Sign in to OAuth MCP servers from a terminal (`pi mcp login <server>`); web sessions use the stored credentials. Models and auth now come from pi 1.x's shared `ModelRuntime`, and `/models` refreshes availability before answering, so a provider signed in to from a terminal shows up without restarting the server.
14
+ - ffbadb1: Choose which pi SDK web sessions run on with `piSdk` in `~/.wherever/config.json`: the bundled SDK (default), `"auto"` for the `pi` on the server's PATH (npm global bins and Nix-style wrappers are followed), or a path to an install. Versions in the tested range (currently `>=1.4.0 <1.5.0`) are used directly; untested versions from 1.0.0 up can be allowed with `allowUntested: true` or a narrower `accept` semver range, and older ones are always refused. A refused, missing or broken install never stops the server: it falls back to the bundled SDK and logs why. The startup log and the web UI's version tooltip show the pi version in use. Using an install's own built-in extension list also brings pi's `llama.cpp` provider to web sessions.
15
+
16
+ ## 0.18.5
17
+
18
+ ### Patch Changes
19
+
20
+ - ad574b7: Reopening the app after the phone killed it now shows the conversation at once. The web keeps a small on-device cache of recently viewed conversations and, when the address names a cached session, paints it before the connection is up: you can read and type straight away, and only sending waits until the session has resynced, when the server's history replaces the cached copy. A session the server no longer has is dropped from the cache and from the address bar without adding a history entry. Both "Disconnect" actions wipe the cache, connecting to another server drops the previous server's conversations, and "Reconnect" or connecting again to the same server keeps them. "Load older messages" appears only once the real history has arrived.
21
+ - 18696b8: Uploads over the WebSocket are now resumable and report real progress when the server supports it (`upload.v1`). The client sends the file as binary chunks, counts progress only from the server's acknowledgements, pauses on a dropped connection and, after the reconnect rejoins the session, continues from where the server got to instead of starting over. Cancelling an upload now tells the server to drop the partial file. Against an older server the client falls back to the previous single-frame upload, with the same limits as before (72 MB, three attempts). A file the phone can no longer read fails with "The file is no longer readable, pick it again".
22
+
23
+ Breaking for `@wherever-dev/client`: `uploadFileViaWebSocket(sessionId, filename, source, options)` now takes a byte source (`{size, read(offset, length)}`) instead of a base64 string, and gains `options.onProgress` and `options.mime`. The client also exposes `uploadsStore` (progress per upload id) and `forgetUpload(id)`. In the web app, `uploadFile()` accepts an `onProgress` callback that reports `{acked, size, state, error?}` for every upload method.
24
+
25
+ - c99ccd6: Server: resumable, binary, chunked uploads over the existing WebSocket (`upload.v1`, advertised in `connected.capabilities`). `upload_begin` / binary chunk frames / `upload_finish` / `upload_abort`, acked with `upload_offset`, resumable from the server offset after a reconnect, serialised per upload id, idempotent across a lost reply or a server restart (a repeated finish returns the same `savedPath`), and gated on every frame by the painted-session write gate. Partials are staged under `<state dir>/upload-staging`, never downloadable, and garbage-collected after 24 h. The legacy base64 `file_upload` frame keeps working.
26
+ - bdafbcc: Client groundwork for showing a cached conversation instantly after a reload. `@wherever-dev/client` now exports `serverKey(config)` (a synchronous `host:port` plus token-hash identity) and `WhereverClient.hydrateCachedSession(snapshot)`, which paints a cached conversation before the socket is up and lets the normal reconnect rejoin replace it with the server's history. The store gains `serverKey` (the server that actually delivered the active session) and `historyAuthoritative` (gates `loadMoreHistory()` until the real history has arrived). A reconnect after the host, port or token were edited no longer preserves or rejoins the previous server's session. When the server refuses the load of a hydrated session outright, the client clears it and emits a synthesized `hydration_rejected` event to `onMessage` listeners. `resume()` no longer arms a load watchdog that was immediately cleared.
27
+ - 338a3c0: Returning to the app after the file picker, the camera or a short app switch no longer tears down a healthy connection and resyncs the session. The client's liveness watchdog now treats a silent socket as suspect, not dead: it sends a ping and waits a 5 s grace period, and only reconnects if nothing at all arrives. The page also probes the socket on every return to visibility (`client.noteVisible()`), and a detected freeze (a wall-clock jump between watchdog ticks) triggers the same probe. A genuinely dead socket is still torn down and reconnected, about 5 s later than before.
28
+ - 94c1611: Add the web's on-device conversation cache module (`web/src/lib/core/conversation-cache.ts`): a bounded IndexedDB store of recently viewed conversations (5 sessions in total, ~2 MB each, LRU), scoped by server key, normalized at write time (no undelivered messages, streaming flags or tool images), with a write throttle for streaming replies and a silent no-op fallback when IndexedDB is unavailable. Not wired into the app yet; it is the storage half of instant resume after the OS kills the PWA.
29
+ - 8acafe0: Opening a link (or reloading a page) whose URL names a session that cannot be loaded, e.g. one that was deleted, no longer retries the load every 300 ms forever with a flickering error and a permanent "Loading session..." spinner. The load is tried once: on failure the error is shown, the URL fragment is cleared (without adding a history entry, so Back still works) and the home screen comes back.
30
+ - ccd9791: Build tooling: move the build-script approval from `package.json`'s `pnpm.onlyBuiltDependencies` (no longer read by pnpm 11, which then failed `pnpm install` with `ERR_PNPM_IGNORED_BUILDS`) to `allowBuilds` in `pnpm-workspace.yaml`, which pnpm 10 and 11 both honour. Only esbuild may run its install script, as before. Also Prettier-format `web/src/lib/core/view-mode.ts` and its test, which were failing `pnpm format:check`.
31
+ - d7a83fd: POST uploads (`uploads.method: 'post'`) now show real progress on the attachment chip (the web client uses XMLHttpRequest instead of `fetch`), report a cancel as cancelled and show the server's reason on a refusal. `POST /session/upload` now writes into the session's own upload dir even while its agent is still building (it used to fall back to tmp), answers 404 for an unknown session, refuses a read-only, missing or being-restored folder (403), and enforces `uploads.maxBytes` (413), removing any partial file.
32
+ - 5ef0f41: The server's WebSocket heartbeat reaper no longer drops a healthy connection after a single late pong: it terminates a socket only after two consecutive unanswered pings, and any inbound message now counts as proof of life just like a pong, so a client busily sending data (e.g. upload chunks) is never reaped. A genuinely dead (half-open) socket is still reaped, at most one interval later. The interval is configurable with `WHEREVER_HEARTBEAT_MS` (default 30000; an invalid value is ignored with a warning).
33
+ - 2a8e1c2: Composer attachment chips now show the upload's real state: a progress bar with a percentage while sending (a spinner until the first bytes are acknowledged), "Paused, waiting for connection" while offline, a finishing state, and a Cancel control while in flight. A failed upload shows the reason and a Retry button that reuses the picked file (no re-pick), except when the file is no longer readable, where the chip asks to pick it again. Send stays disabled while any attachment is still uploading.
34
+ - 1e74f00: Uploads are now bound to the session the socket painted. A `file_upload` for any other session is refused with a reason. Before this, a client on a writable session could write into another session's folder. An upload made while a cold session's agent is still building now lands in that session's upload dir instead of falling back to tmp. A leave or switch during a cold load no longer lets the slow build re-attach the socket or send a stale `session_ready` / `session_error`. New config key `uploads.maxBytes` (default 1 GiB) refuses oversized uploads with a reason.
35
+ - 3da6573: Mobile resilience fixes for loading sessions, reconnecting and uploading files:
36
+ - Opening a session no longer flashes "New Session Started" while its history is still arriving. A "Loading conversation..." spinner is shown until the history lands.
37
+ - While disconnected or resyncing, the composer stays editable: you can keep reading, typing and attaching. Only sending (Send/Steer, Enter, dictation auto-send) waits for the connection and the resync.
38
+ - A WebSocket file upload is no longer tied to the socket it started on. If the socket drops (e.g. the file picker or camera backgrounds the page on mobile), the upload waits and is sent again automatically once the session has rejoined (after the server re-applies its read-only verdict). The chip shows "waiting for connection" in the meantime. Uploads always settle: they used to hang forever, leaving Send disabled. They now complete, fail, or time out after 10 minutes of waiting for a connection (time spent actually transferring does not count).
39
+ - Removing an attachment chip cancels its pending upload, and no longer updates the wrong chip.
40
+ - Uploads that waited for an unreachable server now time out after 10 minutes as intended (the clock used to restart on every reconnect attempt). An upload whose connection drops during the transfer on 3 consecutive attempts now fails with a clear message instead of retrying forever, and files too large for a single WebSocket frame (over 72 MB) are refused before being read.
41
+
42
+ ## 0.18.4
43
+
44
+ ### Patch Changes
45
+
46
+ - b75a4ab: Server-created sessions no longer load the CLI bridge extension (`@wherever-dev/pi`). Since 0.18 the server runs the pi extension lifecycle for its own sessions, and with the bridge in the user's pi settings (the normal install) the bridge ran inside the server, registered the server's own session as a CLI terminal, got shut down by that takeover, disconnected, and the server reloaded the session, several times a second. Any turn in flight was aborted with "CLI terminal disconnected. Active execution was aborted." even though no terminal was attached. The server now filters the bridge out of every session it builds (new, loaded and reloaded), identified by the name in the nearest named `package.json` of the extension's resolved file (`@wherever-dev/pi`), not by a substring. Every other extension still gets `session_start` and `session_shutdown`. A real terminal `pi` still takes over and hands back as before. The server also marks its process with a `globalThis` symbol (never an environment variable, so it cannot leak into terminals or commands a session spawns), which newer bridge versions check. The `remote.bridge: false` workaround in config.json is no longer needed.
47
+
48
+ ## 0.18.3
49
+
50
+ ### Patch Changes
51
+
52
+ - ba530fd: The AGENTS.md seeded into the search folder is reworded for small local models. On a machine running Gemma 4 E4B with `web_search` and `web_fetch` provided by an extension, a search session replied that it could not search the web, because the old text framed the tools as something that might be missing or failing. It now opens, in bold, by stating that `web_search` and `web_fetch` exist and work, that every question gets a `web_search` first, and that the agent must never say it cannot search. The method is a three-step numbered list (search, fetch one to three results, answer briefly with the links used), a question about the machine itself is answered with bash, and the failure case comes last and only applies when a `web_search` call actually returns an error. The bundled `skills/web-search` skill gets the same tools-first opening and error-triggered failure rule. An existing AGENTS.md is still never overwritten.
53
+
54
+ ## 0.18.2
55
+
56
+ ### Patch Changes
57
+
58
+ - 54ee452: The AGENTS.md seeded into the search folder no longer assumes one particular setup. It used to send the agent to "the web-search skill" and, when a search failed, to blame Ollama and suggest `ollama signin`, which is wrong on any machine whose `web_search` / `web_fetch` come from another extension (pi-webveil over a local SearXNG, for instance), and small local models followed it literally. It now names no skill and no provider: it says the workspace needs an extension that provides `web_search` and `web_fetch`, and if they are missing or failing the agent says so plainly and never answers from memory as if it had searched. It also tells the agent that a question about the machine it runs on is answered with its bash tool rather than a search, and that anything worth keeping goes into a topic-named subfolder, never the workspace root. The bundled `skills/web-search` skill's failure advice is likewise provider-agnostic. An existing AGENTS.md is still never overwritten.
59
+
60
+ ## 0.18.1
61
+
62
+ ### Patch Changes
63
+
64
+ - 3074b96: Server sessions now run on models whose provider an extension registers (`pi.registerProvider`), as the pi CLI does. pi queues those registrations while extensions load and, on the path wherever takes, flushed them only when wherever bound the extensions, after `createAgentSession` had already picked the model. A default model served through an extension (a local model, for instance) therefore resolved to nothing: the session showed `unknown:unknown` and every prompt failed with "No API key found", while the same settings worked in the pi CLI. The registrations are now applied right after loading, before the model is chosen, and a model handed to a rebuild (a `/reload`) is re-read from the registry, so a provider whose config changed takes effect. The global extensions' providers are also discovered once at startup (bounded to 10 s), so `/models`, the default-model lookup and a model picked in the new-session form see them before any session exists.
65
+
66
+ ## 0.18.0
67
+
68
+ ### Minor Changes
69
+
70
+ - 914a24c: Support `/reload` in the web composer. It no longer reaches the model as chat text: the client sends a new `session_reload` frame and the server rebuilds the session's agent so it re-reads settings, extensions (including edited extension code), skills, prompts and context files such as AGENTS.md. Extensions see `session_shutdown` and `session_start` with reason `reload`. The rebuild keeps the conversation, model and thinking level, and avoids pi's in-place reload, whose provider reset would affect every other live session. While it runs, viewers get `session_reloading` (composer blocked) and then `session_ready`. It is refused with a notice while the agent is busy, for terminal-driven sessions and for read-only viewers. The client gains `reloadResources()`.
71
+
72
+ ## 0.17.1
73
+
74
+ ### Patch Changes
75
+
76
+ - 777d652: Server-created sessions now run the pi extension lifecycle. Both `createAgentSession()` paths call `bindExtensions()` before the session is tracked, so extensions receive `session_start` and `resources_discover` (this fixes "MCP not initialized" from the pi-mcp-adapter in web sessions); a `session_start` still running after 15s is logged. Every dispose now aborts any in-flight turn, then emits `session_shutdown` (`reason: "quit"`) bounded by a 5s timeout, on idle eviction, manual destroy, delete, server shutdown and CLI takeover, so extensions release MCP connections, OAuth callback servers and timers. Extension errors are logged to the journal. Extension-requested reload, new session, fork, switch and tree navigation are refused for server sessions (reload would reset model providers for every session in the process).
77
+
78
+ ## 0.17.0
79
+
80
+ ### Minor Changes
81
+
82
+ - 27d0389: Reach a token-protected instance with a single link: opening `https://host/#token=SECRET` now gives a fully working session with nothing to configure by hand.
83
+
84
+ The dashboard takes the token out of the page URL on boot, merges it into the stored connection config and removes it from the address bar with `history.replaceState`, so no history entry keeps the secret. Previously the token was only ever read from Connection Settings, so a link authenticated the page request but left the WebSocket upgrade with no credential: the dashboard rendered and then failed to connect.
85
+
86
+ The hash fragment is the documented form because a fragment is never sent to the server, keeping the token out of HTTP access logs, out of the `Referer` header and out of any intermediary proxy's request log. A legacy `?token=` link still works and is scrubbed from the address bar too. Adopting a link only touches the token field, so host, port and display preferences are preserved, and a blank `#token=` is ignored rather than stored, so a malformed link cannot clear a token that is already working.
87
+
88
+ The token is stored exactly as written in the link, since the server compares it byte for byte, and the `token` key is recognised whatever its capitalisation, so a retyped link is adopted rather than being mistaken for a session deep link (the fragment is also how the dashboard addresses a session).
89
+
90
+ ## 0.16.0
91
+
92
+ ### Minor Changes
93
+
94
+ - 3328220: Serve on a unix socket, with `--socket <path>` or `--socket fd://<n>`.
95
+
96
+ `--socket /run/wherever/wherever.sock` binds a unix socket instead of a TCP port, for running behind nginx or Caddy (`reverse_proxy unix/<path>`). A stale socket file left by a crashed server is removed first; a socket something is still _serving_ is refused rather than unlinked, because stealing it would leave the incumbent running and permanently unreachable. A path that exists and is not a socket is refused outright, so a typo in a unit file cannot destroy a file. The mode is set deliberately (`--socket-mode`, default 0660) rather than inherited from the ambient umask, which otherwise decides whether the proxy can connect based on whichever shell happened to launch the service.
97
+
98
+ `--socket fd://3` adopts a socket a supervisor already created, bound, chowned and chmodded, which is what systemd socket activation passes. This is the better form for a supervised service: systemd applies `SocketUser=`/`SocketGroup=`/`SocketMode=` as root before the process starts, so the socket can be owned by one account and connectable by a proxy running as a different uid, with no shared group, no setgid parent directory and no privileged code in the server. The descriptor is verified to be an open socket before use, and `LISTEN_FDS`/`LISTEN_PID` are honoured: a mismatched `LISTEN_PID` warns rather than refusing, since the descriptor was named explicitly and an inherited fd survives a fork perfectly well.
99
+
100
+ Three things that are not the listen call but would otherwise be wrong: the startup banner describes the socket instead of interpolating a `host:port` that does not exist; the no-token warning gets its own branch, because a socket is neither the off-loopback case (that warning would misstate what is exposed) nor the quiet loopback case (a socket's reach is its file mode, which is routinely widened for a proxy), and without it an unauthenticated socket warned nothing at all; and `--http-localhost-fallback` is refused alongside `--socket` rather than silently kept, since it opens a second TCP listener and so hands an operator who asked for no TCP surface one anyway.
101
+
102
+ A unix socket also no longer mints a self-signed certificate. TLS over a unix socket protects nothing, the generated certificate is `CN=localhost` and a socket has no hostname to match, and minting it writes a keypair unasked. Explicit `--ssl-key`/`--ssl-cert` are still honoured.
103
+
104
+ Also fixes test isolation: `test/harness.ts` neutralises `WHEREVER_STATE_DIR` alongside the `WHEREVER_CONFIG_DIR` it already isolated. Drafts live in the state dir, so without this the suite read and appended to the real one whenever it was run from inside a wherever session, where the server's own `WHEREVER_STATE_DIR` is inherited by every descendant shell.
105
+
106
+ ## 0.15.2
107
+
108
+ ### Patch Changes
109
+
110
+ - 88e0810: Apply the instance appearance from the layout rather than from the config fetch.
111
+
112
+ `fetchConfig()` in `session-store.ts` wrote directly to `document.documentElement` via `applyAppearance()`, putting a DOM side effect in the module that talks to the server. The store is now the only thing it publishes, and `+layout.svelte` re-themes off that store: it already owns `app.css`, where the `--color-brand-*` tokens and the frame/pattern rules the appearance drives actually live.
113
+
114
+ Driving the effect off the store rather than off the fetch also means any future writer re-themes too, instead of the palette only updating on the one code path that happened to remember to call it.
115
+
116
+ Adds coverage for the `/config` appearance mapping, which had none: the accent/label/frame/pattern payload, the compiled defaults for a server that configures no appearance, and the last-known appearance surviving an unreachable server.
117
+
118
+ - e6c3ca2: Fix the web unit suite failing to resolve `$lib` imports.
119
+
120
+ `web/vitest.config.ts` is a standalone config that deliberately does not load the SvelteKit vite plugin, so nothing registered the `$lib` alias. This went unnoticed until `src/lib/session-store.ts` gained an `import ... from '$lib/theme'`, which put an aliased specifier on a module the tests actually load, breaking all 6 tests in `session-store.test.ts` and `remote-candidates.test.ts`.
121
+
122
+ The alias is now registered directly in the vitest config, keeping the no-plugin property intact. Its target is read from SvelteKit's own `svelte-kit sync` output rather than hardcoded as `src/lib`, so it cannot drift from what SvelteKit resolves `$lib` to if `kit.files.lib` is ever changed.
123
+
124
+ ## 0.15.1
125
+
126
+ ### Patch Changes
127
+
128
+ - ee96ade: Configure the CLI bridge's connection from `config.json`, not just flags.
129
+
130
+ The bridge's connection settings were reachable only as command-line flags, which breaks down for any deployment that is not on the built-in defaults: the settings have to be repeated on every single `pi` invocation, and a human who starts `pi` by hand just gets a bridge that never connects.
131
+
132
+ The case that motivated this is a server behind a TLS-terminating reverse proxy. It runs `--http` on loopback and lets Caddy or nginx own HTTPS, but the extension defaults to `wss://`, so the bridge fails the TLS handshake with `wrong version number` while the server logs nothing at all: from the server's side no connection was ever made. The existing `--remote-insecure` flag fixes it per-invocation, which is the part that does not scale.
133
+
134
+ A new `remote` section in the shared `config.json` sets the same things persistently, alongside the `beep` section the extension already reads from that file:
135
+ - **`host`** / **`port`** / **`token`**: where the standalone server is, defaulting to `127.0.0.1:31415` as before.
136
+ - **`insecure`**: connect over plain `ws://`. This is the reverse-proxy case above.
137
+ - **`bridge`**: set `false` to disable the bridge entirely.
138
+
139
+ Precedence is explicit CLI flag, then config, then built-in default. Making that hold required dropping the registered `default:` from `--remote-host`, `--remote-port` and `--remote-token`, because a registered default is indistinguishable from the user typing that same value: `getFlag` always returned something truthy, so the config could never have won. The defaults now apply at the point of use and are stated in the flag descriptions, so `--help` is unchanged in substance.
140
+
141
+ Two of these are only reachable from config, and that is inherent rather than an oversight. A pi boolean flag cannot be passed as `false`, so `--remote-bridge` could never actually disable the bridge, and `remote.insecure: true` cannot be turned back off by a flag. The `insecure` asymmetry is documented on the config field: undo it by editing the config, not with a second negating flag.
142
+
143
+ The extension now also honours `WHEREVER_CONFIG_DIR` when locating `config.json`, matching the server's `getWhereverConfigDir()`. Previously an isolated harness would relocate the server's config while the extension kept reading the developer's real `~/.wherever/config.json`, which is the exact cross-talk that variable exists to prevent. With the variable unset the path is unchanged.
144
+
145
+ ## 0.15.0
146
+
147
+ ### Minor Changes
148
+
149
+ - dd66a68: Config-driven theming of the web dashboard: distinguish each server instance at a glance.
150
+
151
+ Machines that mirror the same pi sessions over cloned folders look identical in the dashboard, so you cannot tell which instance you are driving — and with clones drifting out of sync, answering "is this the one that is ahead?" currently means reading paths. A new `appearance` section in `~/.wherever/config.json` gives each server a visual identity that the web frontend applies on connect:
152
+ - **`label`** — instance name shown as a pill next to the logo in the sidebar and appended to the tab title (`Wherever · laptop-ahead`). It defaults to the **machine hostname**, so two servers are already distinguishable with zero configuration. An explicit `""`/`false` opts out for the exact pre-feature look.
153
+ - **`accent`** — one CSS color re-tints the whole accent family (links, buttons, gradients, active-session highlights) plus the mobile/PWA `theme-color` chrome. Because the brand palette is compiled as Tailwind v4 `@theme` custom properties, every `bg-brand-*` / `text-brand-*` utility resolves them at paint time: the override is applied as inline CSS variables on `<html>` with no rebuild.
154
+ - **`colors`** — advanced, per-token overrides (`brandDark`, `brandSurface`, `brandSurface2`, `brandSurface3`, `brandBorder`, `brandText`, `brandTextMuted`, `brandCyan`, `brandBlue`, `brandPurple`) for operators who want more than a hue shift; applied on top of `accent`.
155
+
156
+ The identity is served by the existing `GET /config` (behind the same token gate), applied when the dashboard fetches it, and reset before reapplication so a PWA reconnecting to a different instance never blends two palettes. Values are written through `style.setProperty` only — arbitrary config strings cannot inject markup.
157
+
158
+ Two additional visibility markers, for when a hue shift is not loud enough:
159
+ - **`frame`** — a solid accent bar across the top edge of the whole dashboard (default: enabled when `accent` is set). It survives a collapsed sidebar and a session filling the screen, which the sidebar pill does not.
160
+ - **`pattern`** — a backdrop pattern (`stripes` / `dots` / `grid`) painted on the dashboard's dark background wherever it shows, tinted with the accent at low alpha (`color-mix`), so it reads as a watermark rather than noise.
161
+
162
+ The two hardcoded gradient stops in `app.css` were switched to the brand variables, so `accent` retints the `.gradient-text`/`.gradient-border` accents too.
163
+
164
+ ## 0.14.0
165
+
166
+ ### Minor Changes
167
+
168
+ - bf90aed: Make "this session's folder does not exist on this machine" an explicit, safe, explained state instead of a silently broken one.
169
+
170
+ Transcripts and the folders they refer to travel separately: a transcript syncs (syncthing, a backup, a new laptop), the git clone it talks about does not. Opening such a session used to look fine and then quietly hand you a live agent pointed at a directory that is not there: pi's `SettingsManager.create()` and `DefaultResourceLoader.reload()` both succeed against a nonexistent cwd, so nothing threw and the first sign of trouble was every file and bash tool misbehaving for no stated reason.
171
+ - The cheap session-meta read now also answers whether the working folder EXISTS (one `stat`, beside the read-only verdict it already computes from the cwd), so both the warm and the cold load path share the answer.
172
+ - When it does not exist, the transcript still paints (reading never needed the folder), the client is marked read-only, and the cold path does **not** build the live agent at all. There is no `session_ready`, so the composer stays disabled.
173
+ - New `folder_missing` frame (plus a `folderMissing` flag on `session_created`) carries the **absolute** missing path, and the dashboard replaces the composer with a notice naming it. The shared client package mirrors it as `WhereverState.folderMissing`.
174
+ - A message sent anyway is refused out loud, naming the path, instead of being dropped in silence.
175
+ - Read-only precedence is now explicit and lives in one predicate: a configured `sessions.readOnly` folder is hard and never lifted, a missing folder is hard and lifted only by restoring the folder and reloading, and a folder conflict remains the only dismissible one. "Continue anyway" can no longer lift a missing-folder lock.
176
+ - Detection is load-time only, deliberately: a session that is already RESIDENT when its folder is found missing is locked read-only for anyone loading it, but its running agent is left alone.
177
+
178
+ Older clients degrade safely: they simply do not render the notice, and the server's own refusal is what protects them. The restore ACTIONS (clone/create with progress) are separate, later work; until they land this state is locked with no in-app remedy, which is strictly better than an agent running against a directory that is not there. See the new `CONTEXT.md` sections and `docs/adr/0009` / `0010`.
179
+
180
+ - 5214eb8: Creating a new session that CLONES an existing remote now runs through the path-keyed restore registry, with live progress instead of a blocking overlay, and the old synchronous clone is gone.
181
+
182
+ Creating a session in a folder that does not exist could already clone the remote the provider probe found, but it did so synchronously behind the "Creating session..." overlay: no progress, no submodules, and a 25-second client watchdog that gave up while git was still running, which made a large repository effectively un-clonable. That clone is now the same job the restore panel drives, so there is ONE clone implementation left in the codebase.
183
+ - **Cloning here is now RECURSIVE** (`--recurse-submodules`), which it was not before. A session created this way lands with its submodule content present rather than with empty submodule directories discovered later. Upstream tracking is still configured on the resulting clone, as it always was.
184
+ - **Real progress, no watchdog.** The server answers `session_new { cloneRemote: true }` with `restore_started` and then the ordinary `restore_progress` / `restore_complete` frames; the dashboard shows the same honest progress display as the restore panel (phase, scope, a real percentage or an explicitly indeterminate bar, submodules counted separately) and disarms the create watchdog while the job is watched. A multi-minute clone no longer strands the UI.
185
+ - **The server continues into creation itself** once the job is `done`. Unlike the restore panel, this path has nothing to reload: the session does not exist until the clone lands, so the flow completes itself rather than asking the user to retry.
186
+ - **A failed or cancelled clone fails the create** with the registry's mapped cause (no key this host accepts, host missing from `known_hosts`, repository not found, network) on `session_error`, and leaves no half-made session. The clone stays cancellable while it runs, through the ordinary `restore_cancel` frame, because the job is server-owned and keyed by the target path.
187
+ - **`POST /session/new` takes the same branch** for `cloneRemote`, gaining recursion; having no progress channel, it simply waits for the job.
188
+ - **The synchronous `cloneRemoteRepo()` helper is DELETED** and `SessionPool.createNewSession` no longer takes `cloneRemote`: by the time it is called the folder is there. Creating a NEW remote repository (the other branch of the clone-or-create dialog), creating a session in a folder that already exists, and the plain create-the-folder path are all unchanged.
189
+ - The shared client package carries `RestoreInfo.forSessionCreate`, which marks a restore that is the first step of a session create, so a client can tell "watch this and then hand back to the create" apart from the panel's "restore, then reload".
190
+
191
+ - eecb694: Add the server-side restore engine: a path-keyed registry of restore jobs that materialise a missing working folder, either by cloning a remote or by creating an empty folder. It is a standalone module (`server/src/restore-jobs.ts`) with its own tests and is wired to nothing yet; the WebSocket protocol, the dashboard panel and the re-point of the existing create-session clone are separate work.
192
+ - Jobs are keyed by the resolved absolute TARGET PATH, not by socket or session (`docs/adr/0009`), so a clone survives a dropped phone connection, is shared by two tabs, and is never started twice for one folder. A second request for a running path coalesces onto that job and is told the URL actually in flight, so a requester whose edited URL differs is never silently answered as though their own URL was accepted.
193
+ - Clones are RECURSIVE (submodules) and report live progress. Git rewrites one progress line in place, so the parser splits on carriage returns as well as newlines; each frame carries a phase, a scope, and either a percentage or an explicit indeterminate marker, and submodules are scoped to themselves rather than folded into one fake global percentage. The previous synchronous helper did neither, and the create-session path's 25-second client watchdog is why asynchrony and progress matter.
194
+ - Unsafe input is refused before anything is spawned: the target must resolve inside the home directory, the leaf must be absent or empty, and the URL must match a shape allowlist (scp-style SSH, `ssh://`, plus `file://` for fixtures) rejecting control characters, newlines and a leading dash. The clone runs through an argv array with no shell, and never carries a relaxation of git's file-transport protection.
195
+ - SSH only, with the missing credential NAMED rather than worked around (`docs/adr/0010`): interactive prompts are disabled (no terminal prompt, no askpass, batch-mode SSH with a connect timeout) so an unprovisioned box fails fast instead of hanging at zero percent, and git's well-known signatures are mapped onto actionable causes (no key this host accepts, host absent from `known_hosts`, repository not found stated as both wrong-URL and no-access, network rather than credentials) while git's raw stderr is kept underneath.
196
+ - Cancel is authoritative: the child is signalled, the job settles as cancelled, and the target directory is removed only when the job created it.
197
+ - A second, trivial job kind creates the folder (with an optional `git init`) so callers drive one state machine rather than two, and the module owns an explicit subscription seam (progress plus terminal outcome, with unsubscribe) for its two coming consumers: the client broadcast and a per-folder existence-cache invalidation.
198
+
199
+ - 84fc5a9: Restore a session's missing working folder from the dashboard: tap Clone, watch it honestly, cancel it, survive a dropped connection, and come back to a live session.
200
+
201
+ A folder-missing session now shows a RESTORE PANEL in place of its composer: the missing absolute path, an editable URL pre-filled from the server's remote candidates (`GET /remote-candidates`, so a repository can be restored from a phone without typing one), a Clone button, live progress, Cancel while it runs, and on success a Reload that brings the session back live. This is the user-facing half of the path-keyed restore registry, wired over the WebSocket.
202
+ - **New frames**, all namespaced `restore_*` and all addressed by TARGET PATH (never by session id, because the job's key is the path). Client to server: `restore_start { targetPath, action, url?, gitInit? }` and `restore_cancel { targetPath }`. Server to client: `restore_started` (with `outcome: 'started' | 'joined'` and the url really in flight), `restore_rejected` (refused before anything was spawned: no job, no completion coming), `restore_progress` and `restore_complete` (which carries every terminal state -- `done`, `failed` or `cancelled`). `folder_missing` now also carries any `job` already running for the path.
203
+ - **Subscription is DERIVED, not registered**: progress reaches every client whose attached session cwd, pending load target, or folder-missing path MATCHES the job path, evaluated per frame. A phone that drops mid-clone and reconnects repaints the RUNNING job from the `folder_missing` frame and keeps receiving live progress, with no second clone and no leaked bookkeeping. A second device sees the same job, and its Clone tap JOINS it and is told which URL is actually being cloned rather than being silently answered as though its edited URL had won.
204
+ - **A restore in flight now counts as folder-missing.** `git clone` creates the target directory in its first breath, so the plain existence check said "present" for the whole of a multi-minute clone and a client loading in that window was handed a live agent pointed at a HALF-CLONED tree. A session whose folder has a running restore job is locked read-only with no agent built, exactly like one whose folder is absent, and the send refusal says "still being restored" instead of "does not exist".
205
+ - **Honest progress, per story 8**: the phase, the scope (the repository or a named submodule), and either a real percentage or an explicitly indeterminate bar -- never a fake unified number. Submodules are shown under their own scope with a standing note that each is counted separately.
206
+ - **Failures explain themselves**: the mapped cause (no key this host accepts, host missing from `known_hosts`, repository not found, network) with git's raw output available underneath, and a refused request (a target outside the home directory, a non-empty folder, a URL outside the SSH/`file://` allowlist) says why and leaves the panel offering to try again.
207
+ - The shared client package carries the new frames as `WhereverState.restore` (`RestoreInfo` / `RestoreJobInfo` / `RestoreProgressInfo` / `RestoreFailureInfo`) plus `startRestore()`, `cancelRestore()` and `reloadSession()`. Older clients degrade safely: they do not render the panel, and the server's refusal to accept their sends is what protects them.
208
+
209
+ Restoring ends in a RELOAD by design: whether a session has a live agent is a load-time decision, and the load that found the folder missing built none. See the new `CONTEXT.md` section and `docs/adr/0009`.
210
+
211
+ - 8a4fb9f: Mark folders that do not exist on this machine in the session browser, so a freshly migrated machine shows the scale of what still needs restoring without opening every conversation.
212
+ - `GET /sessions` stamps each folder with `missing: true` when its cwd is not a directory on this machine. It is a SECOND, orthogonal per-folder fact beside `readOnly`: read-only is a configured policy, missing is a fact about the disk and is curable by a restore, and the dashboard renders them differently (a **Missing** chip on the folder, never the read-only treatment).
213
+ - The check costs one `stat` per DISTINCT folder path, cached for 10s, never one per session: the listing can cover thousands of sessions and the dashboard refetches it on every `sessions_updated`, so a naive per-session check would put a syscall storm back into the pass the listing cache exists to keep free of IO.
214
+ - Completing a restore invalidates that folder's cached answer (by subscribing to the restore job registry directly, not through the WebSocket layer) and asks connected dashboards to refetch, so the chip disappears without a manual refresh. A folder that reappears by other means (cloned by hand in a terminal, a mount coming back) loses its chip within the cache window on its own.
215
+
216
+ The listing's ordering, its ignore and read-only filters, and everything else about the response are unchanged.
217
+
218
+ - ee71bd3: Answer "which repository is this missing folder?" with an ordered list of SSH candidates, served on demand from a new authenticated `GET /remote-candidates` endpoint so the restore panel can pre-fill an editable URL instead of asking for one to be typed on a phone.
219
+ - Two sources, in decreasing confidence (`server/src/remote-candidates.ts`): the PROVIDER PROBE (the folder matches a configured `remoteRepoRules` entry, so the provider CLI the create-session path already uses is asked whether the repository exists and its SSH URL is taken), then the PATH CONVENTION (`<...>/<host-token>/<owner>/<repo>` read back into `git@host:owner/repo.git`). The convention is what covers repositories owned by SOMEONE ELSE, which the probe structurally cannot find and which dominate a machine migration where one rule covers one personal namespace. Neither source produces anything: an honestly empty list, and the user pastes a URL.
220
+ - SSH only (`docs/adr/0010`): an HTTPS candidate is never synthesised, and a probe result that is not an SSH URL is dropped rather than offered. Candidates are ADVISORY -- the server clones what it is finally given (after the restore job validates it), not what it guessed.
221
+ - A probe failure of any kind (CLI missing, not authenticated, repository absent, a throw) degrades to the derived candidate instead of erroring. A folder no rule covers is never probed at all, so nothing shells out on the common path.
222
+ - Known host tokens are `github`, `codeberg` and `gitlab`, plus any token that is already a dotted hostname (`git.example.com`). An unknown token yields no candidate rather than a confidently wrong one, as does a path too shallow to carry an owner and a repo.
223
+ - The endpoint sits beside `/check-remote-repo`, behind the same token gate, and refuses a path outside the home directory like `/check-path` does. It is called on demand (the panel opening), never per keystroke and never on the session-load path, because the probe shells out.
224
+ - Remote-repo rule matching is now one implementation (`matchRemoteRepoRule`), shared by `/check-path`, `/check-remote-repo` and the resolver.
225
+
226
+ ### Patch Changes
227
+
228
+ - 77a7f37: Gate file uploads behind the read-only verdict, honour tilde-written remote-repo rules at session-creation time, and fix the port race that made the server suite flake.
229
+ - **`file_upload` is now refused on a read-only session.** An upload writes a file to disk, so it is a write capability, but the handler never consulted `client.readOnly`: a client on an observe-only session could not send a message referencing an attachment yet could still drop the attachment itself into the upload directory. It is now refused for every read-only reason (a configured `sessions.readOnly` folder, an uncontinued folder conflict, a missing folder), and refused **out loud** with a `file_upload_error` rather than silently, for the same reason a refused message answers: a client only hides its composer when it agrees it is read-only, so a desync has to be visible instead of swallowed.
230
+ - **A `remoteRepoRules` pattern written as `~/dev/github/me/` now matches when the session is actually created.** Rule matching in `session-pool.ts` used a bare `new RegExp(pattern)` while the HTTP layer expanded a leading `~`, so a rule written the natural way matched in `/check-path` and `/check-remote-repo` — the checks the new-session dialog runs — but not at creation time, and the promised remote was silently skipped. It now goes through the shared `matchRemoteRepoRule`, which also treats an invalid pattern as a non-match rather than throwing.
231
+
232
+ Test-suite reliability (no production behaviour change):
233
+ - **Fixed the port TOCTOU race behind the suite's flakiness.** The two helpers that spawn a real server picked a port by binding to `0`, reading the assigned port, closing the socket, and only then spawning the child — leaving a window in which the port belonged to nobody and another concurrent spawn could be handed the same one. That produced two failures that looked unrelated but were one bug: a server that never bound (`server did not become healthy`), and, worse, a test whose requests reached **another test's** server and got a correct answer to the wrong question (a 401 where a 200 was expected, because that server had a different token). The second shape is why raising timeouts never fixed it — nothing was slow, the request went somewhere else. Port allocation now lives in one place (`server/test/free-port.ts`) and gives each vitest worker a disjoint band below the OS ephemeral range, tracking every port already issued, so two workers cannot collide by construction.
234
+ - **Bounded test concurrency** (`maxWorkers`), since most files boot a real server and vitest otherwise forked one worker per core, putting tens of processes in contention. The suite got _faster_ as a result (~97s vs ~133–186s).
235
+ - **Removed two remaining timing assumptions**: the three heavy `session-transcript` cases assert memory, not elapsed time, but relied on the default 5s timeout while writing tens of MB, so they carry an explicit one; and the `conversation-mode-hint` lockstep test now freezes the clock instead of deep-equalling two independently stamped `Date.now()` values, which only passed when both landed in the same millisecond.
236
+
237
+ No API or protocol changes.
238
+
239
+ - 4bc44ce: Restore panel: create the folder instead of cloning, with a git-init checkbox that honours the configured default.
240
+
241
+ The second remedy for a folder-missing session, for the case where the folder was never a clone (a scratch directory, a folder whose contents only ever lived on the old machine): make it. It reuses the clone's machinery rather than forking it, so there is ONE flow, not two.
242
+ - **Same job, same frames, same state machine.** Create is the existing path-keyed restore job's `create` kind driven over the existing `restore_start { action: 'create', gitInit }` frame: the directory and any missing parents are made, a git repository is optionally initialised, and the panel lands in the same ready-and-reload state a completed clone does. The same safety rules apply, because they are the same guards: the target must resolve inside the home directory, and an existing non-empty target is refused before anything is created.
243
+ - **The checkbox is the CONFIGURED git-init default** (`gitInitDefault`, the same value the new-session dialog reads), never a second restore-only default, so a user who turned it off does not get a surprise repository. The panel refreshes `GET /config` when it opens for a folder rather than depending on the session browser having done so, and the choice travels explicitly in both states.
244
+ - **Deliberately SECONDARY.** The common case is a repository that exists remotely, so Create sits behind a disclosure with a secondary button rather than beside Clone: an accidental tap makes an empty folder that then looks restored, while the non-empty guard refuses the clone that should have happened.
245
+ - The panel is now kind-aware in its running, cancelled and progress wording, and drops the submodule note and the scope label for a create, which has exactly one scope.
246
+
247
+ Tests cover both checkbox states at the WebSocket seam against the resulting filesystem state (a git repository with it on, a plain directory with it off), plus the shared refusals, with the server run against a temp `HOME` and isolated git config.
248
+
249
+ ## 0.13.0
250
+
251
+ ### Minor Changes
252
+
253
+ - 70257b6: Make the server deployable from a READ-ONLY config directory, with no secret on the command line. Everything here is purely additive: with the new variables unset, every path and every behaviour is identical to before.
254
+ - **`WHEREVER_STATE_DIR`** splits "where config is READ" from "where the server WRITES". It **defaults to the config directory**, so an existing install (or a test setting only `WHEREVER_CONFIG_DIR`) is unaffected and there is no migration. `drafts.json` and the auto-generated self-signed `certs/` pair move under it. That is the complete list of things the server writes into the config directory — uploads are _not_ among them, since `uploads.subDir` resolves against the session's own `cwd`, not the config dir.
255
+ - **The certs directory now honours the override.** It was built from `os.homedir()` directly, so `WHEREVER_CONFIG_DIR` did not move it and an isolated server still wrote into the developer's real `~/.wherever`.
256
+ - **`WHEREVER_TOKEN` / `WHEREVER_TOKEN_FILE`** supply the auth token without putting it in argv, where `ps` shows it to every user on the machine. Precedence, highest first: `--token` → `WHEREVER_TOKEN` → `WHEREVER_TOKEN_FILE` (a file whose contents are the token, the shape sops-nix and systemd `LoadCredential=` produce) → `PI_REMOTE_TOKEN`. The two **new** sources are whitespace-trimmed (a secret file ends with a newline); the two **pre-existing** ones are taken verbatim, and `--token` still wins whenever the flag is given even with an empty value, so no install can have the string that authenticates change under it. A `WHEREVER_TOKEN_FILE` that is set but missing/unreadable/empty is a **fatal startup error**, because falling through to "no token" would silently run an unauthenticated server that looks healthy.
257
+ - **`WHEREVER_SSL_KEY` / `WHEREVER_SSL_CERT`**, each resolved independently, so a key from a secret manager and a certificate from ACME can live in completely different places, neither tied to a home directory. A leading `~` is expanded (a systemd `Environment=` line is not shell-expanded). Supplying only one half now warns instead of silently discarding it.
258
+ - The startup banner reports the token's _source_, never the token. A token variable that is set but **blank** warns loudly (that is what a half-rendered secret looks like), as does binding a non-loopback address with no token at all.
259
+ - The token is **deleted from the server's own environment** once resolved, so the children it spawns — the agent's `bash` tool and the memonaut indexer, both of which inherit `process.env` — cannot read it. Previously `!env` in the dashboard printed the server's auth token into a stored transcript.
260
+ - **Explicitly-configured TLS that fails to load is now fatal instead of falling back to plaintext HTTP.** This is the one deliberate behaviour change: the old code caught the error, logged it, and served unencrypted on the same (often `0.0.0.0`) address, so clients sent their token in cleartext to a server that looked healthy — the same fail-open the token-file rule exists to prevent, and the exact shape of a secret that has not decrypted yet. The silent HTTP fallback survives for the self-signed pair the server mints for itself; use `--no-ssl` to ask for plaintext on purpose.
261
+ - **Nix packaging**: `package.nix` (a plain function of `pkgs`, the interface a deployment repo imports with its own nixpkgs pin) plus a `flake.nix` providing `nix develop` (the exact node/pnpm toolchain, replacing a hardcoded version-manager path) and `nix build`. `nix/check-pnpm-deps-hash.sh` fails loudly when `pnpmDepsHash` goes stale, which a plain build cannot detect.
262
+ - `web/svelte.config.js` honours `WHEREVER_BUILD_VERSION`, so a build with no `.git` reports a real build id instead of a timestamp.
263
+
264
+ Also fixed while here: the Nix build never built the `@wherever-dev/client` workspace package, so it only succeeded on a tree where `client/dist` happened to exist from an earlier manual build and would have failed from a clean checkout.
265
+
266
+ See `docs/deployment-nixos.md`, and ADRs 0006 / 0007 / 0008.
267
+
268
+ ## 0.12.0
269
+
270
+ ### Minor Changes
271
+
272
+ - c805329: Add saved drafts: keep a message instead of sending it, then load it back later from any device.
273
+
274
+ The composer footer gains "💾 Save draft" (keeps the typed message and clears the box, the way a send would) and "🗂 Drafts (N)", which opens a list of saved drafts, newest first, with a one-line preview, when it was saved and the folder it was written in. Tapping one loads it into the message box; 🗑 deletes it.
275
+
276
+ **Drafts live on the server**, not in the browser: `~/.wherever/drafts.json`, behind the same token gate as the other API routes, via new `GET /drafts`, `POST /drafts` and `POST /drafts/delete` endpoints. A draft saved on a phone is therefore there on the laptop, and survives clearing site data or restarting the server. The server is the only writer (it owns ids, dedupe, cap and ordering, and answers every mutation with the whole new list); the browser keeps a mirror only so the list still renders while disconnected. Saving fails loudly rather than silently, and the message stays in the box.
277
+
278
+ **Drafts work in every composer mode**, including the no-session home page, which is exactly where you want to pull up something written yesterday and fire it into a new session. They are global rather than per session, for the same reason.
279
+
280
+ **Loading a draft never destroys unsent text:** if the box is not empty the list warns first and offers Replace, Append below (keeps both, separated by a blank line) or Cancel. **Loading does not delete the draft, but sending it does** (mail-client semantics): a mistap must not lose the text, while a message that has actually been sent is no longer a draft. The draft is only consumed when the sent message is still exactly it, optionally below text you typed; edit it further and the draft is kept.
281
+
282
+ The store fails safe throughout: over-long input is rejected rather than truncated, an unreadable or corrupt `drafts.json` is reported instead of being treated as "you have no drafts" (so a save can never overwrite a file it could not read), writes are atomic and 0600, and the composer is only cleared once the server confirms it has the text.
283
+
284
+ This is separate from the existing per-session auto-draft, which remains client-side crash protection for the text currently in the box.
285
+
286
+ ## 0.11.2
287
+
288
+ ### Patch Changes
289
+
290
+ - a5723a8: Stop the test harness leaking a server process per test file. `startHarness()` spawned the server as `pnpm exec tsx ...` and tore it down with `child.kill('SIGTERM')`, but that signal reached only `pnpm`: the real server sat two levels down (`pnpm` -> `tsx/cli.mjs` -> `node`), so it survived teardown and was reparented to init. A full suite run therefore left ~50 MB of orphaned server behind per test file. Run inside the memory-capped `wherever` systemd service, this filled the cgroup with 141 leaked processes holding ~5.5 GB, pinning it at 98% memory pressure and 8.3 GB of swap: the service never OOM-killed (so `Restart=on-failure` never fired) and instead livelocked in permanent reclaim, presenting as a hang indistinguishable from a crash.
291
+
292
+ The harness now invokes the `tsx` binary directly (no signal-swallowing intermediary), spawns it `detached` so it leads its own process group, and `cleanup()` signals the entire group and awaits the actual exit, escalating `SIGTERM` -> `SIGKILL` if the process is wedged. The group kill matters beyond the removed `pnpm` layer, since `tsx` itself spawns an inner `node` child that a bare `child.kill()` would strand. A `process.on('exit')` backstop reaps any still-live server, covering the abnormal path where a test throws or the runner kills the worker and `cleanup()` never runs.
293
+
294
+ - 8d458d3: Fix "new conversation here" landing you back in an existing conversation.
295
+
296
+ Asking for a new session in a folder that already had a live viewer did not create anything: the server attached you read-only to the session already running there and raised the "another client is active in this folder" banner. The conversation you were handed was often the one you were already reading (any second tab, or your own socket that dropped silently and has not been reaped yet, counts as another viewer), and "Continue anyway" could only unlock that old conversation, never give you the new one you asked for.
297
+
298
+ `session_new` now always creates a new session (`SessionPool.createNewSession(..., forceNew)` bypasses the reuse-an-occupied-folder shortcut). When the folder really is shared, the folder-conflict banner is raised on the NEW conversation, which starts read-only until "Continue anyway" - so the warning stays, but it now sits on the conversation you asked for. `POST /session/new` keeps its old reuse behaviour.
299
+
300
+ Also stops a second viewer of the SAME conversation being counted as a folder conflict, which could pin the banner (and its read-only) on with nothing left to resolve it.
301
+
302
+ ## 0.11.1
303
+
304
+ ### Patch Changes
305
+
306
+ - 01b0601: Allow attaching files to the first message of a web search. The search composer (shown when no session is open) now has the 📎 button: picked files are held in the browser, uploaded as soon as the search creates its session, and referenced from the query as `[Uploaded file: ...]` lines. A search with files but no text is valid, upload failures still send the query and surface as a session error, and files are dropped if the composer leaves search mode. The uploaded-file message shape is now a shared, unit-tested helper (`web/src/lib/core/attachments.ts`) used by both the chat and search paths.
307
+ - a42ea5c: fix(web): wrap long tokens in still-streaming (plain-text) messages
308
+
309
+ An assistant message that is still streaming is deliberately rendered as plain text (markdown is only parsed once the message is final, so the DOM stays stable and a selection survives), but that plain-text block had no `overflow-wrap`, unlike the finalized `.markdown-body` view. A single unbreakable token (a long file path, a URL) therefore pushed the rest of its line past the bubble and off-screen on a narrow viewport, so an in-progress reply looked like it was missing words until it finalized and re-rendered wrapped. The streaming block now uses `wrap-anywhere`, matching the finalized rendering; the same guard was added to the user/thinking plain-text bubbles and to skill-invocation args.
310
+
311
+ ## 0.11.0
312
+
313
+ ### Minor Changes
314
+
315
+ - 53f438b: Conversation search: find anything ever said in any session, and jump into it.
316
+ - **Server**: new `GET /search?q=<FTS5>&view=default|readonly&limit=` (same token gate as the other API routes), backed by the [memonaut](https://github.com/wighawag/memonaut) index (`~/.local/share/memonaut/index.db`). Opened strictly read-only; wherever never writes to it. Results carry the absolute transcript path normalized exactly like `/sessions`, so a hit is directly clickable into the existing session view, and every fork carrying a match in shared history is returned (most recently active first, with per-thread `+N after` counts) instead of being collapsed to one.
317
+ - **Never blocks the event loop**: the endpoint never builds or syncs the index in-process (memonaut's indexer is synchronous, ~40 s on a real corpus, which would freeze every WebSocket client). A missing index answers `status: "not-indexed"` telling you to run `recall index`; incremental catch-up is delegated to a TTL-gated child process, fired after the response and never awaited (`conversationSearch.autoSync` / `conversationSearch.syncIntervalMs` in `~/.wherever/config.json`).
318
+ - **Privacy**: the two axes compose in one place. memonaut's `private` transcripts are never returned, and wherever's `sessions.ignore` sessions are dropped from search on every view, so search can never surface what the dashboard hides; `sessions.readOnly` folders mirror `/sessions` and stay on the read-only view.
319
+ - **Web**: a "Search conversations" panel in the sidebar (and from the read-only page), with highlighted snippets, fork-aware result grouping and click-through to the session. The existing session-list filter box is unchanged, plus a "Search all conversations for …" hand-off.
320
+
321
+ ### Patch Changes
322
+
323
+ - c478478: Order sidebar fork groups by their most recent activity across forks.
324
+
325
+ Session groups were ordered by the top-most parent's own `modified` time, so a session forked long ago and worked on all day stayed buried under its stale root, making the active fork hard to find. Each fork group (a root plus its descendants) is now ranked by the newest `modified` in its whole subtree, and siblings are ranked the same way, so an active branch floats its group to the top while the parent/child tree shape is preserved. Ties fall back to the session's own `modified` then its path for a deterministic order.
326
+
327
+ The tree builder moved out of `SessionBrowser.svelte` into `web/src/lib/core/fork-tree.ts` with unit tests.
328
+
329
+ - 63626f9: Stop loading whole session transcripts into memory: startup RSS on a 2 GB sessions directory drops from ~990 MB peak / 426 MB settled to 208 MB, and opening a large session no longer ratchets memory (or blocks the event loop).
330
+
331
+ The server read session `.jsonl` files by materializing them. The `/sessions` listing scan did `readFile(utf8)` + `split('\n')` + `JSON.parse` per line into a retained array, per file, and it runs at startup to warm the cache; every history read (`session_load`, `history_page`, `cli_register`) went through pi's `SessionManager.open()` (which loads and parses the whole file twice) and then mapped EVERY entry into a `HistoryMessage[]`, base64 tool images included, only to slice the last 60 off the end. On a real corpus (3,831 files / 2.0 GB, single transcripts up to 62 MB) that is hundreds of MB of transient objects per pass, and V8 never gives the heap high-water mark back, so the process grew until systemd-oomd killed it.
332
+
333
+ All of it now goes through a new streaming reader (`server/src/session-transcript.ts`) that finds newlines in the bytes, classifies each line from a bounded 512-byte head, and only ever materializes what the caller asked for. Tool results (most of a transcript's bytes) are counted and discarded without becoming strings. History is read as two bounded passes: one counts (and supplies the header, the current model and the total), the second stops as soon as the requested window is full, so paging back through a long session costs the same as reading its tail. `registerCliSession` reads the 8 KB header instead of the whole file for a session id. A file that cannot be read is skipped with a log line instead of failing the whole listing.
334
+
335
+ Measured on the same 2.0 GB corpus, built server, identical methodology:
336
+ - startup: peak RSS 990 MB -> 208 MB, settled 426 MB -> 208 MB (an empty sessions dir is 164 MB, so the corpus costs ~44 MB instead of ~260 MB)
337
+ - opening the largest session (59 MB, 1,780 messages): 401 ms of blocked event loop and ~130 MB RSS growth per open -> 71 ms, non-blocking; 150 consecutive opens plateau at ~340 MB with live heap flat at 39 MB (40 opens on the old path alone reached 825 MB)
338
+
339
+ Also in this change:
340
+ - New optional listing retention, both off by default and applied from the file's `stat` before any body is read: `sessions.maxAgeDays` and `sessions.maxSessions` in `~/.wherever/config.json`. Nothing is deleted and excluded sessions still open by path or short ID; they just are not listed. The server prints a one-line hint at startup when it lists more than 1,000 sessions with neither set.
341
+ - `wherever install` now bakes `MemoryHigh=1G` / `MemoryMax=1500M` into the systemd unit, so a memory problem can only take down (and auto-restart) that unit instead of pushing the whole machine into swap thrash. Tune with `--memory-high` / `--memory-max`, or drop them with `--no-memory-limits`; install prints how to verify systemd actually applied them (it silently ignores them without memory-controller delegation). launchd has no equivalent, so this is Linux-only.
342
+ - Fixed a race the streaming reads exposed: "Continue anyway" clicked immediately after a cold `session_load` was dropped when it landed before the load had recorded its cwd, leaving the client read-only with the banner's button already gone. The intent is now recorded regardless and re-evaluated at attach (the `sessions.readOnly` guard still applies).
343
+ - An unanswered `!sudo` password prompt (client vanished mid-prompt) is no longer retained forever: it is dropped when its session is evicted, and any entry past a 30-minute TTL is swept when the next prompt is armed.
344
+
345
+ ## 0.10.15
346
+
347
+ ### Patch Changes
348
+
349
+ - 2f4e67c: Fix "New Session Here" sometimes redirecting to the folder's already-active session as read-only, with no way to continue. Two separate bugs.
350
+
351
+ **1. A reconnect was counted as a second viewer.** A client whose socket dropped silently (phone sleep, wifi/cellular switch, any half-open TCP) reconnects on a new socket with a fresh server-side client id, while its previous record stays attached to the session until the heartbeat reaper notices, up to a minute later. During that window `session_new` saw "another viewer holds this folder" and, by design for real conflicts, attached the client read-only to the existing session instead of creating a new one. Connections now carry an optional stable `clientKey` (`/ws?token=...&clientKey=...`); on connect the server retires any still-registered viewer with the same key, detaching it from its session before any further traffic is handled. The web client derives one key per browser TAB from `sessionStorage`, so two real tabs still count as two viewers and genuine folder conflicts behave as before. CLI bridges are untouched (their own registration path handles takeover). Because duplicating a tab clones `sessionStorage`, two live tabs can end up sharing a key: the server now tells the retired connection (`connection_superseded`, flushed before the socket is destroyed) and the client takes a fresh key before reconnecting, so they converge instead of evicting each other. The VS Code webview carries a key of its own too.
352
+
353
+ **2. The folder-conflict banner destroyed its own "Continue anyway" button.** Attaching as a read-only observer puts the client on the occupant's session FILE, but the live `folder_conflict` broadcast scanned for another session file in the folder while skipping the client's own, so it immediately reported `active: false`. The client dropped the banner, taking the only escape hatch with it, and stayed read-only with nothing left to lift it. A conflict is now tracked per client, so the update keeps reporting `active` while the occupant is there, and it carries the server's authoritative `readOnly`, which also releases the composer automatically once the conflict resolves. The generic read-only banner is suppressed while the DISMISSIBLE conflict banner is up, since that one explains the cause and carries the action; a read-only that survives a continue (a hard `sessions.readOnly` folder) still explains itself.
354
+
355
+ **3. "Continue anyway" could be silently lost.** Clicking it during a cold session load, i.e. after the conversation is painted but before the agent finishes building and the client is attached, resolved no session, so the click was dropped; and the build's completion path then re-imposed the read-only it had computed before the click. Either way the composer looked enabled while the server dropped every send with no error. The continue is now recorded as a durable intent, honoured at attach whatever the ordering, answered with an authoritative `folder_conflict` on the same socket (which also settles a broadcast that was already in flight), and restated explicitly once the cold build attaches.
356
+
357
+ **4. Read-only sends are refused out loud.** A message rejected because the session is read-only was dropped with no reply at all, so any desync between the client's belief and the server's authority showed up as text vanishing. It now answers with a `session_error`, which the client surfaces as a recoverable, retryable failure.
358
+
359
+ ## 0.10.14
360
+
361
+ ### Patch Changes
362
+
363
+ - c1c26f4: Security hardening: command injection, eruda DOM-XSS, and path-scoping fixes.
364
+ - **Command injection in remote-repo provisioning (critical):** all `gh`/`tea`/`cb`/`git` calls in the session pool now use `execFileSync` with argument arrays instead of `execSync` with interpolated shell strings. A client-supplied folder basename could previously break out of a quoted shell argument (e.g. `x";touch /tmp/pwned;"`) and run commands as the server user when `remoteRepoRules` was configured. The `tea`/`cb` `… | grep` pipelines were rewritten to read CLI output and match in JS. The `openssl` self-signed-cert generation was converted too.
365
+ - **Unauthenticated route:** `/check-remote-repo` (the only reach that fired the injection without a token) is now behind the auth gate.
366
+ - **eruda DOM-XSS (high):** the dashboard's eruda custom-plugin loader took `?eruda=<pkg>` and wrote it unescaped into a `<script src>`, letting a crafted link inject attacker JS that could read the auth token from `localStorage`. Plugin loading is now gated behind a `<meta name="wherever-eruda-plugins">` flag that is `false` in the built shell and only flipped to `true` when the server runs with `--debug` (or `PI_DEBUG`/`WHEREVER_DEBUG`). Core eruda still loads for phone debugging.
367
+ - **`/session/delete`:** now scoped to `.jsonl` files inside the server's sessions directory, so an authenticated caller can no longer `unlink` arbitrary `.jsonl` files anywhere on disk.
368
+ - **`/check-path` and `/autocomplete-path`:** now scoped to the home directory, so they can no longer be used to enumerate arbitrary paths on the server.
369
+ - Added a `--debug` server flag (and `PI_DEBUG`/`WHEREVER_DEBUG` env vars) that enables eruda custom-plugin loading in the served dashboard for local debugging.
370
+
371
+ ## 0.10.13
372
+
373
+ ### Patch Changes
374
+
375
+ - 84c89c1: Fix the shrunken Android home-screen PWA icon and remove the fragile PWA post-process.
376
+
377
+ The installed app icon had been shrinking over time to a tiny logo on a white
378
+ circle because the deployed build shipped pwag's raw manifest (no maskable
379
+ icon): the hand-rolled `pwa-postprocess.mjs` failed silently when ImageMagick
380
+ was missing on the build machine, and `prepare`'s `|| echo ''` swallowed the
381
+ error.
382
+ - Use pwag 0.6.0 native maskable icon generation (`maskable: true`): padded,
383
+ fully-opaque maskable icons at 192/512 with `purpose: "maskable"`, plus
384
+ explicit `purpose: "any"` on the regular icons — generated via `sharp`, with no
385
+ ImageMagick dependency.
386
+ - Use pwag 0.6.0 native `screenshots` support: sources under `pwa-assets/` are
387
+ copied into `static/pwa/` and emitted in the manifest with auto-detected
388
+ sizes/type.
389
+ - Delete `web/scripts/pwa-postprocess.mjs`; `generate-pwa-icons-and-tags` is now
390
+ a single `pwag static/logo.svg src/web-config.json` invocation.
391
+ - `prepare` no longer swallows failures, so a broken PWA build fails loudly
392
+ instead of shipping a raw manifest.
393
+
394
+ ## 0.10.12
395
+
396
+ ### Patch Changes
397
+
398
+ - 6c3ea26: Conversation Mode is now per CONVERSATION, and the hands-free mic re-opens on both speech engines.
399
+
400
+ **Per-conversation mode.** The 💬/🗣️ toggle above the composer used to flip one global flag, so turning conversation mode on while talking to one session turned it on everywhere, and every other session started stamping "a spoken conversation is active" on its messages too. A spoken back-and-forth is a property of the conversation you are having, not of the app. The toggle now sets the conversation you are in and leaves the others alone, exactly like the waiting-for-human beep's per-session control: the setting in Connection Settings became the DEFAULT for conversations you have not toggled, a conversation with no choice of its own follows that default live, and one you have toggled keeps its own choice. With no conversation open the toggle edits the default, since there is nothing else it could mean. The individual knobs (speak replies, collapse long replies, hands-free mic re-open) stay global: they describe how a spoken conversation behaves, while only whether THIS conversation is spoken is per conversation.
401
+
402
+ **Hands-free on the cloud engine.** "Re-open mic after the agent speaks" only ever auto-recorded on the browser speech engine; on the Cloud AI engine it just re-focused the composer, so a phone user (the most likely to be on that engine) still tapped the mic every single turn, which is the tap the knob exists to remove. The confirmation belongs in the config the user already set, not in a per-conversation gesture, so the mic now re-opens on both engines. What the cloud engine actually lacked is a stop condition, since it records until told to stop: an auto-opened recording now ends itself after about two seconds of silence once you have spoken, gives up after six if nobody speaks at all, and can never run past a one-minute ceiling. Recordings you start by tapping are untouched: your next tap is still the stop.
403
+
404
+ - 6c3ea26: Make conversation mode actually speak, instead of only when the user asks it to.
405
+
406
+ The per-turn conversation-mode signal (telling the agent a spoken conversation is active) was reaching the model, but only as one line appended to a long system prompt, and that turned out to be a coin flip. Measured against the local 35B a reported session ran on, with a realistic system prompt: with the hint 3/6 turns called `say`, without it 1/6, and at the moment that matters most, the synthesis call right after a tool result, the hint was ignored almost every time. Two things defeat it: the line sits far from the tail, and once the transcript contains earlier assistant turns that did not speak, the model imitates its own history. The result was the reported symptom, an agent that stayed silent unless nagged every turn.
407
+
408
+ Three changes, from the model outwards:
409
+ - **The signal now also rides the TAIL of every LLM call.** On top of the system-prompt line, a short reminder is added via pi's `context` event, which fires before EVERY provider call of the turn (including the post-tool-result one) rather than once per user prompt. It is ephemeral by construction: the SDK applies the handler to a clone on the way to the provider, so nothing reaches the session file, the web transcript or the CLI TUI. Placement is role-safe (it rides inside a clone of a `user`/`toolResult` tail rather than opening a second consecutive user turn, which Anthropic merges but Bedrock and some proxies reject), and it stops the moment the agent has actually called `say` in that turn, so it can neither nag nor drive a `say` loop.
410
+ - **Spoken replies no longer depend on the model complying at all.** When a turn settles with spoken replies active and no `say` was spoken, the web app now speaks a short plain-text lead-in of the written reply (code fences, links, bare URLs and markdown markers stripped, cut to whole sentences). The agent's own `say` line always wins when there is one, and the written transcript is never modified.
411
+ - **Mobile priming no longer depends on tapping one specific control.** Browsers gate the first `speechSynthesis.speak()` of a page behind a user gesture, and the existing priming points (the Conversation Mode toggle, the mic button, settings-save) all assume the user touches one of them in that page load. A returning user whose conversation mode is already persisted ON touches none, so on a phone every reply was dropped while desktop spoke fine. Priming now also happens from the user's first gesture of any kind, the priming utterance is silent but no longer blank (mobile Chrome discards a blank one without consuming the activation it was issued under), and a configured speech locale the engine has no voice for is dropped rather than set, since that is another known way to get silence on mobile.
412
+
413
+ ## 0.10.11
414
+
415
+ ### Patch Changes
416
+
417
+ - 823b39a: Show the server version next to the web app build id. The connection panel already displayed the frontend build (the short git commit baked in at build time), but there was no way to tell which server version that frontend was actually talking to, which made it easy to debug a stale server as if it were a frontend bug.
418
+
419
+ The server now reports its package version in the `connected` WebSocket message, the client keeps it in state as `serverVersion` (null until connected, or when the server is old enough not to report it), and the connection panel renders it as `v<build> / srv <version>` with both spelled out in the tooltip.
420
+
421
+ ## 0.10.10
422
+
423
+ ### Patch Changes
424
+
425
+ - 5a3e325: Show messages that are still queued as mid-stream steers after a reload. A message sent while the agent is streaming is queued by pi and injected at the next step, but until then it lives only in the agent's memory: it is not in the session file, so a reloaded client painted history with no trace of it. The text simply disappeared from the UI while the agent still had it and went on to act on it.
426
+
427
+ Attaching to a session (`session_load`, which also serves reload and reconnect resync) now replies with a `queue_update` snapshot of the current steer queue, and the client re-materializes any queued message its history does not contain, so it renders with the "Queued (not yet sent to the agent)" badge and stays cancellable. When the queued message is finally injected, the server's echo reconciles onto that bubble instead of appending a duplicate.
428
+
429
+ - c7b9999: Fix a session opened from a URL hash deep link (`https://host/#<sessionId>`) hanging forever on "Loading session...", while the same session opened instantly from the sidebar.
430
+
431
+ The sidebar joins a session by FILE path, but the URL hash carries the session ID. `session_load` accepts either (the server resolves an ID to its file) yet always replies with the resolved file path. The client's superseded-load guard matched a `session_created` reply against the pending load target by file path only, so an ID-issued load never recognised its own reply: it was dropped as a stale/superseded load, no session ever became active, and the hash-driven spinner never cleared. The pending load target now matches its reply by session file OR session ID, while still rejecting late replies for genuinely abandoned loads.
432
+
433
+ ## 0.10.9
434
+
435
+ ### Patch Changes
436
+
437
+ - d831cdf: Fix session loading getting stuck while the console fills with `/sessions` requests.
438
+
439
+ `GET /sessions` rebuilt the whole session list from scratch on every request: a synchronous `readFileSync` + per-line `JSON.parse` of EVERY session `.jsonl` on disk. On a real sessions directory (~2,800 files / 1.1 GB / 341k JSON lines) that is ~6.9s of work on the single Node thread, so the WebSocket could not deliver `session_created` / `message_history` for the session being opened. The list was also refetched constantly, because the server broadcast `sessions_updated` on every `message_end` (per message, many per turn) and every client answered each broadcast with a full-list fetch. Together: a flood of multi-second requests, an event loop pinned by them, and a "Loading session..." spinner that could hang past the client's 12s load watchdog.
440
+ - **Cached, incremental scan** (`scanDiskSessions`): each file's parsed listing info is cached against its `(mtime, size)` stamp, so a repeat scan only re-reads what actually changed; the folder cwd probe is cached per directory; entries for deleted sessions are evicted. Cold pass ~6.9s, warm pass ~90ms.
441
+ - **Non-blocking**: the scan is fully async and yields to the event loop between parses (worst measured event-loop lag during a cold pass: 29ms, vs the whole ~7s previously). Concurrent requests for the same view share one pass, and the cache is warmed in the background at startup.
442
+ - **Fewer broadcasts**: `sessions_updated` now fires on `agent_end` only (not `message_end`) and is leading+trailing throttled at 2s, so structural changes stay instant but bursts collapse into one broadcast. Deleting a whole folder no longer triggers one full-list refetch per deleted session.
443
+ - **No stranded promise**: `fetchSessions()` queued a resolver on the in-flight path that nothing would ever settle, so `await fetchSessions()` during an in-flight fetch could hang forever.
444
+ - **Quieter logs**: the per-request `/sessions` log line now only appears when a pass did real parsing work.
445
+ - **Lower memory**: the capped first-message preview is flattened, so caching it cannot pin the full (often huge) first message via a V8 sliced string (~33 MB retained -> ~3 MB).
446
+ - **Test isolation**: `WHEREVER_CONFIG_DIR` overrides the config directory, and the harness sets it, so an isolated test server no longer reads the developer's real `~/.wherever/config.json` (whose `sessions.ignore` could hide the harness's own sessions).
447
+
448
+ Also resolves a session by short ID/name through the same cached scan instead of `SessionManager.listAll()`, which re-read every session file just to resolve one deep link.
449
+
450
+ - de08e13: Fix `/skill:` composer autocomplete being empty on a freshly created session. The client only asked the server for the session's skill commands (`skills_request`) when it received `session_ready`, but `session_ready` is only sent by the session-LOAD path (it signals "the cold agent finished building"). A brand-new session created via `session_new` is live the moment `session_created` arrives and never emits `session_ready`, so the request was never sent and `state.skills` stayed `[]`: typing `/` in a fresh session showed no menu, while the same session offered the full list after a reload.
451
+
452
+ The client now sends `skills_request` as soon as the agent is known to be live: on `session_created` when `pending !== true` (fresh create, and warm attach), and still on `session_ready` for a cold load that was `pending`. Re-requesting is harmless since the server always replies with the full list, and the per-session reset of `skills` on attach is unchanged, so switching sessions cannot leak another session's commands. Covered by `client/test/skills-autocomplete.test.ts`.
453
+
454
+ ## 0.10.8
455
+
456
+ ### Patch Changes
457
+
458
+ - fcd3d23: Make conversation mode's spoken reply actually happen: the agent is now TOLD, per turn, that a spoken conversation is active, so it adds a short `say` reply to its written answer instead of staying silent. "Conversation mode is on" only ever lived in the web client, and a dictated message is byte-identical to a typed one, so the agent had no signal and (following the `say` tool's own guidance) defaulted to not speaking, which made the feature inert unless the user nagged it every turn.
459
+
460
+ The signal is an OPTIONAL `conversationMode` boolean FIELD on the EXISTING `message` WebSocket payload (no new message type, no new chat role; an absent field means false, so older clients keep working). The web app stamps it, on both the send and the resend path, only when the master `conversationMode` AND `speakReplies` knobs are both active. For a turn whose message carried the flag, a `before_agent_start` hook APPENDS one line to the assembled system prompt asking for a short spoken `say` reply in addition to the written answer; the hint is per-turn (the mode can flip mid-session) and ephemeral (it is a system-prompt addition, so the user's message is preserved verbatim, nothing extra renders on web or CLI, and only the resulting `say` call is visible). It is wired for BOTH session types, mirroring the `say` tool's dual registration: an inline pi extension on the server's own agent sessions, and a `pi.on("before_agent_start", ...)` handler in the `@wherever-dev/pi` extension fed by the flag relayed on `cli_message`, so a bridged terminal session driven from a phone speaks too. With conversation mode (or speak-replies) off, no flag is sent, nothing is injected, and behaviour is exactly as before.
461
+
462
+ The `say` tool description/guidelines (server and extension, in lockstep) no longer tell the agent to stay silent when "the user is typing", which was the instruction fighting the feature; `say` is now framed as an additive short spoken layer for an active spoken conversation.
463
+
464
+ - c6ed2bb: Stop the agent from speaking when conversation mode is OFF: the `say` tool's own text no longer invites it to decide for itself whether a spoken conversation is active. Since the per-turn conversation-mode signal (ADR 0004) became the authoritative "a spoken conversation is active, add a `say` reply" instruction, the tool description's standing "while a spoken conversation is active" condition was a second, unreliable trigger: the agent could infer "active" from a chatty exchange or dictated-sounding text and call `say` with the mode off.
465
+
466
+ The description, `promptSnippet` and `promptGuidelines` now split the concerns cleanly: the tool text owns HOW (an additive one-or-two-sentence plain-spoken reply on top of, never instead of, the written answer, no code/markdown/lists), while the injected per-turn hint owns WHETHER. `say` is to be called ONLY when the instructions for THIS turn explicitly state that a spoken conversation is active, that instruction is the only signal there is, and absent it `say` is never called. Both copies (`server/src/say-tool.ts` and the `@wherever-dev/pi` extension's `registerTool` block) are updated identically, and `server/test/say-tool.test.ts` now parses the extension source so the twins cannot drift.
467
+
468
+ This is guidance, not a hard gate (the tool is still registered when the mode is off); behaviour with the mode ON is unchanged.
469
+
470
+ - 657cc76: Prime browser TTS when spoken replies are enabled from Connection Settings, closing a mobile gap in the conversation-mode gesture-unlock. Enabling conversation mode + speak-replies via the settings checkboxes is a real user gesture, so `unlockTts()` is now called from that save handler too. Without it, a mobile Chrome / iOS / PWA user who turned spoken replies on from settings and then only typed (never tapping the master toggle or the mic) would have their first `say` reply silently dropped by the browser's user-activation gate. The call is idempotent and only primes when spoken replies are actually intended.
471
+
472
+ ## 0.10.7
473
+
474
+ ### Patch Changes
475
+
476
+ - 012a260: Fix the conversation-mode spoken reply never being heard on mobile Chrome, iOS Safari and installed PWAs. Those browsers only allow the first `speechSynthesis.speak()` of a page from inside a user gesture, and the `say` reply speaks from a WebSocket-driven effect, so mobile silently dropped every utterance (desktop has no such gate, which is why it looked fine there). Speech synthesis is now primed once, silently, from a real tap: the Conversation Mode toggle, and the mic button (which also covers a returning user whose conversation mode was already persisted on). A real `say` reply additionally issues a defensive `resume()` kick, since mobile Chrome can leave the utterance queue paused. The priming utterance is kept off the TTS-settle signal, so `isTtsSpeaking()` / `whenTtsIdle()` still report only real spoken replies and the hands-free mic-reopen loop is unchanged.
477
+ - c1bd6c6: Fix a slow-loading session suddenly replacing the one you switched to. While a session was still loading, tapping a different session in the sidebar could let the old session's late reply clobber the one you were now looking at. The client now stamps every `session_load` with its target file and rejects a stale `session_created` / `message_history` for a session it already switched away from (the latest tap wins), so a superseded load can no longer take over the active view or strand the loading spinner.
478
+
479
+ ## 0.10.6
480
+
481
+ ### Patch Changes
482
+
483
+ - fa115a6: Add per-message actions to assistant replies in the web dashboard: a Copy button that copies the message's raw markdown to the clipboard (with a brief "Copied" confirmation and a clipboard fallback for insecure contexts), and a Raw/Rendered toggle that switches an individual message between its rendered markdown and its verbatim markdown source (shown in a monospace block). Both actions are keyed per message id so each toggles independently, and they live in a subtle action bar that reveals on hover/focus so the transcript stays uncluttered. Display-only: the underlying message content is never modified.
484
+
485
+ ## 0.10.5
486
+
487
+ ### Patch Changes
488
+
489
+ - 451c042: Add the `collapseLongReplies` conversation-mode behaviour to the web dashboard: when conversation mode + the `collapseLongReplies` knob are on, a LONG written assistant reply is de-emphasised (clamped behind a fade) so the short spoken `say` summary is the focus and the transcript stays glanceable. This is a display concern only — the full written reply is NEVER deleted, hidden, or destructively truncated; it always stays fully expandable via a "Show full reply" affordance (reusing the same expand/collapse idiom the chat message list already uses for tool cards) and re-collapsible once opened. Being a gated conversation knob, it only takes effect when the master `conversationMode` toggle is also on; with the knob off (or conversation mode off) replies render exactly as today, no collapse. The underlying transcript/message content is untouched. The pure decision logic (whether a given reply renders collapsed, and the long-reply char threshold) lives in a new `core/collapse-reply.ts` module — mirroring the `core/speak.ts` seam pattern for the `say` card — with unit tests at that seam.
490
+ - 6ec9b03: Add a conversation-mode knobs registry to the web dashboard: a named preset of independent boolean knobs (`conversationMode`, `autoSendOnSpeechEnd`, `speakReplies`, `collapseLongReplies`, `micReopensAfterReply`) persisted in the existing config, with a prominent "Conversation Mode" master toggle that flips the configured bundle on at once and gates the purely-conversation knobs. Each knob has exactly one canonical localStorage home: the purely-conversation knobs + the master toggle live in the single `wherever-config` entry (mirroring the `beepDefault` persisted-flag pattern), while `autoSendOnSpeechEnd` IS the existing `directSend` flag surfaced as a knob and reuses the `wherever-speech-direct-send` key (no forked second flag), so the two stay the same underlying value. When the master is off the purely-conversation knobs are dormant (default typing-first experience unchanged), but a standalone-set `directSend`/`autoSendOnSpeechEnd` still auto-sends. This task is the registry + toggle + persistence + gating only; the behaviours the knobs drive (TTS, the `say` card, collapse-long-replies, hands-free mic re-open) are consumed by separate tasks that read these knobs.
491
+ - df01c28: Add the hands-free `micReopensAfterReply` loop to the web dashboard: when conversation mode + the `micReopensAfterReply` knob are on, the agent settling (the same `isStreaming` true→false edge the waiting-for-human beep uses) now re-opens the mic so the user can keep talking without tapping. Per the resolved engine-scope decision (Open Question 3), auto mic-reopen is BROWSER-engine only (streaming speech recognition restarts cleanly); on the CLOUD engine (explicit hold-to-talk / tap-to-toggle) it FALLS BACK to just re-focusing the composer, no auto-record (which would have no natural gesture and surprise the user). Before re-opening, it waits for any in-flight `say` TTS to finish so the spoken reply is not captured as microphone input. With the knob off (or conversation mode off) nothing re-opens or auto-focuses; the typing-first default is unchanged.
492
+
493
+ To coordinate this, `core/speak.ts` gains a minimal TTS-settle signal (`isTtsSpeaking()` / `whenTtsIdle()`, plus `resetTtsSettleSignal()`) that tracks outstanding utterances via `utterance.onend`/`onerror` — the shipped `speakUtterance` was fire-and-forget with no TTS-done signal — and reports idle immediately when no utterance was ever fired (speakReplies off) so the re-open is never blocked. `SpeechButton.svelte` gains a minimal public surface for the browser-engine auto-reopen: a bindable `activeEngine` and an exported `startRecordingProgrammatically()`. The pure engine-scope decision lives in a new `core/hands-free.ts` module (mirroring `core/collapse-reply.ts` / `core/compose-send.ts`) with unit tests at that seam; the settle-edge driver that consumes it lives in `ChatInput.svelte`, which already owns the composer focus and subscribes to the settle edge.
494
+
495
+ - ccf60d6: Add a self-contained `say` tool so the agent can emit a SHORT spoken-form reply (in addition to its written answer) that the web UI will later speak aloud and surface while a spoken conversation is active. Mirroring `attach_file`, it validates its `text` argument (error on blank) and returns a normal tool result carrying the text in `details` — no file reads, no bridge, no side channel. It is dual-registered: as a `customTool` on the server session pool's server-created sessions and via `pi.registerTool` in the `@wherever-dev/pi` extension, so behaviour is uniform across session types. The affordance rides the existing `tool_start`/`tool_end` stream — no new WS message type and no new chat role.
496
+ - c8557f3: Surface the `say` tool call in the web dashboard as a first-class 🔊 "spoken:" card and speak its payload via the browser `SpeechSynthesis` API. Driven entirely by the existing `tool_start`/`tool_end` stream (no new WS message type, no new chat role): a `say` call now renders a distinct "spoken:" card — mirroring the `attach_file` first-class treatment and exempt from the `hideTools` collapse — while the full written reply always remains present in the transcript (the card is additive, never a replacement). When the `speakReplies` conversation-mode knob is active (which, being a gated knob, also requires the master `conversationMode` toggle on), a completed `say` call fires exactly one `SpeechSynthesisUtterance` carrying the text, using the configured speech locale (`wherever-speech-locale`) for the utterance `lang`; each say message is spoken at most once. TTS is feature-detected to a graceful no-op when the browser has no `speechSynthesis`, and with `speakReplies` off no utterance fires. The short spoken text comes only from the agent's explicit `say` call — never a client-side summary of the full reply. The extraction + utterance logic lives in a new `core/speak.ts` module (mirroring the `core/beep.ts` feature-detected pattern) with unit tests at that seam.
497
+
498
+ ## 0.10.4
499
+
500
+ ### Patch Changes
501
+
502
+ - fe17675: Relicense the project from MIT to AGPL-3.0-only. The root `LICENSE` file now contains the verbatim GNU Affero General Public License v3.0 text. Documentation (`README.md`, `CONTEXT.md`) and the marketing site footer now reference AGPL-3.0, and the published packages (`wherever-dev`, `@wherever-dev/client`, and the extension `@wherever-dev/pi`) declare `"license": "AGPL-3.0-only"`.
503
+
504
+ ## 0.10.3
505
+
506
+ ### Patch Changes
507
+
508
+ - 3c035f6: Fix a `/skill:<name>` invocation showing up as TWO messages: the raw optimistic echo (which then flipped to "Not delivered / Retry" and persisted across reloads) plus the transformed skill chip. The client optimistically echoes the raw `/skill:...` invocation, but the server confirms it with a raw `message_ack` and later echoes back the expanded `<skill>` block, so exact-content delivery matching missed and appended a duplicate. Delivery confirmation now matches the raw optimistic bubble to the expanded server echo by skill-invocation identity (name + args) and rewrites it in place, so there is a single confirmed skill chip. Adds shared `parseSkillInvocation` / `skillInvocationIdentity` helpers to `@wherever-dev/client` (now used by the web instead of a local copy).
509
+
510
+ ## 0.10.2
511
+
512
+ ### Patch Changes
513
+
514
+ - 3760975: Display `/skill:<name>` invocations as a compact skill chip instead of the expanded skill body. Skill commands are still expanded server-side so the agent receives the full skill content, but the web now recognizes the expanded `<skill>` block (in both live echoes and reloaded history) and renders a distinct skill-invocation bubble showing the skill name plus any argument text the user typed after `/skill:<name>`.
515
+
516
+ ## 0.10.1
517
+
518
+ ### Patch Changes
519
+
520
+ - 1400666: Correct the PATH/environment caveat's account of the intermittency. Evidence from the richelieu drive sessions (~/.pi/agent/sessions) shows the git ENOENT toggled between consecutive tasks inside a SINGLE wherever process with the same, constantly-broken PATH. That toggling is not the systemd start-time race: the frozen process.env.PATH was constantly missing /usr/bin, and whether a given git spawn failed depended on which downstream code path (in dorfl) built the child env for that spawn. The docs now split the two layers explicitly: systemd/user-service setup explains why the PATH was incomplete at all (intermittent across service restarts), while a spawned tool's per-call-site env construction explains why the visible failure came and went within one process.
521
+ - 417dad7: Document the systemd user-service PATH/environment caveat in the README, and record the root-cause investigation under docs/. The root cause is the service environment wiring, not application logic: a Linux user service does not source the login shell and snapshots the systemd user-manager environment once at start; if that PATH was imported in stages and was still incomplete (e.g. missing `/usr/bin`) when the service started, every tool it shells out to (git, ssh, coreutils) can fail with an intermittent, start-time-ordering-dependent ENOENT. The README note explains how to get the full user PATH (volta/pixi/etc) into the service via `systemctl --user import-environment PATH` + restart (the recommended way to carry your session PATH), or by pinning `Environment=PATH=` / `environment.d` for deterministic/headless setups, and gives diagnostic commands to inspect the running service's frozen PATH. Docs only; no code or unit change.
522
+ - 5d05397: Make the per-message "Fork" button clearly visible with a proper hover state.
523
+
524
+ The Fork action lived inside the message footer, which is rendered at 50% opacity; a parent opacity caps its children, so the button looked greyed out and its `hover:opacity-100` had almost no effect. It now renders as its own fully-opaque bordered chip below the timestamp, with a distinct blue hover (border, tint, and text), so it is easy to see and clearly interactive.
525
+
526
+ - 75f378d: Retract the incorrect "dorfl builds its child env differently per call site" explanation of the git ENOENT intermittency. Checked against the dorfl source (the commit that failed): dorfl does NOT edit PATH anywhere; run/runAsync spawn with `env: options.env ?? process.env` and identityEnv builds `{...base}`, faithfully propagating whatever PATH it inherited. The richelieu drive-session run markers show the failure was uniform within the process (every first-attempt hit ENOENT, including memory-pillar), and the `merged` results came from re-runs after a `~/.local/bin/git -> /usr/bin/git` workaround. So there is one cause (wherever handed dorfl a PATH without /usr/bin, dorfl passed it straight to git) and the only real intermittency is across service restarts (the systemd snapshot layer). Docs corrected accordingly; no code change.
527
+ - b3d3af3: Make `/skill:<name>` work in browser (server-created) sessions, and add composer autocomplete for skill commands.
528
+
529
+ Previously, `/skill:<name>` only worked when a session was bridged to an external pi CLI process, because the CLI expanded it on its side. For sessions the wherever server runs in-process (the browser path), messages were sent via `AgentSession.sendUserMessage()`, which calls `prompt()` with `expandPromptTemplates: false`, so `/skill:foo` was forwarded to the model verbatim instead of inlining the skill body. Server sessions now route any `/`-prefixed message through `prompt({ expandPromptTemplates: true, source: 'interactive' })`, matching the pi CLI exactly: all expansions (skills, prompt templates, extension commands) are start-of-message anchored, and any trailing text after `/skill:<name> ` is preserved and appended after the skill block. Plain (non-slash) text keeps the existing `sendUserMessage()` path.
530
+
531
+ Also adds a `/skill:` autocomplete dropdown in the composer. Skills discovered for the active session (including `~/.agents/skills`) are surfaced to the web client via a new `skills_request`/`skills_list` protocol pair (requested on `session_ready`). Typing `/setu` fuzzily matches and offers `/skill:setup`; ArrowUp/Down navigate, and the first Enter/Tab ACCEPTS the highlighted command (inserting `/skill:<name> ` with a trailing space) without sending, so a second Enter is needed to submit. This mirrors the CLI's accept-then-send behaviour and lets the user type an argument after selecting a skill.
532
+
533
+ ## 0.10.0
534
+
535
+ ### Minor Changes
536
+
537
+ - af0fd7a: Fork sessions at a specific user message, and show the fork hierarchy in the sidebar.
538
+
539
+ The session list now renders forked sessions as a tree: a session created by forking is nested (indented, with a ↳ marker) under the session it was forked from. This mirrors pi's own session selector and is driven by each session's `parentSession` header, which the `/sessions` endpoint now surfaces as `parentSessionPath`.
540
+
541
+ Every user message in a conversation gets a "Fork" action. Clicking it forks the session BEFORE that message (pi's default `position: 'before'`), creating a new branched session that keeps everything up to just before the chosen message and records the source as its parent. The web then switches to the new session and pre-fills the composer with the forked-at message's text, ready to edit and resend, exactly like `/fork` in the pi CLI.
542
+
543
+ Implementation: user history messages now carry their source tree `entryId`; a new `session_fork` -> `session_forked` WebSocket exchange creates the branched file server-side (via the SDK's `createBranchedSession`) and returns the new path plus the pre-fill text; the client loads it through the normal session-load path. No live agent is built until the forked session is opened.
544
+
545
+ ## 0.9.5
546
+
547
+ ### Patch Changes
548
+
549
+ - c540ef8: Add a way to cancel queued steer messages on the web frontend.
550
+
551
+ A message sent while the agent is mid-turn is queued by pi as a steer (injected at the next step boundary). Until now the web had no way to retract one: the only option was the Abort button, which kills the whole in-flight turn. The server now relays pi's steer queue to the client (a `queue_update` frame sourced from pi's `queue_update` event). Each still-queued steer bubble shows a passive "Queued (not yet sent to the agent)" badge so you can see which messages are pending, and a single session-level "Cancel queued" button (next to Abort) clears them via pi's `clearQueue()` without aborting the running turn. The cancel action is session-level, not per-message, because `clearQueue()` drops the whole steer queue at once; the button shows a count when more than one steer is queued.
552
+
553
+ Only server-type sessions report a steer queue, so the affordance never appears for CLI-bridge sessions (the extension API has no per-steer dequeue), where it degrades gracefully to a no-op.
554
+
555
+ ## 0.9.4
556
+
557
+ ### Patch Changes
558
+
559
+ - 2d2a3c5: Fix steer messages wrongly flipping to "Retry", and show a proper in-flight state for pending messages.
560
+
561
+ A message submitted while the agent is mid-turn is delivered as a steer, which pi only echoes back (as the user message) at the next model call. When the current turn outlasted the client's ~12s confirmation window, that missing echo made the accepted steer flip to a false "Not delivered / Retry" state. The server now emits a `message_ack` frame the moment it hands a message to the agent (both server and CLI-bridge sessions), and the client confirms delivery on that ack instead of waiting for the deferred user echo. `!command` bash is excluded (its tool output is the real feedback).
562
+
563
+ The web UI now shows a spinner and a dimmed, ringed bubble while a user message is still `sending`, so a message no longer looks fully delivered and then abruptly becomes "Retry"; the failed state also gets a distinct amber ring.
564
+
565
+ ## 0.9.3
566
+
567
+ ### Patch Changes
568
+
569
+ - bc44497: Web dashboard: play audio attachments inline in tool cards.
570
+ - A downloadable path (now `read` + `attach_file`) whose extension is audio (`mp3 wav oga ogg m4a aac flac opus`) renders an inline `<audio controls preload="metadata">` player, sourced from the SAME token-gated `downloadFileUrl(path)` as the image preview (not embedded bytes), OUTSIDE the collapsible section so it survives collapse.
571
+ - The download chip stays, so an unsupported audio format degrades gracefully to the chip.
572
+ - Images/video and non-media paths are unaffected — the audio branch keys purely off `mediaKind(path) === 'audio'`, beside the existing `image` branch, in both the `attach_file` attachment card and the generic tool card.
573
+
574
+ - b8b8d41: Web dashboard: preview images inline in tool cards and narrow the download/preview affordance to `read` + `attach_file`.
575
+ - Narrowed `extractDownloadablePath()` from `attach_file`/`read`/`write`/`edit` to `read` + `attach_file` only — a `write`/`edit` card no longer renders a download chip (a download of a just-written file is noise).
576
+ - Added a `mediaKind()` helper (`web/src/lib/core/media-kind.ts`) classifying a path by extension (case-insensitive) into `image`/`audio`/`video`/`null`; only `image` is used now (audio/video are pure additions later).
577
+ - A downloadable image path now renders an inline `<img>` preview from the SAME token-gated `downloadFileUrl(path)` (not embedded bytes), OUTSIDE the collapsible section, tap-to-open and lazy-loaded, with the download chip still present.
578
+ - De-duped against the model-facing `msg.images` `data:` path (left as-is): a `read`-on-image shows exactly one preview.
579
+
580
+ - 747b968: Play video attachments inline in the web dashboard, backed by server-side HTTP Range support so media can seek/scrub.
581
+ - Web: a downloadable path (`read` + `attach_file`) whose extension is video (`mp4 webm mov m4v ogv`) renders an inline `<video controls playsinline preload="metadata">` player sourced from the SAME token-gated `downloadFileUrl(path)` (not embedded bytes), OUTSIDE the collapsible section, with the download chip still present. The branch keys purely off `mediaKind(path) === 'video'`, beside the existing `image`/`audio` branches, in both the `attach_file` attachment card and the generic tool card.
582
+ - Server: `GET /session/download` now honours a single `Range: bytes=start-end` header — `206 Partial Content` with `Content-Range` + `Accept-Ranges: bytes` + a byte-exact sliced stream, a suffix range (`bytes=-N`), `416` for an unsatisfiable range, and a full `200` (advertising `Accept-Ranges: bytes`) when there is no `Range` header. A multi-range header serves only its first range (no multipart body).
583
+ - Server: the MIME map gained audio/video types (mp3/wav/oga/ogg/m4a/aac/flac/opus, mp4/webm/mov/m4v/ogv) so media is served with a playable `Content-Type` instead of `application/octet-stream`, and media (audio/video/image) is served with an `inline` `Content-Disposition` (non-media stays `attachment`) — both keeping the existing ASCII + RFC 5987 filename encoding — so browsers render it in-chat.
584
+ - The deny-by-default path resolution (out-of-root → `404`), the size cap (`413`), and the `downloads.enabled: false` gate (`403`) are unchanged and re-asserted by tests on the Range code path.
585
+
586
+ ## Decisions
587
+ - **Inline disposition for media.** Media (`audio/`, `video/`, `image/`) is served `Content-Disposition: inline` because an `attachment` disposition can suppress inline `<video>`/`<audio>` playback; non-media keeps `attachment` (the safe save default). The ASCII + RFC 5987 filename is preserved on both.
588
+ - **Single-range only.** Only the first range of a (possibly multi-range) header is honoured; the server never emits a `multipart/byteranges` body — a single contiguous slice is all a media element needs to seek. An unsatisfiable range → `416` with `Content-Range: bytes */<size>`.
589
+ - Observation captured: the default `uploads.type: 'tmp'` makes all of `os.tmpdir()` an allowed download root (`work/notes/observations/download-tmp-upload-dir-is-an-allowed-root.md`) — out of scope here, flagged for the deny-by-default posture.
590
+
591
+ - dd6a55c: Security fix (Gate-3 follow-up to inline-video-player-and-range): serve
592
+ `image/svg+xml` downloads with `Content-Disposition: attachment` again instead
593
+ of `inline`. The inline-media disposition change flipped every `image/*` type to
594
+ `inline`, which for SVG (which can embed `<script>`) turned a tap-to-open of the
595
+ same-origin download URL into a stored-XSS vector. SVG is not needed for inline
596
+ `<video>`/`<audio>` seeking and previews fine via `<img src>` regardless of
597
+ disposition, so it keeps the safe `attachment` default — preserving the
598
+ pre-media-feature security posture. Adds a server test asserting SVG stays
599
+ `attachment` while audio/video keep their inline disposition.
600
+
601
+ ## 0.9.2
602
+
603
+ ### Patch Changes
604
+
605
+ - d9df862: Show web `!command` / `!!command` (force command) bash tool calls INSTANTLY again instead of only after a server round-trip. Since the `!sudo` change, `!`-commands no longer add any local user echo — the bash tool-call render (driven by the server's `tool_start`) is the only feedback — so nothing appeared until the full client → server → `tool_start` → client hop completed, making force commands feel laggy.
606
+
607
+ The client now renders an OPTIMISTIC bash tool bubble the moment a `!`/`!!` command is sent (correct `$ bash command="..."` label, `forceCommand`, live "Elapsed" timer), tagged `optimistic` so it is NOT delivery-tracked (no watchdog/retry banner) and is reconciled — not duplicated — when the server's real `tool_start` arrives (FIFO match on the oldest pending optimistic bubble, so back-to-back `!`-commands line up correctly). `!sudo ...` is intentionally excluded from the optimistic bubble because the server defers it behind a password prompt and only emits `tool_start` once the password arrives. A stuck optimistic bubble (e.g. the turn ends before any `tool_start`) is still finalized as interrupted by the existing agent_end/aborted sweep.
608
+
609
+ - 0610f2d: Refine the proposed `inline-media-attachments` spec: NARROW the download/preview
610
+ tool set to `read` + `attach_file` only, dropping the pre-existing over-broad
611
+ download button on `write`/`edit` tool cards (`extractDownloadablePath()` goes from
612
+ `['attach_file','read','write','edit']` to `['attach_file','read']`). The narrowing
613
+ rides slice 1 (same `ChatMessageList.svelte` seam as image-inline), with a matching
614
+ user story and test. Spec-only change; no runtime code touched yet.
615
+ - 462d525: Task the `inline-media-attachments` spec into three vertical tracer-bullet tasks in
616
+ `work/tasks/backlog/` (`inline-images-and-narrow-download-tools` → `inline-audio-player`
617
+ → `inline-video-player-and-range`, serialized on the shared preview seam), trim the
618
+ spec to its durable framing, and move it `work/specs/proposed/ → work/specs/tasked/`
619
+ to record tasked-ness. No runtime code changed.
620
+
621
+ ## 0.9.1
622
+
623
+ ### Patch Changes
624
+
625
+ - 09c6f6a: Pin `@earendil-works/pi-coding-agent` and `@earendil-works/pi-ai` to an exact version (`0.80.6`) instead of the loose `^0.80.3` range. A later `0.80.x` patch release removed the `AuthStorage` export that `session-pool.ts` imports, so fresh global installs (no lockfile) resolved a broken version and crash-looped on startup with "does not provide an export named 'AuthStorage'". Exact pinning prevents that drift.
626
+
627
+ ## 0.9.0
628
+
629
+ ### Minor Changes
630
+
631
+ - 9e4e6e0: Replace the blocking session take-over / conflict-resolution dialog with a
632
+ non-blocking folder-overlap **warning banner**, and drop the take-over and
633
+ read-only _choices_ entirely.
634
+
635
+ Previously, loading or starting a session in a folder that already had another
636
+ active session popped a modal offering **Take Over** (interrupt the other
637
+ client) or **Read-Only** (observe). This had two problems: the modal blocked the
638
+ flow, and **Read-Only** was broken for a brand-new session (there was nothing to
639
+ observe, so it fell back to the existing session).
640
+
641
+ Now the server never blocks:
642
+ - On a folder conflict it attaches the client to the folder's session as a
643
+ **read-only observer** and flags `folderConflict` on `session_created`.
644
+ - The client renders a persistent **warning banner** with a single **Continue
645
+ anyway** button. Clicking it sends the new `folder_conflict_continue` message,
646
+ which lifts read-only for that client so it can send. It does **NOT** abort or
647
+ take over the other session — both run concurrently (changes may conflict).
648
+ - After continuing, the banner stays as a passive warning (no button) and
649
+ **disappears automatically** once no other session is active in the folder,
650
+ driven by a new live `folder_conflict` server→client update broadcast on every
651
+ session-set change.
652
+ - A `sessions.readOnly`-configured folder stays hard read-only (Continue anyway
653
+ is a no-op there).
654
+
655
+ Removed the `session_conflict` / `session_resolve_conflict` protocol messages,
656
+ `resolveConflict` / `takeOver`-driven UI, and the `SessionConflictDialog`
657
+ component. The web frontend and the VS Code sidebar both use the new banner.
658
+
659
+ ### Patch Changes
660
+
661
+ - 81b5e26: Fix server test isolation: the integration harness spawns the real server with
662
+ `...process.env`, so an ambient `PI_REMOTE_TOKEN` (present when tests run inside a
663
+ wherever-managed shell) made the server enforce auth and reject the token-less
664
+ test WS client with `401`, failing all 13 server tests. The harness now
665
+ neutralizes every leaking `PI_REMOTE_*` var (token, host, port, SSL, HTTP
666
+ fallback) so its documented "no token / no SSL" intent holds regardless of the
667
+ ambient environment.
668
+ - faa9f4e: Onboard the repo onto the file-based `work/` contract: add the contract skeleton
669
+ (`work/tasks`, `work/specs`, `work/questions`, synced `work/protocol/` docs),
670
+ migrate the bespoke `work/briefs/ready/` specs to `work/specs/ready/` and
671
+ `work/ideas/` to `work/notes/ideas/` (history-preserving renames), add a
672
+ `dorfl.json` gate (`verify` = `pnpm format:check && pnpm build:all && pnpm run -r test`,
673
+ `prepare` = `pnpm install --frozen-lockfile`, `promptGuidance.testFirst`), and
674
+ document the conventions + contract layout in `CONTEXT.md`. No runtime code changed.
675
+ - 23e30fe: Add `work/specs/proposed/conversation-mode.md`: a spoken back-and-forth "conversation
676
+ mode" that is a PRESET over individually-configurable speech knobs (reusing the
677
+ existing `directSend` send-on-speech-end), plus a self-contained `say` tool (the
678
+ `attach_file` pattern) so the agent emits a SHORT spoken reply — read aloud via
679
+ browser `SpeechSynthesis` — IN ADDITION to its full written answer, letting the
680
+ human hear something concise and spot when it misrepresents the detail. Staged in
681
+ `specs/proposed/` with `needsAnswers: true` (three open questions: `say` registration
682
+ surface, `say` UI treatment, hands-free/engine interaction). No runtime code changed.
683
+ - 3fe9369: Migrate the ad-hoc `docs/plan-inline-media-attachments.md` plan into the `work/`
684
+ spec lifecycle as `work/specs/proposed/inline-media-attachments.md`, reshaped to
685
+ the repo's `spec-template` (Problem / Solution / User Stories / Out of Scope /
686
+ Implementation & Testing Decisions) and staged in `specs/proposed/` for review-first
687
+ admission. No runtime code changed.
688
+ - 3fe9369: deploy: add `--sudo-password` option to the cloud-init generator that lets the wherever service run `sudo` but requires the user's password (collected by the frontend and piped to `sudo -S`). It sets a real login password on the account, switches sudoers to `ALL=(ALL) ALL`, and relaxes the systemd sandbox (`NoNewPrivileges=false`, `ProtectSystem=off`) so escalation actually works. The default (passwordless, fully-sandboxed, sudo-blocked service) is unchanged.
689
+
690
+ ## 0.8.4
691
+
692
+ ### Patch Changes
693
+
694
+ - f16bca7: Server: expand a leading `~` in `remoteRepoRules[].pattern` before matching. The pattern is tested against the absolute, tilde-expanded folder path (e.g. `/home/user/dev/...`), so a rule written as `~/dev/github/me/.*` (the natural form, mirroring `commonFolders`) never matched and the auto-remote-repo creation silently did not fire. A leading `~` in the pattern is now expanded to the home directory first. Absolute patterns are unaffected, and an invalid regex is treated as a non-match instead of throwing.
695
+
696
+ ## 0.8.3
697
+
698
+ ### Patch Changes
699
+
700
+ - 6a95014: Client: surface an actionable error when the WebSocket handshake keeps being rejected instead of silently reconnecting forever. The server rejects a missing or wrong token with HTTP 401 during the WS upgrade, which a browser WebSocket can only observe as an opaque 1006 close, so the dashboard previously just showed `reconnecting to relay (attempt N)` with no hint of the cause. The client now tracks whether it has ever connected; after a couple of failed attempts with zero successful opens it sets a clear error ("the connection is being rejected... missing or wrong token, or wrong host/port/scheme...") while still retrying. A drop after a successful connection is still treated as a normal transient reconnect.
701
+
702
+ ## 0.8.2
703
+
704
+ ### Patch Changes
705
+
706
+ - 8addff3: Auto-clone an existing remote when creating a session in a not-yet-cloned project. Previously, starting a session in a non-existing folder that matched a `remoteRepoRules` pattern always tried to CREATE the remote (`gh repo create` / `tea`/`cb repo create`); if that repo already existed on the host, the create failed and the session was left as an empty local folder with no `origin`. Now, at submit time (not on every keystroke), the server probes the provider using the same authenticated CLI and owner it would use to create (`gh repo view` for GitHub, `tea`/`cb` listing for Codeberg/Gitea/Forgejo). If the repo is found, the dashboard asks whether to clone it (preferring the SSH remote) or create a new one anyway; cloning runs `git clone <ssh-url>` into the target folder and pre-configures upstream tracking. When no matching remote exists, behavior is unchanged and it falls back to the normal create path (any probe/CLI failure is also treated as "does not exist"). `WhereverClient.createSession` gains an optional trailing `cloneRemote` argument.
707
+
708
+ ## 0.8.1
709
+
710
+ ### Patch Changes
711
+
712
+ - 6fff814: Web dashboard: connect back to the page's own origin port by default instead of always assuming 31415. When the dashboard is served behind a reverse proxy (e.g. Caddy on 443 with no port in the URL), the client previously forced `wss://host:31415/ws`, which is a closed port in that setup, so it hung on "Connecting to Wherever Server...". Now an unconfigured port resolves to the page's port (443/80/whatever the origin uses), and a legacy stored `31415` is healed to the page's port when the dashboard is actually served from a different origin. Direct `http://host:31415` LAN setups and explicit user-set ports are unaffected.
713
+
714
+ ## 0.8.0
715
+
716
+ ### Minor Changes
717
+
718
+ - fe11760: Support `!sudo ...` bash commands from the web client, for both server-hosted sessions and CLI-bridge sessions. When a `!`-command (or `!!`-command) starts with `sudo`, the server defers execution and asks the web client for the password via a new one-shot, masked prompt (a `bash_sudo_prompt` -> `bash_sudo_password`/`bash_sudo_cancel` protocol round-trip). Once the password arrives, a server session runs the command locally and a CLI-bridge session forwards it to the extension (new `cli_bash_sudo` message); in both cases the command runs with `sudo -S -k -p ''`, feeding the password over the child's stdin, and streams output/records history exactly like any other `!command`. The password is used once and is never streamed, logged, or persisted (only the password-free command line is recorded). A fresh prompt is required for every invocation (`-k` resets any cached sudo credential). Cancelling the prompt drops the command without running anything.
719
+
720
+ Also fixes pre-existing UX bugs affecting all `!`/`!!` bash commands from the web client. Because the server runs them as a bash tool call instead of delivering them to the agent, there is no user-message echo to confirm: the delivery watchdog wrongly flagged them as failed (a spurious retry/discard banner) and re-surfaced them as failed user bubbles on reload. Web `!`/`!!` commands no longer add any local user-message echo at all (the bash tool call is the feedback), so there is no banner and nothing reappears after a reload. The server now also marks force-command bash tool calls explicitly (`forceCommand`), both live and in reloaded history, so the web auto-expands their output reliably, including for back-to-back `!command`s and after a reload.
721
+
722
+ ## 0.7.1
723
+
724
+ ### Patch Changes
725
+
726
+ - a4866aa: Show the context-window usage indicator ("11.3% / 1.0M") for CLI-controlled sessions as soon as a viewer joins, instead of leaving it blank until the next turn. Previously the pi extension only forwarded its context usage on `agent_end` and model switches, so an idle CLI-bridged session (no new turn since the bridge connected) had no usage snapshot to show, and the server broadcast `session_created` on `cli_register` without one. The extension now pushes a context-usage snapshot immediately after registering (on connect/reconnect), and the server includes any cached usage in the `session_created` message it broadcasts to web viewers on `cli_register`. Both are best-effort: when usage is genuinely unknown (no model or no turn yet) nothing is shown, matching the previous behavior.
727
+ - fe99d43: Keep the scroll position anchored when loading older messages. Previously, clicking "Load older messages" preserved the distance from the bottom, which could visually shift the content the user was reading once the older window was prepended. Now the client records the message that was first before the load and, after the older messages are prepended, scrolls so that same message stays in place near the top of the viewport, leaving a small gap above it that reveals the newly loaded messages. If the anchor message can't be located after the prepend, it falls back to the previous "preserve distance from bottom" behavior so the content never jumps unexpectedly.
728
+
729
+ ## 0.7.0
730
+
731
+ ### Minor Changes
732
+
733
+ - 13c2d36: Add a file download mechanism so agent-produced files (e.g. a generated PDF saved into the work folder) can be pulled down to a phone/browser. New authenticated `GET /session/download?sessionId=..&path=..` endpoint streams the file with `Content-Disposition: attachment`, guarded deny-by-default: a file is served only when its real (symlink-resolved) path is inside an allowed root (always the session cwd and the resolved upload dir, plus `config.downloads.roots`), so `..` traversal and in-tree symlink escapes are rejected. Configurable via a new `downloads` block (`enabled`, `roots`, `maxBytes`).
734
+
735
+ The download button in the web UI is driven by the tool CALL itself: the client inspects each tool call and, for a small set of file-oriented tools, renders a download button in the tool-card header (building an authenticated URL against the active session). This works identically in CLI-bridge and pure server-side (web-frontend) sessions, since both already stream tool calls to every client, so no side-channel message is needed. `attach_file` is the intended, agent-driven trigger; `read`/`write`/`edit` cards also offer a button opportunistically. The server additionally registers `attach_file` as a `customTool` on its own `createAgentSession()` sessions so the tool exists in web-frontend sessions that have no CLI bridge.
736
+
737
+ ### Patch Changes
738
+
739
+ - 817aa93: Fix a session-routing bug where a message could be delivered to the wrong session's agent (you switch to a session, post a message, and the agent replies as if it were in a different session). The web client already stamps every send with the `sessionId` of the session it is actually viewing, but the server ignored it and routed by its own per-connection `client.sessionId`, which is only (re)attached when a `session_load` completes. During a switch/reconnect/resync window that value could be stale (a reconnected socket even starts with no attachment, and a cold load attaches only seconds later inside the async agent-build step), so the message went to whatever session the connection was previously attached to.
740
+
741
+ The `message` and `abort` WS handlers now treat the client-stamped `msg.sessionId` as authoritative: they resolve it through the session pool and verify it maps to the same tracked session the connection is attached to. On a mismatch the send is refused with a `session_error` (surfaced by the client as a recoverable, retryable failure via its delivery watchdog + Retry) instead of being misrouted into another session's agent. Adds an end-to-end regression test (`server/test/message-session-authority.test.ts`) that reproduces the misroute and asserts it is now refused, and that a correctly-stamped send is still delivered.
742
+
743
+ ## 0.6.2
744
+
745
+ ### Patch Changes
746
+
747
+ - 30db572: Fix the server test harness, which spawned the server without the required `start` verb. Since the explicit verb dispatch was introduced, a bare invocation prints usage and exits, so `/health` never came up and every gate test failed with "server did not become healthy". The harness now passes `start`, and the full suite (6 files, 11 tests) is green again.
748
+ - f1ccbcc: Chat rendering improvements: user messages now linkify bare URLs (http(s):// and www.) into clickable links without reinterpreting other characters as markdown, and long fenced code blocks (triple backtick) in assistant messages render as collapsible `<details>` showing the language plus a truncated first line so they no longer clutter the log. Single-line code blocks stay expanded.
749
+
750
+ ## 0.6.1
751
+
752
+ ### Patch Changes
753
+
754
+ - 3d193f3: `wherever install` now forwards all server flags directly, no separator needed. Install owns only `--system`, `--no-pi-config`, and `--dry-run`; every other argument is passed verbatim to the baked `wherever start` command. So `wherever install --host 0.0.0.0 --port 31415 --http-localhost-fallback` works, and any server flag (`--host`, `--port`, `--token`, `--http-localhost-fallback`, `--no-ssl`, `--ssl-key`, `--idle-timeout`, ...) can be baked into the service without install modelling each one. A leading `--` separator is still tolerated (and ignored) for backward compatibility. On Linux, re-running `install` now also restarts the running service so the freshly written options take effect immediately (previously `enable --now` left an already-running process on the old `ExecStart` until the next restart), mirroring the launchd unload+load behavior on macOS.
755
+ - 3d193f3: Add a `wherever --version` command (with `-v` and `version` aliases) that prints the installed package version. The version is read at runtime from the package's own `package.json` next to the entrypoint, so it reports correctly regardless of how the CLI was launched (npm, a Volta shim, or an absolute service path). The version line is also listed in `wherever help`.
756
+
757
+ ## 0.6.0
758
+
759
+ ### Minor Changes
760
+
761
+ - 0d7ca65: Add `wherever install` / `uninstall` / `service-status` subcommands to run the server as a background service.
762
+
763
+ On Linux it writes a systemd unit (a per-user unit under `~/.config/systemd/user/` by default, or a system-wide unit with `--system`) and enables/starts it. On macOS it writes and loads a per-user launchd LaunchAgent under `~/Library/LaunchAgents/`. Server flags like `--port`, `--host`, and `--token` are baked into the service invocation.
764
+
765
+ On install (unless `--no-pi-config`) the `npm:@wherever-dev/pi` extension is added to the `packages` array in `~/.pi/agent/settings.json` if it is not already configured, so a running pi CLI bridges into the same server automatically. The existing settings file is backed up to `settings.json.bak` before it is modified. A `--dry-run` flag prints the unit/plist and the actions without writing anything.
766
+
767
+ The server is now started with an explicit verb: `wherever start [server flags]`. A bare `wherever` prints the command help instead of starting the server (breaking change; acceptable pre-1.0). All existing server flags work unchanged after `start`. Windows is not supported yet; the command prints the manual steps instead.
768
+
769
+ ## 0.5.3
770
+
771
+ ### Patch Changes
772
+
773
+ - 4836b65: Fix dangling tool calls being hoisted to the end of the transcript on the web frontend, showing as a phantom "series of aborted tool calls" after the latest reply.
774
+
775
+ When loaded history contained a tool call with no matching tool result (e.g. an interrupted long-running `bash` that was superseded by a new user turn, then more replies), the web history mapping deferred every unmatched tool call and appended them all AFTER the last mapped message. So dangling calls from the MIDDLE of the conversation piled up below the latest assistant reply, even though the CLI (and the actual transcript) has them inline where they were issued. The reproducing session was a deliberate recoverability test ("Generate a long message..."/"long running tool call using bash sleep" then interrupting it).
776
+
777
+ The mapping now renders each tool call IN PLACE at its position in the stream: a result-less tool message is emitted when the tool call is seen, and its matching tool result fills it in later (oldest-open-first per tool name, preserving the parallel-call FIFO behaviour). A call that never receives a result stays exactly where it was issued, correctly marked `interrupted` (neutral "no result" state), instead of migrating to the end. On the live streaming tail, only the newest still-open call is kept streaming ("Elapsed" ticking); earlier open calls in the window are interrupted.
778
+
779
+ Tests: two new client tests covering (1) a mid-conversation dangling call staying in place with the final message still an assistant reply, and (2) multiple dangling calls where only the newest streams on the live tail while earlier ones are interrupted in place. All existing tool abort/interrupted/duration tests still pass.
780
+
781
+ - 12083e5: Render an aborted tool call as interrupted, not a red error.
782
+
783
+ When you hit the web "abort" button while tools are running, pi kills the in-flight tools and surfaces each as an errored result with a trailing "...aborted" status ("Command aborted" for bash, "Operation aborted" for edit/write). The web then rendered that as a red error tick, as if the tool had genuinely failed. With parallel tool calls this was especially confusing: a tool that happened to finish just before the abort showed a green success tick while the killed one showed a red error, even though the user aborted the whole turn.
784
+
785
+ The client now detects an abort result (an errored result whose trailing status line is "...aborted") and renders it with the neutral "interrupted" state (muted icon, neutral border) instead of a red error, on both the live tool_end path and when reconstructing from loaded history. A tool that genuinely completed keeps its green success, and a genuine failure keeps its red error. The match is anchored to the trailing status line, so ordinary command output that merely contains the word "aborted" is not misclassified.
786
+
787
+ Also fixes a related mismatch with PARALLEL same-named tools. Live tool_end frames were matched to a tool message by name via a last-match search, so with two concurrent bash calls both tool_end frames could land on the same message, leaving the other tool stuck streaming; it was then finalized by the agent_end sweep with no result and shown as a bogus green success tick. tool_end now claims the OLDEST still-streaming tool of that name (FIFO), so each concurrent call settles a distinct message. And any tool still streaming when the turn ends (agent_end) is now marked interrupted rather than left to render green, since its outcome is unknown.
788
+
789
+ Also adds a `tool-calls` (parallel tool_use) behavior to the test fake LLM to exercise concurrent tool execution.
790
+
791
+ - b87f1bc: Search mode: let the user pick the model before searching, and make the default folder-aware.
792
+
793
+ The main-page search composer now shows a compact model picker (same list as the sidebar new-session picker). The selection is seeded from the search folder's default model, which the server now resolves against that folder's own settings (a folder-local harness/pi config default wins over the server global). The chosen model is threaded through `runSearch` into session creation, so a search runs on the selected model instead of always falling back to the global default. The top-bar magnifier needs no separate control: it just focuses the same composer.
794
+
795
+ Server: `getAvailableModels(cwd?)` now resolves `isDefault` against an optional folder, a new `getDefaultModelFor(cwd)` returns a folder's default as `provider:modelId`, and `GET /config` includes `searchDefaultModel` for the configured search folder.
796
+
797
+ - db16623: Render `read`-tool image output inline in the web frontend, mirroring the CLI's inline image display.
798
+
799
+ When the agent uses the builtin `read` tool on an image path, the pi tool result carries an image content block (`{type:'image', data, mimeType}`) alongside the text note. Previously the server's `extractToolResult` kept only text blocks, so the web never saw the image. The server now also pulls image blocks out of the tool result and ships them (base64 + mimeType) on the `tool_end` frame via a new optional `images` field, and reconstructs them from history when a session is reloaded. The client stores them on the `ChatMessage` (`images`), and the web renders each image inline right under the tool header, always visible (not hidden behind the collapse toggle), while the textual arguments/output stay collapsible. Click an image to open it full size. Text-only tools are unaffected.
800
+
801
+ - 9931867: Pair reconstructed tool results to their exact tool call by id, not just by tool name.
802
+
803
+ The server now forwards the tool-call id on both `tool_call` (the id the assistant issued) and `tool_result` (the `toolCallId` it satisfies) history messages, and the web history mapping matches a result to its exact call by that id, falling back to the previous oldest-open-first per-tool-name behaviour only when no id is present (older sessions, or the synthesized `bashExecution` pair).
804
+
805
+ This fixes mis-pairing when same-named calls interleave with some left dangling: e.g. two `bash` calls issued back-to-back where only the second returns a result. Name-FIFO alone would resolve the first call and leave the second dangling; id matching resolves the correct one and leaves the genuinely-interrupted call marked interrupted, in place.
806
+
807
+ Tests: a new client test covering id-exact pairing (result resolves call #2 by id, leaving call #1 dangling/interrupted, order preserved).
808
+
809
+ - 676ca94: Add an inviting "agent is waiting for you" beep to both the web frontend and the CLI bridge extension.
810
+
811
+ Both surfaces can now play a gentle sound the moment the agent finishes and is waiting for a human message, so you can look away and be called back when it is your turn. The beep is DISABLED by default on both. Each surface has a per-session toggle, and a config that sets the default for new sessions (which the per-session toggle can still override). The two surfaces are configured independently.
812
+
813
+ Web frontend (`wherever-dev`): the chime is synthesised with the Web Audio API (a soft two-note rising interval, no bundled asset) and fires on the `isStreaming` true -> false edge for the active session. Connection Settings has a "Beep when the agent is waiting" checkbox (`beepDefault`) for the persisted default and an optional custom sound URL (`beepSoundUrl`, played via an `Audio` element, with a Test button; blank = built-in chime), both persisted in the `wherever-config` localStorage entry.
814
+
815
+ The chat toolbar (next to "Hide Thinking" / context usage) has a tri-state per-session beep control that cycles Default -> On -> Off -> Default. Per-session choices are stored per session id (persisted in a separate `wherever-beep-overrides` localStorage map), so a session with NO explicit choice follows the global default live (changing the default updates it), while an explicit On/Off sticks to that session across session switches and reloads, unaffected by later default changes, until cleared back to Default. The default is a reactive store so toggling it in the Config menu takes effect immediately.
816
+
817
+ CLI bridge extension (`@wherever-dev/pi`): plays a sound on the `agent_settled` event (the run has fully settled and is genuinely waiting for input, so it does not fire between chained internal turns).
818
+ - Enabled by default when EITHER the `--remote-beep` flag is set OR `beep.enabled: true` in `~/.wherever/config.json` (the flag can only force-on, so the config file is the way to enable-by-default without passing the flag). Default off.
819
+ - `/remote-beep [on|off]` toggles it for the current session (no argument toggles; enabling plays a sample); resets to the configured default on each session start.
820
+ - Sound resolution, highest precedence first: `--remote-beep-command` flag, then `beep.command` in `~/.wherever/config.json`, then an auto-detected player + a system chime (`pw-play`/`paplay`/`canberra-gtk-play`/`ffplay` + freedesktop `complete.oga`, or `afplay` on macOS), then a terminal bell. The bell (`\x07`) is written to `/dev/tty` rather than stdout because pi's TUI owns stdout and can swallow an out-of-band byte; the command path exists because many terminals (e.g. WezTerm on Linux) have a silent audible bell.
821
+
822
+ Also adds a typed `beep` section (`enabled`, `command`) to the server's `WhereverConfig` (the shared `~/.wherever/config.json` type), which the extension reads directly.
823
+
824
+ - 8536f30: Warn both the web frontend and the CLI when a CLI takeover discards an in-flight turn.
825
+
826
+ When a `pi` CLI resumes/registers a session while the standalone server is mid-turn for a web viewer, the CLI seizes control and the server disposes its live agent. Disposing mid-turn discards the whole in-flight turn without persisting it (persistence only happens on turn completion), so the web viewer, who was watching a tool run or a reply stream, lost it silently with no explanation.
827
+
828
+ The server now detects that the server-side agent was mid-turn at takeover and sends the attached web clients a non-fatal `session_notice` (level: warning). The web frontend renders it as a dismissible banner. The wording is tailored to what was lost: a running tool call (tracked via a per-session in-flight tool-execution count, so its result never arrives) or a streaming reply (the partial text is discarded and not saved). A takeover of an already-settled (idle) session is not flagged. The session stays attached (informational, unlike `session_interrupted`).
829
+
830
+ The notice also states the takeover semantics accurately: once the CLI has taken over it owns the session's execution loop, so messages sent from the web frontend are relayed to the CLI rather than wresting control back. The web frontend regains control only when the CLI disconnects.
831
+
832
+ The CLI side is covered too. On register, the server sends the taking-over CLI a `cli_takeover_interrupted` message, and the Wherever extension surfaces a single matching notice. This closes a blind spot: a still-streaming turn is never persisted, so the extension's own resumed-mid-tool-call check (which reads the saved transcript) cannot see the streaming-text case. For the tool-call case, the extension's transcript check already warns with the tool names, so the server-driven notice defers to it to avoid a duplicate.
833
+
834
+ Also fixes the web frontend rendering a killed-then-orphaned tool call as a green success tick. When a CLI takeover kills an in-flight tool (the pi SDK aborts the run and SIGKILLs the tool's process tree, so it does not keep running in the background), the transcript keeps a dangling toolCall with no toolResult. The web history mapping now flags such a result-less, non-streaming tool call as `interrupted`, and the UI shows a neutral "interrupted, no result" state (a muted ⊘ icon, neutral border, and an explanatory output note) instead of the green ✅ "Succeeded": its outcome is genuinely unknown, neither success nor failure.
835
+
836
+ Also cleans up the CLI's resumed-mid-run warning (the extension's dangling-tool-call widget):
837
+ - It now counts only the TRAILING dangling tool calls (those after the last user message on the active branch), not every unsatisfied tool call in the whole session. Earlier turns' interrupted tool calls are already superseded by a later human turn and do not block auto-continue, so they were over-counted (e.g. "4 tool calls" when only 1 was actually blocking).
838
+ - It shows a single persistent widget instead of a widget plus a duplicate transient notify.
839
+ - Its guidance is corrected: the CLI has already taken over, so it says to send a message to retry or continue, rather than the stale "send a message to take over".
840
+
841
+ ## 0.5.2
842
+
843
+ ### Patch Changes
844
+
845
+ - 333f6ad: Never silently lose a message when the connection drops mid-send; confirm delivery and recover it on reload.
846
+
847
+ A frame handed to a socket that reports OPEN can still never reach the server (a half-open TCP connection: `send()` buffers locally and does not throw, but the bytes never land). The optimistic echo was treated as delivered, the input was cleared, and on reload the message was gone with no way to recover it.
848
+
849
+ Outbound user messages are now tracked as `delivery: 'sending'` until the server echoes them back (`message_end` role:user), at which point they are confirmed. If no echo arrives within a window, the message flips to `delivery: 'failed'` and the UI surfaces "Not delivered" with Retry / Discard instead of a normal-looking sent message. Unconfirmed messages are persisted per session, so a reload reconciles them against the loaded history: anything the server actually persisted is shown as delivered, and anything it did not is re-surfaced as a recoverable failed message (never silently dropped). New client APIs: `resendMessage(id)` and `discardMessage(id)`.
850
+
851
+ - 0976c2e: Steer the agent immediately on a mid-stream submit, matching pi's default.
852
+
853
+ Submitting a message while the agent is streaming now steers it right away (the server injects it at the next tool/step boundary, before the next LLM call) instead of parking it in a local queue that waits for the whole turn to resolve. The primary button is renamed "Queue" -> "Steer" and the surrounding copy is aligned to pi's language ("Agent is working, Steer to interrupt"). The local `queuedText` wait-then-send and the `isStreaming`-driven auto-drain (and the "Unqueue" button) are removed; this also eliminates the "pi stops midway" auto-fire mechanism (see docs/adr/0003). The submit decision is now a pure, unit-tested helper (`web/src/lib/core/compose-send.ts`), and the hard-won safety is preserved: text is kept on a dropped send, per-session drafts persist, and disconnected/resyncing/agent-pending surface clear states instead of silently swallowing a message.
854
+
855
+ - 9368269: Show how long each tool call has been running, like the pi CLI.
856
+
857
+ A running tool now shows a live-ticking "Elapsed N.Ns" and, once it finishes, "Took N.Ns" (one decimal, matching the CLI's bash duration format). The client reducer stamps `startedAt` on `tool_start` and `endedAt` on `tool_end` (new `ChatMessage` fields), and freezes a still-running tool's `endedAt` if the turn ends or is aborted without a `tool_end`, so the timer stops instead of counting up forever. The web UI ticks only while a tool is actually running (no per-frame work on an idle session).
858
+
859
+ Durations also survive a reload/reconnect: history mapping pairs each `tool_call` with its `tool_result` and derives `startedAt`/`endedAt` from their timestamps (no server change needed), so a tool restored from loaded history shows the same "Took N.Ns" as a live-streamed one.
860
+
861
+ ## 0.5.1
862
+
863
+ ### Patch Changes
864
+
865
+ - e15f5fa: Fix Abort being disabled (and the composer enabled) when joining a pi CLI session that is mid-tool-call.
866
+
867
+ When a session is being driven by the pi CLI and you opened it in the web frontend while a long tool call was in flight, Abort showed disabled and the composer looked ready, even though the CLI was still waiting for the tool to finish. Root cause: the CLI bridge only forwarded `agent_start`/`agent_end` as they happened and registered the session with a hardcoded `isStreaming: false`, so a turn already in progress when the bridge (re)connected was invisible to the server. Now the extension reports the agent's current streaming state (`!ctx.isIdle()`) in the `cli_register` handshake, and the server honors it (and keeps the mid-turn session from being idle-reaped), so a viewer joining a running CLI session correctly sees it as streaming.
868
+
869
+ - 2701c07: Fix the composer showing the web-search input while a session is still loading.
870
+
871
+ The bottom composer decided it was in "search mode" purely from `!sessionFile`, ignoring the loading/resyncing/hash state. So during a session open (spinner showing "Loading session..." in the message area) the composer would render the search text box and "Search" button, an inconsistent, confusing state. Search mode is now derived from a single shared `isSearchActive` helper that also treats a session that is loading, resyncing, or targeted by the URL hash as "not the search state", so the composer and the message area always agree.
872
+
873
+ Also adds a `vitest` unit-test tier to the `web` package covering the view-mode logic.
874
+
875
+ ## 0.5.0
876
+
877
+ ### Minor Changes
878
+
879
+ - f17f262: Make opening a session fast, and add the deterministic fake-LLM integration gate.
880
+
881
+ Opening a session no longer blocks on building the live agent. Previously `session_load` awaited `createAgentSession` (which resolves extensions and connects MCP servers, seconds of work, occasionally hanging past the client's load watchdog) before sending anything, so returning to an idle-evicted session was slow and could time out. Now the server reads the session header + transcript cheaply and sends `session_created` (with a new `pending` flag) + `message_history` immediately, then builds the agent asynchronously and sends a new `session_ready` message. The client renders and lets you scroll the conversation right away; only the composer stays disabled (with a "Preparing the session agent..." banner) until the agent is ready. A failed cold build degrades to readable-but-not-sendable instead of a hard load failure. Warm (still-resident) sessions skip the pending phase entirely.
882
+
883
+ Also raised the default session idle-eviction window from 5 to 20 minutes (`PI_IDLE_TIMEOUT`, ms) so a dip-in/dip-out user usually returns to a warm session with no agent rebuild at all.
884
+
885
+ Foundation: promoted the fake-LLM test substrate (ADR 0001) into `server/test/` and wired `vitest` into the `server` and `client` packages, giving a deterministic, offline integration gate (real server + real pi + fake Anthropic-Messages SSE server). New coverage: server integration tests for fast-first load and a client reducer test for the pending/ready lifecycle.
886
+
887
+ Protocol: `session_created` gains an optional `pending` flag and there is a new `session_ready` server message. Both are additive and backward compatible (an older client that ignores them simply treats the load as before, seeing history once and the composer enabled on `session_created`).
888
+
889
+ ### Patch Changes
890
+
891
+ - f615141: Fix three frontend session-lifecycle bugs and add the first client unit tests.
892
+ - Creating a new session no longer spins the blocking "Creating session..." overlay forever when the server reply is lost (slow git init / remote-repo creation, a half-open socket, or an error before the reply is sent). A create watchdog now mirrors the existing load watchdog: it clears the overlay and surfaces a recoverable error instead of forcing a reload.
893
+ - Returning to the app (PWA/mobile) after a background suspend no longer flashes the new-session / search empty-state or the big "Not connected" panel over an already-loaded conversation. `suspend()` now correctly reflects the disconnected state so `resume()` actually rejoins in place (it was silently no-op'ing on a stale connected flag and falling through to a session-dropping reconnect). The chat view keeps the cached messages visible during a reconnect, with a thin "Reconnecting and syncing session..." banner over the composer; the sidebar and top-bar search stay usable, and only sending into that one session is blocked.
894
+ - An UNSOLICITED socket drop (tab switch, network blip, laptop sleep, half-open reap) no longer silently detaches the frontend from a still-running session. Previously the reconnect neither re-issued `session_load` nor preserved the cached session, so the relay reconnected but the session stream was dead: the UI froze on a stale tool call with "Abort" disabled and no "connecting"/"loading" hint while the agent kept working headless, recoverable only by reload. Now the auto-reconnect preserves the cached conversation, shows the resyncing banner during the backoff, re-attaches to the active session on open, and restores the true streaming state (re-enabling Abort) from the server.
895
+ - Added `vitest` to the `client` package with unit tests covering the create watchdog, the suspend/resume-keeps-session invariants, and unsolicited-reconnect re-attachment.
896
+
897
+ ## 0.4.3
898
+
899
+ ### Patch Changes
900
+
901
+ - 326f8a2: Fix duplicate parallel sessions when switching between the CLI and the web frontend.
902
+
903
+ Root cause was a pi SDK version skew: the standalone server and the CLI-bridge extension were pinned to `@earendil-works/pi-coding-agent@^0.75.3`, while the user's `pi` binary had moved to 0.80.x. pi >=0.80 canonicalizes the cwd (resolving trailing slashes and `.`/`..` segments) before encoding the session directory name, whereas <0.80 encoded the raw cwd. Because the server keys its in-memory session map by the session file path, the 0.75-built server and the 0.80 CLI produced two different path strings for the same logical session, so the browser and the terminal ended up attached to two separate tracked sessions.
904
+
905
+ Changes:
906
+ - Bump the server and extension to `@earendil-works/pi-coding-agent@^0.80.3` (and pin `@earendil-works/pi-ai` to `^0.80.3`) so both sides use the same session-directory encoding as a modern pi CLI.
907
+ - Harden the pool against any future version skew: a new `normalizeSessionFile()` canonicalizes the session file path at every map-key boundary (`registerCliSession`, `unregisterCliSession`, `handleCliEvent`, `getSession`, `loadSession`, `createNewSession`, and the active-session lookup in the session listing), so a CLI-reported path and a server-computed path converge on one key regardless of trailing slashes, `.`/`..` segments, or an SDK mismatch.
908
+
909
+ ## 0.4.2
910
+
911
+ ### Patch Changes
912
+
913
+ - e132f93: Make installed PWAs pick up new versions, and add a Reload button to the connection settings panel.
914
+
915
+ An installed PWA is a hash-routed SPA and almost never issues a `navigate` request, so the service worker's skipWaiting-on-navigate trick never fired and a freshly deployed worker stayed stuck in the `waiting` state. The idle-gated update check also rarely ran right after a relaunch, so the "new version available" popup never appeared. The service worker registration now calls `registration.update()` immediately and on every `visibilitychange` to visible (relaunch / tab re-show), so the manual update popup is surfaced. The manual popup is kept (no silent auto-update).
916
+
917
+ Also adds a Reload button to the web app's connection settings panel for forcing a fresh page load.
918
+
919
+ ## 0.4.1
920
+
921
+ ### Patch Changes
922
+
923
+ - 81c552f: Add an automated npm publish (approve) flow via Changesets and GitHub Actions. Landing a changeset on `main` opens/updates a "Version Packages" PR; approving and merging that PR builds every package and runs `changeset publish` to npm. Publishing uses npm Trusted Publishing (OIDC, no `NPM_TOKEN`) with provenance, so each published package (`wherever-dev`, `@wherever-dev/client`, `@wherever-dev/pi`) must register this repo + `release.yml` as a trusted publisher. Adds `build:all` (builds `client` first so the extension resolves it, then the web/server/extension bundle with the web UI embedded into `server/public`, then `vscode`) and a `release:ci` script for the workflow.
924
+ - 074af64: Fix uploads failing with "No active session" after using the file picker / camera. Opening a native file picker backgrounds the page and fires `visibilitychange: hidden`. If the user took longer than the 8s background-suspend delay (e.g. taking a photo or browsing files), the suspend timer tore down the session, so the upload that ran on return failed. The visibility handler now skips scheduling a suspend while a native file picker is open, and clears that guard when the picker closes (file selected, cancelled, or the page returns to the foreground).
925
+ - cf11972: Stop silently losing (or wrongly queueing) a message sent right after returning to a backgrounded/idle tab.
926
+
927
+ Two related failures, both rooted in the suspend/resume-on-background path:
928
+ - Lost message: `send()` silently dropped any frame issued on a non-OPEN socket (null / CONNECTING / CLOSING / half-open), so a message typed during the reconnect+resync window rendered locally but never reached the server and was gone after reload. `send()` now reports whether the frame actually went out, and `sendMessage()` checks the real socket `readyState` (via `getIsConnected()`, not the laggy store `connected` flag) and only commits the local echo + clears the error after the frame is confirmed sent; on failure it surfaces a recoverable "not connected, your message was not sent" error, ensures a reconnect is scheduled, and returns `false`. `sendMessage()` now returns a success boolean so the composer only clears the textarea on a real send: a dropped send keeps the typed text intact for retry instead of losing it.
929
+ - Cannot send while disconnected + clear status: the chat composer is now disabled when the socket is not connected (previously only gated on having a session, so you could press send into a dead socket). The placeholder and the existing status line now show "Reconnecting to remote server..." / "Disconnected - cannot send" so the connection state is visible.
930
+ - Wrongly queued, never drained: `isStreaming` could stay stuck `true` across a suspend/resume (the `agent_end` that would clear it arrives on the now-dead socket), so the composer queued the next message as if the agent were still busy, and the queue never drained. `suspend()` now clears the stale `isStreaming` (the authoritative value is re-established by `session_created` on rejoin), `disconnect()` cancels any pending `agent_end` clear timer so it cannot fire against a fresh connection, and the composer only queues when streaming AND connected (and only auto-drains the queue when connected), falling through to a clear error otherwise.
931
+
932
+ - 605693a: Fix the sidebar getting stuck on "Loading session..." when switching sessions, where the previous session would close but the sidebar stayed open over a hanging spinner and tapping other sessions appeared to do nothing.
933
+ - client: add an atomic `switchSession()` that leaves the current session (if any) and loads the target in a single step. The UI previously did `leaveSession()` then `joinSession()` separated by a 100ms `setTimeout`; that gap could strand the loading state if a tap landed mid-switch or a leave's follow-up load never fired. `switchSession()` always (re)arms the load watchdog for the new target, so a superseded or lost load can never strand the UI and the latest tap always wins.
934
+ - client: shorten the session-load watchdog from 20s to 12s so a genuinely stuck load surfaces a recoverable error (and frees the UI) sooner.
935
+ - web: the sidebar now closes as soon as a load is in flight (loading/resync), not only once the session id is set. A stalled load no longer leaves the sidebar open on top of the spinner.
936
+ - web: the sidebar session click and the URL-hash change handler both use the atomic `switchSession()` path, removing the fragile leave -> setTimeout -> join dance.
937
+
938
+ - f9080e1: Fix a "Loading session..." spinner that could hang forever, and stop losing a typed message during session resync.
939
+
940
+ Stuck loading state (hash auto-join, sidebar selection, and tab-return after >8s):
941
+ - web: only take the resume (preserve-cache, rejoin-in-place) path when a session was actually suspended; otherwise do a plain `connect()` so the hash auto-join drives the load.
942
+ - web: make the hash auto-join self-healing by gating on live state (active session id + loading/resync flags) instead of a latched guard that connect/disconnect churn could strand, and debounce the join via a single tracked timer.
943
+ - client: add a session-load watchdog. The loading/resync flags are set the moment a `session_load` is issued and cleared when `message_history` (or an error/conflict/disconnect) arrives; if none ever comes back (a lost reply, a half-open socket, or any unforeseen edge), the watchdog now clears the flags and surfaces a recoverable error instead of spinning forever. Armed for the sidebar/hash join and the resume-on-reconnect path alike.
944
+ - client: add `hasSuspendedSession()` so callers can choose resume vs. plain connect.
945
+
946
+ Lost message draft during resync:
947
+ - web: keep the composer (ChatInput) mounted during reconnect/resync instead of swapping it for a status line, showing a thin "Reconnecting and syncing session..." banner above a disabled input so the in-progress text stays in the live DOM.
948
+ - web: also persist the draft to localStorage and restore it on (re)mount, so the typed message survives even a full unmount or reload. The draft is cleared automatically on a successful send. Drafts are scoped per session, with the no-session search composer getting its own shared draft: switching contexts does not carry text over (the box swaps to the target's own draft, or empties), and returning to a session (or back to search mode by closing the session or hitting the search button) brings its draft back.
949
+
950
+ - caabb92: Keep the session cached when the tab is backgrounded instead of reloading it on return.
951
+
952
+ Previously, backgrounding the tab disconnected and reset the whole client state, so coming back re-fetched and re-rendered the entire session (a visible "reload"). Now the connection is suspended without dropping the cached messages/session: the client records the active session, reconnects preserving the store, and rejoins+resyncs that session in place.
953
+
954
+ While reconnecting and resyncing, the composer is replaced by a "Reconnecting and syncing session..." status line so no message can be sent until the socket is back and history has resynced.
955
+
956
+ Also fixes the session error banner: long error text now wraps and scrolls within a bounded area instead of pushing the dismiss (X) button off-screen.
957
+
958
+ - 613f439: Show the app build version next to the "Connected" indicator in the web frontend. Uses SvelteKit's built-in `version` (already wired to the git short hash, with a `-dirty` suffix when the tree has uncommitted changes), rendered right-aligned in a muted monospace style so you can tell at a glance which UI build is loaded.
959
+
960
+ ## 0.4.0
961
+
962
+ ### Minor Changes
963
+
964
+ - 2b72232: Render assistant chat messages as markdown, and fix two text-selection/copy problems in the chat (most visible on mobile Firefox).
965
+ - **Markdown rendering**: finalized assistant messages now render GFM markdown (headings, lists, bold/italic, links, inline and fenced code, tables, blockquotes) with a dark, compact style scoped to `.markdown-body`. Parsing is done with `marked` and sanitized with `DOMPurify`. Links open in a new tab with `rel="noopener noreferrer"`.
966
+ - **Copy while streaming**: a finalized assistant message is now parsed once and its DOM stays stable, so a text selection inside it survives instead of being collapsed on every token. While a message is still streaming it renders as plain text (no markdown re-parse per token), and only the live, bottom message keeps mutating.
967
+ - **Selection spilling into the chrome**: a drag-select that started in a message bubble and reached the viewport edge could extend into the top bar / sidebar / toggle bar and copy the whole page. The app chrome is now marked non-selectable (`.app-chrome`) and message content is explicitly selectable (`.chat-selectable`), keeping a selection contained to the message.
968
+
969
+ - 3a430c7: Show context-window usage in the session top bar, like the pi CLI (e.g. `11.3% / 1.0M`).
970
+
971
+ The dashboard now surfaces how much of the model's context window the active session is using, next to the model indicator. It updates live as turns complete and when the model changes.
972
+ - **Server-managed sessions:** the server reads usage from pi's `AgentSession.getContextUsage()` and broadcasts a new `context_usage` message after each turn / message / model switch, and includes an initial snapshot on `session_created`.
973
+ - **CLI-bridged sessions:** the server cannot run the agent, so the pi extension forwards its `ctx.getContextUsage()` on `agent_end` and model change; the relay caches and broadcasts it the same way.
974
+ - **Display:** percentage of the context window used over the humanized window size (`1.0M`, `200K`, ...), matching the pi CLI. Right after compaction (when token count is momentarily unknown) it shows `– / <window>`. The value clears when leaving a session.
975
+
976
+ - 2aee118: Add a `sessions.readOnly` config option and a separate, observe-only Read-only sessions page.
977
+
978
+ Building on `sessions.ignore` (which fully hides + skips folders), `sessions.readOnly` takes the same glob syntax but treats matching folders differently: they are **hidden from the main session list** (and, like `ignore`, skipped before their file bodies are read on the main view, so they do not slow it down), yet remain viewable on a dedicated **Read-only sessions** page reached via a link in the sidebar.
979
+
980
+ ```json
981
+ { "sessions": { "ignore": ["/tmp/**"], "readOnly": ["~/.agent-runner/**"] } }
982
+ ```
983
+
984
+ This is aimed at autonomous agent fleets (e.g. `agent-runner` working directories) you want to watch but not drive:
985
+ - `GET /sessions?view=readonly` returns only the read-only folders, each tagged `readOnly`.
986
+ - The Read-only page reuses the session browser but hides the create form and all delete controls.
987
+ - Opening a read-only session is **forced read-only end-to-end**: the server sets the client read-only (so `message` sends are refused) and reports it in `session_created`; the dashboard then hides the composer entirely, showing an "observing only" notice.
988
+
989
+ When `sessions.readOnly` is empty or omitted, behaviour is unchanged.
990
+
991
+ ### Patch Changes
992
+
993
+ - f3c6c43: Add a client-side stale-socket liveness watchdog so a half-open WebSocket to the relay no longer hangs the connected agent forever.
994
+
995
+ A half-open TCP connection (peer vanished without a clean FIN/RST: relay restart, network blip, dropped upstream) leaves the socket in `ESTAB` and fires neither `close` nor `error`, so the client's existing reconnect machinery was never triggered and the agent waited on the dead socket indefinitely (recoverable only by restarting the relay). `WhereverClient` now:
996
+ - records `lastInboundAt` on every inbound frame (any frame, including the `pong` reply, counts as proof of life);
997
+ - runs a periodic app-level `{type:'ping'}` keepalive so a healthy connection stays warm even during long, token-less model turns;
998
+ - runs a watchdog that, when the socket has been silent past a threshold (~60s, comfortably above the keepalive interval), forcibly `terminate()`s/`close()`s the dead socket and calls the existing `scheduleReconnect()`.
999
+
1000
+ This reuses the existing exponential-backoff reconnect logic (the only thing missing was the trigger), so a wedged agent now self-heals in ~60s by reconnecting instead of requiring a manual relay restart. The watchdog timers are torn down on `close`/`disconnect`, and the socket is nulled before `terminate()` so the normal `close` handler does not double-fire a reconnect. Implements Slice A of `work/observations/ws-half-open-connection-hangs-agent-no-heartbeat.md`.
1001
+
1002
+ - dff6a44: Move the context-window usage indicator (e.g. `11.3% / 1.0M`) from the top bar to the bottom toggle bar, next to the Hide Thinking / Hide Tools toggles, and let that bar wrap onto a second line on narrow screens so nothing gets squeezed off.
1003
+ - 94cb06c: Fix session selection showing the "New Session Started" empty state and not scrolling to the bottom while an existing session loads.
1004
+ - Added a dedicated `loadingSession` state flag that is set the moment a `session_load` is requested and cleared when its `message_history` (or an error/conflict/disconnect) arrives. This distinguishes "opening an existing session" from "a brand new empty session", so the chat view now shows a "Loading session..." spinner instead of "New Session Started" during the gap between the `session_created` and `message_history` websocket messages.
1005
+ - Scroll-to-bottom now also fires on the `loadingSession` true→false edge (when the history actually renders) using a settle loop across a couple of animation frames plus delayed retries, so freshly opened sessions reliably land at the bottom even when tall markdown/code content keeps growing for a few frames after mount.
1006
+
1007
+ - 6c036d9: Add a server-side WebSocket heartbeat that reaps dead/half-open relay connections.
1008
+
1009
+ A half-open TCP socket (peer vanished without a clean FIN/RST: process restart, network blip, dropped upstream) stays in `ESTAB` and fires neither `close` nor `error`, so the relay never noticed the dead agent and its session was left dangling forever. The relay now sends a protocol-level ping frame to every connection on a fixed interval (30s) and `terminate()`s any socket that did not answer the previous ping. Because `terminate()` fires `close`, this routes through the existing teardown (`unregisterCliSession` / `removeClient` + `broadcastSessionsUpdated`), so a reaped agent's session is released rather than left hanging. The interval is cleared on `wss` close and on shutdown.
1010
+
1011
+ Pairs with the client-side stale-socket watchdog (Slice A): the server reaps its own view of the dead connection while the client self-heals by reconnecting. Implements Slice B of `work/observations/ws-half-open-connection-hangs-agent-no-heartbeat.md`.
1012
+
1013
+ - 9db52f1: Add a `sessions.ignore` config option to exclude session folders from the dashboard list and speed up `/sessions`.
1014
+
1015
+ The session list was built by reading and JSON-parsing **every** session file on disk on every `/sessions` request (to compute each session's first-message preview). With hundreds of sessions, including large piles of throwaway agent scratch sessions (e.g. under `/tmp`), this made the list noticeably slow to load.
1016
+
1017
+ You can now set, in `~/.wherever/config.json`:
1018
+
1019
+ ```json
1020
+ { "sessions": { "ignore": ["/tmp/**", "~/.agent-runner/**"] } }
1021
+ ```
1022
+
1023
+ Any session whose resolved working directory matches one of these globs is excluded from the list. Crucially, because all sessions in one on-disk folder share a working directory, a matching folder is detected by reading only its first file's header (not its body) and is then **skipped before its file bodies are read**, so ignored sessions no longer cost anything to scan. Globs support `*` (does not cross a path separator), `**` (crosses separators), and `?`; `~` is expanded to home; and a pattern ignores both the directory itself and everything nested under it. When `sessions.ignore` is empty or omitted, behaviour is unchanged (the existing fast path is used).
1024
+
1025
+ - e1f9601: Shrink and de-thrash the `/sessions` payload so the dashboard loads fast with many sessions.
1026
+
1027
+ The session list shipped the **entire, untruncated first message** of every session (often huge: pasted prompts, PRDs, specs), even though the sidebar only renders a ~40-char snippet. With hundreds of sessions this made `/sessions` multi-megabyte and slow, and it was refetched aggressively.
1028
+ - **Server (shrink):** `listSessions()` now caps `firstMessage` to a short, whitespace-collapsed preview (160 chars) at a single choke point, so every listing path ships a small preview. The field name is unchanged (now documented as a capped preview); the sidebar's display and filtering work as before. Measured against a real ~900-session store, the first-message portion of the payload dropped roughly 33x (multi-MB to ~140 KB).
1029
+ - **Web (de-thrash):** `fetchSessions()` no longer runs two fetches at once, collapses any requests arriving while a fetch is in flight into a single trailing re-fetch, and caps its debounce so a continuous stream of `sessions_updated` events (one per agent turn) can no longer pull the whole list repeatedly or postpone the fetch indefinitely.
1030
+
1031
+ This composes with the `sessions.ignore` / `sessions.readOnly` options (which cut how many sessions are scanned/listed at all): together the default session list is now small and quick to load.
1032
+
1033
+ - 123b6a3: Add a per-turn transport-stall timeout and liveness observability to the WebSocket relay.
1034
+
1035
+ Builds on the stale-socket watchdog (Slice A) and server heartbeat (Slice B):
1036
+ - **Per-turn stall timeout (client).** While a turn is streaming, the watchdog now uses a shorter deadline (`TURN_STALL_MS`, 45s) than the idle stale-socket threshold (60s). The keepalive pong should keep traffic flowing during a turn, so this distinguishes a merely slow model (heartbeat still arriving, not stale) from a dead transport (heartbeat stopped). On a mid-turn stall it surfaces a recoverable `sessionError` ("Connection to relay stalled mid-turn; reconnecting...") and clears `isStreaming` before reconnecting, instead of silently parking mid-stream.
1037
+ - **Idempotent re-register on reconnect.** Confirmed already handled: the extension re-sends `cli_register` on every `connected` state edge, which the watchdog reconnect re-triggers, so a vanished-and-returned client re-attaches cleanly.
1038
+ - **Observability (pi-remote half).** The client logs stale-socket teardowns, reconnect attempts, and successful reconnects; the server logs each reaped dead socket with its client/session context. A hung agent now shows up as an event rather than as silence.
1039
+
1040
+ Implements Slice C and the pi-remote half of Slice D of `work/observations/ws-half-open-connection-hangs-agent-no-heartbeat.md`. The `agent-runner` wrapper change in Slice D is intentionally left to the agent-runner repo.
1041
+
1042
+ ## 0.3.0
1043
+
1044
+ ### Minor Changes
1045
+
1046
+ - a0a6adc: Reuse the chat composer as the search composer instead of a separate top-bar input.
1047
+
1048
+ ChatInput is now mode-aware via props (onSubmit, placeholder, submitLabel, showAttach, searchMode, searchConfigured). In search mode it routes submit to the injected handler (runSearch), is enabled with no active session (requires only a live connection and a configured search folder), shows the "Search the web..." placeholder and "Search" button, hides file attach, and skips slash-command handling. The mic, autosize, and Shift+Enter behaviour are kept in both modes.
1049
+
1050
+ On the page the inline single-line top-bar search input is removed. The always-mounted bottom composer becomes the search composer in the empty state (connected, search folder configured, no active session), which is also the page-load state, so users can type directly. When a session is active, a compact magnifier button in the top bar drops back to the search empty state and focuses the composer synchronously inside the tap gesture so the mobile virtual keyboard rises (notably on iOS Safari). Only one search input is ever shown at a time.
1051
+
1052
+ Also fixes a bug where a search query was silently dropped: the client runs app message listeners before its internal state update, so sending the pending query directly from the session_created handler hit sendMessage while sessionId was still null. The query is now deferred to a microtask so the session is fully established first, and the magnifier clears the URL hash synchronously to avoid flashing the "Loading session..." spinner.
1053
+
1054
+ - 242b652: Add a web "search mode". A search bar in the dashboard top bar (visible when connected and a search folder is configured, autofocused on first load) creates a fresh session in the configured search folder and sends the query as the first message, returning a current, cited answer. New `searchFolder` and `searchCreateRemote` config keys (in `~/.wherever/config.json`) are exposed via `GET /config`; the search folder is created on demand on first search, with a private remote when `searchCreateRemote` is enabled and a matching remote rule exists. The reusable web-search skill (in `skills/web-search`) drives the same behaviour from the terminal via the companion `pisearch` installer.
1055
+
1056
+ ### Patch Changes
1057
+
1058
+ - 37de34b: Extract core client WebSocket and state management logic into a dedicated, framework-agnostic `@wherever-dev/client` monorepo package. Update both the web dashboard (`@wherever-dev/web`) and the CLI extension (`@wherever-dev/pi`) to use the new shared client, reducing duplicate code and establishing a modular architecture for future integrations.
1059
+ - ffd28c7: Improve resume behaviour after the page is backgrounded (notably Firefox on Android after a screen lock). The dashboard now closes its WebSocket after the page has been hidden for a short delay and reconnects immediately on return, improving back/forward-cache eligibility (so resume can be instant) and ensuring that, when a full reload does happen, the active session is restored quickly from the URL hash. Quick tab switches do not churn the connection.
1060
+ - ffd28c7: Fix stale data on first load: the service worker no longer serves cached responses for dynamic server API endpoints (`/sessions`, `/config`, `/models`, `/check-path`, `/autocomplete-path`, `/session/*`, `/health`), which are now fetched online-first. App-shell navigations are also served online-first so a freshly deployed build is picked up without needing a second reload. Hashed assets and images remain cache-first for offline support.
1061
+ - ffd28c7: Fix: unqueuing a queued message now restores its text into the editable input (so it can be edited or resent) instead of silently discarding it. Previously `Unqueue` cleared the input even though a backup of the message existed.
1062
+ - 40c88c7: robust againt invalid session file
1063
+ - ee52ff4: Improve Lighthouse scores for the dashboard PWA.
1064
+ - Web: stop shipping un-minified production assets. The Vite build had an
1065
+ inherited `minify: false` override which left JS/CSS unminified, roughly
1066
+ halving the largest chunk's size and fixing slow First/Largest Contentful
1067
+ Paint. Sourcemaps stay enabled for debuggable production stack traces.
1068
+ - Server: set `Cache-Control` headers when serving static files. Content-hashed
1069
+ `/_app/immutable/` assets are served `public, max-age=31536000, immutable`;
1070
+ the HTML app shell, manifest and other top-level files stay `no-cache` so a
1071
+ freshly deployed build is always picked up. This fixes the "efficient cache
1072
+ lifetimes" audit without affecting the service worker's own caching.
1073
+ - Server: add `.txt` and `.webmanifest` MIME types so robots.txt is served as
1074
+ `text/plain` and the manifest as `application/manifest+json` instead of
1075
+ `application/octet-stream`.
1076
+ - Web: add a minimal valid `robots.txt` so the SPA fallback no longer returns
1077
+ the HTML app shell for `/robots.txt` (which Lighthouse flagged as invalid).
1078
+ Wherever is a private Tailscale-only tool, so it disallows all crawlers.
1079
+
1080
+ - affc7cf: PWA: make the installed icon resolve correctly on Firefox Android. Regular icons now carry an explicit `purpose: "any"` (some Firefox versions otherwise fall back to a generated letter icon), and maskable icons are generated at both 192 and 512 (Firefox prefers a maskable at the launcher size). Firefox still overlays its own small badge on installed-PWA icons, which is a browser behaviour and not controllable from the manifest.
1081
+ - eb0cfd0: PWA polish: the installed app icon is now generated from the Wherever logo (`logo.svg`) instead of the old placeholder, a properly padded `maskable` icon is generated (fixing the previous broken/missing maskable icon reference), and the manifest now declares desktop (`wide`) and mobile screenshots so Chrome offers its richer install UI. Icon/screenshot assets are produced at build time via a post-process step from committed sources under `static/pwa-src/`.
1082
+ - 7b2ca04: PWA: set the web manifest `display` to `standalone` (was the pwag default `fullscreen`) and give the app a real identity (`name`/`title` "Wherever" with a proper description) instead of the template placeholder. This makes the installed app launch in its own window rather than a normal browser tab on browsers that honor `standalone`.
1083
+ - 347e214: Removed all architecture overview diagrams and explicit references to "pi CLI" from the website landing page to simplify the landing page experience and remove any installation dependencies on pi or the CLI extension for typical dashboard users.
1084
+ - a57e137: Rephrased website landing page copy, app description, and user onboarding elements to focus on building and maintaining apps "from wherever" (on any device), shifting the AI component to an implementation detail and correcting references from "mirroring terminal" to "syncing sessions and conversations".
1085
+ - ffd28c7: Speed up loading of long sessions with tail-first history windowing. On load/join, the server now sends only the most recent messages (with a total count and offset) instead of the entire history in one payload, and the web dashboard shows a "Load older messages" button that lazily fetches earlier windows (with scroll-position anchoring). This adds `history_load_more` / `message_history_prepend` to the protocol and a `loadMoreHistory()` method plus history pagination state to `@wherever-dev/client`.
1086
+ - fd8427d: Updated documentation and the landing page to clarify that installing the `pi` CLI is optional and not required to run Wherever in Headless Mode. Added notes detailing the architectural limitation where quitting/killing the `pi` CLI in Bridge Mode interrupts active sessions and running tools.
1087
+
1088
+ ## 0.1.0
1089
+
1090
+ ### Minor Changes
1091
+
1092
+ - 76522ac: Add standalone marketing/info website for GitHub Pages deployment. The new `site/` folder contains a SvelteKit + TailwindCSS static site with a landing page featuring hero section, features grid, architecture diagram, install guide, and footer. Includes a custom SVG logo with a pi symbol made of tetris-like blocks and signal waves. Deployed automatically via GitHub Actions workflow on push to main.
1093
+
1094
+ ### Patch Changes
1095
+
1096
+ - bb36b59: Automatically expand shell/bash command tool calls in the remote web dashboard when the user executes a prompt starting with "!" or "!!".
1097
+ - 8626cd3: Automatically update the session browser list in the sidebar in real time whenever a session is created, loaded, left, when client connections open or close, and when messages or agent cycles end.
1098
+ - 26cba7b: Add toggles for hiding tool calls and thinking messages in the chat UI.
1099
+ - e5fae9d: Maximize available horizontal space in the header for the workspace folder path by displaying the agent status (Ready vs. Agent working) directly on the robot model selector icon, removing the redundant text status indicators.
1100
+ - e87ab30: Add "Hide thinking steps" and "Hide tool calls" options in the config UI to clean up the chat log. "Hide tool calls" keeps tool execution blocks visible if they are associated with explicit user terminal commands starting with `!` or `!!`.
1101
+ - bb0bc3d: Normalize `cwd` paths in the server's session pool before creating, loading, or registering sessions. This resolves duplicate session folders when a workspace is accessed with vs. without a trailing slash (e.g. `--home-wighawag...--` vs `--home-wighawag...---`), fragments conversation history, and handles relative segments and double slashes.
1102
+ - 01e6641: Fix the `/new` / `session_new` command on the server so that it successfully creates a brand new, clean session instead of returning the existing active session when the requesting client is already connected to it.
1103
+ - 0630cff: Add a full-screen loading overlay on the main screen during session creation. This prevents users from initiating multiple simultaneous session creations and provides visual feedback during the creation delay.
1104
+ - afe5ebc: Change sessions in the sidebar session browser to standard anchor links, allowing users to middle-click, command-click, or right-click to open sessions in new tabs.
1105
+ - 70a974a: Configure both `web` and `site` packages for static site pre-rendering by setting `prerender = true` (in page/layout routing) and removing `fallback: 'index.html'` from the svelte static adapter configs. This enables SvelteKit to generate correct, portable relative-path references in the built HTML files, allowing the dashboard and marketing website to load perfectly under subpaths or IPFS gateways.
1106
+ - ae04a3c: Redesign the remote web dashboard to match the brand design system and colors of the marketing website, introducing brand-dark, brand-surface, brand-border, emerald, and rose theme tokens across all UI components, dialogs, inputs, and layout blocks.
1107
+
1108
+ ## 0.0.4
1109
+
1110
+ ### Patch Changes
1111
+
1112
+ - 393e8aa: update to port 31415
1113
+
1114
+ ## 0.0.3
1115
+
1116
+ ### Patch Changes
1117
+
1118
+ - e54e697: Allow users to collapse folders in the session browser even when a filter query is active, with automatic reset of search-specific folder expansions when clearing the search query.
1119
+ - 948ad33: fix: show full folder path under folder name in session sidebar
1120
+
1121
+ When multiple directories share the same basename (e.g. `/home/user/wighawag`
1122
+ and `/home/user/projects/wighawag`), they appeared as separate groups with the
1123
+ same visible name, making them indistinguishable. Now the full resolved path is
1124
+ shown in smaller gray text beneath the folder name for easy differentiation.
1125
+
1126
+ - 14f1269: Show queued message text in input box as greyed-out italic text when agent is streaming
1127
+
1128
+ When a message is queued (sent while agent is working), the text is now visible in the disabled textarea in a grey italic style instead of being hidden. Unqueueing clears the text and re-enables editing. Also added a refresh button (↻) next to the session filter in the sidebar to manually refresh the session list, with a spinning animation while loading.
1129
+
1130
+ - d319cfd: Fixed session list issues in the sidebar:
1131
+ - Fixed duplicate folder entries by properly resolving path representations (like expanding ~ and relative paths) consistently on the server.
1132
+ - Added keyed loops in Svelte `#each` blocks to make session list rendering reactive and prevent unnecessary DOM rebuilds.
1133
+ - Debounced `fetchSessions()` calls to coalesce rapid concurrent requests during bulk operations.
1134
+ - Added a "Delete All" button inside each folder's expanded session list to delete all sessions of that folder at once.
1135
+ - Prevented visual reloading/layout-flashing by keeping the existing list visible during background refreshes, only displaying the loading spinner on initial load when the folder list is empty.
1136
+
1137
+ - a697a2d: Ensure model choices are preserved across page reloads, server restarts, and synchronized dynamically between web and CLI.
1138
+
1139
+ Specifically:
1140
+ - Fixed an issue where the model resolved to the first (oldest) model_change entry on session reload/restart instead of the most recent one.
1141
+ - Added model_select event propagation so that changing the model in a CLI session dynamically updates any connected web client.
1142
+ - Added support in the CLI bridge extension to receive and apply model changes initiated from the remote web dashboard.
1143
+
1144
+ ## 0.0.2
1145
+
1146
+ ### Patch Changes
1147
+
1148
+ - 2b2a81e: Add the ability to send images and documents by uploading them to a configurable server-side folder and appending their absolute paths to the user's message so the agent can read and process them.
1149
+ - dda50b5: Add hint on the main screen stating that the sidebar can be used to open existing/running sessions.
1150
+ - format files
1151
+
1152
+ - 4859ae8: remove empty message from the conversation
1153
+ - 1ae3216: Compress session list folders by default and support inline session deletion with double-confirmation, syncing state instantly across all clients. Fix mobile browser layout issues on Firefox by locking page overscroll and constraining container layout to visual viewport boundaries.
1154
+ - 696abee: auto-completion path
1155
+ - 66f8354: common folder
1156
+ - e890743: Add support for executing bash commands directly from the Svelte web frontend using the `!` prefix (e.g., `!ls`, `!!git status`), matching the pi CLI's interactive behavior.
1157
+ - Intercepts prompts starting with `!` or `!!` on the server and runs them through the active AgentSession's executeBash or forwards them as `cli_bash` messages to the CLI bridge client.
1158
+ - Streams tool execution chunk updates back to the Svelte client in real-time.
1159
+ - Captures output and exit status and persists them to the session log as a `bashExecution` history message.
1160
+ - Supports raw output streaming of direct shell command executions.
1161
+
1162
+ - ce9aff8: Document all advanced features in the main README and enrich the USAEG guide with HTTP endpoints and WebSocket events.
1163
+ - 002e622: fix abort on reload
1164
+ - 49bc222: better side bar
1165
+ - bf81616: git remote repo creation
1166
+ - 2a1466a: speech api
1167
+ - b8acc26: Improve speech recording feedback and reliability:
1168
+ - Transition from `MediaRecorder` to direct `AudioContext` / PCM buffer capture for instant, zero-latency WAV creation.
1169
+ - Add an audible synthesizer beep / chime on recording start for clear user feedback.
1170
+ - Introduce an explicit `isProcessing` state during local downsampling and cloud transcription to replace the red pulsing mic indicator with an orange processing indicator.
1171
+ - 0a6f84e: remove empty message from the conversation and fix url hash persistence
1172
+ - 99c1afa: Remove the clear button from the chat list and add a way to collapse the text input bar for easier reading on mobile. Clicking the collapsed bar expands the input and automatically focuses the textarea.
1173
+ - ba41c2a: better enter keys for send
1174
+ - 5ba8fd3: add option to upload via normal post request
1175
+
1176
+ ## 0.0.1
1177
+
1178
+ ### Patch Changes
1179
+
1180
+ - first release