Commit Graph

10345 Commits

Author SHA1 Message Date
BearHuddleston
f45ec34e0d fix(desktop): gate model pill and menu speed labels on active tier support
formatModelPillLabel checked `serviceTier === 'ultrafast'` without
checking `fastMode`, so any model lacking Ultrafast support still
rendered `· Ultrafast` whenever `agent.service_tier: ultrafast` was set
in profile config (even though `session.info` reported `fast: false`).

- Gate both `Ultrafast` and `Fast` in `formatModelPillLabel` behind
  `fastMode`, plus model capabilities (`supportsFast`,
  `supportsUltrafast`) from `useChatBarState` so pre-session drafts
  seeded from `config.agent.service_tier` do not display unsupported
  speed tags either.
- Keep `ultrafastOn` in `ModelOptionsContent` gated on
  `ultrafastSupported` and preserve `fastOn` for active `-fast` variant
  models while leaving param fast-only switches off under an inherited
  `ultrafast` tier.
- Gate the catalog row chip through `rowSpeedSetting` so `-fast`
  variants keep `Fast` and fast-only rows never render `Ultrafast`.
- Add unit, component, and core Webapp E2E regression tests.
2026-11-19 03:21:51 -06:00
BearHuddleston
f5d03660e7 test(desktop): restore idle globals and prefetch spy in CapabilitiesView test 2026-11-19 03:13:38 -06:00
demianad
a1ee88d794 fix(desktop): fall back when idle callbacks are unavailable
(cherry picked from commit d3bf568cf988faecc6eaf67ea7b89523bba96f11)
2026-11-19 03:13:38 -06:00
Teknium
36a0653d36 fix(desktop): teammate-wait Open and Dismiss never submit the composer draft
The strip renders in the composer's `composer.top` slot, inside the
composer's <form>. The shared Button sets no type, so both controls were
native submit buttons: clicking Dismiss (or Open) with a draft typed sent
that draft. Both are now type="button".
2026-11-19 00:41:03 -08:00
Teknium
4b4f87920d fix(desktop): a failed teammate-wait poll keeps the last rows, marked stale
listDeliveries answered [] for every error, so a timeout, a dropped socket
or a storage error replaced the last known deliveries with an empty list
and hid the strip while requests were still pending. Only a JSON-RPC
method-not-found (an older gateway) is an empty answer now; any other
failure reaches the query, which keeps the last good rows, greys them and
says the strip could not refresh. Ages keep counting across failed polls.
2026-11-19 00:41:03 -08:00
Teknium
b210b45834 fix(desktop): teammate-wait Open never routes to the sender's own chat
When a delivery named a teammate the cached roster had not caught up with
yet, the row's fallback spread the SENDER's row and only swapped the name,
so Open routed back to the sender's Bot Chat. The fallback is gone: such a
row shows the target's handle with Open disabled until the roster lists it.
2026-11-19 00:41:03 -08:00
Teknium
8226efabab fix(desktop): teammate-wait strip uses the shared Button and defined theme tokens
Open and Dismiss were hand-styled buttons, the Dismiss X carried a tooltip
repeating its aria-label, and the card fill, hover and failure colour
pointed at --ui-surface-raised / --ui-surface-hover / --ui-danger, which no
theme defines. Both controls are now SDK Buttons (ghost micro / icon-xs),
the X has no tooltip, and the card uses --ui-stroke-tertiary /
--ui-bg-secondary with text-destructive for a failure.
2026-11-19 00:41:03 -08:00
Teknium
67738c7798 fix(desktop): teammate-wait failures read in plain words; ages keep counting
Two defects the live run showed on the card:
- a failed row printed the raw reason code ("Failed: provider_auth_or_access").
  Each typed reason now has plain words in every shipped locale; an
  unclassified failure shows the teammate owner's own error line.
- the age column froze at its first value: an unchanged poll result does
  not re-render, so "4s" stayed "4s" for minutes. Ages are now computed
  against the query's last fetch time.
