paseo-follow-up 2.3.0-beta.1 → 2.3.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/client/brief.tsx +17 -7
- package/client/catch-up.tsx +16 -9
- package/client/dismiss.tsx +106 -0
- package/client/home-chrome.tsx +3 -1
- package/client/home.tsx +4 -2
- package/client/inbox-store.ts +11 -1
- package/client/needs-you.tsx +28 -9
- package/client/questions.tsx +32 -30
- package/index.client.tsx +3 -0
- package/index.server.ts +21 -3
- package/package.json +3 -2
- package/server/agent-actions.ts +1 -1
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +7 -2
- package/server/dismiss.ts +62 -0
- package/server/hook-source.ts +1 -1
- package/server/inbox.ts +29 -4
- package/server/mcp-source.ts +5 -0
- package/server/mcp.mjs +5 -0
- package/shared/attention.ts +50 -3
- package/shared/brief.ts +3 -2
- package/shared/chat.ts +1 -1
- package/shared/contracts.ts +9 -1
- package/shared/display.ts +4 -3
- package/shared/errors.ts +3 -1
- package/shared/home-keys.ts +2 -2
- package/shared/inbox.ts +21 -3
- package/shared/model.ts +7 -0
- package/shared/paseo-keys.ts +24 -0
- package/shared/search-key.ts +8 -8
- package/shared/status-invariants.ts +2 -2
package/client/brief.tsx
CHANGED
|
@@ -26,6 +26,7 @@ import { cardStore } from "./card-store";
|
|
|
26
26
|
import { PrSheet } from "./pr-sheet";
|
|
27
27
|
import { isLight, withAlpha, type Colors } from "./theme";
|
|
28
28
|
import { dismissToast, notice, runAction, runUndoable } from "./toasts";
|
|
29
|
+
import { DismissX, RevealScope, useDismiss } from "./dismiss";
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* The brief card (design §2): the ask in one line, decisions as option rows, only the context needed, and the one
|
|
@@ -347,7 +348,7 @@ function Past({ b, c, now, compact, height, pending = false, onResend, resending
|
|
|
347
348
|
/** `embedded`: inside Home's detail pane, which has its own reply box and action bar, so the card drops its moves. */
|
|
348
349
|
/** `snoozed`: the row is in Later, so the card wears the row's muted tone and says "Later" instead of "Needs you". */
|
|
349
350
|
/** `bare`: a section of the Needs you block (client/needs-you.tsx), whose frame says "Needs you": no border, margin or second label. */
|
|
350
|
-
type BriefCardProps = PluginTimelineItemProps<Brief> & { deps: BriefDeps; embedded?: boolean; snoozed?: boolean; bare?: boolean };
|
|
351
|
+
type BriefCardProps = PluginTimelineItemProps<Brief> & { deps: BriefDeps; embedded?: boolean; snoozed?: boolean; bare?: boolean; /** After its x is pressed (Catch up moves on). */ onDismissed?: () => void };
|
|
351
352
|
/** A brief names its PRs ("#240 is merged"): each "#N" its workspace tracks opens that PR (a-row-that-names-a-pr-opens-it-in-one-click). */
|
|
352
353
|
export function BriefCard(props: BriefCardProps) {
|
|
353
354
|
const workspace = props.item.data.workspaceId ? props.deps.workspace(props.item.data.workspaceId) : undefined;
|
|
@@ -355,7 +356,7 @@ export function BriefCard(props: BriefCardProps) {
|
|
|
355
356
|
return <PrLinksProvider prs={prs}><BriefCardBody {...props} /></PrLinksProvider>;
|
|
356
357
|
}
|
|
357
358
|
|
|
358
|
-
function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, snoozed = false, bare = false }: BriefCardProps) {
|
|
359
|
+
function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, snoozed = false, bare = false, onDismissed }: BriefCardProps) {
|
|
359
360
|
const c = theme.colors; const row = item.data; const compact = layout.compact;
|
|
360
361
|
// The row is a snapshot; the live brief decides (shownBrief). Only a row that still looks open asks, one query per
|
|
361
362
|
// agent for every card in its chat. A card is actionable only when the server says this exact brief is open.
|
|
@@ -392,6 +393,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
392
393
|
const [marked, setMarked] = useState<string | null>(null);
|
|
393
394
|
// The send landed: green at once, before the server's answered brief replaces the card.
|
|
394
395
|
const [sent, setSent] = useState(false);
|
|
396
|
+
const dismiss = useDismiss();
|
|
395
397
|
const picks = usePicks(b.id);
|
|
396
398
|
const words = useWords(b.id);
|
|
397
399
|
const notes = useNotes(b.id);
|
|
@@ -420,6 +422,11 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
420
422
|
const acts = flaggedAct && !snoozed;
|
|
421
423
|
const tone = !snoozed && (acts || b.kind === "done" || b.kind === "review" || b.kind === "error") ? kindTone(b.kind, c) : c.foregroundMuted;
|
|
422
424
|
const ageText = age(b.at, now);
|
|
425
|
+
// dismissing-anything-in-needs-you-sends-the-agent-nothing: an ask still in Needs you (or in Later) has the small x
|
|
426
|
+
// beside its age. It signs the row off as dismissed: the agent is sent nothing, and a restated ask isn't flagged again.
|
|
427
|
+
const x = flaggedAct && shown.actionable && agentId ? <View style={{ marginVertical: compact ? -8 : -5, marginRight: compact ? -8 : -6 }}>
|
|
428
|
+
<DismissX theme={theme} compact={compact} label="Dismiss the agent's ask" disabled={!!sending} onPress={() => dismiss({ agentId }, { onDismissed })} />
|
|
429
|
+
</View> : null;
|
|
423
430
|
const border = acts ? withAlpha(attention, isLight(c) ? 0.5 : 0.45) : c.border;
|
|
424
431
|
// Every send from the card (a pick, Something else, Send answers, the keyboard's Send) goes through runAction: the
|
|
425
432
|
// card keeps the picks and words and says what failed, and the toast offers Retry. Success is the card itself.
|
|
@@ -470,7 +477,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
470
477
|
if (b.slim) {
|
|
471
478
|
// Permission: Paseo's own prompt below is the control (F9). Fallback: the paragraph is right above.
|
|
472
479
|
// The label and age share the top line so the ask always gets the full width; at a narrow panel the move wraps under it.
|
|
473
|
-
return <
|
|
480
|
+
return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you: " : ""}${askText}. ${b.sourceLine}`}
|
|
474
481
|
style={[{ marginVertical: embedded ? 0 : 10, gap: 4, paddingHorizontal: 12, paddingVertical: 10, borderRadius: 10, borderWidth: 1, borderColor: border }, bare && BARE]}>
|
|
475
482
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 7 }}>
|
|
476
483
|
<Icon name={ICON[b.kind]} size={14} color={tone} />
|
|
@@ -478,6 +485,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
478
485
|
<View style={{ flex: 1 }} />
|
|
479
486
|
{/* In Later the age would read as a second clock beside "Later until"; the pane header keeps it. */}
|
|
480
487
|
{!snoozed && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{ageText}</Text>}
|
|
488
|
+
{x}
|
|
481
489
|
</View>
|
|
482
490
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 10, rowGap: 8 }}>
|
|
483
491
|
<RichText numberOfLines={3} tooltip={askText}
|
|
@@ -486,7 +494,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
486
494
|
</View>
|
|
487
495
|
{!!error && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
488
496
|
{!!mergeWhy && <Text accessibilityRole="alert" style={{ color: c.statusWarning, fontSize: 13, lineHeight: 18 }}>{mergeWhy}</Text>}
|
|
489
|
-
</
|
|
497
|
+
</RevealScope>;
|
|
490
498
|
}
|
|
491
499
|
|
|
492
500
|
const tight = isTight(b, compact, height);
|
|
@@ -511,7 +519,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
511
519
|
const otherId = !multi ? askedDecisions(b).find(d => isOther(picks[d.id]))?.id : undefined;
|
|
512
520
|
const keySend = multi ? (sendBar(b, sendable).ready ? () => sendAll() : null) : otherId && words[otherId]?.trim() ? () => sendOther(otherId) : null;
|
|
513
521
|
const sendOther = (decisionId: string) => { const text = words[decisionId]?.trim(); if (text) void run(`${decisionId}:${OTHER}`, async answerId => { await answer([{ decisionId, choice: OTHER, words: text }], answerId); clearCard(b.id); }); };
|
|
514
|
-
return <
|
|
522
|
+
return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you" : flaggedAct ? "Later" : word(b.kind)}: ${askText}`}
|
|
515
523
|
style={[{ marginVertical: embedded ? 0 : 10, borderRadius: 12, borderWidth: 1, borderColor: border, backgroundColor: c.surface1, overflow: "hidden" }, bare && BARE]}>
|
|
516
524
|
<SubmitScope enabled={!!keySend && !busy} onSubmit={() => keySend?.()} style={{ paddingHorizontal: pad, paddingTop: compact ? 12 : 14, paddingBottom: 14, gap: tight ? 10 : 12 }}>
|
|
517
525
|
<View style={{ gap: 4 }}>
|
|
@@ -525,9 +533,11 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
525
533
|
{!snoozed && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{ageText}</Text>}
|
|
526
534
|
{/* Phones: where the card's facts come from sits behind ⓘ instead of a footer under every card. */}
|
|
527
535
|
{compact && <Pressable accessibilityRole="button" accessibilityLabel={why ? "Hide where this comes from" : "Where this comes from"} aria-expanded={why} accessibilityState={{ expanded: why }}
|
|
528
|
-
onPress={() => setWhy(v => !v)} style={{ width: 44, height: 44, marginVertical: -15, marginRight: -14, alignItems: "center", justifyContent: "center" }}>
|
|
536
|
+
onPress={() => setWhy(v => !v)} style={{ width: 44, height: 44, marginVertical: -15, marginRight: x ? -10 : -14, alignItems: "center", justifyContent: "center" }}>
|
|
529
537
|
<Icon name="Info" size={14} color={why ? c.foreground : c.foregroundMuted} />
|
|
530
538
|
</Pressable>}
|
|
539
|
+
{/* The x is always the card's last control, in its top-right corner, on every Needs-you item. */}
|
|
540
|
+
{x}
|
|
531
541
|
</View>
|
|
532
542
|
{/* The ask role on phones (react-native-web ignores hitSlop, so the ⓘ above is a real 44 box); desktop keeps 19/26. */}
|
|
533
543
|
{/* Bare: a section of the Needs you block, so the same size as its question titles. */}
|
|
@@ -558,7 +568,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
558
568
|
<Text style={{ flex: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.sourceLine}</Text>
|
|
559
569
|
</View>}
|
|
560
570
|
{detail.workspace && sheet && <PrSheet workspace={detail.workspace} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
|
|
561
|
-
</
|
|
571
|
+
</RevealScope>;
|
|
562
572
|
}
|
|
563
573
|
|
|
564
574
|
const BARE = { marginVertical: 0, borderWidth: 0, borderRadius: 0, backgroundColor: "transparent" } as const;
|
package/client/catch-up.tsx
CHANGED
|
@@ -21,7 +21,8 @@ import { bottomInset, Button, focusSoon, IconButton, SubmitScope, text, type The
|
|
|
21
21
|
import { glyphColor } from "./home-list";
|
|
22
22
|
import { useHomeModel, type HomeSources } from "./home-data";
|
|
23
23
|
import { useInbox } from "./inbox";
|
|
24
|
-
import { QuestionBody, type SendReady } from "./questions";
|
|
24
|
+
import { QuestionBody, QuestionDismissX, type SendReady } from "./questions";
|
|
25
|
+
import { DismissReveal, useDismiss } from "./dismiss";
|
|
25
26
|
import { NeedsYouList } from "./needs-you";
|
|
26
27
|
import { BriefCard, type BriefDeps } from "./brief";
|
|
27
28
|
import { SummaryLine } from "./about";
|
|
@@ -187,7 +188,8 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
187
188
|
break;
|
|
188
189
|
}
|
|
189
190
|
// The card's own Dismiss (QuestionBody), so the key does exactly what the click does.
|
|
190
|
-
|
|
191
|
+
// The card's own x (client/dismiss.tsx), whatever the card is, so the key does exactly what the click does.
|
|
192
|
+
case "dismiss": { const d = inCard('[aria-label^="Dismiss"]'); if (!d) return; d.click?.(); break; }
|
|
191
193
|
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; }
|
|
192
194
|
// Its sheet or popover takes focus itself (MoveResult).
|
|
193
195
|
case "later": if (!click('[aria-label="Later (L)"]')) return; break;
|
|
@@ -286,10 +288,11 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
286
288
|
|
|
287
289
|
const body = finished || !card ? <Finished theme={theme} compact={compact} stats={stats} empty={!total} onHome={onExit}
|
|
288
290
|
onSkipped={() => setSession(s => ({ ...s, pos: s.order.findIndex(k => s.outcomes[k] === "skipped"), lapped: true }))} />
|
|
289
|
-
|
|
291
|
+
// The card on screen is the selected one: its x shows without hover (dismissing-anything-in-needs-you-sends-the-agent-nothing).
|
|
292
|
+
: <DismissReveal.Provider value="always"><CardView key={card.key} card={card} w={w} theme={theme} compact={compact} deps={deps} navigation={navigation} gone={gone} more={more} setMore={setMore}
|
|
290
293
|
request={askFor(context, card)} waiting={!!session.parked[card.s.key]} onAsk={ask}
|
|
291
294
|
sameWorkspace={session.order.filter(k => cardOf(k)?.s.key === card.s.key)}
|
|
292
|
-
onDone={() => settle("done")} onSkip={skip} onSkipWorkspace={wsLeft > 1 ? skipWs : undefined} wsLeft={wsLeft} onBack={session.pos > 0 ? back : undefined} onLater={() => settle("later")}
|
|
295
|
+
onDone={() => settle("done")} onSkip={skip} onSkipWorkspace={wsLeft > 1 ? skipWs : undefined} wsLeft={wsLeft} onBack={session.pos > 0 ? back : undefined} onLater={() => settle("later")} /></DismissReveal.Provider>;
|
|
293
296
|
|
|
294
297
|
const rail = <ScrollView {...({ dataSet: { catchUpRail: "1" } } as object)} contentContainerStyle={{ paddingVertical: 8 }}>
|
|
295
298
|
{session.order.map((k, i) => {
|
|
@@ -356,6 +359,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
356
359
|
const ws = openRowCopy<ListWorkspace>(w, full);
|
|
357
360
|
const [laterOpen, setLaterOpen] = useState(false);
|
|
358
361
|
const [ready, setReady] = useState<SendReady | null>(null);
|
|
362
|
+
const dismiss = useDismiss();
|
|
359
363
|
const openChat = () => { if (!navigation) return; if (s.agentId) navigation.openAgent({ agentId: s.agentId }); else if (s.workspaceId) navigation.openWorkspace({ workspaceId: s.workspaceId }); };
|
|
360
364
|
const word = cardWord(card);
|
|
361
365
|
const color = card.item?.kind === "merge" ? mergedColor(c) : card.kind === "finished" ? c.foregroundMuted : c.statusWarning;
|
|
@@ -395,8 +399,11 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
395
399
|
|
|
396
400
|
const askBlock = card.kind === "question" && q && ws
|
|
397
401
|
? <View style={{ gap: 8 }}>
|
|
398
|
-
<
|
|
399
|
-
|
|
402
|
+
<View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>
|
|
403
|
+
<RichText plain style={[compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }], { flex: 1, minWidth: 0 }]}>{`${q.id} · ${q.title}`}</RichText>
|
|
404
|
+
<View style={{ marginTop: compact ? -4 : -1, marginRight: -5 }}><QuestionDismissX workspaceId={ws.id} questionId={q.id} theme={theme} compact={compact} onDismissed={onDone} dismiss={dismiss} /></View>
|
|
405
|
+
</View>
|
|
406
|
+
<QuestionBody key={q.id} workspace={ws} question={q} theme={theme} compact={compact} inline={false} dismissAt="host"
|
|
400
407
|
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} onSendReady={setReady} dictate moreContext={false} />
|
|
401
408
|
</View>
|
|
402
409
|
: card.kind === "item" && card.item && full
|
|
@@ -404,7 +411,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
404
411
|
<NeedsYouList workspace={full} theme={theme} compact={compact} rows={[card.item]} flush actions={{ after: onDone, openAgent: openChat } as never} />
|
|
405
412
|
</View>
|
|
406
413
|
: card.kind === "permission" ? <PermissionCard s={s} theme={theme} compact={compact} onDone={onDone} />
|
|
407
|
-
: card.kind === "brief" ? <BriefAsk s={s} theme={theme} compact={compact} deps={deps} />
|
|
414
|
+
: card.kind === "brief" ? <BriefAsk s={s} theme={theme} compact={compact} deps={deps} onDismissed={onDone} />
|
|
408
415
|
: <View style={{ gap: 10 }}>
|
|
409
416
|
<Text style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || "The agent finished its turn."}</Text>
|
|
410
417
|
<Text style={t.meta}>Nothing to decide. Sign it off once you've read it, or reply.</Text>
|
|
@@ -479,12 +486,12 @@ function PermissionCard({ s, theme, compact, onDone }: { s: DeckCard["s"]; theme
|
|
|
479
486
|
onRespond={r => { void agent.handle?.respondToPermission({ requestId: p.id, response: r as never }); onDone(); }} />)}</View>;
|
|
480
487
|
}
|
|
481
488
|
|
|
482
|
-
function BriefAsk({ s, theme, compact, deps }: { s: DeckCard["s"]; theme: Theme; compact: boolean; deps: CatchUpDeps }) {
|
|
489
|
+
function BriefAsk({ s, theme, compact, deps, onDismissed }: { s: DeckCard["s"]; theme: Theme; compact: boolean; deps: CatchUpDeps; onDismissed?: () => void }) {
|
|
483
490
|
const read = useRpc(inboxBriefRpc);
|
|
484
491
|
const brief = useQuery({ queryKey: ["follow-up", "home-brief", s.agentId, "catch-up"], queryFn: () => read({ agentId: s.agentId! }), enabled: !!s.agentId });
|
|
485
492
|
const b = liveBrief(brief.data?.brief);
|
|
486
493
|
if (!b) return <Text style={text(theme.colors, compact).ask}>{s.line}</Text>;
|
|
487
|
-
return <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />;
|
|
494
|
+
return <BriefCard {...({ embedded: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps, onDismissed } as unknown as Parameters<typeof BriefCard>[0])} />;
|
|
488
495
|
}
|
|
489
496
|
|
|
490
497
|
export function Finished({ theme, compact, stats, empty, onHome, onSkipped }: { theme: Theme; compact: boolean; stats: ReturnType<typeof statsOf>; empty: boolean; onHome: () => void; onSkipped: () => void }) {
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createContext, useContext, useEffect, useRef, useState, type ReactNode } from "react";
|
|
2
|
+
import { Platform, View, type StyleProp, type ViewProps, type ViewStyle } from "react-native";
|
|
3
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { dismissRpc } from "../shared/contracts";
|
|
7
|
+
import { Pressable } from "./text";
|
|
8
|
+
import { focusRing, type Theme } from "./kit";
|
|
9
|
+
import { withAlpha } from "./theme";
|
|
10
|
+
import { liveBriefKey, overviewKey, workspaceKey } from "./keys";
|
|
11
|
+
import { hasToastHost, pushToast, runAction } from "./toast-store";
|
|
12
|
+
import type { InboxStore } from "./inbox-store";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Dismiss, the same on every Needs-you item (dismissing-anything-in-needs-you-sends-the-agent-nothing): a small muted x
|
|
16
|
+
* in the card's top-right corner, next to its age. "This no longer needs me": the item leaves Needs you and every
|
|
17
|
+
* count at once, the agent is sent nothing, and the toast's Undo brings it back. One control (DismissX), one request
|
|
18
|
+
* (follow.dismiss), one toast.
|
|
19
|
+
*
|
|
20
|
+
* Where it shows: on a phone (no hover) always, muted, with a 40 px hit area (a real box, since react-native-web ignores hitSlop) rather than a bigger glyph.
|
|
21
|
+
* On desktop it appears while the pointer is over its card or focus is inside it (RevealScope), and always on the card
|
|
22
|
+
* that is selected (Catch up's card, Home's detail pane: `DismissReveal` "always"). Hidden is opacity 0, never
|
|
23
|
+
* unmounted, so the card doesn't move when it appears and the keyboard and screen readers always reach it.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/** As long as sign-off's Undo (6 s): the toast holds while the pointer or focus is on it. */
|
|
27
|
+
export const DISMISS_UNDO_MS = 6_000;
|
|
28
|
+
/** The x's tooltip and the second half of its accessibility label. */
|
|
29
|
+
export const DISMISS_HINT = "it no longer needs you, and the agent isn't messaged";
|
|
30
|
+
|
|
31
|
+
export type DismissTarget = { workspaceId: string; key: string } | { agentId: string };
|
|
32
|
+
const targetKey = (t: DismissTarget) => "agentId" in t ? `agent:${t.agentId}` : `${t.workspaceId}:${t.key}`;
|
|
33
|
+
|
|
34
|
+
/** The inbox store, bound once by the client entry, so dismissing a brief updates the rows at once. */
|
|
35
|
+
let inbox: InboxStore | null = null;
|
|
36
|
+
export function bindDismissInbox(store: InboxStore | null): void { inbox = store; }
|
|
37
|
+
|
|
38
|
+
/** Dismiss one item, with Undo in the toast. `onDismissed` runs at once, before the request: the card moves on. */
|
|
39
|
+
export function useDismiss(): (target: DismissTarget, options?: { onDismissed?: () => void }) => void {
|
|
40
|
+
const rpc = useRpc(dismissRpc);
|
|
41
|
+
const toast = useToast();
|
|
42
|
+
const cache = useQueryClient();
|
|
43
|
+
const refresh = (t: DismissTarget) => {
|
|
44
|
+
if ("agentId" in t) void cache.invalidateQueries({ queryKey: liveBriefKey(t.agentId) });
|
|
45
|
+
else void cache.invalidateQueries({ queryKey: workspaceKey(t.workspaceId) });
|
|
46
|
+
void cache.invalidateQueries({ queryKey: overviewKey });
|
|
47
|
+
};
|
|
48
|
+
const call = (t: DismissTarget, undo: boolean) => "agentId" in t && inbox ? inbox.dismiss(t.agentId, undo) : rpc({ ...t, ...(undo ? { undo: true } : {}) });
|
|
49
|
+
const undo = (t: DismissTarget, name: string) => void runAction({ label: `Undo dismiss ${name}`, toast, run: () => call(t, true), onSuccess: () => refresh(t),
|
|
50
|
+
success: () => `${name.charAt(0).toUpperCase()}${name.slice(1)} is back in Needs you`, failure: `Couldn't bring back ${name}` }, `dismiss:${targetKey(t)}`);
|
|
51
|
+
return (t, options = {}) => {
|
|
52
|
+
options.onDismissed?.();
|
|
53
|
+
void runAction({ label: "Dismiss", toast, run: () => call(t, false), onSuccess: () => refresh(t), failure: "Couldn't dismiss it",
|
|
54
|
+
// Already gone (merged, answered, sent elsewhere): nothing to say, the surface shows what happened.
|
|
55
|
+
reconcile: () => refresh(t),
|
|
56
|
+
success: r => {
|
|
57
|
+
const message = `Dismissed ${r.name}. The agent wasn't messaged.`;
|
|
58
|
+
if (!hasToastHost()) return message;
|
|
59
|
+
pushToast("success", message, [{ label: "Undo", onPress: () => undo(t, r.name) }], { durationMs: DISMISS_UNDO_MS, keep: true });
|
|
60
|
+
return null;
|
|
61
|
+
} }, `dismiss:${targetKey(t)}`);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** "always": the card is the selected one (Catch up's card, Home's detail pane), so its x shows without hover. */
|
|
66
|
+
export const DismissReveal = createContext<"hover" | "always">("hover");
|
|
67
|
+
const Hovered = createContext<boolean>(false);
|
|
68
|
+
|
|
69
|
+
type DomNode = { addEventListener(type: string, f: () => void): void; removeEventListener(type: string, f: () => void): void; setAttribute?(k: string, v: string): void };
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A card whose x shows while the pointer is over it or focus is inside it (desktop web). Native and phones draw the x
|
|
73
|
+
* always, so this is a plain View there.
|
|
74
|
+
*/
|
|
75
|
+
export function RevealScope({ children, style, ...rest }: { children: ReactNode; style?: StyleProp<ViewStyle> } & Omit<ViewProps, "style" | "children">) {
|
|
76
|
+
const [hovered, setHovered] = useState(false);
|
|
77
|
+
const [focused, setFocused] = useState(false);
|
|
78
|
+
// react-native-web forwards these to the DOM (as client/linked.tsx's hover does); React's onFocus/onBlur bubble, so
|
|
79
|
+
// focus anywhere inside the card counts. Native ignores them: the x is always shown there.
|
|
80
|
+
const web = Platform.OS === "web" ? { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onFocus: () => setFocused(true), onBlur: () => setFocused(false) } : {};
|
|
81
|
+
return <View style={style} {...rest} {...(web as object)}><Hovered.Provider value={hovered || focused}>{children}</Hovered.Provider></View>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The small x. `label` names what it dismisses ("Dismiss Q3", "Dismiss #12 is approved"); the hint follows it. Quiet by
|
|
86
|
+
* design: the muted foreground at 14 px (16 on phones), no fill until hovered, never the size or colour of an action.
|
|
87
|
+
*/
|
|
88
|
+
export function DismissX({ theme, compact, label, onPress, disabled = false }: { theme: Theme; compact: boolean; label: string; onPress: () => void; disabled?: boolean }) {
|
|
89
|
+
const c = theme.colors;
|
|
90
|
+
const reveal = useContext(DismissReveal);
|
|
91
|
+
const hovered = useContext(Hovered);
|
|
92
|
+
const [focused, setFocused] = useState(false);
|
|
93
|
+
const touch = compact || Platform.OS !== "web";
|
|
94
|
+
const shown = touch || reveal === "always" || hovered || focused;
|
|
95
|
+
const tip = useRef<View>(null);
|
|
96
|
+
useEffect(() => { if (Platform.OS === "web") (tip.current as unknown as DomNode | null)?.setAttribute?.("title", `Dismiss: ${DISMISS_HINT}`); }, []);
|
|
97
|
+
// Phones: a real 40 px box (react-native-web ignores hitSlop) pulled in by 6 px each side, so it lays out as 28 px;
|
|
98
|
+
// native also gets 4 px of hitSlop, a 48 px target. The glyph stays small and muted.
|
|
99
|
+
const box = touch ? 40 : 22;
|
|
100
|
+
return <Pressable ref={tip} accessibilityRole="button" accessibilityLabel={`${label}: ${DISMISS_HINT}`} disabled={disabled} onPress={onPress}
|
|
101
|
+
hitSlop={4} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
|
|
102
|
+
style={(state: { hovered?: boolean; pressed: boolean; focused?: boolean }) => ({ ...focusRing(state.focused, c), width: box, height: box, margin: touch ? -6 : 0, borderRadius: box / 2, alignItems: "center", justifyContent: "center",
|
|
103
|
+
opacity: shown ? (disabled ? 0.4 : 1) : 0, backgroundColor: state.pressed ? c.surface2 : state.hovered ? withAlpha(c.foreground, 0.06) : "transparent" })}>
|
|
104
|
+
{state => <Icon name="X" size={touch ? 16 : 14} color={(state as { hovered?: boolean }).hovered ? c.foreground : c.foregroundMuted} />}
|
|
105
|
+
</Pressable>;
|
|
106
|
+
}
|
package/client/home-chrome.tsx
CHANGED
|
@@ -130,7 +130,9 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
|
|
|
130
130
|
: !!value && <Pressable accessibilityRole="button" accessibilityLabel={`Clear ${placeholder.toLowerCase()}`} hitSlop={dense ? 14 : 8} onPress={() => { onChange(""); inputRef.current?.focus(); }}>
|
|
131
131
|
<Icon name="X" size={dense ? 16 : 13} color={c.foregroundMuted} />
|
|
132
132
|
</Pressable>}
|
|
133
|
-
{slashHint && !value && !focused && !dense && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no"
|
|
133
|
+
{slashHint && !value && !focused && !dense && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no"
|
|
134
|
+
// React Native Web drops title props on Text; keep the existing chip's DOM title current directly.
|
|
135
|
+
ref={node => { (node as unknown as { setAttribute?: (key: string, value: string) => void } | null)?.setAttribute?.("title", slashTitle ?? ""); }} style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 4, borderRadius: 3, borderWidth: 1, borderColor: c.border, fontVariant: ["tabular-nums"] }}>{slashHint}</Text>}
|
|
134
136
|
</View>;
|
|
135
137
|
}
|
|
136
138
|
|
package/client/home.tsx
CHANGED
|
@@ -23,6 +23,7 @@ import { NeedsYouBlock } from "./needs-you";
|
|
|
23
23
|
import { HeldMerges } from "./merge-button";
|
|
24
24
|
import { PrSheet } from "./pr-sheet";
|
|
25
25
|
import { QuestionSheet } from "./questions";
|
|
26
|
+
import { DismissReveal } from "./dismiss";
|
|
26
27
|
import { Age, BadgeView, BRIEF_KEY, glyphColor, HomeList, OVERSEER_KEY, PrChipView, PrSummaryText, type OverseerRowState } from "./home-list";
|
|
27
28
|
import { answerLine, overseerRowState } from "../shared/overseer";
|
|
28
29
|
import type { OmniboxItem } from "../shared/search";
|
|
@@ -592,7 +593,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
592
593
|
// Only a real ask joins it (shared briefAsks): a done brief on a row flagged for something else stays out of the count.
|
|
593
594
|
const inBlock = !!w && !!showBrief && !later && briefAsks(b, row);
|
|
594
595
|
|
|
595
|
-
|
|
596
|
+
// Home's detail pane is the selected workspace: every x in it shows without hover (client/dismiss.tsx).
|
|
597
|
+
return <DismissReveal.Provider value="always"><DockedPane compact={compact} header={header} style={{ backgroundColor: c.surface0 }} contentContainerStyle={{ padding: compact ? 16 : 20, gap: 16, paddingBottom: 24 }}
|
|
596
598
|
dock={({ yields, typingInContent }) => s.agentId && !typingInContent && <View nativeID={compact ? TOAST_ANCHOR : undefined} style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
|
|
597
599
|
{!yields && moves}
|
|
598
600
|
<ReplyBox theme={theme} compact={compact} agentName={s.title} placeholder={compact ? "Reply to the agent" : undefined} onSend={async text => {
|
|
@@ -617,7 +619,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
617
619
|
{laterModal}
|
|
618
620
|
{full && sheet && <PrSheet workspace={full} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
|
|
619
621
|
{full && <QuestionSheet workspace={full} questionId={question} theme={theme} compact={compact} onClose={() => setQuestion(null)} />}
|
|
620
|
-
|
|
622
|
+
</DismissReveal.Provider>;
|
|
621
623
|
}
|
|
622
624
|
|
|
623
625
|
/**
|
package/client/inbox-store.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
|
-
import { inboxActRpc, inboxFeed, inboxListRpc } from "../shared/contracts";
|
|
2
|
+
import { dismissRpc, inboxActRpc, inboxFeed, inboxListRpc } from "../shared/contracts";
|
|
3
3
|
import { openFeed, type Feed } from "./feeds";
|
|
4
4
|
import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
|
|
5
5
|
import { withoutWithdrawnAsks, type InboxRow } from "../shared/inbox";
|
|
@@ -143,6 +143,16 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
143
143
|
nudge,
|
|
144
144
|
stop() { stopped = true; feed?.stop(); offVisible(); offNoReview(); if (timer) clearTimeout(timer); if (nudged) clearTimeout(nudged); listeners.clear(); unsubscribe(); },
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Dismiss an agent's ask (dismissing-anything-in-needs-you-sends-the-agent-nothing): it leaves Needs you at once and
|
|
148
|
+
* the agent is sent nothing. The caller's toast carries Undo (`undo: true`), so no Undo bar here.
|
|
149
|
+
*/
|
|
150
|
+
async dismiss(agentId: string, undo = false) {
|
|
151
|
+
if (!undo) { patch([agentId], r => ({ ...r, needs: null, snooze: null, signedOffAt: new Date().toISOString(), undoable: true })); emit(); }
|
|
152
|
+
try { return await client.rpc(dismissRpc, { agentId, ...(undo ? { undo: true } : {}) }); }
|
|
153
|
+
finally { refresh(); }
|
|
154
|
+
},
|
|
155
|
+
|
|
146
156
|
/** Sign off now; queue for replay when the host can't be reached. */
|
|
147
157
|
async signOff(requested: string[], options: { muteTurn?: boolean } = {}) {
|
|
148
158
|
const agentIds = requested.filter(id => !inflight.has(id));
|
package/client/needs-you.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { sameText } from "../shared/home";
|
|
|
11
11
|
import type { ListWorkspace as Workspace } from "../shared/list";
|
|
12
12
|
import { Button, Card, CardRow, Chip, PrLinkButton, errorText, text, type Theme } from "./kit";
|
|
13
13
|
import type { Colors } from "./theme";
|
|
14
|
-
import { QuestionBody, meanwhile } from "./questions";
|
|
14
|
+
import { QuestionBody, QuestionDismissX, meanwhile } from "./questions";
|
|
15
15
|
import { needsYouBlock } from "../shared/needs-block";
|
|
16
16
|
import { age } from "../shared/inbox";
|
|
17
17
|
import { questionState } from "../shared/questions";
|
|
@@ -20,6 +20,7 @@ import { useState, type ReactNode } from "react";
|
|
|
20
20
|
import { usePendingAnswer } from "./pending-answers";
|
|
21
21
|
import { useReviewerSettings } from "./reviewers";
|
|
22
22
|
import { NoReviewLink } from "./review-mode";
|
|
23
|
+
import { DismissX, RevealScope, useDismiss } from "./dismiss";
|
|
23
24
|
|
|
24
25
|
import { overviewKey, workspaceKey } from "./keys";
|
|
25
26
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
@@ -99,6 +100,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
99
100
|
const inspect = useMutation({ mutationFn: (actionId: string) => check({ workspaceId: w.id, actionId }), onSuccess: reply => { toast.show(reply.result, { variant: reply.state === "failed" ? "warning" : "info" }); refresh(); }, onError: fail });
|
|
100
101
|
const items = rows ?? needsYou(w, now);
|
|
101
102
|
const mergeControl = useMergeButtons(w);
|
|
103
|
+
const dismiss = useDismiss();
|
|
102
104
|
if (!items.length) return null;
|
|
103
105
|
const busy = resume.isPending || retry.isPending || retryTask.isPending || deliver.isPending || sendAnswer.isPending || resendAnswer.isPending || queueAct.isPending || inspect.isPending;
|
|
104
106
|
const openMain = actions.openAgent ? () => actions.openAgent!(w.mainAgentId) : undefined;
|
|
@@ -160,12 +162,15 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
160
162
|
const more = secondary(item);
|
|
161
163
|
const button = act || link || more ? <>{pair ?? <>{act}{link}</>}{more}</> : null;
|
|
162
164
|
const said = !!untitled?.has(item.key);
|
|
165
|
+
// The small x, top right, on every kind (dismissing-anything-in-needs-you-sends-the-agent-nothing).
|
|
166
|
+
const x = <DismissX theme={theme} compact={compact} label={`Dismiss ${item.kind === "question" ? item.questionId : item.title}`}
|
|
167
|
+
onPress={() => dismiss({ workspaceId: w.id, key: item.key }, { onDismissed: actions.after })} />;
|
|
163
168
|
// Phones: the action sits at the row's right edge so rows never grow a second line of controls. A send batch
|
|
164
169
|
// (the primary, with its task list) and Retry's pair keep their buttons full width under the row.
|
|
165
170
|
// A stack's scope line and a blocker need the row's full width, so those rows put their button under the text.
|
|
166
171
|
const inline = compact && button && item.kind !== "send" && !(item.kind === "retry" && !item.exhausted) && item.kind !== "person" && !scopeLine && !notice;
|
|
167
172
|
if (inline) return <CardRow key={item.key} theme={theme} compact first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
168
|
-
<
|
|
173
|
+
<RevealScope style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
169
174
|
{/* A row with the quiet link under it is taller: the glyph stays on the title's line. */}
|
|
170
175
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start", paddingTop: 2 } : undefined}><Icon name={g.name} size={16} color={g.color} /></View>
|
|
171
176
|
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
@@ -174,10 +179,12 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
174
179
|
{item.kind === "reviewers" && <NoReviewLink repo={item.prKey.split("#")[0]} theme={theme} compact />}
|
|
175
180
|
</View>
|
|
176
181
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start" } : undefined}>{pair ?? button}</View>
|
|
177
|
-
|
|
182
|
+
{/* Top right, a step away from the action so a thumb aimed at it doesn't land here. */}
|
|
183
|
+
<View style={{ alignSelf: "flex-start", marginTop: -4, marginRight: -6, marginLeft: 2 }}>{x}</View>
|
|
184
|
+
</RevealScope>
|
|
178
185
|
</CardRow>;
|
|
179
186
|
return <CardRow key={item.key} theme={theme} compact={compact} first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
180
|
-
<
|
|
187
|
+
<RevealScope style={{ flexDirection: "row", gap: 9 }}>
|
|
181
188
|
<View style={{ paddingTop: 2 }}><Icon name={g.name} size={14} color={g.color} /></View>
|
|
182
189
|
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
|
|
183
190
|
{!said && <RichText style={compact ? t.label : t.body}>{item.title}</RichText>}
|
|
@@ -191,7 +198,8 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
191
198
|
</View>}
|
|
192
199
|
{notice}
|
|
193
200
|
</View>
|
|
194
|
-
|
|
201
|
+
<View style={{ marginTop: -3, marginRight: -5 }}>{x}</View>
|
|
202
|
+
</RevealScope>
|
|
195
203
|
</CardRow>;
|
|
196
204
|
})}
|
|
197
205
|
</View></PrLinksProvider>;
|
|
@@ -246,6 +254,7 @@ export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brie
|
|
|
246
254
|
function QuestionAsk({ workspace: w, questionId, context, theme, compact, now, open, onToggle, openAgent }: { workspace: Workspace; questionId: string; context: string | null; theme: Theme; compact: boolean; now: number; open: boolean; onToggle: () => void; openAgent?: (agentId: string) => void }) {
|
|
247
255
|
const c = theme.colors; const t = text(c, compact);
|
|
248
256
|
const pending = usePendingAnswer(w.id, questionId);
|
|
257
|
+
const dismiss = useDismiss();
|
|
249
258
|
const q = w.questions.find(x => x.id === questionId);
|
|
250
259
|
if (!q) return null;
|
|
251
260
|
const state = meanwhile(w, q, pending);
|
|
@@ -257,10 +266,20 @@ function QuestionAsk({ workspace: w, questionId, context, theme, compact, now, o
|
|
|
257
266
|
<Text style={[t.meta, { paddingTop: 1 }]}>{age(q.askedAt, now)}</Text>
|
|
258
267
|
<View style={{ paddingTop: 1 }}><Icon name={open ? "ChevronUp" : "ChevronDown"} size={14} color={c.foregroundMuted} /></View>
|
|
259
268
|
</View>;
|
|
260
|
-
|
|
269
|
+
// The x sits beside the header, outside its toggle, so dismissing never also opens or closes the section.
|
|
270
|
+
const x = <View style={{ marginTop: compact ? -4 : -3, marginRight: compact ? -8 : -6 }}><QuestionDismissX workspaceId={w.id} questionId={q.id} theme={theme} compact={compact} dismiss={dismiss} /></View>;
|
|
271
|
+
if (!open) return <CardRow theme={theme} compact={compact} style={{ minHeight: compact ? 48 : undefined, justifyContent: "center" }}>
|
|
272
|
+
<RevealScope style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
|
|
273
|
+
<Pressable accessibilityRole="button" accessibilityLabel={`Show ${q.id}: ${q.title}`} onPress={onToggle} style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : undefined, justifyContent: "center" }}>{header}</Pressable>
|
|
274
|
+
{x}
|
|
275
|
+
</RevealScope>
|
|
276
|
+
</CardRow>;
|
|
261
277
|
return <CardRow theme={theme} compact={compact} style={{ paddingVertical: compact ? 14 : 12 }}>
|
|
262
|
-
<
|
|
263
|
-
<
|
|
278
|
+
<RevealScope style={{ gap: 12 }}>
|
|
279
|
+
<View style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
|
|
280
|
+
<Pressable accessibilityRole="button" aria-expanded accessibilityState={{ expanded: true }} accessibilityLabel={`Hide ${q.id}: ${q.title}`} onPress={onToggle} style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : undefined }}>{header}</Pressable>
|
|
281
|
+
{x}
|
|
282
|
+
</View>
|
|
264
283
|
{/* What the agent does meanwhile sits under the question, as in the dialog; under the buttons goes what they do. */}
|
|
265
284
|
<View style={{ flexDirection: "row", gap: 6 }}>
|
|
266
285
|
<View style={{ paddingTop: 2 }}><Icon name={state.icon} size={12} color={state.color(c)} /></View>
|
|
@@ -268,6 +287,6 @@ function QuestionAsk({ workspace: w, questionId, context, theme, compact, now, o
|
|
|
268
287
|
</View>
|
|
269
288
|
{!!context && <RichText selectable linkColor={c.foreground} style={[t.body, { color: c.foregroundMuted }]}>{context}</RichText>}
|
|
270
289
|
<QuestionBody workspace={w} question={q} theme={theme} compact={compact} now={now} openAgent={openAgent} inline />
|
|
271
|
-
</
|
|
290
|
+
</RevealScope>
|
|
272
291
|
</CardRow>;
|
|
273
292
|
}
|