paseo-follow-up 2.6.0 → 2.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -17
- package/client/about.tsx +8 -2
- package/client/agents.tsx +1 -1
- package/client/brief-since.tsx +13 -7
- package/client/brief.tsx +69 -42
- package/client/button-visibility.ts +7 -3
- package/client/card-data.ts +24 -2
- package/client/catch-up.tsx +18 -12
- package/client/chat.tsx +15 -4
- package/client/created.tsx +15 -34
- package/client/daily-brief.tsx +83 -0
- package/client/dismiss.tsx +21 -6
- package/client/display.tsx +64 -38
- package/client/floating-surface.tsx +2 -1
- package/client/home-chrome.tsx +36 -12
- package/client/home-data.ts +32 -6
- package/client/home-list.tsx +137 -45
- package/client/home-view.ts +38 -3
- package/client/home.tsx +86 -56
- package/client/i18n.tsx +45 -0
- package/client/inbox-store.ts +34 -4
- package/client/inbox.tsx +19 -5
- package/client/install-scope.ts +80 -0
- package/client/job-rows.tsx +11 -4
- package/client/kit.tsx +11 -4
- package/client/last-known.ts +70 -0
- package/client/live.tsx +32 -18
- package/client/moments.tsx +66 -0
- package/client/more-context.tsx +19 -3
- package/client/motion.tsx +25 -2
- package/client/move-testids.ts +6 -0
- package/client/needs-you.tsx +16 -11
- package/client/onboarding-read.ts +12 -0
- package/client/onboarding.tsx +97 -152
- package/client/panel.tsx +38 -1
- package/client/pending-removals.ts +45 -0
- package/client/pill.tsx +19 -12
- package/client/pr-controls.tsx +6 -1
- package/client/pr-sheet.tsx +72 -3
- package/client/question-context.tsx +30 -18
- package/client/question-draft.ts +117 -0
- package/client/questions.tsx +193 -81
- package/client/release-notes.tsx +8 -7
- package/client/review-mode.tsx +2 -2
- package/client/row-actions.ts +30 -8
- package/client/row-chips.tsx +246 -0
- package/client/search-focus.ts +24 -4
- package/client/search-key.ts +8 -4
- package/client/settings.tsx +3 -3
- package/client/setup-gate.tsx +28 -4
- package/client/setup-ui.ts +10 -3
- package/client/shipping.tsx +23 -6
- package/client/shown-cards.tsx +18 -10
- package/client/sidebar-view.tsx +22 -7
- package/client/stacks.tsx +2 -1
- package/client/timeline-card.tsx +54 -0
- package/client/toast-store.ts +22 -7
- package/client/toasts.tsx +2 -2
- package/client/turn-view.tsx +70 -12
- package/client/updates.tsx +2 -0
- package/client/view-at.ts +19 -0
- package/client/view-r-header.tsx +155 -0
- package/client/view-r.tsx +730 -0
- package/client/workspace-data.ts +7 -1
- package/index.client.tsx +42 -7
- package/index.server.ts +117 -31
- package/package.json +2 -1
- package/scripts/inline.mjs +22 -8
- package/server/about.ts +30 -4
- package/server/agent-actions.ts +78 -21
- package/server/agent-hook.mjs +24 -6
- package/server/agent-hooks.ts +29 -0
- package/server/agent-parity.ts +7 -3
- package/server/ai-jobs.ts +44 -10
- package/server/ask.ts +2 -2
- package/server/brief-sources.ts +5 -5
- package/server/brief-timeline.ts +9 -1
- package/server/compass.ts +4 -1
- package/server/daemon-endpoint/index.d.mts +24 -0
- package/server/daemon-endpoint/index.mjs +145 -0
- package/{shared → server}/daemon-url.d.mts +3 -1
- package/server/daemon-url.mjs +48 -0
- package/server/daemon.ts +5 -4
- package/server/discovery.ts +3 -3
- package/server/engine.ts +57 -8
- package/server/github.ts +7 -3
- package/server/hook-source.ts +72 -35
- package/server/inbox.ts +65 -6
- package/server/mcp-source.ts +252 -81
- package/server/mcp.mjs +33 -36
- package/server/message-queue.ts +5 -0
- package/server/onboarding.ts +16 -3
- package/server/overseer.ts +3 -2
- package/server/pr-actions.ts +3 -0
- package/server/pr-workflow.ts +9 -6
- package/server/ranker.ts +29 -8
- package/server/rename.ts +1 -1
- package/server/tasks.ts +17 -4
- package/server/turn-end.ts +17 -0
- package/server/turn-events.ts +2 -2
- package/server/turn-usage.ts +47 -0
- package/server/update-watchdog-source.ts +174 -18
- package/server/update-watchdog.mjs +3 -2
- package/server/usage-record.ts +69 -0
- package/server/wait-jobs.ts +11 -8
- package/shared/about.ts +2 -1
- package/shared/agent-settings.ts +10 -1
- package/shared/agent-text.d.mts +5 -1
- package/shared/agent-text.mjs +48 -29
- package/shared/attention.ts +34 -20
- package/shared/brief-sources.ts +6 -3
- package/shared/brief.ts +46 -4
- package/shared/catch-up.ts +35 -10
- package/shared/chat.ts +30 -22
- package/shared/contracts.ts +24 -6
- package/shared/daily-brief.ts +184 -0
- package/shared/display.ts +34 -2
- package/shared/errors.ts +3 -1
- package/shared/headline.ts +27 -8
- package/shared/home-arrange.ts +2 -2
- package/shared/home.ts +182 -28
- package/shared/i18n.ts +224 -0
- package/shared/inbox.ts +59 -5
- package/shared/job-rows.ts +7 -4
- package/shared/last-known.ts +63 -0
- package/shared/list-entries.ts +24 -5
- package/shared/model.ts +28 -1
- package/shared/moments.ts +166 -0
- package/shared/needs-block.ts +11 -5
- package/shared/onboarding.ts +77 -67
- package/shared/optimistic-removals.ts +145 -0
- package/shared/peek.ts +26 -1
- package/shared/pr-workflow.ts +64 -4
- package/shared/question-draft.ts +60 -0
- package/shared/questions.ts +21 -1
- package/shared/row-chips.ts +167 -0
- package/shared/row-menu.ts +26 -13
- package/shared/search-focus.ts +34 -2
- package/shared/search-key.ts +10 -0
- package/shared/send-decision.ts +32 -2
- package/shared/settings-nav.ts +1 -1
- package/shared/settings.ts +11 -0
- package/shared/setup-popup.ts +10 -3
- package/shared/spin.ts +17 -0
- package/shared/status-invariants.ts +211 -6
- package/shared/status.ts +34 -4
- package/shared/task-status.ts +23 -1
- package/shared/task-view.ts +1 -1
- package/shared/turn.ts +6 -0
- package/shared/usage-record.ts +84 -0
- package/shared/view-r.ts +208 -0
- package/client/card-store.ts +0 -21
- package/shared/daemon-url.mjs +0 -39
package/README.md
CHANGED
|
@@ -24,40 +24,44 @@ your attention instead. The work comes to you, in one place, ranked.
|
|
|
24
24
|
paseo plugin install npm:paseo-follow-up
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
You need Paseo 0.15 or later and Node 22+ on the machine Paseo runs on; a signed-in GitHub CLI (`gh`) there is optional and turns on PR tracking. Then open
|
|
28
|
-
Follow-up in Paseo's sidebar. A
|
|
27
|
+
You need Paseo 0.15 or later and Node 22+ on the machine Paseo runs on; a signed-in GitHub CLI (`gh`) there is optional and turns on PR tracking. It works with any agent Paseo runs. Then open
|
|
28
|
+
Follow-up in Paseo's sidebar. A one-page setup checks GitHub and your agents and asks what Follow-up may do on its own
|
|
29
|
+
and in your chats, saying what each choice costs.
|
|
29
30
|
|
|
30
31
|
## What it does
|
|
31
32
|
|
|
32
33
|
### Every workspace in one place
|
|
33
34
|
|
|
34
|
-
All your workspaces, across every project, on one screen. Each shows its state, a one-line summary,
|
|
35
|
-
issues, Slack threads and docs it's about. It's on Home, or always open as Paseo's
|
|
35
|
+
All your workspaces, across every project, on one screen. Each shows its state, a one-line summary, what each agent
|
|
36
|
+
is working on now, and the Linear issues, Slack threads and docs it's about. It's on Home, or always open as Paseo's
|
|
37
|
+
sidebar, with your pinned workspaces on top and status counts you tap to filter.
|
|
36
38
|
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
<img alt="Follow-up as Paseo's sidebar: status counts under the filter, the Overseer and two pinned workspaces on top, then Needs you" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-notes-260-sidebar.png" width="321">
|
|
40
|
+
|
|
41
|
+
Click a workspace and its view has everything you need to run it: PRs and checks, what needs you, each agent's chat
|
|
42
|
+
with a reply box, the questions you asked, tasks and activity. Rest the pointer on an agent's line for its latest
|
|
43
|
+
steps.
|
|
44
|
+
|
|
45
|
+
<img alt="The workspace view: the workspace's PRs and their progress, a question waiting in Needs you, and the main agent's chat" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-notes-260-view.png">
|
|
41
46
|
|
|
42
47
|
### Automatic follow-ups, through merge, deploy and after
|
|
43
48
|
|
|
44
49
|
Before the merge, failed checks, merge conflicts and review comments go back to the agent that made the PR by
|
|
45
|
-
themselves.
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
themselves. Where your team wants every GitHub comment written by a person, set review comments to Fix only (the agent
|
|
51
|
+
pushes the fix and never replies) or Off, per repository, in Settings → Following → Shipping PRs. After it, the tasks an agent recorded come due when the PR merges, when it's deployed, a set number of days
|
|
52
|
+
later or at a time you pick, and go back to the agent that owns them: verify it in production, reply in the Slack
|
|
53
|
+
thread once it's live, check the numbers again next week. Work isn't done when the agent stops, or even when the PR merges. Merging
|
|
48
54
|
and answering stay yours: see [what it never does on its own](#what-it-never-does-on-its-own).
|
|
49
55
|
|
|
50
|
-
<picture>
|
|
51
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-deploy-dark.png">
|
|
52
|
-
<img alt="Invoice PDFs: the chat shows the failed check Follow-up sent back to the agent, and the panel beside it shows that repair sent and the next task, sending a test receipt from staging, waiting until #188 deploys" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-deploy-light.png">
|
|
53
|
-
</picture>
|
|
54
|
-
|
|
55
56
|
### One inbox of what needs you, ranked by AI
|
|
56
57
|
|
|
57
58
|
Questions, failed checks, reviews and merges from every workspace, in one list. AI orders it by what your Linear
|
|
58
59
|
issues, Slack mentions and review requests say matters most. Agents ask for decisions as cards with lettered options
|
|
59
60
|
and a recommendation, so you answer in seconds without opening the chat or loading its context.
|
|
60
61
|
|
|
62
|
+
Using the Progress plugin too? Its runs show on the agent's line, and its questions and stuck tickets land in Needs
|
|
63
|
+
you, answerable right there.
|
|
64
|
+
|
|
61
65
|
<picture>
|
|
62
66
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-home-dark.png">
|
|
63
67
|
<img alt="Home: every workspace grouped by what it needs from you, Needs you first, with Billing retries' decision open beside the list as lettered options, A recommended" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-home-light.png">
|
|
@@ -73,6 +77,14 @@ and it answers or passes your words to the agent doing the work. It can re-rank
|
|
|
73
77
|
<img alt="Home with the Overseer selected: asked what's blocked on review, it names the two workspaces waiting and why" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-overseer-light.png">
|
|
74
78
|
</picture>
|
|
75
79
|
|
|
80
|
+
### Agents show their work, and you can ask them
|
|
81
|
+
|
|
82
|
+
Screenshots, benchmarks, tables or a report an agent wants you to see show up as cards in the workspace view, next to
|
|
83
|
+
the question they're about. Ask any agent something from its workspace view, from Home, or with /ask in its chat; the
|
|
84
|
+
answer stays in Your questions.
|
|
85
|
+
|
|
86
|
+
<img alt="An agent's card in the workspace view: before and after latency as bars for p50, p95 and p99, a table of endpoints with the change, and a link to a flame graph" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-notes-260-cards.png" width="550">
|
|
87
|
+
|
|
76
88
|
### Catch up
|
|
77
89
|
|
|
78
90
|
After a meeting or a morning away, go through everything that needs you one card at a time: answer, next, answer,
|
|
@@ -94,7 +106,12 @@ I built it for myself, to keep up with my own agents, and it made me a lot more
|
|
|
94
106
|
|
|
95
107
|
- Merge, request reviewers or archive. Those take your click, or an agent's plan that you confirmed.
|
|
96
108
|
- Answer a question for you.
|
|
97
|
-
- Wake a resting agent. It reads the transcript on disk instead.
|
|
109
|
+
- Wake a resting agent just to read it. It reads the transcript on disk instead.
|
|
110
|
+
|
|
111
|
+
Everything it adds can be turned off, and off means off: Settings → Chats & display has what it adds to your chats
|
|
112
|
+
(the pill, its cards in chats, agent cards, questions you ask in chat, the nudge to say what an agent needs) and where
|
|
113
|
+
it shows; Settings → Agents has the jobs that use your model usage on their own (Summaries, AI priority, which starts off
|
|
114
|
+
on a new install), each with what it costs; Settings → Following has auto-send.
|
|
98
115
|
|
|
99
116
|
It runs on your machine with your own GitHub sign-in. [Data and access](docs/data-access.md) says exactly what it reads and
|
|
100
117
|
writes.
|
|
@@ -115,6 +132,7 @@ Follow-up can also switch Graphite's **Merge when ready** through it, after you
|
|
|
115
132
|
|
|
116
133
|
- [Using Follow-up](docs/guide.md): setup, Home, Catch up, the Overseer, the panel, the pill, settings, helper agents,
|
|
117
134
|
updates, reporting a bug, upgrading from 1.x and memory on Linux.
|
|
135
|
+
- [Using Follow-up with Progress](docs/progress.md): what shows where when you also run the Progress plugin.
|
|
118
136
|
- [CHANGELOG.md](CHANGELOG.md): release notes.
|
|
119
137
|
- [AGENTS.md](AGENTS.md): how it's built and how to work on it.
|
|
120
138
|
|
package/client/about.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { errorText } from "../shared/errors";
|
|
|
9
9
|
import { Button, text, type Theme } from "./kit";
|
|
10
10
|
import { useReducedMotion } from "./motion";
|
|
11
11
|
import { useTick } from "./home-data";
|
|
12
|
+
import { useSummariesOn } from "./display";
|
|
12
13
|
|
|
13
14
|
export const aboutKey = (workspaceId: string) => ["follow-up", "about", workspaceId] as const;
|
|
14
15
|
|
|
@@ -21,6 +22,8 @@ export const aboutKey = (workspaceId: string) => ["follow-up", "about", workspac
|
|
|
21
22
|
export function useSummary(workspaceId: string) {
|
|
22
23
|
const read = useRpc(workspaceAboutRpc);
|
|
23
24
|
const client = useQueryClient();
|
|
25
|
+
// Summaries off (off-means-fully-off): no read, so the worker is never asked to write one.
|
|
26
|
+
const on = useSummariesOn();
|
|
24
27
|
// Pending replies in a row: the next ask comes after 500 ms, backing off to 3 s (pendingPollMs). None while not pending.
|
|
25
28
|
const pendingRun = useRef(0);
|
|
26
29
|
const query = useQuery({
|
|
@@ -28,6 +31,7 @@ export function useSummary(workspaceId: string) {
|
|
|
28
31
|
queryFn: async () => { const v = await read({ workspaceId, open: true }); pendingRun.current = v.status === "pending" ? pendingRun.current + 1 : 0; return v; },
|
|
29
32
|
refetchInterval: q => (q.state.data as AboutView | undefined)?.status === "pending" ? pendingPollMs(pendingRun.current) : false,
|
|
30
33
|
staleTime: 60_000,
|
|
34
|
+
enabled: on,
|
|
31
35
|
});
|
|
32
36
|
const [rewriting, setRewriting] = useState(false);
|
|
33
37
|
const rewrite = async () => {
|
|
@@ -36,7 +40,7 @@ export function useSummary(workspaceId: string) {
|
|
|
36
40
|
try { client.setQueryData(aboutKey(workspaceId), await read({ workspaceId, open: true, refresh: true })); }
|
|
37
41
|
catch { /* the query's error shows */ } finally { setRewriting(false); }
|
|
38
42
|
};
|
|
39
|
-
return { query, view: query.data ?? null, rewrite, rewriting };
|
|
43
|
+
return { query, view: on ? query.data ?? null : null, rewrite, rewriting, on };
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
/**
|
|
@@ -76,8 +80,10 @@ export function SummaryLine({ workspace, theme, compact, lead = false }: { works
|
|
|
76
80
|
*/
|
|
77
81
|
export function SummaryRow({ workspaceId, theme, compact }: { workspaceId: string; theme: Theme; compact: boolean }) {
|
|
78
82
|
const c = theme.colors; const t = text(c, compact);
|
|
79
|
-
const { query, view, rewrite, rewriting } = useSummary(workspaceId);
|
|
83
|
+
const { query, view, rewrite, rewriting, on } = useSummary(workspaceId);
|
|
80
84
|
useTick(60_000);
|
|
85
|
+
// Summaries off: no row, no Rewrite (off-means-fully-off).
|
|
86
|
+
if (!on) return null;
|
|
81
87
|
const d = summaryDisplay(view, Date.now());
|
|
82
88
|
const busy = rewriting || d.pending;
|
|
83
89
|
const line = query.error ? `Couldn't load the summary: ${errorText(query.error)}`
|
package/client/agents.tsx
CHANGED
|
@@ -22,7 +22,7 @@ const DEFAULT = "__default";
|
|
|
22
22
|
type Role = AgentSettingsView["roles"][number];
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Settings → Agents: the same job rows as setup's
|
|
25
|
+
* Settings → Agents: the same job rows as setup's step (client/job-rows.tsx), plus each row's More with
|
|
26
26
|
* what only Settings has: permissions, limits, schedule and Reset to defaults. The provider catalog is read once when
|
|
27
27
|
* this screen opens (cached on the server), never polled.
|
|
28
28
|
*/
|
package/client/brief-since.tsx
CHANGED
|
@@ -88,13 +88,19 @@ function LineActions({ source, actions, c, compact, onStarted }: { source: strin
|
|
|
88
88
|
catch (e) { toast.error(errorText(e)); openNew({ source }); }
|
|
89
89
|
finally { setBusy(null); }
|
|
90
90
|
};
|
|
91
|
-
// Each button keeps its whole label (never squeezed to "Plan as ar…"): a row that doesn't fit wraps instead.
|
|
91
|
+
// Each button keeps its whole label (never squeezed to "Plan as ar…"): a row that doesn't fit wraps instead. ⋯ wraps
|
|
92
|
+
// with the last button, never onto a line of its own.
|
|
93
|
+
const shown = actions.slice(0, 2);
|
|
94
|
+
const button = (a: DispatchAction) => <BarBtn key={a.id} c={c} compact={compact} small primary={false} disabled={!!busy} b={{ name: busy === a.id ? `${a.name}…` : a.name, icon: actionIcon(a.icon), key: null }} onPress={() => void start(a)} />;
|
|
92
95
|
return <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8, marginTop: 6 }}>
|
|
93
|
-
{
|
|
94
|
-
<
|
|
95
|
-
|
|
96
|
-
<
|
|
97
|
-
|
|
96
|
+
{shown.slice(0, -1).map(button)}
|
|
97
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
98
|
+
{shown.slice(-1).map(button)}
|
|
99
|
+
<Pressable accessibilityRole="button" accessibilityLabel={`More ways to start ${source} in ${NEW_NAME}`} onPress={() => openNew({ source })}
|
|
100
|
+
style={(s: Hover) => ({ minHeight: compact ? 44 : 32, minWidth: compact ? 44 : 32, alignItems: "center", justifyContent: "center", borderRadius: 8, backgroundColor: s.pressed ? c.surface2 : s.hovered ? c.surface1 : "transparent", ...focusRing(c, s.focused) })}>
|
|
101
|
+
<Icon name="Ellipsis" size={16} color={c.foreground} />
|
|
102
|
+
</Pressable>
|
|
103
|
+
</View>
|
|
98
104
|
</View>;
|
|
99
105
|
}
|
|
100
106
|
|
|
@@ -290,7 +296,7 @@ export function NobodyRows({ theme, compact, data, onDismissed }: { theme: Theme
|
|
|
290
296
|
const reason = <PriorityLine reason={first.line} source={first.from === "compass" ? { kind: "compass", label: first.source } : { kind: "linear", label: first.source }} c={c} size={compact ? 12 : 11} lines={compact ? 2 : 1} />;
|
|
291
297
|
const when = age(r.at, now);
|
|
292
298
|
const start = <BarBtn c={c} compact={compact} small primary={false} disabled={false} b={{ name: "Start…", icon: "Play", key: null }} onPress={() => openNew({ source: r.key })} />;
|
|
293
|
-
const x = <DismissX theme={theme} compact={compact} label={`Remove ${r.key}`} onPress={() => dismiss({ issue: r.key })} />;
|
|
299
|
+
const x = <DismissX theme={theme} compact={compact} label={`Remove ${r.key}`} onPress={() => dismiss({ issue: r.key }, { restore: { need: r, index: data.needs.indexOf(r) } })} />;
|
|
294
300
|
const glyph = <View style={{ width: compact ? 18 : 16, alignItems: "center", paddingTop: compact ? 2 : 0 }}><Icon name={row.compass ? "Compass" : "ArrowUp"} size={compact ? 17 : 15} color={c.statusWarning} /></View>;
|
|
295
301
|
return <RevealScope key={r.key} accessibilityLabel={`Needs you: ${row.label}`}
|
|
296
302
|
style={{ flexDirection: "row", alignItems: compact ? "flex-start" : "center", gap: 10, minHeight: compact ? 56 : 46, paddingLeft: compact ? 14 : 16, paddingRight: compact ? 16 : 16, paddingVertical: compact ? 12 : 5,
|
package/client/brief.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { useMemo, useState, useSyncExternalStore, type ReactNode } from "react";
|
|
1
|
+
import { useEffect, useMemo, useState, useSyncExternalStore, type ReactNode } from "react";
|
|
2
|
+
import { useChatCardsOn } from "./display";
|
|
2
3
|
import { useKept } from "./kept";
|
|
3
4
|
import { LinkWorkspaceProvider, openLinkQuietly } from "./open-link";
|
|
4
5
|
import { browserKey, liveBriefKey, LIVE_BRIEF_POLL_MS, workspaceKey } from "./keys";
|
|
@@ -8,7 +9,7 @@ import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
|
8
9
|
import { useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
9
10
|
import { deliveryStatus } from "../shared/queue";
|
|
10
11
|
import { Icon, copyText, useToast } from "@getpaseo/plugin/client/ui";
|
|
11
|
-
import { BRIEF_KIND, briefCardAsk, BRIEF_VERSION, askedDecisions, cardPicks, decisionQuestion, notedCount, pickedCount, briefSchema, collapsedLine, outcomeLabel, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId, answeredOutcome, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
12
|
+
import { BRIEF_KIND, briefCardAsk, BRIEF_VERSION, askedDecisions, cardPicks, decisionQuestion, notedCount, pickedCount, briefSchema, collapsedLine, outcomeLabel, extrasFit, hasOriginal, nothingNeededLine, quietDone, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId, answeredOutcome, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
12
13
|
import { needsYou } from "../shared/attention";
|
|
13
14
|
import { age, briefOutlived } from "../shared/inbox";
|
|
14
15
|
import { noReviewReposVersion, onNoReviewRepos } from "../shared/pr-workflow";
|
|
@@ -20,6 +21,7 @@ import { ImageField, useImageAttachments, type ImageAttachments } from "./image-
|
|
|
20
21
|
import { errorText, mootNote } from "../shared/errors";
|
|
21
22
|
import { PRIMARY_FORM } from "./dock";
|
|
22
23
|
import { QuestionContextBlock } from "./question-context";
|
|
24
|
+
import { QuestionBody } from "./questions";
|
|
23
25
|
import { OTHER, OTHER_LABEL, OWN_ANSWER_HINT, briefAnswerStatus, isDoneOnly, isOpen, isOther, TASK_DONE, type Question } from "../shared/questions";
|
|
24
26
|
import type { ListQuestion, ListWorkspace } from "../shared/list";
|
|
25
27
|
import { useDetailGate, useWorkspace } from "./workspace-data";
|
|
@@ -28,7 +30,8 @@ import { PrLinksProvider, RichText } from "./rich-text";
|
|
|
28
30
|
import { useMergeButtons } from "./merge-button";
|
|
29
31
|
import { useReviewerButtons } from "./reviewers-button";
|
|
30
32
|
import { prLinksByNumber } from "../shared/presentation";
|
|
31
|
-
import {
|
|
33
|
+
import { clearDraft, getDraft, setDraft, useDrafts } from "./question-draft";
|
|
34
|
+
import { decisionDraftKey, questionDraftKey } from "../shared/question-draft";
|
|
32
35
|
import { PrSheet } from "./pr-sheet";
|
|
33
36
|
import { disabledPrimary, isLight, withAlpha, type Colors } from "./theme";
|
|
34
37
|
import { dismissToast, notice, runAction, runUndoable } from "./toasts";
|
|
@@ -83,21 +86,29 @@ function Btn({ label, icon, primary, onPress, c, compact, disabled, shortcut = f
|
|
|
83
86
|
</Pressable>;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
|
|
89
|
+
/**
|
|
90
|
+
* The card's picks, Something else's words and notes live in the one draft store (client/question-draft.ts,
|
|
91
|
+
* an-answer-in-progress-is-never-lost): a decision that is a tracked question shares its draft with every other surface
|
|
92
|
+
* showing that question (the view's Needs you, Home, the pill), keyed by the question; a brief-only decision is keyed by
|
|
93
|
+
* the brief. The one text field is Something else's answer once Something else is picked, else the note.
|
|
94
|
+
*/
|
|
95
|
+
type Where = { workspaceId?: string | null; agentId: string };
|
|
96
|
+
const draftKeyOf = (b: Pick<Brief, "id" | "questionIds">, where: Where, decisionId: string) =>
|
|
97
|
+
where.workspaceId && b.questionIds.includes(decisionId) ? questionDraftKey(where.workspaceId, decisionId) : decisionDraftKey(where.workspaceId ?? where.agentId, b.id, decisionId);
|
|
98
|
+
function cardDrafts(b: Pick<Brief, "id" | "questionIds" | "decisions">, where: Where) {
|
|
99
|
+
const picks: Record<string, string> = {}, words: Record<string, string> = {}, notes: Record<string, string> = {}, notesOpen: Record<string, string> = {};
|
|
100
|
+
for (const d of b.decisions) {
|
|
101
|
+
const k = getDraft(draftKeyOf(b, where, d.id)); if (!k) continue;
|
|
102
|
+
if (k.choice) picks[d.id] = k.choice;
|
|
103
|
+
if (isOther(k.choice)) { if (k.words) words[d.id] = k.words; }
|
|
104
|
+
else { if (k.words) notes[d.id] = k.words; if (k.noteOpen) notesOpen[d.id] = "1"; }
|
|
105
|
+
}
|
|
106
|
+
return { picks, words, notes, notesOpen };
|
|
107
|
+
}
|
|
95
108
|
/** A sent answer leaves nothing behind on the card: picks, Something else's words and notes. */
|
|
96
|
-
const clearCard = (
|
|
97
|
-
const useWords = (briefId: string) => useSyncExternalStore(wordStore.subscribe, () => wordStore.get(briefId), () => wordStore.get(briefId));
|
|
109
|
+
const clearCard = (b: Pick<Brief, "id" | "questionIds" | "decisions">, where: Where) => { for (const d of b.decisions) clearDraft(draftKeyOf(b, where, d.id)); };
|
|
98
110
|
/** Picks that can be sent: Something else counts only once it has words. */
|
|
99
111
|
const ready = (picks: Record<string, string>, words: Record<string, string>) => Object.fromEntries(Object.entries(picks).filter(([id, c]) => !isOther(c) || !!words[id]?.trim()));
|
|
100
|
-
const usePicks = (briefId: string) => useSyncExternalStore(pickStore.subscribe, () => pickStore.get(briefId), () => pickStore.get(briefId));
|
|
101
112
|
|
|
102
113
|
/**
|
|
103
114
|
* One option. `send` answers on tap (a single-decision card); `select` marks it as this decision's pick (a card with
|
|
@@ -186,7 +197,7 @@ export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks,
|
|
|
186
197
|
b: Brief; c: Colors; compact: boolean; tight: boolean; embedded: boolean; height: number;
|
|
187
198
|
mode: "send" | "select" | "readonly"; picks: Record<string, string>; onPick: (decisionId: string, letter: string) => void; busy: string | null; onSend?: (key: string) => void;
|
|
188
199
|
words?: Record<string, string>; onWords?: (decisionId: string, text: string) => void; onSendOther?: (decisionId: string) => void;
|
|
189
|
-
/** Notes on lettered picks, and which decisions have the note field open (client/
|
|
200
|
+
/** Notes on lettered picks, and which decisions have the note field open (client/question-draft.ts: they survive a remount and a reload). */
|
|
190
201
|
notes?: Record<string, string>; notesOpen?: Record<string, string>; onNote?: (decisionId: string, text: string) => void; onNoteOpen?: (decisionId: string, open: boolean) => void;
|
|
191
202
|
}) {
|
|
192
203
|
const [open, setOpen] = useState<Record<string, boolean>>({});
|
|
@@ -388,7 +399,12 @@ function Past({ b, c, now, compact, height, pending = false, onResend, resending
|
|
|
388
399
|
</View>;
|
|
389
400
|
}
|
|
390
401
|
|
|
391
|
-
/**
|
|
402
|
+
/**
|
|
403
|
+
* `embedded`: inside a pane with its own reply box (Home's detail pane, Catch up, the Overseer's pane): "Reply below.",
|
|
404
|
+
* no outer margin. It never takes the card's moves: one ask has the same buttons on every surface (invariant 249).
|
|
405
|
+
* 2026-12-03: Home's pane and Catch up passed `embedded`, left from before Home drew the workspace view, and dropped every
|
|
406
|
+
* move: an Action card there had no Done while the tab's and the chat's had one.
|
|
407
|
+
*/
|
|
392
408
|
/** `snoozed`: the row is in Later, so the card wears the row's muted tone and says "Later" instead of "Needs you". */
|
|
393
409
|
/** `bare`: a section of the Needs you block (client/needs-you.tsx), whose frame says "Needs you": no border, margin or second label. */
|
|
394
410
|
type BriefCardProps = PluginTimelineItemProps<Brief> & { deps: BriefDeps; embedded?: boolean; snoozed?: boolean; bare?: boolean; /** After its x is pressed (Catch up moves on). */ onDismissed?: () => void };
|
|
@@ -428,7 +444,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
428
444
|
const act = useRpc(briefActionRpc);
|
|
429
445
|
const answerQuestion = useRpc(answerQuestionRpc);
|
|
430
446
|
// Pasted images on the answer or the note (every-agent-field-takes-images): they ride the answer to the brief's agent.
|
|
431
|
-
const img = useImageAttachments({ target: { kind: "agent", agentId } });
|
|
447
|
+
const img = useImageAttachments({ target: { kind: "agent", agentId }, draft: b.decisions.length === 1 ? draftKeyOf(b, { workspaceId: row.workspaceId, agentId }, b.decisions[0].id) : `brief:${row.workspaceId ?? agentId}:${b.id}` });
|
|
432
448
|
const withImages = () => { const images = img.uploads(); return images ? { images } : {}; };
|
|
433
449
|
const browserRead = useRpc(browserStatusRpc);
|
|
434
450
|
const [sending, setBusy] = useState<string | null>(null);
|
|
@@ -443,10 +459,15 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
443
459
|
// A brief-only decision answered from this card: drawn answered at once, until the server's answered brief replaces it.
|
|
444
460
|
const [answering, setAnswering] = useState<Brief | null>(null);
|
|
445
461
|
const dismiss = useDismiss();
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
const notes =
|
|
449
|
-
|
|
462
|
+
const where = { workspaceId: row.workspaceId, agentId };
|
|
463
|
+
useDrafts(b.decisions.map(d => draftKeyOf(b, where, d.id)));
|
|
464
|
+
const { picks, words, notes, notesOpen } = cardDrafts(b, where);
|
|
465
|
+
// A brief that's no longer open, or a decision whose question was answered, withdrawn or removed: its draft goes.
|
|
466
|
+
const settled = b.state !== "open" ? b.decisions.map(d => d.id) : b.decisions.filter(d => { const q = workspace?.questions.find(x => x.id === d.id && b.questionIds.includes(d.id)); return !!q && !isOpen(q); }).map(d => d.id);
|
|
467
|
+
useEffect(() => { for (const id of settled) clearDraft(draftKeyOf(b, where, id)); }, [settled.join(","), b.id, row.workspaceId, agentId]);
|
|
468
|
+
const keyOf = (decisionId: string) => draftKeyOf(b, where, decisionId);
|
|
469
|
+
// Picking the picked letter again clears it, so a decision can be skipped on a multi-decision card.
|
|
470
|
+
const pick = (decisionId: string, letter: string) => setDraft(keyOf(decisionId), { choice: getDraft(keyOf(decisionId))?.choice === letter ? null : letter });
|
|
450
471
|
const [sheet, setSheet] = useKept<{ key: string; intent: "merge" | "reviewers" } | null>(`brief:${b.id}:sheet`, null);
|
|
451
472
|
// The PR sheet draws review and deploy detail the list form leaves out: one read of the full workspace while it's open.
|
|
452
473
|
const detail = useWorkspace(undefined, row.workspaceId ?? "", { enabled: !!sheet });
|
|
@@ -461,6 +482,14 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
461
482
|
// An add-reviewers card for a PR the agent merges itself isn't an ask: gone the moment the repository flips to No
|
|
462
483
|
// review, back on Undo (invariant a-no-review-repo-never-asks-for-review-or-merge).
|
|
463
484
|
if (b.state === "open" && !liveBrief(b)) return null;
|
|
485
|
+
// F7: "Nothing needed" is one muted line, no buttons, in every state (quietDone, a-done-card-is-never-answered):
|
|
486
|
+
// a done brief asked nothing, so it never becomes a closed card. Paseo's own running and idle state says the rest.
|
|
487
|
+
if (quietDone(b)) return <View accessibilityRole="summary" accessibilityLabel={nothingNeededLine(b.ask)}
|
|
488
|
+
style={{ marginVertical: 6, flexDirection: "row", alignItems: "center", gap: 8, minHeight: 28, paddingHorizontal: 4 }}>
|
|
489
|
+
<Icon name="Check" size={13} color={c.foregroundMuted} />
|
|
490
|
+
<RichText linkColor={c.foreground} numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>{nothingNeededLine(b.ask)}</RichText>
|
|
491
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{age(b.at, now)}</Text>
|
|
492
|
+
</View>;
|
|
464
493
|
if (shown.brief.state !== "open") return <Past b={shown.brief} c={c} now={now} compact={compact} height={height} onResend={b.answerId ? resend : undefined} resending={sending === "resend"} questions={workspace?.questions} workspace={workspace} />;
|
|
465
494
|
// Muted until the send lands: the server's answered brief then replaces this, green.
|
|
466
495
|
if (marked) return <Past b={{ ...b, state: "answered", outcome: "Done", outcomeAt: marked }} pending={!sent} c={c} now={now} compact={compact} height={height} />;
|
|
@@ -535,14 +564,6 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
535
564
|
// A decision brief that folded into an action card still gets the card's one Done, first.
|
|
536
565
|
const moves: BriefMove[] = doneQ && !tracked.some(m => m.kind === "done") ? [{ kind: "done", label: "Done", prKey: null, url: null, agentId: null }, ...tracked] : tracked;
|
|
537
566
|
|
|
538
|
-
// F7: "Nothing needed" is one muted line, no buttons. Paseo's own running and idle state says the rest.
|
|
539
|
-
if (b.kind === "done" && b.source === "agent" && !b.flagged) return <View accessibilityRole="summary" accessibilityLabel={nothingNeededLine(b.ask)}
|
|
540
|
-
style={{ marginVertical: 6, flexDirection: "row", alignItems: "center", gap: 8, minHeight: 28, paddingHorizontal: 4 }}>
|
|
541
|
-
<Icon name="Check" size={13} color={c.foregroundMuted} />
|
|
542
|
-
<RichText linkColor={c.foreground} numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>{nothingNeededLine(b.ask)}</RichText>
|
|
543
|
-
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{ageText}</Text>
|
|
544
|
-
</View>;
|
|
545
|
-
|
|
546
567
|
if (b.slim) {
|
|
547
568
|
// Permission: Paseo's own prompt below is the control (F9). Fallback: the paragraph is right above.
|
|
548
569
|
// The label and age share the top line so the ask always gets the full width; at a narrow panel the move wraps under it.
|
|
@@ -559,7 +580,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
559
580
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 10, rowGap: 8 }}>
|
|
560
581
|
<RichText numberOfLines={3} tooltip={askText}
|
|
561
582
|
style={{ flexGrow: 1, flexShrink: 1, flexBasis: 200, minWidth: 0, color: acts ? c.foreground : c.foregroundMuted, fontSize: 14, lineHeight: 20, fontWeight: acts ? "600" : "400" }}>{askText}</RichText>
|
|
562
|
-
{
|
|
583
|
+
{moves.map(m => <Btn key={m.kind} label={moveLabel(m)} icon={moveIcon(m)} disabled={moveOff(m)} onPress={() => press(m)} c={c} compact={compact} hint={MOVE_HINT[m.kind]} />)}
|
|
563
584
|
</View>
|
|
564
585
|
{!!error && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
565
586
|
{!!mergeWhy && <Text accessibilityRole="alert" style={{ color: c.statusWarning, fontSize: 13, lineHeight: 18 }}>{mergeWhy}</Text>}
|
|
@@ -569,6 +590,8 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
569
590
|
const tight = isTight(b, compact, height);
|
|
570
591
|
const pad = compact ? 14 : 16;
|
|
571
592
|
const multi = selectsFirst(b);
|
|
593
|
+
// One open question behind a one-decision card: the question block answers it (one-question-block).
|
|
594
|
+
const asked = !multi && b.decisions.length === 1 && workspace && !doneQ ? (() => { const q = decisionQuestion(b, b.decisions[0].id, workspace.questions); return q && isOpen(q) && !isDoneOnly(q) ? q : null; })() : null;
|
|
572
595
|
// One answer path: a decision stored as an open question (the brief points at it) is answered as that question
|
|
573
596
|
// (follow.answer-question), like the panel's, Home's and the pill's; the brief resolves once its questions settle
|
|
574
597
|
// (briefQuestionsEvent). Only a decision with no tracked question goes through the brief's own action.
|
|
@@ -608,16 +631,16 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
608
631
|
void cache.invalidateQueries({ queryKey: liveBriefKey(agentId) }); void cache.invalidateQueries({ queryKey: workspaceKey(wid) });
|
|
609
632
|
};
|
|
610
633
|
// A tap sends the letter, with the note when one is typed; a sent answer clears the card (clearCard).
|
|
611
|
-
const sendOne = (key: string) => { const [decisionId, choice] = key.split(":"); void run(key, async answerId => { await answer(cardPicks({ [decisionId]: choice }, {}, notesOpen[decisionId] ? notes : {}), answerId); clearCard(b
|
|
634
|
+
const sendOne = (key: string) => { const [decisionId, choice] = key.split(":"); void run(key, async answerId => { await answer(cardPicks({ [decisionId]: choice }, {}, notesOpen[decisionId] ? notes : {}), answerId); clearCard(b, where); }); };
|
|
612
635
|
const sendable = ready(picks, words);
|
|
613
636
|
const openNotes = Object.fromEntries(Object.entries(notes).filter(([id]) => notesOpen[id]));
|
|
614
|
-
const sendAll = () => void run("answers", async answerId => { await answer(cardPicks(sendable, words, openNotes), answerId); clearCard(b
|
|
637
|
+
const sendAll = () => void run("answers", async answerId => { await answer(cardPicks(sendable, words, openNotes), answerId); clearCard(b, where); });
|
|
615
638
|
// The keyboard's Send: every pick on a multi-decision card, or a single card's Something else once it has words.
|
|
616
639
|
const otherId = !multi ? askedDecisions(b).find(d => isOther(picks[d.id]))?.id : undefined;
|
|
617
640
|
// one-done-button: on an action card the keyboard sends Done (with its note), as the panel's card does.
|
|
618
641
|
const doneMove = doneQ && !multi && !isOther(picks[doneQ.id]) && moves[0]?.kind === "done" ? moves[0] : null;
|
|
619
642
|
const keySend = multi ? (sendBar(b, sendable).ready ? () => sendAll() : null) : otherId && words[otherId]?.trim() ? () => sendOther(otherId) : doneMove ? () => press(doneMove) : null;
|
|
620
|
-
const sendOther = (decisionId: string) => { const text = words[decisionId]?.trim(); if (text) void run(`${decisionId}:${OTHER}`, async answerId => { await answer([{ decisionId, choice: OTHER, words: text }], answerId); clearCard(b
|
|
643
|
+
const sendOther = (decisionId: string) => { const text = words[decisionId]?.trim(); if (text) void run(`${decisionId}:${OTHER}`, async answerId => { await answer([{ decisionId, choice: OTHER, words: text }], answerId); clearCard(b, where); }); };
|
|
621
644
|
return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you" : flaggedAct ? "Later" : word(b.kind)}: ${askText}`}
|
|
622
645
|
style={[{ marginVertical: embedded ? 0 : 10, borderRadius: 12, borderWidth: 1, borderColor: border, backgroundColor: c.surface1, overflow: "hidden" }, bare && BARE]}>
|
|
623
646
|
<SubmitScope message compact={compact} enabled={!!keySend && !busy} onSubmit={() => keySend?.()} style={{ paddingHorizontal: pad, paddingTop: compact ? 12 : 14, paddingBottom: 14, gap: tight ? 10 : 12 }}>
|
|
@@ -641,18 +664,21 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
641
664
|
<RichText accessibilityRole="header" style={compact || bare ? text(c, compact).ask : { color: c.foreground, fontSize: 19, lineHeight: 26, fontWeight: "600", letterSpacing: -0.2 }}>{askText}</RichText>
|
|
642
665
|
</View>
|
|
643
666
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
667
|
+
{/* one-question-block (invariant 206): a card about one open question draws the question block itself, the same
|
|
668
|
+
component as the workspace view's Needs you, so the two look and behave the same and share one draft. */}
|
|
669
|
+
{asked ? <QuestionBody workspace={workspace!} question={asked} theme={theme} compact={compact} inline dismissAt="host" openAgent={deps.openAgent} />
|
|
670
|
+
: <BriefBody b={b} c={c} compact={compact} tight={tight} embedded={embedded} height={height} mode={multi ? "select" : "send"} picks={picks}
|
|
671
|
+
onPick={(decisionId, letter) => { if (!busy) pick(decisionId, letter); }} busy={busy} onSend={sendOne}
|
|
672
|
+
words={words} onWords={(decisionId, t) => setDraft(keyOf(decisionId), { words: t })} onSendOther={sendOther}
|
|
673
|
+
notes={notes} notesOpen={notesOpen} onNote={(decisionId, t) => setDraft(keyOf(decisionId), { words: t })} onNoteOpen={(decisionId, open) => setDraft(keyOf(decisionId), open ? { noteOpen: true } : { noteOpen: false, words: "" })} doneIds={doneQ ? [doneQ.id] : []} img={img} workspace={workspace} openAgent={deps.openAgent} />}
|
|
648
674
|
|
|
649
675
|
{multi && <SendBar b={b} picks={sendable} noted={notedCount(sendable, openNotes)} busy={busy} error={error} onSend={sendAll} c={c} compact={compact} />}
|
|
650
676
|
|
|
651
|
-
{
|
|
677
|
+
{moves.length > 0 && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, columnGap: 14 }}>
|
|
652
678
|
{moves.map((m, i) => <Btn key={m.kind} shortcut={m === doneMove} label={moveLabel(m)} icon={moveIcon(m)} primary={i === 0 && !multi} disabled={moveOff(m)} onPress={() => press(m)} c={c} compact={compact} hint={MOVE_HINT[m.kind]} />)}
|
|
653
679
|
{/* one-done-button: the quiet choices sit beside Done, never above the context, away from it. */}
|
|
654
|
-
{doneQ && !notesOpen[doneQ.id] && !isOther(picks[doneQ.id]) && <NoteLink icon="MessageSquarePlus" label="Add note" a11y="Add a note, sent with Done" disabled={!!busy} onPress={() =>
|
|
655
|
-
{doneQ && !isOther(picks[doneQ.id]) && <NoteLink icon="Reply" label="Reply instead" a11y="Write a reply instead of Done" disabled={!!busy} onPress={() =>
|
|
680
|
+
{doneQ && !notesOpen[doneQ.id] && !isOther(picks[doneQ.id]) && <NoteLink icon="MessageSquarePlus" label="Add note" a11y="Add a note, sent with Done" disabled={!!busy} onPress={() => setDraft(keyOf(doneQ.id), { noteOpen: true })} c={c} compact={compact} />}
|
|
681
|
+
{doneQ && !isOther(picks[doneQ.id]) && <NoteLink icon="Reply" label="Reply instead" a11y="Write a reply instead of Done" disabled={!!busy} onPress={() => setDraft(keyOf(doneQ.id), { choice: OTHER, noteOpen: false })} c={c} compact={compact} />}
|
|
656
682
|
</View>}
|
|
657
683
|
|
|
658
684
|
{!!error && !multi && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
@@ -674,6 +700,7 @@ const MOVE_HINT: Partial<Record<BriefMove["kind"], string>> = { done: "Tells the
|
|
|
674
700
|
const MOVE_ICON: Record<BriefMove["kind"], string> = { merge: "GitMerge", open_pr: "ExternalLink", sign_off_next: "ArrowRight", retry: "RotateCcw", copy_error: "Copy", open_subagent: "SquareArrowOutUpRight", add_reviewers: "UserPlus", done: "Check" };
|
|
675
701
|
|
|
676
702
|
export function contributeBrief(client: PluginClientContext, deps: BriefDeps) {
|
|
677
|
-
|
|
703
|
+
// Cards in chats off (off-means-fully-off): a card the worker appended before stays in the timeline, drawn as nothing.
|
|
704
|
+
const Component = (props: PluginTimelineItemProps<Brief>) => useChatCardsOn() ? <BriefCard {...props} deps={deps} /> : null;
|
|
678
705
|
return client.addTimelineRenderer({ kind: BRIEF_KIND, version: BRIEF_VERSION, schema: briefSchema, Component });
|
|
679
706
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { PluginClientContext, PluginButtonRegistration } from "@getpaseo/plugin/client";
|
|
2
|
-
import { subscribeDisplay } from "./display";
|
|
2
|
+
import { displayValues, subscribeDisplay } from "./display";
|
|
3
3
|
|
|
4
4
|
export function withButtonVisibility(client: PluginClientContext) {
|
|
5
5
|
const entries = new Set<{ reconcile(): void; remove(): void }>();
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// off-means-fully-off: a Display document read before this subscribed (the last client's kept copy, invariant 213)
|
|
7
|
+
// decides from the first registration, so an off pill or header button never flashes on.
|
|
8
|
+
const known = displayValues();
|
|
9
|
+
let enableHeader = known ? known.enable_header_button !== false : true;
|
|
10
|
+
// Unknown is not off: older saved documents predate the pill preference.
|
|
11
|
+
let enableComposer = known ? known.enable_composer_pill !== false : true;
|
|
8
12
|
function gated<K extends "addHeaderButton" | "addComposerPill">(method: K, input: Parameters<PluginClientContext[K]>[0]): PluginButtonRegistration {
|
|
9
13
|
let descriptor = input.button;
|
|
10
14
|
let registration: PluginButtonRegistration | undefined;
|
package/client/card-data.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createContext, useEffect, useState } from "react";
|
|
2
|
-
import { Image, Platform } from "react-native";
|
|
1
|
+
import { createContext, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Image, Platform, type View } from "react-native";
|
|
3
3
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
5
5
|
import { cardActRpc, cardMediaRpc, cardsRpc } from "../shared/contracts";
|
|
@@ -114,5 +114,27 @@ export function goToCard(workspaceId: string, cardId: string, compact: boolean):
|
|
|
114
114
|
openCardLarge(workspaceId, cardId);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/** A Needs-you question as a place `revealQuestion` scrolls to (the same registry as cards, keyed `question:<id>`). */
|
|
118
|
+
export function useQuestionTarget(workspaceId: string, questionId: string) {
|
|
119
|
+
const ref = useRef<View>(null);
|
|
120
|
+
useEffect(() => registerCard(workspaceId, `question:${questionId}`, { node: ref.current, open: () => undefined }), [workspaceId, questionId]);
|
|
121
|
+
return ref;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Scrolls to a question in a Follow-up view that is opening (a chat's question card, invariant 195): it waits up to
|
|
125
|
+
* `REVEAL_WAIT_MS` for the view to draw it, then scrolls it to the middle (web). Elsewhere the view opening is the move.
|
|
126
|
+
*/
|
|
127
|
+
export const REVEAL_WAIT_MS = 3000;
|
|
128
|
+
export function revealQuestion(workspaceId: string, questionId: string): void {
|
|
129
|
+
if (Platform.OS !== "web") return;
|
|
130
|
+
const started = Date.now();
|
|
131
|
+
const look = () => {
|
|
132
|
+
const on = (mounted.get(key(workspaceId, `question:${questionId}`)) ?? []).map(e => e.node as DomEl | null).find(n => n?.getClientRects?.().length && (n.checkVisibility?.() ?? true));
|
|
133
|
+
if (on?.scrollIntoView) { on.scrollIntoView({ block: "center", behavior: "smooth" }); return; }
|
|
134
|
+
if (Date.now() - started < REVEAL_WAIT_MS) setTimeout(look, 150);
|
|
135
|
+
};
|
|
136
|
+
setTimeout(look, 0);
|
|
137
|
+
}
|
|
138
|
+
|
|
117
139
|
/** The card a screen is showing (Open large): its question's "below" row would point at the card it is docked under, so it skips it. */
|
|
118
140
|
export const CardHere = createContext<string | null>(null);
|
package/client/catch-up.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useText } from "./i18n";
|
|
1
2
|
import { allQuestions } from "../shared/outside-run";
|
|
2
3
|
import { useKept } from "./kept";
|
|
3
4
|
import { floatingScopes } from "../shared/floating";
|
|
@@ -27,7 +28,7 @@ import type { Workspace } from "../shared/model";
|
|
|
27
28
|
import type { ListWorkspace } from "../shared/list";
|
|
28
29
|
import { bottomInset, Button, errorText, focusSoon, IconButton, SubmitScope, text, type Theme } from "./kit";
|
|
29
30
|
import { glyphColor } from "./home-list";
|
|
30
|
-
import { useHomeModel, type HomeSources } from "./home-data";
|
|
31
|
+
import { useArranged, useHomeModel, type HomeSources } from "./home-data";
|
|
31
32
|
import { useInbox } from "./inbox";
|
|
32
33
|
import { QuestionBody, QuestionDismissX, type SendReady } from "./questions";
|
|
33
34
|
import { DismissReveal, useDismiss } from "./dismiss";
|
|
@@ -105,7 +106,10 @@ const askFor = (context: readonly ContextRequest[], card: DeckCard) => contextFo
|
|
|
105
106
|
export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: Theme; compact: boolean; deps: CatchUpDeps; navigation: Nav; onExit: () => void }) {
|
|
106
107
|
const c = theme.colors; const t = text(c, compact);
|
|
107
108
|
const { inbox, live, extras } = deps.sources;
|
|
108
|
-
const
|
|
109
|
+
const homeModel = useHomeModel(deps.sources);
|
|
110
|
+
// The deck deals the rows Home's strip counts: Display's filters applied (useArranged, invariant 249).
|
|
111
|
+
const { arranged } = useArranged(deps.sources, homeModel);
|
|
112
|
+
const model = useMemo(() => ({ ...homeModel, groups: arranged.byGroup }), [homeModel, arranged]);
|
|
109
113
|
const rows = useInbox(inbox, () => inbox.rows());
|
|
110
114
|
const version = useSyncExternalStore(live.subscribe, live.version, live.version);
|
|
111
115
|
const context = useSyncExternalStore(extras.subscribe, extras.context, extras.context);
|
|
@@ -385,6 +389,7 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
385
389
|
request: ContextRequest | null; /** An `answer` card's question (Your questions). */ answer: ContextRequest | null; waiting: boolean; onAsk: (words: string, images?: ImageUpload[]) => Promise<void>;
|
|
386
390
|
sameWorkspace: string[]; onDone: () => void; onSkip: () => void; onSkipWorkspace?: () => void; wsLeft: number; onBack?: () => void; onLater: () => void;
|
|
387
391
|
}) {
|
|
392
|
+
const tr = useText();
|
|
388
393
|
const c = theme.colors; const t = text(c, compact);
|
|
389
394
|
const s = card.s;
|
|
390
395
|
const { workspace: full } = useWorkspace(deps.sources.live, s.workspaceId ?? "");
|
|
@@ -475,7 +480,7 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
475
480
|
: <View style={{ gap: 10 }}>
|
|
476
481
|
<Text style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || "The agent finished its turn."}</Text>
|
|
477
482
|
<Text style={t.meta}>Nothing to decide. Sign it off once you've read it, or reply.</Text>
|
|
478
|
-
<View style={{ flexDirection: "row", gap: 8 }}><Button theme={theme} compact={compact} grow={compact} kind="primary" icon="Check" title="
|
|
483
|
+
<View style={{ flexDirection: "row", gap: 8 }}><Button theme={theme} compact={compact} grow={compact} kind="primary" icon="Check" title={tr("moves.signOff")} onPress={() => { if (s.agentId) void deps.sources.inbox.signOff([s.agentId]); onDone(); }} /></View>
|
|
479
484
|
</View>;
|
|
480
485
|
|
|
481
486
|
// Add context without answering: every card that isn't a question has the agent's reply box (a question has its note).
|
|
@@ -486,10 +491,10 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
486
491
|
const closeMore = () => { setMore(false); if (!compact) focusSoon("catch-up-more"); };
|
|
487
492
|
const moreBlock = more && <MorePanel theme={theme} compact={compact} onClose={closeMore} onAsk={onAsk} target={s.workspaceId ? { kind: "workspace", workspaceId: s.workspaceId } : s.agentId ? { kind: "agent", agentId: s.agentId } : null} />;
|
|
488
493
|
const later = (until: string) => { setLaterOpen(false); if (s.agentId) void deps.sources.inbox.snooze([s.agentId], until); onLater(); };
|
|
489
|
-
const laterBlock = laterOpen && <View {...({ dataSet: { catchUpLater: "1" } } as object)} accessibilityRole="menu" accessibilityLabel="
|
|
490
|
-
<Text style={[t.small, { fontWeight: "600" }]}>
|
|
494
|
+
const laterBlock = laterOpen && <View {...({ dataSet: { catchUpLater: "1" } } as object)} accessibilityRole="menu" accessibilityLabel={tr("moves.later")} style={{ gap: 8 }}>
|
|
495
|
+
<Text style={[t.small, { fontWeight: "600" }]}>{tr("moves.laterBack")}</Text>
|
|
491
496
|
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
492
|
-
{laterChoices(new Date()).map(([k, label]) => <Button key={k} theme={theme} compact={compact} kind="ghost" icon="AlarmClock" title={label} onPress={() => later(snoozeUntil(k, new Date()))} />)}
|
|
497
|
+
{laterChoices(new Date(), tr).map(([k, label]) => <Button key={k} theme={theme} compact={compact} kind="ghost" icon="AlarmClock" title={label} onPress={() => later(snoozeUntil(k, new Date()))} />)}
|
|
493
498
|
</View>
|
|
494
499
|
</View>;
|
|
495
500
|
const toggleMore = () => { setLaterOpen(false); setMore(v => !v); };
|
|
@@ -510,8 +515,8 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
510
515
|
: <IconButton theme={theme} icon="ChevronLeft" label="Back (K or ←)" tooltip disabled={!onBack} onPress={() => onBack?.()} />}
|
|
511
516
|
{isAnswer ? null : compact ? <DockMove theme={theme} icon="Sparkles" caption="Context" label="More context" onPress={toggleMore} />
|
|
512
517
|
: <View>{popover(moreBlock, "More context", 560)}<Tip label="More context (M)"><Button theme={theme} icon="Sparkles" title="More context" accessibilityHint="M" nativeID="catch-up-more" onPress={toggleMore} /></Tip></View>}
|
|
513
|
-
{compact ? <DockMove theme={theme} icon="AlarmClock" caption="
|
|
514
|
-
: <View>{popover(laterBlock, "
|
|
518
|
+
{compact ? <DockMove theme={theme} icon="AlarmClock" caption={tr("moves.later")} label={tr("moves.later")} disabled={!s.agentId} onPress={toggleLater} />
|
|
519
|
+
: <View>{popover(laterBlock, tr("moves.later"), 380)}<IconButton theme={theme} icon="AlarmClock" label={tr("moves.laterKey")} tooltip disabled={!s.agentId} onPress={toggleLater} /></View>}
|
|
515
520
|
{compact ? <DockMove theme={theme} icon="MessageSquare" caption="Chat" label="Open chat" disabled={!navigation} onPress={openChat} />
|
|
516
521
|
: <IconButton theme={theme} icon="MessageSquare" label="Open chat (O)" tooltip disabled={!navigation} onPress={openChat} />}
|
|
517
522
|
{!compact && <View style={{ flex: 1 }} />}
|
|
@@ -531,7 +536,7 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
531
536
|
return <DockedPane compact={compact}
|
|
532
537
|
contentContainerStyle={{ padding: compact ? 16 : 28, gap: compact ? 16 : 18, ...(compact ? {} : { maxWidth: 720, width: "100%", alignSelf: "center" }) }}
|
|
533
538
|
dock={({ yields, typingInContent }) => compact && (sheet && !typingInContent || !yields) && <View style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
|
|
534
|
-
{sheet && !typingInContent && <MoveResult place="sheet" theme={theme} label={moreBlock ? "More context" : "
|
|
539
|
+
{sheet && !typingInContent && <MoveResult place="sheet" theme={theme} label={moreBlock ? "More context" : tr("moves.later")}>{sheet}</MoveResult>}
|
|
535
540
|
{!yields && moves}
|
|
536
541
|
</View>}>
|
|
537
542
|
{goneBanner}
|
|
@@ -648,10 +653,11 @@ function DockMove({ theme, icon, caption, label, disabled = false, onPress }: {
|
|
|
648
653
|
</Pressable>;
|
|
649
654
|
}
|
|
650
655
|
|
|
651
|
-
export function CatchUpButton({ theme, compact, count, onPress }: { theme: Theme; compact: boolean; count: number; onPress: () => void }): ReactNode {
|
|
656
|
+
export function CatchUpButton({ theme, compact, count, onPress, plain = false }: { theme: Theme; compact: boolean; count: number; onPress: () => void; plain?: boolean }): ReactNode {
|
|
652
657
|
if (!count) return null;
|
|
653
|
-
|
|
654
|
-
const
|
|
658
|
+
// plain: the morning brief's, beside a list that counts something else (MODE.buttonPlain).
|
|
659
|
+
const label = plain ? MODE.buttonPlainLabel : MODE.buttonLabel(count);
|
|
660
|
+
const button = <Button theme={theme} compact={compact} grow={compact} kind="primary" icon="Layers" title={plain ? MODE.buttonPlain : MODE.button(count)} accessibilityLabel={label} onPress={onPress} />;
|
|
655
661
|
return Platform.OS === "web" && !compact ? <View {...({ dataSet: { tooltip: label }, title: label } as object)}>{button}</View> : button;
|
|
656
662
|
}
|
|
657
663
|
|