paseo-follow-up 2.0.1 → 2.0.2-beta.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/client/brief.tsx CHANGED
@@ -14,7 +14,8 @@ const word = (kind: Brief["kind"]) => HEADLINE_WORD[briefKey(kind)];
14
14
  import { answerQuestionRpc, briefActionRpc, browserStatusRpc, inboxBriefRpc } from "../shared/contracts";
15
15
  import { errorText, mootNote } from "../shared/errors";
16
16
  import { OTHER, OTHER_LABEL, briefAnswerStatus, isOther, type Question } from "../shared/questions";
17
- import type { Workspace } from "../shared/model";
17
+ import type { ListQuestion, ListWorkspace } from "../shared/list";
18
+ import { useDetailGate, useWorkspace } from "./workspace-data";
18
19
  import { SubmitScope, submitHint, text, useNow } from "./kit";
19
20
  import { PrLinksProvider, RichText } from "./rich-text";
20
21
  import { useMergeButtons } from "./merge-button";
@@ -32,7 +33,8 @@ export type BriefDeps = {
32
33
  signOff(agentId: string): void;
33
34
  openNext(from: string): void;
34
35
  openAgent(agentId: string): void;
35
- workspace(id: string): Workspace | undefined;
36
+ /** The workspace's list form (shared/list.ts); the PR sheet reads the full one itself. */
37
+ workspace(id: string): ListWorkspace | undefined;
36
38
  /** Opens Follow-up's panel for a workspace whose record this client hasn't loaded yet. */
37
39
  openPanel(workspaceId: string): void;
38
40
  /** Done's Undo window, so the composer pill says Done (and its Undo cancels the same toast) until it ends. */
@@ -275,7 +277,7 @@ function Reveal({ label, openLabel, open, onPress, c, compact }: { label: string
275
277
  * A card that's no longer open keeps its question (1.4.0). Answered: the ask, each decision with what was picked, and
276
278
  * "Show full question" opens the original read-only. Superseded or signed off: the one muted line, plus "Show original".
277
279
  */
278
- function Past({ b, c, now, compact, height, pending = false, onResend, resending = false, questions = [] }: { b: Brief; c: Colors; now: number; compact: boolean; height: number; pending?: boolean; onResend?: () => void; resending?: boolean; questions?: readonly Question[] }) {
280
+ function Past({ b, c, now, compact, height, pending = false, onResend, resending = false, questions = [] }: { b: Brief; c: Colors; now: number; compact: boolean; height: number; pending?: boolean; onResend?: () => void; resending?: boolean; questions?: readonly ListQuestion[] }) {
279
281
  const [expanded, setExpanded] = useState(false);
280
282
  const answered = b.state === "answered";
281
283
  // Its questions' answers as every surface reads them (briefAnswerStatus): copied or in the message box is "not sent
@@ -390,6 +392,9 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
390
392
  const notes = useNotes(b.id);
391
393
  const notesOpen = useNotesOpen(b.id);
392
394
  const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
395
+ // The PR sheet draws review and deploy detail the list form leaves out: one read of the full workspace while it's open.
396
+ const detail = useWorkspace(undefined, row.workspaceId ?? "", { enabled: !!sheet });
397
+ useDetailGate(detail.failure, !!sheet, () => setSheet(null));
393
398
  const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), enabled: !!sheet, staleTime: 0, refetchOnMount: "always" });
394
399
  // Send again on an undelivered answer: the same answerId, so the server resends that answer and never a second one.
395
400
  const resend = () => {
@@ -547,7 +552,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
547
552
  <Icon name="Info" size={12} color={c.foregroundMuted} />
548
553
  <Text style={{ flex: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.sourceLine}</Text>
549
554
  </View>}
550
- {workspace && sheet && <PrSheet workspace={workspace} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
555
+ {detail.workspace && sheet && <PrSheet workspace={detail.workspace} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
551
556
  </View>;
552
557
  }
553
558
 
package/client/home.tsx CHANGED
@@ -38,6 +38,8 @@ import { useRowMenu } from "./row-actions";
38
38
  import { laterChoices } from "../shared/row-menu";
39
39
  import { PrLinksProvider, RichText } from "./rich-text";
40
40
  import { TOAST_ANCHOR, ToastHost, useQuestionOpener } from "./toasts";
41
+ import { openRowCopy, useDetailGate, useWorkspace } from "./workspace-data";
42
+ import type { ListWorkspace } from "../shared/list";
41
43
 
42
44
  export const HOME_SCREEN = "follow-up";
43
45
 
@@ -303,7 +305,11 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
303
305
  const toast = useToast();
304
306
  const { inbox, live } = deps.sources;
305
307
  const row = useInbox(inbox, () => s.agentId ? inbox.rows().find(r => r.agentId === s.agentId) ?? null : null);
306
- const w = useSyncExternalStore(live.subscribe, () => s.workspaceId ? live.get(s.workspaceId) : undefined, () => undefined);
308
+ // The open row paints from the list form at once; its PR sheet and question sheet draw detail the list leaves out,
309
+ // so they wait for the full workspace, read once (useWorkspace). Until it answers, the list form draws the rest.
310
+ const { workspace: full, failure } = useWorkspace(live, s.workspaceId ?? "");
311
+ const listed = useSyncExternalStore(live.subscribe, () => s.workspaceId ? live.get(s.workspaceId) : undefined, () => undefined);
312
+ const w: ListWorkspace | undefined = openRowCopy<ListWorkspace>(listed, full);
307
313
  const agent = useAgentLive(s.agentId);
308
314
  const readBrief = useRpc(inboxBriefRpc);
309
315
  const control = useRpc(controlRpc);
@@ -314,6 +320,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
314
320
  const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), enabled: !!sheet, staleTime: 0, refetchOnMount: "always" });
315
321
  const [question, setQuestion] = useState<string | null>(() => ask?.id ?? null);
316
322
  useEffect(() => { if (ask) setQuestion(ask.id); }, [ask?.n]); // eslint-disable-line react-hooks/exhaustive-deps
323
+ useDetailGate(failure, !!sheet, () => setSheet(null));
324
+ useDetailGate(failure, !!question, () => setQuestion(null));
317
325
  useQuestionOpener(w?.id, setQuestion);
318
326
  const [laterOpen, setLaterOpen] = useState(false);
319
327
  const [busy, setBusy] = useState<string | null>(null);
@@ -485,8 +493,8 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
485
493
  }} />
