fix(prime-agent): publish the project indicator on turn_start, not only session_start

prime-agent emits session_start from exactly one place — reload() — and never
at startup. A session_start-only handler therefore never ran on a fresh
session, and the '/mcpctl -> already on X' path returns without reloading, so
the indicator stayed blank exactly when it was most wanted.

Also guard against the no-op UI context: the runtime hands extensions
noOpUIContext until the TUI binds the real one, and every setter on it
silently discards. Publishing under it would cache a label that never
rendered.

Now published on session_start (reload), turn_start (earliest reliable point
on a fresh session), and on entering /mcpctl. Repeat calls are a no-op unless
the label changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BMXdb2qZbPSh8Q7XpTyjB
This commit is contained in:
Michal
2026-08-08 18:38:52 +01:00
parent 64503e8924
commit a1893a7578
2 changed files with 4 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@@ -543,6 +543,9 @@ describe('config prime-agent', () => {
expect(ext).toContain("placement: 'belowEditor'"); expect(ext).toContain("placement: 'belowEditor'");
// Still set the status: pi's footer does render it. // Still set the status: pi's footer does render it.
expect(ext).toContain('ctx.ui.setStatus(STATUS_KEY'); expect(ext).toContain('ctx.ui.setStatus(STATUS_KEY');
// prime-agent emits session_start only from reload(), never at startup, so
// a session_start-only indicator stays blank until the first switch.
expect(ext).toContain("pi.on('turn_start'");
}); });
it('the installed switcher filters the project list before showing it', async () => { it('the installed switcher filters the project list before showing it', async () => {