hermes-agent/hermes_cli/plugin_validate.py

694 lines
27 KiB
Python
Raw Permalink Normal View History

"""``hermes plugins validate`` — admission checks for a plugin directory.
This is the command the plugin-catalog admission CI (and the
``.github/actions/plugin-validate`` composite action) runs against a
candidate plugin. It performs static manifest checks plus a
subprocess-isolated capability probe: the plugin is imported and its
``register(ctx)`` called against a minimal recording stub context in a
scratch child process (with a throwaway ``HERMES_HOME``), so a crashing or
malicious plugin cannot take down the CLI, and the *actually registered*
tools/hooks/middleware are compared against the manifest's declared
``provides_*`` lists.
"""
from __future__ import annotations
import json
import os
import re
import subprocess
import sys
import tempfile
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
feat(plugin-catalog): refuse plugins that override Hermes core or Desktop at runtime Catalog policy (Teknium): a listed plugin extends Hermes only through public surfaces. A plugin that replaces core functions, methods or Desktop UI in place collides with every other plugin patching the same seam and breaks on any core release. - New `no core override` admission check (hermes_cli/plugin_validate_core_override.py): static taint pass over the import closure of __init__.py and dashboard/*.py. Core values are Hermes modules (plus hermes_plugins.*) and attribute chains off them, reached by import, importlib/sys.modules lookups, getattr, iteration, or a plugin helper that returns one. Rebinds are attribute assignment/deletion, setattr/delattr, sys.modules writes, writes into a core module's tables, mock.patch, and passing a core value to a helper that setattr's its parameter. Tests, benchmarks and CI/smoke scripts outside the import closure are not judged. - Desktop lint: new `app DOM reach` rule (document-level queries of the app's own data-slot/data-tour/data-sidebar/data-testid markup, and document.body childList/subtree MutationObservers). - Desktop lint bug: the comment stripper did not skip string literals, so a string holding `/*` (a glob like '**/*.md') opened a fake comment and hid every line up to the next `*/` from all rules. Strings are now matched first and kept. - README rule 9, the plugin-catalog user guide and the plugin developer guide's compatibility contract state the rule. A/B over 466 pinned trees (121 open catalog PR entries + 349 listed entries + humalike): the new checks flag exactly the hand-verified overrides; zero crashes; no previously reported Desktop finding disappears.
2026-10-01 11:17:05 -07:00
from hermes_cli.plugin_validate_core_override import check_core_override
from hermes_cli.plugin_validate_desktop import check_desktop_surface
from hermes_cli.plugin_validate_private_imports import check_private_imports
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
from hermes_cli.plugin_validate_locales import check_language_packs
from hermes_cli.plugins_manifest import _CONFIG_SCHEMA_TYPES
_UPPER_SNAKE_RE = re.compile(r"^[A-Z][A-Z0-9_]*$")
# Admission accepts exactly the ``config_schema`` types the loader type-checks at load time (and the
# Desktop settings renderer keys its field table on) — a private copy drifted and rejected ``secret``.
_CONFIG_TYPES = frozenset(_CONFIG_SCHEMA_TYPES)
_PROBE_TIMEOUT = 30
_PROBE_SENTINEL = "HERMES_VALIDATE_JSON:"
@dataclass
class ValidationReport:
"""Result of validating one plugin directory."""
checks: list[tuple[str, bool, str]] = field(default_factory=list)
warnings: list[str] = field(default_factory=list)
isolation: Optional[dict[str, Any]] = None # plugin-host readiness; informational, never fails
@property
def failures(self) -> list[str]:
return [detail or name for name, ok, detail in self.checks if not ok]
@property
def ok(self) -> bool:
return all(ok for _name, ok, _detail in self.checks)
@property
def exit_code(self) -> int:
return 0 if self.ok else 1
def add(self, name: str, ok: bool, detail: str = "") -> None:
self.checks.append((name, ok, detail))
def warn(self, message: str) -> None:
self.warnings.append(message)
def to_dict(self) -> dict[str, Any]:
return {
"ok": self.ok,
"checks": [
{"name": name, "ok": ok, "detail": detail}
for name, ok, detail in self.checks
],
"warnings": list(self.warnings),
"isolation": self.isolation,
}
# ─── Static checks ───────────────────────────────────────────────────────────
def _requires_hermes_spec_valid(spec: str) -> bool:
"""Strictly validate a ``requires_hermes`` spec.
Unlike :func:`hermes_cli.plugins_manifest.version_satisfies` (permissive at load
time), validation REJECTS clauses whose version segment doesn't parse —
a typo'd spec should fail admission, not silently gate nothing.
"""
from hermes_cli.plugins_manifest import _VERSION_COMPARATOR_RE, _version_tuple
for clause in spec.split(","):
clause = clause.strip()
if not clause:
continue
m = _VERSION_COMPARATOR_RE.match(clause)
target = m.group(2) if m else clause
if _version_tuple(target) is None:
return False
return True
def _check_manifest_fields(report: ValidationReport, manifest: dict) -> None:
missing = [
f for f in ("name", "version", "description") if not manifest.get(f)
]
if missing:
report.add(
"manifest fields",
False,
f"plugin.yaml missing required field(s): {', '.join(missing)}",
)
else:
report.add("manifest fields", True, "name, version, description present")
def _check_requires_hermes(report: ValidationReport, manifest: dict) -> None:
spec = str(manifest.get("requires_hermes") or "").strip()
if not spec:
report.add("requires_hermes", True, "not declared")
return
if _requires_hermes_spec_valid(spec):
report.add("requires_hermes", True, f"spec {spec!r} parses")
else:
report.add(
"requires_hermes",
False,
f"requires_hermes spec {spec!r} does not parse "
"(expected e.g. \">=0.19\" or \">=0.19, <1.0\")",
)
def _check_config_spec(report: ValidationReport, manifest: dict) -> None:
"""Validate the manifest ``config_schema`` mapping (#64165 format)."""
raw = manifest.get("config_schema")
if raw in (None, [], {}):
report.add("config schema", True, "not declared")
return
problems: list[str] = []
if not isinstance(raw, dict):
problems.append("config_schema: must be a mapping of key -> spec")
else:
for skey, spec in raw.items():
if not isinstance(spec, dict):
problems.append(
f"config_schema.{skey}: must be a mapping (e.g. {{type: str}})"
)
continue
typ = spec.get("type")
if typ is not None and str(typ).lower() not in _CONFIG_TYPES:
problems.append(
f"config_schema.{skey}: type must be one of "
f"{'/'.join(sorted(_CONFIG_TYPES))}"
)
required = spec.get("required")
if required is not None and not isinstance(required, bool):
problems.append(
f"config_schema.{skey}: required must be a boolean"
)
if problems:
report.add("config schema", False, "; ".join(problems))
else:
report.add("config schema", True, "shape valid")
def _check_requires_env(report: ValidationReport, manifest: dict) -> None:
raw = manifest.get("requires_env") or []
problems: list[str] = []
if not isinstance(raw, list):
problems.append("requires_env: must be a list")
raw = []
for i, entry in enumerate(raw):
if isinstance(entry, str):
name = entry
elif isinstance(entry, dict):
name = str(entry.get("name") or "")
else:
problems.append(f"requires_env[{i}]: must be a string or mapping")
continue
if not _UPPER_SNAKE_RE.match(name):
problems.append(
f"requires_env[{i}]: {name!r} is not UPPER_SNAKE_CASE"
)
if problems:
report.add("requires_env", False, "; ".join(problems))
else:
report.add("requires_env", True, "all entries UPPER_SNAKE")
feat(plugins): OAuth clients a plugin declares, signed in and refreshed by Hermes A plugin that calls a third-party API with the user's own OAuth client (Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml instead of running the consent flow and keeping the refresh token itself. - `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE login of auth_oauth_pkce_plugin and keeps the grant in the active profile's auth.json (section `plugin_oauth`, keyed by the plugin's key) - `credentialed_provider_request(<id>, ...)` attaches the bearer for the entry's declared hosts only (https, port 443) and refreshes the grant under the auth-store lock; the calling plugin's own entry is resolved before `_PROVIDERS`, so a later core provider of the same name cannot take it over - each grant stores a fingerprint of the entry it was made for: a plugin version that changes the token URL, hosts, scopes or client variables gets ProviderNotSignedIn until the user signs in again - the client secret is read with get_secret right before each token POST (OAuthPKCEConfig.token_request) and never sits in the frozen config - grant-dead codes retire the grant; invalid_client, unauthorized_client and invalid_scope surface as AuthError codes; a sign-in granted fewer scopes than declared saves nothing - `hermes plugins validate` checks the block and the declared variables and warns when plugin code names the token URL; install/show notices and the catalog re-pin consent delta list the entries Refs #139077
2026-10-16 14:33:13 +05:00
def _check_oauth(report: ValidationReport, manifest: dict, plugin_dir: Path) -> None:
"""``oauth:`` clients (hermes_cli.plugin_oauth): shape, https and declared variables fail admission; a
host outside the IdP's domains and plugin code that names a token URL are reviewer warnings."""
from hermes_cli.plugin_oauth import oauth_admission_problems, oauth_admission_warnings
feat(plugins): OAuth clients a plugin declares, signed in and refreshed by Hermes A plugin that calls a third-party API with the user's own OAuth client (Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml instead of running the consent flow and keeping the refresh token itself. - `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE login of auth_oauth_pkce_plugin and keeps the grant in the active profile's auth.json (section `plugin_oauth`, keyed by the plugin's key) - `credentialed_provider_request(<id>, ...)` attaches the bearer for the entry's declared hosts only (https, port 443) and refreshes the grant under the auth-store lock; the calling plugin's own entry is resolved before `_PROVIDERS`, so a later core provider of the same name cannot take it over - each grant stores a fingerprint of the entry it was made for: a plugin version that changes the token URL, hosts, scopes or client variables gets ProviderNotSignedIn until the user signs in again - the client secret is read with get_secret right before each token POST (OAuthPKCEConfig.token_request) and never sits in the frozen config - grant-dead codes retire the grant; invalid_client, unauthorized_client and invalid_scope surface as AuthError codes; a sign-in granted fewer scopes than declared saves nothing - `hermes plugins validate` checks the block and the declared variables and warns when plugin code names the token URL; install/show notices and the catalog re-pin consent delta list the entries Refs #139077
2026-10-16 14:33:13 +05:00
if manifest.get("oauth") in (None, []):
feat(plugins): OAuth clients a plugin declares, signed in and refreshed by Hermes A plugin that calls a third-party API with the user's own OAuth client (Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml instead of running the consent flow and keeping the refresh token itself. - `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE login of auth_oauth_pkce_plugin and keeps the grant in the active profile's auth.json (section `plugin_oauth`, keyed by the plugin's key) - `credentialed_provider_request(<id>, ...)` attaches the bearer for the entry's declared hosts only (https, port 443) and refreshes the grant under the auth-store lock; the calling plugin's own entry is resolved before `_PROVIDERS`, so a later core provider of the same name cannot take it over - each grant stores a fingerprint of the entry it was made for: a plugin version that changes the token URL, hosts, scopes or client variables gets ProviderNotSignedIn until the user signs in again - the client secret is read with get_secret right before each token POST (OAuthPKCEConfig.token_request) and never sits in the frozen config - grant-dead codes retire the grant; invalid_client, unauthorized_client and invalid_scope surface as AuthError codes; a sign-in granted fewer scopes than declared saves nothing - `hermes plugins validate` checks the block and the declared variables and warns when plugin code names the token URL; install/show notices and the catalog re-pin consent delta list the entries Refs #139077
2026-10-16 14:33:13 +05:00
report.add("oauth", True, "not declared")
return
problems = oauth_admission_problems(manifest, plugin_dir)
report.add("oauth", not problems, "; ".join(problems) or "clients valid")
for warning in oauth_admission_warnings(manifest, plugin_dir):
feat(plugins): OAuth clients a plugin declares, signed in and refreshed by Hermes A plugin that calls a third-party API with the user's own OAuth client (Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml instead of running the consent flow and keeping the refresh token itself. - `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE login of auth_oauth_pkce_plugin and keeps the grant in the active profile's auth.json (section `plugin_oauth`, keyed by the plugin's key) - `credentialed_provider_request(<id>, ...)` attaches the bearer for the entry's declared hosts only (https, port 443) and refreshes the grant under the auth-store lock; the calling plugin's own entry is resolved before `_PROVIDERS`, so a later core provider of the same name cannot take it over - each grant stores a fingerprint of the entry it was made for: a plugin version that changes the token URL, hosts, scopes or client variables gets ProviderNotSignedIn until the user signs in again - the client secret is read with get_secret right before each token POST (OAuthPKCEConfig.token_request) and never sits in the frozen config - grant-dead codes retire the grant; invalid_client, unauthorized_client and invalid_scope surface as AuthError codes; a sign-in granted fewer scopes than declared saves nothing - `hermes plugins validate` checks the block and the declared variables and warns when plugin code names the token URL; install/show notices and the catalog re-pin consent delta list the entries Refs #139077
2026-10-16 14:33:13 +05:00
report.warn(warning)
# ─── Capability probe (subprocess-isolated) ──────────────────────────────────
# Self-contained harness run in a scratch child process. Imports the plugin
# module using the same file-location mechanics PluginManager uses, calls
# register() against a recording stub ctx, and prints a sentinel-prefixed
# JSON line of what was actually registered. Deliberately imports NOTHING
# from hermes so a hostile plugin only sees a bare interpreter — the one
# exception is `providers` for `kind: model-provider`, whose contract IS
# calling providers.register_provider at import.
_PROBE_SCRIPT = r"""
import importlib.util
import json
import sys
plugin_dir = sys.argv[1]
sentinel = sys.argv[2]
options = json.loads(sys.argv[3])
# Public method names of the real PluginContext, computed by the parent so the
# stub's attribute surface cannot drift from the class plugins run against.
context_methods = set(options["context_methods"])
provider_kind = options["kind"] == "model-provider"
recorded = {"tools": [], "hooks": [], "middleware": [], "commands": [], "providers": [], "trusted_inbound": []}
class RecordingContext:
plugin_config = {}
profile_name = "default"
plugin_id = "hermes_validate_probe_plugin"
def register_tool(self, name, *args, **kwargs):
recorded["tools"].append(str(name))
def register_hook(self, hook_name, callback, *, hold_stream=False):
recorded["hooks"].append(str(hook_name))
def register_middleware(self, kind, callback):
recorded["middleware"].append(str(kind))
def register_command(self, name, *args, **kwargs):
recorded["commands"].append(str(name))
def register_cli_command(self, name, *args, **kwargs):
recorded["commands"].append(str(name))
def register_platform(self, name, *args, **kwargs):
if kwargs.get("trusted_inbound"):
recorded["trusted_inbound"].append(str(name))
feat(plugins): catalog is the sole discovery system — re-port onto main's layout - hermes_cli/plugins_cmd_catalog.py: new sibling owning resolution, the .hermes-catalog.json provenance sidecar, search/info/validate, re-pin on update, and the dashboard/TUI payload builders. plugins_cmd.py only gains the hooks (cmd_install catalog branch, cmd_update / dashboard update re-pin, dashboard_install_plugin catalog_name + kill list, dispatch entries); the community index (plugin_index.py) is gone. - hermes_cli/plugin_catalog.py: catalog_dir parameter replaces the test-only HERMES_PLUGIN_CATALOG_DIR env var; live refresh reads ONE published document (/docs/api/plugin-catalog.json, 6h cache, in-tree fallback) instead of the unauthenticated GitHub contents API (60 req/h, 1 request per entry); in-tree and live removals are unioned so a stale cache can never un-block. - Catalog route lives in web_routers/dashboard_ui.py (the facade is off limits); _plugin_runtime_status shared from web_server_dashboard.py; hub rows carry removed_reason. TUI plugins.manage gains catalog_name install, catalog row fields and an update action. - plugin_validate: the probe context honours ctx.get_config defaults (real plugins do int(ctx.get_config("timeout", 180)) in register()). - Installed-state merge matches through the sidecar's catalog_name first — catalog names rarely equal manifest names. - extract-plugins.py emits plugin-catalog.json; deploy-site triggers on plugin-catalog/** so entry merges republish it.
2026-09-09 04:38:01 -07:00
def get_config(self, key, default=None):
# Mirrors PluginContext.get_config with no config on disk: the DEFAULT, never None —
# plugins do `int(ctx.get_config("timeout", 180))` in register().
return default
def __getattr__(self, name):
# Any other REAL registration surface (platforms, providers, skills,
# context engines, ...) is accepted as a no-op — the probe only audits
# the declared-capability categories. Names the real PluginContext does
# not have raise AttributeError exactly like it would; handing back a
# callable made `getattr(ctx, "profile_path", None)` truthy and crashed
# register() in the probe alone.
if name in context_methods:
def _noop(*args, **kwargs):
return None
return _noop
raise AttributeError(name)
def emit(payload):
print(sentinel + json.dumps(payload))
if provider_kind:
# `kind: model-provider` plugins register at import via
# providers.register_provider(ProviderProfile) — the PluginManager never
# calls a register(ctx) on them (plugins_discovery skips the kind), so the
# probe records that call instead of demanding an entry point that would
# be dead code.
try:
import providers as _providers
except Exception as exc:
emit({"error": "model-provider probe could not import providers: %s" % exc})
sys.exit(0)
_real_register_provider = _providers.register_provider
def _recording_register_provider(profile):
recorded["providers"].append(str(getattr(profile, "name", profile)))
return _real_register_provider(profile)
_providers.register_provider = _recording_register_provider
try:
spec = importlib.util.spec_from_file_location(
"hermes_validate_probe_plugin",
plugin_dir + "/__init__.py",
submodule_search_locations=[plugin_dir],
)
module = importlib.util.module_from_spec(spec)
module.__path__ = [plugin_dir]
sys.modules[spec.name] = module
spec.loader.exec_module(module)
except Exception as exc:
emit({"error": "import failed: %s" % exc})
sys.exit(0)
if provider_kind:
if not recorded["providers"]:
emit({"error": "model-provider plugin registered no ProviderProfile at import"})
else:
emit(recorded)
sys.exit(0)
register = getattr(module, "register", None)
if register is None:
emit({"error": "no register() function"})
sys.exit(0)
try:
register(RecordingContext())
except Exception as exc:
emit({"error": "register() raised: %s" % exc})
sys.exit(0)
emit(recorded)
"""
def _probe_options(manifest: dict) -> dict:
from hermes_cli.plugins import PluginContext
return {
"kind": str(manifest.get("kind") or ""),
"context_methods": sorted(
n for n in dir(PluginContext)
if not n.startswith("_") and callable(getattr(PluginContext, n))
),
}
def _run_capability_probe(
plugin_dir: Path, manifest: dict, probe: Optional[tuple[list[str], dict[str, str]]] = None,
) -> tuple[Optional[dict], str]:
"""Run the recording probe in a scratch subprocess.
*probe* is ``(python argv prefix, env)`` of the dependency environment to import the plugin
from (``pm.environments.venv_command``); None probes this interpreter.
Returns ``(recorded, error)`` — exactly one is meaningful: *recorded*
is the ``{tools, hooks, middleware, commands, providers}`` dict on
success, and *error* is a human-readable failure description otherwise.
"""
with tempfile.TemporaryDirectory(prefix="hermes-validate-") as scratch:
env = dict(probe[1] if probe else os.environ)
env["HERMES_HOME"] = scratch
# The probe imports this tree's ``providers``; name the tree instead of relying on the cwd.
repo_root = str(Path(__file__).resolve().parents[1])
env["PYTHONPATH"] = os.pathsep.join(p for p in (repo_root, env.get("PYTHONPATH", "")) if p)
python, *options = probe[0] if probe else [sys.executable]
try:
result = subprocess.run(
[
# -P: ``-c`` would put the user's cwd ahead of Hermes and the plugin's imports.
python, "-P", *options,
"-c",
_PROBE_SCRIPT,
str(plugin_dir),
_PROBE_SENTINEL,
json.dumps(_probe_options(manifest)),
],
capture_output=True,
text=True, encoding="utf-8", errors="replace",
timeout=_PROBE_TIMEOUT,
env=env,
check=False,
)
except subprocess.TimeoutExpired:
return None, f"capability probe timed out after {_PROBE_TIMEOUT}s"
payload: Optional[dict] = None
for line in (result.stdout or "").splitlines():
if line.startswith(_PROBE_SENTINEL):
try:
payload = json.loads(line[len(_PROBE_SENTINEL):])
except json.JSONDecodeError:
payload = None
if payload is None:
err = (result.stderr or "").strip()
return None, (
"capability probe produced no result "
f"(exit {result.returncode})" + (f": {err}" if err else "")
)
if "error" in payload:
return None, str(payload["error"])
return payload, ""
def _declared_list(manifest: dict, key: str) -> list[str]:
raw = manifest.get(key) or []
if not isinstance(raw, list):
return []
return [str(item) for item in raw if isinstance(item, str)]
def _check_capabilities(
report: ValidationReport, manifest: dict, plugin_dir: Path,
probe: Optional[tuple[Path, dict[str, str]]] = None,
) -> Optional[dict]:
"""Probe actual registrations and diff against declared capabilities.
Returns the recorded dict (for the built-in collision check) or None
when the probe failed / was skipped.
"""
if not (plugin_dir / "__init__.py").is_file():
report.warn(
"no __init__.py — capability probe skipped (manifest-only plugin)"
)
report.add("capability probe", True, "skipped (no __init__.py)")
return None
recorded, error = _run_capability_probe(plugin_dir, manifest, probe)
if recorded is None:
report.add("capability probe", False, error)
return None
if recorded.get("providers"):
report.add(
"capability probe", True,
"import registered provider(s): " + ", ".join(recorded["providers"]),
)
else:
report.add("capability probe", True, "register() ran in isolation")
for kind, manifest_key in (
("tools", "provides_tools"),
("hooks", "provides_hooks"),
("middleware", "provides_middleware"),
):
declared = set(_declared_list(manifest, manifest_key))
actual = set(recorded.get(kind) or [])
undeclared = sorted(actual - declared)
unregistered = sorted(declared - actual)
if undeclared:
report.add(
f"declared {kind}",
False,
f"undeclared {kind} registered (not in {manifest_key}): "
f"{', '.join(undeclared)}",
)
else:
report.add(f"declared {kind}", True, "matches registrations")
if unregistered:
report.warn(
f"{manifest_key} declares {', '.join(unregistered)} "
f"but register() did not register them"
)
return recorded
def _builtin_tool_names() -> list[str]:
"""Return the built-in tool registry names (discovery-timing safe).
``tools.registry`` starts empty — built-in tool modules self-register on
import, so we must run ``discover_builtin_tools()`` first (idempotent;
see the AGENTS.md discover_plugins timing pitfall).
"""
try:
from tools.registry import discover_builtin_tools, registry
discover_builtin_tools()
return list(registry.get_all_tool_names())
except Exception:
return []
def _check_builtin_collisions(
report: ValidationReport, manifest: dict, recorded: Optional[dict]
) -> None:
candidate_tools = set(_declared_list(manifest, "provides_tools"))
if recorded:
candidate_tools.update(recorded.get("tools") or [])
if not candidate_tools:
report.add("built-in tool collisions", True, "no tools to check")
return
builtin = set(_builtin_tool_names())
collisions = sorted(candidate_tools & builtin)
if collisions:
report.add(
"built-in tool collisions",
False,
"tool name(s) collide with built-in tools: "
f"{', '.join(collisions)}",
)
else:
report.add("built-in tool collisions", True, "no collisions")
# ─── Entry point ─────────────────────────────────────────────────────────────
def validate_plugin_dir(
plugin_dir: Path, probe: Optional[tuple[list[str], dict[str, str]]] = None,
) -> ValidationReport:
"""Run every admission check against *plugin_dir* and return the report. *probe* is
``(python argv prefix, env)`` for the capability probe (see ``_run_capability_probe``)."""
report = ValidationReport()
plugin_dir = Path(plugin_dir)
if not plugin_dir.is_dir():
report.add(
"plugin directory", False, f"{plugin_dir} is not a directory"
)
return report
manifest_file = plugin_dir / "plugin.yaml"
if not manifest_file.is_file():
manifest_file = plugin_dir / "plugin.yml"
if not manifest_file.is_file():
# Portable Agent Plugins v1 (#81196): a plugin.json-only package is
# admissible — validated through the portable manifest reader. When a
# package carries both manifests the native plugin.yaml always wins
# (this branch is only reached when no native manifest exists).
portable_file = plugin_dir / "plugin.json"
if portable_file.is_file():
return _validate_portable_plugin(report, plugin_dir)
report.add(
"manifest", False,
"no plugin.yaml (or portable plugin.json) in the plugin directory",
)
return report
fix(pm): isolate bootstrap dependencies and unify YAML on ruamel Activation reaches plugin discovery before the application dependencies exist. Give PM its own locked Python project and runtime so it can install or repair the application without importing that dependency tree. Keep PM outside the application workspace. A shared uv workspace resolves the application graph and cannot provide this isolation. Route mutations through an isolated worker and preserve transaction callbacks, cancellation, custom package registrations, and correlated receipts. Use the same runtime builder for source installs and packaged payloads. Keep offline wheelhouse support in that builder. Nix builds the independent PM lock as a separate derivation. Refuse lazy-disabled bootstrap before installing tools or dependencies. Move first-party YAML readers and writers to ruamel. Keep the application lock's transitive PyYAML requirements for third-party packages. Verification: - Focused canonical Python suite: 177 passed, 1 host-gated skip. - Electron backend probes: 12 passed. Electron typecheck passed. - Both uv locks, scoped lint, Bash syntax, and whitespace checks passed. - Cold activation, corrupt-app repair, offline staging, and relocation ran. - Built and exercised the Nix PM runtime and standalone YAML merge script. Six broader caller test files retain the same 24 failing test IDs as an archive of HEAD. The existing real-home guard blocks those tests before they can exercise the affected paths. No full-suite pass is claimed. Native Windows signing and full Bionic package execution remain unverified.
2026-09-11 12:23:51 -04:00
import hermes_yaml as yaml
try:
manifest = yaml.safe_load(
manifest_file.read_text(encoding="utf-8-sig")
)
except Exception as exc:
report.add("manifest", False, f"plugin.yaml failed to parse: {exc}")
return report
if not isinstance(manifest, dict):
report.add("manifest", False, "plugin.yaml must be a mapping")
return report
report.add("manifest", True, "plugin.yaml parses")
_check_manifest_fields(report, manifest)
_check_requires_hermes(report, manifest)
_check_config_spec(report, manifest)
_check_requires_env(report, manifest)
feat(plugins): OAuth clients a plugin declares, signed in and refreshed by Hermes A plugin that calls a third-party API with the user's own OAuth client (Google, Microsoft, Notion) declares it under `oauth:` in plugin.yaml instead of running the consent flow and keeping the refresh token itself. - `hermes auth add|status|refresh|logout <plugin>:<id>` runs the PKCE login of auth_oauth_pkce_plugin and keeps the grant in the active profile's auth.json (section `plugin_oauth`, keyed by the plugin's key) - `credentialed_provider_request(<id>, ...)` attaches the bearer for the entry's declared hosts only (https, port 443) and refreshes the grant under the auth-store lock; the calling plugin's own entry is resolved before `_PROVIDERS`, so a later core provider of the same name cannot take it over - each grant stores a fingerprint of the entry it was made for: a plugin version that changes the token URL, hosts, scopes or client variables gets ProviderNotSignedIn until the user signs in again - the client secret is read with get_secret right before each token POST (OAuthPKCEConfig.token_request) and never sits in the frozen config - grant-dead codes retire the grant; invalid_client, unauthorized_client and invalid_scope surface as AuthError codes; a sign-in granted fewer scopes than declared saves nothing - `hermes plugins validate` checks the block and the declared variables and warns when plugin code names the token URL; install/show notices and the catalog re-pin consent delta list the entries Refs #139077
2026-10-16 14:33:13 +05:00
_check_oauth(report, manifest, plugin_dir)
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
_check_loadable(report, plugin_dir, manifest)
_check_python_dependencies(report, plugin_dir)
recorded = _check_capabilities(report, manifest, plugin_dir, probe)
_check_builtin_collisions(report, manifest, recorded)
_check_trusted_inbound(report, recorded)
_check_security_scan(report, plugin_dir)
feat(plugin-catalog): refuse plugins that override Hermes core or Desktop at runtime Catalog policy (Teknium): a listed plugin extends Hermes only through public surfaces. A plugin that replaces core functions, methods or Desktop UI in place collides with every other plugin patching the same seam and breaks on any core release. - New `no core override` admission check (hermes_cli/plugin_validate_core_override.py): static taint pass over the import closure of __init__.py and dashboard/*.py. Core values are Hermes modules (plus hermes_plugins.*) and attribute chains off them, reached by import, importlib/sys.modules lookups, getattr, iteration, or a plugin helper that returns one. Rebinds are attribute assignment/deletion, setattr/delattr, sys.modules writes, writes into a core module's tables, mock.patch, and passing a core value to a helper that setattr's its parameter. Tests, benchmarks and CI/smoke scripts outside the import closure are not judged. - Desktop lint: new `app DOM reach` rule (document-level queries of the app's own data-slot/data-tour/data-sidebar/data-testid markup, and document.body childList/subtree MutationObservers). - Desktop lint bug: the comment stripper did not skip string literals, so a string holding `/*` (a glob like '**/*.md') opened a fake comment and hid every line up to the next `*/` from all rules. Strings are now matched first and kept. - README rule 9, the plugin-catalog user guide and the plugin developer guide's compatibility contract state the rule. A/B over 466 pinned trees (121 open catalog PR entries + 349 listed entries + humalike): the new checks flag exactly the hand-verified overrides; zero crashes; no previously reported Desktop finding disappears.
2026-10-01 11:17:05 -07:00
check_core_override(report, plugin_dir)
check_private_imports(report, plugin_dir)
check_desktop_surface(report, plugin_dir)
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
check_language_packs(report, manifest, plugin_dir)
from hermes_cli.plugin_isolation_audit import audit_plugin_dir
report.isolation = audit_plugin_dir(plugin_dir, manifest).to_dict()
return report
def _check_trusted_inbound(report: ValidationReport, recorded: Optional[dict]) -> None:
"""Surface ``trusted_inbound`` platforms (their events skip user allowlists and pairing); one
naming a core platform fails, as the loader refuses it."""
from gateway.platform_registry import core_ships_platform
for name in (recorded or {}).get("trusted_inbound") or []:
if core_ships_platform(name):
report.add("trusted inbound", False, f"platform '{name}' ships with core; trusted_inbound is refused for it")
else:
report.add("trusted inbound", True, f"platform '{name}' is trusted_inbound: its events skip user allowlists and pairing")
_LOADABLE_ENTRYPOINTS = ("__init__.py", "desktop/plugin.js", "plugin.json")
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
def _check_loadable(report: ValidationReport, plugin_dir: Path, manifest: Optional[dict] = None) -> None:
"""A plugin.yaml with nothing beside it that Hermes can load (no ``register()`` module, no
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
desktop bundle, no portable manifest, no declared language pack) installs "successfully" and does
nothing — a pip-layout repo whose code lives under ``src/`` behind an entry point is the usual shape."""
present = [rel for rel in _LOADABLE_ENTRYPOINTS if (plugin_dir / rel).is_file()]
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
if (manifest or {}).get("provides_locales") and (plugin_dir / "locales").is_dir():
present.append("locales/ (language pack)")
report.add(
"loadable", bool(present),
f"entry: {', '.join(present)}" if present else
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
"nothing to load: no __init__.py, desktop/plugin.js, plugin.json or provides_locales + locales/ beside "
"plugin.yaml (pip-layout packages need a directory-plugin wrapper with a pyproject.toml declaring the deps)",
)
def _check_python_dependencies(report: ValidationReport, plugin_dir: Path) -> None:
"""Declared deps (pyproject ``[project].dependencies`` or manifest ``python_dependencies``) must be
well-formed PEP 508 specs the installer will accept; a plugin opting out with
``python_runtime: external`` declares none."""
from pm.plugin_declarations import read_python_declaration, unsupported_requirements
try:
decl = read_python_declaration(plugin_dir)
if decl.external:
report.add("python dependencies", True, "external runtime (plugin manages its own)")
return
urls = unsupported_requirements(decl.requirements)
installable = decl.install_requirements
except (ValueError, OSError) as exc:
report.add("python dependencies", False, f"declaration invalid: {exc}")
return
if urls:
report.warn("python dependencies: direct URL requirement(s) are not managed by PM; "
f"use a plugin-owned external runtime: {', '.join(urls)}")
source = "pyproject" if decl.pyproject is not None else "manifest"
detail = f"{len(installable)} requirements from {source}" if decl.requirements else "none declared"
report.add("python dependencies", True, detail)
def _check_security_scan(report: ValidationReport, plugin_dir: Path) -> None:
"""Run the install-time scanner at admission, so a pin a reviewer approves is one the
installer will accept: ``dangerous`` fails the entry; ``caution`` findings surface as
warnings for the reviewer (the installer trusts them once the pin is merged)."""
from tools.plugin_guard import scan_plugin
result = scan_plugin(plugin_dir)
flagged = [f for f in result.findings if f.severity in ("critical", "high")]
summary = ", ".join(sorted({f"{f.pattern_id} ({Path(f.file).name}:{f.line})" for f in flagged})) or "no findings"
if result.verdict == "dangerous":
report.add("security scan", False, f"dangerous: {summary}")
return
report.add("security scan", True, result.verdict)
if result.verdict == "caution":
report.warn(f"security scan caution: {summary}")
def _validate_portable_plugin(report: ValidationReport, plugin_dir: Path) -> ValidationReport:
"""Admission checks for a portable Agent Plugins v1 (plugin.json) package.
Portable packages have no register() entry point, so the capability
probe does not apply; validation is the manifest reader's own
diagnostics (schema shape, name, supported subset).
"""
try:
from hermes_cli.agent_plugins import load_agent_plugin
from hermes_platform.resolver.availability import availability
with tempfile.TemporaryDirectory() as data_root:
package = load_agent_plugin(plugin_dir, Path(data_root))
manifest = package.manifest
diagnostics = package.diagnostics
except Exception as exc:
report.add("portable manifest", False, f"plugin.json failed validation: {exc}")
return report
for diag in diagnostics:
scope = getattr(diag, "scope", "")
message = getattr(diag, "message", str(diag))
report.warnings.append(f"{scope}: {message}" if scope else message)
report.add("portable manifest", True, "plugin.json parses (Agent Plugins v1)")
name = str(manifest.get("name") or "").strip()
report.add(
"manifest fields",
bool(name),
"name present" if name else "plugin.json missing required 'name'",
)
from hermes_cli.agent_plugins import manifest_config_schema
_check_config_spec(report, {"config_schema": manifest_config_schema(manifest)})
for server_name, config in package.mcp_servers.items():
if config.get("trust") == "untrusted":
report.add(f"server trust: {server_name}", True,
"untrusted (Hermes asks before every write-capable tool call)")
if config.get("tool_costs"):
limit = config.get("spend_limit") or 0
report.add(f"server costs: {server_name}", True,
f"{len(config['tool_costs'])} costed tool(s), "
+ (f"spend limit {limit} {config.get('cost_unit') or 'credits'} per chat" if limit
else "no spend limit"))
for server_name, server_decl in package.server_declarations.items():
result = availability(server_decl.declaration)
detail = result.state
if result.version:
detail += f", version {result.version}"
if result.path:
detail += f", path {result.path}"
report.add(f"server availability: {server_name}", True, detail)
_check_security_scan(report, plugin_dir)
check_desktop_surface(report, plugin_dir)
from hermes_cli.plugin_isolation_audit import audit_plugin_dir
report.isolation = audit_plugin_dir(plugin_dir, manifest).to_dict()
return report