The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 19:00 UTC
feat(search): find threads by conversation content (#4959)
Theo Browne committed
Jul 30, 2026 at 05:30 UTC
4b71a2ae2ffbbb7b6936051552094b71364cefd4
34 files changed
+1345
-72
apps/mobile/src/features/home/HomeRouteScreen.tsx
+16
-14
@@ -25,7 +25,7 @@ export function HomeRouteScreen() {
25
const { layout } = useAdaptiveWorkspaceLayout();
26
const projects = useProjects();
27
const threads = useThreadShells();
28
- const { state: catalogState } = useWorkspaceState();
28
+ const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
29
const { savedConnectionsById } = useSavedRemoteConnections();
30
const navigation = useNavigation();
31
const [searchQuery, setSearchQuery] = useState("");
@@ -33,20 +33,22 @@ export function HomeRouteScreen() {
33
useThreadListActions();
34
const pendingTasks = usePendingNewTasks();
35
const { openPendingTask, confirmDeletePendingTask } = usePendingTaskListActions();
36
- const environments = useMemo(
37
- () =>
38
- Arr.sort(
39
- Object.values(savedConnectionsById).map((connection) => ({
40
- environmentId: connection.environmentId,
41
- label: connection.environmentLabel,
42
- })),
43
- Order.mapInput(
44
- Order.String,
45
- (environment: { readonly label: string }) => environment.label,
46
- ),
36
+ const environments = useMemo(() => {
37
+ const connectionStateByEnvironmentId = new Map(
38
+ workspaceEnvironments.map(
39
+ (environment) => [environment.environmentId, environment.connectionState] as const,
40
),
48
- [savedConnectionsById],
49
- );
41
+ );
42
+ return Arr.sort(
43
+ Object.values(savedConnectionsById).map((connection) => ({
44
+ environmentId: connection.environmentId,
45
+ label: connection.environmentLabel,
46
+ connectionState:
47
+ connectionStateByEnvironmentId.get(connection.environmentId) ?? "available",
48
+ })),
49
+ Order.mapInput(Order.String, (environment: { readonly label: string }) => environment.label),
50
+ );
51
+ }, [savedConnectionsById, workspaceEnvironments]);
52
const availableEnvironmentIds = useMemo(
53
() => new Set(environments.map((environment) => environment.environmentId)),
54
[environments],
apps/mobile/src/features/home/HomeScreen.tsx
+97
-27
@@ -7,6 +7,10 @@ import {
7
type EnvironmentProject,
8
type EnvironmentThreadShell,
9
} from "@t3tools/client-runtime/state/shell";
10
+import {
11
+ threadSearchMatchKey,
12
+ type EnvironmentThreadSearchMatch,
13
+} from "@t3tools/client-runtime/state/thread-search";
14
import type {
15
EnvironmentId,
16
SidebarProjectGroupingMode,
@@ -22,11 +26,12 @@ import { useThemeColor } from "../../lib/useThemeColor";
26
27
import { AppText as Text } from "../../components/AppText";
28
import { EmptyState } from "../../components/EmptyState";
25
-import type { WorkspaceState } from "../../state/workspaceModel";
29
+import type { WorkspaceEnvironment, WorkspaceState } from "../../state/workspaceModel";
30
import type { SavedRemoteConnection } from "../../lib/connection";
31
import { scopedProjectKey } from "../../lib/scopedEntities";
32
import { NATIVE_LIQUID_GLASS_SUPPORTED } from "../../native/native-glass";
33
import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/preferences";
34
+import { useThreadSearch } from "../../state/queries";
35
import { useThreadListV2Enabled } from "../threads/use-thread-list-v2-enabled";
36
import { environmentServerConfigsAtom } from "../../state/server";
37
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
@@ -72,7 +77,9 @@ interface HomeScreenProps {
77
readonly pendingTasks: ReadonlyArray<PendingNewTask>;
78
readonly catalogState: WorkspaceState;
79
readonly savedConnectionsById: Readonly<Record<string, SavedRemoteConnection>>;
75
- readonly environments: ReadonlyArray<HomeListFilterMenuEnvironment>;
80
+ readonly environments: ReadonlyArray<
81
+ HomeListFilterMenuEnvironment & Pick<WorkspaceEnvironment, "connectionState">
82
+ >;
83
readonly searchQuery: string;
84
readonly selectedEnvironmentId: EnvironmentId | null;
85
readonly selectedProjectKey: string | null;
@@ -189,6 +196,35 @@ export function HomeScreen(props: HomeScreenProps) {
196
const listRef = useRef<LegendListRef | null>(null);
197
const insets = useSafeAreaInsets();
198
const accentColor = useThemeColor("--color-icon-muted");
199
+ const searchEnvironmentIds = useMemo(
200
+ () =>
201
+ props.selectedEnvironmentId === null
202
+ ? props.environments
203
+ .filter((environment) => environment.connectionState === "connected")
204
+ .map((environment) => environment.environmentId)
205
+ : props.environments.some(
206
+ (environment) =>
207
+ environment.environmentId === props.selectedEnvironmentId &&
208
+ environment.connectionState === "connected",
209
+ )
210
+ ? [props.selectedEnvironmentId]
211
+ : [],
212
+ [props.environments, props.selectedEnvironmentId],
213
+ );
214
+ const threadSearch = useThreadSearch(searchEnvironmentIds, props.searchQuery);
215
+ const threadSearchMatchByKey = useMemo(() => {
216
+ const matches = new Map<string, EnvironmentThreadSearchMatch>();
217
+ for (const match of threadSearch.matches) {
218
+ if (match.source === "user" || match.source === "assistant") {
219
+ matches.set(threadSearchMatchKey(match), match);
220
+ }
221
+ }
222
+ return matches;
223
+ }, [threadSearch.matches]);
224
+ const matchedThreadKeys = useMemo(
225
+ () => new Set(threadSearch.matches.map(threadSearchMatchKey)),
226
+ [threadSearch.matches],
227
+ );
228
const effectiveGroupDisplayStates = useMemo(() => {
229
const next = new Map(groupDisplayStates);
230
if (!AsyncResult.isSuccess(preferencesResult)) {
@@ -318,6 +354,7 @@ export function HomeScreen(props: HomeScreenProps) {
354
pendingTasks: scopedPendingTasks,
355
environmentId: props.selectedEnvironmentId,
356
searchQuery: props.searchQuery,
357
+ matchedThreadKeys,
358
projectSortOrder: props.projectSortOrder,
359
threadSortOrder: props.threadSortOrder,
360
projectGroupingMode: props.projectGroupingMode,
@@ -328,6 +365,7 @@ export function HomeScreen(props: HomeScreenProps) {
365
props.searchQuery,
366
props.selectedEnvironmentId,
367
props.threadSortOrder,
368
+ matchedThreadKeys,
369
scopedPendingTasks,
370
scopedProjects,
371
scopedThreads,
@@ -516,6 +554,7 @@ export function HomeScreen(props: HomeScreenProps) {
554
environmentId: props.selectedEnvironmentId,
555
projectRefs: v2ScopedProjectGroup === null ? null : v2ScopedProjectGroup.projectRefs,
556
searchQuery: props.searchQuery,
557
+ matchedThreadKeys,
558
changeRequestStateByKey,
559
settlementEnvironmentIds,
560
snoozeEnvironmentIds,
@@ -533,6 +572,7 @@ export function HomeScreen(props: HomeScreenProps) {
572
props.searchQuery,
573
props.selectedEnvironmentId,
574
props.threads,
575
+ matchedThreadKeys,
576
threadListV2Enabled,
577
v2ScopedProjectGroup,
578
]);
@@ -629,6 +669,13 @@ export function HomeScreen(props: HomeScreenProps) {
669
? (props.savedConnectionsById[thread.environmentId]?.environmentLabel ?? null)
670
: null
671
}
672
+ searchMatch={threadSearchMatchByKey.get(
673
+ threadSearchMatchKey({
674
+ environmentId: thread.environmentId,
675
+ threadId: thread.id,
676
+ }),
677
+ )}
678
+ searchQuery={props.searchQuery}
679
onSelectThread={props.onSelectThread}
680
onDeleteThread={handleDeleteThread}
681
onArchiveThread={props.onArchiveThread}
@@ -660,7 +707,9 @@ export function HomeScreen(props: HomeScreenProps) {
707
props.savedConnectionsById,
708
serverConfigs,
709
settlementEnvironmentIds,
710
+ threadSearchMatchByKey,
711
v2ProjectTitleByProjectKey,
712
+ props.searchQuery,
713
],
714
);
715
const v2KeyExtractor = useCallback((item: ThreadListV2ListItem) => item.key, []);
@@ -675,19 +724,28 @@ export function HomeScreen(props: HomeScreenProps) {
724
projectTitleByProjectKey: v2ProjectTitleByProjectKey,
725
serverConfigs,
726
savedConnectionsById: props.savedConnectionsById,
727
+ searchQuery: props.searchQuery,
728
+ threadSearchMatchByKey,
729
}),
730
[
731
projectByKey,
732
projectCwdByKey,
733
+ props.searchQuery,
734
props.savedConnectionsById,
735
serverConfigs,
736
+ threadSearchMatchByKey,
737
v2ProjectTitleByProjectKey,
738
],
739
);
740
741
const extraData = useMemo(
689
- () => ({ savedConnectionsById: props.savedConnectionsById, projectCwdByKey }),
690
- [props.savedConnectionsById, projectCwdByKey],
742
+ () => ({
743
+ projectCwdByKey,
744
+ savedConnectionsById: props.savedConnectionsById,
745
+ searchQuery: props.searchQuery,
746
+ threadSearchMatchByKey,
747
+ }),
748
+ [projectCwdByKey, props.savedConnectionsById, props.searchQuery, threadSearchMatchByKey],
749
);
750
751
const renderItem = useCallback(
@@ -740,6 +798,13 @@ export function HomeScreen(props: HomeScreenProps) {
798
null
799
}
800
isLast={item.isLast}
801
+ searchMatch={threadSearchMatchByKey.get(
802
+ threadSearchMatchKey({
803
+ environmentId: thread.environmentId,
804
+ threadId: thread.id,
805
+ }),
806
+ )}
807
+ searchQuery={props.searchQuery}
808
onArchiveThread={props.onArchiveThread}
809
onDeleteThread={props.onDeleteThread}
810
onSelectThread={props.onSelectThread}
@@ -770,7 +835,9 @@ export function HomeScreen(props: HomeScreenProps) {
835
props.onNewThreadInProject,
836
props.onSelectPendingTask,
837
props.onSelectThread,
838
+ props.searchQuery,
839
props.savedConnectionsById,
840
+ threadSearchMatchByKey,
841
updateGroupDisplay,
842
],
843
);
@@ -863,7 +930,7 @@ export function HomeScreen(props: HomeScreenProps) {
930
const v2ListHeader = listHeader;
931
932
const listEmpty = !hasResults ? (
866
- hasSearchQuery ? (
933
+ hasSearchQuery && threadSearch.isPending ? null : hasSearchQuery ? (
934
<EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
935
) : selectedProjectScope !== null ? (
936
<EmptyState
@@ -886,31 +953,34 @@ export function HomeScreen(props: HomeScreenProps) {
953
// threads yet" over an inbox that is merely all-snoozed reads as data
954
// loss.
955
const v2SnoozedCount = threadListV2Layout.snoozedCount;
889
- const v2ListEmpty = hasSearchQuery ? (
890
- v2SnoozedCount > 0 ? (
891
- // The snoozed threads already passed this search filter: "No
892
- // results" would claim nothing matched when matches are merely
893
- // parked.
956
+ const v2ListEmpty =
957
+ hasSearchQuery && threadSearch.isPending && v2SnoozedCount === 0 ? null : hasSearchQuery ? (
958
+ v2SnoozedCount > 0 ? (
959
+ // The snoozed threads already passed this search filter: "No
960
+ // results" would claim nothing matched when matches are merely
961
+ // parked.
962
+ <EmptyState
963
+ title={
964
+ v2SnoozedCount === 1 ? "1 matching thread snoozed" : `All matching threads snoozed`
965
+ }
966
+ detail={`Threads matching "${props.searchQuery}" are snoozed and return when their wake time passes.`}
967
+ />
968
+ ) : (
969
+ <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
970
+ )
971
+ ) : v2SnoozedCount > 0 ? (
972
+ <EmptyState
973
+ title={v2SnoozedCount === 1 ? "1 thread snoozed" : `${v2SnoozedCount} threads snoozed`}
974
+ detail="Snoozed threads return when their wake time passes."
975
+ />
976
+ ) : v2ScopedProjectGroup !== null ? (
977
<EmptyState
895
- title={v2SnoozedCount === 1 ? "1 matching thread snoozed" : `All matching threads snoozed`}
896
- detail={`Threads matching "${props.searchQuery}" are snoozed and return when their wake time passes.`}
978
+ title={`No threads in ${v2ScopedProjectGroup.title}`}
979
+ detail="Choose another project or create a new task."
980
/>
981
) : (
899
- <EmptyState title="No results" detail={`No threads matching "${props.searchQuery}".`} />
900
- )
901
- ) : v2SnoozedCount > 0 ? (
902
- <EmptyState
903
- title={v2SnoozedCount === 1 ? "1 thread snoozed" : `${v2SnoozedCount} threads snoozed`}
904
- detail="Snoozed threads return when their wake time passes."
905
- />
906
- ) : v2ScopedProjectGroup !== null ? (
907
- <EmptyState
908
- title={`No threads in ${v2ScopedProjectGroup.title}`}
909
- detail="Choose another project or create a new task."
910
- />
911
- ) : (
912
- listEmpty
913
- );
982
+ listEmpty
983
+ );
984
985
if (threadListV2Enabled) {
986
return (
apps/mobile/src/features/home/homeThreadList.test.ts
+28
@@ -2,6 +2,7 @@ import type {
2
EnvironmentProject,
3
EnvironmentThreadShell,
4
} from "@t3tools/client-runtime/state/shell";
5
+import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
6
import { EnvironmentId, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
7
import { describe, expect, it } from "vite-plus/test";
8
@@ -661,6 +662,33 @@ describe("buildHomeThreadGroups", () => {
662
);
663
});
664
665
+ it("includes a thread matched by message content", () => {
666
+ const environmentId = EnvironmentId.make("environment-1");
667
+ const project = makeProject({
668
+ environmentId,
669
+ id: ProjectId.make("project-1"),
670
+ title: "T3 Code",
671
+ });
672
+ const thread = makeThread({
673
+ environmentId,
674
+ id: ThreadId.make("thread-content"),
675
+ projectId: project.id,
676
+ title: "Unrelated title",
677
+ });
678
+
679
+ const groups = buildGroups([project], [thread], {
680
+ searchQuery: "relay reconnect",
681
+ matchedThreadKeys: new Set([
682
+ threadSearchMatchKey({
683
+ environmentId,
684
+ threadId: thread.id,
685
+ }),
686
+ ]),
687
+ });
688
+
689
+ expect(groups[0]?.threads.map((candidate) => candidate.id)).toEqual(["thread-content"]);
690
+ });
691
+
692
it("targets quick new threads at the group member with the newest thread", () => {
693
const laptopEnv = EnvironmentId.make("environment-laptop");
694
const desktopEnv = EnvironmentId.make("environment-desktop");
apps/mobile/src/features/home/homeThreadList.ts
+12
-1
@@ -12,6 +12,7 @@ import {
12
sortThreads,
13
toSortableTimestamp,
14
} from "@t3tools/client-runtime/state/thread-sort";
15
+import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
16
import type {
17
EnvironmentId,
18
ScopedProjectRef,
@@ -254,6 +255,7 @@ export function buildHomeThreadGroups(input: {
255
readonly pendingTasks?: ReadonlyArray<PendingNewTask>;
256
readonly environmentId: EnvironmentId | null;
257
readonly searchQuery: string;
258
+ readonly matchedThreadKeys?: ReadonlySet<string>;
259
readonly projectSortOrder: HomeProjectSortOrder;
260
readonly threadSortOrder: SidebarThreadSortOrder;
261
readonly projectGroupingMode: SidebarProjectGroupingMode;
@@ -350,7 +352,16 @@ export function buildHomeThreadGroups(input: {
352
group.projects.some((project) => project.title.toLocaleLowerCase().includes(query));
353
const matchingThreads = groupMatches
354
? group.threads
353
- : group.threads.filter((thread) => thread.title.toLocaleLowerCase().includes(query));
355
+ : group.threads.filter(
356
+ (thread) =>
357
+ thread.title.toLocaleLowerCase().includes(query) ||
358
+ input.matchedThreadKeys?.has(
359
+ threadSearchMatchKey({
360
+ environmentId: thread.environmentId,
361
+ threadId: thread.id,
362
+ }),
363
+ ) === true,
364
+ );
365
const matchingPendingTasks = groupMatches
366
? group.pendingTasks
367
: group.pendingTasks.filter((pendingTask) =>
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+73
-9
@@ -3,6 +3,10 @@ import type {
3
EnvironmentProject,
4
EnvironmentThreadShell,
5
} from "@t3tools/client-runtime/state/shell";
6
+import {
7
+ threadSearchMatchKey,
8
+ type EnvironmentThreadSearchMatch,
9
+} from "@t3tools/client-runtime/state/thread-search";
10
import { LegendList } from "@legendapp/list/react-native";
11
import type { MenuAction } from "@react-native-menu/menu";
12
import { useAtomValue } from "@effect/atom-react";
@@ -24,6 +28,7 @@ import { NativeStackScreenOptions } from "../../native/StackHeader";
28
import { scopedProjectKey, scopedThreadKey } from "../../lib/scopedEntities";
29
import { useThemeColor } from "../../lib/useThemeColor";
30
import { useProjects, useThreadShells } from "../../state/entities";
31
+import { useThreadSearch } from "../../state/queries";
32
import { useThreadListV2Enabled } from "./use-thread-list-v2-enabled";
33
import { environmentServerConfigsAtom } from "../../state/server";
34
import { usePendingNewTasks } from "../../state/use-pending-new-tasks";
@@ -180,7 +185,7 @@ function ThreadNavigationSidebarPane(
185
const colorScheme = useColorScheme() === "dark" ? "dark" : "light";
186
const projects = useProjects();
187
const threads = useThreadShells();
183
- const { state: catalogState } = useWorkspaceState();
188
+ const { environments: workspaceEnvironments, state: catalogState } = useWorkspaceState();
189
const { savedConnectionsById } = useSavedRemoteConnections();
190
const [headerIsOverContent, setHeaderIsOverContent] = useState(false);
191
const searchInputRef = useRef<TextInput>(null);
@@ -209,6 +214,35 @@ function ThreadNavigationSidebarPane(
214
);
215
const { options, setSelectedEnvironmentId, setProjectSortOrder, setThreadSortOrder } =
216
useHomeListOptions(availableEnvironmentIds);
217
+ const searchEnvironmentIds = useMemo(
218
+ () =>
219
+ options.selectedEnvironmentId === null
220
+ ? workspaceEnvironments
221
+ .filter((environment) => environment.connectionState === "connected")
222
+ .map((environment) => environment.environmentId)
223
+ : workspaceEnvironments.some(
224
+ (environment) =>
225
+ environment.environmentId === options.selectedEnvironmentId &&
226
+ environment.connectionState === "connected",
227
+ )
228
+ ? [options.selectedEnvironmentId]
229
+ : [],
230
+ [options.selectedEnvironmentId, workspaceEnvironments],
231
+ );
232
+ const threadSearch = useThreadSearch(searchEnvironmentIds, props.searchQuery);
233
+ const threadSearchMatchByKey = useMemo(() => {
234
+ const matches = new Map<string, EnvironmentThreadSearchMatch>();
235
+ for (const match of threadSearch.matches) {
236
+ if (match.source === "user" || match.source === "assistant") {
237
+ matches.set(threadSearchMatchKey(match), match);
238
+ }
239
+ }
240
+ return matches;
241
+ }, [threadSearch.matches]);
242
+ const matchedThreadKeys = useMemo(
243
+ () => new Set(threadSearch.matches.map(threadSearchMatchKey)),
244
+ [threadSearch.matches],
245
+ );
246
const [selectedProjectKey, setSelectedProjectKey] = useState<string | null>(null);
247
const projectScopes = useMemo(
248
() =>
@@ -305,11 +339,19 @@ function ThreadNavigationSidebarPane(
339
pendingTasks: scopedPendingTasks,
340
environmentId: options.selectedEnvironmentId,
341
searchQuery: props.searchQuery,
342
+ matchedThreadKeys,
343
projectSortOrder: options.projectSortOrder,
344
threadSortOrder: options.threadSortOrder,
345
projectGroupingMode: options.projectGroupingMode,
346
}),
312
- [options, props.searchQuery, scopedPendingTasks, scopedProjects, scopedThreads],
347
+ [
348
+ matchedThreadKeys,
349
+ options,
350
+ props.searchQuery,
351
+ scopedPendingTasks,
352
+ scopedProjects,
353
+ scopedThreads,
354
+ ],
355
);
356
const [groupDisplayStates, setGroupDisplayStates] = useState<
357
ReadonlyMap<string, HomeGroupDisplayState>
@@ -432,6 +474,7 @@ function ThreadNavigationSidebarPane(
474
environmentId: options.selectedEnvironmentId,
475
projectRefs: selectedProjectScope === null ? null : selectedProjectScope.projectRefs,
476
searchQuery: props.searchQuery,
477
+ matchedThreadKeys,
478
changeRequestStateByKey,
479
settlementEnvironmentIds,
480
snoozeEnvironmentIds,
@@ -445,6 +488,7 @@ function ThreadNavigationSidebarPane(
488
snoozeWakeTick,
489
options.selectedEnvironmentId,
490
props.searchQuery,
491
+ matchedThreadKeys,
492
settledVisibleCount,
493
settlementEnvironmentIds,
494
snoozeEnvironmentIds,
@@ -687,6 +731,7 @@ function ThreadNavigationSidebarPane(
731
projectTitleByProjectKey,
732
savedConnectionsById,
733
serverConfigs,
734
+ threadSearchMatchByKey,
735
}),
736
[
737
props.selectedThreadKey,
@@ -695,6 +740,7 @@ function ThreadNavigationSidebarPane(
740
projectTitleByProjectKey,
741
savedConnectionsById,
742
serverConfigs,
743
+ threadSearchMatchByKey,
744
],
745
);
746
const sidebarItemsAreEqual = useCallback(
@@ -797,6 +843,13 @@ function ThreadNavigationSidebarPane(
843
? (savedConnectionsById[thread.environmentId]?.environmentLabel ?? null)
844
: null
845
}
846
+ searchMatch={threadSearchMatchByKey.get(
847
+ threadSearchMatchKey({
848
+ environmentId: thread.environmentId,
849
+ threadId: thread.id,
850
+ }),
851
+ )}
852
+ searchQuery={props.searchQuery}
853
pane="sidebar"
854
selected={
855
scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
@@ -876,6 +929,13 @@ function ThreadNavigationSidebarPane(
929
null
930
}
931
isLast={item.isLast}
932
+ searchMatch={threadSearchMatchByKey.get(
933
+ threadSearchMatchKey({
934
+ environmentId: thread.environmentId,
935
+ threadId: thread.id,
936
+ }),
937
+ )}
938
+ searchQuery={props.searchQuery}
939
selected={
940
scopedThreadKey(thread.environmentId, thread.id) === props.selectedThreadKey
941
}
@@ -914,10 +974,12 @@ function ThreadNavigationSidebarPane(
974
projectCwdByKey,
975
projectTitleByProjectKey,
976
props.onNewThreadInProject,
977
+ props.searchQuery,
978
props.selectedThreadKey,
979
props.width,
980
savedConnectionsById,
981
serverConfigs,
982
+ threadSearchMatchByKey,
983
settleThread,
984
settlementEnvironmentIds,
985
showMoreSettled,
@@ -977,13 +1039,15 @@ function ThreadNavigationSidebarPane(
1039
{catalogState.isLoadingConnections
1040
? "Loading threads…"
1041
: props.searchQuery.trim().length > 0
980
- ? snoozedCount > 0
981
- ? // Snoozed matches passed this same search filter — "No
982
- // matching threads" would misreport them as nonexistent.
983
- snoozedCount === 1
984
- ? "1 matching thread snoozed"
985
- : "All matching threads snoozed"
986
- : "No matching threads"
1042
+ ? threadSearch.isPending && snoozedCount === 0
1043
+ ? "Searching thread messages…"
1044
+ : snoozedCount > 0
1045
+ ? // Snoozed matches passed this same search filter — "No
1046
+ // matching threads" would misreport them as nonexistent.
1047
+ snoozedCount === 1
1048
+ ? "1 matching thread snoozed"
1049
+ : "All matching threads snoozed"
1050
+ : "No matching threads"
1051
: snoozedCount > 0
1052
? snoozedCount === 1
1053
? "1 thread snoozed"
apps/mobile/src/features/threads/thread-list-items.tsx
+18
@@ -3,6 +3,7 @@ import type {
3
EnvironmentProject,
4
EnvironmentThreadShell,
5
} from "@t3tools/client-runtime/state/shell";
6
+import type { EnvironmentThreadSearchMatch } from "@t3tools/client-runtime/state/thread-search";
7
import type { MenuAction } from "@react-native-menu/menu";
8
import { SymbolView } from "../../components/AppSymbol";
9
import { memo, useCallback, useMemo, type ComponentProps } from "react";
@@ -21,6 +22,7 @@ import { useThreadPr, type ThreadPr } from "../../state/use-thread-pr";
22
import type { HomeGroupDisplayAction } from "../home/homeListItems";
23
import { ThreadSwipeable } from "../home/thread-swipe-actions";
24
import { resolveThreadStatus } from "./threadPresentation";
25
+import { ThreadSearchMatchExcerpt } from "./thread-search-match";
26
27
/**
28
* Shared presentation for the thread lists: the compact (phone) Home list and
@@ -416,6 +418,8 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
418
readonly thread: EnvironmentThreadShell;
419
readonly environmentLabel: string | null;
420
readonly projectCwd: string | null;
421
+ readonly searchMatch?: EnvironmentThreadSearchMatch;
422
+ readonly searchQuery?: string;
423
readonly isLast: boolean;
424
/** Sidebar only: the thread currently open in the detail pane. */
425
readonly selected?: boolean;
@@ -569,6 +573,13 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
573
/>
574
</View>
575
</View>
576
+ {props.searchMatch ? (
577
+ <ThreadSearchMatchExcerpt
578
+ compact
579
+ match={props.searchMatch}
580
+ query={props.searchQuery ?? ""}
581
+ />
582
+ ) : null}
583
{subtitleRow}
584
</View>
585
</View>
@@ -623,6 +634,13 @@ export const ThreadListRow = memo(function ThreadListRow(props: {
634
</Text>
635
</View>
636
</View>
637
+ {props.searchMatch ? (
638
+ <ThreadSearchMatchExcerpt
639
+ match={props.searchMatch}
640
+ query={props.searchQuery ?? ""}
641
+ selected={selected}
642
+ />
643
+ ) : null}
644
{subtitleRow}
645
</View>
646
</Pressable>
apps/mobile/src/features/threads/thread-list-v2-items.tsx
+31
-9
@@ -2,6 +2,7 @@ import type {
2
EnvironmentProject,
3
EnvironmentThreadShell,
4
} from "@t3tools/client-runtime/state/shell";
5
+import type { EnvironmentThreadSearchMatch } from "@t3tools/client-runtime/state/thread-search";
6
import type { MenuAction } from "@react-native-menu/menu";
7
import { memo, useCallback, useEffect, useMemo, type ComponentProps } from "react";
8
import { Platform, Pressable, useWindowDimensions, View } from "react-native";
@@ -18,6 +19,7 @@ import type { PendingNewTask } from "../../state/use-pending-new-tasks";
19
import { useThreadPr } from "../../state/use-thread-pr";
20
import { ThreadSwipeable } from "../home/thread-swipe-actions";
21
import { resolveThreadListV2Status, type ThreadListV2Status } from "./threadListV2";
22
+import { ThreadSearchMatchExcerpt } from "./thread-search-match";
23
24
/**
25
* Thread List v2 renders one flat native list: rich edge-to-edge rows for
@@ -243,6 +245,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
245
state: "open" | "closed" | "merged" | null,
246
) => void;
247
readonly projectCwd?: string | null;
248
+ readonly searchMatch?: EnvironmentThreadSearchMatch;
249
+ readonly searchQuery?: string;
250
readonly simultaneousSwipeGesture?: ComponentProps<
251
typeof ThreadSwipeable
252
>["simultaneousWithExternalGesture"];
@@ -369,6 +373,15 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
373
>
374
{thread.title}
375
</Text>
376
+ {props.searchMatch ? (
377
+ <View className="mt-1">
378
+ <ThreadSearchMatchExcerpt
379
+ match={props.searchMatch}
380
+ query={props.searchQuery ?? ""}
381
+ selected={selected}
382
+ />
383
+ </View>
384
+ ) : null}
385
<View className="mt-1 flex-row items-center gap-2">
386
{status === "failed" && thread.session?.lastError ? (
387
<Text
@@ -517,15 +530,24 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
530
/>
531
</View>
532
) : null}
520
- <Text
521
- className={cn(
522
- "flex-1 text-base",
523
- selected ? "text-user-bubble-foreground" : "text-foreground-muted",
524
- )}
525
- numberOfLines={1}
526
- >
527
- {thread.title}
528
- </Text>
533
+ <View className="min-w-0 flex-1">
534
+ <Text
535
+ className={cn(
536
+ "text-base",
537
+ selected ? "text-user-bubble-foreground" : "text-foreground-muted",
538
+ )}
539
+ numberOfLines={1}
540
+ >
541
+ {thread.title}
542
+ </Text>
543
+ {props.searchMatch ? (
544
+ <ThreadSearchMatchExcerpt
545
+ match={props.searchMatch}
546
+ query={props.searchQuery ?? ""}
547
+ selected={selected}
548
+ />
549
+ ) : null}
550
+ </View>
551
<Text
552
className={cn(
553
"text-sm tabular-nums",
apps/mobile/src/features/threads/thread-search-match.tsx
new
+92
@@ -0,0 +1,92 @@
1
+import type { EnvironmentThreadSearchMatch } from "@t3tools/client-runtime/state/thread-search";
2
+
3
+import { AppText as Text } from "../../components/AppText";
4
+import { cn } from "../../lib/cn";
5
+
6
+function foldAsciiCase(value: string): string {
7
+ return value.replace(/[A-Z]/g, (character) => character.toLowerCase());
8
+}
9
+
10
+function splitHighlightParts(text: string, query: string) {
11
+ const normalizedText = foldAsciiCase(text);
12
+ const normalizedQuery = foldAsciiCase(query.trim());
13
+ if (normalizedQuery.length === 0) {
14
+ return [{ text, highlighted: false, start: 0 }];
15
+ }
16
+
17
+ const parts: Array<{
18
+ readonly text: string;
19
+ readonly highlighted: boolean;
20
+ readonly start: number;
21
+ }> = [];
22
+ let cursor = 0;
23
+ while (cursor < text.length) {
24
+ const matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
25
+ if (matchIndex === -1) {
26
+ parts.push({ text: text.slice(cursor), highlighted: false, start: cursor });
27
+ break;
28
+ }
29
+ if (matchIndex > cursor) {
30
+ parts.push({
31
+ text: text.slice(cursor, matchIndex),
32
+ highlighted: false,
33
+ start: cursor,
34
+ });
35
+ }
36
+ parts.push({
37
+ text: text.slice(matchIndex, matchIndex + normalizedQuery.length),
38
+ highlighted: true,
39
+ start: matchIndex,
40
+ });
41
+ cursor = matchIndex + normalizedQuery.length;
42
+ }
43
+ return parts;
44
+}
45
+
46
+export function ThreadSearchMatchExcerpt(props: {
47
+ readonly match: EnvironmentThreadSearchMatch;
48
+ readonly query: string;
49
+ readonly selected?: boolean;
50
+ readonly compact?: boolean;
51
+}) {
52
+ const isUser = props.match.source === "user";
53
+ const parts = splitHighlightParts(props.match.snippet, props.query);
54
+ return (
55
+ <Text
56
+ className={cn(
57
+ props.compact ? "text-sm" : "text-xs",
58
+ props.selected ? "text-user-bubble-foreground-muted" : "text-foreground-muted",
59
+ )}
60
+ numberOfLines={1}
61
+ >
62
+ <Text
63
+ className={cn(
64
+ props.compact ? "text-sm font-t3-medium" : "text-xs font-t3-medium",
65
+ props.selected
66
+ ? "text-user-bubble-foreground"
67
+ : isUser
68
+ ? "text-blue-500 dark:text-blue-400"
69
+ : "text-emerald-600 dark:text-emerald-400",
70
+ )}
71
+ >
72
+ {isUser ? "You:" : "Agent:"}{" "}
73
+ </Text>
74
+ {parts.map((part) => (
75
+ <Text
76
+ className={cn(
77
+ props.compact ? "text-sm" : "text-xs",
78
+ part.highlighted && "font-t3-bold",
79
+ props.selected
80
+ ? "text-user-bubble-foreground"
81
+ : part.highlighted
82
+ ? "text-foreground"
83
+ : "text-foreground-muted",
84
+ )}
85
+ key={part.start}
86
+ >
87
+ {part.text}
88
+ </Text>
89
+ ))}
90
+ </Text>
91
+ );
92
+}
apps/mobile/src/features/threads/threadListV2.test.ts
+22
@@ -1,4 +1,5 @@
1
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
2
+import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
3
import {
4
CommandId,
5
EnvironmentId,
@@ -263,6 +264,27 @@ describe("buildThreadListV2Items", () => {
264
]);
265
});
266
267
+ it("includes a thread matched by message content", () => {
268
+ const thread = makeThread({
269
+ id: ThreadId.make("content-match"),
270
+ title: "Unrelated title",
271
+ });
272
+ const { items } = buildThreadListV2Items({
273
+ threads: [thread],
274
+ environmentId: null,
275
+ searchQuery: "relay reconnect",
276
+ matchedThreadKeys: new Set([
277
+ threadSearchMatchKey({
278
+ environmentId,
279
+ threadId: thread.id,
280
+ }),
281
+ ]),
282
+ now: NOW,
283
+ });
284
+
285
+ expect(items.map((item) => item.thread.id)).toEqual(["content-match"]);
286
+ });
287
+
288
it("scopes the flat list to one project", () => {
289
const otherProjectId = ProjectId.make("project-2");
290
const { items } = buildThreadListV2Items({
apps/mobile/src/features/threads/threadListV2.ts
+14
-1
@@ -1,5 +1,6 @@
1
import { effectiveSettled, effectiveSnoozed } from "@t3tools/client-runtime/state/thread-settled";
2
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
3
+import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
4
import type { EnvironmentId, ProjectId } from "@t3tools/contracts";
5
6
import type { PendingNewTask } from "../../state/use-pending-new-tasks";
@@ -183,6 +184,7 @@ export function buildThreadListV2Items(input: {
184
readonly projectId: ProjectId;
185
}> | null;
186
readonly searchQuery: string;
187
+ readonly matchedThreadKeys?: ReadonlySet<string>;
188
/** Per-row PR state reported up by visible rows ("env:threadId" keys). */
189
readonly changeRequestStateByKey?: ReadonlyMap<string, "open" | "closed" | "merged">;
190
/** Environments whose server supports thread.settle/unsettle. Threads on
@@ -222,7 +224,18 @@ export function buildThreadListV2Items(input: {
224
if (projectKeys !== null && !projectKeys.has(`${thread.environmentId}:${thread.projectId}`)) {
225
continue;
226
}
225
- if (query.length > 0 && !thread.title.toLocaleLowerCase().includes(query)) continue;
227
+ if (
228
+ query.length > 0 &&
229
+ !thread.title.toLocaleLowerCase().includes(query) &&
230
+ input.matchedThreadKeys?.has(
231
+ threadSearchMatchKey({
232
+ environmentId: thread.environmentId,
233
+ threadId: thread.id,
234
+ }),
235
+ ) !== true
236
+ ) {
237
+ continue;
238
+ }
239
const supportsSettlement = input.settlementEnvironmentIds?.has(thread.environmentId) ?? true;
240
const supportsSnooze = input.snoozeEnvironmentIds?.has(thread.environmentId) ?? true;
241
const changeRequestState =
apps/mobile/src/state/queries.ts
+47
@@ -1,5 +1,12 @@
1
import type { EnvironmentId, OrchestrationThread, ThreadId } from "@t3tools/contracts";
2
+import {
3
+ createThreadSearchResultsAtomFamily,
4
+ makeThreadSearchKey,
5
+ type EnvironmentThreadSearchMatch,
6
+} from "@t3tools/client-runtime/state/thread-search";
7
+import { useAtomValue } from "@effect/atom-react";
8
import * as Option from "effect/Option";
9
+import { Atom } from "effect/unstable/reactivity";
10
import { useEffect, useMemo, useState } from "react";
11
12
import { orchestrationEnvironment } from "./orchestration";
@@ -15,7 +22,22 @@ import {
22
23
const COMPOSER_PATH_SEARCH_DEBOUNCE_MS = 200;
24
const COMPOSER_PATH_SEARCH_LIMIT = 20;
25
+const THREAD_SEARCH_DEBOUNCE_MS = 200;
26
const VCS_REF_LIST_LIMIT = 100;
27
+const EMPTY_THREAD_SEARCH_MATCHES: ReadonlyArray<EnvironmentThreadSearchMatch> = Object.freeze([]);
28
+const EMPTY_THREAD_SEARCH_ATOM = Atom.make({
29
+ matches: EMPTY_THREAD_SEARCH_MATCHES,
30
+ isLoading: false,
31
+}).pipe(Atom.withLabel("mobile:thread-search:empty"));
32
+
33
+const threadSearchResultsAtom = createThreadSearchResultsAtomFamily({
34
+ getSearchAtom: (environmentId, query) =>
35
+ orchestrationEnvironment.threadSearch({
36
+ environmentId,
37
+ input: { query },
38
+ }),
39
+ labelPrefix: "mobile:thread-search",
40
+});
41
42
export interface ThreadDetailView {
43
readonly data: OrchestrationThread | null;
@@ -45,6 +67,31 @@ function useDebouncedValue<A>(value: A, delayMs: number): A {
67
return debounced;
68
}
69
70
+export function useThreadSearch(
71
+ environmentIds: ReadonlyArray<EnvironmentId>,
72
+ query: string,
73
+): {
74
+ readonly matches: ReadonlyArray<EnvironmentThreadSearchMatch>;
75
+ readonly isPending: boolean;
76
+} {
77
+ const normalizedQuery = query.trim();
78
+ const debouncedQuery = useDebouncedValue(normalizedQuery, THREAD_SEARCH_DEBOUNCE_MS);
79
+ const canSearch = environmentIds.length > 0 && normalizedQuery.length >= 2;
80
+ const settledQuery = canSearch && normalizedQuery === debouncedQuery ? debouncedQuery : null;
81
+ const searchKey = useMemo(
82
+ () => (settledQuery === null ? null : makeThreadSearchKey(environmentIds, settledQuery)),
83
+ [environmentIds, settledQuery],
84
+ );
85
+ const result = useAtomValue(
86
+ searchKey === null ? EMPTY_THREAD_SEARCH_ATOM : threadSearchResultsAtom(searchKey),
87
+ );
88
+ const isDebouncing = canSearch && normalizedQuery !== debouncedQuery;
89
+ return {
90
+ matches: isDebouncing ? EMPTY_THREAD_SEARCH_MATCHES : result.matches,
91
+ isPending: canSearch && (isDebouncing || result.isLoading),
92
+ };
93
+}
94
+
95
export function useThreadDetail(
96
environmentId: EnvironmentId | null,
97
threadId: ThreadId | null,
apps/server/src/auth/RpcAuthorization.ts
+1
@@ -24,6 +24,7 @@ export const RPC_REQUIRED_SCOPES = {
24
[ORCHESTRATION_WS_METHODS.dispatchCommand]: AuthOrchestrationOperateScope,
25
[ORCHESTRATION_WS_METHODS.getTurnDiff]: AuthOrchestrationReadScope,
26
[ORCHESTRATION_WS_METHODS.getFullThreadDiff]: AuthOrchestrationReadScope,
27
+ [ORCHESTRATION_WS_METHODS.searchThreads]: AuthOrchestrationReadScope,
28
[ORCHESTRATION_WS_METHODS.subscribeShell]: AuthOrchestrationReadScope,
29
[ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot]: AuthOrchestrationReadScope,
30
[ORCHESTRATION_WS_METHODS.subscribeThread]: AuthOrchestrationReadScope,
apps/server/src/checkpointing/CheckpointDiffQuery.test.ts
+5
@@ -108,6 +108,7 @@ describe("CheckpointDiffQuery.layer", () => {
108
getThreadShellById: () => Effect.succeed(Option.none()),
109
getThreadDetailById: () => Effect.succeed(Option.none()),
110
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
111
+ searchThreads: () => Effect.succeed({ matches: [] }),
112
}),
113
),
114
);
@@ -201,6 +202,7 @@ describe("CheckpointDiffQuery.layer", () => {
202
getThreadShellById: () => Effect.succeed(Option.none()),
203
getThreadDetailById: () => Effect.succeed(Option.none()),
204
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
205
+ searchThreads: () => Effect.succeed({ matches: [] }),
206
}),
207
),
208
);
@@ -284,6 +286,7 @@ describe("CheckpointDiffQuery.layer", () => {
286
getThreadShellById: () => Effect.succeed(Option.none()),
287
getThreadDetailById: () => Effect.succeed(Option.none()),
288
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
289
+ searchThreads: () => Effect.succeed({ matches: [] }),
290
}),
291
),
292
);
@@ -352,6 +355,7 @@ describe("CheckpointDiffQuery.layer", () => {
355
getThreadShellById: () => Effect.succeed(Option.none()),
356
getThreadDetailById: () => Effect.succeed(Option.none()),
357
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
358
+ searchThreads: () => Effect.succeed({ matches: [] }),
359
}),
360
),
361
);
@@ -405,6 +409,7 @@ describe("CheckpointDiffQuery.layer", () => {
409
getThreadShellById: () => Effect.succeed(Option.none()),
410
getThreadDetailById: () => Effect.succeed(Option.none()),
411
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
412
+ searchThreads: () => Effect.succeed({ matches: [] }),
413
}),
414
),
415
);
apps/server/src/orchestration/Layers/OrchestrationEngine.test.ts
+1
@@ -203,6 +203,7 @@ describe("OrchestrationEngine", () => {
203
getThreadShellById: () => Effect.succeed(Option.none()),
204
getThreadDetailById: () => Effect.succeed(Option.none()),
205
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
206
+ searchThreads: () => Effect.succeed({ matches: [] }),
207
}),
208
),
209
Layer.provide(
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts
+265
@@ -1551,6 +1551,271 @@ projectionSnapshotLayer("ProjectionSnapshotQuery", (it) => {
1551
assert.equal(shellSnapshot.threads.length, 0);
1552
}),
1553
);
1554
+
1555
+ it.effect("searches active user messages and canonical assistant outputs", () =>
1556
+ Effect.gen(function* () {
1557
+ const snapshotQuery = yield* ProjectionSnapshotQuery;
1558
+ const sql = yield* SqlClient.SqlClient;
1559
+
1560
+ yield* sql`DELETE FROM projection_thread_messages`;
1561
+ yield* sql`DELETE FROM projection_turns`;
1562
+ yield* sql`DELETE FROM projection_threads`;
1563
+ yield* sql`DELETE FROM projection_projects`;
1564
+
1565
+ yield* sql`
1566
+ INSERT INTO projection_projects (
1567
+ project_id,
1568
+ title,
1569
+ workspace_root,
1570
+ default_model_selection_json,
1571
+ scripts_json,
1572
+ created_at,
1573
+ updated_at,
1574
+ deleted_at
1575
+ )
1576
+ VALUES (
1577
+ 'project-search',
1578
+ 'Project Needle',
1579
+ '/tmp/project-search',
1580
+ '{"provider":"codex","model":"gpt-5-codex"}',
1581
+ '[]',
1582
+ '2026-05-01T00:00:00.000Z',
1583
+ '2026-05-01T00:00:01.000Z',
1584
+ NULL
1585
+ )
1586
+ `;
1587
+
1588
+ yield* sql`
1589
+ INSERT INTO projection_threads (
1590
+ thread_id,
1591
+ project_id,
1592
+ title,
1593
+ model_selection_json,
1594
+ runtime_mode,
1595
+ interaction_mode,
1596
+ branch,
1597
+ worktree_path,
1598
+ latest_turn_id,
1599
+ latest_user_message_at,
1600
+ pending_approval_count,
1601
+ pending_user_input_count,
1602
+ has_actionable_proposed_plan,
1603
+ created_at,
1604
+ updated_at,
1605
+ archived_at,
1606
+ deleted_at
1607
+ )
1608
+ VALUES
1609
+ (
1610
+ 'thread-active',
1611
+ 'project-search',
1612
+ 'Literal 100% fix',
1613
+ '{"provider":"codex","model":"gpt-5-codex"}',
1614
+ 'full-access',
1615
+ 'default',
1616
+ 'search-branch',
1617
+ NULL,
1618
+ 'turn-active',
1619
+ '2026-05-01T00:00:02.000Z',
1620
+ 0,
1621
+ 0,
1622
+ 0,
1623
+ '2026-05-01T00:00:02.000Z',
1624
+ '2026-05-01T00:00:03.000Z',
1625
+ NULL,
1626
+ NULL
1627
+ ),
1628
+ (
1629
+ 'thread-percent-decoy',
1630
+ 'project-search',
1631
+ 'Literal 100x fix',
1632
+ '{"provider":"codex","model":"gpt-5-codex"}',
1633
+ 'full-access',
1634
+ 'default',
1635
+ NULL,
1636
+ NULL,
1637
+ NULL,
1638
+ NULL,
1639
+ 0,
1640
+ 0,
1641
+ 0,
1642
+ '2026-05-01T00:00:04.000Z',
1643
+ '2026-05-01T00:00:05.000Z',
1644
+ NULL,
1645
+ NULL
1646
+ ),
1647
+ (
1648
+ 'thread-hidden',
1649
+ 'project-search',
1650
+ 'Archived search',
1651
+ '{"provider":"codex","model":"gpt-5-codex"}',
1652
+ 'full-access',
1653
+ 'default',
1654
+ NULL,
1655
+ NULL,
1656
+ NULL,
1657
+ NULL,
1658
+ 0,
1659
+ 0,
1660
+ 0,
1661
+ '2026-05-01T00:00:06.000Z',
1662
+ '2026-05-01T00:00:07.000Z',
1663
+ '2026-05-01T00:00:08.000Z',
1664
+ NULL
1665
+ )
1666
+ `;
1667
+
1668
+ yield* sql`
1669
+ INSERT INTO projection_thread_messages (
1670
+ message_id,
1671
+ thread_id,
1672
+ turn_id,
1673
+ role,
1674
+ text,
1675
+ is_streaming,
1676
+ created_at,
1677
+ updated_at
1678
+ )
1679
+ VALUES
1680
+ (
1681
+ 'message-user',
1682
+ 'thread-active',
1683
+ 'turn-active',
1684
+ 'user',
1685
+ 'Please find this USER needle in an old prompt.',
1686
+ 0,
1687
+ '2026-05-01T00:00:12.000Z',
1688
+ '2026-05-01T00:00:12.000Z'
1689
+ ),
1690
+ (
1691
+ 'message-percent',
1692
+ 'thread-active',
1693
+ NULL,
1694
+ 'user',
1695
+ 'Literal 100% fix in a prompt.',
1696
+ 0,
1697
+ '2026-05-01T00:00:11.000Z',
1698
+ '2026-05-01T00:00:11.000Z'
1699
+ ),
1700
+ (
1701
+ 'message-percent-decoy',
1702
+ 'thread-percent-decoy',
1703
+ NULL,
1704
+ 'user',
1705
+ 'Literal 100x fix in a prompt.',
1706
+ 0,
1707
+ '2026-05-01T00:00:11.000Z',
1708
+ '2026-05-01T00:00:11.000Z'
1709
+ ),
1710
+ (
1711
+ 'message-final',
1712
+ 'thread-active',
1713
+ 'turn-active',
1714
+ 'assistant',
1715
+ 'The canonical final needle appears in this completed answer.',
1716
+ 0,
1717
+ '2026-05-01T00:00:13.000Z',
1718
+ '2026-05-01T00:00:13.000Z'
1719
+ ),
1720
+ (
1721
+ 'message-interim',
1722
+ 'thread-active',
1723
+ 'turn-active',
1724
+ 'assistant',
1725
+ 'Interim needle must not be searchable.',
1726
+ 0,
1727
+ '2026-05-01T00:00:14.000Z',
1728
+ '2026-05-01T00:00:14.000Z'
1729
+ ),
1730
+ (
1731
+ 'message-system',
1732
+ 'thread-active',
1733
+ NULL,
1734
+ 'system',
1735
+ 'System needle must not be searchable.',
1736
+ 0,
1737
+ '2026-05-01T00:00:15.000Z',
1738
+ '2026-05-01T00:00:15.000Z'
1739
+ ),
1740
+ (
1741
+ 'message-hidden',
1742
+ 'thread-hidden',
1743
+ NULL,
1744
+ 'user',
1745
+ 'Hidden needle in archive.',
1746
+ 0,
1747
+ '2026-05-01T00:00:16.000Z',
1748
+ '2026-05-01T00:00:16.000Z'
1749
+ )
1750
+ `;
1751
+
1752
+ yield* sql`
1753
+ INSERT INTO projection_turns (
1754
+ thread_id,
1755
+ turn_id,
1756
+ pending_message_id,
1757
+ assistant_message_id,
1758
+ state,
1759
+ requested_at,
1760
+ started_at,
1761
+ completed_at,
1762
+ checkpoint_files_json
1763
+ )
1764
+ VALUES (
1765
+ 'thread-active',
1766
+ 'turn-active',
1767
+ 'message-user',
1768
+ 'message-final',
1769
+ 'completed',
1770
+ '2026-05-01T00:00:12.000Z',
1771
+ '2026-05-01T00:00:12.000Z',
1772
+ '2026-05-01T00:00:13.000Z',
1773
+ '[]'
1774
+ )
1775
+ `;
1776
+
1777
+ const literalPercent = yield* snapshotQuery.searchThreads({ query: "100%" });
1778
+ assert.deepStrictEqual(
1779
+ literalPercent.matches.map((match) => [match.threadId, match.source]),
1780
+ [[ThreadId.make("thread-active"), "user"]],
1781
+ );
1782
+
1783
+ const user = yield* snapshotQuery.searchThreads({ query: "user needle" });
1784
+ assert.equal(user.matches[0]?.source, "user");
1785
+ assert.match(user.matches[0]?.snippet ?? "", /USER needle/);
1786
+
1787
+ const assistant = yield* snapshotQuery.searchThreads({ query: "FINAL NEEDLE" });
1788
+ assert.equal(assistant.matches[0]?.source, "assistant");
1789
+
1790
+ const deduped = yield* snapshotQuery.searchThreads({ query: "needle" });
1791
+ assert.deepStrictEqual(
1792
+ deduped.matches.map((match) => [match.threadId, match.source]),
1793
+ [[ThreadId.make("thread-active"), "user"]],
1794
+ );
1795
+
1796
+ assert.deepStrictEqual(
1797
+ (yield* snapshotQuery.searchThreads({ query: "interim needle" })).matches,
1798
+ [],
1799
+ );
1800
+ assert.deepStrictEqual(
1801
+ (yield* snapshotQuery.searchThreads({ query: "system needle" })).matches,
1802
+ [],
1803
+ );
1804
+ assert.deepStrictEqual(
1805
+ (yield* snapshotQuery.searchThreads({ query: "hidden needle" })).matches,
1806
+ [],
1807
+ );
1808
+ yield* sql`
1809
+ UPDATE projection_threads
1810
+ SET deleted_at = '2026-05-01T00:00:20.000Z'
1811
+ WHERE thread_id = 'thread-active'
1812
+ `;
1813
+ assert.deepStrictEqual(
1814
+ (yield* snapshotQuery.searchThreads({ query: "user needle" })).matches,
1815
+ [],
1816
+ );
1817
+ }),
1818
+ );
1819
});
1820
1821
it.effect(
apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.ts
+132
@@ -7,6 +7,7 @@ import {
7
OrchestrationCheckpointFile,
8
OrchestrationProposedPlanId,
9
OrchestrationReadModel,
10
+ OrchestrationThreadSearchSource,
11
OrchestrationShellSnapshot,
12
OrchestrationThread,
13
OrchestrationThreadDetailSnapshot,
@@ -108,6 +109,17 @@ const ProjectionCountsRowSchema = Schema.Struct({
109
projectCount: Schema.Number,
110
threadCount: Schema.Number,
111
});
112
+const ProjectionThreadSearchRequest = Schema.Struct({
113
+ pattern: Schema.String,
114
+ limit: Schema.Int,
115
+});
116
+const ProjectionThreadSearchRow = Schema.Struct({
117
+ threadId: ThreadId,
118
+ projectId: ProjectId,
119
+ source: OrchestrationThreadSearchSource,
120
+ matchText: Schema.String,
121
+ messageCreatedAt: Schema.NullOr(IsoDateTime),
122
+});
123
const WorkspaceRootLookupInput = Schema.Struct({
124
workspaceRoot: Schema.String,
125
});
@@ -157,6 +169,31 @@ function maxIso(left: string | null, right: string): string {
169
return left > right ? left : right;
170
}
171
172
+function escapeLikePattern(value: string): string {
173
+ return value.replaceAll("!", "!!").replaceAll("%", "!%").replaceAll("_", "!_");
174
+}
175
+
176
+function foldAsciiCase(value: string): string {
177
+ return value.replace(/[A-Z]/g, (character) => character.toLowerCase());
178
+}
179
+
180
+function buildSearchSnippet(text: string, query: string): string {
181
+ const normalizedText = text.replace(/\s+/g, " ").trim();
182
+ if (normalizedText.length <= 240) {
183
+ return normalizedText;
184
+ }
185
+
186
+ const normalizedQuery = foldAsciiCase(query.replace(/\s+/g, " ").trim());
187
+ const matchIndex = foldAsciiCase(normalizedText).indexOf(normalizedQuery);
188
+ const bodyLength = 236;
189
+ const idealStart = Math.max(0, matchIndex - 72);
190
+ const start = Math.min(idealStart, normalizedText.length - bodyLength);
191
+ const end = Math.min(normalizedText.length, start + bodyLength);
192
+ return `${start > 0 ? "…" : ""}${normalizedText.slice(start, end)}${
193
+ end < normalizedText.length ? "…" : ""
194
+ }`;
195
+}
196
+
197
function computeSnapshotSequence(
198
stateRows: ReadonlyArray<Schema.Schema.Type<typeof ProjectionStateDbRowSchema>>,
199
): number {
@@ -685,6 +722,74 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
722
`,
723
});
724
725
+ const searchActiveThreadRows = SqlSchema.findAll({
726
+ Request: ProjectionThreadSearchRequest,
727
+ Result: ProjectionThreadSearchRow,
728
+ execute: ({ pattern, limit }) =>
729
+ sql`
730
+ WITH ranked AS (
731
+ SELECT
732
+ threads.thread_id AS thread_id,
733
+ threads.project_id AS project_id,
734
+ CASE messages.role
735
+ WHEN 'user' THEN 'user'
736
+ ELSE 'assistant'
737
+ END AS source,
738
+ messages.text AS match_text,
739
+ messages.created_at AS message_created_at,
740
+ CASE messages.role
741
+ WHEN 'user' THEN 0
742
+ ELSE 1
743
+ END AS match_rank,
744
+ threads.updated_at AS thread_updated_at,
745
+ ROW_NUMBER() OVER (
746
+ PARTITION BY threads.thread_id
747
+ ORDER BY
748
+ CASE messages.role
749
+ WHEN 'user' THEN 0
750
+ ELSE 1
751
+ END ASC,
752
+ messages.created_at DESC,
753
+ messages.message_id ASC
754
+ ) AS thread_match_rank
755
+ FROM projection_thread_messages AS messages
756
+ INNER JOIN projection_threads AS threads
757
+ ON threads.thread_id = messages.thread_id
758
+ INNER JOIN projection_projects AS projects
759
+ ON projects.project_id = threads.project_id
760
+ WHERE threads.deleted_at IS NULL
761
+ AND threads.archived_at IS NULL
762
+ AND projects.deleted_at IS NULL
763
+ AND messages.is_streaming = 0
764
+ AND (
765
+ messages.role = 'user'
766
+ OR (
767
+ messages.role = 'assistant'
768
+ AND messages.message_id IN (
769
+ SELECT turns.assistant_message_id
770
+ FROM projection_turns AS turns
771
+ WHERE turns.assistant_message_id IS NOT NULL
772
+ )
773
+ )
774
+ )
775
+ AND messages.text LIKE ${pattern} ESCAPE '!'
776
+ )
777
+ SELECT
778
+ thread_id AS "threadId",
779
+ project_id AS "projectId",
780
+ source,
781
+ match_text AS "matchText",
782
+ message_created_at AS "messageCreatedAt"
783
+ FROM ranked
784
+ WHERE thread_match_rank = 1
785
+ ORDER BY
786
+ match_rank ASC,
787
+ thread_updated_at DESC,
788
+ thread_id ASC
789
+ LIMIT ${limit}
790
+ `,
791
+ });
792
+
793
const getActiveProjectRowByWorkspaceRoot = SqlSchema.findOneOption({
794
Request: WorkspaceRootLookupInput,
795
Result: ProjectionProjectLookupRowSchema,
@@ -1758,6 +1863,32 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
1863
),
1864
);
1865
1866
+ const searchThreads: ProjectionSnapshotQueryShape["searchThreads"] = Effect.fn(
1867
+ "ProjectionSnapshotQuery.searchThreads",
1868
+ )(function* (input) {
1869
+ const escapedQuery = escapeLikePattern(input.query);
1870
+ const rows = yield* searchActiveThreadRows({
1871
+ pattern: `%${escapedQuery}%`,
1872
+ limit: input.limit ?? 50,
1873
+ }).pipe(
1874
+ Effect.mapError(
1875
+ toPersistenceSqlOrDecodeError(
1876
+ "ProjectionSnapshotQuery.searchThreads:query",
1877
+ "ProjectionSnapshotQuery.searchThreads:decodeRows",
1878
+ ),
1879
+ ),
1880
+ );
1881
+ return {
1882
+ matches: rows.map((row) => ({
1883
+ threadId: row.threadId,
1884
+ projectId: row.projectId,
1885
+ source: row.source,
1886
+ snippet: buildSearchSnippet(row.matchText, input.query),
1887
+ messageCreatedAt: row.messageCreatedAt,
1888
+ })),
1889
+ };
1890
+ });
1891
+
1892
const getActiveProjectByWorkspaceRoot: ProjectionSnapshotQueryShape["getActiveProjectByWorkspaceRoot"] =
1893
(workspaceRoot) =>
1894
getActiveProjectRowByWorkspaceRoot({ workspaceRoot }).pipe(
@@ -2131,6 +2262,7 @@ const makeProjectionSnapshotQuery = Effect.gen(function* () {
2262
getSnapshot,
2263
getShellSnapshot,
2264
getArchivedShellSnapshot,
2265
+ searchThreads,
2266
getSnapshotSequence,
2267
getCounts,
2268
getActiveProjectByWorkspaceRoot,
apps/server/src/orchestration/Services/ProjectionSnapshotQuery.ts
+10
@@ -12,6 +12,8 @@ import type {
12
OrchestrationProject,
13
OrchestrationProjectShell,
14
OrchestrationReadModel,
15
+ OrchestrationSearchThreadsInput,
16
+ OrchestrationSearchThreadsResult,
17
OrchestrationShellSnapshot,
18
OrchestrationThread,
19
OrchestrationThreadDetailSnapshot,
@@ -94,6 +96,14 @@ export interface ProjectionSnapshotQueryShape {
96
ProjectionRepositoryError
97
>;
98
99
+ /**
100
+ * Search active thread navigation metadata, user messages, and canonical
101
+ * assistant outputs without hydrating thread detail snapshots.
102
+ */
103
+ readonly searchThreads: (
104
+ input: OrchestrationSearchThreadsInput,
105
+ ) => Effect.Effect<OrchestrationSearchThreadsResult, ProjectionRepositoryError>;
106
+
107
/**
108
* Read the latest projection snapshot sequence without hydrating read-model
109
* entities.
apps/server/src/project/ProjectSetupScriptRunner.test.ts
+1
@@ -44,6 +44,7 @@ const makeProjectionSnapshotQueryLayer = (project: OrchestrationProject) =>
44
getThreadShellById: () => Effect.die("unused"),
45
getThreadDetailById: () => Effect.die("unused"),
46
getThreadDetailSnapshot: () => Effect.die("unused"),
47
+ searchThreads: () => Effect.succeed({ matches: [] }),
48
});
49
50
const makeTerminalManagerLayer = (
apps/server/src/provider/Layers/ProviderSessionReaper.test.ts
+1
@@ -212,6 +212,7 @@ describe("ProviderSessionReaper", () => {
212
),
213
getThreadDetailById: () => Effect.die("unused"),
214
getThreadDetailSnapshot: () => Effect.die("unused"),
215
+ searchThreads: () => Effect.succeed({ matches: [] }),
216
}),
217
),
218
Layer.provideMerge(NodeServices.layer),
apps/server/src/server.test.ts
+30
@@ -729,6 +729,7 @@ const buildAppUnderTest = (options?: {
729
threads: [],
730
updatedAt: "1970-01-01T00:00:00.000Z",
731
}),
732
+ searchThreads: () => Effect.succeed({ matches: [] }),
733
getSnapshotSequence: () => Effect.succeed({ snapshotSequence: 0 }),
734
getProjectShellById: () => Effect.succeed(Option.none()),
735
getThreadShellById: () => Effect.succeed(Option.none()),
@@ -5723,6 +5724,18 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
5724
layers: {
5725
projectionSnapshotQuery: {
5726
getSnapshot: () => Effect.succeed(snapshot),
5727
+ searchThreads: () =>
5728
+ Effect.succeed({
5729
+ matches: [
5730
+ {
5731
+ threadId: ThreadId.make("thread-1"),
5732
+ projectId: ProjectId.make("project-a"),
5733
+ source: "assistant",
5734
+ snippet: "Search reached the final response.",
5735
+ messageCreatedAt: now,
5736
+ },
5737
+ ],
5738
+ }),
5739
},
5740
orchestrationEngine: {
5741
dispatch: () => Effect.succeed({ sequence: 7 }),
@@ -5780,6 +5793,23 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
5793
),
5794
);
5795
assert.equal(fullDiffResult.diff, "full-diff");
5796
+
5797
+ const searchResult = yield* Effect.scoped(
5798
+ withWsRpcClient(wsUrl, (client) =>
5799
+ client[ORCHESTRATION_WS_METHODS.searchThreads]({
5800
+ query: "final response",
5801
+ }),
5802
+ ),
5803
+ );
5804
+ assert.deepEqual(searchResult.matches, [
5805
+ {
5806
+ threadId: ThreadId.make("thread-1"),
5807
+ projectId: ProjectId.make("project-a"),
5808
+ source: "assistant",
5809
+ snippet: "Search reached the final response.",
5810
+ messageCreatedAt: now,
5811
+ },
5812
+ ]);
5813
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
5814
);
5815
apps/server/src/serverRuntimeStartup.test.ts
+4
@@ -97,6 +97,7 @@ it.effect("launchStartupHeartbeat does not block the caller while counts are loa
97
getThreadShellById: () => Effect.succeed(Option.none()),
98
getThreadDetailById: () => Effect.succeed(Option.none()),
99
getThreadDetailSnapshot: () => Effect.succeed(Option.none()),
100
+ searchThreads: () => Effect.succeed({ matches: [] }),
101
}),
102
Effect.provideService(AnalyticsService.AnalyticsService, {
103
record: () => Effect.void,
@@ -160,6 +161,7 @@ it.effect("resolveAutoBootstrapWelcomeTargets returns existing project and threa
161
getThreadShellById: () => Effect.die("unused"),
162
getThreadDetailById: () => Effect.die("unused"),
163
getThreadDetailSnapshot: () => Effect.die("unused"),
164
+ searchThreads: () => Effect.succeed({ matches: [] }),
165
}),
166
Effect.provideService(OrchestrationEngine.OrchestrationEngineService, {
167
readEvents: () => Stream.empty,
@@ -204,6 +206,7 @@ it.effect("resolveAutoBootstrapWelcomeTargets creates a project and thread when
206
getThreadShellById: () => Effect.die("unused"),
207
getThreadDetailById: () => Effect.die("unused"),
208
getThreadDetailSnapshot: () => Effect.die("unused"),
209
+ searchThreads: () => Effect.succeed({ matches: [] }),
210
}),
211
Effect.provideService(OrchestrationEngine.OrchestrationEngineService, {
212
readEvents: () => Stream.empty,
@@ -254,6 +257,7 @@ it.effect("resolveAutoBootstrapWelcomeTargets preserves typed UUID generation fa
257
getThreadShellById: () => Effect.die("unused"),
258
getThreadDetailById: () => Effect.die("unused"),
259
getThreadDetailSnapshot: () => Effect.die("unused"),
260
+ searchThreads: () => Effect.succeed({ matches: [] }),
261
}),
262
Effect.provideService(OrchestrationEngine.OrchestrationEngineService, {
263
readEvents: () => Stream.empty,
apps/server/src/ws.ts
+15
@@ -28,6 +28,7 @@ import {
28
type OrchestrationThreadStreamItem,
29
OrchestrationGetFullThreadDiffError,
30
OrchestrationGetSnapshotError,
31
+ OrchestrationSearchThreadsError,
32
OrchestrationGetTurnDiffError,
33
ORCHESTRATION_WS_METHODS,
34
type ProjectId,
@@ -1103,6 +1104,20 @@ const makeWsRpcLayer = (
1104
),
1105
{ "rpc.aggregate": "orchestration" },
1106
),
1107
+ [ORCHESTRATION_WS_METHODS.searchThreads]: (input) =>
1108
+ observeRpcEffect(
1109
+ ORCHESTRATION_WS_METHODS.searchThreads,
1110
+ projectionSnapshotQuery.searchThreads(input).pipe(
1111
+ Effect.mapError(
1112
+ (cause) =>
1113
+ new OrchestrationSearchThreadsError({
1114
+ message: "Failed to search threads",
1115
+ cause,
1116
+ }),
1117
+ ),
1118
+ ),
1119
+ { "rpc.aggregate": "orchestration" },
1120
+ ),
1121
[ORCHESTRATION_WS_METHODS.subscribeShell]: (input) =>
1122
observeRpcStreamEffect(
1123
ORCHESTRATION_WS_METHODS.subscribeShell,
apps/web/src/components/CommandPalette.logic.test.ts
+23
@@ -169,6 +169,29 @@ describe("buildThreadActionItems", () => {
169
expect(groups[0]?.items.map((item) => item.value)).toEqual(["thread:project-context-only"]);
170
});
171
172
+ it("keeps message excerpts searchable without replacing thread metadata", () => {
173
+ const [item] = buildThreadActionItems({
174
+ threads: [makeThread({ branch: "feat/search" })],
175
+ projectTitleById: new Map([[PROJECT_ID, "T3 Code"]]),
176
+ sortOrder: "updated_at",
177
+ icon: null,
178
+ getContentMatch: () => ({
179
+ source: "assistant",
180
+ snippet: "The relay reconnect is now bounded.",
181
+ query: "reconnect",
182
+ }),
183
+ runThread: async (_thread) => undefined,
184
+ });
185
+
186
+ expect(item?.searchTerms).toContain("The relay reconnect is now bounded.");
187
+ expect(item?.threadContentMatch).toEqual({
188
+ source: "assistant",
189
+ snippet: "The relay reconnect is now bounded.",
190
+ query: "reconnect",
191
+ });
192
+ expect(item?.description).toBe("T3 Code · #feat/search");
193
+ });
194
+
195
it("filters archived threads out of thread search items", () => {
196
const items = buildThreadActionItems({
197
threads: [
apps/web/src/components/CommandPalette.logic.ts
+16
-1
@@ -15,12 +15,19 @@ export const RECENT_THREAD_LIMIT = 12;
15
export const ITEM_ICON_CLASS = "size-4 text-muted-foreground/80";
16
export const ADDON_ICON_CLASS = "size-4";
17
18
+export interface CommandPaletteThreadContentMatch {
19
+ readonly source: "user" | "assistant";
20
+ readonly snippet: string;
21
+ readonly query: string;
22
+}
23
+
24
export interface CommandPaletteItem {
25
readonly kind: "action" | "submenu";
26
readonly value: string;
27
readonly searchTerms: ReadonlyArray<string>;
28
readonly title: ReactNode;
29
readonly description?: string;
30
+ readonly threadContentMatch?: CommandPaletteThreadContentMatch;
31
readonly timestamp?: string;
32
readonly icon: ReactNode;
33
readonly disabled?: boolean;
@@ -114,6 +121,7 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
121
renderLeadingContent?: (thread: TThread) => ReactNode;
122
/** Optional content rendered inline after the title text per-thread. */
123
renderTrailingContent?: (thread: TThread) => ReactNode;
124
+ getContentMatch?: (thread: TThread) => CommandPaletteThreadContentMatch | undefined;
125
runThread: (thread: Pick<SidebarThreadSummary, "environmentId" | "id">) => Promise<void>;
126
limit?: number;
127
}): CommandPaletteActionItem[] {
@@ -140,12 +148,18 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
148
149
const leadingContent = input.renderLeadingContent?.(thread);
150
const trailingContent = input.renderTrailingContent?.(thread);
151
+ const contentMatch = input.getContentMatch?.(thread);
152
153
return Object.assign(
154
{
155
kind: "action" as const,
156
value: `thread:${thread.id}`,
148
- searchTerms: [thread.title, projectTitle ?? ``, thread.branch ?? ``],
157
+ searchTerms: [
158
+ thread.title,
159
+ projectTitle ?? ``,
160
+ thread.branch ?? ``,
161
+ contentMatch?.snippet ?? ``,
162
+ ],
163
title: thread.title,
164
description: descriptionParts.join(` · `),
165
timestamp: formatRelativeTimeLabel(
@@ -155,6 +169,7 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
169
},
170
leadingContent ? { titleLeadingContent: leadingContent } : {},
171
trailingContent ? { titleTrailingContent: trailingContent } : {},
172
+ contentMatch ? { threadContentMatch: contentMatch } : {},
173
{
174
run: async () => {
175
await input.runThread(thread);
apps/web/src/components/CommandPalette.tsx
+49
-2
@@ -3,6 +3,7 @@
3
import { scopeProjectRef, scopeThreadRef } from "@t3tools/client-runtime/environment";
4
import { canCreateProjectInEnvironment } from "@t3tools/client-runtime/operations/projects";
5
import { connectionStatusText } from "@t3tools/client-runtime/connection";
6
+import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
7
import {
8
canPreloadBrowsePath,
9
createBrowseNavigationCoordinator,
@@ -66,6 +67,7 @@ import { useAtomCommand } from "../state/use-atom-command";
67
import { useAtomQueryRunner } from "../state/use-atom-query-runner";
68
import { useEnvironments, usePrimaryEnvironmentId } from "../state/environments";
69
import { useProjects, useThreadShells } from "../state/entities";
70
+import { useThreadSearch } from "../state/queries";
71
import { resolveThreadActionProjectRef, startNewThreadFromContext } from "../lib/chatThreadActions";
72
import {
73
appendBrowsePathSegment,
@@ -510,6 +512,26 @@ function OpenCommandPaletteDialog(props: {
512
const providers = useAtomValue(primaryServerProvidersAtom);
513
const [viewStack, setViewStack] = useState<CommandPaletteView[]>([]);
514
const currentView = viewStack.at(-1) ?? null;
515
+ const environmentIds = useMemo(
516
+ () =>
517
+ environments
518
+ .filter((environment) => environment.connection.phase === "connected")
519
+ .map((environment) => environment.environmentId),
520
+ [environments],
521
+ );
522
+ const threadSearchQuery = currentView === null && !isActionsOnly ? deferredQuery : "";
523
+ const threadSearch = useThreadSearch(environmentIds, threadSearchQuery);
524
+ const threadContentMatchByKey = useMemo(
525
+ () =>
526
+ new Map(
527
+ threadSearch.matches.flatMap((match) =>
528
+ match.source === "user" || match.source === "assistant"
529
+ ? [[threadSearchMatchKey(match), match] as const]
530
+ : [],
531
+ ),
532
+ ),
533
+ [threadSearch.matches],
534
+ );
535
const [browseGeneration, setBrowseGeneration] = useState(0);
536
const browseNavigationRef = useRef<ReturnType<typeof createBrowseNavigationCoordinator> | null>(
537
null,
@@ -916,6 +938,21 @@ function OpenCommandPaletteDialog(props: {
938
icon: <MessageSquareIcon className={ITEM_ICON_CLASS} />,
939
renderLeadingContent: (thread) => <ThreadRowLeadingStatus thread={thread} />,
940
renderTrailingContent: (thread) => <ThreadRowTrailingStatus thread={thread} />,
941
+ getContentMatch: (thread) => {
942
+ const match = threadContentMatchByKey.get(
943
+ threadSearchMatchKey({
944
+ environmentId: thread.environmentId,
945
+ threadId: thread.id,
946
+ }),
947
+ );
948
+ return match && (match.source === "user" || match.source === "assistant")
949
+ ? {
950
+ source: match.source,
951
+ snippet: match.snippet,
952
+ query: threadSearchQuery,
953
+ }
954
+ : undefined;
955
+ },
956
runThread: async (thread) => {
957
await navigate({
958
to: "/$environmentId/$threadId",
@@ -923,7 +960,15 @@ function OpenCommandPaletteDialog(props: {
960
});
961
},
962
}),
926
- [activeThreadId, clientSettings.sidebarThreadSortOrder, navigate, projectTitleById, threads],
963
+ [
964
+ activeThreadId,
965
+ clientSettings.sidebarThreadSortOrder,
966
+ navigate,
967
+ projectTitleById,
968
+ threadContentMatchByKey,
969
+ threadSearchQuery,
970
+ threads,
971
+ ],
972
);
973
const recentThreadItems = allThreadItems.slice(0, RECENT_THREAD_LIMIT);
974
@@ -2194,7 +2239,9 @@ function OpenCommandPaletteDialog(props: {
2239
emptyStateMessage:
2240
"Press Enter to create this folder and add it as a project.",
2241
}
2197
- : {})}
2242
+ : threadSearch.isPending
2243
+ ? { emptyStateMessage: "Searching thread messages…" }
2244
+ : {})}
2245
/>
2246
</CommandPanel>
2247
<CommandFooter className="gap-3 max-sm:flex-col max-sm:items-start">
apps/web/src/components/CommandPaletteResults.tsx
+81
-8
@@ -16,6 +16,69 @@ import {
16
} from "./ui/command";
17
import { cn } from "~/lib/utils";
18
19
+function foldAsciiCase(value: string): string {
20
+ return value.replace(/[A-Z]/g, (character) => character.toLowerCase());
21
+}
22
+
23
+function HighlightedSearchText(props: { text: string; query: string }) {
24
+ const query = props.query.trim();
25
+ if (query.length === 0) return props.text;
26
+
27
+ const normalizedText = foldAsciiCase(props.text);
28
+ const normalizedQuery = foldAsciiCase(query);
29
+ const parts: Array<{
30
+ readonly text: string;
31
+ readonly highlighted: boolean;
32
+ readonly start: number;
33
+ }> = [];
34
+ let cursor = 0;
35
+
36
+ while (cursor < props.text.length) {
37
+ const matchIndex = normalizedText.indexOf(normalizedQuery, cursor);
38
+ if (matchIndex === -1) {
39
+ parts.push({ text: props.text.slice(cursor), highlighted: false, start: cursor });
40
+ break;
41
+ }
42
+ if (matchIndex > cursor) {
43
+ parts.push({
44
+ text: props.text.slice(cursor, matchIndex),
45
+ highlighted: false,
46
+ start: cursor,
47
+ });
48
+ }
49
+ parts.push({
50
+ text: props.text.slice(matchIndex, matchIndex + query.length),
51
+ highlighted: true,
52
+ start: matchIndex,
53
+ });
54
+ cursor = matchIndex + query.length;
55
+ }
56
+
57
+ return parts.map((part) =>
58
+ part.highlighted ? (
59
+ <mark className="bg-transparent font-semibold text-foreground" key={part.start}>
60
+ {part.text}
61
+ </mark>
62
+ ) : (
63
+ part.text
64
+ ),
65
+ );
66
+}
67
+
68
+function ThreadContentMatch(props: {
69
+ match: NonNullable<CommandPaletteActionItem["threadContentMatch"]>;
70
+}) {
71
+ const isUser = props.match.source === "user";
72
+ return (
73
+ <span className="truncate text-xs text-muted-foreground/85">
74
+ <span className={isUser ? "text-blue-400" : "text-emerald-400"}>
75
+ {isUser ? "You:" : "Agent:"}
76
+ </span>{" "}
77
+ <HighlightedSearchText text={props.match.snippet} query={props.match.query} />
78
+ </span>
79
+ );
80
+}
81
+
82
interface CommandPaletteResultsProps {
83
emptyStateMessage?: string;
84
groups: ReadonlyArray<CommandPaletteGroup>;
@@ -69,15 +132,20 @@ function DisabledCommandPaletteResultRow(props: {
132
return (
133
<div className="flex min-h-8 select-none items-center gap-2 rounded-sm px-2 py-1.5 text-base opacity-64 sm:min-h-7 sm:text-sm">
134
{props.item.icon}
72
- {props.item.description ? (
135
+ {props.item.description || props.item.threadContentMatch ? (
136
<span className="flex min-w-0 flex-1 flex-col">
137
<span className="flex min-w-0 items-center gap-1.5 text-sm text-foreground">
138
{props.item.titleLeadingContent}
139
<span className="truncate">{props.item.title}</span>
140
</span>
78
- <span className="truncate text-muted-foreground/85 text-xs">
79
- {props.item.description}
80
- </span>
141
+ {props.item.threadContentMatch ? (
142
+ <ThreadContentMatch match={props.item.threadContentMatch} />
143
+ ) : null}
144
+ {props.item.description ? (
145
+ <span className="truncate text-muted-foreground/70 text-xs">
146
+ {props.item.description}
147
+ </span>
148
+ ) : null}
149
</span>
150
) : (
151
<span className="flex min-w-0 flex-1 items-center gap-1.5 text-sm text-foreground">
@@ -115,15 +183,20 @@ function CommandPaletteResultRow(props: {
183
}}
184
>
185
{props.item.icon}
118
- {props.item.description ? (
186
+ {props.item.description || props.item.threadContentMatch ? (
187
<span className="flex min-w-0 flex-1 flex-col">
188
<span className="flex min-w-0 items-center gap-1.5 text-sm text-foreground">
189
{props.item.titleLeadingContent}
190
<span className="truncate">{props.item.title}</span>
191
</span>
124
- <span className="truncate text-muted-foreground/85 text-xs">
125
- {props.item.description}
126
- </span>
192
+ {props.item.threadContentMatch ? (
193
+ <ThreadContentMatch match={props.item.threadContentMatch} />
194
+ ) : null}
195
+ {props.item.description ? (
196
+ <span className="truncate text-muted-foreground/70 text-xs">
197
+ {props.item.description}
198
+ </span>
199
+ ) : null}
200
</span>
201
) : (
202
<span className="flex min-w-0 flex-1 items-center gap-1.5 text-sm text-foreground">
apps/web/src/state/queries.ts
+45
@@ -3,6 +3,11 @@ import {
3
type CheckpointDiffTarget,
4
type ComposerPathSearchTarget,
5
} from "@t3tools/client-runtime/state/threads";
6
+import {
7
+ createThreadSearchResultsAtomFamily,
8
+ makeThreadSearchKey,
9
+ type EnvironmentThreadSearchMatch,
10
+} from "@t3tools/client-runtime/state/thread-search";
11
import { type VcsRefTarget } from "@t3tools/client-runtime/state/vcs";
12
import type {
13
EnvironmentId,
@@ -26,9 +31,24 @@ import { vcsEnvironment } from "./vcs";
31
32
const COMPOSER_PATH_SEARCH_DEBOUNCE_MS = 120;
33
const COMPOSER_PATH_SEARCH_LIMIT = 80;
34
+const THREAD_SEARCH_DEBOUNCE_MS = 200;
35
const VCS_REF_LIST_LIMIT = 100;
36
const EMPTY_REFS: ReadonlyArray<VcsRef> = [];
37
const INITIAL_BRANCH_CURSORS = [undefined] as const;
38
+const EMPTY_THREAD_SEARCH_MATCHES: ReadonlyArray<EnvironmentThreadSearchMatch> = Object.freeze([]);
39
+const EMPTY_THREAD_SEARCH_ATOM = Atom.make({
40
+ matches: EMPTY_THREAD_SEARCH_MATCHES,
41
+ isLoading: false,
42
+}).pipe(Atom.withLabel("web:thread-search:empty"));
43
+
44
+const threadSearchResultsAtom = createThreadSearchResultsAtomFamily({
45
+ getSearchAtom: (environmentId, query) =>
46
+ orchestrationEnvironment.threadSearch({
47
+ environmentId,
48
+ input: { query },
49
+ }),
50
+ labelPrefix: "web:thread-search",
51
+});
52
53
export interface ThreadDetailView {
54
readonly data: OrchestrationThread | null;
@@ -52,6 +72,31 @@ function useDebouncedValue<A>(value: A, delayMs: number): A {
72
return debounced;
73
}
74
75
+export function useThreadSearch(
76
+ environmentIds: ReadonlyArray<EnvironmentId>,
77
+ query: string,
78
+): {
79
+ readonly matches: ReadonlyArray<EnvironmentThreadSearchMatch>;
80
+ readonly isPending: boolean;
81
+} {
82
+ const normalizedQuery = query.trim();
83
+ const debouncedQuery = useDebouncedValue(normalizedQuery, THREAD_SEARCH_DEBOUNCE_MS);
84
+ const canSearch = environmentIds.length > 0 && normalizedQuery.length >= 2;
85
+ const settledQuery = canSearch && normalizedQuery === debouncedQuery ? debouncedQuery : null;
86
+ const searchKey = useMemo(
87
+ () => (settledQuery === null ? null : makeThreadSearchKey(environmentIds, settledQuery)),
88
+ [environmentIds, settledQuery],
89
+ );
90
+ const result = useAtomValue(
91
+ searchKey === null ? EMPTY_THREAD_SEARCH_ATOM : threadSearchResultsAtom(searchKey),
92
+ );
93
+ const isDebouncing = canSearch && normalizedQuery !== debouncedQuery;
94
+ return {
95
+ matches: isDebouncing ? EMPTY_THREAD_SEARCH_MATCHES : result.matches,
96
+ isPending: canSearch && (isDebouncing || result.isLoading),
97
+ };
98
+}
99
+
100
export function useThreadDetail(
101
environmentId: EnvironmentId | null,
102
threadId: ThreadId | null,
docs/user/keybindings.md
+5
@@ -69,6 +69,11 @@ Invalid rules are ignored. Invalid config files are ignored. Warnings are logged
69
- `editor.openFavorite`: open current project/worktree in the last-used editor
70
- `script.{id}.run`: run a project script by id (for example `script.test.run`)
71
72
+The command palette searches active thread titles, projects, branches, user messages, and final
73
+agent responses across connected environments. Message matches show one labeled excerpt while
74
+keeping the thread's project, branch, and machine context visible. Message search begins after two
75
+characters and uses SQLite's ASCII case-insensitive matching.
76
+
77
### Key Syntax
78
79
Supported modifiers:
packages/client-runtime/package.json
+4
@@ -131,6 +131,10 @@
131
"types": "./src/state/threadSettled.ts",
132
"default": "./src/state/threadSettled.ts"
133
},
134
+ "./state/thread-search": {
135
+ "types": "./src/state/threadSearch.ts",
136
+ "default": "./src/state/threadSearch.ts"
137
+ },
138
"./state/vcs": {
139
"types": "./src/state/vcs.ts",
140
"default": "./src/state/vcs.ts"
packages/client-runtime/src/state/orchestration.ts
+6
@@ -16,6 +16,12 @@ export function createOrchestrationEnvironmentAtoms<R, E>(
16
label: "environment-data:orchestration:full-thread-diff",
17
tag: ORCHESTRATION_WS_METHODS.getFullThreadDiff,
18
}),
19
+ threadSearch: createEnvironmentRpcQueryAtomFamily(runtime, {
20
+ label: "environment-data:orchestration:thread-search",
21
+ tag: ORCHESTRATION_WS_METHODS.searchThreads,
22
+ staleTimeMs: 30_000,
23
+ idleTtlMs: 60_000,
24
+ }),
25
archivedShellSnapshot: createEnvironmentRpcQueryAtomFamily(runtime, {
26
label: "environment-data:orchestration:archived-shell-snapshot",
27
tag: ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot,
packages/client-runtime/src/state/threadSearch.test.ts
new
+72
@@ -0,0 +1,72 @@
1
+import {
2
+ EnvironmentId,
3
+ ProjectId,
4
+ ThreadId,
5
+ type OrchestrationSearchThreadsResult,
6
+} from "@t3tools/contracts";
7
+import * as Cause from "effect/Cause";
8
+import { AsyncResult, Atom, AtomRegistry } from "effect/unstable/reactivity";
9
+import { expect, it } from "vite-plus/test";
10
+
11
+import {
12
+ createThreadSearchResultsAtomFamily,
13
+ makeThreadSearchKey,
14
+ threadSearchMatchKey,
15
+} from "./threadSearch.ts";
16
+
17
+const envA = EnvironmentId.make("env-a");
18
+const envB = EnvironmentId.make("env-b");
19
+
20
+it("creates stable keys regardless of environment order", () => {
21
+ expect(makeThreadSearchKey([envB, envA], "needle")).toBe(
22
+ makeThreadSearchKey([envA, envB], "needle"),
23
+ );
24
+});
25
+
26
+it("encodes scoped thread keys without delimiter collisions", () => {
27
+ const first = threadSearchMatchKey({
28
+ environmentId: EnvironmentId.make("env\u0000thread"),
29
+ threadId: ThreadId.make("id"),
30
+ });
31
+ const second = threadSearchMatchKey({
32
+ environmentId: EnvironmentId.make("env"),
33
+ threadId: ThreadId.make("thread\u0000id"),
34
+ });
35
+
36
+ expect(first).not.toBe(second);
37
+});
38
+
39
+it("merges successful environments and silently ignores failures", () => {
40
+ const result: OrchestrationSearchThreadsResult = {
41
+ matches: [
42
+ {
43
+ threadId: ThreadId.make("thread-a"),
44
+ projectId: ProjectId.make("project-a"),
45
+ source: "user",
46
+ snippet: "needle",
47
+ messageCreatedAt: "2026-07-30T00:00:00.000Z",
48
+ },
49
+ ],
50
+ };
51
+ const searchAtom = createThreadSearchResultsAtomFamily<Error>({
52
+ getSearchAtom: (environmentId) =>
53
+ environmentId === envA
54
+ ? Atom.make(AsyncResult.success(result))
55
+ : Atom.make(
56
+ AsyncResult.failure<OrchestrationSearchThreadsResult, Error>(
57
+ Cause.fail(new Error("unsupported rpc")),
58
+ ),
59
+ ),
60
+ labelPrefix: "test:thread-search",
61
+ });
62
+ const registry = AtomRegistry.make();
63
+
64
+ const state = registry.get(searchAtom(makeThreadSearchKey([envB, envA], "needle")));
65
+ expect(state).toEqual({
66
+ matches: [{ ...result.matches[0], environmentId: envA }],
67
+ isLoading: false,
68
+ });
69
+ expect(threadSearchMatchKey(state.matches[0]!)).toBe('["env-a","thread-a"]');
70
+
71
+ registry.dispose();
72
+});
packages/client-runtime/src/state/threadSearch.ts
new
+81
@@ -0,0 +1,81 @@
1
+import {
2
+ EnvironmentId,
3
+ OrchestrationSearchThreadsInput,
4
+ type OrchestrationSearchThreadsResult,
5
+ type OrchestrationThreadSearchMatch,
6
+} from "@t3tools/contracts";
7
+import * as Option from "effect/Option";
8
+import * as Schema from "effect/Schema";
9
+import { AsyncResult, Atom } from "effect/unstable/reactivity";
10
+
11
+export interface EnvironmentThreadSearchMatch extends OrchestrationThreadSearchMatch {
12
+ readonly environmentId: EnvironmentId;
13
+}
14
+
15
+export interface ThreadSearchResultsState {
16
+ readonly matches: ReadonlyArray<EnvironmentThreadSearchMatch>;
17
+ readonly isLoading: boolean;
18
+}
19
+
20
+const ThreadSearchKey = Schema.Tuple([
21
+ Schema.Array(EnvironmentId),
22
+ OrchestrationSearchThreadsInput.fields.query,
23
+]);
24
+const decodeThreadSearchKey = Schema.decodeUnknownSync(ThreadSearchKey);
25
+
26
+export function makeThreadSearchKey(
27
+ environmentIds: ReadonlyArray<EnvironmentId>,
28
+ query: string,
29
+): string {
30
+ return JSON.stringify([
31
+ [...environmentIds].toSorted((left, right) => left.localeCompare(right)),
32
+ query,
33
+ ]);
34
+}
35
+
36
+function parseThreadSearchKey(key: string) {
37
+ return decodeThreadSearchKey(JSON.parse(key));
38
+}
39
+
40
+export function threadSearchMatchKey(
41
+ match: Pick<EnvironmentThreadSearchMatch, "environmentId" | "threadId">,
42
+): string {
43
+ return JSON.stringify([match.environmentId, match.threadId]);
44
+}
45
+
46
+/**
47
+ * Combines one search query atom per environment. Failed and disconnected
48
+ * environments contribute no content matches, preserving local title search
49
+ * as the compatibility fallback.
50
+ */
51
+export function createThreadSearchResultsAtomFamily<E>(options: {
52
+ readonly getSearchAtom: (
53
+ environmentId: EnvironmentId,
54
+ query: string,
55
+ ) => Atom.Atom<AsyncResult.AsyncResult<OrchestrationSearchThreadsResult, E>>;
56
+ readonly labelPrefix: string;
57
+}) {
58
+ return Atom.family((key: string) =>
59
+ Atom.make((get): ThreadSearchResultsState => {
60
+ const [environmentIds, query] = parseThreadSearchKey(key);
61
+ const matches: EnvironmentThreadSearchMatch[] = [];
62
+ let isLoading = false;
63
+
64
+ for (const environmentId of environmentIds) {
65
+ const result = get(options.getSearchAtom(environmentId, query));
66
+ isLoading ||= result.waiting;
67
+ const value = Option.getOrNull(AsyncResult.value(result));
68
+ if (value !== null) {
69
+ matches.push(
70
+ ...value.matches.map((match) => ({
71
+ ...match,
72
+ environmentId,
73
+ })),
74
+ );
75
+ }
76
+ }
77
+
78
+ return { matches, isLoading };
79
+ }).pipe(Atom.withLabel(`${options.labelPrefix}:${key}`)),
80
+ );
81
+}
packages/contracts/src/orchestration.ts
+39
@@ -18,6 +18,7 @@ import {
18
ProviderItemId,
19
ThreadId,
20
TrimmedNonEmptyString,
21
+ TrimmedString,
22
TurnId,
23
} from "./baseSchemas.ts";
24
import { ProviderInstanceId } from "./providerInstance.ts";
@@ -26,6 +27,7 @@ export const ORCHESTRATION_WS_METHODS = {
27
dispatchCommand: "orchestration.dispatchCommand",
28
getTurnDiff: "orchestration.getTurnDiff",
29
getFullThreadDiff: "orchestration.getFullThreadDiff",
30
+ searchThreads: "orchestration.searchThreads",
31
getArchivedShellSnapshot: "orchestration.getArchivedShellSnapshot",
32
subscribeShell: "orchestration.subscribeShell",
33
subscribeThread: "orchestration.subscribeThread",
@@ -1394,6 +1396,31 @@ export type OrchestrationGetFullThreadDiffInput = typeof OrchestrationGetFullThr
1396
export const OrchestrationGetFullThreadDiffResult = ThreadTurnDiff;
1397
export type OrchestrationGetFullThreadDiffResult = typeof OrchestrationGetFullThreadDiffResult.Type;
1398
1399
+export const OrchestrationThreadSearchSource = Schema.Literals(["user", "assistant"]);
1400
+export type OrchestrationThreadSearchSource = typeof OrchestrationThreadSearchSource.Type;
1401
+
1402
+// The server's SQLite client is synchronous and single-connection. Bound both
1403
+// scan input and response size so a search cannot monopolize that connection.
1404
+export const OrchestrationSearchThreadsInput = Schema.Struct({
1405
+ query: TrimmedString.check(Schema.isMinLength(2), Schema.isMaxLength(200)),
1406
+ limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 50 }))),
1407
+});
1408
+export type OrchestrationSearchThreadsInput = typeof OrchestrationSearchThreadsInput.Type;
1409
+
1410
+export const OrchestrationThreadSearchMatch = Schema.Struct({
1411
+ threadId: ThreadId,
1412
+ projectId: ProjectId,
1413
+ source: OrchestrationThreadSearchSource,
1414
+ snippet: Schema.String.check(Schema.isMaxLength(240)),
1415
+ messageCreatedAt: Schema.NullOr(IsoDateTime),
1416
+});
1417
+export type OrchestrationThreadSearchMatch = typeof OrchestrationThreadSearchMatch.Type;
1418
+
1419
+export const OrchestrationSearchThreadsResult = Schema.Struct({
1420
+ matches: Schema.Array(OrchestrationThreadSearchMatch),
1421
+});
1422
+export type OrchestrationSearchThreadsResult = typeof OrchestrationSearchThreadsResult.Type;
1423
+
1424
export const OrchestrationRpcSchemas = {
1425
dispatchCommand: {
1426
input: ClientOrchestrationCommand,
@@ -1407,6 +1434,10 @@ export const OrchestrationRpcSchemas = {
1434
input: OrchestrationGetFullThreadDiffInput,
1435
output: OrchestrationGetFullThreadDiffResult,
1436
},
1437
+ searchThreads: {
1438
+ input: OrchestrationSearchThreadsInput,
1439
+ output: OrchestrationSearchThreadsResult,
1440
+ },
1441
getArchivedShellSnapshot: {
1442
input: Schema.Struct({}),
1443
output: OrchestrationShellSnapshot,
@@ -1452,3 +1483,11 @@ export class OrchestrationGetFullThreadDiffError extends Schema.TaggedErrorClass
1483
cause: Schema.optional(Schema.Defect()),
1484
},
1485
) {}
1486
+
1487
+export class OrchestrationSearchThreadsError extends Schema.TaggedErrorClass<OrchestrationSearchThreadsError>()(
1488
+ "OrchestrationSearchThreadsError",
1489
+ {
1490
+ message: TrimmedNonEmptyString,
1491
+ cause: Schema.optional(Schema.Defect()),
1492
+ },
1493
+) {}
packages/contracts/src/rpc.ts
+9
@@ -57,6 +57,8 @@ import {
57
OrchestrationGetFullThreadDiffError,
58
OrchestrationGetFullThreadDiffInput,
59
OrchestrationGetSnapshotError,
60
+ OrchestrationSearchThreadsError,
61
+ OrchestrationSearchThreadsInput,
62
OrchestrationGetTurnDiffError,
63
OrchestrationGetTurnDiffInput,
64
OrchestrationRpcSchemas,
@@ -690,6 +692,12 @@ export const WsOrchestrationGetFullThreadDiffRpc = Rpc.make(
692
},
693
);
694
695
+export const WsOrchestrationSearchThreadsRpc = Rpc.make(ORCHESTRATION_WS_METHODS.searchThreads, {
696
+ payload: OrchestrationSearchThreadsInput,
697
+ success: OrchestrationRpcSchemas.searchThreads.output,
698
+ error: Schema.Union([OrchestrationSearchThreadsError, EnvironmentAuthorizationError]),
699
+});
700
+
701
export const WsOrchestrationGetArchivedShellSnapshotRpc = Rpc.make(
702
ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot,
703
{
@@ -840,6 +848,7 @@ export const WsRpcGroup = RpcGroup.make(
848
WsOrchestrationDispatchCommandRpc,
849
WsOrchestrationGetTurnDiffRpc,
850
WsOrchestrationGetFullThreadDiffRpc,
851
+ WsOrchestrationSearchThreadsRpc,
852
WsOrchestrationGetArchivedShellSnapshotRpc,
853
WsOrchestrationSubscribeShellRpc,
854
WsOrchestrationSubscribeThreadRpc,