paseo-follow-up 2.2.1-beta.1 → 2.3.0-beta.0

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.
@@ -596,27 +596,37 @@ export function Finished({ theme, compact, stats, empty, onHome, onSkipped }: {
596
596
  </ScrollView>;
597
597
  }
598
598
 
599
- /** S: the keys, from the one list the handler reads (shared/catch-up.ts). A dialog over the card; S or its X closes it. */
600
- export function KeysSheet({ theme, onClose }: { theme: Theme; onClose: () => void }) {
599
+ /** A keys sheet's rows: a key (as spelled in its list) and what it does. */
600
+ export type KeySection = { title: string; keys: readonly { key: string; what: string }[] };
601
+
602
+ /**
603
+ * S: the keys, from the one list the handler reads (Catch up: shared/catch-up.ts; Home: shared/home-keys.ts). A dialog
604
+ * over the screen; S or its X closes it.
605
+ */
606
+ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: given, keyWidth = 64 }: { theme: Theme; onClose: () => void; label?: string; sections?: readonly KeySection[]; /** The key column, wide enough for the list's longest key so every description lines up. */ keyWidth?: number }) {
601
607
  const dictation = !!hostDictation();
608
+ const sections = given ?? catchUpSections(dictation);
602
609
  const c = theme.colors; const t = text(c, false);
603
- const row = (k: typeof CATCH_UP_KEYS[number]) => <View key={`${k.action}-${k.key}`} style={{ flexDirection: "row", gap: 10, alignItems: "center" }}>
604
- <View style={{ minWidth: 64 }}><Text style={[t.meta, { alignSelf: "flex-start", paddingHorizontal: 6, borderRadius: 4, borderWidth: 1, borderColor: c.border, color: c.foreground, fontVariant: ["tabular-nums"] }]}>{keyLabel(k.key, isMac())}</Text></View>
605
- <Text style={t.meta}>{k.what}</Text>
606
- </View>;
607
- const section = (title: string, keys: readonly typeof CATCH_UP_KEYS[number][]) => <View style={{ gap: 6 }}>
608
- <Text style={[t.small, { fontWeight: "600" }]}>{title}</Text>{keys.map(row)}
610
+ const row = (k: KeySection["keys"][number], i: number) => <View key={`${k.key}-${i}`} style={{ flexDirection: "row", gap: 10, alignItems: "center" }}>
611
+ <View style={{ width: keyWidth }}><Text style={[t.meta, { alignSelf: "flex-start", paddingHorizontal: 6, borderRadius: 4, borderWidth: 1, borderColor: c.border, color: c.foreground, fontVariant: ["tabular-nums"] }]}>{keyLabel(k.key, isMac())}</Text></View>
612
+ <Text style={[t.meta, { flex: 1, minWidth: 0 }]}>{k.what}</Text>
609
613
  </View>;
610
- return <View role="dialog" accessibilityLabel="Catch up keys" style={{ position: "absolute", zIndex: 10, right: 20, top: 8, width: 300, padding: 16, gap: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12 }}>
614
+ return <View role="dialog" accessibilityLabel={label} style={{ position: "absolute", zIndex: 10, right: 20, top: 8, width: 236 + keyWidth, padding: 16, gap: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12 }}>
611
615
  <View style={{ flexDirection: "row", alignItems: "center" }}>
612
616
  <Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
613
617
  <IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
614
618
  </View>
615
- {section("On a card", CATCH_UP_KEYS.filter(k => !k.when && (!k.needs || dictation)))}
616
- {section("In More context", CATCH_UP_KEYS.filter(k => k.when === "more"))}
617
- {section("In the queue", CATCH_UP_KEYS.filter(k => k.when === "rail"))}
619
+ {sections.filter(s => s.keys.length).map(s => <View key={s.title} style={{ gap: 6 }}>
620
+ <Text style={[t.small, { fontWeight: "600" }]}>{s.title}</Text>{s.keys.map(row)}
621
+ </View>)}
618
622
  </View>;
619
623
  }
