Commit Graph
4 Commits
Author SHA1 Message Date
Teknium 5f274827ff fix(plugins): keep a context keyword whose name only a positional-only first parameter shares
`def h(source, /, **kwargs)` and `def h(*session_id, **kwargs)` cannot take
that name by keyword, so the context value belongs in kwargs. (Greptile
re-review on #140997.)
2026-10-18 01:27:20 -07:00
Teknium 9cfcfcc8d4 fix(plugins): never pass a context keyword that names the raw-args parameter
A handler like `def h(source, **kwargs)` got raw_args positionally AND source=
from the context (TypeError). Drop the first positional parameter name from
the context before both the **kwargs and the named-parameter branches.
(Greptile review on #140997.)
2026-10-18 01:27:20 -07:00
Teknium 0975937593 feat(plugins): pass the calling session to plugin slash commands on every surface
Widen the contributor's opt-in `source=` to the calling-session context plugins
asked for (#140199, #91526, #123245): a `ctx.register_command` handler that
declares any of `session_id`, `session_key`, `platform`, `source` (or
`**kwargs`) receives them; one-argument handlers keep `handler(raw_args)`.

- One call boundary (hermes_cli/plugin_command_dispatch.py) used by the gateway
  (messaging platforms and local CLI/Desktop sessions via
  `_hm_run_plugin_handler`), the TUI/Desktop RPC (`_run_plugin_command`) and
  the classic CLI's off-gateway fallback. The first positional parameter
  always gets raw_args whatever its name.
- Messaging plugin commands look up the chat's current session entry (never
  create one), so HERMES_SESSION_ID / `session_id` are the id a later /new
  reports as old_session_id instead of "" (#123245).
- Fold the contributor's separate gateway adapter module back into
  `_hm_run_plugin_handler` so the local-session path shares it.
- Tests trimmed to two invariants, both red on origin/main.
2026-10-18 01:27:20 -07:00
ewtillman 06e8c5bc70 feat(plugins): expose gateway source to slash handlers 2026-10-18 01:27:20 -07:00