@andrioid/paseo-attention-span 0.4.14 → 0.6.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.
Files changed (56) hide show
  1. package/OVERVIEW.md +13 -5
  2. package/README.md +2 -2
  3. package/client/attention-screen.tsx +140 -143
  4. package/client/card.tsx +4 -2
  5. package/client/history.tsx +189 -0
  6. package/client/icons.ts +3 -1
  7. package/client/mark.ts +19 -0
  8. package/client/next-up.tsx +16 -2
  9. package/client/sessions.ts +50 -3
  10. package/client/still.tsx +70 -27
  11. package/client/ui.tsx +3 -3
  12. package/client/wrap-up.tsx +197 -0
  13. package/docs/architecture.md +17 -10
  14. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  15. package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
  16. package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
  17. package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
  18. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  19. package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
  20. package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
  21. package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
  22. package/docs/screenshots/desktop-dark-doing.png +0 -0
  23. package/docs/screenshots/desktop-dark-history-filtered.png +0 -0
  24. package/docs/screenshots/desktop-dark-history-groups.png +0 -0
  25. package/docs/screenshots/desktop-dark-history.png +0 -0
  26. package/docs/screenshots/desktop-dark-next-up-setup.png +0 -0
  27. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  28. package/docs/screenshots/desktop-dark-settings.png +0 -0
  29. package/docs/screenshots/desktop-dark-setup.png +0 -0
  30. package/docs/screenshots/desktop-dark-waiting.png +0 -0
  31. package/docs/screenshots/phone-dark-doing.png +0 -0
  32. package/docs/screenshots/phone-dark-history.png +0 -0
  33. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  34. package/index.client.tsx +6 -1
  35. package/index.server.ts +21 -2
  36. package/package.json +9 -3
  37. package/requirements.yaml +13 -9
  38. package/server/archive.ts +132 -0
  39. package/server/archived.ts +120 -0
  40. package/server/changes.ts +184 -26
  41. package/server/classify.ts +9 -2
  42. package/server/fixture.ts +71 -12
  43. package/server/github-types.ts +29 -5
  44. package/server/queries.ts +33 -7
  45. package/server/service.ts +90 -19
  46. package/server/store.ts +10 -3
  47. package/server/view.ts +14 -5
  48. package/shared/archive.ts +37 -0
  49. package/shared/attention.ts +85 -8
  50. package/shared/changes.ts +26 -11
  51. package/shared/got-it.ts +23 -0
  52. package/shared/history-report.ts +61 -0
  53. package/shared/rpc.ts +23 -4
  54. package/shared/still.ts +29 -7
  55. package/shared/wrap-up.ts +126 -0
  56. package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
