Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .agents/skills/test-t3-app/references/feature-map.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Code: apps/web/src/components/sidebar/
- **sidebar.working-section** — collapsed "Working" section for threads busy with background work. Turn off in **Settings → General → Working section**.
- **sidebar.snoozed-shelf** — "Snoozed" threads, hidden until their wake time.
- **sidebar.settled-shelf** — "Settled" finished threads. Drag a thread onto the header to settle it.
- **sidebar.bots-group** — "My Bots" and "Shared Bots" groups for standing bot threads. Shared bots are the ones filed to the Shared inbox.
- **sidebar.bots-group** — "My bots", "Closura bots" and "Teammate bots" groups for standing bot threads. My and Teammate bots are filed to the viewer's or the other founder's inbox; Closura bots are Shared, Agents or unfiled. A founder's CoS lists for that founder, and for the other founder only when its owner's inbox is shown.
- **sidebar.project-folder** — per-project folders when **Settings → Labs → Boring sidebar (group by project)** is on; "Pin project" / "Unpin project", "Project settings".
- **sidebar.thread-row** — one thread: title, status, PR badge, hover actions. Click opens `/$environmentId/$threadId`. Drop files on it to attach them.
- **sidebar.thread-status** — row status labels: "Working", "Waiting", "Needs you", "Needs action", "Usage limit reached", "Failed", "Woke", "Unsent draft".
- **sidebar.thread-status** — row status labels: "Working", "Waiting", "Needs you", "Needs action", "Blocked · quota", "Failed", "Woke", "Unsent draft".
- **sidebar.thread-hover-actions** — "Settle", "Un-settle", "Wake" buttons; press and drag to apply to a range.
- **sidebar.draft-row** — unsent draft; "Discard draft" (with Undo).
- **sidebar.thread-menu** — right-click a thread row:
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const STATUS_LABEL_BY_STATUS: Partial<Record<ThreadListV2Status, StatusLabel>> =
iconTintClassName: "accent-danger-foreground",
},
limited: {
label: "Limited",
label: "Blocked · quota",
icon: "exclamationmark.circle",
className: "text-warning-foreground",
iconTintClassName: "accent-warning-foreground",
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { resolveBotPresence } from "./bots/botPresence";
import { botPresenceInput, resolveBotPresence } from "./bots/botPresence";
import { resolveThreadLastVisitedAt, resolveThreadStatusPill } from "./Sidebar.logic";
import { useUiStateStore } from "../uiStateStore";
import { ChildThreadApprovals } from "./chat/ChildThreadApprovals";
Expand Down Expand Up @@ -1862,7 +1862,7 @@ export default function ChatView(props: ChatViewProps) {
},
});
return resolveBotPresence(
pill === null ? null : { ...pill, errorClass: activeThreadShell.runtime?.lastErrorClass },
botPresenceInput(pill, activeThreadShell.runtime),
activeStanding.role,
).avatarState;
})();
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Sidebar.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ describe("standing bots bound by a scheduled task", () => {
it("keeps every standing bot listed when a scheduled task binds its thread after the snapshot", () => {
const snapshot = listedBots(new Set());
expect(snapshot.mine.map((thread) => thread.id)).toEqual([cosId]);
expect(snapshot.shared.map((thread) => thread.id)).toEqual([ctoId]);
expect(snapshot.closura.map((thread) => thread.id)).toEqual([ctoId]);

// A running scheduled task now reports these threads as its fresh-session threads.
const updated = listedBots(
Expand Down
42 changes: 33 additions & 9 deletions apps/web/src/components/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
threadListFilterOf,
} from "./sidebar/threadListFilter.logic";
import {
type FounderByEnvironmentId,
launchingThreadIdOf,
resolveMachineOwners,
resolveThreadAttributions,
Expand Down Expand Up @@ -424,6 +425,7 @@ interface SidebarThreadPartitionInput {
readonly workingShelfEnabled: boolean;
readonly inboxFilter: ReadonlyArray<InboxChoice>;
readonly founderInboxOwner: "kameron" | "jeff" | undefined;
readonly machineOwners: FounderByEnvironmentId;
/** Boring mode: folders list active threads by the user's latest message. */
readonly sortActiveBySend: boolean;
// Snooze wakes, the queued-turn grace and the Working shelf's exit grace depend
Expand Down Expand Up @@ -516,6 +518,7 @@ function useSidebarThreads(input: {
useClientSettings((s) => s.sidebarWorkingShelfEnabled) && folderGroups === null;
const inboxFilter = useClientSettings(effectiveInboxFilter);
const founderInboxOwner = useClientSettings((settings) => settings.founderInboxOwner);
const founderByEnvironmentId = useClientSettings((settings) => settings.founderByEnvironmentId);
const inboxReturnsVersion = useSyncExternalStore(
inboxReturns.subscribe,
inboxReturns.getSnapshot,
Expand Down Expand Up @@ -561,6 +564,7 @@ function useSidebarThreads(input: {
workingShelfEnabled,
inboxFilter,
founderInboxOwner,
machineOwners: resolveMachineOwners(serverConfigs, founderByEnvironmentId),
sortActiveBySend: folderGroups !== null,
clockKey: `${nowMinute}:${snoozeWakeClock}:${inboxReturnsVersion}`,
});
Expand Down Expand Up @@ -655,7 +659,8 @@ function useSidebarThreads(input: {
threads,
workingShelfEnabled,
searchableThreads: [
...botThreads,
// Search looks across every inbox, so it includes a CoS the bot groups leave out.
...partition.allBotThreads,
...pinnedThreads,
...activeThreads,
...workingThreads,
Expand Down Expand Up @@ -716,6 +721,7 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) {
workingShelfEnabled,
sortActiveBySend,
founderInboxOwner,
machineOwners,
} = input;
const preciseNow = new Date().toISOString();
const visible = filterSidebarV2VisibleThreads(threads, scopedProjectKeys, delegatedUnderParent);
Expand Down Expand Up @@ -789,11 +795,16 @@ function partitionSidebarThreads(input: SidebarThreadPartitionInput) {
? sortInboxThreadsByReturn(active, inboxObservation.returnedAt)
: sortThreadsForSidebar(active);
const sortedBots = sortBotThreads(bots);
const botGroups = partitionBotGroups(sortedBots, founderInboxOwner);
const botGroups = partitionBotGroups(sortedBots, founderInboxOwner, {
shownInboxes: input.inboxFilter,
machineOwnerOf: (thread) => machineOwners[thread.environmentId],
});
return {
botThreads: sortedBots,
botThreads: [...botGroups.mine, ...botGroups.closura, ...botGroups.teammates],
allBotThreads: sortedBots,
myBotThreads: botGroups.mine,
sharedBotThreads: botGroups.shared,
closuraBotThreads: botGroups.closura,
teammateBotThreads: botGroups.teammates,
pinnedThreads:
optimisticDrop?.section !== "pinned" || optimisticDrop.order === null
? sortedPinned
Expand Down Expand Up @@ -1470,7 +1481,8 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
workingShelfEnabled,
botThreads,
myBotThreads,
sharedBotThreads,
closuraBotThreads,
teammateBotThreads,
pinnedThreads,
draggableThreadKeys,
activeReorderableThreadKeys,
Expand Down Expand Up @@ -3561,17 +3573,29 @@ export default function Sidebar({ routeReveal }: { routeReveal: SidebarRouteReve
{!isSearchingThreads ? (
<>
<SidebarBotsGroup
label="My Bots"
label="My bots"
groupId="mine"
threads={myBotThreads}
activeThreadKey={routeRowThreadKey}
onThreadClick={handleThreadClick}
onThreadActivate={navigateToThread}
onContextMenu={handleThreadContextMenu}
/>
<SidebarBotsGroup
label="Shared Bots"
testId="sidebar-shared-bots-group"
threads={sharedBotThreads}
label="Closura bots"
groupId="closura"
testId="sidebar-closura-bots-group"
threads={closuraBotThreads}
activeThreadKey={routeRowThreadKey}
onThreadClick={handleThreadClick}
onThreadActivate={navigateToThread}
onContextMenu={handleThreadContextMenu}
/>
<SidebarBotsGroup
label="Teammate bots"
groupId="teammates"
testId="sidebar-teammate-bots-group"
threads={teammateBotThreads}
activeThreadKey={routeRowThreadKey}
onThreadClick={handleThreadClick}
onThreadActivate={navigateToThread}
Expand Down
29 changes: 24 additions & 5 deletions apps/web/src/components/bots/botOrgTree.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vite-plus/test";

import { isFounderName, orderBotTree, visibleBotRows } from "./botOrgTree";
import { botDisplayName, isFounderName, orderBotTree, visibleBotRows } from "./botOrgTree";
import { splitStandingThreads } from "./botPresence";

const bot = (name: string) => ({ id: name, standing: { name } });
Expand All @@ -23,8 +23,8 @@ describe("orderBotTree", () => {
"CoS",
]),
).toEqual([
"0:CoS",
"0:CEO",
"1:CoS",
"1:CTO",
"2:Platform",
"2:Infra / ARC Ops",
Expand All @@ -36,6 +36,16 @@ describe("orderBotTree", () => {
]);
});

it("puts Product Designer under Product and Daemon under CTO", () => {
expect(shape(["Daemon", "Product Designer", "Product / Site", "CTO", "CEO"])).toEqual([
"0:CEO",
"1:CTO",
"2:Daemon",
"1:Product / Site",
"2:Product Designer",
]);
});

it("shows a bot as a root when its manager is not in the list", () => {
expect(shape(["CTO", "Platform"])).toEqual(["0:CTO", "1:Platform"]);
expect(shape(["Platform", "CFO"])).toEqual(["0:CFO", "0:Platform"]);
Expand All @@ -57,6 +67,15 @@ describe("orderBotTree", () => {
});
});

describe("botDisplayName", () => {
it("shows Platform and ARC Ops under their short names and leaves other names alone", () => {
expect(botDisplayName("Platform / CTO")).toBe("Platform");
expect(botDisplayName("Infra / ARC Ops")).toBe("ARC Ops");
expect(botDisplayName("infra/arc ops")).toBe("ARC Ops");
expect(botDisplayName("CTO")).toBe("CTO");
});
});

describe("founders are not bots", () => {
it("recognizes founder names", () => {
expect(isFounderName(" Kameron ")).toBe(true);
Expand All @@ -83,12 +102,12 @@ describe("visibleBotRows", () => {
);

it("marks bots with reports and lists everything when nothing is collapsed", () => {
expect(shown([])).toEqual(["0:CoS", "0:CEO-", "1:CTO-", "2:Platform", "1:CFO"]);
expect(shown([])).toEqual(["0:CEO-", "1:CoS", "1:CTO-", "2:Platform", "1:CFO"]);
});

it("hides a collapsed bot's whole subtree but not its siblings", () => {
expect(shown(["CTO"])).toEqual(["0:CoS", "0:CEO-", "1:CTO+", "1:CFO"]);
expect(shown(["CEO"])).toEqual(["0:CoS", "0:CEO+"]);
expect(shown(["CTO"])).toEqual(["0:CEO-", "1:CoS", "1:CTO+", "1:CFO"]);
expect(shown(["CEO"])).toEqual(["0:CEO+"]);
});

it("ignores a collapse flag on a bot with no reports", () => {
Expand Down
29 changes: 24 additions & 5 deletions apps/web/src/components/bots/botOrgTree.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
/**
* The Bots shelf as an org tree. The chain of command mirrors closura-agent-config
* `config/standing-threads.json` (`reportsTo`): CoS and CEO at the root, the executive team under
* CEO, and the engineering team under CTO. Founders are humans, never bots, so they have no
* place here and never list in the Bots shelf.
* The Bots shelf as an org tree. The chain of command lives here; closura-agent-config
* `config/standing-threads.json` names the seats but carries no reporting lines. CEO is the root,
* with CoS and the executive team under it and the engineering team under CTO. Founders are
* humans, never bots, so they have no place here and never list in the Bots shelf.
*/

/** Normalized bot name -> the normalized name it reports to; `null` is a root. */
const REPORTS_TO: Readonly<Record<string, string | null>> = {
cos: null,
ceo: null,
cos: "ceo",
cto: "ceo",
cfo: "ceo",
product: "ceo",
growth: "ceo",
"product designer": "product",
platform: "cto",
"infra / arc ops": "cto",
"release engineer": "cto",
"pr reviewer": "cto",
daemon: "cto",
};

/** Existing persona names that are the same seat under a longer title. */
const ALIASES: Readonly<Record<string, string>> = {
"chief of staff": "cos",
"product / site": "product",
designer: "product designer",
"platform / cto": "platform",
"infra/arc ops": "infra / arc ops",
"arc ops": "infra / arc ops",
};

/** Seats shown under a shorter name than the persona's; the stored name is unchanged. */
const DISPLAY_NAMES: Readonly<Record<string, string>> = {
platform: "Platform",
"infra / arc ops": "ARC Ops",
};

/** Root order and sibling order follow the chart, not the alphabet. */
const SEAT_ORDER = Object.keys(REPORTS_TO);

Expand All @@ -38,6 +48,15 @@ function botSeat(name: string | null | undefined): string {
return ALIASES[key] ?? key;
}

/** The name a bot is shown under. */
export function botDisplayName(name: string): string {
return DISPLAY_NAMES[botSeat(name)] ?? name;
}

export function isChiefOfStaff(name: string | null | undefined): boolean {
return botSeat(name) === "cos";
}

export function isFounderName(name: string | null | undefined): boolean {
return FOUNDER_NAMES.has((name ?? "").trim().toLowerCase().replace(/\s+/g, " "));
}
Expand Down
Loading
Loading