@andrioid/paseo-attention-span 0.4.13 → 0.5.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 (54) hide show
  1. package/OVERVIEW.md +10 -4
  2. package/README.md +2 -2
  3. package/client/attention-screen.tsx +142 -123
  4. package/client/card.tsx +4 -2
  5. package/client/history.tsx +184 -0
  6. package/client/icons.ts +7 -0
  7. package/client/mark.ts +19 -0
  8. package/client/sessions.ts +50 -3
  9. package/client/ui.tsx +18 -3
  10. package/client/wrap-up.tsx +197 -0
  11. package/docs/architecture.md +19 -7
  12. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  13. package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
  14. package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
  15. package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
  16. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  17. package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
  18. package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
  19. package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
  20. package/docs/screenshots/desktop-dark-doing.png +0 -0
  21. package/docs/screenshots/desktop-dark-history-filtered.png +0 -0
  22. package/docs/screenshots/desktop-dark-history-groups.png +0 -0
  23. package/docs/screenshots/desktop-dark-history.png +0 -0
  24. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  25. package/docs/screenshots/desktop-dark-settings.png +0 -0
  26. package/docs/screenshots/desktop-dark-setup.png +0 -0
  27. package/docs/screenshots/desktop-dark-waiting.png +0 -0
  28. package/docs/screenshots/phone-dark-doing.png +0 -0
  29. package/docs/screenshots/phone-dark-history.png +0 -0
  30. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  31. package/index.client.tsx +6 -1
  32. package/index.server.ts +21 -1
  33. package/package.json +8 -3
  34. package/requirements.yaml +11 -7
  35. package/server/archive.ts +132 -0
  36. package/server/archived.ts +120 -0
  37. package/server/changes.ts +355 -0
  38. package/server/classify.ts +15 -4
  39. package/server/fixture.ts +85 -8
  40. package/server/gh.ts +16 -4
  41. package/server/github-types.ts +67 -3
  42. package/server/queries.ts +62 -8
  43. package/server/service.ts +131 -11
  44. package/server/store.ts +20 -1
  45. package/server/view.ts +25 -6
  46. package/shared/archive.ts +37 -0
  47. package/shared/attention.ts +93 -3
  48. package/shared/changes.ts +66 -0
  49. package/shared/got-it.ts +23 -0
  50. package/shared/history-report.ts +61 -0
  51. package/shared/rpc.ts +23 -2
  52. package/shared/still.ts +4 -3
  53. package/shared/wrap-up.ts +126 -0
  54. package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
package/OVERVIEW.md CHANGED
@@ -6,7 +6,9 @@ There are four tabs. I think of them as a little story: what needs me now, what'
6
6
 
7
7
  ## Doing: what needs you now
8
8
 
9
- This is the one you'll live in. It's split by reason: someone's waiting for your reply, someone answered your question, a review's been requested, CI's failing, changes were requested, it's ready to merge, it needs upstream, nobody's been asked to review it yet, or it's one of your drafts. Only things you can act on, though. Nudging people lives in Waiting.
9
+ This is the one you'll live in. At the top is **Wrap up**: finished or handed-off work whose Paseo sessions are still open, waiting for you to put them away. Below that it's split by reason: someone's waiting for your reply, someone answered your question, a review's been requested, CI's failing, changes were requested, it's ready to merge, it needs upstream, nobody's been asked to review it yet, or it's one of your drafts. Only things you can act on, though. Nudging people lives in Waiting.
10
+
11
+ Wrap up is the cleanup pass. A PR that merged, an issue that closed, work that left your hands, a review you finished on someone else's PR: if one of your sessions is still open on it, it sits here once the agent is idle, newest finish first. **Archive session** puts the session and its worktree away. If anything is uncommitted or unpushed you get a sheet first, naming it, with **Open session** beside **Archive anyway**; several sessions get a list of their own. **Archive all clean** does the tidy ones in one go. A worktree shared with anything else, or a local checkout, is never archived, and there's no Undo, which is exactly why it checks first. Archived work goes to History as already read, not as a new note.
10
12
 
11
13
  ![Doing](docs/screenshots/desktop-dark-doing.png)
12
14
 
@@ -18,6 +20,8 @@ When there's nothing in it, you get a quiet horizon that follows the time of day
18
20
 
19
21
  Mentions only count while the person is still waiting for you. Reply or react and it's gone. On your own issues and PRs, a new comment from the last 30 days shows up under **Answered** even if it doesn't tag you. On other people's threads only tags count. The point is to pick out the signal, and most of what happens in threads you once commented on isn't. If you do want those replies, turn on **Follow threads I've commented on** in Settings. Team mentions are left out entirely, because "@everyone-in-backend" is not really a question for *me*. And if something's just an FYI, dismiss it. It stays gone until something new happens on it.
20
22
 
23
+ Sometimes other people move your work without asking: they merge your PR, close it, close an issue assigned to you, reopen a PR you'd seen closed, take work over, or unassign you. None of that is something to do, so it doesn't count, but it shouldn't happen behind your back either. Each one waits at the top of **History**, like "merged by dave 2h ago" or "phil took over", and the tab gets a little green dot until you tap its check, or **Mark all as read** to clear them all. If the work is already in Wrap up, archiving the session acknowledges it instead.
24
+
21
25
  Every item has one main button that matches why it's there: Reply, Review, Fix CI, Merge. Open the item and you get every action, each with a line saying what it'll do. I wanted buttons you can press without wondering what's about to happen to your repo.