486
494
  </View>}
487
495
  {laterModal}
488
- {w && sheet && <PrSheet workspace={w} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
489
- {w && <QuestionSheet workspace={w} questionId={question} theme={theme} compact={compact} onClose={() => setQuestion(null)} />}
496
+ {full && sheet && <PrSheet workspace={full} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
497
+ {full && <QuestionSheet workspace={full} questionId={question} theme={theme} compact={compact} onClose={() => setQuestion(null)} />}
490
498
  </View>;
491
499
  }
492
500
 
package/client/linked.tsx CHANGED
@@ -6,7 +6,7 @@ import { Icon, Modal, TextInput, copyText, useToast } from "@getpaseo/plugin/cli
6
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
7
  import { linkedIndexRpc, linkedItemsRpc, setLinkedItemsRpc } from "../shared/contracts";
8
8
  import type { LinkedKind, LinkedView, LinkedViewItem } from "../shared/linked";
9
- import type { Workspace } from "../shared/model";
9
+ import type { ListWorkspace as Workspace } from "../shared/list";
10
10
  import { CHIP_MAX, LINKED_EMPTY, linkedChip, linkedGroups, linkedRow, linkedSpec, pasteToAdd, referencesShown, type LinkedChipModel, type RowGlyph } from "../shared/linked-display";
11
11
  import { BRAND_ICONS } from "./brand-icons";
12
12
  import { Button, CardRow, IconButton, errorText, space, text, type Theme } from "./kit";
@@ -1,7 +1,8 @@
1
1
  import type { Workspace } from "../shared/model";
2
+ import { errorText } from "../shared/errors";
2
3
 
3
4
  /** A copy only replaces one it is newer than (updatedAt): a late diff or poll never undoes a fresher read. */
4
- export const newer = (held: Workspace | undefined, w: Workspace) => !held || Date.parse(w.updatedAt) >= Date.parse(held.updatedAt) ? w : held;
5
+ export const newer = <T extends { updatedAt: string }>(held: T | undefined, w: T): T => !held || Date.parse(w.updatedAt) >= Date.parse(held.updatedAt) ? w : held;
5
6
  export const opened = new Set<(w: Workspace) => void>();
6
7
  /**
7
8
  * A fresh read of one workspace (useWorkspace's read, a merge's read before its toast) reaches every live store, so
@@ -9,3 +10,20 @@ export const opened = new Set<(w: Workspace) => void>();
9
10
  * Home's Needs you kept "#151 is approved" beside a "Merged" button until the next feed push or poll.
10
11
  */
11
12
  export function acceptWorkspace(w: Workspace): void { for (const accept of opened) accept(w); }
13
+
14
+ /** Why a read left nothing to show: its error, or its answer's. Null while it reads, once it has the workspace, or while disabled. */
15
+ export function detailFailure(q: { enabled: boolean; workspace: Workspace | null; error: unknown; reply: { workspace: Workspace | null; error: string | null } | undefined }): string | null {
16
+ if (!q.enabled || q.workspace) return null;
17
+ if (q.error) return errorText(q.error);
18
+ if (q.reply) return q.reply.error ?? "Follow-up has no record of this workspace.";
19
+ return null;
20
+ }
21
+
22
+ /**
23
+ * What a list surface draws (Home's open row, the pill's popover): the newer of its list copy and its full read
24
+ * (updatedAt). After the full read, a list change listed later (a merge, a turn) draws at once instead of waiting for
25
+ * the re-read it triggers; the sheets keep the full read. 2.0.1: the open row drew `full ?? listed` and lagged.
26
+ */
27
+ export function openRowCopy<T extends { updatedAt: string }>(listed: T | null | undefined, full: T | null | undefined): T | undefined {
28
+ return listed && full ? newer(listed, full) : full ?? listed ?? undefined;
29
+ }
package/client/live.tsx CHANGED
@@ -5,6 +5,7 @@ import type { PluginButtonIconProps, PluginClientContext, PluginSidebarItemProps
5
5
  import { Icon, SidebarRow } from "@getpaseo/plugin/client/ui";
6
6
  import { listRpc, workspacesFeed } from "../shared/contracts";
7
7
  import { openFeed, type Feed } from "./feeds";
8
+ import { isArchivedEntry, listEntry, type ArchivedListWorkspace, type ListEntry, type ListWorkspace } from "../shared/list";
8
9
  import type { Workspace } from "../shared/model";
9
10
  import { activeNeeds, needsYou } from "../shared/attention";
10
11
  import { useSidebarViewActive } from "./inbox";
@@ -22,9 +23,10 @@ const POLL_MS = 15_000;
22
23
 
23
24
  /** One shared poll of tracked workspaces for the pills, header-button dots and the sidebar count. */
24
25
  export function createLiveStore(client: PluginClientContext) {
25
- let workspaces = new Map<string, Workspace>();
26
- /** Archived ones, only for search ("Archived" at the bottom of results). */
27
- let archived: Workspace[] = [];
26
+ /** Each followed workspace in its list form (shared/list.ts); a surface that draws detail reads it with follow.get. */
27
+ let workspaces = new Map<string, ListWorkspace>();
28
+ /** Archived ones, only for search ("Archived" at the bottom of results): name and PRs only. */
29
+ let archived: ArchivedListWorkspace[] = [];
28
30
  let version = 0;
29
31
  const listeners = new Set<() => void>();
30
32
  let timer: ReturnType<typeof setTimeout> | null = null;
@@ -32,19 +34,19 @@ export function createLiveStore(client: PluginClientContext) {
32
34
  let stopped = false;
33
35
  /** The worker's list revision this store holds; each poll asks only for what changed since (1.3.0-beta.4). */
34
36
  let revision: number | undefined;
35
- let all = new Map<string, Workspace>();
37
+ let all = new Map<string, ListEntry>();
36
38
  const emit = () => { version++; for (const l of listeners) l(); };
37
39
  let feed: Feed | null = null;
38
40
  const pushed = () => feed?.live === true;
39
- const apply = (result: { full?: boolean; workspaces: Workspace[]; removed?: string[]; revision?: number }) => {
41
+ const apply = (result: { full?: boolean; workspaces: ListEntry[]; removed?: string[]; revision?: number }) => {
40
42
  const diff = result.full === false;
41
43
  if (diff && !result.workspaces.length && !result.removed?.length) return;
42
- const next = diff ? new Map(all) : new Map<string, Workspace>();
44
+ const next = diff ? new Map(all) : new Map<string, ListEntry>();
43
45
  for (const id of result.removed ?? []) next.delete(id);
44
46
  for (const w of result.workspaces) next.set(w.id, diff ? newer(all.get(w.id), w) : w);
45
47
  all = next; revision = result.revision;
46
- workspaces = new Map([...all.values()].filter(w => !w.archived).map(w => [w.id, w]));
47
- archived = [...all.values()].filter(w => w.archived);
48
+ workspaces = new Map([...all.values()].filter((w): w is ListWorkspace => !isArchivedEntry(w)).map(w => [w.id, w]));
49
+ archived = [...all.values()].filter(isArchivedEntry);
48
50
  emit();
49
51
  };
50
52
  // Paseo 0.15: poll the revision diff. 0.16: the worker pushes the same diff (follow.workspaces-feed), and nothing polls.
@@ -58,12 +60,14 @@ export function createLiveStore(client: PluginClientContext) {
58
60
  };
59
61
  // The feed went down (the worker restarted): read now and poll until it is back.
60
62
  feed = openFeed(client, workspacesFeed, {}, { event: event => { if (!stopped) apply(event); }, down: () => { if (timer) clearTimeout(timer); void poll(); }, up: () => { if (timer) clearTimeout(timer); timer = null; } });
63
+ // The store keeps list forms only: a read's full workspace is projected (shared/list.ts listEntry) before it's held.
61
64
  const accept = (w: Workspace) => {
62
65
  const held = all.get(w.id);
63
- if (!held || newer(held, w) !== w || held === w) return;
64
- all = new Map(all).set(w.id, w);
65
- workspaces = new Map([...all.values()].filter(x => !x.archived).map(x => [x.id, x]));
66
- archived = [...all.values()].filter(x => x.archived);
66
+ if (!held || Date.parse(w.updatedAt) < Date.parse(held.updatedAt)) return;
67
+ const entry = listEntry(w);
68
+ all = new Map(all).set(w.id, entry);
69
+ workspaces = new Map([...all.values()].filter((x): x is ListWorkspace => !isArchivedEntry(x)).map(x => [x.id, x]));
70
+ archived = [...all.values()].filter(isArchivedEntry);
67
71
  emit();
68
72
  };
69
73
  opened.add(accept);
@@ -6,7 +6,7 @@ import { confirmPrActionRpc, getRpc, preparePrActionRpc } from "../shared/contra
6
6
  import { readWorkspace } from "./workspace-data";
7
7
  import { workspaceKey } from "./keys";
8
8
  import { mergeClick, mergeScope, mergeWords, type MergeClickResult, type MergeScope } from "../shared/merge-click";
9
- import type { Workspace } from "../shared/model";
9
+ import type { ListWorkspace as Workspace } from "../shared/list";
10
10
  import { Button, errorText, text, type ButtonKind, type Theme } from "./kit";
11
11
  import { Text } from "./text";
12
12
  import { View } from "react-native";
@@ -8,7 +8,7 @@ import { answerQuestionRpc, checkPrActionRpc, controlRpc, sendRpc } from "../sha
8
8
  import { agentName, needsYou, workspaceSnoozed, type NeedItem } from "../shared/attention";
9
9
  import { laterLabel } from "./inbox";
10
10
  import { sameText } from "../shared/home";
11
- import type { Workspace } from "../shared/model";
11
+ import type { ListWorkspace as Workspace } from "../shared/list";
12
12
  import { Button, Card, CardRow, Chip, PrLinkButton, errorText, text, type Theme } from "./kit";
13
13
  import type { Colors } from "./theme";
14
14
  import { QuestionBody, meanwhile } from "./questions";
package/client/pill.tsx CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useState, useSyncExternalStore } from "react";
2
2
  import { browserKey } from "./keys";
3
- import { useWorkspace } from "./workspace-data";
3
+ import { openRowCopy, useDetailGate, useWorkspace } from "./workspace-data";
4
4
  import { ScrollView, View } from "react-native";
5
5
  import { Pressable, Text } from "./text";
6
6
  import { useQuery } from "@tanstack/react-query";
@@ -12,7 +12,7 @@ import { briefQuestionIds, echoedItems, HEADLINE_ICON, todoLine, HEADLINE_TONE,
12
12
  import { snoozeUntil, type InboxRow } from "../shared/inbox";
13
13
  import { laterChoices } from "../shared/row-menu";
14
14
  import { isOpen as questionOpen } from "../shared/questions";
15
- import type { Workspace } from "../shared/model";
15
+ import type { ListWorkspace } from "../shared/list";
16
16
  import { Button, errorText, text, type Theme } from "./kit";
17
17
  import { headlineColor, withAlpha } from "./theme";
18
18
  import { useInbox } from "./inbox";
@@ -29,10 +29,10 @@ const UNDO_TITLE: Record<string, string> = { sign_off: "Signed off", later: "Mov
29
29
 
30
30
 
31
31
  type Deps = { inbox: InboxStore; live: LiveStore; openPanel: (workspaceId: string) => void; openNext: (from: string) => void };
32
- type Target = { agentId: string; workspaceId: string; row: InboxRow | null; workspace: Workspace | null; items: NeedItem[] };
32
+ type Target = { agentId: string; workspaceId: string; row: InboxRow | null; workspace: ListWorkspace | null; items: NeedItem[] };
33
33
 
34
34
  /** Every agent that may carry the pill: inbox rows with a workspace, plus each tracked workspace's main agent. */
35
- export function targets(rows: InboxRow[], workspaces: Workspace[], now: number): Map<string, Target> {
35
+ export function targets(rows: InboxRow[], workspaces: ListWorkspace[], now: number): Map<string, Target> {
36
36
  const out = new Map<string, Target>();
37
37
  for (const row of rows) if (row.workspaceId) out.set(row.agentId, { agentId: row.agentId, workspaceId: row.workspaceId, row, workspace: null, items: [] });
38
38
  for (const w of workspaces) {
@@ -148,13 +148,17 @@ export function PillPopover(props: PluginButtonContentProps & { deps: Deps }) {
148
148
  const { target, state, now } = useTarget(deps, agentId, props.workspaceId);
149
149
  const browserRead = useRpc(browserStatusRpc);
150
150
  const main = !!target.workspace && target.workspace.mainAgentId === agentId;
151
- // The live store already holds this workspace; the popover reads it once on open (Paseo can leave a stray mounted
152
- // copy, so nothing here polls it: 1.4.0).
151
+ // The live store holds this workspace's list form; the popover reads it in full once on open (Paseo can leave a stray
152
+ // mounted copy, so nothing here polls it: 1.4.0).
153
153
  const query = useWorkspace(deps.live, props.workspaceId, { enabled: main });
154
154
  const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), enabled: main, staleTime: 0, refetchOnMount: "always" });
155
155
  const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
156
156
  const [question, setQuestion] = useState<string | null>(null);
157
- const w = main ? query.workspace ?? target.workspace : null;
157
+ // The popover paints from the list form at once; its PR sheet and question sheet wait for this read's full workspace.
158
+ const full = main ? query.workspace : null;
159
+ const w: ListWorkspace | null = main ? openRowCopy<ListWorkspace>(target.workspace, full) ?? null : null;
160
+ useDetailGate(query.failure, !!sheet, () => setSheet(null));
161
+ useDetailGate(query.failure, !!question, () => setQuestion(null));
158
162
  const row = target.row;
159
163
  const flagged = state?.mode === "flag";
160
164
  const running = !!row && ["running", "initializing"].includes(row.status);
@@ -232,8 +236,8 @@ export function PillPopover(props: PluginButtonContentProps & { deps: Deps }) {
232
236
  : <NeedsYouList workspace={w} theme={props.theme} compact={touch} flush untitled={echoed}
233
237
  actions={{ after: () => deps.live.refresh(), openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion }} />}
234
238
  {asking && items.some(i => i.kind !== "question" && !echoed.has(i.key)) && <Text numberOfLines={2} style={t.small}>Also: {items.filter(i => i.kind !== "question" && !echoed.has(i.key)).map(i => i.title).join(" · ")}</Text>}
235
- <PrSheet workspace={w} prKey={sheet?.key ?? null} intent={sheet?.intent ?? null} theme={props.theme} compact={touch} browserReady={browser.data?.ready ?? false} onClose={() => { setSheet(null); deps.live.refresh(); }} />
236
- <QuestionSheet workspace={w} questionId={question} theme={props.theme} compact={touch} onClose={() => { setQuestion(null); deps.live.refresh(); }} />
239
+ {full && <PrSheet workspace={full} prKey={sheet?.key ?? null} intent={sheet?.intent ?? null} theme={props.theme} compact={touch} browserReady={browser.data?.ready ?? false} onClose={() => { setSheet(null); deps.live.refresh(); }} />}
240
+ {full && <QuestionSheet workspace={full} questionId={question} theme={props.theme} compact={touch} onClose={() => { setQuestion(null); deps.live.refresh(); }} />}
237
241
  </View>}
238
242
  {main && !w && query.error && <Text style={t.meta}>Couldn't read Follow-up: {errorText(query.error)}</Text>}
239
243
 
@@ -9,6 +9,7 @@ import { Icon, Modal, ScrollView, TextInput, copyText, useToast } from "@getpase
9
9
  import { useMutation, useQueryClient } from "@tanstack/react-query";
10
10
  import { answerQuestionRpc } from "../shared/contracts";
11
11
  import type { Workspace } from "../shared/model";
12
+ import type { ListQuestion, ListWorkspace } from "../shared/list";
12
13
  import { OTHER, OTHER_LABEL, answerHeading, answerLabel, answerStatus, answerMessage, isOpen, isOther, questionState, type Question } from "../shared/questions";
13
14
  import { ago } from "../shared/attention";
14
15
  import { mootNote, sentence } from "../shared/errors";
@@ -24,14 +25,14 @@ import { putInChatOrCopy } from "../shared/put-in-chat";
24
25
  import { useChatComposer } from "./put-in-chat";
25
26
  import { clearPendingAnswer, failPendingAnswer, pendingKey, setPendingAnswer, usePendingAnswer, usePendingAnswers, type PendingAnswer } from "./pending-answers";
26
27
 
27
- const who = (w: Workspace, agentId: string | null) => !agentId || agentId === w.mainAgentId ? "the main agent" : "a root session";
28
+ const who = (w: Pick<ListWorkspace, "mainAgentId">, agentId: string | null) => !agentId || agentId === w.mainAgentId ? "the main agent" : "a root session";
28
29
 
29
30
  /**
30
31
  * What the agent is doing while the question is open, in the developer's terms. `pending` is required, so every
31
32
  * surface that describes a question also says when the developer's answer didn't reach Paseo, or is on its way;
32
33
  * pass null only where the surface shows that itself (QuestionBody's Not sent · Retry line).
33
34
  */
34
- export function meanwhile(w: Workspace, q: Question, pending: PendingAnswer | null | undefined): { icon: string; color: (c: Colors) => string; text: string } {
35
+ export function meanwhile(w: ListWorkspace, q: ListQuestion, pending: PendingAnswer | null | undefined): { icon: string; color: (c: Colors) => string; text: string } {
35
36
  if (pending?.error) return { icon: "CircleAlert", color: c => c.statusDanger, text: `Your answer wasn't sent: ${sentence(pending.error)} Open it to retry; your words are kept.` };
36
37
  if (pending) return { icon: "Send", color: c => c.foregroundMuted, text: "Sending your answer…" };
37
38
  if (q.taskId && !q.options.length) return { icon: "Clock", color: c => c.foregroundMuted, text: "A task is blocked on this. The agent works on the rest." };
@@ -44,7 +45,7 @@ export function meanwhile(w: Workspace, q: Question, pending: PendingAnswer | nu
44
45
  }
45
46
  }
46
47
 
47
- function deliveryLine(w: Workspace, q: Question, now: number): { icon: string; tone: "success" | "warning" | "muted" | "spinner"; text: string } | null {
48
+ function deliveryLine(w: ListWorkspace, q: ListQuestion, now: number): { icon: string; tone: "success" | "warning" | "muted" | "spinner"; text: string } | null {
48
49
  const d = q.answer?.delivery;
49
50
  if (!d) return null;
50
51
  switch (d.state) {
@@ -87,7 +88,7 @@ const inputStyle = (c: Colors, compact: boolean, lines: number) => ({ minHeight:
87
88
  * away; Copy records it and puts a reply on the clipboard instead. Used by the dialog and the pill.
88
89
  */
89
90
  export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false }: {
90
- workspace: Workspace; question: Question; theme: Theme; compact: boolean; now?: number; dense?: boolean; bodyMaxHeight?: number; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: () => void;
91
+ workspace: ListWorkspace; question: ListQuestion; theme: Theme; compact: boolean; now?: number; dense?: boolean; bodyMaxHeight?: number; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: () => void;
91
92
  /** Inside the Needs you block: its header says the title and when it was asked, its footer what the agent does meanwhile. */
92
93
  inline?: boolean;
93
94
  /** The dialog's close: Send and Copy close it at once and report the outcome as a toast. */
@@ -181,9 +182,9 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
181
182
  const pr = q.prKey ? w.prs.find(p => p.key === q.prKey) : null;
182
183
  const task = q.taskId ? w.obligations.find(o => o.id === q.taskId) : null;
183
184
  const deliveryColor = delivery?.tone === "success" ? c.statusSuccess : delivery?.tone === "warning" ? c.statusWarning : c.foregroundMuted;
184
- const context = (!!q.background || !!q.links.length || pr || (task && !(inline && task.title.trim() === q.title.trim()))) && <View style={{ gap: 8 }}>
185
+ const context = (!!q.background || !!q.links?.length || pr || (task && !(inline && task.title.trim() === q.title.trim()))) && <View style={{ gap: 8 }}>
185
186
  {!!q.background && <RichText selectable linkColor={c.foreground} numberOfLines={dense ? 3 : undefined} style={t.meta}>{q.background}</RichText>}
186
- {!dense && q.links.map((link, i) => <View key={i} style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
187
+ {!dense && q.links?.map((link, i) => <View key={i} style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
187
188
  <Icon name={link.url ? "Globe" : "FileText"} size={13} color={c.foregroundMuted} />
188
189
  {link.url ? <Pressable accessibilityRole="link" accessibilityLabel={`Open ${link.label || link.url}`} onPress={() => { void openExternalUrl(link.url!).catch(() => undefined); }} hitSlop={4}
189
190
  style={state => ({ flexShrink: 1, opacity: state.pressed ? 0.7 : 1 })}>
@@ -317,7 +318,7 @@ export function QuestionSheet({ workspace: w, questionId, theme, compact, onClos
317
318
  }
318
319
 
319
320
  /** The pill steps through open questions ("1 of 3") and answers them without leaving the chat. */
320
- export function QuestionStepper({ workspace: w, theme, compact, openAgent, onAnswered, onDetails, bodyMaxHeight }: { workspace: Workspace; theme: Theme; compact: boolean; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: (id: string) => void; bodyMaxHeight?: number }) {
321
+ export function QuestionStepper({ workspace: w, theme, compact, openAgent, onAnswered, onDetails, bodyMaxHeight }: { workspace: ListWorkspace; theme: Theme; compact: boolean; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: (id: string) => void; bodyMaxHeight?: number }) {
321
322
  const c = theme.colors; const t = text(c);
322
323
  const pending = usePendingAnswers();
323
324
  // An answer on its way (sent, no reply yet) steps the pill on at once; one that failed comes back as Not sent.
package/client/spec.tsx CHANGED
@@ -5,7 +5,7 @@ import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
5
5
  import { Icon, Modal, TextInput, useToast } from "@getpaseo/plugin/client/ui";
6
6
  import { useQueryClient } from "@tanstack/react-query";
7
7
  import { workspaceSpecRpc } from "../shared/contracts";
8
- import type { Workspace } from "../shared/model";
8
+ import type { ListWorkspace as Workspace } from "../shared/list";
9
9
  import { specLabel, validSpecUrl } from "../shared/spec";
10
10
  import { ago } from "../shared/attention";
11
11
  import { Button, CardRow, text, type Theme, SubmitScope } from "./kit";
@@ -1,46 +1,63 @@
1
- import { useSyncExternalStore } from "react";
1
+ import { useEffect, useSyncExternalStore } from "react";
2
2
  import { useQuery } from "@tanstack/react-query";
3
3
  import { useRpc } from "@getpaseo/plugin/client";
4
4
  import { getRpc } from "../shared/contracts";
5
- import type { Workspace } from "../shared/model";
6
5
  import type { LiveStore } from "./live";
7
- import { acceptWorkspace } from "./live-copies";
6
+ import { useToast } from "@getpaseo/plugin/client/ui";
7
+ import { acceptWorkspace, detailFailure } from "./live-copies";
8
+ export { openRowCopy } from "./live-copies";
8
9
  import { workspaceKey } from "./keys";
10
+ import type { Workspace } from "../shared/model";
9
11
 
10
12
  const none = () => () => {};
11
- const newer = (a: Workspace | null | undefined, b: Workspace | null | undefined): Workspace | null => {
12
- if (!a) return b ?? null; if (!b) return a;
13
- return Date.parse(b.updatedAt) > Date.parse(a.updatedAt) ? b : a;
14
- };
15
13
 
16
14
  /**
17
- * One workspace for the panel, the larger view and the pill (1.4.0). The client's shared live store already holds
18
- * every followed workspace and keeps it current (one diff poll for the whole client, nudged by agent changes), so a
19
- * surface paints from it at once. On open it makes one small read of its own workspace, never a poll; a mutation's
20
- * invalidation re-reads it once. Whichever copy is newer wins.
15
+ * One workspace in full for the panel, the larger view, the pill's popover and Home's open row (1.4.0; full since
16
+ * 2.0.1). The client's shared live store holds every followed workspace in its LIST form only (shared/list.ts,
17
+ * a-list-carries-only-what-lists-draw): what Home, the pill and the sidebar draw, without deployment evidence, task
18
+ * evidence or question background. A surface that draws detail makes one small read of its own workspace on open,
19
+ * never a poll; when the list copy changes after that read, it reads once more; a mutation's invalidation re-reads it.
21
20
  */
22
21
  type GetReply = { workspace: Workspace | null; error: string | null };
23
- /** One read of a workspace; its copy also reaches every live store (acceptWorkspace), so no surface keeps an older one. */
22
+ /** One read of a workspace; its list form also reaches every live store (acceptWorkspace), so no surface keeps an older one. */
24
23
  export async function readWorkspace(read: (input: { workspaceId: string }) => Promise<GetReply>, workspaceId: string): Promise<GetReply> {
25
24
  const reply = await read({ workspaceId });
26
25
  if (reply.workspace) acceptWorkspace(reply.workspace);
27
26
  return reply;
28
27
  }
29
28
 
30
- export function useWorkspace(live: LiveStore | undefined, workspaceId: string, options: { enabled?: boolean; read?: boolean } = {}) {
29
+ export function useWorkspace(live: LiveStore | undefined, workspaceId: string, options: { enabled?: boolean } = {}) {
31
30
  const enabled = (options.enabled ?? true) && !!workspaceId;
32
31
  const read = useRpc(getRpc);
33
- useSyncExternalStore(live?.subscribe ?? none, live?.version ?? (() => 0), live?.version ?? (() => 0));
34
- const cached = enabled ? live?.get(workspaceId) : undefined;
35
- const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => readWorkspace(read, workspaceId), enabled: enabled && (options.read ?? true), staleTime: 15_000, refetchOnWindowFocus: false });
36
- const workspace = enabled ? newer(cached, query.data?.workspace) : null;
32
+ // The list copy only says when to read again: a change listed after this read (updatedAt) re-reads once.
33
+ const listedAt = useSyncExternalStore(live?.subscribe ?? none, () => enabled ? live?.get(workspaceId)?.updatedAt ?? null : null, () => null);
34
+ const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => readWorkspace(read, workspaceId), enabled, staleTime: 15_000, refetchOnWindowFocus: false });
35
+ const readAt = query.data?.workspace?.updatedAt ?? null;
36
+ const { refetch, isFetching } = query;
37
+ useEffect(() => {
38
+ if (enabled && listedAt && readAt && !isFetching && Date.parse(listedAt) > Date.parse(readAt)) void refetch();
39
+ }, [enabled, listedAt, readAt, isFetching, refetch]);
40
+ const workspace = enabled ? query.data?.workspace ?? null : null;
37
41
  return {
38
42
  workspace,
39
- /** Nothing to show yet: no live copy and the read hasn't answered. */
40
- pending: !workspace && query.isPending && enabled && (options.read ?? true),
43
+ /** Why there is no workspace to show: the read failed or found none (null while reading, or when disabled). */
44
+ failure: detailFailure({ enabled, workspace, error: query.error, reply: query.data }),
45
+ /** Nothing to show yet: the read hasn't answered. */
46
+ pending: !workspace && query.isPending && enabled,
41
47
  error: query.error,
42
48
  loadError: query.data?.error ?? null,
43
49
  refetching: query.isRefetching,
44
50
  refetch: () => { live?.refresh(); return query.refetch(); },
45
51
  };
46
52
  }
53
+
54
+ /**
55
+ * A sheet that waits for the full read (PR sheet, question sheet): opened while reading, it appears when the read
56
+ * answers; if the read fails, Follow-up's error toast says so and the request closes, instead of a click doing nothing.
57
+ */
58
+ export function useDetailGate(failure: string | null, open: boolean, close: () => void): void {
59
+ const toast = useToast();
60
+ useEffect(() => {
61
+ if (open && failure) { toast.error(`Couldn't open it: ${failure}`); close(); }
62
+ }, [open, failure]); // eslint-disable-line react-hooks/exhaustive-deps
63
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.0.1",
4
+ "version": "2.0.2-beta.0",
5
5
  "description": "A Paseo plugin that follows every workspace until the work is done: one Home for what needs you, questions you answer anywhere, and repairs that send themselves.",
6
6
  "type": "module",
7
7
  "files": [
package/server/daemon.ts CHANGED
@@ -7,7 +7,6 @@ import { homedir } from "node:os";
7
7
  import { join } from "node:path";
8
8
  import { readSharedJson } from "./shared-file";
9
9
  import { createRequire } from "node:module";
10
- import { TICK_MS } from "../shared/poll";
11
10
  import type { Workspace, Batch } from "../shared/model";
12
11
  import type { Gateway, Runtime } from "./engine";
13
12
  import type { State } from "../shared/model";
@@ -130,44 +129,32 @@ export function withDaemon<T>(work: (client: Daemon) => Promise<T>): Promise<T>
130
129
  * opened a WebSocket per workspace per tick through withDaemon (96 a minute live, each with its own hello and status).
131
130
  * It is in `clients`, so closeConnections closes it within the stop's deadline, and nothing opens after stop.
132
131
  *
133
- * The connection outlives the gap between ticks (a-running-worker-holds-one-daemon-connection): it closes only after
134
- * SHARED_CLIENT_IDLE_MS unused, which is the engine's TICK_MS plus a named margin, so a worker that keeps ticking
135
- * holds one connection. 2026-11-13 live: with a 5 s idle close and a 60 s replacement, every 15 s tick opened a new
136
- * WebSocket (the worker said hello 39 times in 12 min, each with its own handshake, status and buffers). A dropped
137
- * connection is still retired at once, and SHARED_CLIENT_MAX_MS replaces a long-lived one now and then.
132
+ * A running worker holds it (a-running-worker-holds-one-daemon-connection): nothing closes it for being unused. It
133
+ * closes on stop, when it drops (retired at once, the next call opens a fresh one), and SHARED_CLIENT_MAX_MS replaces a
134
+ * long-lived one. No idle bound is safe: the engine's loop waits TICK_MS after a tick ends, a tick's daemon calls come
135
+ * before its GitHub reads, and a paused tick (the governor) calls the daemon not at all. 2026-11-13 live (2.0.1-beta.7):
136
+ * with a TICK_MS + 10 s idle close the worker closed and reopened it every 80-130 s (22 hellos in 30 min); before that,
137
+ * a 5 s idle close opened one per tick (39 hellos in 12 min).
138
138
  */
139
- /** How far past one tick interval the shared connection stays open unused: a slow tick still finds it. */
140
- export const SHARED_CLIENT_MARGIN_MS = 10_000;
141
- export const SHARED_CLIENT_IDLE_MS = TICK_MS + SHARED_CLIENT_MARGIN_MS;
142
139
  export const SHARED_CLIENT_MAX_MS = 30 * 60_000;
143
- export type SharedConnect = (<T>(work: (client: Daemon) => Promise<T>) => Promise<T>) & { idle(): Promise<void> };
144
- type Shared = { client: Promise<Daemon>; opened: number; users: number; lastUsed: number; retired: boolean; timer: ReturnType<typeof setTimeout> | null };
145
- export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { idleMs?: number; maxMs?: number; now?: () => number } = {}): SharedConnect {
146
- const idleMs = o.idleMs ?? SHARED_CLIENT_IDLE_MS, maxMs = o.maxMs ?? SHARED_CLIENT_MAX_MS, now = o.now ?? Date.now;
140
+ export type SharedConnect = <T>(work: (client: Daemon) => Promise<T>) => Promise<T>;
141
+ type Shared = { client: Promise<Daemon>; opened: number; users: number; retired: boolean };
142
+ export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { maxMs?: number; now?: () => number } = {}): SharedConnect {
143
+ const maxMs = o.maxMs ?? SHARED_CLIENT_MAX_MS, now = o.now ?? Date.now;
147
144
  let current: Shared | null = null;
148
145
  const close = async (entry: Shared) => {
149
146
  if (current === entry) current = null;
150
- if (entry.timer) { clearTimeout(entry.timer); entry.timer = null; }
151
147
  const client = await entry.client.catch(() => null);
152
148
  if (client) { clients.delete(client); await client.close().catch(() => undefined); }
153
149
  };
154
- const settle = (entry: Shared) => { if (entry.users === 0 && (entry.retired || now() - entry.lastUsed >= idleMs)) void close(entry); };
155
- // One idle timer per connection, re-armed for what is left of the idle bound (not a timer per call).
156
- const arm = (entry: Shared) => {
157
- if (entry.timer) return;
158
- entry.timer = setTimeout(() => {
159
- entry.timer = null;
160
- if (current !== entry && !entry.retired) return;
161
- if (entry.users === 0 && now() - entry.lastUsed < idleMs) arm(entry); else settle(entry);
162
- }, Math.max(0, idleMs - (now() - entry.lastUsed)) || idleMs);
163
- (entry.timer as { unref?: () => void }).unref?.();
164
- };
165
- const connect = (async <T>(work: (client: Daemon) => Promise<T>): Promise<T> => {
150
+ // A retired connection closes once its last call is done; the current one stays open.
151
+ const settle = (entry: Shared) => { if (entry.users === 0 && entry.retired) void close(entry); };
152
+ return async <T>(work: (client: Daemon) => Promise<T>): Promise<T> => {
166
153
  if (stopped) throw new Error("Follow-up is stopping");
167
154
  if (current && now() - current.opened >= maxMs) { current.retired = true; const old = current; current = null; settle(old); }
168
155
  if (!current) {
169
156
  const client = open().then(c => { if (stopped) { void c.close().catch(() => undefined); throw new Error("Follow-up is stopping"); } clients.add(c); return c; });
170
- const entry: Shared = { client, opened: now(), users: 0, lastUsed: now(), retired: false, timer: null };
157
+ const entry: Shared = { client, opened: now(), users: 0, retired: false };
171
158
  current = entry;
172
159
  void client.catch(() => { if (current === entry) current = null; });
173
160
  }
@@ -179,16 +166,14 @@ export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { idle
179
166
  catch (error) {
180
167
  // A dropped connection isn't reused: the next call opens a fresh one.
181
168
  const status = (client as unknown as { connectionState?: { status?: string } }).connectionState?.status;
182
- if (status !== undefined && status !== "connected") entry.retired = true;
169
+ if (status !== undefined && status !== "connected") { entry.retired = true; if (current === entry) current = null; }
183
170
  throw error;
184
171
  }
185
172
  } finally {
186
- entry.users--; entry.lastUsed = now();
187
- if (entry.users === 0) { if (entry.retired) settle(entry); else arm(entry); }
173
+ entry.users--;
174
+ settle(entry);
188
175
  }
189
- }) as SharedConnect;
190
- connect.idle = async () => { if (current) { const entry = current; if (entry.users === 0 && now() - entry.lastUsed >= idleMs) await close(entry); } };
191
- return connect;
176
+ };
192
177
  }
193
178
  async function openDaemon(): Promise<Daemon> {
194
179
  const module = require(["@getpaseo", "client", "internal", "daemon-client"].join("/")) as Module;