469 Commits

Author SHA1 Message Date
Teknium
5819226468 feat(plugins): one switch and one action for unattended plugin updates
main already ships `hermes plugins update` (no name = update all) and the
opt-in `plugins.auto_apply` cadence. This makes both reachable from every
surface and closes the gaps reported on the original PR:

- Catalog installs now ride `plugins.auto_apply` too (it moved only git
  rows, so catalog plugins stayed on their install-day pin). The update
  path still refuses a widened pin or a too-new requires_hermes unattended.
- One updater per plugin: a cross-process lock around update_one and the
  dashboard/Desktop update, so the gateway's auto-apply tick and a manual
  update never run on the same plugin at once; the loser changes nothing.
- `hermes update` names, per profile, the catalog installs its new catalog
  pins left behind and re-arms that profile's plugin check, so an opted-in
  gateway applies them on the next tick.
- New CLI verb `hermes plugins auto-update [on|off]`; `/plugins update` and
  `/plugins auto-update [on|off]` in the classic CLI and the TUI (slash
  worker).
- RPC `plugins.manage` actions `update_all` and `auto_update` (contract +
  regenerated apps/shared outputs) for Desktop.

Off by default (legacy behaviour); all writes are profile-scoped through
get_hermes_home()/the scoped RPC.
2026-11-04 21:58:12 -08:00
Teknium
f24a54c3d7 feat(desktop): MCP consent line names the env vars and working directory a stdio server adds; a string args value is one argument 2026-11-04 21:44:24 -08:00
Teknium
3dbb1303fe feat(desktop): show what an MCP consent row runs or contacts before approval
The manage_connections MCP card asked the user to Install / Enable / Authorize
a server by name only. Each MCP target now carries a backend-built `launch`
line ({kind: stdio|remote, target}) in connection.request: the catalog
manifest's transport for install, the configured mcp_servers entry for
enable/authorize. The card renders it under the row as plain text
("Runs: npx -y ...", "Connects to: https://...") until the row resolves.

The line is scrubbed in the backend (tools/connectors/mcp_launch.py): values
of secret-named flags (--api-key=..., --token ...), credential query params
and URL userinfo, long opaque URL path segments, then the standard egress
redaction; control characters are flattened and the text is capped at 400
chars after scrubbing. The env map and headers are never part of it. The
model's tool result drops the field.

i18n: launchCommand / launchRemote in all nine locales, _keys.desktop.json
regenerated. Gateway contract regenerated.
2026-11-04 21:44:24 -08:00
Teknium
57c6a9e44b feat(groups): opt-in auto routing and Continue at the discussion cap
Gateway-hosted Group Chats gain two things:

- routing "auto" (opt-in room setting; "everyone" stays the default). The
  deterministic rules run first and never reach the router: an @mention,
  @all/@everyone, a scheduled post, a message inside an existing thread. An
  unaddressed message otherwise gets ONE tool-less auxiliary.group_router call
  over the room purpose/notes, the roster (handle, name, profile description)
  and the last 5 messages, answering strict {"members": [...]} JSON. The
  answer is written as room.routed BEFORE any turn is planned, so
  plan_next_task stays a pure function of the log; a failed or invalid answer
  records a fallback to everyone. The call runs on its own thread; its answer
  is recorded only if the re-run planner still wants exactly that route, so a
  Stop or a newer message during the call discards it.
- The cap (max_rounds / max_messages) still writes room.activity bounded, and
  groups.continue (both the standalone and the gateway route) appends
  room.continued: one more budget of rounds and messages for the same
  discussion, at most 5 times. The policy checkpoint reopens the discussion's
  projection from the room log, so Continue works after a gateway restart.

Desktop: "Assigned to X" rows (names, never ids), "Paused after N messages"
with Continue and Stop, a "Continued" row, and the auto choice in Room settings
when the gateway lists it (driver_status.routing_modes). All 9 locales.
2026-11-04 20:52:12 -08:00
Teknium
eed57b0beb fix(tui): the client declares its terminal for image.render and pet.cells
One gateway serves many clients by design, but image.render's `auto`
mode read KITTY_WINDOW_ID/TERM/TMUX from the daemon's own os.environ,
and the TUI only sent `graphics: isTTY`. A kitty TUI attached to a
daemon Desktop started got half-blocks; a daemon started from kitty sent
placeholders to an iTerm/VS Code/dashboard TUI, which paints tofu.
pet.cells had the same flaw (detect_terminal_graphics in
_pet_kitty_cells), so it gets the same field.

- ui-tui lib/terminalGraphics.ts picks kitty/unicode from the TUI's own
  env (TERM, TERM_PROGRAM, KITTY_WINDOW_ID, GHOSTTY_RESOURCES_DIR,
  WezTerm, VS Code, the dashboard PTY, and TMUX/STY: screen swallows the
  APC too) and sends it as `terminal` on both RPCs.
- resolve_inline_mode takes the remote painter's pick as `detected`
  (keyword-only; the classic CLI keeps reading its own env). A client
  that declares nothing gets half-blocks; a pinned `kitty` stays the
  user's explicit opt-in.
- ImageRenderParams.graphics is `bool = False` like PetCellsParams;
  contracts regenerated.
2026-11-04 13:26:30 -08:00
Adolanium
d4ac2edd5d feat(tui): draw images inline in the TUI transcript
The TUI shows the same images as the CLI: a user turn's attachments under
its row, and a tool's image in its own transcript row under the trail line
that made it (anchored like inline diffs).

- tool.complete carries image_path, from both the sidecar gateway
  (tool_progress) and the shared gateway's local-viewer fields
  (local_viewer_events.complete_fields), so canonical sessions get it too.
- image.render lays an image out for the client: kitty placeholders when the
  TUI owns a terminal that paints them, half-block cells otherwise, nothing
  when display.inline_images is off or the file is not a readable image.
