Commit Graph

2 Commits

Author SHA1 Message Date
unsupportedpastels
dadb58d9d9 docs(plugins): note that session_cwd() in an ingress hook is the profile's terminal cwd
The session_cwd() docstring did not say that in ingress hooks such as
pre_gateway_dispatch, which run before the message reaches any session,
it returns the profile's terminal cwd rather than the workspace of the
session the message will reach. The user docs already say so; the
docstring now does too.

Refs #134889 (LC-5)
Refs #139523
2026-10-16 21:36:26 +00:00
unsupportedpastels
11ba615c3c fix(plugins): give gateway-run plugin code the calling session's key, surface and cwd
Since the one-gateway runtime, plugin hooks and tools of classic CLI,
TUI and Desktop sessions run in the gateway process. Plugins written for
the CLI broke there:

- inject_message() with neither session_key nor origin was refused. A
  hook or tool running for a classic CLI session now resolves that
  session's key from the turn context, and the text is committed to its
  FIFO through the local session's own source and adapter (local
  sessions have no messaging allowlist). allow_gateway_injection is
  still required. Keyed injection into a local session is refused unless
  the session authority registered for the calling plugin's own profile
  holds that live session; ownership is never resolved through the
  ambient profile scope.
- Approval hooks and transports saw surface='gateway' for CLI sessions.
  They now report 'cli' again for a classic CLI session's turn. TUI,
  Desktop and messaging keep 'gateway', as documented.
- os.getcwd() is the gateway's install root. ctx.session_cwd() and
  ctx.session_surface() read the calling session's recorded workspace
  and client from the turn's task-local policy. The gateway process is
  never chdir-ed.

print() going to gateway-stdio.log and input() getting EOF are intended
differences, now documented in the plugin guide.

Refs #134889 (LC-5)
Refs #139523
2026-10-16 21:35:53 +00:00