mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-08 16:39:42 +02:00
feat(session): say when a session is watching its own background work
An agent that arms a monitor, backgrounds a shell or hands a task to a cloud session is told to end its turn. The pane then falls quiet, Claude Code's idle_prompt notification arrives a minute later, and every surface files the session under NEEDS YOU with nothing for a human to answer. Claude states what it is still running on the last row of its screen (`⏵⏵ bypass permissions on · 1 monitor · ← for agents`). That row is now `capabilities.workDetect.watchingLine` in the CLI registry, guarded by compileVersionRegex() like every other config regex, and the idle probe reads it off the capture it already takes: `watchingLabel()` in session-activity.ts searches the last five lines only, so a session that PRINTS "1 monitor" is not mistaken for one running it. The label lands on Session.watching and rides toLightDetailedState() out to every surface. The phone overview, the desktop home rail and the rich sidebar rows wear it as a `watching` badge in the accent colour, beside the state pill and never in place of it: an agent can arm a monitor and ask a question in the same breath, and only the pill says which. Verified end to end against a throwaway session on an isolated beta instance: the payload carried `watching: "1 monitor"` once the turn ended, the badge rendered next to a yellow `waiting` pill, and both cleared when the monitor died. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
9466acfc1a
commit
3f2cde2db7
@@ -356,3 +356,50 @@ describe('home screens: one order, one numbering', () => {
|
||||
expect(branch).not.toContain('this.sessionOrder[idx]');
|
||||
});
|
||||
});
|
||||
|
||||
describe('home sessions column: watching badge', () => {
|
||||
it('carries the label off the session payload', () => {
|
||||
const app = loadHomeSessionsApp({
|
||||
sessions: sessionMap([{ id: 'watcher', watching: '1 monitor' }, { id: 'plain' }]),
|
||||
sessionOrder: ['watcher', 'plain'],
|
||||
cases: CASES,
|
||||
});
|
||||
|
||||
const rows = Object.fromEntries(app.buildHomeSessionRows().map((r: any) => [r.id, r.watching]));
|
||||
expect(rows).toEqual({ watcher: '1 monitor', plain: '' });
|
||||
});
|
||||
|
||||
it("builds the badge with the phone overview, in the rail's own pill class", () => {
|
||||
// Both home screens must word this badge identically, so the rail borrows the
|
||||
// builder rather than writing a second one — the same arrangement it already has
|
||||
// for state classification and for the stamp wording.
|
||||
const app = loadHomeSessionsApp({
|
||||
sessions: sessionMap([{ id: 'watcher', watching: '2 shells' }]),
|
||||
sessionOrder: ['watcher'],
|
||||
cases: CASES,
|
||||
});
|
||||
|
||||
const row = app._buildHomeSessionRow(app.buildHomeSessionRows()[0]);
|
||||
const badges = collect(row).filter((el: any) => String(el.className).includes('--watching'));
|
||||
expect(badges).toHaveLength(1);
|
||||
expect(badges[0].className).toBe('home-sessions-pill home-sessions-pill--watching');
|
||||
expect(badges[0].textContent).toBe('watching');
|
||||
expect(badges[0].title).toBe('Still running in the background: 2 shells');
|
||||
});
|
||||
|
||||
it('draws no badge for a session running nothing in the background', () => {
|
||||
const app = loadHomeSessionsApp({
|
||||
sessions: sessionMap([{ id: 'plain' }]),
|
||||
sessionOrder: ['plain'],
|
||||
cases: CASES,
|
||||
});
|
||||
|
||||
const row = app._buildHomeSessionRow(app.buildHomeSessionRows()[0]);
|
||||
expect(collect(row).filter((el: any) => String(el.className).includes('--watching'))).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
/** Every node under one the builders made, the row itself included. */
|
||||
function collect(node: any): any[] {
|
||||
return [node, ...(node.children || []).flatMap((child: any) => collect(child))];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user