@andrioid/paseo-attention-span 0.1.3 → 0.2.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.
Files changed (35) hide show
  1. package/OVERVIEW.md +116 -42
  2. package/README.md +12 -12
  3. package/client/attention-screen.tsx +162 -110
  4. package/client/card.tsx +17 -5
  5. package/client/data.ts +2 -1
  6. package/client/icons.ts +2 -0
  7. package/client/next-up.tsx +64 -30
  8. package/client/session-menu.ts +45 -0
  9. package/client/sessions.ts +10 -8
  10. package/client/sheet.tsx +75 -3
  11. package/client/ui.tsx +91 -9
  12. package/docs/screenshots/desktop-dark-doing-acknowledge.png +0 -0
  13. package/docs/screenshots/desktop-dark-doing-session-menu.png +0 -0
  14. package/docs/screenshots/desktop-dark-doing-sheet.png +0 -0
  15. package/docs/screenshots/desktop-dark-doing-too-long.png +0 -0
  16. package/docs/screenshots/desktop-dark-doing.png +0 -0
  17. package/docs/screenshots/desktop-dark-history-reviewed.png +0 -0
  18. package/docs/screenshots/desktop-dark-history.png +0 -0
  19. package/docs/screenshots/desktop-dark-next-up-code-repo.png +0 -0
  20. package/docs/screenshots/desktop-dark-next-up.png +0 -0
  21. package/docs/screenshots/desktop-dark-settings.png +0 -0
  22. package/docs/screenshots/desktop-dark-setup.png +0 -0
  23. package/docs/screenshots/desktop-dark-waiting.png +0 -0
  24. package/docs/screenshots/phone-dark-doing.png +0 -0
  25. package/docs/screenshots/phone-light-next-up-filtered.png +0 -0
  26. package/index.server.ts +16 -19
  27. package/package.json +13 -2
  28. package/paseo-plugin.json +4 -2
  29. package/server/fixture.ts +19 -7
  30. package/server/service.ts +55 -6
  31. package/server/store.ts +3 -0
  32. package/server/view.ts +71 -1
  33. package/shared/attention.ts +22 -1
  34. package/shared/format.ts +6 -0
  35. package/shared/rpc.ts +13 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andrioid/paseo-attention-span",
3
- "version": "0.1.3",
3
+ "version": "0.2.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": {
@@ -22,9 +22,20 @@
22
22
  "shared/",
23
23
  "!**/*.test.ts",
24
24
  "assets/",
25
+ "docs/screenshots/desktop-dark-doing-acknowledge.png",
26
+ "docs/screenshots/desktop-dark-doing-session-menu.png",
27
+ "docs/screenshots/desktop-dark-doing-sheet.png",
28
+ "docs/screenshots/desktop-dark-doing-too-long.png",
25
29
  "docs/screenshots/desktop-dark-doing.png",
30
+ "docs/screenshots/desktop-dark-history-reviewed.png",
31
+ "docs/screenshots/desktop-dark-history.png",
32
+ "docs/screenshots/desktop-dark-next-up-code-repo.png",
33
+ "docs/screenshots/desktop-dark-next-up.png",
34
+ "docs/screenshots/desktop-dark-settings.png",
35
+ "docs/screenshots/desktop-dark-setup.png",
36
+ "docs/screenshots/desktop-dark-waiting.png",
26
37
  "docs/screenshots/phone-dark-doing.png",
27
- "docs/screenshots/desktop-dark-next-up.png"
38
+ "docs/screenshots/phone-light-next-up-filtered.png"
28
39
  ],
