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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ 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, dismissQuestionRpc } from "../shared/contracts";
10
+ import { answerQuestionRpc } from "../shared/contracts";
11
11
  import type { Workspace } from "../shared/model";
12
12
  import type { ListQuestion, ListWorkspace } from "../shared/list";
13
13
  import { OTHER, OTHER_LABEL, closedLine, isDismissed, answerDraft, answerHeading, answerLabel, answerStatus, answerMessage, answerHasActions, resendTitle, isOpen, isOther, questionState, type Question } from "../shared/questions";
@@ -26,7 +26,7 @@ import { overviewKey, workspaceKey } from "./keys";
26
26
  import { PrLinksProvider, RichText } from "./rich-text";
27
27
  import { prLinksByNumber } from "../shared/presentation";
28
28
  import { notice, openQuestion, runAction } from "./toasts";
29
- import { hasToastHost, pushToast } from "./toast-store";
29
+ import { DismissX, useDismiss } from "./dismiss";
30
30
  import { putInChatOrCopy } from "../shared/put-in-chat";
31
31
  import { useChatComposer } from "./put-in-chat";
32
32
  import { Marked, NoMatchRow, useSectionSearch } from "./section-search";
@@ -34,8 +34,6 @@ import { activityFields, questionFields, questionStatus } from "../shared/sectio
34
34
  import type { Activity } from "../shared/activity";
35
35
  import { clearPendingAnswer, failPendingAnswer, pendingKey, setPendingAnswer, usePendingAnswer, usePendingAnswers, type PendingAnswer } from "./pending-answers";
36
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;
39
37
  const who = (w: Pick<ListWorkspace, "mainAgentId">, agentId: string | null) => !agentId || agentId === w.mainAgentId ? "the main agent" : "a root session";
40
38
 
41
39
  /**
@@ -106,10 +104,16 @@ export type SendReady = { send: () => void; busy: boolean };
106
104
  * (the dialog, Needs you on Home and in the panel, the pill, phones): what its field means comes from answerDraft
107
105
  * (`one-answer-flow-for-every-question`), never from the surface.
108
106
  */
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 }: {
107
+ 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, dismissAt = inline ? "host" : "top" }: {
110
108
  workspace: ListWorkspace; question: ListQuestion; theme: Theme; compact: boolean; now?: number; dense?: boolean; bodyMaxHeight?: number; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: () => void;
111
109
  /** Inside the Needs you block: its header says the title and when it was asked, its footer what the agent does meanwhile. */
112
110
  inline?: boolean;
111
+ /**
112
+ * Where the card's small x sits (dismissing-anything-in-needs-you-sends-the-agent-nothing): "top", the body's top
113
+ * right; "host", in the header of whatever draws this body (the Needs you block, the pill, Catch up), next to its age;
114
+ * "foot", at the end of the "Asked … by" line, for the dialog, whose header's top right is its own close.
115
+ */
116
+ dismissAt?: "top" | "host" | "foot";
113
117
  /** The dialog's close: Send and Copy close it at once and report the outcome as a toast. */
114
118
  onClose?: () => void;
115
119
  /**
@@ -213,24 +217,11 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
213
217
  onClose?.(); onAnswered?.();
214
218
  };
215
219
  /**
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.
220
+ * Dismiss (dismissing-anything-in-needs-you-sends-the-agent-nothing): the question no longer matters. It closes and
221
+ * leaves Needs you; nothing goes to the agent. Undo in the toast reopens it. The card moves on as after an answer.
218
222
  */
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} />;
223
+ const dismissAny = useDismiss();
224
+ const dismissX = open && dismissAt !== "host" ? <QuestionDismissX workspaceId={w.id} questionId={q.id} theme={theme} compact={compact} disabled={run.isPending} onDismissed={() => { onClose?.(); onAnswered?.(); }} dismiss={dismissAny} /> : null;
234
225
  // The footer's Send calls the latest quick through a ref, so it never sends a stale choice or words.
235
226
  const quickRef = useRef(quick); quickRef.current = quick;
236
227
  const sendable = open && !!answer;
@@ -282,7 +273,10 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
282
273
  const body = <View style={{ gap: dense ? 10 : 14 }}>
283
274
  <View style={{ gap: 6 }}>
284
275
  {/* Inline: the block's header carries the title, so the question reads as body text under it. */}
285
- <RichText selectable style={inline ? text(c, compact).body : [t.body, { fontSize: dense ? 13 : 15, lineHeight: dense ? 19 : 22 }]}>{q.question}</RichText>
276
+ {(() => {
277
+ const question = <RichText selectable style={[inline ? text(c, compact).body : [t.body, { fontSize: dense ? 13 : 15, lineHeight: dense ? 19 : 22 }], { flex: 1, minWidth: 0 }]}>{q.question}</RichText>;
278
+ return dismissX && dismissAt === "top" ? <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>{question}<View style={{ marginTop: -2, marginRight: -5 }}>{dismissX}</View></View> : question;
279
+ })()}
286
280
  {/* Phones: who asked and when is meta under the question, not a footnote after the buttons. */}
287
281
  {compact && !dense && !inline && <Text style={t.small}>Asked {ago(q.askedAt, now)} by {who(w, q.askedBy)}{q.taskId && !q.options.length ? " (blocked task)" : ""}</Text>}
