Commit Graph

22221 Commits

Author SHA1 Message Date
Teknium c89ca9c4bf chore(attribution): map dnethusahan.h05@gmail.com -> deaneeth (PR #64317 salvage) 2026-08-12 18:38:25 -07:00
Dineth Hettiarachchi 00f4da01ec feat(plugins): add streaming output observer hooks
Salvage of PR #64317 (@deaneeth) onto current main, implementing #64161:
observer-only on_stream_start / on_stream_delta / on_stream_end /
on_interim_message plugin hooks dispatched through a host-owned bounded
queue (one worker per callback) so plugin callbacks never run inline on
the token path. Reasoning deltas are opt-in via
plugins.stream_reasoning_deltas.
2026-08-12 18:38:25 -07:00
Brooklyn Nicholson 985594aaa3 fix(desktop): one git glyph on the composer's coding row, with the PR number leading
The branch's PR chip carried its own pull-request icon next to the row's
branch glyph, so the strip opened with two git marks in a row. The chip now
takes showIcon, and the coding row renders it glyph-less and ahead of the
branch name — the leading branch icon covers both, and the row reads
icon → #number → branch. Sidebar rows keep the full chip.
2026-08-12 20:34:58 -05:00
GodsBoy c5097da12b fix(gateway): revalidate stored role grants
Gate adapter-provided role authorization during plugin session injection and cover the stale role-only route.
2026-08-12 18:25:33 -07:00
GodsBoy e64fb2b614 fix(review): harden plugin gateway injection 2026-08-12 18:25:33 -07:00
GodsBoy f46c600a54 feat(gateway): allow plugins to inject session messages 2026-08-12 18:25:33 -07:00
Brooklyn Nicholson ebf8443604 fix(desktop): paint the self-improvement review row as the memory write it is
The background review's summary fell through SystemMessage's generic branch: centered, 60% width, muted grey — while the memory tool row it reports on wears the gold-to-purple legendary chrome. Type the event with a review: marker at the gateway handler (same convention as steer: / slash:) and give it the brain glyph, gradient label and purple detail, left-aligned in the reading column.
2026-08-12 20:24:30 -05:00
Teknium b088535c78 feat(plugins): capability declarations + install/update consent flow (#64228)
Unify the scattered per-plugin trust gates into one declared, diffable
capability model with an install/update-time consent flow. Consent +
audit over host API surfaces — explicitly NOT a sandbox.

New module hermes_cli/plugin_capabilities.py:
- Canonical CAPABILITY_REGISTRY mapping each capability id 1:1 to an
  EXISTING enforcing gate (no capability minted without a surface):
    tools.override          -> allow_tool_override
    llm.provider_override   -> llm.allow_provider_override
    llm.model_override      -> llm.allow_model_override
    llm.agent_id_override   -> llm.allow_agent_id_override
    llm.profile_override    -> llm.allow_profile_override
    llm.task_override       -> llm.allow_task_override
- plugin_capability_granted(plugin_id, capability): canonical check —
  granted set OR deprecated legacy allow_* key; fail closed on unknown
  ids and any unreadable/corrupt consent state; emits checked_by audit
  log lines on every decision.
- record_consent() persists plugins.entries.<id>.granted_capabilities +
  capabilities_consent {hash, granted_at} and mirrors grants into the
  legacy keys so existing enforcement sites keep working unchanged.
- capability_set_hash / pending_capabilities / declared_set_changed
  power the update-time re-consent diff.

Wiring:
- plugin.yaml manifest field `capabilities:` parsed into
  PluginManifest.capabilities (unknown ids dropped with a warning).
- hermes plugins install: consent screen (one Y/n) when the manifest
  declares capabilities; non-interactive installs proceed with
  capabilities ungranted (fail closed).
- hermes plugins update: when the new version declares capabilities the
  granted set lacks (hash diff), the additions are surfaced and require
  re-consent — an update can never silently widen access.
- hermes plugins enable: consent screen replaces the standalone
  tool-override prompt for capability-declaring plugins.
- hermes plugins capabilities [<id>]: declared vs granted per plugin,
  flags grants held via deprecated legacy keys.
- PluginContext.has_capability() probing API so plugins degrade
  gracefully; _tool_override_allowed migrated to the canonical
  plugin_capability_granted path (reference migration; legacy
  allow_tool_override still honored).

Tests: tests/hermes_cli/test_plugin_capabilities.py (38 tests) —
declaration parsing, consent grant/persist, update re-consent on added
capability, fail-closed on missing/corrupt state, legacy-gate backward
compat, consent CLI flow (grant / decline / non-interactive).

Docs: user-guide plugins.md consent section (with explicit not-a-sandbox
warning) + developer-guide plugin authoring capability note.

Salvages the intent of PR #37976 (@coygeek — require renewed review
before plugin updates), scoped to capability diffs.

Part of #64182.
2026-08-12 18:05:21 -07:00
brooklyn! 0c3f60fe4f
Merge pull request #84903 from NousResearch/salv/41236
feat(desktop): auto-detect Linux keychain backend for secure token storage (salvage #41236)
2026-08-12 19:57:09 -05:00
Teknium 40712da40f test: adapt #41236 password-store tests to real-host _make_packaged_executable
Main's helper no longer takes a platform kwarg (real-host layout since the
sys.platform-fake removal); mark the five password-store tests linux_only/
macos_only per the don't-fake-the-host policy, and stub the Linux desktop-entry
registration those cmd_gui runs now reach.
2026-08-12 17:19:12 -07:00
Teknium e3215cfbdc chore: map hfsearcy@gmail.com -> hsearcy for contributor attribution 2026-08-12 17:07:51 -07:00
Teknium 2d91c085e3 Merge PR #41236 (Linux keychain auto-detect) onto current main 2026-08-12 17:07:45 -07:00
Teknium 715d26cdf4 feat: auto-install gateway service during setup and import
Users who install Hermes and then restore a backup (hermes import) ended
up with bot tokens and cron jobs fully registered but nothing running
them: the setup wizard's service-install prompt lived at the end of the
Messaging Platforms section, so skipping messaging (the normal case on a
box whose tokens arrive with the import afterward) skipped the service
entirely, and run_import never touched the service layer at all.

A platform-less gateway is already a supported mode (gateway/run.py runs
the cron scheduler and picks platforms up as tokens appear), so there is
no reason to gate the service on messaging config — or to ask at all.

- hermes_cli/gateway.py: new ensure_gateway_service() — prompt-free,
  never-raising install+start of the user-scope service (systemd /
  launchd / Scheduled Task), no-op in containers and on hosts without a
  service manager, refuses to pile onto conflicting user+system units.
- hermes_cli/setup.py: setup_gateway() service block now runs
  unconditionally (zero platforms included) and auto-installs instead of
  prompting; restart-on-config-change keeps its prompt. Quick-setup and
  migrated-config paths that skip the messaging section now call
  ensure_gateway_service() so they can no longer skip the service.
- hermes_cli/backup.py: run_import() ends by installing/starting the
  service when none is running, with a manual fallback hint on failure.
- tests: new tests/hermes_cli/test_ensure_gateway_service.py (9 cases)
  + 3 run_import wiring tests; existing backup tests get an autouse
  fixture so they never touch the host's real service manager.
2026-08-12 16:59:37 -07:00
Teknium d48c5f29ee
Merge pull request #84878 from NousResearch/salv/62319
fix(desktop): allow remote gateway token storage on keyring-less Linux (salvage #62319)
2026-08-12 16:50:44 -07:00
Teknium e4f4805108 test(gateway): declare routed profile as served in reaction observer test
Main now fail-closes profile routes targeting unserved profiles
(_profile_name_for_source checks _multiplex_profile_homes). The
provenance test routes to profile 'work', which no longer stamps in a
bare test env; mock the served-profile set so the route resolves.
2026-08-12 16:42:28 -07:00
Teknium 1e46e09bbd fix(gateway): scope reaction observers to routed profiles 2026-08-12 16:42:28 -07:00
Teknium 9994bc9ec9 fix(gateway): enforce post-auth normalized reaction observer
Builds on Paolo Antinori's #68431 salvage for #64176. Move plugin dispatch behind the profile-scoped runner authorization boundary, fail closed on malformed reaction identities, preserve observer registration across Telegram app rebuilds, and document the deliberately observer-only contract.

Co-authored-by: Paolo Antinori <pantinor@redhat.com>
2026-08-12 16:42:28 -07:00
Paolo Antinori 24e3aa180f fix(plugins): gateway_platform_event error logs include traceback; pin handler groups
- _on_platform_update: log the normalize and auth errors with exc_info=True so
  a regression that silently drops reactions leaves a traceback, not just a
  one-line message (matches the intake auth fallback's exc_info usage).
- TestRegisterHandlers: also assert five core handlers land in the default
  group and only the observer is in group 99.

DoD: hook + auth tests green (34 passed). For a log-line + assertion change
the substantive gate is the test run; /simplify and /code-review were applied
proportionately.
2026-08-12 16:42:28 -07:00
Paolo Antinori c0a4535a26 fix(plugins): address #64176 review on gateway_platform_event (#68431)
Response to teknium1's hermes-sweeper review (keep_open, salvageability=medium).

1. Post-auth gate. The group-99 catch-all fired gateway_platform_event before
   the authorization boundary. Extract _is_source_authorized(source) from
   _is_user_authorized_from_message and add _source_from_reaction_for_auth;
   reactions whose actor the intake would reject no longer reach plugins.
   Fails closed if source extraction raises, so a future non-reaction event
   type cannot silently bypass auth before its own extraction is wired.

2. Shared registration. Extract _register_handlers(app) from connect() so the
   gateway_platform_event observer (group 99) is re-registered alongside the
   core handlers on any rebuild path.

3. Trim inert hook surface. Drop the three reserved gateway_* names from
   VALID_HOOKS (keep only gateway_platform_event). The others land with their
   real contracts and fire-sites when #64231 is finalized.

Tests: unauthorized/authorized/open reaction gating, fail-closed for a future
non-reaction event type, and _register_handlers re-registration.

Ran /simplify and /code-review (high) before pushing.
2026-08-12 16:42:28 -07:00
Paolo Antinori 929be4d1aa feat(plugins): gateway_platform_event observer hook (normalized envelopes)
First slice of #64176's observer-hook half — a normalized-envelope inbound
event hook, replacing raw-SDK handler args with a stable contract (per #64176's
"normalized versioned envelopes only; raw SDK gated behind a capability" rule).

- VALID_HOOKS: register the four gateway_* names from #64176
  (gateway_platform_event fires today; gateway_session_titled /
  gateway_message_delivered / gateway_thread_created reserved pending #64176's
  fire-sites).
- BasePlatformAdapter._fire_gateway_hook: reusable, has_hook-guarded,
  per-call-isolated fire helper (the no-subscriber common case short-circuits).
- TelegramAdapter: a group-99 catch-all TypeHandler normalizes inbound updates
  into gateway_platform_event envelopes. message_reaction -> {platform,
  event_type:"reaction", payload{emojis, custom_emoji_ids, chat_id, message_id,
  thread_id}} (custom-emoji reactions captured via custom_emoji_id; standard via
  .emoji — no None in consumer-facing lists). Other update types return None
  pending #64176's taxonomy (#64231). Normalization is wrapped so a malformed
  update can't raise into PTB dispatch.

Observer-only — zero behavioral change to core dispatch. Supersedes the raw
inbound half of #62584 (telegram:update -> normalized gateway_platform_event).

Tests: VALID_HOOKS registration; _fire_gateway_hook routing/has_hook/isolation;
_normalize for standard, custom-emoji, and mixed reactions + non-reaction;
_on_platform_update firing + normalize-error isolation.

Ran code-review (high) + simplify before pushing.
2026-08-12 16:42:28 -07:00
Teknium 33840149d0 chore: map voice contributor attribution 2026-08-12 16:42:07 -07:00
Teknium 0ca78e5f32 fix(voice): preserve existing TUI drafts 2026-08-12 16:42:07 -07:00
khanhngoo f1c45f5727 feat(voice): add configurable TUI draft submission
Add voice.submit_mode=direct|draft without model-refine hooks or callbacks. Validate the config, preserve direct-submit compatibility, render editable drafts in the Ink composer, and document both locales.

Co-authored-by: BELIVIN MEDIA <212580280+KarateWilly@users.noreply.github.com>
2026-08-12 16:42:07 -07:00
Teknium 98c3edbd8b chore: map github.commits@widow.cc -> Zeus-Deus for contributor attribution 2026-08-12 16:40:20 -07:00
Teknium 4c8e326500 Merge PR #62319 (keyring-less Linux token storage) onto current main 2026-08-12 16:38:35 -07:00
SeoYeonKim 9acf0db889 feat(plugins): add cache-safe system prompt sections
Salvage the plugin-owned static prompt idea from PR #51589 into the constrained #64167 contract: stable IDs, deterministic placement, bounded fail-open rendering, and full-prompt resume recovery without new session columns.

Co-authored-by: Topher Ross <biz@topherross.com>
2026-08-12 16:34:58 -07:00
Teknium 6cd40d4257 test(gateway): synchronize pending-drain handoff 2026-08-12 16:33:13 -07:00
Teknium e2157b8697 fix(tests): await gateway drain completion 2026-08-12 16:33:13 -07:00
Teknium 6601330e0a feat(plugins): install exact commit refs 2026-08-12 16:27:30 -07:00
Teknium d409f67485 feat(platforms): add typed plugin send paths
Route plugin target parsing, validation, and host-driven delivery through PlatformEntry across CLI and cron while preserving the host-only send_message policy.
2026-08-12 16:27:19 -07:00
Mark Mennell b58c7aaf9d test(send_message): move plugin fallback regressions to target_parse suite
Keep opaque-plugin routing coverage in the lightweight suite so it still
runs when optional telegram deps are absent. Address PR review feedback.
2026-08-12 16:27:19 -07:00
Mark Mennell a009b71766 fix(send_message): discover plugins before target fallback 2026-08-12 16:27:19 -07:00
Mark Mennell d3ebe14b03 fix(send_message): constrain opaque plugin fallback 2026-08-12 16:27:19 -07:00
Kevin Anderson a37192546e feat(gateway,send_message): plugin platform target parsing via PlatformEntry.parse_target_ref_fn and verbatim fallback (#67941 #33547) 2026-08-12 16:27:19 -07:00
Kevin Anderson 274214d3c9 fix(send_message): avoid shared schema mutation and support sync enricher handlers 2026-08-12 16:27:19 -07:00
Kevin Anderson 482682db78 send_message: plugin enricher registry for custom platforms 2026-08-12 16:27:19 -07:00
Teknium 7a5062fbcd feat(plugins): add runtime-backed plugin Doctor
Validate plugin manifests, imports, hook signatures, and runtime registrations through the real plugin loader in an isolated temporary home.
2026-08-12 16:27:07 -07:00
webdevtodayjason 2711e41c4f docs(plugins): fold unique guide content into the canonical author guide
Per review, docs/plugins.md was a parallel guide outside the published
navigation. Its genuinely unique material moves into
website/docs/developer-guide/plugins/index.md: the middleware
registration surface (all four VALID_MIDDLEWARE kinds with contracts and
chaining rules), the per-API-call request hooks, and the
allow_tool_override operator grant (which also fixes pre-existing text
implying override=True alone suffices for non-bundled plugins). Every
migrated claim was re-verified against current main; stale material
(deep-copy claim, approval-surface coverage, a hook that is not in
VALID_HOOKS on main) was corrected or dropped rather than copied.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PnMCvi2vXqfs996AjVeF2F
2026-08-12 16:27:07 -07:00
峯岸 亮 1636206ff0 feat: add Plugin Doctor plugin 2026-08-12 16:27:07 -07:00
Teknium cd7c674d74 fix(plugins): harden approval transport boundaries 2026-08-12 16:26:55 -07:00
Teknium de56e49a7c feat(plugins): add approval transport interface 2026-08-12 16:26:55 -07:00
Teknium 5265409012 docs(plugins): document config and state ownership 2026-08-12 16:26:43 -07:00
Teknium 6bf93c0e38 feat(plugins): add namespaced config and durable state bridge 2026-08-12 16:26:43 -07:00
Topher Ross 223e74345e docs(rfc): align config bridge with #64227 — namespace jail, real APIs, acceptance criteria
- Replace cfg_set references with cfg_get (cfg_set deferred to #64227)
- Add Namespace jail section: key-prefix enforcement, cross-plugin rejection,
  path-traversal rejection, read allow-list
- Rewrite cron sketch: replace CronManager/command with create_job() using
  prompt/script params per cron/jobs.py:1039-1234
- Add #64227 to Related
2026-08-12 16:26:43 -07:00
Topher Ross 516ca4170a docs: plugin config & state bridge design proposal
RFC covering four PluginContext additions driven by kanban-advanced needs:
- ctx.get_config() / ctx.set_config() — typed config access
- ctx.register_config_schema() — schema validation surfaced to hermes doctor
- ctx.cron facade — cron CRUD without subprocess fragility
- provides_config_defaults in plugin.yaml — safe config defaults on install
2026-08-12 16:26:43 -07:00
Teknium d36c432da4 test(memory): use explicit fixture encodings 2026-08-12 16:25:29 -07:00
Teknium 729b8a7169 test(plugins): enforce behavior compatibility contract 2026-08-12 16:25:29 -07:00
Teknium f6aaff4646 chore(contributors): map Magnus Hedemark 2026-08-12 16:25:20 -07:00
Magnus Hedemark 79c11aea7a fix(plugins): complete task-routed LLM integration 2026-08-12 16:25:20 -07:00
hans 1176222b7c feat(plugins): route ctx.llm.complete(task=) through registered aux slots
Wire an optional `task=<key>` kwarg through the PluginLlm facade so a
plugin can route an LLM call through an auxiliary model slot it
registered via `ctx.register_auxiliary_task`. Registration already
existed; this adds the missing consumption half. Closes #44673.
Sub-issue 08/14 of the plugin-interface expansion tracking issue #64182.

- New optional `task:` kwarg on complete/acomplete/complete_structured/
  acomplete_structured. Unset or "auto" keeps today's main-model path
  byte-for-byte (task=None reaches call_llm exactly as before), so no
  prompt-cache or default-behavior change.
- A set task resolves provider/model through `auxiliary.<task>` via the
  existing auxiliary_client path, identical to built-in aux tasks.
- Trust gate (per the round-2 design correction): a plugin may only pass
  a key it registered itself; a built-in key additionally requires
  `plugins.entries.<id>.llm.allow_task_override: true`. A foreign or
  unknown key is rejected with a PluginLlmTrustError and a logged warning
  naming the offending plugin and key -- fail loud, NOT a silent fallback
  to auto (which would mask misconfiguration and could route to the main
  model the user steered elsewhere).
- The plugin_llm audit dict and audit-log line gain a `task` field.
- register_auxiliary_task now stores the plugin's canonical id
  (`key or name`, the same id ctx.llm is bound to) as the slot owner, so
  the trust gate matches ownership even when a manifest sets a distinct
  key. For the common no-key case this equals the name (unchanged).

Tests (tests/agent/test_plugin_llm_task_routing.py, 24): _check_task
resolution incl. own/foreign/unknown/built-in-gated keys and loud
rejection; end-to-end routing sync+async+structured; production-path
forwarding into call_llm/async_call_llm (covers the task=None->task line);
and ownership resolution against the real plugin registry incl. the
name/key reconciliation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013b1XyXitAxV7phGmKWigJX
2026-08-12 16:25:20 -07:00