624
+ /** Catch up's sheet: the dictation key only where the host has a mic. */
625
+ const catchUpSections = (dictation: boolean): readonly KeySection[] => [
626
+ { title: "On a card", keys: CATCH_UP_KEYS.filter(k => !k.when && (!k.needs || dictation)) },
627
+ { title: "In More context", keys: CATCH_UP_KEYS.filter(k => k.when === "more") },
628
+ { title: "In the queue", keys: CATCH_UP_KEYS.filter(k => k.when === "rail") },
629
+ ];
620
630
 
621
631
  /** A desktop hover title on any control (react-native-web drops `title` on a Pressable; IconButton does the same). */
622
632
  function Tip({ label, children }: { label: string; children: ReactNode }) {
@@ -116,6 +116,9 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
116
116
  {...(listKeys ? { dataSet: { listKeys: "1" } } as object : {})}
117
117
  onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
118
118
  onSubmitEditing={onSubmit}
119
+ // A single-line field blurs on submit by default, which dropped focus on the page after a search pick while the
120
+ // results stayed up, so the second Enter reached nothing (the-selected-workspace-opens-with-enter).
121
+ blurOnSubmit={false}
119
122
  onKeyPress={e => {
120
123
  const key = (e.nativeEvent as { key?: string }).key;
121
124
  if (key === "ArrowDown" && onArrow) { e.preventDefault?.(); onArrow(1); }
@@ -135,12 +138,13 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
135
138
  * Home's search. Its chip names the search-from-anywhere key when one is set (it works here too), else "/"; plain "/"
136
139
  * focuses it on Home either way (useSlashToFocus).
137
140
  */
138
- export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem) => void; anywhereKey?: string | null }) {
141
+ /** `onEnter`: the active result, or null when the query is empty (Home then opens its selection). */
142
+ export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem | null) => void; anywhereKey?: string | null }) {
139
143
  const { query, setQuery, results, active, move, inputRef, askOn } = omnibox;
140
144
  const placeholder = askOn ? dense ? "Search or ask the Overseer" : "Search, or ask the Overseer" : "Search workspaces, branches, PRs";
141
145
  return <QueryField theme={theme} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} slashHint={anywhereKey || "/"}
142
146
  slashTitle={anywhereKey ? `${anywhereKey} from anywhere · / on Home` : "/ focuses the search"}
143
- onSubmit={() => { const item = results?.[active]; if (item) onEnter(item); }} onArrow={move} listKeys={!query.trim()} />;
147
+ onSubmit={() => { const item = results?.[active]; if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} />;
144
148
  }
145
149
 
146
150
  /**
@@ -79,11 +79,11 @@ export type HomeListProps = {
79
79
  menu: { build: (s: Workstream) => RowMenuSection[]; pick: (s: Workstream, item: RowMenuItem) => void };
80
80
  /**
81
81
  * Desktop and web keys (client/list-keys.ts, one-keyboard-walk-for-every-list): ↑/↓ and j/k walk the rows in this
82
- * list's order, Home/End jump, Enter opens. "select" moves the selection (Home); "focus" moves only the focus and
82
+ * list's order, Home/End jump, Enter or O opens, S shows the keys (`onKeys`, Home). "select" moves the selection (Home); "focus" moves only the focus and
83
83
  * Enter opens (the sidebar view). `scope`: where the keys count (default: this list); `claimBody`: also with
84
84
  * nothing focused.
85
85
  */
86
- keys?: { mode: "select" | "focus"; onOpen: (key: string) => void; scope?: { current: unknown }; claimBody?: boolean };
86
+ keys?: { mode: "select" | "focus"; onOpen: (key: string) => void; onKeys?: () => void; scope?: { current: unknown }; claimBody?: boolean };
87
87
  /** The selected row's fill. Paseo's sidebar view passes its own selected-item colour (sidebarSelected); Home: surface2. */
88
88
  selectedBg?: string;
