@andrioid/paseo-attention-span 0.6.0 → 0.7.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 (78) hide show
  1. package/OVERVIEW.md +3 -1
  2. package/client/attention-screen.tsx +61 -1174
  3. package/client/coverage-settings.tsx +5 -4
  4. package/client/data.ts +4 -2
  5. package/client/feedback.tsx +21 -25
  6. package/client/history.tsx +12 -50
  7. package/client/item-actions.ts +387 -0
  8. package/client/item-row.tsx +450 -0
  9. package/client/new-issue.tsx +244 -0
  10. package/client/next-up.tsx +22 -183
  11. package/client/pickers.tsx +238 -0
  12. package/client/session-menu.ts +3 -11
  13. package/client/sessions.ts +58 -57
  14. package/client/setup.tsx +2 -1
  15. package/client/sheet.tsx +92 -15
  16. package/client/ui.tsx +23 -14
  17. package/client/wrap-up.tsx +151 -85
  18. package/docs/architecture.md +24 -13
  19. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  20. package/docs/screenshots/desktop-dark-doing-clear.png +0 -0
  21. package/docs/screenshots/desktop-dark-doing-issue-sheet.png +0 -0
  22. package/docs/screenshots/desktop-dark-doing-reviewers.png +0 -0
  23. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  24. package/docs/screenshots/desktop-dark-doing-wrap-dirty.png +0 -0
  25. package/docs/screenshots/desktop-dark-doing-wrap-multi.png +0 -0
  26. package/docs/screenshots/desktop-dark-doing-wrap.png +0 -0
  27. package/docs/screenshots/desktop-dark-doing.png +0 -0
  28. package/docs/screenshots/desktop-dark-history-filtered.png +0 -0
  29. package/docs/screenshots/desktop-dark-history.png +0 -0
  30. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  31. package/docs/screenshots/desktop-dark-settings.png +0 -0
  32. package/docs/screenshots/desktop-dark-setup.png +0 -0
  33. package/docs/screenshots/desktop-dark-waiting-too-long.png +0 -0
  34. package/docs/screenshots/desktop-dark-waiting.png +0 -0
  35. package/docs/screenshots/phone-dark-doing.png +0 -0
  36. package/docs/screenshots/phone-dark-history.png +0 -0
  37. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  38. package/index.client.tsx +19 -0
  39. package/index.server.ts +43 -26
  40. package/package.json +2 -1
  41. package/requirements.yaml +10 -3
  42. package/server/actions.ts +2 -1
  43. package/server/archive.ts +146 -67
  44. package/server/archived.ts +12 -16
  45. package/server/changes.ts +34 -54
  46. package/server/classify.ts +157 -139
  47. package/server/context.ts +95 -3
  48. package/server/feedback.ts +2 -6
  49. package/server/fetch.ts +262 -0
  50. package/server/fixture.ts +88 -14
  51. package/server/github-types.ts +5 -2
  52. package/server/markdown.ts +3 -1
  53. package/server/port.ts +46 -0
  54. package/server/queries.ts +34 -24
  55. package/server/service.ts +155 -272
  56. package/server/setup.ts +15 -14
  57. package/server/store.ts +94 -80
  58. package/server/update.ts +34 -13
  59. package/server/view.ts +16 -15
  60. package/shared/archive.ts +116 -13
  61. package/shared/attention.ts +63 -18
  62. package/shared/changes.ts +2 -1
  63. package/shared/config.ts +2 -6
  64. package/shared/drafting.ts +17 -0
  65. package/shared/feedback.ts +6 -5
  66. package/shared/format.ts +2 -1
  67. package/shared/history-report.ts +2 -1
  68. package/shared/item-sessions.ts +76 -0
  69. package/shared/item-view.ts +224 -0
  70. package/shared/linked-sessions.ts +59 -8
  71. package/shared/names.ts +17 -0
  72. package/shared/new-issue.ts +129 -0
  73. package/shared/next-up-filter.ts +137 -0
  74. package/shared/paging.ts +16 -0
  75. package/shared/prompts.ts +39 -22
  76. package/shared/rpc.ts +23 -10
  77. package/shared/setup.ts +3 -1
  78. package/shared/wrap-up.ts +20 -23
package/shared/wrap-up.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { type AgentSummary, type AttentionView, isIdle, type Item, keySet, matchSessions, memberKeys, type RememberedGroups, type SessionWorkspace, type WrapItem } from "./attention";
1
+ import { type AgentSummary, type AttentionView, isIdle, type Item, matchSessions, memberKeys, type RememberedGroups, type WrapItem } from "./attention";
2
+ import { type UnsavedSession, unsavedOf } from "./archive";
2
3
  import { ago } from "./format";
3
4
  import { changeText } from "./changes";
5
+ import { keySet } from "./names";
4
6
 
5
7
  // Wrap up: finished or out-of-my-hands work whose unarchived Paseo sessions are all idle [ATT-22]. Pure, so the rules are
6
8
  // testable. It's assembled on the client, which already polls Paseo's sessions for the screen and the sidebar's count; the
@@ -8,27 +10,19 @@ import { changeText } from "./changes";
8
10
 
