paseo-follow-up 1.4.0-beta.2 → 1.4.0-beta.21
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 +15 -4
- package/README.md +59 -6
- package/client/about.tsx +22 -12
- package/client/agents.tsx +132 -0
- package/client/brief.tsx +200 -72
- package/client/chat.tsx +12 -4
- package/client/display.tsx +62 -11
- package/client/header.tsx +40 -19
- package/client/home-chrome.tsx +135 -40
- package/client/home-list.tsx +90 -35
- package/client/home-view.ts +66 -8
- package/client/home.tsx +268 -77
- package/client/inbox-store.ts +15 -7
- package/client/keys.ts +3 -0
- package/client/kit.tsx +46 -15
- package/client/large.tsx +9 -10
- package/client/live.tsx +8 -6
- package/client/needs-you.tsx +36 -8
- package/client/onboarding.tsx +455 -0
- package/client/panel.tsx +98 -23
- package/client/pill.tsx +41 -21
- package/client/pr-controls.tsx +38 -14
- package/client/pr-sheet.tsx +8 -6
- package/client/questions.tsx +6 -4
- package/client/reviewers.tsx +63 -21
- package/client/settings-shell.tsx +77 -0
- package/client/settings.tsx +145 -49
- package/client/shipping.tsx +186 -0
- package/client/spec.tsx +1 -1
- package/client/stacks.tsx +4 -3
- package/client/tasks.tsx +1 -1
- package/client/theme.ts +21 -0
- package/client/visibility.ts +7 -0
- package/client/workspace-data.ts +37 -0
- package/docs/screenshots/decision-card-answered-phone-light.png +0 -0
- package/docs/screenshots/decision-card-expanded-chat-light.png +0 -0
- package/docs/screenshots/decision-card-partial-phone-dark.png +0 -0
- package/docs/screenshots/decision-card-unanswered-phone-dark.png +0 -0
- package/index.client.tsx +27 -8
- package/index.server.ts +257 -24
- package/package.json +5 -3
- package/server/about.ts +15 -4
- package/server/agent-actions.ts +75 -6
- package/server/agent-hook.mjs +54 -16
- package/server/agent-parity.ts +149 -0
- package/server/agent-settings.ts +124 -0
- package/server/ai-jobs.ts +88 -23
- package/server/daemon.ts +165 -105
- package/server/directory.ts +165 -0
- package/server/discovery.ts +34 -6
- package/server/engine.ts +31 -9
- package/server/etag.ts +14 -0
- package/server/github.ts +66 -5
- package/server/hook-source.ts +1 -1
- package/server/inbox-directory.ts +14 -19
- package/server/inbox.ts +28 -1
- package/server/mcp-source.ts +1 -1
- package/server/mcp.d.mts +3 -1
- package/server/mcp.mjs +83 -10
- package/server/native-tools.ts +3 -2
- package/server/onboarding.ts +101 -0
- package/server/overseer-prompt-source.ts +1 -1
- package/server/overseer-prompt.md +1 -0
- package/server/overseer.ts +72 -8
- package/server/pr-actions.ts +91 -15
- package/server/pr-workflow.ts +188 -0
- package/server/questions.ts +1 -1
- package/server/ranker.ts +431 -0
- package/server/recovery-config.ts +17 -0
- package/server/scopes.ts +20 -8
- package/server/tasks.ts +9 -3
- package/server/trust-bypass.ts +125 -0
- package/shared/about.ts +8 -3
- package/shared/activity.ts +3 -1
- package/shared/agent-settings.ts +169 -0
- package/shared/attention.ts +8 -4
- package/shared/brief.ts +44 -0
- package/shared/chat.ts +3 -1
- package/shared/contracts.ts +42 -4
- package/shared/display.ts +16 -1
- package/shared/headline.ts +5 -0
- package/shared/home.ts +6 -0
- package/shared/model.ts +12 -1
- package/shared/onboarding.ts +243 -0
- package/shared/overseer.ts +10 -2
- package/shared/pr-actions.ts +26 -4
- package/shared/pr-workflow.ts +133 -0
- package/shared/questions.ts +17 -0
- package/shared/ranker.ts +237 -0
- package/shared/search.ts +25 -5
- package/shared/settings-nav.ts +97 -0
- package/skills/follow-through/SKILL.md +3 -1
package/client/home-list.tsx
CHANGED
|
@@ -2,10 +2,10 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode
|
|
|
2
2
|
import { FlatList, Pressable, Text, View } from "react-native";
|
|
3
3
|
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import { GROUP_TITLE, quietFolds, type Badge, type HomeGroupId, type HomeModel, type Workstream } from "../shared/home";
|
|
5
|
-
import type
|
|
6
|
-
import { PriorityLine, ResultRow } from "./home-chrome";
|
|
5
|
+
import { ASK_KEY, type OmniboxItem, type WorkspaceItem } from "../shared/search";
|
|
6
|
+
import { AskRow, PriorityLine, ResultRow } from "./home-chrome";
|
|
7
7
|
import { age } from "../shared/inbox";
|
|
8
|
-
import { headlineColor, mergedColor, runningColor, tint, toneColor, withAlpha, type Colors } from "./theme";
|
|
8
|
+
import { headlineColor, mergedColor, readable, runningColor, tint, toneColor, withAlpha, type Colors } from "./theme";
|
|
9
9
|
import { useMinute } from "./home-data";
|
|
10
10
|
import { Spinner } from "./motion";
|
|
11
11
|
import type { Theme } from "./kit";
|
|
@@ -29,8 +29,11 @@ type Entry =
|
|
|
29
29
|
| { type: "row"; key: string; s: Workstream }
|
|
30
30
|
| { type: "fold"; key: string; project: string; count: number; archivable: number; open: boolean }
|
|
31
31
|
| { type: "more"; key: string; project: string; left: number }
|
|
32
|
-
| { type: "result"; key: string; item:
|
|
33
|
-
| { type: "
|
|
32
|
+
| { type: "result"; key: string; item: WorkspaceItem; index: number }
|
|
33
|
+
| { type: "ask"; key: string; ask: string; index: number }
|
|
34
|
+
| { type: "label"; key: string; text: string }
|
|
35
|
+
| { type: "empty"; key: string }
|
|
36
|
+
| { type: "slot"; key: string };
|
|
34
37
|
|
|
35
38
|
export type HomeListProps = {
|
|
36
39
|
model: HomeModel;
|
|
@@ -48,6 +51,10 @@ export type HomeListProps = {
|
|
|
48
51
|
footer?: ReactNode;
|
|
49
52
|
/** Chrome above the list that never scrolls away: search, sort, status, limits. */
|
|
50
53
|
top?: ReactNode;
|
|
54
|
+
/** Phones: a row placed right after the Needs-you group (the setup offer), so it never pushes the first ask down. */
|
|
55
|
+
afterNeeds?: ReactNode;
|
|
56
|
+
/** Phones: the action under the "Nothing followed yet" empty state. */
|
|
57
|
+
emptyAction?: ReactNode;
|
|
51
58
|
/** While searching: one flat ranked list instead of the groups. */
|
|
52
59
|
results?: OmniboxItem[] | null;
|
|
53
60
|
activeResult?: number;
|
|
@@ -56,9 +63,11 @@ export type HomeListProps = {
|
|
|
56
63
|
filter?: HomeGroupId | null;
|
|
57
64
|
/** The pinned Overseer row under the brief. Absent: the Overseer is off (or this surface has none). */
|
|
58
65
|
overseer?: OverseerRowState | null;
|
|
66
|
+
/** An omnibox ask is on its way to the Overseer. */
|
|
67
|
+
asking?: boolean;
|
|
59
68
|
};
|
|
60
69
|
|
|
61
|
-
export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, results, activeResult = 0, onResult, filter = null, overseer = null }: HomeListProps) {
|
|
70
|
+
export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, emptyAction, results, activeResult = 0, onResult, filter = null, overseer = null, asking = false }: HomeListProps) {
|
|
62
71
|
const c = theme.colors;
|
|
63
72
|
const [closed, setClosed] = useState<Set<string>>(new Set(["quiet"]));
|
|
64
73
|
const [openProjects, setOpenProjects] = useState<Set<string>>(new Set());
|
|
@@ -72,6 +81,12 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
72
81
|
// Search ignores the sort and the groups: ranked by match, archived ones last under their own label.
|
|
73
82
|
let archivedShown = false;
|
|
74
83
|
results.forEach((item, index) => {
|
|
84
|
+
if (item.ask !== undefined) {
|
|
85
|
+
// The ask row closes the list; with no match it follows the "no match" line.
|
|
86
|
+
if (index === 0) out.push({ type: "label", key: "l:none", text: "No workspace, branch or PR matches." });
|
|
87
|
+
out.push({ type: "ask", key: item.key, ask: item.ask, index });
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
75
90
|
if (item.hit.group === "archived" && !archivedShown) { archivedShown = true; out.push({ type: "label", key: "l:archived", text: "Archived" }); }
|
|
76
91
|
out.push({ type: "result", key: `r:${item.provider}:${item.key}`, item, index });
|
|
77
92
|
});
|
|
@@ -83,9 +98,10 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
83
98
|
for (const g of model.groups) {
|
|
84
99
|
if (filter && g.id !== filter) continue;
|
|
85
100
|
const open = !!filter || !closed.has(g.id);
|
|
86
|
-
|
|
87
|
-
if (!open)
|
|
88
|
-
if (g.id
|
|
101
|
+
// Phones with one group filtered: the chip above already says "N Needs you ×"; no header repeating it.
|
|
102
|
+
if (!(touch && filter)) out.push({ type: "header", key: `h:${g.id}`, group: g.id, title: g.title, count: g.items.length, open });
|
|
103
|
+
if (!open) { if (g.id === "needs" && afterNeeds && !filter) out.push({ type: "slot", key: "s:afterNeeds" }); continue; }
|
|
104
|
+
if (g.id !== "quiet") { for (const s of g.items) out.push({ type: "row", key: s.key, s }); if (g.id === "needs" && afterNeeds && !filter) out.push({ type: "slot", key: "s:afterNeeds" }); continue; }
|
|
89
105
|
for (const f of quietFolds(g.items)) {
|
|
90
106
|
const fopen = openProjects.has(f.project);
|
|
91
107
|
out.push({ type: "fold", key: `f:${f.project}`, project: f.project, count: f.items.length, archivable: f.archivable, open: fopen });
|
|
@@ -95,17 +111,26 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
95
111
|
if (f.items.length > shown) out.push({ type: "more", key: `m:${f.project}`, project: f.project, left: f.items.length - shown });
|
|
96
112
|
}
|
|
97
113
|
}
|
|
114
|
+
// Phones: nothing followed yet says so and what fills the list, instead of a blank screen under the pinned rows.
|
|
115
|
+
if (touch && !filter && model.groups.every(g => !g.items.length)) out.push({ type: "empty", key: "l:nothing" });
|
|
98
116
|
return out;
|
|
99
117
|
if (filter && !out.length) out.push({ type: "label", key: "l:empty", text: `Nothing in ${GROUP_TITLE[filter as HomeGroupId]} right now.` });
|
|
100
118
|
return out;
|
|
101
|
-
}, [model, closed, openProjects, pages, briefLine, results, filter, !!overseer]);
|
|
119
|
+
}, [model, closed, openProjects, pages, briefLine, results, filter, !!overseer, touch, !!afterNeeds]);
|
|
102
120
|
|
|
103
121
|
const render = useCallback(({ item }: { item: Entry }) => {
|
|
104
122
|
switch (item.type) {
|
|
105
123
|
case "label": return <Text accessibilityRole={item.key === "l:archived" ? "header" : undefined} style={{ color: c.foregroundMuted, fontSize: item.key === "l:archived" ? 11 : 13, fontWeight: item.key === "l:archived" ? "600" : "400",
|
|
106
124
|
letterSpacing: item.key === "l:archived" ? 0.6 : 0, textTransform: item.key === "l:archived" ? "uppercase" : "none", paddingHorizontal: dense ? 8 : 16, paddingTop: 12, paddingBottom: 4 }}>{item.text}</Text>;
|
|
125
|
+
case "empty": return <View accessibilityRole="summary" style={{ marginHorizontal: 16, marginTop: 20, gap: 6 }}>
|
|
126
|
+
<Text accessibilityRole="header" style={{ color: c.foreground, fontSize: 17, lineHeight: 23, fontWeight: "600" }}>Nothing followed yet</Text>
|
|
127
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 14, lineHeight: 20 }}>Follow a workspace from its Follow-up panel, or turn a project on in Settings so its workspaces join on their own. They show up here once their agents work.</Text>
|
|
128
|
+
{emptyAction ? <View style={{ flexDirection: "row", marginTop: 6 }}>{emptyAction}</View> : null}
|
|
129
|
+
</View>;
|
|
130
|
+
case "slot": return <View style={{ paddingVertical: 10 }}>{afterNeeds}</View>;
|
|
107
131
|
case "result": return <ResultRow item={item.item} s={model.byKey.get(item.item.key)} theme={theme} active={item.index === activeResult} dense={dense} touch={touch} onPress={() => onResult?.(item.item)} />;
|
|
108
|
-
case "
|
|
132
|
+
case "ask": return <AskRow ask={item.ask} theme={theme} active={item.index === activeResult} dense={dense} touch={touch} sending={!!asking} onPress={() => onResult?.({ provider: "overseer", key: ASK_KEY, ask: item.ask })} />;
|
|
133
|
+
case "brief": return <BriefRow theme={theme} line={briefLine ?? ""} selected={!touch && (selectedKey === null || selectedKey === BRIEF_KEY)} touch={touch} onSelect={onSelect} />;
|
|
109
134
|
case "overseer": return overseer ? <OverseerRow theme={theme} o={overseer} selected={selectedKey === OVERSEER_KEY} touch={touch} onSelect={onSelect} /> : null;
|
|
110
135
|
case "header": return <GroupHeader theme={theme} title={item.title} count={item.count} open={item.open} tone={item.group === "needs" && item.count ? c.statusWarning : undefined} dense={dense} touch={touch} onPress={() => toggle(item.group)} />;
|
|
111
136
|
case "fold": return <Pressable accessibilityRole="button" aria-expanded={item.open} accessibilityState={{ expanded: item.open }} accessibilityLabel={`${item.project}, ${item.count}. ${item.open ? "Collapse" : "Expand"}`} onPress={() => toggleProject(item.project)}
|
|
@@ -127,16 +152,16 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
127
152
|
</View>;
|
|
128
153
|
}
|
|
129
154
|
}
|
|
130
|
-
}, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, model, overseer?.state, overseer?.line]);
|
|
155
|
+
}, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, model, overseer?.state, overseer?.line, asking, afterNeeds, emptyAction]);
|
|
131
156
|
|
|
132
157
|
const listRef = useRef<FlatList<Entry>>(null);
|
|
133
158
|
// Keep the keyboard-active result in view.
|
|
134
159
|
useEffect(() => {
|
|
135
160
|
if (!results?.length) return;
|
|
136
|
-
const at = data.findIndex(e => e.type === "result" && e.index === activeResult);
|
|
161
|
+
const at = data.findIndex(e => (e.type === "result" || e.type === "ask") && e.index === activeResult);
|
|
137
162
|
if (at >= 0) listRef.current?.scrollToIndex({ index: at, viewPosition: 0.5, animated: false });
|
|
138
163
|
}, [activeResult, results, data]);
|
|
139
|
-
const list = <FlatList ref={listRef} data={data} keyExtractor={e => e.key} renderItem={render} extraData={`${selectedKey}:${activeResult}`} onScrollToIndexFailed={() => undefined}
|
|
164
|
+
const list = <FlatList ref={listRef} data={data} keyExtractor={e => e.key} renderItem={render} extraData={`${selectedKey}:${activeResult}:${asking}`} onScrollToIndexFailed={() => undefined}
|
|
140
165
|
initialNumToRender={30} maxToRenderPerBatch={30} windowSize={9} removeClippedSubviews={false}
|
|
141
166
|
ListHeaderComponent={header ? <>{header}</> : null} ListFooterComponent={footer ? <>{footer}</> : <View style={{ height: 32 }} />}
|
|
142
167
|
style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 8 }} keyboardShouldPersistTaps="handled" />;
|
|
@@ -146,10 +171,11 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
146
171
|
function GroupHeader({ theme, title, count, open, tone, dense, touch, onPress }: { theme: Theme; title: string; count: number; open: boolean; tone?: string; dense: boolean; touch: boolean; onPress: () => void }) {
|
|
147
172
|
const c = theme.colors;
|
|
148
173
|
return <Pressable accessibilityRole="button" aria-expanded={open} accessibilityState={{ expanded: open }} accessibilityLabel={`${title}, ${count}. ${open ? "Collapse" : "Expand"}`} onPress={onPress}
|
|
149
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 6, minHeight: touch ? 44 : dense ? 28 : 34, paddingHorizontal: dense ? 8 : 16, paddingTop: dense ? 4 : 8 }}>
|
|
150
|
-
{dense && <Icon name={open ? "ChevronDown" : "ChevronRight"} size={12} color={c.foregroundMuted} />}
|
|
151
|
-
|
|
152
|
-
<Text style={{ color: tone ?? c.foregroundMuted, fontSize: 11, lineHeight: 14,
|
|
174
|
+
style={{ flexDirection: "row", alignItems: "center", gap: 6, minHeight: touch ? 44 : dense ? 28 : 34, paddingHorizontal: touch ? 16 : dense ? 8 : 16, paddingTop: touch ? 8 : dense ? 4 : 8 }}>
|
|
175
|
+
{dense && <Icon name={open ? "ChevronDown" : "ChevronRight"} size={touch ? 14 : 12} color={c.foregroundMuted} />}
|
|
176
|
+
{/* Phones: sentence case at 13, the section role; desktop keeps the small caps. */}
|
|
177
|
+
<Text accessibilityRole="header" style={touch ? { color: tone ?? c.foregroundMuted, fontSize: 13, lineHeight: 18, fontWeight: "600" } : { color: tone ?? c.foregroundMuted, fontSize: 11, lineHeight: 14, fontWeight: "600", letterSpacing: 0.6, textTransform: "uppercase" }}>{touch ? title.charAt(0) + title.slice(1).toLowerCase() : title}</Text>
|
|
178
|
+
<Text style={{ color: tone ?? c.foregroundMuted, fontSize: touch ? 13 : 11, lineHeight: touch ? 18 : 14, fontVariant: ["tabular-nums"] }}>{count}</Text>
|
|
153
179
|
{!dense && !open && <Icon name="ChevronRight" size={12} color={c.foregroundMuted} />}
|
|
154
180
|
</Pressable>;
|
|
155
181
|
}
|
|
@@ -158,9 +184,10 @@ function BriefRow({ theme, line, selected, touch, onSelect }: { theme: Theme; li
|
|
|
158
184
|
const c = theme.colors;
|
|
159
185
|
return <Pressable accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={`Morning brief. ${line}`} onPress={() => onSelect(BRIEF_KEY)}
|
|
160
186
|
style={state => ({ flexDirection: "row", alignItems: "center", gap: 10, minHeight: touch ? 52 : 40, paddingHorizontal: 16, backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
161
|
-
<Icon name="Sun" size={15} color={c.foregroundMuted} />
|
|
162
|
-
<Text style={{ color: c.foreground, fontSize: 13, fontWeight: "600" }}>Morning brief</Text>
|
|
163
|
-
<Text numberOfLines={1} style={{ flex: 1, color: c.foregroundMuted, fontSize: 12 }}>{line}</Text>
|
|
187
|
+
<Icon name="Sun" size={touch ? 16 : 15} color={c.foregroundMuted} />
|
|
188
|
+
<Text style={{ color: c.foreground, fontSize: touch ? 14 : 13, fontWeight: "600" }}>Morning brief</Text>
|
|
189
|
+
<Text numberOfLines={1} style={{ flex: 1, color: c.foregroundMuted, fontSize: touch ? 13 : 12 }}>{line}</Text>
|
|
190
|
+
{touch && <Icon name="ChevronRight" size={16} color={c.foregroundMuted} />}
|
|
164
191
|
</Pressable>;
|
|
165
192
|
}
|
|
166
193
|
|
|
@@ -172,14 +199,20 @@ function OverseerRow({ theme, o, selected, touch, onSelect }: { theme: Theme; o:
|
|
|
172
199
|
// Its ask isn't a Needs-you row (it's yours to route), so the edge marks it the way blocking rows are marked.
|
|
173
200
|
borderLeftWidth: 2, borderLeftColor: o.state === "asks" || o.state === "error" ? withAlpha(tone, 0.9) : "transparent",
|
|
174
201
|
backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
175
|
-
{o.state === "running" ? <Spinner color={tone} size={13} label="Overseer working" /> : <Icon name="MessagesSquare" size={15} color={o.state === "idle" || o.state === "start" ? c.foregroundMuted : tone} />}
|
|
176
|
-
<Text style={{ color: c.foreground, fontSize: 13, fontWeight: "600" }}>Overseer</Text>
|
|
177
|
-
<Text numberOfLines={1} style={{ flex: 1, color: o.state === "asks" || o.state === "error" ? tone : c.foregroundMuted, fontSize: 12 }}>{o.line}</Text>
|
|
202
|
+
{o.state === "running" ? <Spinner color={tone} size={13} label="Overseer working" /> : <Icon name="MessagesSquare" size={touch ? 16 : 15} color={o.state === "idle" || o.state === "start" ? c.foregroundMuted : tone} />}
|
|
203
|
+
<Text style={{ color: c.foreground, fontSize: touch ? 14 : 13, fontWeight: "600" }}>Overseer</Text>
|
|
204
|
+
<Text numberOfLines={1} style={{ flex: 1, color: o.state === "asks" || o.state === "error" ? tone : c.foregroundMuted, fontSize: touch ? 13 : 12 }}>{touch && o.state === "start" ? "Ask about any workspace" : o.line}</Text>
|
|
205
|
+
{touch && <Icon name="ChevronRight" size={16} color={c.foregroundMuted} />}
|
|
178
206
|
</Pressable>;
|
|
179
207
|
}
|
|
180
208
|
|
|
181
|
-
|
|
182
|
-
|
|
209
|
+
/**
|
|
210
|
+
* `text`: the colour carries the state word on its own (phones), so it's lifted to 4.5:1 on dark grounds. Finished
|
|
211
|
+
* uses the host accent and success green, both fill colours at about 3:1 as 12px text.
|
|
212
|
+
*/
|
|
213
|
+
export function glyphColor(s: Pick<Workstream, "tone">, c: Colors, text = false): string {
|
|
214
|
+
const base = s.tone === "running" ? runningColor(c) : s.tone === "success" ? c.statusSuccess : headlineColor(s.tone, c);
|
|
215
|
+
return text ? readable(base, c) : base;
|
|
183
216
|
}
|
|
184
217
|
const badgeColor = (b: Badge, c: Colors) => b.tone === "danger" ? c.statusDanger : b.tone === "warning" ? c.statusWarning : b.tone === "success" ? c.statusSuccess : b.tone === "merged" ? mergedColor(c) : c.foregroundMuted;
|
|
185
218
|
|
|
@@ -200,6 +233,14 @@ export function PrChipView({ s, c }: { s: Workstream; c: Colors }) {
|
|
|
200
233
|
</View>;
|
|
201
234
|
}
|
|
202
235
|
|
|
236
|
+
/** Phones: the PR summary as plain text ("#1402 +1 · 1 thread") inside a meta line, no bordered chip. */
|
|
237
|
+
export function PrSummaryText({ s, c, lead = "" }: { s: Workstream; c: Colors; lead?: string }) {
|
|
238
|
+
if (!s.pr) return null;
|
|
239
|
+
const checks = s.pr.checks;
|
|
240
|
+
return <Text>{lead}<Text style={{ color: c.foreground }}>{s.pr.label.replace(/\+(\d)/, " +$1")}</Text>
|
|
241
|
+
{checks && <Text style={{ color: checks.tone === "muted" ? c.foregroundMuted : badgeColor({ text: "", tone: checks.tone }, c) }}>{` ${checks.text}`}</Text>}</Text>;
|
|
242
|
+
}
|
|
243
|
+
|
|
203
244
|
/** The age on the right. It re-renders on the shared minute clock without touching its row. */
|
|
204
245
|
export function Age({ iso, c, size = 12 }: { iso: string | null; c: Colors; size?: number }) {
|
|
205
246
|
const now = useMinute();
|
|
@@ -210,35 +251,49 @@ export function Age({ iso, c, size = 12 }: { iso: string | null; c: Colors; size
|
|
|
210
251
|
type RowProps = { s: Workstream; sig: string; theme: Theme; dense: boolean; touch: boolean; selected: boolean; onSelect: (key: string) => void };
|
|
211
252
|
const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect }: RowProps) {
|
|
212
253
|
const c = theme.colors;
|
|
213
|
-
const color = glyphColor(s, c);
|
|
254
|
+
const color = glyphColor(s, c, touch);
|
|
214
255
|
const blocking = s.group === "needs" && s.tier === 0;
|
|
215
256
|
const muted = s.group === "quiet" || s.group === "later";
|
|
216
257
|
const line = [s.word && s.group !== "needs" ? s.word : null, s.line].filter(Boolean).join(" · ");
|
|
258
|
+
// Phones: "Working" under every row of a "Running 9" group says nothing the header didn't; one line per row instead.
|
|
259
|
+
const generic = touch && !s.word && (s.line === "Working" || s.line === "Fixing");
|
|
217
260
|
const label = [s.title + (s.agent ? ` › ${s.agent}` : ""), s.word, s.line].filter(Boolean).join(". ");
|
|
218
261
|
return <Pressable accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={label} onPress={() => onSelect(s.key)}
|
|
219
|
-
style={state => ({ flexDirection: "row", alignItems: dense ? "flex-start" : "center", gap: dense ? 8 : 10, minHeight: touch ? 56 : dense ? 36 : 38, paddingLeft: dense ? 8 : 16, paddingRight: dense ? 8 : 16, paddingVertical: dense ? 6 : 0,
|
|
262
|
+
style={state => ({ flexDirection: "row", alignItems: dense ? "flex-start" : "center", gap: touch ? 10 : dense ? 8 : 10, minHeight: touch ? 56 : dense ? 36 : 38, paddingLeft: touch ? 14 : dense ? 8 : 16, paddingRight: touch ? 16 : dense ? 8 : 16, paddingVertical: touch ? 12 : dense ? 6 : 0,
|
|
263
|
+
...(touch ? { borderBottomWidth: 1, borderBottomColor: withAlpha(c.border, 0.6) } : {}),
|
|
220
264
|
borderLeftWidth: 2, borderLeftColor: blocking ? withAlpha(color, 0.9) : "transparent",
|
|
221
265
|
backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
222
|
-
<View style={{ width: 16, alignItems: "center", paddingTop: dense ? 1 : 0 }}>
|
|
223
|
-
{s.tone === "running" && s.icon === "LoaderCircle" ? <Spinner color={color} size={13} label="Running" /> : <Icon name={s.icon} size={15} color={color} />}
|
|
266
|
+
<View style={{ width: touch ? 18 : 16, alignItems: "center", paddingTop: touch ? 2 : dense ? 1 : 0 }}>
|
|
267
|
+
{s.tone === "running" && s.icon === "LoaderCircle" ? <Spinner color={color} size={13} label="Running" /> : <Icon name={s.icon} size={touch ? 17 : 15} color={color} />}
|
|
224
268
|
</View>
|
|
225
|
-
{
|
|
269
|
+
{/* Phones: title 15/20 over two lines, then state · reason, then the PRs as plain text (no bordered chips). */}
|
|
270
|
+
{touch ? <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
271
|
+
<View style={{ flexDirection: "row", alignItems: "flex-start", gap: 8 }}>
|
|
272
|
+
<Text numberOfLines={2} style={{ flex: 1, minWidth: 0, color: muted ? c.foregroundMuted : c.foreground, fontSize: 15, lineHeight: 20, fontWeight: muted ? "400" : "500" }}>{s.title}</Text>
|
|
273
|
+
<View style={{ paddingTop: 2 }}><Age iso={s.at} c={c} size={12} /></View>
|
|
274
|
+
</View>
|
|
275
|
+
{(!!s.word || !!s.line) && !generic && <Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>
|
|
276
|
+
{s.word && s.group === "needs" ? <Text style={{ color, fontWeight: "600" }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
277
|
+
</Text>}
|
|
278
|
+
{!!s.priority?.reason && <PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} size={12} lines={2} />}
|
|
279
|
+
{!!s.pr && <Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}><PrSummaryText s={s} c={c} /></Text>}
|
|
280
|
+
</View> : dense ? <View style={{ flex: 1, minWidth: 0, gap: 1 }}>
|
|
226
281
|
<Text numberOfLines={1} style={{ color: muted ? c.foregroundMuted : c.foreground, fontSize: 13, lineHeight: 18, fontWeight: muted ? "400" : "500" }}>{s.title}{s.agent ? <Text style={{ color: c.foregroundMuted }}>{` › ${s.agent}`}</Text> : null}</Text>
|
|
227
282
|
{(!!s.word || !!s.line) && <Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>
|
|
228
283
|
{s.word && s.group === "needs" ? <Text style={{ color, fontWeight: "600" }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
229
284
|
</Text>}
|
|
230
|
-
{s.priority && <PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} size={11} />}
|
|
285
|
+
{!!s.priority?.reason && <PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} size={11} lines={2} />}
|
|
231
286
|
{touch && (s.pr || s.badges.length > 0) && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6, marginTop: 4 }}>
|
|
232
287
|
{s.badges.map(b => <BadgeView key={b.text} b={b} c={c} />)}<PrChipView s={s} c={c} />
|
|
233
288
|
</View>}
|
|
234
|
-
</View> : <View style={{ flex: 1, minWidth: 0, gap: 1, paddingVertical: s.priority ? 4 : 0 }}><View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
289
|
+
</View> : <View style={{ flex: 1, minWidth: 0, gap: 1, paddingVertical: s.priority?.reason ? 4 : 0 }}><View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
235
290
|
<Text numberOfLines={1} style={{ flexShrink: 0, maxWidth: "55%", color: muted ? c.foregroundMuted : c.foreground, fontSize: 13, fontWeight: muted ? "400" : "500" }}>{s.title}{s.agent ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{` › ${s.agent}`}</Text> : null}</Text>
|
|
236
291
|
<Text numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 12 }}>
|
|
237
292
|
{s.word && s.group === "needs" ? <Text style={{ color }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
238
293
|
</Text>
|
|
239
294
|
{s.badges.map(b => <BadgeView key={b.text} b={b} c={c} />)}
|
|
240
295
|
<PrChipView s={s} c={c} />
|
|
241
|
-
</View>{s.priority && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
|
|
242
|
-
<Age iso={s.at} c={c} size={dense ? 11 : 12} />
|
|
296
|
+
</View>{!!s.priority?.reason && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
|
|
297
|
+
{!touch && <Age iso={s.at} c={c} size={dense ? 11 : 12} />}
|
|
243
298
|
</Pressable>;
|
|
244
299
|
}, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect);
|
package/client/home-view.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
|
-
import { overseerStartRpc, overseerStatusRpc, prioritiesRpc, usageRpc } from "../shared/contracts";
|
|
2
|
+
import { overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, rankNowRpc, rankStatusRpc, usageRpc } from "../shared/contracts";
|
|
3
3
|
import type { RpcOutput } from "@getpaseo/plugin";
|
|
4
4
|
import type { Priority } from "../shared/priorities";
|
|
5
5
|
import { DEFAULT_SORT, isSortMode, type SortMode } from "../shared/sort";
|
|
6
6
|
import type { AgentLite } from "../shared/search";
|
|
7
7
|
import { NO_USAGE, USAGE_POLL_MS, type Usage } from "../shared/usage";
|
|
8
|
+
import { onVisible, whileVisible } from "./visibility";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* What Home adds on top of the inbox, live and Paseo stores (1.3.0-beta.2): the sort choice (per device), external
|
|
@@ -28,6 +29,7 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
28
29
|
let priorities: Priority[] = [];
|
|
29
30
|
let usage: Usage = NO_USAGE;
|
|
30
31
|
let overseer: RpcOutput<typeof overseerStatusRpc> | null = null;
|
|
32
|
+
let rank: RpcOutput<typeof rankStatusRpc> | null = null;
|
|
31
33
|
const agents = new Map<string, AgentLite>();
|
|
32
34
|
let version = 0;
|
|
33
35
|
let focusToken = 0;
|
|
@@ -39,16 +41,33 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
39
41
|
const emitSoon = () => { if (pending) return; pending = setTimeout(() => { pending = null; emit(); }, 250); };
|
|
40
42
|
|
|
41
43
|
const timers: ReturnType<typeof setTimeout>[] = [];
|
|
44
|
+
// Nothing polls while the app is hidden; each poll runs once when it comes back (1.4.0).
|
|
45
|
+
const runs: (() => Promise<void>)[] = [];
|
|
42
46
|
const poll = (ms: number, work: () => Promise<boolean>) => {
|
|
43
|
-
|
|
47
|
+
let waiting = false;
|
|
48
|
+
const run = async () => {
|
|
49
|
+
waiting = false;
|
|
50
|
+
try { if (await work()) emit(); } catch { /* keep the last answer */ }
|
|
51
|
+
if (stopped) return;
|
|
52
|
+
const next = whileVisible(ms, () => void run());
|
|
53
|
+
if (next) timers.push(next); else waiting = true;
|
|
54
|
+
};
|
|
55
|
+
runs.push(async () => { if (waiting) await run(); });
|
|
44
56
|
void run();
|
|
45
57
|
};
|
|
58
|
+
const offVisible = onVisible(() => { for (const r of runs) void r(); });
|
|
46
59
|
poll(PRIORITY_POLL_MS, async () => {
|
|
47
60
|
const next = (await client.rpc(prioritiesRpc, {})).items;
|
|
48
61
|
if (JSON.stringify(next) === JSON.stringify(priorities)) return false;
|
|
49
62
|
priorities = next; return true;
|
|
50
63
|
});
|
|
51
|
-
|
|
64
|
+
// The ranker's last run and source health, with the priorities (the ranker runs at most hourly).
|
|
65
|
+
poll(PRIORITY_POLL_MS, async () => {
|
|
66
|
+
const next = await client.rpc(rankStatusRpc, {});
|
|
67
|
+
if (JSON.stringify(next) === JSON.stringify(rank)) return false;
|
|
68
|
+
rank = next; return true;
|
|
69
|
+
});
|
|
70
|
+
poll(15_000, async () => {
|
|
52
71
|
const next = await client.rpc(overseerStatusRpc, {});
|
|
53
72
|
if (JSON.stringify(next) === JSON.stringify(overseer)) return false;
|
|
54
73
|
overseer = next; return true;
|
|
@@ -67,21 +86,32 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
67
86
|
if (prior && prior.title === next.title && prior.workspaceId === next.workspaceId) return;
|
|
68
87
|
agents.set(a.id, next); emitSoon();
|
|
69
88
|
};
|
|
89
|
+
// Push for the inbox and live stores (1.4.0): an agent's status, attention or permissions changing is when Needs you
|
|
90
|
+
// and the pills can change, so those stores re-read then instead of polling every few seconds.
|
|
91
|
+
const activity = new Set<() => void>();
|
|
92
|
+
const signatures = new Map<string, string>();
|
|
93
|
+
const noteActivity = (a: unknown) => {
|
|
94
|
+
const x = a as { id?: string; status?: string; requiresAttention?: boolean; attentionReason?: string | null; pendingPermissions?: unknown[]; archivedAt?: string | null } | undefined;
|
|
95
|
+
if (!x?.id) return;
|
|
96
|
+
const signature = [x.status, x.requiresAttention, x.attentionReason, x.pendingPermissions?.length ?? 0, x.archivedAt].join("|");
|
|
97
|
+
const prior = signatures.get(x.id); signatures.set(x.id, signature);
|
|
98
|
+
if (prior !== undefined && prior !== signature) for (const l of activity) l();
|
|
99
|
+
};
|
|
70
100
|
const unsubscribe = client.paseo.agents.subscribe(update => {
|
|
71
101
|
const u = update as { kind: string; agent?: AgentEntry["agent"]; agentId?: string };
|
|
72
|
-
if (u.kind === "remove") { if (u.agentId && agents.delete(u.agentId)) emitSoon(); }
|
|
73
|
-
else putAgent(u.agent);
|
|
102
|
+
if (u.kind === "remove") { if (u.agentId && agents.delete(u.agentId)) emitSoon(); if (u.agentId) signatures.delete(u.agentId); for (const l of activity) l(); }
|
|
103
|
+
else { putAgent(u.agent); noteActivity(u.agent); }
|
|
74
104
|
});
|
|
75
105
|
let release: (() => Promise<void>) | null = null;
|
|
76
106
|
void (async () => {
|
|
77
107
|
const page = await client.paseo.agents.list({ subscribe: {}, page: { limit: 200 } });
|
|
78
108
|
if (stopped) { await page.subscription.release(); return; }
|
|
79
109
|
release = () => page.subscription.release();
|
|
80
|
-
(page.entries as AgentEntry[]).forEach(e => putAgent(e.agent));
|
|
110
|
+
(page.entries as AgentEntry[]).forEach(e => { putAgent(e.agent); noteActivity(e.agent); });
|
|
81
111
|
let cursor = page.pageInfo.nextCursor;
|
|
82
112
|
for (let i = 0; cursor && !stopped && i < 20; i++) {
|
|
83
113
|
const next = await client.paseo.agents.list({ page: { limit: 200, cursor } });
|
|
84
|
-
(next.entries as AgentEntry[]).forEach(e => putAgent(e.agent));
|
|
114
|
+
(next.entries as AgentEntry[]).forEach(e => { putAgent(e.agent); noteActivity(e.agent); });
|
|
85
115
|
if (next.pageInfo.nextCursor === cursor) break;
|
|
86
116
|
cursor = next.pageInfo.nextCursor;
|
|
87
117
|
}
|
|
@@ -94,14 +124,42 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
94
124
|
setSort(next: SortMode) { if (next === sort) return; sort = next; storage.set(SORT_KEY, next); emit(); },
|
|
95
125
|
priorities: () => priorities,
|
|
96
126
|
usage: () => usage,
|
|
127
|
+
/** The ranker: on or off, its last run and which sources it could read. */
|
|
128
|
+
rank: () => rank,
|
|
129
|
+
/**
|
|
130
|
+
* "Re-rank now": starts the ranker (the RPC returns at once), then polls its status every 3 s until it's done,
|
|
131
|
+
* refreshes priorities and answers with the run's outcome. Gives up waiting after 6 minutes; the run goes on.
|
|
132
|
+
*/
|
|
133
|
+
async rankNow(): Promise<{ ok: boolean; skipped: string | null; error: string | null; top: { title: string }[] }> {
|
|
134
|
+
await client.rpc(rankNowRpc, { force: true });
|
|
135
|
+
rank = rank ? { ...rank, running: true } : rank; emit();
|
|
136
|
+
let st = rank;
|
|
137
|
+
for (let i = 0; i < 120 && !stopped; i++) {
|
|
138
|
+
await new Promise(r => setTimeout(r, 3000));
|
|
139
|
+
st = await client.rpc(rankStatusRpc, {}).catch(() => st);
|
|
140
|
+
if (st && !st.running) break;
|
|
141
|
+
}
|
|
142
|
+
const p = await client.rpc(prioritiesRpc, {}).catch(() => null);
|
|
143
|
+
if (p) priorities = p.items; if (st) rank = st; emit();
|
|
144
|
+
if (st?.running) return { ok: true, skipped: "busy", error: null, top: [] };
|
|
145
|
+
const last = st?.last;
|
|
146
|
+
// A run that was already going when the click came has finished too: report its outcome, not "busy".
|
|
147
|
+
return { ok: !!last?.ok, skipped: last?.skipped ?? null, error: last?.ok ? null : st?.error ?? null, top: last?.top ? [{ title: last.top }] : [] };
|
|
148
|
+
},
|
|
97
149
|
/** The Overseer: off, not started yet, or its agent and workspace. */
|
|
98
150
|
overseer: () => overseer,
|
|
99
151
|
async startOverseer() { overseer = await client.rpc(overseerStartRpc, {}); emit(); return overseer; },
|
|
152
|
+
/** Sends the omnibox's ask to the Overseer, starting it on first use. */
|
|
153
|
+
async askOverseer(text: string) { overseer = await client.rpc(overseerAskRpc, { text }); emit(); return overseer; },
|
|
154
|
+
/** Settings → Agents changed: a new Overseer on the configured agent, handed the old one's last steps. */
|
|
155
|
+
async restartOverseer() { overseer = await client.rpc(overseerRestartRpc, {}); emit(); return overseer; },
|
|
100
156
|
agents: () => [...agents.values()],
|
|
101
157
|
/** Bumped by ⌘K "Follow-up: Search"; the visible search field focuses when it changes. */
|
|
102
158
|
focusToken: () => focusToken,
|
|
103
159
|
focusSearch() { focusToken++; emit(); },
|
|
104
|
-
|
|
160
|
+
/** Calls `listener` when an agent's status, attention or permissions change (see above). */
|
|
161
|
+
onActivity(listener: () => void) { activity.add(listener); return () => { activity.delete(listener); }; },
|
|
162
|
+
async stop() { stopped = true; offVisible(); activity.clear(); for (const t of timers) clearTimeout(t); if (pending) clearTimeout(pending); listeners.clear(); unsubscribe(); await release?.(); },
|
|
105
163
|
};
|
|
106
164
|
}
|
|
107
165
|
export type HomeExtras = ReturnType<typeof createHomeExtras>;
|