288
282
  {open && !inline && <View style={{ flexDirection: "row", gap: 6 }}>
@@ -296,10 +290,8 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
296
290
  </View>}
297
291
  {context}
298
292
  {/* 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>)}
293
+ {/* The question's quiet row: More context (Catch up's move bar has its own). Dismiss is the card's x, top right. */}
294
+ {open && moreContext && <QuestionMoreContext workspace={w} question={q} theme={theme} compact={compact} openAgent={openAgent} />}
303
295
  {!!q.options.length && <View accessibilityRole="radiogroup" accessibilityLabel={`Options for ${q.id}`} style={{ gap: 6 }}>
304
296
  {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}
305
297
  selected={(open ? choice : q.answer?.choice) === o.letter} disabled={!open || run.isPending} onPress={() => setChoice(o.letter)} />)}
@@ -380,10 +372,18 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
380
372
  {open && input}
381
373
  {actions}
382
374
  </View>
383
- {!dense && !compact && !inline && <Text style={t.small}>Asked {ago(q.askedAt, now)} by {who(w, q.askedBy)}{q.taskId && !q.options.length ? " (blocked task)" : ""}</Text>}
375
+ {!dense && !compact && !inline && <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
376
+ <Text style={[t.small, { flex: 1 }]}>Asked {ago(q.askedAt, now)} by {who(w, q.askedBy)}{q.taskId && !q.options.length ? " (blocked task)" : ""}</Text>
377
+ {dismissAt === "foot" && dismissX}
378
+ </View>}
384
379
  </SubmitScope>;
385
380
  }
386
381
 
382
+ /** A question's x: closes it as dismissed (follow.dismiss with "question:Qn"), sends the agent nothing, Undo in the toast. */
383
+ export function QuestionDismissX({ workspaceId, questionId, theme, compact, disabled, onDismissed, dismiss }: { workspaceId: string; questionId: string; theme: Theme; compact: boolean; disabled?: boolean; onDismissed?: () => void; dismiss: ReturnType<typeof useDismiss> }) {
384
+ return <DismissX theme={theme} compact={compact} label={`Dismiss ${questionId}`} disabled={disabled} onPress={() => dismiss({ workspaceId, key: `question:${questionId}` }, { onDismissed })} />;
385
+ }
386
+
387
387
  function hostOf(url: string): string {
388
388
  try { return new URL(url).host.replace(/^www\./, ""); } catch { return ""; }
389
389
  }
