@andrioid/paseo-attention-span 0.8.0 → 0.8.1
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 +5 -5
- package/client/attention-screen.tsx +18 -11
- package/client/item-actions.ts +8 -4
- package/docs/architecture.md +2 -2
- 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-settings.png +0 -0
- package/docs/screenshots/desktop-dark-waiting-too-long.png +0 -0
- package/docs/screenshots/desktop-dark-waiting.png +0 -0
- package/index.server.ts +1 -1
- package/package.json +1 -1
- package/server/classify.ts +8 -1
- package/server/service.ts +7 -5
- package/server/store.ts +2 -2
- package/server/view.ts +11 -4
- package/shared/attention.ts +8 -1
- package/shared/item-view.ts +2 -1
- package/shared/rpc.ts +2 -1
package/OVERVIEW.md
CHANGED
|
@@ -10,11 +10,11 @@ This is the tab you'll live in. Items are grouped by reason: someone's waiting f
|
|
|
10
10
|
|
|
11
11
|
At the top is **Wrap up**. It lists merged, closed or handed-off work that still has a Paseo session open. Archive puts the session and its worktree away. It leaves alone worktrees another session still uses, and your own checkout. It also checks for uncommitted or unpushed work first, because there's no Undo.
|
|
12
12
|
|
|
13
|
-

|
|
14
14
|
|
|
15
15
|
Every item has one main button that matches why it's there: Reply, Review, Fix CI, Merge. Open the item to see 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.
|
|
16
16
|
|
|
17
|
-

|
|
18
18
|
|
|
19
19
|
Mentions clear when you reply or react. Team mentions don't count, because "@everyone-in-backend" isn't really a question for *me*. If something's just an FYI, dismiss it.
|
|
20
20
|
|
|
@@ -24,7 +24,7 @@ This is your work where someone else has the next move: a review you asked for,
|
|
|
24
24
|
|
|
25
25
|
Otherwise there's nothing to do here, and that's kind of the point. It's tracked, so you can stop holding it in your head.
|
|
26
26
|
|
|
27
|
-

|
|
28
28
|
|
|
29
29
|
## Next up
|
|
30
30
|
|
|
@@ -32,7 +32,7 @@ For when your plate is clear. It does happen. Issues assigned to you come first,
|
|
|
32
32
|
|
|
33
33
|
**Start** launches an agent that reads the issue and proposes a plan. **New issue** (also in ⌘K) takes a line or two, and an agent turns that into a proper issue. It checks for duplicates and shows you the result before anything goes to GitHub.
|
|
34
34
|
|
|
35
|
-

|
|
36
36
|
|
|
37
37
|
## History
|
|
38
38
|
|
|
@@ -40,7 +40,7 @@ What you finished in recent weeks, grouped by week. There's a copy button per we
|
|
|
40
40
|
|
|
41
41
|
Things other people did to your work, like merging your PR or taking an issue over, wait at the top until you've seen them. None of it is a to-do, but it shouldn't happen behind your back either.
|
|
42
42
|
|
|
43
|
-