2026-11-19 00:41:03 -08:00
Teknium
41986be39a refactor(desktop): composer.top session context lives in its own slot component
Keeps ChatBar inside its size/complexity caps; the legacy bot_delivery.list boundary logs its traceback.
2026-11-19 00:41:03 -08:00
Teknium
0692eb8477 feat(desktop): "Waiting on teammates" strip above a Bot Chat composer
A compact card in a bot's own Bot Chat lists each message_agent delivery from that bot that has
not settled: the teammate's avatar and name, queued / picked up / working / waiting on you
(answer its question, or approve or deny) / failed with its typed reason, and how long. Open
fronts the teammate's chat, where the pending card is; Dismiss hides a failure. It polls
bot_delivery.list on the roster's 5 s cadence, renders nothing in other chats or on gateways
without the method, and never resends: an unknown outcome is shown as such with the rule.

Core gains one SDK door, useComposerSession(), so a composer.top contribution knows which
session's composer it sits in (main and every tile answer for their own).
2026-11-19 00:41:03 -08:00
Teknium
6190457161 feat(bot-mode): bot_delivery.list — read-only view of a bot's unsettled teammate deliveries
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.
2026-11-19 00:41:03 -08:00
BearHuddleston
ca8e736130 docs: describe the diagnostic Linux AppImage builds
The workflow README, platform support page, bundle and stable release
guides, desktop README/BUILDING and the install smoke README said the Linux
desktop legs were disabled. They now say what the workflow does: canary
tags build Linux AppImages as diagnostic artifacts that stage to the tag
archive, gate nothing, have no smoke or feed, and are offered by no
release; commit builds skip them. The PM Bundle Linux legs stay listed as
disabled.
2026-11-19 02:35:54 -06:00
Ben Barclay
52811481bc fix(desktop): give a restored search row its resolved owner
Some checks failed
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Canary Release / Tag, draft, and start the canary build (push) Has been cancelled
Canary Release / Prune canaries older than 14 days (push) Has been cancelled
Search rows carry no profile. unarchiveSession already resolves the owner to
route the RPC; stamp it on the row it puts back in the active list, or a
named-profile sidebar filters the row out as the default profile's and the
search hit keeps offering Unarchive.
2026-11-18 22:41:16 -05:00
Ben Barclay
236b8038f0 fix(desktop): run the archive verb the row menu showed
The row menu labels its verb from the clicked row, but the handler got only
the id and re-derived archived state from the loaded lists and the Archived
view cache. An archived search hit is in neither until the Archived view has
loaded, so Unarchive ran archive. Pass the row through and let its flag decide;
the cache lookup stays as the fallback for callers without a row.

unarchiveSession takes the row as the stand-in for a cold cache and resolves
the owning profile the same way archiveSession does.
2026-11-18 22:41:16 -05:00
Ben Barclay
e2f81bba95 test(desktop): pin the archived flag on synthesized search hits
An archived session is never in the loaded sessions list, so sidebar search
always builds its row from the search hit. Cover both the archived hit and a
hit from an older gateway that omits the flag.
2026-11-18 22:41:16 -05:00
Yuan Li
8a2499a64d fix(desktop): preserve archived state in session search
(cherry picked from commit 366f83f9861e41dda4c5b826e47addf072960e5b)
2026-11-18 22:41:16 -05:00
Teknium
6161a34409 docs(desktop): say which agent-tab streams still convert line feeds
The salvaged comment called agent process logs non-PTY. A process
started with pty=true streams raw PTY output into the agent tab, which
still converts every LF; that path stays open on #122482.
2026-11-18 10:38:40 -08:00
Teknium
9cac5ad3b9 test(desktop): pin the ConPTY spinner frame that jumped the caret (#157373)
On Windows, ConPTY re-encodes the classic CLI's spinner tick (cursor up,
glyph, cursor down) as an absolute move to the spinner cell followed by a
bare LF back to the input row. With convertEol that LF became CR LF, so
every tick left the visible caret at column 1 instead of the input column.

The bytes come from a real `hermes chat --cli` capture replayed through
node-pty on windows-latest: the inbox ConPTY delivered 55 of 145 visible
caret frames at column 1 with convertEol on, 2 with it off (the 2 are the
initial screen clear, before the composer is drawn).