89
89
  };
@@ -164,11 +164,13 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
164
164
  // results through the omnibox instead.
165
165
  const order = useMemo(() => results ? [] : walkOrder(data), [data, results]);
166
166
  useListKeys({
167
- enabled: !!keys && !touch && !results, order, mode: keys?.mode ?? "focus",
167
+ // On while a search shows its results too: the walk has no rows then (walkOrder), but Enter with nothing focused
168
+ // still opens the selection the search picked.
169
+ enabled: !!keys && !touch, order, mode: keys?.mode ?? "focus",
168
170
  // Home draws the brief as selected while nothing is.
169
171
  selectedKey: selectedKey ?? (order[0] === BRIEF_KEY ? BRIEF_KEY : null),
170
172
  scope: () => (keys?.scope?.current ?? rootRef.current) as { contains(n: unknown): boolean; checkVisibility?(): boolean } | null,
171
- claimBody: keys?.claimBody, onSelect, onOpen: key => keys?.onOpen(key),
173
+ claimBody: keys?.claimBody, onSelect, onOpen: key => keys?.onOpen(key), onKeys: keys?.onKeys ? () => keys.onKeys?.() : undefined,
172
174
  reveal: key => { const index = data.findIndex(e => e.key === key); if (index >= 0) listRef.current?.scrollToIndex({ index, viewPosition: 0.5, animated: false }); },
173
175
  });
174
176
  // Keep the keyboard-active result in view.
package/client/home.tsx CHANGED
@@ -36,7 +36,9 @@ import { withAlpha, isLight, mergedColor, type Colors } from "./theme";
36
36
  import { UpdateNotice, VersionMark } from "./updates";
37
37
  import { WhatsNewGate } from "./release-notes";
38
38
  import { ViewSync } from "./view-store";
39
- import { CatchUp, CatchUpButton } from "./catch-up";
39
+ import { CatchUp, CatchUpButton, KeysSheet } from "./catch-up";
40
+ import { searchEnter } from "../shared/list-keys";
41
+ import { HOME_KEYS } from "../shared/home-keys";
40
42
  import { deckCards } from "../shared/catch-up";
41
43
  import { ResizableSplit } from "./split";
42
44
  import type { SearchKey } from "./search-key";
@@ -119,7 +121,9 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
119
121
  // host's ← is the only back control and it lands on the list. Desktop selects in place beside the list.
120
122
  const route = compact && deps.openItem ? deps.openItem : null;
121
123
  const onSelect = useCallback((key: string) => { if (route) route(key); else setSelected(key === BRIEF_KEY ? null : key); }, [route]);
122
- const current = selected ? model.byKey.get(selected) ?? (selected.startsWith("agent:") ? [...model.byKey.values()].find(x => x.agentId === selected.slice(6)) ?? null : null) : null;
124
+ // A key names a row (`ws:…`, an agent row) or, from a ⌘K or chat link, an agent (`agent:<id>`): one lookup for both.
125
+ const resolve = (key: string | null) => key ? model.byKey.get(key) ?? (key.startsWith("agent:") ? [...model.byKey.values()].find(x => x.agentId === key.slice(6)) ?? null : null) : null;
126
+ const current = resolve(selected);
123
127
  const tracked = useSyncExternalStore(deps.sources.live.subscribe, deps.sources.live.version, deps.sources.live.version);
124
128
  const rows = useInbox(inbox, () => inbox.rows());
125
129
  // Go through's count is its cards (one per ask), the same deck the mode opens on.
@@ -143,14 +147,25 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
143
147
  // The omnibox's "Ask the Overseer" row: send, then show the conversation it lands in.
144
148
  const [asking, setAsking] = useState(false);
145
149
  const [pendingAsk, setPendingAsk] = useState<string | null>(null);
