paseo-follow-up 2.4.0-beta.5 → 2.4.0-beta.7
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 +19 -8
- package/client/catch-up.tsx +6 -0
- package/client/header.tsx +6 -1
- package/client/home-chrome.tsx +10 -0
- package/client/home-data.ts +2 -1
- package/client/home-list.tsx +6 -4
- package/client/home-view.ts +7 -2
- package/client/home.tsx +7 -2
- package/client/needs-you.tsx +42 -18
- package/client/panel.tsx +1 -1
- package/client/reviewers-button.tsx +114 -0
- package/client/why-it-matters.tsx +194 -0
- package/index.server.ts +32 -6
- package/package.json +2 -1
- package/server/agent-actions.ts +10 -3
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +6 -1
- package/server/compass.ts +56 -0
- package/server/engine.ts +8 -2
- package/server/hook-source.ts +1 -1
- package/server/inbox.ts +6 -1
- package/server/mcp-source.ts +4 -2
- package/server/mcp.mjs +4 -2
- package/server/tasks.ts +11 -3
- package/shared/activity.ts +20 -1
- package/shared/attention.ts +18 -3
- package/shared/chat.ts +1 -1
- package/shared/compass.ts +88 -2
- package/shared/contracts.ts +11 -3
- package/shared/headline.ts +3 -0
- package/shared/home.ts +13 -3
- package/shared/inbox.ts +29 -1
- package/shared/keep-in-place.ts +22 -0
- package/shared/model.ts +6 -0
- package/shared/reviewers-click.ts +59 -0
- package/shared/send-decision.ts +14 -0
- package/shared/status-invariants.ts +43 -2
package/client/brief.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { deliveryStatus } from "../shared/queue";
|
|
|
8
8
|
import { Icon, TextInput, copyText, useToast } from "@getpaseo/plugin/client/ui";
|
|
9
9
|
import { BRIEF_KIND, briefCardAsk, BRIEF_VERSION, askedDecisions, cardPicks, notedCount, pickedCount, briefSchema, collapsedLine, outcomeLabel, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
10
10
|
import { needsYou } from "../shared/attention";
|
|
11
|
-
import { age } from "../shared/inbox";
|
|
11
|
+
import { age, briefOutlived } from "../shared/inbox";
|
|
12
12
|
import { noReviewReposVersion, onNoReviewRepos } from "../shared/pr-workflow";
|
|
13
13
|
import { briefKey, HEADLINE_WORD } from "../shared/headline";
|
|
14
14
|
/** The card's kind word comes from the same table as the pill and the Needs-you row. */
|
|
@@ -23,6 +23,7 @@ import { useDetailGate, useWorkspace } from "./workspace-data";
|
|
|
23
23
|
import { SubmitScope, focusRing, submitHint, text, useNow } from "./kit";
|
|
24
24
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
25
25
|
import { useMergeButtons } from "./merge-button";
|
|
26
|
+
import { useReviewerButtons } from "./reviewers-button";
|
|
26
27
|
import { prLinksByNumber } from "../shared/presentation";
|
|
27
28
|
import { cardStore } from "./card-store";
|
|
28
29
|
import { PrSheet } from "./pr-sheet";
|
|
@@ -41,7 +42,7 @@ export type BriefDeps = {
|
|
|
41
42
|
/** The workspace's list form (shared/list.ts); the PR sheet reads the full one itself. */
|
|
42
43
|
workspace(id: string): ListWorkspace | undefined;
|
|
43
44
|
/** The agent's Needs-you inbox row, so a card knows whether its brief is an ask (briefAsks). */
|
|
44
|
-
row?(agentId: string): { needs?: unknown } | null;
|
|
45
|
+
row?(agentId: string): { needs?: unknown; status?: string; turnStartedAt?: string | null } | null;
|
|
45
46
|
/** Opens Follow-up's panel for a workspace whose record this client hasn't loaded yet. */
|
|
46
47
|
openPanel(workspaceId: string): void;
|
|
47
48
|
/** Done's Undo window, so the composer pill says Done (and its Undo cancels the same toast) until it ends. */
|
|
@@ -381,11 +382,14 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
381
382
|
const live = useQuery({ queryKey: liveBriefKey(agentId), queryFn: () => readBrief({ agentId }), enabled: row.state === "open" && !!agentId, refetchInterval: LIVE_BRIEF_POLL_MS, staleTime: 5_000 });
|
|
382
383
|
const workspace = row.workspaceId ? deps.workspace(row.workspaceId) : undefined;
|
|
383
384
|
const merges = useMergeButtons(workspace);
|
|
385
|
+
const asks = useReviewerButtons(workspace);
|
|
384
386
|
const checked = shownBrief(row, live.data, workspace?.questions ?? []);
|
|
385
387
|
// The check itself failed (or there's no agent to ask): don't leave a dead card. The server still validates every
|
|
386
388
|
// action against the stored brief, and a moot refusal reconciles, so acting on the row is safe.
|
|
387
389
|
const unverifiable = live.isError || !agentId;
|
|
388
|
-
const
|
|
390
|
+
const verified = row.state !== "open" ? { brief: row, actionable: false } : unverifiable && checked.brief.state === "open" ? { ...checked, actionable: true } : checked;
|
|
391
|
+
// A running agent's newer turn outlived a finish that asked nothing: it reads as the turn before, not "Finished".
|
|
392
|
+
const shown = agentId && briefOutlived(verified.brief, deps.row?.(agentId)) ? { brief: { ...verified.brief, state: "superseded" as const }, actionable: false } : verified;
|
|
389
393
|
const b = shown.brief;
|
|
390
394
|
// One predicate decides whether the brief's own words draw (briefCardShown, inside briefCardAsk): beside what Needs you
|
|
391
395
|
// holds, a brief without an ask points at it instead (a-brief-without-an-ask-never-sits-beside-needs-you).
|
|
@@ -471,11 +475,18 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
471
475
|
if (id !== null) deps.noteDone?.(agentId, () => { dismissToast(id); setMarked(null); });
|
|
472
476
|
};
|
|
473
477
|
// A merge move reads what its click merges ("Merge 3 PRs"), then "Merging…".
|
|
474
|
-
|
|
475
|
-
|
|
478
|
+
// An add-reviewers move that names whom it asks reads "Add reviewers", "Requesting…", then "Requested"
|
|
479
|
+
// (a-click-on-add-reviewers-asks), and a move that is done stays done.
|
|
480
|
+
const oneClick = (m: BriefMove) => !m.prKey ? null : m.kind === "merge" ? merges.view(m.prKey) : m.kind === "add_reviewers" ? asks.view(m.prKey) : null;
|
|
481
|
+
const moveLabel = (m: BriefMove) => (m.kind === "merge" || m.kind === "add_reviewers" ? oneClick(m)?.label : null) ?? (busy === m.kind ? `${m.label}…` : m.label);
|
|
482
|
+
const moveDone = (m: BriefMove) => { const one = oneClick(m); return !!one && ("done" in one ? one.done : one.submitted); };
|
|
483
|
+
const moveIcon = (m: BriefMove) => moveDone(m) ? "Check" : MOVE_ICON[m.kind];
|
|
484
|
+
const moveOff = (m: BriefMove) => !!busy || !!oneClick(m)?.running || moveDone(m);
|
|
485
|
+
const mergeWhy = b.moves.map(m => oneClick(m)?.why).find(Boolean) ?? null;
|
|
476
486
|
const press = (m: BriefMove) => {
|
|
477
487
|
// Merge is one click (a-click-on-merge-merges); the sheet's confirm only for a PR whose scope can't be known.
|
|
478
|
-
|
|
488
|
+
// Add reviewers is one click too when there is someone to ask; the sheet's picker only when nobody is set.
|
|
489
|
+
const one = oneClick(m);
|
|
479
490
|
if (one) one.run();
|
|
480
491
|
else if ((m.kind === "merge" || m.kind === "add_reviewers") && m.prKey) { if (workspace?.prs.some(p => p.key === m.prKey)) setSheet({ key: m.prKey, intent: m.kind === "merge" ? "merge" : "reviewers" }); else if (b.workspaceId) deps.openPanel(b.workspaceId); }
|
|
481
492
|
else if (m.kind === "open_pr" && m.url) void openExternalUrl(m.url).catch(() => undefined);
|
|
@@ -514,7 +525,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
514
525
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 10, rowGap: 8 }}>
|
|
515
526
|
<RichText numberOfLines={3} tooltip={askText}
|
|
516
527
|
style={{ flexGrow: 1, flexShrink: 1, flexBasis: 200, minWidth: 0, color: acts ? c.foreground : c.foregroundMuted, fontSize: 14, lineHeight: 20, fontWeight: acts ? "600" : "400" }}>{askText}</RichText>
|
|
517
|
-
{!embedded && moves.map(m => <Btn key={m.kind} label={moveLabel(m)} icon={
|
|
528
|
+
{!embedded && moves.map(m => <Btn key={m.kind} label={moveLabel(m)} icon={moveIcon(m)} disabled={moveOff(m)} onPress={() => press(m)} c={c} compact={compact} hint={MOVE_HINT[m.kind]} />)}
|
|
518
529
|
</View>
|
|
519
530
|
{!!error && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
520
531
|
{!!mergeWhy && <Text accessibilityRole="alert" style={{ color: c.statusWarning, fontSize: 13, lineHeight: 18 }}>{mergeWhy}</Text>}
|
|
@@ -583,7 +594,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
583
594
|
{multi && <SendBar b={b} picks={sendable} noted={notedCount(sendable, openNotes)} busy={busy} error={error} onSend={sendAll} c={c} compact={compact} />}
|
|
584
595
|
|
|
585
596
|
{!embedded && moves.length > 0 && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, columnGap: 14 }}>
|
|
586
|
-
{moves.map((m, i) => <Btn key={m.kind} shortcut={m === doneMove} label={moveLabel(m)} icon={
|
|
597
|
+
{moves.map((m, i) => <Btn key={m.kind} shortcut={m === doneMove} label={moveLabel(m)} icon={moveIcon(m)} primary={i === 0 && !multi} disabled={moveOff(m)} onPress={() => press(m)} c={c} compact={compact} hint={MOVE_HINT[m.kind]} />)}
|
|
587
598
|
{/* one-done-button: the quiet choices sit beside Done, never above the context, away from it. */}
|
|
588
599
|
{doneQ && !notesOpen[doneQ.id] && !isOther(picks[doneQ.id]) && <NoteLink icon="MessageSquarePlus" label="Add note" a11y="Add a note, sent with Done" disabled={!!busy} onPress={() => noteOpenStore.set(b.id, doneQ.id, "1")} c={c} compact={compact} />}
|
|
589
600
|
{doneQ && !isOther(picks[doneQ.id]) && <NoteLink icon="Reply" label="Reply instead" a11y="Write a reply instead of Done" disabled={!!busy} onPress={() => pickStore.set(b.id, doneQ.id, OTHER)} c={c} compact={compact} />}
|
package/client/catch-up.tsx
CHANGED
|
@@ -365,6 +365,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
365
365
|
const dismiss = useDismiss();
|
|
366
366
|
const openChat = () => { if (!navigation) return; if (s.agentId) navigation.openAgent({ agentId: s.agentId }); else if (s.workspaceId) navigation.openWorkspace({ workspaceId: s.workspaceId }); };
|
|
367
367
|
const word = cardWord(card);
|
|
368
|
+
const compassLine = s.compass ?? (s.priority?.source?.kind === "compass" ? s.priority.reason : null);
|
|
368
369
|
const color = card.item?.kind === "merge" ? mergedColor(c) : card.kind === "finished" ? c.foregroundMuted : c.statusWarning;
|
|
369
370
|
const q = card.kind === "question" ? ws?.questions.find(x => x.id === card.questionId) ?? null : null;
|
|
370
371
|
const nth = sameWorkspace.indexOf(card.key);
|
|
@@ -392,6 +393,11 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
392
393
|
</View>
|
|
393
394
|
{ws && <SummaryLine key={ws.id} workspace={ws} theme={theme} compact={compact} />}
|
|
394
395
|
{full && <ReferencesLine workspace={full} theme={theme} compact={compact} />}
|
|
396
|
+
{/* One muted line of pinned context (docs/compass.md): the note's own words, never a second reason. */}
|
|
397
|
+
{compassLine && <View style={{ flexDirection: "row", alignItems: "center", gap: 5, minWidth: 0 }}>
|
|
398
|
+
<Icon name="Compass" size={12} color={c.foregroundMuted} />
|
|
399
|
+
<Text numberOfLines={1} style={[t.meta, { flex: 1, minWidth: 0, color: c.foregroundMuted }]}>{`Compass · ${compassLine}`}</Text>
|
|
400
|
+
</View>}
|
|
395
401
|
</View>;
|
|
396
402
|
|
|
397
403
|
const goneBanner = gone && <View accessibilityRole="alert" style={{ flexDirection: "row", alignItems: "center", gap: 8, padding: 12, borderRadius: 10, backgroundColor: c.surface1, borderWidth: 1, borderColor: c.border }}>
|
package/client/header.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { VersionMark } from "./updates";
|
|
|
10
10
|
import { IconSwap, Spinner } from "./motion";
|
|
11
11
|
import { segmentPaint, type Colors } from "./theme";
|
|
12
12
|
import { ReferencesLine } from "./linked";
|
|
13
|
+
import { WhyItMatters } from "./why-it-matters";
|
|
13
14
|
import { SummaryLine } from "./about";
|
|
14
15
|
|
|
15
16
|
/** PR status older than this means the poll has stopped working; say so instead of looking current. */
|
|
@@ -56,7 +57,7 @@ function LiveGlyph({ icon, colors }: { icon: LiveIcon; colors: Colors }) {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings, onRefresh, refreshing, onAuto, autoPending, notice, onOpenPr, resize, hideTitle = false, onHome, more }: {
|
|
60
|
+
export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings, onRefresh, refreshing, onAuto, autoPending, notice, onOpenPr, resize, hideTitle = false, onHome, more, openAgent }: {
|
|
60
61
|
workspace: Workspace; theme: Theme; compact: boolean; now: number; onSettings: (category?: SettingsCategory) => void; onRefresh: () => void; refreshing: boolean; onAuto: (next: boolean) => void; autoPending: boolean; notice: string | null; onOpenPr?: (key: string) => void;
|
|
61
62
|
/** Expand to the larger view, or collapse back to the panel. Absent where the panel is already as wide as it gets. */
|
|
62
63
|
resize?: { icon: "Maximize2" | "Minimize2"; label: string; onPress: () => void } | null;
|
|
@@ -66,6 +67,8 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
|
|
|
66
67
|
onHome?: () => void;
|
|
67
68
|
/** The More button (client/panel-menu.tsx), before the gear. */
|
|
68
69
|
more?: ReactNode;
|
|
70
|
+
/** Why it matters' Ask the Overseer opens the Overseer's chat with the draft in it. */
|
|
71
|
+
openAgent?: (agentId: string) => void;
|
|
69
72
|
}) {
|
|
70
73
|
const c = theme.colors; const t = text(c, compact);
|
|
71
74
|
const parts = headline(w, now);
|
|
@@ -112,6 +115,7 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
|
|
|
112
115
|
{/* Spec and Linked: their own line, as on desktop and Home. The 44px bar can't hold them beside Home, the version
|
|
113
116
|
and settings at 390pt without pushing settings off-screen. */}
|
|
114
117
|
<ReferencesLine workspace={w} theme={theme} compact />
|
|
118
|
+
<WhyItMatters workspace={w} theme={theme} compact openAgent={openAgent} />
|
|
115
119
|
<Text accessibilityLiveRegion="polite" style={[t.ask, { color: c.foregroundMuted }]}>
|
|
116
120
|
{parts.map((part, i) => <Text key={part.text} style={toneOf(part.tone) ? { color: toneOf(part.tone) } : { color: c.foreground }}>{i ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{" · "}</Text> : null}{part.text}</Text>)}
|
|
117
121
|
</Text>
|
|
@@ -129,6 +133,7 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
|
|
|
129
133
|
{!compact && !hideTitle && <SummaryLine workspace={w} theme={theme} compact={false} />}
|
|
130
134
|
{/* The references line: Spec and Linked, one line, only when there's a spec or anything linked. */}
|
|
131
135
|
<ReferencesLine workspace={w} theme={theme} compact={compact} />
|
|
136
|
+
<WhyItMatters workspace={w} theme={theme} compact={compact} openAgent={openAgent} />
|
|
132
137
|
<Text accessibilityLiveRegion="polite" style={[t.meta, { color: c.foregroundMuted, marginTop: 2 }]}>
|
|
133
138
|
{parts.map((part, i) => <Text key={part.text} style={toneOf(part.tone) ? { color: toneOf(part.tone), fontWeight: "600" } : { color: c.foreground }}>{i ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{" · "}</Text> : null}{part.text}</Text>)}
|
|
134
139
|
</Text>
|
package/client/home-chrome.tsx
CHANGED
|
@@ -396,7 +396,17 @@ export function AskRow({ ask, theme, active, dense, touch, sending, onPress }: {
|
|
|
396
396
|
}
|
|
397
397
|
|
|
398
398
|
/** The muted reason and source chip a fresh external priority adds to a row. */
|
|
399
|
+
/**
|
|
400
|
+
* The reason line: why a row ranks where it does, with its source. A Compass reason leads with the compass glyph and
|
|
401
|
+
* names Compass after it ("Dana: client call Tue · Compass"); other sources keep their chip.
|
|
402
|
+
*/
|
|
399
403
|
export function PriorityLine({ reason, source, c, size = 12, lines = 1 }: { reason: string; source: { kind: keyof typeof PRIORITY_SOURCE_LABEL; label: string } | null; c: Colors; size?: number; lines?: number }) {
|
|
404
|
+
if (source?.kind === "compass") return <View style={{ flexDirection: "row", alignItems: "center", gap: 5, minWidth: 0 }}>
|
|
405
|
+
<Icon name="Compass" size={size} color={c.foregroundMuted} />
|
|
406
|
+
<Text numberOfLines={lines} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: size }}>
|
|
407
|
+
<Text style={{ fontStyle: "italic" }}>{reason}</Text>{" · Compass"}
|
|
408
|
+
</Text>
|
|
409
|
+
</View>;
|
|
400
410
|
return <View style={{ flexDirection: "row", alignItems: "center", gap: 6, minWidth: 0 }}>
|
|
401
411
|
{source && <View style={{ paddingHorizontal: 5, height: 16, justifyContent: "center", borderRadius: 3, backgroundColor: c.surface2 }}>
|
|
402
412
|
<Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 10, lineHeight: 13 }}>{PRIORITY_SOURCE_LABEL[source.kind]}</Text>
|
package/client/home-data.ts
CHANGED
|
@@ -87,7 +87,8 @@ export function useHomeModel(sources: HomeSources): HomeModel {
|
|
|
87
87
|
// Decision Q8: the raised Linear issues count in Needs you, the worker's one number (home feed), so Home's header,
|
|
88
88
|
// strip and brief line and the sidebar badge (client/live.tsx) agree (invariant raised-is-needs-you).
|
|
89
89
|
const raised = useSyncExternalStore(extras.subscribe, () => extras.queue().raised.length, () => 0);
|
|
90
|
-
|
|
90
|
+
const compass = useSyncExternalStore(extras.subscribe, extras.compass, extras.compass);
|
|
91
|
+
return useMemo(() => buildHome({ rows: inbox.rows(), tracked: live.all(), paseo: paseo.all(), now: Date.now(), sort, priorities, hidden: overseer ? [overseer] : [], hold, compass, raised }), [a, b, c, now, sort, priorities, inbox, live, paseo, overseer, hold, raised, compass]);
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
/** Rebuilds a value at most every `ms` while mounted (used for the brief pane's source ages). */
|
package/client/home-list.tsx
CHANGED
|
@@ -346,6 +346,8 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
|
|
|
346
346
|
const title = <>{marks(s.title, hit?.titleRanges, c)}{s.agent ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{" › "}{marks(s.agent, hit?.agentRanges, c)}</Text> : null}</>;
|
|
347
347
|
// Phones: "Working" under every row of a "Running 9" group says nothing the header didn't; one line per row instead.
|
|
348
348
|
const generic = touch && !s.word && s.line === "Working";
|
|
349
|
+
// The reason line: AI priority's, else the workspace's first live Compass note (a live note is a reason).
|
|
350
|
+
const why = s.priority?.reason ? { reason: s.priority.reason, source: s.priority.source } : s.compass ? { reason: s.compass, source: { kind: "compass" as const, label: "Compass" } } : null;
|
|
349
351
|
// Send now: outlined (filled is only for what waits on the developer), and only where the server would take it.
|
|
350
352
|
const sendNow = s.sendNow && onSendNow && !dense ? <SendNowButton s={s} theme={theme} touch={touch} onSendNow={onSendNow} /> : null;
|
|
351
353
|
// A Later row says when it comes back on screen; the label also keeps how long it has waited.
|
|
@@ -373,7 +375,7 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
|
|
|
373
375
|
: (!!s.word || !!s.line) && !generic && <Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>
|
|
374
376
|
{s.word && s.group === "needs" ? <Text style={{ color, fontWeight: "600" }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
375
377
|
</Text>}
|
|
376
|
-
{!!
|
|
378
|
+
{!!why && <PriorityLine reason={why.reason} source={why.source} c={c} size={12} lines={2} />}
|
|
377
379
|
{!!s.pr && <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"], ...(older ? { opacity: 0.6 } : {}) }}><PrSummaryText s={s} c={c} /></Text>}
|
|
378
380
|
{sendNow && <View style={{ flexDirection: "row", marginTop: 6 }}>{sendNow}</View>}
|
|
379
381
|
</View> : dense ? <View style={{ flex: 1, minWidth: 0, gap: 1 }}>
|
|
@@ -382,11 +384,11 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
|
|
|
382
384
|
: (!!s.word || !!s.line) && <Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>
|
|
383
385
|
{s.word && s.group === "needs" ? <Text style={{ color, fontWeight: "600" }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
384
386
|
</Text>}
|
|
385
|
-
{!!
|
|
387
|
+
{!!why && <PriorityLine reason={why.reason} source={why.source} c={c} size={11} lines={2} />}
|
|
386
388
|
{touch && (s.pr || s.badges.length > 0) && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6, marginTop: 4 }}>
|
|
387
389
|
{s.badges.map(b => <BadgeView key={b.text} b={b} c={c} />)}<PrChipView s={s} c={c} />
|
|
388
390
|
</View>}
|
|
389
|
-
</View> : <View style={{ flex: 1, minWidth: 0, gap: 1, paddingVertical:
|
|
391
|
+
</View> : <View style={{ flex: 1, minWidth: 0, gap: 1, paddingVertical: why ? 4 : 0 }}><View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
390
392
|
{/* The title keeps its width (up to 55 %) and the chips yield; only beside Send now, which can't, does it shrink. */}
|
|
391
393
|
<Text numberOfLines={1} style={{ flexShrink: sendNow ? 1 : 0, minWidth: 0, maxWidth: "55%", color: muted ? c.foregroundMuted : c.foreground, fontSize: 13, fontWeight: muted ? "400" : "500" }}>{title}</Text>
|
|
392
394
|
{/* A Needs-you row's word (Permission, Question…) is why it's there: it keeps its place, the chips yield first. */}
|
|
@@ -398,7 +400,7 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
|
|
|
398
400
|
</Text>
|
|
399
401
|
<ChipRail s={s} c={c} dim={older} />
|
|
400
402
|
{sendNow}
|
|
401
|
-
</View>{!!
|
|
403
|
+
</View>{!!why && <View style={{ paddingRight: 40 }}><PriorityLine reason={why.reason} source={why.source} c={c} /></View>}</View>}
|
|
402
404
|
{!touch && <RowTime s={s} c={c} size={dense ? 11 : 12} />}
|
|
403
405
|
</Pressable>;
|
|
404
406
|
}, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect && a.onMenu === b.onMenu && a.menuOpen === b.menuOpen && a.hit === b.hit && a.onSendNow === b.onSendNow && a.selectedBg === b.selectedBg);
|
package/client/home-view.ts
CHANGED
|
@@ -59,6 +59,9 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
59
59
|
* feed (on 0.15, carried by the priorities poll). Home's model, the sidebar badge and the brief pane all read it.
|
|
60
60
|
*/
|
|
61
61
|
let queue: QueueNeeds = NO_QUEUE;
|
|
62
|
+
/** Each workspace's first live Compass note as one line (Home rows, Catch up), from the worker with the priorities. */
|
|
63
|
+
let compass: Record<string, string> = {};
|
|
64
|
+
const setCompass = (next: Record<string, string> | undefined) => { if (!next || JSON.stringify(next) === JSON.stringify(compass)) return false; compass = next; return true; };
|
|
62
65
|
const setQueue = (next: QueueNeeds | undefined) => { if (!next || JSON.stringify(next) === JSON.stringify(queue)) return false; queue = next; return true; };
|
|
63
66
|
const setContext = (next: ContextRequest[]) => { if (JSON.stringify(next) === JSON.stringify(context)) return false; context = next; return true; };
|
|
64
67
|
const readContext = async () => setContext((await client.rpc(contextListRpc, {})).requests);
|
|
@@ -105,7 +108,7 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
105
108
|
const pollHome = () => together([
|
|
106
109
|
poll(PRIORITY_POLL_MS, async () => {
|
|
107
110
|
const answer = await client.rpc(prioritiesRpc, {});
|
|
108
|
-
const queued = setQueue(answer.queue);
|
|
111
|
+
const queued = setCompass(answer.compass) || setQueue(answer.queue);
|
|
109
112
|
if (JSON.stringify(answer.items) === JSON.stringify(priorities)) return queued;
|
|
110
113
|
priorities = answer.items; return true;
|
|
111
114
|
}),
|
|
@@ -137,7 +140,7 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
137
140
|
if (event.context) setContext(event.context);
|
|
138
141
|
if (event.dispatches) dispatches = event.dispatches;
|
|
139
142
|
if (event.prStats !== undefined) prStatsOn = event.prStats;
|
|
140
|
-
setQueue(event.queue);
|
|
143
|
+
setQueue(event.queue); setCompass(event.compass);
|
|
141
144
|
if (event.usage) usage = { ...event.usage, resources: usage.resources };
|
|
142
145
|
if (!event.rank.running) { for (const done of rankWaiters) done(); rankWaiters.clear(); }
|
|
143
146
|
// Smart Session's files can't be watched: read the meters once a minute instead.
|
|
@@ -270,6 +273,8 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
270
273
|
prStatsOn: () => prStatsOn,
|
|
271
274
|
/** The raised Linear issues in Needs you and the queue's revision (Q8), from the worker. */
|
|
272
275
|
queue: () => queue,
|
|
276
|
+
/** Each workspace's first live Compass note as one line. */
|
|
277
|
+
compass: () => compass,
|
|
273
278
|
/** A dismissal on a 0.15 host (or with the feed down): read the answer once now; the feed pushes it itself. */
|
|
274
279
|
refreshQueue: () => { if (home && !homePolls) return; void client.rpc(prioritiesRpc, {}).then(a => { if (!stopped && setQueue(a.queue)) emit(); }).catch(() => undefined); },
|
|
275
280
|
/** Reads the asks once (Catch up opening or moving on, so a 0.15 host or a dropped feed is never stale for long). */
|
package/client/home.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import { prLinksByNumber } from "../shared/presentation";
|
|
|
19
19
|
import { BriefCard, type BriefDeps } from "./brief";
|
|
20
20
|
import { SummaryLine } from "./about";
|
|
21
21
|
import { ReferencesLine } from "./linked";
|
|
22
|
+
import { WhyItMatters } from "./why-it-matters";
|
|
22
23
|
import { bottomGap, bottomInset, Button, focusSoon, IconButton, space, text, type Theme } from "./kit";
|
|
23
24
|
import { DispatchRows, NewHost, openNew, useNewOpen } from "./new";
|
|
24
25
|
import { QueueScreen, RaisedRows, SinceBlock } from "./brief-since";
|
|
@@ -261,7 +262,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
261
262
|
const detail = selected === OVERSEER_KEY && overseer
|
|
262
263
|
? <OverseerPane theme={theme} compact={compact} o={overseer} focus={replyFocus} pending={pendingAsk} agentId={overseerStatus?.agentId ?? null} model={overseerStatus?.model ?? null} restartWith={overseerStatus?.restartWith ?? null} configured={overseerStatus?.configured ?? null} deps={deps} navigation={navigation} onBack={compact && !route ? () => setSelected(null) : undefined} />
|
|
263
264
|
: current
|
|
264
|
-
? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} ask={ask?.key === current.key ? ask : null} onBack={compact && !route ? () => setSelected(null) : undefined} />
|
|
265
|
+
? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} ask={ask?.key === current.key ? ask : null} onBack={compact && !route ? () => setSelected(null) : undefined} openAgent={navigation ? agentId => navigation.openAgent({ agentId }) : undefined} />
|
|
265
266
|
: <BriefPane theme={theme} compact={compact} pane={pane} catchUp={deps.openCatchUp} deckSize={deckSize} onSelect={key => route ? route(key) : setSelected(key)} openLog={deps.openLog} sources={deps.sources}
|
|
266
267
|
queue={deps.openQueue ? <SinceBlock theme={theme} compact={compact} openQueue={deps.openQueue} onStarted={() => deps.sources.extras.refreshDispatches()} navigation={navigation} raised={raisedKeys} revision={queue.revision} /> : null} />;
|
|
267
268
|
// Nothing followed at all: no sort, no meters, just the empty state and its action.
|
|
@@ -480,9 +481,11 @@ function DetailSendNow({ s, theme, compact, deps }: { s: Workstream; theme: Them
|
|
|
480
481
|
</View>;
|
|
481
482
|
}
|
|
482
483
|
|
|
483
|
-
function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask, onBack }: {
|
|
484
|
+
function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask, onBack, openAgent }: {
|
|
484
485
|
s: Workstream; model: HomeModel; theme: Theme; compact: boolean; deps: HomeDeps;
|
|
485
486
|
openFull: (s: Workstream) => void; signOffNext: (s: Workstream) => void; onBack?: () => void;
|
|
487
|
+
/** Why it matters' Ask the Overseer opens the Overseer's chat with the draft in it. */
|
|
488
|
+
openAgent?: (agentId: string) => void;
|
|
486
489
|
/** The row menu's Answer: open this question's card (n changes on every pick, so the same question reopens). */
|
|
487
490
|
ask?: { id: string; n: number } | null;
|
|
488
491
|
}) {
|
|
@@ -553,6 +556,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
553
556
|
{/* The Summary: what this workspace is for, right under its name. */}
|
|
554
557
|
{!writing && s.workspaceId && w && <View style={{ marginTop: 4 }}><SummaryLine key={s.workspaceId} workspace={w} theme={theme} compact /></View>}
|
|
555
558
|
{!writing && s.workspaceId && w && <View style={{ marginTop: 6 }}><ReferencesLine key={`refs:${s.workspaceId}`} workspace={w} theme={theme} compact /></View>}
|
|
559
|
+
{!writing && s.workspaceId && w && <View style={{ marginTop: 6 }}><WhyItMatters key={`why:${s.workspaceId}`} workspace={w} theme={theme} compact openAgent={openAgent} /></View>}
|
|
556
560
|
{!writing && <View style={{ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 44 }}>
|
|
557
561
|
<Icon name={s.icon} size={14} color={color} />
|
|
558
562
|
{/* Read as one line, with the PR summary in words: a nested Text can't carry its own label. */}
|
|
@@ -572,6 +576,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
572
576
|
</View>
|
|
573
577
|
{s.workspaceId && w && <SummaryLine key={s.workspaceId} workspace={w} theme={theme} compact={false} />}
|
|
574
578
|
{s.workspaceId && w && <ReferencesLine key={`refs:${s.workspaceId}`} workspace={w} theme={theme} compact={false} />}
|
|
579
|
+
{s.workspaceId && w && <WhyItMatters key={`why:${s.workspaceId}`} workspace={w} theme={theme} compact={false} openAgent={openAgent} />}
|
|
575
580
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
|
|
576
581
|
{!!s.word && <Text style={{ color, fontSize: 12, fontWeight: "600" }}>{s.word}</Text>}
|
|
577
582
|
<Text style={t.meta}>{[laterText, s.at ? age(s.at, Date.now()) === "now" ? "just now" : `${age(s.at, Date.now())} ago` : "", s.project].filter(Boolean).join(" · ")}</Text>
|
package/client/needs-you.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { FINISH_ASK } from "../shared/status";
|
|
|
3
3
|
import { View, type StyleProp, type ViewStyle } from "react-native";
|
|
4
4
|
import { Pressable, Text } from "./text";
|
|
5
5
|
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
6
|
-
import { useRpc } from "@getpaseo/plugin/client";
|
|
6
|
+
import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
|
|
7
7
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
8
8
|
import { answerQuestionRpc, checkPrActionRpc, controlRpc, queueActionRpc, sendRpc } from "../shared/contracts";
|
|
9
9
|
import { agentName, needsYou, workspaceSnoozed, type NeedItem } from "../shared/attention";
|
|
@@ -26,6 +26,7 @@ import { DismissX, RevealScope, useDismiss } from "./dismiss";
|
|
|
26
26
|
import { overviewKey, workspaceKey } from "./keys";
|
|
27
27
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
28
28
|
import { useMergeButtons } from "./merge-button";
|
|
29
|
+
import { reviewerClick, useHeldNeeds, useReviewerButtons } from "./reviewers-button";
|
|
29
30
|
import { mergeScope } from "../shared/merge-click";
|
|
30
31
|
import { prLinksByNumber } from "../shared/presentation";
|
|
31
32
|
import { deliveryStatus } from "../shared/queue";
|
|
@@ -99,7 +100,11 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
99
100
|
const queueAct = useMutation({ mutationFn: (input: { itemId: string; action: "retry" | "cancel" }) => queueAction(input),
|
|
100
101
|
onSuccess: (_r, input) => { toast.show(input.action === "retry" ? "Sending it again" : "Cancelled; it won't be sent", { variant: "info" }); refresh(); actions.after?.(); }, onError: fail });
|
|
101
102
|
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 });
|
|
102
|
-
const
|
|
103
|
+
const reviewerControl = useReviewerButtons(w);
|
|
104
|
+
// a-clicked-row-holds-its-place: a row clicked here keeps its spot (with its outcome) after the next read drops it,
|
|
105
|
+
// so a run of clicks down the list lands on the rows aimed at. A surface passing `rows` held them itself (the block).
|
|
106
|
+
const held = useHeldNeeds(w.id, rows ? [] : needsYou(w, now));
|
|
107
|
+
const items = rows ?? held;
|
|
103
108
|
const mergeControl = useMergeButtons(w);
|
|
104
109
|
const dismiss = useDismiss();
|
|
105
110
|
if (!items.length) return null;
|
|
@@ -119,7 +124,11 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
119
124
|
{openMain && <Button theme={theme} compact={compact} icon="MessageSquare" title="Open agent" accessibilityLabel="Open main agent" onPress={openMain} />}
|
|
120
125
|
</>;
|
|
121
126
|
// The agent said only a person can move it: ask the reviewer again (the PR sheet's reviewers), or hand it back.
|
|
122
|
-
|
|
127
|
+
// Only a part of it (one thread waits on the reviewer's call): the developer's first move is to read that part on the PR.
|
|
128
|
+
case "person": if (item.part) return item.pr
|
|
129
|
+
? <Button theme={theme} compact={compact} icon="ExternalLink" title={`Open #${item.pr.number}`} accessibilityLabel={`Open #${item.pr.number} to see ${item.detail || item.title}`} accessibilityHint="Opens in your browser" onPress={() => void openExternalUrl(item.pr!.url).catch(() => undefined)} />
|
|
130
|
+
: null;
|
|
131
|
+
return item.review && item.prKey && actions.openPr
|
|
123
132
|
? <Button theme={theme} compact={compact} icon="UserPlus" title="Ask for re-review" accessibilityLabel={`Ask for a re-review: ${item.title}`} onPress={() => actions.openPr!(item.prKey!, "reviewers")} />
|
|
124
133
|
: null;
|
|
125
134
|
case "check": return <Button theme={theme} compact={compact} icon="RefreshCw" title="Check state" loading={inspect.isPending} disabled={busy} onPress={() => inspect.mutate(item.actionId)} />;
|
|
@@ -141,45 +150,52 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
141
150
|
case "send": return <Button theme={theme} compact={compact} kind="primary" icon="Send" title={item.finish ? "Ask to finish" : sendButton(item.what)} accessibilityLabel={item.finish ? `Ask to finish: ${FINISH_ASK}` : `Send ${item.what} to ${agentName(w)}`} accessibilityHint={item.blocker ?? undefined} loading={deliver.isPending} disabled={busy || !!item.blocker} onPress={() => deliver.mutate(item.batchId)} />;
|
|
142
151
|
// One click merges what the button names (a-click-on-merge-merges); the sheet's confirm only when the scope can't be known.
|
|
143
152
|
case "merge": return mergeControl(item.prKey, { theme, compact, fallback: actions.openPr ? () => actions.openPr!(item.prKey, "merge") : undefined }).button;
|
|
144
|
-
|
|
153
|
+
// One click asks the people the row names (a-click-on-add-reviewers-asks); the sheet's picker only when nobody is set.
|
|
154
|
+
case "reviewers": return reviewerControl(item.prKey, { theme, compact, after: actions.after, fallback: actions.openPr ? () => actions.openPr!(item.prKey, "reviewers") : undefined })?.button ?? null;
|
|
145
155
|
}
|
|
146
156
|
};
|
|
147
157
|
// A second, quieter action after the primary and its PR link, so the link never wraps onto a line of its own.
|
|
148
158
|
const secondary = (item: NeedItem) => item.kind === "person"
|
|
149
|
-
? <Button theme={theme} compact={compact} kind="ghost" icon="RotateCcw" title="
|
|
159
|
+
? <Button theme={theme} compact={compact} kind="ghost" icon="RotateCcw" title={compact ? "Hand back" : "Hand back to agent"} accessibilityLabel={`Hand it back to ${agentName(w)}: ${item.title}`} loading={retryTask.isPending} disabled={busy} onPress={() => retryTask.mutate(item.taskKey)} />
|
|
150
160
|
: null;
|
|
151
161
|
return <PrLinksProvider prs={prLinksByNumber(w.prs)}><View>
|
|
152
162
|
{items.map((item, index) => {
|
|
153
163
|
const g = glyph(item, c);
|
|
154
164
|
// A row about one PR opens it in one click, beside its action and never instead of it.
|
|
155
|
-
|
|
165
|
+
// A person part's own action is Open #N, so it doesn't draw the link a second time.
|
|
166
|
+
let link = item.pr ? <PrLinkButton link={item.pr} theme={theme} compact={compact} /> : null;
|
|
167
|
+
if (item.kind === "person" && item.part && item.pr) link = null;
|
|
156
168
|
const act = action(item);
|
|
157
169
|
// A stack's Merge names its scope on the row ("Merges #1628, #1629, then #1630"); a click-time blocker shows here too.
|
|
158
170
|
const merging = item.kind === "merge" ? mergeControl(item.prKey, { theme, compact }) : null;
|
|
159
171
|
const scopeLine = item.kind === "merge" ? mergeScope(w, item.prKey)?.detail ?? null : null;
|
|
160
172
|
const notice = merging?.notice ?? null;
|
|
173
|
+
// A reviewers row's why-not sits in its own text column on phones too, so the row never changes layout under the next tap.
|
|
174
|
+
const asked = item.kind === "reviewers" ? reviewerControl(item.prKey, { theme, compact })?.notice ?? null : null;
|
|
161
175
|
// The action and its link are one group, so the link never wraps under the button (a long "Add reviewers").
|
|
162
176
|
const pair = act && link ? <View style={{ flexDirection: "row", alignItems: "center", gap: 4, flexShrink: 0 }}>{act}{link}</View> : null;
|
|
163
177
|
const more = secondary(item);
|
|
164
178
|
const button = act || link || more ? <>{pair ?? <>{act}{link}</>}{more}</> : null;
|
|
165
179
|
const said = !!untitled?.has(item.key);
|
|
180
|
+
// A reviewers row whose request went out reads as a receipt: muted title, nothing left to remove.
|
|
181
|
+
const receipt = item.kind === "reviewers" && reviewerClick(w.id, item.prKey)?.outcome?.state === "submitted";
|
|
182
|
+
const titleStyle = (base: object) => receipt ? [base, { color: c.foregroundMuted }] : base;
|
|
166
183
|
// The small x, top right, on every kind (dismissing-anything-in-needs-you-sends-the-agent-nothing).
|
|
167
|
-
const x = <DismissX theme={theme} compact={compact} label={`Remove ${item.kind === "question" ? item.questionId : item.title}`}
|
|
184
|
+
const x = receipt ? null : <DismissX theme={theme} compact={compact} label={`Remove ${item.kind === "question" ? item.questionId : item.title}`}
|
|
168
185
|
onPress={() => dismiss({ workspaceId: w.id, key: item.key }, { onDismissed: actions.after })} />;
|
|
169
186
|
// Phones: the action sits at the row's right edge so rows never grow a second line of controls. A send batch
|
|
170
187
|
// (the primary, with its task list) and Retry's pair keep their buttons full width under the row.
|
|
171
188
|
// A stack's scope line and a blocker need the row's full width, so those rows put their button under the text.
|
|
172
|
-
|
|
189
|
+
// So does a reviewers row: its one click asks the people its title names, so the title shows them in full.
|
|
190
|
+
const inline = compact && button && item.kind !== "send" && !(item.kind === "retry" && !item.exhausted) && item.kind !== "person" && item.kind !== "reviewers" && !scopeLine && !notice;
|
|
173
191
|
if (inline) return <CardRow key={item.key} theme={theme} compact first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
174
192
|
<RevealScope style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
175
|
-
{
|
|
176
|
-
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start", paddingTop: 2 } : undefined}><Icon name={g.name} size={16} color={g.color} /></View>
|
|
193
|
+
<View><Icon name={g.name} size={16} color={g.color} /></View>
|
|
177
194
|
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
178
|
-
{!said && <RichText numberOfLines={2} style={t.label}>{item.title}</RichText>}
|
|
195
|
+
{!said && <RichText numberOfLines={2} style={titleStyle(t.label)}>{item.title}</RichText>}
|
|
179
196
|
{"detail" in item && !!item.detail && !sameText(item.detail, item.title.replace(/^Q\d+ · /, "")) && <RichText linkColor={c.foreground} numberOfLines={item.kind === "answer" || item.kind === "message" ? 3 : 1} style={t.meta}>{item.detail}</RichText>}
|
|
180
|
-
{item.kind === "reviewers" && <NoReviewLink repo={item.prKey.split("#")[0]} theme={theme} compact />}
|
|
181
197
|
</View>
|
|
182
|
-
<View
|
|
198
|
+
<View>{pair ?? button}</View>
|
|
183
199
|
{/* Top right, a step away from the action so a thumb aimed at it doesn't land here. */}
|
|
184
200
|
{/* Flush (Catch up's bordered card): no pull to the edge, so the armed Dismiss pill keeps clear of the border. */}
|
|
185
201
|
<View style={{ alignSelf: "flex-start", marginTop: -4, marginRight: flush ? 0 : -6, marginLeft: 2 }}>{x}</View>
|
|
@@ -189,7 +205,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
189
205
|
<RevealScope style={{ flexDirection: "row", gap: 9 }}>
|
|
190
206
|
<View style={{ paddingTop: 2 }}><Icon name={g.name} size={14} color={g.color} /></View>
|
|
191
207
|
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
|
|
192
|
-
{!said && <RichText style={compact ? t.label : t.body}>{item.title}</RichText>}
|
|
208
|
+
{!said && <RichText style={titleStyle(compact ? t.label : t.body)}>{item.title}</RichText>}
|
|
193
209
|
{"detail" in item && !!item.detail && !sameText(item.detail, item.title.replace(/^Q\d+ · /, "")) && <RichText linkColor={c.foreground} numberOfLines={item.kind === "question" ? 2 : 3} style={t.meta}>{item.detail}</RichText>}
|
|
194
210
|
{scopeLine && <RichText style={t.meta}>{scopeLine}</RichText>}
|
|
195
211
|
{item.kind === "question" && <QuestionState workspace={w} questionId={item.questionId} theme={theme} />}
|
|
@@ -198,7 +214,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
198
214
|
{button}
|
|
199
215
|
{item.kind === "send" && item.blocker && <Text style={[t.small, { flexShrink: 1 }]}>{item.blocker}</Text>}
|
|
200
216
|
</View>}
|
|
201
|
-
{notice}
|
|
217
|
+
{notice ?? asked}
|
|
202
218
|
</View>
|
|
203
219
|
<View style={{ marginTop: -3, marginRight: flush ? 2 : -5 }}>{x}</View>
|
|
204
220
|
</RevealScope>
|
|
@@ -232,14 +248,22 @@ export function NeedsYouBlock({ workspace: w, theme, compact, actions, now, brie
|
|
|
232
248
|
/** That brief's own card, drawn when it points at no open question. */ briefCard?: ReactNode; style?: StyleProp<ViewStyle>;
|
|
233
249
|
}) {
|
|
234
250
|
useReviewerSettings(); // re-renders on a No review change, so the block's rows and count drop the asks at once
|
|
235
|
-
|
|
251
|
+
// Held before grouping: a clicked reviewers row keeps its place, and the brief it folds stays folded.
|
|
252
|
+
const live = needsYou(w, now);
|
|
253
|
+
const all = useHeldNeeds(w.id, live);
|
|
236
254
|
const block = needsYouBlock(all, brief && briefCard ? brief : null, w.questions);
|
|
255
|
+
// The count is the rows still open or still in flight; a held row whose request is done is drawn as a receipt, not
|
|
256
|
+
// counted. Mid-run the number matches the rows on screen; once every held row is done the card says so.
|
|
257
|
+
const held = all.filter(i => !live.includes(i));
|
|
258
|
+
const inFlight = held.filter(i => i.kind === "reviewers" && reviewerClick(w.id, i.prKey)?.running).length;
|
|
259
|
+
const count = block.count - held.length + inFlight;
|
|
260
|
+
const asked = !count && held.length > 0 && held.every(i => i.kind === "reviewers");
|
|
237
261
|
// An accordion: one question open at a time (the block's first by default); its header closes it again.
|
|
238
262
|
const [openId, setOpenId] = useState<string | null | undefined>(undefined);
|
|
239
|
-
if (!block.count) return null;
|
|
263
|
+
if (!block.count) return null; // held rows keep the block drawn after its last ask is done
|
|
240
264
|
// In Later the block stays (its moves still work) but reads Later, without the attention border.
|
|
241
265
|
const later = workspaceSnoozed(w, all, now) && w.snooze ? laterLabel(w.snooze.until, now) : null;
|
|
242
|
-
return <Card theme={theme} compact={compact} icon={later ? "AlarmClock" : "CircleAlert"} title={later ? `Later ${later}` : "Needs you"} tone={later ? "plain" : "attention"} count={
|
|
266
|
+
return <Card theme={theme} compact={compact} icon={later ? "AlarmClock" : asked ? "Check" : "CircleAlert"} title={later ? `Later ${later}` : asked ? "Reviewers requested" : "Needs you"} tone={later || !count ? "plain" : "attention"} count={count || undefined} style={style}>
|
|
243
267
|
{block.cards.map(card => card.kind === "brief"
|
|
244
268
|
? <View key="brief" style={{ borderTopWidth: 1, borderTopColor: theme.colors.border }}>{briefCard}</View>
|
|
245
269
|
: <QuestionAsk key={card.questionId} workspace={w} questionId={card.questionId} context={card.brief ? brief?.context ?? null : null} theme={theme} compact={compact} now={now} openAgent={actions.openAgent}
|
package/client/panel.tsx
CHANGED
|
@@ -377,7 +377,7 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
|
|
|
377
377
|
const openPr = (key: string) => setSheet({ key, intent: null });
|
|
378
378
|
// The expand button only appears while the panel is narrow; a wide panel or the larger view keeps its collapse button.
|
|
379
379
|
const resizeShown = compact ? null : resize?.icon === "Maximize2" && wide ? null : resize;
|
|
380
|
-
const header = <WorkspaceHeader workspace={w} theme={theme} compact={compact} now={now} onSettings={openSettings} onRefresh={() => update.mutate()} refreshing={update.isPending} onAuto={next => auto.mutate(next)} autoPending={auto.isPending} notice={loadError ?? null} onOpenPr={openPr} resize={resizeShown} hideTitle={large} onHome={compact ? openOverview : undefined}
|
|
380
|
+
const header = <WorkspaceHeader workspace={w} theme={theme} compact={compact} now={now} onSettings={openSettings} onRefresh={() => update.mutate()} refreshing={update.isPending} onAuto={next => auto.mutate(next)} autoPending={auto.isPending} notice={loadError ?? null} onOpenPr={openPr} resize={resizeShown} hideTitle={large} onHome={compact ? openOverview : undefined} openAgent={openAgent}
|
|
381
381
|
more={sources ? <PanelMore w={w} sources={sources} theme={theme} compact={compact} openAgent={openAgent} openQuestion={setQuestion} showMenu={setMoreMenu} /> : undefined} />;
|
|
382
382
|
const shipped = <ShippedCard workspace={w} theme={theme} compact={compact} now={now} />;
|
|
383
383
|
const needs = <NeedsYouBlock workspace={w} theme={theme} compact={compact} now={now} brief={ask?.brief ?? null} briefCard={ask?.card ?? null} actions={{ openAgent, openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion }} />;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { useRef, useSyncExternalStore, type ReactNode } from "react";
|
|
2
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { requestReviewersRpc } from "../shared/contracts";
|
|
5
|
+
import { workspaceKey } from "./keys";
|
|
6
|
+
import { reviewersScope, reviewersWords, type ReviewersOutcome } from "../shared/reviewers-click";
|
|
7
|
+
import type { ListWorkspace as Workspace } from "../shared/list";
|
|
8
|
+
import type { NeedItem } from "../shared/attention";
|
|
9
|
+
import { keepInPlace } from "../shared/keep-in-place";
|
|
10
|
+
import { Button, errorText, text, type ButtonKind, type Theme } from "./kit";
|
|
11
|
+
import { Text } from "./text";
|
|
12
|
+
import { View } from "react-native";
|
|
13
|
+
|
|
14
|
+
type Control = { button: ReactNode; notice: ReactNode; /** Asked: the row reads as a receipt, not an ask. */ done: boolean };
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Each PR's click, for the session: in flight, or what came of it. One store for every surface (the panel's block and
|
|
18
|
+
* its rows, the chat's brief card, Home's detail pane, the pill), keyed by workspace and PR, so a click on one shows on
|
|
19
|
+
* all, and a surface that regroups its rows (the block folds a brief into a row) never loses it. Memory only.
|
|
20
|
+
*/
|
|
21
|
+
type Entry = { running: boolean; outcome: ReviewersOutcome | null };
|
|
22
|
+
let asked: Record<string, Entry> = {};
|
|
23
|
+
const subscribers = new Set<() => void>();
|
|
24
|
+
const keyOf = (workspaceId: string, prKey: string) => `${workspaceId}|${prKey}`;
|
|
25
|
+
const setEntry = (k: string, e: Entry) => { asked = { ...asked, [k]: e }; for (const f of subscribers) f(); };
|
|
26
|
+
const subscribe = (f: () => void) => { subscribers.add(f); return () => { subscribers.delete(f); }; };
|
|
27
|
+
const snapshot = () => asked;
|
|
28
|
+
/** One PR's click as the session holds it, for a list deciding how to draw and count a held row. */
|
|
29
|
+
export const reviewerClick = (workspaceId: string, prKey: string): Entry | undefined => asked[keyOf(workspaceId, prKey)];
|
|
30
|
+
/** Tests: forget every click. */
|
|
31
|
+
export const resetReviewerClicks = () => { asked = {}; for (const f of subscribers) f(); };
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* a-clicked-row-holds-its-place: the Needs-you items a surface draws, with every reviewers row clicked here kept where
|
|
35
|
+
* it was after the next read drops it, until the surface unmounts. Call it on the items before anything groups them
|
|
36
|
+
* (the block's cards and rows), so the grouping never changes under the developer's next click either.
|
|
37
|
+
*/
|
|
38
|
+
export function useHeldNeeds(workspaceId: string, items: readonly NeedItem[]): NeedItem[] {
|
|
39
|
+
const all = useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
40
|
+
const drawn = useRef<readonly NeedItem[]>([]);
|
|
41
|
+
const out = keepInPlace(drawn.current, items, i => i.key, key => key.startsWith("reviewers:") && !!all[keyOf(workspaceId, key.slice("reviewers:".length))]);
|
|
42
|
+
drawn.current = out;
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Every Add reviewers button that names its people (a Needs-you row, Catch up's card, a brief's move): one click asks
|
|
48
|
+
* the saved reviewers the row names, with no sheet (a-click-on-add-reviewers-asks, shared/reviewers-click.ts). Each
|
|
49
|
+
* PR has its own pending and outcome, so clicks on several rows one after another all run, and none waits on or
|
|
50
|
+
* disables another (no shared busy lock: a single `useMutation` tracks only its latest call). `fallback` opens the
|
|
51
|
+
* PR sheet's picker, only when nobody is set for the PR. `held(prKey)` says a row has a local outcome to keep
|
|
52
|
+
* showing, so the list keeps it in place (keep-in-place.ts).
|
|
53
|
+
*/
|
|
54
|
+
export type ReviewerButtons = ((prKey: string, o: { theme: Theme; compact: boolean; kind?: ButtonKind; fallback?: () => void; after?: () => void }) => Control | null) & {
|
|
55
|
+
held: (prKey: string) => boolean;
|
|
56
|
+
/** For a surface with its own buttons (the brief card): label and one-click run. Null: nobody set, or the PR isn't tracked. */
|
|
57
|
+
view: (prKey: string, after?: () => void) => { label: string; a11y: string; running: boolean; done: boolean; why: string | null; run: () => void } | null;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export function useReviewerButtons(w: Pick<Workspace, "id" | "prs"> | undefined): ReviewerButtons {
|
|
61
|
+
const request = useRpc(requestReviewersRpc);
|
|
62
|
+
const cache = useQueryClient();
|
|
63
|
+
const all = useSyncExternalStore(subscribe, snapshot, snapshot);
|
|
64
|
+
const entry = (prKey: string) => w ? all[keyOf(w.id, prKey)] : undefined;
|
|
65
|
+
const refresh = () => w ? Promise.all([
|
|
66
|
+
cache.invalidateQueries({ queryKey: workspaceKey(w.id) }),
|
|
67
|
+
...[["follow-up", "pr-controls", w.id], ["follow-up", "overview"]].map(key => cache.invalidateQueries({ queryKey: key })),
|
|
68
|
+
]).catch(() => undefined) : Promise.resolve();
|
|
69
|
+
|
|
70
|
+
const run = (prKey: string, after?: () => void) => {
|
|
71
|
+
if (!w) return;
|
|
72
|
+
// Read the store, not this render's copy, so a double click never sends twice.
|
|
73
|
+
const k = keyOf(w.id, prKey); const now = asked[k];
|
|
74
|
+
if (now?.running || now?.outcome?.state === "submitted" || now?.outcome?.state === "uncertain") return;
|
|
75
|
+
setEntry(k, { running: true, outcome: null });
|
|
76
|
+
// No reviewers argument: the server asks the saved list, the same people the row names.
|
|
77
|
+
void request({ workspaceId: w.id, prKey })
|
|
78
|
+
.then(reply => ({ state: reply.state, result: reply.result }) as ReviewersOutcome, (e: unknown) => ({ state: "error", result: errorText(e) }) as ReviewersOutcome)
|
|
79
|
+
.then(outcome => {
|
|
80
|
+
setEntry(k, { running: false, outcome });
|
|
81
|
+
void refresh();
|
|
82
|
+
if (outcome.state === "submitted") after?.();
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const stateOf = (prKey: string, compact = false) => {
|
|
87
|
+
const pr = w?.prs.find(p => p.key === prKey);
|
|
88
|
+
const scope = pr ? reviewersScope(pr) : null;
|
|
89
|
+
if (!scope) return null;
|
|
90
|
+
const e = entry(prKey);
|
|
91
|
+
const words = reviewersWords(scope, e?.outcome ?? null, !!e?.running, compact);
|
|
92
|
+
return { scope, words, running: !!e?.running };
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const control = (prKey: string, { theme, compact, kind = "secondary", fallback, after }: Parameters<ReviewerButtons>[1]): Control | null => {
|
|
96
|
+
const c = theme.colors; const t = text(c, compact);
|
|
97
|
+
const s = stateOf(prKey, compact);
|
|
98
|
+
if (!s) return fallback ? { done: false, notice: null, button: <Button theme={theme} compact={compact} kind={kind} icon="UserPlus" title="Add reviewers…" accessibilityLabel="Pick reviewers for this PR" onPress={fallback} /> } : null;
|
|
99
|
+
const { scope, words } = s;
|
|
100
|
+
// As wide as its widest word, so the PR link beside it never moves under the next click.
|
|
101
|
+
const button = <View style={{ minWidth: compact ? 118 : 146 }}><Button theme={theme} compact={compact} kind={kind} icon={words.done ? "Check" : "UserPlus"} title={words.button}
|
|
102
|
+
accessibilityLabel={words.done && words.button !== "Unconfirmed" ? scope.doneA11y : words.done ? `Unconfirmed: ${scope.a11y}` : scope.a11y}
|
|
103
|
+
loading={s.running} disabled={s.running || words.done} onPress={() => run(prKey, after)} /></View>;
|
|
104
|
+
const notice = words.line ? <Text accessibilityRole={words.tone === "warning" ? "alert" : undefined} style={[t.meta, words.tone === "warning" ? { color: c.statusWarning } : null]}>{words.line}</Text> : null;
|
|
105
|
+
return { button, notice, done: words.done };
|
|
106
|
+
};
|
|
107
|
+
const held = (prKey: string) => !!entry(prKey);
|
|
108
|
+
const view: ReviewerButtons["view"] = (prKey, after) => {
|
|
109
|
+
const s = stateOf(prKey);
|
|
110
|
+
if (!s) return null;
|
|
111
|
+
return { label: s.words.button, a11y: s.scope.a11y, running: s.running, done: s.words.done, why: s.words.tone === "warning" ? s.words.line : null, run: () => run(prKey, after) };
|
|
112
|
+
};
|
|
113
|
+
return Object.assign(control, { held, view });
|
|
114
|
+
}
|