@@ -0,0 +1,189 @@
1
+ import type { ReactNode } from "react";
2
+ import { Pressable, Text, View } from "react-native";
3
+ import type { HistoryFilter, Item } from "../shared/attention";
4
+ import { allNotesBusy } from "../shared/got-it";
5
+ import { historyWeeks, weekOf } from "../shared/history-report";
6
+ import type { IconName } from "./icons";
7
+ import { Modal } from "./sheet";
8
+ import { Still } from "./still";
9
+ import { Button, KeepStyles, SectionHeader, TablerIcon, useCopy, useStyles } from "./ui";
10
+
11
+ // History: what others did to my work, unread, on top until Got it or an archive; then what I finished, by week, with
12
+ // Reviewed and cleared changes when the filter shows them [HIS-01, HIS-02, HIS-06, HIS-07]. A week copies what's shown as
13
+ // Markdown lists, per kind; changes by others are never copied [HIS-03]. Which items go where is shared/history-report.ts.
14
+
15
+ function weekLabel(monday: Date): string {
16
+ const weeks = Math.round((weekOf(new Date().toISOString()).getTime() - monday.getTime()) / (7 * 86_400_000));
17
+ if (weeks === 0) return "This week";
18
+ if (weeks === 1) return "Last week";
19
+ const sunday = new Date(monday.getTime() + 6 * 86_400_000);
20
+ const format = (date: Date) => date.toLocaleDateString(undefined, { month: "short", day: "numeric" });
21
+ return `${format(monday)} – ${format(sunday)}`;
22
+ }
23
+
24
+ export function History({
25
+ notes,
26
+ calm,
27
+ items,
28
+ filter,
29
+ filtering,
30
+ onFiltering,
31
+ onFilter,
32
+ busy,
33
+ onMarkAllRead,
34
+ card,
35
+ }: {
36
+ // Nothing finished and nothing unread, after a refresh that worked [HIS-08].
37
+ calm: boolean;
38
+ notes: Item[];
39
+ items: Item[];
40
+ filter: HistoryFilter[];
41
+ filtering: boolean;
42
+ onFiltering: (open: boolean) => void;
43
+ onFilter: (filter: HistoryFilter[]) => void;
44
+ busy: ReadonlySet<string>;
45
+ onMarkAllRead: (notes: Item[]) => void;
46
+ // The screen's cards, with their actions and sheets.
47
+ card: (items: Item[]) => ReactNode;
48
+ }) {
49
+ const styles = useStyles();
50
+ const copy = useCopy();
51
+ const { weeks, anything } = historyWeeks(items, filter);
52
+ if (calm) return <Still shore="bench" title="Nothing finished yet." line="Your accomplishments will show up here." />;
53
+ if (notes.length === 0 && !anything) return <Text style={styles.text}>Nothing finished in this period.</Text>;
54
+ return (
55
+ <>
56
+ {notes.length > 0 ? (
57
+ <View>
58
+ <SectionHeader
59
+ icon="team"
60
+ title="Changed by others"
61
+ count={notes.length}
62
+ action={
63
+ notes.length > 1 ? (
64
+ <View style={styles.overCard}>
65
+ <Button
66
+ label="Mark all as read"
67
+ icon="check"
68
+ variant="ghost"
69
+ disabled={allNotesBusy(busy, notes.map((item) => item.key))}
70
+ onPress={() => onMarkAllRead(notes)}
71
+ />
72
+ </View>
73
+ ) : null
74
+ }
75
+ />
76
+ {card(notes)}
77
+ </View>
78
+ ) : null}
79
+ {/* Filter shows whenever a week holds anything, even only what the filter hides, so it can be turned on [HIS-07]. */}
80
+ {anything ? (
81
+ <View style={[styles.row, { justifyContent: "flex-end" }]}>
82
+ <Button
83
+ label={filter.length ? `Filter · ${filter.length}` : "Filter"}
84
+ accessibilityLabel={filter.length ? `Filter, ${filter.length} on` : "Filter"}
85
+ icon="filter"
86
+ variant={filter.length ? "calm" : "ghost"}
87
+ onPress={() => onFiltering(true)}
88
+ />
89
+ </View>
90
+ ) : null}
91
+ {anything && weeks.length === 0 ? <Text style={styles.text}>Nothing finished in this period.</Text> : null}
92
+ {weeks.map((week) => {
93
+ const label = weekLabel(week.monday);
94
+ const { links } = week.copy;
95
+ return (
96
+ <View key={week.monday.getTime()} style={{ gap: 8 }}>
97
+ <SectionHeader
98
+ icon="clock"
99
+ title={label}
100
+ count={week.done.length}
101
+ action={
102
+ links > 0 ? (
103
+ <View style={styles.overCard}>
104
+ <Button
105
+ icon="markdown"
106
+ variant="ghost"
107
+ accessibilityLabel={`Copy links from ${label}`}
108
+ onPress={() => copy(week.copy.text, `Copied ${links} link${links === 1 ? "" : "s"} from ${label}`)}
109
+ />
110
+ </View>
111
+ ) : null
112
+ }
113
+ />
114
+ {week.done.length > 0 ? card(week.done) : null}
115
+ {week.reviewed.length > 0 ? (
116
+ <View style={{ gap: 8 }}>
117
+ <Subgroup icon="review" label="Reviewed" count={week.reviewed.length} />
118
+ {card(week.reviewed)}
119
+ </View>
120
+ ) : null}
121
+ {week.changed.length > 0 ? (
122
+ <View style={{ gap: 8 }}>
123
+ <Subgroup icon="team" label="Changed by others" count={week.changed.length} />
124
+ {card(week.changed)}
125
+ </View>
126
+ ) : null}
127
+ </View>
128
+ );
129
+ })}
130
+ {filtering ? <HistoryFilterSheet filter={filter} onChange={onFilter} onClose={() => onFiltering(false)} /> : null}
131
+ </>
132
+ );
133
+ }
134
+
135
+ // A quiet name for a week's second list, like Reviewed or its cleared changes [HIS-02, HIS-07].
136
+ function Subgroup({ icon, label, count }: { icon: IconName; label: string; count: number }) {
137
+ const styles = useStyles();
138
+ return (
139
+ <View style={[styles.row, { gap: 6, paddingVertical: 2 }]}>
140
+ <TablerIcon name={icon} size={13} />
141
+ <Text style={styles.muted}>
142
+ {label} · {count}
143
+ </Text>
144
+ </View>
145
+ );
146
+ }
147
+
148
+ // History's filter: Finished always, plus Reviewed and cleared Changed by others per week [HIS-07]. Ticks apply right away.
149
+ function HistoryFilterSheet({ filter, onChange, onClose }: { filter: HistoryFilter[]; onChange: (filter: HistoryFilter[]) => void; onClose: () => void }) {
150
+ const styles = useStyles();
151
+ const flip = (id: HistoryFilter) => onChange(filter.includes(id) ? filter.filter((other) => other !== id) : [...filter, id]);
152
+ const row = (id: HistoryFilter | null, label: string, note?: string) => {
153
+ const on = id === null || filter.includes(id);
154
+ return (
155
+ <Pressable
156
+ accessibilityRole="checkbox"
157
+ accessibilityState={{ checked: on, disabled: id === null }}
158
+ disabled={id === null}
159
+ accessibilityLabel={label}
160
+ onPress={() => id && flip(id)}
161
+ style={[styles.row, { paddingVertical: 11, paddingHorizontal: 14, opacity: id === null ? 0.65 : 1 }]}
162
+ >
163
+ <TablerIcon name={on ? "squareCheck" : "square"} size={18} color={on ? styles.action : styles.c.foregroundMuted} />
164
+ <Text style={[styles.text, { flex: 1 }]}>{label}</Text>
165
+ {note ? <Text style={styles.muted}>{note}</Text> : null}
166
+ </Pressable>
167
+ );
168
+ };
169
+ return (
170
+ <Modal title="Filter" open onOpenChange={(open) => (open ? null : onClose())}>
171
+ <Modal.Content>
172
+ <KeepStyles styles={styles}>
173
+ <Text style={styles.muted}>Show in each week</Text>
174
+ <View style={[styles.card, { backgroundColor: styles.c.surface2 }]}>
175
+ {row(null, "Finished", "always")}
176
+ <View style={{ height: 1, backgroundColor: styles.c.surface1 }} />
177
+ {row("reviewed", "Reviewed")}
178
+ <View style={{ height: 1, backgroundColor: styles.c.surface1 }} />
179
+ {row("changed", "Changed by others")}
180
+ </View>
181
+ <View style={[styles.row, { justifyContent: "flex-end" }]}>
182
+ <Button label="Clear" variant="ghost" disabled={filter.length === 0} onPress={() => onChange([])} />
183
+ <Button label="Done" variant="solid" onPress={onClose} />
184
+ </View>
185
+ </KeepStyles>
186
+ </Modal.Content>
187
+ </Modal>
188
+ );
189
+ }
package/client/icons.ts CHANGED
@@ -51,10 +51,12 @@ export const ICONS = {
51
51
  chevronRight: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m9 6l6 6l-6 6\"/></svg>" },
