Commit Graph

59 Commits

Author SHA1 Message Date
unsupportedpastels
36e095f59f fix(tui): a refused ticket mint shows in Ink's startup activity
Ink's startup activity echoes only verdict-looking stderr lines (`gateway <state>: `, a traceback,
an `XxxError:` head). The previous commit printed the refusal's own `reason: detail; fix` line,
which matched none of them, so the user still saw only "Still waiting"; and an owner that answered
`ok: false` printed a bare `invalid_control_response`, losing the `ticket_unavailable` head.

The bootstrap now builds the same `inaccessible`/`ticket_unavailable` verdict `hermes gateway attach`
reports and raises it through `failure_message`: a `gateway inaccessible: ticket_unavailable` head,
then the bounded cause or the repair command, each line a verdict Ink echoes. Socket errors still
print only their class name. `isTerminalBootstrapFailure` matches none of these, so Ink keeps
retrying as before.

The pytest pins both lines for an unsafe control home, a socket error and an owner's `ok: false`
refusal; a vitest feeds those lines to `reportGatewayStartTimeout` and checks both show as rows.

Suggested by @BearHuddleston in review (bootstrap change and pytest changes applied as posted).
2026-11-06 20:24:06 -05:00
unsupportedpastels
9f130aa6e6 fix(tui): a refused ticket mint shows its repair command again
Since the Ink bootstrap shares attach_gateway with `hermes gateway attach`, a
DiscoveryError from the ticket mint (for example an unsafe control home on a
multiplexer) reached the TUI only as `ticket_unavailable: <reason>`. Before
that change the bootstrap printed the DiscoveryError itself, `reason: detail;
fix`, ending in the command that repairs it. bootstrap() now raises that same
text when the TicketUnavailable came from a DiscoveryError. Other mint
failures keep today's bounded line.

Also marks SessionDB.get_tool_rotation_root for the storage interface
(`sessions.tool_rotation_root`).
2026-11-06 20:24:06 -05:00
alt-glitch
fc3f64ed18 fix(shared): carry the rebase onto main: pnpm, main's new client and test imports
Main switched the workspaces to pnpm and kept editing Ink's client while this branch moved it.

- pnpm-lock.yaml records apps/shared's @types/node (package-lock.json is gone on main);
  apps/shared scripts run through pnpm.
- Main's four client changes (runtime capabilities, `clarifyBatch`, `open_requests`
  redelivery in hydrateSharedPrompts) are in apps/shared/src/node/gateway-client.ts.
- Imports main added for moved modules point at @hermes/shared; duplicate import lines from
  the conflict resolution are merged; clarifyBatchReconnect.test.tsx takes RECONNECT_BASE_MS
  from the shared client.
2026-11-06 11:14:34 -05:00
alt-glitch
1fadfed3f1 fix(shared): the gateway client's terminal-failure hook names its own line; test the default path
Review of the move:

- `isTerminalConnectFailure` becomes `terminalConnectFailure`, which returns the line to report.
  The shared client no longer parses Ink's `gateway unavailable:` format; Ink's subclass does, and
  logs the same line as before.
- apps/shared/src/node/gateway-client.test.ts runs the client with only `connect` (no Ink
  options): it dials the grant with its subprotocols, reads runtime.describe before readiness,
  creates a `source: tui` session, rejects a pending request with the English close text, and
  redials through `connect(false, true)`.
- Docs say sessions are created with `source: "tui"` and that `hermes gateway attach` comes with
  #142159; option and file comments are corrected (connection fields, `text`, prompt-history's
  HERMES_HOME, the i18n and helper comments that named the old files).
- Duplicate `@hermes/shared/gateway-types` imports are merged, and apps/shared/tsconfig.json keeps
  its original formatting.
2026-11-06 11:14:34 -05:00
alt-glitch
ab334f6fdd refactor(tui): move the gateway client into @hermes/shared so other clients skip Ink's source
A third-party Node frontend had to compile ui-tui's private source to talk to the gateway:
gatewayClient.ts, canonicalGateway.ts, gatewayTypes.ts and the slash, history and provider
helpers beside them. hermes-tern bundles 36 such imports through a `.hermes-src` alias.

The renderer-free client now lives in apps/shared:

- src/node/gateway-client.ts: transport, ticketed dial, runtime.describe, the session.create
  contract, reconnect and bounded owner recovery, typed request/events (Node-only).
- src/gateway-canonical.ts, src/gateway-types.ts, src/gateway-text.ts: the hermes-gateway-v1
  request/result translation, the typed results (SessionInfo and SlashCategory with them) and
  the client's English text, keyed by Ink's catalog keys.
- src/slash-input.ts, slash-score.ts, provider-names.ts, interpolation.ts, circular-buffer.ts and
  src/node/prompt-history.ts: helpers with no Ink or React import, moved as they were.

Everything Ink-specific became a constructor option that Ink's own GatewayClient
(ui-tui/src/gatewayClient.ts) passes exactly as before: `connect` (its gateway_bootstrap.py
helper), the terminal-failure predicate, HERMES_TUI_GATEWAY_URL / _SIDECAR_URL, the startup and
RPC timeouts, the launch tool-progress pin, the crash-log breadcrumbs, its i18n `t`, and undici
as the WebSocket when the runtime has none. The launcher's env parsing stays in Ink
(launchOptions.ts). Node-only modules sit in src/node, which the web app's typecheck excludes;
the package typechecks src and src/node with separate configs, and boundary.test.ts fails if
its program ever includes another workspace's file. apps/shared now runs its tests in `check`.
2026-11-06 11:14:34 -05:00
alt-glitch
54dae26e58 fix(gateway): attach leaves its caller's environment alone; one ticket_unavailable verdict
Review of the attach command:

