paseo-follow-up 2.3.0-beta.0 → 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.
@@ -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, CONTEXT_ASKS, MODE, askHeadline, catchUpKey, 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";
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[], key: string) => [...context].reverse().find(r => r.cardKey === key) ?? null;
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.key)} waiting={!!session.parked[card.s.key]} onAsk={ask}
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.
@@ -0,0 +1,177 @@
1
+ // More context, the one component and the one request path for every surface that answers a question
2
+ // (more-context-is-the-same-on-every-surface, docs/needs-you.md#more-context): Catch up's card (its move bar opens
3
+ // MorePanel), and QuestionBody everywhere else: the panel's Needs you card, Home's detail pane, the question dialog, the
4
+ // pill, phones. "I don't get it" first, then your own words; the ask goes to the card's workspace's main agent
5
+ // (follow.context-ask, the same request ask_context makes), and the answer shows on the question wherever you look at it,
6
+ // because every reader matches it with `contextFor` (shared/catch-up.ts).
7
+ import { useEffect, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
8
+ import { Platform, View } from "react-native";
9
+ import { Pressable, Text } from "./text";
10
+ import { Icon, TextInput } from "@getpaseo/plugin/client/ui";
11
+ import { CONTEXT_ASKS, askHeadline, contextFor, keyLabel, questionCardKey, type ContextRequest } from "../shared/catch-up";
12
+ import type { RpcInput } from "@getpaseo/plugin";
13
+ import type { contextAskRpc } from "../shared/contracts";
14
+ import type { ListQuestion, ListWorkspace } from "../shared/list";
15
+ import { errorText } from "../shared/errors";
16
+ import { Button, IconButton, text, type Theme } from "./kit";
17
+ import { withAlpha } from "./theme";
18
+ import { RichText } from "./rich-text";
19
+ import { PRIMARY_FORM } from "./dock";
20
+
21
+ const CATCH_UP_FOOTNOTE = "This workspace steps aside while you keep going, and comes back as your next card with the answer. Back reaches it any time.";
22
+ const isMac = () => typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test((navigator as { platform?: string }).platform ?? "");
23
+
24
+ /**
25
+ * The client's one store of More context asks: Home's extras (client/home-view.ts), which the home feed keeps current,
26
+ * so nothing polls. index.client.tsx hands it over once; every surface reads the same asks and asks through it.
27
+ */
28
+ export type ContextSource = {
29
+ context(): ContextRequest[];
30
+ subscribe(listener: () => void): () => void;
31
+ askContext(input: RpcInput<typeof contextAskRpc>): Promise<{ request: ContextRequest }>;
32
+ /** Reads the asks once. A 0.15 host has no feed, and the store starts empty, so a fresh panel would miss an ask. */
33
+ refreshContext?(): Promise<void>;
34
+ };
35
+ /** Sources already read: the first question card on screen reads the asks once per client, never per card or on a timer. */
36
+ const read = new WeakSet<ContextSource>();
37
+ let source: ContextSource | null = null;
38
+ const sourceListeners = new Set<() => void>();
39
+ export function setContextSource(next: ContextSource | null): void { source = next; for (const l of sourceListeners) l(); }
40
+ const noAsks: ContextRequest[] = [];
41
+ const idle = () => () => undefined;
42
+
43
+ /** The newest ask about one question, from any surface, and the way to ask. Null `ask` when no source is set. */
44
+ export function useQuestionContext(workspaceId: string, questionId: string): { request: ContextRequest | null; ask: ((words: string, card: string, agentId: string | null) => Promise<ContextRequest>) | null } {
45
+ const current = useSyncExternalStore(l => { sourceListeners.add(l); return () => { sourceListeners.delete(l); }; }, () => source, () => source);
46
+ const requests = useSyncExternalStore(current?.subscribe ?? idle, current?.context ?? (() => noAsks), current?.context ?? (() => noAsks));
47
+ useEffect(() => { if (current && !read.has(current)) { read.add(current); void current.refreshContext?.().catch(() => undefined); } }, [current]);
48
+ const cardKey = questionCardKey(workspaceId, questionId);
49
+ const request = contextFor(requests, { workspaceId, cardKey });
50
+ return {
51
+ request,
52
+ ask: current && (async (words, card, agentId) => (await current.askContext({ workspaceId, agentId, cardKey, card: card.slice(0, 300), ask: words })).request),
53
+ };
54
+ }
55
+
56
+ /**
57
+ * More context on a question card outside Catch up: a quiet link where the answer is written, never a new top-level
58
+ * button. Open, it is Catch up's panel (suggestions, then your own words) in Catch up's sheet; asked, the card says it
59
+ * is waiting; answered, the answer sits on the question. `children` are the row's other quiet links (they follow it).
60
+ */
61
+ export function QuestionMoreContext({ workspace: w, question: q, theme, compact, openAgent, children }: { workspace: Pick<ListWorkspace, "id" | "mainAgentId">; question: Pick<ListQuestion, "id" | "title" | "askedBy">; theme: Theme; compact: boolean; openAgent?: (agentId: string) => void; children?: ReactNode }) {
62
+ const c = theme.colors;
63
+ const { request, ask } = useQuestionContext(w.id, q.id);
64
+ const [open, setOpen] = useState(false);
65
+ const asking = request?.state === "asking";
66
+ const agentId = q.askedBy ?? w.mainAgentId ?? null;
67
+ const chatOf = request?.askedOf ?? w.mainAgentId ?? null;
68
+ const onAsk = async (words: string) => { await ask!(words, `${q.id} · ${q.title}`, agentId); setOpen(false); };
69
+ const link = !!ask && !asking && !open && <Pressable accessibilityRole="button" accessibilityLabel={`More context on ${q.id}`} accessibilityHint="Ask the agent to explain this question" hitSlop={6} onPress={() => setOpen(true)}
70
+ style={({ hovered, pressed }: { hovered?: boolean; pressed: boolean }) => ({ flexDirection: "row", alignItems: "center", gap: 6, alignSelf: "flex-start", minHeight: compact ? 44 : 28, paddingHorizontal: 4, marginLeft: -4, borderRadius: 6, opacity: pressed ? 0.7 : 1, backgroundColor: hovered ? withAlpha(c.foreground, 0.05) : "transparent" })}>
71
+ <Icon name="Sparkles" size={14} color={c.foregroundMuted} />
72
+ <Text style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18, fontWeight: "500" }}>{request ? "Ask more" : "More context"}</Text>
73
+ </Pressable>;
74
+ if (!ask && !request && !children) return null;
75
+ return <View {...({ dataSet: { moreContext: q.id } } as object)} style={{ gap: 8 }}>
76
+ {request && <ContextAnswer theme={theme} compact={compact} request={request} waiting={false} onQuestion agent="the agent"
77
+ openChat={() => { if (chatOf) openAgent?.(chatOf); }} chatDisabled={!openAgent || !chatOf} openAgent={openAgent} />}
78
+ {open && ask && <MoveResult place="sheet" inset theme={theme} label="More context">
79
+ <MorePanel theme={theme} compact={compact} onClose={() => setOpen(false)} onAsk={onAsk}
80
+ footnote="Keep going meanwhile: the answer shows on this question here, on Home and in Catch up." />
81
+ </MoveResult>}
82
+ {(link || children) && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 16 }}>{link}{children}</View>}
83
+ </View>;
84
+ }
85
+
86
+ /**
87
+ * 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
88
+ * on its desktop button. Focus moves into it (its first choice), and on the web it scrolls into view the least distance.
89
+ */
90
+ export function MoveResult({ place, theme, label, width, inset = false, children }: { place: "sheet" | "popover"; theme: Theme; label: string; width?: number; /** Inside a card: no margins of its own. */ inset?: boolean; children: ReactNode }) {
91
+ const c = theme.colors;
92
+ const ref = useRef<View>(null);
93
+ useEffect(() => {
94
+ if (Platform.OS !== "web") return;
95
+ const t = setTimeout(() => {
96
+ const node = ref.current as unknown as { querySelector?(q: string): { focus?(o?: object): void } | null; scrollIntoView?(o: object): void } | null;
97
+ node?.scrollIntoView?.({ block: "nearest" });
98
+ // The first choice: More context's suggestions ("I don't get it" leads), else Later's first time.
99
+ (node?.querySelector?.('[role="radio"]') ?? node?.querySelector?.('[role="menu"] [role="button"]'))?.focus?.({ preventScroll: true });
100
+ }, 0);
101
+ return () => clearTimeout(t);
102
+ }, []);
103
+ return <View ref={ref} {...({ dataSet: { moveResult: place } } as object)} role="dialog" accessibilityLabel={label}
104
+ style={[{ padding: place === "sheet" ? 14 : 16, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 },
105
+ place === "sheet"
106
+ ? inset ? {} : { marginHorizontal: 12, marginTop: 12 }
107
+ : { position: "absolute", zIndex: 20, left: 0, bottom: "100%", marginBottom: 8, width, shadowColor: "#000", shadowOpacity: 0.22, shadowRadius: 16, shadowOffset: { width: 0, height: 6 } }]}>
108
+ {children}
109
+ </View>;
110
+ }
111
+
112
+ /** What came back for this card: the answer, "answered in its chat", a failure, or (seen going Back) that it's still asking. */
113
+ export function ContextAnswer({ theme, compact, request, waiting, agent, openChat, openAgent, onQuestion = false, chatDisabled = false }: { theme: Theme; compact: boolean; request: ContextRequest; waiting: boolean; agent: string; openChat: () => void; openAgent?: (agentId: string) => void;
114
+ /** On a question card outside Catch up: a pending ask says where its answer will show. */ onQuestion?: boolean; chatDisabled?: boolean }) {
115
+ const c = theme.colors; const t = text(c, compact);
116
+ const who = request.target === "overseer" ? "Overseer" : agent === "the agent" ? "The agent" : agent;
117
+ const asking = request.state === "asking";
118
+ 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 }}>
119
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
120
+ <Icon name={asking ? "Hourglass" : request.state === "failed" ? "CircleAlert" : "Sparkles"} size={14} color={request.state === "failed" ? c.statusDanger : c.foregroundMuted} />
121
+ <RichText plain style={[t.small, { flex: 1 }]}>{asking ? `Asked ${who === "Overseer" ? "the Overseer" : who === "The agent" ? "the agent" : who}${waiting ? " · this comes back as the next card when it answers. You can still act on it now" : onQuestion ? " · the answer shows here when it comes. You can still answer now" : ""}` : `${who} · you asked: ${askHeadline(request.ask)}`}</RichText>
122
+ </View>
123
+ {request.state === "answered" && request.answer && <RichText selectable style={t.body}>{request.answer}</RichText>}
124
+ {request.state === "chat" && <View style={{ gap: 8 }}>
125
+ <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>
126
+ {/* 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). */}
127
+ <View style={{ flexDirection: "row" }}>{who === "Overseer"
128
+ ? <Button theme={theme} compact={compact} icon="MessageSquare" title="Open Overseer" disabled={!request.askedOf || !openAgent} onPress={() => request.askedOf && openAgent?.(request.askedOf)} />
129
+ : <Button theme={theme} compact={compact} icon="MessageSquare" title="Open chat" disabled={chatDisabled} onPress={openChat} />}</View>
130
+ </View>}
131
+ {request.state === "failed" && <Text style={t.body}>{request.error ?? "The ask didn't go through. Try again, or open the chat."}</Text>}
132
+ </View>;
133
+ }
134
+
135
+ /**
136
+ * More context: "I don't get it" first (most asks just need explaining), then the developer's own words, to one place:
137
+ * 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-
138
+ * it). It may wake, because the developer asked. The deck moves on and this workspace comes back when the answer is ready.
139
+ */
140
+ export function MorePanel({ theme, compact, onClose, onAsk, footnote = CATCH_UP_FOOTNOTE }: { theme: Theme; compact: boolean; onClose: () => void; onAsk: (words: string) => Promise<void>; /** What happens while the agent answers, in this surface's terms. */ footnote?: string }) {
141
+ const c = theme.colors; const t = text(c, compact);
142
+ const [words, setWords] = useState<string>(CONTEXT_ASKS[0].text);
143
+ const [picked, setPicked] = useState<string>(CONTEXT_ASKS[0].id);
144
+ const [busy, setBusy] = useState(false);
145
+ const [error, setError] = useState<string | null>(null);
146
+ const send = () => {
147
+ if (!words.trim() || busy) return;
148
+ setBusy(true); setError(null);
149
+ // The words stay unless the ask is recorded.
150
+ onAsk(words.trim()).catch(e => setError(errorText(e))).finally(() => setBusy(false));
151
+ };
152
+ return <View {...({ dataSet: { catchUpMore: "1" } } as object)} style={{ gap: 10 }}>
153
+ <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
154
+ <Icon name="Sparkles" size={14} color={c.foreground} />
155
+ <Text style={[t.label, { flex: 1, fontWeight: "600" }]}>More context</Text>
156
+ <IconButton theme={theme} compact={compact} icon="X" label="Close more context" onPress={onClose} />
157
+ </View>
158
+ <View accessibilityRole="radiogroup" style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
159
+ {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); }}
160
+ 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" }}>
161
+ <Text style={[t.meta, { color: picked === x.id ? c.foreground : c.foregroundMuted }]}>{x.label}</Text>
162
+ </Pressable>)}
163
+ </View>
164
+ <View {...PRIMARY_FORM} style={{ gap: 10 }}>
165
+ <TextInput accessibilityLabel="What do you want to know?" placeholder="What do you want to know?" placeholderTextColor={c.foregroundMuted} value={words} multiline
166
+ onChangeText={v => { setWords(v); setPicked(CONTEXT_ASKS.find(x => x.text === v)?.id ?? ""); }}
167
+ style={{ minHeight: compact ? 84 : 76, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, backgroundColor: c.surface0 }} />
168
+ {!!error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{error}</Text>}
169
+ <View {...({ dataSet: { askAgent: "1" } } as object)} style={{ flexDirection: "row" }}>
170
+ <Button theme={theme} compact={compact} grow={compact} kind="primary" icon="MessageSquareText" title="Ask the agent" loading={busy} disabled={!words.trim() || busy}
171
+ 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} />
172
+ </View>
173
+ </View>
174
+ <Text style={t.small}>{footnote}</Text>
175
+ </View>;
176
+ }
177
+
@@ -7,10 +7,10 @@ import { Pressable, Text, copyable } from "./text";
7
7
  import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
