paseo-follow-up 1.4.0-beta.30 → 1.4.0-beta.32

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/OVERVIEW.md CHANGED
@@ -28,7 +28,7 @@ Auto-send ("Send repairs automatically") is on by default for every followed wor
28
28
 
29
29
  ### What agents can do for you
30
30
 
31
- Every root agent Paseo launches (tracked or not) gets Follow-up's action tools: `list_prs`, `add_reviewers`, `merge`, `enable_merge_when_ready`, `disable_merge_when_ready`, `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track`, `inbox_list`, `sign_off`, `snooze`, `set_finish_flags`, `set_priorities`, `set_wait_for_jobs` and the read-only `workspace_about` (a workspace's overview and linked items) and `release_notes` (the installed version and its notes) (external priorities for Home's Priority sort, kept in `plugin-data/follow-through/priorities.json`). Each runs the server path its button runs, with the same guards (tracked workspace, hold, PR eligibility, merge blockers), across every tracked workspace, so an orchestrating agent can act "on all" when you ask it to. Tools that act on a list, and merge, return a dry run and run only with `confirm: true` and that plan's id; merge is marked destructive and the list tools read-only. Inbox tools act on other agents only: an agent can't sign itself off. Recovery agents, contributors and subagents never get them, and the daemon re-checks the caller on each call. Each agent action is kept in the inbox's delivery ledger as `by: "agent:<id>"`; it never counts as you writing to an agent. A sign-off is still a sign-off made on your behalf, so it clears the flag. There is no tool to untrack or archive a workspace, or to put one on hold, because Follow-up has no button for those either.
31
+ Every root agent Paseo launches (tracked or not) gets Follow-up's action tools: `list_prs`, `add_reviewers`, `merge`, `enable_merge_when_ready`, `disable_merge_when_ready`, `send_repairs`, `set_auto_send`, `clear_hold`, `retry_batch`, `track`, `inbox_list`, `sign_off`, `snooze`, `set_finish_flags`, `set_priorities`, `set_wait_for_jobs` and the read-only `workspace_about` (a workspace's overview and linked items) and `release_notes` (the installed version and its notes), `updates_status` and `check_updates` (Settings → General, Check now), with `set_updates` and `install_update` as confirmed plans (external priorities for Home's Priority sort, kept in `plugin-data/follow-through/priorities.json`). Each runs the server path its button runs, with the same guards (tracked workspace, hold, PR eligibility, merge blockers), across every tracked workspace, so an orchestrating agent can act "on all" when you ask it to. Tools that act on a list, and merge, return a dry run and run only with `confirm: true` and that plan's id; merge is marked destructive and the list tools read-only. Inbox tools act on other agents only: an agent can't sign itself off. Recovery agents, contributors and subagents never get them, and the daemon re-checks the caller on each call. Each agent action is kept in the inbox's delivery ledger as `by: "agent:<id>"`; it never counts as you writing to an agent. A sign-off is still a sign-off made on your behalf, so it clears the flag. There is no tool to untrack or archive a workspace, or to put one on hold, because Follow-up has no button for those either.
32
32
 
33
33
  ## Data and access
34
34
 
@@ -54,3 +54,5 @@ The ranker behind AI priority (beta) runs inside Follow-up's worker as bounded o
54
54
  Wait for background jobs (1.4.0-beta.24, folded in from the standalone paseo-wait plugin) attaches `wait_prepare_job`, `wait_for_job` and `wait_get_job` to every interactive Claude session as native plugin tools, with `CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0` in that session's environment (Claude Code then never backgrounds a long MCP call, Wait's or another's) and `FOLLOW_THROUGH_WAIT=1`, which makes the provider hook add Wait's guidance once at SessionStart. It keeps job records in `plugin-data/follow-through/wait/jobs/<agentId>/<jobId>/` (`job.json`, a `started` marker and the exit receipt `result.json`) and a shell runner, `wait/run-job.sh`, that the agent's own Bash tool runs; the worker never runs the command. A job is readable only by the agent id and working directory the daemon reports for the caller. A wait holds two timers and refreshes that one agent at most once a second to notice a new message, and only while it waits. It is off when Settings → Agents says so (`enable_wait: false` in `agents.json`), when Paseo's `config.json` lists the standalone `paseo-wait` plugin as installed and not disabled, when the host doesn't serve plugin tools, and for agents labelled `follow-up-wait/enabled=false`, `paseo-wait/enabled=false` or `plugin-tools/enabled=false`. Records are never deleted automatically.
55
55
 
56
56
  Getting started keeps only its own progress in `plugin-data/follow-through/onboarding.json`: whether this host was a fresh or existing install when this version first started (existing if `state.json`, `inbox.json`, `reviewers.json`, `agents.json` or `brief.json` was already there), the current step, and whether the existing-install offer was shown or dismissed. An unreadable file counts as finished, so setup is never forced. Its choices are written through the same RPCs and display settings the Settings screen uses. The readiness checks run only when setup asks for them, at most once a minute unless you press Check again: `gh api user` on the daemon host, Paseo's provider snapshot (the same cached read Settings → Agents uses), Paseo's `config.json`, and the count of `hook-state/native-*.json` files. They never read an agent's timeline.
57
+
58
+ Updates (Settings → General) talk to the npm registry Paseo itself uses (`npm_config_registry`, else registry.npmjs.org): one abbreviated-metadata request with an ETag about every six hours (none when updates are Off), at most one a minute when Settings opens, one per Check now, and, once per new version, two for its provenance (the version document and its attestations) and one download of its tarball, checked against the confirmed checksum, to show its release notes before installing. Nothing about the host or its agents is sent. Choices, the waiting update and provenance verdicts live in `updates.json`, the last registry answer in `registry.json`, and each install step in `updates.jsonl`. Installing writes `update-watchdog.mjs` and starts it as a detached `node` process with the daemon's connection details in its environment (never on the command line); it previews and applies the update through Paseo's own plugin-update calls, pinned to the checksum Follow-up checked, then reads Paseo's plugin list every 15 seconds and the new worker's `heartbeat.json` for ten minutes, rolls back the same way if needed, and exits. Waiting for a quiet moment uses the cached agent list and turn events, with one fresh agent list right before installing; it never reads timelines.
package/README.md CHANGED
@@ -32,7 +32,8 @@ The first time you open Follow-up from the sidebar, a short setup takes Home's p
32
32
  2. **Check your setup.** Whether the GitHub CLI is signed in (and as whom), whether Claude and Codex are available for the helper agents, and whether agents get Follow-up's tools. Anything missing shows the fix, with the command to copy. Checks run only while this step is open.
33
33
  3. **What Follow-up does without asking.** Follow every workspace (or turn single ones off), Send repairs automatically, and Trust bypass agents. They are on by default and save as you change them.
34
34
  4. **Reviewers.** Who **Add reviewers** asks: a default for every repository, and a list per repository Follow-up has seen. **Skip, set later** leaves it empty.
35
- 5. **Helpers.** The Overseer and AI priority switches, which models they use (change them under Settings → Agents), and where Home, the workspace panel, Needs you and the Summary live.
35
+ 5. **Updates.** Install automatically (recommended), Tell me, or Off, and the Stable or Beta channel. Passing the step or skipping setup keeps Install automatically.
36
+ 6. **Helpers.** The Overseer and AI priority switches, which models they use (change them under Settings → Agents), and where Home, the workspace panel, Needs you and the Summary live.
36
37
 
37
38
  Every switch in setup is the same one Settings shows, so nothing is applied twice and nothing is lost if you stop halfway. Setup remembers its step, so a reload or another device picks up where you left off. Run it again any time from **Set up Follow-up again** in Settings → **General**, the first category, or ⌘K → **Follow-up: Set up again**. If Follow-up was already installed before this version, it doesn't open on its own: Home shows one dismissible line offering it, for a day.
38
39
 
@@ -40,6 +41,22 @@ Every switch in setup is the same one Settings shows, so nothing is applied twic
40
41
 
41
42
  After a major update (1.x to 2.0), the next time you open Paseo it shows **What's new**: the notes for every version since that device last looked, newest open, older ones folded. It shows once per device per version (once per host in the phone app), never on a fresh install and never over setup. Betas, minor and patch updates never pop it up. Betas have no notes of their own; their changes are collected in the next stable release. Home's last line says which version you run, with **Release notes** for the full list; for three days after an update to a version with its own notes it reads **Updated to X · What's new** instead. The notes ship inside the package as [CHANGELOG.md](CHANGELOG.md), so they work offline and match the installed version.
42
43
 
44
+ ## Updates
45
+
46
+ Follow-up can update itself. **Settings → General** has three modes:
47
+
48
+ - **Install automatically** installs a new version at a quiet moment: no agent mid-turn and none of Follow-up's own work running, for five minutes in a row (after a day of waiting, any idle moment). Installing reloads Follow-up, which detaches its tools from open agent sessions until they reopen, so it never installs mid-turn.
49
+ - **Tell me** shows the new version in Settings → General, and as one line on Home only for a new major version (2.0). You choose when with **Install now**. It is the default on hosts that had Follow-up before updates existed.
50
+ - **Off** never asks npm on its own, not even when Settings opens. **Check now** still works.
51
+
52
+ Follow-up asks npm about once every six hours (one small request, nothing when unchanged), opening Settings → General checks at most once a minute, and **Check now** always asks. **Channel** picks Stable (`latest`) or Beta; it starts on Beta when you run a beta, and never offers a stable older than what you run.
53
+
54
+ Before installing a version on its own, Follow-up reads the version's npm provenance and checks that it was built by this repository's GitHub workflow and is the exact file npm serves. That file's checksum is then pinned for the install. Follow-up does not verify the provenance signature itself, so this guards against a version published by hand or from another repository, not against a compromised registry. A version that fails the check is never installed from Settings; install it by hand with `paseo plugin update follow-through --version <version>` only if you trust it.
55
+
56
+ An installer runs alongside Follow-up for the install and the ten minutes after it. If the new version fails to load, reports an error, or doesn't start within two minutes, it installs the previous version again, and Settings and Home say what happened. Follow-up doesn't retry a rolled-back version on its own. Every update is listed under **Update history**. Installs from a Git checkout or a local folder are left alone: pull and rebuild to update.
57
+
58
+ Agents can do the same with `updates_status`, `check_updates`, `set_updates` and `install_update` (the last two as confirmed plans).
59
+
43
60
  ## Use
44
61
 
45
62
  Follow-up follows every workspace as soon as it has an agent; there is nothing to turn on. Open a workspace and click the Follow-up icon in its header (or press ⌘K / Ctrl+K and choose **Follow-up: open for this workspace**) to see that workspace's panel. Its **Home** button opens Home, the list of every workspace. To leave a workspace or a project out, open the settings (**Follow-up: settings** in ⌘K): **Following** has the global switches, **Workspace exceptions** the per-workspace ones.
@@ -221,7 +238,7 @@ This replaces the separate **Wait** plugin (`paseo-wait`). While that plugin is
221
238
  Install the beta:
222
239
 
223
240
  ```sh
224
- paseo plugin update follow-through --version 1.4.0-beta.30
241
+ paseo plugin update follow-through --version 1.4.0-beta.32
225
242
  # or, for a fresh install:
226
243
  paseo plugin install npm:paseo-follow-up@beta
227
244
  ```
package/client/home.tsx CHANGED
@@ -26,6 +26,7 @@ import { Spinner } from "./motion";
26
26
  import { Setup, SetupOffer, useOnboarding } from "./onboarding";
27
27
  import type { OnboardingView } from "../shared/onboarding";
28
28
  import { withAlpha, isLight, mergedColor, type Colors } from "./theme";
29
+ import { UpdateNotice } from "./updates";
29
30
  import { ReleaseNotesSheet, VersionLine, WhatsNewGate } from "./release-notes";
30
31
 
31
32
  export const HOME_SCREEN = "follow-through";
@@ -121,7 +122,8 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
121
122
 
122
123
  // null: closed; false: What's new since the previous version; true: every version.
123
124
  const [notesOpen, setNotesOpen] = useState<boolean | null>(null);
124
- const versionLine = <VersionLine theme={theme} compact={compact} onOpen={setNotesOpen} />;
125
+ const updateNotice = <UpdateNotice theme={theme} compact={compact} openSettings={deps.openSettings} />;
126
+ const updatesFooter = <VersionLine theme={theme} compact={compact} onOpen={setNotesOpen} />;
125
127
  const updateSheets = <>
126
128
  <WhatsNewGate surface="home" theme={theme} compact={compact} />
127
129
  {notesOpen != null && <ReleaseNotesSheet theme={theme} compact={compact} all={notesOpen} onClose={() => setNotesOpen(null)} />}
@@ -140,8 +142,8 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
140
142
  // Phones: the host header already says Follow-up, so no "Home" title row; search, sort and settings share one row and
141
143
  // the meters move to the end of the list.
142
144
  footer={omnibox.results ? undefined : compact
143
- ? <View style={{ paddingTop: 16, paddingBottom: 96, gap: 12 }}>{!nothing && <UsageMeters theme={theme} sources={deps.sources} dense />}{versionLine}</View>
144
- : versionLine}
145
+ ? <View style={{ paddingTop: 16, paddingBottom: 96, gap: 12 }}>{!nothing && <UsageMeters theme={theme} sources={deps.sources} dense />}{updatesFooter}</View>
146
+ : updatesFooter}
145
147
  // Phones: the setup offer goes after the Needs-you group when there is one, so the first ask stays high.
