iterate.com / ui

git clone https://git.iterate.com/repos/ui

Agent pages: a view gets the agents below it that are at work, with what each does

Jonas, 28 Nov 2026, in the Dash on a phone, of a thread's line under a
message: "Why does it say 'iterate is working on a reply' and not some kind"
(of status of what the thread's agent does).

- A thread is an agent below the conversation. What it does now is on its own
  log, which the conversation's view does not hold. The page holds every
  agent's row already.
- New field `atWork` of a view's props: the rows below the page's path that
  are at work by `agentAtWork`, by path, each with `status`, `activity` and
  `lastActivityAt`. No other row: a conversation can have some thousand
  agents below it.
- The frame is told only when that text changes. While a row is at work the
  page looks at the clock again each half minute.

Via: /agents/claude/dash-context-feed-threads-mwy308tb-4d1e63
Session: claude 89f0feea-b83f-4937-8b4a-56af6cb8884b on beelink
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Jonas Templestein, 2026-11-28 07:29 UTC · 3503ad65c46274bd22085fda8a08bc8e23853c37 · parent e63d3b3

6 files changed

A src/agent-kind-view/below.test.ts
@@ -0,0 +1,45 @@
+import { describe, expect, it } from "vitest";
+import { atWorkBelowOf } from "./below.ts";
+
+const NOW = Date.parse("2026-11-28T08:00:00.000Z");
+const row = (
+  path: string,
+  status: "working" | "idle" | "waiting" | "ended",
+  activity: string | null,
+  agoMs: number,
+) => ({
+  path,
+  status,
+  activity,
+  lastActivityAt: new Date(NOW - agoMs).toISOString(),
+});
+
+describe("atWorkBelowOf", () => {
+  it("names only the agents below the path that are at work", () => {
+    const found = atWorkBelowOf(
+      [
+        row("/agents/main", "working", "Answering", 1_000),
+        row("/agents/main/t/12", "working", "Reading the card", 2_000),
+        row("/agents/main/t/13", "idle", null, 2_000),
+        row("/agents/main/t/14", "ended", "Done", 2_000),
+        row("/agents/mainly/t/15", "working", "Other", 2_000),
+        row("/agents/main/t/16", "working", null, 2_000),
+      ],
+      "/agents/main",
+      NOW,
+    );
+    expect(Object.keys(found)).toEqual(["/agents/main/t/12", "/agents/main/t/16"]);
+    expect(found["/agents/main/t/12"]).toEqual({
+      status: "working",
+      activity: "Reading the card",
+      lastActivityAt: new Date(NOW - 2_000).toISOString(),
+    });
+    expect(found["/agents/main/t/16"]?.activity).toBeUndefined();
+  });
+
+  it("drops a row whose word of work is stale, and answers one object for none", () => {
+    const stale = atWorkBelowOf([row("/a/t/1", "working", "x", 25 * 3_600_000)], "/a", NOW);
+    expect(stale).toBe(atWorkBelowOf(undefined, "/a", NOW));
+    expect(Object.keys(stale)).toEqual([]);
+  });
+});
A src/agent-kind-view/below.ts
@@ -0,0 +1,63 @@
+// below.ts — THE AGENTS BELOW AN AGENT THAT WORK NOW, for the view of that agent.
+//
+// Jonas, 28 Nov 2026, in the Dash on a phone, of a thread's line under a message: "Why does it
+// say 'iterate is working on a reply' and not some kind" (of status of what the thread's agent
+// does). A thread is an agent below the conversation (`<conversation>/t/<offset>`), and what it
+// does now is on its own log, which the conversation's view does not hold. The page holds the
+// row of every agent already (the list's). So the page hands the view the rows below its own
+// path that are at work, by the rule that the list uses (`agentAtWork`), and no other row: a
+// conversation can have some thousand agents below it, and a frame is told at each change.
+
+import { useEffect, useMemo, useState } from "react";
+import { agentAtWork } from "iterate/agents/at-work";
+
+/** What the page says of one agent at work: its row's own words. */
+export type AtWork = { status: string; activity?: string; lastActivityAt?: string };
+export type AtWorkBelow = Readonly<Record<string, AtWork>>;
+
+type Row = {
+  path: string;
+  status: "working" | "idle" | "waiting" | "ended" | null;
+  activity: string | null;
+  lastActivityAt: string | null;
+};
+
+const NONE: AtWorkBelow = Object.freeze({});
+/** A row at work with no news falls out by the clock: the page looks again this often. */
+const LOOK_AGAIN_MS = 30_000;
+
+/** The rows below `path` that are at work at `now`, by path. */
+export function atWorkBelowOf(
+  rows: readonly Row[] | undefined,
+  path: string,
+  now: number,
+): AtWorkBelow {
+  const under = `${path.replace(/\/+$/, "")}/`;
+  const found: Record<string, AtWork> = {};
+  for (const row of rows || []) {
+    if (!row.path.startsWith(under) || !row.status || !agentAtWork(row, now)) continue;
+    found[row.path] = {
+      status: row.status,
+      ...(row.activity ? { activity: row.activity } : {}),
+      ...(row.lastActivityAt ? { lastActivityAt: row.lastActivityAt } : {}),
+    };
+  }
+  return Object.keys(found).length ? found : NONE;
+}
+
+/** The same object while nothing changed, so the frame is told once. */
+export function useAtWorkBelow(rows: readonly Row[] | undefined, path: string): AtWorkBelow {
+  const [now, setNow] = useState(() => Date.now());
+  const found = useMemo(() => atWorkBelowOf(rows, path, now), [rows, path, now]);
+  const any = found !== NONE;
+  useEffect(() => {
+    // a new list is a new look at the clock; while a row is at work, so is each half minute
+    setNow(Date.now());
+    if (!any) return;
+    const timer = setInterval(() => setNow(Date.now()), LOOK_AGAIN_MS);
+    return () => clearInterval(timer);
+  }, [rows, any]);
+  const signature = JSON.stringify(found);
+  // oxlint-disable-next-line react-hooks/exhaustive-deps -- `found` changes only with its text
+  return useMemo(() => found, [signature]);
+}
M src/agent-kind-view/bridge.ts
@@ -52,6 +52,8 @@
   presenceOn?: boolean;
   /** The writers' names and pictures (`AgentKindViewProps.people`). */
   people?: AgentKindViewProps["people"];
+  /** The agents below this one that are at work (`AgentKindViewProps.atWork`). */
+  atWork?: AgentKindViewProps["atWork"];
 };
 
 /** What changed: the fields that did, and the events added at either end, or all of them again
M src/agent-kind-view/dash-agents.tsx
@@ -18,6 +18,7 @@
 // not import this folder. Each loads its larger part when it first draws (the composer, the chat),
 // and reads the kinds once for the page's life: which kind has which file (the mind's KV,
 // `agent-kinds`, which worker.ts writes at every publish), and each file's source.
+import { useAtWorkBelow } from "./below.ts";
 import { useWriters, type WritersItx } from "./writers.ts";
 import {
   createContext,
@@ -1054,6 +1055,7 @@
   const older = useMemo(() => (exhausted ? null : { loading, exhausted }), [loading, exhausted]);
   const { stub } = agent;
   const people = useWriters(itx as unknown as WritersItx, log.events);
+  const atWork = useAtWorkBelow(agents, path);
   const hostError = agent.error || load.error;
   // the cover stands until the frame has drawn (its own document loads first) and the log has
   // answered: a saved copy answers at once, so the frame's load is said outright
@@ -1085,6 +1087,8 @@
     presenceOn: presence,
     // the writers' names and pictures, read and signed as the viewer (writers.ts)
     people,
+    // the agents below this one that work now: a thread's line says what its agent does
+    atWork,
   };
   // the view's state, as the frame reads it
   const state = inputs.state;
M src/agent-kind-view/frame-view.tsx
@@ -84,6 +84,7 @@
     me: held.me,
     presence: held.presenceOn,
     people: held.people,
+    atWork: held.atWork,
   };
 }
 
M src/agent-kind-view/types.ts
@@ -108,6 +108,11 @@
    *  with a name or a picture; none on a page whose viewer may not read them (a guest), and
    *  none on a page older than this field. A view draws initials for anyone who is not here. */
   people?: Readonly<Record<string, { name?: string; picture?: string }>>;
+  /** The agents below this one that are at work now, by path, each with its row's own words: its
+   *  `status` (`working`, `waiting`, or `idle` while a script of its last answer may still run),
+   *  what it says it does (`activity`) and when it last did anything (below.ts). A view draws a
+   *  thread's line with them. Empty when none works; none on a page older than this field. */
+  atWork?: Readonly<Record<string, { status: string; activity?: string; lastActivityAt?: string }>>;
   /** Another server's MCP App in the feed calls its server through these, as this agent: pass
    *  them on to `AgentChat` as `widgetCalls`. None: a page older than these verbs. */
   widgetCalls?: {