Commit Graph

463 Commits

Author SHA1 Message Date
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
(163a633265); 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
Teknium
b87977cadd refactor(api): remove browser-extension control (its browser tools are gone)
The broker's capability allowlist named only the deleted browser_navigate/click/type/... tools, so a
bound extension controller silently did nothing (review P1-1); owner ruling: remove the feature.
Drops the broker, artifact store, extension router, /v1/browser-control + /v1/artifacts routes,
browser.controller.* RPCs/events (contracts regenerated) and the per-request controller identity.
The authenticated-identity helpers bot relay and session ownership still use move to
gateway/session_identity.py; persisted API admissions carrying 'browser_control' still recover.
2026-10-23 01:42:27 -07:00
Teknium
433e420be4 refactor(browser): drop /browser use, the browser.manage use action and the downgrade notice
browser_exec is the only core browser path, so there is no Browser Use /
built-in tools switch to flip and no silent downgrade to announce.

- classic CLI, Ink TUI and the gateway browser.manage RPC lose the `use`
  action (contract regenerated: BrowserAction, enabled, browser_use);
- /browser status no longer reports a mode; the Chromium-fallback line for
  Lightpanda and the dead "chrome" engine row go with the built-in tools;
- browser_backend_notice leaves the session snapshot, the CLI banner and
  the canonical contract.