146
148
  afterNeeds={compact && model.needs > 0 ? <SetupOffer theme={theme} compact view={props.onboarding} /> : undefined}
147
149
  emptyAction={compact ? <Button theme={theme} compact kind="secondary" icon="Settings" title="Project settings" onPress={deps.openSettings} /> : undefined}
@@ -159,10 +161,11 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
159
161
  </ListTop>}
160
162
  // Phones: only the search row stays pinned; the status chips and the setup offer scroll away with the list, so a
161
163
  // scrolled list keeps the screen instead of sitting under a 250px block.
162
- header={compact && !omnibox.results ? <View style={{ gap: 8, paddingTop: 6, paddingBottom: 6 }}>
164
+ header={omnibox.results ? undefined : compact ? <View style={{ gap: 8, paddingTop: 6, paddingBottom: 6 }}>
163
165
  <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch dense />
166
+ {updateNotice}
164
167
  {model.needs === 0 && <SetupOffer theme={theme} compact view={props.onboarding} />}
165
- </View> : undefined} />;
168
+ </View> : updateNotice} />;
166
169
 
167
170
  if (compact) return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
168
171
  {current || selected === OVERSEER_KEY && overseer || selected === BRIEF_KEY ? detail : list}
@@ -9,11 +9,12 @@ import { ONBOARDING_STEPS, autoSendWrites, checksSummary, type Check, type Onboa
9
9
  import { Button, IconButton, errorText, text, type Theme } from "./kit";
10
10
  import { ReviewerSettings } from "./reviewers";
11
11
  import { ShippingStep } from "./shipping";
12
+ import { UpdatesStep } from "./updates";
12
13
  import { Spinner, useReducedMotion } from "./motion";
13
14
  import { raised, runningColor, tint, withAlpha, type Colors } from "./theme";
14
15
 
15
16
  /**
16
- * Getting started: five steps that take a fresh install to a configured Follow-up. Shown in Home's place while the
17
+ * Getting started: the steps that take a fresh install to a configured Follow-up. Shown in Home's place while the
17
18
  * server says so (fresh install, or "Set up Follow-up again"), never forced on an existing install.
18
19
  * Every switch writes through the Settings screen's own RPC or settings document as it changes; the flow itself only
19
20
  * saves which step it's on, so a reload resumes there.
@@ -40,6 +41,7 @@ const TITLES: Record<OnboardingStep, string> = {
40
41
  defaults: "What Follow-up does without asking",
41
42
  shipping: "How do you ship PRs?",
42
43
  reviewers: "Who should review your PRs?",
44
+ updates: "Keep Follow-up up to date",
43
45
  helpers: "Helpers, and where things are",
44
46
  };
45
47
 
@@ -79,6 +81,7 @@ export function Setup({ theme, compact, view, deps }: { theme: Theme; compact: b
79
81
  : step === "defaults" ? <DefaultsStep theme={theme} compact={compact} held={view.holdsAutoSends} />
80
82
  : step === "shipping" ? <ShippingStep theme={theme} compact={compact} />
81
83
  : step === "reviewers" ? <ReviewerSettings theme={theme} compact={compact} />
84
+ : step === "updates" ? <UpdatesStep theme={theme} compact={compact} />
82
85
  : <HelpersStep theme={theme} compact={compact} deps={deps} checks={checks.data?.checks ?? null} />;
83
86
  const lead: Record<OnboardingStep, string> = {
84
87
  intro: "It follows your agents' pull requests until the work is done, sends fixes back to them, and asks you only for decisions.",
@@ -86,6 +89,7 @@ export function Setup({ theme, compact, view, deps }: { theme: Theme; compact: b
86
89
  defaults: "These are on now. Change anything here; it saves as you go, and Settings has the same switches.",
87
90
  shipping: "Follow-up merges and tracks PRs the way each repository already works. It picked these; change one if it's wrong.",
88
91
  reviewers: "When you press Add reviewers on a PR, Follow-up asks these people. Set a default for all repositories, or a list for one. Until then, PRs without reviewers show in Needs you.",
92
+ updates: "New versions fix problems and add features. Follow-up can install them for you, at a moment when no agent is using it, and goes back to the old version if something breaks.",
89
93
  helpers: "Two optional agents. They read, summarise and rank. They never change code or message anyone.",
90
94
  };
91
95
  const column: ViewStyle = { width: "100%", maxWidth: 560, alignSelf: "center", paddingHorizontal: compact ? 16 : 24 };
@@ -43,9 +43,10 @@ function deliveryLine(w: Workspace, q: Question, now: number): { icon: string; t
43
43
  }
44
44
  }
45
45
 
46
- function OptionCard({ theme, letter, label, consequence, recommended, selected, disabled, onPress, compact, dense = false }: { theme: Theme; letter: string; label: string; consequence?: string; recommended: boolean; selected: boolean; disabled: boolean; onPress: () => void; compact: boolean; dense?: boolean }) {
46
+ /** A radio card: the question options, and setup's Updates choice (no letter there). */
47
+ export function OptionCard({ theme, letter, label, consequence, recommended, selected, disabled, onPress, compact, dense = false }: { theme: Theme; letter?: string; label: string; consequence?: string; recommended: boolean; selected: boolean; disabled: boolean; onPress: () => void; compact: boolean; dense?: boolean }) {
47
48
  const c = theme.colors; const t = text(c);
48
- return <Pressable accessibilityRole="radio" aria-checked={selected} accessibilityState={{ checked: selected, disabled }} accessibilityLabel={`${letter}. ${label}${recommended ? ". Recommended" : ""}${consequence ? `. ${consequence}` : ""}`}
49
+ return <Pressable accessibilityRole="radio" aria-checked={selected} accessibilityState={{ checked: selected, disabled }} accessibilityLabel={`${letter ? `${letter}. ` : ""}${label}${recommended ? ". Recommended" : ""}${consequence ? `. ${consequence}` : ""}`}
49
50
  disabled={disabled} onPress={onPress}
50
51
  style={state => ({ flexDirection: "row", gap: 10, paddingHorizontal: dense ? 10 : 12, paddingVertical: compact ? 12 : dense ? 8 : 10, borderRadius: 8, borderWidth: selected ? 1.5 : 1,
51
52
  borderColor: selected ? c.accent : c.border, margin: selected ? 0 : 0.5,
@@ -53,7 +54,7 @@ function OptionCard({ theme, letter, label, consequence, recommended, selected,
53
54
  <View style={{ width: 18, height: 18, marginTop: 1, borderRadius: 9, borderWidth: selected ? 5 : 1.5, borderColor: selected ? c.accent : c.foregroundMuted }} />
54
55
  <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
55
56
  <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 8, rowGap: 4 }}>
56
- <Text style={t.label}><Text style={{ fontVariant: ["tabular-nums"] }}>{letter}</Text>{" "}{label}</Text>
57
+ <Text style={t.label}>{letter ? <><Text style={{ fontVariant: ["tabular-nums"] }}>{letter}</Text>{" "}</> : null}{label}</Text>
57
58
  {recommended && <Chip theme={theme} icon="ThumbsUp" label="Recommended" color={c.foregroundMuted} />}
58
59
  </View>
59
60
  {!!consequence && <Text numberOfLines={dense ? 2 : undefined} style={t.meta}>{consequence}</Text>}
@@ -11,12 +11,11 @@ import { DisplaySections, PermissionsSection, PreferenceSwitch } from "./display
11
11
  import { ReviewerSettings, reviewerSettingsKey } from "./reviewers";
12
12
  import { AgentSettings, WaitSettings, agentSettingsKey } from "./agents";
13
13
  import { ShippingSettings } from "./shipping";
14
+ import { UpdatesSections, useUpdates } from "./updates";
15
+ import { generalSummary } from "../shared/updates";
14
16
  import { BackHeader, CategoryList, CategoryTabs, Disclosure } from "./settings-shell";
15
17
  import { useOnboarding } from "./onboarding";
16
- import { generalSummary, setupEntry, type SetupEntry } from "../shared/onboarding";
17
- import { ReleaseNotesSheet, releaseNotesKey, useReleaseNotes } from "./release-notes";
18
- import type { ReleaseNotesView } from "../shared/changelog";
19
- import type { OnboardingView } from "../shared/onboarding";
18
+ import { setupEntry, type SetupEntry } from "../shared/onboarding";
20
19
  import {
21
20
  categoryTitle, followingSummary, hasSavedCategory, projectsOpenByDefault, projectsSummary, readCategory, reviewersSummary, workspaceRows, workspaceState, workspacesOpenByDefault, workspacesSummary,
22
21
  writeCategory, type SettingsCategory, type WorkspaceSetting,
@@ -179,21 +178,11 @@ function AgentsCategory({ theme, compact }: { theme: Theme; compact: boolean })
179
178
  * "Set up Follow-up again" is the first row, so it's on the first screen Settings opens on.
180
179
  */
181
180
  function GeneralCategory({ theme, compact, setup }: { theme: Theme; compact: boolean; setup?: { entry: SetupEntry; open: () => void } }) {
182
- const notes = useReleaseNotes();
183
- const [sheet, setSheet] = useState<boolean | null>(null);
184
- const version = notes.data?.version;
185
181
  return <>
186
182
  {setup && <SettingsSection title="Setup">
187
183
  <SettingsCard><SettingsAction label={setup.entry.label} hint={setup.entry.hint} actionLabel={setup.entry.action} onPress={setup.open} /></SettingsCard>
188
184
  </SettingsSection>}
189
- <SettingsSection title="Version">
190
- <SettingsCard>
191
- <SettingsAction label={version ? `Follow-up ${version}` : "Follow-up"} hint={notes.isError ? "Couldn't read the release notes." : "Installed version."}
192
- actionLabel="What's new" onPress={() => setSheet(false)} />
193
- <SettingsAction label="Older versions" hint="Every release, newest first." actionLabel="Open" onPress={() => setSheet(true)} />
194
- </SettingsCard>
195
- </SettingsSection>
196
- {sheet != null && <ReleaseNotesSheet theme={theme} compact={compact} all={sheet} onClose={() => setSheet(null)} />}
185
+ <UpdatesSections theme={theme} compact={compact} />
197
186
  </>;
198
187
  }
199
188
 
@@ -204,10 +193,10 @@ function useSummaries(): Partial<Record<SettingsCategory, string | null>> {
204
193
  const reviewers = useQuery({ queryKey: reviewerSettingsKey, queryFn: skipToken }).data as { config: ReviewerConfig } | undefined;
205
194
  const agents = useQuery({ queryKey: agentSettingsKey, queryFn: skipToken }).data as AgentSettingsView | undefined;
206
195
  const changed = agents?.roles.filter(r => !r.isDefault).length ?? 0;
207
- const notes = useQuery({ queryKey: releaseNotesKey, queryFn: skipToken }).data as ReleaseNotesView | undefined;
208
- const onboarding = useQuery({ queryKey: ["follow-through", "onboarding"], queryFn: skipToken }).data as OnboardingView | undefined;
196
+ // General's line reads the updates view (local files, no npm request), so the phone list shows it before a drill-in.
197
+ const updates = useUpdates().data;
209
198
  return {
210
- general: generalSummary(notes?.version, onboarding?.status),
199
+ general: updates ? generalSummary(updates) : null,
211
200
  following: follow ? followingSummary(follow) : null,
212
201
  reviewers: reviewers ? reviewersSummary(reviewers.config) : null,
213
202
  agents: agents ? (changed ? `${changed} of ${agents.roles.length} changed from the defaults` : "Every agent on its default") : null,
@@ -229,8 +218,6 @@ export function FollowSettings({ theme, layout, openSetup }: PluginSurfaceProps
229
218
  const pick = (id: SettingsCategory) => { writeCategory(id); setCategory(id); };
230
219
  // "Set up Follow-up again" leads General, the first category: what it says depends on where setup stands.
231
220
  const onboarding = useOnboarding();
232
- // Loaded up front (cached for good) so General's line in the phone list can name the version.
233
- useReleaseNotes();
234
221
  const entry = setupEntry(onboarding.data);
235
222
  const setup = openSetup ? { entry, open: () => openSetup(entry.resume) } : undefined;
236
223
  const content = category === "general" ? <GeneralCategory theme={theme} compact={compact} setup={setup} />
@@ -253,7 +240,7 @@ export function FollowSettings({ theme, layout, openSetup }: PluginSurfaceProps
253
240
  const line = summaries[category];
254
241
  return <ScrollView style={{ flex: 1, backgroundColor: c.surface0 }} stickyHeaderIndices={[0]} contentContainerStyle={{ ...page, paddingTop: 0 }}>
255
242
  <View style={{ paddingTop: 24, backgroundColor: c.surface0 }}><CategoryTabs value={category} onChange={pick} theme={theme} /></View>
256
- {/* General shows the version and setup itself, so its line would only repeat them. */}
243
+ {/* General's status card says it already; its line is for the phone list. */}
257
244
  {line && category !== "general" ? <Text style={[t.meta, { marginTop: -6 }]}>{line}</Text> : null}
258
245
  {content}
259
246
  </ScrollView>;
@@ -0,0 +1,188 @@
1
+ import { useState } from "react";
2
+ import { Pressable, Text, View } from "react-native";
3
+ import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
4
+ import { Icon, SettingsAction, SettingsCard, SettingsSection, SettingsSelect, copyText, useToast } from "@getpaseo/plugin/client/ui";
5
+ import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
+ import { dismissUpdateNoticeRpc, installUpdateRpc, setUpdatesRpc, updatesRpc } from "../shared/contracts";
7
+ import { MODE_HINT, MODE_LABEL, UPDATE_MODES, channelHint, checkedText, copyCommand, statusCopy, type StatusAction, type UpdateMode, type UpdatesView } from "../shared/updates";
8
+ import { writeCategory } from "../shared/settings-nav";
9
+ import type { Channel } from "../shared/version";
10
+ import { Button, errorText, space, text, useNow, type Theme } from "./kit";
11
+ import { Spinner } from "./motion";
12
+ import { Disclosure } from "./settings-shell";
13
+ import { withAlpha } from "./theme";
14
+ import { OptionCard } from "./questions";
15
+ import { ReleaseNotesSheet, VersionNotes } from "./release-notes";
16
+
17
+ export const updatesKey = ["follow-through", "updates"];
18
+
19
+ /** The server's updates view. Reading it never asks the registry; `check` does (rate-limited on the server). */
20
+ export function useUpdates(check?: "settings") {
21
+ const read = useRpc(updatesRpc);
22
+ return useQuery({ queryKey: updatesKey, queryFn: () => read(check ? { check } : {}), staleTime: 60_000,
23
+ // While installing, the plugin reloads under us: keep asking every few seconds until it's back.
24
+ refetchInterval: q => { const k = (q.state.data as UpdatesView | undefined)?.phase.kind; return k === "installing" || k === "checking" ? 3000 : false; } });
25
+ }
26
+
27
+ const toneColor = (tone: "success" | "warning" | "muted", c: Theme["colors"]) => tone === "success" ? c.statusSuccess : tone === "warning" ? c.statusWarning : c.foregroundMuted;
28
+ /** Home's top line: an update to install (Tell me mode) or a rollback. One slot; the rollback wins. */
29
+ export function UpdateNotice({ theme, compact, openSettings }: { theme: Theme; compact: boolean; openSettings: () => void }) {
30
+ const c = theme.colors; const t = text(c);
31
+ const query = useUpdates(); const cache = useQueryClient(); const toast = useToast();
32
+ const dismiss = useRpc(dismissUpdateNoticeRpc); const install = useRpc(installUpdateRpc);
33
+ const [confirm, setConfirm] = useState(false);
34
+ const run = useMutation({ mutationFn: (fn: () => Promise<UpdatesView>) => fn(), onSuccess: v => cache.setQueryData(updatesKey, v), onError: e => toast.error(errorText(e)) });
35
+ const n = query.data?.notice;
36
+ if (!n) return null;
37
+ const rolled = n.kind === "rolled-back";
38
+ const title = rolled ? `Update to ${n.version} failed, rolled back` : `Follow-up ${n.version} is available`;
39
+ const detail = rolled ? `You're on ${n.from} again. Nothing to do.` : "Installing reloads Follow-up for a few seconds.";
40
+ return <View accessibilityRole="summary" style={{ marginHorizontal: compact ? space(true).gutter : 24, marginTop: 8, marginBottom: 4, borderRadius: 8, borderWidth: 1,
41
+ borderColor: rolled ? withAlpha(c.statusWarning, 0.6) : c.border, backgroundColor: c.surface1, paddingHorizontal: 12, paddingVertical: 10, gap: 8 }}>
42
+ <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 10 }}>
43
+ <View style={{ paddingTop: 2 }}><Icon name={rolled ? "Undo2" : "CircleArrowUp"} size={15} color={rolled ? c.statusWarning : c.foregroundMuted} /></View>
44
+ <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
45
+ <Text style={t.label}>{title}</Text>
46
+ <Text style={t.meta}>{confirm ? "Some agents are mid-turn. Open agent chats lose Follow-up's tools until you reopen them; their work and history are kept." : detail}</Text>
47
+ </View>
48
+ <Pressable accessibilityRole="button" accessibilityLabel={rolled ? "Dismiss" : "Not now"} hitSlop={8} onPress={() => run.mutate(() => dismiss({ id: n.id }))}
49
+ style={state => ({ width: compact ? 44 : 32, height: compact ? 44 : 32, marginTop: compact ? -12 : -6, marginRight: compact ? -12 : -8, alignItems: "center", justifyContent: "center", borderRadius: 6, backgroundColor: state.pressed ? c.surface2 : "transparent" })}>
50
+ <Icon name="X" size={14} color={c.foregroundMuted} />
51
+ </Pressable>
52
+ </View>
53
+ <View style={{ flexDirection: "row", gap: 8, paddingLeft: 25 }}>
54
+ {rolled ? <Button title="Details" theme={theme} compact={compact} onPress={() => { writeCategory("general"); openSettings(); }} />
55
+ : confirm ? <>
56
+ <Button title="Install now" theme={theme} compact={compact} loading={run.isPending} onPress={() => run.mutate(() => install({ version: n.version, anyway: true }))} />
57
+ <Button title="Cancel" kind="ghost" theme={theme} compact={compact} onPress={() => setConfirm(false)} />
58
+ </> : <Button title="Install" theme={theme} compact={compact} loading={run.isPending} onPress={() => run.mutate(async () => { const v = await install({ version: n.version }); if (v.phase.kind === "waiting" && v.phase.busy) setConfirm(true); return v; })} />}
59
+ </View>
60
+ </View>;
61
+ }
62
+
63
+ /** The status card at the top of Settings → General. */
64
+ function StatusCard({ view, theme, compact, onWhatsNew }: { view: UpdatesView; theme: Theme; compact: boolean; onWhatsNew: () => void }) {
65
+ const c = theme.colors; const t = text(c);
66
+ const now = useNow(30_000);
67
+ const read = useRpc(updatesRpc); const install = useRpc(installUpdateRpc);
68
+ const cache = useQueryClient(); const toast = useToast();
69
+ const [confirm, setConfirm] = useState(false);
70
+ const run = useMutation({ mutationFn: (fn: () => Promise<UpdatesView>) => fn(), onSuccess: v => cache.setQueryData(updatesKey, v), onError: e => toast.error(errorText(e)) });
71
+ const s = statusCopy(view, now);
72
+ const color = toneColor(s.tone, c);
73
+ const p = view.phase;
74
+ const version = "version" in p ? p.version : view.version;
75
+ const act: Record<StatusAction, { title: string; onPress: () => void; icon?: string }> = {
76
+ check: { title: "Check now", onPress: () => run.mutate(() => read({ check: "manual" })) },
77
+ install: { title: "Install now", onPress: () => run.mutate(async () => { const v = await install({ version }); if (v.phase.kind === "waiting" && v.phase.busy) setConfirm(true); return v; }) },
78
+ "install-anyway": { title: "Install now anyway", onPress: () => setConfirm(true) },
79
+ retry: { title: "Try again", onPress: () => run.mutate(() => install({ version })) },
80
+ "copy-details": { title: "Copy details", onPress: () => void copyText(`${s.title}\n${s.detail}`).then(() => toast.show("Copied"), () => toast.error("Couldn't copy")) },
81
+ "copy-command": { title: "Copy install command", onPress: () => void copyText(copyCommand(version)).then(() => toast.show("Copied. Run it on the computer running Paseo."), () => toast.error("Couldn't copy")) },
82
+ "view-npm": { title: "View on npm", onPress: () => void openExternalUrl(`https://www.npmjs.com/package/paseo-follow-up/v/${encodeURIComponent(version)}`).catch(() => undefined) },
83
+ "whats-new": { title: "What's new", onPress: onWhatsNew },
84
+ };
85
+ const checking = run.isPending && run.variables != null;
86
+ const pending = view.pendingNotes;
87
+ return <View style={{ borderRadius: 10, borderWidth: 1, borderColor: s.tone === "warning" ? withAlpha(c.statusWarning, 0.6) : c.border, backgroundColor: c.surface1, padding: compact ? 16 : 14, gap: 4 }}>
88
+ <View accessibilityLiveRegion="polite" style={{ flexDirection: "row", alignItems: "flex-start", gap: 10 }}>
89
+ <View style={{ width: 16, paddingTop: 1, alignItems: "center" }}>{s.spinning ? <Spinner color={color} size={14} /> : <Icon name={s.icon} size={16} color={color} />}</View>
90
+ <View style={{ flex: 1, minWidth: 0, gap: 4 }}>
91
+ <Text style={t.label}>{s.title}</Text>
92
+ <Text style={t.meta}>{confirm ? "Open agent chats lose Follow-up's tools until you reopen them. Their work and history are kept." : s.detail}</Text>
93
+ </View>
94
+ </View>
95
+ {(confirm || s.primary || s.secondary.length > 0 || view.installKind === "npm") && <View style={{ flexDirection: compact ? "column" : "row", alignItems: compact ? "stretch" : "center", gap: 8, marginTop: 10, paddingLeft: 26 }}>
96
+ {/* Phones: one full-width button per row, so a ghost button below a bordered one doesn't float. */}
97
+ <View style={compact ? { flexDirection: "column", alignItems: "stretch", gap: 8 } : { flexDirection: "row", flexWrap: "wrap", gap: 8, flex: 1 }}>
98
+ {confirm ? <>
99
+ <Button title="Install now" kind="primary" theme={theme} compact={compact} loading={run.isPending} onPress={() => run.mutate(() => install({ version, anyway: true }).finally(() => setConfirm(false)))} />
100
+ <Button title="Cancel" kind="ghost" theme={theme} compact={compact} onPress={() => setConfirm(false)} />
101
+ </> : <>
102
+ {s.primary && <Button title={act[s.primary].title} kind="primary" theme={theme} compact={compact} loading={run.isPending && s.primary === "install"} onPress={act[s.primary].onPress} />}
103
+ {s.secondary.map((a, i) => <Button key={a} title={act[a].title} kind={i === 0 && !s.primary ? "secondary" : "ghost"} theme={theme} compact={compact} loading={a === "check" && checking} onPress={act[a].onPress} />)}
104
+ </>}
105
+ </View>
106
+ {view.installKind === "npm" && <Text style={[t.small, compact ? null : { textAlign: "right" }]}>{checkedText(view.checkedAt, now)}</Text>}
107
+ </View>}
108
+ {pending.length > 0 && (p.kind === "available" || p.kind === "waiting" || p.kind === "untrusted") && <View style={{ marginTop: 12, paddingTop: 12, borderTopWidth: 1, borderTopColor: c.border, gap: 8, paddingLeft: 26 }}>
109
+ <Text style={t.small}>{`What's in ${pending[0]!.version}`}</Text>
110
+ <VersionNotes note={pending[0]!} theme={theme} max={6} />
111
+ {pending.length > 1 && <Text style={t.small}>{`and ${pending.length - 1} earlier version${pending.length === 2 ? "" : "s"} since yours`}</Text>}
112
+ </View>}
113
+ </View>;
114
+ }
115
+
116
+ const HISTORY_RESULT: Record<string, string> = { updated: "Updated", "rolled-back": "Rolled back", failed: "Failed", skipped: "Skipped" };
117
+ const stamp = (at: number) => { const d = new Date(at); return `${d.toLocaleDateString(undefined, { day: "numeric", month: "short" })} ${String(d.getHours()).padStart(2, "0")}:${String(d.getMinutes()).padStart(2, "0")}`; };
118
+
119
+ /**
120
+ * Settings → General's updates: the status card (version, last check, Check now, what's available or went wrong),
121
+ * the two settings, all release notes and the history. Opening it asks npm at most once a minute, never when Off.
122
+ */
123
+ export function UpdatesSections({ theme, compact }: { theme: Theme; compact: boolean }) {
124
+ const c = theme.colors; const t = text(c);
125
+ const query = useUpdates("settings");
126
+ const write = useRpc(setUpdatesRpc); const cache = useQueryClient(); const toast = useToast();
127
+ // null: closed; false: What's new (since the last update); true: every version.
128
+ const [sheet, setSheet] = useState<boolean | null>(null);
129
+ const save = useMutation({ mutationFn: (input: { mode?: UpdateMode; channel?: Channel }) => write(input), onSuccess: v => cache.setQueryData(updatesKey, v), onError: e => toast.error(errorText(e)) });
130
+ const view = query.data;
131
+ if (query.isLoading) return <Spinner color={c.foregroundMuted} size={16} label="Loading updates" />;
132
+ if (!view) return <SettingsSection title="Updates"><Text accessibilityRole="alert" style={{ color: c.statusDanger }}>{query.error ? errorText(query.error) : "Couldn't load updates."}</Text></SettingsSection>;
133
+ return <View style={{ gap: 18 }}>
134
+ <SettingsSection title="Updates">
135
+ <StatusCard view={view} theme={theme} compact={compact} onWhatsNew={() => setSheet(false)} />
136
+ </SettingsSection>
137
+ <SettingsSection title={view.installKind === "npm" ? "How Follow-up updates" : "Release notes"}>
138
+ <SettingsCard>
139
+ {view.installKind === "npm" && <>
140
+ <SettingsSelect<UpdateMode> label="When a new version is out" hint={MODE_HINT[view.mode]} value={view.mode} disabled={save.isPending}
141
+ options={UPDATE_MODES.map(m => ({ value: m, label: MODE_LABEL[m] }))} onValueChange={mode => save.mutate({ mode })} />
142
+ <SettingsSelect<Channel> label="Channel" hint={channelHint(view)} value={view.channel} disabled={save.isPending}
143
+ options={[{ value: "stable", label: "Stable" }, { value: "beta", label: "Beta" }]}
144
+ onValueChange={channel => save.mutate({ channel }, { onSuccess: () => toast.show(channel === "stable" ? "Switched to Stable. Nothing changes until a newer stable is out." : "Switched to Beta. The next check looks for betas.") })} />
145
+ </>}
146
+ <SettingsAction label="Release notes" hint={`Every version up to ${view.version}, newest first.`} actionLabel="See all" onPress={() => setSheet(true)} />
147
+ </SettingsCard>
148
+ </SettingsSection>
149
+ {view.installKind === "npm" && view.history.length > 0 && <Disclosure id="updates.history" title="Update history" summary={`${HISTORY_RESULT[view.history[0]!.result]} ${stamp(view.history[0]!.at)}`} defaultOpen={false} theme={theme} compact={compact}>
150
+ {view.history.slice(0, 10).map((h, i) => <View key={i} style={{ paddingHorizontal: compact ? 16 : 14, paddingVertical: 8, borderTopWidth: i ? 1 : 0, borderTopColor: c.border, gap: 2 }}>
151
+ <Text style={t.meta}>{`${stamp(h.at)} · ${h.from} → ${h.to} · ${HISTORY_RESULT[h.result]}`}</Text>
152
+ {h.reason && <Text style={t.small}>{h.reason}</Text>}
153
+ </View>)}
154
+ </Disclosure>}
155
+ {sheet != null && <ReleaseNotesSheet theme={theme} compact={compact} all={sheet} onClose={() => setSheet(null)} />}
156
+ </View>;
157
+ }
158
+
159
+ const SETUP_CARDS: { mode: UpdateMode; hint: string }[] = [
160
+ { mode: "auto", hint: "Waits until your agents are idle. Rolls back if the new version fails." },
161
+ { mode: "notify", hint: "Shows new versions on Home. You choose when to install." },
162
+ { mode: "off", hint: "No checks. You can check from Settings → General." },
163
+ ];
164
+ /**
165
+ * Setup's Updates step: the same RPCs and controls as Settings → General, as radio cards. Reads without asking npm.
166
+ * Saves on change; passing the step or skipping setup on a fresh install saves the pre-selected mode (server side).
167
+ */
168
+ export function UpdatesStep({ theme, compact }: { theme: Theme; compact: boolean }) {
169
+ const c = theme.colors; const t = text(c);
170
+ const query = useUpdates();
171
+ const write = useRpc(setUpdatesRpc); const cache = useQueryClient(); const toast = useToast();
172
+ const save = useMutation({ mutationFn: (input: { mode?: UpdateMode; channel?: Channel }) => write(input), onSuccess: v => cache.setQueryData(updatesKey, v), onError: e => toast.error(errorText(e)) });
173
+ const view = query.data;
174
+ if (query.isLoading) return <Spinner color={c.foregroundMuted} size={16} label="Loading updates" />;
175
+ if (!view) return <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{query.error ? errorText(query.error) : "Couldn't load updates."}</Text>;
176
+ if (view.installKind !== "npm") return <Text style={t.body}>Updates are managed by your checkout. Pull and rebuild to update.</Text>;
177
+ return <View style={{ gap: 12 }}>
178
+ <View accessibilityRole="radiogroup" accessibilityLabel="Updates" style={{ gap: 6 }}>
179
+ {SETUP_CARDS.map(card => <OptionCard key={card.mode} theme={theme} compact={compact} label={MODE_LABEL[card.mode]} consequence={card.hint} recommended={card.mode === "auto"}
180
+ selected={view.mode === card.mode} disabled={save.isPending} onPress={() => view.mode !== card.mode && save.mutate({ mode: card.mode })} />)}
181
+ </View>
182
+ <SettingsCard>
183
+ <SettingsSelect<Channel> label="Channel" hint={channelHint(view)} value={view.channel} disabled={save.isPending}
184
+ options={[{ value: "stable", label: "Stable" }, { value: "beta", label: "Beta" }]} onValueChange={channel => save.mutate({ channel })} />
185
+ </SettingsCard>
186
+ <Text style={t.small}>Follow-up only installs versions npm confirms were built from github.com/tomgrin10/paseo-follow-up.</Text>
187
+ </View>;
188
+ }