@@ -395,7 +395,7 @@ export function QuestionSheet({ workspace: w, questionId, theme, compact, onClos
395
395
  const color = !q ? c.foregroundMuted : q.answer ? c.statusSuccess : q.closed ? c.foregroundMuted : c.statusWarning;
396
396
  return <Modal title={q ? `${q.id} · ${q.title}` : "Question"} icon={<Icon name={q?.answer ? "MessageCircleReply" : "MessageCircleQuestion"} size={18} color={color} />} open={!!q} onOpenChange={next => { if (!next) onClose(); }}>
397
397
  <Modal.Content contentContainerStyle={{ padding: compact ? 16 : 20 }}>
398
- {q && <QuestionBody key={q.id} workspace={w} question={q} theme={theme} compact={compact} openAgent={openAgent} onClose={onClose} />}
398
+ {q && <QuestionBody key={q.id} workspace={w} question={q} theme={theme} compact={compact} openAgent={openAgent} onClose={onClose} dismissAt={compact ? "top" : "foot"} />}
399
399
  </Modal.Content>
400
400
  </Modal>;
401
401
  }
@@ -407,6 +407,7 @@ export function QuestionStepper({ workspace: w, theme, compact, openAgent, onAns
407
407
  // An answer on its way (sent, no reply yet) steps the pill on at once; one that failed comes back as Not sent.
408
408
  const open = w.questions.filter(q => isOpen(q) && !(pending[pendingKey(w.id, q.id)] && !pending[pendingKey(w.id, q.id)].error)).sort((a, b) => Number(questionState(b) === "stopped") - Number(questionState(a) === "stopped"));
409
409
  const [index, setIndex] = useState(0);
410
+ const dismiss = useDismiss();
410
411
  if (!open.length) return null;
411
412
  const at = Math.min(index, open.length - 1);
412
413
  const q = open[at];
@@ -423,8 +424,9 @@ export function QuestionStepper({ workspace: w, theme, compact, openAgent, onAns
423
424
  <Text accessibilityLabel={`Question ${at + 1} of ${open.length}`} style={[t.small, { marginLeft: 4 }]}>{at + 1} of {open.length}</Text>
424
425
  {arrow("ChevronLeft", "Previous question", -1)}{arrow("ChevronRight", "Next question", 1)}
425
426
  </>}
427
+ <QuestionDismissX workspaceId={w.id} questionId={q.id} theme={theme} compact={compact} onDismissed={onAnswered} dismiss={dismiss} />
426
428
  </View>
427
- <QuestionBody key={q.id} workspace={w} question={q} theme={theme} compact={compact} dense bodyMaxHeight={bodyMaxHeight} openAgent={openAgent} onAnswered={onAnswered} onDetails={onDetails ? () => onDetails(q.id) : undefined} />
429
+ <QuestionBody key={q.id} workspace={w} question={q} theme={theme} compact={compact} dense bodyMaxHeight={bodyMaxHeight} openAgent={openAgent} onAnswered={onAnswered} onDetails={onDetails ? () => onDetails(q.id) : undefined} dismissAt="host" />
428
430
  </View>;
429
431
  }
430
432
 
package/index.client.tsx CHANGED
@@ -18,6 +18,7 @@ import { createLiveStore, headerIcon, sidebarItem } from "./client/live";
18
18
  import { FOLLOW_UP_ICON } from "./client/follow-up-icon";
19
19
  import { contributeFollowUpPill } from "./client/pill";
20
20
  import { FollowLarge, LARGE_SCREEN } from "./client/large";
21
+ import { bindDismissInbox } from "./client/dismiss";
21
22
  import { createInboxStore } from "./client/inbox-store";
22
23
  import { contributeInboxCommands } from "./client/inbox";
23
24
  import type { BriefDeps } from "./client/brief";
@@ -69,6 +70,8 @@ export default function contribute(host: PluginClientContext) {
69
70
  const Settings = (props: PluginSurfaceProps) => <><FollowSettings {...props} openSetup={openSetup} openReport={() => openReportSheet()} />{reportHost(props)}</>;
70
71
  const store = createLiveStore(client);
71
72
  const inbox = createInboxStore(host);
73
+ // A brief's x (client/dismiss.tsx) updates the inbox rows at once, like Sign off.
74
+ bindDismissInbox(inbox);
72
75
  const HeaderIcon = headerIcon(store);
73
76
  const headers = new Map<string, PluginButtonRegistration>();
74
77
  let stopped = false;
package/index.server.ts CHANGED
@@ -10,6 +10,7 @@ import { isRecovery, withRuntimePrelude, invokeSelf, PLUGIN_ID } from "./shared/
10
10
  import { displayPreferences } from "./shared/display";
11
11
  import { DEFAULT_QUESTION_MODE, QUESTION_DEDUPE_MIGRATION, awaitingSend, collapseDuplicateQuestions, questionPreferences, signedOffAnswers, type QuestionMode } from "./shared/questions";
12
12
  import { answerRecipients, askQuestion, needsYouQuestions, recordAnswer, syncTaskQuestions, withdrawQuestion } from "./server/questions";
13
+ import { dismissItem, dismissedNeeds, undoDismissItem } from "./server/dismiss";
13
14
  import { agentSetSpec, developerSetSpec } from "./server/spec";
14
15
  import type { PluginServerContext, PluginHandlerContext, PluginHookContext, PluginSessionOpenRequest } from "@getpaseo/plugin/server";
15
16
  import type { PluginRpcContract, PluginSubscriptionContract } from "@getpaseo/plugin";
@@ -21,7 +22,7 @@ import { needsYou } from "./shared/attention";
21
22
  import type { SortMode } from "./shared/sort";
22
23
  import type { ZodType, output as zOutput } from "zod";
23
24
  import { mkdir, writeFile } from "node:fs/promises";
24
- import { isTimeZone } from "./shared/inbox";
25
+ import { DISMISSED_ASK_NOTE, isTimeZone, sameAsk } from "./shared/inbox";
25
26
  import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
26
27
  import { join } from "node:path";
27
28
  import { randomUUID } from "node:crypto";
@@ -643,7 +644,7 @@ export default function contribute(server: PluginServerContext) {
643
644
  await agentHooks.confirm(w.id, agentId, summary);
644
645
  return { workspaceId: w.id, synced: true as const };
645
646
  });
646
- handle(rpc.agentStatusRpc, async ({ agentId }, { paseo }) => { await requireReady(); const workspaceId = await callerWorkspaceId(agentId, paseo); const w = agentWorkspace(await store.snapshot(), agentId, "read", workspaceId, "pr"); return { ...w, prWorkflow: prWorkflow.agentWorkflow(workspaceRepo(w), touchedRepos(w)), nextMessageInfo: nextMessageInfo(w, Date.now()), sending: sendingOf(w, Date.now(), { held: !governor.allowsBackground() }) }; });
647
+ handle(rpc.agentStatusRpc, async ({ agentId }, { paseo }) => { await requireReady(); const workspaceId = await callerWorkspaceId(agentId, paseo); const w = agentWorkspace(await store.snapshot(), agentId, "read", workspaceId, "pr"); return { ...w, dismissed: dismissedNeeds(w, Date.now()), dismissedAsk: await inbox.dismissedAsk(agentId), prWorkflow: prWorkflow.agentWorkflow(workspaceRepo(w), touchedRepos(w)), nextMessageInfo: nextMessageInfo(w, Date.now()), sending: sendingOf(w, Date.now(), { held: !governor.allowsBackground() }) }; });
647
648
  handle(rpc.activateRpc, async ({ workspaceId }) => { await requireReady(); return engine.activate(workspaceId); });
648
649
  handle(rpc.sendRpc, async ({ workspaceId, batchId }) => { await requireReady(); return engine.sendPending(workspaceId, batchId); });
649
650
  handle(rpc.recoverRpc, async ({ workspaceId }) => { await requireReady(); return engine.startRecovery(workspaceId); });
@@ -806,6 +807,17 @@ export default function contribute(server: PluginServerContext) {
806
807
  });
807
808
  });