Swap the generic bare-LF test for that captured frame: it fails with
convertEol on and passes with the parent commit's fix.
2026-11-18 10:38:40 -08:00
Wyzer
84ee865bb2 fix(desktop): honour bare LF in the PTY terminal (drop convertEol)
A PTY already emits CR LF where a program means a new line, so a bare LF
must move down and keep the column. convertEol forced every LF to CR LF,
which breaks cursor-addressed redraws: a full-screen TUI positions at the indent
(CSI row;3H), clears, then sends a bare LF to start the next indented row.
With the conversion that row began at column 1, so after a scroll repaint
each indented line kept the old frame's first two glyphs (Th, Wh, "Y).

Found by capturing a real TUI coding-agent session through node-pty/ConPTY and
replaying it into headless xterm: 17 ghost-prefixed rows with convertEol,
0 without. The agent-process log terminal is not a PTY and keeps it.
2026-11-18 10:38:40 -08:00
BearHuddleston
6f929bf85d fix(desktop): match gateway units that spell the copy path systemd-quoted
hermes_cli/gateway.py _systemd_command writes each ExecStart argument
quoted for systemd: `\` -> `\\`, `"` -> `\"`, `%` -> `%%`, `$` -> `$$`. The
copy key is sanitized, but its parent ($XDG_DATA_HOME or the home dir) is
not, so with XDG_DATA_HOME=/data/100%/share a stopped unit named the build
as /data/100%%/share/... and cleanup, looking for the raw path, could
remove the copy that unit runs.

Cleanup now looks for both the raw and the systemd-quoted spelling of each
build's path.
2026-11-18 11:12:24 -06:00
BearHuddleston
2bc47272db fix(desktop): keep payload copies an installed gateway unit runs
A gateway unit installed from a payload copy names that copy in its
ExecStart. While the unit is stopped, no process runs from the copy, so
cleanup could remove it once it was neither the current nor the most
recently used other build. Desktop's `gateway ensure` then started the
installed unit unchanged (`systemctl start`, with no unit refresh on that
path), and the gateway failed until a `hermes gateway restart` from the
CLI rewrote the unit.

Cleanup now reads the installed hermes-gateway*.service units, in the
user unit dir ($XDG_CONFIG_HOME/systemd/user, ~/.config by default, as
hermes_cli/gateway.py resolves it) and /etc/systemd/system, and keeps any
build one of them names.
2026-11-18 11:12:24 -06:00
BearHuddleston
c3de2bfc28 fix(desktop): clear a failed AppImage unpack before copying from the mount
When `--appimage-extract` failed, unpackPayload copied the payload from
the mount while the failed extraction still sat in squashfs-root, and
removed it only in `finally`. A runtime that wrote most of the 5.4 GB
payload before failing therefore needed room for two trees, while the
free-space check allows for one, so a disk with room for the copy could
fill up and leave the launch running from the mount.

The fallback now removes squashfs-root before it starts copying.
2026-11-18 11:12:24 -06:00
BearHuddleston
7cb4a04ebb fix(desktop): strip only this app's AppImage mount from the gateway env
mountFreeEnv took any inherited APPIMAGE as this app's. The AppImage
runtime exports APPIMAGE and APPDIR to every descendant, so a .deb Hermes
started from a terminal AppImage had the terminal's mount entries
stripped from its gateway's env: PATH, EDITOR and the rest lost whatever
that terminal put there, on an install this change should leave alone.

mountFreeEnv now asks ownAppImage first, as the relaunch path does, and
runGatewayEnsure passes it the executable path (process.execPath by
default). runnablePayloadResources gated the payload copy on the same
inherited variable; it now asks ownAppImage too, so a foreign image is
never run with --appimage-extract.
2026-11-18 11:12:24 -06:00
BearHuddleston
cca65cf2ff fix(desktop): keep payload copies an open Desktop uses
Cleanup kept an older build only while a live process executed from it
(/proc/<pid>/exe). An open Desktop runs Electron from its AppImage mount,
so until its gateway started, nothing under its copy showed there. A
channel install (its own userData, the same bundles root) launching
another build could therefore delete the copy an open Desktop had already
selected; the low-space path makes even the previous build eligible. That
Desktop then kept handing out the cached path, so every later gateway
start failed.

