paseo-follow-up 2.0.1-beta.6 → 2.0.1-beta.8
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/CHANGELOG.md +2 -2
- package/client/brief.tsx +12 -3
- package/client/home.tsx +4 -2
- package/client/kit.tsx +1 -1
- package/client/live-copies.ts +11 -0
- package/client/live.tsx +15 -2
- package/client/merge-button.tsx +105 -0
- package/client/needs-you.tsx +16 -3
- package/client/pr-controls.tsx +12 -4
- package/client/stacks.tsx +2 -0
- package/client/toasts.tsx +27 -4
- package/client/workspace-data.ts +10 -1
- package/index.server.ts +10 -5
- package/package.json +1 -1
- package/server/daemon.ts +41 -17
- package/server/directory.ts +4 -3
- package/server/engine.ts +30 -4
- package/server/inbox-directory.ts +13 -24
- package/server/inbox.ts +31 -4
- package/server/list-cache.ts +9 -1
- package/server/pr-actions.ts +23 -6
- package/server/request-trace.ts +3 -1
- package/server/turn-timeline.ts +139 -0
- package/shared/activity.ts +4 -1
- package/shared/attention.ts +42 -3
- package/shared/merge-click.ts +98 -0
- package/shared/model.ts +1 -1
- package/shared/pr-actions.ts +7 -1
- package/shared/status-invariants.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,7 @@ What changed in each version of Follow-up, newest first. Follow-up shows the cur
|
|
|
6
6
|
|
|
7
7
|
Follow-up keeps track of every workspace your coding agents work in, until the work is merged and done. It shows you in one place which agents are waiting on you and why, sends failed checks and review comments back to the right agent by itself, and lets you answer an agent's question without opening its chat.
|
|
8
8
|
|
|
9
|
-

|
|
10
10
|
|
|
11
11
|
### One list of what needs you
|
|
12
12
|
|
|
@@ -16,7 +16,7 @@ Home lists every workspace, grouped by what it needs from you. When an agent fin
|
|
|
16
16
|
|
|
17
17
|
The Follow-up tab beside a workspace's chat shows how far its PRs are, what needs you and what's left to fix, with a bar for the PR stack, what the agent is doing now and the question it's waiting on.
|
|
18
18
|
|
|
19
|
-