808
809
  handle(rpc.dismissQuestionRpc, async ({ workspaceId, questionId, undo }, context) => { await requireReady(); return engine.dismiss(workspaceId, questionId, !!undo, actorOf(context)); });
810
+ // dismissing-anything-in-needs-you-sends-the-agent-nothing: one path for every kind; only records change.
811
+ handle(rpc.dismissRpc, async ({ workspaceId, key, agentId, undo }, context) => {
812
+ await requireReady();
813
+ const actor = actorOf(context);
814
+ if (agentId) return inbox.dismiss(agentId, !!undo, actor);
815
+ return store.mutateWorkspace(workspaceId!, w => {
816
+ const r = undo ? undoDismissItem(w, key!, actor) : dismissItem(w, key!, actor, Date.now());
817
+ w.updatedAt = new Date().toISOString();
818
+ return r;
819
+ });
820
+ });
809
821
  handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }, context) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action, actorOf(context)); });
810
822
  handle(rpc.declareDoneRpc, async ({ agentId, summary }, { paseo }) => { await requireReady(); return engine.declareDone(agentId, summary, await callerWorkspaceId(agentId, paseo, false)); });
811
823
  handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result, humanOnly }, { paseo }) => {
@@ -1426,13 +1438,19 @@ export default function contribute(server: PluginServerContext) {
1426
1438
  call = { ...rest, ...(linked.decisions.length ? { decisions: linked.decisions } : {}) };
1427
1439
  if (!linked.decisions.length) delete call.decisions;
1428
1440
  } else if (call.questions?.length) throw new Error("questions point at a tracked workspace's open questions, and this workspace isn't tracked.");
1441
+ // dismissing-anything-in-needs-you-sends-the-agent-nothing: an ask the developer dismissed, stated again with nothing
1442
+ // new to decide, isn't flagged again: the turn ends quiet, and the call says why.
1443
+ const gone = await inbox.dismissedAsk(agentId);
1444
+ const restated = !!gone && !questionIds.length && !call.decisions?.length && sameAsk(gone.ask, call.ask);
1445
+ if (restated) call = { ...call, kind: "done" };
1429
1446
  const record: NeedsYouRecord = { at: Date.now(), turnId: turn?.turnId ?? null, call, questionIds, createdIds };
1430
1447
  await mkdir(join(directory, "hook-state"), { recursive: true, mode: 0o700 });
1431
1448
  const temporary = `${needsYouPath(agentId)}.${randomUUID()}`;
1432
1449
  await writeFile(temporary, JSON.stringify(record), { mode: 0o600 });
1433
1450
  await rename(temporary, needsYouPath(agentId));
1434
1451
  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.` } : {}) };
1452
+ ...(restated ? { note: DISMISSED_ASK_NOTE }
1453
+ : 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.` } : {}) };
1436
1454
  });
1437
1455
  // Replies once the answer is recorded; the send runs after (Inbox.briefAction), so a dormant agent's slow resume never
1438
1456
  // 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.1",
4
+ "version": "2.3.0-beta.2",
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": [
@@ -43,7 +43,8 @@
43
43
  "test:wait": "node scripts/check-wait.mjs",
44
44
  "test:wait-live": "node scripts/check-wait.mjs --live",
45
45
  "shots": "node scripts/screenshots.mjs",
46
- "shots:readme": "sh scripts/readme-shots.sh"
46
+ "shots:readme": "sh scripts/readme-shots.sh",
47
+ "check:paseo-keys": "tsx scripts/check-paseo-keys.ts"
47
48
  },
48
49
  "devDependencies": {
49
50
  "@getpaseo/client": "0.16.0-beta.1",
@@ -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", "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;
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", "dismiss_item", "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", "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"];
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", "dismiss_item", "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,11 @@ 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
+ // dismissing-anything-in-needs-you-sends-the-agent-nothing: the small x on every Needs-you item and brief.
99
+ { name: "dismiss_item", rpc: "follow.dismiss", kind: "planned",
100
+ input: z.strictObject({ workspaceId: id.optional(), key: z.string().min(1).max(400).optional(), agentId: id.optional(), undo: z.boolean().optional(), ...confirm }),
101
+ toRpc: a => ({ ...(a.agentId ? { agentId: a.agentId } : { workspaceId: a.workspaceId, key: a.key }), ...(a.undo ? { undo: true } : {}) }),
102
+ guard: (a, caller) => a.agentId === caller ? "dismiss_item dismisses another agent's brief for the developer; your own brief is the developer's to dismiss." : null },
98
103
  { name: "dismiss_question", rpc: "follow.dismiss-question", kind: "planned",
99
104
  input: z.strictObject({ workspaceId: id.optional(), questionId: z.string().regex(/^Q\d+$/).optional(), undo: z.boolean().optional(), ...confirm }),
100
105
  toRpc: a => ({ workspaceId: a.workspaceId, questionId: a.questionId, ...(a.undo ? { undo: true } : {}) }) },
@@ -189,7 +194,7 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
189
194
  "follow.queue-action": { tools: ["queue_action"] },
190
195
  "follow.inbox-act": { tools: ["sign_off", "snooze", "set_finish_flags", "inbox_act"] },
191
196
  "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." },
