paseo-follow-up 2.2.1-beta.1 → 2.3.0-beta.1
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/client/catch-up.tsx +32 -109
- package/client/home-chrome.tsx +6 -2
- package/client/home-list.tsx +6 -4
- package/client/home.tsx +34 -9
- package/client/kit.tsx +3 -2
- package/client/list-keys.ts +15 -6
- package/client/more-context.tsx +177 -0
- package/client/questions.tsx +38 -5
- package/index.client.tsx +4 -0
- package/index.server.ts +7 -5
- package/package.json +1 -1
- package/server/agent-actions.ts +1 -1
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +5 -1
- package/server/context-requests.ts +6 -3
- package/server/engine.ts +13 -1
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +3 -0
- package/server/mcp.mjs +3 -0
- package/server/questions.ts +47 -9
- package/shared/activity.ts +2 -2
- package/shared/brief.ts +6 -4
- package/shared/catch-up.ts +29 -1
- package/shared/chat.ts +1 -1
- package/shared/contracts.ts +4 -2
- package/shared/errors.ts +4 -2
- package/shared/home-keys.ts +16 -0
- package/shared/list-keys.ts +27 -4
- package/shared/questions.ts +29 -1
- package/shared/section-search.ts +2 -2
package/client/catch-up.tsx
CHANGED
|
@@ -13,9 +13,8 @@ import { needsYou } from "../shared/attention";
|
|
|
13
13
|
import { liveBrief } from "../shared/brief";
|
|
14
14
|
import { age, snoozeUntil } from "../shared/inbox";
|
|
15
15
|
import { laterChoices } from "../shared/row-menu";
|
|
16
|
-
import { errorText } from "../shared/errors";
|
|
17
16
|
import { CATCH_UP_RAIL_DEFAULT, CATCH_UP_RAIL_MAX, CATCH_UP_RAIL_MIN } from "../shared/display";
|
|
18
|
-
import { CATCH_UP_KEYS,
|
|
17
|
+
import { CATCH_UP_KEYS, MODE, catchUpKey, contextFor, keyLabel, deckCards, groupOf, openInWorkspace, park, prevPos, applySwipe, skipWorkspace, swipeLock, swipeOutcome, settle as settleCard, startSession, statsOf, sync, type ContextRequest, type DeckCard, type Outcome, type Session } from "../shared/catch-up";
|
|
19
18
|
import type { Workspace } from "../shared/model";
|
|
20
19
|
import type { ListWorkspace } from "../shared/list";
|
|
21
20
|
import { bottomInset, Button, focusSoon, IconButton, SubmitScope, text, type Theme } from "./kit";
|
|
@@ -36,6 +35,9 @@ import { hostDictation } from "./dictation";
|
|
|
36
35
|
import { ownsKey, surfaceVisible } from "../shared/list-keys";
|
|
37
36
|
import { useReducedMotion } from "./motion";
|
|
38
37
|
import { PRIMARY_FORM } from "./dock";
|
|
38
|
+
import { MorePanel, MoveResult, ContextAnswer } from "./more-context";
|
|
39
|
+
|
|
40
|
+
export { MorePanel, MoveResult, ContextAnswer };
|
|
39
41
|
|
|
40
42
|
/** react-native-web's data attribute, so the option-letter keys find this card's radios. */
|
|
41
43
|
const CARD_MARK = { dataSet: { catchUpCard: "1" } } as object;
|
|
@@ -80,8 +82,8 @@ export function skipNoun(card: Pick<DeckCard, "kind" | "item">): string {
|
|
|
80
82
|
/** The card Skip's tooltip and accessible name: what it does and that the card comes back. */
|
|
81
83
|
export const skipCardHint = (noun: string) => `Skip this ${noun}. It comes back after the rest`;
|
|
82
84
|
export const skipWorkspaceHint = (n: number) => `Skip this workspace's ${n} cards. They come back after the rest`;
|
|
83
|
-
/** The newest ask about this card, if any. */
|
|
84
|
-
const askFor = (context: readonly ContextRequest[],
|
|
85
|
+
/** The newest ask about this card, if any, from whichever surface asked it (sameCard). */
|
|
86
|
+
const askFor = (context: readonly ContextRequest[], card: DeckCard) => contextFor(context, { workspaceId: card.s.workspaceId, cardKey: card.key });
|
|
85
87
|
|
|
86
88
|
export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: Theme; compact: boolean; deps: CatchUpDeps; navigation: Nav; onExit: () => void }) {
|
|
87
89
|
const c = theme.colors; const t = text(c, compact);
|
|
@@ -184,6 +186,8 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
184
186
|
setTimeout(() => hit(mic()), 0);
|
|
185
187
|
break;
|
|
186
188
|
}
|
|
189
|
+
// The card's own Dismiss (QuestionBody), so the key does exactly what the click does.
|
|
190
|
+
case "dismiss": { const d = inCard('[aria-label^="Dismiss Q"]'); if (!d) return; d.click?.(); break; }
|
|
187
191
|
case "note": { const add = inCard('[aria-label^="Add a note"]'); if (add) add.click?.(); else r.querySelector('[aria-label="Tell the agent something"]')?.focus?.(); break; }
|
|
188
192
|
// Its sheet or popover takes focus itself (MoveResult).
|
|
189
193
|
case "later": if (!click('[aria-label="Later (L)"]')) return; break;
|
|
@@ -283,7 +287,7 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
283
287
|
const body = finished || !card ? <Finished theme={theme} compact={compact} stats={stats} empty={!total} onHome={onExit}
|
|
284
288
|
onSkipped={() => setSession(s => ({ ...s, pos: s.order.findIndex(k => s.outcomes[k] === "skipped"), lapped: true }))} />
|
|
285
289
|
: <CardView key={card.key} card={card} w={w} theme={theme} compact={compact} deps={deps} navigation={navigation} gone={gone} more={more} setMore={setMore}
|
|
286
|
-
request={askFor(context, card
|
|
290
|
+
request={askFor(context, card)} waiting={!!session.parked[card.s.key]} onAsk={ask}
|
|
287
291
|
sameWorkspace={session.order.filter(k => cardOf(k)?.s.key === card.s.key)}
|
|
288
292
|
onDone={() => settle("done")} onSkip={skip} onSkipWorkspace={wsLeft > 1 ? skipWs : undefined} wsLeft={wsLeft} onBack={session.pos > 0 ? back : undefined} onLater={() => settle("later")} />;
|
|
289
293
|
|
|
@@ -393,7 +397,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
393
397
|
? <View style={{ gap: 8 }}>
|
|
394
398
|
<RichText plain style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{`${q.id} · ${q.title}`}</RichText>
|
|
395
399
|
<QuestionBody key={q.id} workspace={ws} question={q} theme={theme} compact={compact} inline={false}
|
|
396
|
-
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} onSendReady={setReady} dictate />
|
|
400
|
+
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} onSendReady={setReady} dictate moreContext={false} />
|
|
397
401
|
</View>
|
|
398
402
|
: card.kind === "item" && card.item && full
|
|
399
403
|
? <View style={{ borderRadius: 10, borderWidth: 1, borderColor: withAlpha(c.statusWarning, 0.45), overflow: "hidden" }}>
|
|
@@ -467,54 +471,6 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
467
471
|
</DockedPane>;
|
|
468
472
|
}
|
|
469
473
|
|
|
470
|
-
/**
|
|
471
|
-
* Where a move's result opens (MOVE_OPENS, a-move-bar-action-opens-in-view): a sheet in the phone's dock or a popover
|
|
472
|
-
* on its desktop button. Focus moves into it (its first choice), and on the web it scrolls into view the least distance.
|
|
473
|
-
*/
|
|
474
|
-
export function MoveResult({ place, theme, label, width, children }: { place: "sheet" | "popover"; theme: Theme; label: string; width?: number; children: ReactNode }) {
|
|
475
|
-
const c = theme.colors;
|
|
476
|
-
const ref = useRef<View>(null);
|
|
477
|
-
useEffect(() => {
|
|
478
|
-
if (Platform.OS !== "web") return;
|
|
479
|
-
const t = setTimeout(() => {
|
|
480
|
-
const node = ref.current as unknown as { querySelector?(q: string): { focus?(o?: object): void } | null; scrollIntoView?(o: object): void } | null;
|
|
481
|
-
node?.scrollIntoView?.({ block: "nearest" });
|
|
482
|
-
// The first choice: More context's suggestions ("I don't get it" leads), else Later's first time.
|
|
483
|
-
(node?.querySelector?.('[role="radio"]') ?? node?.querySelector?.('[role="menu"] [role="button"]'))?.focus?.({ preventScroll: true });
|
|
484
|
-
}, 0);
|
|
485
|
-
return () => clearTimeout(t);
|
|
486
|
-
}, []);
|
|
487
|
-
return <View ref={ref} {...({ dataSet: { moveResult: place } } as object)} role="dialog" accessibilityLabel={label}
|
|
488
|
-
style={[{ padding: place === "sheet" ? 14 : 16, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 },
|
|
489
|
-
place === "sheet"
|
|
490
|
-
? { marginHorizontal: 12, marginTop: 12 }
|
|
491
|
-
: { position: "absolute", zIndex: 20, left: 0, bottom: "100%", marginBottom: 8, width, shadowColor: "#000", shadowOpacity: 0.22, shadowRadius: 16, shadowOffset: { width: 0, height: 6 } }]}>
|
|
492
|
-
{children}
|
|
493
|
-
</View>;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/** What came back for this card: the answer, "answered in its chat", a failure, or (seen going Back) that it's still asking. */
|
|
497
|
-
export function ContextAnswer({ theme, compact, request, waiting, agent, openChat, openAgent }: { theme: Theme; compact: boolean; request: ContextRequest; waiting: boolean; agent: string; openChat: () => void; openAgent?: (agentId: string) => void }) {
|
|
498
|
-
const c = theme.colors; const t = text(c, compact);
|
|
499
|
-
const who = request.target === "overseer" ? "Overseer" : agent === "the agent" ? "The agent" : agent;
|
|
500
|
-
const asking = request.state === "asking";
|
|
501
|
-
return <View accessibilityLiveRegion="polite" style={{ gap: 8, padding: compact ? 14 : 16, borderRadius: 12, borderWidth: 1, borderColor: asking ? c.border : withAlpha(c.statusSuccess, 0.4), backgroundColor: c.surface1 }}>
|
|
502
|
-
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
503
|
-
<Icon name={asking ? "Hourglass" : request.state === "failed" ? "CircleAlert" : "Sparkles"} size={14} color={request.state === "failed" ? c.statusDanger : c.foregroundMuted} />
|
|
504
|
-
<RichText plain style={[t.small, { flex: 1 }]}>{asking ? `Asked ${who === "Overseer" ? "the Overseer" : who}${waiting ? " · this comes back as the next card when it answers. You can still act on it now" : ""}` : `${who} · you asked: ${askHeadline(request.ask)}`}</RichText>
|
|
505
|
-
</View>
|
|
506
|
-
{request.state === "answered" && request.answer && <RichText selectable style={t.body}>{request.answer}</RichText>}
|
|
507
|
-
{request.state === "chat" && <View style={{ gap: 8 }}>
|
|
508
|
-
<Text style={t.body}>{who === "Overseer" ? "The Overseer answered in its own chat, not here: it can't reply on a card." : `${who} answered in its chat.`}</Text>
|
|
509
|
-
{/* A 2.2.0-beta.3 ask of the Overseer: its answer is in the Overseer's chat (an-ask-goes-only-to-an-agent-that-can-answer-it). */}
|
|
510
|
-
<View style={{ flexDirection: "row" }}>{who === "Overseer"
|
|
511
|
-
? <Button theme={theme} compact={compact} icon="MessageSquare" title="Open Overseer" disabled={!request.askedOf || !openAgent} onPress={() => request.askedOf && openAgent?.(request.askedOf)} />
|
|
512
|
-
: <Button theme={theme} compact={compact} icon="MessageSquare" title="Open chat" onPress={openChat} />}</View>
|
|
513
|
-
</View>}
|
|
514
|
-
{request.state === "failed" && <Text style={t.body}>{request.error ?? "The ask didn't go through. Try again, or open the chat."}</Text>}
|
|
515
|
-
</View>;
|
|
516
|
-
}
|
|
517
|
-
|
|
518
474
|
function PermissionCard({ s, theme, compact, onDone }: { s: DeckCard["s"]; theme: Theme; compact: boolean; onDone: () => void }) {
|
|
519
475
|
const agent = useAgentLive(s.agentId);
|
|
520
476
|
const t = text(theme.colors, compact);
|
|
@@ -531,49 +487,6 @@ function BriefAsk({ s, theme, compact, deps }: { s: DeckCard["s"]; theme: Theme;
|
|
|
531
487
|
return <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />;
|
|
532
488
|
}
|
|
533
489
|
|
|
534
|
-
/**
|
|
535
|
-
* More context: "I don't get it" first (most asks just need explaining), then the developer's own words, to one place:
|
|
536
|
-
* the card's workspace's main agent, the one that can answer on the card (an-ask-goes-only-to-an-agent-that-can-answer-
|
|
537
|
-
* it). It may wake, because the developer asked. The deck moves on and this workspace comes back when the answer is ready.
|
|
538
|
-
*/
|
|
539
|
-
export function MorePanel({ theme, compact, onClose, onAsk }: { theme: Theme; compact: boolean; onClose: () => void; onAsk: (words: string) => Promise<void> }) {
|
|
540
|
-
const c = theme.colors; const t = text(c, compact);
|
|
541
|
-
const [words, setWords] = useState<string>(CONTEXT_ASKS[0].text);
|
|
542
|
-
const [picked, setPicked] = useState<string>(CONTEXT_ASKS[0].id);
|
|
543
|
-
const [busy, setBusy] = useState(false);
|
|
544
|
-
const [error, setError] = useState<string | null>(null);
|
|
545
|
-
const send = () => {
|
|
546
|
-
if (!words.trim() || busy) return;
|
|
547
|
-
setBusy(true); setError(null);
|
|
548
|
-
// The words stay unless the ask is recorded.
|
|
549
|
-
onAsk(words.trim()).catch(e => setError(errorText(e))).finally(() => setBusy(false));
|
|
550
|
-
};
|
|
551
|
-
return <View {...({ dataSet: { catchUpMore: "1" } } as object)} style={{ gap: 10 }}>
|
|
552
|
-
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
553
|
-
<Icon name="Sparkles" size={14} color={c.foreground} />
|
|
554
|
-
<Text style={[t.label, { flex: 1, fontWeight: "600" }]}>More context</Text>
|
|
555
|
-
<IconButton theme={theme} compact={compact} icon="X" label="Close more context" onPress={onClose} />
|
|
556
|
-
</View>
|
|
557
|
-
<View accessibilityRole="radiogroup" style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
558
|
-
{CONTEXT_ASKS.map((x, i) => <Pressable key={x.id} accessibilityLabel={compact ? x.label : `${x.label} (${i + 1})`} accessibilityRole="radio" accessibilityState={{ checked: picked === x.id }} onPress={() => { setPicked(x.id); setWords(x.text); }}
|
|
559
|
-
style={{ minHeight: compact ? 36 : 28, justifyContent: "center", paddingHorizontal: 10, borderRadius: 999, borderWidth: 1, borderColor: picked === x.id ? c.foreground : c.border, backgroundColor: picked === x.id ? c.surface2 : "transparent" }}>
|
|
560
|
-
<Text style={[t.meta, { color: picked === x.id ? c.foreground : c.foregroundMuted }]}>{x.label}</Text>
|
|
561
|
-
</Pressable>)}
|
|
562
|
-
</View>
|
|
563
|
-
<View {...PRIMARY_FORM} style={{ gap: 10 }}>
|
|
564
|
-
<TextInput accessibilityLabel="What do you want to know?" placeholder="What do you want to know?" placeholderTextColor={c.foregroundMuted} value={words} multiline
|
|
565
|
-
onChangeText={v => { setWords(v); setPicked(CONTEXT_ASKS.find(x => x.text === v)?.id ?? ""); }}
|
|
566
|
-
style={{ minHeight: compact ? 84 : 56, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, backgroundColor: c.surface0 }} />
|
|
567
|
-
{!!error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{error}</Text>}
|
|
568
|
-
<View {...({ dataSet: { askAgent: "1" } } as object)} style={{ flexDirection: "row" }}>
|
|
569
|
-
<Button theme={theme} compact={compact} grow={compact} kind="primary" icon="MessageSquareText" title="Ask the agent" loading={busy} disabled={!words.trim() || busy}
|
|
570
|
-
accessibilityHint={compact ? "Asks this workspace's main agent, which may wake it" : `Asks this workspace's main agent, which may wake it. ${keyLabel("⌘↵", isMac())}`} onPress={send} />
|
|
571
|
-
</View>
|
|
572
|
-
</View>
|
|
573
|
-
<Text style={t.small}>This workspace steps aside while you keep going, and comes back as your next card with the answer. Back reaches it any time.</Text>
|
|
574
|
-
</View>;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
490
|
export function Finished({ theme, compact, stats, empty, onHome, onSkipped }: { theme: Theme; compact: boolean; stats: ReturnType<typeof statsOf>; empty: boolean; onHome: () => void; onSkipped: () => void }) {
|
|
578
491
|
const c = theme.colors; const t = text(c, compact);
|
|
579
492
|
// "All caught up" only when it is true: a skipped or waiting card means the developer is not, so the end says so.
|
|
@@ -596,27 +509,37 @@ export function Finished({ theme, compact, stats, empty, onHome, onSkipped }: {
|
|
|
596
509
|
</ScrollView>;
|
|
597
510
|
}
|
|
598
511
|
|
|
599
|
-
/**
|
|
600
|
-
export
|
|
512
|
+
/** A keys sheet's rows: a key (as spelled in its list) and what it does. */
|
|
513
|
+
export type KeySection = { title: string; keys: readonly { key: string; what: string }[] };
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* S: the keys, from the one list the handler reads (Catch up: shared/catch-up.ts; Home: shared/home-keys.ts). A dialog
|
|
517
|
+
* over the screen; S or its X closes it.
|
|
518
|
+
*/
|
|
519
|
+
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
520
|
const dictation = !!hostDictation();
|
|
521
|
+
const sections = given ?? catchUpSections(dictation);
|
|
602
522
|
const c = theme.colors; const t = text(c, false);
|
|
603
|
-
const row = (k:
|
|
604
|
-
<View style={{
|
|
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)}
|
|
523
|
+
const row = (k: KeySection["keys"][number], i: number) => <View key={`${k.key}-${i}`} style={{ flexDirection: "row", gap: 10, alignItems: "center" }}>
|
|
524
|
+
<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>
|
|
525
|
+
<Text style={[t.meta, { flex: 1, minWidth: 0 }]}>{k.what}</Text>
|
|
609
526
|
</View>;
|
|
610
|
-
return <View role="dialog" accessibilityLabel=
|
|
527
|
+
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
528
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
612
529
|
<Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
|
|
613
530
|
<IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
|
|
614
531
|
</View>
|
|
615
|
-
{
|
|
616
|
-
|
|
617
|
-
|
|
532
|
+
{sections.filter(s => s.keys.length).map(s => <View key={s.title} style={{ gap: 6 }}>
|
|
533
|
+
<Text style={[t.small, { fontWeight: "600" }]}>{s.title}</Text>{s.keys.map(row)}
|
|
534
|
+
</View>)}
|
|
618
535
|
</View>;
|
|
619
536
|
}
|
|
537
|
+
/** Catch up's sheet: the dictation key only where the host has a mic. */
|
|
538
|
+
const catchUpSections = (dictation: boolean): readonly KeySection[] => [
|
|
539
|
+
{ title: "On a card", keys: CATCH_UP_KEYS.filter(k => !k.when && (!k.needs || dictation)) },
|
|
540
|
+
{ title: "In More context", keys: CATCH_UP_KEYS.filter(k => k.when === "more") },
|
|
541
|
+
{ title: "In the queue", keys: CATCH_UP_KEYS.filter(k => k.when === "rail") },
|
|
542
|
+
];
|
|
620
543
|
|
|
621
544
|
/** A desktop hover title on any control (react-native-web drops `title` on a Pressable; IconButton does the same). */
|
|
622
545
|
function Tip({ label, children }: { label: string; children: ReactNode }) {
|
package/client/home-chrome.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
/**
|
package/client/home-list.tsx
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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
|
|
package/client/list-keys.ts
CHANGED
|
@@ -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
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
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,
|
|
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 });
|