Skip to content

feat(pulse/menubar): surface active PAI sessions with read-only transcript popover#1280

Open
janrenz wants to merge 1 commit into
danielmiessler:mainfrom
janrenz:feat/menubar-session-view
Open

feat(pulse/menubar): surface active PAI sessions with read-only transcript popover#1280
janrenz wants to merge 1 commit into
danielmiessler:mainfrom
janrenz:feat/menubar-session-view

Conversation

@janrenz
Copy link
Copy Markdown

@janrenz janrenz commented May 17, 2026

What

Adds a session-aware view to the existing macOS menubar app so you can glance at what PAI is doing across all terminals without opening anything.

Single-file addition to Releases/v5.0.0/.claude/PAI/PULSE/MenuBar/PulseMenuBar.swift. Pure addition — zero behavioural change to existing jobs / status / controls / logs.

How it works

  1. Reads ~/.claude/PAI/MEMORY/STATE/work.json — already kept fresh by ISASync.hook.ts on every ISA frontmatter edit. No new pipeline, no Pulse HTTP dependency.
  2. Two new menu sections between the status line and Jobs:
    • Active Sessions — in-flight runs (phase != complete, updated within 5 min), sorted newest first, capped at 5
    • Recent (N) — collapsible flyout submenu (native macOS pattern), completed/idle sessions in the last 24h, capped at 3
  3. Active-count badge appears next to the menubar icon when ≥ 1 active.
  4. Click a sessionNSPopover anchored to the status item, showing a read-only transcript view of that session's ~/.claude/projects/-Users-{name}/<sessionUUID>.jsonl. Auto-refreshes every 2 s while open.
  5. Indicators: ⚡ active algorithm phase · 📡 native · ✓ complete.

Visual

PAI Pulse
  Running -- 4h 12m
  -----
Active Sessions
  ⚡ E3  pulse-menubar-sessions  EXECUTE  7/12  2m
  📡 native  bot-question                       1m
Recent (3) ▸                                       ← flyout submenu
  -----
Jobs
  ok cost-aggregation  every 15min  |  3m ago
  ...

Popover content:

⚡ E3  pulse-menubar-sessions
EXECUTE · 7/12 ISCs · updated 2m ago
─────────────────────────────────────
You: build the menubar session view
Timmy: Compile succeeded. Deploying...
🔧 Bash: install.sh
Timmy: Deployed. PID 22798.
...
Read-only · auto-refreshes every 2s

Implementation notes

  • New types: WorkSession, WorkRegistry, TranscriptEvent, TranscriptKind.
  • New free helpers: parseWorkRegistry(from:), loadTranscript(uuid:limit:), formatAgeShort(_:), parseISO(_:), sessionIndicator(...), sessionLabel(...), formatSessionMenuTitle(...).
  • New view controller: SessionPopoverViewController (NSViewController with NSTextView in NSScrollView, 2-second refresh timer bound to viewWillAppear / viewWillDisappear).
  • New action: openSessionPopover(_:) replaces the previous direct file-open behaviour for session menu items.

Build & verify

Compiles cleanly with the existing build.sh (no script changes):

bash Releases/v5.0.0/.claude/PAI/PULSE/MenuBar/build.sh

swiftc -O -whole-module-optimization — 0 warnings, 0 errors. Tested locally; deployed via install.sh; menubar process healthy, popover renders, transcript loads and auto-refreshes.

Diff stat

Releases/v5.0.0/.claude/PAI/PULSE/MenuBar/PulseMenuBar.swift | 492 ++++++++++++++++++
1 file changed, 492 insertions(+)

Zero deletions — strictly additive on top of upstream main.

Future work (not in this PR)

  • Reply input: a POST /chat/{slug} Pulse endpoint that runs SDK resume on the session UUID (same plumbing as the Telegram bot) + a text input in the popover. Deliberately scoped out so the read-only viewer ships first and the reply architecture gets validated against actual usage.

…cript popover

Adds a session-aware view to the existing macOS menubar app so the user can
glance at what PAI is doing across all terminals without opening anything else.

What's new in PulseMenuBar.swift:
- Reads ~/.claude/PAI/MEMORY/STATE/work.json (already kept fresh by
  ISASync.hook.ts) and surfaces two sections in the menubar dropdown:
    - Active Sessions: in-flight runs (phase != complete, updated < 5min),
      sorted newest first, capped at 5.
    - Recent (N): collapsible flyout submenu, completed/idle sessions
      within the last 24h, capped at 3.
- Active-session count badge next to the menubar icon.
- Click any session entry -> NSPopover anchored to the status item,
  showing a read-only transcript view of that session's .jsonl from
  ~/.claude/projects/*/<sessionUUID>.jsonl. Auto-refreshes every 2s.
- Indicators: ⚡ active algorithm phase, 📡 native, ✓ complete.
- Pure addition: zero behavioural change to existing jobs / status /
  controls / logs. Filesystem-only, no Pulse HTTP dependency.

Compiles cleanly with the existing build.sh (swiftc -O -whole-module-optimization).

Closes nothing — opt-in feature, ships only via the existing install.sh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant