paseo-follow-up 2.1.0-beta.1 → 2.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -160,7 +160,7 @@ full data-access statement.
160
160
  ## Memory on Linux
161
161
 
162
162
  On Linux (glibc), a Follow-up that stays up for hours can slowly grow in memory: the allocator keeps memory Follow-up
163
- already freed. macOS isn't affected. Three allocator settings in the Paseo daemon's environment stop the growth. Every
163
+ already freed. macOS isn't affected. Three allocator settings in the Paseo daemon's environment stop most of the idle growth. Every
164
164
  process Paseo starts inherits them.
165
165
 
166
166
  If a systemd unit runs Paseo, add them to it (the unit name is your own; `paseo` here):
@@ -183,7 +183,9 @@ MALLOC_ARENA_MAX=2 MALLOC_MMAP_THRESHOLD_=131072 MALLOC_TRIM_THRESHOLD_=131072 p
183
183
  ```
184
184
 
185
185
  In our test harness (140 workspaces, 45 idle minutes) Follow-up grew about 20 MB without them and 3 to 6 MB with them,
186
- at no measurable CPU cost. To undo it, remove the settings and restart Paseo.
186
+ at no measurable CPU cost. On a busy real setup they kept Follow-up flat while idle, but memory still stepped up during
187
+ bursts of activity and stayed there: after about 4.7 hours it used 363 MB with them and 375 MB without. To undo it,
188
+ remove the settings and restart Paseo.
187
189
 
188
190
  ## Docs
189
191
 
@@ -1,12 +1,12 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
2
- import { Platform, ScrollView, TextInput, View } from "react-native";
2
+ import { Platform, TextInput, View } from "react-native";
3
3
  import { Pressable, Text } from "./text";
4
- import { Icon, useToast } from "@getpaseo/plugin/client/ui";
4
+ import { Icon, ScrollView, useToast } from "@getpaseo/plugin/client/ui";
5
5
  import { homeCounts, type HomeGroupId, type HomeModel } from "../shared/home";
6
6
  import { filterHome, homeSearchDocs, indexDocs, defaultActive, omniboxResults, overseerProvider, workspaceProvider, type OmniboxItem, type OmniboxProvider } from "../shared/search";
7
7
  import { DEFAULT_SORT, SORT_HINT, SORT_LABEL, SORT_MODES, type SortMode } from "../shared/sort";
8
- import { priorityNote, PRIORITY_SOURCE_LABEL } from "../shared/priorities";
9
- import { rankCost } from "../shared/ranker";
8
+ import { PRIORITY_SOURCE_LABEL } from "../shared/priorities";
9
+ import { rankFooter } from "../shared/ranker";
10
10
  import { meters, meterText, type Meter } from "../shared/usage";
11
11
  import { resourceMeter, type Resources } from "../shared/resources";
12
12
  import type { HomeSources } from "./home-data";
@@ -92,9 +92,14 @@ export function useSlashToFocus(omnibox: Omnibox, enabled = true) {
92
92
  * The one query field: Home's omnibox (SearchField) and the sidebar view's filter (FilterField) are this with
93
93
  * different words. `dense` is the phone layout: a 44px field with a rounder shape and body-size text.
94
94
  */
95
- function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, onSubmit, onArrow, listKeys = false }: {
95
+ export function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, onSubmit, onArrow, listKeys = false, count, autoFocus = false, onEscape }: {
96
96
  /** Its arrows step into the list below (client/list-keys.ts): the sidebar filter, and Home's search while empty. */
97
97
  listKeys?: boolean;
98
+ /** "2 of 12" at the field's end (a panel section's search), in place of the field's own ✕: the section has its own. */
99
+ count?: string;
100
+ autoFocus?: boolean;
101
+ /** Esc's own action (a section search closes); without it Esc clears, then leaves the field. */
102
+ onEscape?: () => void;
98
103
  theme: Theme; value: string; onChange: (q: string) => void; placeholder: string; icon: string; dense: boolean;
99
104
  inputRef: { current: TextInput | null }; slashHint: boolean; onSubmit?: () => void; onArrow?: (delta: number) => void;
100
105
  }) {
@@ -104,7 +109,7 @@ function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef
104
109
  borderWidth: 1, borderColor: focused ? withAlpha(c.foreground, 0.35) : c.border, backgroundColor: c.surface1 }}>
105
110
  <Icon name={icon as never} size={dense ? 16 : 13} color={c.foregroundMuted} />
106
111
  <TextInput ref={inputRef} value={value} onChangeText={onChange} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
107
- accessibilityLabel={placeholder} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
112
+ accessibilityLabel={placeholder} autoFocus={autoFocus} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
108
113
  {...(listKeys ? { dataSet: { listKeys: "1" } } as object : {})}
109
114
  onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
110
115
  onSubmitEditing={onSubmit}
@@ -112,10 +117,11 @@ function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef
112
117
  const key = (e.nativeEvent as { key?: string }).key;
113
118
  if (key === "ArrowDown" && onArrow) { e.preventDefault?.(); onArrow(1); }
114
119
  else if (key === "ArrowUp" && onArrow) { e.preventDefault?.(); onArrow(-1); }
115
- else if (key === "Escape") { if (value) onChange(""); else inputRef.current?.blur(); }
120
+ else if (key === "Escape") { if (onEscape) onEscape(); else if (value) onChange(""); else inputRef.current?.blur(); }
116
121
  }}
117
122
  style={{ flex: 1, minWidth: 0, color: c.foreground, fontSize: dense ? 15 : 13, paddingVertical: 0, ...(Platform.OS === "web" ? { outlineStyle: "none" } as object : {}) }} />
118
- {!!value && <Pressable accessibilityRole="button" accessibilityLabel={`Clear ${placeholder.toLowerCase()}`} hitSlop={dense ? 14 : 8} onPress={() => { onChange(""); inputRef.current?.focus(); }}>
123
+ {count !== undefined ? !!count && <Text accessibilityLiveRegion="polite" style={{ color: c.foregroundMuted, fontSize: dense ? 13 : 12, fontVariant: ["tabular-nums"] }}>{count}</Text>
124
+ : !!value && <Pressable accessibilityRole="button" accessibilityLabel={`Clear ${placeholder.toLowerCase()}`} hitSlop={dense ? 14 : 8} onPress={() => { onChange(""); inputRef.current?.focus(); }}>
119
125
  <Icon name="X" size={dense ? 16 : 13} color={c.foregroundMuted} />
120
126
  </Pressable>}
121
127
  {slashHint && !value && !focused && !dense && Platform.OS === "web" && <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 4, borderRadius: 3, borderWidth: 1, borderColor: c.border }}>/</Text>}
@@ -159,9 +165,9 @@ export function FilterField({ theme, filter, dense }: { theme: Theme; filter: Li
159
165
  export type RankState = { enabled: boolean; running: boolean; healthLine: string; error: string | null; costUsd?: number | null; last?: { ok: boolean; skipped: string | null; provider: string | null } | null } | null;
160
166
 
161
167
 
162
- export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null, onRerank, compact = touch, shared = false }: { theme: Theme; mode: SortMode; onChange: (m: SortMode) => void; rankedAt: string | null; touch: boolean; rank?: RankState; onRerank?: () => Promise<{ ok: boolean; skipped: string | null; error: string | null; top?: { title: string }[] }>;
168
+ export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null, onRerank, compact = touch }: { theme: Theme; mode: SortMode; onChange: (m: SortMode) => void; rankedAt: string | null; touch: boolean; rank?: RankState; onRerank?: () => Promise<{ ok: boolean; skipped: string | null; error: string | null; top?: { title: string }[] }>;
163
169
  /** An icon without the mode's name (phones, and the sidebar view's narrow column). */ compact?: boolean;
164
- /** Shown away from Home (the sidebar view): the menu says the order is Home's too. */ shared?: boolean }) {
170
+ }) {
165
171
  const c = theme.colors;
166
172
  const [open, setOpen] = useState(false);
167
173
  const now = useMinute();
@@ -177,9 +183,8 @@ export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null,
177
183
  else toast.show(r.skipped === "same" ? "Nothing new in Linear, Slack, GitHub or the plan since the last ranking" : r.top?.[0] ? `Re-ranked · ${r.top[0].title} first` : "Re-ranked", { variant: "success" });
178
184
  } catch (e) { toast.error(e instanceof Error ? e.message : String(e)); }
179
185
  };
180
- // "Ranked 12m ago · Slack unavailable": the age, then any source the last run couldn't read.
181
- // The footer keeps the standing ranking's age and cost while a new one runs; the menu item says "Ranking…".
182
- const note = [priorityNote(rankedAt, now), rankedAt && rank?.enabled ? rankCost(rank) : "", rank?.enabled ? rank.healthLine : ""].filter(Boolean).join(" · ");
186
+ // "Ranked 12m ago": only when the ranking last ran (and a failed run's reason); never its cost.
187
+ const note = rankFooter({ rankedAt, now, rank });
183
188
  return <View style={{ position: "relative", zIndex: 20 }}>
184
189
  <Pressable accessibilityRole="button" accessibilityLabel={`Sort: ${SORT_LABEL[mode]}${running ? ", ranking" : ""}`} aria-expanded={open} accessibilityState={{ expanded: open }} onPress={() => setOpen(o => !o)}
185
190
  style={state => ({ flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 4, height: touch ? 44 : compact ? 32 : 30, minWidth: touch ? 44 : compact ? 32 : undefined, paddingHorizontal: compact ? 0 : 8, borderRadius: touch ? 8 : 6, backgroundColor: open || (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
@@ -201,10 +206,7 @@ export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null,
201
206
  style={state => ({ ...menuItemRow(touch), minHeight: touch ? 48 : 34, paddingHorizontal: touch ? 12 : 10, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
202
207
  <MenuItemContent theme={theme} touch={touch} glyph={running ? <Spinner color={c.foregroundMuted} size={menuGlyph(touch).size - 2} label="Ranking" /> : "RefreshCw"} label={running ? "Ranking…" : "Re-rank now"} muted={running} />
203
208
  </Pressable>}
204
- {/* Phones: before anything is ranked, "Priority: By urgency" only repeats the checked row's hint. */}
205
- {!(touch && !rankedAt) && <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 10, paddingTop: 4, paddingBottom: shared ? 0 : 4 }}>Priority: {note}</Text>}
206
- {/* One order, saved as the Display setting home_sort: changing it here reorders Home as well. */}
207
- {shared && <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 10, paddingTop: 2, paddingBottom: 6 }}>Home uses this order too.</Text>}
209
+ {note && <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: touch ? 12 : 10, paddingTop: 4, paddingBottom: 6 }}>{note}</Text>}
208
210
  </View>
209
211
  </View>}
210
212
  </View>;
@@ -1,13 +1,14 @@
1
1
  import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
2
- import { FlatList, View } from "react-native";
2
+ import { View, type FlatList as NativeFlatList } from "react-native";
3
3
  import { Pressable, Text } from "./text";
4
- import { Icon } from "@getpaseo/plugin/client/ui";
4
+ import { Icon, FlatList } from "@getpaseo/plugin/client/ui";
5
5
  import { type Badge, type HomeGroupId, type HomeModel, type Workstream } from "../shared/home";
6
- import { ASK_KEY, excerpt, FIELD_LABEL, highlightRuns, type OmniboxItem, type Range, type RowHit, type SearchHit } from "../shared/search";
6
+ import { ASK_KEY, excerpt, FIELD_LABEL, type OmniboxItem, type Range, type RowHit, type SearchHit } from "../shared/search";
7
7
  import { AskRow, PriorityLine } from "./home-chrome";
8
8
  import { age, wakeLabel, wakeShort } from "../shared/inbox";
9
9
  import { headlineColor, mergedColor, readable, runningColor, tint, toneColor, withAlpha, type Colors } from "./theme";
10
10
  import { useMinute } from "./home-data";
11
+ import { marked } from "./rich-text";
11
12
  import { Spinner } from "./motion";
12
13
  import { Button, focusRing, rowDomId, type Theme } from "./kit";
13
14
  import { useListKeys } from "./list-keys";
@@ -157,7 +158,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
157
158
  }
158
159
  }, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, pickResult, model, overseer?.state, overseer?.line, overseer?.ranges, stackOverseer, asking, afterNeeds, emptyAction, onMenu, menuKey, onSendNow, selectedBg]);
159
160
 
160
- const listRef = useRef<FlatList<Entry>>(null);
161
+ const listRef = useRef<NativeFlatList<Entry>>(null);
161
162
  const rootRef = useRef<View>(null);
162
163
  // The keyboard walk: the rows as drawn, the brief and the Overseer first (they're rows too). A search walks its
163
164
  // results through the omnibox instead.
@@ -293,7 +294,7 @@ export function Age({ iso, c, size = 12 }: { iso: string | null; c: Colors; size
293
294
  /** Matched words, highlighted inside a line of text: the hit colour, semibold, on a light warning tint. */
294
295
  export function marks(text: string, ranges: Range[] | null | undefined, c: Colors): ReactNode {
295
296
  if (!ranges?.length) return text;
296
- return highlightRuns(text, ranges).map((r, i) => r.hit ? <Text key={i} style={{ color: c.foreground, fontWeight: "600", backgroundColor: withAlpha(c.statusWarning, 0.22), borderRadius: 2 }}>{r.text}</Text> : r.text);
297
+ return marked(text, 0, ranges, c);
297
298
  }
298
299
 
299
300
 
package/client/home.tsx CHANGED
@@ -1,9 +1,9 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
2
2
  import { browserKey } from "./keys";
3
- import { Platform, ScrollView, TextInput, useWindowDimensions, View } from "react-native";
3
+ import { Platform, TextInput, useWindowDimensions, View } from "react-native";
4
4
  import { Pressable, Text } from "./text";
5
5
  import { usePaseo, useRpc, type PluginScreenProps } from "@getpaseo/plugin/client";
6
- import { Icon, Modal, useToast } from "@getpaseo/plugin/client/ui";
6
+ import { Icon, ScrollView, Modal, useToast } from "@getpaseo/plugin/client/ui";
7
7
  import { useQuery } from "@tanstack/react-query";
8
8
  import { browserStatusRpc, controlRpc, inboxBriefRpc, sendRpc } from "../shared/contracts";
9
9
  import { needsYou, workspaceSnoozed } from "../shared/attention";
package/client/kit.tsx CHANGED
@@ -153,14 +153,14 @@ export function PrLinkButton({ link, theme, compact = false }: { link: { url: st
153
153
  </PressScale></View>;
154
154
  }
155
155
 
156
- export function IconButton({ icon, label, onPress, theme, compact = false, disabled = false, spinning = false, color, tooltip = false }: { icon: string; label: string; onPress: () => void; theme: Theme; compact?: boolean; disabled?: boolean; spinning?: boolean; color?: string; tooltip?: boolean }) {
156
+ export function IconButton({ icon, label, onPress, theme, compact = false, disabled = false, spinning = false, color, tooltip = false, nativeID }: { icon: string; label: string; onPress: () => void; theme: Theme; compact?: boolean; disabled?: boolean; spinning?: boolean; color?: string; tooltip?: boolean; nativeID?: string }) {
157
157
  const c = theme.colors;
158
158
  const size = compact ? 44 : 28;
159
159
  // tooltip: the label as the desktop hover title. React Native Web drops `title` on a Pressable, so it goes on a
160
160
  // wrapper's DOM node (the client/linked.tsx pattern).
161
161
  const tip = useRef<View | null>(null);
162
162
  useEffect(() => { if (tooltip && Platform.OS === "web") (tip.current as unknown as { setAttribute?: (k: string, v: string) => void } | null)?.setAttribute?.("title", label); }, [tooltip, label]);
163
- const button = <PressScale accessibilityRole="button" accessibilityLabel={label} disabled={disabled} onPress={onPress} hitSlop={compact ? 0 : 6}
163
+ const button = <PressScale nativeID={nativeID} accessibilityRole="button" accessibilityLabel={label} disabled={disabled} onPress={onPress} hitSlop={compact ? 0 : 6}
164
164
  style={({ pressed, hovered }) => ({ width: size, height: size, borderRadius: 6, alignItems: "center", justifyContent: "center", backgroundColor: pressed ? c.surface2 : hovered ? c.surface1 : "transparent", opacity: disabled && !spinning ? 0.45 : 1 })}>
165
165
  {spinning ? <Spinner color={color ?? c.foregroundMuted} size={14} label={label} /> : <Icon name={icon} size={compact ? 18 : 15} color={color ?? c.foregroundMuted} />}
166
166
  </PressScale>;
@@ -168,9 +168,12 @@ export function IconButton({ icon, label, onPress, theme, compact = false, disab
168
168
  }
169
169
 
170
170
  export type CardTone = "plain" | "attention" | "success";
171
- /** A raised container with an icon title. Attention cards trade the ring for a warning border. */
172
- export function Card({ theme, icon, title, tone = "plain", count, right, children, compact = false, style }: {
173
- theme: Theme; icon: string; title: string; tone?: CardTone; count?: string | number; right?: ReactNode; children: ReactNode; compact?: boolean; style?: StyleProp<ViewStyle>;
171
+ /**
172
+ * A raised container with an icon title. Attention cards trade the ring for a warning border. `search`: the section
173
+ * is being searched (client/section-search.tsx), and its field takes the title's place in the header.
174
+ */
175
+ export function Card({ theme, icon, title, tone = "plain", count, right, children, compact = false, style, search }: {
176
+ theme: Theme; icon: string; title: string; tone?: CardTone; count?: string | number; right?: ReactNode; children: ReactNode; compact?: boolean; style?: StyleProp<ViewStyle>; search?: ReactNode;
174
177
  }) {
175
178
  const c = theme.colors;
176
179
  const accent = tone === "attention" ? c.statusWarning : tone === "success" ? c.statusSuccess : null;
@@ -178,10 +181,12 @@ export function Card({ theme, icon, title, tone = "plain", count, right, childre
178
181
  accent ? { borderWidth: 1, borderColor: withAlpha(accent, 0.7) } : raised(c), style]}>
179
182
  <View style={{ flexDirection: "row", alignItems: "center", gap: compact ? 8 : 7, paddingHorizontal: compact ? 14 : 12, paddingTop: 10, paddingBottom: 8, minHeight: compact ? 44 : undefined }}>
180
183
  <Icon name={icon} size={compact ? 16 : 14} color={accent ?? c.foregroundMuted} />
181
- <Text accessibilityRole="header" style={{ color: accent ?? c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: "600" }}>{title}</Text>
182
- {count !== undefined && count !== "" && <Chip theme={theme} color={accent ?? c.foregroundMuted} label={String(count)} />}
183
- <View style={{ flex: 1 }} />
184
- {right}
184
+ {search ?? <>
185
+ <Text accessibilityRole="header" style={{ color: accent ?? c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: "600" }}>{title}</Text>
186
+ {count !== undefined && count !== "" && <Chip theme={theme} color={accent ?? c.foregroundMuted} label={String(count)} />}
187
+ <View style={{ flex: 1 }} />
188
+ {right}
189
+ </>}
185
190
  </View>
186
191
  {children}
187
192
  </View>;
@@ -1,8 +1,8 @@
1
1
  import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
2
- import { Animated, Easing, Keyboard, Platform, ScrollView, View, type ViewStyle } from "react-native";
2
+ import { Animated, Easing, Keyboard, Platform, View, type ViewStyle, type ScrollView as NativeScrollView } from "react-native";
3
3
  import { Pressable, Text } from "./text";
4
4
  import { useRpc, useSettings } from "@getpaseo/plugin/client";
5
- import { Icon, copyText, useToast } from "@getpaseo/plugin/client/ui";
5
+ import { Icon, ScrollView, copyText, useToast } from "@getpaseo/plugin/client/ui";
6
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
7
  import { followSettingsRpc, onboardingChecksRpc, onboardingRpc, setFollowSettingsRpc, setOnboardingRpc } from "../shared/contracts";
8
8
  import { displayPreferences } from "../shared/display";
@@ -61,7 +61,7 @@ export function Setup({ theme, compact, view, deps }: { theme: Theme; compact: b
61
61
  const act = useRpc(setOnboardingRpc); const cache = useQueryClient(); const toast = useToast();
62
62
  const [step, setStep] = useState<OnboardingStep>(view.step);
63
63
  const index = ONBOARDING_STEPS.indexOf(step);
64
- const scroll = useRef<ScrollView>(null);
64
+ const scroll = useRef<NativeScrollView>(null);
65
65
  const follow = useFollowSettings();
66
66
  // Checks start on the first frame so step 2 usually opens with its answers in. One cached call, never polled.
67
67
  const checks = useChecks();
package/client/panel.tsx CHANGED
@@ -1,8 +1,8 @@
1
1
  import { useEffect, useState, type ReactNode } from "react";
2
2
  import { recoveryActions } from "./recovery-actions";
3
- import { ScrollView, View } from "react-native";
3
+ import { View } from "react-native";
4
4
  import { Text } from "./text";
5
- import { Icon, useToast } from "@getpaseo/plugin/client/ui";
5
+ import { Icon, ScrollView, useToast } from "@getpaseo/plugin/client/ui";
6
6
  import { useAgent, useRpc, useTabState, openExternalUrl, type PluginHostProps, type PluginWorkspacePanelProps } from "@getpaseo/plugin/client";
7
7
  import { z } from "zod";
8
8
  import type { InboxStore } from "./inbox-store";
package/client/pill.tsx CHANGED
@@ -1,11 +1,11 @@
1
1
  import { useState, useSyncExternalStore } from "react";
2
2
  import { browserKey } from "./keys";
3
3
  import { openRowCopy, useDetailGate, useWorkspace } from "./workspace-data";
4
- import { ScrollView, View } from "react-native";
4
+ import { View } from "react-native";
5
5
  import { Pressable, Text } from "./text";
6
6
  import { useQuery } from "@tanstack/react-query";
7
7
  import { useRpc, type PluginButtonContentProps, type PluginButtonIconProps, type PluginButtonRegistration, type PluginClientContext } from "@getpaseo/plugin/client";
8
- import { Icon } from "@getpaseo/plugin/client/ui";
8
+ import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
9
9
  import { browserStatusRpc } from "../shared/contracts";
10
10
  import { activeNeeds, needsYou, type NeedItem } from "../shared/attention";
11
11
  import { briefQuestionIds, echoedItems, HEADLINE_ICON, todoLine, HEADLINE_TONE, pillState, todoLabel, withoutBriefQuestions, type PillState } from "../shared/headline";
@@ -23,6 +23,9 @@ import { prLinksByNumber } from "../shared/presentation";
23
23
  import { notice, openQuestion, runAction } from "./toasts";
24
24
  import { putInChatOrCopy } from "../shared/put-in-chat";
25
25
  import { useChatComposer } from "./put-in-chat";
26
+ import { Marked, NoMatchRow, useSectionSearch } from "./section-search";
27
+ import { activityFields, questionFields, questionStatus } from "../shared/section-search";
28
+ import type { Activity } from "../shared/activity";
26
29
  import { clearPendingAnswer, failPendingAnswer, pendingKey, setPendingAnswer, usePendingAnswer, usePendingAnswers, type PendingAnswer } from "./pending-answers";
27
30
 
28
31
  const who = (w: Pick<ListWorkspace, "mainAgentId">, agentId: string | null) => !agentId || agentId === w.mainAgentId ? "the main agent" : "a root session";
@@ -353,9 +356,13 @@ export function ActivityCard({ workspace: w, theme, compact, now, open, toggle,
353
356
  const rows = activity(w);
354
357
  const questions = [...w.questions].sort((a, b) => Number(isOpen(b)) - Number(isOpen(a)) || Number(b.id.slice(1)) - Number(a.id.slice(1)));
355
358
  const [tab, setTab] = useState<"timeline" | "questions">("timeline");
359
+ // Activity searches both tabs at once; each tab chip then counts its own matches.
360
+ const search = useSectionSearch<Activity | Question>(w.id, "activity", { theme, compact, items: [...rows, ...questions], fields: x => "askedAt" in x ? questionFields(x) : activityFields(x) });
361
+ const hits = search.hits;
356
362
  if (!rows.length && !questions.length) return null;
357
363
  const all = open("activity");
358
364
  const LIMIT = 5;
365
+ const found = { timeline: hits ? rows.filter(r => hits.has(r)) : rows, questions: hits ? questions.filter(q => hits.has(q)) : questions };
359
366
  const tabButton = (id: "timeline" | "questions", label: string, count?: number) => {
360
367
  const selected = tab === id;
361
368
  return <Pressable key={id} accessibilityRole="tab" aria-selected={selected} accessibilityState={{ selected }} accessibilityLabel={count !== undefined ? `${label}, ${count}` : label} onPress={() => setTab(id)} hitSlop={4}
@@ -364,14 +371,23 @@ export function ActivityCard({ workspace: w, theme, compact, now, open, toggle,
364
371
  {count !== undefined && <Text style={{ color: c.foregroundMuted, fontSize: 12, fontVariant: ["tabular-nums"] }}>{count}</Text>}
365
372
  </Pressable>;
366
373
  };
367
- const list = tab === "timeline" ? rows : questions;
368
- const shown = all ? list : list.slice(0, LIMIT);
369
- return <Card theme={theme} compact={compact} icon="Activity" title="Activity"
370
- right={questions.length ? <View accessibilityRole="tablist" style={{ flexDirection: "row", gap: 2, marginVertical: -4 }}>{tabButton("timeline", "Timeline")}{tabButton("questions", "Questions", questions.length)}</View> : undefined}>
374
+ const list = found[tab];
375
+ // While searching, "Show all" is ignored: every match shows.
376
+ const shown = all || hits ? list : list.slice(0, LIMIT);
377
+ const tabs = (counts: boolean) => <View accessibilityRole="tablist" style={{ flexDirection: "row", gap: 2, marginVertical: -4 }}>{tabButton("timeline", "Timeline", counts ? found.timeline.length : undefined)}{tabButton("questions", "Questions", found.questions.length)}</View>;
378
+ return <Card theme={theme} compact={compact} icon="Activity" title="Activity" search={search.header}
379
+ right={<View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>{questions.length ? tabs(false) : null}{search.button}</View>}>
380
+ {/* Searching: the tabs move under the field and count their matches, so a hit in the other tab is never hidden. */}
381
+ {search.header && questions.length > 0 && <View style={{ flexDirection: "row", paddingHorizontal: compact ? 14 : 12, paddingTop: 6, paddingBottom: 10 }}>{tabs(!!hits)}</View>}
382
+ {hits && !hits.size && <NoMatchRow section="activity" query={search.query!} theme={theme} compact={compact} />}
383
+ {hits && hits.size > 0 && !list.length && <View style={{ paddingHorizontal: compact ? 14 : 12, paddingVertical: 10, borderTopWidth: 1, borderTopColor: c.border }}>
384
+ <Text style={t.meta}>{`Nothing in ${tab === "timeline" ? "Timeline" : "Questions"} matches. ${found[tab === "timeline" ? "questions" : "timeline"].length} in ${tab === "timeline" ? "Questions" : "Timeline"}.`}</Text>
385
+ </View>}
371
386
  {/* The timeline is drawn on the same rail as the stacks: a 2px line through 16px state nodes. */}
372
- {tab === "timeline" ? <View style={{ paddingHorizontal: 12, paddingTop: 4, paddingBottom: 6, borderTopWidth: 1, borderTopColor: c.border }}>
387
+ {!list.length ? null : tab === "timeline" ? <View style={{ paddingHorizontal: 12, paddingTop: 4, paddingBottom: 6, borderTopWidth: 1, borderTopColor: c.border }}>
373
388
  {(shown as typeof rows).map((r, i, all) => {
374
389
  const color = toneColor(c, r.tone);
390
+ const hit = hits?.get(r);
375
391
  return <View key={r.key} style={{ flexDirection: "row", gap: 10 }}>
376
392
  <View style={{ width: 16, alignItems: "center" }}>
377
393
  <View style={{ width: 2, height: 8, backgroundColor: i === 0 ? "transparent" : c.border }} />
@@ -380,17 +396,18 @@ export function ActivityCard({ workspace: w, theme, compact, now, open, toggle,
380
396
  </View>
381
397
  <View style={{ flex: 1, minWidth: 0, gap: 2, paddingTop: 6, paddingBottom: 8 }}>
382
398
  <View style={{ flexDirection: "row", alignItems: "baseline", gap: 8 }}>
383
- <Text numberOfLines={2} style={[t.body, { flex: 1 }]}>{r.text}</Text>
399
+ {hit ? <Marked numberOfLines={2} text={r.text} ranges={hit.ranges[0]} theme={theme} style={[t.body, { flex: 1 }]} /> : <Text numberOfLines={2} style={[t.body, { flex: 1 }]}>{r.text}</Text>}
384
400
  <Text style={t.small}>{ago(r.at, now)}</Text>
385
401
  </View>
386
- {(r.detail || r.took) && <RichText linkColor={c.foreground} numberOfLines={2} style={t.meta}>{[r.detail, r.took ? `took ${r.took}` : null].filter(Boolean).join(" · ")}</RichText>}
402
+ {(r.detail || r.took) && <RichText marks={hit && r.detail ? { ranges: hit.ranges[1], colors: c } : undefined} linkColor={c.foreground} numberOfLines={2} style={t.meta}>{[r.detail, r.took ? `took ${r.took}` : null].filter(Boolean).join(" · ")}</RichText>}
387
403
  </View>
388
404
  </View>;
389
405
  })}
390
406
  </View> : (shown as typeof questions).map(q => {
391
407
  // Until it reached the agent the row says where it is, in muted, like every other surface (answerStatus).
392
408
  const s = answerStatus(q);
393
- const status = q.answer ? `${s && !s.delivered ? `${s.label} · ` : ""}${answerLabel(q, q.answer.choice, q.answer.words)}` : q.closed ? `Withdrawn: ${q.closed.reason}` : "Waiting for you";
409
+ const status = questionStatus(q);
410
+ const hit = hits?.get(q);
394
411
  const icon = q.answer ? "MessageCircleReply" : q.closed ? "MessageCircleOff" : "MessageCircleQuestion";
395
412
  const color = s?.delivered ? c.statusSuccess : q.answer || q.closed ? c.foregroundMuted : c.statusWarning;
396
413
  return <CardRow key={q.id} theme={theme} onPress={() => onOpenQuestion(q.id)} accessibilityLabel={`${q.id}, ${q.title}. ${status}. Open`}>
@@ -398,14 +415,15 @@ export function ActivityCard({ workspace: w, theme, compact, now, open, toggle,
398
415
  <View style={{ paddingTop: 2 }}><Icon name={icon} size={13} color={color} /></View>
399
416
  <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
400
417
  <View style={{ flexDirection: "row", alignItems: "baseline", gap: 8 }}>
401
- <RichText plain numberOfLines={1} style={[t.body, { flex: 1 }]}>{`${q.id} · ${q.title}`}</RichText>
418
+ {hit ? <Marked numberOfLines={1} text={`${q.id} · ${q.title}`} ranges={hit.ranges[0]} theme={theme} style={[t.body, { flex: 1 }]} /> : <RichText plain numberOfLines={1} style={[t.body, { flex: 1 }]}>{`${q.id} · ${q.title}`}</RichText>}
402
419
  <Text style={t.small}>{ago(q.answer?.at ?? q.closed?.at ?? q.askedAt, now)}</Text>
403
420
  </View>
404
- <RichText plain numberOfLines={2} style={[t.meta, !q.answer && !q.closed ? { color: c.statusWarning } : null]}>{status}</RichText>
421
+ {hit ? <Marked numberOfLines={2} text={status} ranges={hit.ranges[1]} theme={theme} style={[t.meta, !q.answer && !q.closed ? { color: c.statusWarning } : null]} />
422
+ : <RichText plain numberOfLines={2} style={[t.meta, !q.answer && !q.closed ? { color: c.statusWarning } : null]}>{status}</RichText>}
405
423
  </View>
406
424
  </View>
407
425
  </CardRow>;
408
426
  })}
409
- {list.length > LIMIT && <FoldRow theme={theme} compact={compact} open={all} onPress={() => toggle("activity")} icon="History" iconColor={c.foregroundMuted} label={all ? "Show less" : `Show all ${list.length}`} />}
427
+ {!hits && list.length > LIMIT && <FoldRow theme={theme} compact={compact} open={all} onPress={() => toggle("activity")} icon="History" iconColor={c.foregroundMuted} label={all ? "Show less" : `Show all ${list.length}`} />}
410
428
  </Card>;
411
429
  }
package/client/rename.tsx CHANGED
@@ -55,6 +55,7 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
55
55
  const [info, setInfo] = useState<RenameStatus | null>(null);
56
56
  const [phase, setPhase] = useState<Phase>("suggesting");
57
57
  const [error, setError] = useState<string | null>(null);
58
+ const [jobFailed, setJobFailed] = useState(false);
58
59
  const [name, setName] = useState("");
59
60
  const [edited, setEdited] = useState(false);
60
61
  const [details, setDetails] = useState(false);
@@ -65,7 +66,7 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
65
66
 
66
67
  const suggest = useCallback(async () => {
67
68
  const mine = ++run.current;
68
- setPhase("suggesting"); setError(null); setDetails(false); typed.current = false; setEdited(false); setName("");
69
+ setPhase("suggesting"); setError(null); setJobFailed(false); setDetails(false); typed.current = false; setEdited(false); setName("");
69
70
  // The quick read first (the name now, the Undo link), so the dialog is never blank while the model runs.
70
71
  status({ workspaceId: request.workspaceId }).then(s => { if (mine === run.current) setInfo(prev => prev ?? s); }).catch(() => undefined);
71
72
  try {
@@ -74,6 +75,7 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
74
75
  setInfo(s); if (!typed.current) setName(s.suggestion ?? ""); setPhase("ready");
75
76
  } catch (e) {
76
77
  if (mine !== run.current) return;
78
+ setJobFailed(/Couldn't suggest a name:/i.test(errorText(e)));
77
79
  setError(errorText(e).replace(/^Couldn't suggest a (usable )?name[:.]?\s*/i, "").replace(/\s*Try again, or type one\.?$/i, "") || null); setPhase("error");
78
80
  setTimeout(() => input.current?.focus(), 0);
79
81
  }
@@ -82,6 +84,8 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
82
84
 
83
85
  const now = info?.current ?? request.title ?? "";
84
86
  const check = checkName(name, { keys: info?.keys ?? [], current: now || null });
87
+ const invalidHint = (edited || phase === "ready") && !check.ok && !!name.trim();
88
+ const hintColor = edited ? c.statusDanger : c.statusWarning;
85
89
  const canRename = check.ok && (phase !== "suggesting" || edited);
86
90
  const refresh = () => { void cache.invalidateQueries({ queryKey: overviewKey }); void cache.invalidateQueries({ queryKey: ["follow-up"] }); };
87
91
 
@@ -101,7 +105,7 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
101
105
  };
102
106
 
103
107
  const field = { minHeight: compact ? 44 : 34, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, color: c.foreground, backgroundColor: c.surface1, fontSize: compact ? 16 : 14,
104
- borderColor: edited && !check.ok ? c.statusDanger : c.border };
108
+ borderColor: invalidHint ? hintColor : c.border };
105
109
  const counter = name.trim().length;
106
110
  // Only near the limit: the reason text covers the rest (words, keys, branch names).
107
111
  const showCounter = counter > NAME_MAX_CHARS - 15;
@@ -130,17 +134,18 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
130
134
  {phase === "error" && !edited && <View accessibilityRole="alert" style={{ flexDirection: "row", gap: 6 }}>
131
135
  <View style={{ paddingTop: 2 }}><Icon name="TriangleAlert" size={13} color={c.statusWarning} /></View>
132
136
  <View style={{ flex: 1, gap: 2 }}>
133
- <Text style={[t.meta, { color: c.statusWarning }]}>Couldn't suggest a name. Type one, or try again.</Text>
134
- {!!error && (details
137
+ <Text style={[t.meta, { color: c.statusWarning }]}>{jobFailed ? "Couldn't suggest a name. Type one, or try again." : error || "Couldn't load this workspace. Type a name, or try again."}</Text>
138
+ {jobFailed && !!error && (details
135
139
  ? <Text selectable style={t.small}>{error}</Text>
136
140
  : <Pressable accessibilityRole="button" onPress={() => setDetails(true)} style={{ alignSelf: "flex-start" }}><Text style={[t.small, { textDecorationLine: "underline" }]}>Details</Text></Pressable>)}
137
141
  </View>
138
142
  </View>}
139
- {edited && !check.ok && !!name.trim() && <View accessibilityLiveRegion="polite" style={{ flexDirection: "row", gap: 6 }}>
140
- <View style={{ paddingTop: 1 }}><Icon name="CircleAlert" size={13} color={c.statusDanger} /></View>
141
- <Text style={[t.small, { flex: 1, color: c.statusDanger }]}>{check.reason}</Text>
143
+ {invalidHint && !check.ok && <View accessibilityLiveRegion="polite" style={{ flexDirection: "row", gap: 6 }}>
144
+ <View style={{ paddingTop: 1 }}><Icon name="CircleAlert" size={13} color={hintColor} /></View>
145
+ <Text style={[t.small, { flex: 1, color: hintColor }]}>{check.reason}</Text>
142
146
  </View>}
143
- {(!edited || !name.trim()) && phase !== "error" && <Text style={t.small}>{NAME_RULE}</Text>}
147
+ {(!edited || !name.trim()) && !invalidHint && phase !== "error" && <Text style={t.small}>{NAME_RULE}</Text>}
148
+ {phase === "ready" && !edited && !!info?.notice && <Text accessibilityLiveRegion="polite" style={[t.small, { color: c.statusWarning }]}>{info.notice}</Text>}
144
149
  </View>
145
150
  <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, alignItems: "center" }}>
146
151
  {/* After a failed suggestion with nothing typed, Try again is the likely next step, so it leads. */}
@@ -1,9 +1,10 @@
1
1
  import { useEffect, useState, useSyncExternalStore } from "react";
2
- import { Platform, ScrollView, View } from "react-native";
2
+ import { Platform, View } from "react-native";
3
3
  import { Pressable, Text } from "./text";
4
4
  import { openExternalUrl, useRpc, type PluginHostProps } from "@getpaseo/plugin/client";
5
- import { Icon, Modal, TextInput } from "@getpaseo/plugin/client/ui";
5
+ import { Icon, Modal, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
6
6
  import { reportLinkRpc, reportSendRpc, reportTargetsRpc } from "../shared/contracts";
7
+ import { NEW_AGENT, NEW_WORKSPACE, PICKER_MAX, defaultChoice, pickerScrolls, newAgentLines, pickerRows, targetLines, type PickerRow, type SendTargets } from "../shared/report-send";
7
8
  import { errorText } from "../shared/errors";
8
9
  import { BRAND_ICONS } from "./brand-icons";
9
10
  import { Button, SubmitScope, text } from "./kit";
@@ -45,23 +46,14 @@ const KINDS: { id: ReportKind; label: string; icon: string; placeholder: string
45
46
  ];
46
47
  export const TRUST_LINE = "The agent gathers versions and recent errors, removes private names, and shows you the issue before filing it. Nothing is posted without your yes.";
47
48
 
48
- type Target = { id: string; title: string; provider: string; status: string; workspaceId: string | null; workspaceTitle: string | null; main: boolean };
49
- const NEW = "new";
50
- /** The picker's height: about five rows (52 desktop, 54 on phones), plus half a row so it's clear the list scrolls. */
51
- export const PICKER_MAX = (compact: boolean) => Math.round((compact ? 54 : 52) * 5.5);
49
+ export { PICKER_MAX, targetLines };
52
50
 
53
- /** "Billing retries · main agent", "Claude Code · idle". */
54
- export function targetLines(t: Target): [string, string] {
55
- const provider = t.provider === "claude" ? "Claude Code" : t.provider === "codex" ? "Codex" : t.provider;
56
- const head = t.workspaceTitle ? `${t.workspaceTitle} · ${t.main ? "main agent" : t.title}` : t.title;
57
- return [head, `${provider} · ${t.status === "running" ? "working" : t.status}`];
58
- }
59
-
60
- function ProviderMark({ provider, theme }: { provider: string | null; theme: Theme }) {
51
+ function ProviderMark({ provider, mark, theme }: { provider: string | null; mark?: PickerRow["mark"]; theme: Theme }) {
61
52
  const c = theme.colors;
62
53
  return <View style={{ width: 22, height: 22, borderRadius: 6, backgroundColor: c.surface2, alignItems: "center", justifyContent: "center" }}>
63
54
  {provider === "claude" ? <Icon icon={BRAND_ICONS.claude} size={13} color={c.foregroundMuted} />
64
- : provider === null ? <Icon name="Plus" size={13} color={c.foregroundMuted} />
55
+ : mark === "workspace" ? <Icon name="FolderPlus" size={13} color={c.foreground} />
56
+ : provider === null ? <Icon name="Plus" size={13} color={mark ? c.foreground : c.foregroundMuted} />
65
57
  : <Icon name={provider === "codex" ? "SquareTerminal" : "Bot"} size={13} color={c.foregroundMuted} />}
66
58
  </View>;
67
59
  }
@@ -91,35 +83,40 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
91
83
  const [picked, setPicked] = useState<string | null>(null);
92
84
  const [choosing, setChoosing] = useState(false);
93
85
  const [phase, setPhase] = useState<Phase>({ kind: "edit" });
94
- const [targets, setTargets] = useState<{ agents: Target[]; defaultId: string | null; newAgentWorkspace: { id: string; title: string } | null } | null>(null);
86
+ const [targets, setTargets] = useState<SendTargets | null>(null);
95
87
  const readTargets = useRpc(reportTargetsRpc); const send = useRpc(reportSendRpc); const link = useRpc(reportLinkRpc);
96
88
  useEffect(() => {
97
89
  let live = true;
98
90
  readTargets({ workspaceId: request.workspaceId, agentId: request.agentId }).then(r => { if (live) setTargets(r); }).catch(() => { if (live) setTargets({ agents: [], defaultId: null, newAgentWorkspace: null }); });
99
91
  return () => { live = false; };
100
92
  }, [request.workspaceId, request.agentId]);
101
- const chosen = picked ?? targets?.defaultId ?? (targets?.newAgentWorkspace ? NEW : null);
102
- const target = targets?.agents.find(a => a.id === chosen) ?? null;
103
- const nowhere = !!targets && !targets.agents.length && !targets.newAgentWorkspace;
93
+ const chosen = picked ?? (targets ? defaultChoice(targets) : null);
94
+ const rows = targets ? pickerRows(targets) : { pinned: [], agents: [] };
95
+ const chosenRow = [...rows.pinned, ...rows.agents].find(r => r.id === chosen) ?? null;
96
+ const nowhere = !!targets && !targets.agents.length && !targets.newAgentWorkspace && !targets.newWorkspace;
104
97
  const empty = !words.trim() && !error;
105
98
  const placeholder = error ? "Anything else? What were you doing when it happened?" : KINDS.find(k => k.id === kind)!.placeholder;
106
99
  const submit = async () => {
107
100
  if (empty || phase.kind === "sending" || !chosen) return;
108
101
  setPhase({ kind: "sending" });
109
102
  try {
110
- const r = await send({ kind, text: words, error, ...(chosen === NEW ? { newAgentWorkspaceId: targets!.newAgentWorkspace!.id } : { agentId: chosen }) });
103
+ const r = await send({ kind, text: words, error, ...(chosen === NEW_AGENT ? { newAgentWorkspaceId: targets!.newAgentWorkspace!.id } : chosen === NEW_WORKSPACE ? { newWorkspaceProjectId: targets!.newWorkspace!.projectId } : { agentId: chosen }) });
111
104
  setPhase({ kind: "sent", ...r });
112
105
  } catch (e) { setPhase({ kind: "failed", message: errorText(e) }); }
113
106
  };
114
107
  const openGithub = async () => { try { const { url } = await link({ kind, text: [words, error ? `Error: ${error}` : ""].filter(Boolean).join("\n\n") }); await openExternalUrl(url); onClose(); } catch (e) { setPhase({ kind: "failed", message: errorText(e) }); } };
115
108
  const pad = compact ? 16 : 16;
116
- const row = (id: string, lines: [string, string], provider: string | null, selected: boolean, onPress: () => void, first: boolean) =>
117
- <Pressable key={id} accessibilityRole="button" accessibilityState={{ selected }} onPress={onPress}
118
- style={state => ({ flexDirection: "row", alignItems: "center", gap: 10, paddingHorizontal: 10, paddingVertical: 8, minHeight: compact ? 48 : 0, borderTopWidth: first ? 0 : 1, borderTopColor: c.border, backgroundColor: selected || (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
119
- <ProviderMark provider={provider} theme={theme} />
120
- <View style={{ flex: 1, minWidth: 0 }}><Text numberOfLines={1} style={t.body}>{lines[0]}</Text><Text numberOfLines={1} style={t.meta}>{lines[1]}</Text></View>
109
+ const row = (r: PickerRow, first: boolean) => {
110
+ const selected = r.id === chosen;
111
+ return <Pressable key={r.id} accessibilityRole="button" accessibilityState={{ selected }} onPress={() => { setPicked(r.id); setChoosing(false); }}
112
+ style={state => ({ flexDirection: "row", alignItems: "center", gap: 10, paddingHorizontal: 10, paddingVertical: 8, minHeight: compact ? 54 : 52, borderTopWidth: first ? 0 : 1, borderTopColor: c.border, backgroundColor: selected || (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
113
+ <ProviderMark provider={r.provider} mark={r.mark} theme={theme} />
114
+ <View style={{ flex: 1, minWidth: 0 }}><Text numberOfLines={1} style={t.body}>{r.lines[0]}</Text><Text numberOfLines={1} style={t.meta}>{r.lines[1]}</Text></View>
115
+ {selected && <Icon name="Check" size={14} color={c.foreground} />}
121
116
  </Pressable>;
122
- const newLines: [string, string] = ["A new agent", `Starts in ${targets?.newAgentWorkspace?.title ?? "this workspace"}, with the default model`];
117
+ };
118
+ const agentRows = rows.agents.map((r, i) => row(r, i === 0));
119
+ const shownLines = chosenRow?.lines ?? newAgentLines(targets?.newAgentWorkspace?.title);
123
120
 
124
121
  if (phase.kind === "sent") return <Modal.Content contentContainerStyle={{ padding: 0, gap: 0 }}>
125
122
  <View style={{ padding: pad, gap: 12 }}>
@@ -158,15 +155,20 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
158
155
  {!targets ? <View style={{ minHeight: 46, justifyContent: "center", paddingHorizontal: 10, borderWidth: 1, borderColor: c.border, borderRadius: 8 }}><Spinner color={c.foregroundMuted} size={14} label="Loading agents" /></View>
159
156
  : <Pressable accessibilityRole="button" accessibilityLabel="Send to" accessibilityHint="Pick which agent gets this" onPress={() => setChoosing(v => !v)}
160
157
  style={{ flexDirection: "row", alignItems: "center", gap: 10, borderWidth: 1, borderColor: c.border, borderRadius: 8, paddingHorizontal: 10, paddingVertical: 8, minHeight: compact ? 48 : 0, backgroundColor: c.surface0 }}>
161
- <ProviderMark provider={target ? target.provider : null} theme={theme} />
162
- <View style={{ flex: 1, minWidth: 0 }}>{(target ? targetLines(target) : newLines).map((l, i) => <Text key={i} numberOfLines={1} style={i ? t.meta : t.body}>{l}</Text>)}</View>
158
+ <ProviderMark provider={chosenRow?.provider ?? null} mark={chosenRow ? chosenRow.mark : "agent"} theme={theme} />
159
+ <View style={{ flex: 1, minWidth: 0 }}>{shownLines.map((l, i) => <Text key={i} numberOfLines={1} style={i ? t.meta : t.body}>{l}</Text>)}</View>
163
160
  <Icon name="ChevronsUpDown" size={14} color={c.foregroundMuted} />
164
161
  </Pressable>}
165
- {/* About five rows show; more scroll inside, so a long list never pushes the trust line and Send off the dialog. */}
166
- {choosing && targets && <ScrollView nestedScrollEnabled style={{ marginTop: 6, maxHeight: PICKER_MAX(compact), borderWidth: 1, borderColor: c.border, borderRadius: 8, backgroundColor: c.surface0 }}>
167
- {targets.agents.map((a, i) => row(a.id, targetLines(a), a.provider, a.id === chosen, () => { setPicked(a.id); setChoosing(false); }, i === 0))}
168
- {targets.newAgentWorkspace && row(NEW, newLines, null, chosen === NEW, () => { setPicked(NEW); setChoosing(false); }, !targets.agents.length)}
169
- </ScrollView>}
162
+ {/* The new rows first, pinned; then the agents, which scroll inside on desktop and with the sheet on phones. */}
163
+ {choosing && targets && <View style={{ marginTop: 6, borderWidth: 1, borderColor: c.border, borderRadius: 8, backgroundColor: c.surface0, overflow: "hidden" }}>
164
+ {rows.pinned.map((r, i) => row(r, i === 0))}
165
+ {!!rows.agents.length && <View style={{ flexDirection: "row", justifyContent: "space-between", paddingHorizontal: 10, paddingTop: 8, paddingBottom: 6, borderTopWidth: rows.pinned.length ? 1 : 0, borderTopColor: c.border, borderBottomWidth: 1, borderBottomColor: c.border }}>
166
+ <Text style={t.meta}>Agents</Text><Text style={[t.meta, { fontVariant: ["tabular-nums"] }]}>{rows.agents.length}</Text>
167
+ </View>}
168
+ {pickerScrolls(compact)
169
+ ? <ScrollView nestedScrollEnabled style={{ maxHeight: PICKER_MAX(compact), flexGrow: 0 }}>{agentRows}</ScrollView>
170
+ : agentRows}
171
+ </View>}
170
172
  </View>}
171
173
  {!nowhere && <View style={{ flexDirection: "row", gap: 8 }}>
172
174
  <Icon name="ShieldCheck" size={14} color={c.foregroundMuted} />
@@ -177,7 +179,7 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
177
179
  <Footer compact={compact} theme={theme}>
178
180
  <Button title="Cancel" kind="ghost" theme={theme} compact={compact} grow={compact} onPress={onClose} />
179
181
  {nowhere ? <Button title="Open on GitHub" icon="ExternalLink" kind="primary" theme={theme} compact={compact} grow={compact} disabled={empty} onPress={() => void openGithub()} />
180
- : <Button title={chosen === NEW ? "Start agent and send" : "Send to agent"} kind="primary" theme={theme} compact={compact} grow={compact} shortcut disabled={empty || !chosen} loading={phase.kind === "sending"} onPress={() => void submit()} />}
182
+ : <Button title={chosen === NEW_WORKSPACE ? "Start workspace and send" : chosen === NEW_AGENT ? "Start agent and send" : "Send to agent"} kind="primary" theme={theme} compact={compact} grow={compact} shortcut disabled={empty || !chosen} loading={phase.kind === "sending"} onPress={() => void submit()} />}
181
183
  </Footer>
182
184
  </SubmitScope></Modal.Content>;
183
185
  }
@@ -1,8 +1,8 @@
1
1
  import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
2
- import { TextInput, View } from "react-native";
2
+ import { View } from "react-native";
3
3
  import { Pressable, Text } from "./text";
4
4
  import { useRpc } from "@getpaseo/plugin/client";
5
- import { Icon, SettingsAction, SettingsCard, useToast } from "@getpaseo/plugin/client/ui";
5
+ import { Icon, SettingsAction, SettingsCard, useToast, TextInput } from "@getpaseo/plugin/client/ui";
6
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
7
  import { reviewerSettingsRpc, reviewerSuggestionsRpc, saveReviewersRpc } from "../shared/contracts";
8
8
  import { MAX_REVIEWERS, TEAM_SLUG, USER_LOGIN, isTeam, resolveReviewers, reviewerConfig, reviewerLabel, sameLogin, setReviewerConfig, type ReviewerEntry } from "../shared/reviewers";