/btw --explore (#158593) and its Desktop side chat (#158643) belong in a
third-party plugin, but the plugin API could not host them: a fork lease came
only from post_llm_call, no core tool could ever be named for a plugin fork,
and a running fork reported nothing until it settled. Three generic extension
points close that, reusing the existing ctx.fork_session machinery (cache-parity
fork, dispatch whitelist, auto-denied approvals, next-turn cancellation):
- Slash-command handlers that name a `side_question_token` keyword get a lease
on the calling session's live agent (classic CLI, gateway-owned local
sessions and messaging, TUI sidecar). Same lease rules as the turn token; it
does not replace that token. Only a handler that names it pays for the
capture.
- `plugins.entries.<id>.fork_tools` lets the user grant ONE plugin's forks
named core tools (read_file, search_files, terminal, ...). Pre-registry
names (delegate_task, memory, connectors, Tool Search bridges) stay refused;
FORK_SAFE_CORE_TOOLS stays empty. Forks now bind the non-interactive secret
capture so a granted skill tool can never pop the turn's secret prompt.
- `ctx.fork_session(..., on_tool=cb)` hears each allowed tool call as it
starts (display-redacted args), for live progress via post_message / edit or
emit_to_session.
Desktop needs no SDK change: a plugin docks its side chat as a `panes`
contribution with placement right and sends its slash command for follow-ups.
`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.)
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.)
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.