52
52
  plus: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 5v14m-7-7h14\"/></svg>" },
53
53
  check: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m5 12l5 5L20 7\"/></svg>" },
54
- // Tabler git-pull-request-closed, user-share, user-minus and chevron-down: what others did to my work [ATT-21, HIS-06].
54
+ // Tabler git-pull-request-closed, user-share, user-minus and chevron-down: what others did to my work [HIS-07, HIS-06].
55
55
  prClosed: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M4 18a2 2 0 1 0 4 0a2 2 0 1 0-4 0M4 6a2 2 0 1 0 4 0a2 2 0 1 0-4 0m12 12a2 2 0 1 0 4 0a2 2 0 1 0-4 0M6 8v8m12-5v5M16 4l4 4m0-4l-4 4\"/></svg>" },
56
56
  userShare: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h3m3 7l5-5m0 4.5V17h-4.5\"/></svg>" },
57
57
  userMinus: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M8 7a4 4 0 1 0 8 0a4 4 0 0 0-8 0M6 21v-2a4 4 0 0 1 4-4h4c.348 0 .686.045 1.009.128M16 19h6\"/></svg>" },
58
+ // Tabler archive: puts a finished item's Paseo sessions away [ATT-22].
59
+ archive: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M3 4a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/><path d=\"M5 8v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8M10 12h4\"/></g></svg>" },
58
60
  chevronDown: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m6 9l6 6l6-6\"/></svg>" },
59
61
  // Tabler message-ai: marks actions that start or continue an agent session.
60
62
  agent: { svg: "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"><path d=\"M8 9h8m-8 4h3.5m-1.506 6.804L8 21v-3H6a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v4\"/><path d=\"M14 21v-4a2 2 0 1 1 4 0v4m-4-2h4m3-4v6\"/></g></svg>" },