|
|
20
20
|
|
|
21
21
|
### Answer questions from anywhere
|
|
22
22
|
|
package/client/brief.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { OTHER, OTHER_LABEL, briefAnswerStatus, isOther, type Question } from ".
|
|
|
17
17
|
import type { Workspace } from "../shared/model";
|
|
18
18
|
import { SubmitScope, submitHint, text, useNow } from "./kit";
|
|
19
19
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
20
|
+
import { useMergeButtons } from "./merge-button";
|
|
20
21
|
import { prLinksByNumber } from "../shared/presentation";
|
|
21
22
|
import { cardStore } from "./card-store";
|
|
22
23
|
import { PrSheet } from "./pr-sheet";
|
|
@@ -355,6 +356,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
355
356
|
const cache = useQueryClient();
|
|
356
357
|
const live = useQuery({ queryKey: liveBriefKey(agentId), queryFn: () => readBrief({ agentId }), enabled: row.state === "open" && !!agentId, refetchInterval: LIVE_BRIEF_POLL_MS, staleTime: 5_000 });
|
|
357
358
|
const workspace = row.workspaceId ? deps.workspace(row.workspaceId) : undefined;
|
|
359
|
+
const merges = useMergeButtons(workspace);
|
|
358
360
|
const checked = shownBrief(row, live.data, workspace?.questions ?? []);
|
|
359
361
|
// The check itself failed (or there's no agent to ask): don't leave a dead card. The server still validates every
|
|
360
362
|
// action against the stored brief, and a moot refusal reconciles, so acting on the row is safe.
|
|
@@ -429,8 +431,14 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
429
431
|
// The pill's Undo is this toast's Undo: it closes the toast (so nothing is sent) and reopens the card.
|
|
430
432
|
if (id !== null) deps.noteDone?.(agentId, () => { dismissToast(id); setMarked(null); });
|
|
431
433
|
};
|
|
434
|
+
// A merge move reads what its click merges ("Merge 3 PRs"), then "Merging…".
|
|
435
|
+
const moveLabel = (m: BriefMove) => (m.kind === "merge" && m.prKey ? merges.view(m.prKey)?.label : null) ?? (busy === m.kind ? `${m.label}…` : m.label);
|
|
436
|
+
const mergeWhy = b.moves.map(m => m.kind === "merge" && m.prKey ? merges.view(m.prKey)?.why : null).find(Boolean) ?? null;
|
|
432
437
|
const press = (m: BriefMove) => {
|
|
433
|
-
|
|
438
|
+
// Merge is one click (a-click-on-merge-merges); the sheet's confirm only for a PR whose scope can't be known.
|
|
439
|
+
const one = m.kind === "merge" && m.prKey ? merges.view(m.prKey) : null;
|
|
440
|
+
if (one) one.run();
|
|
441
|
+
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); }
|
|
434
442
|
else if (m.kind === "open_pr" && m.url) void openExternalUrl(m.url).catch(() => undefined);
|
|
435
443
|
else if (m.kind === "sign_off_next") { deps.signOff(agentId); deps.openNext(agentId); }
|
|
436
444
|
else if (m.kind === "retry") void run("retry", answerId => act({ agentId, briefId: b.id, move: "retry", answerId }), "Retry didn't start");
|
|
@@ -464,9 +472,10 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
464
472
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 10, rowGap: 8 }}>
|
|
465
473
|
<RichText numberOfLines={3} tooltip={askText}
|
|
466
474
|
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>
|
|
467
|
-
{!embedded && moves.map(m => <Btn key={m.kind} label={
|
|
475
|
+
{!embedded && moves.map(m => <Btn key={m.kind} label={moveLabel(m)} icon={MOVE_ICON[m.kind]} disabled={!!busy || m.kind === "merge" && !!m.prKey && !!merges.view(m.prKey)?.running} onPress={() => press(m)} c={c} compact={compact} hint={MOVE_HINT[m.kind]} />)}
|
|
468
476
|
</View>
|
|
469
477
|
{!!error && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
478
|
+
{!!mergeWhy && <Text accessibilityRole="alert" style={{ color: c.statusWarning, fontSize: 13, lineHeight: 18 }}>{mergeWhy}</Text>}
|
|
470
479
|
</View>;
|
|
471
480
|
}
|
|
472
481
|
|
|
@@ -523,7 +532,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
523
532
|
{multi && <SendBar b={b} picks={sendable} noted={notedCount(sendable, openNotes)} busy={busy} error={error} onSend={sendAll} c={c} compact={compact} />}
|
|
524
533
|
|
|
525
534
|
{!embedded && moves.length > 0 && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
526
|
-
{moves.map((m, i) => <Btn key={m.kind} label={
|
|
535
|
+
{moves.map((m, i) => <Btn key={m.kind} label={moveLabel(m)} icon={MOVE_ICON[m.kind]} primary={i === 0 && !multi} disabled={!!busy || m.kind === "merge" && !!m.prKey && !!merges.view(m.prKey)?.running} onPress={() => press(m)} c={c} compact={compact} hint={MOVE_HINT[m.kind]} />)}
|
|
527
536
|
</View>}
|
|
528
537
|
|
|
529
538
|
{!!error && !multi && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
package/client/home.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import { SummaryLine } from "./about";
|
|
|
18
18
|
import { ReferencesLine } from "./linked";
|
|
19
19
|
import { bottomGap, bottomInset, Button, focusSoon, IconButton, space, text, type Theme } from "./kit";
|
|
20
20
|
import { NeedsYouBlock } from "./needs-you";
|
|
21
|
+
import { HeldMerges } from "./merge-button";
|
|
21
22
|
import { PrSheet } from "./pr-sheet";
|
|
22
23
|
import { QuestionSheet } from "./questions";
|
|
23
24
|
import { Age, BadgeView, BRIEF_KEY, glyphColor, HomeList, OVERSEER_KEY, PrChipView, PrSummaryText, type OverseerRowState } from "./home-list";
|
|
@@ -36,7 +37,7 @@ import { ViewSync } from "./view-store";
|
|
|
36
37
|
import { useRowMenu } from "./row-actions";
|
|
37
38
|
import { laterChoices } from "../shared/row-menu";
|
|
38
39
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
39
|
-
import { ToastHost, useQuestionOpener } from "./toasts";
|
|
40
|
+
import { TOAST_ANCHOR, ToastHost, useQuestionOpener } from "./toasts";
|
|
40
41
|
|
|
41
42
|
export const HOME_SCREEN = "follow-up";
|
|
42
43
|
|
|
@@ -471,11 +472,12 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
471
472
|
{w && <NeedsYouBlock workspace={w} theme={theme} compact={compact} now={Date.now()} style={{ marginHorizontal: 0, marginTop: 0 }}
|
|
472
473
|
brief={inBlock ? b : null} briefCard={inBlock && <BriefCard {...({ embedded: true, bare: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />}
|
|
473
474
|
actions={{ openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion, openAgent: () => openFull(s) }} />}
|
|
475
|
+
{w && <HeldMerges workspace={w} theme={theme} compact={compact} />}
|
|
474
476
|
{actionBar}
|
|
475
477
|
{laterBlock}
|
|
476
478
|
{steps}
|
|
477
479
|
</ScrollView>
|
|
478
|
-
{s.agentId && <View style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
|
|
480
|
+
{s.agentId && <View nativeID={compact ? TOAST_ANCHOR : undefined} style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
|
|
479
481
|
{moves}
|
|
480
482
|
<ReplyBox theme={theme} compact={compact} agentName={s.title} placeholder={compact ? "Reply to the agent" : undefined} onFocusChange={setTyping} onSend={async text => {
|
|
481
483
|
await agent.handle!.send(text);
|
package/client/kit.tsx
CHANGED
|
@@ -108,7 +108,7 @@ export function SubmitScope({ enabled, onSubmit, children, style, accessibilityR
|
|
|
108
108
|
return <View ref={ref} style={style} accessibilityRole={accessibilityRole} accessibilityLabel={accessibilityLabel}>{children}</View>;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
type ButtonKind = "primary" | "secondary" | "ghost" | "danger";
|
|
111
|
+
export type ButtonKind = "primary" | "secondary" | "ghost" | "danger";
|
|
112
112
|
/** One button vocabulary for the whole plugin: 32px on desktop with a hit slop, 44px on touch layouts. */
|
|
113
113
|
export function Button({ title, onPress, theme, kind = "secondary", disabled = false, loading = false, icon, compact = false, accessibilityLabel, accessibilityHint, grow = false, shortcut = false, nativeID, onInteract }: {
|
|
114
114
|
/** Focus and hover, for a surface that pauses while the button is in use (the Undo bar). */ onInteract?: (event: "focus" | "blur" | "hoverIn" | "hoverOut") => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Workspace } from "../shared/model";
|
|
2
|
+
|
|
3
|
+
/** A copy only replaces one it is newer than (updatedAt): a late diff or poll never undoes a fresher read. */
|
|
4
|
+
export const newer = (held: Workspace | undefined, w: Workspace) => !held || Date.parse(w.updatedAt) >= Date.parse(held.updatedAt) ? w : held;
|
|
5
|
+
export const opened = new Set<(w: Workspace) => void>();
|
|
6
|
+
/**
|
|
7
|
+
* A fresh read of one workspace (useWorkspace's read, a merge's read before its toast) reaches every live store, so
|
|
8
|
+
* Home, the pill, the sidebar count and the panel read one copy (a-merge-outcome-reads-the-same-everywhere). Before,
|
|
9
|
+
* Home's Needs you kept "#151 is approved" beside a "Merged" button until the next feed push or poll.
|
|
10
|
+
*/
|
|
11
|
+
export function acceptWorkspace(w: Workspace): void { for (const accept of opened) accept(w); }
|
package/client/live.tsx
CHANGED
|
@@ -14,6 +14,8 @@ import { onVisible, whileVisible } from "./visibility";
|
|
|
14
14
|
import { WhatsNewGate } from "./release-notes";
|
|
15
15
|
import { ViewSync } from "./view-store";
|
|
16
16
|
import { ToastHost } from "./toasts";
|
|
17
|
+
import { newer, opened } from "./live-copies";
|
|
18
|
+
export { acceptWorkspace } from "./live-copies";
|
|
17
19
|
|
|
18
20
|
/** The backstop poll; agent changes `nudge` it sooner (1.4.0). Nothing while the app is hidden. */
|
|
19
21
|
const POLL_MS = 15_000;
|
|
@@ -39,7 +41,7 @@ export function createLiveStore(client: PluginClientContext) {
|
|
|
39
41
|
if (diff && !result.workspaces.length && !result.removed?.length) return;
|
|
40
42
|
const next = diff ? new Map(all) : new Map<string, Workspace>();
|
|
41
43
|
for (const id of result.removed ?? []) next.delete(id);
|
|
42
|
-
for (const w of result.workspaces) next.set(w.id, w);
|
|
44
|
+
for (const w of result.workspaces) next.set(w.id, diff ? newer(all.get(w.id), w) : w);
|
|
43
45
|
all = next; revision = result.revision;
|
|
44
46
|
workspaces = new Map([...all.values()].filter(w => !w.archived).map(w => [w.id, w]));
|
|
45
47
|
archived = [...all.values()].filter(w => w.archived);
|
|
@@ -56,6 +58,15 @@ export function createLiveStore(client: PluginClientContext) {
|
|
|
56
58
|
};
|
|
57
59
|
// The feed went down (the worker restarted): read now and poll until it is back.
|
|
58
60
|
feed = openFeed(client, workspacesFeed, {}, { event: event => { if (!stopped) apply(event); }, down: () => { if (timer) clearTimeout(timer); void poll(); }, up: () => { if (timer) clearTimeout(timer); timer = null; } });
|
|
61
|
+
const accept = (w: Workspace) => {
|
|
62
|
+
const held = all.get(w.id);
|
|
63
|
+
if (!held || newer(held, w) !== w || held === w) return;
|
|
64
|
+
all = new Map(all).set(w.id, w);
|
|
65
|
+
workspaces = new Map([...all.values()].filter(x => !x.archived).map(x => [x.id, x]));
|
|
66
|
+
archived = [...all.values()].filter(x => x.archived);
|
|
67
|
+
emit();
|
|
68
|
+
};
|
|
69
|
+
opened.add(accept);
|
|
59
70
|
const offVisible = onVisible(() => { if (pushed()) return; if (timer) clearTimeout(timer); void poll(); });
|
|
60
71
|
if (!feed) void poll();
|
|
61
72
|
return {
|
|
@@ -68,7 +79,9 @@ export function createLiveStore(client: PluginClientContext) {
|
|
|
68
79
|
refresh: () => { if (pushed()) return; if (timer) clearTimeout(timer); void poll(); },
|
|
69
80
|
/** Paseo reported an agent change: one diff read soon, however many updates arrive together. */
|
|
70
81
|
nudge: () => { if (nudged || stopped || pushed()) return; nudged = setTimeout(() => { nudged = null; if (timer) clearTimeout(timer); void poll(); }, 1_500); },
|
|
71
|
-
|
|
82
|
+
/** A fresh read of one workspace this store follows; kept only if newer (acceptWorkspace). */
|
|
83
|
+
accept,
|
|
84
|
+
stop() { stopped = true; opened.delete(accept); feed?.stop(); offVisible(); if (timer) clearTimeout(timer); if (nudged) clearTimeout(nudged); listeners.clear(); },
|
|
72
85
|
};
|
|
73
86
|
}
|
|
74
87
|
export type LiveStore = ReturnType<typeof createLiveStore>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useState, type ReactNode } from "react";
|
|
2
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
3
|
+
import { useToast } from "@getpaseo/plugin/client/ui";
|
|
4
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
5
|
+
import { confirmPrActionRpc, getRpc, preparePrActionRpc } from "../shared/contracts";
|
|
6
|
+
import { readWorkspace } from "./workspace-data";
|
|
7
|
+
import { workspaceKey } from "./keys";
|
|
8
|
+
import { mergeClick, mergeScope, mergeWords, type MergeClickResult, type MergeScope } from "../shared/merge-click";
|
|
9
|
+
import type { Workspace } from "../shared/model";
|
|
10
|
+
import { Button, errorText, text, type ButtonKind, type Theme } from "./kit";
|
|
11
|
+
import { Text } from "./text";
|
|
12
|
+
import { View } from "react-native";
|
|
13
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
14
|
+
import { heldMerges } from "../shared/attention";
|
|
15
|
+
import { prLinksByNumber } from "../shared/presentation";
|
|
16
|
+
import { PrLinksProvider, RichText } from "./rich-text";
|
|
17
|
+
import { hasToastHost, pushToast } from "./toast-store";
|
|
18
|
+
|
|
19
|
+
type Outcome = MergeClickResult | { state: "error"; result: string };
|
|
20
|
+
const whyNot = (o: Outcome | undefined) => o?.state === "blocked" ? `Not merged: ${o.blockers.join(" · ")}` : o?.state === "failed" || o?.state === "error" ? `Not merged: ${o.result}` : null;
|
|
21
|
+
type Control = { button: ReactNode; notice: ReactNode; label: string | null };
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Every Merge button (a Needs-you row, the composer pill, Home, a brief, the PR card): one click merges what the
|
|
25
|
+
* button names (a-click-on-merge-merges, shared/merge-click.ts). The button says "Merging…" while it runs; then the
|
|
26
|
+
* button and a toast say the same outcome (mergeWords: "Merged", "Queued", "Merge requested"),
|
|
27
|
+
* and the row clears on the next read. A blocker found at click time merges nothing and comes back
|
|
28
|
+
* as `notice`, for the surface to put under its row. One hook per surface (a list draws many rows), so `control`
|
|
29
|
+
* is a plain function. `fallback` is the PR sheet's confirm, only for a PR whose scope can't be known (mergeScope is
|
|
30
|
+
* null: a parent cycle or a downstack PR outside the inventory).
|
|
31
|
+
*/
|
|
32
|
+
export type MergeButtons = ((prKey: string, o: { theme: Theme; compact: boolean; kind?: ButtonKind; grow?: boolean; disabled?: boolean; fallback?: () => void }) => Control) & {
|
|
33
|
+
/** For a surface with its own buttons (the brief card): the label to show, and the one-click run. Null: no scope. */
|
|
34
|
+
view: (prKey: string) => { label: string; a11y: string; running: boolean; submitted: boolean; why: string | null; run: () => void } | null;
|
|
35
|
+
};
|
|
36
|
+
export function useMergeButtons(w: Workspace | undefined): MergeButtons {
|
|
37
|
+
const prepare = useRpc(preparePrActionRpc); const confirm = useRpc(confirmPrActionRpc);
|
|
38
|
+
const cache = useQueryClient(); const toast = useToast();
|
|
39
|
+
const [outcomes, setOutcomes] = useState<Record<string, Outcome>>({});
|
|
40
|
+
const settle = (prKey: string, o: Outcome | null) => setOutcomes(all => { const next = { ...all }; if (o) next[prKey] = o; else delete next[prKey]; return next; });
|
|
41
|
+
const read = useRpc(getRpc);
|
|
42
|
+
// One fresh read of the workspace, given to the panel's query and every live store (Home, the pill, the sidebar
|
|
43
|
+
// count) before the toast, so no surface still lists the merge (a-merge-outcome-reads-the-same-everywhere).
|
|
44
|
+
const refresh = () => w ? Promise.all([
|
|
45
|
+
cache.fetchQuery({ queryKey: workspaceKey(w.id), queryFn: () => readWorkspace(read, w.id), staleTime: 0 }),
|
|
46
|
+
...[["follow-up", "pr-controls", w.id], ["follow-up", "overview"]].map(key => cache.invalidateQueries({ queryKey: key })),
|
|
47
|
+
]).catch(() => undefined) : Promise.resolve();
|
|
48
|
+
const merge = useMutation({
|
|
49
|
+
mutationFn: ({ prKey, scope }: { prKey: string; scope: MergeScope }) => mergeClick({ prepare: key => prepare({ workspaceId: w!.id, prKey: key, kind: "merge" }), confirm: input => confirm(input) }, prKey, scope),
|
|
50
|
+
onMutate: ({ prKey }) => settle(prKey, null),
|
|
51
|
+
onSuccess: async (result, { prKey, scope }) => {
|
|
52
|
+
settle(prKey, result);
|
|
53
|
+
// The header, rows and progress read the merge first (the server marked the PRs merged), then the toast says it,
|
|
54
|
+
// so the toast never shows beside a header that hasn't caught up. The toast and the button read one outcome (mergeWords).
|
|
55
|
+
await refresh();
|
|
56
|
+
const said = mergeWords(scope, result).toast;
|
|
57
|
+
// Follow-up's own toast where a Follow-up root is mounted: on phones it sits above the dock, never over the
|
|
58
|
+
// heading (Paseo's toast is pinned to the top). Otherwise Paseo's.
|
|
59
|
+
if (said) { if (hasToastHost()) pushToast(said.variant, said.text); else toast.show(said.text, { variant: said.variant }); }
|
|
60
|
+
},
|
|
61
|
+
onError: (e, { prKey }) => { settle(prKey, { state: "error", result: errorText(e) }); void refresh(); },
|
|
62
|
+
});
|
|
63
|
+
const control = (prKey: string, { theme, compact, kind = "secondary", grow, disabled, fallback }: Parameters<MergeButtons>[1]): Control => {
|
|
64
|
+
const c = theme.colors; const t = text(c, compact);
|
|
65
|
+
const scope = w ? mergeScope(w, prKey) : null;
|
|
66
|
+
const pr = w?.prs.find(p => p.key === prKey);
|
|
67
|
+
if (!scope) return { label: null, notice: null, button: fallback ? <Button theme={theme} compact={compact} kind={kind} grow={grow} icon="GitMerge" title={`Merge #${pr?.number ?? ""}…`} accessibilityLabel={`Review and merge pull request ${pr?.number ?? ""}`} disabled={disabled} onPress={fallback} /> : null };
|
|
68
|
+
const running = merge.isPending && merge.variables?.prKey === prKey;
|
|
69
|
+
const outcome = outcomes[prKey];
|
|
70
|
+
const submitted = outcome?.state === "submitted" || outcome?.state === "uncertain";
|
|
71
|
+
// Phones keep the button on the row's line: a short done label, so the row's title keeps its one line.
|
|
72
|
+
const title = mergeWords(scope, outcome && outcome.state !== "error" ? outcome : null, running, compact).button;
|
|
73
|
+
const button = <Button theme={theme} compact={compact} kind={kind} grow={grow} icon={submitted ? "Check" : scope.queue ? "ListPlus" : "GitMerge"} title={title} accessibilityLabel={scope.a11y}
|
|
74
|
+
loading={running} disabled={disabled || merge.isPending || submitted} onPress={() => merge.mutate({ prKey, scope })} />;
|
|
75
|
+
const why = whyNot(outcome);
|
|
76
|
+
const notice = why ? <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning }]}>{why}</Text> : null;
|
|
77
|
+
return { button, notice, label: scope.label };
|
|
78
|
+
};
|
|
79
|
+
const view: MergeButtons["view"] = prKey => {
|
|
80
|
+
const scope = w ? mergeScope(w, prKey) : null;
|
|
81
|
+
if (!scope) return null;
|
|
82
|
+
const running = merge.isPending && merge.variables?.prKey === prKey;
|
|
83
|
+
const o = outcomes[prKey]; const submitted = o?.state === "submitted" || o?.state === "uncertain";
|
|
84
|
+
return { why: whyNot(o), label: mergeWords(scope, o && o.state !== "error" ? o : null, running).button, a11y: scope.a11y, running, submitted,
|
|
85
|
+
run: () => { if (!merge.isPending && !submitted) merge.mutate({ prKey, scope }); } };
|
|
86
|
+
};
|
|
87
|
+
return Object.assign(control, { view });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* "#143 approved · waits on #142 (checks failing)": an approved PR that Merge isn't offered on because a PR under it
|
|
92
|
+
* can't merge yet (heldMerges). Quiet, not an ask; both numbers open their PRs. The panel's Pull requests card and
|
|
93
|
+
* Home's detail pane draw it, so an approved PR never goes invisible.
|
|
94
|
+
*/
|
|
95
|
+
export function HeldMerges({ workspace: w, theme, compact, now = Date.now(), framed = false }: { workspace: Workspace; theme: Theme; compact: boolean; now?: number; framed?: boolean }) {
|
|
96
|
+
const held = heldMerges(w, now);
|
|
97
|
+
if (!held.length) return null;
|
|
98
|
+
const c = theme.colors; const t = text(c, compact);
|
|
99
|
+
return <PrLinksProvider prs={prLinksByNumber(w.prs)}><View accessibilityRole="summary" style={framed ? { paddingHorizontal: 12, paddingVertical: 8, borderTopWidth: 1, borderTopColor: c.border, gap: 6 } : { gap: 6 }}>
|
|
100
|
+
{held.map(h => <View key={h.pr.key} style={{ flexDirection: "row", gap: 8 }}>
|
|
101
|
+
<View style={{ paddingTop: 2 }}><Icon name="Clock" size={13} color={c.foregroundMuted} /></View>
|
|
102
|
+
<RichText linkColor={c.foreground} style={[t.meta, { flex: 1 }]}>{h.line}</RichText>
|
|
103
|
+
</View>)}
|
|
104
|
+
</View></PrLinksProvider>;
|
|
105
|
+
}
|
package/client/needs-you.tsx
CHANGED
|
@@ -23,6 +23,8 @@ import { NoReviewLink } from "./review-mode";
|
|
|
23
23
|
|
|
24
24
|
import { overviewKey, workspaceKey } from "./keys";
|
|
25
25
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
26
|
+
import { useMergeButtons } from "./merge-button";
|
|
27
|
+
import { mergeScope } from "../shared/merge-click";
|
|
26
28
|
import { prLinksByNumber } from "../shared/presentation";
|
|
27
29
|
export { overviewKey, workspaceKey };
|
|
28
30
|
|
|
@@ -84,6 +86,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
84
86
|
}, onError: fail });
|
|
85
87
|
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 });
|
|
86
88
|
const items = rows ?? needsYou(w, now);
|
|
89
|
+
const mergeControl = useMergeButtons(w);
|
|
87
90
|
if (!items.length) return null;
|
|
88
91
|
const busy = resume.isPending || retry.isPending || retryTask.isPending || deliver.isPending || sendAnswer.isPending || inspect.isPending;
|
|
89
92
|
const openMain = actions.openAgent ? () => actions.openAgent!(w.mainAgentId) : undefined;
|
|
@@ -110,7 +113,8 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
110
113
|
</>
|
|
111
114
|
: actions.openQuestion && <Button theme={theme} compact={compact} icon="Eye" title="Check" accessibilityLabel={`Check the ${item.questionId} answer`} onPress={() => actions.openQuestion!(item.questionId)} />;
|
|
112
115
|
case "send": return <Button theme={theme} compact={compact} kind="primary" icon="Send" title={item.finish ? "Ask to finish" : `Send ${item.tasks.length} task${item.tasks.length === 1 ? "" : "s"}`} accessibilityLabel={item.finish ? `Ask to finish: ${FINISH_ASK}` : `Send ${item.tasks.length} task${item.tasks.length === 1 ? "" : "s"} to ${agentName(w)}`} accessibilityHint={item.blocker ?? undefined} loading={deliver.isPending} disabled={busy || !!item.blocker} onPress={() => deliver.mutate(item.batchId)} />;
|
|
113
|
-
|
|
116
|
+
// One click merges what the button names (a-click-on-merge-merges); the sheet's confirm only when the scope can't be known.
|
|
117
|
+
case "merge": return mergeControl(item.prKey, { theme, compact, fallback: actions.openPr ? () => actions.openPr!(item.prKey, "merge") : undefined }).button;
|
|
114
118
|
case "reviewers": return actions.openPr && <Button theme={theme} compact={compact} icon="UserPlus" title="Add reviewers" onPress={() => actions.openPr!(item.prKey, "reviewers")} />;
|
|
115
119
|
}
|
|
116
120
|
};
|
|
@@ -120,11 +124,18 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
120
124
|
// A row about one PR opens it in one click, beside its action and never instead of it.
|
|
121
125
|
const link = item.pr ? <PrLinkButton link={item.pr} theme={theme} compact={compact} /> : null;
|
|
122
126
|
const act = action(item);
|
|
127
|
+
// A stack's Merge names its scope on the row ("Merges #1628, #1629, then #1630"); a click-time blocker shows here too.
|
|
128
|
+
const merging = item.kind === "merge" ? mergeControl(item.prKey, { theme, compact }) : null;
|
|
129
|
+
const scopeLine = item.kind === "merge" ? mergeScope(w, item.prKey)?.detail ?? null : null;
|
|
130
|
+
const notice = merging?.notice ?? null;
|
|
131
|
+
// The action and its link are one group, so the link never wraps under the button (a long "Add reviewers").
|
|
132
|
+
const pair = act && link ? <View style={{ flexDirection: "row", alignItems: "center", gap: 4, flexShrink: 0 }}>{act}{link}</View> : null;
|
|
123
133
|
const button = act || link ? <>{act}{link}</> : null;
|
|
124
134
|
const said = !!untitled?.has(item.key);
|
|
125
135
|
// Phones: the action sits at the row's right edge so rows never grow a second line of controls. A send batch
|
|
126
136
|
// (the primary, with its task list) and Retry's pair keep their buttons full width under the row.
|
|
127
|
-
|
|
137
|
+
// A stack's scope line and a blocker need the row's full width, so those rows put their button under the text.
|
|
138
|
+
const inline = compact && button && item.kind !== "send" && !(item.kind === "retry" && !item.exhausted) && !scopeLine && !notice;
|
|
128
139
|
if (inline) return <CardRow key={item.key} theme={theme} compact first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
129
140
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
130
141
|
{/* A row with the quiet link under it is taller: the glyph stays on the title's line. */}
|
|
@@ -134,7 +145,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
134
145
|
{"detail" in item && !!item.detail && !sameText(item.detail, item.title.replace(/^Q\d+ · /, "")) && <RichText linkColor={c.foreground} numberOfLines={1} style={t.meta}>{item.detail}</RichText>}
|
|
135
146
|
{item.kind === "reviewers" && <NoReviewLink repo={item.prKey.split("#")[0]} theme={theme} compact />}
|
|
136
147
|
</View>
|
|
137
|
-
{button}
|
|
148
|
+
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start" } : undefined}>{pair ?? button}</View>
|
|
138
149
|
</View>
|
|
139
150
|
</CardRow>;
|
|
140
151
|
return <CardRow key={item.key} theme={theme} compact={compact} first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
@@ -143,12 +154,14 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
143
154
|
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
|
|
144
155
|
{!said && <RichText style={compact ? t.label : t.body}>{item.title}</RichText>}
|
|
145
156
|
{"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>}
|
|
157
|
+
{scopeLine && <RichText style={t.meta}>{scopeLine}</RichText>}
|
|
146
158
|
{item.kind === "question" && <QuestionState workspace={w} questionId={item.questionId} theme={theme} />}
|
|
147
159
|
{item.kind === "reviewers" && <NoReviewLink repo={item.prKey.split("#")[0]} theme={theme} compact={compact} />}
|
|
148
160
|
{(button || (item.kind === "send" && item.blocker)) && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, marginTop: 5 }}>
|
|
149
161
|
{button}
|
|
150
162
|
{item.kind === "send" && item.blocker && <Text style={[t.small, { flexShrink: 1 }]}>{item.blocker}</Text>}
|
|
151
163
|
</View>}
|
|
164
|
+
{notice}
|
|
152
165
|
</View>
|
|
153
166
|
</View>
|
|
154
167
|
</CardRow>;
|
package/client/pr-controls.tsx
CHANGED
|
@@ -14,14 +14,16 @@ import { reviewersMissing } from "../shared/pr-workflow";
|
|
|
14
14
|
import { resolveReviewers, withoutAuthor, type ReviewerEntry } from "../shared/reviewers";
|
|
15
15
|
import { ReviewerPicker, reviewerSettingsKey, useReviewerSettings, willAsk } from "./reviewers";
|
|
16
16
|
import { runAction } from "./toasts";
|
|
17
|
+
import { useMergeButtons } from "./merge-button";
|
|
18
|
+
import { mergeScope } from "../shared/merge-click";
|
|
17
19
|
|
|
18
20
|
const METHOD_SENTENCE: Record<MergeMethod, string> = { squash: "squash and merge it", merge: "merge it with a merge commit", rebase: "rebase and merge it" };
|
|
19
21
|
/** Blockers read as nouns after "clears:"; proper names (GitHub, Graphite) keep their capital. */
|
|
20
22
|
const lowerFirst = (b: string) => /^(GitHub|Graphite)\b/.test(b) ? b : b[0].toLowerCase() + b.slice(1);
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
|
-
* Merge, merge-when-ready and reviewer requests for one PR. Every write needs a click
|
|
24
|
-
*
|
|
25
|
+
* Merge, merge-when-ready and reviewer requests for one PR. Every write needs a click. Merge is one click: it names
|
|
26
|
+
* its whole scope (the stack under the PR included) and merges exactly that, at the heads it showed, or shows why not. In GitHub mode When ready is
|
|
25
27
|
* GitHub's auto-merge, read with the PR, so it needs no browser companion; it's hidden when the repository disallows it.
|
|
26
28
|
*/
|
|
27
29
|
export function PrControls({ pr, workspace, theme, compact, browserReady: companionReady, intent }: { browserReady: boolean; pr: Pr; workspace: Workspace; theme: Theme; compact: boolean; intent?: "merge" | "reviewers" | null }) {
|
|
@@ -46,6 +48,7 @@ export function PrControls({ pr, workspace, theme, compact, browserReady: compan
|
|
|
46
48
|
else setPlan(result);
|
|
47
49
|
} });
|
|
48
50
|
const pendingAction = workspace.prActions.some(a => prActionBlocks(a, [pr.key]));
|
|
51
|
+
const mergeControl = useMergeButtons(workspace);
|
|
49
52
|
const busy = checking.isPending || submit.isPending;
|
|
50
53
|
const actual = browserReady ? status.data?.pr : null;
|
|
51
54
|
const known = !!actual && !status.error && !status.data?.error;
|
|
@@ -61,13 +64,16 @@ export function PrControls({ pr, workspace, theme, compact, browserReady: compan
|
|
|
61
64
|
const error = failure ? errorText(failure) : (browserReady ? status.data?.error : null) ?? null;
|
|
62
65
|
const scopeBlocked = (scope: "target" | "downstack") => !!plan && (plan.blockers.length > 0 || (scope === "target" ? plan.prs.slice(-1) : plan.prs).some(p => p.blockers.length > 0));
|
|
63
66
|
const act = (scope: "target" | "downstack") => { if (plan) submit.mutate({ planId: plan.id, scope }); };
|
|
64
|
-
//
|
|
67
|
+
// Merge is one click (a-click-on-merge-merges, client/merge-button.tsx). Only a PR whose scope can't be known when the
|
|
68
|
+
// button draws opens here with intent "merge": that starts the read-only check, and the plan below asks to confirm.
|
|
65
69
|
const started = useRef(false);
|
|
66
70
|
useEffect(() => { if (intent === "merge" && canMerge && !disabled && !started.current) { started.current = true; begin("merge"); } }, [intent, canMerge]);
|
|
67
71
|
// Opening from "Add reviewers" with nobody set goes straight to the picker instead of an error.
|
|
68
72
|
const loaded = !!reviewerSettings.data;
|
|
69
73
|
useEffect(() => { if (intent === "reviewers" && loaded && missingReviewers && !pr.snapshot?.draft && !reviewers.length) setPicking(true); }, [intent, loaded]);
|
|
70
74
|
if (pr.snapshot?.state !== "OPEN") return null;
|
|
75
|
+
const mergeOne = mergeControl(pr.key, { theme, compact, kind: "primary", disabled, fallback: () => begin("merge") });
|
|
76
|
+
const scopeLine = canMerge ? mergeScope(workspace, pr.key)?.detail ?? null : null;
|
|
71
77
|
const waitingFor = mergeBlockers(pr).filter(b => !b.startsWith("Graphite ")).map(lowerFirst);
|
|
72
78
|
// GitHub refuses auto-merge on a PR it can already merge, so the switch shows only while Merge is waiting, or to turn it off.
|
|
73
79
|
const showSwitch = browserReady && (!github || !canMerge || !!enabled);
|
|
@@ -104,10 +110,12 @@ export function PrControls({ pr, workspace, theme, compact, browserReady: compan
|
|
|
104
110
|
});
|
|
105
111
|
}} />}
|
|
106
112
|
{!plan && <View style={{ flexDirection: "row", alignItems: "center", flexWrap: "wrap", gap: 12 }}>
|
|
107
|
-
{(canMerge || queued || recentlySubmitted || busy) ? <Button title={busy ? checking.isPending ? "Checking…" : "Submitting…" : queued ? "Queued to merge" : recentlySubmitted ? "Submitted" : `Merge #${pr.number}`} icon={queued ? "Clock" : "GitMerge"} theme={theme} compact={compact} kind={canMerge ? "primary" : "secondary"} loading={busy} disabled={disabled || !canMerge} onPress={() => begin("merge")} />
|
|
113
|
+
{canMerge && !queued && !recentlySubmitted && !busy && mergeOne.button ? mergeOne.button : (canMerge || queued || recentlySubmitted || busy) ? <Button title={busy ? checking.isPending ? "Checking…" : "Submitting…" : queued ? "Queued to merge" : recentlySubmitted ? "Submitted" : `Merge #${pr.number}`} icon={queued ? "Clock" : "GitMerge"} theme={theme} compact={compact} kind={canMerge ? "primary" : "secondary"} loading={busy} disabled={disabled || !canMerge} onPress={() => begin("merge")} />
|
|
108
114
|
: <Text style={[t.meta, { flex: 1 }]}>{waitingFor.length ? `Merge opens when it clears: ${waitingFor.join(", ")}.` : github ? "Waiting for GitHub to confirm it can merge." : "Waiting for Graphite to report it ready to merge."}</Text>}
|
|
109
115
|
{showSwitch && <Switch theme={theme} compact={compact} label={`${github ? "Auto-merge" : "When ready"}${known ? "" : " · unknown"}`} accessibilityLabel={`${github ? "Auto-merge" : "Merge when ready"} for ${pr.repo} pull request ${pr.number}`} value={known ? !!enabled : null} disabled={disabled} onChange={() => begin(enabled ? "disable_mwr" : "enable_mwr")} />}
|
|
110
116
|
</View>}
|
|
117
|
+
{!plan && mergeOne.notice}
|
|
118
|
+
{!plan && scopeLine && <Text style={t.meta}>{scopeLine}</Text>}
|
|
111
119
|
{!plan && autoMergeOff && <Text style={t.meta}>Auto-merge is off for this repository. Turn on Allow auto-merge in its GitHub settings.</Text>}
|
|
112
120
|
{error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{error}</Text>}
|
|
113
121
|
{notice && <Text accessibilityLiveRegion="polite" style={t.meta}>{notice}</Text>}
|
package/client/stacks.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { Card, FoldRow, text, type Theme } from "./kit";
|
|
|
10
10
|
import { Spinner } from "./motion";
|
|
11
11
|
import { mergedColor, tint, toneColor, type Colors } from "./theme";
|
|
12
12
|
import { RichText } from "./rich-text";
|
|
13
|
+
import { HeldMerges } from "./merge-button";
|
|
13
14
|
|
|
14
15
|
const NODE = 16;
|
|
15
16
|
|
|
@@ -117,6 +118,7 @@ export function StacksCard({ workspace: w, theme, compact, open, toggle, onOpen,
|
|
|
117
118
|
<View style={{ paddingTop: 3 }}><Spinner color={c.accent} size={12} /></View>
|
|
118
119
|
<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>
|
|
119
120
|
</View>)}
|
|
121
|
+
<HeldMerges workspace={w} theme={theme} compact={compact} framed />
|
|
120
122
|
{!w.prs.length && <View style={{ paddingHorizontal: 12, paddingVertical: 10, borderTopWidth: 1, borderTopColor: c.border, gap: 4 }}>
|
|
121
123
|
<Text style={t.body}>No PRs yet</Text>
|
|
122
124
|
<Text style={t.meta}>The main agent registers each PR it opens, and Follow-up also picks up PRs submitted from this workspace's sessions.</Text>
|
package/client/toasts.tsx
CHANGED
|
@@ -29,6 +29,17 @@ const GAP = 8;
|
|
|
29
29
|
/** Web: where Paseo's own toast ends, so Follow-up's stack sits below it rather than on top of it. */
|
|
30
30
|
/** Where Paseo's own toast last sat (its top), so Follow-up's lands in the same place when it shows alone. */
|
|
31
31
|
let hostTop = 0;
|
|
32
|
+
/**
|
|
33
|
+
* Phones: the bottom dock a screen marks with this nativeID (Home's moves and reply). Follow-up's toasts sit just above
|
|
34
|
+
* it, in thumb reach, never over the screen's heading (a toast at the top covered "WEB-17 Saved search filters").
|
|
35
|
+
*/
|
|
36
|
+
export const TOAST_ANCHOR = "follow-up-toast-anchor";
|
|
37
|
+
function anchorTop(): number {
|
|
38
|
+
const doc = (globalThis as { document?: { getElementById(id: string): { getBoundingClientRect(): { top: number; height: number } } | null } }).document;
|
|
39
|
+
if (Platform.OS !== "web" || !doc) return 0;
|
|
40
|
+
const box = doc.getElementById(TOAST_ANCHOR)?.getBoundingClientRect();
|
|
41
|
+
return box && box.height > 0 ? box.top : 0;
|
|
42
|
+
}
|
|
32
43
|
function hostToastBottom(): number {
|
|
33
44
|
type Box = { top: number; bottom: number; height: number };
|
|
34
45
|
type El = { closest(sel: string): El | null; parentElement: El | null; getBoundingClientRect(): Box };
|
|
@@ -108,14 +119,26 @@ class IconSafe extends Component<{ children: ReactNode }, { failed: boolean }> {
|
|
|
108
119
|
function ToastStack({ theme, compact }: { theme: Theme; compact: boolean }) {
|
|
109
120
|
const list = useSyncExternalStore(subscribe, toastsNow, toastsNow);
|
|
110
121
|
const [hostBottom, setHostBottom] = useState(0);
|
|
111
|
-
|
|
122
|
+
const [dock, setDock] = useState(0);
|
|
123
|
+
// Only while Follow-up shows a toast: watch for Paseo's own above it, and on phones the dock below it (cheap DOM
|
|
124
|
+
// reads a quarter second).
|
|
112
125
|
useEffect(() => {
|
|
113
|
-
if (!list.length || Platform.OS !== "web") { setHostBottom(0); return; }
|
|
114
|
-
const tick = () => setHostBottom(b => { const next = hostToastBottom(); return next === b ? b : next; });
|
|
126
|
+
if (!list.length || Platform.OS !== "web") { setHostBottom(0); setDock(0); return; }
|
|
127
|
+
const tick = () => { setHostBottom(b => { const next = hostToastBottom(); return next === b ? b : next; }); if (compact) setDock(d => { const next = anchorTop(); return next === d ? d : next; }); };
|
|
115
128
|
tick(); const timer = setInterval(tick, 250);
|
|
116
129
|
return () => clearInterval(timer);
|
|
117
|
-
}, [list.length]);
|
|
130
|
+
}, [list.length, compact]);
|
|
118
131
|
if (!list.length) return null;
|
|
132
|
+
// Phones on the web: at the bottom, above the screen's dock when it marks one (TOAST_ANCHOR), in thumb reach and
|
|
133
|
+
// clear of the heading. The window's height is read here, as the dock's top is.
|
|
134
|
+
if (Platform.OS === "web" && compact) {
|
|
135
|
+
const height = (globalThis as { innerHeight?: number }).innerHeight ?? 0;
|
|
136
|
+
const above = dock && height ? Math.max(height - dock + GAP, 16) : 16;
|
|
137
|
+
const bottom = { position: "fixed", bottom: dock ? `${above}px` : `calc(env(safe-area-inset-bottom) + ${above}px)` } as unknown as object;
|
|
138
|
+
return <View pointerEvents="box-none" style={[{ left: 16, right: 16, zIndex: 1000, alignItems: "center", gap: GAP }, bottom]}>
|
|
139
|
+
{list.map(item => <ToastView key={item.id} item={item} theme={theme} compact={compact} />)}
|
|
140
|
+
</View>;
|
|
141
|
+
}
|
|
119
142
|
// Alone, it takes Paseo's toast place: below the app header (measured once a host toast has shown), not over it.
|
|
120
143
|
const top = hostBottom ? hostBottom + GAP : hostTop || (Platform.OS === "web" ? (compact ? 72 : 44) : TOP);
|
|
121
144
|
const position = Platform.OS === "web"
|
package/client/workspace-data.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { useRpc } from "@getpaseo/plugin/client";
|
|
|
4
4
|
import { getRpc } from "../shared/contracts";
|
|
5
5
|
import type { Workspace } from "../shared/model";
|
|
6
6
|
import type { LiveStore } from "./live";
|
|
7
|
+
import { acceptWorkspace } from "./live-copies";
|
|
7
8
|
import { workspaceKey } from "./keys";
|
|
8
9
|
|
|
9
10
|
const none = () => () => {};
|
|
@@ -18,12 +19,20 @@ const newer = (a: Workspace | null | undefined, b: Workspace | null | undefined)
|
|
|
18
19
|
* surface paints from it at once. On open it makes one small read of its own workspace, never a poll; a mutation's
|
|
19
20
|
* invalidation re-reads it once. Whichever copy is newer wins.
|
|
20
21
|
*/
|
|
22
|
+
type GetReply = { workspace: Workspace | null; error: string | null };
|
|
23
|
+
/** One read of a workspace; its copy also reaches every live store (acceptWorkspace), so no surface keeps an older one. */
|
|
24
|
+
export async function readWorkspace(read: (input: { workspaceId: string }) => Promise<GetReply>, workspaceId: string): Promise<GetReply> {
|
|
25
|
+
const reply = await read({ workspaceId });
|
|
26
|
+
if (reply.workspace) acceptWorkspace(reply.workspace);
|
|
27
|
+
return reply;
|
|
28
|
+
}
|
|
29
|
+
|
|
21
30
|
export function useWorkspace(live: LiveStore | undefined, workspaceId: string, options: { enabled?: boolean; read?: boolean } = {}) {
|
|
22
31
|
const enabled = (options.enabled ?? true) && !!workspaceId;
|
|
23
32
|
const read = useRpc(getRpc);
|
|
24
33
|
useSyncExternalStore(live?.subscribe ?? none, live?.version ?? (() => 0), live?.version ?? (() => 0));
|
|
25
34
|
const cached = enabled ? live?.get(workspaceId) : undefined;
|
|
26
|
-
const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => read
|
|
35
|
+
const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => readWorkspace(read, workspaceId), enabled: enabled && (options.read ?? true), staleTime: 15_000, refetchOnWindowFocus: false });
|
|
27
36
|
const workspace = enabled ? newer(cached, query.data?.workspace) : null;
|
|
28
37
|
return {
|
|
29
38
|
workspace,
|
package/index.server.ts
CHANGED
|
@@ -32,6 +32,7 @@ import { PriorityStore } from "./server/priorities";
|
|
|
32
32
|
import { UsageReader } from "./server/usage";
|
|
33
33
|
import { Engine, agentWorkspace, findWorkspace } from "./server/engine";
|
|
34
34
|
import { turnStarted, turnEnded, agentTrackedWorkspace } from "./server/turn-events";
|
|
35
|
+
import { TurnTimeline } from "./server/turn-timeline";
|
|
35
36
|
import { nextMessageInfo } from "./shared/task-rows";
|
|
36
37
|
import { sendingOf } from "./shared/sending";
|
|
37
38
|
import { Github } from "./server/github";
|
|
@@ -55,7 +56,7 @@ import { removeGlobalRegistrations } from "./server/mcp-registrations";
|
|
|
55
56
|
import { TrustBypass } from "./server/trust-bypass";
|
|
56
57
|
import { scopes } from "./server/scopes";
|
|
57
58
|
import { updateObligation } from "./server/obligations";
|
|
58
|
-
import { Inbox, type GuardPause } from "./server/inbox";
|
|
59
|
+
import { Inbox, INBOX_WRITE_MS, type GuardPause } from "./server/inbox";
|
|
59
60
|
import { daemonDirectory, guardPath } from "./server/inbox-directory";
|
|
60
61
|
import { fileSources } from "./server/inbox-classifier";
|
|
61
62
|
import { onBeforeSend } from "./server/daemon";
|
|
@@ -178,7 +179,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
178
179
|
const historyCache = HistoryCache.at(directory);
|
|
179
180
|
const gateway = new PaseoGateway(undefined, undefined, undefined, historyCache);
|
|
180
181
|
/** The daemon as the inbox sees it; its turnItems is the one timeline read per turn end (engine and inbox). */
|
|
181
|
-
const
|
|
182
|
+
const turnTimeline = new TurnTimeline();
|
|
183
|
+
gateway.turnTimeline = turnTimeline;
|
|
184
|
+
const inboxDirectory = daemonDirectory(gateway.directory, undefined, turnTimeline);
|
|
182
185
|
// Settings → Agents: which agent each special role uses, in agents.json (defaults when absent).
|
|
183
186
|
const agentSettings = new AgentSettingsStore(directory);
|
|
184
187
|
gateway.recoveryRole = () => agentSettings.role("recovery");
|
|
@@ -203,6 +206,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
203
206
|
actions.savedMethod = repo => prWorkflow.current().repos[repoKey(repo)]?.mergeMethod ?? null;
|
|
204
207
|
const engine = new Engine(store, github, gateway);
|
|
205
208
|
engine.wording = { reviewFix: repo => commandName(prWorkflow.reviewFix(repo)) };
|
|
209
|
+
actions.settleTasks = w => engine.settleTasks(w);
|
|
206
210
|
const governor = new Governor();
|
|
207
211
|
const linkedStore = new LinkedStore(directory);
|
|
208
212
|
const linked = new LinkedService({ store: linkedStore, sources: liveLinkedSources(), roomForBackground: async () => governor.allowsBackground() });
|
|
@@ -241,6 +245,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
241
245
|
// Who sent a message (server/inbox-classifier.ts): the inbox and the Overseer's new-workspace gate read one ledger.
|
|
242
246
|
const senderSources = fileSources(paseoHome, async () => (await inbox.store.snapshot()).ledger);
|
|
243
247
|
const inbox: Inbox = new Inbox(directory, {
|
|
248
|
+
writeMs: INBOX_WRITE_MS,
|
|
244
249
|
enabled: inboxSettings,
|
|
245
250
|
overseer: async () => (await overseer?.state())?.agentId ?? null,
|
|
246
251
|
briefs: {
|
|
@@ -1444,11 +1449,11 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1444
1449
|
void engine.nudge(assigned.id); return;
|
|
1445
1450
|
}
|
|
1446
1451
|
if (!agentTrackedWorkspace(await store.snapshot(), event.agent.id)) return;
|
|
1447
|
-
gateway.markDirty(event.agent.id);
|
|
1448
1452
|
// Since Paseo 0.13 the lifecycle payload deliberately contains no history.
|
|
1449
|
-
// Read
|
|
1450
|
-
//
|
|
1453
|
+
// Read the ended turn through the plugin-owned API, outside the state lock: one read from the agent's cursor,
|
|
1454
|
+
// shared with the inbox's handler and with discovery, which the read is kept for (a-turn-s-timeline-is-read-once).
|
|
1451
1455
|
const items = await inboxDirectory.turnItems!(event.agent.id, event.turnId ?? null).catch(() => null);
|
|
1456
|
+
gateway.markDirty(event.agent.id);
|
|
1452
1457
|
if (signal.aborted || stopped) return;
|
|
1453
1458
|
const guarded = !!interruption && await sessionGuardOwnsInterruption(event.agent.id, interruption).catch(() => false);
|
|
1454
1459
|
// Only the developer's Stop holds (shared/status.ts cancelCause): a turn already replaced by a newer one (the
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.0.1-beta.
|
|
4
|
+
"version": "2.0.1-beta.8",
|
|
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": [
|