- Each launch holds its build's completion marker open for the life of
  the process, taken before the copy is handed out and re-checked after
  the open. Cleanup now treats /proc/<pid>/fd targets like exe targets,
  so a copy any open Desktop selected is kept, low space or not.
- stablePayloadResources re-checks the cached copy on every call and
  prepares it again when it is gone (removed by hand, or by a cleanup
  that ran in the moment before this launch took its hold).
2026-11-18 11:12:24 -06:00
BearHuddleston
254bd11cab fix(desktop): keep the AppImage mount out of the gateway's environment
AppRun prepends its mount to PATH, LD_LIBRARY_PATH, XDG_DATA_DIRS and
GSETTINGS_SCHEMA_DIR, and its usr/lib ships libXss, libXtst, libnotify and
libappindicator. With the payload running from the stable per-build copy,
the gateway still inherited those entries, so a child it starts while the
app is open (a headed browser, a notifier) could map libraries from the
mount and die with SIGBUS once the app quits and the mount goes. In the
launch test the gateway's env named the mount in PATH, LD_LIBRARY_PATH,
XDG_DATA_DIRS, GSETTINGS_SCHEMA_DIR and APPDIR.

runGatewayEnsure now passes the gateway an env without the mount's entries
whenever its command lives outside the mount. It reuses relaunch-target's
withoutMountEntries, which the relaunch path already uses for the same
reason. A gateway that still runs from the mount (the copy fell back) keeps
its env whole, as before, and so does every install that is not an
AppImage.
2026-11-18 11:12:24 -06:00
BearHuddleston
d618296822 fix(desktop): move CLI links forward from an older payload copy
provisionCliLinks repaired only dangling links, so a live link was never
touched. With per-build AppImage payload copies, ~/.local/bin/hermes still
resolves into the previous build's copy after an update or a rebuild, and
the CLI would keep running the old build.

A live link into another build beside the payload's own
(<store>/<build>/agent-payload/bin/<name>) is now an older copy of this
install and moves to the current build. A live link into another install
(a .deb under /opt, another app bundle) is still left alone.
2026-11-18 11:12:24 -06:00
BearHuddleston
0a8e23bdf6 feat(desktop): run the AppImage agent payload from a stable per-build copy
An AppImage mounts itself at a new /tmp/.mount_* on every launch, and the
bundled payload, the CLI links in ~/.local/bin and the Desktop-started
gateway all ran from that mount. Once the app quit, the links dangled and
the gateway died with "Fatal Python error: Bus error" within 30 s, because
its interpreter and extension modules were mmapped from the vanished FUSE
mount.

On the first launch of each build, an AppImage served from its FUSE mount
now unpacks agent-payload to $XDG_DATA_HOME/hermes/bundles/<build>/
(default ~/.local/share), keyed by version, commit and builtAt so a rebuild
at the same commit gets its own copy. Every later launch of that build runs
the copy, so CLI links, the gateway and any service unit generated from it
outlive the app.

- The AppImage runtime unpacks the payload (`$APPIMAGE --appimage-extract
  'resources/agent-payload/*'` in a child process): 8 s for the 5.4 GB
  arm64 payload on spark-0, where a copy read back through the FUSE mount
  took 137 s with the main process busy. If the runtime cannot unpack, the
  payload is copied from the mount instead.
- The copy lands in a .partial-<pid>-* sibling, is checked against the
  mount (entry, file and link counts and file bytes), gets a completion
  marker, and is committed by rename. A crashed, short or concurrent copy
  is never run; a build directory without the marker is left alone.
- Free space is checked first (payload bytes, block slack, 1 GiB reserve);
  when short, unused older copies are evicted before giving up.
- Any failure falls back to running from the mount, as before, with a log
  line that says the CLI and gateway stop working when the app quits.