29
40
  "scripts": {
30
41
  "typecheck": "tsc --noEmit",
package/paseo-plugin.json CHANGED
@@ -5,8 +5,10 @@
5
5
  "icon": "assets/icon.png",
6
6
  "media": [
7
7
  "docs/screenshots/desktop-dark-doing.png",
8
- "docs/screenshots/phone-dark-doing.png",
9
- "docs/screenshots/desktop-dark-next-up.png"
8
+ "docs/screenshots/desktop-dark-waiting.png",
9
+ "docs/screenshots/desktop-dark-next-up.png",
10
+ "docs/screenshots/desktop-dark-history.png",
11
+ "docs/screenshots/phone-dark-doing.png"
10
12
  ],
11
13
  "requirements": {
12
14
  "paseo": ">=0.13.0"
package/server/fixture.ts CHANGED
@@ -207,13 +207,25 @@ export function fixture(now: Date): { data: SearchResult; details: Details } {
207
207
  }
208
208
 
209
209
  // Sessions the preview shows as started from items: working, needs me, failed, idle.
210
- const agent = (id: string, status: string, requiresAttention = false): AgentSummary => ({ id, status, requiresAttention, title: `Fixture session ${id}`, workspaceId: null });
211
- export const FIXTURE_AGENTS: Record<string, AgentSummary> = {
212
- [`${REPO}#101`]: agent("agent-101", "running"),
213
- [`${REPO}#102`]: agent("agent-102", "idle", true),
214
- [`${REPO}#108`]: agent("agent-108", "error"),
215
- [`${REPO}#150`]: agent("agent-150", "idle"),
216
- };
210
+ // Issue 90 has two, one on the issue and one on its PR, so the card shows the pick. #113 waits on CI while its agent works.
211
+ const agent = (id: string, itemKey: string, status: string, minutesAgo: number, requiresAttention = false): AgentSummary => ({
212
+ id,
213
+ itemKey,
214
+ status,
215
+ requiresAttention,
216
+ title: `Fixture session ${id}`,
217
+ workspaceId: null,
218
+ lastActivityAt: new Date(Date.now() - minutesAgo * 60_000).toISOString(),
219
+ });
220
+ export const FIXTURE_AGENTS: AgentSummary[] = [
221
+ agent("agent-101", `${REPO}#101`, "running", 4),
222
+ agent("agent-102", `${REPO}#102`, "idle", 30, true),
223
+ agent("agent-108", `${REPO}#108`, "error", 90),
224
+ agent("agent-150", `${REPO}#150`, "idle", 300),
225
+ agent("agent-90", `${REPO}#90`, "idle", 120, true),
226
+ agent("agent-103", `${REPO}#103`, "running", 6),
227
+ agent("agent-113", `${REPO}#113`, "running", 2),
228
+ ];
217
229
 
218
230
  export const FIXTURE_CONTEXT = "Context from GitHub would go here (fixture mode).";
219
231
 
package/server/service.ts CHANGED
@@ -7,15 +7,20 @@ import { fixture, FIXTURE_AGENTS } from "./fixture";
7
7
  import type { Details, HistoryResult, LiveResult } from "./github-types";
8
8
  import { detailsQuery, HISTORY_SEARCHES, mergeUnclaimed, type SearchName, searchQuery, searchVariables, type UnclaimedSearch, unclaimedSearches } from "./queries";
9
9
  import { loadConfig, loadState, moveOldFiles, saveCodeRepo, saveCoverage, saveNextUpSources, saveState, State } from "./store";
10
- import { buildView } from "./view";
10
+ import { applyPending, buildView, doneItem, type Effect, isPending, SETTLE_MS } from "./view";
11
11
 
12
12
  // History changes only when I finish something, so it's fetched daily, on ⟳ in its tab and after a merge.
13
13
  const HISTORY_MAX_AGE_SECONDS = 24 * 60 * 60;
14
14
  // A failed refresh is retried at most this often, except on ⟳.
15
15
  const RETRY_MS = 5 * 60_000;
16
16
 
17
+ // What a change does to the lists: an effect, Finished (merged or closed, so off the lists and maybe into History), or nothing.
18
+ export type Change = Effect | { kind: "finished"; notPlanned?: boolean } | null;
19
+
17
20
  interface Feed {
18
21
  inFlight: Promise<void> | null;
22
+ // A fetch queued to start once the one in flight is done, for callers that need data from after now.
23
+ next: Promise<void> | null;
19
24
  lastAttemptAt: number;
20
25
  error: string | null;
21
26
  }
@@ -26,11 +31,12 @@ export class AttentionService {
26
31
  private config: AttentionConfig = AttentionConfig.parse({});
27
32
  private configError: string | null = null;
28
33
  private feeds: Record<FeedId, Feed> = {
29
- live: { inFlight: null, lastAttemptAt: 0, error: null },
30
- history: { inFlight: null, lastAttemptAt: 0, error: null },
34
+ live: { inFlight: null, next: null, lastAttemptAt: 0, error: null },
35
+ history: { inFlight: null, next: null, lastAttemptAt: 0, error: null },
31
36
  };
32
37
  private saving: Promise<void> = Promise.resolve();
33
38
  private timer: ReturnType<typeof setInterval> | null = null;
39
+ private followUps: Partial<Record<FeedId, ReturnType<typeof setTimeout>>> = {};
34
40
  private intervalMinutes = 0;
35
41
  // The app's connection to Paseo, from its last request; background refreshes have none of their own.
36
42
  private paseo: PluginHandlerContext["paseo"] | null = null;
@@ -50,6 +56,7 @@ export class AttentionService {
50
56
  stop(): void {
51
57
  if (this.timer) clearInterval(this.timer);
52
58
  this.timer = null;
59
+ for (const timeout of Object.values(this.followUps)) clearTimeout(timeout);
53
60
  }
54
61
 
55
62
  // ⟳ fetches its tab's feed now; otherwise feeds older than their schedule are fetched first.
@@ -109,9 +116,41 @@ export class AttentionService {
109
116
  await this.save();
110
117
  }
111
118
 
112
- // Concurrent callers share one refresh per feed.
113
- refresh(id: FeedId): Promise<void> {
119
+ // A change on GitHub from one tap [SAFE-01], answered with the list as it is after it.
120
+ // GitHub's search takes seconds to show it, so its effect shows until a fetch can [FRESH-02]; no change (Undo) clears it.
121
+ async act(key: string, work: () => Promise<void>, change: Change): Promise<AttentionView> {
122
+ await work();
123
+ const before = this.state.pending[key];
124
+ const at = new Date().toISOString();
125
+ if (change) this.state.pending[key] = { at, effect: change.kind === "finished" ? this.finished(key, at, change.notPlanned) : change };
126
+ else delete this.state.pending[key];
127
+ await this.save();
128
+ const history = change?.kind === "finished" || before?.effect.kind === "done";
129
+ this.followUp("live");
130
+ if (history) this.followUp("history");
131
+ return this.view();
132
+ }
133
+
134
+ // Into History if it's mine: a PR in my lists, or an issue assigned to me [HIS-01]. Else just off the lists.
135
+ private finished(key: string, at: string, notPlanned?: boolean): Effect {
136
+ const live = this.state.live?.attention;
137
+ const source = live?.items.find((item) => item.key === key) ?? live?.assigned.find((issue) => issue.key === key);
138
+ return source ? { kind: "done", item: doneItem(source, at, notPlanned) } : { kind: "gone" };
139
+ }
140
+
141
+ // One fetch once GitHub's search has caught up with the latest change, which ends what's pending.
142
+ private followUp(id: FeedId): void {
143
+ clearTimeout(this.followUps[id]);
144
+ this.followUps[id] = setTimeout(() => void this.refresh(id, true).catch(() => {}), SETTLE_MS);
145
+ }
146
+
147
+ // Concurrent callers share one refresh per feed. `fresh` won't share one that began before the call, which can't show a change just made.
148
+ refresh(id: FeedId, fresh = false): Promise<void> {
114
149
  const feed = this.feeds[id];
150
+ if (fresh && feed.inFlight) {
151
+ feed.next ??= feed.inFlight.catch(() => {}).then(() => ((feed.next = null), this.refresh(id)));
152
+ return feed.next;
153
+ }
115
154
  feed.inFlight ??= this.fetch(id).finally(() => (feed.inFlight = null));
116
155
  return feed.inFlight;
117
156
  }
@@ -133,6 +172,8 @@ export class AttentionService {
133
172
  // Forget dismissals of items that are gone.
134
173
  const keys = new Set(this.items().map((item) => item.key));
135
174
  for (const key of Object.keys(this.state.dismissed)) if (!keys.has(key)) delete this.state.dismissed[key];
175
+ // And changes GitHub now shows for itself.
176
+ for (const [key, pending] of Object.entries(this.state.pending)) if (!isPending(pending, this.fetchedAt(), Date.now())) delete this.state.pending[key];
136
177
  feed.error = null;
137
178
  await this.save();
138
179
  } catch (error) {
@@ -256,17 +297,25 @@ export class AttentionService {
256
297
  return this.saving;
257
298
  }
258
299
 
300
+ private fetchedAt(): Record<FeedId, string | null> {
301
+ return { live: this.state.live?.fetchedAt ?? null, history: this.state.history?.fetchedAt ?? null };
302
+ }
303
+
259
304
  private view(): AttentionView {
260
305
  const status = (id: FeedId): FeedStatus => ({
261
306
  fetchedAt: this.state[id]?.fetchedAt ?? null,
262
307
  refreshing: this.feeds[id].inFlight !== null,
263
308
  error: this.feeds[id].error ?? this.configError,
264
309
  });
265
- return buildView(this.state.live?.attention ?? null, this.state.history?.items ?? [], this.state.dismissed, {
310
+ const now = Date.now();
311
+ const pending = Object.fromEntries(Object.entries(this.state.pending).filter(([, entry]) => isPending(entry, this.fetchedAt(), now)));
312
+ const shown = applyPending(this.state.live?.attention ?? null, this.state.history?.items ?? [], pending);
313
+ return buildView(shown.attention, shown.history, this.state.dismissed, {
266
314
  feeds: { live: status("live"), history: status("history") },
267
315
  scopes: this.state.scopes,
268
316
  sources: this.state.sources,
269
317
  config: this.config,
318
+ pending: Object.keys(pending).length,
270
319
  ...(FIXTURE ? { fixtureAgents: FIXTURE_AGENTS } : {}),
271
320
  });
272
321
  }
package/server/store.ts CHANGED
@@ -4,6 +4,7 @@ import { join } from "node:path";
4
4
  import { z } from "zod";
5
5
  import type { Attention, Item, SectionId } from "../shared/attention";
6
6
  import { AttentionConfig } from "../shared/config";
7
+ import type { Pending } from "./view";
7
8
 
8
9
  // Local files in ~/.config/paseo-attention-span/ [PRIV-01].
9
10
  const CHOSEN_DIR = process.env.PASEO_ATTENTION_SPAN_DIR ?? process.env.PASEO_GITHUB_ATTENTION_DIR;
@@ -16,6 +17,8 @@ const STATE = join(DIR, "state.json");
16
17
  export const State = z.object({
17
18
  // Item key -> others' activity and section when dismissed [ATT-08].
18
19
  dismissed: z.record(z.string(), z.object({ at: z.string(), section: z.custom<SectionId>() })).default({}),
20
+ // Item key -> what I just changed on GitHub, until a fetch shows it [FRESH-02].
21
+ pending: z.record(z.string(), z.custom<Pending>((value) => typeof (value as Pending)?.at === "string" && !!(value as Pending)?.effect)).default({}).catch({}),
19
22
  // Scopes ticked in Next up's filter; none means all [NXT-03].
20
23
  scopes: z.array(z.string()).default([]),
21
24
  // Sources ticked in Next up's filter; none means all [NXT-09].
package/server/view.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type Attention, type AttentionView, type FeedId, type FeedStatus, type Item, type Section, SECTION_ORDER, SECTIONS, type TabId } from "../shared/attention";
1
+ import { type Attention, type AttentionView, type Chip, type FeedId, type FeedStatus, type Item, type NextUpIssue, type Section, SECTION_ORDER, SECTIONS, type TabId } from "../shared/attention";
2
2
  import type { AttentionConfig } from "../shared/config";
3
3
  import type { State } from "./store";
4
4
 
@@ -7,6 +7,76 @@ export interface ViewMeta {
7
7
  scopes: string[];
8
8
  sources: string[];
9
9
  config: AttentionConfig;
10
+ pending: number;
11
+ }
12
+
13
+ // What a tap on GitHub changed, shown until a fetch can show it for itself [FRESH-02].
14
+ // Only where the outcome is certain does a card move; otherwise it stays, with a chip saying what's under way.
15
+ export type Effect =
16
+ | { kind: "gone" }
17
+ // Merged, or an issue of mine closed: off the lists, and into History as it will be fetched.
18
+ | { kind: "done"; item: Item }
19
+ | { kind: "claimed" }
20
+ | { kind: "unclaimed" }
21
+ | { kind: "chip"; chip: Chip };
22
+
23
+ export interface Pending {
24
+ at: string;
25
+ effect: Effect;
26
+ }
27
+
28
+ // GitHub's search shows a change within seconds (3s, measured), so a fetch begun this long after it shows it.
29
+ export const SETTLE_MS = 30_000;
30
+ // While fetches keep failing, a change stops being shown after this.
31
+ const GIVE_UP_MS = 10 * 60_000;
32
+
33
+ // Shown until every feed it touches has been fetched from after GitHub caught up.
34
+ export function isPending({ at, effect }: Pending, fetchedAt: Record<FeedId, string | null>, now: number): boolean {
35
+ const time = new Date(at).getTime();
36
+ if (now - time >= GIVE_UP_MS) return false;
37
+ const feeds: FeedId[] = effect.kind === "done" ? ["live", "history"] : ["live"];
38
+ return feeds.some((id) => !fetchedAt[id] || new Date(fetchedAt[id]).getTime() < time + SETTLE_MS);
39
+ }
40
+
41
+ // The History entry a merge or close will be, as classifyHistory makes it [HIS-01].
42
+ export function doneItem(source: Item | NextUpIssue, closedAt: string, notPlanned = false): Item {
43
+ const { key, repo, number, title, url } = source;
44
+ const kind = "kind" in source ? source.kind : "issue";
45
+ return {
46
+ key,
47
+ section: "done",
48
+ kind,
49
+ draft: false,
50
+ repo,
51
+ number,
52
+ title,
53
+ url,
54
+ chips: notPlanned ? [{ text: "not planned", tone: "neutral" }] : [],
55
+ actions: [],
56
+ children: "children" in source ? source.children.map((child) => ({ ...child, draft: false, chips: [], attention: false })) : [],
57
+ target: { kind, repo, number, title, url },
58
+ othersActivityAt: "1970-01-01T00:00:00Z",
59
+ closedAt,
60
+ };
61
+ }
62
+
63
+ // The fetched lists with what's pending applied on top.
64
+ export function applyPending(attention: Attention | null, history: Item[], pending: Record<string, Pending>): { attention: Attention | null; history: Item[] } {
65
+ if (!attention || Object.keys(pending).length === 0) return { attention, history };
66
+ const effect = (key: string) => pending[key]?.effect.kind;
67
+ const off = (key: string) => effect(key) === "gone" || effect(key) === "done";
68
+ const items = attention.items
69
+ .filter((item) => !off(item.key))
70
+ .map((item) => {
71
+ const now = pending[item.key]?.effect;
72
+ return now?.kind === "chip" && !item.chips.some((chip) => chip.text === now.chip.text) ? { ...item, chips: [...item.chips, now.chip] } : item;
73
+ });
74
+ const assigned = [...attention.assigned.filter((issue) => !off(issue.key) && effect(issue.key) !== "unclaimed"), ...attention.unclaimed.filter((issue) => effect(issue.key) === "claimed")];
75
+ const unclaimed = [...attention.unclaimed.filter((issue) => !off(issue.key) && effect(issue.key) !== "claimed"), ...attention.assigned.filter((issue) => effect(issue.key) === "unclaimed")];
76
+ const known = new Set(history.map((item) => item.key));
77
+ const done = Object.values(pending).flatMap(({ effect }) => (effect.kind === "done" && !known.has(effect.item.key) ? [effect.item] : []));
78
+ // History is newest first; what I just finished is newest of all.
79
+ return { attention: { ...attention, items, assigned, unclaimed }, history: [...done, ...history] };
10
80
  }
11
81
 
12
82
  // A dismissed item stays hidden until someone else does something on it or its reason changes [ATT-08].
@@ -50,6 +50,8 @@ export type ActionId =
50
50
  export interface Chip {
51
51
  text: string;
52
52
  tone: "good" | "bad" | "warn" | "neutral";
53
+ // In place of the dot, where a picture says it better.
54
+ icon?: "thumbUp";
53
55
  }
54
56
 
55
57
  // The person (or bot) I'm waiting on, or who is waiting on me.
@@ -184,10 +186,27 @@ export interface Section {
184
186
  // A Paseo session started from an item [ATT-07].
185
187
  export interface AgentSummary {
186
188
  id: string;
189
+ // The item it was started on: an issue or a PR.
190
+ itemKey: string;
187
191
  status: string;
188
192
  requiresAttention: boolean;
189
193
  title: string | null;
190
194
  workspaceId: string | null;
195
+ lastActivityAt: string | null;
196
+ }
197
+
198
+ // An item's open sessions: started on it or on any PR under it, until it's merged or closed.
199
+ // One that needs me comes first, then the most recent [SES-03].
200
+ export function itemSessions(agents: AgentSummary[], item: Pick<Item, "key" | "closedAt" | "children">): AgentSummary[] {
201
+ if (item.closedAt) return [];
202
+ return matchSessions(agents, [item.key, ...item.children.map((child) => child.key)]);
203
+ }
204
+
205
+ export function matchSessions(agents: AgentSummary[], keys: string[]): AgentSummary[] {
206
+ const wanted = new Set(keys.map((key) => key.toLowerCase()));
207
+ return agents
208
+ .filter((agent) => wanted.has(agent.itemKey.toLowerCase()))
209
+ .sort((a, b) => Number(b.requiresAttention) - Number(a.requiresAttention) || (b.lastActivityAt ?? "").localeCompare(a.lastActivityAt ?? ""));
191
210
  }
192
211
 
193
212
  export interface FeedStatus {
@@ -214,6 +233,8 @@ export interface AttentionView {
214
233
  // Sources ticked in Next up's filter; none means all [NXT-09].
215
234
  sources: string[];
216
235
  config: AttentionConfig;
236
+ // Changes I just made that GitHub's search hasn't caught up with; the app checks back sooner while there are any [FRESH-02].
237
+ pending: number;
217
238
  // Fixture mode only: made-up sessions, since the preview daemon has no agents.
218
- fixtureAgents?: Record<string, AgentSummary>;
239
+ fixtureAgents?: AgentSummary[];
219
240
  }
package/shared/format.ts CHANGED
@@ -20,6 +20,12 @@ export function linkList(items: { title: string; url: string }[]): string {
20
20
  return items.map(({ title, url }) => `- [${title.replace(/[[\]\\]/g, "\\$&")}](${url})`).join("\n");
21
21
  }
22
22
 
23
+ // Where a card's item lives: "app" for my own repos, "acme/app" for anyone else's, so same-named repos don't blur [ATT-05, NXT-10].
24
+ export function repoLabel(repo: string, login: string | null): string {
25
+ const [owner, name] = repo.split("/");
26
+ return name && login && owner.toLowerCase() === login.toLowerCase() ? name : repo;
27
+ }
28
+
23
29
  // An issue field value for a card: "🐟 Tiny (< 4h)" -> "Tiny", "🏕P2 Medium" -> "P2 Medium" [NXT-10]. The sheet keeps the full value.
24
30
  export function shortValue(value: string): string {
25
31
  return (
package/shared/rpc.ts CHANGED
@@ -30,20 +30,21 @@ export const myOrgs = defineRpc({ name: "config.my-orgs", input: z.object({}), o
30
30
  export const setScopes = defineRpc({ name: "next-up.scopes", input: z.object({ scopes: z.array(z.string()) }), output: done });
31
31
  export const setSources = defineRpc({ name: "next-up.sources", input: z.object({ sources: z.array(z.string()) }), output: done });
32
32
 
33
- // GitHub changes, each from an explicit tap [SAFE-01].
34
- export const updateBranch = defineRpc({ name: "pr.update-branch", input: z.object({ target }), output: done });
35
- export const mergePullRequest = defineRpc({ name: "pr.merge", input: z.object({ target }), output: done });
36
- export const closePullRequest = defineRpc({ name: "pr.close", input: z.object({ target, comment: z.string().optional() }), output: done });
37
- export const claimIssue = defineRpc({ name: "issue.claim", input: z.object({ target }), output: done });
38
- export const unclaimIssue = defineRpc({ name: "issue.unclaim", input: z.object({ target }), output: done });
33
+ // GitHub changes, each from an explicit tap [SAFE-01], answered with the list after it.
34
+ // `key` is the card it was done from, which shows the change until GitHub's search does [FRESH-02].
35
+ export const updateBranch = defineRpc({ name: "pr.update-branch", input: z.object({ key: z.string(), target }), output: view });
36
+ export const mergePullRequest = defineRpc({ name: "pr.merge", input: z.object({ key: z.string(), target }), output: view });
37
+ export const closePullRequest = defineRpc({ name: "pr.close", input: z.object({ key: z.string(), target, comment: z.string().optional() }), output: view });
38
+ export const claimIssue = defineRpc({ name: "issue.claim", input: z.object({ key: z.string(), target }), output: view });
39
+ export const unclaimIssue = defineRpc({ name: "issue.unclaim", input: z.object({ key: z.string(), target }), output: view });
39
40
  // Close an issue from Next up; reopen is its Undo [NXT-11].
40
- export const closeIssue = defineRpc({ name: "issue.close", input: z.object({ target, reason: z.enum(["completed", "not_planned"]), comment: z.string().optional() }), output: done });
41
- export const reopenIssue = defineRpc({ name: "issue.reopen", input: z.object({ target }), output: done });
41
+ export const closeIssue = defineRpc({ name: "issue.close", input: z.object({ key: z.string(), target, reason: z.enum(["completed", "not_planned"]), comment: z.string().optional() }), output: view });
42
+ export const reopenIssue = defineRpc({ name: "issue.reopen", input: z.object({ key: z.string(), target }), output: view });
42
43
  // `ready: false` and `on: false` are the Undo of each.
43
- export const setReady = defineRpc({ name: "pr.ready", input: z.object({ target, ready: z.boolean() }), output: done });
44
- export const setAutoMerge = defineRpc({ name: "pr.auto-merge", input: z.object({ target, on: z.boolean() }), output: done });
45
- export const react = defineRpc({ name: "comment.react", input: z.object({ subjectIds: z.array(z.string()), on: z.boolean() }), output: done });
46
- export const rerunFailed = defineRpc({ name: "checks.rerun", input: z.object({ repo: z.string(), runIds: z.array(z.number()) }), output: done });
44
+ export const setReady = defineRpc({ name: "pr.ready", input: z.object({ key: z.string(), target, ready: z.boolean() }), output: view });
45
+ export const setAutoMerge = defineRpc({ name: "pr.auto-merge", input: z.object({ key: z.string(), target, on: z.boolean() }), output: view });
46
+ export const react = defineRpc({ name: "comment.react", input: z.object({ key: z.string(), subjectIds: z.array(z.string()), on: z.boolean() }), output: view });
47
+ export const rerunFailed = defineRpc({ name: "checks.rerun", input: z.object({ key: z.string(), repo: z.string(), runIds: z.array(z.number()) }), output: view });
47
48
 
48
49
  // What an item's sheet shows beyond the card [ATT-06]. `checks` asks for failing checks too, for Rerun.
49
50
  export const itemDetails = defineRpc({