- <InlineImage> paints both with the generic cell painters. Renders are
  cached across virtual-scroll remounts and each kitty image goes over the
  tty once per process.
2026-11-04 13:26:30 -08:00
Bear Huddleston
862be95391
Merge pull request #148949 from NousResearch/fix/acp-service-tier-picker
fix(acp): expose session-scoped service-tier picker
2026-11-04 10:32:48 -06:00
Teknium
50c7d1c4b9 fix(bot-mode): a sender's cancel by delivery id always reaches the delivery's retry
message_agent's cancel picked an admission from the target's receipt file and cancelled it with
prompt.cancel. When the first attempt had just failed transiently, the owner's one automatic retry
could be scheduled but not yet recorded: the cancel hit the finished first attempt, and the retry
then ran anyway.

The cancel is now an owner RPC, bot_relay.cancel {id, profile, author_id}
(gateway/session_bot_cancel.py). It runs under the mailbox lock that admits the retry, follows the
retry when it exists, and otherwise withdraws it for good: the receipt's retry is marked refused
"cancelled", so no wake, re-delivery or owner restart admits it, and the receipt reads cancelled.
Only the delivery's own principal and author may cancel it.
2026-11-04 08:01:12 -08:00
Teknium
ef52d34bdb feat(bot-mode): message_agent fans out with one combined reply, sends notify-only, cancels its own request, and reports a blocked teammate
- target accepts up to 8 comma-separated teammates: each is admitted as before, and one
  combined runner joins their reply runners and wakes the sender ONCE with a typed outcome per
  teammate (settled/failed/cancelled/pending + reply/error/reason/target_state).
- expects_reply=false: the message is marked "[no reply needed]" after the attribution colon and
  no reply runner starts (local: the payload and intent go once the owner admitted it; relay: no
  waiter; peer: the sending runner runs unwatched), so nothing wakes the sender.
- cancel=<delivery_id>: the sender withdraws its own queued request, or stops the exact turn it
  started, through the owner's prompt.cancel; the receipt's author must be the caller.
- The owner's deliver answer carries target_state (idle/working/waiting_approval/
  waiting_clarify/paused, never stored); the ack says plainly when the teammate is parked on its
  own user, and a runner whose wait lapses pending re-reads it through a same-id replay instead
  of ending on a silent timeout.