8
8
  import { Icon, Modal, ScrollView, TextInput, copyText, useToast } from "@getpaseo/plugin/client/ui";
9
9
  import { useMutation, useQueryClient } from "@tanstack/react-query";
10
- import { answerQuestionRpc } from "../shared/contracts";
10
+ import { answerQuestionRpc, dismissQuestionRpc } from "../shared/contracts";
11
11
  import type { Workspace } from "../shared/model";
12
12
  import type { ListQuestion, ListWorkspace } from "../shared/list";
13
- import { OTHER, OTHER_LABEL, answerDraft, answerHeading, answerLabel, answerStatus, answerMessage, answerHasActions, resendTitle, isOpen, isOther, questionState, type Question } from "../shared/questions";
13
+ import { OTHER, OTHER_LABEL, closedLine, isDismissed, answerDraft, answerHeading, answerLabel, answerStatus, answerMessage, answerHasActions, resendTitle, isOpen, isOther, questionState, type Question } from "../shared/questions";
14
14
  import { ago } from "../shared/attention";
15
15
  import { RETRYING_DETAIL, deliveryStatus } from "../shared/queue";
16
16
  import { mootNote, sentence } from "../shared/errors";
@@ -19,12 +19,14 @@ import { Button, Card, CardRow, Chip, FoldRow, IconButton, SubmitScope, errorTex
19
19
  import { Spinner } from "./motion";
20
20
  import { DictationField, useCaret, type FieldPad } from "./dictation";
21
21
  import { NoteLink } from "./brief";
22
+ import { QuestionMoreContext } from "./more-context";
22
23
  import { PRIMARY_FORM } from "./dock";
23
24
  import { mergedColor, tint, withAlpha, type Colors } from "./theme";
24
25
  import { overviewKey, workspaceKey } from "./keys";
25
26
  import { PrLinksProvider, RichText } from "./rich-text";
26
27
  import { prLinksByNumber } from "../shared/presentation";
27
28
  import { notice, openQuestion, runAction } from "./toasts";
29
+ import { hasToastHost, pushToast } from "./toast-store";
28
30
  import { putInChatOrCopy } from "../shared/put-in-chat";
29
31
  import { useChatComposer } from "./put-in-chat";
30
32
  import { Marked, NoMatchRow, useSectionSearch } from "./section-search";
@@ -32,6 +34,8 @@ import { activityFields, questionFields, questionStatus } from "../shared/sectio
32
34
  import type { Activity } from "../shared/activity";
33
35
  import { clearPendingAnswer, failPendingAnswer, pendingKey, setPendingAnswer, usePendingAnswer, usePendingAnswers, type PendingAnswer } from "./pending-answers";
34
36
 
37
+ /** As long as sign-off's Undo (6 s): the toast holds while the pointer or focus is on it. */
38
+ const DISMISS_UNDO_MS = 6_000;
35
39
  const who = (w: Pick<ListWorkspace, "mainAgentId">, agentId: string | null) => !agentId || agentId === w.mainAgentId ? "the main agent" : "a root session";
36
40
 
37
41
  /**
@@ -102,7 +106,7 @@ export type SendReady = { send: () => void; busy: boolean };
102
106
  * (the dialog, Needs you on Home and in the panel, the pill, phones): what its field means comes from answerDraft
103
107
  * (`one-answer-flow-for-every-question`), never from the surface.
104
108
  */
105
- export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false, onSendReady, dictate = false }: {
109
+ export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false, onSendReady, dictate = false, moreContext = true }: {
106
110
  workspace: ListWorkspace; question: ListQuestion; theme: Theme; compact: boolean; now?: number; dense?: boolean; bodyMaxHeight?: number; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: () => void;
107
111
  /** Inside the Needs you block: its header says the title and when it was asked, its footer what the agent does meanwhile. */
108
112
  inline?: boolean;
@@ -115,6 +119,11 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
115
119
  onSendReady?: (send: SendReady | null) => void;
116
120
  /** Catch up: a mic beside the field (DictationField), when the host has Paseo's dictation. */
117
121
  dictate?: boolean;
122
+ /**
123
+ * More context on the question (more-context-is-the-same-on-every-surface). Catch up passes false: its move bar has
124
+ * the same More context, and its card shows the answer.
125
+ */
126
+ moreContext?: boolean;
118
127
  }) {
119
128
  const c = theme.colors; const t = text(c);
120
129
  const toast = useToast(); const cache = useQueryClient();
@@ -203,6 +212,25 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
203
212
  });
204
213
  onClose?.(); onAnswered?.();
205
214
  };
215
+ /**
216
+ * Dismiss (dismissing-a-question-sends-the-agent-nothing): the question no longer matters. It closes and leaves Needs
217
+ * you; nothing goes to the agent. Undo in the toast reopens it. The card moves on as after an answer.
218
+ */
219
+ const dismissRpc = useRpc(dismissQuestionRpc);
220
+ const undoDismiss = () => void runAction({ label: `Undo dismiss ${q.id}`, toast, run: () => dismissRpc({ workspaceId: w.id, questionId: q.id, undo: true }),
221
+ success: () => `${q.id} is open again`, onSuccess: refresh, failure: `Couldn't reopen ${q.id}` }, `dismiss:${w.id}:${q.id}`);
222
+ const dismiss = () => {
223
+ onClose?.(); onAnswered?.();
224
+ void runAction({ label: `Dismiss ${q.id}`, toast, run: () => dismissRpc({ workspaceId: w.id, questionId: q.id }), onSuccess: refresh, failure: `Couldn't dismiss ${q.id}`,
225
+ reconcile: e => { refresh(); notice(mootNote(e), toast); },
226
+ success: () => {
227
+ const message = `Dismissed ${q.id}. The agent wasn't messaged.`;
228
+ if (!hasToastHost()) return message;
229
+ pushToast("success", message, [{ label: "Undo", onPress: undoDismiss }], { durationMs: DISMISS_UNDO_MS, keep: true });
230
+ return null;
231
+ } }, `dismiss:${w.id}:${q.id}`);
232
+ };
233
+ const dismissLink = <NoteLink icon="X" label="Dismiss" a11y={`Dismiss ${q.id}: it no longer matters, and the agent isn't messaged`} disabled={run.isPending} c={c} compact={compact} onPress={dismiss} />;
206
234
  // The footer's Send calls the latest quick through a ref, so it never sends a stale choice or words.
207
235
  const quickRef = useRef(quick); quickRef.current = quick;
208
236
  const sendable = open && !!answer;
@@ -263,10 +291,15 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
263
291
  </View>}
264
292
  </View>
265
293
  {q.closed && <View style={{ flexDirection: "row", gap: 6 }}>
266
- <View style={{ paddingTop: 2 }}><Icon name="MessageCircleOff" size={12} color={c.foregroundMuted} /></View>
267
- <Text style={[t.meta, { flex: 1 }]}>Withdrawn {ago(q.closed.at, now)}: {q.closed.reason}</Text>
294
+ <View style={{ paddingTop: 2 }}><Icon name={isDismissed(q) ? "X" : "MessageCircleOff"} size={12} color={c.foregroundMuted} /></View>
295
+ <Text style={[t.meta, { flex: 1 }]}>{isDismissed(q) ? `${closedLine(q)} ${ago(q.closed.at, now)}. The agent wasn't messaged.` : `Withdrawn ${ago(q.closed.at, now)}: ${q.closed.reason}`}</Text>
268
296
  </View>}
