( pi: ExtensionAPI, deps: StatusLineDeps, )
| 36 | * or compartment enumeration here; the rich breakdown is reserved for /ctx-status. |
| 37 | */ |
| 38 | export function registerStatusLine( |
| 39 | pi: ExtensionAPI, |
| 40 | deps: StatusLineDeps, |
| 41 | ): void { |
| 42 | void deps.projectIdentity; |
| 43 | |
| 44 | pi.on("session_start", async (_event, ctx) => |
| 45 | updateStatusLine(ctx, deps, true), |
| 46 | ); |
| 47 | pi.on("agent_end", async (_event, ctx) => updateStatusLine(ctx, deps)); |
| 48 | pi.on("session_compact", async (_event, ctx) => |
| 49 | updateStatusLine(ctx, deps, true), |
| 50 | ); |
| 51 | pi.on("tool_execution_end", async (_event, ctx) => |
| 52 | updateStatusLine(ctx, deps), |
| 53 | ); |
| 54 | pi.on("message_end", async (event, ctx) => { |
| 55 | const role = (event.message as { role?: unknown } | undefined)?.role; |
| 56 | if (role === "assistant") updateStatusLine(ctx, deps); |
| 57 | }); |
| 58 | pi.on("session_shutdown", async (_event, ctx) => { |
| 59 | const sessionId = resolveSessionId(ctx); |
| 60 | if (sessionId) lastRenderedBySession.delete(sessionId); |
| 61 | ctx.ui.setStatus(STATUS_KEY, undefined); |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | export function updateStatusLine( |
| 66 | ctx: ExtensionContext, |
no test coverage detected