@andrioid/paseo-attention-span 0.7.0 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +2 -0
- package/client/attention-screen.tsx +4 -0
- package/client/entity.tsx +15 -3
- package/client/icons.ts +2 -0
- package/client/item-actions.ts +24 -0
- package/client/item-row.tsx +5 -55
- package/client/next-up.tsx +49 -7
- package/client/stack.tsx +57 -0
- package/client/ui.tsx +4 -1
- package/client/wrap-up.tsx +181 -49
- package/docs/architecture.md +3 -2
- 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-code-repo.png +0 -0
- package/docs/screenshots/desktop-dark-next-up-setup.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.server.ts +2 -0
- package/package.json +1 -1
- package/requirements.yaml +2 -0
- package/server/classify.ts +29 -0
- package/server/fetch.ts +29 -3
- package/server/fixture.ts +16 -5
- package/server/github-types.ts +13 -0
- package/server/queries.ts +14 -0
- package/server/references.ts +12 -0
- package/server/service.ts +90 -11
- package/server/store.ts +17 -2
- package/server/view.ts +24 -4
- package/shared/attention.ts +26 -2
- package/shared/next-up-filter.ts +19 -0
- package/shared/rpc.ts +4 -0
- package/shared/wrap-up.ts +34 -9
package/shared/wrap-up.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentSummary, type AttentionView, isIdle, type Item, matchSessions, memberKeys, type RememberedGroups, type WrapItem } from "./attention";
|
|
1
|
+
import { type AgentSummary, type AttentionView, baseItem, type CloseAsk, isIdle, type Item, matchSessions, memberKeys, type RememberedGroups, type WrapItem } from "./attention";
|
|
2
2
|
import { type UnsavedSession, unsavedOf } from "./archive";
|
|
3
3
|
import { ago } from "./format";
|
|
4
4
|
import { changeText } from "./changes";
|
|
@@ -25,9 +25,10 @@ export function sessionCleanliness(agent: AgentSummary): SessionCleanliness {
|
|
|
25
25
|
return unsaved.files || unsaved.uncommitted || unsaved.commits ? "dirty" : "unknown";
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
// A row with one session, clean: Archive session archives it at once, whatever happened on GitHub [ATT-22].
|
|
28
|
+
// A row with one session, clean: Archive session archives it at once, whatever happened on GitHub [ATT-22]. A row asking to
|
|
29
|
+
// close an issue answers that first [ATT-24].
|
|
29
30
|
export function cleanSingle(item: WrapItem): boolean {
|
|
30
|
-
return item.wrap.sessions.length === 1 && sessionCleanliness(item.wrap.sessions[0]) === "clean";
|
|
31
|
+
return !item.wrap.ask && item.wrap.sessions.length === 1 && sessionCleanliness(item.wrap.sessions[0]) === "clean";
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
// What finishing looked like, in the same words the cards use [HIS-05, HIS-07].
|
|
@@ -75,25 +76,48 @@ function candidates(view: WrapView): Item[] {
|
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
// What Wrap up reads from the view.
|
|
78
|
-
export type WrapView = Pick<AttentionView, "history" | "doing" | "waiting"> & Partial<Pick<AttentionView, "activeKeys" | "groups" | "ownClosed">>;
|
|
79
|
+
export type WrapView = Pick<AttentionView, "history" | "doing" | "waiting"> & Partial<Pick<AttentionView, "activeKeys" | "groups" | "ownClosed" | "closeAsks">>;
|
|
80
|
+
|
|
81
|
+
// "#34 merged 2h ago", "#34 and #35 merged 2h ago", "4 PRs merged 2h ago": what's done under an issue asked about, by its
|
|
82
|
+
// latest merge [ATT-24].
|
|
83
|
+
export function askText(ask: CloseAsk, now: Date): string {
|
|
84
|
+
const numbers = ask.prs.map((pr) => `#${pr.number}`);
|
|
85
|
+
const which = numbers.length > 3 ? `${numbers.length} PRs` : numbers.length > 1 ? `${numbers.slice(0, -1).join(", ")} and ${numbers.at(-1)}` : numbers[0];
|
|
86
|
+
return `${which} merged ${ago(ask.mergedAt, now)} ago`;
|
|
87
|
+
}
|
|
79
88
|
|
|
80
89
|
// What Doing's Wrap up shows, newest finish first. A row needs at least one open session, all idle. A stack or issue group
|
|
81
90
|
// enters once, and only when everything its sessions serve is done: a key still open in Doing or Waiting, or a remembered
|
|
82
91
|
// sibling of one, keeps the group out [ATT-22].
|
|
83
92
|
export function wrapItems(view: WrapView, agents: AgentSummary[], now = new Date()): WrapItem[] {
|
|
84
|
-
|
|
93
|
+
const asks = view.closeAsks ?? [];
|
|
94
|
+
if (agents.length === 0 && asks.length === 0) return [];
|
|
85
95
|
const active = keySet([...(view.activeKeys ?? []), ...[...view.doing.flatMap((section) => section.items), ...view.waiting.flatMap((group) => group.items)].flatMap(memberKeys)]);
|
|
86
96
|
const groups = view.groups ?? {};
|
|
87
97
|
const serving = (key: string) => [key.toLowerCase(), ...(groups[key.toLowerCase()] ?? [])].some((other) => active.has(other));
|
|
88
98
|
const rows: { item: WrapItem; at: string }[] = [];
|
|
89
99
|
const used = new Set<string>();
|
|
100
|
+
// The group's sessions must all be idle, none may serve work that's still active, and a session belongs to one row only.
|
|
101
|
+
// A sub-agent still working keeps its session's row out too.
|
|
102
|
+
const unready = (sessions: AgentSummary[]) => sessions.some((agent) => !isIdle(agent) || agent.subAgents?.working || serving(agent.itemKey) || used.has(agent.id));
|
|
103
|
+
// An issue to close leads its row, with its merged PRs' sessions once they're ready, so they don't make rows of their own;
|
|
104
|
+
// it asks with or without them [ATT-24].
|
|
105
|
+
const asked = new Set<string>();
|
|
106
|
+
for (const ask of asks) {
|
|
107
|
+
const keys = [ask.key, ...ask.prs.map((pr) => pr.key)];
|
|
108
|
+
const found = matchSessions(agents, keys);
|
|
109
|
+
const sessions = unready(found) ? [] : found;
|
|
110
|
+
for (const agent of sessions) used.add(agent.id);
|
|
111
|
+
for (const key of keys) asked.add(key.toLowerCase());
|
|
112
|
+
const base = baseItem({ key: `wrap:${ask.key}`, section: "wrap", kind: "issue", repo: ask.repo, number: ask.number, title: ask.title, url: ask.url }, ask.mergedAt);
|
|
113
|
+
rows.push({ item: { ...base, section: "wrap", children: ask.prs, wrap: { sessions, itemKey: ask.key, keys, finish: askText(ask, now), ask: true } }, at: ask.mergedAt });
|
|
114
|
+
}
|
|
90
115
|
for (const item of candidates(view)) {
|
|
91
116
|
const keys = memberKeys(item);
|
|
117
|
+
if (keys.some((key) => asked.has(key.toLowerCase()))) continue;
|
|
92
118
|
const sessions = matchSessions(agents, keys);
|
|
93
119
|
if (sessions.length === 0) continue;
|
|
94
|
-
|
|
95
|
-
// A sub-agent still working keeps its session's row out too.
|
|
96
|
-
if (sessions.some((agent) => !isIdle(agent) || agent.subAgents?.working || serving(agent.itemKey) || used.has(agent.id)) || keys.some(serving)) continue;
|
|
120
|
+
if (unready(sessions) || keys.some(serving)) continue;
|
|
97
121
|
for (const agent of sessions) used.add(agent.id);
|
|
98
122
|
rows.push({
|
|
99
123
|
item: {
|
|
@@ -113,7 +137,8 @@ export function wrapItems(view: WrapView, agents: AgentSummary[], now = new Date
|
|
|
113
137
|
// The unread changes History shows: every note except the ones already in Wrap up, where archiving is the acknowledgement
|
|
114
138
|
// [HIS-07, ATT-22]. A note whose work has no session left, or whose sessions are busy, stays unread.
|
|
115
139
|
export function unreadChanges(notes: Item[], wrap: WrapItem[]): Item[] {
|
|
116
|
-
|
|
140
|
+
// A row asking to close an issue only acknowledges when it has sessions to archive [ATT-24].
|
|
141
|
+
const inWrap = keySet(wrap.filter((item) => item.wrap.sessions.length > 0).flatMap((item) => item.wrap.keys));
|
|
117
142
|
return notes.filter((note) => !memberKeys(note).some((key) => inWrap.has(key.toLowerCase())));
|
|
118
143
|
}
|
|
119
144
|
|