22
26
 
23
27
  ![An item's actions](docs/screenshots/desktop-dark-doing-sheet.png)
@@ -73,13 +77,15 @@ Some orgs keep issues in a separate repo from the code. When that happens, the f
73
77
 
74
78
  ## History: what you got done
75
79
 
76
- The issues and PRs you finished in recent weeks, grouped by week, plus the PRs you reviewed that got merged. Reviews are work too, even if nobody counts them.
80
+ The issues and PRs you finished in recent weeks, grouped by week, with what others did at the top until you've seen it. Reviews are work too, even if nobody counts them, so **Filter** can show them under each week, along with the changes by others you've cleared. Finished work is always there; the other two are off until you ask, and the button remembers.
77
81
 
78
- There's a copy button per week that gives you a Markdown list of links, each led by what kind of work it was: 🐞 bug, 🚀 feature, 🔧 task, or 🔀 for a PR that's none of those. The kind comes from the issue type, else the labels, else a title like "fix: …", so it works whether or not your repos use issue types. Cards show it too. Issues closed as not planned stay out of the list. That's my standup prep now, and it takes about four seconds.
82
+ There's a copy button per week that gives you Markdown lists of what's shown, each line led by what kind of work it was: 🐞 bug, 🚀 feature, 🔧 task, or 🔀 for a PR that's none of those. The kind comes from the issue type, else the labels, else a title like "fix: …", so it works whether or not your repos use issue types. Cards show it too. Issues closed as not planned stay out of the list. A PR someone else merged says who, and so does an issue someone else closed. Work that left your hands (a PR someone closed or took over, an issue you were taken off) sits under **Changed by others** when that's shown, out of the list, even if its new owner merges it later. Changes by others are never copied. That's my standup prep now, and it takes about four seconds.
79
83
 
80
84
  ![History](docs/screenshots/desktop-dark-history.png)
81
85
 
82
- ![History with reviews](docs/screenshots/desktop-dark-history-reviewed.png)
86
+ ![History filtered to Reviewed and changes](docs/screenshots/desktop-dark-history-filtered.png)
87
+
88
+ ![Both lists under a week](docs/screenshots/desktop-dark-history-groups.png)
83
89
 
84
90
  ## Agent sessions
85
91
 
package/README.md CHANGED
@@ -8,10 +8,10 @@ It's a [Paseo](https://paseo.sh) plugin that boils GitHub down to a short list o
8
8
 
9
9
  ![Doing](docs/screenshots/desktop-dark-doing.png)
10
10
 
11
- - **Doing:** what needs you right now. Someone's waiting for a reply, a review, CI's red, something's ready to merge.
11
+ - **Doing:** what needs you right now. Someone's waiting for a reply, a review, CI's red, something's ready to merge, and at the top, finished work whose sessions you should put away.
12
12
  - **Waiting:** the ball's in someone else's court. You can stop thinking about it, at least until it's waited too long.
13
13
  - **Next up:** for when your plate is actually clear. It happens. Occasionally.
14
- - **History:** what you got done, for when someone asks and your mind goes blank.
14
+ - **History:** what you got done, for when someone asks and your mind goes blank, with what others did to your work at the top until you've seen it.
15
15
 
16
16
  I've tried not to assume much about how you use GitHub. Solo, a team that reviews everything, stacked PRs, issues first, open source: so far it copes with all of them. Tell me where it doesn't.
17
17
 
@@ -4,18 +4,18 @@ import { Markdown, TextInput, useToast } from "@getpaseo/plugin/client/ui";
4
4
  import { useQuery, useQueryClient } from "@tanstack/react-query";
5
5
  import { type ReactNode, useState } from "react";
6
6
  import { Pressable, ScrollView, Text, View } from "react-native";
7
- import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type PersonRole, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn } from "../shared/attention";
7
+ import { type ActionId, type AgentSummary, type AttentionView, type Chip, checkoutPr, type FailingChecks, type Item, itemSessions, liftActive, looseSessions, type NextUpIssue, ownStack, type PersonRole, type Reviewer, type Section, type SectionId, SECTIONS, type SubRow, TAB_FEED, type TabId, type Target, type WaitingGroup, type WaitingOn, type WrapItem } from "../shared/attention";
8
8
  import { type AttentionConfig, nextUpSources, type SessionKind } from "../shared/config";
9
9
  import { failingList, groupLabel, rerunHistory, summarizeRerun } from "../shared/checks";
10
+ import { changeText } from "../shared/changes";
10
11
  import { ago, linkList } from "../shared/format";
11
12
  import { isClear } from "../shared/still";
12
- import { workEmoji } from "../shared/work";
13
13
  import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
14
14
  import * as rpc from "../shared/rpc";
15
15
  import { type FeedbackKind, themeName } from "../shared/feedback";
16
16
  import { blocks } from "../shared/setup";
17
17
  import { useAttention } from "./data";
