Skip to content

Feature: session lifecycle events (session-opened / session-closed) on the event bus #1589

Description

@jumski

Context

The pi extension already exposes an event bus contract third-party extensions build on:

  • plannotator:request — external callers can start annotate / annotate-last / code-review / plan-review sessions and await the decision
  • plannotator:review-result — emitted when a channel-initiated plan review completes
  • plannotator:plan-approved — emitted on plan approval

Gap

Nothing is emitted when a browser session opens or closes. The built-in slash commands (/plannotator-annotate, /plannotator-last, /plannotator-review, /plannotator-plan-mode) open sessions directly without touching the request channel, so from outside the extension there is no way to know "a review is open and waiting on the human".

Use case

Agent harnesses and terminal multiplexers can surface waiting state to the user. Example: while an agent has a plannotator browser session open, we show a "🗨 needs review" badge on the agent's pane in Herdr (set via pane metadata while the session is open, cleared when it closes). Today this is only possible for sessions we start ourselves through plannotator:request; sessions opened by the built-in slash commands are invisible to us.

Proposal

Emit two channels, mirroring the existing pattern:

  • plannotator:session-opened — { action: "annotate" | "annotate-last" | "code-review" | "plan-review", reviewId?: string, url: string }
  • plannotator:session-closed — same identity fields plus { outcome: "closed" | "submitted" | "approved" }

If both are emitted from the single place sessions start and finish (rather than per entry point), every caller — slash commands, channel requests, stop-hook flows — gets covered automatically.

Version observed: @plannotator/pi-extension 0.27.9.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions