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.
Files changed (148) hide show
  1. package/README.md +35 -17
  2. package/client/about.tsx +8 -2
  3. package/client/agents.tsx +1 -1
  4. package/client/brief-since.tsx +13 -7
  5. package/client/brief.tsx +61 -39
  6. package/client/button-visibility.ts +7 -3
  7. package/client/card-data.ts +24 -2
  8. package/client/catch-up.tsx +13 -10
  9. package/client/chat.tsx +15 -4
  10. package/client/created.tsx +15 -34
  11. package/client/daily-brief.tsx +83 -0
  12. package/client/dismiss.tsx +21 -6
  13. package/client/display.tsx +64 -38
  14. package/client/floating-surface.tsx +2 -1
  15. package/client/home-chrome.tsx +33 -9
  16. package/client/home-data.ts +18 -4
  17. package/client/home-list.tsx +80 -25
  18. package/client/home-view.ts +38 -3
  19. package/client/home.tsx +77 -48
  20. package/client/i18n.tsx +45 -0
  21. package/client/inbox-store.ts +34 -4
  22. package/client/inbox.tsx +19 -5
  23. package/client/install-scope.ts +80 -0
  24. package/client/job-rows.tsx +11 -4
  25. package/client/kit.tsx +11 -4
  26. package/client/last-known.ts +70 -0
  27. package/client/live.tsx +29 -14
  28. package/client/moments.tsx +66 -0
  29. package/client/more-context.tsx +19 -3
  30. package/client/motion.tsx +25 -2
  31. package/client/move-testids.ts +6 -0
  32. package/client/needs-you.tsx +15 -10
  33. package/client/onboarding-read.ts +12 -0
  34. package/client/onboarding.tsx +97 -152
  35. package/client/panel.tsx +37 -1
  36. package/client/pending-removals.ts +45 -0
  37. package/client/pill.tsx +16 -11
  38. package/client/pr-controls.tsx +6 -1
  39. package/client/pr-sheet.tsx +72 -3
  40. package/client/question-context.tsx +30 -18
  41. package/client/question-draft.ts +117 -0
  42. package/client/questions.tsx +193 -81
  43. package/client/release-notes.tsx +8 -7
  44. package/client/review-mode.tsx +2 -2
  45. package/client/row-actions.ts +30 -8
  46. package/client/row-chips.tsx +246 -0
  47. package/client/search-focus.ts +24 -4
  48. package/client/search-key.ts +8 -4
  49. package/client/settings.tsx +3 -3
  50. package/client/setup-gate.tsx +28 -4
  51. package/client/setup-ui.ts +10 -3
  52. package/client/shipping.tsx +23 -6
  53. package/client/shown-cards.tsx +18 -10
  54. package/client/sidebar-view.tsx +19 -4
  55. package/client/stacks.tsx +2 -1
  56. package/client/timeline-card.tsx +54 -0
  57. package/client/toast-store.ts +22 -7
  58. package/client/toasts.tsx +2 -2
  59. package/client/turn-view.tsx +68 -10
  60. package/client/updates.tsx +2 -0
  61. package/client/view-at.ts +19 -0
  62. package/client/view-r-header.tsx +155 -0
  63. package/client/view-r.tsx +715 -0
  64. package/client/workspace-data.ts +7 -1
  65. package/index.client.tsx +42 -7
  66. package/index.server.ts +117 -31
  67. package/package.json +2 -1
  68. package/scripts/inline.mjs +22 -8
  69. package/server/about.ts +30 -4
  70. package/server/agent-actions.ts +71 -18
  71. package/server/agent-hook.mjs +24 -6
  72. package/server/agent-hooks.ts +29 -0
  73. package/server/agent-parity.ts +7 -3
  74. package/server/ai-jobs.ts +44 -10
  75. package/server/ask.ts +2 -2
  76. package/server/brief-sources.ts +5 -5
  77. package/server/brief-timeline.ts +9 -1
  78. package/server/compass.ts +4 -1
  79. package/server/daemon-endpoint/index.d.mts +24 -0
  80. package/server/daemon-endpoint/index.mjs +145 -0
  81. package/{shared → server}/daemon-url.d.mts +3 -1
  82. package/server/daemon-url.mjs +48 -0
  83. package/server/daemon.ts +5 -4
  84. package/server/discovery.ts +3 -3
  85. package/server/engine.ts +57 -8
  86. package/server/github.ts +7 -3
  87. package/server/hook-source.ts +72 -35
  88. package/server/inbox.ts +65 -6
  89. package/server/mcp-source.ts +252 -81
  90. package/server/mcp.mjs +33 -36
  91. package/server/message-queue.ts +5 -0
  92. package/server/onboarding.ts +16 -3
  93. package/server/pr-actions.ts +3 -0
  94. package/server/pr-workflow.ts +9 -6
  95. package/server/ranker.ts +29 -8
  96. package/server/rename.ts +1 -1
  97. package/server/tasks.ts +17 -4
  98. package/server/turn-end.ts +17 -0
  99. package/server/turn-events.ts +2 -2
  100. package/server/turn-usage.ts +47 -0
  101. package/server/update-watchdog-source.ts +174 -18
  102. package/server/update-watchdog.mjs +3 -2
  103. package/server/usage-record.ts +69 -0
  104. package/server/wait-jobs.ts +11 -8
  105. package/shared/about.ts +2 -1
  106. package/shared/agent-settings.ts +10 -1
  107. package/shared/agent-text.d.mts +5 -1
  108. package/shared/agent-text.mjs +48 -29
  109. package/shared/attention.ts +29 -19
  110. package/shared/brief-sources.ts +6 -3
  111. package/shared/brief.ts +35 -4
  112. package/shared/catch-up.ts +6 -0
  113. package/shared/chat.ts +30 -22
  114. package/shared/contracts.ts +24 -6
  115. package/shared/daily-brief.ts +184 -0
  116. package/shared/display.ts +34 -2
  117. package/shared/errors.ts +3 -1
  118. package/shared/headline.ts +6 -2
  119. package/shared/home.ts +70 -12
  120. package/shared/i18n.ts +224 -0
  121. package/shared/inbox.ts +46 -5
  122. package/shared/job-rows.ts +7 -4
  123. package/shared/last-known.ts +63 -0
  124. package/shared/model.ts +28 -1
  125. package/shared/moments.ts +166 -0
  126. package/shared/onboarding.ts +77 -67
  127. package/shared/optimistic-removals.ts +145 -0
  128. package/shared/peek.ts +26 -1
  129. package/shared/pr-workflow.ts +64 -4
  130. package/shared/question-draft.ts +60 -0
  131. package/shared/questions.ts +21 -1
  132. package/shared/row-chips.ts +167 -0
  133. package/shared/row-menu.ts +26 -13
  134. package/shared/search-focus.ts +34 -2
  135. package/shared/search-key.ts +10 -0
  136. package/shared/send-decision.ts +32 -2
  137. package/shared/settings-nav.ts +1 -1
  138. package/shared/settings.ts +11 -0
  139. package/shared/setup-popup.ts +10 -3
  140. package/shared/spin.ts +17 -0
  141. package/shared/status-invariants.ts +187 -5
  142. package/shared/status.ts +21 -4
  143. package/shared/task-status.ts +23 -1
  144. package/shared/task-view.ts +1 -1
  145. package/shared/usage-record.ts +84 -0
  146. package/shared/view-r.ts +173 -0
  147. package/client/card-store.ts +0 -21
  148. 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 two-minute setup walks you through the rest.
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, and the Linear
35
- issues, Slack threads and docs it's about. It's on Home, or always open as Paseo's sidebar.
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
- <picture>
38
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-sidebar-dark.png">
39
- <img alt="Follow-up as Paseo's sidebar: workspaces grouped by what they need from you, beside the selected workspace's chat" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-frame-sidebar-light.png">
40
- </picture>
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. After it, the tasks an agent recorded come due when the PR merges, when it's deployed, or a set number of
46
- days later, and go back to the agent that owns them: verify it in production, reply in the Slack thread once it's
47
- live, check the numbers again next week. Work isn't done when the agent stops, or even when the PR merges. Merging
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 Helper agents step (client/job-rows.tsx), plus each row's More with
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
  */