146
- const pick = useCallback(async (item: OmniboxItem) => {
150
+ // Enter in the search (the-selected-workspace-opens-with-enter): the first press shows the result in the pane, a
151
+ // press on the result already showing opens its chat, and with no query Enter opens what is selected.
152
+ const openRef = useRef<(key: string) => void>(() => undefined);
153
+ const selectedRef = useRef<string | null>(null); selectedRef.current = current?.key ?? selected;
154
+ const pick = useCallback(async (picked: OmniboxItem | null) => {
155
+ if (!route && (!picked || picked.ask === undefined)) {
156
+ const move = searchEnter({ item: picked ? resolve(picked.key)?.key ?? picked.key : null, selected: selectedRef.current, query: omnibox.query });
157
+ if (move === "open") { openRef.current(picked?.key ?? selectedRef.current!); return; }
158
+ }
159
+ if (!picked) return;
160
+ const item = picked;
147
161
  if (item.ask === undefined) { if (route) route(item.key); else setSelected(item.key); return; }
148
162
  if (asking) return;
149
163
  setAsking(true);
150
164
  // No toast: the conversation opens on the sent words, which says it more plainly.
151
165
  try { await deps.sources.extras.askOverseer(item.ask); omnibox.setQuery(""); omnibox.inputRef.current?.blur(); setPendingAsk(item.ask); if (route) route(OVERSEER_KEY); else setSelected(OVERSEER_KEY); inbox.refresh(); }
152
166
  catch (e) { toast.error(errorText(e)); } finally { setAsking(false); }
153
- }, [asking, deps.sources.extras, omnibox, inbox, toast, route]);
167
+ // eslint-disable-next-line react-hooks/exhaustive-deps
168
+ }, [asking, deps.sources.extras, omnibox, inbox, toast, route, model]);
154
169
  // ⌘K "Follow-up: Ask the Overseer" opens Home with `?ask=<nonce>`: select it and focus its reply box. A param, not
155
170
  // shared state, so it works whether Home was already open or mounts fresh.
156
171
  const [replyFocus, setReplyFocus] = useState(0);
@@ -207,10 +222,13 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
207
222
  // Enter on a row: its chat, as Open full does. The brief has nothing to open; the Overseer opens once it runs.
208
223
  const openKey = (key: string) => {
209
224
  if (key === OVERSEER_KEY) { const id = overseerStatus?.agentId; if (id && navigation) navigation.openAgent({ agentId: id }); return; }
210
- const s = model.byKey.get(key); if (s) openFull(s);
225
+ const s = resolve(key); if (s) openFull(s);
211
226
  };
227
+ openRef.current = openKey;
228
+ // S: Home's keys (desktop web), from the one list (shared/home-keys.ts).
229
+ const [keysOpen, setKeysOpen] = useState(false);
212
230
  const list = <HomeList model={model} theme={theme} dense={compact} touch={compact} selectedKey={selected} onSelect={onSelect} briefLine={briefLine}
213
- keys={{ mode: "select", onOpen: openKey, scope: homeRef, claimBody: true }}
231
+ keys={{ mode: "select", onOpen: openKey, onKeys: () => setKeysOpen(v => !v), scope: homeRef, claimBody: true }}
214
232
  results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} overseer={overseer} asking={asking} menu={rowMenu} onSendNow={sendNow}
215
233
  // Phones: the host header already says Follow-up, so no "Home" title row; search, sort and settings share one row and
216
234
  // the meters move to the end of the list.
@@ -222,7 +240,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
222
240
  // Phones: the setup offer goes after the Needs-you group when there is one, so the first ask stays high.
223
241
  afterNeeds={compact && model.needs > 0 ? <SetupOffer theme={theme} compact view={props.onboarding} /> : undefined}
224
242
  emptyAction={compact ? <Button theme={theme} compact kind="secondary" icon="Settings" title="Project settings" onPress={deps.openSettings} /> : undefined}
