@andrioid/paseo-attention-span 0.7.1 → 0.7.2

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 (27) hide show
  1. package/client/attention-screen.tsx +1 -0
  2. package/client/item-row.tsx +5 -55
  3. package/client/stack.tsx +57 -0
  4. package/client/wrap-up.tsx +135 -50
  5. package/docs/architecture.md +1 -1
  6. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  7. package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
  8. package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
  9. package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
  10. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  11. package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
  12. package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
  13. package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
  14. package/docs/screenshots/desktop-dark-doing.png +0 -0
  15. package/docs/screenshots/desktop-dark-history-filtered.png +0 -0
  16. package/docs/screenshots/desktop-dark-history-groups.png +0 -0
  17. package/docs/screenshots/desktop-dark-history.png +0 -0
  18. package/docs/screenshots/desktop-dark-next-up-code-repo.png +0 -0
  19. package/docs/screenshots/desktop-dark-next-up-setup.png +0 -0
  20. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  21. package/docs/screenshots/desktop-dark-settings.png +0 -0
  22. package/docs/screenshots/desktop-dark-setup.png +0 -0
  23. package/docs/screenshots/desktop-dark-waiting.png +0 -0
  24. package/docs/screenshots/phone-dark-doing.png +0 -0
  25. package/docs/screenshots/phone-dark-history.png +0 -0
  26. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  27. package/package.json +1 -1