197
+ "follow.dismiss": { tools: ["dismiss_item", "dismiss_question"], note: "The small x on every Needs-you item and brief. The server refuses an agent's own brief, question or workspace; undo: true is the toast's Undo. dismiss_question (follow.dismiss-question, which the client no longer calls) stays as the question-only alias of dismiss_item with key question:Qn." },
193
198
  "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." },
194
199
  "follow.workspace-about": { tools: ["workspace_about"] },
195
200
  "follow.rename-status": { tools: ["ai_rename"], note: "The dry run shows the name now and the suggestion." },
@@ -221,6 +226,6 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
221
226
  * note says where an agent finds what the developer found.
222
227
  */
223
228
  export const VIEW_PARITY: Record<string, { tools: readonly string[]; note: string }> = {
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." },
229
+ "catch-up": { tools: ["catch_up_deck", "answer_question", "dismiss_question", "dismiss_item", "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." },
225
230
  "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." },
226
231
  };
@@ -0,0 +1,62 @@
1
+ import { actorBy, type Actor } from "../shared/actor";
2
+ import { allNeeds, dismissPrint, isDismissedNeed, type NeedItem } from "../shared/attention";
3
+ import type { Workspace } from "../shared/model";
4
+ import { dismissQuestion, undoDismiss } from "./questions";
5
+
6
+ /**
7
+ * Dismiss for every Needs-you item (dismissing-anything-in-needs-you-sends-the-agent-nothing): "this no longer needs
8
+ * me". Only this record changes. Nothing is queued or sent, so no agent spends a turn or a token on it, and nothing
9
+ * Follow-up holds is dropped: a dismissed send's batch stays queued on its Tasks rows, a dismissed retry's batch stays
10
+ * blocked, a paused workspace stays paused, an undelivered message keeps retrying. The item comes back when what it is
11
+ * about changes (dismissPrint), or on Undo.
12
+ *
13
+ * A question closes as dismissed (server/questions.ts dismissQuestion). An agent's turn-end brief is the inbox's
14
+ * (Inbox.dismiss). Everything else is pinned here, on `Workspace.dismissed`.
15
+ */
16
+
17
+ /** How the toast and the tool name the item: "Q3", or what the row says. */
18
+ export function dismissName(item: Pick<NeedItem, "kind" | "title"> & { questionId?: string }): string {
19
+ if (item.kind === "question" && item.questionId) return item.questionId;
20
+ const title = item.title.trim();
21
+ return `"${title.length > 70 ? `${title.slice(0, 69)}…` : title}"`;
22
+ }
23
+
24
+ /** Workspace items an agent may not dismiss for the developer: the main agent's own workspace (its asks and its work). */
25
+ function refuseOwn(w: Workspace, actor: Actor): void {
26
+ if (actor.kind === "agent" && actor.agentId === w.mainAgentId)
27
+ throw new Error("This is your own workspace's Needs you: what it asks is the developer's to dismiss. dismiss_item dismisses another workspace's items for the developer.");
28
+ }
29
+
30
+ export function dismissItem(w: Workspace, key: string, actor: Actor, now: number): { name: string } {
31
+ const question = /^question:(Q\d+)$/.exec(key)?.[1];
32
+ if (question) { dismissQuestion(w, question, actor, now); return { name: question }; }
33
+ const item = allNeeds(w, now).find(i => i.key === key);
34
+ // Moot, not failed: the item left Needs you by itself (merged, sent, resumed) before the click landed.
35
+ if (!item) throw new Error(`${key} is already gone from Needs you.`);
36
+ const print = dismissPrint(item, w);
37
+ if (isDismissedNeed(w, key, print)) throw new Error(`${key} is already dismissed.`);
38
+ refuseOwn(w, actor);
39
+ // Keep only dismissals that still hold: a changed item's old print would never match again.
40
+ const live = new Map(allNeeds(w, now).map(i => [i.key, dismissPrint(i, w)]));
41
+ w.dismissed = [...(w.dismissed ?? []).filter(d => d.key !== key && live.get(d.key) === d.print),
42
+ { key, print, title: item.title.slice(0, 400), at: new Date(now).toISOString(), by: actorBy(actor) }].slice(-100);
43
+ return { name: dismissName(item) };
44
+ }
45
+
46
+ /** Undo: the item is back in Needs you as it was. */
47
+ export function undoDismissItem(w: Workspace, key: string, actor: Actor): { name: string } {
48
+ const question = /^question:(Q\d+)$/.exec(key)?.[1];
49
+ if (question) { undoDismiss(w, question); return { name: question }; }
50
+ const entry = w.dismissed?.find(d => d.key === key);
51
+ if (!entry) throw new Error(`${key} isn't dismissed, so there is nothing to undo.`);
52
+ refuseOwn(w, actor);
53
+ w.dismissed = w.dismissed!.filter(d => d.key !== key);
54
+ return { name: dismissName({ kind: "hold", title: entry.title }) };
55
+ }
56
+
57
+ /** What the developer dismissed that still holds, for workspace_status: the agent learns only when it looks. */
58
+ export function dismissedNeeds(w: Workspace, now: number): NonNullable<Workspace["dismissed"]> {
59
+ if (!w.dismissed?.length) return [];
60
+ const all = allNeeds(w, now);
61
+ return w.dismissed.filter(d => all.some(i => i.key === d.key && dismissPrint(i, w) === d.print));
62
+ }
@@ -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\", \"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\"];",
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\", \"dismiss_item\", \"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; }",
package/server/inbox.ts CHANGED
@@ -13,7 +13,7 @@ import { copyOnAccess, detach, peek, type Changes } from "./cow";
13
13
  import { z } from "zod";
