You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
impl(mcpx): resolve plugin-session manifest hooks into live bus subscribers (#1873 slice 2) #10046
Next slice on top of the merged plugin-session foundation for #1873 (PR #10045, internal/pluginsession).
Slice: resolve a plugin session's manifest hook declarations into live bus subscribers at session start, owned by the session and dropped by its Close.
At plugin-session open, take the manifest's declared hook subscriptions (today recorded in the session, "recorded, not interpreted") and subscribe them to the daemon's event bus with events.Filter semantics, observe phase per decision 0001 (pkgs/mcpx/docs/decisions/0001-hook-vocabulary.md). Delivery target is the owning plugin (its tool surface), keyed by session: one session's hooks are never another's.
Each live subscription is registered with Registry.Own(id, OwnedItem{Kind: "hook", ...}) so /v1/status introspection shows what each session owns, and session end (clean or crash path, both through Close) drops the subscribers with the session — no separate unsubscription bookkeeping.
Tests (tree rules: changed packages, named oracles): a manifest hook fires to the owning plugin on a matching event; a non-matching event does not fire it; session end drops subscriptions (a post-close event fires nothing); two sessions with identical declarations each receive only their own deliveries.
Out of scope: capability enforcement (decision 0003), the vars store, the named-command registry, detach/re-address — separate later packets under the #1885 tracker / #1873 lineage.
Outcome: PR mcpx: resolve plugin-session manifest hooks into live bus subscribers (#10046) #10241 merged (merge commit 5771a9c). pluginsession.Resolver now binds the session registry to the daemon events bus: at plugin-session open, each manifest hook declaration (an events.Filter kind prefix, observe phase per decision 0001) becomes a live bus subscription registered as a session-owned hook item (Registry.Own, kind hook) visible in /v1/status; deliveries are published back on the bus as plugin.hook events addressed to the owning session, so the plugin hears them over its own /v1/events stream and nobody else's; session Close stops the forward loops and unsubscribes before the registry drops the session — a post-close event fires nothing. Daemon routes open/close through the resolver (lazily built, nil-bus safe).
The mcpx: config-declared hooks over the event bus, running any command, JS/TS or Python module #1872 machinery question, answered: the issue's premise was stale — mcpx: config-declared hooks over the event bus, running any command, JS/TS or Python module #1872 is CLOSED and its machinery has landed on main (internal/hooks Parse + Runner, wired in internal/daemon/server.go). This slice does not use the Runner and waits for no follow-up: a Runner hook's only actions are child processes (run / module), and a plugin is not a child process the daemon spawns per event. It reuses the shared layer — the bus, hooks.Hook.SubFilter and hooks.HookableKinds, so manifest and config declarations match identically — and builds only the session-scoped subscribe/deliver/unsubscribe piece (internal/pluginsession/hooks.go, whose package doc records this answer). Declarations naming no hookable kind (e.g. the blocking phase name onSuccess) stay recorded-only, as the foundation left them.
Tests: pluginsession suite incl. -race (matching fires to the owner; non-matching does not; close drops subscriptions + post-close silence; two sessions with identical declarations get only their own, closing one leaves the other live; non-hookable recorded-only; wildcard fires), daemon PluginSession suite incl. a new route-level live-resolution test, hooks + events suites green, go vet / gofmt clean. Full suite runs in CI on main (queued at merge).
Activity
developing-today commentedon Nov 14, 2026
CODE-3516
Merge pull request #10241 from developing-today/queue/16927-10046-man…
dezren39 commentedon Nov 14, 2026
🤖 Agent note · done — merged in PR #10241
pluginsession.Resolvernow binds the session registry to the daemon events bus: at plugin-session open, each manifest hook declaration (anevents.Filterkind prefix, observe phase per decision 0001) becomes a live bus subscription registered as a session-owned hook item (Registry.Own, kindhook) visible in /v1/status; deliveries are published back on the bus asplugin.hookevents addressed to the owning session, so the plugin hears them over its own /v1/events stream and nobody else's; sessionClosestops the forward loops and unsubscribes before the registry drops the session — a post-close event fires nothing. Daemon routes open/close through the resolver (lazily built, nil-bus safe).internal/hooksParse + Runner, wired ininternal/daemon/server.go). This slice does not use the Runner and waits for no follow-up: a Runner hook's only actions are child processes (run/module), and a plugin is not a child process the daemon spawns per event. It reuses the shared layer — the bus,hooks.Hook.SubFilterandhooks.HookableKinds, so manifest and config declarations match identically — and builds only the session-scoped subscribe/deliver/unsubscribe piece (internal/pluginsession/hooks.go, whose package doc records this answer). Declarations naming no hookable kind (e.g. the blocking phase nameonSuccess) stay recorded-only, as the foundation left them.-race(matching fires to the owner; non-matching does not; close drops subscriptions + post-close silence; two sessions with identical declarations get only their own, closing one leaves the other live; non-hookable recorded-only; wildcard fires), daemon PluginSession suite incl. a new route-level live-resolution test, hooks + events suites green, go vet / gofmt clean. Full suite runs in CI on main (queued at merge).