package/client/mark.ts ADDED
@@ -0,0 +1,19 @@
1
+ import type { Item } from "../shared/attention";
2
+ import type { CardProps } from "./card";
3
+
4
+ // What the card is: open, draft, merged or closed. Urgency stays in the chips and section headers.
5
+ // A note on what someone else did shows what happened instead; its words say it too, so color isn't the only sign [HIS-07].
6
+ export function stateMark(item: Item): CardProps["mark"] {
7
+ if (item.section === "reviewed" || item.wrap?.review) return { icon: "review", tone: "neutral" };
8
+ if (item.change) {
9
+ const kind = item.change.kind;
10
+ if (kind === "merged") return { icon: "merge", tone: "good" };
11
+ if (kind === "closed") return { icon: "prClosed", tone: "bad" };
12
+ if (kind === "issue_closed") return item.change.reason === "not_planned" ? { icon: "close", tone: "bad" } : { icon: "issueClosed", tone: "good" };
13
+ if (kind === "reopened") return { icon: "pr", tone: "warn" };
14
+ return { icon: kind === "unassigned" ? "userMinus" : "userShare", tone: "warn" };
15
+ }
16
+ if (item.closedAt) return item.kind === "pr" ? { icon: "merge", tone: "good" } : { icon: "issueClosed", tone: item.chips.length ? "neutral" : "good" };
17
+ if (item.kind === "issue") return { icon: "issue", tone: "good" };
18
+ return item.draft ? { icon: "draft", tone: "neutral" } : { icon: "pr", tone: "good" };
19
+ }
@@ -22,11 +22,15 @@ import { CardList, CardRow, type Tone } from "./card";
22
22
  import { sessionEntry, startAnotherEntry } from "./session-menu";
23
23
  import { ActionSheet, DETAILS_STALE_MS, DetailLines, type DetailsQuery, detailsKey, githubEntry, Modal, type SheetEntry, usePrefetchOnRest } from "./sheet";
24
24
  import { githubColor, IssuePills, PlaceText } from "./entity";
25
+ import { Still } from "./still";
25
26
  import { Button, KeepStyles, Meta, SectionHeader, TablerIcon, useHover, useStyles } from "./ui";
26
27
 
27
28
  const TYPE_ICONS: Record<string, IconName> = { bug: "bug", feature: "feature", debt: "debt", task: "task", epic: "epic" };
28
29
 