- One reply path (#95074): message_agent refuses a DM to the bot whose delivery this turn
  answers, since its final response already goes back. Protocol v3 names fan-out and notify-only.
2026-11-04 08:01:12 -08:00
BearHuddleston
42500a10d9 fix(acp): expose session-scoped service-tier picker
ACP clients advertise edit, model and reasoning controls but omit speed,
so editors cannot select the backend's existing service tiers.

Read eligible choices from the owning gateway under its profile and
credential scope, and apply picks through the validated session fast
setter without changing profile defaults. Publish tier changes to attached
viewers and read the requested next-turn value independently of active
agent metadata. Pass the reconnecting client through snapshot projection
to avoid re-entering the connection lock.

Cover route/account eligibility, session isolation, reloads, cross-viewer
updates, older owners and reconnect projection. Update ACP documentation
and regenerate the canonical gateway contract.
2026-11-04 14:53:40 +00:00
Teknium
4d85429c3a feat(bots): opt-in lead routing for Group Chats
A room's settings gain `routing: everyone | lead` (+ `lead_member_id`), stored on the same
`room.context_set` event as purpose/notes and read as of the message that opened the
discussion. `everyone` is the default and plans exactly as before.

In a lead room, a human message that opens a new thread and names nobody first runs one
routing turn on the lead's member session. The lead answers `{"assign": [handles]}`; the
gateway validates the handles against the roster and appends a gateway-authored
`room.assignment` event, and only those members take the normal round (with a line in their
prompt that the lead gave them the message). An answer naming no member, @all, or a failed
routing turn wakes the lead alone; a routing answer can never broadcast. @mentions,
@all/@everyone, scheduled posts and thread replies keep today's resolution.

The routing turn is an ordinary driver task whose seen_through_seq is the message's seq
minus one (a member turn always sees through its opening message), so it is identifiable
from durable state, its receipt never advances the lead's watermark past the message, and
it is excluded from the round-0 terminal set so a lead that picks itself still answers.
Its answer is published as the assignment, never as a visible reply.

Desktop: canonical-group-lead.tsx holds the Room settings control (Everyone answers /
Lead: <member>), the "Ada gave this to Linus, Grace" row, and markRoomLead() so the
member chips can show a Lead badge; the history mounts the row with one line.
2026-11-03 10:43:31 -08:00
Teknium
7fa5bbc71c feat(bots): cron jobs post into Group Chats; rooms get a purpose and shared notes
A scheduled job can now deliver to a Bot Mode Group Chat with
`deliver: room:<room_id>[@<profile>]`. The output lands as one message in
the room, labelled with the job's name. It starts a round only for the
members it @mentions (`@all` addresses everyone); without a mention it is
just a message in the room, so a feed of scheduled results never makes
every Bot answer it. Failure notices never start a round. The post is an
ordinary `message.user` event with a server-minted `cron:<job>` actor, so
the existing thread/round machinery and replay stay unchanged and a client
cannot impersonate a job.

Rooms also gain a short purpose and a small shared notes block
(`groups.context`, shown and edited in the room header's Room settings).
Both are rendered at the top of each member's turn prompt, which is the
user-role message, never the system prompt, so prompt caching is
untouched. They are stored as `room.context_set` events in the room log
and read as of the message that opened a discussion: the planner stays a
pure function of the log, and an edit mid-discussion never re-plans a turn
already admitted (it applies from the next message). Rooms without a
purpose keep byte-identical prompts.
2026-11-03 10:28:21 -08:00
Teknium
8a8f21a214 fix(groups): live room tasks name their thread and round; Retry drops the old attempt's progress
groups.state member_activity rows now carry the task's thread_id and the 0-based round_index its
Discussion turn id names, so a client scopes outcomes and the round strip to the thread that owns
the task instead of guessing from the newest message (review: "Handoffs show the wrong round").

Retry keeps the task id, so the progress map still held the previous attempt's tool and last-frame
time until the new attempt's first frame; a retry started 120 s after that frame read as stalled.
retry_room_task forgets the entry before requeueing (review: "Retries inherit old progress").
2026-11-03 10:13:09 -08:00
Teknium
a39bcd784d feat(groups): groups.state says how long a member has worked, which tool it is in, and the round limit
A gateway-owned room only knew WHO was working. member_activity now also
carries started_at (durable, from the driver task row) and, from the
process running the turn, the tool the member is in right now plus the
time of its last frame (progress_at), so the room can show
"builder · terminal · 1m20s" and tell a bot busy in a tool from one gone
quiet. driver_status also reports max_rounds so the room can say
"Round 2 of 3".

The progress map is in-process and bounded (512 tasks, LRU); a process
that did not run the turn simply omits tool/progress_at.
2026-11-03 10:13:09 -08:00
Teknium
d2b3465bf6 fix(desktop): MCP health toast reads backend state and stops nagging about local servers
The background MCP health checker probed every enabled HTTP server every
30 minutes with its own fresh connect. For a server hosted by a local app
(Unreal Editor's built-in MCP server answers only while the editor runs)
that meant a daily "failed its health check" toast whenever the app was
closed, and the probe itself raced startup connects into false failures
(#133155), evicted single-session hosts' live session (#89576) and could
open an OAuth consent tab unattended (#142406).

The sweep now reads mcp.servers.status, the backend's cached runtime view,
and never connects. The status row gains a needs_auth boolean (parked on a
rejected OAuth credential) so the sign-in nudge survives without putting
error text on the wire. Local servers (stdio, or a loopback URL) are never
toasted, extending the existing stdio exemption: the backend already
re-probes a parked server every 5 minutes, so tools return once the app is
open. Remote failures and needs-auth still toast as before.

Fixes #133155, fixes #142406
Refs #89576 (the background-sweep half; the MCP page probe is #89581)
2026-11-03 08:30:46 -08:00
unsupportedpastels
60f5029394 feat: Daybreak switch for catalog-listed ChatGPT subscription models
OpenAI Daybreak (Trusted Access for Cyber) reduces cyber refusals for
approved accounts. Codex's model picker has a Daybreak toggle; Hermes had
no way to request it.

The signed-in account's Codex /models catalog already lists, per model,
which cyber programs that account may use
(available_access_programs.cyber). Hermes reads that catalog for Fast and
Ultrafast; it now keeps the cyber list from the same fetch.

- agent.daybreak (default false) is one profile-wide switch, like Codex's.
- Desktop shows a Daybreak switch in a model's options submenu, next to
  Fast, only when this account's catalog lists daybreak_blue for that
  model. Unknown or unreachable catalog: hidden.
- Each Responses request adds access_programs.cyber=daybreak_blue only
  when the switch is on AND the request's credential and model are listed.
  Checked per request, so a /model switch, credential rotation or expired
  catalog never carries it to a model or account without it.
- The gateway re-reads the switch every turn, so a flip applies to the
  next turn of a running chat without rebuilding its agent.
- The opt-in codex app-server runtime does not send it, so the switch is
  hidden there.

Co-authored-by: FroRaut <79215537+Froraut@users.noreply.github.com>
2026-11-02 15:06:27 -05:00
Teknium
b0e2b30915 fix: Desktop status bar shows the switched-to session's own cache hit and t/s
Switching sessions in Desktop left the previous session's cache-hit rate
and tokens-per-second painted in the status bar until a message was sent
in the new one (Discord report). The status bar reads one global usage
atom, and every switch MERGED the new session's snapshot into it, so any
readout the snapshot lacked kept the old session's value. The canonical
gateway's resume / session.info snapshot also carried no usage at all, so
nothing ever replaced them on the local path.

- Desktop: a warm switch paints the session's own cached usage reading
  at once (each session already keeps one, updated by every usage event);
  an authoritative resume snapshot replaces instead of merging. (The cold
  switch clear is the previous commit, salvaged from @kouyichi.)
- Gateway: resume and session.info snapshots carry the resident agent's
  status-bar usage (tui_usage of usage_stats), so reopening a session
  after an app restart shows its real cache hit and t/s. Agentless
  sessions send none rather than zeros that would erase the last reading.

Fixes #146430
2026-11-01 22:17:03 -08:00
Teknium
e032b8a264 fix(desktop): sidebar rows not on screen show running subagents and background work
$subagentsBySession and $backgroundStatusBySession were fed only by
the visible pane (subagent.list / process.list polls on the mounted
tile, plus live events on that tile's stream), and both RPCs need the
session attached to this transport. A conversation that was not open,
and every row right after a renderer reload or socket reconnect, read
idle while its delegated children or background processes ran.

Backend: new sessionless subagent.roster RPC returns per-conversation
counts of live top-level children (keyed by owner_agent_session_id, the
durable spine completion delivery uses) and running background
processes (registry session_key). It reports only conversations stored
in the requested profile's state.db (the same _profile_db scope
session.list reads), so one process serving several profiles never
hands a caller another profile's session ids. Contract + regenerated
apps/shared outputs included.

Renderer: useLiveWorkRoster (mounted app-wide from useBackgroundSync) reads
the roster on connect/reconnect and every 10 s while the window is
visible, once per backend owner the sidebar shows rows for, routed
through requestForSessionProfile like the rows' own session RPCs. The
result lands in $liveWorkRoster and is unioned into
$delegatingSessionIds / $backgroundRunningSessionIds only for
conversations no event-fed entry covers, so an open pane's live events
stay authoritative. A source that fails three times in a row (an older
backend without the RPC) stops until the next reconnect or window
focus.

Refs #143077, #137847. Reconnect-hydration idea first proposed in
#87915 (@aleksclark).
2026-11-01 09:05:22 -08:00
kshitijk4poor
0df6c56546 fix(desktop): the language picker only offers languages it can show
The backend's `i18n.languages` lists every language it translates
anywhere. Seventeen are bundled for core messages and the TUI, but the
Desktop bundles only nine. The other eight (af, ga, hu, it, ko, pt, tr,
uk) were added to the Desktop picker anyway, with no Desktop strings
behind them. Picking one saved `display.language` and the UI stayed in
English: a Korean user picking 한국어 saw no change.

Each `i18n.languages` row now carries `surfaces`: the surfaces some
layer has strings for. These come from the bundled
`locales/<lang>[.<surface>].yaml`, the user overlay and plugin packs,
which already record their (lang, surface) pairs. A layer that loaded no
strings (an empty, comment-only or unparseable file, or an empty pack)
does not count.
`agent.i18n.language_surfaces()` builds the map from those records. The
overlay cache now stores the pairs instead of bare ids, and
`overlay_languages` derives from it.

The Desktop registers a backend language it does not bundle only when
`desktop` is among its surfaces. A language pack with a Desktop catalog
(hermes-lang-ko) and a user overlay `<lang>.desktop.yaml` both still
show up. Rows from older backends (no `surfaces`) are kept as before. A
saved `display.language` the Desktop cannot render is left as it is for
core and the TUI; the Desktop falls back to its OS-locale inference, as
it already does for any unrenderable value, and does not save over it.

Introduced in 9bcbe7b5df (#126296).
2026-11-01 18:12:56 +05:30
kshitijk4poor
c13f64ad26 docs(desktop): Webapp desktop installs take any source the CLI takes
The desktop guide and the plugins.manage install_desktop contract text
still said the Webapp desktop-only clone takes https:// sources only.
That rule was removed on purpose, and every source scheme is held to the
reviewed commit. The contract text also read as if an identifier install
needed no ref; a ref is always required.

Generated contract files regenerated with the repo generator.

Root cause: the source rule was widened without updating its two
descriptions.
Regression from 01dfee9a41 (#146189, @teknium1, 2026-10-28).
2026-10-31 14:32:08 +05:30
Teknium
8a8d453ad1 fix(desktop): a down local model server no longer sends the Webapp to provider sign-in
With the main model on the managed llama.cpp runtime and its server down
(Desktop closed and took it along, still loading, or switched off),
setup.runtime_check answered ok:false while setup.status said a provider
is configured. The onboarding gate wrote that down as "not configured" and
opened the provider sign-in overlay, and a send got an "Update API key"
card: the resolution failure was stamped auth_permanent.

The resolver now raises a typed LocalRuntimeUnavailableError. Both
setup.runtime_check backends answer it with error_code
local_runtime_unavailable, the onboarding gate keeps the app open and
shows a "Local model unavailable" notice with Open Local models, and the
turn failure carries reason local_runtime_unavailable on the endpoint
layer, so the card says the model server is unreachable and offers
Switch provider.
2026-10-30 08:02:40 -07:00
Teknium
981e1325e8 feat(desktop): a multi-question clarify is one form on Desktop and the Webapp
The canonical owner asks the clarify tool's question set as ONE `clarify`
request only for a turn whose prompt.submit declared `clarify_batch`
(gateway/session_cli_turn.py); otherwise it asks one card per question,
each shown only after the previous was answered. The Ink TUI declares it
(163a633265b); Desktop and the Webapp never did, so their batch form only
ever received one question at a time.

The backend now advertises `canonical_clarify_batch` in its
`client.capabilities` answer (the frame every renderer already sends on
gateway.ready), and the Desktop's canonical client adds `clarify_batch:
true` to prompt.submit only where it was advertised: an older owner's
closed submit params refuse the unknown key, and the legacy sidecar is
never sent it. The existing batch card then shows every question at once
and answers through the existing `clarify.lock` verb, one submit.

Keyboard: plain Enter on an answered earlier question now moves to the
next open question instead of sending the set half answered; it submits
from the last question or once nothing is open (Cmd/Ctrl+Enter still
submits from anywhere).
2026-10-30 07:54:21 -07:00
Teknium
1abb78e871 fix(shared): grant the late-tick probe only for a one-off stall
A hidden window's intensive throttling makes every heartbeat tick land
60 s apart, so every tick reads as "late" and the grace probe added a
third throttled tick before a dead hidden socket dropped, breaking the
#133043 contract (drop once a ping goes unanswered across two throttled
ticks). Grant the extra probe only when the late tick follows an
on-time one, which is the renderer stall #142738 describes.
2026-10-30 05:29:33 -07:00
686f6c61
59c4570c8a fix(shared): probe once more when the heartbeat tick itself ran late 2026-10-30 05:29:33 -07:00
Teknium
2c64c7fdb7 fix(plugins): an install dialog installs only the commit it inspected
The dialog inspects a source and shows its commit, but the agent half
cloned the branch tip at Install time: a branch that moved in between put
down a tree nobody reviewed, and the desktop half copied out of that
checkout followed it. Native Electron's probe returned no commit at all, so
its desktop clone had the same gap.

- plugins.manage install takes `inspected_sha` (custom sources without a
  pin). The clone stays an ordinary branch checkout and is refused when its
  tip is not that commit: "The source changed since you reviewed it ...
  Re-open the install dialog". Not `ref`, which records a pin that refuses
  every later `update`; not a detached checkout at the old commit, which
  `git pull` cannot update. Catalog picks keep their pin.
- That install drops inspect's kept answer for the source, so re-opening
  the dialog reads the moved branch instead of the stale commit.
- Electron: probePluginRepo returns the commit it read; installDesktopPlugin
  takes it and installs exactly that tree (fetch + verify) or refuses.
2026-10-28 17:21:32 -07:00
Teknium
8c5895cec1 fix(webapp): a tab's desktop-plugin install takes only the reviewed https commit
Hardening on top of the contributor's Webapp install path (salvage #146132). A browser tab asks the
serving host to clone code onto it, so the host now decides what lands, not the tab:

- `ref` is required: the 40-hex commit the dialog showed (or the user's pin). The clone is checked
  out at exactly that commit and the halves are read from that checkout, instead of re-using a
  ten-minute inspection cache and installing whatever it named; a catalog install whose pin moved is
  refused. `forget_inspection` goes away with the cache dependency.
- https only: `file://` would copy any folder of the host, `ssh`/`git@` spends the host's keys,
  `http://` can be rewritten in transit. Native Desktop keeps those for a user at their own machine.
- The published tree may hold no symbolic link (a `desktop -> /anywhere` link in a repository
  published that host folder) and is capped at 64 MB.
- A standalone plugin's in-tree `.hermes-package.json` is dropped as Electron's installer drops it:
  only an installer writes the marker that pairs a folder with an agent package.
- `desktop_plugin_halves`: the helpers the installer shares become public names instead of
  wrapper functions around private ones.
- Renderer sends `ref: plan.ref ?? plan.probe.sha`.
- Tests: the contributor's installer/RPC/route cases now run through an https identifier at a real
  commit (only the clone's network leg points at the local repository); RPC cases folded into one
  round trip; two added invariants (https only, link escape), each proven red with its guard removed.
2026-10-28 17:21:32 -07:00
Decrux
abfe2876f3 feat(webapp): install a desktop plugin on the host that serves the tab
In the browser-hosted app, installing a desktop plugin dead-ended: the install dialog could inspect a
repository through the gateway (`plugins.manage inspect`, #145770) but had nothing to install with.
A desktop-only package answered "This package has nothing to install here." and the desktop half of a
mixed one was skipped with a toast, because the only clone lived in Electron
(`installDesktopPluginFromGit`). Since #145072 the Webapp *loads* whatever sits in
`<root>/desktop-plugins/`, so the last mile was missing: no way to put it there from the UI.

This adds `plugins.manage` `install_desktop` / `remove_desktop` — the backend half of that install —
and points the dialog at them when it is not running in Electron.

- `hermes_cli/desktop_plugin_install.py`: clones a repository's desktop half into the app-level
  `desktop-plugins/` root. Same resolution, folder name and package-marker rules as Electron, and the
  same staged-copy-then-rename publication under the root's writer lock, so a reconcile pass cannot
  copy a folder underneath it. The clone is held to the commit the inspection read, so a repository
  that moves after review cannot install a tree nobody looked at; `force` re-inspects (a forced
  reinstall means the repository moved). `remove_desktop_plugin` refuses a package's own half unless
  forced, and refuses a linked folder it would only half-delete.
- `plugins_cmd_inspect.forget_inspection`: drops the ten-minute answer cache, used by a forced
  reinstall.
- `desktop_plugin_halves`: `ROOT_WRITER` and `publish_desktop_tree`/`read_package_marker`/`mtime_ms`
  go public (the installer shares the root's lock), a standalone plugin publishes with no marker, and
  the Webapp's read router imports the root from the one place that defines it.
- `plugins.manage install_desktop|remove_desktop` + contract (`tools_mcp_plugins`), regenerated.
- Renderer: `desktopInstallSupported()` is also true in a browser-hosted tab, `cloneDesktopHalf` falls
  back to the gateway, and a backend that predates the action keeps the old "unavailable in this
  environment" wording. Uninstalling a disk plugin uses the same fallback.
- Docs: the Webapp install/remove paragraph now describes the working path.

Tests: 10 installer (real local clones: standalone vs package marker, force, sha pinning, path-shaped
names, linked folder, removal rules), 6 gateway RPC (incl. contract validation), 3 browser-modal cases
(desktop-only, both halves, old backend) beside the 6 existing ones, and one route test that installs
through the backend and then reads the plugin back over `/api/desktop-plugins/*` — the whole trip the
browser makes.
2026-10-28 17:21:32 -07:00
Teknium
95762e286d fix(groups): the standalone backend forwards every room method the gateway serves
A Group Chat created before a gateway served the profile is imported into the gateway's store
and fenced in the standalone one (gateway/hosted_rooms_gateway_import.py). The Desktop's local
backend (`hermes serve`) forwarded room calls to that gateway from a hand list that stopped at
groups.approve, so groups.attachment.upload/download ran against the fenced copy and every
Attach files answered "This Group Chat is managed by another gateway.", and groups.discard (no
handler on this wire at all) answered "unknown method".

- The forwarded set is now the gateway route's own GROUP_METHODS, so a new room verb on the
  gateway route is forwarded (and advertised in forwarded capabilities) without a second list.
- groups.discard gets a contract and handler on this wire: forwarded to the owning gateway, the
  only runtime that offers Discard; refused (4127) on a room this backend drives itself.
- The owner hop accepts answer frames up to the largest room attachment (base64 of 15 MB plus
  envelope) instead of websockets' 1 MiB default, so a forwarded download of a real file fits.

Fixes #145960
Refs #144648
Reported-by: dasader <dasader@users.noreply.github.com>
2026-10-28 08:13:15 -07:00
Teknium
2023f6cc4d fix(gateway): a Group Chat whose members can't be woken says so once, with Retry
Review of #145981 (P2): after a Send is stored, a room preparation that keeps
failing (a member whose profile was deleted, a full room log) retried on every
driver pass forever, and the error only overwrote the process-wide driver
last_error that no client renders. The user saw "sent" and no member answered.

Now each room counts consecutive preparation failures (contention and
ownership moves never count). The third one appends ONE member.unavailable
event to the room ("Members could not be woken: <reason>"), which Desktop and
the Webapp already render, using the control headroom so a full room can still
say why. The room's status lists a Retry row (groups.retry, task_id
prepare:<room_id>) and a per-room last_error, and the driver stops preparing
that room until the next Send or Retry. A failed Retry stays stalled and is the
RPC's error, without a second notice.

Refs #145977
2026-10-28 07:22:05 -07:00
Teknium
857d224808 fix(groups): name a missing RPC method as unavailable, and carry group files on the tui_gateway route
Any unknown JSON-RPC method on the tui_gateway route answered "the client and the Hermes
backend are out of sync (different versions)", which the Desktop/Webapp toast turns into
"update both" even on matching versions. A JSON-RPC client sends no version, so neither
route can know the versions differ: both now answer -32601 "unknown method: <m> — not
available on this Hermes backend" from one helper (the "unknown method:" prefix clients
match on is unchanged).

The concrete case was the group composer's groups.attachment.upload, which only the
gateway route served, while HostedRoomServerRPC declared accepts_attachments=False so a
member turn with a file failed attachments_unsupported_on_route. The tui_gateway route now
serves groups.attachment.upload/download over the same room attachment store, and its
member transport resolves event-bound bytes per member exactly like the gateway route
(bound_submission_payload, shared): documents ride as prompt path lines, images as an
in-process-only _hosted_images list handed to the turn as its image paths.

Refs #144648 (WA-20)
Refs #145184
2026-10-27 20:24:05 -07:00
unsupportedpastels
26ba38a098 fix(webapp): report the commit an inspection read, and share the detection cases
The gateway inspection reported which halves a source ships but not the
commit it read, so for an unpinned Install from Git the reviewed tree and
the installed tree could differ if the source moved in between. Return
the inspected HEAD as `sha` (a catalog entry's is its reviewed pin) and
carry it through inspectAgentPlugin, so the install can be held to it the
way the native Desktop probe's will be. A cached answer keeps the sha it
read.

The component-detection rules now live in two inspectors (Python and
Electron). tests/fixtures/plugin_component_detection.json holds one set
of cases both run, registered as a shared fixture so editing it runs the
pytest and vitest consumers.
2026-10-27 21:32:38 -04:00
unsupportedpastels
3f945df636 fix(webapp): inspect plugin repositories through the gateway
The install dialog inspected a repository only through Electron's
probePluginRepo. The browser-hosted app has no such bridge, so every
install stopped at "Plugin inspection is unavailable in this
environment" with a Retry that could never succeed.

Add a read-only plugins.manage inspect action. It resolves the source
with the installer's own rules, applies the kill list, clones into a
temporary directory outside every profile (catalog entries at their
reviewed pin) and reads only the manifest files; no plugin code is
imported or run. The renderer keeps Electron's inspection when present
and otherwise asks the gateway, with the same stale-result protection.

In the browser a desktop half cannot be installed: a mixed package now
installs its agent half and reports the desktop half as unavailable,
never as installed, and a desktop-only package says there is nothing to
install. Retry is hidden when it cannot help (inspection unsupported by
the backend, nothing installable here).
2026-10-27 21:32:38 -04:00
rob-maron
384e4bde56 fix(model-picker): no "Free" tag on subscription-billed rows for window plans
Rows the gateway bills to a subscription the account holds (billing_mode:
subscription) keep their free usage level, so a full allowance never dims
them, but the pickers no longer label them "Free": that subscription pays.
The ids ride on plan_usage.subscription_model_ids for Desktop/TUI; CLI and
messaging pickers use usage_tag_levels().
2026-10-27 12:44:44 -07:00
Teknium
1b96f079da fix(contracts): declare messages_omitted on the canonical resume snapshot
session.resume with omit_messages returns messages_omitted, but CanonicalSnapshot
forbids undeclared keys: every omitted Desktop open logged a contract violation and
the reply raised under strict checking. Declare it and regenerate the TS/OpenRPC.
The new test drives the omitted resume through dispatch, where the reply is checked.
2026-10-27 12:11:20 -07:00
Teknium
1f0f2cecd1 fix(desktop): a re-sent reply segment upserts by its wire identity
A turn's message.* frames can reach the renderer twice: a reconnect
replay under new seqs, a superseded attempt that re-streams the segment
it already sent (#144609), a second socket. They carried no identity, so
the renderer could only append, and the copy painted beside the original:
inside the live bubble after its tool row, or as a second bubble.

The backend now stamps a prompt turn's frames (tui_gateway/
stream_segments.py): message.start carries the turn's turn_id; every
message.delta adds its segment (interim seals before it) and its offset
in UTF-16 code units inside that segment; every message.interim the
segment it seals. The contract and generated TS types carry the fields.

The renderer keeps a per-session cursor of how far the turn's reply has
been applied (use-message-stream/segment-identity.ts). A delta it has
already applied is dropped (an overlap keeps only the unseen tail), a
seal of a segment already sealed is a no-op, and a message.start whose
turn_id is the session's current turn is not a new occurrence. Frames
without a stamp (older backends, non-prompt emitters) take the old path,
and text the agent genuinely repeats in a later segment still renders:
identity, not content, decides.

The core e2e spec gains the reload-mid-answer step back and the replay
spec (start + narration re-sent when the tool starts).
2026-10-27 11:50:16 -07:00
dokterdok
4ca9b11ccf fix(webapp): send from plain-HTTP origins without losing the draft
Opened over http://<LAN, VPN or Tailscale IP> (the Webapp's documented
wildcard-host setup), the page is not a secure context, so the browser
exposes no crypto.randomUUID. Pressing Send cleared the composer, then
minting the submission id threw before the restore handler was in
place: the words were gone and nothing was sent. New chats, titles,
attachments, queue drains, pop-out windows and group operations failed
the same way.

Export the existing session-mutation id helper from @hermes/shared as
randomUuid (crypto.randomUUID when present, else
crypto.getRandomValues), re-export it from the plugin SDK, and mint
every renderer and hermes-bots id through it. An ESLint rule keeps
crypto.randomUUID out of src/, so the guarded call sites move to the
helper too. The composer now also routes a synchronous throw while
preparing a send through the same restore path as a rejection.

To keep sdk/index.ts within its scripts/check line cap, the comment on
the SDK's Panel re-exports shrinks to one line.

Refs #141864, #93508

(cherry picked from commit b55377a3a6bdb8788489e2194072475e3e30247f)
2026-10-26 21:30:03 -04:00
Teknium
8da9e0b432 fix(desktop): resolve hidden translucency to off so Linux heals on launch
Settings hides the translucency row on Linux, but the renderer still
resolved the platform default (29% tint, a glass default that falls back
to Clear where glass is unsupported), drew the Clear overlay scrim for it,
sent it to main and persisted it to translucency.json. Main now refuses to
hand that value to a Linux window, but a hidden setting should have no
effect anywhere, so the renderer resolves it to off where the row is
hidden. The resolved off state goes to main over IPC, which rewrites a
translucency.json an earlier build left at 29, so an affected profile heals
on its first launch on this build.

Electron 44 honours setOpacity on Linux (X11 _NET_WM_WINDOW_OPACITY and
native Wayland alike), so the comments that called it a no-op are
corrected.

Co-authored-by: IPBDW <bagusdharma0202@gmail.com>
2026-10-26 15:02:10 -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
unsupportedpastels
55f188d9ae fix(groups): allow member actor fields and send retry coordinates on serve
groups.log logged a contract violation on every read with bot replies because
RoomActor forbade the member fields the gateway stamps. Serve retry rows now
carry member_id and execution_generation, so Retry works over SSH, URL and
Cloud connections.

Rows HR-11, HR-14.

Refs #143547
2026-10-25 11:31:51 -04:00
emozilla
797999de01 fix(files): a doubly encoded file URL names the file in the folder its label shows
A `file:` URL holding `..%252f` passed the renderer's encoded-separator check, because only after
one decode does it read `..%2f`. The gateway then decoded the path a second time when the first
reading did not exist, turned `..%2f` into `../`, and served a file from outside the folder the
URL names: the preview or clip on screen was not the file its label showed.

The renderer now refuses a URL whose decoded path still encodes a separator (`%2f`, and `%5c` in a
Windows path) or a dot-segment, as it already refused an encoded separator. The gateway never
decodes a `file:` URL's path twice, and its one-decode rescue for a doubly encoded plain path
(#103425) no longer applies when decoding would add a `.` or `..` segment.
2026-10-25 03:22:29 -07:00
emozilla
08650aef50 fix(desktop): fall back to the cached socket URL when a native ticket mint fails
The browser host's change made a failed native ticket mint reject on local Electron too, where
main dials the cached URL. Only the Webapp's own socket (native_dial=browser) rejects now; that
value is one shared constant, BROWSER_NATIVE_DIAL.
2026-10-25 03:22:20 -07:00
Bear Huddleston
072452f7f4 fix(desktop): read file: URLs with one shared parser
Ported from BearHuddleston's #93508.

@hermes/shared gets fileUrlToNativePath, which reads a file: URL the way the URL implies: a UNC
host or a drive letter is Windows, anything else POSIX. Previews, media and Electron's media
protocol use it, so a drive-letter or UNC URL names the same file on every surface and a URL that
encodes a separator names none.

Co-authored-by: emozilla <emozilla@nousresearch.com>
2026-10-25 03:22:18 -07:00
Bear Huddleston
7ac4cf552c feat(desktop): carry the browser host renderer from #93508
Carried from BearHuddleston's #93508: the browser bridge and transport,
launch-session handling, touch and phone layout, browser previews, file
staging, the host terminal rail, Webapp settings pages and media ticket
renewal. Relay-only and fence-only code stays out.

Co-authored-by: emozilla <emozilla@nousresearch.com>
2026-10-25 03:22:15 -07:00
Bear Huddleston
b5eb5ee7a8 feat(webapp): carry the browser-hosted Desktop's server pieces from #93508
Carried from BearHuddleston's #93508 onto main. The Webapp relay and the
profile-incarnation fence stay out: carried code follows main's
named-profile rule and refuses a missing or deleted profile home.

- Webapp routes: one-use launch tickets, window handoff, and gateway
  WebSocket tickets minted for the signed-in browser
- Browser surface policy and the SPA document policy
- A host terminal for the browser that survives reconnects
- Staged browser uploads and file tickets; file.attach takes a staged upload
- hermes sessions adopt
- Webapp bundle build helpers and the renderer freshness check
- Regenerated gateway contracts

Co-authored-by: emozilla <emozilla@nousresearch.com>
2026-10-25 03:22:14 -07:00
Teknium
4fb80ec2ac fix(desktop): exact tool ownership per chat owner; whole-path producer match
Review fixes (Greptile on #143980):

- Ownership is exact: `plugins.manage list` reports each package's tools by
  name, including the tools its MCP servers actually registered, instead of
  `mcp__<server>__` prefixes (sanitized names can collide and a clamped long
  name loses its prefix). A name two packages list belongs to neither;
  Desktop's longest-prefix guess is gone and `tool_prefixes` is dropped.
- Ownership follows the chat: the list is fetched from the session's own
  owner route with its profile (`knownOwnerForSession` +
  `requestForSessionProfile`) and cached per owner, not from the window's
  active gateway.
- Stale answers never restore removed ownership: each fetch carries a request
  id and only the newest request for an owner may write; a plugin-list change
  clears the cache and orphans in-flight answers.
- A failed fetch retries with a bounded backoff (2 s doubling to 60 s)
  instead of latching the error.
- The producer match is a whole-path match (`/out/a.glb` never matches inside
  `/out/a.glb.bak` or `/x/out/a.glb`).
2026-10-24 06:14:06 -07:00
Teknium
6dc1c398e2 feat(desktop): plugins render the media their own tools produce
A Desktop plugin can now register how Desktop shows a MEDIA: attachment
produced by one of ITS OWN tools (TOOL_MEDIA_RENDERER_AREA,
'transcript.toolMedia'). Ownership is provenance, never file type: the
transcript finds the tool call in that turn whose result produced the path
(earliest call wins, so a later `ls` only mentions it), and the plugin's
component replaces the built-in player only when that plugin's package
registered the tool.

Why: the elevenlabs-sound-effects and meshy plugins each needed a custom
card for their files and had to make the model emit a ::directive (plus a
backend handshake) to get one, which leaves non-Desktop users a raw line.
With this seam the tool keeps returning a plain MEDIA: tag every surface
understands and Desktop alone upgrades it.

- Backend: `plugins.manage list` rows carry `tools` (native tools the
  loaded plugin registered, minus built-in names and names two plugins
  list) and `tool_prefixes` (`mcp__<server>__` for each MCP server the
  loader attributed to a portable package). Contract + generated TS.
- Desktop: lib/tool-media-renderers.ts (contract, producer lookup,
  ownership resolution), store/tool-media-owners.ts (lazy per-route
  ownership list), components/assistant-ui/tool-media-slot.tsx wired into
  MarkdownLink's MEDIA and bare-path branches. Claims on core or other
  plugins' tools, or from a desktop plugin with no agent half, are refused
  with a console warning. A throwing renderer, a disabled plugin or an older
  backend fall back to the built-in player.
- Props: file {path, name, kind, mime, resolveUrl()} (stream route for
  audio/video, works on remote backends), toolName, toolCallId, args,
  result, sessionId, fallback.
- Docs: desktop-plugin-sdk.md section with a worked example; skill ref.
2026-10-24 06:14:06 -07:00
alt-glitch
36a9d412b3 fix(gateway): a reconnecting viewer gets the owner's waiting server requests again
The canonical session.resume / session.events.since replies carried only
approval and clarify prompts. Server-to-client requests sent through
gateway/session_server_requests.py (setup_beat, sudo, secret, batch clarify,
the Desktop UI bridges) kept no params and had no open_requests, so a
renderer reload mid-onboarding showed no card while the agent blocked up to
CARD_TIMEOUT_S. The legacy sidecar replayed them (tui_gateway/server_requests.py
open_requests); the shared channel already re-delivers open_requests from any
reply.

_Pending now keeps the frame's params; open_requests(events, session_id)
lists the requests still waiting on that live stream (with a batch's locked
answers), and both replies carry it. The contracts gain the optional field.
2026-10-24 12:34:49 +05:30
Teknium
5570f5f5d0 fix(plugins): the dependency restart hint names the process that cannot import
activate_plugin_now merged the gateway's and the Desktop/dashboard
backend's missing dependencies into one list, and the hint picked its
restart line from whether the gateway answered. A backend booted before
the install beside a gateway restarted since then got "hermes gateway
restart", which leaves the backend unable to load the plugin.

The activation now records which processes reported the gap
(missing_in: gateway / backend, declared on PluginActivation) and the
hint prints one restart line per process.
2026-10-23 10:01:05 -07:00
Teknium
57dcda1376 fix(plugins): a plugin that fails on its new dependency still asks for a restart
Three gaps in the restart notice, found in review of #143404:

- A plugin importing its dependency at module load fails to load in a
  gateway booted before the install, so it had no activation summary and
  enable still printed "nothing of this plugin needs a session or
  restart". The gateway's reload answer and the in-process go-live now
  carry a dependency-blocked entry for it (dependency_blocked_summaries),
  kept out of the on_plugin_loaded payload since nothing of it loaded.
- PluginActivation (extra="forbid") did not declare missing_dependencies,
  so every plugins.manage reply carrying it violated the wire contract.
  Declared + regenerated the shared contract.
- The presence probe ignored versions: a running process holding x 1.2
  satisfied x>=1.3 after a plugin update raised the floor. It now checks
  the requirement's specifier, in this process and in the selected
  generation.

The restart line also names the process that answered: the messaging
gateway, or the desktop app / dashboard when only the serve backend did.
2026-10-23 10:01:05 -07:00
Ben Barclay
dc1f72689d fix(plugins): say restart when a running process cannot import new plugin deps
Dependency activation is a boot decision: a gateway or dashboard running when
`hermes plugins enable` commits a new generation keeps the one it booted with.
Enable still nudged that gateway to reload, then reported "Gateway reloaded
plugins; nothing of this plugin needs a session or restart" while the plugin
failed to import its dependency there (a terminal backend then fails with
"No module named '<dep>'"), and discovery told the user to run
`hermes pm repair`, which changes nothing.

The activation summary now carries `missing_dependencies` read in the process
that loaded the plugin (the gateway, for its reload answer); `restart_required`
is set when this process or the gateway lacks them, and the CLI hint and the
discovery warning say restart when the selected generation carries the
dependency (repair only when it does not).
2026-10-23 10:01:05 -07:00