paseo-follow-up 0.3.6 → 0.4.0
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/OVERVIEW.md +19 -7
- package/README.md +70 -79
- package/THIRD_PARTY_NOTICES.md +33 -0
- package/assets/LICENSE.lucide +43 -0
- package/assets/icon.png +0 -0
- package/assets/icon.svg +1 -0
- package/client/button-visibility.ts +2 -1
- package/client/chat.tsx +163 -0
- package/client/display.tsx +12 -17
- package/client/header.tsx +92 -0
- package/client/keys.ts +3 -0
- package/client/kit.tsx +119 -0
- package/client/large.tsx +58 -0
- package/client/live.tsx +159 -0
- package/client/motion.tsx +93 -0
- package/client/needs-you.tsx +121 -0
- package/client/overview.tsx +111 -16
- package/client/panel.tsx +257 -68
- package/client/pr-controls.tsx +50 -33
- package/client/pr-sheet.tsx +63 -0
- package/client/questions.tsx +307 -0
- package/client/settings.tsx +55 -20
- package/client/spec.tsx +113 -0
- package/client/stacks.tsx +128 -0
- package/client/tasks.tsx +113 -22
- package/client/theme.ts +69 -0
- package/docs/screenshots/follow-up-chat.png +0 -0
- package/docs/screenshots/follow-up-hero.png +0 -0
- package/docs/screenshots/follow-up-large.png +0 -0
- package/docs/screenshots/follow-up-mobile.png +0 -0
- package/docs/screenshots/follow-up-overview.png +0 -0
- package/docs/screenshots/follow-up-pill.png +0 -0
- package/docs/screenshots/follow-up-pr.png +0 -0
- package/docs/screenshots/follow-up-questions.png +0 -0
- package/docs/screenshots/follow-up-states.png +0 -0
- package/index.client.tsx +47 -16
- package/index.server.ts +53 -0
- package/package.json +4 -2
- package/paseo-plugin.json +11 -3
- package/server/agent-hook.mjs +2 -0
- package/server/daemon.ts +37 -6
- package/server/discovery.ts +6 -3
- package/server/engine.ts +39 -0
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +1 -1
- package/server/mcp.mjs +12 -2
- package/server/questions.ts +112 -0
- package/server/spec.ts +102 -0
- package/shared/activity.ts +56 -0
- package/shared/attention.ts +212 -0
- package/shared/chat.ts +130 -0
- package/shared/contracts.ts +21 -0
- package/shared/display.ts +2 -1
- package/shared/errors.ts +5 -0
- package/shared/model.ts +10 -0
- package/shared/pr-actions.ts +8 -1
- package/shared/questions.ts +123 -0
- package/shared/spec.ts +46 -0
- package/skills/follow-through/SKILL.md +4 -0
- package/client/components.tsx +0 -58
- package/client/navigation.tsx +0 -23
- package/docs/screenshots/follow-up-settings.png +0 -0
- package/docs/screenshots/follow-up-workspace.png +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Pressable, Text, View } from "react-native";
|
|
2
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import type { Pr, Workspace } from "../shared/model";
|
|
4
|
+
import { compactPrStatus, orderedStacks, settledForDisplay } from "../shared/presentation";
|
|
5
|
+
import { mergeQueued, prTone, stackOrder } from "../shared/attention";
|
|
6
|
+
import { noReviewers } from "../shared/reviewers";
|
|
7
|
+
import { Card, FoldRow, text, type Theme } from "./kit";
|
|
8
|
+
import { Spinner } from "./motion";
|
|
9
|
+
import { mergedColor, tint, toneColor, type Colors } from "./theme";
|
|
10
|
+
|
|
11
|
+
const NODE = 16;
|
|
12
|
+
|
|
13
|
+
/** The rail node: the same state colour as the PR's stack-bar segment. */
|
|
14
|
+
function Node({ pr, colors }: { pr: Pr; colors: Colors }) {
|
|
15
|
+
const tone = prTone(pr);
|
|
16
|
+
const s = pr.snapshot;
|
|
17
|
+
const color = toneColor(colors, tone);
|
|
18
|
+
const ring = { width: NODE, height: NODE, borderRadius: NODE / 2, alignItems: "center" as const, justifyContent: "center" as const };
|
|
19
|
+
if (tone === "pending") {
|
|
20
|
+
if (s?.checksPending) return <View style={[ring, { borderWidth: 1.5, borderColor: colors.border, backgroundColor: colors.surface0 }]}><Spinner color={colors.foregroundMuted} size={9} label="Checks running" /></View>;
|
|
21
|
+
return <View style={[ring, { borderWidth: 1.5, borderColor: colors.foregroundMuted, backgroundColor: colors.surface0 }]} />;
|
|
22
|
+
}
|
|
23
|
+
if (tone === "draft") return <View style={[ring, { borderWidth: 1.5, borderStyle: "dashed", borderColor: colors.foregroundMuted, backgroundColor: colors.surface0 }]} />;
|
|
24
|
+
const icon = tone === "merged" ? "GitMerge" : tone === "approved" ? (mergeQueued(pr) ? "Clock" : "Check") : tone === "danger" ? (s?.conflict ? "TriangleAlert" : "X") : tone === "warning" ? (s?.threads.length || s?.reviewDecision === "CHANGES_REQUESTED" ? "MessageSquare" : "X") : tone === "closed" ? "X" : "CircleHelp";
|
|
25
|
+
return <View style={[ring, { backgroundColor: colors.surface0 }]}><View style={[ring, { backgroundColor: tint(color, colors) }]}><Icon name={icon} size={10} color={color} /></View></View>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function statusColor(colors: Colors, pr: Pr) {
|
|
29
|
+
const { tone } = compactPrStatus(pr);
|
|
30
|
+
return tone === "merged" ? mergedColor(colors) : tone === "approved" ? colors.statusSuccess : tone === "warning" ? (prTone(pr) === "danger" ? colors.statusDanger : colors.statusWarning) : colors.foregroundMuted;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function PrRow({ pr, theme, first, last, showRepo, onOpen, compact, wide = false }: { pr: Pr; theme: Theme; first: boolean; last: boolean; showRepo: boolean; onOpen: (key: string) => void; compact: boolean; wide?: boolean }) {
|
|
34
|
+
const c = theme.colors; const t = text(c);
|
|
35
|
+
const s = pr.snapshot;
|
|
36
|
+
const status = compactPrStatus(pr);
|
|
37
|
+
const label = mergeQueued(pr) ? "Queued to merge" : status.label;
|
|
38
|
+
const line = c.border;
|
|
39
|
+
const extras = [
|
|
40
|
+
s?.state === "OPEN" && noReviewers(pr) ? "No reviewers" : null,
|
|
41
|
+
s?.state === "OPEN" && s.mergeWhenReady === "on" && !mergeQueued(pr) ? "Merge when ready" : null,
|
|
42
|
+
].filter(Boolean) as string[];
|
|
43
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={`Pull request ${pr.number}: ${s?.title ?? pr.stack}. ${label}. Open details`} onPress={() => onOpen(pr.key)}
|
|
44
|
+
style={state => ({ flexDirection: "row", gap: 10, paddingHorizontal: 12, minHeight: compact ? 52 : 44, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
45
|
+
<View style={{ width: NODE, alignItems: "center" }}>
|
|
46
|
+
<View style={{ width: 2, height: 10, backgroundColor: first ? "transparent" : line }} />
|
|
47
|
+
<Node pr={pr} colors={c} />
|
|
48
|
+
<View style={{ width: 2, flex: 1, minHeight: 4, backgroundColor: last ? "transparent" : line }} />
|
|
49
|
+
</View>
|
|
50
|
+
{/* Wide views give each row a status column, so states line up; long titles wrap once. */}
|
|
51
|
+
{wide ? <>
|
|
52
|
+
<View style={{ flex: 1, minWidth: 0, paddingVertical: 8, gap: 2 }}>
|
|
53
|
+
<Text numberOfLines={2} style={[t.body, s?.state !== "OPEN" && s ? { color: c.foregroundMuted } : null]}>{s?.title ?? `${pr.repo} pull request`}</Text>
|
|
54
|
+
<Text numberOfLines={1} style={t.meta}>{showRepo ? `${pr.repo} ` : ""}#{pr.number}{extras.map(e => ` · ${e}`).join("")}</Text>
|
|
55
|
+
</View>
|
|
56
|
+
<View style={{ width: 120, paddingTop: 8, alignItems: "flex-end" }}>
|
|
57
|
+
<Text numberOfLines={1} style={[t.meta, { color: statusColor(c, pr), fontWeight: "600" }]}>{label}</Text>
|
|
58
|
+
</View>
|
|
59
|
+
</> : <View style={{ flex: 1, minWidth: 0, paddingVertical: 8, gap: 2 }}>
|
|
60
|
+
<Text numberOfLines={2} style={[t.body, s?.state !== "OPEN" && s ? { color: c.foregroundMuted } : null]}>{s?.title ?? `${pr.repo} pull request`}</Text>
|
|
61
|
+
<Text numberOfLines={1} style={t.meta}>
|
|
62
|
+
<Text style={{ fontVariant: ["tabular-nums"] }}>{showRepo ? `${pr.repo.split("/")[1]} ` : ""}#{pr.number}</Text>
|
|
63
|
+
{" · "}<Text style={{ color: statusColor(c, pr), fontWeight: "600" }}>{label}</Text>
|
|
64
|
+
{extras.map(e => <Text key={e}>{` · ${e}`}</Text>)}
|
|
65
|
+
</Text>
|
|
66
|
+
</View>}
|
|
67
|
+
<View style={{ paddingTop: 11 }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
68
|
+
</Pressable>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function StackRows({ name, prs, theme, open, toggle, onOpen, compact, showRepo, settled, wide }: { name: string; prs: Pr[]; theme: Theme; open: (key: string) => boolean; toggle: (key: string) => void; onOpen: (key: string) => void; compact: boolean; showRepo: boolean; settled: boolean; wide: boolean }) {
|
|
72
|
+
const c = theme.colors; const t = text(c);
|
|
73
|
+
// Graphite's orientation: the top of the stack first, its base (merged first) at the bottom.
|
|
74
|
+
const ordered = stackOrder(prs).reverse();
|
|
75
|
+
const done = ordered.filter(settledForDisplay);
|
|
76
|
+
const active = ordered.filter(p => !settledForDisplay(p));
|
|
77
|
+
const foldKey = `merged:${name}`;
|
|
78
|
+
const showDone = settled || open(foldKey);
|
|
79
|
+
const rows = settled ? ordered : [...active, ...(showDone ? done : [])];
|
|
80
|
+
const fold = !settled && done.length > 0;
|
|
81
|
+
const merged = prs.filter(p => p.snapshot?.state === "MERGED").length;
|
|
82
|
+
return <View style={{ borderTopWidth: 1, borderTopColor: c.border }}>
|
|
83
|
+
<View style={{ flexDirection: "row", alignItems: "baseline", gap: 8, paddingHorizontal: 12, paddingTop: 9, paddingBottom: 3 }}>
|
|
84
|
+
<Text numberOfLines={1} style={[t.label, { flex: 1, fontSize: 12, lineHeight: 17 }]}>{name}</Text>
|
|
85
|
+
<Text style={[t.small, { fontVariant: ["tabular-nums"] }]}>{settled ? `${prs.length} PR${prs.length === 1 ? "" : "s"}` : `${merged} of ${prs.length} merged`}</Text>
|
|
86
|
+
</View>
|
|
87
|
+
{rows.map((pr, i) => <PrRow key={pr.key} pr={pr} theme={theme} first={i === 0} last={i === rows.length - 1 && !fold} showRepo={showRepo} onOpen={onOpen} compact={compact} wide={wide} />)}
|
|
88
|
+
{fold && <Pressable accessibilityRole="button" aria-expanded={showDone} accessibilityState={{ expanded: showDone }} accessibilityLabel={`${showDone ? "Hide" : "Show"} ${done.length} merged PR${done.length === 1 ? "" : "s"} in ${name}`} onPress={() => toggle(foldKey)}
|
|
89
|
+
style={state => ({ flexDirection: "row", gap: 10, paddingHorizontal: 12, minHeight: compact ? 44 : 30, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
90
|
+
<View style={{ width: NODE, alignItems: "center" }}>
|
|
91
|
+
<View style={{ width: 2, height: 7, backgroundColor: c.border }} />
|
|
92
|
+
<View style={{ width: NODE, height: NODE, borderRadius: NODE / 2, alignItems: "center", justifyContent: "center", backgroundColor: showDone ? c.surface0 : tint(mergedColor(c), c) }}>
|
|
93
|
+
<Icon name={showDone ? "ChevronUp" : "GitMerge"} size={10} color={showDone ? c.foregroundMuted : mergedColor(c)} />
|
|
94
|
+
</View>
|
|
95
|
+
</View>
|
|
96
|
+
<Text style={[t.meta, { paddingTop: 7, fontVariant: ["tabular-nums"] }]}>{showDone ? "Hide merged" : `${done.length} merged below`}</Text>
|
|
97
|
+
</Pressable>}
|
|
98
|
+
<View style={{ height: 6 }} />
|
|
99
|
+
</View>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function StacksCard({ workspace: w, theme, compact, open, toggle, onOpen, wide = false }: { workspace: Workspace; theme: Theme; compact: boolean; open: (key: string) => boolean; toggle: (key: string) => void; onOpen: (key: string) => void; wide?: boolean }) {
|
|
103
|
+
const c = theme.colors; const t = text(c);
|
|
104
|
+
const stacks = orderedStacks(w.prs);
|
|
105
|
+
const active = stacks.filter(s => !s.prs.every(settledForDisplay));
|
|
106
|
+
const settled = stacks.filter(s => s.prs.every(settledForDisplay));
|
|
107
|
+
const showRepo = new Set(w.prs.map(p => p.repo)).size > 1;
|
|
108
|
+
const openCount = w.prs.filter(p => p.snapshot?.state === "OPEN").length;
|
|
109
|
+
const inFlight = w.prActions.filter(a => a.state === "sending");
|
|
110
|
+
const settledOpen = open("settled");
|
|
111
|
+
const settledPrs = settled.reduce((n, s) => n + s.prs.length, 0);
|
|
112
|
+
return <Card theme={theme} compact={compact} icon="GitPullRequest" title="Pull requests" count={openCount ? `${openCount} open` : undefined}>
|
|
113
|
+
{inFlight.map(a => <View key={a.id} style={{ flexDirection: "row", gap: 8, paddingHorizontal: 12, paddingVertical: 8, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
114
|
+
<View style={{ paddingTop: 3 }}><Spinner color={c.accent} size={12} /></View>
|
|
115
|
+
<Text style={[t.meta, { flex: 1, color: c.foreground }]}>{a.result || "Submitting to Graphite…"}</Text>
|
|
116
|
+
</View>)}
|
|
117
|
+
{!w.prs.length && <View style={{ paddingHorizontal: 12, paddingVertical: 10, borderTopWidth: 1, borderTopColor: c.border, gap: 4 }}>
|
|
118
|
+
<Text style={t.body}>No PRs yet</Text>
|
|
119
|
+
<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>
|
|
120
|
+
</View>}
|
|
121
|
+
{active.map(s => <StackRows key={s.name} name={s.name} prs={s.prs} theme={theme} open={open} toggle={toggle} onOpen={onOpen} compact={compact} showRepo={showRepo} settled={false} wide={wide} />)}
|
|
122
|
+
{settled.length > 0 && <>
|
|
123
|
+
<FoldRow theme={theme} open={settledOpen} onPress={() => toggle("settled")} icon="Archive" iconColor={c.foregroundMuted}
|
|
124
|
+
label={`${settled.length} settled stack${settled.length === 1 ? "" : "s"} · ${settledPrs} PR${settledPrs === 1 ? "" : "s"}`} />
|
|
125
|
+
{settledOpen && settled.map(s => <StackRows key={s.name} name={s.name} prs={s.prs} theme={theme} open={open} toggle={toggle} onOpen={onOpen} compact={compact} showRepo={showRepo} settled wide={wide} />)}
|
|
126
|
+
</>}
|
|
127
|
+
</Card>;
|
|
128
|
+
}
|
package/client/tasks.tsx
CHANGED
|
@@ -1,44 +1,135 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
-
import { Pressable, Text,
|
|
3
|
-
import { Icon } from "@getpaseo/plugin/client/
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { Icon, Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
5
5
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import type { Obligation, Workspace } from "../shared/model";
|
|
7
|
+
import { followUpObligations } from "../shared/follow-up";
|
|
7
8
|
import { taskSchedule, type TaskTrigger } from "../shared/task-trigger";
|
|
8
9
|
import { taskTriggerRpc } from "../shared/contracts";
|
|
9
|
-
import { Button, type Theme } from "./
|
|
10
|
+
import { Button, Card, Chip, FoldRow, errorText, text, type Theme } from "./kit";
|
|
11
|
+
import { Spinner } from "./motion";
|
|
12
|
+
import type { Colors } from "./theme";
|
|
13
|
+
|
|
14
|
+
const finished = (o: Obligation) => ["done", "waived"].includes(o.status);
|
|
10
15
|
|
|
11
16
|
function TriggerEditor({ obligation: o, workspace, theme, compact }: { obligation: Obligation; workspace: Workspace; theme: Theme; compact: boolean }) {
|
|
17
|
+
const c = theme.colors; const t = text(c);
|
|
12
18
|
const [event, setEvent] = useState<TaskTrigger["event"] | "manual">(o.enable_follow_up && o.trigger ? o.trigger.event : "manual");
|
|
13
19
|
const [days, setDays] = useState(String(o.trigger?.delayDays ?? 0));
|
|
14
20
|
const [prs, setPrs] = useState(o.afterPrs);
|
|
15
|
-
const rpc = useRpc(taskTriggerRpc); const cache = useQueryClient();
|
|
21
|
+
const rpc = useRpc(taskTriggerRpc); const cache = useQueryClient(); const toast = useToast();
|
|
16
22
|
const gated = event === "merge" || event === "deploy";
|
|
17
23
|
const valid = !gated || prs.length > 0 && /^\d+$/.test(days) && Number(days) <= 3650;
|
|
18
|
-
const save = useMutation({ mutationFn: () => rpc({ workspaceId: workspace.id, obligationId: o.id, expectedRevision: o.revision, afterPrs: event === "now" ? [] : prs, trigger: event === "manual" ? null : { event, delayDays: gated ? Number(days) : 0 } }), onSuccess: async () => { await cache.invalidateQueries(); } });
|
|
24
|
+
const save = useMutation({ mutationFn: () => rpc({ workspaceId: workspace.id, obligationId: o.id, expectedRevision: o.revision, afterPrs: event === "now" ? [] : prs, trigger: event === "manual" ? null : { event, delayDays: gated ? Number(days) : 0 } }), onSuccess: async () => { toast.show("Schedule saved", { variant: "success" }); await cache.invalidateQueries(); } });
|
|
19
25
|
const busy = save.isPending;
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
const options = [["manual", "Manual"], ["now", "Now"], ["merge", "After merge"], ["deploy", "After deploy"]] as const;
|
|
27
|
+
return <View style={{ gap: 10 }}>
|
|
28
|
+
<View style={{ gap: 4 }}>
|
|
29
|
+
<Text style={t.label}>Send to the agent</Text>
|
|
30
|
+
<Text style={t.meta}>Manual tasks wait for you. Scheduled tasks join the next repair batch when they come due, and still follow your Auto-send choice.</Text>
|
|
31
|
+
</View>
|
|
22
32
|
<View accessibilityRole="radiogroup" accessibilityLabel={`Send trigger for ${o.title}`} style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
23
|
-
{
|
|
33
|
+
{options.map(([value, label]) => <Pressable key={value} accessibilityRole="radio" accessibilityLabel={label} aria-checked={event === value} accessibilityState={{ checked: event === value, disabled: busy }} disabled={busy} onPress={() => { setEvent(value); save.reset(); }}
|
|
34
|
+
style={{ minHeight: compact ? 44 : 30, justifyContent: "center", paddingHorizontal: 11, borderRadius: 999, borderWidth: 1, borderColor: event === value ? c.accent : c.border, backgroundColor: event === value ? c.accent : "transparent" }}>
|
|
35
|
+
<Text style={{ fontSize: 12, fontWeight: "600", color: event === value ? c.accentForeground : c.foreground }}>{label}</Text>
|
|
36
|
+
</Pressable>)}
|
|
24
37
|
</View>
|
|
25
38
|
{gated && <>
|
|
26
|
-
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
40
|
+
<Text style={t.meta}>Wait</Text>
|
|
41
|
+
<TextInput accessibilityLabel="Delay in days" inputMode="numeric" value={days} editable={!busy} onChangeText={setDays} style={{ width: 64, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: valid ? c.border : c.statusDanger, color: c.foreground, backgroundColor: c.surface1, fontSize: 13, fontVariant: ["tabular-nums"] }} />
|
|
42
|
+
<Text style={t.meta}>days after every selected PR {event === "merge" ? "merges" : "deploys"}</Text>
|
|
43
|
+
</View>
|
|
44
|
+
{!workspace.prs.length && <Text style={[t.meta, { color: c.statusWarning }]}>Register a PR before scheduling this task.</Text>}
|
|
45
|
+
<View>
|
|
46
|
+
{workspace.prs.map(p => <Pressable key={p.key} accessibilityRole="checkbox" accessibilityLabel={`Use PR ${p.number} for task trigger`} aria-checked={prs.includes(p.key)} accessibilityState={{ checked: prs.includes(p.key), disabled: busy }} disabled={busy} onPress={() => setPrs(prs.includes(p.key) ? prs.filter(k => k !== p.key) : [...prs, p.key])}
|
|
47
|
+
style={{ minHeight: compact ? 44 : 32, flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
48
|
+
<Icon name={prs.includes(p.key) ? "SquareCheck" : "Square"} size={15} color={prs.includes(p.key) ? c.accent : c.foregroundMuted} />
|
|
49
|
+
<Text numberOfLines={2} style={[t.body, { flex: 1, fontSize: 12, lineHeight: 17 }]}><Text style={{ fontVariant: ["tabular-nums"], color: c.foregroundMuted }}>#{p.number} </Text>{p.snapshot?.title ?? p.stack}</Text>
|
|
50
|
+
</Pressable>)}
|
|
51
|
+
</View>
|
|
30
52
|
</>}
|
|
31
|
-
{save.error && <Text accessibilityRole="alert" style={{
|
|
32
|
-
|
|
33
|
-
<Button title={busy ? "Saving…" : "Save trigger"} accessibilityLabel={`Save trigger for ${o.title}`} disabled={busy || !valid} onPress={() => save.mutate()} theme={theme} compact={compact} />
|
|
53
|
+
{save.error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{errorText(save.error)}</Text>}
|
|
54
|
+
<Button title="Save schedule" kind="primary" accessibilityLabel={`Save trigger for ${o.title}`} disabled={busy || !valid} loading={busy} onPress={() => save.mutate()} theme={theme} compact={compact} />
|
|
34
55
|
</View>;
|
|
35
56
|
}
|
|
36
57
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
/** The question a blocked task became, if the server has mirrored it. */
|
|
59
|
+
const linkedQuestion = (o: Obligation, w: Workspace) => o.status === "blocked" ? [...(w.questions ?? [])].reverse().find(q => q.taskId === o.id && q.taskRevision !== null) ?? null : null;
|
|
60
|
+
|
|
61
|
+
function statusOf(o: Obligation, w: Workspace) {
|
|
62
|
+
const schedule = taskSchedule(o, w);
|
|
63
|
+
if (finished(o)) return o.status === "done" ? "Done" : "Waived";
|
|
64
|
+
const q = linkedQuestion(o, w);
|
|
65
|
+
if (q) return q.answer ? `${q.id} · answered, waiting on the agent` : `${q.id} · waiting on your answer`;
|
|
66
|
+
if (o.status === "blocked") return "Needs a decision";
|
|
67
|
+
if (o.status === "working") return "Agent working";
|
|
68
|
+
return schedule.ready ? "Ready to send" : schedule.label;
|
|
69
|
+
}
|
|
70
|
+
function TaskGlyph({ o, w, colors }: { o: Obligation; w: Workspace; colors: Colors }) {
|
|
71
|
+
if (finished(o)) return <Icon name={o.status === "done" ? "Check" : "CircleSlash"} size={14} color={o.status === "done" ? colors.statusSuccess : colors.foregroundMuted} />;
|
|
72
|
+
if (o.status === "blocked") return <Icon name="MessageCircleQuestion" size={14} color={linkedQuestion(o, w) ? colors.foregroundMuted : colors.statusWarning} />;
|
|
73
|
+
if (o.status === "working") return <Spinner color={colors.accent} size={13} />;
|
|
74
|
+
if (o.enable_follow_up && o.trigger && !taskSchedule(o, w).ready) return <Icon name="Clock" size={14} color={colors.foregroundMuted} />;
|
|
75
|
+
return <View style={{ width: 14, height: 14, alignItems: "center", justifyContent: "center" }}><View style={{ width: 7, height: 7, borderRadius: 4, backgroundColor: colors.foregroundMuted, opacity: 0.6 }} /></View>;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function TaskRow({ o, w, theme, onOpen, compact }: { o: Obligation; w: Workspace; theme: Theme; onOpen: () => void; compact: boolean }) {
|
|
79
|
+
const c = theme.colors; const t = text(c);
|
|
80
|
+
const status = statusOf(o, w);
|
|
81
|
+
const scheduled = o.enable_follow_up && !!o.trigger;
|
|
82
|
+
const prs = o.afterPrs.map(p => `#${p.split("#")[1]}`).join(", ");
|
|
83
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={`Task: ${o.title}. ${status}. Open details`} onPress={onOpen}
|
|
84
|
+
style={state => ({ flexDirection: "row", gap: 10, paddingHorizontal: 12, paddingVertical: 9, minHeight: compact ? 52 : 44, borderTopWidth: 1, borderTopColor: c.border, backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
85
|
+
<View style={{ width: 16, paddingTop: 2, alignItems: "center" }}><TaskGlyph o={o} w={w} colors={c} /></View>
|
|
86
|
+
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
|
|
87
|
+
<Text numberOfLines={3} style={[t.body, finished(o) ? { color: c.foregroundMuted } : null]}>{o.title}</Text>
|
|
88
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
|
|
89
|
+
{scheduled && !finished(o) ? <Chip theme={theme} label={`${status}${prs ? ` · ${prs}` : ""}`} color={c.foregroundMuted} />
|
|
90
|
+
: <Text style={[t.meta, o.status === "blocked" && !linkedQuestion(o, w) ? { color: c.statusWarning } : null, { fontVariant: ["tabular-nums"] }]}>{status}{prs && !finished(o) && !linkedQuestion(o, w) ? ` · waits for ${prs}` : ""}</Text>}
|
|
91
|
+
</View>
|
|
92
|
+
</View>
|
|
93
|
+
<View style={{ paddingTop: 2 }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
94
|
+
</Pressable>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function TaskSheet({ o, w, theme, compact, onClose }: { o: Obligation | null; w: Workspace; theme: Theme; compact: boolean; onClose: () => void }) {
|
|
98
|
+
const c = theme.colors; const t = text(c);
|
|
99
|
+
const schedule = o ? taskSchedule(o, w) : null;
|
|
100
|
+
return <Modal title="Task" icon={<Icon name="ListTodo" size={18} color={c.foreground} />} open={!!o} onOpenChange={next => { if (!next) onClose(); }}>
|
|
101
|
+
<Modal.Content contentContainerStyle={{ padding: compact ? 16 : 20, gap: 14 }}>
|
|
102
|
+
{o && <>
|
|
103
|
+
<View style={{ gap: 6 }}>
|
|
104
|
+
<Text selectable style={[t.title, { fontSize: 16, lineHeight: 22 }]}>{o.title}</Text>
|
|
105
|
+
<Text style={t.meta}>{statusOf(o, w)}{o.afterPrs.length ? ` · after ${o.afterPrs.map(p => `#${p.split("#")[1]}`).join(", ")}` : ""}{schedule?.dueAt ? ` · due ${new Date(schedule.dueAt).toLocaleString([], { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" })}` : ""}</Text>
|
|
106
|
+
</View>
|
|
107
|
+
<View style={{ gap: 4 }}>
|
|
108
|
+
<Text style={t.label}>Evidence</Text>
|
|
109
|
+
<Text selectable style={t.meta}>{o.evidence || "Nothing recorded yet. The agent adds evidence when it checks or finishes the task."}</Text>
|
|
110
|
+
</View>
|
|
111
|
+
{!finished(o) && o.status !== "working" && <View style={{ paddingTop: 12, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
112
|
+
<TriggerEditor key={`${o.id}:${o.revision}`} obligation={o} workspace={w} theme={theme} compact={compact} />
|
|
113
|
+
</View>}
|
|
114
|
+
</>}
|
|
115
|
+
</Modal.Content>
|
|
116
|
+
</Modal>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function TasksCard({ workspace: w, theme, compact, open, toggle, onOpenQuestion }: { workspace: Workspace; theme: Theme; compact: boolean; open: (key: string) => boolean; toggle: (key: string) => void; onOpenQuestion?: (id: string) => void }) {
|
|
120
|
+
const c = theme.colors; const t = text(c);
|
|
121
|
+
const [selected, setSelected] = useState<string | null>(null);
|
|
122
|
+
const all = followUpObligations(w);
|
|
123
|
+
const outstanding = all.filter(o => !finished(o));
|
|
124
|
+
const completed = all.filter(finished);
|
|
125
|
+
const showDone = open("tasks-done");
|
|
126
|
+
return <Card theme={theme} compact={compact} icon="ListTodo" title="Tasks" count={outstanding.length ? `${outstanding.length} left` : undefined}>
|
|
127
|
+
{!all.length && <View style={{ paddingHorizontal: 12, paddingVertical: 10, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
128
|
+
<Text style={t.meta}>No follow-up tasks. The agent records work that outlives a merge here, like a migration to run or a production check.</Text>
|
|
129
|
+
</View>}
|
|
130
|
+
{outstanding.map(o => { const q = linkedQuestion(o, w); return <TaskRow key={o.id} o={o} w={w} theme={theme} compact={compact} onOpen={() => q && onOpenQuestion ? onOpenQuestion(q.id) : setSelected(o.id)} />; })}
|
|
131
|
+
{completed.length > 0 && <FoldRow theme={theme} open={showDone} onPress={() => toggle("tasks-done")} icon="Check" iconColor={c.statusSuccess} label={`${completed.length} done`} />}
|
|
132
|
+
{showDone && completed.map(o => <TaskRow key={o.id} o={o} w={w} theme={theme} compact={compact} onOpen={() => setSelected(o.id)} />)}
|
|
133
|
+
<TaskSheet o={all.find(o => o.id === selected) ?? null} w={w} theme={theme} compact={compact} onClose={() => setSelected(null)} />
|
|
134
|
+
</Card>;
|
|
44
135
|
}
|
package/client/theme.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { PluginHostProps } from "@getpaseo/plugin/client";
|
|
2
|
+
import type { ViewStyle } from "react-native";
|
|
3
|
+
import type { PrTone } from "../shared/attention";
|
|
4
|
+
|
|
5
|
+
export type Theme = PluginHostProps["theme"];
|
|
6
|
+
export type Colors = Theme["colors"];
|
|
7
|
+
|
|
8
|
+
function channels(color: string): number[] | null {
|
|
9
|
+
const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(color.trim());
|
|
10
|
+
if (hex) return (hex[1].length === 3 ? [...hex[1]].map(d => d + d) : hex[1].match(/../g)!).map(d => parseInt(d, 16));
|
|
11
|
+
const fn = /^rgba?\(\s*([\d.]+)[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(color);
|
|
12
|
+
return fn ? fn.slice(1, 4).map(Number) : null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Light when the page ground is bright; unknown colours count as dark, Paseo's default. */
|
|
16
|
+
export function isLight(colors: Colors): boolean {
|
|
17
|
+
const rgb = channels(colors.surface0);
|
|
18
|
+
if (!rgb) return false;
|
|
19
|
+
const [r, g, b] = rgb.map(v => { const c = v / 255; return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4; });
|
|
20
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b > 0.4;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function withAlpha(color: string, alpha: number): string {
|
|
24
|
+
const rgb = channels(color);
|
|
25
|
+
return rgb ? `rgba(${rgb.join(", ")}, ${alpha})` : color;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A tag fill in the same hue as its text: 12% on light grounds, 16% on dark ones. */
|
|
29
|
+
export function tint(color: string, colors: Colors): string {
|
|
30
|
+
return withAlpha(color, isLight(colors) ? 0.12 : 0.16);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Card depth: a hairline ring plus a soft lift in light themes, a single faint ring in dark ones. */
|
|
34
|
+
export function raised(colors: Colors): ViewStyle {
|
|
35
|
+
return isLight(colors)
|
|
36
|
+
? { boxShadow: "0px 0px 0px 1px rgba(0, 0, 0, 0.07), 0px 1px 2px -1px rgba(0, 0, 0, 0.06), 0px 2px 6px 0px rgba(0, 0, 0, 0.04)" } as ViewStyle
|
|
37
|
+
: { boxShadow: "0px 0px 0px 1px rgba(255, 255, 255, 0.08)" } as ViewStyle;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Paseo's merged purple. The plugin SDK omits statusMerged, so match the host's light and dark values. */
|
|
41
|
+
export function mergedColor(colors: Colors): string {
|
|
42
|
+
const provided = (colors as Colors & { statusMerged?: string }).statusMerged;
|
|
43
|
+
return provided ?? (isLight(colors) ? "#7347af" : "#a890d5");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function toneColor(colors: Colors, tone: PrTone): string {
|
|
47
|
+
switch (tone) {
|
|
48
|
+
case "merged": return mergedColor(colors);
|
|
49
|
+
case "approved": return colors.statusSuccess;
|
|
50
|
+
case "danger": return colors.statusDanger;
|
|
51
|
+
case "warning": return colors.statusWarning;
|
|
52
|
+
default: return colors.foregroundMuted;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Bar segments: only merged PRs are solid, so the filled length is real progress. Every other PR is
|
|
58
|
+
* a neutral track carrying a short dash in its full status hue, the same colour as its rail text.
|
|
59
|
+
*/
|
|
60
|
+
export function segmentPaint(colors: Colors, tone: PrTone): { fill: string; line: string | null } {
|
|
61
|
+
if (tone === "merged") return { fill: mergedColor(colors), line: null };
|
|
62
|
+
const fill = withAlpha(colors.foregroundMuted, isLight(colors) ? 0.16 : 0.22);
|
|
63
|
+
switch (tone) {
|
|
64
|
+
case "approved": case "danger": case "warning": return { fill, line: toneColor(colors, tone) };
|
|
65
|
+
default: return { fill, line: null };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const mono = { fontVariant: ["tabular-nums"] as ("tabular-nums")[] };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.client.tsx
CHANGED
|
@@ -1,36 +1,61 @@
|
|
|
1
1
|
import { contributeDisplay } from "./client/display";
|
|
2
|
-
import { withSettingsFooter } from "./client/navigation";
|
|
3
2
|
import { withButtonVisibility } from "./client/button-visibility";
|
|
4
|
-
import type
|
|
3
|
+
import { openExternalUrl, type PluginClientContext, type PluginButtonRegistration, type PluginScreenProps, type PluginWorkspacePanelProps } from "@getpaseo/plugin/client";
|
|
5
4
|
import { Dimensions } from "react-native";
|
|
6
5
|
import { FollowSettings } from "./client/settings";
|
|
7
6
|
import { FollowPanel } from "./client/panel";
|
|
8
7
|
import { FollowOverview } from "./client/overview";
|
|
8
|
+
import { contributeChat } from "./client/chat";
|
|
9
|
+
import { contributePills, createLiveStore, headerIcon, sidebarItem } from "./client/live";
|
|
10
|
+
import { FollowLarge, LARGE_SCREEN } from "./client/large";
|
|
11
|
+
|
|
12
|
+
const OVERVIEW = "follow-through";
|
|
9
13
|
|
|
10
14
|
export default function contribute(host: PluginClientContext) {
|
|
11
15
|
const visibility = withButtonVisibility(host);
|
|
12
16
|
const client = visibility.client;
|
|
13
17
|
const location = () => Dimensions.get("window").width < 768 ? "workspace" as const : "explorer" as const;
|
|
14
18
|
const panel = () => location() === "workspace" ? "follow-through-tab" : "follow-through";
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const openPanel = (workspaceId: string) => client.openPanel(panel(), { workspaceId, location: location() });
|
|
20
|
+
const openSettings = () => client.openSettings("projects");
|
|
21
|
+
const openOverview = () => client.openScreen({ screenId: OVERVIEW });
|
|
22
|
+
const openLarge = (workspaceId: string) => client.openScreen({ screenId: LARGE_SCREEN, params: { workspaceId } });
|
|
23
|
+
const store = createLiveStore(client);
|
|
24
|
+
|
|
25
|
+
const removeDisplay = contributeDisplay(client, { id: "follow-through-overview", title: "Follow-up", Component: sidebarItem(store, OVERVIEW) });
|
|
26
|
+
const Overview = (props: PluginScreenProps) => <FollowOverview {...props} openSettings={openSettings} />;
|
|
27
|
+
const Panel = (props: PluginWorkspacePanelProps) => <FollowPanel {...props} openSettings={openSettings} openOverview={openOverview} openLarge={openLarge} />;
|
|
28
|
+
const Large = (props: PluginScreenProps) => <FollowLarge {...props} openSettings={openSettings} openOverview={openOverview} />;
|
|
29
|
+
const removers: (() => unknown)[] = [
|
|
30
|
+
client.addScreen({ id: OVERVIEW, title: "Follow-up", Component: Overview }),
|
|
31
|
+
client.addScreen({ id: LARGE_SCREEN, title: params => store.get(params.workspaceId ?? "")?.title ?? "Follow-up", Component: Large }),
|
|
32
|
+
client.addScreen({ id: "follow-through-settings", title: "Follow-up settings", Component: FollowSettings }),
|
|
33
|
+
client.addScreen({ id: "project-settings", title: "Follow-up settings", Component: FollowSettings }),
|
|
34
|
+
client.addSettingsScreen({ id: "projects", title: "Follow-up", icon: "GitPullRequest", Component: FollowSettings }),
|
|
35
|
+
client.addWorkspacePanel({ id: "follow-through", title: "Follow-up", icon: "GitPullRequest", locations: ["workspace", "explorer"], Component: Panel }),
|
|
36
|
+
client.addWorkspacePanel({ id: "follow-through-tab", title: "Follow-up", icon: "GitPullRequest", locations: ["workspace"], Component: Panel }),
|
|
37
|
+
client.addCommandCenterItem({ id: "open-follow-through", title: "Follow-up: open for this workspace", icon: "GitPullRequest", keywords: ["PR", "stack", "repairs", "done", "archive", "follow-through"], context: "workspace", onSelect({ openPanel }) { openPanel(panel(), { location: location() }); } }),
|
|
38
|
+
client.addCommandCenterItem({ id: "open-follow-through-large", title: "Follow-up: open the larger view", icon: "Maximize2", keywords: ["expand", "full screen", "maximize", "PR", "stack"], context: "workspace", onSelect({ workspace, openScreen }) { openScreen({ screenId: LARGE_SCREEN, params: { workspaceId: workspace.id } }); } }),
|
|
39
|
+
client.addCommandCenterItem({ id: "open-follow-through-spec", title: "Follow-up: open the spec", icon: "FileText", keywords: ["spec", "artifact", "plan", "doc", "design"], context: "workspace", onSelect({ workspace, openPanel }) {
|
|
40
|
+
const url = store.get(workspace.id)?.spec?.url;
|
|
41
|
+
// Without a link yet, open the panel, where the spec link can be added.
|
|
42
|
+
if (url) void openExternalUrl(url).catch(() => undefined); else openPanel(panel(), { location: location() });
|
|
43
|
+
} }),
|
|
44
|
+
client.addCommandCenterItem({ id: "follow-through-overview", title: "Follow-up: all tracked workspaces", icon: "LayoutList", keywords: ["workspaces", "needs you", "attention", "done", "overview"], context: "global", onSelect({ openScreen }) { openScreen({ screenId: OVERVIEW }); } }),
|
|
45
|
+
client.addCommandCenterItem({ id: "follow-through-settings", title: "Follow-up: project settings", icon: "Settings", keywords: ["default", "tracking", "project"], context: "global", onSelect({ openScreen }) { openScreen({ screenId: "follow-through-settings" }); } }),
|
|
46
|
+
client.addSlashCommand({ name: "follow-up", description: "Open this workspace's PRs and remaining work", argumentHint: "", context: "agent", onSubmit({ openPanel }) { openPanel(panel(), { location: location() }); } }),
|
|
47
|
+
client.addSlashCommand({ name: "follow-through", description: "Open this workspace's PRs and remaining work", argumentHint: "", context: "agent", onSubmit({ openPanel }) { openPanel(panel(), { location: location() }); } }),
|
|
48
|
+
contributeChat(client),
|
|
49
|
+
contributePills(client, store, openPanel),
|
|
50
|
+
];
|
|
21
51
|
|
|
22
|
-
|
|
23
|
-
client.addWorkspacePanel({ id: "follow-through-tab", title: "Follow-up", icon: "GitPullRequest", context: "workspace", locations: ["workspace"], Component: withSettingsFooter(FollowPanel, client) });
|
|
24
|
-
client.addCommandCenterItem({ id: "open-follow-through", title: "Open workspace follow-up", icon: "GitPullRequest", keywords: ["PR", "stack", "done", "archive"], context: "workspace", onSelect({ openPanel }) { openPanel(panel(), { location: location() }); } });
|
|
25
|
-
client.addCommandCenterItem({ id: "follow-through-overview", title: "Open follow-up overview", icon: "GitPullRequest", keywords: ["workspaces", "attention", "done"], context: "global", onSelect({ openScreen }) { openScreen({ screenId: "follow-through" }); } });
|
|
26
|
-
client.addSlashCommand({ name: "follow-through", description: "Open this workspace's PRs and remaining work", argumentHint: "", context: "agent", onSubmit({ openPanel }) { openPanel(panel(), { location: location() }); } });
|
|
27
|
-
client.addSlashCommand({ name: "follow-up", description: "Open this workspace's PRs and remaining work", argumentHint: "", context: "agent", onSubmit({ openPanel }) { openPanel(panel(), { location: location() }); } });
|
|
52
|
+
const HeaderIcon = headerIcon(store);
|
|
28
53
|
const headers = new Map<string, PluginButtonRegistration>();
|
|
29
54
|
let stopped = false;
|
|
30
55
|
let releaseObservation: (() => Promise<void>) | null = null;
|
|
31
56
|
const register = (workspaceId: string) => {
|
|
32
57
|
if (stopped || headers.has(workspaceId)) return;
|
|
33
|
-
headers.set(workspaceId, client.addHeaderButton({ id: "follow-through", workspaceId, button: { title: "
|
|
58
|
+
headers.set(workspaceId, client.addHeaderButton({ id: "follow-through", workspaceId, button: { title: "Follow-up", icon: HeaderIcon, behavior: { kind: "action", onPress() { openPanel(workspaceId); } } } }));
|
|
34
59
|
};
|
|
35
60
|
const remove = client.paseo.workspaces.subscribe(update => {
|
|
36
61
|
if (update.kind === "remove") { headers.get(update.id)?.remove(); headers.delete(update.id); }
|
|
@@ -49,5 +74,11 @@ export default function contribute(host: PluginClientContext) {
|
|
|
49
74
|
cursor = next.pageInfo.nextCursor;
|
|
50
75
|
}
|
|
51
76
|
})().catch(() => undefined);
|
|
52
|
-
return async () => {
|
|
77
|
+
return async () => {
|
|
78
|
+
stopped = true;
|
|
79
|
+
visibility.dispose(); removeDisplay(); remove(); store.stop();
|
|
80
|
+
for (const r of removers) void r();
|
|
81
|
+
for (const button of headers.values()) button.remove();
|
|
82
|
+
await releaseObservation?.();
|
|
83
|
+
};
|
|
53
84
|
}
|
package/index.server.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { displayPreferences } from "./shared/display";
|
|
2
|
+
import { DEFAULT_QUESTION_MODE, questionPreferences, type QuestionMode } from "./shared/questions";
|
|
3
|
+
import { askQuestion, recordAnswer, syncTaskQuestions, withdrawQuestion } from "./server/questions";
|
|
4
|
+
import { agentSetSpec, developerSetSpec } from "./server/spec";
|
|
2
5
|
import type { PluginServerContext, PluginHandlerContext } from "@getpaseo/plugin/server";
|
|
3
6
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
7
|
import { join } from "node:path";
|
|
@@ -25,6 +28,9 @@ import { updateObligation } from "./server/obligations";
|
|
|
25
28
|
|
|
26
29
|
export default function contribute(server: PluginServerContext) {
|
|
27
30
|
server.registerSettings(displayPreferences);
|
|
31
|
+
const questionSettings = server.registerSettings(questionPreferences);
|
|
32
|
+
// An unreadable setting means the default, which never lets an agent build ahead of the developer.
|
|
33
|
+
const questionMode = async (): Promise<QuestionMode> => { try { const state = await questionSettings.read(); return state.status === "ready" ? state.values.mode : DEFAULT_QUESTION_MODE; } catch { return DEFAULT_QUESTION_MODE; } };
|
|
28
34
|
const directory = join(paseoHome, "plugin-data", "follow-through");
|
|
29
35
|
const bridge = join(directory, "mcp.mjs");
|
|
30
36
|
const store = new Store(directory);
|
|
@@ -180,10 +186,57 @@ export default function contribute(server: PluginServerContext) {
|
|
|
180
186
|
const result = await store.mutate(state => {
|
|
181
187
|
const w = agentWorkspace(state, agentId, "write", workspaceId);
|
|
182
188
|
const obligation = updateObligation(w, input);
|
|
189
|
+
syncTaskQuestions(w, Date.now());
|
|
183
190
|
changed(w); return { ...w, updatedObligationId: obligation.id };
|
|
184
191
|
});
|
|
185
192
|
void engine.tick(); return result;
|
|
186
193
|
});
|
|
194
|
+
server.handle(rpc.askQuestionRpc, async ({ agentId, ...input }, { paseo }) => {
|
|
195
|
+
await requireReady();
|
|
196
|
+
const workspaceId = await callerWorkspaceId(agentId, paseo);
|
|
197
|
+
const mode = await questionMode();
|
|
198
|
+
return store.mutate(state => {
|
|
199
|
+
const w = agentWorkspace(state, agentId, "write", workspaceId);
|
|
200
|
+
const { question, instruction } = askQuestion(w, agentId, input, mode, Date.now());
|
|
201
|
+
changed(w);
|
|
202
|
+
return { workspaceId: w.id, question, mode, instruction };
|
|
203
|
+
});
|
|
204
|
+
});
|
|
205
|
+
server.handle(rpc.recordAnswerRpc, async ({ agentId, id, choice, words }, { paseo }) => {
|
|
206
|
+
await requireReady();
|
|
207
|
+
const workspaceId = await callerWorkspaceId(agentId, paseo);
|
|
208
|
+
return store.mutate(state => {
|
|
209
|
+
const w = agentWorkspace(state, agentId, "write", workspaceId);
|
|
210
|
+
return { workspaceId: w.id, question: recordAnswer(w, agentId, id, choice, words, Date.now()) };
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
server.handle(rpc.withdrawQuestionRpc, async ({ agentId, id, reason }, { paseo }) => {
|
|
214
|
+
await requireReady();
|
|
215
|
+
const workspaceId = await callerWorkspaceId(agentId, paseo);
|
|
216
|
+
return store.mutate(state => {
|
|
217
|
+
const w = agentWorkspace(state, agentId, "write", workspaceId);
|
|
218
|
+
return { workspaceId: w.id, question: withdrawQuestion(w, agentId, id, reason, Date.now()) };
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
server.handle(rpc.setSpecRpc, async ({ agentId, url, title }, { paseo }) => {
|
|
222
|
+
await requireReady();
|
|
223
|
+
const workspaceId = await callerWorkspaceId(agentId, paseo);
|
|
224
|
+
return store.mutate(state => {
|
|
225
|
+
const w = agentWorkspace(state, agentId, "write", workspaceId);
|
|
226
|
+
const { applied, message } = agentSetSpec(w, agentId, url, title, Date.now());
|
|
227
|
+
return { workspaceId: w.id, spec: w.spec, applied, message };
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
server.handle(rpc.workspaceSpecRpc, async input => {
|
|
231
|
+
await requireReady();
|
|
232
|
+
return store.mutate(state => {
|
|
233
|
+
const w = findWorkspace(state, input.workspaceId);
|
|
234
|
+
if (!w.enable_tracking || w.archived) throw new Error("Track this workspace before changing its spec link.");
|
|
235
|
+
developerSetSpec(w, input, Date.now());
|
|
236
|
+
return w;
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
server.handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action); });
|
|
187
240
|
server.handle(rpc.declareDoneRpc, async ({ agentId, summary }, { paseo }) => { await requireReady(); return engine.declareDone(agentId, summary, await callerWorkspaceId(agentId, paseo, false)); });
|
|
188
241
|
server.handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result }, { paseo }) => {
|
|
189
242
|
await requireReady();
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
8
8
|
"paseo-plugin.json",
|
|
9
|
+
"assets/",
|
|
9
10
|
"OVERVIEW.md",
|
|
10
11
|
"index.client.ts",
|
|
11
12
|
"index.client.tsx",
|
|
@@ -16,6 +17,7 @@
|
|
|
16
17
|
"shared/",
|
|
17
18
|
"skills/",
|
|
18
19
|
"README.md",
|
|
20
|
+
"THIRD_PARTY_NOTICES.md",
|
|
19
21
|
"docs/screenshots/",
|
|
20
22
|
"scripts/build.mjs"
|
|
21
23
|
],
|
package/paseo-plugin.json
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "follow-through",
|
|
3
3
|
"name": "Follow-up",
|
|
4
|
-
"
|
|
4
|
+
"icon": "assets/icon.png",
|
|
5
|
+
"description": "See every workspace PR stack at a glance, answer your agents' questions, send repairs in one batch, and know when something needs you.",
|
|
5
6
|
"media": [
|
|
6
|
-
"docs/screenshots/follow-up-
|
|
7
|
-
"docs/screenshots/follow-up-
|
|
7
|
+
"docs/screenshots/follow-up-hero.png",
|
|
8
|
+
"docs/screenshots/follow-up-questions.png",
|
|
9
|
+
"docs/screenshots/follow-up-states.png",
|
|
10
|
+
"docs/screenshots/follow-up-pill.png",
|
|
11
|
+
"docs/screenshots/follow-up-large.png",
|
|
12
|
+
"docs/screenshots/follow-up-pr.png",
|
|
13
|
+
"docs/screenshots/follow-up-chat.png",
|
|
14
|
+
"docs/screenshots/follow-up-overview.png",
|
|
15
|
+
"docs/screenshots/follow-up-mobile.png"
|
|
8
16
|
],
|
|
9
17
|
"requirements": {
|
|
10
18
|
"paseo": ">=0.14.0"
|