TUI locale packs and _keys.tui.json drop the five slashCmd.ops.browser
keys whose only caller was `/browser use`.
2026-10-23 01:41:24 -07:00
Siddharth Balyan
7b0f11fc7b feat(connectors): no guest on page open, connector sign-in offer (#143248)
* feat(connectors): list hosted apps without creating a guest identity

Opening the desktop Connectors page used to create a Nous guest identity:
connectors.list, connectors.catalog, connectors.accounts and
connectors.policy.get each created one before answering, because the
Portal's catalog route needs a token. A user who only looked at the page
got an identity anyway.

While there is no identity yet (and one may still be created), those four
reads now answer without one: the catalog from a snapshot that ships with
Hermes, an empty connector list, no accounts and no rules. Connecting an
app still creates the identity, as before.

scripts/refresh_connector_catalog.py rewrites the snapshot from a
signed-in install. It leaves logos out: no client draws them.

* feat(free-tier): sign-in offer for guests who connected apps

Every free-tier sign-in offer keyed on the welcome trial, so a user on
their own model key who connected apps through a guest identity never saw
one.

The offer record now tracks two offers on the same schedule. `trial` is
unchanged. `connector` is for a guest without the trial that has connected
an app: each app that finishes connecting sets `has_connected_app` on the
guest state (so it dies with the guest) and counts as a finished task.
free_tier.status (still a pure local read) adds connector_nudge_due_in, and
free_tier.claim_nudge takes a `kind`.

The desktop reads the connector offer whether or not the trial is
available, re-reads the status after a turn or a page connect, and shows
connector copy instead of the free-allowance copy. After a page connect
settles it also re-reads the catalog and rules, so the bundled catalog
from before the identity existed is replaced by the account's own.

* fix(connectors): point the sign-in hint at `hermes auth upgrade`

`hermes connectors` told users to run `hermes login`, which no longer
exists. Both hints now say "Run `hermes auth upgrade` to sign in."

* feat(connectors): read the public catalog with no token; one guest rule per entry point

The bundled catalog snapshot listed apps a new guest cannot connect and
went stale whenever the catalog changed. With no token, the Connectors
page now reads the Nous Portal's public catalog route
(GET /api/v1/connectors/catalog/public), sent with no Authorization and
parsed with the existing catalog model. Once a token exists the page reads
the signed-in route, as before.

Whether an entry point may create the guest identity is now declared once
per entry point instead of checked inside handlers:
- managed_client(creates_guest=...) is required: connect (page, agent,
  card retry) and the explicit lists (CLI `hermes connectors list`, agent
  manage_connections status/display) pass True, unchanged.
- account RPCs declare creates_guest on _account_method: catalog,
  accounts and policy.get never create one; tools and the account writes
  still do.
- the page's connectors.list never creates one; connect does.

With no token the page reads give true answers: public catalog, empty
connected list, no accounts. The invented "unrestricted" policy is gone:
the desktop asks for rules only once the list has rows, which needs a
token, and policy.get without one refuses with sign-in-required.

Deleted: the bundled snapshot, its refresh script, and the no-identity
stubs.

* fix(connectors): CI and review round: older backends, outside connects, link connects, guest opt-out

- CI: test_legacy_fallback_ticket_profile_verbs faked managed_client with
  no arguments and gave the secondary profile no token, so the page list
  (now token-gated, creates_guest=False) never reached it. The fake takes
  the new keyword and the profile holds a token.
- Older backends: a trial claim sends free_tier.claim_nudge with no
  params again. An older backend rejects the unknown `kind` key and would
  have dropped the trial offer; the new backend defaults to the trial.
  Only the connector claim sends `kind`.
- Outside connects: while the page's list is empty (no identity), every
  finished turn or connect re-reads the list and catalog. An agent connect
  in a chat then moves the page to the signed-in routes and its rules.
- Link connects: an agent status read that sees a connected app on a
  guest without the flag arms the connector offer, so messaging and
  one-shot connects (no operation watcher) count too.
- Opt-out: the connector offer requires nous.guest to be allowed.

* fix(connectors): the Connectors page list arms the connector offer too

A guest whose apps were connected by an older Hermes has no has_connected_app flag, and only the operation watcher or the agent's status read set it. The page's connectors.list now passes its rows to note_connected_apps_seen, which owns the any-connected check for both list reads.

* fix(connectors): review round 3: accounts after an outside connect, retryable offer record

- An identity created outside the page (an agent connect in a chat) now also re-reads the accounts cached while there was none, so the new account row, rename and remove show up.
- note_app_connected records the connector task before it sets has_connected_app. The flag ends list-read sightings, so a failed schedule write no longer leaves the offer unarmed for good.
2026-10-23 06:08:27 +05:30
Teknium
feecf7cbd2 fix(usage-window): the status bar drops the plan gauge once a reply arrives off a window plan
Greptile: "Old allowance stays visible" (gateway/session_usage.py:101-102).

Both usage builders (gateway/session_usage.py::tui_usage and
tui_gateway/server.py::_get_usage) always send `calls` and send
`plan_gauge` only on a window plan, so a complete usage payload without
the key means the session is off the plan (or the allowance reset).
Desktop merged every payload into the stored usage, which kept the old
gauge forever. The new `mergeUsage` (apps/shared usage-tick) clears it on
complete payloads and keeps it across partial ticks; usageFromTick forwards
a top-level frame's gauge so a canonical counters-only frame is complete
too. The wire stays byte-identical for accounts never on a window plan.
The Ink TUI never reads plan_gauge, so it has no stale copy.
2026-10-22 14:34:55 -07:00
Teknium
e106c2c9fa fix(usage-window): a pinned current model never takes the Recommended heading in the composer menu
Greptile: "Headings mislabel pinned current models". sectionAt assumes picks-first order,
but the composer menu prepends a current model the catalog omits, so with featured A and
pinned custom X, X got "Recommended" and A "Other models". Re-apply the picks-first
order (splitRecommended) after the pin, and state the order contract on sectionAt.
2026-10-22 13:50:11 -07:00
Teknium
655926daba fix(usage-window): carry the plan gauge on the canonical usage feed
Greptile: "Normal Desktop usage omits gauges". plan_gauge was built only in
tui_gateway/server.py::_get_usage (the embedded backend), but a normal local
Desktop session reads its session.usage ticks and message.complete usage from
gateway/session_usage (usage_stats -> tui_usage), so the status-bar allowance
never showed. Move the builder to gateway.session_usage.plan_gauge, use it on
both paths (omitted off a window plan, as before), and type it on the Usage,
SessionStats and session.usage contracts (regenerated).
2026-10-22 13:50:11 -07:00
Teknium
c00f999ba4 Merge origin/main into window-plans
Resolves the desktop i18n conflicts: main moved en/ru errorCodes into
en_error_codes.ts / ru_error_codes.ts, so usage_window moves there; ar/ja/zh/
zh-hant keep both usage_window and main's workspace_unavailable. _keys.desktop.json
regenerated.
2026-10-22 12:53:41 -07:00
Austin Pickett
92663ae805 feat(desktop): install with +, switch once installed; tier badges on the install dialog (#142708)
* fix(desktop): catalog card actions sit above the card-wide hit area

On compact and hero cards the action slot comes before the title button,
whose ::after stretches over the whole card and painted on top of it, so
clicks on the switch or + opened the details instead.

* feat(desktop): install catalog entries with +, switch only once installed

Install is one-way, so it is now a + button instead of a switch that also
meant enable/disable. Installed entries keep their on/off switch. Featured
cards and the detail spell it out as "+ Install". A plugin's Uninstall
moves from the header trash icon to a labelled row at the bottom of its
detail.

* feat(plugins): badge the install dialog with the catalog tier

The dialog called every catalog pick Verified. It now says Official,
Verified or Community. plugins.catalog.lookup returns the tier so
hermes://plugin/install?catalog= links badge the same as in-app picks.

* refactor(desktop): plugin Uninstall row is its own component

Keeps PackageRow under its code-health complexity cap.

* chore(i18n): regenerate desktop locale keys for catalog.install

* fix(desktop): "Install here" badges the catalog tier too

The third way into the install dialog opened it with a catalog name but no
tier, so a community package still read Verified. Read the tier from the
cached catalog by name; uncached keeps the generic badge. Also note why the
catalog path passes entry.source as the tier.
2026-10-22 11:28:08 -04:00
Siddharth Balyan
944c3a4340 Merge pull request #142919 from NousResearch/sid/drop-serve-era-desktop-spawn
refactor(desktop): delete what only the Desktop's own hermes serve reached
2026-10-22 14:47:55 +05:30
alt-glitch
fe46dc282c chore: trim comments the code already says across the onboarding stack
Comment and docstring edits only (no code or assertion changes): bug
history in module docstrings, narration, cross-refs and test copies of
the handshake comment go; WHY comments on ordering, locking, the launch
profile scope and the old-backend wire constraint stay.
2026-10-22 13:43:01 +05:30
alt-glitch
5e2b545dd9 fix(desktop): give a fresh install its onboarding and free trial again
Since the unified gateway (#106742) the Desktop attaches to the shared
gateway instead of spawning its own `hermes serve`. Onboarding, the
welcome-trial claim and free inference decide "is this the Desktop app on
this machine?" from HERMES_DESKTOP and the spawn token in the process
environment, which the gateway never has. So `onboarding.state` answered
eligible:false for every new user, who landed on the provider picker with
no free account.

The answer now comes from the connection:

- The Desktop sends `client.capabilities {desktop_local: true}` first on
  every socket, as a call of its own, before the boot's first
  `onboarding.state` (the backend reads frames in order). An older backend
  refuses only that call and keeps the server_requests answer.
- The gateway counts it only on a native-ticket connection, so a remote or
  tunnelled client never gets the trial.
- Requests on that connection run under `serving_local_desktop(True)`, and
  a chat it creates records the declaration in its launch policy, so the
  chat's later turns run the same way (`local_desktop_turn`).
- A trial-only user has no configured model; a canonical chat freezes its
  model at creation, so the chat now freezes the free model
  (`_welcome_trial_model`) instead of refusing.

Live: a --fresh-install sandbox launch minted a guest account, opened the
onboarding chat and the free model answered.
2026-10-22 13:42:49 +05:30
Teknium
b3e7289110 fix(gateway): groups.state names the member answering a hosted room
Gateway-owned group rooms only reported a room-wide `working` flag, so a
client had no way to show which bot was busy. `HostedRoomService.status`
now returns `member_activity`: the room's live tasks (queued, running,
stopping) with their member, in admission order. `working` derives from
the same list. The field is optional in the contract, so older gateways
simply omit it.

Fixes #102196.
2026-10-21 23:18:49 -07:00
rob-maron
cafa03f7f4 PR review comments 2026-10-21 23:05:11 -04:00
rob-maron
83c5737be2 merge main in 2026-10-20 21:19:31 -04:00
rob-maron
15307dece7 Usage-window plan support 2026-10-20 21:04:30 -04:00