269
297
  {context}
298
+ {/* Read before choosing: More context sits under the question's own context, its answer with it. */}
299
+ {/* The question's quiet row: More context first, then Dismiss (Catch up's move bar has its own More context). */}
300
+ {open && (moreContext
301
+ ? <QuestionMoreContext workspace={w} question={q} theme={theme} compact={compact} openAgent={openAgent}>{dismissLink}</QuestionMoreContext>
302
+ : <View style={{ flexDirection: "row" }}>{dismissLink}</View>)}
270
303
  {!!q.options.length && <View accessibilityRole="radiogroup" accessibilityLabel={`Options for ${q.id}`} style={{ gap: 6 }}>
271
304
  {q.options.map(o => <OptionCard key={o.letter} theme={theme} compact={compact} dense={dense} letter={o.letter} label={o.label} consequence={o.consequence} recommended={q.recommend === o.letter}
272
305
  selected={(open ? choice : q.answer?.choice) === o.letter} disabled={!open || run.isPending} onPress={() => setChoice(o.letter)} />)}
package/index.client.tsx CHANGED
@@ -10,6 +10,7 @@ import { MODE } from "./shared/catch-up";
10
10
  import { FollowPanel } from "./client/panel";
11
11
  import { createPaseoWorkspaces } from "./client/home-data";
12
12
  import { createHomeExtras } from "./client/home-view";
13
+ import { setContextSource } from "./client/more-context";
13
14
  import { contributeChat } from "./client/chat";
14
15
  import { contributeCreated } from "./client/created";
15
16
  import { hasFeeds } from "./client/feeds";
@@ -78,6 +79,8 @@ export default function contribute(host: PluginClientContext) {
78
79
  };
79
80
  const paseoWorkspaces = createPaseoWorkspaces(client, { onAdd: register, onRemove: id => { headers.get(id)?.remove(); headers.delete(id); } });
80
81
  const extras = createHomeExtras(client);
82
+ // One store of More context asks for every question surface (client/more-context.tsx).
83
+ setContextSource(extras);
81
84
  const searchKey = createSearchKey();
82
85
  const sources = { inbox, live: store, paseo: paseoWorkspaces, extras };
83
86
  const offActivity = extras.onActivity(() => { inbox.nudge(); store.nudge(); });
@@ -164,6 +167,7 @@ export default function contribute(host: PluginClientContext) {
164
167
  for (const r of removers) void r();
165
168
  for (const button of headers.values()) button.remove();
166
169
  await paseoWorkspaces.stop();
170
+ setContextSource(null);
167
171
  await extras.stop();
168
172
  };
169
173
  }
package/index.server.ts CHANGED
@@ -15,7 +15,7 @@ import type { PluginServerContext, PluginHandlerContext, PluginHookContext, Plug
15
15
  import type { PluginRpcContract, PluginSubscriptionContract } from "@getpaseo/plugin";
16
16
  import { ValueFeed, WorkspacesFeed } from "./server/feeds";
17
17
  import { ContextRequests, contextRecipient } from "./server/context-requests";
18
- import { agentContextPrompt, deckCards } from "./shared/catch-up";
18
+ import { agentContextPrompt, contextFor, deckCards } from "./shared/catch-up";
19
19
  import { buildHome } from "./shared/home";
20
20
  import { needsYou } from "./shared/attention";
21
21
  import type { SortMode } from "./shared/sort";
@@ -805,6 +805,7 @@ export default function contribute(server: PluginServerContext) {
805
805
  return w;
806
806
  });
807
807
  });
808
+ handle(rpc.dismissQuestionRpc, async ({ workspaceId, questionId, undo }, context) => { await requireReady(); return engine.dismiss(workspaceId, questionId, !!undo, actorOf(context)); });
808
809
  handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }, context) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action, actorOf(context)); });
809
810
  handle(rpc.declareDoneRpc, async ({ agentId, summary }, { paseo }) => { await requireReady(); return engine.declareDone(agentId, summary, await callerWorkspaceId(agentId, paseo, false)); });