- After a successful prepare, a background pass removes partial copies
  whose writer died and older builds, keeping the most recently used other
  build and any build a live process executes from (/proc/*/exe).
- The boot path reports the one-time unpack as a boot-progress phase; it
  is async and never blocks the main thread.

Other platforms, the .deb, and AppImages run extracted
(--appimage-extract-and-run or any non-FUSE payload) keep running their own
payload. main.ts only swaps bundledPayload for runnableBundledPayload and
passes the boot progress reporter (line-neutral).
2026-11-18 11:12:24 -06:00
BearHuddleston
d8d3ab74d3 fix(desktop): compare symlink targets in the packaged payload check
The payload check recorded every symlink as "symlink", so a packaged
link pointing somewhere other than the prepared one passed, dangling or
not. PM's tree digests hash the link text, so a retargeted tool link
would still fail `hermes pm doctor` in the shipped payload.

Targets were left out because relocation rewrites them, but the check
now runs on electron-builder's copy before relocation, where builder-util
copies each link's text verbatim. Each symlink is now compared by its
target. On Windows builder-util recreates links as junctions, which
store absolute paths, so a relative link the copy rewrote would fail
the pack there too; such a link would point into the build machine's
tree after install.

Test: a verbatim copy with a relative tool link passes afterPack, and
the same copy with the link retargeted fails naming both targets. On the
previous commit the retargeted copy passed. Reported by @kvnloo.
2026-11-18 11:11:59 -06:00
BearHuddleston
77f642c100 test(desktop): give the builder-copy test Windows packaging inputs
readPackagingInputs requires the winCodeSign toolset and a .NET root
for every win32 target, --dir included. The builder-copy test published
neither, so on Windows runElectronBuilder refused the manifest ("Missing
Windows tool selection") before the test reached the copy it checks.

The fixture now supplies both on Windows. Probe on Linux: the same
manifest built for win32-x64 is refused without them and admitted with
them. The Linux run is unchanged. No CI lane runs this file on Windows,
so the rest of the Windows run is unproven.
2026-11-18 11:11:59 -06:00
BearHuddleston
6dcd045c3a fix(desktop): fail the pack when the mapped payload never arrived
afterPack only looked up the prepared payload when agent-payload already
existed in the packaged resources, so a bundled pack with no payload at
all skipped the check. electron-builder only warns ("file source doesn't
exist") when an extraResources source is missing and packs without it.

The hook now asks the build's extraResources mapping first. When the
build maps a payload and the packaged copy is absent, the pack fails and
names both paths. Hermes Light maps none and is still skipped.

The after-pack.test.mjs fixtures now pass a packager with a config, as
electron-builder always does, because the hook reads the mapping on
every pack.

Test: a bundled pack with the prepared payload but no packaged copy
fails; the same pack under the real Light config passes. On the previous
commit the bundled pack resolved.
2026-11-18 11:11:59 -06:00
BearHuddleston
91b7579910 fix(desktop): check the packaged payload before afterPack changes it
The payload check ran at the end of afterPack, after relocation and
signing. On a signed macOS build, signNestedChromium first repairs any
flattened Chromium framework: Foo.framework/Foo and its Resources become
symlinks into Versions/Current. The prepared payload keeps the flattened
copy, so the check would have failed the pack over a repair afterPack
makes on purpose. The Nov 10 signed canary logged "repaired 0 framework
links", so no shipped build has hit this yet; a Chromium download with
flattened frameworks would.

The check now runs on electron-builder's copy before afterPack touches
it. Nothing has signed or relocated anything yet, so every platform
compares entries, types and file sizes, and the per-platform allowances
for signing's rewrites and macOS _CodeSignature seals go away. What
afterPack changes afterwards (relocated links, repaired frameworks,
signatures, refreshed digests) is that step's own work and stays covered
by its own tests.

Test: a signed darwin afterPack over a flattened framework (security and
codesign faked) repairs the links, signs Chromium.app and passes, while
a lost .gitkeep or a changed size fails before anything is signed. On
the previous commit the repaired copy fails the pack with "F: file
became symlink".
2026-11-18 11:11:59 -06:00
BearHuddleston
4ec66f1170 fix(desktop): fail the pack when the packaged payload differs from the prepared one
CI's payload smoke runs on build/agent-payload before packaging, so a loss
in electron-builder's copy shipped unseen: the pnpm .gitkeep the copy drops
is missing from the Nov 10 macOS canary. afterPack now compares the packaged
payload with the prepared one, after relocation, signing and the digest
refresh, and fails the pack listing every missing entry, changed type and
unexpected entry. The prepared payload is found through the build's own
extraResources mapping, so Hermes Light, which maps none, skips the check.

What afterPack itself legitimately changes decides what is compared:

- Linux: relocation only retargets venv symlinks (and discards build locks
  the sealed payload no longer carries), so the entry set, every type and
  every file size must match.
- macOS: codesign rewrites Mach-O bytes and wheel zips and adds
  _CodeSignature seals to the nested Chromium bundles (the Nov 10 canary
  has seven CodeResources files the Chrome for Testing zip lacks), and the
  rehash rewrites tools/facts.json. The entry set and types are compared;
  additions inside _CodeSignature are accepted.
- Windows: PE sanitizing and Authenticode signing rewrite PE bytes and the
  rehash rewrites tools/facts.json. The entry set and types are compared.

Symlink targets are never compared, because relocation rewrites them. The
PM digest check is no substitute: on macOS and Windows the rehash
re-records every tool digest over the packaged tree, so it passes whatever
the copy lost, and it covers tools/ only. Comparing a full Linux arm64
payload (130,707 entries) takes about 3 s.

The check sees appOutDir, not the AppImage stage or the MSIX file map that
targets build later. Those use the same patched builder-util module in the
same builder process, so a pack whose resource copy kept every entry here
had the copy patch loaded for them too.

Tests: an exact copy passes afterPack, while electron-builder's own copy
without the preload, plus a lost file, a changed size and a stray file,
fails naming each (on the previous commit afterPack resolved). The macOS
and Windows rules accept signing's rewrites and macOS's seals but still
report a lost .gitkeep.

The hook now reads context.packager whenever a payload is packed, so the
Linux relocation test passes the packager electron-builder always supplies.
2026-11-18 11:11:59 -06:00
BearHuddleston
b5a470b7d4 fix(desktop): keep .gitkeep files and empty directories through electron-builder's copies
electron-builder (27.0.0-alpha.6) moves the payload with builder-util, which
loses two classes of entries:

- builder-util dist/fs.js:58: walk() drops every entry named .gitkeep or
  .DS_Store before it consults the caller's filter (line 63).
- builder-util dist/fs.js:225-253: copyDir() creates a directory only when
  it copies a file or symlink into it ("Empty directories is never
  created.").

The payload goes through them at three points after preparation:

- the extraResources copy into resources/agent-payload (app-builder-lib
  dist/fileMatcher.js:462 copyFiles -> copyDir, from platformPackager.js:303),
  on every OS;
- the AppImage target, which copies the whole appOutDir into its squashfs
  stage (dist/targets/linux/appimage/appImageUtil.js:19 and :54, copyDir);
- the MSIX/AppX targets, whose makeappx file map lists appOutDir with walk()
  (dist/targets/win/winAppUtil.js:120).

A Linux arm64 AppImage built at 7b0a2cdbdf lost 6 of 130,707 payload
entries: three empty llama.cpp directories, uv-cache/builds-v0,
contributors/emails/.gitkeep and pnpm's
dist/node_modules/undici/lib/llhttp/.gitkeep. That last file is part of
pnpm's recorded tree digest, so `hermes pm doctor` in the packaged payload
reports "pnpm: realized bytes do not match recorded digest" while the
pre-packaging payload smoke passes. The Nov 10 macOS canary zip lacks the
same .gitkeep.

An extraResources filter cannot help: walk() skips the names before any
filter runs, and no filter makes copyDir create a directory. Restoring the
entries in afterPack fixes only the first copy; a build with such a restore
still shipped an AppImage without them, because the AppImage stage copies
appOutDir again with the same copyDir, and the MSIX file map walks it with
the same walk(). Rehashing digests over the copy would hide the loss.

run-electron-builder.mjs now starts the builder child with
patch-electron-builder-copy.mjs, which rewrites builder-util's fs.js in
memory through a module load hook: walk() keeps the two names, and copyDir()
creates every directory it walks. This follows
patch-electron-builder-mac-binary.mjs, never touches node_modules, and
throws if either needle is missing, so an electron-builder upgrade that
changes this code fails the build instead of silently dropping files.

App files keep excluding .gitkeep and .DS_Store: the `files` matcher
appends electron-builder's default-ignored names to its own patterns
(fileMatcher.js getDefaultIgnoredPatterns), independently of walk().

The preload goes in as a file URL because --import reads a bare Windows
path's drive letter as a URL scheme.

The test launches node with the exact flags runElectronBuilder gives the
builder child, then runs builder-util's copyDir and walk over a fixture
payload. On the base the copy lacks both .gitkeep files, the .DS_Store and
every empty directory.
2026-11-18 11:11:59 -06:00
chloecaffeinexo
04fceafcc3 fix(desktop): mark the prepared icons toolset CommonJS so Node runs the bundled icon-tool.js
electron-builder's bundled icon-tool.js is CommonJS, but the desktop
package.json declares "type":"module", so Node treats the extracted
script as a module and the AppImage packaging step dies with 'require is
not defined in ES module scope' (Linux rebuild failure #132172).

After the icons toolset is copied into the packaged tools output, write a
package.json declaring "type":"commonjs" into that directory only, so
the parent type is overridden for it and Node executes the script as
CommonJS.

Adds prepare-packaging-tools.test.mjs, which reproduces the failure (a
CommonJS script under a "type":"module" tree) and proves the marker
fixes it; red on the base commit, green with the fix.

[BearHuddleston: adapted to main's optional toolsets (9ffa8c63c1): the marker is
written only when the icons toolset is acquired, since an unpacked --dir build
skips it.]

(cherry picked from commit 6fa99e22f69893d6f895bacd63b910258e2dbcd5)
2026-11-18 11:11:47 -06:00
Teknium
df702cab6b feat(cache): backtest rulings — upstream-aware misses, 5m->1h tier at the first pause, learning-store guards
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).
2026-11-18 03:40:34 -08:00
Teknium
579e25e022 feat(caching): learn how each route really caches, across sessions, from usage already received
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>.'
2026-11-18 03:40:34 -08:00
Teknium
3a4fe9c53c feat(caching): cache rules follow the API spec; first keep-alive miss ends warming for the session; keep warming while a tool runs
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.
2026-11-18 03:40:34 -08:00
Vortex Openclaw
730d593fe3 fix(models): honor resolved Codex identity in ACP and Desktop
Some checks failed
Deploy Site / deploy-vercel (push) Has been cancelled
Deploy Site / deploy-docs (push) Has been cancelled
Skills Index Freshness Check / check-freshness (push) Has been cancelled
Skills Index Freshness Check / check-catalog-cors (push) Has been cancelled
Docs Search Monitor / probe (push) Has been cancelled
auto-fix lint issues & formatting / Generate eslint --fix patch (push) Has been cancelled
auto-fix lint issues & formatting / Apply patch (push) Has been cancelled
Build Skills Index / build-index (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
Canary Release / Tag, draft, and start the canary build (push) Has been cancelled
Canary Release / Prune canaries older than 14 days (push) Has been cancelled
2026-11-17 21:42:04 -06:00
Vortex Openclaw
864fd57c59 fix(models): keep undiscovered Codex choices out of Desktop and ACP 2026-11-17 21:42:04 -06:00
Teknium
5ebfa750c5 Merge pull request #149567 from NousResearch/refactor/storage-callers
refactor(storage): every caller on the storage interface
2026-11-17 10:46:06 -08:00
Teknium
0b68adfdee Merge pull request #151825 from NousResearch/refactor/storage-swap
refactor(storage): SessionDB served through the SQLite backend's holder and registry, with one refusal class
2026-11-17 10:45:03 -08:00
yoniebans
d321a00e91 docs(repo): docs, desktop app, skills and native code for the persistence interface
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.
2026-11-17 17:51:21 +01:00
yoniebans
b29699077f refactor(state): serve SessionDB through the backend's store holder and registry
SessionDB keeps its methods and opens no connection of its own: it takes its writer, read pool and write transactions from the SQLite backend's holder, handed out by the backend's registry, so a process holds one writer per state.db whichever door a caller uses. The legacy tests that reached the old connection fields follow the new owner, and the mixed-caller cases pin one writer, one VACUUM gate and one profile release for a process that uses both doors.

A SessionDB built without a holder takes its own reference on the registry's holder for its file, as the backend's stores do, and returns it once: at close, or when the handle is collected unclosed. When that close is the last release and the holder could not close (a lost WAL generation whose capture failed keeps it open), close() raises the holder's error as the legacy close did; a handle collected unclosed only logs it. A read-only one opens a read-only holder, as the read-only backend does. Tests that stand for a second writer in the process open it on a holder of their own.

Tests that patched names this change moves follow them: the registry's holder open, the read lock wait, the clock the store stamps rows with, and the token writer's seam, whose loop-thread read case runs on the backend's holder.

The desktop source-backend fixture copies persistence and session_rules into its test install, since hermes_state imports persistence.
2026-11-17 17:50:50 +01:00
Austin Pickett
2a0f26c6bc refactor(desktop): drop Bot Mode's embedded Skills Hub picker
Bot Mode already embeds the Capabilities view, whose Skills tab is the native
catalog. Removes the docs-page iframe, its hub-origin clipboard/popup/navigation
carve-outs in the main process, and the strings only it used.
2026-11-17 11:27:30 -05:00
Austin Pickett
f461c64a29 fix(desktop): skills catalog docs button opens the skills guide, not the legacy catalog 2026-11-17 11:27:30 -05:00
alt-glitch
458a0046ad refactor(agent): six checkpoint files move from tools/ to agent/checkpoints/
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.
2026-11-16 19:21:55 -06:00
alt-glitch
5b7b215a0d refactor(plugins): plugin install scan moves from tools/ to hermes_cli/
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.
2026-11-17 06:41:24 +05:30
teknium1
0fd634f29c fix(desktop): held cold-start keys reach only the chat the handoff names
Keys typed while no composer was mounted were held per focus target, and
every chat's composer is 'main', so opening another chat from the sidebar
before the cold-start restore finished appended those keys to it. Bind the
held keys to the announced handoff's session; only the composer that adopts
that handoff takes them, and they are dropped once the handoff is abandoned.

Move the cold-start remount tests into use-composer-draft.cold-start.test.tsx
with a shared editable-composer harness (main file was over 1,000 lines).
2026-11-16 11:27:04 -08:00
teknium1
9528ba5156 fix(desktop): keep keys typed while the cold-start resume has no composer mounted
Text typed on the fresh chat during boot follows the chat that
resume-last-session restores (b8dd611d4a, #156615). In between, the
restored chat's loading view mounts no composer. Type-to-focus
(use-keybinds) preventDefaults every printable key and dispatches it to
the 'active' composer synchronously; with no composer subscribed, the
key was simply dropped. macOS packaged Desktop lost the middle of the
prompt this way ("6-d6099024e52cHello, c").

An unclaimed type-to-focus character is now held per target while a
new-session draft handoff is pending, and the next composer to mount on
that target appends the held keys after the draft it restored. Outside a
pending handoff an unclaimed key stays dropped, so stray typing is never
replayed into a later composer. Subscribers mark the request claimed.

0.23.2 release blocker: install-e2e macos desktop-installer@latest ->
open-app-update (v2026.8.13 -> HEAD) and linux installer-script+desktop.
2026-11-16 11:27:04 -08:00
teknium1
23d0650cc8 test(desktop): a draft adopted across the cold-start remount keeps the caret at its end
The cold-start resume remounts the composer and b8dd611d4a (#156615)
carries the boot-time draft onto it. The new editor is painted in the
hook's layout effect before FloatingComposerSurface (the parent)
attaches its portal host, so placeCaretEnd skips the detached node and
the later focus() collapses Chromium's caret to offset 0: keys typed
after the remount land BEFORE the carried text.

Pins the hook-level path: a remount through a parent-attached portal
host with an announced pre-session draft must leave the caret at the
draft's end. Red on main (offset 0), green with the focus fix.

0.23.2 release blocker: install-e2e linux installer-script+desktop
(v2026.8.13 -> HEAD), "The composer must hold the typed prompt before
Enter", Received "r me? Desktop smoke new <uuid>Hello, can y".
2026-11-16 11:27:04 -08:00