@andrioid/paseo-attention-span 0.4.14 → 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.
- package/OVERVIEW.md +9 -5
- package/README.md +2 -2
- package/client/attention-screen.tsx +127 -141
- package/client/card.tsx +4 -2
- package/client/history.tsx +184 -0
- package/client/icons.ts +3 -1
- package/client/mark.ts +19 -0
- package/client/sessions.ts +50 -3
- package/client/ui.tsx +3 -3
- package/client/wrap-up.tsx +197 -0
- package/docs/architecture.md +17 -10
- package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
- package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
- package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
- package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
- package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
- package/docs/screenshots/desktop-dark-doing.png +0 -0
- package/docs/screenshots/desktop-dark-history-filtered.png +0 -0
- package/docs/screenshots/desktop-dark-history-groups.png +0 -0
- package/docs/screenshots/desktop-dark-history.png +0 -0
- package/docs/screenshots/desktop-dark-next-up.png +0 -0
- package/docs/screenshots/desktop-dark-settings.png +0 -0
- package/docs/screenshots/desktop-dark-setup.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/docs/screenshots/phone-dark-doing.png +0 -0
- package/docs/screenshots/phone-dark-history.png +0 -0
- package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
- package/index.client.tsx +6 -1
- package/index.server.ts +21 -2
- package/package.json +8 -3
- package/requirements.yaml +10 -9
- package/server/archive.ts +132 -0
- package/server/archived.ts +120 -0
- package/server/changes.ts +184 -26
- package/server/classify.ts +9 -2
- package/server/fixture.ts +56 -12
- package/server/github-types.ts +29 -5
- package/server/queries.ts +33 -7
- package/server/service.ts +88 -17
- package/server/store.ts +10 -3
- package/server/view.ts +14 -5
- package/shared/archive.ts +37 -0
- package/shared/attention.ts +85 -8
- package/shared/changes.ts +26 -11
- package/shared/got-it.ts +23 -0
- package/shared/history-report.ts +61 -0
- package/shared/rpc.ts +23 -4
- package/shared/still.ts +4 -3
- package/shared/wrap-up.ts +126 -0
- 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.
|
|
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
|

|
|
12
14
|
|
|
@@ -18,7 +20,7 @@ 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
|
|
|
21
|
-
Sometimes other people move your work without asking: they merge your PR, close it, take
|
|
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.
|
|
22
24
|
|
|
23
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.
|
|
24
26
|
|
|
@@ -75,13 +77,15 @@ Some orgs keep issues in a separate repo from the code. When that happens, the f
|
|
|
75
77
|
|
|
76
78
|
## History: what you got done
|
|
77
79
|
|
|
78
|
-
The issues and PRs you finished in recent weeks, grouped by week,
|
|
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.
|
|
79
81
|
|
|
80
|
-
There's a copy button per week that gives you
|
|
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.
|
|
81
83
|
|
|
82
84
|

|
|
83
85
|
|
|
84
|
-

|
|
87
|
+
|
|
88
|
+

|
|
85
89
|
|
|
86
90
|
## Agent sessions
|
|
87
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
|

