paseo-follow-up 2.3.0-beta.1 → 2.3.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/brief.tsx +17 -7
- package/client/catch-up.tsx +16 -9
- package/client/dismiss.tsx +106 -0
- package/client/home-chrome.tsx +47 -12
- package/client/home.tsx +6 -3
- package/client/inbox-store.ts +11 -1
- package/client/needs-you.tsx +28 -9
- package/client/questions.tsx +32 -30
- package/client/sidebar-view.tsx +6 -5
- package/client/stacks.tsx +9 -1
- package/index.client.tsx +3 -0
- package/index.server.ts +21 -3
- package/package.json +3 -2
- package/server/agent-actions.ts +6 -2
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +7 -2
- package/server/dismiss.ts +62 -0
- package/server/engine.ts +18 -3
- package/server/github.ts +124 -16
- package/server/hook-source.ts +1 -1
- package/server/inbox.ts +29 -4
- package/server/mcp-source.ts +7 -0
- package/server/mcp.mjs +7 -0
- package/shared/attention.ts +50 -3
- package/shared/brief.ts +3 -2
- package/shared/chat.ts +1 -1
- package/shared/contracts.ts +9 -1
- package/shared/display.ts +4 -3
- package/shared/errors.ts +3 -1
- package/shared/home-keys.ts +2 -2
- package/shared/inbox.ts +21 -3
- package/shared/layout-swap.ts +63 -0
- package/shared/model.ts +12 -0
- package/shared/overseer.ts +7 -1
- package/shared/paseo-keys.ts +24 -0
- package/shared/poll.ts +44 -11
- package/shared/presentation.ts +14 -0
- package/shared/search-key.ts +8 -8
- package/shared/search.ts +39 -7
- package/shared/status-invariants.ts +2 -2
package/client/needs-you.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import { sameText } from "../shared/home";
|
|
|
11
11
|
import type { ListWorkspace as Workspace } from "../shared/list";
|
|
12
12
|
import { Button, Card, CardRow, Chip, PrLinkButton, errorText, text, type Theme } from "./kit";
|
|
13
13
|
import type { Colors } from "./theme";
|
|
14
|
-
import { QuestionBody, meanwhile } from "./questions";
|
|
14
|
+
import { QuestionBody, QuestionDismissX, meanwhile } from "./questions";
|
|
15
15
|
import { needsYouBlock } from "../shared/needs-block";
|
|
16
16
|
import { age } from "../shared/inbox";
|
|
17
17
|
import { questionState } from "../shared/questions";
|
|
@@ -20,6 +20,7 @@ import { useState, type ReactNode } from "react";
|
|
|
20
20
|
import { usePendingAnswer } from "./pending-answers";
|
|
21
21
|
import { useReviewerSettings } from "./reviewers";
|
|
22
22
|
import { NoReviewLink } from "./review-mode";
|
|
23
|
+
import { DismissX, RevealScope, useDismiss } from "./dismiss";
|
|
23
24
|
|
|
24
25
|
import { overviewKey, workspaceKey } from "./keys";
|
|
25
26
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
@@ -99,6 +100,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
99
100
|
const inspect = useMutation({ mutationFn: (actionId: string) => check({ workspaceId: w.id, actionId }), onSuccess: reply => { toast.show(reply.result, { variant: reply.state === "failed" ? "warning" : "info" }); refresh(); }, onError: fail });
|
|
100
101
|
const items = rows ?? needsYou(w, now);
|
|
101
102
|
const mergeControl = useMergeButtons(w);
|
|
103
|
+
const dismiss = useDismiss();
|
|
102
104
|
if (!items.length) return null;
|
|
103
105
|
const busy = resume.isPending || retry.isPending || retryTask.isPending || deliver.isPending || sendAnswer.isPending || resendAnswer.isPending || queueAct.isPending || inspect.isPending;
|
|
104
106
|
const openMain = actions.openAgent ? () => actions.openAgent!(w.mainAgentId) : undefined;
|
|
@@ -160,12 +162,15 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
160
162
|
const more = secondary(item);
|
|
161
163
|
const button = act || link || more ? <>{pair ?? <>{act}{link}</>}{more}</> : null;
|
|
162
164
|
const said = !!untitled?.has(item.key);
|
|
165
|
+
// The small x, top right, on every kind (dismissing-anything-in-needs-you-sends-the-agent-nothing).
|
|
166
|
+
const x = <DismissX theme={theme} compact={compact} label={`Dismiss ${item.kind === "question" ? item.questionId : item.title}`}
|
|
167
|
+
onPress={() => dismiss({ workspaceId: w.id, key: item.key }, { onDismissed: actions.after })} />;
|
|
163
168
|
// Phones: the action sits at the row's right edge so rows never grow a second line of controls. A send batch
|
|
164
169
|
// (the primary, with its task list) and Retry's pair keep their buttons full width under the row.
|
|
165
170
|
// A stack's scope line and a blocker need the row's full width, so those rows put their button under the text.
|
|
166
171
|
const inline = compact && button && item.kind !== "send" && !(item.kind === "retry" && !item.exhausted) && item.kind !== "person" && !scopeLine && !notice;
|
|
167
172
|
if (inline) return <CardRow key={item.key} theme={theme} compact first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
168
|
-
<
|
|
173
|
+
<RevealScope style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
169
174
|
{/* A row with the quiet link under it is taller: the glyph stays on the title's line. */}
|
|
170
175
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start", paddingTop: 2 } : undefined}><Icon name={g.name} size={16} color={g.color} /></View>
|
|
171
176
|
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
@@ -174,10 +179,12 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
174
179
|
{item.kind === "reviewers" && <NoReviewLink repo={item.prKey.split("#")[0]} theme={theme} compact />}
|
|
175
180
|
</View>
|
|
176
181
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start" } : undefined}>{pair ?? button}</View>
|
|
177
|
-
|
|
182
|
+
{/* Top right, a step away from the action so a thumb aimed at it doesn't land here. */}
|
|
183
|
+
<View style={{ alignSelf: "flex-start", marginTop: -4, marginRight: -6, marginLeft: 2 }}>{x}</View>
|
|
184
|
+
</RevealScope>
|
|
178
185
|
</CardRow>;
|
|
179
186
|
return <CardRow key={item.key} theme={theme} compact={compact} first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
180
|
-
<
|
|
187
|
+
<RevealScope style={{ flexDirection: "row", gap: 9 }}>
|
|
181
188
|
<View style={{ paddingTop: 2 }}><Icon name={g.name} size={14} color={g.color} /></View>
|
|
182
189
|
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
|
|
183
190
|
{!said && <RichText style={compact ? t.label : t.body}>{item.title}</RichText>}
|
|
@@ -191,7 +198,8 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
191
198
|
</View>}
|
|
192
199
|
{notice}
|
|
193
200
|
</View>
|
|
194
|
-
|
|
201
|
+
<View style={{ marginTop: -3, marginRight: -5 }}>{x}</View>
|
|
202
|
+
</RevealScope>
|
|
195
203
|
</CardRow>;
|
|
196
204
|
})}
|
|
197
205
|
</View></PrLinksProvider>;
|
|
@@ -246,6 +254,7 @@ export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brie
|
|
|
246
254
|
function QuestionAsk({ workspace: w, questionId, context, theme, compact, now, open, onToggle, openAgent }: { workspace: Workspace; questionId: string; context: string | null; theme: Theme; compact: boolean; now: number; open: boolean; onToggle: () => void; openAgent?: (agentId: string) => void }) {
|
|
247
255
|
const c = theme.colors; const t = text(c, compact);
|
|
248
256
|
const pending = usePendingAnswer(w.id, questionId);
|
|
257
|
+
const dismiss = useDismiss();
|
|
249
258
|
const q = w.questions.find(x => x.id === questionId);
|
|
250
259
|
if (!q) return null;
|
|
251
260
|
const state = meanwhile(w, q, pending);
|
|
@@ -257,10 +266,20 @@ function QuestionAsk({ workspace: w, questionId, context, theme, compact, now, o
|
|
|
257
266
|
<Text style={[t.meta, { paddingTop: 1 }]}>{age(q.askedAt, now)}</Text>
|
|
258
267
|
<View style={{ paddingTop: 1 }}><Icon name={open ? "ChevronUp" : "ChevronDown"} size={14} color={c.foregroundMuted} /></View>
|
|
259
268
|
</View>;
|
|
260
|
-
|
|
269
|
+
// The x sits beside the header, outside its toggle, so dismissing never also opens or closes the section.
|
|
270
|
+
const x = <View style={{ marginTop: compact ? -4 : -3, marginRight: compact ? -8 : -6 }}><QuestionDismissX workspaceId={w.id} questionId={q.id} theme={theme} compact={compact} dismiss={dismiss} /></View>;
|
|
271
|
+
if (!open) return <CardRow theme={theme} compact={compact} style={{ minHeight: compact ? 48 : undefined, justifyContent: "center" }}>
|
|
272
|
+
<RevealScope style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
|
|
273
|
+
<Pressable accessibilityRole="button" accessibilityLabel={`Show ${q.id}: ${q.title}`} onPress={onToggle} style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : undefined, justifyContent: "center" }}>{header}</Pressable>
|
|
274
|
+
{x}
|
|
275
|
+
</RevealScope>
|
|
276
|
+
</CardRow>;
|
|
261
277
|
return <CardRow theme={theme} compact={compact} style={{ paddingVertical: compact ? 14 : 12 }}>
|
|
262
|
-
<
|
|
263
|
-
<
|
|
278
|
+
<RevealScope style={{ gap: 12 }}>
|
|
279
|
+
<View style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
|
|
280
|
+
<Pressable accessibilityRole="button" aria-expanded accessibilityState={{ expanded: true }} accessibilityLabel={`Hide ${q.id}: ${q.title}`} onPress={onToggle} style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : undefined }}>{header}</Pressable>
|
|
281
|
+
{x}
|
|
282
|
+
</View>
|
|
264
283
|
{/* What the agent does meanwhile sits under the question, as in the dialog; under the buttons goes what they do. */}
|
|
265
284
|
<View style={{ flexDirection: "row", gap: 6 }}>
|
|
266
285
|
<View style={{ paddingTop: 2 }}><Icon name={state.icon} size={12} color={state.color(c)} /></View>
|
|
@@ -268,6 +287,6 @@ function QuestionAsk({ workspace: w, questionId, context, theme, compact, now, o
|
|
|
268
287
|
</View>
|
|
269
288
|
{!!context && <RichText selectable linkColor={c.foreground} style={[t.body, { color: c.foregroundMuted }]}>{context}</RichText>}
|
|
270
289
|
<QuestionBody workspace={w} question={q} theme={theme} compact={compact} now={now} openAgent={openAgent} inline />
|
|
271
|
-
</
|
|
290
|
+
</RevealScope>
|
|
272
291
|
</CardRow>;
|
|
273
292
|
}
|
package/client/questions.tsx
CHANGED
|
@@ -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
|
|
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 {
|
|
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-
|
|
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
|
|
220
|
-
const
|
|
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
|
-
|
|
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
|
|
300
|
-
{open &&
|
|
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 && <
|
|
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/client/sidebar-view.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Text } from "./text";
|
|
|
6
6
|
import { UndoBar, useInbox, useSidebarViewMounted } from "./inbox";
|
|
7
7
|
import { HomeList, OVERSEER_KEY, type OverseerRowState } from "./home-list";
|
|
8
8
|
import { sidebarSelected } from "./theme";
|
|
9
|
-
import { FilterField, SortMenu, useListFilter } from "./home-chrome";
|
|
9
|
+
import { FilterField, LayoutNotice, SortMenu, useListFilter } from "./home-chrome";
|
|
10
10
|
import { useHomeModel, type HomeSources } from "./home-data";
|
|
11
11
|
import { useRowMenu } from "./row-actions";
|
|
12
12
|
import { RenameHost } from "./rename";
|
|
@@ -90,11 +90,12 @@ export function inboxSidebarView(sources: HomeSources, openOverseerHome: () => v
|
|
|
90
90
|
keys={{ mode: "focus", onOpen: onSelect }}
|
|
91
91
|
// The open chat's row wears Paseo's own selected-item fill, so it reads like a selected native item.
|
|
92
92
|
selectedBg={sidebarSelected(c)}
|
|
93
|
-
// One row
|
|
93
|
+
// One control row: the filter takes the width, the sort is an icon. A layout hint may sit below. zIndex keeps the
|
|
94
94
|
// sort menu above the list on web, where every View is its own stacking context.
|
|
95
|
-
top={<View style={{ zIndex: 10,
|
|
96
|
-
<FilterField theme={view.theme} filter={filter} dense={touch} />
|
|
97
|
-
<SortMenu theme={view.theme} mode={full.sort} onChange={sources.extras.setSort} rankedAt={full.rankedAt} touch={touch} compact rank={rank} onRerank={sources.extras.rankNow}
|
|
95
|
+
top={<View style={{ zIndex: 10, paddingHorizontal: touch ? 12 : 8, paddingVertical: touch ? 8 : 6, borderBottomWidth: 1, borderBottomColor: c.border }}>
|
|
96
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: touch ? 8 : 4 }}><FilterField theme={view.theme} filter={filter} dense={touch} />
|
|
97
|
+
<SortMenu theme={view.theme} mode={full.sort} onChange={sources.extras.setSort} rankedAt={full.rankedAt} touch={touch} compact rank={rank} onRerank={sources.extras.rankNow} /></View>
|
|
98
|
+
<LayoutNotice theme={view.theme} query={filter.layoutHint} dense={touch} />
|
|
98
99
|
</View>}
|
|
99
100
|
footer={filter.hits && !touch ? <Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 8, paddingTop: 10, paddingBottom: 32 }}>Filtering this list · Esc clears</Text> : undefined} />
|
|
100
101
|
<View style={{ position: "absolute", left: 8, right: 8, bottom: 8 }}><UndoBar store={sources.inbox} theme={view.theme} touch={touch} /></View>
|
package/client/stacks.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { View } from "react-native";
|
|
|
2
2
|
import { Pressable, Text } from "./text";
|
|
3
3
|
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import type { Pr, Workspace } from "../shared/model";
|
|
5
|
-
import { compactPrStatus, orderedStacks, settledForDisplay } from "../shared/presentation";
|
|
5
|
+
import { compactPrStatus, githubWaitLine, orderedStacks, settledForDisplay } from "../shared/presentation";
|
|
6
6
|
import { mergeQueued, prTone, stackOrder } from "../shared/attention";
|
|
7
7
|
import { reviewersMissing } from "../shared/pr-workflow";
|
|
8
8
|
import { isGithubFlow } from "../shared/pr-actions";
|
|
@@ -123,6 +123,7 @@ export function StacksCard({ workspace: w, theme, compact, open, toggle, onOpen,
|
|
|
123
123
|
const showRepo = new Set(w.prs.map(p => p.repo)).size > 1;
|
|
124
124
|
const openCount = w.prs.filter(p => p.snapshot?.state === "OPEN").length;
|
|
125
125
|
const inFlight = w.prActions.filter(a => a.state === "sending");
|
|
126
|
+
const wait = githubWaitLine(w, Date.now());
|
|
126
127
|
const settledOpen = open("settled");
|
|
127
128
|
const settledPrs = settled.reduce((n, s) => n + s.prs.length, 0);
|
|
128
129
|
// Every PR in the order the card draws them, settled stacks included: the search's "n of N" and its filter.
|
|
@@ -135,6 +136,13 @@ export function StacksCard({ workspace: w, theme, compact, open, toggle, onOpen,
|
|
|
135
136
|
<View style={{ paddingTop: 3 }}><Spinner color={c.accent} size={12} /></View>
|
|
136
137
|
<RichText style={[t.meta, { flex: 1, color: c.foreground }]}>{a.result || (isGithubFlow(w.prs.find(p => p.key === a.prs[0])?.snapshot) ? "Sending to GitHub…" : "Submitting to Graphite…")}</RichText>
|
|
137
138
|
</View>)}
|
|
139
|
+
{!hits && wait && <View accessible accessibilityLabel={wait.label} style={{ flexDirection: "row", gap: 8, paddingHorizontal: 12, paddingVertical: 8, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
140
|
+
<View style={{ paddingTop: 2 }}><Icon name="CirclePause" size={13} color={c.foregroundMuted} /></View>
|
|
141
|
+
<View style={{ flex: 1, gap: 2 }}>
|
|
142
|
+
<Text style={[t.meta, { color: c.foreground, fontVariant: ["tabular-nums"] }]}>{wait.title}</Text>
|
|
143
|
+
<Text style={t.meta}>{wait.detail}</Text>
|
|
144
|
+
</View>
|
|
145
|
+
</View>}
|
|
138
146
|
{!hits && <HeldMerges workspace={w} theme={theme} compact={compact} framed />}
|
|
139
147
|
{!hits && !w.prs.length && <View style={{ paddingHorizontal: 12, paddingVertical: 10, borderTopWidth: 1, borderTopColor: c.border, gap: 4 }}>
|
|
140
148
|
<Text style={t.body}>No PRs yet</Text>
|
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
|
-
...(
|
|
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.
|
|
4
|
+
"version": "2.3.0-beta.3",
|
|
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",
|
package/server/agent-actions.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { searchRows } from "../shared/search";
|
|
1
2
|
import { sendingOf } from "../shared/sending";
|
|
2
3
|
import { agentActor, type Actor } from "../shared/actor";
|
|
3
4
|
import { conditionId, noProgressSends } from "../shared/send-decision";
|
|
@@ -47,7 +48,7 @@ export function rowPrs(state: State, r: InboxRow, now: number): PrLink[] {
|
|
|
47
48
|
return [...out.values()];
|
|
48
49
|
}
|
|
49
50
|
|
|
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
|
+
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
52
|
export type AgentTool = typeof AGENT_TOOLS[number];
|
|
52
53
|
/** Tools that only read. */
|
|
53
54
|
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)];
|
|
@@ -363,7 +364,10 @@ export class AgentActions {
|
|
|
363
364
|
|
|
364
365
|
private async listPrs(args: { workspace?: string; needs_reviewers?: boolean; ready_to_merge?: boolean; include_closed?: boolean }) {
|
|
365
366
|
const state = await this.d.store.snapshot();
|
|
366
|
-
const
|
|
367
|
+
const tracked = this.tracked(state);
|
|
368
|
+
// Stable ids remain exact identities. Text queries share Home's layout-aware matcher.
|
|
369
|
+
const exact = tracked.find(w => w.id === args.workspace);
|
|
370
|
+
const workspaces = exact ? [exact] : searchRows(tracked, w => [{ field: "name", text: w.title }], args.workspace ?? "");
|
|
367
371
|
if (args.workspace && !workspaces.length) throw new Error(`No tracked workspace matches ${args.workspace}.`);
|
|
368
372
|
const prs = workspaces.flatMap(w => w.prs.map(p => prRow(w, p)))
|
|
369
373
|
.filter(r => args.include_closed || !["MERGED", "CLOSED"].includes(r.state))
|
package/server/agent-hook.mjs
CHANGED
|
@@ -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; }
|
package/server/agent-parity.ts
CHANGED
|
@@ -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
|
|
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
|
+
}
|