14
14
  import { BRIEF_ORIGINS_MAX, briefOriginSchema, emptyInbox, entrySchema, expired, inboxStateSchema, newEntry, reduce, StaleSignOff, type Entry, type InboxEvent, type InboxRow, type InboxState, type Reason, liveFlag, withoutRunState, FACT_REASONS, prEndEvent, reviewersBriefPr, markNotified, notifiedBefore, prNotice, pruneNotified } from "../shared/inbox";
15
15
  import type { State as FollowState, Workspace as FollowWorkspace } from "../shared/model";
16
- import { asksForReviewers } from "../shared/attention";
16
+ import { reviewersAskStands } from "../shared/attention";
17
17
  import { followUpObligations } from "../shared/follow-up";
18
18
  import { configuredReviewers, reviewerLabel, withoutAuthor } from "../shared/reviewers";
19
19
  import { classify, finishedReply, turnPrompt, type Sources } from "./inbox-classifier";
@@ -287,7 +287,7 @@ export type InboxOptions = {
287
287
  export type BriefDecider = (prev: Entry, next: Entry, at: string) => BriefEvent | null;
288
288
  /** Brief steps every inbox event implies: sign-off collapses, undo reopens, an answered prompt retires its slim brief. */
289
289
  export function autoBrief(event: InboxEvent, prev?: Entry): BriefEvent | null {
290
- if (event.type === "sign_off") return { type: "sign_off" };
290
+ if (event.type === "sign_off") return { type: "sign_off", ...(event.dismissed ? { dismissed: true } : {}) };
291
291
  // Undoing a Later only moves the snooze back: the brief was never collapsed, so nothing reopens.
292
292
  if (event.type === "undo") return prev?.undo?.kind === "snooze" ? null : { type: "undo" };
293
293
  if (event.type === "permission_resolved") return { type: "permission_resolved" };
@@ -957,7 +957,7 @@ export class Inbox {
957
957
  switch (input.action) {
958
958
  case "sign_off": {
959
959
  const before = Object.fromEntries((input.agentIds ?? []).map(id => [id, state.entries[id]]));
960
- each(id => ({ type: "sign_off", ...(input.seqs?.[id] !== undefined ? { seq: input.seqs[id] } : {}), ...(input.muteTurn ? { muteTurn: true } : {}) }));
960
+ each(id => ({ type: "sign_off", ...(input.seqs?.[id] !== undefined ? { seq: input.seqs[id] } : {}), ...(input.muteTurn ? { muteTurn: true } : {}), ...(input.dismissed ? { dismissed: true } : {}) }));
961
961
  const done = results.filter(r => r.ok).map(r => r.agentId);
962
962
  cleared.push(...done); state.signOffs += done.length;
963
963
  if (done.length > 1) state.batchUndo = { at, expires: new Date(now + DAY).toISOString(), unsorted: null, entries: done.map(id => ({ agentId: id, seq: state.entries[id].seq, prev: before[id]?.needs ?? null, prevSnooze: before[id]?.snooze ?? null })) };
@@ -1033,6 +1033,29 @@ export class Inbox {
1033
1033
  return appends.map(a => a.agentId);
1034
1034
  }
1035
1035
 
1036
+ /**
1037
+ * Dismiss an agent's turn-end brief (dismissing-anything-in-needs-you-sends-the-agent-nothing): a sign-off that sends
1038
+ * the agent nothing and remembers the ask, so a needs_you restating it isn't flagged again (`dismissedAsk`). Undo
1039
+ * brings the row and its card back. An agent can't dismiss its own brief.
1040
+ */
1041
+ async dismiss(agentId: string, undo: boolean, actor: Actor = DEVELOPER): Promise<{ name: string }> {
1042
+ if (actor.kind === "agent" && actor.agentId === agentId) throw new Error("This is your own brief: it is the developer's to dismiss. dismiss_item dismisses another agent's brief for the developer.");
1043
+ const e = (await this.store.snapshot()).entries[agentId];
1044
+ if (undo) {
1045
+ if (!e?.dismissedAsk || e.undo?.kind !== "sign_off") throw new Error("This agent's ask isn't dismissed, so there is nothing to undo.");
1046
+ await this.act({ action: "undo", agentIds: [agentId] }, actor);
1047
+ return { name: "the agent's ask" };
1048
+ }
1049
+ if (!e?.needs) throw new Error("This agent's ask is already gone from Needs you.");
1050
+ await this.act({ action: "sign_off", agentIds: [agentId], dismissed: true }, actor);
1051
+ return { name: "the agent's ask" };
1052
+ }
1053
+
1054
+ /** The ask the developer dismissed on this agent's row, if it still stands (cleared by their next message or Undo). */
1055
+ async dismissedAsk(agentId: string): Promise<{ ask: string; kind: string; at: string } | null> {
1056
+ return (await this.store.snapshot()).entries[agentId]?.dismissedAsk ?? null;
1057
+ }
1058
+
1036
1059
  /** The stored brief for one agent, for Home's detail pane. */
1037
1060
  async brief(agentId: string): Promise<Brief | null> {
1038
1061
  if (!await this.on()) return null;
@@ -1109,6 +1132,8 @@ export function briefShare(state: Pick<InboxState, "briefOrigins">, now: number,
1109
1132
  export type InboxAction = {
1110
1133
  action: "sign_off" | "undo" | "snooze" | "unsnooze" | "mute_turn" | "set_finish_flags" | "unsorted_flag" | "unsorted_sign_off" | "batch_undo";
1111
1134
  agentIds?: string[]; seqs?: Record<string, number>; until?: string; value?: boolean; muteTurn?: boolean;
1135
+ /** Dismiss (follow.dismiss, never the inbox RPC): a sign-off that remembers the ask, so a restated ask isn't flagged again. */
1136
+ dismissed?: boolean;
1112
1137
  };
1113
1138
 
1114
1139
  /**
@@ -1208,7 +1233,7 @@ export function followUpEvents(follow: FollowState, enablePrClosed: boolean): {
1208
1233
  if (s.conflict) events.push({ agentId, event: { type: "review", dedupeKey: `${pr.key}:conflict:${s.head}`, detail: `Merge conflict to fix on #${pr.number}`, suppressed: repairing || automatic } });
1209
1234
  // Reviewers are the developer's job, and don't wait for threads or CI. Skipped only while a reviewer request
1210
1235
  // or merge is already in flight for this PR (so a second request isn't asked for while GitHub catches up).
1211
- if (asksForReviewers(pr, w))
1236
+ if (reviewersAskStands(pr, w))
1212
1237
  events.push({ agentId, event: { type: "reviewers", dedupeKey: `${pr.key}:reviewers`, detail: `#${pr.number}`, prKey: pr.key, url: prLink(pr).url,
1213
1238
  names: withoutAuthor(configuredReviewers(pr.repo), s.reviewers?.author).map(reviewerLabel) } });
1214
1239
  } else if (enablePrClosed) {
@@ -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_item\", \"Dismiss anything in Needs you for the developer, like its small x: { workspaceId, key } for a workspace's item (keys from inbox_list or catch_up_deck: merge:<pr>, reviewers:<pr>, send:<batch>, question:Q3…), or { agentId } for another agent's turn-end brief. Sends no agent anything; the item comes back if it changes. undo: true brings it back. Never your own brief, question or workspace.\" + ask, \"follow.agent-act\", { workspaceId: string, key: string, agentId: string, undo: boolean, ...planned }, []],",
104
105
  " [\"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 }, []],",
105
106
  " [\"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 }, []],",
106
107
  " [\"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 }, []],",
@@ -265,6 +266,10 @@ export const mcpSource: string = [
265
266
  " 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
267
  " // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.",
267
268
  " 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 })),",
269
+ " // Needs-you items the developer dismissed (merge, reviewers, a stuck repair…): hidden until they change; nothing was sent.",
270
+ " dismissedItems: (w.dismissed ?? []).slice(-20).map(d => ({ key: d.key, title: d.title, at: d.at, by: d.by })),",
271
+ " // Your own ask the developer dismissed: they don't need it; don't raise it again at a turn's end.",
272
+ " ...(w.dismissedAsk ? { dismissedAsk: w.dismissedAsk } : {}),",
268
273
  " spec: w.spec?.url ? { url: w.spec.url, title: w.spec.title, source: w.spec.source } : null,",
269
274
  " 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 })),",
270
275
  " 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_item", "Dismiss anything in Needs you for the developer, like its small x: { workspaceId, key } for a workspace's item (keys from inbox_list or catch_up_deck: merge:<pr>, reviewers:<pr>, send:<batch>, question:Q3…), or { agentId } for another agent's turn-end brief. Sends no agent anything; the item comes back if it changes. undo: true brings it back. Never your own brief, question or workspace." + ask, "follow.agent-act", { workspaceId: string, key: string, agentId: string, undo: boolean, ...planned }, []],
102
103
  ["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 }, []],
103
104
  ["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 }, []],
104
105
  ["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 }, []],
@@ -263,6 +264,10 @@ function currentWork(w) {
263
264
  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
265
  // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.
265
266
  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 })),
267
+ // Needs-you items the developer dismissed (merge, reviewers, a stuck repair…): hidden until they change; nothing was sent.
268
+ dismissedItems: (w.dismissed ?? []).slice(-20).map(d => ({ key: d.key, title: d.title, at: d.at, by: d.by })),
269
+ // Your own ask the developer dismissed: they don't need it; don't raise it again at a turn's end.
270
+ ...(w.dismissedAsk ? { dismissedAsk: w.dismissedAsk } : {}),
266
271
  spec: w.spec?.url ? { url: w.spec.url, title: w.spec.title, source: w.spec.source } : null,
267
272
  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 })),
268
273
  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 })),
@@ -186,10 +186,57 @@ export function asksForReviewers(pr: Pr, w: Pick<Workspace, "prActions">): boole
186
186
  return !agentMerges(pr) && noReviewers(pr) && !pr.snapshot!.draft && configuredReviewers(pr.repo).length > 0 && !w.prActions.some(a => prActionBlocks(a, [pr.key]));
187
187
  }
188
188
 
189
- /** What needs the developer, most urgent first. Answered once per store snapshot and clock reading (perSnapshot); each caller gets its own array. */
190
- const needsYouOnce = perSnapshot(computeNeedsYou);
189
+ /**
190
+ * What an item's dismissal is pinned to (dismissing-anything-in-needs-you-sends-the-agent-nothing): Dismiss hides the
191
+ * item while this print matches, and a change to what it is about makes a new print, so a real new problem comes back.
192
+ * Per kind, what "changed" means:
193
+ * - merge, reviewers: the PR's head commit (a new push asks again).
194
+ * - retry: the batch, its state, attempts and result (a new failure, or the next attempt failing).
195
+ * - capped, person: the task's fingerprint (what GitHub shows for it) and why it is held.
196
+ * - send: the batch and its tasks' fingerprints (a new batch, or a task added or changed).
197
+ * - decision: the task's revision and ask. hold: the pause's reason. check: the action and its result.
198
+ * - answer: the delivery state and the answer (failed again after a Retry, copied then put in chat).
199
+ * - message: the queue item and its state (queued past the stuck mark, then failed).
200
+ * A question never needs a print: its dismissal closes it (server/questions.ts dismissQuestion).
201
+ */
202
+ export function dismissPrint(i: NeedItem, w: Workspace): string {
203
+ switch (i.kind) {
204
+ case "hold": return `${w.hold ?? ""}`;
205
+ case "retry": { const b = w.batches.find(b => b.id === i.batchId); return `${i.batchId}|${b?.state ?? ""}|${b?.attempts ?? 0}|${b?.result ?? ""}`; }
206
+ case "capped": case "person": { const h = (w.heldTasks ?? []).find(h => h.task.key === i.taskKey); return `${i.taskKey}|${h?.task.fingerprint ?? ""}|${i.detail}`; }
207
+ case "send": { const b = w.batches.find(b => b.id === i.batchId); return `${i.batchId}|${(b?.tasks ?? []).map(t => `${t.key}:${t.fingerprint}`).sort().join(",")}`; }
208
+ case "decision": { const o = w.obligations.find(o => o.id === i.obligationId); return `${i.obligationId}|${o?.revision ?? ""}|${i.detail}`; }
209
+ case "question": return i.questionId;
210
+ case "answer": { const a = (w.questions ?? []).find(q => q.id === i.questionId)?.answer; return `${i.questionId}|${a?.delivery.state ?? ""}|${a?.at ?? ""}|${a?.choice ?? ""}|${a?.words ?? ""}`; }
211
+ case "check": return `${i.actionId}|${i.detail}`;
212
+ case "message": { const m = (w.undelivered ?? []).find(m => m.id === i.itemId); return `${i.itemId}|${m?.state ?? ""}`; }
213
+ case "merge": case "reviewers": return `${i.prKey}|${w.prs.find(p => p.key === i.prKey)?.snapshot?.head ?? ""}`;
214
+ }
215
+ }
216
+ /** The developer dismissed this item and it hasn't changed since (dismissPrint). */
217
+ export const isDismissedNeed = (w: Pick<Workspace, "dismissed">, key: string, print: string) => !!w.dismissed?.some(d => d.key === key && d.print === print);
218
+ /**
219
+ * Whether the reviewers ask for this PR stands: it asks (asksForReviewers) and the developer hasn't dismissed it since
220
+ * its last push. The inbox's "Add reviewers" flag reads this, so dismissing the ask in Needs you drops the agent row's
221
+ * flag too, and the two never disagree (reviewers-ask-agrees).
222
+ */
223
+ export function reviewersAskStands(pr: Pr, w: Pick<Workspace, "prActions" | "dismissed">): boolean {
224
+ return asksForReviewers(pr, w) && !isDismissedNeed(w, `reviewers:${pr.key}`, `${pr.key}|${pr.snapshot?.head ?? ""}`);
225
+ }
226
+
227
+ /**
228
+ * Every Needs-you item, dismissed ones included: what Dismiss looks an item up in (server/dismiss.ts) and what
229
+ * workspace_status reads to say what the developer dismissed. Every count and surface reads needsYou.
230
+ */
231
+ const allNeedsOnce = perSnapshot(computeAllNeeds);
232
+ export const allNeeds = (w: Workspace, now = Date.now()): NeedItem[] => [...allNeedsOnce(w, now)];
233
+ /** What needs the developer, most urgent first, without what they dismissed. Answered once per store snapshot and clock reading (perSnapshot); each caller gets its own array. */
234
+ const needsYouOnce = perSnapshot((w: Workspace, now: number) => {
235
+ const all = allNeedsOnce(w, now);
236
+ return w.dismissed?.length ? all.filter(i => !isDismissedNeed(w, i.key, dismissPrint(i, w))) : all;
237
+ });
191
238
  export const needsYou = (w: Workspace, now = Date.now()): NeedItem[] => [...needsYouOnce(w, now)];
192
- function computeNeedsYou(w: Workspace, now: number): NeedItem[] {
239
+ function computeAllNeeds(w: Workspace, now: number): NeedItem[] {
193
240
  if (!w.enable_tracking || w.archived) return [];
194
241
  const items: NeedItem[] = [];
195
242
  const questions = w.questions ?? [];