@@ -214,6 +214,7 @@ function AttentionList({
214
214
  busy={act.busy}
215
215
  login={view.login}
216
216
  fixture={!!view.fixtureAgents}
217
+ fetchDetails={act.fetchDetails}
217
218
  openAgent={act.openAgent}
218
219
  {...act.askActions}
219
220
  onArchive={(item, confirm, terminals) => act.archiveRows([item], confirm, item.key, terminals)}
@@ -3,22 +3,23 @@
3
3
  import { openExternalUrl } from "@getpaseo/plugin/client";
4
4
  import { useQuery } from "@tanstack/react-query";
5
5
  import { type ReactNode, useState } from "react";
6
- import { Pressable, Text, View } from "react-native";
7
- import { type ActionId, type AgentSummary, type Chip, type FailingChecks, type Item, itemSessions, type PersonRole, type SubRow, type WaitingGroup, type WaitingOn } from "../shared/attention";
6
+ import { Text, View } from "react-native";
7
+ import { type ActionId, type AgentSummary, type Chip, type FailingChecks, type Item, itemSessions, type PersonRole, type WaitingGroup, type WaitingOn } from "../shared/attention";
8
8
  import type { SessionKind } from "../shared/config";
9
9
  import { failingList, groupLabel, rerunHistory, summarizeRerun } from "../shared/checks";
10
10
  import { ago } from "../shared/format";
11
11
  import { noteBusy } from "../shared/got-it";
12
12
  import { actionLabel, alsoWaitingOn, cardStack, cardWhen, copiesLink, rerunState, sessionSignal, type SheetStep, sheetPlan, soleStep, stackMetaChips, targetUrl, waitChips } from "../shared/item-view";
13
13
  import { CardList, CardRow } from "./card";
14
- import { NumberText, PlaceText } from "./entity";
14
+ import { PlaceText } from "./entity";
15
15
  import type { IconName } from "./icons";
16
16
  import { type Actions, itemDetailsQuery } from "./item-actions";
17
17
  import { stateMark } from "./mark";
18
+ import { StackLine } from "./stack";
18
19
  import { AcknowledgeSheet, ReviewerSheet } from "./pickers";
19
20
  import { sessionEntry, startAnotherEntry } from "./session-menu";
20
21
  import { ActionSheet, DETAILS_STALE_MS, DetailLines, FadeIn, githubEntry, type SheetEntry, useArrived, usePrefetchOnRest } from "./sheet";
21
- import { Avatar, Hint, LINE_HEIGHT, Meta, mix, TablerIcon, tint, useCopy, useHover, useStrongText, useStyles } from "./ui";
22
+ import { Avatar, Hint, LINE_HEIGHT, Meta, mix, TablerIcon, useCopy, useStrongText, useStyles } from "./ui";
22
23
 
23
24
  // The agent icon marks every action that starts an agent session; the rest act on GitHub right away [ATT-13].
24
25
  const ACTION_ICONS: Record<ActionId, IconName> = {
@@ -397,54 +398,3 @@ function WaitingOnLine({ people, asked, expanded }: { people: WaitingOn[]; asked
397
398
  </Hint>
398
399
  );
399
400
  }
400
-
401
- // Stacked or linked PRs as a connected line; collapsed, only those needing attention [ATT-03, ATT-04].
402
- // In the sheet each row opens its PR on GitHub [ATT-12], and the PR an issue's actions apply to is tinted and says so [ATT-06].
403
- function StackLine({ rows, merged, links = false, target }: { rows: SubRow[]; merged: boolean; links?: boolean; target?: string }) {
404
- const styles = useStyles();
405
- return (
406
- <View>
407
- {rows.map((row, index) => (
408
- <StackRow key={row.key} url={row.url} number={row.number} link={links} target={row.key === target}>
409
- <View style={{ width: 16, alignItems: "center" }}>
410
- <View style={{ width: 2, flex: 1, backgroundColor: index === 0 ? "transparent" : styles.c.border }} />
411
- <TablerIcon name={merged ? "merge" : row.draft ? "draft" : "pr"} size={14} color={merged ? styles.c.statusSuccess : row.draft ? styles.c.foregroundMuted : styles.c.statusSuccess} />
412
- <View style={{ width: 2, flex: 1, backgroundColor: index === rows.length - 1 ? "transparent" : styles.c.border }} />
413
- </View>
414
- <View style={{ flex: 1, paddingVertical: 3, gap: 2 }}>
415
- <Text style={{ color: styles.c.foreground, fontSize: 13 }} numberOfLines={1}>
416
- {row.title}
417
- </Text>
418
- <View style={[styles.wrap, { columnGap: 10, rowGap: 2 }]}>
419
- <Meta lead={<NumberText number={row.number} />} facts={merged && row.mergedBy ? [`merged by ${row.mergedBy}`] : []} chips={row.chips} />
420
- {row.key === target ? <Text style={{ color: styles.action, fontSize: 12, fontWeight: "600" }}>actions apply here</Text> : null}
421
- </View>
422
- </View>
423
- {links ? (
424
- <View style={{ justifyContent: "center", paddingHorizontal: 4 }}>
425
- <TablerIcon name="github" size={14} color={styles.c.foregroundMuted} />
426
- </View>
427
- ) : null}
428
- </StackRow>
429
- ))}
430
- </View>
431
- );
432
- }
433
-
434
- function StackRow({ url, number, link, target = false, children }: { url: string; number: number; link: boolean; target?: boolean; children: ReactNode }) {
435
- const styles = useStyles();
436
- const { hovered, hover } = useHover();
437
- const tinted = target ? { backgroundColor: tint(styles.action, 0.1), borderRadius: 6 } : null;
438
- if (!link) return <View style={[styles.row, { alignItems: "stretch" }, tinted]}>{children}</View>;
439
- return (
440
- <Pressable
441
- accessibilityRole="link"
442
- accessibilityLabel={`Open PR #${number} on GitHub`}
443
- onPress={() => void openExternalUrl(url)}
444
- {...hover}
445
- style={({ pressed }) => [styles.row, { alignItems: "stretch", borderRadius: 6, backgroundColor: pressed || hovered ? styles.c.surface2 : target ? tint(styles.action, 0.1) : "transparent" }]}
446
- >
447
- {children}
448
- </Pressable>
449
- );
450
- }
@@ -0,0 +1,57 @@
1
+ import { openExternalUrl } from "@getpaseo/plugin/client";
2
+ import type { ReactNode } from "react";
3
+ import { Pressable, Text, View } from "react-native";
4
+ import type { SubRow } from "../shared/attention";
5
+ import { NumberText } from "./entity";
6
+ import { Meta, TablerIcon, tint, useHover, useStyles } from "./ui";
7
+
8
+ // Stacked or linked PRs as a connected line; collapsed, only those needing attention [ATT-03, ATT-04].
9
+ // In the sheet each row opens its PR on GitHub [ATT-12], and the PR an issue's actions apply to is tinted and says so [ATT-06].
10
+ export function StackLine({ rows, merged, links = false, target }: { rows: SubRow[]; merged: boolean; links?: boolean; target?: string }) {
11
+ const styles = useStyles();
12
+ return (
13
+ <View>
14
+ {rows.map((row, index) => (
15
+ <StackRow key={row.key} url={row.url} number={row.number} link={links} target={row.key === target}>
16
+ <View style={{ width: 16, alignItems: "center" }}>
17
+ <View style={{ width: 2, flex: 1, backgroundColor: index === 0 ? "transparent" : styles.c.border }} />
18
+ <TablerIcon name={merged ? "merge" : row.draft ? "draft" : "pr"} size={14} color={merged ? styles.c.statusSuccess : row.draft ? styles.c.foregroundMuted : styles.c.statusSuccess} />
19
+ <View style={{ width: 2, flex: 1, backgroundColor: index === rows.length - 1 ? "transparent" : styles.c.border }} />
20
+ </View>
21
+ <View style={{ flex: 1, paddingVertical: 3, gap: 2 }}>
22
+ <Text style={{ color: styles.c.foreground, fontSize: 13 }} numberOfLines={1}>
23
+ {row.title}
24
+ </Text>
25
+ <View style={[styles.wrap, { columnGap: 10, rowGap: 2 }]}>
26
+ <Meta lead={<NumberText number={row.number} />} facts={merged && row.mergedBy ? [`merged by ${row.mergedBy}`] : []} chips={row.chips} />
27
+ {row.key === target ? <Text style={{ color: styles.action, fontSize: 12, fontWeight: "600" }}>actions apply here</Text> : null}
28
+ </View>
29
+ </View>
30
+ {links ? (
31
+ <View style={{ justifyContent: "center", paddingHorizontal: 4 }}>
32
+ <TablerIcon name="github" size={14} color={styles.c.foregroundMuted} />
33
+ </View>
34
+ ) : null}
35
+ </StackRow>
36
+ ))}
37
+ </View>
38
+ );
39
+ }
40
+
41
+ function StackRow({ url, number, link, target = false, children }: { url: string; number: number; link: boolean; target?: boolean; children: ReactNode }) {
42
+ const styles = useStyles();
43
+ const { hovered, hover } = useHover();
44
+ const tinted = target ? { backgroundColor: tint(styles.action, 0.1), borderRadius: 6 } : null;
45
+ if (!link) return <View style={[styles.row, { alignItems: "stretch" }, tinted]}>{children}</View>;
46
+ return (
47
+ <Pressable
48
+ accessibilityRole="link"
49
+ accessibilityLabel={`Open PR #${number} on GitHub`}
50
+ onPress={() => void openExternalUrl(url)}
51
+ {...hover}
52
+ style={({ pressed }) => [styles.row, { alignItems: "stretch", borderRadius: 6, backgroundColor: pressed || hovered ? styles.c.surface2 : target ? tint(styles.action, 0.1) : "transparent" }]}
53
+ >
54
+ {children}
55
+ </Pressable>
56
+ );
57
+ }
@@ -1,4 +1,5 @@
1
1
  import { useState } from "react";
2
+ import { useQuery } from "@tanstack/react-query";
2
3
  import { openExternalUrl } from "@getpaseo/plugin/client";
3
4
  import { Text, View } from "react-native";
4
5
  import type { AgentSummary, WrapItem } from "../shared/attention";
@@ -7,8 +8,12 @@ import { allWrapBusy, wrapBusy } from "../shared/got-it";
7
8
  import { cleanSingle, sessionCleanliness, sessionUnsaved } from "../shared/wrap-up";
8
9
  import { CardList, CardRow } from "./card";
9
10
  import { stateMark } from "./mark";
10
- import { Dialog } from "./sheet";
11
- import { Button, SectionHeader, TablerIcon, useStyles } from "./ui";
11
+ import { type FetchDetails, itemDetailsQuery } from "./item-actions";
12
+ import { PlaceText } from "./entity";
13
+ import { StackLine } from "./stack";
14
+ import { sessionEntry } from "./session-menu";
15
+ import { ActionSheet, DETAILS_STALE_MS, DetailLines, Dialog, githubEntry, type SheetEntry, usePrefetchOnRest } from "./sheet";
16
+ import { Button, Meta, SectionHeader, useStyles } from "./ui";
12
17
 
13
18
  // Doing's Wrap up: finished or out-of-my-hands work whose sessions are still open, and archiving them [ATT-22]. The screen
14
19
  // assembles the rows and runs the archive; these draw them and ask before archiving anything unsaved or closing a terminal,
@@ -20,6 +25,7 @@ interface RowProps {
20
25
  // Previews have made-up sessions: their snapshot is the answer, as there's no daemon to ask.
21
26
  fixture: boolean;
22
27
  openAgent: (agentId: string) => void;
28
+ fetchDetails: FetchDetails;
23
29
  onArchive: (item: WrapItem, confirm: boolean, terminals?: string[]) => Promise<ArchiveOutcome | null>;
24
30
  }
25
31
 
@@ -71,7 +77,7 @@ export function WrapUp({
71
77
  <CardList>
72
78
  {items.map((item, index) =>
73
79
  item.wrap.ask ? (
74
- <AskRow key={item.key} item={item} first={index === 0} busy={row.busy} login={row.login} openSession={row.openAgent} onCloseIssue={onCloseIssue} onKeepOpen={onKeepOpen} />
80
+ <AskRow key={item.key} item={item} first={index === 0} busy={row.busy} login={row.login} openSession={row.openAgent} fetchDetails={row.fetchDetails} onCloseIssue={onCloseIssue} onKeepOpen={onKeepOpen} />
75
81
  ) : (
76
82
  <WrapRow key={item.key} item={item} first={index === 0} {...row} />
77
83
  ),
@@ -101,9 +107,15 @@ function AskRow({
101
107
  busy,
102
108
  login,
103
109
  openSession,
110
+ fetchDetails,
104
111
  onCloseIssue,
105
112
  onKeepOpen,
106
- }: { item: WrapItem; first: boolean; busy: ReadonlySet<string>; login: string | null; openSession: (agentId: string) => void } & AskProps) {
113
+ }: { item: WrapItem; first: boolean; busy: ReadonlySet<string>; login: string | null; openSession: (agentId: string) => void; fetchDetails: FetchDetails } & AskProps) {
114
+ const [sheet, setSheet] = useState(false);
115
+ const open = () => setSheet(true);
116
+ const prefetch = usePrefetchOnRest(itemDetailsQuery(item, fetchDetails));
117
+ const close = () => setSheet(false);
118
+ const blocked = wrapBusy(busy, item.key);
107
119
  const { sessions } = item.wrap;
108
120
  const still = sessions.length > 1 ? ` · ${sessions.length} sessions still open` : sessions.length ? " · your session's still open" : "";
109
121
  return (
@@ -112,10 +124,36 @@ function AskRow({
112
124
  mark={stateMark(item)}
113
125
  title={item.title}
114
126
  meta={{ place: { repo: item.repo, number: item.number, login }, when: `Close #${item.number}? ${item.wrap.finish}${still}`, signals: [] }}
115
- onOpen={() => (sessions[0] ? openSession(sessions[0].id) : void openExternalUrl(item.url))}
116
- busy={wrapBusy(busy, item.key)}
127
+ onOpen={open}
128
+ hover={prefetch}
129
+ busy={blocked}
117
130
  primary={{ label: `Close #${item.number}`, accessibilityLabel: `Close #${item.number} as completed`, icon: "issueClosed", onPress: () => onCloseIssue(item) }}
118
- secondary={[{ label: "Keep open", icon: "close", accessibilityLabel: `Keep #${item.number} open`, onPress: () => onKeepOpen(item) }]}
131
+ secondary={[
132
+ { label: `Details for #${item.number}`, icon: "chevronRight", onPress: open },
133
+ { label: "Keep open", icon: "close", accessibilityLabel: `Keep #${item.number} open`, onPress: () => onKeepOpen(item) },
134
+ ]}
135
+ overlay={
136
+ sheet ? (
137
+ <WrapItemSheet
138
+ item={item}
139
+ fetchDetails={fetchDetails}
140
+ openSession={openSession}
141
+ onClose={close}
142
+ entries={[
143
+ {
144
+ key: "close", label: `Close #${item.number}`, icon: "issueClosed",
145
+ detail: "Closes as completed, with Undo", disabled: blocked,
146
+ onPress: () => { close(); onCloseIssue(item); },
147
+ },
148
+ {
149
+ key: "keep", label: "Keep open", icon: "close",
150
+ detail: "Waits until another PR merges before asking again", housekeeping: true, disabled: blocked,
151
+ onPress: () => { close(); onKeepOpen(item); },
152
+ },
153
+ ]}
154
+ />
155
+ ) : null
156
+ }
119
157
  />
120
158
  );
121
159
  }
@@ -126,10 +164,11 @@ function wrapMeta({ wrap }: WrapItem): string {
126
164
  return `${wrap.finish} · ${still}`;
127
165
  }
128
166
 
129
- function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, onArchive }: { item: WrapItem; first: boolean } & RowProps) {
130
- const styles = useStyles();
167
+ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, fetchDetails, onArchive }: { item: WrapItem; first: boolean } & RowProps) {
131
168
  const { sessions } = item.wrap;
132
- const [sheet, setSheet] = useState<"multi" | "dirty" | null>(null);
169
+ const [sheet, setSheet] = useState<"item" | "dirty" | null>(null);
170
+ const open = () => setSheet("item");
171
+ const prefetch = usePrefetchOnRest(itemDetailsQuery(item, fetchDetails));
133
172
  const [unsaved, setUnsaved] = useState<UnsavedSession[]>([]);
134
173
  // The terminals the confirm sheet names, sent back with it: a terminal opened since brings the sheet back [ATT-22].
135
174
  const [terminals, setTerminals] = useState<string[]>([]);
@@ -137,7 +176,7 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
137
176
  const [leaving, setLeaving] = useState<string[]>([]);
138
177
  const dirty = sessions.some((session) => sessionCleanliness(session) === "dirty");
139
178
  const press = async () => {
140
- if (sessions.length > 1) return setSheet("multi");
179
+ if (sessions.length > 1) return open();
141
180
  // A preview has no daemon to ask; its made-up snapshot is the answer. Elsewhere the server checks git too, so the sheet
142
181
  // can name the files and commits it found.
143
182
  if (sessionCleanliness(sessions[0]) !== "clean" && fixture) {
@@ -156,7 +195,7 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
156
195
  setSheet("dirty");
157
196
  }
158
197
  };
159
- // The multi sheet asks the server first, like a single row; unsaved work or open terminals it finds get the confirm that
198
+ // The item's archive entry asks the server first; unsaved work or open terminals it finds get the confirm that
160
199
  // names them [ATT-22].
161
200
  const confirm = async (confirm: boolean) => {
162
201
  const outcome = await onArchive(item, confirm, confirm ? terminals : []);
@@ -173,7 +212,8 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
173
212
  when: wrapMeta(item),
174
213
  signals: dirty ? [{ text: "unsaved changes", tone: "warn" }] : [],
175
214
  }}
176
- onOpen={() => (sessions.length > 1 ? setSheet("multi") : sessions[0] ? openSession(sessions[0].id) : undefined)}
215
+ onOpen={open}
216
+ hover={prefetch}
177
217
  busy={wrapBusy(busy, item.key)}
178
218
  primary={{
179
219
  label: sessions.length > 1 ? "Archive sessions" : "Archive session",
@@ -181,44 +221,29 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
181
221
  icon: "archive",
182
222
  onPress: () => void press(),
183
223
  }}
184
- secondary={[{ label: `Details for #${item.number}`, icon: "chevronRight", onPress: () => (sessions.length > 1 ? setSheet("multi") : sessions[0] ? openSession(sessions[0].id) : undefined) }]}
224
+ secondary={[{ label: `Details for #${item.number}`, icon: "chevronRight", onPress: open }]}
185
225
  overlay={
186
- sheet === "multi" ? (
187
- <Dialog title={`Sessions on #${item.number}`} onClose={() => setSheet(null)}>
188
- <Text style={styles.muted}>
189
- {item.title} · {item.wrap.finish}
190
- </Text>
191
- <View style={[styles.card, { backgroundColor: styles.c.surface2 }]}>
192
- {sessions.map((session, index) => (
193
- <View key={session.id} style={[styles.row, { paddingVertical: 10, paddingHorizontal: 12 }, index > 0 ? styles.divider : null]}>
194
- <TablerIcon name="agent" size={16} />
195
- <View style={{ flex: 1, gap: 2 }}>
196
- <Text style={styles.text}>{session.title ?? "Session"}</Text>
197
- <Text style={styles.muted}>{sessionStateText(session)}</Text>
198
- {session.subAgents?.count ? (
199
- <Text style={styles.muted}>
200
- +{session.subAgents.count} sub-agent{session.subAgents.count === 1 ? "" : "s"}
201
- </Text>
202
- ) : null}
203
- </View>
204
- <Button label="Open" variant="ghost" onPress={() => openSession(session.id)} />
205
- </View>
206
- ))}
207
- </View>
208
- <Text style={styles.muted}>
209
- Archives {sessions.length} sessions. Their worktrees go too when no other session lives in them, closing their terminals
210
- {sessions.some((session) => sessionCleanliness(session) === "unknown") ? "; the one that couldn't be checked may hold unsaved work" : ""}.
211
- </Text>
212
- <View style={[styles.row, { justifyContent: "flex-end" }]}>
213
- <Button label="Cancel" onPress={() => setSheet(null)} />
214
- <Button label={sessions.length === 2 ? "Archive both" : `Archive ${sessions.length}`} variant="danger" onPress={() => void confirm(false)} />
215
- </View>
216
- </Dialog>
226
+ sheet === "item" ? (
227
+ <WrapItemSheet
228
+ item={item}
229
+ fetchDetails={fetchDetails}
230
+ openSession={openSession}
231
+ onClose={() => setSheet(null)}
232
+ entries={[{
233
+ key: "archive",
234
+ label: sessions.length === 2 ? "Archive both" : sessions.length > 1 ? `Archive ${sessions.length} sessions` : "Archive session",
235
+ icon: "archive",
236
+ detail: "Archives the sessions and their worktrees when no other session lives in them. Asks before losing unsaved work or closing terminals.",
237
+ housekeeping: true,
238
+ disabled: wrapBusy(busy, item.key),
239
+ onPress: () => { setSheet(null); void (sessions.length > 1 ? confirm(false) : press()); },
240
+ }]}
241
+ />
217
242
  ) : sheet === "dirty" ? (
218
243
  <ArchiveSheet
219
244
  title={leaving.length === 1 ? `Archive "${leaving[0]}"?` : sessions.length > 1 ? `Archive the sessions on #${item.number}?` : `Archive the session on #${item.number}?`}
220
245
  unsaved={unsaved.length ? unsaved : [readingOf(sessions[0])]}
221
- onOpen={() => openSession(unsaved[0]?.agentId ?? sessions[0].id)}
246
+ onOpen={() => { setSheet(null); openSession(unsaved[0]?.agentId ?? sessions[0].id); }}
222
247
  onArchive={() => void confirm(true)}
223
248
  onClose={() => setSheet(null)}
224
249
  />
@@ -228,7 +253,51 @@ function WrapRow({ item, first, busy, login, fixture, openAgent: openSession, on
228
253
  );
229
254
  }
230
255
 
231
- // What a session in Wrap up's multi sheet says about its worktree [ATT-22].
256
+ // Wrap up owns its cleanup actions; the sheet uses the same details and entries as the other tabs [ATT-06, SES-03].
257
+ function WrapItemSheet({ item, fetchDetails, openSession, entries, onClose }: {
258
+ item: WrapItem;
259
+ fetchDetails: FetchDetails;
260
+ openSession: (agentId: string) => void;
261
+ entries: SheetEntry[];
262
+ onClose: () => void;
263
+ }) {
264
+ const details = useQuery({ ...itemDetailsQuery(item, fetchDetails), staleTime: DETAILS_STALE_MS });
265
+ const pr = item.children.find((child) => child.url === item.target.url) ?? item.children[0];
266
+ const shown = new Set(item.children.map((child) => child.url));
267
+ const extra = details.data && { ...details.data, linked: details.data.linked.filter((link) => !shown.has(link.url)) };
268
+ return (
269
+ <ActionSheet
270
+ title={item.title}
271
+ onClose={onClose}
272
+ top={
273
+ <>
274
+ <Meta lead={<PlaceText place={{ repo: item.repo, number: item.number, login: null }} />} facts={[item.wrap.finish]} chips={[]} />
275
+ {item.children.length > 0 ? <StackLine rows={item.children} merged={!!item.closedAt || !!item.wrap.ask} links /> : null}
276
+ </>
277
+ }
278
+ entries={[
279
+ ...item.wrap.sessions.map((session) => ({
280
+ ...sessionEntry(session, "Continue session", (id) => { onClose(); openSession(id); }),
281
+ detail: [session.title, sessionStateText(session), session.subAgents?.count ? `+${session.subAgents.count} sub-agent${session.subAgents.count === 1 ? "" : "s"}` : null].filter(Boolean).join(" · "),
282
+ })),
283
+ githubEntry(item, (url) => { onClose(); void openExternalUrl(url); }, pr),
284
+ ...entries,
285
+ ]}
286
+ bottom={
287
+ <DetailLines
288
+ details={extra}
289
+ loading={details.isLoading}
290
+ error={details.error}
291
+ linkedLabel={item.kind === "issue" ? "PR" : "Closes"}
292
+ expected={item.target.kind === "pr" ? 1 : 0}
293
+ sizeOf={item.kind === "issue" && item.target.kind === "pr" ? item.target.number : undefined}
294
+ />
295
+ }
296
+ />
297
+ );
298
+ }
299
+
300
+ // What a session in Wrap up's item sheet says about its worktree [ATT-22].
232
301
  function sessionStateText(session: AgentSummary): string {
233
302
  const unsaved = sessionUnsaved(session);
234
303
  if (!unsaved) return "idle · nothing unsaved";
@@ -282,6 +351,8 @@ function KeptWorktreeRow({
282
351
  onArchive: KeptProps["onArchiveWorktree"];
283
352
  onDismiss: (row: KeptRow) => void;
284
353
  }) {
354
+ const [detailsOpen, setDetailsOpen] = useState(false);
355
+ const open = () => setDetailsOpen(true);
285
356
  const [sheet, setSheet] = useState<{ unsaved: UnsavedSession[]; terminals: string[] } | null>(null);
286
357
  const archive = async (confirm: boolean) => {
287
358
  const outcome = await onArchive(row, confirm, confirm ? (sheet?.terminals ?? []) : []);
@@ -298,12 +369,26 @@ function KeptWorktreeRow({
298
369
  mark={{ icon: "archive", tone: "neutral" }}
299
370
  title={row.title}
300
371
  meta={{ place: { repo: row.repo, number: row.number, login }, when: keptText(row), signals: [] }}
301
- onOpen={primary.onPress}
372
+ onOpen={open}
302
373
  busy={busy}
303
374
  primary={{ ...primary, accessibilityLabel: `${primary.label}: ${row.name}` }}
304
- secondary={[{ label: "Dismiss", icon: "close", accessibilityLabel: `Dismiss: keep ${row.name}`, onPress: () => onDismiss(row) }]}
375
+ secondary={[
376
+ { label: `Details for #${row.number}`, icon: "chevronRight", onPress: open },
377
+ { label: "Dismiss", icon: "close", accessibilityLabel: `Dismiss: keep ${row.name}`, onPress: () => onDismiss(row) },
378
+ ]}
305
379
  overlay={
306
- sheet ? <ArchiveSheet title={`Archive "${row.name}"?`} unsaved={sheet.unsaved} onArchive={() => void archive(true)} onClose={() => setSheet(null)} /> : null
380
+ detailsOpen ? (
381
+ <ActionSheet
382
+ title={row.title}
383
+ onClose={() => setDetailsOpen(false)}
384
+ top={<Meta lead={<PlaceText place={{ repo: row.repo, number: row.number, login: null }} />} facts={[row.name, keptText(row)]} chips={[]} />}
385
+ entries={[
386
+ { key: "primary", ...primary, detail: row.reason === "session" ? "Opens the session keeping this worktree" : "Checks the worktree before archiving; asks before losing unsaved work or closing terminals", disabled: busy, onPress: () => { setDetailsOpen(false); primary.onPress(); } },
387
+ { key: "dismiss", label: "Dismiss", icon: "close", detail: "Keeps the worktree and removes this reminder", housekeeping: true, disabled: busy, onPress: () => { setDetailsOpen(false); onDismiss(row); } },
388
+ ]}
389
+ bottom={null}
390
+ />
391
+ ) : sheet ? <ArchiveSheet title={`Archive "${row.name}"?`} unsaved={sheet.unsaved} onArchive={() => void archive(true)} onClose={() => setSheet(null)} /> : null
307
392
  }
308
393
  />
309
394
  );
@@ -96,7 +96,7 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
96
96
  - **Mentions** [MEN-01..06]: a thread counts when a person @-mentioned me after my last comment, review or reaction there. Team mentions are ignored. A bot counts only when it opened a thread I need to resolve, and is marked with 🤖. The quote on a card is cut around the mention, so it's shown as plain text: links keep their text, Markdown marks and quoted replies go.
97
97
  - **Handed over** [PRS-08]: my PRs assigned to someone else, and not to me, are left out. Mentions of me on them still count. A PR of mine with nobody assigned is mine.
98
98
  - **Changed by others** [HIS-07] (`server/changes.ts`) keeps a ledger of what others did, in `state.json`, by GitHub's node ids, which a transfer keeps. Only someone else's doing counts; my own actions and others' pushes don't. Merges, unmerged closes and issue closes come from live searches: `mergedBy`, the last close event's actor, and an issue's `stateReason`. A PR that left my hands before it ended counts as the handover, not the merge; one assigned to someone after it ended is still my merge, and a PR someone else has waits a refresh for its lookup rather than be called a merge. Handovers come from GitHub's assign and unassign events, which are separate, never one "handover": a PR is looked up when it's assigned to someone else and not me, once per change of its assignees; it left my hands with whichever came last of my removal and the new owner's assignment, so a PR I took myself off is mine until someone takes it, and an earlier round's removal doesn't name who took it this time; an issue when it leaves my assigned search since the last refresh that worked. Leaving the search proves nothing (search lag, a coverage change, its 50 results), so only an unassign event of me by someone else counts; one closed by then is left to its close note. So unassignments are noticed only for issues Attention Span has seen assigned to me; on the first run none count as gone. A PR seen closed unmerged is tracked; once it drops out of the closed search, as a reopen takes it out, a batch asks for its state and last reopen event. A reopen removes the old close from its week whoever did it, and only someone else's is a note; a merged one stops being tracked, and nothing older than the ledger's window is tracked. A first run tracks from then on, so old closes don't replay as new. A failed lookup, or one node in it GitHub failed on (anything but not found), is asked again on the next refresh. A PR handed over isn't listed under the finished issue it closed either; when a cleared handover's work comes back to me it stays in its week, marked returned, so my later work on it is mine again. Events are kept `historyWeeks` + 1 weeks, or `mentionDays` if longer; unread notes expire after `mentionDays` for History's top section.
99
- - **Wrap up** [ATT-22] (`shared/wrap-up.ts`, drawn by `client/wrap-up.tsx`) is assembled on the client from the sessions the screen and the sidebar already poll; the server archives and acknowledges. An item's identity is `memberKeys` in `shared/attention.ts`: its key, the PRs under it and the work a change note is about, spelled as GitHub spells them since Paseo's labels match exactly, and compared ignoring case (`shared/names.ts`, as all GitHub names are); Wrap up, archiving and acknowledging all use it. A finished item, reviewed PR, my own unmerged close, cleared change or unread change is a candidate; its sessions are the ones on any of its member keys. It enters when it has at least one unarchived session, every one is idle (not working and not needing me), none serves an item still in Doing or Waiting, and no session already belongs to another row. History lists a merged PR alone, as its branches are gone, so each live refresh remembers every open stack's and issue group's keys under each member (`groups` in `state.json`, kept as long as the ledger): a merged member whose remembered sibling is still open stays out, and so does its session. The screen freezes rows whose archive runs and Archive all clean while any row's archive runs (`shared/got-it.ts`). Archiving goes through `paseo.agents.ref(id).archive()`, sub-agents first (found by Paseo's `paseo.parent-agent-id` label, `subAgentsOf` in `shared/linked-sessions.ts`; one in another workspace is archived, its workspace left alone; archive lists every page of agents, archived ones too, so one under an archived sub-agent still counts, and a sub-agent that won't archive and stays open stops the archive before its session goes); a Paseo worktree is archived too, through `paseo.workspaces.archive`, which archives everything in it, only when every unarchived agent in it is being archived, and a local checkout never is. Workspaces are named as Paseo's sidebar names them: the title, else the branch. A worktree that stays is a `KeptRow` in `state.json` (`kept`) with its row's item; the `workspace.archived` hook forgets it, and remembers the workspace so an archive still running doesn't add it back, Dismiss forgets it, and Archive worktree or Try again runs the same checks on the worktree alone (`rpc.archiveWorktree`). Paseo closes a worktree's terminals when it archives it, so they're listed (`paseo.terminals.list`) right before archiving and named on the sheet; the confirm sends back the ids it named, and any other asks again. They're listed once more right before each worktree goes: one that opened while the sessions were being archived keeps its worktree, said in its kept row, as Paseo's SDK has no archive that checks and removes at once. Terminals that can't be listed don't keep the worktree, as Paseo would close them anyway. The plugin SDK says nothing of what a terminal runs, so an idle shell and a dev server are named alike. The dirty check reads Paseo's workspace snapshot and, for counts, `git status --porcelain`, `git diff --shortstat HEAD` for lines, and `git rev-list --count @{upstream}..HEAD` (with no upstream, `HEAD --not --remotes`) on the daemon host. Clean needs both answers: when either can't say, it's treated as dirty and the sheet says so (`unsavedOf` in `shared/archive.ts`, for the server and the screen alike). Agents and their status are listed again right before archiving, so a session that started working during the checks, or one that moved into the worktree, stops it. A session Attention Span started, archived in Paseo itself, is caught by the `agent.archived` hook in `index.server.ts` (`server/archived.ts`), even with the screen closed: once no other open session labelled with any key of its item's group is left, the group's changes up to the archive's `archivedAt` are acknowledged, so what others do later still shows. A sub-agent's archive, a restored session and a session without an item label acknowledge nothing; sessions linked only by their workspace neither acknowledge nor hold an acknowledgement back. Lists read every page, and a lookup that fails is tried again on the next hook event or list request, never taken as "none left"; tries are kept in memory, so an archive while the server isn't running, or one pending at a restart, isn't noticed, and Got it or Mark all clears its notes. A new list that brings other merged branches polls again at once, so a session linked by branch doesn't wait for the next round. When a session leaves the screen's 15-second poll (`useItemAgents` in `client/sessions.ts`, shared with the sidebar), the screen reads the server's view from memory first, so the notes acknowledged for it are cleared before its Wrap up row goes. Paseo's SDK has no `restoreWorkspace`, so there is no Undo; `server/archive.ts` confirms instead.
99
+ - **Wrap up** [ATT-22] (`shared/wrap-up.ts`, drawn by `client/wrap-up.tsx`) uses the shared `ActionSheet` on every card-body or Details tap, including close-issue prompts and kept worktrees [ATT-06]. Item sheets reuse the detail query, hover prefetch, session entries, linked-PR rows (`client/stack.tsx`) and GitHub links from the other tabs; cleanup is an explicit action, with unsaved-work and terminal confirmations kept separate. Wrap up is assembled on the client from the sessions the screen and the sidebar already poll; the server archives and acknowledges. An item's identity is `memberKeys` in `shared/attention.ts`: its key, the PRs under it and the work a change note is about, spelled as GitHub spells them since Paseo's labels match exactly, and compared ignoring case (`shared/names.ts`, as all GitHub names are); Wrap up, archiving and acknowledging all use it. A finished item, reviewed PR, my own unmerged close, cleared change or unread change is a candidate; its sessions are the ones on any of its member keys. It enters when it has at least one unarchived session, every one is idle (not working and not needing me), none serves an item still in Doing or Waiting, and no session already belongs to another row. History lists a merged PR alone, as its branches are gone, so each live refresh remembers every open stack's and issue group's keys under each member (`groups` in `state.json`, kept as long as the ledger): a merged member whose remembered sibling is still open stays out, and so does its session. The screen freezes rows whose archive runs and Archive all clean while any row's archive runs (`shared/got-it.ts`). Archiving goes through `paseo.agents.ref(id).archive()`, sub-agents first (found by Paseo's `paseo.parent-agent-id` label, `subAgentsOf` in `shared/linked-sessions.ts`; one in another workspace is archived, its workspace left alone; archive lists every page of agents, archived ones too, so one under an archived sub-agent still counts, and a sub-agent that won't archive and stays open stops the archive before its session goes); a Paseo worktree is archived too, through `paseo.workspaces.archive`, which archives everything in it, only when every unarchived agent in it is being archived, and a local checkout never is. Workspaces are named as Paseo's sidebar names them: the title, else the branch. A worktree that stays is a `KeptRow` in `state.json` (`kept`) with its row's item; the `workspace.archived` hook forgets it, and remembers the workspace so an archive still running doesn't add it back, Dismiss forgets it, and Archive worktree or Try again runs the same checks on the worktree alone (`rpc.archiveWorktree`). Paseo closes a worktree's terminals when it archives it, so they're listed (`paseo.terminals.list`) right before archiving and named on the sheet; the confirm sends back the ids it named, and any other asks again. They're listed once more right before each worktree goes: one that opened while the sessions were being archived keeps its worktree, said in its kept row, as Paseo's SDK has no archive that checks and removes at once. Terminals that can't be listed don't keep the worktree, as Paseo would close them anyway. The plugin SDK says nothing of what a terminal runs, so an idle shell and a dev server are named alike. The dirty check reads Paseo's workspace snapshot and, for counts, `git status --porcelain`, `git diff --shortstat HEAD` for lines, and `git rev-list --count @{upstream}..HEAD` (with no upstream, `HEAD --not --remotes`) on the daemon host. Clean needs both answers: when either can't say, it's treated as dirty and the sheet says so (`unsavedOf` in `shared/archive.ts`, for the server and the screen alike). Agents and their status are listed again right before archiving, so a session that started working during the checks, or one that moved into the worktree, stops it. A session Attention Span started, archived in Paseo itself, is caught by the `agent.archived` hook in `index.server.ts` (`server/archived.ts`), even with the screen closed: once no other open session labelled with any key of its item's group is left, the group's changes up to the archive's `archivedAt` are acknowledged, so what others do later still shows. A sub-agent's archive, a restored session and a session without an item label acknowledge nothing; sessions linked only by their workspace neither acknowledge nor hold an acknowledgement back. Lists read every page, and a lookup that fails is tried again on the next hook event or list request, never taken as "none left"; tries are kept in memory, so an archive while the server isn't running, or one pending at a restart, isn't noticed, and Got it or Mark all clears its notes. A new list that brings other merged branches polls again at once, so a session linked by branch doesn't wait for the next round. When a session leaves the screen's 15-second poll (`useItemAgents` in `client/sessions.ts`, shared with the sidebar), the screen reads the server's view from memory first, so the notes acknowledged for it are cleared before its Wrap up row goes. Paseo's SDK has no `restoreWorkspace`, so there is no Undo; `server/archive.ts` confirms instead.
100
100
  - **Close #12?** [ATT-24] (`classifyCloseAsks` in `server/classify.ts`): after History's searches, the issues my merged PRs refer to that History doesn't know closed (`mergedToLookUp` in `server/references.ts`, at most 100) are looked up, a batch per request, for their state and the open PRs GitHub links to them, anyone's. A merged PR is put under an issue as `issueFor` picks one, counting History's closed issues as issues so a PR that closed one isn't put under another it mentions. An issue that's open, with no linked PR open, is asked about (`asks` in `state.json`'s History); as History is fetched daily, each live refresh looks the asked issues up again (`askOff`, one batched request while any is asked; one that can't be looked up keeps asking); the view leaves out one with a PR of mine open under it in the live feed (a mention or answer on the issue alone doesn't count), one Next up knows has anyone's PR open, one the live lookup found closed or with a PR open, one whose latest merge is older than History's weeks, one kept open (`keptOpen`: the latest merge then, so a later one asks again; kept for History's weeks, so an ask missing from one fetch doesn't lose it) and one I just closed. Closing goes through `rpc.closeIssue`, its done item carrying the merged PRs with their branches, so a session linked by branch keeps its row, whether the issue is assigned to me or not; as History's search only finds closed issues assigned to me, it's kept in `closedAsks` for History's weeks, listed in History with its PRs under it rather than alone, and Undo forgets it; Next up's card gets a "PRs merged" pill (`prsMerged`).
101
101
 
102
102
  - **Dismiss** [ATT-08] hides an item until someone other than me comments, reviews or pushes, or its reason changes. My own actions and CI reruns don't bring it back.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrioid/paseo-attention-span",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "For when your attention is spread thin: the GitHub issues and pull requests waiting on you, grouped by why, with one-tap Paseo sessions.",
5
5
  "license": "MIT",
6
6
  "repository": {