225
- top={<ListTop theme={theme} dense={compact} title={compact ? undefined : <ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} />}>
243
+ top={<ListTop theme={theme} dense={compact} title={compact ? undefined : <ListHeader theme={theme} compact={compact} onSettings={deps.openSettings} onKeys={() => setKeysOpen(v => !v)} />}>
226
244
  {/* zIndex: on web every View is its own stacking context, so the sort menu only paints and hit-tests above the
227
245
  strip and meters below if this row sits above them. */}
228
246
  <View style={{ zIndex: 2, flexDirection: "row", alignItems: "center", gap: compact ? 2 : 6, paddingLeft: compact ? 16 : 16, paddingRight: compact ? 6 : 16 }}>
@@ -256,6 +274,11 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
256
274
  {updateSheets}
257
275
  <View style={{ position: "absolute", left: 12, right: 12, bottom: 12 }}><UndoBar store={inbox} theme={theme} touch={false} /></View>
258
276
  </View>} />
277
+ {keysOpen && <KeysSheet theme={theme} label="Home keys" keyWidth={104} onClose={() => setKeysOpen(false)} sections={[
278
+ { title: "In the list", keys: HOME_KEYS.filter(k => !k.when) },
279
+ { title: "In the search", keys: HOME_KEYS.filter(k => k.when === "search").map(k => k.key === "/" && anywhereKey ? { ...k, key: `/ or ${anywhereKey}` } : k) },
280
+ { title: "Answering", keys: HOME_KEYS.filter(k => k.when === "pane") },
281
+ ]} />}
259
282
  </View>;
260
283
  }
261
284
 