18
- import { CardList, CardRow, type CardProps } from "./card";
18
+ import { CardList, CardRow } from "./card";
19
19
  import type { IconName } from "./icons";
20
20
  import { NumberText, PlaceText } from "./entity";
21
21
  import { NextUpList } from "./next-up";
@@ -23,7 +23,13 @@ import { Still } from "./still";
23
23
  import { agentSignal, sessionEntry, startAnotherEntry } from "./session-menu";
24
24
  import { ActionSheet, DETAILS_STALE_MS, DetailLines, type DetailsQuery, detailsKey, FadeIn, githubEntry, Modal, type SheetEntry, useArrived, usePrefetchOnRest } from "./sheet";
25
25
  import { FeedbackAsk, FeedbackLine, type FeedbackScreen, FeedbackSheet } from "./feedback";
26
- import { branchWorkspaces, type FetchProviders, findCheckout, githubProjects, itemAgents, listProfiles, noProjectMessage, resolveAgentConfig, startSession } from "./sessions";
26
+ import { AGENTS_QUERY_KEY, branchWorkspaces, type FetchProviders, findCheckout, githubProjects, listProfiles, noProjectMessage, resolveAgentConfig, startSession, useItemAgents } from "./sessions";
27
+ import { ALL_NOTES, ALL_WRAP, noteBusy } from "../shared/got-it";
28
+ import { cleanSingle, doingCount, unreadChanges, wrapItems } from "../shared/wrap-up";
29
+ import { type ArchiveOutcome, archiveTarget } from "../shared/archive";
30
+ import { History } from "./history";
31
+ import { stateMark } from "./mark";
32
+ import { WrapUp } from "./wrap-up";
27
33
  import { SetupChecklist } from "./setup";
28
34
  import { UpdateNotice } from "./update";
29
35
  import { Avatar, Button, Hint, KeepStyles, LINE_HEIGHT, Loading, Meta, mix, SectionHeader, SpinningIcon, StylesProvider, TablerIcon, Toggle, useCopy, useHover, useStrongText, useStyles } from "./ui";
@@ -45,6 +51,7 @@ const ACTION_ICONS: Record<ActionId, IconName> = {
45
51
  merge: "merge",
46
52
  close: "close",
47
53
  start: "agent",
54
+ got_it: "check",
48
55
  };
49
56
 
50
57
  function actionLabel(action: ActionId, item: Item): string {
@@ -66,6 +73,7 @@ function actionLabel(action: ActionId, item: Item): string {
66
73
  merge: "Merge",
67
74
  close: "Close draft",
68
75
  start: "Start",
76
+ got_it: "Got it",
69
77
  }[action];
70
78
  }
71
79
 
@@ -96,6 +104,7 @@ function actionDetail(action: Exclude<ActionId, "rerun">, item: Item): string {
96
104
  merge: `Merges ${pr} into ${base} (${target.mergeMethod}) now`,
97
105
  close: `Closes ${pr}. A comment is posted only if you write one`,
98
106
  start: "An agent reads the issue and proposes a plan",
107
+ got_it: "Clears this note. Nothing changes on GitHub",
99
108
  }[action];
100
109
  }
101
110
 
@@ -179,8 +188,11 @@ const SECTION_ICONS: Record<SectionId, IconName> = {
179
188
  wait_reviewer: "replyArrow",
180
189
  wait_ci: "clock",
181
190
  wait_answer: "reply",
191
+ wrap: "archive",
192
+ changed: "team",
182
193
  done: "merge",
183
194
  reviewed: "review",
195
+ handed_off: "team",
184
196
  };
185
197
 
