Commit Graph

3679 Commits

Author SHA1 Message Date
Teknium
b5a73d46a0 fix(gateway): a Desktop-started macOS gateway keeps LAN access after Desktop quits
macOS Local Network Privacy attributes a process to its responsible app. The gateway that
`hermes gateway ensure` (Desktop's launch path, CLI clients) and the update-time restart
watcher start is a plain detached child, so it is attributed to whichever app started it.
The gateway outlives that app by design; once the app quits, macOS holds every surviving
descendant responsible for itself, and a bare venv Python is denied: every connect to a
model server on another machine fails with `[Errno 65] No route to host`, even though Hermes
is allowed in Local Network settings. Reported in Discord: Test and chat against a LAN Ollama
broke on every Desktop quit/reopen and after in-app updates, and worked only with a gateway
run from Terminal or the installed launchd service (which already runs through osascript,
#71206).

On macOS both spawn sites now start the gateway as a one-off launchd job through the same
osascript JXA wrapper the installed service uses, so osascript (an exempt Apple platform
binary) stays the responsible code for the gateway's whole life. Nothing is installed: the
plist is loaded once and deleted, it never lives in ~/Library/LaunchAgents, has no KeepAlive
and is labelled outside ai.hermes.* so no fleet scan or restart route mistakes it for a
service; the gateway sees XPC_SERVICE_NAME=0 and still reads as unsupervised. When launchd
refuses the job (no GUI session, e.g. over SSH) the old plain-child spawn runs instead.
2026-10-25 23:19:22 -07:00
Teknium
c2383a6806 feat(compression): one prepared summary per compaction, newer messages join the tail
Maintainer ruling on the prepared-compaction design, plus the review findings
(ours and Greptile's) on #144684:

- One pass per compaction. The extension passes (a new summary call every ~8k
  tokens of growth) and the "stale after one tail budget" check are gone: the
  summary splices at its own boundary and every message after it, however
  many, stays verbatim in the tail. No second summary is ever paid for.
- The splice check compares message structure, not text: role, tool call
  ids/names, tool result ids, plus the durable message_uid where both sides
  carry one. Plugins that rewrite text in place (redaction, pre-compaction
  notes) no longer throw the summary away; a dropped/inserted message or a
  rewind into the window (new message_uids) still misses. This also settles
  the fingerprint gap on input_text/output_text parts: text is not compared.
- A pass that recovered on the main model after the summary model failed now
  hands that over on a splice, as an inline call would: summary_model goes
  sticky to the main model, and the "configured compression model failed"
  warning reaches the user. The attempt telemetry carries the pass's aux call
  (model, tokens, duration, fallback) and a new prepared_summary flag.
- The first compaction that needs memory-provider context stops further
  passes for the agent; each would have been discarded and paid twice.
- Turn-end passes are skipped for cron runs and delegated children, whose
  sessions end with the turn.
2026-10-25 22:55:11 -07:00
kshitijk4poor
d2d1824fdf feat(compression): wait for a running prepared-compaction pass at the threshold
When automatic compaction fires with no completed candidate but a pass is
still writing a summary whose window fits, compaction waited for nothing and
wrote the same summary again inline, so the user paid the full summary
latency and the background call was thrown away.

Compaction now waits for that pass. Each streamed chunk of the pass touches
the compacting thread's aux progress hook, so the host's idle watchdog treats
the wait like an inline summary stream. The wait ends at the host's stream
deadline (the compression aux timeout when none is installed) or when the
host cancels, and compaction then summarizes inline as before. A running pass
whose window no longer fits is not waited on. Annotations in the module and
its tests move to builtin generics.
2026-10-25 22:55:11 -07:00
Hugo Alves Pereira
32a636bc8d feat(agent): opt-in prepared compaction (compression.prepare_ahead)
With compression.prepare_ahead (default false), once the provider-reported
prompt size is within 12% of the context window below the compaction
trigger, the turn loop starts a background pass before a tool batch runs
and at turn end. The pass plans the same window compress() plans and runs
the same summariser on a copy of the compressor and of the window rows.
The pass itself never rewrites the live transcript, system prompt or
prompt cache; the transcript keeps growing normally meanwhile.

At the next automatic threshold compaction, compress() splices the
finished candidate when the head boundary is unchanged, its boundary is no
later than the fresh tail cut, and the transcript up to that boundary is
unchanged (ignoring what the no-LLM prune rewrites). Messages after the
candidate boundary stay outside the summarized region and go through the
existing tail handling. Everything else, including a pass that has not
finished, manual/focus compaction, overflow recovery and memory-provider
summary context, compacts inline as before. A running pass is never
waited on and loses the right to publish once compaction or a session
boundary overtakes it. A failed pass backs off further passes without
touching the live failure cooldown.

State is per compressor and in memory only. Plugin context engines, Codex
app-server, native Responses compaction, micro-compaction and
background-review forks are not prepared. With the flag off no state is
created and compress() takes its existing path.
2026-10-25 22:55:11 -07:00
unsupportedpastels
86fa3afdf4 fix(webapp): list clipboard reads and the wake word among what plain HTTP loses
navigator.clipboard is undefined on a plain-HTTP origin other than loopback, so the browser terminal pastes nothing, its right-click Paste stays disabled and pasting an image finds no clipboard image. The remote wake word uses getUserMedia like dictation and live voice.
2026-10-25 23:49:14 -04:00
unsupportedpastels
c7bf749b7b fix(webapp): warn in --status about the plain-HTTP address browsers open
The gateway reports its loopback dial origin, so the --status note never fired. Work out the
browser-facing address as webapp-launch does (webapp.public_url, else the LAN address Web Access
registered sign-in for) and print the note for that address.
2026-10-25 23:49:14 -04:00
unsupportedpastels
477937cfb8 fix(webapp): say what plain HTTP loses when the Webapp's address is not secure
Browsers keep secure-context APIs from a plain-HTTP origin that is not
loopback: crypto.subtle (the bot screen viewer), mediaDevices (dictation
and live voice) and Notification (system notifications). Nothing told
the user before they hit the missing feature.

hermes webapp and hermes webapp --status now print a note naming those
features and the way to keep them (HTTPS through webapp.public_url, or
an SSH tunnel to 127.0.0.1) when the address they open or print is
plain HTTP on a host other than localhost, *.localhost, 127.0.0.0/8 or
::1, which browsers already treat as secure. The Webapp docs list the
same features.

Refs #144648 (WA-14)
2026-10-25 23:49:14 -04:00
unsupportedpastels
395c673739 fix(webapp): point to --no-open when a private launch opened no visible browser
On macOS webbrowser.open can return True with no page the user sees: over SSH osascript opens the browser on the Mac's own screen, and a sandboxed browser may refuse a file: page in a hidden folder. After a private launch, say how to get the link. The docs no longer say an SSH session always prints the link: that holds on the BSDs and illumos. The private-launch docstring notes that on macOS the URL reaches osascript on stdin, so the page mainly protects the BSDs and illumos.
2026-10-25 23:32:04 -04:00
unsupportedpastels
975446bb88 fix(webapp): give a standalone profile its own Web Access port
A standalone profile that turned on Web Access without its own webapp.port bound 9120, which the default gateway's Webapp holds, so nothing was served and the LAN sign-in callback was registered on the other gateway's address. Start now gives such a profile the first port above 9120 that no other Hermes home claims and nothing listens on, and writes it to that profile's webapp.port, so the gateway binds it, the launcher prints and opens it, the callback names it, and it stays across restarts. The default profile keeps 9120, a webapp.port the user set is never replaced, and with no free port Start refuses and names the setting.

Refs #144648 (WA-13)
2026-10-25 23:32:04 -04:00
unsupportedpastels
166bc0f822 fix(webapp): open private launch links through a user-only page
Where nothing checks who redeems a one-use launch link (macOS, the BSDs, illumos, WSL), hermes webapp printed it, and any local user who read it first could redeem it within its 60 s. TCP loopback has no peer-credential call on those platforms. The launcher now writes the link into a 0600 page in the gateway home's user-only webapp folder and opens that page, so the browser launcher's command line carries only the page's path and nothing is printed. It still prints the link where it cannot open a browser and on WSL.

Refs #144648 (WA-12)
2026-10-25 23:32:04 -04:00
Teknium
3ae67dc3d6 fix(delegation): stopping a turn no longer kills background subagents
Ctrl+C, Esc, the Desktop/TUI Stop button, a message that interrupts and
an ACP cancel end the current turn. They also called
async_delegation.interrupt_for_session, so every background subagent the
session had dispatched died with the turn: one Ctrl+C took down a running
/review and both of its sub-reviewers. A background subagent is
independent of the chat that spawned it (Teknium ruling), so a turn stop
now hard-cancels only the turn:

- gateway SessionAuthority.interrupt (Desktop, Ink, classic CLI view,
  ACP-through-gateway, messaging interrupts, api_server run cancel)
- tui_gateway session.interrupt (legacy Desktop/TUI stop)
- acp_adapter cancel

The explicit /stop command still ends them (CLI and Ink process.stop,
gateway /stop busy and idle paths), and so does closing or resetting the
session. Reverses the turn-stop half of b71359066c and 659e55ac71d;
tests/gateway/test_canonical_stop_hard_cancel.py now pins the delegation
surviving a canonical Stop.
2026-10-25 18:33:24 -07:00
Teknium
d569365e87 fix(sessions): optimize-storage paces for a writer that opens state.db mid-run; failed runs exit 1
Review round (@yoniebans) on #144630:

- Pacing was decided once at start, so a writer that opened state.db after the
  run began (Desktop launched, gateway restarted) only got in through SQLite's
  own gaps (one append waited 16.7 s with wal_autocheckpoint=0, next to
  _execute_write's 20 s patience). _HolderWatch re-runs the same foreign-holder
  scan the held-store refusal and --force use (foreign_state_db_holders, ~15 ms)
  every 2 s on a side thread (copy_context, HX012); the chunk loop reads the flag
  and switches to the paced cycle (~50 ms chunks + max(0.2 s, 4x cost) pause)
  while a holder is there, back to unpaced when it leaves. A quiet run still
  never sleeps. The CLI's one-shot scan and yield_to_writers go away; progress
  lines say "paced: another process is using the database".
- A failed run (chunk kept failing, or "Could not optimize") now returns 1.
- Backfill progress counts messages (rows each window covered, total = rows at or
  below the high water), not ids: a 100k id gap no longer reads 0% then 99%.
- The CJK backfill gets its own phase/line ("Building CJK index") instead of
  overwriting the base pass's line with a lower percent.
- Teardown skips the per-table COUNT(*) when no progress callback is registered.
- Tests build the legacy store with both inline indexes (base + trigram), so the
  trigram rebuild and all 10 reclaimed tables run; exit code 1 is asserted in the
  disk-full test; one new test covers a holder appearing mid-run.
2026-10-25 18:25:29 -07:00
Teknium
6cf8173a2b fix(scratch): the detached prune spares the launcher's whole ancestry and fails closed
The detached pass got only the launcher's pid and ppid and walked their ancestry itself, ~40 ms
later (more under load). When both had already exited, the user's shell sitting in an idle
entry was no longer anyone's ancestor: it was TERMed and the entry deleted, where the inline
prune on main keeps both.

- The launcher computes its ancestry as (pid, create_time) pairs before it spawns the pass and
  hands them over; the pass spares a passed pid only while it still has that create time.
- A launcher that cannot compute it (no psutil, a process refusing inspection) hands over
  nothing: the pass signals no process and keeps every entry a live process works in.
- A process check that raises deletes nothing that pass (logged), instead of deleting with no
  ownership check; prune_scratch_dir's only production caller is now the detached pass.
- A failing pass leaves one line in scratch-prune.log (its stderr is /dev/null).
- tests: an autouse conftest fixture stubs spawn_prune per test, so a test that reloads
  hermes_constants no longer starts a real detached pass.
2026-10-25 17:50:36 -07:00
Teknium
b12b263157 fix(scratch): run the due scratch prune in a detached child so it always finishes
On a daemon thread the hourly prune died with every short-lived `hermes` command: the
stamp was already spent, so a run of quick commands could eat every hourly pass and
reclaim nothing, and a pass cut inside rmtree left a remainder the idle rule kept for
another 24 h.

The process that is due a pass now keeps the once-per-process flag and the hourly stamp
and hands the pass to a detached child (start_new_session on POSIX, the repo's Windows
detach flags with the no-breakaway retry). The child runs `python -I` on the launcher's
own sys.path with the scratch path the caller resolved, and calls prune_scratch_dir
directly: no hermes_bootstrap, no boot hook, no second prune, no re-resolved home. The
pass is the unchanged origin/main pass: same idle rule, re-check, reap and audit log.

The launcher's process tree stays the pass's own lineage after the child is reparented
(captured at child start): a shell working inside an idle entry that ran the Hermes
command still keeps that entry, as it did when the prune ran inline. A failed spawn is
logged at debug and dropped; the next process past the hourly mark retries.

The test conftest marks the once-per-process prune as done so no test starts a real
child (or feeds one to its Popen mock); the prune tests reset it.

Tests: the two daemon-thread tests become (1) the boot hook and the prompt build hand the
pass to exactly one child for the resolved (and routed) scratch dir, red on main; (2) a
real short-lived process exits at once and its detached pass still removes the routed
home's idle entry, leaving the launch home alone, red on the daemon-thread head.
2026-10-25 17:50:36 -07:00
Teknium
eefd03b3ee fix(scratch): no process start waits for the scratch-dir prune
get_scratch_dir(prune=True) ran the once-per-process idle scan and rmtree inline. Its first
caller in nearly every process is the boot hook (hermes_bootstrap -> export_scratch_tmp_env ->
apply_scratch_tmp_env), so `hermes`, the TUI backend, serve, gateway and every Hermes child sat
on the prune before doing anything: a 34 GB idle entry held one CLI start for 13 s.

The prune=True path now schedules the same pass on the scratch-prune daemon thread (the
background helper from the prompt-builder fix), so the boot hook, the post --profile re-export,
the child-env builders (apply_subprocess_home_env) and the system prompt all share one
non-blocking path; the prompt builder goes back to a plain get_scratch_dir(). The directory is
still created and permissioned before the call returns, so TMPDIR is valid at once. Stamp,
once-per-process flag, 24 h idle rule, reap and audit log are unchanged; the thread gets the
path the caller resolved.

A process that exits mid-prune kills the thread with the hourly stamp already touched: entries
it never reached go on the next hourly pass, and an entry cut inside rmtree waits 24 h (the
unlinks freshen its directory mtimes), the same as a Ctrl-C during the old inline prune.

Tests: the 3 prompt-builder tests become 2 invariants (boot hook + prompt never wait and prune
once on the resolved dir; the thread prunes the routed home's dir), both red on main.
2026-10-25 17:50:36 -07:00
Teknium
f219708926 feat(tts): fold voice search into text_to_speech's ElevenLabs schema (find_voices)
Teknium: the ElevenLabs variant of text_to_speech is where voice search belongs, not a
separate tts_voices tool. The ElevenLabs schema now carries voice_id plus a find_voices
object (text optional there); other providers' schema is byte-identical to main.

Live search findings folded in: the library is the default source and sorts by a year of
usage (most-used first); use_case (e.g. characters_animation) and sort filters; library
voices with a custom credit rate show credit_rate; the description tells the model the
library matches words literally, so a role word that finds nothing ('dwarf') falls back to
describing the sound ('gravelly old' + filters).
2026-10-25 15:58:23 -07:00
Teknium
c975831fbc feat(tts): let the agent pick ElevenLabs voices (voice_id + paginated tts_voices search)
With tts.provider: elevenlabs, text_to_speech gains an optional voice_id and a new
tts_voices tool searches the user's account voices (/v2/voices) or the public
Voice Library (/v1/shared-voices) with query/gender/age/accent/language filters and
an opaque next_page cursor. Both are gated on the ElevenLabs provider (dynamic
schema override + check_fn), so every other provider's surface is unchanged. A
per-call voice_id never rewrites config; a stale one sent under another provider is
ignored with a warning.
2026-10-25 15:58:23 -07:00
unsupportedpastels
96168a2fa8 fix(gateway): honour legacy reap opt-outs; startup idle floor for orphan ends
Addresses maintainer review on #143626.

Refs #143547
2026-10-25 11:41:09 -04:00
unsupportedpastels
b1e7bd0b7c fix(gateway): end local sessions left with no viewer
A CLI, TUI, Desktop or oneshot session whose last viewer vanished without
closing (a killed terminal, a dropped socket, a gateway stop) was never ended,
and every boot loaded every local receipt ever written. The gateway now arms a
grace timer (sessions.orphan_end_grace_s, default 300 s, 0 disables) when the
last viewer detaches without an end reason, and at boot for idle sessions the
previous owner left open. On fire it installs the existing persisted pending
close, so the row ends only after the running turn settles; the turn and its
async delegations are never stopped and an unknown turn waits for Discard.
Boot restores only open rows, unsettled input or stored closes; the rest load
on first touch. Ended sessions stay resumable.

Rows LC-35, LC-36, LC-37.

Refs #143547
2026-10-25 11:41:09 -04:00
unsupportedpastels
8aee8df0ec fix(acp): project config options on outside changes; document prompt.cancel
Addresses maintainer review on #143600.

Refs #143547
2026-10-25 11:37:02 -04:00
Teknium
90bc28af98 fix(hold-stream): rows a held user never got stay hidden in history
The hidden-row step covered only the tool-call row of run_tool_round.
Other assistant rows a held turn appends and flushes without showing them
were stored displayable, so reopening the session (TUI/Desktop
display_projection, dashboard, classic CLI resume) showed the original text
even when the final was rewritten:

- the attempted answer a late LSP verdict, verify-on-stop or pre_verify
  sends back (_append_interim_answer), and the kanban stop-guard answer;
- length-continuation fragments of a reply that then recovered (the final
  row holds the rewrite of the whole, so the raw pieces also duplicated it);
- the intent-ack / stall / degenerate-final continuation rows, codex
  status=incomplete partials, and commentary on a call to an unknown tool
  or with broken JSON arguments (turn_tool_validation).

Every one of them is built by AIAgent._build_assistant_message, so the
hiding now happens there: in a held turn a row with visible text comes
back typed display_kind="hidden" (withhold_held_row) before anything can
flush it, and finish_text_response publishes the one row the user gets
(publish_held_final_row: visible again and, after recovered fragments,
carrying the whole reply; api_content keeps the piece the model wrote, so
the wire is unchanged). display_kind never reaches the wire, so the
model's context and cached prefix stay byte-for-byte (the test replays the
resumed session and compares the request).

Same class, also fixed: text beside a housekeeping call reused as the
reply after an empty follow-up was flagged response_previewed/reused,
though a held turn never showed it; the classic CLI then printed nothing.

Tests (tests/agent/test_hold_stream_exits.py, red on 3a5b54d980): late
LSP verdict, recovered continuation, unknown-tool commentary, reused
commentary.

Review: https://github.com/NousResearch/hermes-agent/pull/144266#discussion_r4370678628
2026-10-25 06:18:48 -07:00
Teknium
2cd20e5a5e docs: hold_stream fails closed, keeps its hooks through a reload, hides commentary in history 2026-10-25 06:18:48 -07:00
Teknium
905e54d248 docs: hold_stream for transform_llm_output (hooks reference + plugin guide) 2026-10-25 06:18:48 -07:00
Teknium
9538e94bc1 docs(vault): clone custody at creation; keychain protection depends on the keychain
A --clone-all copy now gets its own keychain entry while it is created (or is
refused when the keychain is unreachable). The offline-disk row no longer
promises a login password for every keychain: it is whatever protects that
store, and an unencrypted Linux keyring protects nothing.
2026-10-25 05:45:51 -07:00
Teknium
ebbe67e878 docs(vault): key storage, migration, threat model and plugin isolation
Documents vault.key_storage and hermes vault key, what keychain mode protects (backups/copies, offline disk) and what it cannot (same-user programs, in-process plugins, root), the unlock-token lifecycle, and recommends plugins.isolation: host (with a launcher sandbox) for users who save logins and run unreviewed plugins.
2026-10-25 05:45:51 -07:00
Teknium
808eaf32f9 fix(plugins): hosted providers keep their declared types across the plugin-host wire
Under plugins.isolation: host every value crosses as JSON, so a dataclass
arrived as a generic Record, a Path as str, an enum as its value and a
plugin object as an Opaque placeholder. Core consumers that type-check
broke:

- secret sources: SecretSource.fetch() came back as Record, the
  orchestrator rejected it ("fetch returned Record instead of
  FetchResult") and applied no secrets; fetch() also received home_path
  as str, so `home_path / "x"` raised in the plugin.
- context references: ContextCompletionItem (a __slots__ class) became
  Opaque, so @prefix: autocomplete silently returned nothing.
- context engines: clone_for_agent() returned Opaque, so no agent could
  get its own copy of a hosted engine.

The provider ABC's annotations are the contract, so the wire now
restores against them: the parent rebuilds results from the declared
return type (dataclasses, enums, Paths, typed containers; a declared
provider ABC becomes an object proxy) and the host rebuilds method
arguments from the declared parameter types. Type names never come from
the host. ContextCompletionItem becomes a slots dataclass so it crosses
as data.
2026-10-25 05:10:15 -07:00
Teknium
6a8b466263 fix(vault): bind one-time-code fills to the saved login's origin
browser_vault enter_code minted a saved login's TOTP code and wrote it into
whatever page the session was on; the password, card and address fills
already refused a page outside the item's saved origins.

Every fill of a stored secret now passes one guard, _bound_page_origin,
before the backend resolves any value: the page origin must exactly match
one of the item's saved origins, else origin_mismatch and nothing is
resolved, prompted or written. The in-page write re-asserts that saved
origin. The payment confirmation is asked only after the origin check.
enter_code without a handle still asks the user, as before.

Tests: one per fill path (OTP, password, card, address, save-then-fill)
asserting refusal before resolution on a foreign origin, plus the saved-
origin OTP success pinned to the item origin.
2026-10-25 05:06:56 -07:00
emozilla
1249e90c83 docs(webapp): name an unusable browser sign-in file among the reasons the Webapp is not served
The desktop guide listed a taken port and a missing sign-in provider as the reasons the gateway
serves native clients only and hermes webapp --status says why. A browser sign-in file in the Hermes
home that cannot be read or written now does the same instead of stopping the gateway, so the guide
names it too.
2026-10-25 03:22:40 -07:00
emozilla
d740c0f757 fix(webapp): Web Access signs the Webapp in with a Nous Portal client of its own
Web Access registered the Webapp's sign-in callback on the standalone dashboard's Portal client
(HERMES_DASHBOARD_OAUTH_CLIENT_ID), saved that id in .env, and `hermes dashboard register` called
back into Web Access so it would register again. If the Portal replaces a client's redirect URI on
update, turning on Web Access broke Nous sign-in on an existing `hermes dashboard` deployment.

Start now registers a client of Web Access's own (named webapp_<adjective>_<noun>) and keeps its
id, its Portal and the callback in webapp/sign-in-registration.json under the gateway home, user
only. It never sends the dashboard's client id and never writes .env. A second Start with the same
callback asks the Portal nothing; a moved callback updates Web Access's client only. While the
gateway serves the Webapp, the Nous sign-in provider uses that client, and a plugin reload keeps
it. The gateway's private listener and the standalone dashboard keep reading
HERMES_DASHBOARD_OAUTH_CLIENT_ID as on main, and a Webapp whose Nous sign-in was set up by hand
keeps the configured client. A home whose record came from an earlier build of Web Access names
the dashboard's client; its next Start registers a client of its own and leaves the dashboard's
alone. `hermes dashboard register` no longer touches Web Access's record.

The desktop guide said Start saves the client id in .env; it now says where the id lives.
2026-10-25 03:22:38 -07:00
emozilla
bf8e96e233 docs(webapp): say that on Windows nothing checks who spends a launch link
The guides and the launcher's docstring said, or implied, that on Linux and Windows the gateway
checks who redeems a one-use launch link. Only Linux does: on Windows the check returns yes for
every connection, and the link is protected because it travels only in the browser launcher's
command line, which other standard users cannot read. A reader weighing a shared Windows machine
was told the server authenticates the browser when it does not.

The peer check's docstring, the launcher's module docstring, the CLI reference and the Desktop
guide now say what each platform does: Linux checks the connection's user, Windows relies on the
launcher's private command line, and macOS, the BSDs and WSL print the link instead.
2026-10-25 03:22:38 -07:00
emozilla
b70215d46a fix(webapp): hermes webapp under WSL prints a launch link the Windows browser can use
Under WSL2 the Windows browser reaches the gateway's loopback port through WSL's localhost relay, and
inside Linux that connection belongs to root. The gateway treated WSL as Linux: it gave hermes webapp
a launch link that only a connection owned by the gateway's user may spend, so every link was
refused, and the page told the user it "was already used or has expired. Run hermes webapp again",
which failed the same way. The loopback Webapp could not be opened from Windows at all.

The connection cannot be tied to the user there (any Windows account can reach the relayed port), so
WSL now takes the macOS path: the link is printed for the user to open by hand and spends without
the peer check. Native Linux keeps the check. Live on this machine's WSL2 (NAT): before, curl.exe from
Windows arrived as uid 0 and got 403; after, the printed link spent with 200.
2026-10-25 03:22:37 -07:00
emozilla
4e54af5d8d test(webapp): a browser login's access token opens none of the Webapp's token sockets
@teknium1's 56be810f764 makes the WebSocket upgrade's ?token= leg ask
webapp_sign_in.token_works_alone first, as the bearer header does. That commit tests /api/ws. This
one tests every socket on the Webapp's listener that takes a provider token as ?token= (/api/ws,
/api/events, /api/pub, /api/pty and both voice streams): a browser login's access token, copied out
of its cookie, opens none of them before a sign-out or after it. It also tests that a token the
listener gave a native app's sign-in opens a socket that stays open across a sign-out, as the native
app stays signed in.

token_works_alone's docstring, the module docstring, the developer guide and the Desktop guide now
name a socket's ?token= among the places the gateway refuses such a token on its own.
2026-10-25 03:22:36 -07:00
emozilla
0d386aac54 docs(webapp): say that Web Access saves the Nous sign-in client's id in .env
Web Access Start registers the Webapp's sign-in callback with the Nous Portal and saves the client
id it gets back as HERMES_DASHBOARD_OAUTH_CLIENT_ID in .env, the same client the standalone
dashboard's Nous sign-in reads. The Desktop guide and the module's docstring said Web Access left
.env alone. Both now say what it writes: the webapp: block of the config, and that client id when it
registers a callback.
2026-10-25 03:22:35 -07:00
emozilla
04318229b2 fix(webapp): report the Webapp unavailable when hermes update could not rebuild it
When the Webapp build in `hermes update` failed, the previous bundle stayed on disk and the gateway
went on serving it as current: `hermes webapp --status` said "Serving", the launch link opened it,
and browsers loaded a renderer built for the code before the update against the updated backend.
The gateway only checked that the bundle's index.html exists.

The update now marks the bundle it could not rebuild out of date, with a file inside the bundle
folder, and keeps the bundle itself. While the mark is there the gateway reports the Webapp
unavailable with "The Webapp is not built for this version of Hermes: hermes update could not
rebuild it. Run hermes webapp to rebuild it.", mints no launch link, and answers the page with
that message (503) instead of the old renderer. The next build that succeeds (`hermes webapp`, Web
Access Start or the next update), or that finds the bundle current, removes the mark and the
running gateway serves the Webapp again without a restart. Publishing a build replaces the whole
folder, and the build receipt's output hash covers the mark, so a marked bundle is never reused as
current. `--skip-build` writes nothing and leaves the mark. With no bundle built there is nothing
to mark. The desktop guide says what happens when the update's build fails.
2026-10-25 03:22:33 -07:00
emozilla
e77feea88d fix(webapp): on the LAN, open the address Web Access registered Nous sign-in for
With the Webapp on every interface (`webapp.host: 0.0.0.0`) and no `webapp.public_url`, `hermes
webapp` on the host opened the loopback address. Web Access Start registers Nous sign-in for the
LAN address's callback, so a sign-in started there sent the Portal a callback for 127.0.0.1 that it
had never seen, and failed.

For a launch behind the sign-in gate the gateway now opens, in order: `webapp.public_url` when set,
as before; on the LAN, the address in Start's `webapp/sign-in-registration.json`, while that is
still this machine's LAN address and the Webapp's port (a moved address or port would send the
browser elsewhere); otherwise the loopback address, which still serves a password provider and
sign-in set up by hand for it. Native clients keep the loopback address. The docs say so.
2026-10-25 03:22:32 -07:00
emozilla
b140bf4039 fix(webapp): print a one-use link on macOS instead of the long-lived browser credential
Where nothing can check who redeems a launch link (macOS and the BSDs), `hermes webapp` printed the
gateway's browser credential as `#hermes-session=<token>`. That link signed a browser in as the user
until the next sign-out, and when Hermes ran the command through its terminal tool the credential
landed in the transcript.

The gateway now mints a launch ticket there too: the same one-use, 60-second link Linux and Windows
get, which spends without the peer check, as a window ticket does. `hermes webapp` prints it with its
lifetime and still never passes it to a browser launcher, whose arguments other local users can read.
A copy that leaks is spent once the user opens it and dead after 60 seconds, instead of working until
the next sign-out. The docs describe the macOS link as the one-use link it now is.
2026-10-25 03:22:31 -07:00
emozilla
9538b1b040 fix(webapp): end the account tokens of a signed-out browser login on the Webapp too
A browser that signs in to the gated Webapp keeps the sign-in provider's access and refresh token
in its cookies. Only the cookie path checked the login's binding to the browser credential, so
after `hermes webapp --sign-out` those tokens still worked when presented on their own: the access
token as `Authorization: Bearer` (enough to mint a host-terminal ticket) and the refresh token on
`/auth/native/refresh`, where the bundled password provider hands out a new 30-day refresh token
every time. Refusing a recorded list of those tokens would not hold: the password provider decodes
base64 leniently, so another spelling of the same token, such as the quoted value the cookie
stores, verifies too.

On the gateway's Webapp behind the sign-in gate, a provider token now works on its own only when
the listener gave it to a native app's RFC 8252 sign-in (`/auth/native/token`, then each
`/auth/native/refresh`). The listener keeps a digest of each such token until it expires, in
`webapp/native-sign-in-tokens.json` in the gateway home, so native apps stay signed in across a
sign-out and a restart. A browser login's tokens work only as that login's cookies, which
sign-out, or a credential replaced while no gateway ran, already ends. The standalone dashboard
and the gateway's private listener keep main's behaviour. `hermes webapp --sign-out` and the docs
now say that those tokens end and that native apps stay signed in.
2026-10-25 03:22:31 -07:00
emozilla
ea7b4476f0 fix(webapp): refuse a pasted image the browser cannot send instead of attaching it
In the Webapp a pasted or dropped image is stored on the host through /api/chat/image-upload, which
takes images up to 25 MiB. Sending the message reads that stored image back through
/api/fs/read-data-url, which stops at 16 MiB, and uploads it again for the session. An image between
the two showed as attached, then the send failed with 413.

The browser now refuses an image over 16 MiB when it is pasted or dropped, with an error that names
the limit: the same limit browser file uploads and terminal drops already apply. Skipping the
read-back by reusing the stored image would need the browser to know that the session sends to the
same profile the image was pasted into, which it cannot tell reliably (a named profile and the
gateway's own default look different), and a draft restored after a reload no longer knows which
images it stored. The native app reads local files itself and keeps its own limits. The desktop
guide now lists pasted and dropped images under the 16 MiB limit.
2026-10-25 03:22:30 -07:00
emozilla
cd58d3dd36 fix(webapp): read webapp.host the way the sign-in gate does
The Webapp's settings accepted any loopback address as a local-only host, but the listener's
sign-in gate leaves only 127.0.0.1, ::1 and localhost open. A host such as 127.0.0.2 or the
long form of ::1 (0:0:0:0:0:0:0:1) was read as local-only and then made the gateway demand a
sign-in provider; without one the Webapp stayed unavailable with a reason about sign-in that did
not match what the user had set.

The settings now spell a host the way the gate compares it (an IP address in its short form, a
name in lower case) and ask the gate whether a bind stays local-only. Other spellings of
127.0.0.1, ::1 and localhost bind that address with no sign-in; any other loopback address keeps
the Webapp off with a reason naming the hosts that work. The gate's own policy is unchanged, and
the configuration docs list the accepted hosts.
2026-10-25 03:22:30 -07:00
emozilla
7e2972f249 fix(webapp): open the Webapp's public URL to sign in when webapp.public_url is set
Behind the sign-in gate, hermes webapp opened the gateway's loopback address even when
webapp.public_url was set. Sign-in started there and kept its state cookie on the loopback
address, but its callback is built on the public URL, so an OAuth sign-in such as the Nous
account's came back to an address without that cookie and failed with "Missing PKCE state
cookie".

A gated launch now opens the listener's own public URL, path prefix kept, with the profile
query after it, so sign-in starts and finishes on the same address. Without a public URL it
still opens the loopback address, and native clients keep dialling loopback. The CLI and
configuration docs say which address is opened.
2026-10-25 03:22:30 -07:00
emozilla
8af890af0c docs(desktop): describe what Web Access builds, saves and leaves alone
The Web Access section described an earlier behaviour: a fixed port 9120, no build, and nothing
about which settings it writes. It now says that Start builds the Webapp when it is missing or out
of date, registers the sign-in address only when it changed, and keeps webapp.port; that the own
URL is saved as webapp.public_url while dashboard.public_url and .env are left to the standalone
dashboard; that network mode is unencrypted; that only the native app on this computer can change
it; what Restart gateway does; how a Webapp turned on for this computer only shows; and that
hermes update rebuilds the Webapp when a profile has it turned on.
2026-10-25 03:22:28 -07:00
emozilla
ac64150960 docs(webapp): describe sign-out behind the sign-in gate and where launch links work
The Webapp docs said `hermes webapp --sign-out` signs out the tabs a launch link signed in. They
now say it also signs out every browser that signed in with a dashboard account behind the
sign-in gate, closes Bot Desktop viewers with the rest of a tab's connections, reports how many
connections it closed, waits for a gateway that is still starting, and replaces the stored
credential itself only when no gateway runs. The private-link fallback is documented for the BSDs
as well as macOS, and the developer guide records how a Webapp login is bound to the browser
session token (the hermes_webapp_signin cookie).
2026-10-25 03:22:25 -07:00
emozilla
fbdf0b0f22 docs(webapp): say what turns the Webapp's sign-in on and what the gateway does around it
The docs said only a 0.0.0.0 or :: host turns on the Webapp's sign-in gate. A public URL does too,
on a loopback host, and `hermes webapp` then opens the Webapp's address instead of a one-use link.
The configuration reference, the Desktop guide, the `hermes webapp` reference and the gateway
sessions guide now name both triggers (webapp.public_url, not dashboard.public_url), say that the
listener native clients use never asks for sign-in, and say that a taken Webapp port replaces the
browser sign-in so open tabs need `hermes webapp` again.
2026-10-25 03:22:24 -07:00
emozilla
43a978390c fix(webapp): report an unbuilt Webapp as unavailable and say how to build it
The gateway served the Webapp's bundle directory without checking that it held a build. With
webapp.enabled set and no bundle (turned on by hand or from Settings → Web Access, or a wiped
apps/desktop/dist-webapp), `hermes webapp --status` said "Serving at http://127.0.0.1:9120" and the
page answered 404 "Frontend not built. Run: cd web && npm run build", which names the dashboard's
web project, not the Webapp.

The gateway now reports the Webapp unavailable while its index.html is missing, with a reason that
names the missing file and says to run `hermes webapp`, which builds it. It mints no launch link in
that state, and the page's 404 on the Webapp says "The Webapp is not built. Run: hermes webapp".
The listener already serves a bundle as soon as it appears, so the status turns to serving once
the build exists, and `hermes webapp --status` does not ask for a gateway restart for this reason.
Sign-out does not depend on the bundle.
2026-10-25 03:22:23 -07:00
emozilla
76a8d7695c fix(webapp): give the Webapp its own public URL and stop reading the dashboard's
The gateway's Webapp listener read dashboard.public_url, the setting that describes `hermes
dashboard` behind a reverse proxy, to decide whether to require sign-in on a loopback bind, which
outside hostname to accept and where to send sign-in callbacks. So a user with a proxied dashboard
got a Webapp that demanded sign-in and accepted the dashboard's hostname, and with no sign-in
provider the gateway exited outright; and the Web Access pane had to rewrite dashboard.public_url
to publish the Webapp, breaking the dashboard it belonged to.

The Webapp now has webapp.public_url: an optional http(s) address with no credentials, query or
fragment (anything else keeps the Webapp off, like the other webapp settings). On the Webapp
listener it alone engages sign-in on a loopback bind, is the one outside hostname accepted, and is
the base of the sign-in and MCP OAuth callbacks and of the Origin check for browsers without Fetch
Metadata; dashboard.public_url never applies there. The listener records its own URL on the app
state and the shared resolver returns it; `hermes dashboard` declares none and reads
dashboard.public_url exactly as before. When the Webapp's URL needs sign-in and no provider is
registered, the gateway's reason names webapp.public_url. The key is in DEFAULT_CONFIG and the
configuration docs.
2026-10-25 03:22:23 -07:00
IAvecilla
5ac5557c39 docs(desktop): document Settings → Web Access 2026-10-25 03:22:22 -07:00
emozilla
7f1e623c71 docs(webapp): sign-in behind the gate, sign-out and the terminal
Documents what hermes webapp does behind the sign-in gate, that sign-out closes open tabs, the
gateway restart after fixing an unavailable Webapp, terminal file drop and the terminal's starting
folder.
2026-10-25 03:22:21 -07:00
emozilla
7979fb2ce3 docs(webapp): document the gateway-served Webapp
Configuration, the hermes webapp command, the Desktop guide's browser
section, and the operator credential in the gateway session notes.
2026-10-25 03:22:17 -07:00
Teknium
4ea8d23cc9 fix(agent): side-question review fixes (unattended turns, profile-bound leases, billing, attribution)
- No side_question_token for cron runs (platform="cron") or delegated subagent turns
  (_delegate_depth > 0): nobody reads the answer, so it is pure unattended spend.
- A lease is bound to the profile home it was issued in; a plugin context of another profile
  gets None and leaves the lease for its owner.
- Usage bills to the session the token was issued for (capture.session_id), not the parent's
  id at release time, which can rotate between issue and redeem.
- Plugin side questions report as aux_task="plugin_side_question" with the asking plugin_id in
  pre/post_auxiliary_call, and record usage as plugin_side_question:<plugin_id>; /btw keeps
  side_question.
- Drop the new legacy key llm.allow_side_question: the capability is declare + consent only.
- The timeout starts before the fork build, so runtime resolution counts against it.
2026-10-24 19:56:21 -07:00
Teknium
4047c3ab72 fix(agent): ctx.side_question reports through pre/post_auxiliary_call
The side request fired the turn-scoped pre_api_request/post_api_request
after its turn had already closed, so trace-per-turn observers (and the
relay metrics keyed on them) counted a plugin's side call as a model call
of a finished turn. Every other side call (titling, compression, MoA,
vision, ...) reports through pre/post_auxiliary_call instead.

- turn_api_request: build_request_payload() is the payload build through
  the LLM request middleware with no hook; build_api_request() wraps it
  with pre_api_request, the debug dump and the MoA handshake, unchanged
  for the turn loop.
- auxiliary_hooks: start_aux_call_hooks()/finish_aux_call_hooks() expose
  the pre/post pair for callers that drive the provider call themselves;
  post accepts an already-normalized (message, finish_reason, usage) view
  for a transport-native reply.
- side_question_request: build_request_payload + aux hooks with
  aux_task="side_question"; a request refused for server-side tools now
  fires nothing.

Test: a real plugin observing all four events sees pre/post_api_request
for the turn only and pre/post_auxiliary_call (with usage) for the side
request (red before).
2026-10-24 19:56:21 -07:00