|
|
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,19 +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
10
|
import { changeText } from "../shared/changes";
|
|
11
11
|
import { ago, linkList } from "../shared/format";
|
|
12
12
|
import { isClear } from "../shared/still";
|
|
13
|
-
import { workEmoji } from "../shared/work";
|
|
14
13
|
import { ACTION_SESSION, renderPrompt } from "../shared/prompts";
|
|
15
14
|
import * as rpc from "../shared/rpc";
|
|
16
15
|
import { type FeedbackKind, themeName } from "../shared/feedback";
|
|
17
16
|
import { blocks } from "../shared/setup";
|
|
18
17
|
import { useAttention } from "./data";
|
|
19
|
-
import { CardList, CardRow
|
|
18
|
+
import { CardList, CardRow } from "./card";
|
|
20
19
|
import type { IconName } from "./icons";
|
|
21
20
|
import { NumberText, PlaceText } from "./entity";
|
|
22
21
|
import { NextUpList } from "./next-up";
|
|
@@ -24,10 +23,16 @@ import { Still } from "./still";
|
|
|
24
23
|
import { agentSignal, sessionEntry, startAnotherEntry } from "./session-menu";
|
|
25
24
|
import { ActionSheet, DETAILS_STALE_MS, DetailLines, type DetailsQuery, detailsKey, FadeIn, githubEntry, Modal, type SheetEntry, useArrived, usePrefetchOnRest } from "./sheet";
|
|
26
25
|
import { FeedbackAsk, FeedbackLine, type FeedbackScreen, FeedbackSheet } from "./feedback";
|
|
27
|
-
import { branchWorkspaces, type FetchProviders, findCheckout, githubProjects,
|
|
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";
|
|
28
33
|
import { SetupChecklist } from "./setup";
|
|
29
34
|
import { UpdateNotice } from "./update";
|
|
30
|
-
import { Avatar, Button,
|
|
35
|
+
import { Avatar, Button, Hint, KeepStyles, LINE_HEIGHT, Loading, Meta, mix, SectionHeader, SpinningIcon, StylesProvider, TablerIcon, Toggle, useCopy, useHover, useStrongText, useStyles } from "./ui";
|
|
31
36
|
|
|
32
37
|
// The agent icon marks every action that starts an agent session; the rest act on GitHub right away [ATT-13].
|
|
33
38
|
const ACTION_ICONS: Record<ActionId, IconName> = {
|
|
@@ -183,10 +188,11 @@ const SECTION_ICONS: Record<SectionId, IconName> = {
|
|
|
183
188
|
wait_reviewer: "replyArrow",
|
|
184
189
|
wait_ci: "clock",
|
|
185
190
|
wait_answer: "reply",
|
|
191
|
+
wrap: "archive",
|
|
186
192
|
changed: "team",
|
|
187
193
|
done: "merge",
|
|
188
194
|
reviewed: "review",
|
|
189
|
-
handed_off: "
|
|
195
|
+
handed_off: "team",
|
|
190
196
|
};
|
|
191
197
|
|
|
192
198
|
const TABS: { id: TabId; label: string; icon: IconName }[] = [
|
|
@@ -196,7 +202,6 @@ const TABS: { id: TabId; label: string; icon: IconName }[] = [
|
|
|
196
202
|
{ id: "next", label: "Next up", icon: "nextUp" },
|
|
197
203
|
];
|
|
198
204
|
|
|
199
|
-
const AGENTS_QUERY_KEY = ["attention-span", "agents"] as const;
|
|
200
205
|
type FetchContext = (input: RpcInput<typeof rpc.sessionContext>) => Promise<RpcOutput<typeof rpc.sessionContext>>;
|
|
201
206
|
export type FetchDetails = (input: RpcInput<typeof rpc.itemDetails>) => Promise<RpcOutput<typeof rpc.itemDetails>>;
|
|
202
207
|
type DefaultBranch = (repo: string) => Promise<string | null>;
|
|
@@ -248,12 +253,14 @@ function AttentionList({
|
|
|
248
253
|
const toast = useToast();
|
|
249
254
|
const queryClient = useQueryClient();
|
|
250
255
|
const attention = useAttention();
|
|
251
|
-
const agents =
|
|
256
|
+
const agents = useItemAgents();
|
|
252
257
|
const fetchContext = useRpc(rpc.sessionContext);
|
|
253
258
|
const dismiss = useRpc(rpc.dismissItem);
|
|
254
259
|
const undismiss = useRpc(rpc.undismissItem);
|
|
255
260
|
const restore = useRpc(rpc.restoreDismissed);
|
|
256
261
|
const gotIt = useRpc(rpc.gotIt);
|
|
262
|
+
const saveHistoryFilter = useRpc(rpc.setHistoryFilter);
|
|
263
|
+
const archiveSessions = useRpc(rpc.archiveSessions);
|
|
257
264
|
const saveScopes = useRpc(rpc.setScopes);
|
|
258
265
|
const saveSources = useRpc(rpc.setSources);
|
|
259
266
|
const saveProjects = useRpc(rpc.setProjectFilter);
|
|
@@ -279,9 +286,14 @@ function AttentionList({
|
|
|
279
286
|
const [tab, setTab] = useState<TabId>("doing");
|
|
280
287
|
// Every card with a change still running: each runs on its own.
|
|
281
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());
|
|
282
292
|
const [undoable, setUndoable] = useState<Undoable[]>([]);
|
|
283
293
|
const [placing, setPlacing] = useState<Placing | null>(null);
|
|
284
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);
|
|
285
297
|
// The feedback sheet, then the first words for the kind picked in it [FB-01].
|
|
286
298
|
const [feedback, setFeedback] = useState<"sheet" | FeedbackKind | null>(null);
|
|
287
299
|
const view = attention.data;
|
|
@@ -290,7 +302,6 @@ function AttentionList({
|
|
|
290
302
|
const failing = !!attention.error || !!view?.feeds.live.error;
|
|
291
303
|
const setup = useQuery({ queryKey: ["attention-span", "setup"], queryFn: () => fetchSetup({}), enabled: failing });
|
|
292
304
|
const [checking, setChecking] = useState(false);
|
|
293
|
-
|
|
294
305
|
async function run(key: string, label: string, work: () => Promise<unknown>) {
|
|
295
306
|
setBusy((keys) => new Set(keys).add(key));
|
|
296
307
|
try {
|
|
@@ -374,21 +385,29 @@ function AttentionList({
|
|
|
374
385
|
|
|
375
386
|
// Each tab shows how fresh its own feed is.
|
|
376
387
|
const feed = view.feeds[TAB_FEED[tab]];
|
|
377
|
-
//
|
|
378
|
-
const
|
|
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);
|
|
379
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.
|
|
380
398
|
const pressed = attention.isRefreshing(TAB_FEED[tab]);
|
|
381
399
|
const refreshing = feed.refreshing || attention.isFetching || pressed;
|
|
382
400
|
const counts: Record<TabId, number> = {
|
|
383
401
|
history: view.history.filter((item) => item.section === "done").length,
|
|
384
|
-
doing: view
|
|
402
|
+
doing: doingCount(view, wrap),
|
|
385
403
|
// Work waiting on several people counts once.
|
|
386
404
|
waiting: new Set(view.waiting.flatMap((group) => group.items.map((item) => item.key))).size,
|
|
387
405
|
next: view.assigned.length + view.unclaimed.length,
|
|
388
406
|
};
|
|
389
407
|
|
|
390
408
|
const actions: Actions = {
|
|
391
|
-
agents:
|
|
409
|
+
agents: agentsNow,
|
|
410
|
+
fixture: !!view.fixtureAgents,
|
|
392
411
|
startWithOptions: setOptions,
|
|
393
412
|
busy,
|
|
394
413
|
config: view.config,
|
|
@@ -404,10 +423,10 @@ function AttentionList({
|
|
|
404
423
|
const session = ACTION_SESSION[action];
|
|
405
424
|
const { target } = item;
|
|
406
425
|
if (action === "reply") return void openExternalUrl(item.person?.url ?? item.url);
|
|
407
|
-
// [
|
|
426
|
+
// [HIS-07]
|
|
408
427
|
if (action === "got_it" && item.change) {
|
|
409
428
|
const { id } = item.change;
|
|
410
|
-
return change(item.key, "Got it", () => gotIt({ id, on: true }), `Cleared the note on “${item.title}”`, () => gotIt({ id, on: false }));
|
|
429
|
+
return change(item.key, "Got it", () => gotIt({ ids: [id], on: true }), `Cleared the note on “${item.title}”`, () => gotIt({ ids: [id], on: false }));
|
|
411
430
|
}
|
|
412
431
|
if (session) return void startWithDefaults(item.key, session, target);
|
|
413
432
|
if (action === "update") change(item.key, "Update", () => update({ key: item.key, target }), `Updating PR ${target.number} with ${target.baseRefName}`);
|
|
@@ -449,9 +468,41 @@ function AttentionList({
|
|
|
449
468
|
action === "merge"
|
|
450
469
|
? change(item.key, "Merge", () => merge({ key: item.key, target: item.target }), `PR ${item.target.number} merged`)
|
|
451
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
|
+
},
|
|
452
477
|
dismiss: (item) => change(item.key, "Dismiss", () => dismiss({ key: item.key }), `Dismissed “${item.title}”`, () => undismiss({ key: item.key }), true),
|
|
453
478
|
};
|
|
454
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
|
+
|
|
455
506
|
const switchTab = (id: TabId) => {
|
|
456
507
|
setTab(id);
|
|
457
508
|
setUndoable([]);
|
|
@@ -463,7 +514,7 @@ function AttentionList({
|
|
|
463
514
|
<View style={[styles.row, { justifyContent: "space-between", flexWrap: "wrap" }]}>
|
|
464
515
|
<View style={styles.row}>
|
|
465
516
|
{TABS.map(({ id, label, icon }) => (
|
|
466
|
-
<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)} />
|
|
467
518
|
))}
|
|
468
519
|
</View>
|
|
469
520
|
<View style={[styles.row, { gap: 16 }]}>
|
|
@@ -505,10 +556,54 @@ function AttentionList({
|
|
|
505
556
|
/>
|
|
506
557
|
</View>
|
|
507
558
|
))}
|
|
508
|
-
{tab === "history" ?
|
|
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}
|
|
509
578
|
{tab === "doing" ? (
|
|
510
579
|
<>
|
|
511
|
-
{clear ? <Still /> :
|
|
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}
|
|
512
607
|
{view.dismissedCount > undoable.filter((row) => row.dismissal).length ? (
|
|
513
608
|
<Pressable
|
|
514
609
|
accessibilityRole="button"
|
|
@@ -584,19 +679,21 @@ function AttentionList({
|
|
|
584
679
|
);
|
|
585
680
|
}
|
|
586
681
|
|
|
587
|
-
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 }) {
|
|
588
683
|
const styles = useStyles();
|
|
589
684
|
const color = active ? styles.c.foreground : styles.c.foregroundMuted;
|
|
590
|
-
// 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].
|
|
591
687
|
return (
|
|
592
688
|
<Pressable
|
|
593
689
|
accessibilityRole="tab"
|
|
594
|
-
accessibilityLabel={`${label}, ${count}`}
|
|
690
|
+
accessibilityLabel={`${label}, ${count}${dot ? ", unread changes" : ""}`}
|
|
595
691
|
accessibilityState={{ selected: active }}
|
|
596
692
|
onPress={onPress}
|
|
597
693
|
style={[styles.row, { gap: 6, paddingVertical: 7, paddingHorizontal: styles.compact ? 9 : 12, borderRadius: 9, backgroundColor: active ? styles.c.surface2 : "transparent" }]}
|
|
598
694
|
>
|
|
599
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}
|
|
600
697
|
{/* On phones only the active tab is labelled, so four tabs fit. */}
|
|
601
698
|
{active || !styles.compact ? <Text style={{ color, fontSize: 14, fontWeight: active ? "600" : "400" }}>{label}</Text> : null}
|
|
602
699
|
<View style={{ minWidth: 20, alignItems: "center", paddingHorizontal: 6, paddingVertical: 1, borderRadius: 9, backgroundColor: tint(styles.c.foreground, active ? 0.14 : 0.08) }}>
|
|
@@ -616,6 +713,8 @@ function tint(color: string, alpha: number): string {
|
|
|
616
713
|
|
|
617
714
|
interface Actions {
|
|
618
715
|
agents: AgentSummary[];
|
|
716
|
+
// Previews have made-up sessions: show their sheets locally instead of asking a daemon that has none.
|
|
717
|
+
fixture: boolean;
|
|
619
718
|
startWithOptions: (spec: OptionsSpec) => void;
|
|
620
719
|
busy: ReadonlySet<string>;
|
|
621
720
|
config: AttentionConfig;
|
|
@@ -632,24 +731,11 @@ interface Actions {
|
|
|
632
731
|
acknowledge: (item: Item, commentIds: string[]) => void;
|
|
633
732
|
confirm: (item: Item, action: "merge" | "close", comment?: string) => void;
|
|
634
733
|
dismiss: (item: Item) => void;
|
|
734
|
+
gotItAll: (items: Item[]) => void;
|
|
635
735
|
openAgent: (agentId: string) => void;
|
|
636
736
|
started: (agentId: string) => Promise<void>;
|
|
637
737
|
}
|
|
638
738
|
|
|
639
|
-
// What the card is: open, draft, merged or closed. Urgency stays in the chips and section headers.
|
|
640
|
-
// A note on what someone else did shows what happened instead; its words say it too, so color isn't the only sign [ATT-21].
|
|
641
|
-
function stateMark(item: Item): CardProps["mark"] {
|
|
642
|
-
if (item.change) {
|
|
643
|
-
const kind = item.change.kind;
|
|
644
|
-
if (kind === "merged") return { icon: "merge", tone: "good" };
|
|
645
|
-
if (kind === "closed") return { icon: "prClosed", tone: "bad" };
|
|
646
|
-
return { icon: kind === "unassigned" ? "userMinus" : "userShare", tone: "warn" };
|
|
647
|
-
}
|
|
648
|
-
if (item.closedAt) return item.kind === "pr" ? { icon: "merge", tone: "good" } : { icon: "issueClosed", tone: item.chips.length ? "neutral" : "good" };
|
|
649
|
-
if (item.kind === "issue") return { icon: "issue", tone: "good" };
|
|
650
|
-
return item.draft ? { icon: "draft", tone: "neutral" } : { icon: "pr", tone: "good" };
|
|
651
|
-
}
|
|
652
|
-
|
|
653
739
|
// A card that works collapsed: its main action and ›. Tapping it opens the sheet with everything else [ATT-05, ATT-06].
|
|
654
740
|
const isRed = (chips: Chip[]) => chips.some((chip) => chip.tone === "bad");
|
|
655
741
|
|
|
@@ -733,7 +819,7 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
|
|
|
733
819
|
when: item.change
|
|
734
820
|
? changeText(item.change)
|
|
735
821
|
: item.closedAt
|
|
736
|
-
? `${item.kind === "pr" ? "merged" : "closed"} ${ago(item.closedAt)} ago${item.mergedBy ? ` by ${item.mergedBy}` : ""}`
|
|
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" : ""}`
|
|
737
823
|
: undefined,
|
|
738
824
|
signals: chips,
|
|
739
825
|
}}
|
|
@@ -749,18 +835,18 @@ function ItemRow({ item, first, actions, group }: { item: Item; first: boolean;
|
|
|
749
835
|
}
|
|
750
836
|
onOpen={open}
|
|
751
837
|
hover={prefetch}
|
|
752
|
-
busy={actions.busy.has(item.key)}
|
|
838
|
+
busy={item.change ? noteBusy(actions.busy, item.key) : actions.busy.has(item.key)}
|
|
753
839
|
primary={
|
|
754
840
|
sessions[0]
|
|
755
841
|
? { label: "Open session", icon: "agent", onPress: () => actions.openAgent(sessions[0].id) }
|
|
756
842
|
: main
|
|
757
|
-
? { 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) }
|
|
758
844
|
: undefined
|
|
759
845
|
}
|
|
760
846
|
secondary={[
|
|
761
847
|
only ? { label: only.label, accessibilityLabel: only.accessibilityLabel, icon: only.icon, onPress: only.onPress } : { label: `Details for #${item.number}`, icon: "chevronRight", onPress: open },
|
|
762
|
-
// History is where I report from, so its cards copy their link in one tap [ATT-15].
|
|
763
|
-
...(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}`) }] : []),
|
|
764
850
|
]}
|
|
765
851
|
confirm={
|
|
766
852
|
confirm === "merge"
|
|
@@ -899,7 +985,7 @@ function sheetEntries(
|
|
|
899
985
|
// History, where an issue is its own target, the first of the PRs that closed it.
|
|
900
986
|
const pr = targetUrl(item) && item.target.kind === "pr" ? item.target : item.kind === "issue" && item.children[0] ? item.children[0] : undefined;
|
|
901
987
|
entries.push(githubEntry(item, (url) => close(() => void openExternalUrl(url))(), pr));
|
|
902
|
-
// 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 [
|
|
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].
|
|
903
989
|
if (!item.closedAt && !item.change) entries.push(startAnotherEntry(sessions.length > 0, withOptions("Start session", fallbackKind(item))));
|
|
904
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)) });
|
|
905
991
|
return entries;
|
|
@@ -1208,106 +1294,6 @@ function Waiting({ groups, actions }: { groups: WaitingGroup[]; actions: Actions
|
|
|
1208
1294
|
});
|
|
1209
1295
|
}
|
|
1210
1296
|
|
|
1211
|
-
// Monday-start weeks in the device's time zone.
|
|
1212
|
-
function weekOf(iso: string): Date {
|
|
1213
|
-
const day = new Date(iso);
|
|
1214
|
-
day.setHours(0, 0, 0, 0);
|
|
1215
|
-
day.setDate(day.getDate() - ((day.getDay() + 6) % 7));
|
|
1216
|
-
return day;
|
|
1217
|
-
}
|
|
1218
|
-
|
|
1219
|
-
function weekLabel(monday: Date): string {
|
|
1220
|
-
const weeks = Math.round((weekOf(new Date().toISOString()).getTime() - monday.getTime()) / (7 * 86_400_000));
|
|
1221
|
-
if (weeks === 0) return "This week";
|
|
1222
|
-
if (weeks === 1) return "Last week";
|
|
1223
|
-
const sunday = new Date(monday.getTime() + 6 * 86_400_000);
|
|
1224
|
-
const format = (date: Date) => date.toLocaleDateString(undefined, { month: "short", day: "numeric" });
|
|
1225
|
-
return `${format(monday)} – ${format(sunday)}`;
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
// What I finished, by week, with reviews tucked away per week [HIS-01, HIS-02].
|
|
1229
|
-
// 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].
|
|
1230
|
-
function History({ items, actions }: { items: Item[]; actions: Actions }) {
|
|
1231
|
-
const styles = useStyles();
|
|
1232
|
-
const copy = useCopy();
|
|
1233
|
-
// Groups opened, as "<week>:<group>"; each opens on its own.
|
|
1234
|
-
const [open, setOpen] = useState<ReadonlySet<string>>(new Set());
|
|
1235
|
-
const toggle = (id: string) => setOpen((now) => (now.has(id) ? new Set([...now].filter((other) => other !== id)) : new Set([...now, id])));
|
|
1236
|
-
if (items.length === 0) return <Text style={styles.text}>Nothing finished in this period.</Text>;
|
|
1237
|
-
const weeks = new Map<number, Item[]>();
|
|
1238
|
-
for (const item of items) {
|
|
1239
|
-
const week = weekOf(item.closedAt!).getTime();
|
|
1240
|
-
weeks.set(week, [...(weeks.get(week) ?? []), item]);
|
|
1241
|
-
}
|
|
1242
|
-
const blocks: ReactNode[] = [];
|
|
1243
|
-
for (const [week, all] of [...weeks].sort((a, b) => b[0] - a[0])) {
|
|
1244
|
-
const done = all.filter((item) => item.section === "done").sort((a, b) => b.closedAt!.localeCompare(a.closedAt!));
|
|
1245
|
-
const reviewed = all.filter((item) => item.section === "reviewed");
|
|
1246
|
-
// Out of the week's copy: it wasn't my finished work [HIS-06].
|
|
1247
|
-
const handed = all.filter((item) => item.section === "handed_off").sort((a, b) => b.closedAt!.localeCompare(a.closedAt!));
|
|
1248
|
-
// What was done, each led by its kind; not planned issues stay on screen but out of the report [HIS-03, HIS-04].
|
|
1249
|
-
const copied = done.filter((item) => !item.notPlanned);
|
|
1250
|
-
const label = weekLabel(new Date(week));
|
|
1251
|
-
blocks.push(
|
|
1252
|
-
<View key={week} style={{ gap: 8 }}>
|
|
1253
|
-
<SectionHeader
|
|
1254
|
-
icon="clock"
|
|
1255
|
-
title={label}
|
|
1256
|
-
count={done.length}
|
|
1257
|
-
action={
|
|
1258
|
-
copied.length > 0 ? (
|
|
1259
|
-
<View style={styles.overCard}>
|
|
1260
|
-
<Button
|
|
1261
|
-
icon="markdown"
|
|
1262
|
-
variant="ghost"
|
|
1263
|
-
accessibilityLabel={`Copy links from ${label}`}
|
|
1264
|
-
onPress={() =>
|
|
1265
|
-
copy(
|
|
1266
|
-
linkList(copied.map((item) => ({ title: item.title, url: item.url, mark: workEmoji(item) }))),
|
|
1267
|
-
`Copied ${copied.length} link${copied.length === 1 ? "" : "s"} from ${label}`,
|
|
1268
|
-
)
|
|
1269
|
-
}
|
|
1270
|
-
/>
|
|
1271
|
-
</View>
|
|
1272
|
-
) : null
|
|
1273
|
-
}
|
|
1274
|
-
/>
|
|
1275
|
-
{done.length > 0 ? <Card items={done} actions={actions} /> : null}
|
|
1276
|
-
{reviewed.length > 0 ? (
|
|
1277
|
-
<View style={{ gap: 8 }}>
|
|
1278
|
-
{/* Its copy lines up under the week's, at the right edge, like every Markdown copy. */}
|
|
1279
|
-
<View style={styles.row}>
|
|
1280
|
-
<Disclosure label="Reviewed" count={reviewed.length} open={open.has(`${label}:reviewed`)} onPress={() => toggle(`${label}:reviewed`)} />
|
|
1281
|
-
<View style={{ flex: 1 }} />
|
|
1282
|
-
<View style={styles.overCard}>
|
|
1283
|
-
<Button
|
|
1284
|
-
icon="markdown"
|
|
1285
|
-
variant="ghost"
|
|
1286
|
-
accessibilityLabel={`Copy reviewed links from ${label}`}
|
|
1287
|
-
onPress={() =>
|
|
1288
|
-
copy(
|
|
1289
|
-
linkList(reviewed.map((item) => ({ title: item.title, url: item.url, mark: workEmoji(item) }))),
|
|
1290
|
-
`Copied ${reviewed.length} reviewed link${reviewed.length === 1 ? "" : "s"} from ${label}`,
|
|
1291
|
-
)
|
|
1292
|
-
}
|
|
1293
|
-
/>
|
|
1294
|
-
</View>
|
|
1295
|
-
</View>
|
|
1296
|
-
{open.has(`${label}:reviewed`) ? <Card items={reviewed} actions={actions} /> : null}
|
|
1297
|
-
</View>
|
|
1298
|
-
) : null}
|
|
1299
|
-
{handed.length > 0 ? (
|
|
1300
|
-
<View style={{ gap: 8 }}>
|
|
1301
|
-
<Disclosure label="Closed or handed off" count={handed.length} open={open.has(`${label}:handed`)} onPress={() => toggle(`${label}:handed`)} />
|
|
1302
|
-
{open.has(`${label}:handed`) ? <Card items={handed} actions={actions} /> : null}
|
|
1303
|
-
</View>
|
|
1304
|
-
) : null}
|
|
1305
|
-
</View>,
|
|
1306
|
-
);
|
|
1307
|
-
}
|
|
1308
|
-
return blocks;
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
1297
|
// Stacked or linked PRs as a connected line; collapsed, only those needing attention [ATT-03, ATT-04].
|
|
1312
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].
|
|
1313
1299
|
function StackLine({ rows, merged, links = false, target }: { rows: SubRow[]; merged: boolean; links?: boolean; target?: string }) {
|
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}
|