diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.ts
index 937e37dd8ec3..bb1d67cd9f19 100644
--- a/apps/web/src/components/settings/settingsSearch.ts
+++ b/apps/web/src/components/settings/settingsSearch.ts
@@ -820,6 +820,12 @@ export const SETTINGS_SEARCH_ITEMS = [
scope: "project-defaults",
searchTerms: ["new worktrees start remote origin latest fetched branch local"],
},
+ {
+ id: "new-thread-inbox",
+ title: "New threads belong to",
+ to: "/settings/threads",
+ searchTerms: ["inbox owner founder kameron jeff attribute filed"],
+ },
{
id: "add-project-starts-in",
title: "Add project starts in",
diff --git a/apps/web/src/components/sidebar/SidebarInboxBar.tsx b/apps/web/src/components/sidebar/SidebarInboxBar.tsx
deleted file mode 100644
index 6d49242b29f5..000000000000
--- a/apps/web/src/components/sidebar/SidebarInboxBar.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { effectiveInboxView, type InboxView } from "@t3tools/contracts";
-import { updateClientSettings, useClientSettings } from "../../hooks/useSettings";
-
-/** A local view of the shared pool; All and search always include every thread. */
-export function SidebarInboxBar() {
- const view = useClientSettings(effectiveInboxView);
- const owner = useClientSettings((settings) => settings.founderInboxOwner);
- return (
-
-
-
-
- );
-}
diff --git a/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx b/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx
new file mode 100644
index 000000000000..466eb7bb93bc
--- /dev/null
+++ b/apps/web/src/components/sidebar/SidebarThreadFilterMenu.tsx
@@ -0,0 +1,219 @@
+import {
+ effectiveInboxFilter,
+ type EnvironmentId,
+ type Founder,
+ type InboxChoice,
+} from "@t3tools/contracts";
+import { SlidersHorizontalIcon } from "lucide-react";
+import type { ReactNode } from "react";
+
+import { updateClientSettings, useClientSettings } from "../../hooks/useSettings";
+import { cn } from "../../lib/utils";
+import { useConnectedEnvironmentIds, useEnvironmentIdentities } from "../../state/environments";
+import {
+ Menu,
+ MenuCheckboxItem,
+ MenuGroup,
+ MenuGroupLabel,
+ MenuItem,
+ MenuPopup,
+ MenuSeparator,
+ MenuTrigger,
+} from "../ui/menu";
+import { SidebarHeaderIconButton } from "./SidebarThreadHeader";
+import {
+ changedThreadListFilters,
+ inboxMenuOrder,
+ threadListFilterCounts,
+ threadListFilterOf,
+ toggleFilterOption,
+ toggleHiddenEnvironment,
+ type ThreadListFilter,
+} from "./threadListFilter.logic";
+
+const INBOX_LABELS: Record = {
+ kameron: "Kameron",
+ jeff: "Jeff",
+ agents: "Agents",
+ shared: "Shared",
+};
+
+type CountedThreads = Parameters[0];
+const LAST_OPTION_NOTE = ", the last one shown, so it stays checked";
+
+/** Chooses which inboxes and environments the thread list shows. Search still finds every thread. */
+export function SidebarThreadFilterMenu({
+ countedThreads,
+}: {
+ /** Called only while the menu is open. */
+ countedThreads: () => CountedThreads;
+}) {
+ const filter = useClientSettings(threadListFilterOf);
+ const owner = useClientSettings((settings) => settings.founderInboxOwner);
+ const environments = useEnvironmentIdentities();
+ const environmentIds = environments.map((environment) => environment.environmentId);
+ const changed = changedThreadListFilters(filter, owner, environmentIds);
+ const hiddenCount = environmentIds.filter((id) =>
+ filter.hiddenEnvironmentIds.includes(id),
+ ).length;
+ const summary = [
+ changed.inboxes ? filter.inboxes.map((inbox) => INBOX_LABELS[inbox]).join(", ") : null,
+ changed.environments
+ ? `${hiddenCount} environment${hiddenCount === 1 ? "" : "s"} hidden`
+ : null,
+ ].filter((part) => part !== null);
+ const label =
+ summary.length === 0
+ ? "Filter threads by inbox and environment"
+ : `Filter threads by inbox and environment (${summary.join("; ")})`;
+ return (
+
+ );
+}
+
+// Mounted only while the menu is open, so counting never runs on streaming ticks.
+function SidebarThreadFilterOptions({
+ countedThreads,
+ filter,
+ owner,
+ environments,
+ isChanged,
+}: {
+ countedThreads: () => CountedThreads;
+ filter: ThreadListFilter;
+ owner: Founder | undefined;
+ environments: ReadonlyArray<{ readonly environmentId: EnvironmentId; readonly label: string }>;
+ isChanged: boolean;
+}) {
+ const connectedEnvironmentIds = useConnectedEnvironmentIds();
+ const counts = threadListFilterCounts(countedThreads(), filter);
+ const inboxOrder = inboxMenuOrder(owner);
+ const environmentIds = environments.map((environment) => environment.environmentId);
+ const shownEnvironmentIds = environmentIds.filter(
+ (id) => !filter.hiddenEnvironmentIds.includes(id),
+ );
+ return (
+ <>
+
+ Inbox
+ {inboxOrder.map((inbox) => {
+ const checked = filter.inboxes.includes(inbox);
+ const isLast = checked && filter.inboxes.length === 1;
+ const count = counts.inboxes.get(inbox) ?? 0;
+ return (
+
+ void updateClientSettings({
+ founderInboxFilter: toggleFilterOption(filter.inboxes, inbox, inboxOrder),
+ })
+ }
+ >
+
+
+ );
+ })}
+
+ {environments.length > 1 ? (
+ <>
+
+
+ Environments
+ {environments.map((environment) => {
+ const checked = shownEnvironmentIds.includes(environment.environmentId);
+ const isLast = checked && shownEnvironmentIds.length === 1;
+ const connected = connectedEnvironmentIds.includes(environment.environmentId);
+ const count = counts.environments.get(environment.environmentId) ?? 0;
+ return (
+
+ void updateClientSettings({
+ sidebarHiddenEnvironmentIds: toggleHiddenEnvironment(
+ filter.hiddenEnvironmentIds,
+ environment.environmentId,
+ environmentIds,
+ ),
+ })
+ }
+ >
+
+ }
+ />
+
+ );
+ })}
+
+ >
+ ) : null}
+ {isChanged ? (
+ <>
+
+
+ >
+ ) : null}
+ >
+ );
+}
+
+function FilterOptionRow({
+ label,
+ count,
+ indicator,
+}: {
+ label: string;
+ count: number;
+ indicator?: ReactNode;
+}) {
+ return (
+
+ {indicator}
+ {label}
+ {count}
+
+ );
+}
diff --git a/apps/web/src/components/sidebar/SidebarThreadHeader.tsx b/apps/web/src/components/sidebar/SidebarThreadHeader.tsx
index e400e03d2758..c8d4cdbde5f3 100644
--- a/apps/web/src/components/sidebar/SidebarThreadHeader.tsx
+++ b/apps/web/src/components/sidebar/SidebarThreadHeader.tsx
@@ -14,6 +14,7 @@ import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
export interface SidebarThreadHeaderProps {
hasProjects: boolean;
+ threadFilter: ReactNode;
projectScope: ReactNode;
onNewProject: () => void;
onNewThread: (event: ReactMouseEvent) => void;
@@ -33,6 +34,7 @@ export interface SidebarThreadHeaderProps {
export function SidebarThreadHeader({
hasProjects,
+ threadFilter,
projectScope,
onNewProject,
onNewThread,
@@ -99,6 +101,7 @@ export function SidebarThreadHeader({