paseo-follow-up 2.6.0 → 2.7.0-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/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 +61 -39
- package/client/button-visibility.ts +7 -3
- package/client/card-data.ts +24 -2
- package/client/catch-up.tsx +13 -10
- 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 +33 -9
- package/client/home-data.ts +18 -4
- package/client/home-list.tsx +80 -25
- package/client/home-view.ts +38 -3
- package/client/home.tsx +77 -48
- 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 +29 -14
- 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 +15 -10
- package/client/onboarding-read.ts +12 -0
- package/client/onboarding.tsx +97 -152
- package/client/panel.tsx +37 -1
- package/client/pending-removals.ts +45 -0
- package/client/pill.tsx +16 -11
- 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 +19 -4
- 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 +68 -10
- 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 +715 -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 +71 -18
- 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/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 +29 -19
- package/shared/brief-sources.ts +6 -3
- package/shared/brief.ts +35 -4
- package/shared/catch-up.ts +6 -0
- 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 +6 -2
- package/shared/home.ts +70 -12
- package/shared/i18n.ts +224 -0
- package/shared/inbox.ts +46 -5
- package/shared/job-rows.ts +7 -4
- package/shared/last-known.ts +63 -0
- package/shared/model.ts +28 -1
- package/shared/moments.ts +166 -0
- 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 +187 -5
- package/shared/status.ts +21 -4
- package/shared/task-status.ts +23 -1
- package/shared/task-view.ts +1 -1
- package/shared/usage-record.ts +84 -0
- package/shared/view-r.ts +173 -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>>({});
|
|
@@ -428,7 +439,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
428
439
|
const act = useRpc(briefActionRpc);
|
|
429
440
|
const answerQuestion = useRpc(answerQuestionRpc);
|
|
430
441
|
// 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 } });
|
|
442
|
+
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
443
|
const withImages = () => { const images = img.uploads(); return images ? { images } : {}; };
|
|
433
444
|
const browserRead = useRpc(browserStatusRpc);
|
|
434
445
|
const [sending, setBusy] = useState<string | null>(null);
|
|
@@ -443,10 +454,15 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
443
454
|
// A brief-only decision answered from this card: drawn answered at once, until the server's answered brief replaces it.
|
|
444
455
|
const [answering, setAnswering] = useState<Brief | null>(null);
|
|
445
456
|
const dismiss = useDismiss();
|
|
446
|
-
const
|
|
447
|
-
|
|
448
|
-
const notes =
|
|
449
|
-
|
|
457
|
+
const where = { workspaceId: row.workspaceId, agentId };
|
|
458
|
+
useDrafts(b.decisions.map(d => draftKeyOf(b, where, d.id)));
|
|
459
|
+
const { picks, words, notes, notesOpen } = cardDrafts(b, where);
|
|
460
|
+
// A brief that's no longer open, or a decision whose question was answered, withdrawn or removed: its draft goes.
|
|
461
|
+
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);
|
|
462
|
+
useEffect(() => { for (const id of settled) clearDraft(draftKeyOf(b, where, id)); }, [settled.join(","), b.id, row.workspaceId, agentId]);
|
|
463
|
+
const keyOf = (decisionId: string) => draftKeyOf(b, where, decisionId);
|
|
464
|
+
// Picking the picked letter again clears it, so a decision can be skipped on a multi-decision card.
|
|
465
|
+
const pick = (decisionId: string, letter: string) => setDraft(keyOf(decisionId), { choice: getDraft(keyOf(decisionId))?.choice === letter ? null : letter });
|
|
450
466
|
const [sheet, setSheet] = useKept<{ key: string; intent: "merge" | "reviewers" } | null>(`brief:${b.id}:sheet`, null);
|
|
451
467
|
// The PR sheet draws review and deploy detail the list form leaves out: one read of the full workspace while it's open.
|
|
452
468
|
const detail = useWorkspace(undefined, row.workspaceId ?? "", { enabled: !!sheet });
|
|
@@ -461,6 +477,14 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
461
477
|
// An add-reviewers card for a PR the agent merges itself isn't an ask: gone the moment the repository flips to No
|
|
462
478
|
// review, back on Undo (invariant a-no-review-repo-never-asks-for-review-or-merge).
|
|
463
479
|
if (b.state === "open" && !liveBrief(b)) return null;
|
|
480
|
+
// F7: "Nothing needed" is one muted line, no buttons, in every state (quietDone, a-done-card-is-never-answered):
|
|
481
|
+
// a done brief asked nothing, so it never becomes a closed card. Paseo's own running and idle state says the rest.
|
|
482
|
+
if (quietDone(b)) return <View accessibilityRole="summary" accessibilityLabel={nothingNeededLine(b.ask)}
|
|
483
|
+
style={{ marginVertical: 6, flexDirection: "row", alignItems: "center", gap: 8, minHeight: 28, paddingHorizontal: 4 }}>
|
|
484
|
+
<Icon name="Check" size={13} color={c.foregroundMuted} />
|
|
485
|
+
<RichText linkColor={c.foreground} numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>{nothingNeededLine(b.ask)}</RichText>
|
|
486
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{age(b.at, now)}</Text>
|
|
487
|
+
</View>;
|
|
464
488
|
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
489
|
// Muted until the send lands: the server's answered brief then replaces this, green.
|
|
466
490
|
if (marked) return <Past b={{ ...b, state: "answered", outcome: "Done", outcomeAt: marked }} pending={!sent} c={c} now={now} compact={compact} height={height} />;
|
|
@@ -535,14 +559,6 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
535
559
|
// A decision brief that folded into an action card still gets the card's one Done, first.
|
|
536
560
|
const moves: BriefMove[] = doneQ && !tracked.some(m => m.kind === "done") ? [{ kind: "done", label: "Done", prKey: null, url: null, agentId: null }, ...tracked] : tracked;
|
|
537
561
|
|
|
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
562
|
if (b.slim) {
|
|
547
563
|
// Permission: Paseo's own prompt below is the control (F9). Fallback: the paragraph is right above.
|
|
548
564
|
// 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.
|
|
@@ -569,6 +585,8 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
569
585
|
const tight = isTight(b, compact, height);
|
|
570
586
|
const pad = compact ? 14 : 16;
|
|
571
587
|
const multi = selectsFirst(b);
|
|
588
|
+
// One open question behind a one-decision card: the question block answers it (one-question-block).
|
|
589
|
+
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
590
|
// One answer path: a decision stored as an open question (the brief points at it) is answered as that question
|
|
573
591
|
// (follow.answer-question), like the panel's, Home's and the pill's; the brief resolves once its questions settle
|
|
574
592
|
// (briefQuestionsEvent). Only a decision with no tracked question goes through the brief's own action.
|
|
@@ -608,16 +626,16 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
608
626
|
void cache.invalidateQueries({ queryKey: liveBriefKey(agentId) }); void cache.invalidateQueries({ queryKey: workspaceKey(wid) });
|
|
609
627
|
};
|
|
610
628
|
// 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
|
|
629
|
+
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
630
|
const sendable = ready(picks, words);
|
|
613
631
|
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
|
|
632
|
+
const sendAll = () => void run("answers", async answerId => { await answer(cardPicks(sendable, words, openNotes), answerId); clearCard(b, where); });
|
|
615
633
|
// The keyboard's Send: every pick on a multi-decision card, or a single card's Something else once it has words.
|
|
616
634
|
const otherId = !multi ? askedDecisions(b).find(d => isOther(picks[d.id]))?.id : undefined;
|
|
617
635
|
// one-done-button: on an action card the keyboard sends Done (with its note), as the panel's card does.
|
|
618
636
|
const doneMove = doneQ && !multi && !isOther(picks[doneQ.id]) && moves[0]?.kind === "done" ? moves[0] : null;
|
|
619
637
|
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
|
|
638
|
+
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
639
|
return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you" : flaggedAct ? "Later" : word(b.kind)}: ${askText}`}
|
|
622
640
|
style={[{ marginVertical: embedded ? 0 : 10, borderRadius: 12, borderWidth: 1, borderColor: border, backgroundColor: c.surface1, overflow: "hidden" }, bare && BARE]}>
|
|
623
641
|
<SubmitScope message compact={compact} enabled={!!keySend && !busy} onSubmit={() => keySend?.()} style={{ paddingHorizontal: pad, paddingTop: compact ? 12 : 14, paddingBottom: 14, gap: tight ? 10 : 12 }}>
|
|
@@ -641,18 +659,21 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
641
659
|
<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
660
|
</View>
|
|
643
661
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
662
|
+
{/* one-question-block (invariant 206): a card about one open question draws the question block itself, the same
|
|
663
|
+
component as the workspace view's Needs you, so the two look and behave the same and share one draft. */}
|
|
664
|
+
{asked ? <QuestionBody workspace={workspace!} question={asked} theme={theme} compact={compact} inline dismissAt="host" openAgent={deps.openAgent} />
|
|
665
|
+
: <BriefBody b={b} c={c} compact={compact} tight={tight} embedded={embedded} height={height} mode={multi ? "select" : "send"} picks={picks}
|
|
666
|
+
onPick={(decisionId, letter) => { if (!busy) pick(decisionId, letter); }} busy={busy} onSend={sendOne}
|
|
667
|
+
words={words} onWords={(decisionId, t) => setDraft(keyOf(decisionId), { words: t })} onSendOther={sendOther}
|
|
668
|
+
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
669
|
|
|
649
670
|
{multi && <SendBar b={b} picks={sendable} noted={notedCount(sendable, openNotes)} busy={busy} error={error} onSend={sendAll} c={c} compact={compact} />}
|
|
650
671
|
|
|
651
672
|
{!embedded && moves.length > 0 && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, columnGap: 14 }}>
|
|
652
673
|
{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
674
|
{/* 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={() =>
|
|
675
|
+
{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} />}
|
|
676
|
+
{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
677
|
</View>}
|
|
657
678
|
|
|
658
679
|
{!!error && !multi && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
@@ -674,6 +695,7 @@ const MOVE_HINT: Partial<Record<BriefMove["kind"], string>> = { done: "Tells the
|
|
|
674
695
|
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
696
|
|
|
676
697
|
export function contributeBrief(client: PluginClientContext, deps: BriefDeps) {
|
|
677
|
-
|
|
698
|
+
// Cards in chats off (off-means-fully-off): a card the worker appended before stays in the timeline, drawn as nothing.
|
|
699
|
+
const Component = (props: PluginTimelineItemProps<Brief>) => useChatCardsOn() ? <BriefCard {...props} deps={deps} /> : null;
|
|
678
700
|
return client.addTimelineRenderer({ kind: BRIEF_KIND, version: BRIEF_VERSION, schema: briefSchema, Component });
|
|
679
701
|
}
|
|
@@ -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";
|
|
@@ -385,6 +386,7 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
385
386
|
request: ContextRequest | null; /** An `answer` card's question (Your questions). */ answer: ContextRequest | null; waiting: boolean; onAsk: (words: string, images?: ImageUpload[]) => Promise<void>;
|
|
386
387
|
sameWorkspace: string[]; onDone: () => void; onSkip: () => void; onSkipWorkspace?: () => void; wsLeft: number; onBack?: () => void; onLater: () => void;
|
|
387
388
|
}) {
|
|
389
|
+
const tr = useText();
|
|
388
390
|
const c = theme.colors; const t = text(c, compact);
|
|
389
391
|
const s = card.s;
|
|
390
392
|
const { workspace: full } = useWorkspace(deps.sources.live, s.workspaceId ?? "");
|
|
@@ -475,7 +477,7 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
475
477
|
: <View style={{ gap: 10 }}>
|
|
476
478
|
<Text style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || "The agent finished its turn."}</Text>
|
|
477
479
|
<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="
|
|
480
|
+
<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
481
|
</View>;
|
|
480
482
|
|
|
481
483
|
// Add context without answering: every card that isn't a question has the agent's reply box (a question has its note).
|
|
@@ -486,10 +488,10 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
486
488
|
const closeMore = () => { setMore(false); if (!compact) focusSoon("catch-up-more"); };
|
|
487
489
|
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
490
|
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" }]}>
|
|
491
|
+
const laterBlock = laterOpen && <View {...({ dataSet: { catchUpLater: "1" } } as object)} accessibilityRole="menu" accessibilityLabel={tr("moves.later")} style={{ gap: 8 }}>
|
|
492
|
+
<Text style={[t.small, { fontWeight: "600" }]}>{tr("moves.laterBack")}</Text>
|
|
491
493
|
<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()))} />)}
|
|
494
|
+
{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
495
|
</View>
|
|
494
496
|
</View>;
|
|
495
497
|
const toggleMore = () => { setLaterOpen(false); setMore(v => !v); };
|
|
@@ -510,8 +512,8 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
510
512
|
: <IconButton theme={theme} icon="ChevronLeft" label="Back (K or ←)" tooltip disabled={!onBack} onPress={() => onBack?.()} />}
|
|
511
513
|
{isAnswer ? null : compact ? <DockMove theme={theme} icon="Sparkles" caption="Context" label="More context" onPress={toggleMore} />
|
|
512
514
|
: <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, "
|
|
515
|
+
{compact ? <DockMove theme={theme} icon="AlarmClock" caption={tr("moves.later")} label={tr("moves.later")} disabled={!s.agentId} onPress={toggleLater} />
|
|
516
|
+
: <View>{popover(laterBlock, tr("moves.later"), 380)}<IconButton theme={theme} icon="AlarmClock" label={tr("moves.laterKey")} tooltip disabled={!s.agentId} onPress={toggleLater} /></View>}
|
|
515
517
|
{compact ? <DockMove theme={theme} icon="MessageSquare" caption="Chat" label="Open chat" disabled={!navigation} onPress={openChat} />
|
|
516
518
|
: <IconButton theme={theme} icon="MessageSquare" label="Open chat (O)" tooltip disabled={!navigation} onPress={openChat} />}
|
|
517
519
|
{!compact && <View style={{ flex: 1 }} />}
|
|
@@ -531,7 +533,7 @@ function CardViewBody({ card, w, theme, compact, deps, navigation, gone, more, s
|
|
|
531
533
|
return <DockedPane compact={compact}
|
|
532
534
|
contentContainerStyle={{ padding: compact ? 16 : 28, gap: compact ? 16 : 18, ...(compact ? {} : { maxWidth: 720, width: "100%", alignSelf: "center" }) }}
|
|
533
535
|
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" : "
|
|
536
|
+
{sheet && !typingInContent && <MoveResult place="sheet" theme={theme} label={moreBlock ? "More context" : tr("moves.later")}>{sheet}</MoveResult>}
|
|
535
537
|
{!yields && moves}
|
|
536
538
|
</View>}>
|
|
537
539
|
{goneBanner}
|
|
@@ -648,10 +650,11 @@ function DockMove({ theme, icon, caption, label, disabled = false, onPress }: {
|
|
|
648
650
|
</Pressable>;
|
|
649
651
|
}
|
|
650
652
|
|
|
651
|
-
export function CatchUpButton({ theme, compact, count, onPress }: { theme: Theme; compact: boolean; count: number; onPress: () => void }): ReactNode {
|
|
653
|
+
export function CatchUpButton({ theme, compact, count, onPress, plain = false }: { theme: Theme; compact: boolean; count: number; onPress: () => void; plain?: boolean }): ReactNode {
|
|
652
654
|
if (!count) return null;
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
+
// plain: the morning brief's, beside a list that counts something else (MODE.buttonPlain).
|
|
656
|
+
const label = plain ? MODE.buttonPlainLabel : MODE.buttonLabel(count);
|
|
657
|
+
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
658
|
return Platform.OS === "web" && !compact ? <View {...({ dataSet: { tooltip: label }, title: label } as object)}>{button}</View> : button;
|
|
656
659
|
}
|
|
657
660
|
|
package/client/chat.tsx
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
import { chatCardsOn } from "./display";
|
|
2
3
|
import { Platform, View } from "react-native";
|
|
3
4
|
import { Pressable, Text } from "./text";
|
|
4
5
|
import type { PluginClientContext, PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
5
6
|
import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
|
|
6
|
-
import { FOLLOW_TOOL_ICON, answerCardSchema, answerCardWhose, batchCardSchema, createMomentLedger,
|
|
7
|
+
import { FOLLOW_TOOL_ICON, answerCardSchema, answerCardWhose, batchCardSchema, createMomentLedger, parseBatchPrompt, toolRowSchema, type AnswerCard, type BatchCard, type ToolRow } from "../shared/chat";
|
|
7
8
|
import { parseAnswerMessage, parseAnswersMessage } from "../shared/questions";
|
|
8
9
|
import { envelopeParts } from "../shared/queue";
|
|
9
10
|
import { CREATED_KIND, CREATED_VERSION, createdCard } from "../shared/created";
|
|
10
11
|
import { timelineSupported } from "./created";
|
|
12
|
+
import { displayValues } from "./display";
|
|
13
|
+
import { MOMENT_KIND, MOMENT_VERSION, followChatItem } from "../shared/moments";
|
|
11
14
|
import { unconfirmedNote, unconfirmedRefs } from "../shared/status";
|
|
12
15
|
import { Reveal } from "./motion";
|
|
13
16
|
import { tint, withAlpha } from "./theme";
|
|
@@ -155,12 +158,19 @@ export function contributeChat(client: PluginClientContext) {
|
|
|
155
158
|
const moments = createMomentLedger();
|
|
156
159
|
const removers = [
|
|
157
160
|
// Routine bookkeeping stays Paseo's own tool call so it groups with the turn's other calls (a plugin item always
|
|
158
|
-
// seals Paseo's group); only the Done card and
|
|
161
|
+
// seals Paseo's group); only the Done card and the moment cards (shared/moments.ts) leave the group. See TOOL_PRESENTATION.
|
|
159
162
|
client.addTimelineTransformer({
|
|
160
163
|
id: "follow-tool-calls", query: { itemType: "tool_call" },
|
|
161
164
|
transform({ item }) {
|
|
162
|
-
|
|
163
|
-
if (
|
|
165
|
+
// Cards in chats off (off-means-fully-off): Paseo's own rows, moment cards, the Done card and the created card included.
|
|
166
|
+
if (!chatCardsOn()) return undefined;
|
|
167
|
+
// Follow-up's own: a moment card (a card shown, a question asked; client/moments.tsx) or the Done card's row.
|
|
168
|
+
const own = followChatItem(item, moments, displayValues());
|
|
169
|
+
// A follow-on call its moment's card already shows (a re-show, a remove, the reply to a noted question) drops out:
|
|
170
|
+
// an empty list takes it out of Paseo's stream, so its group neither shows nor counts it.
|
|
171
|
+
if (own?.kind === "fold") return { items: [] };
|
|
172
|
+
if (own?.kind === "moment") return { items: [{ type: "plugin" as const, kind: MOMENT_KIND, version: MOMENT_VERSION, data: own.data }] };
|
|
173
|
+
if (own) return { items: [{ type: "plugin" as const, kind: TOOL_KIND, version: 1, data: own.data }] };
|
|
164
174
|
// Paseo's create_agent / create_workspace: the created card (client/created.tsx). A call whose result has no id
|
|
165
175
|
// keeps Paseo's row.
|
|
166
176
|
const card = createdCard(item);
|
|
@@ -170,6 +180,7 @@ export function contributeChat(client: PluginClientContext) {
|
|
|
170
180
|
client.addTimelineTransformer({
|
|
171
181
|
id: "follow-batch-prompts", query: { itemType: "user_message" },
|
|
172
182
|
transform({ item }) {
|
|
183
|
+
if (!chatCardsOn()) return undefined;
|
|
173
184
|
// One message can carry several parts (an answer and the repairs that rode along, shared/queue.ts): a card each,
|
|
174
185
|
// in order. A part no card recognises keeps the whole message as Paseo's plain row.
|
|
175
186
|
const cards = envelopeParts(item.text).map(promptCard);
|