@@ -296,7 +319,7 @@ export function DisplaySplit({ theme, main, side, field, defaultFraction, range,
296
319
  const HOME_DETAIL_MIN_PX = 360;
297
320
  const HOME_LIST_MIN_PX = 480;
298
321
 
299
- function ListHeader({ theme, compact, onSettings }: { theme: Theme; compact: boolean; onSettings: () => void }) {
322
+ function ListHeader({ theme, compact, onSettings, onKeys }: { theme: Theme; compact: boolean; onSettings: () => void; onKeys?: () => void }) {
300
323
  const c = theme.colors;
301
324
  return <View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: 16 }}>
302
325
  {/* Home first, the version second: a muted caption on the title's line, never a control beside the cog. */}
@@ -304,6 +327,8 @@ function ListHeader({ theme, compact, onSettings }: { theme: Theme; compact: boo
304
327
  <Text accessibilityRole="header" style={{ color: c.foreground, fontSize: compact ? 17 : 15, fontWeight: "600" }}>Home</Text>
305
328
  <VersionMark theme={theme} touch={compact} openSettings={onSettings} />
306
329
  </View>
330
+ {/* The keys sheet's way in for the mouse (S from the keyboard); desktop web, where the keys are. */}
331
+ {onKeys && Platform.OS === "web" && <IconButton theme={theme} compact={compact} icon="Keyboard" label="Keys (S)" tooltip onPress={onKeys} />}
307
332
  <IconButton theme={theme} compact={compact} icon="Settings" label="Follow-up settings" onPress={onSettings} />
308
333
  </View>;
309
334
  }
@@ -474,7 +499,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
474
499
  {onBack && <IconButton theme={theme} compact icon="ChevronLeft" label="Back to Home" onPress={onBack} />}
475
500
  <Icon name={s.icon} size={16} color={color} />
476
501
  <Text accessibilityRole="header" numberOfLines={2} style={[t.title, { flex: 1, fontSize: 16 }]}>{s.title}{s.agent ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{` › ${s.agent}`}</Text> : null}</Text>
477
- <Button theme={theme} compact={compact} icon="PanelRightOpen" title="Open full" accessibilityHint="Opens the agent's chat and docks this list beside it" onPress={() => openFull(s)} />
502
+ <Button theme={theme} compact={compact} icon="PanelRightOpen" title="Open full" keyHint="↵" accessibilityHint="Opens the agent's chat and docks this list beside it (Enter)" onPress={() => openFull(s)} />
478
503
  </View>
479
504
  {s.workspaceId && w && <SummaryLine key={s.workspaceId} workspace={w} theme={theme} compact={false} />}
480
505
  {s.workspaceId && w && <ReferencesLine key={`refs:${s.workspaceId}`} workspace={w} theme={theme} compact={false} />}
package/client/kit.tsx CHANGED
@@ -110,11 +110,12 @@ export function SubmitScope({ enabled, onSubmit, children, style, accessibilityR
110
110
 
111
111
  export type ButtonKind = "primary" | "secondary" | "ghost" | "danger";
112
112
  /** One button vocabulary for the whole plugin: 32px on desktop with a hit slop, 44px on touch layouts. */
113
- export function Button({ title, onPress, theme, kind = "secondary", disabled = false, loading = false, icon, compact = false, accessibilityLabel, accessibilityHint, grow = false, shortcut = false, nativeID, onInteract }: {
113
+ export function Button({ title, onPress, theme, kind = "secondary", disabled = false, loading = false, icon, compact = false, accessibilityLabel, accessibilityHint, grow = false, shortcut = false, keyHint, nativeID, onInteract }: {
114
114
  /** Focus and hover, for a surface that pauses while the button is in use (the Undo bar). */ onInteract?: (event: "focus" | "blur" | "hoverIn" | "hoverOut") => void;
115
115
  /** A DOM id on web, so focusSoon can move focus here after the control that had it goes away. */ nativeID?: string;
116
116
  title: string; onPress: () => void; theme: Theme; kind?: ButtonKind; disabled?: boolean; loading?: boolean; icon?: string; compact?: boolean; accessibilityLabel?: string; accessibilityHint?: string; grow?: boolean;
117
117
  /** The SubmitScope's action: shows a quiet ⌘↵ on desktop web. */ shortcut?: boolean;
118
+ /** A key that does what this button does from elsewhere on the screen (Home's ↵ for Open full): the same quiet hint. */ keyHint?: string;
118
119
  }) {
119
120
  const c = theme.colors;
120
121
  const fg = kind === "primary" ? c.accentForeground : kind === "danger" ? c.statusDanger : c.foreground;
@@ -130,7 +131,7 @@ export function Button({ title, onPress, theme, kind = "secondary", disabled = f
130
131
  })}>
131
132
  {loading ? <Spinner color={fg} size={12} /> : icon ? <Icon name={icon} size={compact ? 16 : 14} color={fg} /> : null}
132
133
  <Text numberOfLines={1} style={{ color: fg, fontSize: compact ? 14 : 12, lineHeight: compact ? 19 : 16, fontWeight: "600" }}>{title}</Text>
133
- {shortcut && !compact && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no" style={{ color: fg, opacity: 0.6, fontSize: 11, lineHeight: 16, fontWeight: "500", marginLeft: 2 }}>{submitHint()}</Text>}
134
+ {(shortcut || keyHint) && !compact && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no" style={{ color: fg, opacity: 0.6, fontSize: 11, lineHeight: 16, fontWeight: "500", marginLeft: 2 }}>{shortcut ? submitHint() : keyHint}</Text>}
134
135
  </PressScale>;
135
136
  }
136
137
 
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  import { Platform } from "react-native";
3
- import { listMove, ownsKey, surfaceVisible, walkTarget } from "../shared/list-keys";
3
+ import { enterTarget, listMove, ownsKey, surfaceVisible, walkTarget } from "../shared/list-keys";
4
4
  import { rowDomId } from "./kit";
5
5
 
6
6
  type Row = { focus(o?: { preventScroll?: boolean }): void; scrollIntoView?(o?: { block?: string }): void };
@@ -29,6 +29,8 @@ export type ListKeysOptions = {
29
29
  claimBody?: boolean;
30
30
  onSelect: (key: string) => void;
31
31
  onOpen: (key: string) => void;
32
+ /** S: show this surface's keys (Home's keys sheet). Without it S stays unclaimed. */
33
+ onKeys?: () => void;
32
34
  /** A row the virtualized list hasn't drawn yet: scroll it in, so it can take focus. */
33
35
  reveal: (key: string) => void;
34
36
  };
@@ -45,7 +47,7 @@ export function useListKeys(options: ListKeysOptions): void {
45
47
  const doc = (globalThis as { document?: Doc }).document;
46
48
  if (!options.enabled || Platform.OS !== "web" || !doc) return;
47
49
  const onKey = (e: DomKey) => {
48
- const { order, mode, selectedKey, scope, claimBody, onSelect, onOpen, reveal } = ref.current;
50
+ const { order, mode, selectedKey, scope, claimBody, onSelect, onOpen, onKeys, reveal } = ref.current;
49
51
  const target = e.target as Target;
50
52
  const typing = !!target && (!!target.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName ?? ""));
51
53
  if (typing && !target?.closest?.("[data-list-keys]")) return;
@@ -59,13 +61,20 @@ export function useListKeys(options: ListKeysOptions): void {
59
61
  const move = listMove(e, typing);
60
62
  if (!move) return;
61
63
  const focused = !typing && target?.id ? order.find(k => rowDomId(k) === target.id) ?? null : null;
64
+ if (move === "keys") {
65
+ if (!onKeys || typing) return;
66
+ e.preventDefault(); e.stopPropagation(); onKeys();
67
+ return;
68
+ }
62
69
  if (move === "open") {
63
- // Only a focused row opens: Enter on a header, a chip or a button keeps doing what that control does.
64
- if (!focused) return;
65
- e.preventDefault(); e.stopPropagation(); onOpen(focused);
70
+ // A focused row opens itself; on Home, with nothing focused, the selection does (a click, a search or ⌘K pick,
71
+ // coming back). Enter on a header, a chip or a button keeps doing what that control does.
72
+ const open = enterTarget({ focused, selectedKey, mode, onBody });
73
+ if (!open) return;
74
+ e.preventDefault(); e.stopPropagation(); onOpen(open);
66
75
  // The sidebar view: if opening the chat left focus nowhere, give it back to the row, so ↓ ↓ Enter keeps
67
76
  // walking. If Paseo put it somewhere (the composer), it stays there: never taken back.
68
- if (mode === "focus") keepWalking(doc, scope() ?? doc, focused, reveal);
77
+ if (mode === "focus") keepWalking(doc, scope() ?? doc, open, reveal);
69
78
  return;
70
79
  }
71
80
  const to = walkTarget({ order, focused, selectedKey, mode, typing, move });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.2.1-beta.1",
4
+ "version": "2.3.0-beta.0",
5
5
  "description": "A Paseo plugin that follows every workspace until the work is done: one Home for what needs you, questions you answer anywhere, and repairs that send themselves.",
6
6
  "type": "module",
7
7
  "files": [
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Home's keys (desktop and web), the one list the keys sheet draws (client/home.tsx `HomeKeysSheet`). The handlers are
3
+ * the list walk (`listMove`, shared/list-keys.ts), the search field and Search from anywhere; a letter Catch up also
4
+ * uses does the same thing here (O opens the chat, S shows the keys).
5
+ */
6
+ export const HOME_KEYS: readonly { key: string; what: string; when?: "search" | "pane" }[] = [
7
+ { key: "↑ ↓ / J K", what: "Move through the list" },
8
+ { key: "Home / End", what: "First or last row" },
9
+ { key: "↵ / O", what: "Open the selected workspace's chat" },
10
+ { key: "S", what: "Show the keys" },
11
+ { key: "/", what: "Search", when: "search" },
12
+ { key: "↑ / ↓", what: "Move through the results", when: "search" },
13
+ { key: "↵", what: "Show the result; ↵ again opens its chat", when: "search" },
14
+ { key: "Esc", what: "Clear the search, then leave it", when: "search" },
15
+ { key: "⌘↵", what: "Send the answer you're writing", when: "pane" },
16
+ ];
@@ -2,7 +2,7 @@
2
2
  * Walking a list of rows from the keyboard (desktop and web), the keys and the step. Home and Paseo's sidebar view
3
3
  * walk HomeList with these through one hook (client/list-keys.ts; invariant one-keyboard-walk-for-every-list).
4
4
  */
5
- export type ListMove = "next" | "prev" | "first" | "last" | "open";
5
+ export type ListMove = "next" | "prev" | "first" | "last" | "open" | "keys";
6
6
  export type ListKeyEvent = { key: string; metaKey?: boolean; ctrlKey?: boolean; altKey?: boolean; shiftKey?: boolean };
7
7
 
8
8
  /**
@@ -20,13 +20,36 @@ export function listMove(e: ListKeyEvent, typing: boolean): ListMove | null {
20
20
  case "k": return "prev";
21
21
  case "Home": return "first";
22
22
  case "End": return "last";
23
- case "Enter": return "open";
23
+ case "Enter": case "o": return "open";
24
+ // Catch up's letter for the keys sheet: the same letter does the same thing on Home.
25
+ case "s": return "keys";
24
26
  default: return null;
25
27
  }
26
28
  }
27
29
 
30
+ /**
31
+ * The row Enter (or O) opens (invariant the-selected-workspace-opens-with-enter). A focused row opens itself. On Home
32
+ * ("select") the selection opens too when nothing has focus: after a click, a ⌘K or search pick, or coming back to
33
+ * Home the selection is on screen but focus is on the page, not on its row. Enter on any other control (a button, a
34
+ * chip, a field) stays that control's: the caller never asks then.
35
+ */
36
+ export function enterTarget(input: { focused: string | null; selectedKey: string | null; mode: "select" | "focus"; onBody: boolean }): string | null {
37
+ if (input.focused) return input.focused;
38
+ return input.mode === "select" && input.onBody ? input.selectedKey : null;
39
+ }
40
+
41
+ /**
42
+ * Enter in Home's search: the first press picks the active result (the detail pane shows it); a press on the result
43
+ * that is already selected opens it, as Enter on its row would. With no query, Enter opens the selection.
44
+ */
45
+ export function searchEnter(input: { item: string | null; selected: string | null; query: string }): "select" | "open" | null {
46
+ if (!input.query.trim()) return input.selected ? "open" : null;
47
+ if (!input.item) return null;
48
+ return input.item === input.selected ? "open" : "select";
49
+ }
50
+
28
51
  /** The row a move lands on: one step, clamped at both ends (no wrap). From no row (or one that left), the first. */
29
- export function stepKey(order: readonly string[], current: string | null, move: Exclude<ListMove, "open">): string | null {
52
+ export function stepKey(order: readonly string[], current: string | null, move: Exclude<ListMove, "open" | "keys">): string | null {
30
53
  if (!order.length) return null;
31
54
  if (move === "last") return order[order.length - 1];
32
55
  const i = current === null ? -1 : order.indexOf(current);
@@ -68,7 +91,7 @@ export function surfaceVisible(root: Visible | null | undefined, doc: { visibili
68
91
  * Where a move lands. From the list's own query field the arrows enter the list: at the selection on Home ("select"),
69
92
  * at the first match in the sidebar view ("focus"). Otherwise one step from the focused row, or from the selection.
70
93
  */
71
- export function walkTarget(input: { order: readonly string[]; focused: string | null; selectedKey: string | null; mode: "select" | "focus"; typing: boolean; move: Exclude<ListMove, "open"> }): string | null {
94
+ export function walkTarget(input: { order: readonly string[]; focused: string | null; selectedKey: string | null; mode: "select" | "focus"; typing: boolean; move: Exclude<ListMove, "open" | "keys"> }): string | null {
72
95
  const { order, focused, selectedKey, mode, typing, move } = input;
73
96
  const from = focused ?? (selectedKey !== null && order.includes(selectedKey) ? selectedKey : null);
74
97
  if (typing) return mode === "select" && from ? from : order[0] ?? null;