810
811
  handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result, humanOnly }, { paseo }) => {
@@ -979,7 +980,7 @@ export default function contribute(server: PluginServerContext) {
979
980
  const model = buildHome({ rows: list.rows, tracked, paseo: paseoList, now: Date.now(), sort: (settings as { home_sort?: SortMode }).home_sort, priorities });
980
981
  const cards = deckCards({ model, rows: list.rows, items: id => { const w = byId.get(id); return w ? needsYou(w) : []; } });
981
982
  return { cards: cards.map(c => {
982
- const r = [...context].reverse().find(x => x.cardKey === c.key);
983
+ const r = contextFor(context, { workspaceId: c.s.workspaceId, cardKey: c.key });
983
984
  return { key: c.key, kind: c.kind, workspaceId: c.s.workspaceId, agentId: c.s.agentId, title: c.s.title, line: c.s.line, questionId: c.questionId ?? null,
984
985
  item: c.item && "title" in c.item ? String((c.item as { title?: unknown }).title ?? "") || null : null, context: r ? { id: r.id, state: r.state, target: r.target } : null };
985
986
  }) };
@@ -1408,7 +1409,7 @@ export default function contribute(server: PluginServerContext) {
1408
1409
  const turn = inbox.currentTurn(agentId);
1409
1410
  const previous = await readFile(needsYouPath(agentId), "utf8").then(t => JSON.parse(t) as NeedsYouRecord).catch(() => null);
1410
1411
  const sameTurn = !!previous && (turn?.turnId ? previous.turnId === turn.turnId : !!turn && previous.at >= turn.at);
1411
- let questionIds: string[] = []; let createdIds: string[] = [];
1412
+ let questionIds: string[] = []; let createdIds: string[] = []; let dismissed: string[] = [];
1412
1413
  if (tracked) {
1413
1414
  const mode = await questionMode();
1414
1415
  const linked = await store.mutate(state => {
@@ -1417,7 +1418,7 @@ export default function contribute(server: PluginServerContext) {
1417
1418
  if (result.questionIds.length || sameTurn) changed(w);
1418
1419
  return { ...result, ask: foldedAsk(call.ask, result.questionIds, w.questions) };
1419
1420
  });
1420
- questionIds = linked.questionIds; createdIds = linked.createdIds;
1421
+ questionIds = linked.questionIds; createdIds = linked.createdIds; dismissed = linked.dismissed;
1421
1422
  // one-ask-one-title: a brief that folds into its question is named by the question everywhere.
1422
1423
  call = { ...call, ask: linked.ask };
1423
1424
  // The brief maps decisions to questions by position, so the record keeps them aligned (a linked question shows as itself).
@@ -1430,7 +1431,8 @@ export default function contribute(server: PluginServerContext) {
1430
1431
  const temporary = `${needsYouPath(agentId)}.${randomUUID()}`;
1431
1432
  await writeFile(temporary, JSON.stringify(record), { mode: 0o600 });
1432
1433
  await rename(temporary, needsYouPath(agentId));
1433
- return { ok: true as const, briefId: `brief:${turn?.turnId ?? record.at}` };
1434
+ return { ok: true as const, briefId: `brief:${turn?.turnId ?? record.at}`,
1435
+ ...(dismissed.length ? { note: `The developer dismissed ${dismissed.join(", ")}: ${dismissed.length === 1 ? "it no longer matters, so it was" : "they no longer matter, so they were"} left off the card. Don't raise ${dismissed.length === 1 ? "it" : "them"} again.` } : {}) };
1434
1436
  });
1435
1437
  // Replies once the answer is recorded; the send runs after (Inbox.briefAction), so a dormant agent's slow resume never
1436
1438
  // times the card out.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.3.0-beta.0",
4
+ "version": "2.3.0-beta.1",
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": [
@@ -47,7 +47,7 @@ export function rowPrs(state: State, r: InboxRow, now: number): PrLink[] {
47
47
  return [...out.values()];
48
48
  }
49
49
 
50
- export const AGENT_TOOLS = ["make_main_agent", "list_prs", "add_reviewers", "merge", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "track", "inbox_list", "sign_off", "snooze", "snooze_workspace", "set_finish_flags", "set_priorities", "workspace_about", "agent_settings", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "priorities", "rank_status", "rerank_priorities", "usage", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "run_recovery", "refresh", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "link_items", "set_linked_items", "updates_status", "check_updates", "set_updates", "install_update", "display_settings", "set_display", "retry_move", "report_issue", "report_send", "ai_rename", "catch_up_deck", "context_requests", "ask_context"] as const;
50
+ export const AGENT_TOOLS = ["make_main_agent", "list_prs", "add_reviewers", "merge", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "track", "inbox_list", "sign_off", "snooze", "snooze_workspace", "set_finish_flags", "set_priorities", "workspace_about", "agent_settings", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "priorities", "rank_status", "rerank_priorities", "usage", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "dismiss_question", "run_recovery", "refresh", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "link_items", "set_linked_items", "updates_status", "check_updates", "set_updates", "install_update", "display_settings", "set_display", "retry_move", "report_issue", "report_send", "ai_rename", "catch_up_deck", "context_requests", "ask_context"] as const;
51
51
  export type AgentTool = typeof AGENT_TOOLS[number];
52
52
  /** Tools that only read. */
53
53
  export const READ_ONLY_TOOLS: readonly AgentTool[] = ["list_prs", "inbox_list", "workspace_about", "agent_settings", "display_settings", ...RPC_TOOLS.filter(t => t.kind === "read").map(t => t.name as AgentTool)];
@@ -13,7 +13,7 @@ const directory = dirname(fileURLToPath(import.meta.url));
13
13
  /** 1.4.0-beta.2: launched with Follow-up's tools served by Paseo's MCP (follow_<name>), or the follow-up bridge (<name>). Agents opened before the upgrade carry no flag and keep the bridge names. */
14
14
  let native = env("TOOLS") === "native";
15
15
  // Tool names that read unambiguously in prose; kept identical to server/mcp.mjs's underscore names (a test checks it).
16
- export const TOOL_NAMES = ["workspace_status", "sync_workspace", "enroll_workspace", "register_pr", "exclude_stack", "update_obligation", "acknowledge_batch", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "link_items", "set_linked_items", "workspace_about", "agent_settings", "needs_you", "declare_done", "list_prs", "add_reviewers", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "inbox_list", "sign_off", "snooze_workspace", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace", "display_settings", "set_display", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "rank_status", "rerank_priorities", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "run_recovery", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status", "check_updates", "set_updates", "install_update", "make_main_agent", "retry_move", "report_issue", "report_send", "ai_rename", "catch_up_deck", "context_requests", "ask_context", "context_reply"];
16
+ export const TOOL_NAMES = ["workspace_status", "sync_workspace", "enroll_workspace", "register_pr", "exclude_stack", "update_obligation", "acknowledge_batch", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "link_items", "set_linked_items", "workspace_about", "agent_settings", "needs_you", "declare_done", "list_prs", "add_reviewers", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "inbox_list", "sign_off", "snooze_workspace", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace", "display_settings", "set_display", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "rank_status", "rerank_priorities", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "dismiss_question", "run_recovery", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status", "check_updates", "set_updates", "install_update", "make_main_agent", "retry_move", "report_issue", "report_send", "ai_rename", "catch_up_deck", "context_requests", "ask_context", "context_reply"];
17
17
  const toolPattern = new RegExp(`(?<![\\w])(${TOOL_NAMES.join("|")})(?![\\w])`, "g");
18
18
  /** Names Follow-up's tools the way this agent has them. */
19
19
  export function named(text, isNative = native) { return isNative ? text.replace(toolPattern, "follow_$1") : text; }
@@ -95,6 +95,9 @@ export const RPC_TOOLS: readonly RpcTool[] = [
95
95
  { name: "answer_question", rpc: "follow.answer-question", kind: "planned",
96
96
  input: z.strictObject({ workspaceId: id.optional(), questionId: z.string().regex(/^Q\d+$/).optional(), choice: z.string().trim().min(1).max(200).optional(), words: z.string().trim().max(2000).optional(), ...confirm }),
97
97
  toRpc: a => ({ workspaceId: a.workspaceId, questionId: a.questionId, choice: a.choice, words: a.words, action: "send" }) },
98
+ { name: "dismiss_question", rpc: "follow.dismiss-question", kind: "planned",
99
+ input: z.strictObject({ workspaceId: id.optional(), questionId: z.string().regex(/^Q\d+$/).optional(), undo: z.boolean().optional(), ...confirm }),
100
+ toRpc: a => ({ workspaceId: a.workspaceId, questionId: a.questionId, ...(a.undo ? { undo: true } : {}) }) },
98
101
  // Workspace panel: recovery, refresh, the spec link, task triggers
99
102
  { name: "run_recovery", rpc: "follow.recover", kind: "planned", input: z.strictObject({ workspaceId: id.optional(), ...confirm }) },
100
103
  { name: "refresh", rpc: "follow.refresh", kind: "write", input: z.strictObject({ workspaceId: id.optional() }) },
@@ -186,6 +189,7 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
186
189
  "follow.queue-action": { tools: ["queue_action"] },
187
190
  "follow.inbox-act": { tools: ["sign_off", "snooze", "set_finish_flags", "inbox_act"] },
188
191
  "follow.brief-action": { tools: ["brief_action"] },
192
+ "follow.dismiss-question": { tools: ["dismiss_question"], note: "The server refuses an agent's own question (withdraw_question is the asker's way); undo: true is the card's Undo." },
189
193
  "follow.answer-question": { tools: ["answer_question"], note: "The tool sends (action send). Copy and Put in chat (action copy, chat) only move the developer's own words into their clipboard or their composer for them to send; an agent answers by sending, so it has no Put in chat." },
190
194
  "follow.workspace-about": { tools: ["workspace_about"] },
191
195
  "follow.rename-status": { tools: ["ai_rename"], note: "The dry run shows the name now and the suggestion." },
@@ -217,6 +221,6 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
217
221
  * note says where an agent finds what the developer found.
218
222
  */
219
223
  export const VIEW_PARITY: Record<string, { tools: readonly string[]; note: string }> = {
220
- "catch-up": { tools: ["catch_up_deck", "answer_question", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Skip workspace, Back, the phone's drag) changes only the developer's view, so it has no server state and no tool. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
224
+ "catch-up": { tools: ["catch_up_deck", "answer_question", "dismiss_question", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Skip workspace, Back, the phone's drag) changes only the developer's view, so it has no server state and no tool. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
221
225
  "section-search": { tools: ["workspace_status", "list_prs"], note: "The panel's Pull requests, Tasks and Activity search filters lists an agent already reads whole: workspace_status returns the workspace's PRs (title, branch, failed checks), tasks with their evidence, questions with their answers, and the sends, merges and PR actions the timeline is drawn from; list_prs returns every tracked PR with its checks." },
222
226
  };
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { WriteBehind } from "./write-behind";
5
- import { CONTEXT_ANSWER_MAX, contextFileSchema, plainAnswer, pruneContext, type ContextFile, type ContextRequest, type ContextTarget } from "../shared/catch-up";
5
+ import { CONTEXT_ANSWER_MAX, contextFileSchema, plainAnswer, pruneContext, sameCard, type ContextFile, type ContextRequest, type ContextTarget } from "../shared/catch-up";
6
6
 
7
7
  export const CONTEXT_FILE = "context.json";
8
8
 
@@ -63,10 +63,13 @@ export class ContextRequests {
63
63
  return filter.workspaceId ? live.filter(r => r.workspaceId === filter.workspaceId) : live;
64
64
  }
65
65
 
66
- /** Records an ask. One open ask per card: asking again while it's open returns that one (`fresh: false`). */
66
+ /**
67
+ * Records an ask. One open ask per card, from whichever surface (`sameCard`: Catch up's key or the question's own):
68
+ * asking again while it's open returns that one (`fresh: false`).
69
+ */
67
70
  async ask(input: AskInput, by: string, askedOf: string | null): Promise<{ request: ContextRequest; fresh: boolean }> {
68
71
  const { requests } = await this.load();
69
- const open = requests.find(r => r.cardKey === input.cardKey && r.state === "asking");
72
+ const open = requests.find(r => r.state === "asking" && sameCard(r, input));
70
73
  if (open) return { request: open, fresh: false };
71
74
  const request: ContextRequest = {
72
75
  id: `ctx-${randomUUID()}`, ...input, askedOf, state: "asking", answer: null, error: null,
package/server/engine.ts CHANGED
@@ -7,7 +7,7 @@ import { completionBlockers, completionCheck, completionGate, revokesDone, type
7
7
  import { Store } from "./store";
8
8
  import { Github } from "./github";
9
9
  import { batchPrompt, messageText, tasksFor, isRecovery, needsPrObservations, type TaskWording } from "./tasks";
10
- import { answerRecipients, developerAnswer, syncTaskQuestions, type AnswerAction } from "./questions";
10
+ import { answerRecipients, developerAnswer, dismissQuestion, undoDismiss, syncTaskQuestions, type AnswerAction } from "./questions";
11
11
  import { answerMessage, isOpen as isOpenQuestion, type Question } from "../shared/questions";
12
12
  import { reconcileSubmittedStacks } from "./submissions";
13
13
  import { applyDiscovery, interruptionHold, startsWithAutoSend, type DiscoveredWorkspace } from "./discovery";
@@ -418,6 +418,18 @@ export class Engine {
418
418
  const workspace = findWorkspace(await this.store.snapshot(), workspaceId);
419
419
  return { workspace, question: workspace.questions.find(q => q.id === questionId)! };
420
420
  }
421
+ /**
422
+ * The developer dismisses a question (or an agent for them), or undoes that. Only the record changes: nothing is
423
+ * queued or sent, so the agent spends no turn on it (dismissing-a-question-sends-the-agent-nothing).
424
+ */
425
+ async dismiss(workspaceId: string, questionId: string, undo: boolean, actor: Actor = DEVELOPER): Promise<{ workspace: Workspace; question: Question }> {
426
+ await this.store.mutateWorkspace(workspaceId, w => {
427
+ if (undo) undoDismiss(w, questionId); else dismissQuestion(w, questionId, actor, this.now());
428
+ w.updatedAt = new Date(this.now()).toISOString();
429
+ });
430
+ const workspace = findWorkspace(await this.store.snapshot(), workspaceId);
431
+ return { workspace, question: workspace.questions.find(q => q.id === questionId)! };
432
+ }
421
433
  /** The queue that carries answers; the worker attaches it (tests may leave it off: answers are then only recorded). */
422
434
  private queue: MessageQueue | null = null;
423
435
  attachQueue(queue: MessageQueue): void {
@@ -15,7 +15,7 @@ export const hookSource: string = [
15
15
  "/** 1.4.0-beta.2: launched with Follow-up's tools served by Paseo's MCP (follow_<name>), or the follow-up bridge (<name>). Agents opened before the upgrade carry no flag and keep the bridge names. */",
16
16
  "let native = env(\"TOOLS\") === \"native\";",
17
17
  "// Tool names that read unambiguously in prose; kept identical to server/mcp.mjs's underscore names (a test checks it).",
18
- "export const TOOL_NAMES = [\"workspace_status\", \"sync_workspace\", \"enroll_workspace\", \"register_pr\", \"exclude_stack\", \"update_obligation\", \"acknowledge_batch\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"link_items\", \"set_linked_items\", \"workspace_about\", \"agent_settings\", \"needs_you\", \"declare_done\", \"list_prs\", \"add_reviewers\", \"enable_merge_when_ready\", \"disable_merge_when_ready\", \"send_repairs\", \"set_auto_send\", \"clear_hold\", \"retry_batch\", \"inbox_list\", \"sign_off\", \"snooze_workspace\", \"set_finish_flags\", \"set_priorities\", \"agent_digest\", \"route_candidates\", \"send_to_agent\", \"start_workspace\", \"display_settings\", \"set_display\", \"follow_settings\", \"set_follow_settings\", \"project_settings\", \"set_project_tracking\", \"pr_workflow\", \"set_pr_workflow\", \"reviewer_settings\", \"reviewer_suggestions\", \"save_reviewers\", \"set_agent_setting\", \"set_wait_for_jobs\", \"onboarding_status\", \"onboarding_checks\", \"set_onboarding\", \"rank_status\", \"rerank_priorities\", \"overseer_status\", \"overseer_start\", \"overseer_restart\", \"overseer_ask\", \"inbox_brief\", \"brief_action\", \"queue_list\", \"queue_action\", \"inbox_act\", \"answer_question\", \"run_recovery\", \"set_workspace_spec\", \"set_task_trigger\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\", \"check_updates\", \"set_updates\", \"install_update\", \"make_main_agent\", \"retry_move\", \"report_issue\", \"report_send\", \"ai_rename\", \"catch_up_deck\", \"context_requests\", \"ask_context\", \"context_reply\"];",
18
+ "export const TOOL_NAMES = [\"workspace_status\", \"sync_workspace\", \"enroll_workspace\", \"register_pr\", \"exclude_stack\", \"update_obligation\", \"acknowledge_batch\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"link_items\", \"set_linked_items\", \"workspace_about\", \"agent_settings\", \"needs_you\", \"declare_done\", \"list_prs\", \"add_reviewers\", \"enable_merge_when_ready\", \"disable_merge_when_ready\", \"send_repairs\", \"set_auto_send\", \"clear_hold\", \"retry_batch\", \"inbox_list\", \"sign_off\", \"snooze_workspace\", \"set_finish_flags\", \"set_priorities\", \"agent_digest\", \"route_candidates\", \"send_to_agent\", \"start_workspace\", \"display_settings\", \"set_display\", \"follow_settings\", \"set_follow_settings\", \"project_settings\", \"set_project_tracking\", \"pr_workflow\", \"set_pr_workflow\", \"reviewer_settings\", \"reviewer_suggestions\", \"save_reviewers\", \"set_agent_setting\", \"set_wait_for_jobs\", \"onboarding_status\", \"onboarding_checks\", \"set_onboarding\", \"rank_status\", \"rerank_priorities\", \"overseer_status\", \"overseer_start\", \"overseer_restart\", \"overseer_ask\", \"inbox_brief\", \"brief_action\", \"queue_list\", \"queue_action\", \"inbox_act\", \"answer_question\", \"dismiss_question\", \"run_recovery\", \"set_workspace_spec\", \"set_task_trigger\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\", \"check_updates\", \"set_updates\", \"install_update\", \"make_main_agent\", \"retry_move\", \"report_issue\", \"report_send\", \"ai_rename\", \"catch_up_deck\", \"context_requests\", \"ask_context\", \"context_reply\"];",
19
19
  "const toolPattern = new RegExp(`(?<![\\\\w])(${TOOL_NAMES.join(\"|\")})(?![\\\\w])`, \"g\");",
20
20
  "/** Names Follow-up's tools the way this agent has them. */",
21
21
  "export function named(text, isNative = native) { return isNative ? text.replace(toolPattern, \"follow_$1\") : text; }",
@@ -101,6 +101,7 @@ export const mcpSource: string = [
101
101
  " [\"inbox_brief\", \"Read another agent's full Needs-you brief (decisions, options, links): { agentId }.\" + read, \"follow.agent-act\", { agentId: string }, [\"agentId\"]],",
102
102
  " [\"brief_action\", \"Answer another agent's brief for the developer, like its card: { agentId, briefId, decisionId + choice, or choices [{ decisionId, choice }], or move: retry (a failed turn) or done (an Action brief: sends \\\"Done: <ask>\\\" as the developer) }. choice \\\"other\\\" is Something else and needs words (top-level, or on its entry in choices); words with a letter is the developer's note, sent with it. Never your own brief.\" + ask, \"follow.agent-act\", { agentId: string, briefId: string, decisionId: string, choice: string, words: string, move: string, choices: { type: \"array\", items: { type: \"object\" } }, ...planned }, []],",
103
103
  " [\"inbox_act\", \"The inbox's other actions on other agents' rows: action undo|mute_turn|unsorted_flag|unsorted_sign_off|batch_undo, agentIds.\" + ask, \"follow.agent-act\", { action: string, agentIds: array, muteTurn: boolean, ...planned }, []],",
104
+ " [\"dismiss_question\", \"Dismiss another agent's question (Q1…) that no longer matters, for the developer, like its card's Dismiss: { workspaceId, questionId }. Sends that agent nothing. undo: true reopens it. For a question you asked, use withdraw_question.\" + ask, \"follow.agent-act\", { workspaceId: string, questionId: string, undo: boolean, ...planned }, []],",
104
105
  " [\"answer_question\", \"Send the developer's answer to another agent's question (Q1…), like its card: { workspaceId, questionId, choice, words }. choice is an option letter, or \\\"other\\\" (Something else) with the developer's answer as words. For a question you asked, use record_answer.\" + ask, \"follow.agent-act\", { workspaceId: string, questionId: string, choice: string, words: string, ...planned }, []],",
105
106
  " [\"run_recovery\", \"Run recovery on a workspace, like Run recovery: a separate agent reads its history for missed PRs and tasks. { workspaceId }.\" + ask, \"follow.agent-act\", { workspaceId: string, ...planned }, []],",
106
107
  " [\"refresh\", \"Refresh PR status now, like Refresh. Cheap; use when status looks stale.\", \"follow.agent-act\", { workspaceId: string }, []],",
@@ -262,6 +263,8 @@ export const mcpSource: string = [
262
263
  " prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads.length, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),",
263
264
  " obligations: w.obligations.filter(o => ![\"done\", \"waived\"].includes(o.status)), completedObligations: w.obligations.filter(o => [\"done\", \"waived\"].includes(o.status)).length,",
264
265
  " openQuestions: (w.questions ?? []).filter(q => !q.answer && !q.closed).map(q => ({ id: q.id, title: q.title, question: q.question, options: q.options, recommend: q.recommend, big: q.big, mode: q.mode, askedBy: q.askedBy, taskId: q.taskId })),",
266
+ " // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.",
267
+ " dismissedQuestions: (w.questions ?? []).filter(q => !q.answer && q.closed?.dismissed).slice(-20).map(q => ({ id: q.id, title: q.title, at: q.closed.at, by: q.closed.by, taskId: q.taskId })),",
265
268
  " spec: w.spec?.url ? { url: w.spec.url, title: w.spec.title, source: w.spec.source } : null,",
266
269
  " recentAnswers: (w.questions ?? []).filter(q => q.answer).slice(-5).map(q => ({ id: q.id, title: q.title, choice: q.answer.choice, words: q.answer.words, delivery: q.answer.delivery.state })),",
267
270
  " batches: w.batches.filter(b => ![\"completed\", \"cancelled\"].includes(b.state)).map(b => ({ id: b.id, state: b.state, tasks: b.tasks, result: b.result, recipientAgentId: b.recipientAgentId, contextPath: b.contextPath })),",
package/server/mcp.mjs CHANGED
@@ -99,6 +99,7 @@ const actionTools = [
99
99
  ["inbox_brief", "Read another agent's full Needs-you brief (decisions, options, links): { agentId }." + read, "follow.agent-act", { agentId: string }, ["agentId"]],
100
100
  ["brief_action", "Answer another agent's brief for the developer, like its card: { agentId, briefId, decisionId + choice, or choices [{ decisionId, choice }], or move: retry (a failed turn) or done (an Action brief: sends \"Done: <ask>\" as the developer) }. choice \"other\" is Something else and needs words (top-level, or on its entry in choices); words with a letter is the developer's note, sent with it. Never your own brief." + ask, "follow.agent-act", { agentId: string, briefId: string, decisionId: string, choice: string, words: string, move: string, choices: { type: "array", items: { type: "object" } }, ...planned }, []],
101
101
  ["inbox_act", "The inbox's other actions on other agents' rows: action undo|mute_turn|unsorted_flag|unsorted_sign_off|batch_undo, agentIds." + ask, "follow.agent-act", { action: string, agentIds: array, muteTurn: boolean, ...planned }, []],
102
+ ["dismiss_question", "Dismiss another agent's question (Q1…) that no longer matters, for the developer, like its card's Dismiss: { workspaceId, questionId }. Sends that agent nothing. undo: true reopens it. For a question you asked, use withdraw_question." + ask, "follow.agent-act", { workspaceId: string, questionId: string, undo: boolean, ...planned }, []],
102
103
  ["answer_question", "Send the developer's answer to another agent's question (Q1…), like its card: { workspaceId, questionId, choice, words }. choice is an option letter, or \"other\" (Something else) with the developer's answer as words. For a question you asked, use record_answer." + ask, "follow.agent-act", { workspaceId: string, questionId: string, choice: string, words: string, ...planned }, []],
103
104
  ["run_recovery", "Run recovery on a workspace, like Run recovery: a separate agent reads its history for missed PRs and tasks. { workspaceId }." + ask, "follow.agent-act", { workspaceId: string, ...planned }, []],
104
105
  ["refresh", "Refresh PR status now, like Refresh. Cheap; use when status looks stale.", "follow.agent-act", { workspaceId: string }, []],
@@ -260,6 +261,8 @@ function currentWork(w) {
260
261
  prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads.length, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),
261
262
  obligations: w.obligations.filter(o => !["done", "waived"].includes(o.status)), completedObligations: w.obligations.filter(o => ["done", "waived"].includes(o.status)).length,
262
263
  openQuestions: (w.questions ?? []).filter(q => !q.answer && !q.closed).map(q => ({ id: q.id, title: q.title, question: q.question, options: q.options, recommend: q.recommend, big: q.big, mode: q.mode, askedBy: q.askedBy, taskId: q.taskId })),
264
+ // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.
265
+ dismissedQuestions: (w.questions ?? []).filter(q => !q.answer && q.closed?.dismissed).slice(-20).map(q => ({ id: q.id, title: q.title, at: q.closed.at, by: q.closed.by, taskId: q.taskId })),
263
266
  spec: w.spec?.url ? { url: w.spec.url, title: w.spec.title, source: w.spec.source } : null,
264
267
  recentAnswers: (w.questions ?? []).filter(q => q.answer).slice(-5).map(q => ({ id: q.id, title: q.title, choice: q.answer.choice, words: q.answer.words, delivery: q.answer.delivery.state })),
265
268
  batches: w.batches.filter(b => !["completed", "cancelled"].includes(b.state)).map(b => ({ id: b.id, state: b.state, tasks: b.tasks, result: b.result, recipientAgentId: b.recipientAgentId, contextPath: b.contextPath })),
@@ -1,8 +1,8 @@
1
- import { DEVELOPER, type Actor } from "../shared/actor";
1
+ import { DEVELOPER, actorBy, type Actor } from "../shared/actor";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { blockedOnDeveloper, type Workspace } from "../shared/model";
4
4
  import { followUpObligations } from "../shared/follow-up";
5
- import { OTHER, OTHER_LABEL, QUESTION_MODE_RULES, choiceError, findOpenMatch, isOpen, isOther, nextQuestionId, validChoice, type Question, type QuestionMode } from "../shared/questions";
5
+ import { DISMISS_REASON, OTHER, OTHER_LABEL, QUESTION_MODE_RULES, choiceError, findDismissedMatch, findOpenMatch, isDismissed, isOpen, isOther, nextQuestionId, validChoice, type Question, type QuestionMode } from "../shared/questions";
6
6
 
7
7
  /** "other" and its label both mean Something else, so an agent recording "Something else" lands on the same answer. */
8
8
  const normalChoice = (choice: string) => [OTHER, OTHER_LABEL.toLowerCase()].includes(choice.trim().toLowerCase()) ? OTHER : choice.trim();
@@ -24,8 +24,9 @@ function resolvePr(w: Workspace, ref: string): string {
24
24
  export type AskOutcome = {
25
25
  question: Question; instruction: string;
26
26
  /** asked: a new question. duplicate: the same question was already open, so it wasn't asked again. superseded: a
27
- * changed version of an open question; the old one closed as "Superseded by Qn". */
28
- outcome: "asked" | "duplicate" | "superseded";
27
+ * changed version of an open question; the old one closed as "Superseded by Qn". dismissed: the developer dismissed
28
+ * this question, so it wasn't asked again. */
29
+ outcome: "asked" | "duplicate" | "superseded" | "dismissed";
29
30
  /** The question that was already open (duplicate) or that this one replaced (superseded). */
30
31
  of: string | null;
31
32
  };
@@ -54,8 +55,12 @@ export function askQuestion(w: Workspace, agentId: string, input: AskInput, mode
54
55
  if (opts.supersedes) {
55
56
  replace = w.questions.find(q => q.id === opts.supersedes) ?? null;
56
57
  if (!replace) throw new Error(`No question ${opts.supersedes} in this workspace.`);
57
- if (!isOpen(replace)) throw new Error(`${replace.id} is already ${replace.answer ? "answered" : "closed"}; ask without supersedes.`);
58
+ // A dismissed question may be asked again on purpose, when something really changed: it stays dismissed.
59
+ if (!isOpen(replace) && !isDismissed(replace)) throw new Error(`${replace.id} is already ${replace.answer ? "answered" : "closed"}; ask without supersedes.`);
58
60
  } else {
61
+ // dismissing-a-question-sends-the-agent-nothing: what the developer dismissed doesn't come back as a new card.
62
+ const dismissed = findDismissedMatch(w.questions, shape, agentId);
63
+ if (dismissed && !findOpenMatch(w.questions, shape, agentId)) return { question: dismissed, outcome: "dismissed", of: dismissed.id, instruction: dismissedInstruction(dismissed) };
59
64
  const match = findOpenMatch(w.questions, shape, agentId);
60
65
  if (match?.verdict === "same") {
61
66
  const open = match.question;
@@ -72,7 +77,7 @@ export function askQuestion(w: Workspace, agentId: string, input: AskInput, mode
72
77
  askedBy: agentId, askedAt: new Date(now).toISOString(), mode, answer: null, closed: null, via: opts.via ?? "ask",
73
78
  };
74
79
  w.questions.push(question);
75
- if (replace) replace.closed = { at: question.askedAt, reason: `Superseded by ${question.id}.`, by: agentId };
80
+ if (replace && isOpen(replace)) replace.closed = { at: question.askedAt, reason: `Superseded by ${question.id}.`, by: agentId };
76
81
  const rule = QUESTION_MODE_RULES[mode].rule({ recommend, big: question.big });
77
82
  const instruction = [
78
83
  `Asked ${question.id}${replace ? ` (it replaces ${replace.id}, now closed as superseded)` : ""}. Question mode: ${QUESTION_MODE_RULES[mode].label}. ${rule}`,
@@ -106,6 +111,35 @@ export function withdrawQuestion(w: Workspace, agentId: string, id: string, reas
106
111
  return q;
107
112
  }
108
113
 
114
+ /** What an agent hears when it asks, or points at, a question the developer dismissed. */
115
+ export const dismissedInstruction = (q: Pick<Question, "id" | "title">) =>
116
+ `The developer dismissed ${q.id} (${q.title}): it no longer matters, so it isn't asked again and nothing was sent to you. Carry on without it and don't raise it again, at a turn's end either. If something really changed, ask again with supersedes="${q.id}".`;
117
+
118
+ /**
119
+ * The developer dismisses a question that no longer matters (dismissing-a-question-sends-the-agent-nothing). It closes
120
+ * as dismissed and leaves Needs you; nothing is queued or sent, so the agent spends no turn and no tokens on it. It
121
+ * learns only when it looks: workspace_status, or asking or pointing at it again. An agent may dismiss another agent's
122
+ * question for the developer (dismiss_question), never one it asked or owns: that is withdraw_question.
123
+ */
124
+ export function dismissQuestion(w: Workspace, id: string, actor: Actor, now: number): Question {
125
+ const q = w.questions.find(q => q.id === id);
126
+ if (!q) throw new Error(`No question ${id} in this workspace.`);
127
+ if (!isOpen(q)) throw new Error(`${id} is already ${q.answer ? "answered" : isDismissed(q) ? "dismissed" : "closed"}.`);
128
+ if (actor.kind === "agent" && (actor.agentId === q.askedBy || actor.agentId === w.mainAgentId))
129
+ throw new Error(`${id} is your own question: use withdraw_question with a reason. dismiss_question dismisses another agent's question for the developer.`);
130
+ q.closed = { at: new Date(now).toISOString(), reason: DISMISS_REASON, by: actorBy(actor), dismissed: true };
131
+ return q;
132
+ }
133
+
134
+ /** Undo: a dismissed question opens again as it was. Only a dismissal can be undone this way. */
135
+ export function undoDismiss(w: Workspace, id: string): Question {
136
+ const q = w.questions.find(q => q.id === id);
137
+ if (!q) throw new Error(`No question ${id} in this workspace.`);
138
+ if (!isDismissed(q)) throw new Error(`${id} isn't dismissed, so there is nothing to undo.`);
139
+ q.closed = null;
140
+ return q;
141
+ }
142
+
109
143
  /** Delivery states a Resend (Retry, Try now) applies to. */
110
144
  export const RESENDABLE: readonly string[] = ["queued", "retrying", "failed", "unconfirmed"];
111
145
  /** How the developer's answer leaves the card: sent by Follow-up, copied, or put in the agent's chat (Paseo 0.16), or sent again. */
@@ -115,6 +149,7 @@ export type AnswerAction = "send" | "copy" | "chat" | "resend";
115
149
  export function developerAnswer(w: Workspace, id: string, choice: string, words: string | undefined, action: AnswerAction, now: number, actor: Actor = DEVELOPER): Question {
116
150
  const q = w.questions.find(q => q.id === id);
117
151
  if (!q) throw new Error(`No question ${id} in this workspace.`);
152
+ if (isDismissed(q)) throw new Error(`${id} was dismissed, so nothing was sent.`);
118
153
  if (q.closed) throw new Error(`${id} was withdrawn: ${q.closed.reason}`);
119
154
  const at = new Date(now).toISOString();
120
155
  if (action === "resend") {
@@ -179,11 +214,12 @@ export function decisionOf(q: Question): NeedsYouDecision {
179
214
  * questions. A second call in the same turn replaces only the questions the first call created, never one it linked.
180
215
  */
181
216
  export function needsYouQuestions(w: Workspace, agentId: string, call: { decisions?: NeedsYouDecision[]; questions?: string[] }, mode: QuestionMode, now: number,
182
- previous: { createdIds?: string[]; questionIds?: string[] } | null): { questionIds: string[]; createdIds: string[]; decisions: NeedsYouDecision[] } {
183
- const questionIds: string[] = [], createdIds: string[] = [], decisions: NeedsYouDecision[] = [];
217
+ previous: { createdIds?: string[]; questionIds?: string[] } | null): { questionIds: string[]; createdIds: string[]; decisions: NeedsYouDecision[]; dismissed: string[] } {
218
+ const questionIds: string[] = [], createdIds: string[] = [], decisions: NeedsYouDecision[] = [], dismissed: string[] = [];
184
219
  for (const id of call.questions ?? []) {
185
220
  const q = w.questions.find(q => q.id === id);
186
221
  if (!q) throw new Error(`No question ${id} in this workspace.`);
222
+ if (isDismissed(q)) throw new Error(dismissedInstruction(q));
187
223
  if (!isOpen(q)) throw new Error(`${id} is already ${q.answer ? "answered" : "closed"}, so it isn't open any more. Leave it out.`);
188
224
  if (questionIds.includes(id)) continue;
189
225
  questionIds.push(id); decisions.push(decisionOf(q));
@@ -191,6 +227,8 @@ export function needsYouQuestions(w: Workspace, agentId: string, call: { decisio
191
227
  for (const d of call.decisions ?? []) {
192
228
  const options = (d.options ?? []).map((o, i) => ({ letter: String.fromCharCode(65 + i), label: o.label, ...(o.consequence ? { consequence: o.consequence } : {}) }));
193
229
  const r = askQuestion(w, agentId, { title: d.question.slice(0, 120), question: d.question, options, ...(d.options?.length ? { recommend: String.fromCharCode(65 + d.recommend!) } : {}) }, mode, now, { via: "needs_you" });
230
+ // A decision the developer dismissed doesn't come back on the card.
231
+ if (r.outcome === "dismissed") { dismissed.push(r.question.id); continue; }
194
232
  if (questionIds.includes(r.question.id)) continue;
195
233
  questionIds.push(r.question.id);
196
234
  decisions.push(r.outcome === "duplicate" ? decisionOf(r.question) : d);
@@ -202,5 +240,5 @@ export function needsYouQuestions(w: Workspace, agentId: string, call: { decisio
202
240
  const q = w.questions.find(q => q.id === id);
203
241
  if (q && isOpen(q) && !questionIds.includes(id) && q.via !== "ask") q.closed = { at: new Date(now).toISOString(), reason: "Replaced by a newer needs_you call.", by: agentId };
204
242
  }
205
- return { questionIds, createdIds, decisions };
243
+ return { questionIds, createdIds, decisions, dismissed };
206
244
  }
@@ -2,7 +2,7 @@ import type { ListWorkspace as Workspace } from "./list";
2
2
  import { recoveryBatch } from "./follow-up";
3
3
  import { shortRefs } from "./attention";
4
4
  import { isGithubFlow } from "./pr-actions";
5
- import { answerLabel, answerStatus } from "./questions";
5
+ import { answerLabel, answerStatus, closedLine } from "./questions";
6
6
 
7
7
  export type ActivityTone = "merged" | "success" | "warning" | "danger" | "muted";
8
8
  export type Activity = { key: string; at: string; icon: string; tone: ActivityTone; text: string; detail: string | null; took: string | null };
@@ -59,7 +59,7 @@ export function activity(w: Workspace): Activity[] {
59
59
  const said = !s.delivered ? s.label : q.answer.by === "agent" ? "Answered in chat" : "Answered";
60
60
  rows.push({ key: `answered:${q.id}`, at: q.answer.at, icon: "MessageCircleReply", tone: s.delivered ? "success" : "muted", text: ref, detail: `${said}: ${answerLabel(q, q.answer.choice, q.answer.words)}`, took: duration(q.askedAt, q.answer.at) });
61
61
  }
62
- if (q.closed) rows.push({ key: `withdrawn:${q.id}`, at: q.closed.at, icon: "MessageCircleOff", tone: "muted", text: ref, detail: `Withdrawn: ${q.closed.reason}`, took: null });
62
+ if (q.closed) rows.push({ key: `withdrawn:${q.id}`, at: q.closed.at, icon: "MessageCircleOff", tone: "muted", text: ref, detail: closedLine(q), took: null });
63
63
  }
64
64
  if (w.completion) rows.push({ key: "done", at: w.completion.declaredAt, icon: "CircleCheck", tone: "success", text: "Main agent declared Done", detail: null, took: null });
65
65
  return rows.filter(r => Number.isFinite(Date.parse(r.at))).sort((a, b) => Date.parse(b.at) - Date.parse(a.at) || a.key.localeCompare(b.key));
package/shared/brief.ts CHANGED
@@ -311,6 +311,7 @@ export const RESOLVED = {
311
311
  replaced: "Replaced by a newer card",
312
312
  movedOn: "No longer needed · the agent moved on",
313
313
  withdrawn: "The agent withdrew this question",
314
+ dismissed: "You dismissed this question",
314
315
  factEnded: "No longer needed · the PR moved on",
315
316
  } as const;
316
317
  const OWN_OUTCOMES: readonly string[] = Object.values(RESOLVED);
@@ -378,7 +379,7 @@ export type BriefEvent =
378
379
  /** A PR's new state: lands only on the open brief whose facts are about that PR. */
379
380
  | { type: "facts"; prKey: string; facts: BriefFact[] }
380
381
  /** Every question the brief points at is settled, by any path (briefQuestionsEvent): an answer, or null if withdrawn. */
381
- | { type: "questions"; answers: Record<string, { choice: string; words: string | null } | null> }
382
+ | { type: "questions"; answers: Record<string, { choice: string; words: string | null } | null>; /** Every unanswered one was dismissed by the developer. */ dismissed?: boolean }
382
383
  /** The PR facts a Follow-up card reported no longer hold (shared/inbox.ts FACT_REASONS): its card of these kinds closes. */
383
384
  | { type: "fact_ended"; kinds: BriefKind[] };
384
385
 
@@ -461,7 +462,7 @@ export function briefStep(prev: Brief | null, event: BriefEvent, now: string): {
461
462
  if (prev?.state !== "open" || !prev.questionIds.length || !prev.questionIds.every(id => id in event.answers)) return keep;
462
463
  const decisions = prev.decisions.map(d => { const a = event.answers[d.id]; return a && !d.chosen ? { ...d, chosen: a.choice, words: a.words?.trim() || null } : d; });
463
464
  const answered = prev.questionIds.some(id => event.answers[id]);
464
- const b = answered ? { ...collapse(prev, "answered", answeredOutcome(decisions)), decisions } : collapse(prev, "superseded", RESOLVED.withdrawn);
465
+ const b = answered ? { ...collapse(prev, "answered", answeredOutcome(decisions)), decisions } : collapse(prev, "superseded", event.dismissed ? RESOLVED.dismissed : RESOLVED.withdrawn);
465
466
  return { brief: b, appends: [b] };
466
467
  }
467
468
  case "fact_ended":
@@ -585,14 +586,15 @@ export function shownBrief(row: Brief, live: { brief: Brief | null } | undefined
585
586
  export function briefQuestionsEvent(b: Brief, questions: readonly Question[]): Extract<BriefEvent, { type: "questions" }> | null {
586
587
  if (b.state !== "open" || !b.questionIds.length) return null;
587
588
  const answers: Record<string, { choice: string; words: string | null } | null> = {};
589
+ let dismissed = true;
588
590
  for (const id of b.questionIds) {
589
591
  const q = questions.find(q => q.id === id);
590
592
  if (!q) return null;
591
593
  if (q.answer) answers[id] = { choice: q.answer.choice, words: q.answer.words ?? null };
592
- else if (q.closed) answers[id] = null;
594
+ else if (q.closed) { answers[id] = null; dismissed &&= !!q.closed.dismissed; }
593
595
  else return null;
594
596
  }
595
- return { type: "questions", answers };
597
+ return { type: "questions", answers, ...(dismissed && Object.values(answers).some(a => a === null) ? { dismissed: true } : {}) };
596
598
  }
597
599
 
598
600
  /** The developer's option click, in the existing answer format so Follow-up's answer card renders it. */
@@ -205,7 +205,7 @@ export function statsOf(s: Session): SessionStats {
205
205
  * anywhere presets. Paseo takes Shift+? (its shortcuts dialog) and Escape (interrupt agent) when focus is outside a
206
206
  * field, which is exactly when these fire, so the sheet is S and leaving is X.
207
207
  */
208
- export type CatchUpAction = "pick" | "own" | "send" | "skip" | "skip-workspace" | "back" | "more" | "chip" | "ask" | "note" | "later" | "chat" | "rail" | "rail-up" | "rail-down" | "keys" | "leave" | "dictate";
208
+ export type CatchUpAction = "pick" | "own" | "send" | "skip" | "skip-workspace" | "back" | "more" | "chip" | "ask" | "note" | "later" | "chat" | "rail" | "rail-up" | "rail-down" | "keys" | "leave" | "dictate" | "dismiss";
209
209
  /**
210
210
  * a-move-bar-action-opens-in-view: where each move-bar action opens what it opens, so its result is where the eye
211
211
  * already is and never appended below the fold. `sheet`: drawn in the phone's dock, above the bar, kept above the
@@ -237,6 +237,8 @@ export const CATCH_UP_KEYS: readonly { key: string; what: string; action: CatchU
237
237
  { key: "1–4", what: "Pick a More context ask", action: "chip", combos: ["Digit"], when: "more" },
238
238
  { key: "⌘↵", what: "Ask the agent", action: "ask", combos: ["Cmd+Enter", "Ctrl+Enter"], when: "more" },
239
239
  { key: "N", what: "Add a note", action: "note", combos: ["N"] },
240
+ // D alone picks option D, so Dismiss takes Shift, as Skip workspace does beside J.
241
+ { key: "⇧D", what: "Dismiss the question (the agent isn't messaged)", action: "dismiss", combos: ["Shift+D"] },
240
242
  { key: "V", what: "Dictate your answer, and stop", action: "dictate", combos: ["V"], needs: "dictation" },
241
243
  { key: "L", what: "Later", action: "later", combos: ["L"] },
242
244
  { key: "O", what: "Open chat", action: "chat", combos: ["O"] },
@@ -266,6 +268,7 @@ export function catchUpKey(e: KeyPress, at: { typing: boolean; inMore: boolean;
266
268
  if (e.key === "ArrowLeft") return { action: "back" };
267
269
  if (at.moreOpen && /^[1-4]$/.test(e.key)) return { action: "chip", arg: e.key };
268
270
  if (e.shift && e.key.toLowerCase() === "j") return { action: "skip-workspace" };
271
+ if (e.shift && e.key.toLowerCase() === "d") return { action: "dismiss" };
269
272
  if (e.shift || e.key.length !== 1) return null;
270
273
  const k = e.key.toLowerCase();
271
274
  if (/^[a-h]$/.test(k)) return { action: "pick", arg: k.toUpperCase() };
@@ -387,5 +390,30 @@ export function plainAnswer(text: string): string {
387
390
  return text.replace(/\*\*(.+?)\*\*|__(.+?)__/g, (_m, a, b) => a ?? b).replace(/^\s{0,3}(#{1,6}|>)\s+/gm, "").trim();
388
391
  }
389
392
 
393
+ /**
394
+ * more-context-is-the-same-on-every-surface: a question is one card wherever it is answered. Catch up keys its card
395
+ * by workstream (`agent:<id>|Q3` or `ws:<id>|Q3`); the panel, Home's detail pane, the pill and phones ask with
396
+ * `questionCardKey`. Every reader and the worker's one-open-ask rule match through `sameCard`, so an ask made on one
397
+ * surface shows (and dedupes) on all of them.
398
+ */
399
+ export const questionCardKey = (workspaceId: string, questionId: string) => `ws:${workspaceId}|${questionId}`;
400
+ /** The question a card key is about ("Q3"), or null for any other card (a permission, a merge, a brief). */
401
+ export function questionOfCard(cardKey: string): string | null {
402
+ const i = cardKey.indexOf("|");
403
+ const subject = i < 0 ? "" : cardKey.slice(i + 1);
404
+ return /^Q\d+$/.test(subject) ? subject : null;
405
+ }
406
+ /** One card, whichever surface named it: the same key, or the same question of the same workspace. */
407
+ export function sameCard(a: { workspaceId: string | null; cardKey: string }, b: { workspaceId: string | null; cardKey: string }): boolean {
408
+ if (a.cardKey === b.cardKey) return true;
409
+ const q = questionOfCard(a.cardKey);
410
+ return !!q && !!a.workspaceId && a.workspaceId === b.workspaceId && q === questionOfCard(b.cardKey);
411
+ }
412
+ /** The newest ask about a card, from any surface. */
413
+ export function contextFor(requests: readonly ContextRequest[], card: { workspaceId: string | null; cardKey: string }): ContextRequest | null {
414
+ for (let i = requests.length - 1; i >= 0; i--) if (sameCard(requests[i], card)) return requests[i];
415
+ return null;
416
+ }
417
+
390
418
  /** The ask as the card's header quotes it: its first sentence ("I don't get it."), not the whole prompt. */
391
419
  export const askHeadline = (ask: string): string => (ask.match(/^.+?[.?!](?=\s|$)/)?.[0] ?? ask).slice(0, 120);
package/shared/chat.ts CHANGED
@@ -156,7 +156,7 @@ export const TOOL_PRESENTATION: Record<string, "routine" | "moment"> = {
156
156
  set_pr_workflow: "routine", reviewer_settings: "routine", reviewer_suggestions: "routine", save_reviewers: "routine", set_agent_setting: "routine",
157
157
  set_wait_for_jobs: "routine", onboarding_status: "routine", onboarding_checks: "routine", set_onboarding: "routine", rank_status: "routine",
158
158
  rerank_priorities: "routine", overseer_status: "routine", overseer_start: "routine", overseer_restart: "routine", overseer_ask: "routine", catch_up_deck: "routine", context_requests: "routine", ask_context: "routine", context_reply: "routine",
159
- inbox_brief: "routine", brief_action: "routine", queue_list: "routine", queue_action: "routine", inbox_act: "routine", answer_question: "routine", run_recovery: "routine",
159
+ inbox_brief: "routine", brief_action: "routine", queue_list: "routine", queue_action: "routine", inbox_act: "routine", answer_question: "routine", dismiss_question: "routine", run_recovery: "routine",
160
160
  set_workspace_spec: "routine", link_item: "routine", unlink_item: "routine", link_items: "routine", set_linked_items: "routine", set_task_trigger: "routine", pr_controls: "routine", browser_status: "routine", trust_bypass_status: "routine",
161
161
  release_notes: "routine", updates_status: "routine", check_updates: "routine", set_updates: "routine", install_update: "routine", retry_move: "routine", report_issue: "routine", report_send: "routine", make_main_agent: "routine", wait_prepare_job: "routine", wait_for_job: "routine", wait_get_job: "routine",
162
162
  // The developer's moments: the workspace is done, or the agent asked them something. needs_you runs every turn, so a
@@ -118,9 +118,11 @@ export const askQuestionRpc = defineRpc({ name: "follow.ask-question", input: z.
118
118
  background: z.string().trim().max(4000).optional(), links: z.array(linkInput).max(10).optional(),
119
119
  pr: z.string().trim().max(200).optional(), task: idSchema.optional(), supersedes: z.string().regex(/^Q\d+$/).optional(),
120
120
  }), output: z.object({ workspaceId: idSchema, question: questionSchema, mode: z.enum(QUESTION_MODES), instruction: z.string(),
121
- outcome: z.enum(["asked", "duplicate", "superseded"]).default("asked"), of: z.string().nullable().default(null) }) });
121
+ outcome: z.enum(["asked", "duplicate", "superseded", "dismissed"]).default("asked"), of: z.string().nullable().default(null) }) });
122
122
  export const recordAnswerRpc = defineRpc({ name: "follow.record-answer", input: z.strictObject({ agentId: idSchema, id: z.string().regex(/^Q\d+$/), choice: z.string().trim().min(1).max(200), words: z.string().trim().max(2000).optional() }), output: z.object({ workspaceId: idSchema, question: questionSchema }) });
123
123
  export const withdrawQuestionRpc = defineRpc({ name: "follow.withdraw-question", input: z.strictObject({ agentId: idSchema, id: z.string().regex(/^Q\d+$/), reason: z.string().trim().min(1).max(500) }), output: z.object({ workspaceId: idSchema, question: questionSchema }) });
124
+ /** Dismiss a question that no longer matters, or undo that (dismissing-a-question-sends-the-agent-nothing). Sends nothing. */
125
+ export const dismissQuestionRpc = defineRpc({ name: "follow.dismiss-question", input: z.strictObject({ workspaceId: idSchema, questionId: z.string().regex(/^Q\d+$/), undo: z.boolean().optional() }), output: z.object({ workspace: workspaceSchema, question: questionSchema }) });
124
126
  export const answerQuestionRpc = defineRpc({ name: "follow.answer-question", input: z.object({ workspaceId: idSchema, questionId: z.string().regex(/^Q\d+$/), choice: z.string().trim().min(1).max(200), words: z.string().trim().max(2000).optional(), action: z.enum(["send", "copy", "chat", "resend"]) }), output: z.object({ workspace: workspaceSchema, question: questionSchema }) });
125
127
  export const setSpecRpc = defineRpc({ name: "follow.set-spec", input: z.strictObject({ agentId: idSchema, url: z.string().trim().min(1).max(2000), title: z.string().trim().max(120).optional() }), output: z.object({ workspaceId: idSchema, spec: specSchema.nullable(), applied: z.boolean(), message: z.string() }) });
126
128
  export const workspaceSpecRpc = defineRpc({ name: "follow.workspace-spec", input: z.discriminatedUnion("action", [
@@ -180,7 +182,7 @@ export const needsYouRpc = defineRpc({ name: "follow.needs-you", input: z.strict
180
182
  questions: z.array(z.string()).optional(),
181
183
  context: z.string().optional(),
182
184
  links: z.array(z.strictObject({ label: z.string(), url: z.string().optional(), path: z.string().optional(), pr: z.string().optional() })).optional(),
183
- }), output: z.object({ ok: z.literal(true), briefId: z.string() }) });
185
+ }), output: z.object({ ok: z.literal(true), briefId: z.string(), /** Decisions the developer had dismissed: left off the card, and why. */ note: z.string().optional() }) });
184
186
  /** Home's detail pane: the full stored brief for one agent (the list carries only its one-liner). */
185
187
  // The message queue (server/message-queue.ts): what waits to go to agents, and Retry or Cancel on one item.
186
188
  export const queueListRpc = defineRpc({ name: "follow.queue-list", input: z.strictObject({ workspaceId: idSchema.optional(), agentId: idSchema.optional() }), output: z.object({ items: z.array(queueViewSchema), recent: z.array(queueViewSchema) }) });
package/shared/errors.ts CHANGED
@@ -16,7 +16,7 @@ export const STALE_BRIEF = {
16
16
  answered: "This brief was already answered or signed off.",
17
17
  } as const;
18
18
  // Q35 answered or withdrawn elsewhere (server/questions.ts developerAnswer, recordAnswer).
19
- const MOOT = [/^This brief was (replaced by a newer one|already answered or signed off)\./, /^Q\d+ (is already (answered|withdrawn)|was withdrawn)\b/];
19
+ const MOOT = [/^This brief was (replaced by a newer one|already answered or signed off)\./, /^Q\d+ (is already (answered|withdrawn|dismissed)|was (withdrawn|dismissed))\b/];
20
20
 
21
21
  /**
22
22
  * A refusal that means the action is moot, not failed: what it acts on was already answered, replaced or withdrawn
@@ -28,8 +28,9 @@ export function isMoot(error: unknown): boolean {
28
28
  }
29
29
 
30
30
  /** Which moot refusal it is, so a surface says it in its own words instead of echoing the server's. */
31
- export function mootKind(error: unknown): "answered" | "withdrawn" | "replaced" | null {
31
+ export function mootKind(error: unknown): "answered" | "withdrawn" | "replaced" | "dismissed" | null {
32
32
  const t = errorText(error);
33
+ if (/^Q\d+ (is already dismissed|was dismissed)\b/.test(t)) return "dismissed";
33
34
  if (/^This brief was replaced by a newer one\./.test(t)) return "replaced";
34
35
  if (/^Q\d+ (is already withdrawn|was withdrawn)\b/.test(t)) return "withdrawn";
35
36
  return isMoot(error) ? "answered" : null;
@@ -40,6 +41,7 @@ export function mootNote(error: unknown, typed = false): string {
40
41
  const kept = typed ? "Your answer wasn't sent." : "Your pick wasn't sent.";
41
42
  switch (mootKind(error)) {
42
43
  case "withdrawn": return `The agent withdrew this question. ${kept}`;
44
+ case "dismissed": return `This question was dismissed. ${kept}`;
43
45
  case "replaced": return `A newer card replaced this one. ${kept}`;
44
46
  default: return `Already answered elsewhere. ${kept}`;
45
47
  }
@@ -91,7 +91,11 @@ export const questionSchema = z.object({
91
91
  askedAt: z.string(),
92
92
  mode: z.enum(QUESTION_MODES),
93
93
  answer: answerSchema.nullable().default(null),
94
- closed: z.object({ at: z.string(), reason: z.string(), by: z.string().nullable() }).nullable().default(null),
94
+ /**
95
+ * Closed without an answer: withdrawn by its agent, superseded, a task that moved on, or `dismissed` by the developer
96
+ * (or an agent for them, `by` "agent:<id>"): it no longer matters, and the agent was sent nothing.
97
+ */
98
+ closed: z.object({ at: z.string(), reason: z.string(), by: z.string().nullable(), dismissed: z.boolean().optional() }).nullable().default(null),
95
99
  /** Which path created it (1.4.0-beta.25): ask_question, a needs_you decision, or a blocked task. Older records: null. */
96
100
  via: z.enum(["ask", "needs_you", "task"]).nullable().optional(),
97
101
  });
@@ -100,6 +104,15 @@ export type QuestionOption = z.infer<typeof questionOptionSchema>;
100
104
  export type Answer = z.infer<typeof answerSchema>;
101
105
 
102
106
  export const isOpen = (q: Pick<Question, "answer" | "closed">) => !q.answer && !q.closed;
107
+ /** The developer dismissed it (dismissing-a-question-sends-the-agent-nothing): closed, no answer, nothing sent. */
108
+ export const isDismissed = (q: Pick<Question, "answer" | "closed">) => !q.answer && !!q.closed?.dismissed;
109
+ export const DISMISS_REASON = "Dismissed by the developer: it no longer matters.";
110
+ /** A closed question's line on every surface: "Dismissed by you" (or "for you by an agent"), else why it was withdrawn. */
111
+ export function closedLine(q: Pick<Question, "answer" | "closed">): string {
112
+ if (!q.closed) return "";
113
+ if (isDismissed(q)) return q.closed.by?.startsWith("agent:") ? "Dismissed for you by an agent" : "Dismissed by you";
114
+ return `Withdrawn: ${q.closed.reason}`;
115
+ }
103
116
 
104
117
  /** Q1, Q2…: unique for the life of the workspace, never reused after a question closes. */
105
118
  export function nextQuestionId(questions: Pick<Question, "id">[]): string {
@@ -361,6 +374,21 @@ export function findOpenMatch<Q extends Matchable>(questions: readonly Q[], inpu
361
374
  return best && { question: best.question, verdict: best.verdict };
362
375
  }
363
376
 
377
+ /**
378
+ * The dismissed question `input` repeats, if any: the same candidates and rule as findOpenMatch, over questions the
379
+ * developer dismissed. A re-ask returns it instead of a new card, so an agent can't bring back what the developer set
380
+ * aside (no re-ask loop); `supersedes` is the way to ask again when something really changed.
381
+ */
382
+ export function findDismissedMatch<Q extends Matchable>(questions: readonly Q[], input: QuestionShape, askedBy: string | null): Q | null {
383
+ for (let i = questions.length - 1; i >= 0; i--) {
384
+ const q = questions[i];
385
+ if (!isDismissed(q) || q.taskRevision !== null) continue;
386
+ const own = q.askedBy === askedBy || q.via === "needs_you";
387
+ if ((own ? compareQuestions(input, q) : nearIdentical(input, q) ? "same" : null) === "same") return q;
388
+ }
389
+ return null;
390
+ }
391
+
364
392
  /** Open questions that repeat an older open one in the same workspace: [duplicate, original] pairs. The invariant. */
365
393
  export function duplicateOpenQuestions<Q extends Matchable>(questions: readonly Q[]): { duplicate: Q; of: Q }[] {
366
394
  const out: { duplicate: Q; of: Q }[] = [];
@@ -2,7 +2,7 @@ import type { Obligation, Pr } from "./model";
2
2
  import type { Activity } from "./activity";
3
3
  import type { RepairRow } from "./task-rows";
4
4
  import { shortTitle } from "./task-rows";
5
- import { answerLabel, answerStatus, type Question } from "./questions";
5
+ import { answerLabel, answerStatus, closedLine, type Question } from "./questions";
6
6
  import type { ItemField } from "./search";
7
7
 
8
8
  /**
@@ -48,7 +48,7 @@ export function activityFields(r: Pick<Activity, "text" | "detail">): ItemField[
48
48
  /** The Questions tab's line 2: the answer, where it is on its way, or why it was withdrawn. */
49
49
  export function questionStatus(q: Question): string {
50
50
  const s = answerStatus(q);
51
- return q.answer ? `${s && !s.delivered ? `${s.label} · ` : ""}${answerLabel(q, q.answer.choice, q.answer.words)}` : q.closed ? `Withdrawn: ${q.closed.reason}` : "Waiting for you";
51
+ return q.answer ? `${s && !s.delivered ? `${s.label} · ` : ""}${answerLabel(q, q.answer.choice, q.answer.words)}` : q.closed ? closedLine(q) : "Waiting for you";
52
52
  }
53
53
  /** A question: "Q2 · title" and its status line, both on the row. */
54
54
  export function questionFields(q: Question): ItemField[] {