- attach_gateway no longer pops the launch-policy variables from os.environ: an in-process
  caller would have lost HERMES_CWD and friends. scrub_client_launch_env() runs in the two
  processes that exist to attach (the CLI command and Ink's bootstrap), before the attach.
- Every failed mint after an attachable discovery raises TicketUnavailable (a RuntimeError, so
  Ink's bootstrap still prints one bounded line and retries). The CLI reports it as
  inaccessible/ticket_unavailable with the cause in `detail`, instead of a DiscoveryError's own
  code or a bare reason.
- --start and --recover are mutually exclusive; --timeout is documented as the start deadline,
  with discovery and the mint adding at most 5 s each.
- Docs: only an unmanaged gateway that attach spawns has the idle exit; a mint failure is
  answered by running attach again, not by --recover.
- The CLI test keeps the suite's isolation variables in the child, and the no-owner verdict test
  runs on every host.
2026-11-06 10:38:43 -05:00
alt-glitch
f55d794b50 feat(gateway): hermes gateway attach gives a local client a URL and a single-use ticket
A client with its own UI could reach the profile's gateway only through Ink's private
`ui-tui/scripts/gateway_bootstrap.py`: `gateway ensure --json` is public but holds no
credentials, and the `session-ticket` verb had no public caller. hermes-tern had to run Ink's
script out of a Hermes source tree to attach.

`hermes gateway attach --json [--start] [--recover] [--timeout S]` prints ensure's JSON plus,
once the owner is attachable, `url`, `protocol`, `protocols` and one single-use, profile-bound
`ticket` (stdout only, never logged). With no owner to attach it adds `message`, the same
`gateway <state>: <reason>` lines the bootstrap shows, and exits with ensure's code for that
verdict.

Both clients run one function, `hermes_cli/gateway_runtime_attach.py::attach_gateway`:
discover, or ensure on --start / on --recover when not ready, then mint through the existing
`gateway_client._session_ticket` (Unix socket, or the SID-checked named pipe on Windows; a
multiplexed profile mints from the host's socket). The bootstrap is now a thin wrapper over it
and keeps its output, its 30 s start budget, its verdicts and its exit paths.
2026-11-06 10:38:43 -05:00
Maciej Lisiewski
7062229090 chore(js): switch the workspaces from npm to pnpm
pnpm 12.15.0 (native executable) installs every JS workspace from one
pnpm-lock.yaml, imported from package-lock.json with the same resolved
versions. website/, the WhatsApp bridge and the photon sidecar stay separate
npm projects.

Configuration moves from .npmrc and the root manifest into
pnpm-workspace.yaml: the 14-day minimumReleaseAge and its excludes,
overrides, allowBuilds (the old allowScripts set, with strictDepBuilds
failing any unlisted build script), engineStrict, sideEffectsCache: false
(in-place rebuilds must not write into the store) and
verifyDepsBeforeRun: false (a `pnpm run` never installs).

The pnpm version is pinned in pm/lock.json and in root devEngines.
pmOnFail: ignore keeps that pin out of pnpm-lock.yaml: a leading pin
document makes osv-scanner read zero packages. scripts/build/node-deps.mjs
enforces the exact version instead, and every lock reader refuses a
multi-document lock. A root preinstall refuses `npm install`; devEngines
onFail is warn so npx (MCP servers, the tsc linter) keeps working inside
the checkout.

User-machine installs run --frozen-lockfile --trust-lockfile (release age is
checked when locking, in CI, not per user). node-deps removes npm-era
node_modules trees before the first pnpm install. Nix builds the store with
fetchPnpmDeps and a hash file that CI checks.
2026-11-06 04:08:24 +01:00
Maciej Lisiewski
c2a0ecc734 fix: resolve electron, vite and playwright from the workspaces that declare them
Scripts outside the declaring workspace found these through the hoisted root node_modules:
mock-server and connector-rehearsal (whose desktop-local Electron path did not exist under npm),
ui-tui's visual harness, the eval harnesses, and the tests/install/e2e-assets drivers, which import
tests-js's @playwright/test and zod. They now resolve from apps/desktop or tests-js; the typed
e2e-assets files go through a tests-js re-export module so their types resolve the same way.
2026-11-05 14:08:26 -08:00
unsupportedpastels
aa86cf6815 fix(gateway): apply a client's HERMES_* behaviour values to its own session only
On main each `hermes` process read HERMES_EPHEMERAL_SYSTEM_PROMPT,
HERMES_PREFILL_MESSAGES_FILE and HERMES_INFERENCE_PROVIDER from its own
shell. Since the one gateway runs every session, the values exported by
whichever client auto-started it became daemon-wide (messaging and cron
included), and every later client's exports were ignored.

The classic CLI and the Ink TUI now send an allowlisted `client_env` map
(plain strings) with session.create; the classic CLI takes the
allowlist's extra names from the profile's effective config (managed
layer included), as the gateway reads them, and a safe-mode or
ignore-user-config launch reads no profile. The gateway filters the map
again against the session profile's allowlist, freezes it with the
session's policy (outside launch_request, so viewers never see the
values) and binds it for that session's turns only: the ephemeral
prompt, the prefill file and the provider request read the session's
value, in-process and for a managed worker. Desktop sends nothing and
keeps the gateway's environment, as does a session created before this
change.

The auto-started daemon no longer inherits these variables (nor
HERMES_ENABLE_PROJECT_PLUGINS); a gateway the operator starts keeps its
own environment. Clients send the field only when runtime.describe lists
it.

An exact retry of a session created before this change returns its
original session; the retry and commit comparisons and the policy identity
treat an absent client_env as before. A retry is judged against the
committed, filtered map: every stored name must come back with its stored
value, and names dropped at creation don't count, whatever the allowlist
is now. Fresh creates use the current rules, and the unfiltered map is
never stored.

Refs #134889 (LC-8)
Refs #139523
2026-10-16 17:49:54 -04:00
Teknium
21fdbef284 fix(tui): guard the clipboard helper's dependency activation
clipboard_image.py imported hermes_cli.clipboard before activating the
committed generation (it only worked because that module has no third-party
top-level import), and called activate_dependencies unguarded: on PM's store
Python with no committed generation it died with a RuntimeError traceback
instead of answering `false` on stdout.

The helper now activates first, inside main(), and a missing generation or
unreadable install state prints one stderr line and answers `false` (no
image). The Hermes import follows activation.

Review: alt-glitch on #139661, follow-up 3.
Refs #134889 (TUI-22)
Refs #139574
2026-10-16 01:54:58 -07:00
Teknium
4f33e9cd74 fix(tui): name the remedy for a terminal bootstrap failure
`gateway unavailable: bootstrap_dependencies` is the one verdict the client
never retries, and it ended at the raw cause: the user was left with a dead
TUI and no next step. The helper now closes it with a remedy verdict line
("run `hermes pm repair`, then restart the TUI"), prefixed like every other
verdict so STDERR_PROBLEM_RE echoes it inline.

The gateway.start_timeout handler also stops saying "still waiting… /quit and
run `hermes doctor`" for that verdict: the client has already given up, so the
status reads "Hermes stopped" and the verdict lines (cause + remedy) are the
only activity rows. Shown once: gatewayClient publishes the event once and
does not reschedule.

Review: alt-glitch on #139661, follow-up 1.
Refs #134889 (TUI-22)
Refs #139574
2026-10-16 01:54:58 -07:00
Teknium
b2b85bdf71 fix(tui): make only a missing dependency generation a terminal bootstrap failure
gateway_bootstrap.py mapped every RuntimeError and OSError from
activate_dependencies to `gateway unavailable: bootstrap_dependencies`, the
verdict gatewayClient.ts stops retrying on. A one-off I/O error on the install
state (the dependency lock, the facts file) therefore ended the TUI's gateway
for the life of the process.

pm.environments now raises NoCommittedEnvironment (a RuntimeError subclass, so
every existing caller is unchanged) from _require_own_dependencies, and the
bootstrap maps only that to the terminal verdict. Other errors reach the
ordinary failure path the client retries.

Review: alt-glitch on #139661, follow-up 2.
Refs #134889 (TUI-22)
Refs #139574
2026-10-16 01:54:58 -07:00
Teknium
6b083b51d4 fix(tui): let Ink attach to a restart_wait owner on start and recover
connect_gateway already accepted a draining/restart_wait owner, but the
Ink TUI bootstraps through ui-tui/scripts/gateway_bootstrap.py, which
still refused every state but ready on both its start and its recovery
path. Reopening the TUI to answer an approval/clarify parked across a
restart therefore kept failing until the restart finished. Both
bootstraps now share one predicate, gateway_runtime.attachable(), and a
recovery no longer re-ensures an owner it can attach to.

Addresses Greptile review 4291205551.

Refs #134889 (GW-6)
Refs #139574
2026-10-16 01:54:58 -07:00
Teknium
a1a0782156 fix(tui): resolve the helpers' Python root at call time
Code health HX005: the root came from the environment at import time. Read
HERMES_PYTHON_SRC_ROOT through python_root() instead; behaviour is unchanged.

Refs #134889 (TUI-23, TUI-24)
Refs #139574
2026-10-16 01:54:58 -07:00
Teknium
7a0e1e2464 fix(tui): one launch path for Ink's Python helpers; name a bootstrap that cannot start
Settles TUI-23 and TUI-24 on one launch path: the helpers ship with the TUI
product (dist/scripts, salvaged from #139423) AND boot the install's own
dependency generation (salvaged from #138898). Combined as cherry-picked they
broke each other: a packaged helper's parents[2] is the product dir, not the
Python root, so activate_dependencies looked up the wrong install. The client
now passes the root it already puts on PYTHONPATH as HERMES_PYTHON_SRC_ROOT and
both helpers use it.

A helper interpreter that still cannot load Hermes (no committed generation,
missing module) prints the named verdict `gateway unavailable:
bootstrap_dependencies`; gatewayClient reports it once and stops scheduling
reconnects instead of retrying every 30 s forever. nix/checks.nix asserts the
helpers ship in the Nix TUI output.

Refs #134889 (TUI-23, TUI-24)
Refs #139574
Refs #139208
Fixes #138878
2026-10-16 01:54:58 -07:00
Tim Richardson
fb80f5c43e fix(tui): Ink's gateway bootstrap and clipboard helper boot PM's dependencies
Ink runs ui-tui/scripts/gateway_bootstrap.py and clipboard_image.py on
HERMES_PYTHON with PYTHONPATH=<root> only. On a PM source install that is
the store Python, which owns no packages, so the generation the launcher
activated never reaches them. With no gateway running, discovery's no-owner
fallback imports ruamel (gateway.status -> utils -> hermes_yaml) and the
bootstrap dies: a fresh `hermes --tui` can neither start nor recover a
gateway. The clipboard helper loses Pillow, so non-PNG Wayland images
silently depend on ImageMagick.

Both now call pm.environments.activate_dependencies before anything imports
a dependency: the boot hermes_bootstrap runs for every other entry point,
and cron/worker_bootstrap.py for the cron worker. It leases the committed
generation for the process and is a no-op for interpreters that own their
packages (Nix, venvs).

Fixes #138878

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 401ab6cc545390b4ff8c579fa22975bca6cae71e)
2026-10-16 01:54:58 -07:00
Teknium
60ed593167 fix(tui): an open TUI reconnects after hermes gateway stop instead of discovering forever
Reconnects re-ensured only an owner that crashed or idle-exited; a planned stop (or an old
gateway still answering) left every open TUI on "retrying in 30s" until the user quit and
relaunched. Main's TUI ran its own sidecar and never depended on an external daemon, so
`--recover` now re-ensures whenever the owner is not ready. The existing sliding budget
(OWNER_RECOVERY_LIMIT per window) still keeps a crash-looping owner from being respawned
without pause.

(cherry picked from commit b91fec340f16758f4f65600b31010a9a2ea90260)
(cherry picked from commit 71c428eab82cbd9af886328099dae881dd02337b)
2026-10-13 00:31:00 -07:00
Teknium
861afd67b2 fix(tui): say why the gateway refused instead of retrying silently
The bootstrap's verdict (`gateway incompatible: runtime_protocol`) never matched the TUI's
stderr-problem filter, so the reason was dropped and the status bar only cycled "retrying in
30s". The bootstrap now prints the verdict and its remedy (ensure's `detail`) as verdict lines,
and STDERR_PROBLEM_RE echoes them in the activity feed. Remedy strings are kept to one line that
fits the 120-char activity row.

(cherry picked from commit 66a6f0093e5c15e9f571c11e42b6732844dcd7c4)
(cherry picked from commit bcc5d020c45be9a3dcd434aa500e8d25c81c162b)
2026-10-13 00:30:57 -07:00
Teknium
e1a10b0bc2 ci: bring the branch's own code under main's strict ruff config
Main made the strict ruff config the default (`ruff check .`, blocking), and
the branch's code carried 278 findings under it (main itself is clean). Fixed:

- PLW1510 (86): `check=False` on each subprocess.run, preserving behaviour,
  as main's own sweep (0006a5e229) did.
- ASYNC220 (9, test fixtures only): `noqa` with the reason, main's convention
  for a Popen that returns at once and whose handle the test drives.
- ruff's safe autofixes plus the narrow unsafe ones (UP006/UP037/RUF100/RUF013/
  PLR0402/RUF059 underscore renames/UP031/UP041/UP017/FURB167/PIE807/RUF007/
  RUF015/RUF022/FURB162), and by hand: four %-formats to f-strings, three
  unused unpacked names, one fixture loop over `.items()`.

No behaviour change. `ruff check .` passes; scripts/check passes; the 412 test
files mirroring every edited file pass (3 tests/pm files that fail only under
that batch's uv lookup pass solo, before and after this commit).
2026-10-10 17:59:08 -07:00
Teknium
a82d27c593 fix(tui): Ink reconnect re-ensures an owner that idle-exited, never an operator-stopped one
An auto-started owner ends itself once nobody needs it (gateway/run_idle_exit.py, "the next
client starts a fresh gateway") and persists gateway_state `stopped` on the way out. Ink's
reconnect `--recover` treated every `stopped` as a deliberate operator stop, so a TUI that
came back after the owner idle-exited (suspended past the window, laptop asleep, socket
dropped) could never reconnect: plain and --recover both "gateway absent: not ready".

Live premise (real daemon, idle window 2 s, fake HOME): a SIGSTOPped attached client keeps
the owner up (its socket still counts as a client); once it is gone the owner exits with
{gateway_state: stopped, desired_state: null, exit_reason: "auto-started gateway idle for
2s ..."} and `gateway_bootstrap.py --recover` refused on r10-base; with this change it
starts a fresh owner (verified, then stopped by PID).

The idle exit's own exit_reason (now a shared constant, IDLE_EXIT_STOP_PREFIX) tells it apart:
--recover re-ensures a crashed owner or a self-ended idle one; a `hermes gateway stop` /
planned stop / restart (`stopped` with any other reason) and a durable desired_state=stopped
are still never resurrected, and the sliding recovery budget is unchanged.

Test: test_gateway_bootstrap_recover two new cases (idle-exited -> ensured, restart-stopped
-> not); the idle case red on the previous bootstrap, green after.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5475590057
2026-10-10 05:52:03 -07:00
Teknium
5fbf748d58 fix(tui): a TUI-started gateway no longer inherits the launch-time Kanban board
`hermes --tui` pins HERMES_KANBAN_BOARD for its own launch (_pin_kanban_board_env, #20074).
The Ink bootstrap child inherits it, and when it starts the shared owner
(ensure_gateway_runtime -> spawn_unmanaged_gateway copies os.environ) the daemon kept that
board for its whole life: every later chat, Desktop window, cron job and Kanban tool on the
owner resolved to this terminal's launch-time board instead of the profile's kanban/current.
Premise: spawn_unmanaged_gateway with HERMES_KANBAN_BOARD=launch-board in the environment
hands the daemon `HERMES_KANBAN_BOARD=launch-board`.

ui-tui/scripts/gateway_bootstrap.py already strips launch policy (model, toolsets, cwd, yolo,
hooks, ...) before ensuring the owner, because launch policy travels in session.create; the
board joins that list.

Test: tests/tui_gateway/test_gateway_bootstrap_recover.py
test_started_daemon_does_not_inherit_the_launch_time_kanban_board red on r10-base
(['launch-board'] == [None]), green after.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5475590057
2026-10-10 05:52:03 -07:00
Teknium
2107ea5f90 fix(gateway): an auto-started gateway exits once nothing needs it
Every `hermes chat` / `chat -q` / TUI client that found no gateway for its
home started a detached `gateway run` that nothing ever stopped: ~270-350 MB
each, so throwaway homes (scripts, CI, test suites, five homes in the review)
piled up daemons indefinitely.

A client's own start now launches `gateway run --idle-exit` (hidden flag).
That gateway arms a watcher (gateway/run_idle_exit.py) only when no
supervisor owns it (systemd/launchd/Desktop/external stay excluded, as do
installed services, Desktop's `gateway ensure` start, which keeps its
attached gateway for the app's lifetime, and a hand-run `hermes gateway run`).
It exits after `gateway.unmanaged_idle_exit_seconds` (default 600, 0
disables) when all of these hold on two consecutive checks:
- no live ticketed WebSocket, no unredeemed ticket, no HTTP/WS activity
  inside the window;
- no messaging adapter configured, connected or reconnecting (any profile);
- no runnable cron job, no running cron job, no kanban task in
  scheduled/ready/running/review;
- no queued/started admission, live managed worker, hosted-room task,
  in-flight agent/cron/API work, background process/delegation, active
  heartbeat/loop or pending handoff.
Every probe fails closed (an unreadable source keeps it up). The exit
withdraws admission synchronously and publishes draining with
`drain_reason: idle_exit`, so a client that races it waits for the old
process to go and starts a fresh one transparently.

Live (fresh fake homes, loopback provider, window 6 s): chat -q -> gateway
gone at +8.6 s -> second chat -q ok on a new gateway -> gone again; a client
arriving mid-drain succeeds on a fresh gateway; a configured webhook adapter,
a scheduled cron job, a running kanban task, `unmanaged_idle_exit_seconds: 0`,
a Desktop-style `gateway ensure` start and a hand-run `gateway run` all stay
up (watched 24 s).

Review: https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6073624820
(cherry picked from commit 7cdfa2364afb89ac85430d10542cc46cecea0bd4)
2026-10-09 02:10:48 -07:00
Teknium
ac6545eeaa fix: a gateway that dies while starting shows its own error in the client
When the unmanaged gateway a client started exits before it serves (an
import error, an unsupported interpreter, a config refusal), ensure already
returned `runtime_exited` promptly (35e5aaeef9c), but the client only said
"see logs/gateway-stdio.log of the started profile". The traceback was
written to that file before logging is up, so the user had to find and open
it by hand.

ensure now records where this launch's output starts in the append-only
stdio log, and on exit returns the last lines of that launch only (banner
dropped, earlier runs excluded), redacted with force=True, plus the exact
command to read the whole log. `chat -q`, the classic CLI view, Kanban
workers and the Ink bootstrap print it as-is.

Live: a startup exception in a fresh home now fails in 3.1 s with exit 1 and
the RuntimeError line (secret masked), where the reviewed head waited out
`Gateway starting: deadline`. No fallback path is added (maintainer ruling).

Review: https://github.com/NousResearch/hermes-agent/pull/106742#issuecomment-6073624820
(cherry picked from commit 4d0e968ef93ee8978b1eef42f247e846cb7fe6d0)
2026-10-09 02:10:48 -07:00
Teknium
21bd24e2c1 fix: TUI reconnect re-ensures a crashed gateway owner, never a stopped one
After the first launch every Ink bootstrap was discover-only (the
`localStarted` latch), so when an unmanaged owner died (SIGKILL, OOM) the
TUI looped "gateway absent" forever; the pre-cutover client respawned its
owner. Live probe on a fake HOME: ensure -> SIGKILL owner -> discover-only
bootstrap exits "gateway absent: not ready" on every reconnect.

The reconnect now asks `gateway_bootstrap.py --recover`, which re-ensures
only when discovery says `absent` AND the owner's retained
gateway_state.json still claims a live state (running/starting/draining/
degraded) with no `desired_state: stopped`. `hermes gateway stop` and
planned stops persist `stopped`, so an explicit stop is never resurrected
(probe: stop -> --recover -> still absent, no pid file). The client grants
at most 3 recover attempts per 60 s, so a crash-looping owner is not
respawned forever; further reconnects stay discovery-only.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5460639040
2026-10-08 19:09:42 -07:00
Teknium
6b616486c1 refactor(gateway): build the owner WebSocket target in one helper
The canonical owner dial (api_origin -> ws(s)://.../api/ws plus the
['hermes-gateway-v1', 'hermes-gateway-ticket.<ticket>'] subprotocol pair)
was spelled out in agent/runtime_session_store.py (WorkerRPC),
hermes_cli/gateway_client.py (connect_gateway), gateway/session_a2a.py
(forward_to_owner), and also tools/bot_live_delivery.py and
ui-tui/scripts/gateway_bootstrap.py.

hermes_cli.gateway_client already owns the ticket mint (_session_ticket) and the
viewer client, so it now owns gateway_ws_target(endpoint, ticket) and
GATEWAY_WS_PROTOCOL (re-exported from gateway.session_contract's
CANONICAL_GATEWAY_PROTOCOL, a dependency-free module). Every caller uses it and
checks the negotiated subprotocol against the constant. Same URL, same
subprotocols, same proxy=None / timeouts at each call site.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5456384314
2026-10-08 09:10:49 -07:00
Teknium
2ee1cd1ebb fix(gateway): accept -s/--checkpoints/--pass-session-id/--accept-hooks as session creation policy
These four launch options had no working path on the canonical gateway. Classic
`hermes chat` refused them and pointed users at `hermes --tui ...`. The Ink TUI sent
them in session.create, but CREATE_FIELDS rejected them (4001 invalid_params at the
canonical contract), and canonicalRequest threw before the session existed.
localCreationOptions read the documented, exported HERMES_ACCEPT_HOOKS=1, so with
that variable set no TUI session could be created at all. HERMES_TUI_PASS_SESSION_ID
was read by nothing and was silently dropped. On main the in-process TUI gateway and
cli.py applied all four, and tests/hermes_cli/test_cli_preloaded_skills.py covered
the -s preload. That test was deleted on the branch with no replacement.

All four options are now creation fields of the session that names them, applied
by the owner:

- skills: rendered once with build_preloaded_skills_prompt (off the owner loop,
  only for a new session; a retried request_id resumes the frozen route) and stored
  in the frozen LocalSessionPolicy.skills_prompt. The in-process turn appends it to
  the ephemeral prompt and the managed worker passes it as ephemeral_system_prompt,
  matching the CLI/TUI startup preload. A typo among good names is logged and
  skipped, as on main. When no name resolves, creation is refused with unknown_skill.
  A bypass (--safe-mode / --ignore-user-config) launch refuses -s because it must
  not read the profile.
- checkpoints: folded into the frozen config's checkpoints.enabled, which the
  in-process agent already reads through _checkpoint_agent_kwargs(policy config).
  The managed worker now passes it too.
- pass_session_id: frozen in the request and passed to AIAgent (in-process and
  managed), so "Session ID: <id>" rides the system prompt.
- accept_hooks: consents to the profile's configured shell hooks (per-user
  allowlist, off-loop) and registers them on the owner, like the in-process
  --accept-hooks. It is a no-op on a bypass launch, so an exported
  HERMES_ACCEPT_HOOKS=1 cannot brick --safe-mode.

Classic `hermes chat` is a gateway client too: it forwards the same fields, plus
HERMES_ACCEPT_HOOKS=1 when that variable is exported, instead of refusing them.
The Ink TUI maps HERMES_TUI_SKILLS to a list and the flags to booleans, and the
pipe bootstrap stops leaking HERMES_TUI_CHECKPOINTS/HERMES_TUI_PASS_SESSION_ID into a
spawned daemon. The canonical contract (CanonicalCreateParams plus the generated
TS/OpenRPC) advertises the new fields.

Live proof: a real `python -m gateway.run` daemon on a fake home, a real WS
session.create per field, the real Ink mapping via tsx with HERMES_ACCEPT_HOOKS=1
exported, and a real turn against a loopback model. The skill body and
"Session ID: <id>" reach the model's system prompt, a write snapshots into the
checkpoint store (no snapshot without the flag), and the hook command lands in
the allowlist. A real `hermes chat -Q -q ... -s X --checkpoints --pass-session-id
--accept-hooks` exits 0 with the skill in its prompt. On the base, all of these
were refused with invalid_params, Ink threw, and classic chat exited 2.

Review: https://github.com/NousResearch/hermes-agent/pull/106742#pullrequestreview-5456384314
2026-10-08 09:10:37 -07:00
Teknium
7ad6b4e729 refactor(tui): narrow bootstrap except and split native canonical probe run
Clears code-health findings vs origin/main:
- ui-tui/scripts/gateway_bootstrap.py BLE001: the __main__ boundary now catches the
  exceptions discovery/ticketing can raise (ImportError, OSError incl. timeouts and pipe
  errors, RuntimeError, ValueError incl. DiscoveryError/JSON, LookupError, AttributeError,
  TypeError) instead of blind `except Exception`.
- ui-tui/scripts/native_canonical_probe.py run CC 32 -> 18 (extract _peer_class,
  _cleanup for the finally block, _prompt_effect_receipts); its two raw threads now use
  agent.memory_provider.spawn_context_thread (HX012).

Pure extraction, no behaviour change.

(cherry picked from commit 01ec12d6a819a7be4d94e25430dfbe45586f6dc7)
2026-10-07 10:57:36 -07:00
Teknium
8b5688d6e0 fix: POSIX control-socket clients authenticate the listener's uid
query_identify, gateway_client._session_ticket, the Ink gateway_bootstrap
script and session_hosted_transport.owner_request validated the socket
path with lstat and then connect()ed by path. connect() follows a symlink
swapped in after the check, so a writer to the home could stand up an
impostor listener and hand clients its own api_origin (the earlier probe
got {"api_origin": "http://127.0.0.1:6666"} back from query_identify).
None of them asked the kernel who was listening.

Add gateway_runtime_discovery.connect_private(): validate the path, connect,
then require SO_PEERCRED (Linux) / getpeereid (macOS) uid == getuid(),
raising DiscoveryError("unsafe_control_peer") otherwise. All four clients
dial through it. The server's peer-subject check reuses the same
socket_peer_uid() so the platform branches live in one place. Platforms
with neither API keep the path checks only, as documented on the helper.

(cherry picked from commit 69b768f6bc82728395964b74bed3ad7dd98a0544)
2026-10-06 16:21:15 -07:00
Teknium
1e500ebce2 Merge origin/main (#16: 4,465 commits to 9dcab1e440) into feat/unified-gateway-runtime
99 conflicted files resolved in nine area lanes (Desktop composer, Desktop renderer/shared
client, Electron main, Ink, tui_gateway, gateway, state, CLI/config, cron/tools/CI). The
unified runtime's architecture wins where it deliberately replaced a mechanism (pool,
fallback lanes, claim poller, renderer queue); every orthogonal main change is kept, ported
into the <stem>_<topic> sibling that now owns relocated code.

Notable ports and repairs in this merge:
- tui_gateway/server.py relocated regions: atomic _attach_built_agent (#49852), slash ranking
  registry names, minted-key helpers methods_session.py calls, request_overrides, service tier.
- gateway/run_turn*.py: i18n accessors for the removed reply constants, first-contact
  internal/DM rule, rotated-compression persist, fast-mode tiers, prompt-pin rehydration.
- webhook: route_from_chat_id decodes main's opaque webhook:v2 chat ids (old ids still read).
- ws.py: main's per-connection dispatch queue with authority-first dispatch inside it.
- state: schema event for runtime revision renumbered to 31; worker mirrors updated for
  main's message uid/merge fields, on_contended lease arg, compression columns.
- config: branch's bot_chat_delivery_timeout removal renumbered v47 -> v50.
- Electron: primary-profile pin, redirect header scoping, remote fetchJsonForBackend, SSH
  teardown on profile delete, held-update dial gate restored (lost in earlier merges).
- Desktop: canonical clarify.request mapped to main's questions[] card; replay truncation vs
  snapshot_required; periodic secondary prune tick restored; DELETE already_absent restored.
- cron/tools: diagnostic category on cron failure notices restored; owner_holds_delivery
  ported onto the authority; admitted receipts can no longer be cancelled locally.
2026-10-06 14:24:24 -07:00
Teknium
9bcbe7b5df feat(i18n): pluggable, layered language packs across core, Desktop and TUI (#126296)
* feat(i18n): layered catalogs — plugin packs and user overlay over bundled locales

* feat(tui): i18n layer — en catalog, nanostore runtime, RPC pack loader, _keys.tui.json emitter

ui-tui/src/i18n/: en.ts (facade over topical siblings under en/), types.ts
(Translations + dotted TranslationKey derived from en), runtime.ts ($locale/
$catalog atoms, translateFrom active→en→key, pack merge with string→fn
wrapping for {0}/{1} placeholders), loader.ts (display.language →
i18n.catalog {lang, surface:'tui'}, English when the method is missing),
useT()/useLocale() hooks, t() for non-React code. useConfigSync feeds the
loader from the existing config.get full hydration. `npm run i18n:keys`
writes locales/_keys.tui.json (sorted flat key list) and runs before build.

* feat(plugins): provides_locales manifest field, ctx.register_locale/register_locale_dir, manifest-only language packs

* chore(tui): split en catalog siblings by lane (slash sibling)

* feat(plugins): validate language packs — parse, text-only, key-subset WARN against en / _keys exports

* feat(tui_gateway): i18n.languages / i18n.catalog RPC + regenerated contracts

* feat(config): display.language accepts any supported_languages() id, refuses unknown ids with the list

* docs(i18n): language packs user guide, pluggable display.language, plugin developer section, AGENTS notes

* feat(plugins): report language-pack layers in the mid-run activation summary

* feat(tui): wire status bar, composer placeholders, hotkey help and approval/clarify/confirm prompts through i18n

StatusRule maps compared state values (ready/running…/summoning) to catalog
text at render via displayStatus(); hotkeys()/placeholder() resolve lazily so
a pack that arrives after boot applies. Catalog grows to 81 keys.

* feat(desktop): pluggable app locales — registry, host.i18n.registerAppLocale, backend packs, keys emitter

- Locale widens to string (BundledLocale keeps the union); TRANSLATIONS stays
  the bundled record and every consumer resolves through the registry.
- src/i18n/registry.ts: registerAppLocale(id, {endonym, rtl, translations})
  layers partial packs (nested or flat dotted) over bundled/en via
  mergeTranslations; a string over a function-valued en entry becomes a
  positional {0}/{1} formatter; $appLocaleVersion bumps so translators
  re-render; per-source disposers + replaceAppLocaleSource for atomic swaps.
- Backend packs: i18n.languages + i18n.catalog {surface:'desktop'} feed the
  registry as source 'backend' (method-not-found is silent); re-synced on
  socket open, display.language change and profile switch. A saved pack-only
  language is promoted once its pack registers.
- SDK: host.i18n.registerAppLocale / languageOptions; ctx.i18n.registerAppLocale
  tracked for unload. Docs in the desktop plugin SDK guide + skill reference.
- Language switcher lists bundled ∪ registered ∪ backend, endonym-only; RTL
  from the registry (applyDocumentLocale takes rtl).
- npm run i18n:keys emits locales/_keys.desktop.json (wired into build).

* i18n(cli): route /topup + /subscription copy through t() (cli.billing.*, cli.subscription.*)

Module-level copy tables and modal choice tuples in cli_billing_mixin.py froze
English at import, before display.language was known. They are now key tables /
builder functions evaluated at call time; every user-facing line in the /usage
balance block, /subscription and the five /topup screens reads the catalog.
Choice VALUES stay English identifiers. Fragment-assembled status lines
(Plan: … → cancels · $x left · renews …) become full templates.

* i18n(gateway): exec-approval card contract + base/run/run_busy/run_inbound replies through t()

- base_exec_approval: EA_* English constants stay; add ea_header_text()/ea_reason_label_text()/
  ea_smart_deny_line_text()/ea_default_reason_text()/ea_action_labels()/approval_timed_out_notice()
  accessors; deadline + timed-out notice resolve via gateway.exec_approval.*
- BasePlatformAdapter._EA_HEADER/_EA_REASON_LABEL/_EA_SMART_DENY_LINE/_EA_ACTION_LABELS become
  properties (adapters still shadow them with markup class attrs)
- run.py: provider error replies table holds catalog keys; _CONTEXT_OVERFLOW_REPLY -> _context_overflow_reply()
- run_busy/run_inbound: typed approval + slash-confirm matchers accept English ∪ approval.inputs.* (t())
- locales/en.yaml: gateway.exec_approval/busy/errors/... namespaces

* i18n(cli): wire modal, loops, agent-setup mixins through t() (cli.* keys)

* i18n(platforms): route Slack, Matrix and Feishu user-facing text through t()

Exec-approval markup overrides (_EA_HEADER/_EA_REASON_LABEL/_EA_SMART_DENY_LINE/
_EA_ACTION_LABELS) become per-call properties over the shared
gateway.exec_approval.* contract keys, so Slack's 3000-char section budget
measures the resolved template. Slack _APPROVAL_DECISIONS/_CONFIRM_DECISIONS,
Feishu _APPROVAL_LABEL_MAP and Matrix _EA_LEGEND/_EA_TYPED_HINT turn into
key tables resolved at click time; the Matrix typed hints become whole
sentences per offered tier instead of spliced fragments. Slack button labels
are cut to 75 chars and select placeholders to 150 after translation; the
model-facing clarify fallback answer ('choice N') stays English while the
card copy localizes.

locales/en.yaml gains the gateway.exec_approval.* contract keys plus the
platform.shared.* / platform.slack.* / platform.matrix.* / platform.feishu.*
namespaces (and the keys for the other adapters wired in follow-up commits).

* i18n(gateway): run_turn / run_turn_runner / approval-settle copy through t()

- status hints, proxy errors, background task notices, progress heartbeats, session info lines
- tool progress chrome (tool_head/tool_pending/tool_preview/tool_verbose) shared by base.format_tool_event
- run_turn_runner:1406 Chinese clarify placeholder -> gateway.clarify.native_stream_placeholder (zh text kept in zh.yaml)
- _UNEXPECTED_SILENCE_REPLY/_CLARIFY_EXPIRED_NOTICE -> accessor functions

* i18n(platforms): route Google Chat and Teams user-facing text through t()

Google Chat clarify card, typing placeholder, orphan-card labels and the whole
/setup-files reply set (module constants become platform.google_chat.setup_files.*
keys resolved at reply time). The attachment-fallback notice that shipped
hardcoded in Spanish is keyed with an English en value; es.yaml carries the
original Spanish text for those four keys.

Teams approval card header/reason use the gateway.exec_approval.* contract,
_APPROVAL_LABELS becomes a key table resolved at click time, and the meeting
summary writer resolves its section headings/fallbacks per render.

* i18n(platforms): route LINE, WeCom, email, DingTalk, IRC and Home Assistant text through t()

LINE default copy constants become catalog keys resolved in __init__ (the
LINE_*_TEXT / extra.* operator overrides still win); the busy-ack bypass
matcher keys on the leading emoji marker only, so it keeps firing once the
gateway busy heads are localized. WeCom media size/format notices that shipped
hardcoded in Chinese are keyed with English en values and zh.yaml carries the
original Chinese text. DingTalk emotion bubbles resolve per send.

* i18n(cli): route /model switch output and -q status lines through t() (cli.model.*, cli.single_query.*)

Switch-summary labels shared with the gateway reuse gateway.model.* keys
(provider/context/max-output/capabilities/prompt-caching); CLI-only variants
(glyph or no-backtick forms) live under cli.model.*. The hand-padded /model usage
block becomes a (form, description-key) table padded at render time so the
command syntax stays fixed while descriptions translate. -q 'Error:' reuses
gateway.model.error_prefix.

* i18n(cli): route TUI panel/hint/placeholder copy through t() (cli.tui.*)

_APPROVAL_CHOICE_LABELS and _TUI_MODAL_HINTS become key tables resolved at
render time; vault/sudo panel bodies are one catalog value per panel split on
newline; inline plurals use <key>_one/<key>_other. Adds the cli.* namespace
(shared/tui/voice/render/subagents/dock) to locales/en.yaml.

* i18n(cli): voice/wake-word CLI copy through t() (cli.voice.*)

RuntimeError texts raised in _voice_start_recording are human copy (callers
print {e}) and are keyed; the Termux requirement-check match stays English.
Wake state ids stay internal, only their labels localize.

* i18n(cli): live-work dock, subagent monitor and render copy through t()

cli.subagents.* / cli.dock.* / cli.render.*; count fragments pluralize via
_one/_other keys, verdict table holds keys resolved at paint time so width
clipping measures the translated text.

* i18n(gateway): unauthorized/pairing, voice, topics, shutdown, startup, notifications, kanban pings through t()

* i18n(cli): move tips + composer placeholders into the catalog (tips.tNNN / tips.placeholder.pNN)

get_random_tip()/get_random_composer_placeholder() pick a key from the English catalog
(the parity baseline, probed once per process) and resolve it through t() for the active
language, so language packs translate tips like any other string. Also lands the cli.*
en.yaml namespace consumed by the CLI info/help/error-copy wiring in the next commit.

* i18n(cli): wire chat-turn + session mixins through t(); kanban log trimmer matches t() output

* test(cli): assert TUI/dock/voice copy via t(key); prove labels resolve at render time

Pinned-English assertions in the approval-UI, live-work dock and voice tests now
go through the catalog. New test swaps the catalog after import and checks the
approval panel + hint row follow it (the reason _APPROVAL_CHOICE_LABELS and
_TUI_MODAL_HINTS became key tables).

* i18n(cli): route CLI info/help/error copy through t() (cli.* namespace)

cli_info_mixin: /help consumes CommandDef.describe() (added to commands.py: slash.<name>.description
with fallback to .description), section titles/skill/quick-command headers, /tools, /toolsets,
/usage labels, /context, /whoami, /insights, /gateway status, tool-progress labels, bang-shell
denials, MCP config-watch + /reload-mcp confirm/reload lines, /reload-skills, and the session-store
warning all read the catalog at call time (module-level label tables became functions so the
active language is honoured after startup). cli.py: worktree cleanup, tirith warning, show_config
(labels re-padded at print time), quick/plugin/skill slash-command errors, ambiguous-command hint,
stdin error, gateway start, profile warning. cli_chat_error_copy / cli_unknown_command /
cli_output / cli_init_mixin: chat error panel copy, did-you-mean lines, n-more / yes-no prompt
(localized affirmative initial alongside 'y'), unknown-toolsets warning.

* i18n(w1a): wire agent display/explainers/approval + slash registry/help through t()

- hermes_cli/commands.py: CommandDef.describe() resolves slash.<name>.description
  at call time; category labels via slash.category.*; help/alias/usage suffixes
  via slash.shared.*; gateway_help_lines and commands_platforms/slash_exec use them.
- agent/display.py: display.verb.* resolved at call time via get_tool_verb();
  bridge/spinner/thinking-verb/cute-row/failure/preview/diff text via display.*.
- agent/turn_explainers.py: exit-reason / persistence-cause tables become call-time
  lookups (explainer.exit.*, explainer.persistence.*, explainer.file_mutation.*).
- agent/background_review.py, session_activity.py, context_breakdown.py,
  status_output.py: review summaries, iteration progress, context notices.
- tools/approval.py, approval_context.py: approval.summary.*, approval.noun.*,
  approval.window.* pluralized keys.
- gateway/slash_commands*.py: remaining raw strings (busy, whoami, platform,
  bundles, memory, skills, approvals, set_home, diff, update, debug, profile,
  heartbeat, refine, review, subgoal, loop, retry, compress codex path, save,
  sessions, model guard/errors, agents rows, topup, login). HISTORY_UNREADABLE
  keeps its English constant; callers use history_unreadable() ->
  gateway.shared.history_unreadable.
- locales/en.yaml: new approval/display/explainer/slash blocks + gateway leftovers.

* i18n(telegram): route adapter chat copy through t()

Approval card (header/reason/smart-deny as HTML-escaped properties), inline
button labels, callback toasts (cut at Telegram's 200-char cap), model/choice
pickers, clarify/update/slash-confirm prompts, gmail-triage labels and the
inbound-media failure notice now come from the catalog. _UNAUTHORIZED is a
lazy _unauthorized() so the import no longer binds a language. The command
menu carries a language+payload fingerprint (forum scopes re-register on
change) and BotCommand descriptions are cut at 256.

Adds gateway.exec_approval.* (WAVE2 contract), platform.telegram.*,
platform.discord.* and the slash.*.description keys the Discord table shares
with the CLI registry to locales/en.yaml.

* i18n(gateway/platforms): whatsapp_cloud, yuanbao, weixin, signal, api_server copy through t()

- whatsapp_cloud: clarify list/buttons, approve/deny + slash-confirm labels via platform.whatsapp.* (t()-then-truncate at 20/24/72 caps); _EA_HEADER becomes a property wrapping ea_header_text()
- yuanbao: SLOW_RESPONSE_MESSAGE -> slow_response_message() (platform.yuanbao.slow_response_notice; zh keeps the original text); cron-wrapper markers centralized as module constants for strip_cron_wrapper
- api_server: PROVIDER_AUTH_FAILED_LABEL/PROVIDER_RATE_LIMITED_LABEL stay English for run.py matchers; user_text() renders via t()
- signal/_format_wait, weixin voice caption, openai_routes transformed notice
- run_turn: second _UNEXPECTED_SILENCE_REPLY consumer -> accessor

* i18n(discord): route adapter chat copy through t()

Native slash-command table becomes _NATIVE_SLASH_COMMAND_SPECS holding catalog
keys; _native_slash_commands() resolves descriptions, parameter descriptions
and Choice names for the active language, each cut at Discord's 100-char cap,
and the app-command sync fingerprint now includes get_language() so a
display.language change re-syncs. Exec-approval card (gateway.exec_approval.*
contract), slash-confirm / clarify / update views, model+choice pickers,
thread creation, forum titles, voice acks, the response-truncation notice,
the unauthorized-slash security alert and the media upload-size notices all
read from platform.discord.*. Decorator-declared button labels are relabelled
in __init__ (80-char cap); embed titles cut at 256, select placeholders at
150, option label/description at 100. _UNAUTHORIZED is a lazy _unauthorized().

* i18n(cli): wire status-bar, stream, terminal mixins + terminal_input through t(); rename kwargs that shadow t(key)

* i18n: wire hermes_cli/cli_commands_mixin.py slash-command copy through t()

- 431 new leaves under cli.commands.<cmd>.* in locales/en.yaml; 12 rows reuse
  existing gateway.* keys (rollback, diff, resume, branch, btw, model, reasoning)
  via a _gt() helper so CLI and gateway replies stay identical.
- Module-level English tables (_BUSY_MODE_*, _REASONING_TOGGLES, _HATCH_PROGRESS,
  _DIFF_LABELS, _LOCAL_ENGINE_LINES) become call-time catalog lookups keyed by id.
- Verb tables (Enabling/Disabling, Paused/Resumed/Triggered, planned/done,
  Updating/Generating) are one full template per variant; plurals use
  <key>_one/<key>_other via _tn(); hand-padded column labels (/snapshot list)
  translate the value and re-pad at the call site.
- Multi-line usage blocks are single catalog values split with _lines().
- Model-facing system notes and DB-stored reasons stay English (EXCLUDED).

* tests: assert /handoff, /worktree, /login CLI copy via t(key) instead of pinned English

* test(i18n): pin Telegram/Discord adapter catalog wiring

Lazy unauthorized notice, exec-approval contract keys, HTML escaping before
Telegram <b> wrapping, 200-char toast / 256-char BotCommand caps, Discord
100-char app-command text and 80-char button caps, and language-bearing
command-menu fingerprints on both platforms.

* i18n: reconcile cli.shared on/off vs enabled/disabled after lane merge

* i18n: describe() in TUI-gateway slash listings; localize TUI exit resume hint

* i18n(tr): translate bundled catalog + tui pack

* i18n(ja): translate bundled catalog + tui pack

* i18n(ko): translate bundled catalog + tui pack

* i18n(zh): translate bundled catalog + tui pack

* i18n(fr): translate bundled catalog + tui pack

* i18n(af): translate bundled catalog + tui pack

* i18n(uk): translate bundled catalog + tui pack

* i18n(ar): translate bundled catalog + tui pack

* i18n(pt): translate bundled catalog + tui pack

* i18n(it): translate bundled catalog + tui pack

* i18n(es): translate bundled catalog + tui pack

* i18n(zh-hant): translate bundled catalog + tui pack

* i18n(ru): translate bundled catalog + tui pack

* i18n(hu): translate bundled catalog + tui pack

* i18n(hu): translate pre-existing English-valued leftovers (kanban wake, /context, /status, fast labels)

* i18n(de): translate bundled catalog + tui pack

* i18n(ga): translate bundled catalog + tui pack

* test(i18n): fixture matches _normalize_lang(lang, home) signature

* i18n(tui): scaffold userMessages/slashCmd en siblings

* i18n(tui): wire secure prompts + content tables

* feat(tui): i18n — wire billing, subscription, connection-setup and journey overlays

Adds en siblings billing.ts / subscription.ts / connection.ts (namespaces
billing, subscription, connection, journey) and routes every user-facing
literal in billingOverlay, subscriptionOverlay, connectionSetupOverlay and
journey through useT()/messages(). Module-level label tables became lazy
(scopeStillDeniedResult(), verbOf(T, action)); auto-reload rows dispatch on
stable ids instead of label text. Regenerates locales/_keys.tui.json.

* i18n(tui): wire slash ops/wake replies

* i18n(tui): wire pickers (modelPicker, activeSessionSwitcher, petPicker)

* i18n(tui): wire slash core/debug/setup replies

* i18n(tui): wire hubs (agents overlay/panel/controls, skills, plugins)

* i18n(tui): wire slash session/topup/subscription replies

* i18n(tui): wire chat bits (branding, thinking, messageLine, loaders, todo, queued, banner, entry)

* i18n(tui): register t3 siblings (pickers, hubs, secure, content, chatBits) and regenerate keys

* i18n(tui): wire userMessages copy through the userMessages namespace

* i18n(tui): lazy-copy test for userMessages, regenerate _keys.tui.json

* i18n(tui): wire session/gateway/lib text through the TUI catalog (lane t2)

Adds en siblings session.ts, gatewayMsg.ts, libText.ts (namespaces session,
gatewayMsg, libText) and routes user-facing literals in app/{useMainApp,
useSessionLifecycle,useInputHandlers,turnController,createServerRequestHandler,
setupHandoff,createGatewayEventHandler}.ts, gatewayClient displayed reasons,
lib/*, domain/*, hooks/* through t()/messages(). Status-bar state values that
code compares against, backend-matched strings, log lines, model-bound text,
and machine 'error:' prefixes stay literal. Regenerates locales/_keys.tui.json
(232 keys).

* i18n: serve bundled locales/<lang>.tui.yaml under overlay/packs; TUI pack parity test; regen _keys.tui.json (1250)

* i18n: translate pre-existing English stubs in bundled locales (424 leaves, 14 locales)

* tui: i18n-export-en script (English templates for pack translators)

* docs(i18n): bundled TUI packs are the bottom layer of the tui surface

* i18n(ru): translate TUI pack

* i18n(ar): translate TUI pack

* i18n(es): translate TUI pack

* i18n(pt): translate TUI pack

* i18n(ko): translate TUI pack

* i18n(de): translate TUI pack

* i18n(ja): translate TUI pack

* i18n(fr): translate TUI pack

* i18n(tr): translate TUI pack

* i18n(it): translate TUI pack

* i18n(zh): translate TUI pack

* i18n(zh-hant): translate TUI pack

* i18n(hu): translate TUI pack

* i18n(uk): translate TUI pack

1,169 missing keys translated; 81 pre-existing kept byte-identical. Parity OK missing=0 extra=0 placeholder_mismatch=0 empty=0.

Deliberately identical to en: chatBits.branding.mcpSummary ({0} MCP), chatBits.thinking.agentsHint ((/agents)), session.main.voiceStt (◉ STT), session.main.voiceTtsSuffix ( [tts]), slashCmd.core.help.tuiSection (TUI), slashCmd.core.history.hermesTag (Hermes #{0}), slashCmd.debug.heapdump.heapPath (heapdump: {0}), slashCmd.debug.mem.rss (rss), subscription.stepUp.title (Remote Spending — product feature name, as in core catalog), content.faces.* (glyph-only kaomoji).

* i18n(ga): translate TUI pack

* i18n(af): translate TUI pack

* plugin_guard: locale catalogs in language packs step down the agent-config family

A translated status line such as "Updating AGENTS.md" in locales/<lang>.yaml is UI text the loader
reads as a string leaf; it cannot edit a file. The bundled en.yaml itself tripped agent_config_mod
at critical, making any faithful language pack uninstallable. Injection shapes keep full severity.

* plugin_validate_locales: read key exports with utf-8-sig (Windows footgun lint)

* i18n(relay): route relay adapter prompt copy through t(); drop dead import-bound approval header

Adds platform.relay.* (5 keys) to en and all 16 bundled locales, reusing the sibling platform
translations for the confirm buttons and the Other option.

* ci: fix TUI import order, MDX table pipe, main's overflow-warning wording in all locales; fresh-install fixture carries the i18n kernel

- ui-tui/src/i18n/en.ts: perfectionist/sort-imports (slash before slashCmd)
- docs plugins/index.md: escape the | inside the provides_locales table cell (MDX parsed <id> as JSX)
- display.notice.uncompressed_context_overflow: adopt main's wording (names compression.enabled: false
  and /compact) in en + 16 locales; the guardrail test pins that phrase
- tests/scripts/test_fresh_source_install.py: the installer tail now resolves CLI text through
  agent.i18n, so the fixture tree carries the i18n kernel + en.yaml (not the agent runtime)

* docs(desktop-plugin-sdk): double-backtick the template-literal example (MDX evaluated ${n})

* test(e2e): display.language is validated against the live language set; exclude it from the arbitrary-string set property

* commands: keep the localized COMMANDS/COMMANDS_BY_CATEGORY module __getattr__ after the compat block removal

* build: never write locales/_keys.*.json from the desktop/TUI builds; regenerate the committed desktop key export

The desktop build regenerated locales/_keys.desktop.json in the checkout, so a
hermes update that rebuilt the app left the tree dirty (Desktop update E2E:
'M locales/_keys.desktop.json'). The key exports are committed artifacts pinned
to en.ts by apps/desktop/scripts/i18n-keys.test.mjs and ui-tui i18n:keys:check;
builds read them, never write them. Regenerated after main's new desktop strings.

* test: unbreak two main-red timing tests the PR merge-ref inherits

- test_local_runtime racing fake publishes the modern state record (legacy pid-only
  records are rejected since 65ff3ad353; main has been red on this test since)
- test_run_progress_topics ManyProgressLinesAgent waits for the first bubble instead of
  a fixed 0.35s, which a loaded CI runner does not always meet

* chore(i18n): regenerate desktop key catalog for main's new strings (model pricing, copy changelog)

* test(e2e): torture-chamber fd monitor confirms a deleted sidecar is still held before calling it a leak

SQLite's WAL last-close unlinks -shm before closing its descriptor (unixShmUnmap, then
unixShmPurge), so a healthy close shows a (deleted) -shm for microseconds; the 20ms poll
occasionally caught that window on the short-lived opener and failed the episode.

* chore(i18n): regenerate desktop key catalog for main's telemetry/consent strings

* chore(i18n): regenerate desktop key catalog after main sync

---------

Co-authored-by: Teknium <teknium@nousresearch.com>
2026-09-28 14:16:18 -07:00
teknium1
f0638e4487 fix(gateway): named profiles attach through the host multiplexer
The dashboard's profile-scoped PTY never connected (e2e/core/dashboard
test_pty_chat_turn_reconnect_and_profile_scoped_keepalive):

- gateway ensure for profiles/<name> with no multiplexer evidence yet spawned
  a per-profile daemon, which main's guard refuses ("does not get a gateway of
  its own"). ensure now starts the host root in that case, matching the guard:
  standalone profiles, an installed per-profile service, and an explicit
  multiplex_profiles: false keep their own daemon.
- the Ink bootstrap found the host endpoint but asked the profile's own socket
  for the session ticket; it now uses control_home_for like the CLI and Desktop.
- the attached TUI shows main's 'Session: <id>' banner and its profile-labelled
  composer (session.info carries profile_name).

The dashboard harness stops a sandbox gateway before reaping: the TUI's daemon
outlives its viewer by design, outside the dashboard's process group.
2026-09-27 12:37:32 -07:00
teknium1
c6dc7ab120 Merge remote-tracking branch 'origin/main' into feat/unified-gateway-runtime
Merge #8: 2,771 commits from main (4b05f764fa). Ports main's moved code into the
unified runtime (run.py/run_turn.py splits, tui_gateway server, backup/restore
split), keeps the detached-daemon Desktop lifecycle, and adapts main's new tests
to the owner/authority contracts (canonical session deletes, retired-id
tombstones, zero-writer browsing, hermes_yaml, platforms() markers).
2026-09-27 02:30:04 -07:00
Brooklyn Nicholson
87d1c5b0c3 refactor(tui): drop redundant native-mode guards 2026-09-25 17:57:38 -05:00
brooklyn!
7e35460ac2 refactor(tui): simplify native mode paths 2026-09-25 17:57:38 -05:00
brooklyn!
7ecd29c293 perf(tui): add native history benchmark 2026-09-25 17:57:38 -05:00
ethernet
1bf588234c refactor(build): share product recipes across distributions
Build TUI, web, desktop UI and runnable agent products from explicit
prepared inputs. Keep dependency preparation separate from distribution
packaging, with PM and native builds sharing uv environment construction.

Docker copies compiled frontend products instead of build dependencies.
Nix retains uv2nix environments and consumes shared assembly through store
references. Native desktop and Termux use the same launcher and frontend
contracts. Preserve the independent PM runtime and source imports from
arbitrary working directories.

Keep failed frontend builds from replacing the previous product, reject
source/output overlap, and bound dependency-process output draining.
Include hermes_wisdom in the Nix wheel: real CLI smoke tests exposed its
missing package declaration on the base revision too.

Verified focused Python and JavaScript suites, Docker build/runtime checks,
Nix desktop and CLI/ACP checks, standalone TUI and packaged Electron PTY,
and real full-Chromium interaction. Native signed installers, Android device
installation and the full repository suite remain CI verification.
2026-09-11 13:16:55 -04:00
Teknium
179a84734c fix: stage clipboard images on the Ink client host 2026-09-10 05:17:17 -07:00
Teknium
c75e0cdd76 test: exercise native Stop through the Python Ink launcher 2026-09-08 11:48:22 -07:00
Teknium
d0ad8324c8 test: verify native Ink Stop acknowledgement and fresh follow-up 2026-09-08 11:48:15 -07:00
Teknium
8b727f4aad test: exercise fresh Ink launch through the real Python launcher 2026-09-08 11:48:07 -07:00
Teknium
cc4ad0d115 test: verify actual native clarification answer on model wire 2026-09-08 11:48:04 -07:00
Teknium
eecaba4203 test: require native Ink reconnect to render settled history 2026-09-08 11:47:57 -07:00
Teknium
f454485d7c test: retain native reconnect output for intermittent Ink failure 2026-09-08 11:47:33 -07:00
Teknium
3dfb7d50a5 fix: correlate canonical Ink receipts with prepared input identities 2026-09-08 11:47:33 -07:00
Teknium
a2d9e258da feat: bind Ink sessions and controls to canonical authority envelopes 2026-09-08 11:47:33 -07:00
Teknium
08f628f9f5 feat: attach Ink local transport through canonical gateway bootstrap 2026-09-08 11:47:33 -07:00
Gabriel Lesperance
68391930d0 perf(tui): bound scroll rendering and preserve anchors 2026-08-03 09:53:51 +05:30
Brooklyn Nicholson
9fb2a63db8 fix(ui-tui): make npm run visual portable off POSIX — zero new deps
Review on #20379, finding 4 (Medium). Three portability defects in the
visual verification harness:

- `FORCE_COLOR=3 COLORTERM=truecolor tsx ...` POSIX env assignment does not
  work under the Windows npm command shell. The script is now a plain Node
  launcher (scripts/visual/run.mjs) that sets the env itself and spawns tsx
  via require.resolve('tsx/cli') — no cross-env, no shell syntax.
- Hardcoded /tmp/tui-visual.{html,png} resolve to a drive-root path like
  C:\tmp on native Windows (and fail when that directory doesn't exist).
  Both scripts now derive the output directory from a shared paths.mjs
  helper: os.tmpdir()/hermes-tui-visual (created recursively;
  HERMES_TUI_VISUAL_DIR overrides for CI or side-by-side runs).
- electron was undeclared by ui-tui and only worked via hoisting luck. The
  launcher now resolves it EXPLICITLY from the install tree the desktop
  workspace already provides (require('electron') in plain Node returns the
  binary path), with an ELECTRON_BIN override and a clear error pointing at
  the repo-root install when it's absent — instead of declaring a second
  ~100MB dependency on a TUI workspace for a dev-only harness.

Also fixes the trailing-whitespace line in render.tsx that `git diff
--check` flags. Verified end-to-end: render writes the HTML scene sheet
and the electron shot step produces the screenshot from the tmpdir path;
the missing-electron error path prints the guidance message.
2026-07-21 20:29:48 -05:00
Brooklyn Nicholson
c0763bd13a feat(ui-tui): theme engine — seeds to derived-tone ladder + flash-free boot
The desktop color-mix system, ported: a theme is a handful of identity
SEEDS (text, primary, accent, border, status hues); every secondary tone
(muted, label, surfaces, chips, selection) is a color-mix derivative
against the real terminal background. lib/color.ts consolidates the
primitives (parse/mix/luminance/contrast/retone + xterm.js's multiplicative
liftForContrast). Knobs are grid-search fitted so the math reproduces the
classic hand-tuned literals (contract-tested). The display shim renders
authored palettes RAW and only rescues near-invisible colors. Boot reads
the last resolved theme from $HERMES_HOME/tui-theme-boot.json so the first
frame paints in the right palette (no default-dark flash), and the
placeholder cursor follows the bubbles textinput pattern.
2026-07-21 16:36:57 -05:00