@@ -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
- {actions.slice(0, 2).map(a => <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)} />)}
94
- <Pressable accessibilityRole="button" accessibilityLabel={`More ways to start ${source} in ${NEW_NAME}`} onPress={() => openNew({ source })}
95
- 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) })}>
96
- <Icon name="Ellipsis" size={16} color={c.foreground} />
97
- </Pressable>
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 { cardStore } from "./card-store";
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
- /** Picks on a multi-decision card (client/card-store.ts): a pick made in one copy of the card shows in the others. */
87
- const pickStore = cardStore(true);
88
- /** Something else's words, per decision, shared the same way so a half-written answer survives a re-render elsewhere. */
89
- const wordStore = cardStore(false);
90
- /** A note on a lettered pick ("A, but…"), per decision, and whether its field is open; kept like the words. */
91
- const noteStore = cardStore(false);
92
- const noteOpenStore = cardStore(false);
93
- const useNotes = (briefId: string) => useSyncExternalStore(noteStore.subscribe, () => noteStore.get(briefId), () => noteStore.get(briefId));
94
- const useNotesOpen = (briefId: string) => useSyncExternalStore(noteOpenStore.subscribe, () => noteOpenStore.get(briefId), () => noteOpenStore.get(briefId));
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 = (briefId: string) => { pickStore.clear(briefId); wordStore.clear(briefId); noteStore.clear(briefId); noteOpenStore.clear(briefId); };
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/card-store.ts: they survive re-renders). */
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 picks = usePicks(b.id);
447
- const words = useWords(b.id);
448
- const notes = useNotes(b.id);
449
- const notesOpen = useNotesOpen(b.id);
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.id); }); };
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.id); });
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.id); }); };
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
- <BriefBody b={b} c={c} compact={compact} tight={tight} embedded={embedded} height={height} mode={multi ? "select" : "send"} picks={picks}
645
- onPick={(decisionId, letter) => { if (!busy) pickStore.set(b.id, decisionId, letter); }} busy={busy} onSend={sendOne}
646
- words={words} onWords={(decisionId, t) => wordStore.set(b.id, decisionId, t)} onSendOther={sendOther}
647
- notes={notes} notesOpen={notesOpen} onNote={(decisionId, t) => noteStore.set(b.id, decisionId, t)} onNoteOpen={(decisionId, open) => noteOpenStore.set(b.id, decisionId, open ? "1" : "")} doneIds={doneQ ? [doneQ.id] : []} img={img} workspace={workspace} openAgent={deps.openAgent} />
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={() => noteOpenStore.set(b.id, doneQ.id, "1")} c={c} compact={compact} />}
655
- {doneQ && !isOther(picks[doneQ.id]) && <NoteLink icon="Reply" label="Reply instead" a11y="Write a reply instead of Done" disabled={!!busy} onPress={() => pickStore.set(b.id, doneQ.id, OTHER)} c={c} compact={compact} />}
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
- const Component = (props: PluginTimelineItemProps<Brief>) => <BriefCard {...props} deps={deps} />;
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
- let enableHeader = true;
7
- let enableComposer = true;
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;
@@ -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);
@@ -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="Sign off" onPress={() => { if (s.agentId) void deps.sources.inbox.signOff([s.agentId]); onDone(); }} /></View>
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="Later" style={{ gap: 8 }}>
490
- <Text style={[t.small, { fontWeight: "600" }]}>Back in your Needs you</Text>
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="Later" label="Later" disabled={!s.agentId} onPress={toggleLater} />
514
- : <View>{popover(laterBlock, "Later", 380)}<IconButton theme={theme} icon="AlarmClock" label="Later (L)" tooltip disabled={!s.agentId} onPress={toggleLater} /></View>}
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" : "Later"}>{sheet}</MoveResult>}
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
- const label = MODE.buttonLabel(count);
654
- const button = <Button theme={theme} compact={compact} grow={compact} kind="primary" icon="Layers" title={MODE.button(count)} accessibilityLabel={label} onPress={onPress} />;
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, followTimelineItem, parseBatchPrompt, toolRowSchema, type AnswerCard, type BatchCard, type ToolRow } from "../shared/chat";
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 a question asked leave the group. See TOOL_PRESENTATION.
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
- const row = followTimelineItem(item, moments);
163
- if (row) return { items: [{ type: "plugin" as const, kind: TOOL_KIND, version: 1, data: row }] };
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);