9
11
  export type SessionCleanliness = "clean" | "dirty" | "unknown";
10
12
 
11
- // What archiving would lose in a session's worktree, from Paseo's snapshot: clean only when it says both that nothing is
12
- // uncommitted and that nothing is ahead. The server asks git again before archiving [ATT-22].
13
- export function sessionCleanliness(agent: AgentSummary): SessionCleanliness {
13
+ // What archiving a session would lose, from Paseo's reading of its worktree; the server asks git again before archiving.
14
+ // Previews count the files [ATT-22].
15
+ export function sessionUnsaved(agent: AgentSummary): UnsavedSession | null {
14
16
  const workspace = agent.workspace;
15
- if (!workspace) return "unknown";
16
- if (workspace.dirty === true || (workspace.ahead ?? 0) > 0) return "dirty";
17
- if (workspace.dirty === false && workspace.ahead === 0) return "clean";
18
- return "unknown";
17
+ return unsavedOf({ agentId: agent.id, title: agent.title }, workspace && { ...workspace, files: workspace.dirtyFiles, lines: workspace.dirtyLines });
19
18
  }
20
19
 
21
- // "uncommitted changes and 1 unpushed commit on branch": what the multi-session sheet says about a session, from Paseo's
22
- // snapshot, which doesn't count files.
23
- export function unsavedText(agent: AgentSummary): string {
24
- const workspace: SessionWorkspace | undefined = agent.workspace;
25
- if (sessionCleanliness(agent) === "unknown") return "Couldn't check for unsaved changes";
26
- const parts: string[] = [];
27
- if (workspace?.dirty) parts.push("uncommitted changes");
28
- const ahead = workspace?.ahead ?? 0;
29
- if (ahead > 0) parts.push(`${ahead} unpushed commit${ahead === 1 ? "" : "s"}`);
30
- const what = parts.join(" and ") || "unsaved changes";
31
- return workspace?.branch ? `${what} on ${workspace.branch}` : what;
20
+ // Dirty as soon as Paseo says something is unsaved, even when it couldn't tell the other half; unknown only when it knows
21
+ // of nothing unsaved but can't say it's clean.
22
+ export function sessionCleanliness(agent: AgentSummary): SessionCleanliness {
23
+ const unsaved = sessionUnsaved(agent);
24
+ if (!unsaved) return "clean";
25
+ return unsaved.files || unsaved.uncommitted || unsaved.commits ? "dirty" : "unknown";
32
26
  }
33
27
 
34
28
  // A row with one session, clean: Archive session archives it at once, whatever happened on GitHub [ATT-22].
@@ -37,7 +31,7 @@ export function cleanSingle(item: WrapItem): boolean {
37
31
  }
38
32
 
39
33
  // What finishing looked like, in the same words the cards use [HIS-05, HIS-07].
40
- function finishText(item: Item, now: Date): string {
34
+ export function finishText(item: Item, now: Date): string {
41
35
  if (item.change) return changeText(item.change, now);
42
36
  const at = item.closedAt ?? item.othersActivityAt;
43
37
  const age = `${ago(at, now)} ago`;
@@ -64,10 +58,12 @@ export function rememberGroups(groups: RememberedGroups, items: Pick<Item, "key"
64
58
 
65
59
  // The finished work and changes that could appear in Wrap up: my done and reviewed items, my own unmerged closes, work that
66
60
  // left my hands, and a change on finished work that History hasn't fetched yet [ATT-22, HIS-01, HIS-07]. A done item beats
67
- // the note about it.
61
+ // the note about it. A merged PR from the live feed only stands in until History lists it, alone or under its issue, so
62
+ // it never makes a row of its own beside its issue's [FRESH-03].
68
63
  function candidates(view: WrapView): Item[] {
64
+ const listed = new Set(view.history.flatMap((item) => [item.key, ...item.children.map((child) => child.key)]).map((key) => key.toLowerCase()));
69
65
  const seen = new Set<string>();
70
- const ordered = [...view.history, ...(view.ownClosed ?? [])].sort((a, b) => Number(a.section === "changed") - Number(b.section === "changed"));
66
+ const ordered = [...view.history, ...(view.ownClosed ?? []).filter((item) => !listed.has(item.key.toLowerCase()))].sort((a, b) => Number(a.section === "changed") - Number(b.section === "changed"));
71
67
  return ordered.filter((item) => {
72
68
  // A reopened PR is open again, not work to wrap up.
73
69
  if (item.section === "changed" && (!item.change || item.change.kind === "reopened")) return false;
@@ -96,7 +92,8 @@ export function wrapItems(view: WrapView, agents: AgentSummary[], now = new Date
96
92
  const sessions = matchSessions(agents, keys);
97
93
  if (sessions.length === 0) continue;
98
94
  // The group's sessions must all be idle, none may serve work that's still active, and a session belongs to one row only.
99
- if (sessions.some((agent) => !isIdle(agent) || serving(agent.itemKey) || used.has(agent.id)) || keys.some(serving)) continue;
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;
100
97
  for (const agent of sessions) used.add(agent.id);
101
98
  rows.push({
102
99
  item: {