|
|
44
44
|
|
|
45
45
|
## Agent sessions
|
|
46
46
|
|
|
@@ -15,7 +15,7 @@ import { cleanSingle, unreadChanges, wrapItems } from "../shared/wrap-up";
|
|
|
15
15
|
import { nudgeLead, tabCounts } from "../shared/item-view";
|
|
16
16
|
import { useAttention } from "./data";
|
|
17
17
|
import type { IconName } from "./icons";
|
|
18
|
-
import { type Actions, useItemActions } from "./item-actions";
|
|
18
|
+
import { type Actions, type Undoable, useItemActions } from "./item-actions";
|
|
19
19
|
import { Card } from "./item-row";
|
|
20
20
|
import { InProgress } from "./in-progress";
|
|
21
21
|
import { type IssueRowProps, NextUpList } from "./next-up";
|
|
@@ -247,19 +247,14 @@ function AttentionList({
|
|
|
247
247
|
) : !sessionsKnown ? (
|
|
248
248
|
<Loading text="Checking your sessions…" />
|
|
249
249
|
) : null}
|
|
250
|
-
{view.
|
|
251
|
-
<Pressable
|
|
252
|
-
accessibilityRole="button"
|
|
253
|
-
style={clear ? { alignSelf: "center", opacity: 0.7 } : undefined}
|
|
254
|
-
onPress={act.restoreDismissed}
|
|
255
|
-
>
|
|
256
|
-
<Text style={styles.muted}>{view.dismissedCount} dismissed · show them again</Text>
|
|
257
|
-
</Pressable>
|
|
258
|
-
) : null}
|
|
250
|
+
<ShowDismissed count={view.dismissed.doing} undoable={act.undoable} centered={clear} onPress={() => act.restoreDismissed("doing")} />
|
|
259
251
|
</>
|
|
260
252
|
) : null}
|
|
261
253
|
{tab === "waiting" ? (
|
|
262
|
-
|
|
254
|
+
<>
|
|
255
|
+
{calm.waiting ? <Still shore="jetty" title="Nobody's holding you up." line="Nothing to chase." /> : <Waiting groups={view.waiting} actions={actions} />}
|
|
256
|
+
<ShowDismissed count={view.dismissed.waiting} undoable={act.undoable} centered={calm.waiting} onPress={() => act.restoreDismissed("waiting")} />
|
|
257
|
+
</>
|
|
263
258
|
) : null}
|
|
264
259
|
{tab === "next" ? (
|
|
265
260
|
<NextUpList
|
|
@@ -347,6 +342,18 @@ function Sections({ sections, started, actions, issueRow }: { sections: Section[
|
|
|
347
342
|
);
|
|
348
343
|
}
|
|
349
344
|
|
|
345
|
+
// A tab's dismissed items, to bring back; not while the Undo of one just dismissed is still offered. Undo rows go when
|
|
346
|
+
// the tab changes, so the ones showing are this tab's [ATT-08].
|
|
347
|
+
function ShowDismissed({ count, undoable, centered, onPress }: { count: number; undoable: Undoable[]; centered: boolean; onPress: () => void }) {
|
|
348
|
+
const styles = useStyles();
|
|
349
|
+
if (count <= undoable.filter((row) => row.dismissal).length) return null;
|
|
350
|
+
return (
|
|
351
|
+
<Pressable accessibilityRole="button" style={centered ? { alignSelf: "center", opacity: 0.7 } : undefined} onPress={onPress}>
|
|
352
|
+
<Text style={styles.muted}>{count} dismissed · show them again</Text>
|
|
353
|
+
</Pressable>
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
|
|
350
357
|
// Waiting by who it waits on, each with a list to copy for a nudge, oldest first; a bot gets none, as there's nobody to send
|
|
351
358
|
// it to. Last, the work no person holds up. Cards with an active session lead their group [WAI-01, WAI-03].
|
|
352
359
|
function Waiting({ groups, actions }: { groups: WaitingGroup[]; actions: Actions }) {
|
package/client/item-actions.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
|
|
|
2
2
|
import { openExternalUrl, type PluginScreenProps, usePaseo, useRpc } from "@getpaseo/plugin/client";
|
|
3
3
|
import { useToast } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import { useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { useState } from "react";
|
|
6
|
-
import type { ActionId, AgentSummary, AttentionView, HistoryFilter, IssueCloseReason, Item, NextUpIssue, Target, WrapItem } from "../shared/attention";
|
|
5
|
+
import { useRef, useState } from "react";
|
|
6
|
+
import type { ActionId, AgentSummary, AttentionView, DismissTab, HistoryFilter, IssueCloseReason, Item, NextUpIssue, Target, WrapItem } from "../shared/attention";
|
|
7
7
|
import type { AttentionConfig, SessionKind } from "../shared/config";
|
|
8
8
|
import { summarizeRerun } from "../shared/checks";
|
|
9
9
|
import { ALL_NOTES, ALL_WRAP } from "../shared/got-it";
|
|
@@ -124,6 +124,8 @@ export function useItemActions(attention: ReturnType<typeof useAttention>, navig
|
|
|
124
124
|
// makes a Wrap up row go away after its screenshot [ATT-22].
|
|
125
125
|
const [archivedSessions, setArchivedSessions] = useState<ReadonlySet<string>>(new Set());
|
|
126
126
|
const [undoable, setUndoable] = useState<Undoable[]>([]);
|
|
127
|
+
// Bumped when the tab changes and its Undo rows go, so a change still running then adds none to the next tab [ATT-08].
|
|
128
|
+
const undoTab = useRef(0);
|
|
127
129
|
const [placing, setPlacing] = useState<Placing | null>(null);
|
|
128
130
|
const [options, setOptions] = useState<OptionsSpec | null>(null);
|
|
129
131
|
const view = attention.data;
|
|
@@ -142,9 +144,11 @@ export function useItemActions(attention: ReturnType<typeof useAttention>, navig
|
|
|
142
144
|
// A change from one tap, without confirming: Undo instead, where it can be taken back [SAFE-01, ATT-08, ATT-14].
|
|
143
145
|
// The server answers each with the list after it, so nothing needs a refresh.
|
|
144
146
|
function change(key: string, label: string, work: () => Promise<AttentionView>, done: string, undo?: () => Promise<AttentionView>, dismissal?: boolean) {
|
|
147
|
+
const tab = undoTab.current;
|
|
145
148
|
void run(key, label, async () => {
|
|
146
149
|
attention.setView(await work());
|
|
147
150
|
if (!undo) return toast.show(done, { variant: "success" });
|
|
151
|
+
if (tab !== undoTab.current) return;
|
|
148
152
|
const id = Date.now() + Math.random();
|
|
149
153
|
setUndoable((rows) => [...rows, { id, text: done, undo: async () => attention.setView(await undo()), dismissal }]);
|
|
150
154
|
});
|
|
@@ -386,13 +390,13 @@ export function useItemActions(attention: ReturnType<typeof useAttention>, navig
|
|
|
386
390
|
busy,
|
|
387
391
|
archivedSessions,
|
|
388
392
|
undoable,
|
|
389
|
-
clearUndo: () => setUndoable([]),
|
|
393
|
+
clearUndo: () => ((undoTab.current += 1), setUndoable([])),
|
|
390
394
|
undo: (row: Undoable) =>
|
|
391
395
|
void run(String(row.id), "Undo", async () => {
|
|
392
396
|
await row.undo();
|
|
393
397
|
setUndoable((rows) => rows.filter((other) => other.id !== row.id));
|
|
394
398
|
}),
|
|
395
|
-
restoreDismissed: () => void run("restore", "Restore", async () => (attention.setView(await restore({})), setUndoable([]))),
|
|
399
|
+
restoreDismissed: (tab: DismissTab) => void run("restore", "Restore", async () => (attention.setView(await restore({ tab })), setUndoable([]))),
|
|
396
400
|
placing,
|
|
397
401
|
place,
|
|
398
402
|
cancelPlacing: () => setPlacing(null),
|
package/docs/architecture.md
CHANGED
|
@@ -100,7 +100,7 @@ Top to bottom. Each item appears once, under its most urgent reason [ATT-02]. `s
|
|
|
100
100
|
- **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]. PR cards and linked stack rows share state marks: open green, draft muted, closed unmerged red and merged purple; each stack row uses its own state, with merge timestamps supporting older saved rows. Cards show their main action and one Details chevron; Keep open and Dismiss live in the sheet. Close-issue prompts also offer the shared Start a session / Start another session entry, opening the usual session options on the issue. Their navigation lists all matching sessions, including working sessions; archive eligibility stays separate. 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.
|
|
101
101
|
- **Close #12?** [ATT-24] (`classifyCloseAsks` in `server/classify.ts`): after History's searches, the issues my merged PRs close, by GitHub's link or a closing keyword, 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 also closes. 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`).
|
|
102
102
|
|
|
103
|
-
- **Dismiss** [ATT-08] hides an item until someone other than me comments, reviews or pushes, or its reason changes. My
|
|
103
|
+
- **Dismiss** [ATT-08], in the sheet of Doing and Waiting items, hides an item until someone other than me comments, reviews or pushes, or its reason changes. It also comes back when I add to it: my new words on a thread, or a push, review reply or conversation comment on my PR; a comment, like a nudge, doesn't restart the wait's age (`mineAt` on the item). My other actions and CI reruns don't bring it back. A PR of mine in both Doing and Waiting is one item, hidden from both. Doing and Waiting each say how many of theirs are dismissed, "n dismissed · show them again", and bring back only theirs.
|
|
104
104
|
- **Behind base** [UPS-07] only matters when:
|
|
105
105
|
1. the PR conflicts with its base,
|
|
106
106
|
2. a stacked PR no longer builds on its parent's head,
|
|
@@ -120,7 +120,7 @@ Projects are extra, so they never cost the searches they ride on (`server/projec
|
|
|
120
120
|
|
|
121
121
|
## Actions
|
|
122
122
|
|
|
123
|
-
A card shows its main action and ›. Tapping the card or › opens its **sheet**, a bottom sheet on phones and a dialog on desktop [ATT-06]. When the sheet would hold a single action, as on
|
|
123
|
+
A card shows its main action and ›. Tapping the card or › opens its **sheet**, a bottom sheet on phones and a dialog on desktop [ATT-06]. When the sheet would hold a single action, as on History cards where it's only Open PR (or issue) on GitHub, the card shows that action instead of ›; Doing and Waiting cards always have Dismiss too, so they show ›; tapping the card still opens the sheet. History cards also have a copy icon that copies the item's URL [ATT-15]. Top to bottom, the sheet has:
|
|
124
124
|
|
|
125
125
|
1. **What the card knows:** repo#number, its chips, the full quote and the full stack. Each PR in the stack opens on GitHub, so an issue's PRs are a tap away [ATT-12]. On an issue, the PR its actions apply to is tinted in the stack and says "actions apply here", and its chips are said once, on its row: the top keeps only what the row doesn't say [ATT-04].
|
|
126
126
|
2. **Every action,** each with a line saying what it will do, in one list, with what takes the item off my list or gives it up (Dismiss, Unclaim, Close issue, Close PR) apart below the work, icons quiet. A session action's line asks first: it ends in "…" and opens Options, since the card's button is the one-tap start [SES-01, SES-02]. Once a session of that kind runs, the line opens it instead and shows its state as a badge (working, idle, needs you, failed) [SES-03, ATT-07]. Then Open issue or Open PR on GitHub [ATT-12], with a copy icon at its end that copies the URL without adding a line [ATT-15]. An issue with a PR splits that line in two halves of the same weight, "Open issue #90" and "Open PR #103 · 1 of 2", each with its own copy icon, side by side on desktop and one above the other on phones: the PR is the one its actions apply to (in Next up, the first open PR against it), so reaching it doesn't mean going through the issue on GitHub. Then a muted "Start a session…" ("Start another session…" once there is one) for a session with no action preset [SES-02], and Dismiss [ATT-08].
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.server.ts
CHANGED
|
@@ -77,7 +77,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
77
77
|
return ready(() => attention.dismissKept(workspaceId)).then(shown);
|
|
78
78
|
});
|
|
79
79
|
server.on("workspace.archived", ({ workspace }) => void ready(() => attention.forgetKept(workspace.id)));
|
|
80
|
-
server.handle(rpc.restoreDismissed, () => ready(() => attention.restoreDismissed()).then(shown));
|
|
80
|
+
server.handle(rpc.restoreDismissed, ({ tab }) => ready(() => attention.restoreDismissed(tab)).then(shown));
|
|
81
81
|
server.handle(rpc.setCodeRepo, ({ issueRepo, codeRepo }) => ready(() => attention.setCodeRepo(issueRepo, codeRepo)).then(shown));
|
|
82
82
|
server.handle(rpc.setupStatus, () => setupStatus(store, answers.ghStatus));
|
|
83
83
|
server.handle(rpc.getCoverage, () => configStatus(store));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrioid/paseo-attention-span",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
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": {
|
package/server/classify.ts
CHANGED
|
@@ -46,6 +46,7 @@ interface Part {
|
|
|
46
46
|
waitingOn?: WaitingOn[];
|
|
47
47
|
wait?: Item["wait"];
|
|
48
48
|
othersActivityAt: string;
|
|
49
|
+
mineAt?: string;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
const EPOCH = "1970-01-01T00:00:00Z";
|
|
@@ -137,6 +138,8 @@ function prState(
|
|
|
137
138
|
// Requested changes stay mine until I push after them.
|
|
138
139
|
changes: onMe.length > 0 || (pr.reviewDecision === "CHANGES_REQUESTED" && !(lastCommitAt > changesRequestedAt)),
|
|
139
140
|
repliedAt: latest(...unresolved.filter((thread) => isMe(last(thread)?.author)).map((thread) => last(thread)?.createdAt)),
|
|
141
|
+
// My last conversation comment, like a nudge: it brings a dismissed PR back, but doesn't restart its wait [ATT-08].
|
|
142
|
+
commentedAt: latest(...pr.comments.nodes.filter((c) => isMe(c.author)).map((c) => c.createdAt)),
|
|
140
143
|
lastCommitAt,
|
|
141
144
|
behindBy,
|
|
142
145
|
// A stacked PR no longer builds on its parent's latest version [UPS-02].
|
|
@@ -296,6 +299,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
296
299
|
(section === "changes" && s.botThreadsOnly ? { login: "review bot", bot: true, since: s.lastCommitAt, role: "changes" as const } : undefined),
|
|
297
300
|
waitingOn: waitingOn.length > 0 ? waitingOn : undefined,
|
|
298
301
|
othersActivityAt: latest(...stack.map((pr) => state(pr).othersActivityAt), waiting?.since, answer?.since),
|
|
302
|
+
mineAt: latest(waitingSince, ...stack.map((pr) => state(pr).commentedAt)),
|
|
299
303
|
};
|
|
300
304
|
};
|
|
301
305
|
|
|
@@ -337,6 +341,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
337
341
|
wait: lead.wait ?? other?.wait,
|
|
338
342
|
chips: [...lead.chips, ...(stack.length > 1 ? [chip(`stack of ${stack.length}`)] : [])],
|
|
339
343
|
othersActivityAt: latest(lead.othersActivityAt, other?.othersActivityAt),
|
|
344
|
+
mineAt: latest(lead.mineAt, other?.mineAt),
|
|
340
345
|
};
|
|
341
346
|
});
|
|
342
347
|
type Unit = (typeof units)[number];
|
|
@@ -408,6 +413,7 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
408
413
|
// Actions on GitHub act on my PRs, from my bottom one; Review checks out the top of the stack [ATT-04].
|
|
409
414
|
target: target(unit.own[0] ?? bottom, unit.stack),
|
|
410
415
|
othersActivityAt: latest(...grouped.map((u) => u.othersActivityAt), issueWaiting?.since),
|
|
416
|
+
mineAt: latest(...grouped.map((u) => u.mineAt)),
|
|
411
417
|
});
|
|
412
418
|
}
|
|
413
419
|
|
|
@@ -438,8 +444,9 @@ export function classify({ data, details, config, now }: ClassifyInput): Attenti
|
|
|
438
444
|
waitingOn: section !== "answered" && tagged.length > 0 ? tagged : undefined,
|
|
439
445
|
wait: section === "answered" ? undefined : { reason: flags.question ? "question" : "tagged", since, ...(tooLong ? { tooLong } : {}) },
|
|
440
446
|
actions: section === "answered" ? replyActions(person) : [],
|
|
441
|
-
// A new answer brings back a dismissed one [ATT-08].
|
|
447
|
+
// A new answer brings back a dismissed one, and so do my new words [ATT-08].
|
|
442
448
|
othersActivityAt: person ? latest(...(person.comments ?? []).map((c) => c.createdAt)) : EPOCH,
|
|
449
|
+
mineAt: mine,
|
|
443
450
|
});
|
|
444
451
|
}
|
|
445
452
|
|
package/server/service.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Attention, type AttentionView, baseItem, type CloseAsk, type FeedId, type FeedStatus, type HistoryFilter, type Item, memberKeys, type ProjectsAccess, type Reviewer } from "../shared/attention";
|
|
1
|
+
import { type Attention, type AttentionView, baseItem, type CloseAsk, type DismissTab, type FeedId, type FeedStatus, type HistoryFilter, type Item, memberKeys, type ProjectsAccess, type Reviewer } from "../shared/attention";
|
|
2
2
|
import type { PluginHandlerContext } from "@getpaseo/plugin/server";
|
|
3
3
|
import { AttentionConfig, type FieldRole } from "../shared/config";
|
|
4
4
|
import { newIssueRepos } from "../shared/new-issue";
|
|
@@ -12,7 +12,7 @@ import type { Port } from "./port";
|
|
|
12
12
|
import { historySince, isTimeZone, type UnclaimedSearch, unclaimedSearches } from "./queries";
|
|
13
13
|
import type { Details, LiveResult, ReferencedIssue } from "./github-types";
|
|
14
14
|
import { State } from "./store";
|
|
15
|
-
import { applyPending, buildView, doneItem, type Effect, isPending, type Pending, SETTLE_MS } from "./view";
|
|
15
|
+
import { applyPending, buildView, dismissedIn, doneItem, type Effect, isPending, type Pending, SETTLE_MS } from "./view";
|
|
16
16
|
import { keySet, uniqueKeys } from "../shared/names";
|
|
17
17
|
|
|
18
18
|
// History changes only when I finish something, so it's fetched daily, on ⟳ in its tab and after a merge.
|
|
@@ -102,7 +102,7 @@ export class AttentionService {
|
|
|
102
102
|
async dismiss(key: string): Promise<AttentionView> {
|
|
103
103
|
const item = this.items().find((candidate) => candidate.key === key);
|
|
104
104
|
if (item) {
|
|
105
|
-
this.state.dismissed[key] = { at: item.othersActivityAt, section: item.section };
|
|
105
|
+
this.state.dismissed[key] = { at: item.othersActivityAt, section: item.section, ...(item.mineAt ? { mine: item.mineAt } : {}) };
|
|
106
106
|
await this.save();
|
|
107
107
|
}
|
|
108
108
|
return this.view();
|
|
@@ -133,8 +133,10 @@ export class AttentionService {
|
|
|
133
133
|
return this.view();
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
// A tab's dismissed items, or all of them [ATT-08].
|
|
137
|
+
async restoreDismissed(tab?: DismissTab): Promise<AttentionView> {
|
|
138
|
+
if (!tab) this.state.dismissed = {};
|
|
139
|
+
else for (const key of dismissedIn(this.items(), this.state.dismissed, tab)) delete this.state.dismissed[key];
|
|
138
140
|
await this.save();
|
|
139
141
|
return this.view();
|
|
140
142
|
}
|
package/server/store.ts
CHANGED
|
@@ -19,8 +19,8 @@ export const OLD_DIR = CHOSEN_DIR ? undefined : join(homedir(), ".config", "pase
|
|
|
19
19
|
const knownSections = (items: unknown): boolean => Array.isArray(items) && items.every((item) => Object.hasOwn(SECTIONS, (item as Item)?.section));
|
|
20
20
|
|
|
21
21
|
export const State = z.object({
|
|
22
|
-
// Item key -> others' activity and
|
|
23
|
-
dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>() })).default({}),
|
|
22
|
+
// Item key -> others' activity, section, and my latest words or push, when dismissed [ATT-08].
|
|
23
|
+
dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>(), mine: z.string().optional() })).default({}),
|
|
24
24
|
// Item key -> what I just changed on GitHub, until a fetch shows it [FRESH-02].
|
|
25
25
|
pending: z.record(z.string(), z.custom<Pending>((value) => typeof (value as Pending)?.at === "string" && !!(value as Pending)?.effect)).default({}).catch({}),
|
|
26
26
|
// Scopes ticked in Next up's filter; none means all [NXT-03].
|
package/server/view.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Attention, type AttentionView, baseItem, type Chip, type CloseAsk, type FeedId, type FeedStatus, type HistoryFilter, type Item, type NextUpIssue, type Section, SECTION_ORDER, SECTIONS, type TabId, type WaitingGroup } from "../shared/attention";
|
|
1
|
+
import { type Attention, type AttentionView, baseItem, type Chip, type CloseAsk, type DismissTab, type FeedId, type FeedStatus, type HistoryFilter, type Item, type NextUpIssue, type Section, SECTION_ORDER, SECTIONS, type TabId, type WaitingGroup } from "../shared/attention";
|
|
2
2
|
import type { AttentionConfig } from "../shared/config";
|
|
3
3
|
import type { KeptRow } from "../shared/archive";
|
|
4
4
|
import type { NewIssueInfo } from "../shared/new-issue";
|
|
@@ -93,10 +93,17 @@ export function applyPending(attention: Attention | null, history: Item[], pendi
|
|
|
93
93
|
return { attention: { ...attention, items, assigned, unclaimed }, history: [...done, ...history] };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// A dismissed item stays hidden until someone else does something on it
|
|
96
|
+
// A dismissed item stays hidden until someone else does something on it, its reason changes, or I add words or push to it
|
|
97
|
+
// [ATT-08].
|
|
97
98
|
export function isDismissed(item: Item, dismissed: State["dismissed"]): boolean {
|
|
98
99
|
const entry = dismissed[item.key];
|
|
99
|
-
return !!entry && entry.section === item.section && item.othersActivityAt <= entry.at;
|
|
100
|
+
return !!entry && entry.section === item.section && item.othersActivityAt <= entry.at && !(entry.mine && item.mineAt && item.mineAt > entry.mine);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// The keys of a tab's dismissed items: Doing's, or Waiting's, where my Doing PRs that wait on others are too [ATT-08, PRS-15].
|
|
104
|
+
export function dismissedIn(items: Item[], dismissed: State["dismissed"], tab: DismissTab): string[] {
|
|
105
|
+
const inTab = tab === "doing" ? (item: Item) => SECTIONS[item.section].tab === "doing" : inWaiting;
|
|
106
|
+
return items.filter((item) => inTab(item) && isDismissed(item, dismissed)).map((item) => item.key);
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
// Waiting by who it waits on, so I know whom to nudge: whoever blocks the most first, ties by the longest wait, then bots, who
|
|
@@ -185,6 +192,6 @@ export function buildView(attention: Attention | null, fetched: Item[], dismisse
|
|
|
185
192
|
unclaimed: marked(attention?.unclaimed ?? []),
|
|
186
193
|
unclaimedFrom: attention?.unclaimedFrom ?? "config",
|
|
187
194
|
projects: attention?.projects ?? [],
|
|
188
|
-
|
|
195
|
+
dismissed: { doing: dismissedIn(items, dismissed, "doing").length, waiting: dismissedIn(items, dismissed, "waiting").length },
|
|
189
196
|
};
|
|
190
197
|
}
|
package/shared/attention.ts
CHANGED
|
@@ -254,6 +254,9 @@ export interface Item {
|
|
|
254
254
|
target: Target;
|
|
255
255
|
// Latest activity by someone else, for bringing back dismissed items [ATT-08].
|
|
256
256
|
othersActivityAt: string;
|
|
257
|
+
// My latest words or push on it, which bring back a dismissed wait too: my comments on a thread, or a push, review reply or
|
|
258
|
+
// conversation comment on my PR [ATT-08].
|
|
259
|
+
mineAt?: string;
|
|
257
260
|
// History only: when it merged or closed.
|
|
258
261
|
closedAt?: string;
|
|
259
262
|
// History only: what kind of work it was, when that can be told [HIS-04].
|
|
@@ -515,6 +518,9 @@ export interface FeedStatus {
|
|
|
515
518
|
error: string | null;
|
|
516
519
|
}
|
|
517
520
|
|
|
521
|
+
// The tabs whose items can be dismissed [ATT-08].
|
|
522
|
+
export type DismissTab = "doing" | "waiting";
|
|
523
|
+
|
|
518
524
|
// What the client renders: dismissed items removed, grouped per tab.
|
|
519
525
|
export interface AttentionView {
|
|
520
526
|
feeds: Record<FeedId, FeedStatus>;
|
|
@@ -537,7 +543,8 @@ export interface AttentionView {
|
|
|
537
543
|
unclaimedFrom: UnclaimedSource;
|
|
538
544
|
// The projects Next up's issues are on [NXT-03, NXT-12].
|
|
539
545
|
projects: ProjectInfo[];
|
|
540
|
-
|
|
546
|
+
// How many of each tab's items are dismissed, for its "show them again" [ATT-08].
|
|
547
|
+
dismissed: Record<DismissTab, number>;
|
|
541
548
|
// Scopes ticked in Next up's filter; none means all [NXT-03].
|
|
542
549
|
scopes: string[];
|
|
543
550
|
// Sources ticked in Next up's filter; none means all [NXT-09].
|
package/shared/item-view.ts
CHANGED
|
@@ -125,7 +125,8 @@ export function sheetPlan(item: Item, sessions: AgentSummary[]): SheetStep[] {
|
|
|
125
125
|
steps.push({ kind: "github", ...(pr ? { pr } : {}) });
|
|
126
126
|
// 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].
|
|
127
127
|
if (!item.closedAt && !item.change) steps.push({ kind: "start", any: sessions.length > 0, session: fallbackKind(item) });
|
|
128
|
-
|
|
128
|
+
// Doing and Waiting can be dismissed, apart at the bottom; History and Next up can't [ATT-08].
|
|
129
|
+
if ((SECTIONS[item.section].tab === "doing" || SECTIONS[item.section].tab === "waiting") && !item.change) steps.push({ kind: "dismiss" });
|
|
129
130
|
return steps;
|
|
130
131
|
}
|
|
131
132
|
|
package/shared/rpc.ts
CHANGED
|
@@ -50,7 +50,8 @@ export const archiveWorktree = defineRpc({
|
|
|
50
50
|
output: z.custom<ArchiveOutcome>(),
|
|
51
51
|
});
|
|
52
52
|
export const dismissKept = defineRpc({ name: "attention.dismiss-kept", input: z.object({ workspaceId: z.string() }), output: view });
|
|
53
|
-
|
|
53
|
+
// One tab's dismissed items back, or every tab's [ATT-08].
|
|
54
|
+
export const restoreDismissed = defineRpc({ name: "attention.restore-dismissed", input: z.object({ tab: z.enum(["doing", "waiting"]).optional() }), output: view });
|
|
54
55
|
// Adds one entry to codeRepos in config.json [SES-07].
|
|
55
56
|
export const setCodeRepo = defineRpc({ name: "config.set-code-repo", input: z.object({ issueRepo: z.string(), codeRepo: z.string() }), output: view });
|
|
56
57
|
// What the setup checklist shows when nothing loads [SET-01].
|