A report is a claim that the user is at this computer and this window
can show them this session's reply. A false claim silences a phone for
a reply nobody sees, so the reporter corrects whatever it last told a
connection the moment it stops being true, and claims nothing whenever
it is not sure. The backend ages a record by itself; silence is safe.
The shared channel remembers `client_activity` from this connection's
own `client.capabilities` answer and forgets it on detach and attach;
the gateway client exposes it as `clientActivity`.
What is in view, and where to report it (`store/presence-view.ts`): the
chat on this window's HashRouter route, only when its runtime binding
is the one the composer would send to (route, selection and the
runtime's own stored id agree), and only on the connection a submit for
it would use (the composer's owner ladder and the registry's passive
route, never a dial). A draft, another page (Settings), a stale binding
or a profile riding a shared socket is nothing in view. Nothing is ever
created, resumed or bound to report.
Evidence (`store/presence.ts`): with main's OS idle clock, input
anywhere on the computer (`basis: system`); without it, pointer/key/
wheel/touch input inside this document while visible (`basis: page`).
Elapsed time is monotonic; a snapshot older than the newest adopted one
is ignored, a late delivery is aged from when main sampled it, and page
input from before a suspend is dropped on resume.
The reporter keeps what it last told each connection. It reports only
on an open, negotiated connection that advertised the feature, checked
at the moment of sending and never queued; at most once per 45 seconds
while active, and at once when the user becomes active, the session in
view changes or `can_alert` changes. When the session leaves view, the
owner moves, or nothing is in view, it sends `sessions: []` there; when
`can_alert` turns false on stale evidence, also `sessions: []`. Lock
or suspend sends one `away: true` per episode on every connection that
holds a statement or owns the session in view.
`can_alert` is the session in view in a visible, focused window whose
chat is the tab in front (another tab of its zone, a second
conversation, a preview or a tool, can cover it while the route and the
main session stay, and its zone can be minimized), or this client's
turn-done notification for it firing if the turn ended now: one non-consuming check shared with the notification dispatch
(preference and kind, the post-connect quiet interval, the background
and active-session condition, and in a browser the live permission).
The dispatch throttle cannot be predicted and is not.
A route move reaches the reporter at once through `usePresenceRoute`
(a location effect in the app shell): HashRouter pushes history without
a `hashchange` event, so opening Settings over a chat would otherwise
stay claimed until the next 15 second tick. The `hashchange` listener
stays for a hash edited from outside the router.
Input in this window that ends an idle spell is reported at once, not
at main's next 15 second poll. Without an OS clock the input is the
evidence. With one, that clock stays the only evidence: main is asked
for a fresh sample a quarter of a second later, once the OS has counted
the input, and at most once a second for input the OS does not count.
Page listeners are passive and capture-phase and only record a
timestamp. A refused report is swallowed. The gateway boot hook starts
one reporter per window; it lives in timers and listeners and never
renders.
Presence capped each connection at 16 records per source, but a session id
could be any length: one accepted client.activity report naming 16 ids of
1 MiB each stayed in memory for the life of the socket, and touch() kept
whatever session_id an input request carried, even one the request was then
refused for.
client.activity now refuses an id over 256 characters (4001, nothing changes)
and touch() ignores one. The limit is one named constant, MAX_SESSION_ID_CHARS;
the contract's sessions items and the developer guide state it.
`runtime.describe` lists `client-identity-v1` and `client-activity-v1`,
so a client can tell an owner that keeps a connection's label and
activity reports from an older one.
The shared JSON-RPC channel takes an optional `clientIdentity` from its
host and, once per connection generation, right after its
`server_requests` call, sends `client.capabilities {client}` as a call
of its own, ignoring an error reply (an older backend refuses the
unknown param for that call only). A host that names none sends
nothing, so the TUI and other users of the channel stay unannounced.
The Desktop names itself `hermes-desktop` / `desktop` in Electron and
`hermes-webapp` / `webapp` behind the browser bridge. The version is
this machine's own build (the install's version, then the release it
was built from, then the display string), left out when it is a
placeholder or not a valid label version. Reading it asks the backend
and the local install, which takes seconds on a cold start, so the
hello waits at most one second for it and goes without; the read is
kept, and later connections of the window carry it.
The developer guide describes the hello, the kinds (sent on
`session.create` only to an owner with `client-identity-v1`) and
`client.activity`. All of it is attribution only and grants nothing.
A notification plugin needs to know, at the end of a turn, whether the
user is at a client that shows the session, so a phone can stay quiet.
gateway/session_presence.py keeps that per connection and session, in
memory only: one "last input" time fed by input the owner sees on the
connection (prompt submit, queued steer/replace, approval and clarify
answers, interrupt, steer, redirect; touched once from dispatch, and a
person's accepted answer to a server request card) and by the client's
new `client.activity` reports (`now - idle_seconds`, with the basis of
the evidence and whether the client can alert the user). The newest
evidence wins. A report is the connection's whole statement: records of
sessions it does not list are dropped, owner-seen input included.
`away` clears the connection's records. A connection keeps at most 16
records of each source (reports, owner-seen input), so a report naming
16 sessions and input on them never push each other out.
One socket can serve several profiles and session ids are unique only
per profile: owner-seen input is kept for the profile that saw it, and a
report (ids only) counts at read time for the one profile the connection
is attached to that id in, for none when the id is ambiguous.
`viewers(authority, session_id)` lists the connections attached to a
live session right now, with the hello's name and kind. A detached or
closed connection is not a viewer. `client.capabilities` answers
`client_activity: true` so a client reports only to a backend that
keeps the reports.
Nothing here reaches a prompt, a permission or a toolset. The serve
handler ledger and its generated page list `client.activity`.
`client.capabilities` takes an optional `client` label
(`{name, version?, kind?}`): a client sends it as its own call once per
connection, so an older backend refuses only that call. A valid label
is kept on the WebSocket transport (`client_identity`) with an unknown
kind removed; a malformed one answers 4001 before anything else in the
call takes effect, and the connection keeps the label it had. A later
call without `client` keeps it too. Transports that keep no identity
(stdio) ignore it.
The label grants nothing; it is attribution only. Its contract class
moves to contracts/common.py so the liveness contracts can use it
without importing the canonical catalog early.
A client label may now say what sort of client it is: `kind` is a
string of 1-32 characters, and `desktop`, `webapp`, `tui` and `mobile`
are the kinds this owner knows. An unknown kind is not an error, since
a newer client may name a sort an older owner has never heard of: the
label is kept and read without it (`normalized_client`). The creation
request still carries the label as sent, so exact-retry identity is
unchanged.
The label stays attribution only.
A folder or site card can stay open after the turn that raised it. The desktop
asks approval.pending after every session.info and after every answer, and
removes a card that list does not name. A sender that leaves its card out of
the list loses it at the next check, and the contract did not say so.
The docstring of the approval request now states it in one sentence, and the
generated contract files carry it.
An approval request of kind access without a path, or of kind network without
a host, became a card titled "Folder access" or "Website access". It showed
the request's description, or "dangerous command" when the request had none,
and offered Allow and Always allow for something the person could not read.
The desktop now answers such a request with a JSON-RPC error, shows no card
and sends no notification. An entry of that shape in the pending list or in a
resume snapshot is not parked and not acknowledged. The contract model refuses
it as well, and its docstring says so; the generated contract files carry the
new sentence.
The test that pinned the old choice of the field reader keeps its assertion
and now says why the kind is kept: the request is refused as a folder or site
request and is never read as a command.
A sandbox plugin needs to ask the user about a folder or a website from
the chat when its sandbox refuses one. The desktop's approval card only
knew dangerous commands: it said Run, promised a config.yaml allowlist,
and was cleared at turn end while the sandbox still waited.
The approval server request gains an optional kind. Absent or "command"
keeps today's card. "access" (path, read or read_write) and "network"
(host, optional label) render a folder or site card with the risk line
under it and three buttons: Deny, Always allow... (confirm dialog) and
Allow (until the sandbox is switched off). Deny takes an optional
reason, sent as `reason` on the answer and on the approval.respond
fallback.
- Contract: kind, path, access, host, label and risk on
ApprovalRequestParams; reason on ApprovalResult and approval.respond
(command approvals ignore it). Generated TS and OpenRPC regenerated.
- Turn-end clears keep folder and site cards; Stop, close and reclaim
still clear every kind. Only a command approval stands in for the
turn's tool rows.
- Pending-list replay and resume snapshots keep the kind fields.
- OS notifications say "Folder access needed" / "Website access needed"
and offer Allow / Deny.
- Copy in every locale. Each over-cap locale's approval block moves to
an <locale>_approval.ts sibling unchanged; key manifest regenerated.
Hardening on top of the classic-CLI reporter (salvaged from #138152):
- Ink TUI (`hermes --tui`) reports too. useProgramStatus derives the state from the
stores every path already updates (busy, the approval/clarify/sudo/secret/vault/connection
overlays, the turn outcome recorded in turnController), so no answer path has to remember
to report "working" again. A 150 ms settle drops the busy flicker between submit and
message.start that otherwise flashed working -> idle -> working on every turn.
- msg text: the spec discards a whole report whose decoded msg holds C0, DEL or C1
controls; C1 (U+0080-U+009F) passed the old strip. Controls now collapse to one space.
- Config key moved to display.program_status beside bell_on_complete/bell_on_prompt (it is
a display preference, and the TUI's config sync already reads display.*); documented.
- _report_program_status lives on CLIChatTurnMixin, the mixin that calls it, so surfaces
composing the chat mixin without the modal mixin (TUI gateway CLI surface, stubs) do not
AttributeError at turn end.
slow_frame friction caps at 5 per bucket per day (renderer) and 50 (backend)
and starts at 100 ms, so a janky day reads as "5" and mild stutter is
invisible. Add hermes.desktop.long_frames.sum: the existing
long-animation-frame/longtask observer now also folds every visible-window
frame into a per-UTC-day histogram (50-100 ms, 100-250 ms, 250 ms-1 s,
1-5 s, >=5 s; LoAF reports >=50 ms only, the first band sits below the
100 ms slow_frame threshold, the rest mirror slow_frame) plus the day's
visible time, kept in DayAggregate via withState and shipped once per finished day on its
own RPC, shared_metrics.desktop_long_frames (never per frame).
desktop_daily keeps main's contract. An older backend answers -32601 for the
new method; the renderer settles that day's histogram unrecorded so the day's
existing daily report still lands and the pending day clears. The visible-time
clock credits only visible spans and drops any span longer than the tick + 60 s,
so a suspend credits nothing.
Backend: a SUM_METRICS counter, one row per bucket whose value is the day's
frame count (uncapped), each carrying the visible-minutes bucket so a rate is
computable; a visible day with no long frames reports one `none` row.
update_rollup_state rows may carry an amount (SUM_METRICS only). Own
once-per-day latch, profile-scoped. Gated by
the renderer $desktopMetricsGate and the backend enabled(); upload by send.
slow_frame friction is unchanged.
Measured: a synthetic day of 300 frames at 120 ms reports
{bucket: 100ms_to_250ms, count: 300} and stores value 300 (was 5).
The TS profile-id grammar lived in electron/profile-id-guard.ts, so renderer
code imported an Electron module for a regex, and the Bot creation dialog plus
the dashboard ProfilesPage and ProfileBuilderPage still carried private copies.
apps/shared/src/profile-id.ts now holds the one literal (PROFILE_ID_ARG_RE),
exposed as the narrow @hermes/shared/profile-id subpath. Electron gates import
it relatively (esbuild bundles electron/ without tsconfig paths); the renderer
and the dashboard import the subpath; plugins get it through a one-line
@hermes/plugin-sdk utility re-export, since the plugin fence allows only the
SDK. profile-id-guard.ts keeps backendProfileArg and re-exports the regex.
Per-caller trimming, case-folding, default/reserved names and the bot slugifier
are unchanged.
Guards swap the shared owner and prove every gate follows it, including the
Bot dialog (owner-driven rejection on a reachable slug), ProfilesPage and
ProfileBuilderPage, and backendProfileArg.
Refs #155595
The child watch mirror now sends `status: "complete"` with a completed
child's `message.complete` (the previous commit). Pin the other outcomes:
a failed, errored, interrupted or timed-out child, and one that reports no
status, keep the status-less frame, so the desktop still reads an error
summary such as "HTTP 500 upstream" as a failure.
`MessageCompletePayload`'s docstring said the mirror sends `text` only; it
now names the status. The two generated contract files carry that sentence
(`scripts/gen_gateway_contracts.py`); no field or type changes.
A bot that message_agent's a teammate gets nothing back until the reply lands or the wait times
out; if the teammate is parked on a clarify or approval only the user can answer, nobody sees it.
bot_delivery.list reads the existing receipts under each target profile's
runtime/bot_live_delivery (author bot:<sender>) and reports each unsettled delivery as
queued / claimed / working / waiting_on_you / failed (typed reason; unknown_outcome for an
ambiguous receipt, which must never be resent). The canonical owner joins each target's
admission row and its open prompts (PendingControls.waiting_kinds, a non-pruning read) under
that target's owner scope; the legacy sidecar handler reports the durable admission state only.
Nothing is written, claimed, cancelled or resent.
Teknium approved every improvement the usage backtest found:
- A keep-alive miss served by another upstream than the reply that cached the prefix (Nous serves one
Claude model from chatcmpl-* and gen-* upstreams; 70 switches broke a warm cache in the window), or
one that still read the stable system prefix, is routing, not lifetime. Real misses end warming only
on the second in a row (three misses of any kind end it too). The upstream key is data
(prompt_cache_clock.response_upstream: a gateway's upstream field, else the response id family),
stored on the clock event; a retried miss's rewrite is not charged to the money limit.
- cache_ttl auto: a person's chat starts on 5m and asks for 1h from the first message after an idle gap
past five minutes, for the rest of the session (kept per session id, carried to the compaction child,
re-derived from a stored clock that asked for 1h). The upgrade fires only when the clock holds no
guarantee and the last cache touch is over 300 s old, so markers never change on a warm prefix. No
idle keep-alives before the upgrade. /context names the pending tier. Explicit pins and machine
sessions unchanged. Wire snapshot regenerated: fresh cli agents now send 5m markers.
- Route store: a downgrade needs samples from two different sessions, an upstream switch is never a
sample, and a learned lifetime never undercuts the longest hit ever seen (kept outside the trimmed
recent gaps).
Tests pinning the single-miss stop and the 1h start are rewritten to the new ruling (assertions only).
agent/prompt_cache_routes.py: a per-profile store (<HERMES_HOME>/cache/prompt_cache_routes.json, atomic,
<= 500 routes, 7-day expiry) keyed by provider, host, model and marker use, fed by the clock from every
folded response (normal replies and keep-alives; no probes). After two consistent samples: never reads
back -> no keep-alives and no markers; re-writes the prefix on every hit -> no keep-alives; early misses
-> keep-alives on the learned lifetime (never past the tier) or none under a minute; an automatic cache
that dies early while the explicit one reads -> markers. /context shows 'Learned: <rule>.'
Teknium's rulings on PR #156455:
1. A request with cache_control markers is Anthropic spec on any wire or gateway: the 5m/1h it asks
for is declared and trusted (route ceilings still clamp); 'gateway_1h_untrusted' is gone. Every
unmarked request is OpenAI spec (30m, renewed by a read), Nous non-Claude models included.
2. The first keep-alive that misses disables warming for the rest of the session on that route (new
user messages and compactions do not re-arm it; a model/provider switch or a fresh session does).
The compact/offload fallthrough still runs; /context appends 'Keep-alives: off (one missed).'
3. While a tool call executes, keep-alives continue until it returns, uncounted against the idle
budget of 3 and bounded only by one rewrite's cost for that tool wait.
tui_gateway/prompt_turn.py: main added `_retain_refused_turn` at the spot where this branch added
`_pause_mark`. Both functions are kept, main's first; nothing else conflicted.
Documentation, the desktop app, skills and native code follow the interface. The published plugin API lists the storage interface names the plugin guide's replacement table gives, so the guide's examples and the bundled plugins that import them stay on the published list.
tools/ holds model tools. These six files register none: they snapshot and
restore a working directory for the agent loop, /rollback, /undo's
changed-files line and `hermes checkpoints`. They move next to the agent
loop that takes the checkpoints:
tools/checkpoint_manager.py -> agent/checkpoints/manager.py
tools/checkpoint_maintenance.py -> agent/checkpoints/maintenance.py
tools/checkpoint_pruning.py -> agent/checkpoints/pruning.py
tools/checkpoint_refs.py -> agent/checkpoints/refs.py
tools/checkpoint_undo_hint.py -> agent/checkpoints/undo_hint.py
tools/checkpoint_manager_profile_rename.py -> agent/checkpoints/manager_profile_rename.py
agent/checkpoints/__init__.py is a docstring only. Nine test files move to
tests/agent/checkpoints/. Every importer changes its import line in place,
inside the same function. Nothing stays at the old paths: none of the six
names is on the plugin API list, the shipped-release list or the
old-updater list.
Behaviour is unchanged. The four loggers keep their tools.checkpoint_*
names, so the lines stay under `hermes logs --component tools`. The folder
is not a root checkpoints/ package because the checkpoint store is
HERMES_HOME/checkpoints, which is the same directory as such a package on an
install whose checkout root is HERMES_HOME. agent.* is already packaged, so
pyproject.toml and the lists of root packages do not change.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py.
tools/ holds model tools. These two files register none: they are the
security scan that `hermes plugins install`, `update` and `validate` run
on a plugin tree, and every caller is a hermes_cli plugin command. They
move to hermes_cli:
tools/plugin_guard.py -> hermes_cli/plugins_install_scan.py
tools/plugin_guard_context.py -> hermes_cli/plugins_install_scan_context.py
Their three test files move with them to tests/hermes_cli/. Every importer
changes its import line in place, so no module is imported earlier or
later than before.
tools.plugin_guard keeps working. tests/compat/old_updater_surface.json
lists three of its names, because a `hermes update` from v0.21.6 to
v0.23.1 keeps running old code after the checkout swap and imports
tools.plugin_guard from the new tree (hermes_cli/plugins_cmd.py:209 at
v0.23.1). This is the first use of the compat table: one MOVES key, one
REQUIRED_NAMES row, and tools/plugin_guard.py written by
scripts/move/generate_shims.py. That file makes the old name the same
module object as the new one, so an old updater still runs the real scan.
tools.plugin_guard_context is on no frozen list and gets nothing.
Behaviour is unchanged. Neither file has a logger.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py; comments that named the old module stems were fixed
by hand; the two gateway contract files are regenerated from the
docstring that names the module.
Since 674f2d680d the closing row of a turn stopped during its tool run
carries display_metadata {"interrupted": true}, and hydration lends that
mark to the tool bubble it closes. Something can pause a running turn
(session.interrupt) and continue the same reply with a hidden prompt: a
host plugin does this to apply a sandbox grant, restarting or reloading
the sandbox in between. The finished reply read "Read example.com /
Response stopped / Read example.com / <the page>", and while the pause
lasted (1-4 s for a site grant, 10-20 s for a folder grant that restarts
the sandbox) the chat showed only "Response stopped" with an idle
composer. A user who took the reply for dead and sent again killed the
continuation: the gateway interrupts a running turn for a plain send.
A stopped mark says the reply ended there. When the same reply goes on,
it did not end there:
- Stored history (toChatMessages): a stopped bubble followed by a hidden
user row and more assistant output loses the mark. A visible user or
system row next (the user writing, the "resumed interrupted turn"
notice) keeps it, so a real Stop still reads "Response stopped" after a
reload.
- Once the reply goes on (live): a message.start that finds a stopped
reply as the last visible row (no prompt drawn, no automation card on
the start) sets ChatMessage.continued, and toRuntimeMessage then draws
no mark. Display only: `interrupted` stays on the message, because the
stopped turn's receipt bookkeeping (transcript-receipt-turns.ts) reads
it.
- While it is paused: session.interrupt takes `resume: true` ("I pause
this turn and continue it myself"). The turn ends like any interrupt,
with the same stored rows; its message.complete says `paused: true`.
The user's own Stop for the same turn wins. The desktop keeps the chat
paused (store/paused-replies.ts, by stored session id, since a sandbox
restart changes the runtime session) until the continuation's turn has
completed, or 120 s pass without its start or completion. Until it
starts, the newest reply reads "Continuing…" instead of "Response
stopped". Throughout, Enter puts the message in the chat's local queue,
also while a restart has the backend away (the composer is otherwise
disabled then), and not in a gateway-owned queue, which would draw it in
the thread between the paused reply and its continuation. It goes once
the continuation has completed, as its own turn: never steered into the
continuation and never interrupting it.
tools/ holds model tools. These three files register none and do cron's
work, so they move to the package that owns it:
tools/cronjob_job_args.py -> cron/job_args.py
tools/cronjob_prompt_scan.py -> cron/prompt_scan.py
tools/blueprints.py -> cron/skill_blueprints.py
Their tests move with them to tests/cron/. Every importer changes its
import line in place, so no module is imported earlier or later than
before. Nothing stays at the old paths: none of the three names is on the
plugin API list, the shipped-release list or the old-updater list.
skill_blueprints, not blueprints: cron/blueprint_catalog.py already holds
Automation Blueprints, a different thing. This file reads the blueprint
block of a skill's frontmatter.
Behaviour is the same except two strings. The report of a run the
injection scanner blocked names cron/prompt_scan.py. The one debug line
in skill_blueprints logs as cron.skill_blueprints, so it shows under
`hermes logs --component cron`. job_args and prompt_scan keep the logger
name tools.cronjob_tools.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py; the two gateway contract files are regenerated from
the docstring that names job_args.py.
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/browser_lightpanda.py::_record_path
- tools/computer_use/tool.py::get_computer_use_schema
- tools/computer_use/schema.py::get_computer_use_schema
- tools/computer_use/cua_backend.py::CuaDriverBackend.launch_app (and its test)
- tools/computer_use/cua_backend_session.py::_CuaDriverSession.capability_version
and the _capability_version bookkeeping
- tools/computer_use/cua_backend_daemon.py::_CUA_DRIVER_BUNDLE_ID (callers use
CUA_DRIVER_BUNDLE_ID)
- tools/computer_use_tool.py::__all__ and the two imports only it re-exported
- tools/bot_desktop/runtime.py::_allocate_display (its test now calls
_pick_display, the live allocator)
- tools/bot_desktop/install.py::assert_not_running (its test checks release
via claim/release)
- tools/close_preview_tool.py (whole module) and tests/tools/test_close_preview_tool.py;
PreviewClosePayload docstring updated and gateway contract regenerated
The clock modelled every route as "expires = last touch + tier", which is wrong for OpenAI
GPT-5.6+: a read refreshes coverage to at least 30 minutes after it and never restarts a
12h write. It also treated documented minimums as expiries and lost or revived saved state.
- Coverage deadlines per tier with per-route refresh rules: Anthropic family restarts the tier
on read; OpenAI keeps max(existing, read + 30m) and a 12h deadline stays at write + 12h.
- Windows carry guaranteed_until (earliest deadline, so mixed tiers in one response are only as
warm as the shorter) and estimated_until (OpenAI: last touch + 24h retention ceiling; pre-5.6
in_memory 1h). cache_certainly_warm / cache_certainly_cold are the two consumer helpers.
/context: warm until / may still be warm until / expired / unknown.
- Events bind to the session's durable context generation (rows a compaction or prune archived,
SessionDB.prompt_cache_generation), kept as saved on restore; a resumed agent restores and
validates the saved event before folding its first response.
- Route identity is provider + normalize_route_base_url (scheme, host, port, path) + model.
- Agentless session.context_breakdown reads the saved clock (stored_cache_window).
- Codex app-server activity is recorded as an explicit unknown (it sets its own cache options).
- MoA records the resolved aggregator route and the payload the MoA client sent.
- effective_cache_ttl applies the route ceiling on the measured-provider path too.
Every consumer that needs "when does this session's cached prompt expire?" now reads one
answer, agent/prompt_cache_clock.py:cache_window(), instead of re-deriving it from _cache_ttl.
- Per successful attempt the clock records the tier actually on the wire (cache_control ttl,
prompt_cache_options.ttl, prompt_cache_retention, read from the sent payload), the send time,
and the tier the response proved: Anthropic cache_creation.ephemeral_5m/1h_input_tokens,
OpenAI Responses cache_write_tokens_details.ttl_30m/12h_tokens. normalize_usage keeps that
split as CanonicalUsage.cache_write_by_ttl instead of dropping it.
- Per-route rules are a dict of small handlers: native Anthropic proves via the split;
OpenRouter Claude is declared (live-probed to honour 1h); routes with a ceiling are clamped;
other Anthropic-wire gateways assume 5m; OpenAI GPT-5.6+ proves via ttl_30m/12h or declares
the documented 30m minimum; pre-5.6 assumes ~30m (5m on in_memory); implicit caches are
unknown. expires = latest read-or-write send time + the written tier. A route switch,
fallback, session rotation or compaction makes it unknown.
- Route TTL ceiling is data: ProviderProfile.prompt_cache_max_ttl (Nous ships "5m", because
the Portal's upstream drops 1h after ~7 min and bills 5m), overridden per provider by config
prompt_caching.route_ttl_ceilings. effective_cache_ttl uses the same helper, so Hermes stops
asking Nous for 1h. A custom endpoint at the Portal host gets the Nous ceiling.
- Persisted as nullable sessions.prompt_cache_clock (JSON) through the existing token batch;
restored lazily on resume, falling back to the newest assistant row (assumed).
- Codex app-server: read cacheWriteInputTokens instead of hard-coding cache_write_tokens=0.
- /context shows "Prompt cache: warm until HH:MM (…; 1h, proven)", "expired … ago" or
"unknown (…)". The surface is absorbed from #142387 (render/duration helpers, the
SessionContextBreakdownResult.prompt_cache contract and translations), reworked onto the clock.
Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
Squashed onto main (#151819). The session.usage conflict with #141859 keeps the
branch side: _usage_nous_fields already reads the Nous fields inside the
session profile scope.
main's #141859 test now stubs both Portal reads: a session off a Nous route reads
with the stored token only (stored_token_account_info).
agent.account_usage keeps the names that moved to agent.account_usage_nous (and
BP_FULL): plugin_api.json publishes the whole module, and catalog plugins import
build_credits_view and build_nous_credits_snapshot from it.
ConnectionOperationTarget forbids unknown keys, so the upstream_repo the
skill install row now carries made connection.update / operation.status
reject every chat-catalog install of an upstream stub (brag, brag-slim,
impeccable, archify) with extra_forbidden. Declare it, regenerate the TS
contract, and validate the row against the contract in the test.
Map milgoff@gmail.com -> dmytrodanilenkov for the repository guards.
Review round 1 (#153318). The reload dropped the live registrations before the
new tree finished importing, tracked ownership loosely, trusted the in-tree
catalog sidecar as identity, and could reuse a failed import's submodules.
Each tree now imports under its own module name (base + file fingerprint) into
a staging layer; a complete import is published in one step (per-name owner,
generation bumped), a failed one leaves the previous version serving and drops
its half-loaded submodules. The old package stays loaded, so clients built from
it run that version end to end. Identity is a fingerprint of the plugin's files.
The activation summary keeps the dependency check on a failed import, carries
the gateway's own load_error, and the field is in the PluginActivation contract.
session.list returned at most 200 stored conversations and had no way to ask for more, so a
picker could not reach older conversations or search beyond the rows it loaded. The stored
scope now takes `query` (title or id text, the storage rule behind `hermes sessions list
--search`) and `cursor`, and returns `next_cursor` until the listing is exhausted. The cursor
holds the storage offset after the last examined row and is bound to `workspace`, `query` and
`include_hidden`; runtime.describe advertises `session-list-cursor-v1`.
pydantic 2.14 (uv.lock, CI) applies the result model's extra="forbid" to the
nested ProfileCreateReceipt dataclass in the JSON schema; the previous
regeneration ran under 2.13 and left additionalProperties out.
Round-3 review of the gateway create path found three defects and one
structural duplication.
- A config backend outage mid-create read as "nothing was created".
ConfigBackendUnavailable is a SystemExit, so it escaped the handler's
`except Exception` and the dispatcher answered 4064, which the client
read as refused-before-create, even when the profile had already been
published. The handler now catches it (and builds the receipt inside
the same try) and answers 5062. The client no longer treats a bare
4064 as "nothing was created"; only 4061 (no name) is.
- Every `hermes profile create` loaded gateway.platforms (~225 modules,
about +105 ms median) even with no gateway URL, because the
safe_proxy_url_for_log import sat above _where's early return. It now
loads only when a URL is set; a test pins that a URL-less create loads
neither gateway.platforms nor pydantic.
- A newer gateway that added a key under `mirrored` turned a successful
create into "may have created": the strict check forbade extra keys
there. `mirrored` is now a mapping of known value types, so new keys
are kept and never printed.
The receipt had two definitions: the CreateReceipt dataclass and the
contract's ProfileCreateReceipt pydantic model, kept in step by a
field-name test and a hand-written check that skills_seeded["copied"] was
a list. There is now one: the stdlib dataclass ProfileCreateReceipt in
hermes_cli.profile_provision, which the contract uses directly as
ProfilesCreateResult.receipt (pydantic validates dataclasses), so the
generated TS/OpenRPC still describe it. from_wire validates it strictly
with a TypeAdapter (pydantic only on the gateway path). The receipt
carries what the CLI prints, skills_synced (a count) and
skills_opted_out, instead of the raw sync-result dict, which removes the
`copied` check; RECEIPT_FIELDS and the parity test are gone.
Also:
- The refusal chunk limits are imported from gateway_client
(ERROR_DATA_TEXT / ERROR_DATA_ITEMS, now named there) instead of
copied, so lowering the client cap can't silently drop every part.
- A typed refusal with no text is still a refusal ("nothing was
created"), not "may have created".
- POST /api/profiles uses CREATE_REFUSALS.
- The wrapper check reuses profiles.profile_matches_home.
- The developer guide states the wrapper rule the code enforces.
The gateway route for `hermes profile create` returned a hand-built dict that
three places listed by key (receipt(), receipt_defaults(), the contract), and
dropped which route made the profile, so the CLI re-read
HERMES_TUI_GATEWAY_URL to decide the alias. Several outcomes were also
reported wrongly.
- CreateReceipt (profile_provision) is the one receipt: CreateReceipt.of()
after a local create, to_wire() on the gateway, from_wire() on the client.
A test keeps its fields equal to the contract's ProfileCreateReceipt, and
every contract field is now required.
- create_through_gateway returns a CreateReceipt and writes the
~/.local/bin wrapper itself after a create on this machine: a discovered
local owner or a loopback HERMES_TUI_GATEWAY_URL (the dashboard's chat
terminals). Before, a loopback URL never got a wrapper. write_alias
returns (path, collision) instead of filling a result object, and a
wrapper failure after a gateway create is a warning, not a traceback.
- profiles.create no longer cuts refusal text at 200 characters for every
client (Desktop showed "...create bad-"): error.message carries the whole
redacted text, and error.data repeats it in short parts gateway_client
keeps. The client redacts refusal text and receipt warnings again before
printing.
- Outcomes the CLI can't confirm say "may have created ...; check hermes
profile list" instead of "could not create" or a traceback: an untyped
handler error, any exception after the request went out, a non-dict
answer, and a receipt with missing or malformed fields.
- HERMES_TUI_GATEWAY_URL must be ws:// or wss:// with a host (what
connect_gateway accepts); IPv6 hosts are bracketed in messages.
- One lock per profile name around the core create, not one for every name:
the core create includes the multiplexer rescan (up to 8 s), so creates of
different names waited on each other and held gateway pool workers.
- A gateway create reports why skill seeding failed: seed_profile_skills
collects its failure lines (problems=), and a quiet create's receipt
carries them as warnings.
- GatewayRPCError.unknown_method replaces four copies of
`code == -32601 or str(exc) == "unknown_method"`.
The CLI was the last create surface that made profiles in its own process.
It now asks the gateway that serves its profile, over the same
profiles.create RPC Desktop uses, and prints the receipt the gateway reads
where it made the profile:
- a ready gateway for the terminal's profile (discovery only; one is never
started for this) takes the create; with none, or a local one that
predates these fields (-32601 / 4000), the CLI creates in-process as
before;
- HERMES_TUI_GATEWAY_URL names a gateway: the profile is made there, and
an unreachable or older gateway is an error, never a local create. The
URL's token is never printed;
- a refused create keeps its type (error.data.type), so the CLI prints the
same "already exists" / "does not exist" errors;
- a socket lost after the request was sent is reported as unknown, with a
pointer to `hermes profile list`, never retried.
profiles.create gains optional clone_config (`--clone` with no source:
copy the caller's profile), sync_imports and report. On /api/ws it already
runs in the connection's profile (dispatch_legacy binds the ticket's), so
`hermes -p work profile create x` against the multiplexer copies work's
keys, model and (with --clone) SOUL.md.
provision_profile now holds a per-name lock around the core create. The
gateway takes every terminal's create in one process, and create_profile
stages in profiles/.<name>.staging-<pid>, so two same-name creates there
shared and removed each other's staging dir; the loser failed with a raw
OSError (Errno 66 / ENOENT) instead of "already exists". The staging path
came from b47fb2eba3 (teknium1, 2026-09-13).
Review folds: a retiring gateway (5035) or an older one naming
unknown_method creates locally; a gateway that made the profile without
a receipt is reported, never re-created here; Ctrl-C after the request
says the create may still finish; the ~/.local/bin wrapper is written by
the CLI (this terminal's PATH and hermes), none for a URL gateway; the
gateway URL is named as scheme://host[:port] only (never its token,
userinfo or a hostless path), and recovery hints point at the gateway's
machine; refusals and 5062 carry the gateway's message, redacted (a parse error
can quote a config line); `--clone-from ""` is refused before any create. One
process lock around the core create (not seeding or the alias).
Follows #149210. A window holds several sockets to one backend (the primary,
the room's lease, others), and _broadcast_global_event writes the same
groups.changed frame to each, so every push queued one extra groups.state
read that found nothing new (live: 30 state reads for 15 pushes).
- The change watcher stamps each groups.changed with broadcast_id: the
process's replay epoch (the token gateway.ready already carries) and a
counter, unique for the process's life.
- The room view skips a push whose broadcast_id it already read for (the
SDK's LruCache, last 64). A push without one (an older backend) reads as
before.
Copies are told apart by identity, not timing: a later broadcast with the
same rooms, or another backend's, always reads.
Also, from the #149210 review: groups.state's change_events flag (it moves
the view to the 15 s backstop) is now pinned by a test, and the check that the
room service's status sets match the driver's shown rows moves from an
import-time assert to a test.
Plan step 2 of the Bots architecture.
- groups.changed (change watcher) moves an open room on push; the poll is a
15 s backstop on backends that push, 2 s on older and forwarded ones. Any
failed read, a route reconnect, or a lease that failed retries at 2 s / at
once.
- One room read at a time for every caller; a caller resolves after its own
read. A mutation's settle supersedes the read in flight, so a pre-action
answer never lands after it. A read's own reconnect (before its state
answer) is not a re-read; one after it is. A state with nothing past the
cursor reads no log page.
- The log is read from the cursor with a contiguity check; a new authority
epoch or a shorter log reads it all again.
- The signature covers everything groups.state projects from memory:
approvals, routes, stall and last error per service (under _state_lock),
and member progress once per process, including main's live-attempt
confirmation (task_is_active) and progress to 30 s.
- The store part (hosted_room_driver.room_change_rows) reads each live room's
rows through the status index and skips disbanded rooms.
- status() reads the shown rows and the counts in one snapshot
(room_task_summary); both room kinds list approval cards before Retry.
- The bot driver is woken by a room write instead of waiting for its 5 s
idle poll.
The RPC's one behaviour change in #152574 had no test that goes through
the RPC. The contract docstring (and its generated TS / OpenRPC copies)
and the handler docstring now say what clone_all alone does: a full copy
of the active profile.
--no-credentials promises no keys from the launch profile, but --clone /
--clone-from / --clone-all copy the source's .env and config (and auth.json)
by request. The CLI now refuses the combination before creating anything.
POST /api/profiles and profiles.create return provision_profile's
warnings (e.g. a named launch profile's subscription logins not carried
over), so the dashboard and Desktop can show what the CLI prints.
Review of the new create defaults found that share_auth works by not copying
auth.json, so the new profile reads the default root's (hermes_cli.auth
fallback). From a named launch profile that paired its API keys with the
root's logins and hid its own. A named launch profile's auth.json is now
copied (single-use OAuth grants stripped, as before).
mirrored["auth"] is now derived from the outcome: "shared" when the new
profile has no auth.json of its own. --clone-all no longer reports shared
logins it does not have, and --no-credentials says the root's logins stay
readable.
The CLI names the profile keys and model came from, uses cloned (so
--clone-from without --clone no longer says "no API keys yet"), and the
opt-out tests parse real argv. Docs list the new default and both flags.
After #149075 every surface creates through provision_profile, but each still
passed its old options: only the Desktop/TUI RPC copied the launch profile's
keys, so a profile made with `hermes profile create` or from the dashboard had
no provider and failed its first chat until `<name> setup` ran.
ProfileCreateRequest now defaults to the Desktop bot page's "Share keys &
accounts with the main profile" (ticked): provider/tool keys copied into the
new .env (bot tokens and allowlists stripped), auth.json shared rather than
copied, model inherited unless one is picked. Clones keep their own .env.
Each surface has the same two opt-outs:
- isolated logins (auth.json copied once, single-use OAuth grants dropped):
`--isolated-auth`, `share_auth: false` (REST and RPC);
- nothing from the launch profile: `--no-credentials`,
`mirror_credentials: false`.
The CLI now says what it copied, and only warns "no API keys yet" when it
copied none. The RPC's share_auth default flips to true (the bot page already
sent it explicitly, so its behaviour is unchanged).
Pre-arm review of #151193 (correctness reviewer plus reuse, quality and efficiency passes on the full
diff):
- The loader reads what a plugin folder is (package marker or install origin) with one helper and one
listing, for a new folder and again on reload. The reload path used to list the folder twice and
refresh only some fields: a reload that turned a folder into a linked package half never re-read
`sourceFile`, so edits to that checkout weren't watched until restart.
- `PACKAGE_MARKER`, `INSTALL_ORIGIN` and the catalog-name pattern live together in
`apps/shared/src/desktop-plugin-files.ts` (was `plugin-catalog-name.ts`); Electron re-exports the two
file names. The Webapp router reads them from `desktop_plugin_halves`. `PackageOrigin` is one type in
plugins-store, and the desktop half's install answer is one `DesktopHalfInstallResult` instead of a
third hand-written copy.
- `standaloneCatalogName` is the one place that says a package's half answers for no catalog entry.
- `refusalReason` reads the reason through a shared `jsonRpcErrorReason` beside `JsonRpcGatewayError`.
- Electron records the HEAD `checkoutReviewedCommit` already verified instead of asking git again;
`sameFile` is private again.
- The Webapp host checks the package marker without following a link, as Electron's lstat does: a
dangling marker link no longer reads as a plain standalone folder that can be adopted.
- The new Python and loader tests import the sibling suites' Git fixtures and the blob-import reroute
(`runtime-loader.test-helpers.ts`) instead of copying them.
New tests: a reload that finds a linked package half watches its source; a dangling marker link is not
adopted; a catalog install with no pin records the commit it cloned. Each fails with its fix reverted.
Accent Picker (reported on X on 2026-11-07) installs from its catalog card as a standalone
desktop plugin. The install worked, but three things went wrong after it:
- The card kept its "+". The Plugins page matches an installed plugin to its catalog card only
by catalog_name, taken from the agent row or from the package marker. A desktop-only entry has
neither: no agent half, and the installer leaves the package marker out on purpose so the
folder stays standalone.
- The plugin loaded switched off. Its plugin.js sets defaultEnabled: false, but the dialog had
said "turns on right away".
- Clicking "+" again stopped at "Desktop plugin 'accent-picker' already exists. Enable force
reinstall to replace it." On a catalog pick the Force switch is never shown and Advanced
starts collapsed, so the dialog gave the user no way forward.
Fix:
- The installer (Electron and the Webapp host) writes `.hermes-origin.json`
({catalogName, repo, sha}) into a standalone plugin it installs from a catalog entry. The sha
is the commit checked out, so a tag pin is peeled. A copy of that file shipped inside the
repository is always dropped, the same way the package marker is. The loader puts the entry
on the record's packageOrigin, which the card already matches. It re-reads it on a forced
reload, and the Webapp read route serves the file.
- If a catalog install finds a plain standalone folder whose plugin.js is byte-identical to the
tree it would publish, it records the origin and keeps the folder as is, instead of answering
"already exists". That repairs installs made before this change without replacing what the
folder keeps. A different plugin under that name still needs Force.
- After a catalog install with "turn on" set, the plugin installed from that entry is turned on.
- An "already exists" refusal is marked as such (Electron `exists`; the gateway's error data
`reason: "exists"`). Only that refusal opens Advanced and shows Force; a clone or network
failure does not.
- A forced reload waits for a scan already running and then runs, instead of returning at
once. The install's own folder rename starts a background scan, so the reload that follows
could otherwise return before the new plugin was read, and nothing would be turned on.
- The deep-link and setup-card "installed" checks also read the catalog names recorded on disk,
so a desktop-only entry reads as installed there too.
- installDesktopPluginFromGit takes its options as one object. The catalog name pattern moves to
apps/shared so Electron validates the name it records with the same rule.
The card's catalog_name-only matching came in with the Capabilities redesign (#138820,
adcea47191, Brooklyn Nicholson, 2026-09-29). It surfaced for this plugin when accent-picker moved
from bundled into the catalog as a desktop-only entry (#136444, Teknium, 2026-10-10, d4d2ab7b5d).
The related repo-install case is #143522; this change does not close it.
The settleResponse extraction left handleFrame's doc block on the private
helper. Move it back, mention the onUncorrelatedError route, and give
settleResponse a one-line doc.
Co-authored-by: Bear Huddleston <196404565+BearHuddleston@users.noreply.github.com>
handleFrame matched an error frame only to a pending request by id, so the
backend's -32700 parse-error reply (id null) fell through every branch and
was dropped. The channel now hands it to an onUncorrelatedError sink; the
Desktop client logs it to the devtools console and the TUI client to its
protocol log, next to their existing unhandled-request sinks.
The pending-response branch moves into settleResponse so handleFrame stays
under the complexity limit.
A key button in the Browser bar opens a picker of vault logins saved for the
page's exact origin, from every login source `vault.list` returns (Hermes
vault, unlocked Bitwarden / 1Password, any other registered source). Locked
managers get an Unlock row through the existing `vault.unlock` RPC; the empty
state links to Settings -> Credential Vault prefilled with the origin.
Picking a login calls the new `vault.preview.fill {handle, target}` RPC. The
renderer only mints an opaque binding for the clicked tab's live document; the
backend runs the same browser_vault fill (origin guard before any secret read,
re-asserted in the page; nonce-bound fields; redaction registration), also
writing the login's identifier, and sends each page script as a session-less
`preview.act` request on the calling socket. The result carries counts and the
origin only. Nothing is submitted.
New RPC contract + regenerated apps/shared files; VaultItem gains the
allowed_origins metadata manager items already emit. i18n in en + 8 overlays.
Past sessions.max_resume_messages a rotated lineage pages only its current
segment, and a newest-first cursor from that read held no segment. Once a
compaction rotated the tip to a new segment, the old key was looked up in
the new one, the walk ended with an empty page and reset: false, and the
reader kept the old segment's rows. A tip-only newest-first cursor now
holds its segment; when the current segment differs, the reply starts
again from the newest page with reset: true. Whole-lineage newest-first
cursors are unchanged (they page across rotations inside the lineage). A
tip-only cursor issued before this change has no segment, so it resets
once, as an unscoped t3 cursor does.
compaction_summary took the compacted-message count from the first match
over the whole summary, before the quoted user messages were cut, so a
quoted message spelling out the footer's sentence won. The count now comes
from the Context Recovery footer when there is one, else from the summary
with the quotes cut.
Contract doc and gateway-local-sessions.md describe the new reset; the
gateway contract outputs are regenerated.
Reported by Greptile in review.