29
30
  interface Props {
31
+ // Nothing at all to show: nowhere to look yet, or nothing to pick up after a refresh that worked [NXT-13].
32
+ calm: "setup" | "clear" | null;
33
+ openSettings?: () => void;
30
34
  assigned: NextUpIssue[];
31
35
  unclaimed: NextUpIssue[];
32
36
  unclaimedFrom: UnclaimedSource;
@@ -57,10 +61,10 @@ interface Props {
57
61
 
58
62
  type FilterChange = { scopes?: string[]; sources?: string[]; projectFilter?: string[] };
59
63
 
60
- type RowProps = Omit<Props, "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "sources" | "selectedSources" | "projects" | "selectedProjects" | "onFilter">;
64
+ type RowProps = Omit<Props, "calm" | "openSettings" | "assigned" | "unclaimed" | "unclaimedFrom" | "selected" | "sources" | "selectedSources" | "projects" | "selectedProjects" | "onFilter">;
61
65
 
62
66
  // Assigned issues first [NXT-06], then unclaimed ones [NXT-01]; both already ranked by the server [NXT-02].
63
- export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sources, selectedSources, projects, selectedProjects, onFilter, ...rowProps }: Props) {
67
+ export function NextUpList({ calm, openSettings, assigned, unclaimed, unclaimedFrom, selected, sources, selectedSources, projects, selectedProjects, onFilter, ...rowProps }: Props) {
64
68
  const styles = useStyles();
65
69
  const scopes = useMemo(() => [...new Set(unclaimed.map((issue) => issue.scope).filter((scope): scope is string => !!scope))].sort(), [unclaimed]);
66
70
  // Filter by the scopes I picked last time [NXT-03]; a picked scope with no issues left is ignored.
@@ -109,6 +113,16 @@ export function NextUpList({ assigned, unclaimed, unclaimedFrom, selected, sourc
109
113
  ...(scopes.length > 0 ? [{ title: "Scope", options: scopes.map((scope) => ({ id: scope, label: scope })), active, onToggle: toggle }] : []),
110
114
  ];
111
115
 
116
+ // Both point at where Next up looks: plainly when it has nowhere to look, quietly when it found nothing [NXT-13].
117
+ if (calm === "setup") {
118
+ const way = openSettings ? { label: "Open settings", onPress: openSettings } : undefined;
119
+ return <Still shore="signpost" title="Nowhere to look yet." line="Choose where Next up finds issues." way={way} />;
120
+ }
121
+ if (calm === "clear") {
122
+ const way = openSettings ? { label: "Look in more places", onPress: openSettings, link: true } : undefined;
123
+ return <Still shore="signpost" title="Nothing ready for work." line="Want more to choose from?" way={way} />;
124
+ }
125
+
112
126
  return (
113
127
  <View style={{ gap: 24 }}>
114
128
  {assigned.length > 0 ? (
@@ -1,11 +1,41 @@
1
- import type { usePaseo } from "@getpaseo/plugin/client";
2
- import { type AgentSummary, checkoutPr, sessionTitle, type Target } from "../shared/attention";
1
+ import { usePaseo, useRpc } from "@getpaseo/plugin/client";
2
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
3
+ import { type AgentSummary, checkoutPr, type SessionWorkspace, sessionTitle, type Target } from "../shared/attention";
3
4
  import { linkedSessions } from "../shared/linked-sessions";
4
5
  import { chooseAgent, type ReadyProvider } from "../shared/providers";
5
6
  import { type AttentionConfig, codeRepoFor, githubRepoOf, SessionKind } from "../shared/config";
7
+ import { getAttention } from "../shared/rpc";
8
+ import { VIEW_QUERY_KEY } from "./data";
6
9
 
7
10
  type Paseo = ReturnType<typeof usePaseo>;
8
11
 
12
+ // The app's session list, shared by the screen and the sidebar's count [ATT-09, ATT-22].
13
+ export const AGENTS_QUERY_KEY = ["attention-span", "agents"] as const;
14
+
15
+ // The sessions on items, polled for the screen and the sidebar alike [ATT-09, ATT-22]. When one has gone since the last
16
+ // poll, perhaps archived in Paseo, the server's view is read first (from memory, not GitHub), so the notes the server
17
+ // acknowledged for it are cleared before its Wrap up row goes, rather than showing as unread in between [HIS-07].
18
+ export function useItemAgents() {
19
+ const paseo = usePaseo();
20
+ const queryClient = useQueryClient();
21
+ const fetchAttention = useRpc(getAttention);
22
+ return useQuery({
23
+ queryKey: AGENTS_QUERY_KEY,
24
+ refetchInterval: 15_000,
25
+ queryFn: async () => {
26
+ const before = queryClient.getQueryData<AgentSummary[]>(AGENTS_QUERY_KEY);
27
+ const agents = await itemAgents(paseo);
28
+ const now = new Set(agents.map((agent) => agent.id));
29
+ if (before?.some((agent) => !now.has(agent.id))) {
30
+ await fetchAttention({ cached: true })
31
+ .then((view) => queryClient.setQueryData(VIEW_QUERY_KEY, view))
32
+ .catch(() => {}); // the view's own poll catches up
33
+ }
34
+ return agents;
35
+ },
36
+ });
37
+ }
38
+
9
39
  // Labels tie an agent to the item it works on [ATT-07, SES-03].
10
40
  export const LABEL = "attention-span";
11
41
  export const ITEM_LABEL = "attention-span-item";
@@ -14,6 +44,19 @@ export const KIND_LABEL = "attention-span-kind";
14
44
  // Sessions started under the plugin's earlier names, "GitHub attention" and "GitHub inbox".
15
45
  const OLD_LABELS = ["github-attention", "github-inbox"];
16
46
 
47
+ // What Paseo knows about the workspace a session runs in, for Wrap up's unsaved-work check [ATT-22].
48
+ function sessionWorkspace(workspace: (Awaited<ReturnType<Paseo["workspaces"]["list"]>>["entries"][number])): SessionWorkspace {
49
+ const git = workspace.gitRuntime;
50
+ return {
51
+ kind: workspace.workspaceKind,
52
+ name: workspace.title ?? workspace.name,
53
+ directory: workspace.workspaceDirectory ?? workspace.projectRootPath,
54
+ ...(git?.currentBranch ? { branch: git.currentBranch } : {}),
55
+ ...(typeof git?.isDirty === "boolean" ? { dirty: git.isDirty } : {}),
56
+ ...(typeof git?.aheadOfOrigin === "number" ? { ahead: git.aheadOfOrigin } : {}),
57
+ };
58
+ }
59
+
17
60
  // Agents started from Attention Span, each with the item it was started on, and the agents
18
61
  // started outside it in a workspace that belongs to an item [SES-08].
19
62
  export async function itemAgents(paseo: Paseo): Promise<AgentSummary[]> {
@@ -40,7 +83,11 @@ export async function itemAgents(paseo: Paseo): Promise<AgentSummary[]> {
40
83
  }
41
84
  const labelled = [...byId.values()];
42
85
  const unlabelled = all.entries.map((entry) => entry.agent).filter((agent) => !labels.some((label) => agent.labels?.[label]));
43
- return [...labelled, ...linkedSessions(labelled, unlabelled, workspaces.entries)];
86
+ const byWorkspace = new Map(workspaces.entries.map((workspace) => [workspace.id, sessionWorkspace(workspace)]));
87
+ return [...labelled, ...linkedSessions(labelled, unlabelled, workspaces.entries)].map((agent) => {
88
+ const workspace = agent.workspaceId ? byWorkspace.get(agent.workspaceId) : undefined;
89
+ return workspace ? { ...agent, workspace } : agent;
90
+ });
44
91
  }
45
92
 
46
93
  export interface ProjectMatch {
package/client/still.tsx CHANGED
@@ -1,11 +1,12 @@
1
1
  import { Icon } from "@getpaseo/plugin/client/ui";
2
- import { useEffect, useRef, useState } from "react";
3
- import { AccessibilityInfo, Animated, Easing, Platform, Text, View } from "react-native";
2
+ import { type ReactNode, useEffect, useRef, useState } from "react";
3
+ import { AccessibilityInfo, Animated, Easing, Platform, Pressable, Text, View } from "react-native";
4
4
  import { themeName } from "../shared/feedback";
5
5
  import { type Scene, sceneAt } from "../shared/still";
6
- import { useStyles } from "./ui";
6
+ import { Button, useStyles } from "./ui";
7
7
 
8
- // Doing with nothing in it: a horizon that follows the clock, and nothing that asks for anything [ATT-18].
8
+ // A tab with nothing in it: a horizon that follows the clock, and nothing that asks for anything [ATT-18].
9
+ // History, Waiting and Next up each add one thing on the shore [HIS-08, WAI-04, NXT-13].
9
10
  // It settles in on every arrival, then stays still; the hour changing crossfades it.
10
11
 
11
12
  // One tint per time of day, darker on light themes so it holds up on white.
@@ -20,31 +21,46 @@ const H = 110;
20
21
  const svg = (body: string) =>
21
22
  `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${W} ${H}" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round">${body}</svg>`;
22
23
 
23
- const SKY: Record<Scene, string> = {
24
- morning: svg(`<path d="M100 66a20 20 0 0 1 40 0"/>`),
25
- midday: svg(`<circle cx="120" cy="30" r="16"/>`),
26
- evening: svg(`<path d="M88 66a32 32 0 0 1 64 0"/>`),
27
- night: svg(
28
- `<path d="M126 18a16 16 0 1 0 14 22a12.5 12.5 0 0 1 -14 -22z"/>` +
29
- [
24
+ // The sun or moon, moved right by `dx` to make room for a shore; the stars stay put.
25
+ const sky = (scene: Scene, dx: number) =>
26
+ svg(
27
+ `<g transform="translate(${dx} 0)">${SUN[scene]}</g>` +
28
+ (scene === "night" ? STARS : ""),
29
+ );
30
+ const SUN: Record<Scene, string> = {
31
+ morning: `<path d="M100 66a20 20 0 0 1 40 0"/>`,
32
+ midday: `<circle cx="120" cy="30" r="16"/>`,
33
+ evening: `<path d="M88 66a32 32 0 0 1 64 0"/>`,
34
+ night: `<path d="M126 18a16 16 0 1 0 14 22a12.5 12.5 0 0 1 -14 -22z"/>`,
35
+ };
36
+ const STARS = [
30
37
  [70, 24],
31
38
  [168, 16],
32
39
  [190, 40],
33
40
  [52, 46],
34
41
  ]
35
- .map(([x, y]) => `<circle cx="${x}" cy="${y}" r="1" fill="currentColor" stroke="none" opacity=".6"/>`)
36
- .join(""),
37
- ),
38
- };
42
+ .map(([x, y]) => `<circle cx="${x}" cy="${y}" r="1" fill="currentColor" stroke="none" opacity=".6"/>`)
43
+ .join("");
39
44
 
40
45
  // The sun's light on the water, fading downwards; wider under a low sun.
41
46
  const WIDTHS: Record<Scene, number[]> = { morning: [40, 26, 12], midday: [24, 16, 8], evening: [56, 40, 20], night: [30, 18, 8] };
42
- const WATER: Record<Scene, string> = Object.fromEntries(
43
- (Object.keys(WIDTHS) as Scene[]).map((scene) => [
44
- scene,
45
- svg(WIDTHS[scene].map((width, i) => `<path d="M${W / 2 - width / 2} ${76 + i * 8}h${width}" stroke-opacity="${[0.45, 0.28, 0.15][i]}"/>`).join("")),
46
- ]),
47
- ) as Record<Scene, string>;
47
+ const water = (scene: Scene, dx: number) =>
48
+ svg(WIDTHS[scene].map((width, i) => `<path d="M${W / 2 + dx - width / 2} ${76 + i * 8}h${width}" stroke-opacity="${[0.45, 0.28, 0.15][i]}"/>`).join(""));
49
+
50
+ // One thing on the shore, left of the sun, in the line's muted colour: History's bench to look back from, Waiting's
51
+ // jetty with nothing tied to it, Next up's signpost with blank boards. `dx` moves the sun right to make room.
52
+ export type Shore = "bench" | "jetty" | "signpost";
53
+ const SHORES: Record<Shore, { dx: number; svg: string }> = {
54
+ bench: { dx: 36, svg: svg(`<path d="M36 57h28"/><path d="M38 57l-4-14"/><path d="M40 57v9M62 57v9"/>`) },
55
+ jetty: {
56
+ dx: 30,
57
+ svg: svg(`<path d="M20 58h82"/>` + [28, 50, 72, 94].map((x) => `<path d="M${x} 58v14"/><path d="M${x} 78v3" stroke-opacity=".35"/>`).join("")),
58
+ },
59
+ signpost: {
60
+ dx: 40,
61
+ svg: svg(`<path d="M64 66v-34"/><path d="M50 36h26l5 4-5 4h-26z"/><path d="M78 48h-26l-5 4 5 4h26z" stroke-opacity=".6"/>`),
62
+ },
63
+ };
48
64
 
49
65
  const LINE = { svg: svg(`<path d="M20 66h200"/>`) };
50
66
 
@@ -52,8 +68,18 @@ const SETTLE_MS = 700;
52
68
  const CROSSFADE_MS = 4000;
53
69
  const native = Platform.OS !== "web";
54
70
 
55
- export function Still() {
71
+ // What the scene says, and at most one way on: a calm button, or a quieter link in the action colour, which stays
72
+ // readable where the sun's tints are too pale for small text.
73
+ type Way = { label: string; onPress: () => void; link?: boolean };
74
+
75
+ export function Still({
76
+ shore,
77
+ title = "Nothing's on you.",
78
+ line = "Enjoy the quiet.",
79
+ way,
80
+ }: { shore?: Shore; title?: string; line?: string; way?: Way } = {}) {
56
81
  const styles = useStyles();
82
+ const dx = shore ? SHORES[shore].dx : 0;
57
83
  const theme = themeName(styles.c.surface0);
58
84
  const width = styles.compact ? 200 : 240;
59
85
  const height = Math.round((width * H) / W);
@@ -95,6 +121,8 @@ export function Still() {
95
121
 
96
122
  const skyIn = { opacity: arrive.interpolate({ inputRange: [0, 0.65, 1], outputRange: [0, 1, 1] }), transform: [{ translateY: arrive.interpolate({ inputRange: [0, 0.65, 1], outputRange: [6, 0, 0] }) }] };
97
123
  const waterIn = { opacity: arrive.interpolate({ inputRange: [0, 0.35, 1], outputRange: [0, 0, 1] }) };
124
+ // The shore settles in with the water, rising a little.
125
+ const shoreIn = { opacity: waterIn.opacity, transform: [{ translateY: arrive.interpolate({ inputRange: [0, 0.35, 1], outputRange: [3, 3, 0] }) }] };
98
126
  const fadeOut = fade.interpolate({ inputRange: [0, 1], outputRange: [1, 0] });
99
127
 
100
128
  // SvgXml draws a size × size square; the canvas sits in its middle, so crop the square to the canvas.
@@ -105,8 +133,8 @@ export function Still() {
105
133
  );
106
134
  const scenery = (shown: Scene, opacity: Animated.AnimatedInterpolation<number> | Animated.Value) => (
107
135
  <Animated.View key={shown} style={{ position: "absolute", inset: 0, opacity }}>
108
- <Animated.View style={[{ position: "absolute", inset: 0 }, skyIn]}>{layer({ svg: SKY[shown] }, TINTS[theme][shown])}</Animated.View>
109
- <Animated.View style={[{ position: "absolute", inset: 0 }, waterIn]}>{layer({ svg: WATER[shown] }, TINTS[theme][shown])}</Animated.View>
136
+ <Animated.View style={[{ position: "absolute", inset: 0 }, skyIn]}>{layer({ svg: sky(shown, dx) }, TINTS[theme][shown])}</Animated.View>
137
+ <Animated.View style={[{ position: "absolute", inset: 0 }, waterIn]}>{layer({ svg: water(shown, dx) }, TINTS[theme][shown])}</Animated.View>
110
138
  </Animated.View>
111
139
  );
112
140
 
@@ -114,16 +142,31 @@ export function Still() {
114
142
  // Upper two-fifths: a little above the middle, so it reads as a place, not a floating notice.
115
143
  <View style={{ flex: 1, minHeight: styles.compact ? 300 : 360 }}>
116
144
  <View style={{ flex: 2 }} />
117
- <View accessible accessibilityLabel="Nothing needs you right now." style={{ alignItems: "center", gap: 12 }}>
145
+ <View style={{ alignItems: "center", gap: 12 }}>
118
146
  <View style={{ width, height, overflow: "hidden" }} importantForAccessibility="no-hide-descendants" accessibilityElementsHidden>
119
147
  <View style={{ position: "absolute", inset: 0, opacity: 0.6 }}>{layer(LINE, styles.c.foregroundMuted)}</View>
120
148
  {previous ? scenery(previous, fadeOut) : null}
121
149
  {scenery(scene, fade)}
150
+ {shore ? (
151
+ <Animated.View style={[{ position: "absolute", inset: 0 }, shoreIn]}>{layer(SHORES[shore], styles.c.foregroundMuted)}</Animated.View>
152
+ ) : null}
122
153
  </View>
123
- <Text style={{ color: styles.c.foreground, fontSize: 17, fontWeight: "600", marginTop: 6 }}>Nothing's on you.</Text>
124
- <Text style={[styles.muted, { fontSize: 13 }]}>Enjoy the quiet.</Text>
154
+ <View accessible style={{ alignItems: "center", gap: 12 }}>
155
+ <Text style={{ color: styles.c.foreground, fontSize: 17, fontWeight: "600", marginTop: 6, textAlign: "center" }}>{title}</Text>
156
+ <Text style={[styles.muted, { fontSize: 13, textAlign: "center" }]}>{line}</Text>
157
+ </View>
158
+ {way ? <WayOn way={way} color={styles.action} /> : null}
125
159
  </View>
126
160
  <View style={{ flex: 3 }} />
127
161
  </View>
128
162
  );
129
163
  }
164
+
165
+ function WayOn({ way, color }: { way: Way; color: string }): ReactNode {
166
+ if (!way.link) return <View style={{ marginTop: 8 }}><Button label={way.label} icon="settings" onPress={way.onPress} /></View>;
167
+ return (
168
+ <Pressable accessibilityRole="link" onPress={way.onPress} hitSlop={8} style={{ marginTop: 8 }}>
169
+ <Text style={{ color, fontSize: 13 }}>{way.label} ›</Text>
170
+ </Pressable>
171
+ );
172
+ }
package/client/ui.tsx CHANGED
@@ -286,7 +286,7 @@ export function Avatar({ url, bot, team, size = 18 }: { url?: string; bot?: bool
286
286
  }
287
287
 
288
288
  // ghost: no background until hovered or pressed, for secondary icons on every row.
289
- type Variant = "calm" | "solid" | "plain" | "ghost";
289
+ type Variant = "calm" | "solid" | "plain" | "ghost" | "danger";
290
290
 
291
291
  export function useHover() {
292
292
  const [hovered, setHovered] = useState(false);
@@ -315,7 +315,7 @@ export function Button({
315
315
  const styles = useStyles();
316
316
  const { hovered, hover } = useHover();
317
317
  const { c } = styles;
318
- const color = variant === "solid" ? c.accentForeground : variant === "calm" ? styles.action : variant === "ghost" ? c.foregroundMuted : c.foreground;
318
+ const color = variant === "solid" ? c.accentForeground : variant === "calm" ? styles.action : variant === "ghost" ? c.foregroundMuted : variant === "danger" ? c.statusDanger : c.foreground;
319
319
  return (
320
320
  <Pressable
321
321
  accessibilityRole="button"
@@ -331,7 +331,7 @@ export function Button({
331
331
  height: 30,
332
332
  paddingHorizontal: label ? 11 : 8,
333
333
  borderRadius: 8,
334
- backgroundColor: variant === "solid" ? c.accent : hovered || (pressed && variant === "ghost") ? c.border : variant === "ghost" ? "transparent" : c.surface2,
334
+ backgroundColor: variant === "solid" ? c.accent : variant === "danger" ? mix(c.statusDanger, c.surface1, 0.18) : hovered || (pressed && variant === "ghost") ? c.border : variant === "ghost" ? "transparent" : c.surface2,
335
335
  opacity: disabled ? 0.5 : pressed ? 0.8 : 1,
336
336
  })}
337
337
  >