paseo-follow-up 2.0.1-beta.8 → 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/CHANGELOG.md +147 -0
- package/client/brief.tsx +9 -4
- package/client/home.tsx +11 -3
- package/client/linked.tsx +1 -1
- package/client/live-copies.ts +19 -1
- package/client/live.tsx +16 -12
- package/client/merge-button.tsx +1 -1
- package/client/needs-you.tsx +1 -1
- package/client/pill.tsx +13 -9
- package/client/questions.tsx +8 -7
- package/client/spec.tsx +1 -1
- package/client/workspace-data.ts +36 -19
- package/package.json +1 -1
- package/server/daemon.ts +18 -33
- package/server/deployments.ts +55 -20
- package/server/feeds.ts +3 -2
- package/server/list-cache.ts +21 -10
- package/shared/activity.ts +1 -1
- package/shared/attention.ts +8 -7
- package/shared/brief.ts +5 -5
- package/shared/changelog.ts +5 -1
- package/shared/contracts.ts +3 -2
- package/shared/follow-up.ts +2 -2
- package/shared/home.ts +4 -3
- package/shared/list.ts +86 -0
- package/shared/merge-click.ts +1 -1
- package/shared/model.ts +8 -7
- package/shared/overseer.ts +3 -3
- package/shared/poll.ts +1 -1
- package/shared/pr-actions.ts +7 -6
- package/shared/presentation.ts +6 -5
- package/shared/questions.ts +9 -7
- package/shared/reviewers.ts +1 -1
- package/shared/row-menu.ts +1 -1
- package/shared/search.ts +3 -3
- package/shared/send-decision.ts +2 -1
- package/shared/sending.ts +1 -1
- package/shared/status-invariants.ts +1 -1
- package/shared/status.ts +1 -1
- package/shared/task-rows.ts +4 -2
- package/shared/task-status.ts +2 -1
- package/shared/task-trigger.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,153 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of Follow-up, newest first. Follow-up shows the curated part of a major release in "What's new" after the update, and every version's notes from Home's version line.
|
|
4
4
|
|
|
5
|
+
## 2.0.1 (2026-11-14)
|
|
6
|
+
|
|
7
|
+
Follow-up 2.0.1 turns fixes into plain tasks you can see and steer, makes merging one click, and runs much lighter on your machine.
|
|
8
|
+
|
|
9
|
+
### Tasks you can see and steer
|
|
10
|
+
|
|
11
|
+
- What Follow-up finds on your PRs (conflicts, review comments, failing checks, restacks) is now a task in the workspace's Tasks, with one plain state: Queued, Sent, Needs you or Done.
|
|
12
|
+
- The top of Tasks says who the next message goes to, when it goes and why it waits, with Preview and Send now. Turn Auto-send off on a task to keep it for yourself.
|
|
13
|
+
- Follow-up checks GitHub instead of asking you to Retry: what's cleared is done, and what's still open goes in the next message. It asks you only when a task went out twice with no change.
|
|
14
|
+
- Home's "Follow-up is fixing" is now "Sending": each message on its way, with when and why it goes out.
|
|
15
|
+
|
|
16
|
+
### Merging and review
|
|
17
|
+
|
|
18
|
+
- One click on Merge merges, and the button names everything it merges first ("Merge 3 PRs"). A blocker found at click time merges nothing and says why.
|
|
19
|
+
- Set a repository to No review in Settings → Shipping PRs, or with "Let the agent merge in" on a no-reviewers row: agents merge their own PRs once checks pass, and Follow-up never asks you for reviewers there.
|
|
20
|
+
- A PR without reviewers asks once in Needs you, naming the suggested reviewer.
|
|
21
|
+
- Every Needs you row about a PR opens it in one click.
|
|
22
|
+
|
|
23
|
+
### Answering agents
|
|
24
|
+
|
|
25
|
+
- "Add note" on a decision card sends your pick with a note ("A, but keep the BOM off").
|
|
26
|
+
- On Paseo 0.16, Put in chat adds your answer to the end of the agent's message box. An answer you copied or put in the chat reads "not sent yet" everywhere until it reaches the agent.
|
|
27
|
+
- An open question shows once, under one name, in the panel and on Home.
|
|
28
|
+
|
|
29
|
+
### New
|
|
30
|
+
|
|
31
|
+
- Rename with AI from a workspace's menu or ⌘K: Follow-up suggests a short name, and Undo puts the old one back.
|
|
32
|
+
- Report a bug, an idea or feedback from Settings, ⌘K or any error message. Your agent writes it up, removes private names and shows you the issue before it goes to GitHub.
|
|
33
|
+
- When an agent creates another agent or a workspace, the chat shows a card for it with its live status.
|
|
34
|
+
- Search results look like your list's rows, with your words highlighted. The sidebar view has a filter and Home's sort, the same on every device, and right-click opens a workspace's menu.
|
|
35
|
+
- Home remembers which groups you folded (Needs you always opens), and the phone keeps your settings category and folded sections.
|
|
36
|
+
|
|
37
|
+
### Lighter and faster
|
|
38
|
+
|
|
39
|
+
- On Paseo 0.16, Home, the sidebar and the pills update the moment something changes instead of checking every 15 to 60 seconds, and an open Follow-up sends almost nothing while you aren't using it.
|
|
40
|
+
- Follow-up uses about half the CPU and much less memory, reads about 50 times less from disk, keeps one connection to Paseo and uses far less of your GitHub API limit.
|
|
41
|
+
- Pull requests keep their last known status when GitHub is unreachable or out of API budget, instead of turning Unknown.
|
|
42
|
+
|
|
43
|
+
### Settings and fixes
|
|
44
|
+
|
|
45
|
+
- The deploy check is a per-repository setting on your machine: Settings → Following → PR workflow shows it for each repository, or Not set up.
|
|
46
|
+
- With Follow every workspace off, only the projects you switch on are followed.
|
|
47
|
+
- Follow-up pauses only when you stop the main agent, not after a compaction, a replaced turn or a reload.
|
|
48
|
+
- A merged PR reads "Merged", not "PR closed", and a PR merged long ago no longer comes back to Needs you.
|
|
49
|
+
- "No ask stated" and "Nothing needed" no longer linger in Needs you above real work.
|
|
50
|
+
|
|
51
|
+
<details><summary>Full changelog since 2.0.0</summary>
|
|
52
|
+
|
|
53
|
+
### Home and Needs you
|
|
54
|
+
|
|
55
|
+
- Rename with AI: pick it from a workspace's menu (Home, the sidebar view, the panel's new More button) or ⌘K, and Follow-up suggests a short name from the Summary, PRs and linked items. Edit it or accept it; Undo puts the old name back.
|
|
56
|
+
- What Follow-up finds on your PRs (conflicts, review feedback, failing checks, restacks) are now ordinary tasks in the workspace's Tasks, each with its PR and one plain state: Queued, Sent, Needs you or Done.
|
|
57
|
+
- Needs you, Home and the chat pill say "tasks" everywhere, and the Send in Needs you names the agent and doesn't repeat the task list.
|
|
58
|
+
- Home remembers which groups you folded. Needs you always opens, so nothing waiting on you hides behind a fold.
|
|
59
|
+
- A pull request without reviewers asks once in Needs you, naming the suggested reviewer ("Add reviewers to … : Ravi"), instead of a second reviewers card beside it.
|
|
60
|
+
- Home's "Follow-up is fixing" is now "Sending": messages on their way to an agent, with when and why each goes out, and Send now where it would go through. A send that waits on you stays in Needs you.
|
|
61
|
+
- Every Needs you row about a PR opens it in one click: an Open #N link beside its action, and each #N it names is a link.
|
|
62
|
+
- Agents get each inbox row's PR links from inbox_list.
|
|
63
|
+
- A copied answer, or one put in the chat, stays in Needs you as "Your Q1 answer isn't sent yet" until it reaches the agent. Sending it from the chat, Send on that row (one click) or Sign off clears it. Before, Copy cleared it at once.
|
|
64
|
+
- On Paseo 0.16, the recovery agent runs in the background: no tab, no notification and no sidebar row. Its progress shows in the workspace panel.
|
|
65
|
+
- The "has no reviewers" row has a "Let the agent merge in" link that switches its repository to No review, with Undo.
|
|
66
|
+
- Switching a repository to No review clears its "Add reviewers" asks everywhere at once (Needs you, the header, the pill and Home); Undo brings them back.
|
|
67
|
+
- Search results look like the rows of your list, with the words you typed highlighted where they appear. A match in a branch, PR or linked issue shows on the second line.
|
|
68
|
+
- The Follow-up sidebar view has a filter and Home's sort. The sort is one setting for Home and the sidebar, the same on every device, and agents can change it when you ask.
|
|
69
|
+
- A task names the agent working on it and whether it is working, idle or closed, instead of a stale "Agent working", with Open agent. The status line and Home spin only while that agent really runs.
|
|
70
|
+
- An answer you copied or put in the agent's message box now reads "not sent yet" on the chat's card, in the question and in Activity, like Needs you, instead of "Answered" with a check. It reads Answered once it reaches the agent.
|
|
71
|
+
- In menus on a phone, the check beside the chosen sort and the action icons now sit centred beside their item, sized to match the text.
|
|
72
|
+
- An open question shows once in the panel and on Home, under one name: the agent's ask and its question are one card in Needs you, with other questions as headers below. Blocked tasks say what they wait on.
|
|
73
|
+
- Right-click a workspace in the sidebar view to open its menu.
|
|
74
|
+
- A task an agent marks blocked only asks you something when it is blocked on you, with a real question. Tasks waiting on a pull request or another agent show as Blocked in Tasks instead of in Needs you.
|
|
75
|
+
- On Paseo 0.16, Home, the sidebar and the pills update the moment something changes, on every device, instead of checking every 15 to 60 seconds. An open Follow-up now sends almost nothing while you aren't using it.
|
|
76
|
+
- Follow-up's worker makes less short-lived garbage under load: the workspace list re-serializes only the workspaces that changed, and the Needs-you inbox is saved at most once every 2 seconds.
|
|
77
|
+
- Needs you, the usage meters and a workspace's Summary answer at once instead of waiting on Paseo; what's new arrives on the next refresh.
|
|
78
|
+
|
|
79
|
+
### Questions and answers
|
|
80
|
+
|
|
81
|
+
- Decision cards: "Add note" under the options lets you send a pick with a note ("A, but keep the BOM off"). One tap still sends; with a note typed, each option reads "Send A with note".
|
|
82
|
+
- A note sent with a picked option on a decision card (by an agent's brief_action today) now reaches the agent and shows on the chat's answer card. Before, only Something else kept its words.
|
|
83
|
+
- You're asked only when the same problem was sent twice with no change, and the card says which one.
|
|
84
|
+
- When an agent creates another agent or a workspace, the chat shows a card for it: its name, model, live status and what Follow-up knows (an open question, PR state). Tap it to open the agent or workspace.
|
|
85
|
+
- Paseo 0.16: **Put in chat** on a question adds your answer to the end of the agent's message box to edit before sending. It never replaces a draft; if the chat can't open, the answer is copied. Copy becomes an icon (0.15 keeps its label).
|
|
86
|
+
- Follow-up stays quick on workspaces with hundreds of PRs or questions.
|
|
87
|
+
- A multi-decision card is titled with the agent's ask, not Q1.
|
|
88
|
+
|
|
89
|
+
### Repairs and PRs
|
|
90
|
+
|
|
91
|
+
- After a reload mid-send, Follow-up checks the agent's chat and sends the message again only if it never arrived.
|
|
92
|
+
- The top of Tasks says who the next message goes to, when it goes and why it waits, with Preview and Send now. You can keep any single task for yourself by turning its Auto-send off.
|
|
93
|
+
- A task that went out twice with no change on GitHub, even if the agent said it was done, asks you on its own, and everything else keeps going. This replaces the old rule that stopped a PR's messages after three tries.
|
|
94
|
+
- When the machine is short on memory, one line at the top of Sending says auto-sends are paused and why.
|
|
95
|
+
- What Follow-up sends the agent is called tasks everywhere, never repairs.
|
|
96
|
+
- The deploy check is now a per-repository setting on your machine, set by an agent. Settings → Following → PR workflow shows it for each repository, or Not set up.
|
|
97
|
+
- One click on Merge merges: no second "Merge this PR?". The button names everything it merges first ("Merge 3 PRs"), and a blocker found at click time merges nothing and says why.
|
|
98
|
+
- You can set a repository to No review in Settings → Shipping PRs. There, Follow-up never asks you to add reviewers or merge, and agents merge their own PRs once checks pass. Team review stays the default.
|
|
99
|
+
- Report a bug, an idea or feedback from Settings → General, Command-K or any error message. Your agent writes it up with versions and recent errors, removes private names, and shows you the issue before it goes to GitHub.
|
|
100
|
+
- When GitHub's API limit for your account runs out, pull requests keep their last known status instead of turning Unknown, and Follow-up waits for the limit to reset before asking again.
|
|
101
|
+
- An Add reviewers row says only what is new: "Suggested: Ravi" under its title, not the ask again. No headline repeats its label or the PR number its chip already shows.
|
|
102
|
+
- A merged PR reads by its title, not "#240 merged" beside its chip.
|
|
103
|
+
- Follow-up uses far less of your GitHub API limit: an agent finishing a turn rechecks only its own workspace's pull requests, and agents finishing together share one check.
|
|
104
|
+
- Follow-up's worker does less work when an agent's turn ends: it checks only that workspace, and a PR the agent just opened still shows right away.
|
|
105
|
+
|
|
106
|
+
### Providers and helper agents
|
|
107
|
+
|
|
108
|
+
- After a failed recovery, the Recovery block offers one action, Retry recovery, instead of both Run recovery and Retry recovery.
|
|
109
|
+
|
|
110
|
+
### Setup, Settings and updates
|
|
111
|
+
|
|
112
|
+
- On the phone, Follow-up now keeps your settings category and folded sections after you reopen the app.
|
|
113
|
+
|
|
114
|
+
### Performance
|
|
115
|
+
|
|
116
|
+
- Follow-up uses about half the CPU it did, reads about 50 times less from disk and opens one daemon connection at a time instead of one per workspace.
|
|
117
|
+
- Follow-up writes its state files only when something really changed, about 8 times less often.
|
|
118
|
+
|
|
119
|
+
### More
|
|
120
|
+
|
|
121
|
+
- An agent whose session Paseo closed (after an hour idle or a plugin reload) keeps its link as "Open chat" on task rows and cards. Only archived agents show words alone.
|
|
122
|
+
- No repository tracks by default from Follow-up itself anymore: with Follow every workspace off, only the projects you switch on are followed.
|
|
123
|
+
- Ask any agent to "report a bug about Follow-up" and it files a detailed issue only after you say yes. Screenshots are uploaded only if you agree for that report.
|
|
124
|
+
- Follow-up keeps one connection to Paseo instead of opening a new one for each read, and asks for usage meters only when Smart Session is installed.
|
|
125
|
+
- Follow-up reads each agent turn once, picking up where its last read stopped, instead of re-reading the newest part of the chat at the start of the turn, at its end and again for discovery.
|
|
126
|
+
|
|
127
|
+
### Fixes
|
|
128
|
+
|
|
129
|
+
- Fixes no longer ask you to Retry when the agent's turn ends without reporting back. Follow-up checks GitHub instead: what's cleared is done, and what's still open goes in the next message.
|
|
130
|
+
- Sending is lighter: each send writes only its own workspace and reuses the agent list, so a few sends no longer leave the worker ~110 MB larger, and it stays quiet afterwards (it used to keep making ~16 Paseo requests a minute).
|
|
131
|
+
- The line under queued fixes now says exactly why they haven't gone out, such as a PR Follow-up couldn't read or a send that was refused, and only says "sending now" when one is really going out.
|
|
132
|
+
- Fixes that keep changing no longer push their send back: they go out a minute after the first one was queued.
|
|
133
|
+
- A task whose agent Paseo no longer knows reads "Agent unavailable" instead of "In progress", and archived agents keep reading "archived" after Follow-up re-reads Paseo's list.
|
|
134
|
+
- A "No ask stated" card no longer sits above a Needs-you item that says what to do.
|
|
135
|
+
- A PR the agent merges itself no longer reads "No reviewers" in the Pull requests card or the PR sheet.
|
|
136
|
+
- Follow-up pauses only when you stop the main agent. A turn replaced by a new message, a compaction or a session reload no longer leaves it paused, and any pause lifts once the agent runs again.
|
|
137
|
+
- Follow-up reads GitHub inside its own process, so starting up or finishing a deploy no longer launches dozens of `gh` processes.
|
|
138
|
+
- A "Nothing needed" turn end no longer shows in Needs you or counts there when the workspace is flagged for something else, like a merged PR. The pill and rows read that reason instead.
|
|
139
|
+
- Follow-up uses much less memory while your agents are busy, and no longer reconnects to Paseo every few seconds.
|
|
140
|
+
- Needs you: a merged PR reads "Merged", not "PR closed", which now means closed without merging. A PR the agent merged itself no longer flags you; a Later "until this PR merges" still wakes.
|
|
141
|
+
- An agent that says nothing is needed no longer stays in Needs you with an older "No ask stated" card.
|
|
142
|
+
- A PR that merged long ago no longer shows up in Needs you again as "Merged" in workspaces with many PRs.
|
|
143
|
+
- The popup no longer repeats its ask or to-do count.
|
|
144
|
+
- A row never says "No ask stated" above work to do.
|
|
145
|
+
- Merged pull requests no longer show Unknown after GitHub was briefly unreachable or out of API budget. Every pull request keeps its last known status, and its details say when it was last checked.
|
|
146
|
+
- Tracking a workspace right after creating its agent no longer fails with "This workspace has no available main agent".
|
|
147
|
+
- Follow-up uses much less memory and CPU with many workspaces, and no longer spikes when it starts.
|
|
148
|
+
- Signing off, Later and Undo no longer wait for Paseo to clear the unread dot.
|
|
149
|
+
|
|
150
|
+
</details>
|
|
151
|
+
|
|
5
152
|
## 2.0.0 (2026-11-11)
|
|
6
153
|
|
|
7
154
|
Follow-up keeps track of every workspace your coding agents work in, until the work is merged and done. It shows you in one place which agents are waiting on you and why, sends failed checks and review comments back to the right agent by itself, and lets you answer an agent's question without opening its chat.
|
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 {
|
|
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(
|
|
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
|
|
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
|
-
|
|
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
|
-
{
|
|
489
|
-
{
|
|
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/
|
|
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";
|
package/client/live-copies.ts
CHANGED
|
@@ -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:
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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,
|
|
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:
|
|
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,
|
|
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
|
|
47
|
-
archived = [...all.values()].filter(
|
|
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 ||
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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);
|
package/client/merge-button.tsx
CHANGED
|
@@ -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/
|
|
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";
|
package/client/needs-you.tsx
CHANGED
|
@@ -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/
|
|
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 {
|
|
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:
|
|
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:
|
|
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
|
|
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
|
-
|
|
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={
|
|
236
|
-
<QuestionSheet workspace={
|
|
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
|
|
package/client/questions.tsx
CHANGED
|
@@ -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:
|
|
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:
|
|
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:
|
|
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:
|
|
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
|
|
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
|
|
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:
|
|
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/
|
|
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";
|
package/client/workspace-data.ts
CHANGED
|
@@ -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 {
|
|
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
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
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
|
|
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
|
|
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
|
-
|
|
34
|
-
const
|
|
35
|
-
const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => readWorkspace(read, workspaceId), enabled
|
|
36
|
-
const
|
|
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
|
-
/**
|
|
40
|
-
|
|
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
|
+
}
|