186
198
  const TABS: { id: TabId; label: string; icon: IconName }[] = [
@@ -190,7 +202,6 @@ const TABS: { id: TabId; label: string; icon: IconName }[] = [
190
202
  { id: "next", label: "Next up", icon: "nextUp" },
191
203
  ];
192
204
 
193
- const AGENTS_QUERY_KEY = ["attention-span", "agents"] as const;
194
205
  type FetchContext = (input: RpcInput<typeof rpc.sessionContext>) => Promise<RpcOutput<typeof rpc.sessionContext>>;
195
206
  export type FetchDetails = (input: RpcInput<typeof rpc.itemDetails>) => Promise<RpcOutput<typeof rpc.itemDetails>>;
196
207
  type DefaultBranch = (repo: string) => Promise<string | null>;
@@ -242,11 +253,14 @@ function AttentionList({
242
253
  const toast = useToast();
243
254
  const queryClient = useQueryClient();
244
255
  const attention = useAttention();
245
- const agents = useQuery({ queryKey: AGENTS_QUERY_KEY, queryFn: () => itemAgents(paseo), refetchInterval: 15_000 });
256
+ const agents = useItemAgents();
246
257
  const fetchContext = useRpc(rpc.sessionContext);
247
258
  const dismiss = useRpc(rpc.dismissItem);
248
259
  const undismiss = useRpc(rpc.undismissItem);
249
260
  const restore = useRpc(rpc.restoreDismissed);
261
+ const gotIt = useRpc(rpc.gotIt);
262
+ const saveHistoryFilter = useRpc(rpc.setHistoryFilter);
263
+ const archiveSessions = useRpc(rpc.archiveSessions);
250
264
  const saveScopes = useRpc(rpc.setScopes);
251
265
  const saveSources = useRpc(rpc.setSources);
252
266
  const saveProjects = useRpc(rpc.setProjectFilter);
@@ -272,9 +286,14 @@ function AttentionList({
272
286
  const [tab, setTab] = useState<TabId>("doing");
273
287
  // Every card with a change still running: each runs on its own.
274
288
  const [busy, setBusy] = useState<ReadonlySet<string>>(new Set());
289
+ // Sessions archived here, hidden before Paseo's list catches up; in previews, where nothing really archives, this is what
290
+ // makes a Wrap up row go away after its screenshot [ATT-22].
291
+ const [archivedSessions, setArchivedSessions] = useState<ReadonlySet<string>>(new Set());
275
292
  const [undoable, setUndoable] = useState<Undoable[]>([]);
276
293
  const [placing, setPlacing] = useState<Placing | null>(null);
277
294
  const [options, setOptions] = useState<OptionsSpec | null>(null);
295
+ // History's Filter sheet: Reviewed and Changed by others per week [HIS-07].
296
+ const [filtering, setFiltering] = useState(false);
278
297
  // The feedback sheet, then the first words for the kind picked in it [FB-01].
279
298
  const [feedback, setFeedback] = useState<"sheet" | FeedbackKind | null>(null);
280
299
  const view = attention.data;
@@ -283,7 +302,6 @@ function AttentionList({
283
302
  const failing = !!attention.error || !!view?.feeds.live.error;
284
303
  const setup = useQuery({ queryKey: ["attention-span", "setup"], queryFn: () => fetchSetup({}), enabled: failing });
285
304
  const [checking, setChecking] = useState(false);
286
-
287
305
  async function run(key: string, label: string, work: () => Promise<unknown>) {
288
306
  setBusy((keys) => new Set(keys).add(key));
289
307
  try {
@@ -367,21 +385,29 @@ function AttentionList({
367
385
 
368
386
  // Each tab shows how fresh its own feed is.
369
387
  const feed = view.feeds[TAB_FEED[tab]];
370
- // Calm only once a refresh that worked says Doing is empty [ATT-18].
371
- const clear = isClear(view, !!attention.error);
388
+ // Wrap up is made here from the sessions the screen and sidebar already poll; the server archives and acknowledges [ATT-22].
389
+ const agentsNow = (view.fixtureAgents ?? agents.data ?? []).filter((agent) => !archivedSessions.has(agent.id));
390
+ const wrap = wrapItems(view, agentsNow);
391
+ // Notes about work Already in Wrap up wait there; archiving acknowledges them [HIS-07, ATT-22].
392
+ const notes = unreadChanges(view.history.filter((item) => item.section === "changed"), wrap);
393
+ // Calm only once a refresh that worked says Doing is empty, Wrap up included [ATT-18, ATT-22].
394
+ // Sessions not known yet, or failing to load, leave Wrap up unknown: no calm on that [ATT-18, ATT-22].
395
+ const sessionsKnown = !!view.fixtureAgents || (agents.isSuccess && !agents.isError);
396
+ const clear = sessionsKnown && isClear(view, !!attention.error, wrap.length);
372
397
  // ⟳ turns for any refresh of this tab's feed, but only my own press locks it: the cached view can still say a background one runs after it's done.
373
398
  const pressed = attention.isRefreshing(TAB_FEED[tab]);
374
399
  const refreshing = feed.refreshing || attention.isFetching || pressed;
375
400
  const counts: Record<TabId, number> = {
376
401
  history: view.history.filter((item) => item.section === "done").length,
377
- doing: view.count,
402
+ doing: doingCount(view, wrap),
378
403
  // Work waiting on several people counts once.
379
404
  waiting: new Set(view.waiting.flatMap((group) => group.items.map((item) => item.key))).size,
380
405
  next: view.assigned.length + view.unclaimed.length,
381
406
  };
382
407
 
383
408
  const actions: Actions = {
384
- agents: view.fixtureAgents ?? agents.data ?? [],
409
+ agents: agentsNow,
410
+ fixture: !!view.fixtureAgents,
385
411
  startWithOptions: setOptions,
386
412
  busy,
387
413
  config: view.config,
@@ -397,6 +423,11 @@ function AttentionList({
397
423
  const session = ACTION_SESSION[action];
398
424
  const { target } = item;
399
425
  if (action === "reply") return void openExternalUrl(item.person?.url ?? item.url);
426
+ // [HIS-07]
427
+ if (action === "got_it" && item.change) {
428
+ const { id } = item.change;
429
+ return change(item.key, "Got it", () => gotIt({ ids: [id], on: true }), `Cleared the note on “${item.title}”`, () => gotIt({ ids: [id], on: false }));
430
+ }
400
431
  if (session) return void startWithDefaults(item.key, session, target);
401
432
  if (action === "update") change(item.key, "Update", () => update({ key: item.key, target }), `Updating PR ${target.number} with ${target.baseRefName}`);
402
433
  // [PRS-11]
@@ -437,9 +468,41 @@ function AttentionList({
437
468
  action === "merge"
438
469
  ? change(item.key, "Merge", () => merge({ key: item.key, target: item.target }), `PR ${item.target.number} merged`)
439
470
  : change(item.key, "Close", () => close({ key: item.key, target: item.target, comment }), `PR ${item.target.number} closed`),
471
+ // Got it on every Changed by others note at once; one Undo brings them all back [HIS-07].
472
+ gotItAll: (items) => {
473
+ const ids = items.flatMap((item) => (item.change ? [item.change.id] : []));
474
+ const notes = `${ids.length} note${ids.length === 1 ? "" : "s"}`;
475
+ change(ALL_NOTES, "Mark all as read", () => gotIt({ ids, on: true }), `Cleared ${notes} on changes by others`, () => gotIt({ ids, on: false }));
476
+ },
440
477
  dismiss: (item) => change(item.key, "Dismiss", () => dismiss({ key: item.key }), `Dismissed “${item.title}”`, () => undismiss({ key: item.key }), true),
441
478
  };
442
479
 
480
+ // Archive sessions, with the busy key that makes it wait for Archive all clean and the other way round [ATT-22].
481
+ // No Undo: Paseo's SDK can't restore a workspace and its agents, so the sheet is the safeguard instead.
482
+ async function archiveRows(items: WrapItem[], confirm: boolean, key = ALL_WRAP): Promise<ArchiveOutcome | null> {
483
+ if (items.length === 0) return null;
484
+ setBusy((keys) => new Set(keys).add(key));
485
+ try {
486
+ const outcome = await archiveSessions({ targets: items.map(archiveTarget), confirm });
487
+ attention.setView(outcome.view);
488
+ if (outcome.ok) {
489
+ const archived = new Set(items.flatMap((item) => item.wrap.sessions.map((session) => session.id)));
490
+ setArchivedSessions((known) => new Set([...known, ...archived]));
491
+ const sessions = archived.size;
492
+ if (outcome.warning) toast.error(outcome.warning);
493
+ else toast.show(sessions === 1 ? `Archived the session on #${items[0].number}` : `Archived ${sessions} sessions`, { variant: "success" });
494
+ } else if (outcome.reason === "working") {
495
+ toast.error(`Couldn't archive: ${outcome.message}`);
496
+ }
497
+ return outcome;
498
+ } catch (error) {
499
+ toast.error(`Archive failed: ${(error as Error).message}`);
500
+ return null;
501
+ } finally {
502
+ setBusy((keys) => new Set([...keys].filter((other) => other !== key)));
503
+ }
504
+ }
505
+
443
506
  const switchTab = (id: TabId) => {
444
507
  setTab(id);
445
508
  setUndoable([]);
@@ -451,7 +514,7 @@ function AttentionList({
451
514
  <View style={[styles.row, { justifyContent: "space-between", flexWrap: "wrap" }]}>
452
515
  <View style={styles.row}>
453
516
  {TABS.map(({ id, label, icon }) => (
454
- <Tab key={id} icon={icon} label={label} count={counts[id]} active={tab === id} onPress={() => switchTab(id)} />
517
+ <Tab key={id} icon={icon} label={label} count={counts[id]} active={tab === id} dot={id === "history" && notes.length > 0} onPress={() => switchTab(id)} />
455
518
  ))}
456
519
  </View>
457
520
  <View style={[styles.row, { gap: 16 }]}>
@@ -493,10 +556,54 @@ function AttentionList({
493
556
  />
494
557
  </View>
495
558
  ))}
496
- {tab === "history" ? <History items={view.history} actions={actions} /> : null}
559
+ {tab === "history" ? (
560
+ <History
561
+ notes={notes}
562
+ items={view.history}
563
+ filter={view.historyFilter ?? []}
564
+ filtering={filtering}
565
+ onFiltering={setFiltering}
566
+ onFilter={(next) => {
567
+ // Ticks apply right away, like Next up's; the server remembers them [HIS-07].
568
+ attention.setView({ ...view, historyFilter: next });
569
+ saveHistoryFilter({ filter: next })
570
+ .then((saved) => attention.setView(saved))
571
+ .catch((error: Error) => toast.error(`Saving the filter failed: ${error.message}`));
572
+ }}
573
+ busy={busy}
574
+ onMarkAllRead={actions.gotItAll}
575
+ card={(items) => <Card items={items} actions={actions} />}
576
+ />
577
+ ) : null}
497
578
  {tab === "doing" ? (
498
579
  <>
499
- {clear ? <Still /> : view.doing.length ? <Sections sections={view.doing} actions={actions} /> : !feed.fetchedAt && !feed.error ? <Loading text="Checking GitHub…" /> : null}
580
+ {clear ? <Still /> : wrap.length || view.doing.length ? (
581
+ <>
582
+ {wrap.length > 0 ? (
583
+ <WrapUp
584
+ items={wrap}
585
+ busy={busy}
586
+ login={view.login}
587
+ fixture={!!view.fixtureAgents}
588
+ openAgent={openAgent}
589
+ onArchive={(item, confirm) => archiveRows([item], confirm, item.key)}
590
+ onArchiveAll={async () => {
591
+ const clean = wrap.filter(cleanSingle);
592
+ if (clean.length === 0) return;
593
+ const outcome = await archiveRows(clean, false);
594
+ if (outcome && !outcome.ok && outcome.reason === "unsaved") toast.error("Some sessions have unsaved changes. Archive them one by one.");
595
+ }}
596
+ />
597
+ ) : null}
598
+ {view.doing.length > 0 ? <Sections sections={view.doing} actions={actions} /> : null}
599
+ </>
600
+ ) : !feed.fetchedAt && !feed.error ? (
601
+ <Loading text="Checking GitHub…" />
602
+ ) : agents.isError ? (
603
+ <Text style={styles.muted}>Couldn't check your sessions, so Wrap up isn't known yet.</Text>
604
+ ) : !sessionsKnown ? (
605
+ <Loading text="Checking your sessions…" />
606
+ ) : null}
500
607
  {view.dismissedCount > undoable.filter((row) => row.dismissal).length ? (
501
608
  <Pressable
502
609
  accessibilityRole="button"
@@ -572,19 +679,21 @@ function AttentionList({
572
679
  );
573
680
  }
574
681
 
575
- function Tab({ icon, label, count, active, onPress }: { icon: IconName; label: string; count: number; active: boolean; onPress: () => void }) {
682
+ function Tab({ icon, label, count, active, dot, onPress }: { icon: IconName; label: string; count: number; active: boolean; dot?: boolean; onPress: () => void }) {
576
683
  const styles = useStyles();
577
684
  const color = active ? styles.c.foreground : styles.c.foregroundMuted;
578
- // A soft round badge for the count, a shade brighter on the open tab; green marks only where I am.
685
+ // A soft round badge for the count, a shade brighter on the open tab; green marks only where I am. A dot says History
686
+ // has unread changes without adding them to the count [HIS-07].
579
687
  return (
580
688
  <Pressable
581
689
  accessibilityRole="tab"
582
- accessibilityLabel={`${label}, ${count}`}
690
+ accessibilityLabel={`${label}, ${count}${dot ? ", unread changes" : ""}`}
583
691
  accessibilityState={{ selected: active }}
584
692
  onPress={onPress}
585
693
  style={[styles.row, { gap: 6, paddingVertical: 7, paddingHorizontal: styles.compact ? 9 : 12, borderRadius: 9, backgroundColor: active ? styles.c.surface2 : "transparent" }]}
586
694
  >
587
695
  <TablerIcon name={icon} size={16} color={active ? styles.action : color} />
696
+ {dot ? <View style={{ position: "absolute", top: 6, right: 6, width: 7, height: 7, borderRadius: 4, backgroundColor: styles.action }} /> : null}
588
697
  {/* On phones only the active tab is labelled, so four tabs fit. */}
589
698
  {active || !styles.compact ? <Text style={{ color, fontSize: 14, fontWeight: active ? "600" : "400" }}>{label}</Text> : null}
590
699
  <View style={{ minWidth: 20, alignItems: "center", paddingHorizontal: 6, paddingVertical: 1, borderRadius: 9, backgroundColor: tint(styles.c.foreground, active ? 0.14 : 0.08) }}>
@@ -604,6 +713,8 @@ function tint(color: string, alpha: number): string {
604
713
 
605
714
  interface Actions {
606
715
  agents: AgentSummary[];
716
+ // Previews have made-up sessions: show their sheets locally instead of asking a daemon that has none.
717
+ fixture: boolean;
607
718
  startWithOptions: (spec: OptionsSpec) => void;
608
719
  busy: ReadonlySet<string>;
609
720
  config: AttentionConfig;
@@ -620,17 +731,11 @@ interface Actions {
620
731
  acknowledge: (item: Item, commentIds: string[]) => void;
621
732
  confirm: (item: Item, action: "merge" | "close", comment?: string) => void;
622
733
  dismiss: (item: Item) => void;
734
+ gotItAll: (items: Item[]) => void;
623
735
  openAgent: (agentId: string) => void;
624
736
  started: (agentId: string) => Promise<void>;
625
737
  }
626
738
 
627
- // What the card is: open, draft, merged or closed. Urgency stays in the chips and section headers.
628
- function stateMark(item: Item): CardProps["mark"] {
629
- if (item.closedAt) return item.kind === "pr" ? { icon: "merge", tone: "good" } : { icon: "issueClosed", tone: item.chips.length ? "neutral" : "good" };
630
- if (item.kind === "issue") return { icon: "issue", tone: "good" };
631
- return item.draft ? { icon: "draft", tone: "neutral" } : { icon: "pr", tone: "good" };
632
- }
633
-
634
739
  // A card that works collapsed: its main action and ›. Tapping it opens the sheet with everything else [ATT-05, ATT-06].
635
740
  const isRed = (chips: Chip[]) => chips.some((chip) => chip.tone === "bad");
636
741
 
@@ -711,7 +816,11 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
711
816
  title={item.title}
712
817
  meta={{
713
818
  place: { repo: item.repo, number: item.number, login: actions.login },
714
- when: item.closedAt ? `${item.kind === "pr" ? "merged" : "closed"} ${ago(item.closedAt)} ago` : undefined,
819
+ when: item.change
820
+ ? changeText(item.change)
821
+ : item.closedAt
822
+ ? `${item.kind === "pr" ? "merged" : "closed"} ${ago(item.closedAt)} ago${(item.kind === "pr" ? item.mergedBy : item.closedBy) ? ` by ${item.kind === "pr" ? item.mergedBy : item.closedBy}` : ""}${item.notPlanned ? " as not planned" : ""}`
823
+ : undefined,
715
824
  signals: chips,
716
825
  }}
717
826
  extra={
@@ -726,18 +835,18 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
726
835
  }
727
836
  onOpen={open}
728
837
  hover={prefetch}
729
- busy={actions.busy.has(item.key)}
838
+ busy={item.change ? noteBusy(actions.busy, item.key) : actions.busy.has(item.key)}
730
839
  primary={
731
840
  sessions[0]
732
841
  ? { label: "Open session", icon: "agent", onPress: () => actions.openAgent(sessions[0].id) }
733
842
  : main
734
- ? { label: actionLabel(main, item), icon: ACTION_ICONS[main], onPress: () => perform(main) }
843
+ ? { label: actionLabel(main, item), icon: ACTION_ICONS[main], iconOnly: main === "got_it", onPress: () => perform(main) }
735
844
  : undefined
736
845
  }
737
846
  secondary={[
738
847
  only ? { label: only.label, accessibilityLabel: only.accessibilityLabel, icon: only.icon, onPress: only.onPress } : { label: `Details for #${item.number}`, icon: "chevronRight", onPress: open },
739
- // History is where I report from, so its cards copy their link in one tap [ATT-15].
740
- ...(history ? [{ label: `Copy link to #${item.number}`, icon: "copy" as const, onPress: () => copy(item.url, `Copied link to #${item.number}`) }] : []),
848
+ // History is where I report from, so its cards copy their link in one tap [ATT-15]. Unread notes are not report rows.
849
+ ...(history && item.section !== "changed" ? [{ label: `Copy link to #${item.number}`, icon: "copy" as const, onPress: () => copy(item.url, `Copied link to #${item.number}`) }] : []),
741
850
  ]}
742
851
  confirm={
743
852
  confirm === "merge"
@@ -876,9 +985,9 @@ function sheetEntries(
876
985
  // History, where an issue is its own target, the first of the PRs that closed it.
877
986
  const pr = targetUrl(item) && item.target.kind === "pr" ? item.target : item.kind === "issue" && item.children[0] ? item.children[0] : undefined;
878
987
  entries.push(githubEntry(item, (url) => close(() => void openExternalUrl(url))(), pr));
879
- // Nothing's left to start on once it's merged or closed.
880
- if (!item.closedAt) entries.push(startAnotherEntry(sessions.length > 0, withOptions("Start session", fallbackKind(item))));
881
- if (inDoing) entries.push({ key: "dismiss", icon: "dismiss", label: "Dismiss", detail: "Hides it until something new happens on it", housekeeping: true, onPress: close(() => actions.dismiss(item)) });
988
+ // Nothing's left to start on once it's merged or closed, or out of my hands; a note is cleared with Got it, not dismissed [HIS-07].
989
+ if (!item.closedAt && !item.change) entries.push(startAnotherEntry(sessions.length > 0, withOptions("Start session", fallbackKind(item))));
990
+ if (inDoing && !item.change) entries.push({ key: "dismiss", icon: "dismiss", label: "Dismiss", detail: "Hides it until something new happens on it", housekeeping: true, onPress: close(() => actions.dismiss(item)) });
882
991
  return entries;
883
992
  }
884
993
 
@@ -1185,96 +1294,6 @@ function Waiting({ groups, actions }: { groups: WaitingGroup[]; actions: Actions
1185
1294
  });
1186
1295
  }
1187
1296
 
1188
- // Monday-start weeks in the device's time zone.
1189
- function weekOf(iso: string): Date {
1190
- const day = new Date(iso);
1191
- day.setHours(0, 0, 0, 0);
1192
- day.setDate(day.getDate() - ((day.getDay() + 6) % 7));
1193
- return day;
1194
- }
1195
-
1196
- function weekLabel(monday: Date): string {
1197
- const weeks = Math.round((weekOf(new Date().toISOString()).getTime() - monday.getTime()) / (7 * 86_400_000));
1198
- if (weeks === 0) return "This week";
1199
- if (weeks === 1) return "Last week";
1200
- const sunday = new Date(monday.getTime() + 6 * 86_400_000);
1201
- const format = (date: Date) => date.toLocaleDateString(undefined, { month: "short", day: "numeric" });
1202
- return `${format(monday)} – ${format(sunday)}`;
1203
- }
1204
-
1205
- // What I finished, by week, with reviews tucked away per week [HIS-01, HIS-02].
1206
- // A week copies as a list of links to paste into a report, each led by its kind; its reviews copy as a list of their own [HIS-03, HIS-04].
1207
- function History({ items, actions }: { items: Item[]; actions: Actions }) {
1208
- const styles = useStyles();
1209
- const copy = useCopy();
1210
- const [open, setOpen] = useState<string | null>(null);
1211
- if (items.length === 0) return <Text style={styles.text}>Nothing finished in this period.</Text>;
1212
- const weeks = new Map<number, Item[]>();
1213
- for (const item of items) {
1214
- const week = weekOf(item.closedAt!).getTime();
1215
- weeks.set(week, [...(weeks.get(week) ?? []), item]);
1216
- }
1217
- const blocks: ReactNode[] = [];
1218
- for (const [week, all] of [...weeks].sort((a, b) => b[0] - a[0])) {
1219
- const done = all.filter((item) => item.section === "done").sort((a, b) => b.closedAt!.localeCompare(a.closedAt!));
1220
- const reviewed = all.filter((item) => item.section === "reviewed");
1221
- // What was done, each led by its kind; not planned issues stay on screen but out of the report [HIS-03, HIS-04].
1222
- const copied = done.filter((item) => !item.notPlanned);
1223
- const label = weekLabel(new Date(week));
1224
- blocks.push(
1225
- <View key={week} style={{ gap: 8 }}>
1226
- <SectionHeader
1227
- icon="clock"
1228
- title={label}
1229
- count={done.length}
1230
- action={
1231
- copied.length > 0 ? (
1232
- <View style={styles.overCard}>
1233
- <Button
1234
- icon="markdown"
1235
- variant="ghost"
1236
- accessibilityLabel={`Copy links from ${label}`}
1237
- onPress={() =>
1238
- copy(
1239
- linkList(copied.map((item) => ({ title: item.title, url: item.url, mark: workEmoji(item) }))),
1240
- `Copied ${copied.length} link${copied.length === 1 ? "" : "s"} from ${label}`,
1241
- )
1242
- }
1243
- />
1244
- </View>
1245
- ) : null
1246
- }
1247
- />
1248
- {done.length > 0 ? <Card items={done} actions={actions} /> : null}
1249
- {reviewed.length > 0 ? (
1250
- <View style={{ gap: 8 }}>
1251
- {/* Its copy lines up under the week's, at the right edge, like every Markdown copy. */}
1252
- <View style={styles.row}>
1253
- <Toggle label={`Reviewed (${reviewed.length})`} active={open === label} onPress={() => setOpen(open === label ? null : label)} />
1254
- <View style={{ flex: 1 }} />
1255
- <View style={styles.overCard}>
1256
- <Button
1257
- icon="markdown"
1258
- variant="ghost"
1259
- accessibilityLabel={`Copy reviewed links from ${label}`}
1260
- onPress={() =>
1261
- copy(
1262
- linkList(reviewed.map((item) => ({ title: item.title, url: item.url, mark: workEmoji(item) }))),
1263
- `Copied ${reviewed.length} reviewed link${reviewed.length === 1 ? "" : "s"} from ${label}`,
1264
- )
1265
- }
1266
- />
1267
- </View>
1268
- </View>
1269
- {open === label ? <Card items={reviewed} actions={actions} /> : null}
1270
- </View>
1271
- ) : null}
1272
- </View>,
1273
- );
1274
- }
1275
- return blocks;
1276
- }
1277
-
1278
1297
  // Stacked or linked PRs as a connected line; collapsed, only those needing attention [ATT-03, ATT-04].
1279
1298
  // 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].
1280
1299
  function StackLine({ rows, merged, links = false, target }: { rows: SubRow[]; merged: boolean; links?: boolean; target?: string }) {
@@ -1293,7 +1312,7 @@ function StackLine({ rows, merged, links = false, target }: { rows: SubRow[]; me
1293
1312
  {row.title}
1294
1313
  </Text>
1295
1314
  <View style={[styles.wrap, { columnGap: 10, rowGap: 2 }]}>
1296
- <Meta lead={<NumberText number={row.number} />} facts={[]} chips={row.chips} />
1315
+ <Meta lead={<NumberText number={row.number} />} facts={merged && row.mergedBy ? [`merged by ${row.mergedBy}`] : []} chips={row.chips} />
1297
1316
  {row.key === target ? <Text style={{ color: styles.action, fontSize: 12, fontWeight: "600" }}>actions apply here</Text> : null}
1298
1317
  </View>
1299
1318
  </View>
package/client/card.tsx CHANGED
@@ -24,6 +24,8 @@ export interface CardAction {
24
24
  onPress: () => void;
25
25
  // Defaults to the label.
26
26
  accessibilityLabel?: string;
27
+ // Icon only, still in the main action's style, for an action whose icon says it all, like Got it's check [HIS-07].
28
+ iconOnly?: boolean;
27
29
  }
28
30
 
29
31
  export interface ConfirmSpec {
@@ -68,8 +70,8 @@ export function CardRow({ first, mark, title, meta, accessibilityLabel, onOpen,
68
70
  <View style={styles.wrap}>
69
71
  {primary ? (
70
72
  <Button
71
- label={primary.label}
72
- accessibilityLabel={primary.accessibilityLabel}
73
+ label={primary.iconOnly ? undefined : primary.label}
74
+ accessibilityLabel={primary.accessibilityLabel ?? primary.label}
73
75
  icon={primary.icon}
74
76
  variant="calm"
75
77
  busy={busy}