paseo-follow-up 1.4.0-beta.5 → 1.4.0-beta.7
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 +5 -0
- package/README.md +15 -1
- package/client/brief.tsx +2 -1
- package/client/display.tsx +7 -2
- package/client/home-chrome.tsx +29 -6
- package/client/home-list.tsx +3 -3
- package/client/home-view.ts +51 -8
- package/client/home.tsx +4 -2
- package/client/inbox-store.ts +15 -7
- package/client/keys.ts +3 -0
- package/client/large.tsx +9 -10
- package/client/live.tsx +8 -6
- package/client/panel.tsx +13 -10
- package/client/pill.tsx +10 -6
- package/client/pr-controls.tsx +1 -1
- package/client/visibility.ts +7 -0
- package/client/workspace-data.ts +37 -0
- package/index.client.tsx +4 -3
- package/index.server.ts +43 -10
- package/package.json +2 -2
- package/server/ai-jobs.ts +16 -6
- package/server/daemon.ts +126 -98
- package/server/directory.ts +165 -0
- package/server/etag.ts +14 -0
- package/server/inbox-directory.ts +14 -19
- package/server/mcp-source.ts +1 -1
- package/server/mcp.mjs +1 -0
- package/server/overseer-prompt-source.ts +1 -1
- package/server/overseer-prompt.md +1 -0
- package/server/overseer.ts +7 -2
- package/server/ranker.ts +313 -0
- package/shared/contracts.ts +9 -1
- package/shared/display.ts +3 -1
- package/shared/ranker.ts +135 -0
package/OVERVIEW.md
CHANGED
|
@@ -6,6 +6,7 @@ Follow-up watches every pull request a Paseo workspace opens until the work is a
|
|
|
6
6
|
|
|
7
7
|
- Home: every workspace grouped by what it needs from you (Needs you, Follow-up is fixing, Running, Waiting on others, Quiet), with the selected one beside the list so you can allow a permission, answer, merge, reply or sign off in place, and a brief with what Follow-up did while you were away. Above the list: the status counts, provider limits from Smart Session when it's installed, a search over names, branches, PRs, agents and asks, and a sort menu (Priority, Recent, Oldest waiting, Name, By project).
|
|
8
8
|
- The Overseer (1.4 beta), pinned on Home: one agent you talk to about all your workspaces. It forwards your asks to the agent that owns them, asks you when it isn't sure, and starts a new workspace only when you say so. You can ask it from Home's search box (the last row, "Ask the Overseer: …") or with ⌘K → Follow-up: Ask the Overseer.
|
|
9
|
+
- AI priority (1.4 beta): Home's Priority sort ranked from your Linear issues, Slack DMs and mentions, GitHub review requests and the weekly plan, each row with a one-line reason that names its source. It runs hourly on workdays, only when something changed, and Re-rank now is in the sort menu.
|
|
9
10
|
- What's this about?, a collapsible section at the top of Home's detail pane and the workspace panel: a one-line gist, a short AI overview of what the workspace is for and where it stands, and its linked Linear issues, PRs, Slack threads and docs.
|
|
10
11
|
- A workspace panel for the open workspace only, with a Home button: PRs merged, what needs you, what needs fixing, a bar with one segment per PR, and what the agent is doing now. "Open full" on Home docks it beside the agent's chat.
|
|
11
12
|
- A Needs you card with one button per decision: Send repairs, Merge, Resume, Retry, or Answer.
|
|
@@ -33,6 +34,8 @@ Every root agent Paseo launches (tracked or not) gets Follow-up's action tools:
|
|
|
33
34
|
|
|
34
35
|
This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent history and configuration, GitHub status and existing CLI authentication, and keeps its state in `plugin-data/follow-through` on the daemon host. It attaches scoped agent tools per session (served by Paseo's own MCP as `follow_*` on Paseo 0.15+, a per-launch stdio bridge otherwise; never a global MCP registration, and it removes the user-scope `follow-through` entry older versions wrote, keeping a `.follow-through-unregister.bak` of each file) and reversible provider hooks for tracked sessions and, while the Needs-you inbox is on, the `needs_you` tool and its Stop-hook nudge for root agents (see below). To find the spec link it reads completed Claude Artifact publish results in the workspace's root sessions, never page content, chat links or the repository; a link you set wins over the agent's, which wins over detection. Repair prompts go to your configured agent and provider. For the provider meters it calls the Smart Session plugin's `smart-session.subscriptions` and `smart-session.budget` RPCs at most once a minute, or reads the newest rows of its `plugin-data/smart-session/accounts-YYYY-MM.jsonl`; it never asks ZeroSub to refresh or switch. It has no Slack identity and no background channel scanning; replies to stakeholders need your authorization and a sent-message receipt from the agent.
|
|
35
36
|
|
|
37
|
+
Follow-up reads Paseo's agent, workspace and project lists into one in-memory directory shared by discovery, runtime checks, the Needs-you inbox, the Overseer and every client RPC. It reads the lists once at start, then patches the directory from lifecycle events: turn started or ended, permission requested or resolved, agent created, closed or archived, workspace created or archived. A change marks it dirty, and a dirty directory re-reads at most once a minute; a clean one re-reads every ten minutes. Before anything that would load an agent (a timeline or provider-subagent read), Follow-up re-reads that one agent, because the cached copy may predate Paseo unloading it. Provider subagents are asked about only when a send is due or waiting for acknowledgment, or completion is being checked. The Done label is sent only when it changes. In the app, the panel, the larger view and the pill draw from the client's shared workspace poll, which runs every 15 s plus a refresh shortly after Paseo reports an agent change. The inbox runs the same way and passes the tag of the list it holds, so an unchanged list comes back empty. Display preferences re-read once a minute. None of these poll while the app is hidden.
|
|
38
|
+
|
|
36
39
|
Reviewer lists live in `plugin-data/follow-through/reviewers.json` (owner-only), apart from `state.json`. Each list is per repository, plus a default for repositories without one, and each user keeps their own. Collaborator and team suggestions are read with `gh api` only when you open Add reviewer. They are cached for ten minutes, and never polled.
|
|
37
40
|
|
|
38
41
|
The Needs-you inbox (beta) keeps one flag per root agent in `plugin-data/follow-through/inbox.json`. When a turn starts it reads the newest user message from the agent's recent timeline to tell your messages from automation, and it reads, never writes, Defer's `plugin-data/defer/queue.json`, Smart Session's `plugin-data/smart-session/compactions.json`, Session Guard's `plugin-data/session-guard/state.json` and Paseo's schedule records. An unknown or unreadable format counts as your message, which clears a flag rather than adding one. Signing off also clears Paseo's own unread dot for that agent. The first-run import and the restart check read only Paseo's agent list: an agent's last activity is its unread time or your last message to it, never Paseo's `updatedAt` (which the daemon rewrites in bulk), and they don't fetch timelines, which would load every agent. Closed and archived agents are never imported. Turning the inbox off stops all of this.
|
|
@@ -43,3 +46,5 @@ The Overseer (beta) is one Claude agent in a Follow-up workspace under `plugin-d
|
|
|
43
46
|
"What's this about?" keeps its overviews in `plugin-data/follow-through/about.json` (gist, overview, linked rows, when and from what; never raw history) and logs each model call's duration and cost to `ai-jobs.jsonl`. To write one it reads the root agent's latest steps from its live timeline only when Paseo already has the agent loaded; otherwise it reads the first and last part of the agent's provider transcript on disk (Claude Code's `~/.claude/projects`, Codex's `~/.codex/sessions`), read-only, and never wakes the agent. It reads subagent titles from Paseo's agent list, PR titles and bodies with `gh pr view`, and only the Linear issues and Slack threads the workspace itself links, through `mcpproxy call tool-read` (`linear:get_issue`, `slack-user:slack_read_thread`); there are no searches. The model is set under Settings → Agents (default Haiku). With Claude it runs as a headless `claude -p` with no tools, no MCP servers, no settings and no saved session. With Codex it runs as `codex exec --ephemeral` with no user config or rules, no shell tool and a read-only sandbox in an empty temporary folder. Either way it gets one turn, a 90-second timeout, and runs one call at a time; on timeout the whole process group is killed. Overviews are written ahead of time only for non-dormant workspaces in Needs you, at most 60 a day by default (Settings → Agents), and not while a Claude account is above 85% of a limit or the resource governor has paused background work; above its higher threshold, opening the section shows the cached overview and writes none.
|
|
44
47
|
|
|
45
48
|
Settings → Agents (`plugin-data/follow-through/agents.json`, its own file) chooses the provider, model, effort and mode for What's this about?, the Overseer, recovery agents and the priority ranker. Missing or invalid entries use the defaults. The provider and model list comes from Paseo's provider snapshot. It is read only when that settings screen opens, and cached for ten minutes. A changed Overseer setting is never applied mid-conversation: Home offers a restart, and the new Overseer is handed the old one's last steps (read from its transcript on disk when it isn't loaded). The old agent is left as it is. A recovery agent on a different provider than the main agent keeps the main agent's system prompt, MCP servers and tool policy, and drops its provider-specific model, mode and options. `FOLLOW_UP_OVERSEER_PROVIDER` ("provider/model") overrides the Overseer's setting; it exists only for isolated test daemons.
|
|
49
|
+
|
|
50
|
+
The ranker behind AI priority (beta) runs inside Follow-up's worker as bounded one-shot jobs (Claude or Codex, per the ranker role) through the shared job runner (`server/ai-jobs.ts`), one at a time and only while the resource governor allows background work. It reads Follow-up's own state, `mcpproxy call tool-read` for `linear:list_issues` (assigned to you) and `slack-user:slack_search_public_and_private` (DMs and mentions, last 48 hours), `gh search prs --review-requested=@me`, and the planning artifact through one Claude turn limited to the Artifact tool. It hashes those inputs and calls the model only when they changed. It writes only `plugin-data/follow-through/priorities.json` (its ranking, which replaces its previous one) and `ranker.json` (input hash, run count, source health, the day's plan summary, and Linear issues no workspace covers). It never stores raw artifact HTML or share keys. The provider, model, cadence and daily cap come from the ranker role in Settings → Agents; the plan reader always uses Claude, the only provider with the Artifact tool.
|
package/README.md
CHANGED
|
@@ -150,6 +150,19 @@ One agent you talk to about all your workspaces. It sits pinned at the top of Ho
|
|
|
150
150
|
|
|
151
151
|
Turn it off under Settings → **Overseer (beta)**. While it's off, search has no ask row.
|
|
152
152
|
|
|
153
|
+
#### AI priority (1.4 beta)
|
|
154
|
+
|
|
155
|
+
Home's **Priority** sort can come from a ranker that reads what's happening outside Paseo: your assigned Linear issues (priority, due date, project and milestone), Slack DMs and mentions from the last 48 hours, open GitHub review requests, and the CPO's weekly planning artifact. Each row then shows a one-line reason that names its source, such as "HER-1312 · Urgent · due today" or "Slack: Dana asked twice". Needs you still comes first, whatever the score.
|
|
156
|
+
|
|
157
|
+
- **When it runs:** about once an hour, Sunday to Thursday from 08:00 to 20:00 Israel time. **Re-rank now** in the sort menu runs it at any time, and so does asking the Overseer what to work on first. The menu says when it last ranked and names any source it couldn't read ("Ranked 12m ago · Slack unavailable").
|
|
158
|
+
- **What it costs:** it calls the model only when its inputs changed since the last run, and at most 24 times a day (Re-rank now isn't capped). A run at about 100 workspaces is one Sonnet call of roughly 10k input tokens, about $0.06 and 20 s. The weekly plan is read at most once a day, for about $0.03. Each run's cost and duration go to `ai-jobs.jsonl`.
|
|
159
|
+
- **What it touches:** everything is read-only: Follow-up's own state, read-only Linear and Slack tools through mcpproxy, `gh search prs`, and one read of the planning artifact with Claude's Artifact tool and no other tools. It never posts, comments or publishes. The artifact's link comes from `FOLLOW_UP_PLAN_URL`, or else from the morning-brief skill's source list (link only, without any share key).
|
|
160
|
+
- Linear issues assigned to you that no workspace covers are kept for a later "Not started" group; they aren't shown yet.
|
|
161
|
+
|
|
162
|
+
Turn it off under Settings → **Overseer (beta)** → **AI priority**.
|
|
163
|
+
|
|
164
|
+

|
|
165
|
+
|
|
153
166
|

|
|
154
167
|
|
|
155
168
|
### Choosing models
|
|
@@ -170,7 +183,7 @@ The choices live in `agents.json` in Follow-up's data folder. Anything missing o
|
|
|
170
183
|
Install the beta:
|
|
171
184
|
|
|
172
185
|
```sh
|
|
173
|
-
paseo plugin update follow-through --version 1.4.0-beta.
|
|
186
|
+
paseo plugin update follow-through --version 1.4.0-beta.7
|
|
174
187
|
# or, for a fresh install:
|
|
175
188
|
paseo plugin install npm:paseo-follow-up@beta
|
|
176
189
|
```
|
|
@@ -190,6 +203,7 @@ Betas publish to npm's `beta` dist-tag, so `paseo plugin update` without `--vers
|
|
|
190
203
|
- Follow-up never merges, turns on merge when ready, requests reviewers or archives on its own. **Merge** re-checks the stack, lists any PRs underneath that would merge first, and asks again.
|
|
191
204
|
- A merged PR is not the end: tasks such as production checks and open questions keep the workspace open until the main agent declares Done and everything has settled.
|
|
192
205
|
- Answers go out only when you click Send. Follow-up never answers for you.
|
|
206
|
+
- **It stays light on Paseo (1.4).** Follow-up keeps one shared view of Paseo's agents and workspaces. It reads the full list once at start, then updates it from Paseo's events: turns, permissions, archives and new agents or workspaces. It re-reads the list at most once a minute after a change, and every ten minutes otherwise. Home, the workspace panel, the pills and the Needs-you inbox all read that shared view, so opening them never makes Paseo list your workspaces again. In the app, the panel and pills draw from one shared poll that refreshes when an agent changes. The Needs-you list answers "unchanged" in a few bytes when nothing moved, and nothing polls while the app is in the background. At 120 workspaces and idle, Follow-up's worker makes about 1 request a minute to Paseo, down from about 60. With the app open it was about 140.
|
|
193
207
|
|
|
194
208
|
### Agents can do what you can click
|
|
195
209
|
|
package/client/brief.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useState } from "react";
|
|
2
|
+
import { browserKey, BROWSER_POLL_MS } from "./keys";
|
|
2
3
|
import { Platform, Pressable, Text, View, useWindowDimensions } from "react-native";
|
|
3
4
|
import { useQuery } from "@tanstack/react-query";
|
|
4
5
|
import { openExternalUrl, useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
@@ -109,7 +110,7 @@ export function BriefCard({ item, theme, layout, agentId, deps, embedded = false
|
|
|
109
110
|
const [details, setDetails] = useState(false);
|
|
110
111
|
const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
|
|
111
112
|
const workspace = b.workspaceId ? deps.workspace(b.workspaceId) : undefined;
|
|
112
|
-
const browser = useQuery({ queryKey:
|
|
113
|
+
const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), refetchInterval: BROWSER_POLL_MS, enabled: !!sheet });
|
|
113
114
|
if (b.state !== "open") return <Collapsed b={b} c={c} now={now} />;
|
|
114
115
|
|
|
115
116
|
const attention = c.statusWarning;
|
package/client/display.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { useEffect } from "react";
|
|
|
7
7
|
import { ActivityIndicator, Text, View } from "react-native";
|
|
8
8
|
import { displayPreferences, displayRpc } from "../shared/display";
|
|
9
9
|
import { sidebarVisibility } from "./sidebar-visibility";
|
|
10
|
+
import { appVisible, onVisible } from "./visibility";
|
|
10
11
|
|
|
11
12
|
type Display = import("zod").infer<typeof displayPreferences.schema>;
|
|
12
13
|
const listeners = new Set<(values: Display) => void>();
|
|
@@ -66,6 +67,7 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
66
67
|
<SettingsSection title="Overseer (beta)" info="One agent you can ask about all your work. It sends each task to the agent that owns it and asks you when it isn't sure.">
|
|
67
68
|
<SettingsCard>
|
|
68
69
|
<SettingsSwitch label="Overseer" hint="Off hides its row on Home and stops its digest. An Overseer you already started stays in its workspace; Follow-up never archives it." value={settings.values.enable_overseer} disabled={settings.saving} onValueChange={(enable_overseer) => save({ enable_overseer })} />
|
|
70
|
+
<SettingsSwitch label="AI priority" hint="Ranks Home's Priority sort from Linear, Slack, GitHub and the weekly plan. Read-only; runs hourly on workdays when something changed." value={settings.values.enable_ranker} disabled={settings.saving} onValueChange={(enable_ranker) => save({ enable_ranker })} />
|
|
69
71
|
</SettingsCard>
|
|
70
72
|
</SettingsSection>
|
|
71
73
|
</>
|
|
@@ -98,11 +100,14 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
|
|
|
98
100
|
// Retain the last valid preference through temporary disconnects.
|
|
99
101
|
} finally { pending = false; }
|
|
100
102
|
};
|
|
103
|
+
// Changes made on this client notify at once; other clients' changes are picked up within a minute, and not at all
|
|
104
|
+
// while the app is hidden (it reads once on return).
|
|
101
105
|
void refresh();
|
|
102
|
-
const timer = setInterval(() => void refresh(),
|
|
106
|
+
const timer = setInterval(() => { if (appVisible()) void refresh(); }, 60_000);
|
|
107
|
+
const offVisible = onVisible(() => void refresh());
|
|
103
108
|
return () => {
|
|
104
109
|
disposed = true;
|
|
105
|
-
clearInterval(timer);
|
|
110
|
+
clearInterval(timer); offVisible();
|
|
106
111
|
listeners.delete(update);
|
|
107
112
|
sidebar.dispose();
|
|
108
113
|
};
|
package/client/home-chrome.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
|
2
2
|
import { Platform, Pressable, Text, TextInput, View } from "react-native";
|
|
3
|
-
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
4
4
|
import { GROUP_TITLE, homeCounts, type HomeGroupId, type HomeModel } from "../shared/home";
|
|
5
5
|
import { FIELD_LABEL, excerpt, highlightRuns, homeSearchDocs, indexDocs, defaultActive, omniboxResults, overseerProvider, workspaceProvider, type OmniboxItem, type OmniboxProvider, type Range, type WorkspaceItem } from "../shared/search";
|
|
6
6
|
import { SORT_HINT, SORT_LABEL, SORT_MODES, type SortMode } from "../shared/sort";
|
|
@@ -112,14 +112,30 @@ export function SearchField({ theme, omnibox, dense, onEnter }: { theme: Theme;
|
|
|
112
112
|
|
|
113
113
|
// ---------- sort ----------
|
|
114
114
|
|
|
115
|
-
export
|
|
115
|
+
export type RankState = { enabled: boolean; running: boolean; healthLine: string; error: string | null } | null;
|
|
116
|
+
|
|
117
|
+
export function SortMenu({ theme, mode, onChange, rankedAt, touch, rank = null, onRerank }: { theme: Theme; mode: SortMode; onChange: (m: SortMode) => void; rankedAt: string | null; touch: boolean; rank?: RankState; onRerank?: () => Promise<{ ok: boolean; skipped: string | null; error: string | null; top?: { title: string }[] }> }) {
|
|
116
118
|
const c = theme.colors;
|
|
117
119
|
const [open, setOpen] = useState(false);
|
|
118
120
|
const now = useMinute();
|
|
121
|
+
const toast = useToast();
|
|
122
|
+
const running = !!rank?.running;
|
|
123
|
+
const rerank = async () => {
|
|
124
|
+
if (!onRerank || running) return;
|
|
125
|
+
setOpen(false);
|
|
126
|
+
try {
|
|
127
|
+
const r = await onRerank();
|
|
128
|
+
if (!r.ok) toast.error(r.error ?? "Couldn't re-rank.");
|
|
129
|
+
else if (r.skipped === "busy") toast.show("Already re-ranking");
|
|
130
|
+
else toast.show(r.skipped === "same" ? "Nothing new in Linear, Slack, GitHub or the plan since the last ranking" : r.top?.[0] ? `Re-ranked · ${r.top[0].title} first` : "Re-ranked", { variant: "success" });
|
|
131
|
+
} catch (e) { toast.error(e instanceof Error ? e.message : String(e)); }
|
|
132
|
+
};
|
|
133
|
+
// "Ranked 12m ago · Slack unavailable": the age, then any source the last run couldn't read.
|
|
134
|
+
const note = running ? "Re-ranking…" : [priorityNote(rankedAt, now), rank?.enabled ? rank.healthLine : ""].filter(Boolean).join(" · ");
|
|
119
135
|
return <View style={{ position: "relative", zIndex: 20 }}>
|
|
120
136
|
<Pressable accessibilityRole="button" accessibilityLabel={`Sort: ${SORT_LABEL[mode]}`} aria-expanded={open} accessibilityState={{ expanded: open }} onPress={() => setOpen(o => !o)}
|
|
121
137
|
style={state => ({ flexDirection: "row", alignItems: "center", gap: 4, height: touch ? 36 : 30, paddingHorizontal: 8, borderRadius: 6, backgroundColor: open || (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
|
|
122
|
-
<Icon name="ArrowUpDown" size={13} color={c.foregroundMuted} />
|
|
138
|
+
{running ? <Spinner color={c.foregroundMuted} size={12} label="Re-ranking" /> : <Icon name="ArrowUpDown" size={13} color={c.foregroundMuted} />}
|
|
123
139
|
<Text numberOfLines={1} style={{ color: c.foreground, fontSize: 12 }}>{SORT_LABEL[mode]}</Text>
|
|
124
140
|
<Icon name="ChevronDown" size={12} color={c.foregroundMuted} />
|
|
125
141
|
</Pressable>
|
|
@@ -133,7 +149,14 @@ export function SortMenu({ theme, mode, onChange, rankedAt, touch }: { theme: Th
|
|
|
133
149
|
<Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 11, lineHeight: 15 }}>{SORT_HINT[m]}</Text>
|
|
134
150
|
</View>
|
|
135
151
|
</Pressable>)}
|
|
136
|
-
<
|
|
152
|
+
<View style={{ marginTop: 4, borderTopWidth: 1, borderTopColor: c.border, paddingTop: 2 }}>
|
|
153
|
+
{rank?.enabled && onRerank && <Pressable accessibilityRole="menuitem" accessibilityState={{ busy: running, disabled: running }} disabled={running} onPress={() => void rerank()}
|
|
154
|
+
style={state => ({ flexDirection: "row", alignItems: "center", gap: 8, minHeight: touch ? 44 : 34, paddingHorizontal: 10, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
|
|
155
|
+
<View style={{ width: 14 }}>{running ? <Spinner color={c.foregroundMuted} size={12} label="Re-ranking" /> : <Icon name="RefreshCw" size={13} color={c.foreground} />}</View>
|
|
156
|
+
<Text style={{ color: running ? c.foregroundMuted : c.foreground, fontSize: 13 }}>{running ? "Re-ranking…" : "Re-rank now"}</Text>
|
|
157
|
+
</Pressable>}
|
|
158
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 11, paddingHorizontal: 10, paddingTop: 4, paddingBottom: 4 }}>Priority: {note}</Text>
|
|
159
|
+
</View>
|
|
137
160
|
</View>}
|
|
138
161
|
</View>;
|
|
139
162
|
}
|
|
@@ -285,12 +308,12 @@ export function AskRow({ ask, theme, active, dense, touch, sending, onPress }: {
|
|
|
285
308
|
}
|
|
286
309
|
|
|
287
310
|
/** The muted reason and source chip a fresh external priority adds to a row. */
|
|
288
|
-
export function PriorityLine({ reason, source, c, size = 12 }: { reason: string; source: { kind: keyof typeof PRIORITY_SOURCE_LABEL; label: string } | null; c: Colors; size?: number }) {
|
|
311
|
+
export function PriorityLine({ reason, source, c, size = 12, lines = 1 }: { reason: string; source: { kind: keyof typeof PRIORITY_SOURCE_LABEL; label: string } | null; c: Colors; size?: number; lines?: number }) {
|
|
289
312
|
return <View style={{ flexDirection: "row", alignItems: "center", gap: 6, minWidth: 0 }}>
|
|
290
313
|
{source && <View style={{ paddingHorizontal: 5, height: 16, justifyContent: "center", borderRadius: 3, backgroundColor: c.surface2 }}>
|
|
291
314
|
<Text numberOfLines={1} style={{ color: c.foregroundMuted, fontSize: 10, lineHeight: 13 }}>{PRIORITY_SOURCE_LABEL[source.kind]}</Text>
|
|
292
315
|
</View>}
|
|
293
|
-
<Text numberOfLines={
|
|
316
|
+
<Text numberOfLines={lines} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: size, fontStyle: "italic" }}>{reason}</Text>
|
|
294
317
|
</View>;
|
|
295
318
|
}
|
|
296
319
|
|
package/client/home-list.tsx
CHANGED
|
@@ -237,18 +237,18 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect }: Ro
|
|
|
237
237
|
{(!!s.word || !!s.line) && <Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>
|
|
238
238
|
{s.word && s.group === "needs" ? <Text style={{ color, fontWeight: "600" }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
239
239
|
</Text>}
|
|
240
|
-
{s.priority && <PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} size={11} />}
|
|
240
|
+
{!!s.priority?.reason && <PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} size={11} lines={2} />}
|
|
241
241
|
{touch && (s.pr || s.badges.length > 0) && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6, marginTop: 4 }}>
|
|
242
242
|
{s.badges.map(b => <BadgeView key={b.text} b={b} c={c} />)}<PrChipView s={s} c={c} />
|
|
243
243
|
</View>}
|
|
244
|
-
</View> : <View style={{ flex: 1, minWidth: 0, gap: 1, paddingVertical: s.priority ? 4 : 0 }}><View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
244
|
+
</View> : <View style={{ flex: 1, minWidth: 0, gap: 1, paddingVertical: s.priority?.reason ? 4 : 0 }}><View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
245
245
|
<Text numberOfLines={1} style={{ flexShrink: 0, maxWidth: "55%", color: muted ? c.foregroundMuted : c.foreground, fontSize: 13, fontWeight: muted ? "400" : "500" }}>{s.title}{s.agent ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{` › ${s.agent}`}</Text> : null}</Text>
|
|
246
246
|
<Text numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 12 }}>
|
|
247
247
|
{s.word && s.group === "needs" ? <Text style={{ color }}>{s.word}</Text> : null}{s.word && s.group === "needs" && s.line ? " · " : ""}{line}
|
|
248
248
|
</Text>
|
|
249
249
|
{s.badges.map(b => <BadgeView key={b.text} b={b} c={c} />)}
|
|
250
250
|
<PrChipView s={s} c={c} />
|
|
251
|
-
</View>{s.priority && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
|
|
251
|
+
</View>{!!s.priority?.reason && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
|
|
252
252
|
<Age iso={s.at} c={c} size={dense ? 11 : 12} />
|
|
253
253
|
</Pressable>;
|
|
254
254
|
}, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect);
|
package/client/home-view.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
|
-
import { overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, usageRpc } from "../shared/contracts";
|
|
2
|
+
import { overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, rankNowRpc, rankStatusRpc, usageRpc } from "../shared/contracts";
|
|
3
3
|
import type { RpcOutput } from "@getpaseo/plugin";
|
|
4
4
|
import type { Priority } from "../shared/priorities";
|
|
5
5
|
import { DEFAULT_SORT, isSortMode, type SortMode } from "../shared/sort";
|
|
6
6
|
import type { AgentLite } from "../shared/search";
|
|
7
7
|
import { NO_USAGE, USAGE_POLL_MS, type Usage } from "../shared/usage";
|
|
8
|
+
import { onVisible, whileVisible } from "./visibility";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* What Home adds on top of the inbox, live and Paseo stores (1.3.0-beta.2): the sort choice (per device), external
|
|
@@ -28,6 +29,7 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
28
29
|
let priorities: Priority[] = [];
|
|
29
30
|
let usage: Usage = NO_USAGE;
|
|
30
31
|
let overseer: RpcOutput<typeof overseerStatusRpc> | null = null;
|
|
32
|
+
let rank: RpcOutput<typeof rankStatusRpc> | null = null;
|
|
31
33
|
const agents = new Map<string, AgentLite>();
|
|
32
34
|
let version = 0;
|
|
33
35
|
let focusToken = 0;
|
|
@@ -39,16 +41,33 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
39
41
|
const emitSoon = () => { if (pending) return; pending = setTimeout(() => { pending = null; emit(); }, 250); };
|
|
40
42
|
|
|
41
43
|
const timers: ReturnType<typeof setTimeout>[] = [];
|
|
44
|
+
// Nothing polls while the app is hidden; each poll runs once when it comes back (1.4.0).
|
|
45
|
+
const runs: (() => Promise<void>)[] = [];
|
|
42
46
|
const poll = (ms: number, work: () => Promise<boolean>) => {
|
|
43
|
-
|
|
47
|
+
let waiting = false;
|
|
48
|
+
const run = async () => {
|
|
49
|
+
waiting = false;
|
|
50
|
+
try { if (await work()) emit(); } catch { /* keep the last answer */ }
|
|
51
|
+
if (stopped) return;
|
|
52
|
+
const next = whileVisible(ms, () => void run());
|
|
53
|
+
if (next) timers.push(next); else waiting = true;
|
|
54
|
+
};
|
|
55
|
+
runs.push(async () => { if (waiting) await run(); });
|
|
44
56
|
void run();
|
|
45
57
|
};
|
|
58
|
+
const offVisible = onVisible(() => { for (const r of runs) void r(); });
|
|
46
59
|
poll(PRIORITY_POLL_MS, async () => {
|
|
47
60
|
const next = (await client.rpc(prioritiesRpc, {})).items;
|
|
48
61
|
if (JSON.stringify(next) === JSON.stringify(priorities)) return false;
|
|
49
62
|
priorities = next; return true;
|
|
50
63
|
});
|
|
51
|
-
|
|
64
|
+
// The ranker's last run and source health, with the priorities (the ranker runs at most hourly).
|
|
65
|
+
poll(PRIORITY_POLL_MS, async () => {
|
|
66
|
+
const next = await client.rpc(rankStatusRpc, {});
|
|
67
|
+
if (JSON.stringify(next) === JSON.stringify(rank)) return false;
|
|
68
|
+
rank = next; return true;
|
|
69
|
+
});
|
|
70
|
+
poll(15_000, async () => {
|
|
52
71
|
const next = await client.rpc(overseerStatusRpc, {});
|
|
53
72
|
if (JSON.stringify(next) === JSON.stringify(overseer)) return false;
|
|
54
73
|
overseer = next; return true;
|
|
@@ -67,21 +86,32 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
67
86
|
if (prior && prior.title === next.title && prior.workspaceId === next.workspaceId) return;
|
|
68
87
|
agents.set(a.id, next); emitSoon();
|
|
69
88
|
};
|
|
89
|
+
// Push for the inbox and live stores (1.4.0): an agent's status, attention or permissions changing is when Needs you
|
|
90
|
+
// and the pills can change, so those stores re-read then instead of polling every few seconds.
|
|
91
|
+
const activity = new Set<() => void>();
|
|
92
|
+
const signatures = new Map<string, string>();
|
|
93
|
+
const noteActivity = (a: unknown) => {
|
|
94
|
+
const x = a as { id?: string; status?: string; requiresAttention?: boolean; attentionReason?: string | null; pendingPermissions?: unknown[]; archivedAt?: string | null } | undefined;
|
|
95
|
+
if (!x?.id) return;
|
|
96
|
+
const signature = [x.status, x.requiresAttention, x.attentionReason, x.pendingPermissions?.length ?? 0, x.archivedAt].join("|");
|
|
97
|
+
const prior = signatures.get(x.id); signatures.set(x.id, signature);
|
|
98
|
+
if (prior !== undefined && prior !== signature) for (const l of activity) l();
|
|
99
|
+
};
|
|
70
100
|
const unsubscribe = client.paseo.agents.subscribe(update => {
|
|
71
101
|
const u = update as { kind: string; agent?: AgentEntry["agent"]; agentId?: string };
|
|
72
|
-
if (u.kind === "remove") { if (u.agentId && agents.delete(u.agentId)) emitSoon(); }
|
|
73
|
-
else putAgent(u.agent);
|
|
102
|
+
if (u.kind === "remove") { if (u.agentId && agents.delete(u.agentId)) emitSoon(); if (u.agentId) signatures.delete(u.agentId); for (const l of activity) l(); }
|
|
103
|
+
else { putAgent(u.agent); noteActivity(u.agent); }
|
|
74
104
|
});
|
|
75
105
|
let release: (() => Promise<void>) | null = null;
|
|
76
106
|
void (async () => {
|
|
77
107
|
const page = await client.paseo.agents.list({ subscribe: {}, page: { limit: 200 } });
|
|
78
108
|
if (stopped) { await page.subscription.release(); return; }
|
|
79
109
|
release = () => page.subscription.release();
|
|
80
|
-
(page.entries as AgentEntry[]).forEach(e => putAgent(e.agent));
|
|
110
|
+
(page.entries as AgentEntry[]).forEach(e => { putAgent(e.agent); noteActivity(e.agent); });
|
|
81
111
|
let cursor = page.pageInfo.nextCursor;
|
|
82
112
|
for (let i = 0; cursor && !stopped && i < 20; i++) {
|
|
83
113
|
const next = await client.paseo.agents.list({ page: { limit: 200, cursor } });
|
|
84
|
-
(next.entries as AgentEntry[]).forEach(e => putAgent(e.agent));
|
|
114
|
+
(next.entries as AgentEntry[]).forEach(e => { putAgent(e.agent); noteActivity(e.agent); });
|
|
85
115
|
if (next.pageInfo.nextCursor === cursor) break;
|
|
86
116
|
cursor = next.pageInfo.nextCursor;
|
|
87
117
|
}
|
|
@@ -94,6 +124,17 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
94
124
|
setSort(next: SortMode) { if (next === sort) return; sort = next; storage.set(SORT_KEY, next); emit(); },
|
|
95
125
|
priorities: () => priorities,
|
|
96
126
|
usage: () => usage,
|
|
127
|
+
/** The ranker: on or off, its last run and which sources it could read. */
|
|
128
|
+
rank: () => rank,
|
|
129
|
+
/** "Re-rank now": runs the ranker, then refreshes priorities and status. */
|
|
130
|
+
async rankNow() {
|
|
131
|
+
rank = rank ? { ...rank, running: true } : rank; emit();
|
|
132
|
+
try { return await client.rpc(rankNowRpc, { force: true }); }
|
|
133
|
+
finally {
|
|
134
|
+
const [p, st] = await Promise.all([client.rpc(prioritiesRpc, {}).catch(() => null), client.rpc(rankStatusRpc, {}).catch(() => null)]);
|
|
135
|
+
if (p) priorities = p.items; if (st) rank = st; emit();
|
|
136
|
+
}
|
|
137
|
+
},
|
|
97
138
|
/** The Overseer: off, not started yet, or its agent and workspace. */
|
|
98
139
|
overseer: () => overseer,
|
|
99
140
|
async startOverseer() { overseer = await client.rpc(overseerStartRpc, {}); emit(); return overseer; },
|
|
@@ -105,7 +146,9 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
105
146
|
/** Bumped by ⌘K "Follow-up: Search"; the visible search field focuses when it changes. */
|
|
106
147
|
focusToken: () => focusToken,
|
|
107
148
|
focusSearch() { focusToken++; emit(); },
|
|
108
|
-
|
|
149
|
+
/** Calls `listener` when an agent's status, attention or permissions change (see above). */
|
|
150
|
+
onActivity(listener: () => void) { activity.add(listener); return () => { activity.delete(listener); }; },
|
|
151
|
+
async stop() { stopped = true; offVisible(); activity.clear(); for (const t of timers) clearTimeout(t); if (pending) clearTimeout(pending); listeners.clear(); unsubscribe(); await release?.(); },
|
|
109
152
|
};
|
|
110
153
|
}
|
|
111
154
|
export type HomeExtras = ReturnType<typeof createHomeExtras>;
|
package/client/home.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { browserKey, BROWSER_POLL_MS } from "./keys";
|
|
2
3
|
import { Platform, Pressable, ScrollView, Text, TextInput, View } from "react-native";
|
|
3
4
|
import { usePaseo, useRpc, type PluginScreenProps } from "@getpaseo/plugin/client";
|
|
4
5
|
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
@@ -59,6 +60,7 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
|
|
|
59
60
|
const tracked = useSyncExternalStore(deps.sources.live.subscribe, deps.sources.live.version, deps.sources.live.version);
|
|
60
61
|
const rows = useInbox(inbox, () => inbox.rows());
|
|
61
62
|
const pane = useMemo(() => briefPane({ model, rows, tracked: deps.sources.live.all(), now: Date.now() }), [model, rows, tracked, deps.sources.live]);
|
|
63
|
+
const rank = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.rank, deps.sources.extras.rank);
|
|
62
64
|
const overseerStatus = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.overseer, deps.sources.extras.overseer);
|
|
63
65
|
const overseerInbox = useInbox(inbox, () => inbox.overseer());
|
|
64
66
|
const overseer = overseerRowState(overseerStatus, overseerInbox);
|
|
@@ -111,7 +113,7 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
|
|
|
111
113
|
strip and meters below if this row sits above them. */}
|
|
112
114
|
<View style={{ zIndex: 2, flexDirection: "row", alignItems: "center", gap: 6, paddingHorizontal: compact ? 12 : 16 }}>
|
|
113
115
|
<SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => void pick(item)} />
|
|
114
|
-
<SortMenu theme={theme} mode={model.sort} onChange={deps.sources.extras.setSort} rankedAt={model.rankedAt} touch={compact} />
|
|
116
|
+
<SortMenu theme={theme} mode={model.sort} onChange={deps.sources.extras.setSort} rankedAt={model.rankedAt} touch={compact} rank={rank} onRerank={deps.sources.extras.rankNow} />
|
|
115
117
|
</View>
|
|
116
118
|
{!omnibox.results && <StatusStrip theme={theme} model={model} filter={filter} onFilter={setFilter} touch={compact} dense={compact} />}
|
|
117
119
|
{!omnibox.results && <UsageMeters theme={theme} sources={deps.sources} dense={compact} />}
|
|
@@ -213,7 +215,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
|
|
|
213
215
|
const tail = useTail(agent.handle, `${row?.seq ?? 0}:${agent.status ?? ""}`);
|
|
214
216
|
const browserRead = useRpc(browserStatusRpc);
|
|
215
217
|
const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
|
|
216
|
-
const browser = useQuery({ queryKey:
|
|
218
|
+
const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), refetchInterval: BROWSER_POLL_MS, enabled: !!sheet });
|
|
217
219
|
const [question, setQuestion] = useState<string | null>(null);
|
|
218
220
|
const [laterOpen, setLaterOpen] = useState(false);
|
|
219
221
|
const [busy, setBusy] = useState<string | null>(null);
|
package/client/inbox-store.ts
CHANGED
|
@@ -3,13 +3,15 @@ import { inboxActRpc, inboxListRpc } from "../shared/contracts";
|
|
|
3
3
|
import type { RpcInput, RpcOutput } from "@getpaseo/plugin";
|
|
4
4
|
import type { InboxRow } from "../shared/inbox";
|
|
5
5
|
import { subscribeDisplay } from "./display";
|
|
6
|
-
import { onVisible,
|
|
6
|
+
import { onVisible, whileVisible } from "./visibility";
|
|
7
7
|
|
|
8
8
|
type List = RpcOutput<typeof inboxListRpc>;
|
|
9
9
|
export type Recent = { agentIds: string[]; label: string; at: number; batch: boolean };
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
/**
|
|
11
|
+
* The backstop poll. Changes arrive sooner by push: an agent's status or attention changing in Paseo's agent stream
|
|
12
|
+
* calls `nudge` (1.4.0). Nothing polls while the app is hidden; it refreshes once on return.
|
|
13
|
+
*/
|
|
14
|
+
const POLL_MS = 15_000;
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* One shared poll of the inbox for every surface on this client. Sign-offs apply optimistically;
|
|
@@ -32,7 +34,7 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
32
34
|
let stopped = false;
|
|
33
35
|
const listeners = new Set<() => void>();
|
|
34
36
|
const emit = () => { version++; for (const l of listeners) l(); };
|
|
35
|
-
const rpcList = (): Promise<List> => client.rpc(inboxListRpc, {});
|
|
37
|
+
const rpcList = (): Promise<List> => client.rpc(inboxListRpc, data?.etag ? { etag: data.etag } : {});
|
|
36
38
|
const act = (input: RpcInput<typeof inboxActRpc>) => client.rpc(inboxActRpc, input);
|
|
37
39
|
|
|
38
40
|
const poll = async () => {
|
|
@@ -44,15 +46,20 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
44
46
|
}
|
|
45
47
|
const next = await rpcList();
|
|
46
48
|
if (stopped) return;
|
|
49
|
+
// Nothing changed since the answer this store holds: keep it, and only re-render if we were offline.
|
|
50
|
+
if (next.unchanged && data) { if (offlineSince !== null || failures) { offlineSince = null; failures = 0; emit(); } return; }
|
|
47
51
|
data = next; offlineSince = null; failures = 0;
|
|
48
52
|
// Rows signed off while offline stay hidden until the replay lands.
|
|
49
53
|
emit();
|
|
50
54
|
} catch {
|
|
51
55
|
failures++;
|
|
52
56
|
if (failures >= 2 && offlineSince === null) { offlineSince = Date.now(); emit(); }
|
|
53
|
-
} finally { if (!stopped) timer =
|
|
57
|
+
} finally { if (!stopped) timer = whileVisible(POLL_MS, () => void poll()); }
|
|
54
58
|
};
|
|
55
59
|
const refresh = () => { if (timer) clearTimeout(timer); void poll(); };
|
|
60
|
+
let nudged: ReturnType<typeof setTimeout> | null = null;
|
|
61
|
+
/** Something changed in Paseo: refresh soon, coalescing a burst of agent updates into one read. */
|
|
62
|
+
const nudge = () => { if (nudged || stopped) return; nudged = setTimeout(() => { nudged = null; refresh(); }, 750); };
|
|
56
63
|
const unsubscribe = subscribeDisplay(values => {
|
|
57
64
|
const on = values.enable_inbox !== false;
|
|
58
65
|
if (on !== enabled) { enabled = on; emit(); if (on) refresh(); }
|
|
@@ -97,7 +104,8 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
97
104
|
recent: () => recent,
|
|
98
105
|
clearRecent() { recent = null; emit(); },
|
|
99
106
|
refresh,
|
|
100
|
-
|
|
107
|
+
nudge,
|
|
108
|
+
stop() { stopped = true; offVisible(); if (timer) clearTimeout(timer); if (nudged) clearTimeout(nudged); listeners.clear(); unsubscribe(); },
|
|
101
109
|
|
|
102
110
|
/** Sign off now; queue for replay when the host can't be reached. */
|
|
103
111
|
async signOff(requested: string[], options: { muteTurn?: boolean } = {}) {
|
package/client/keys.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/** React Query keys shared by every surface that reads Follow-up state. */
|
|
2
2
|
export const workspaceKey = (id: string) => ["follow-through", "workspace", id];
|
|
3
3
|
export const overviewKey = ["follow-through", "overview"];
|
|
4
|
+
/** The browser extension's connection status: one shared query for every surface (1.4.0: 15 s, was 5 s). */
|
|
5
|
+
export const browserKey = ["follow-through", "browser"];
|
|
6
|
+
export const BROWSER_POLL_MS = 15_000;
|
package/client/large.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useEffect } from "react";
|
|
2
2
|
import { Platform, Text, View } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { type PluginScreenProps } from "@getpaseo/plugin/client";
|
|
4
|
+
import { useWorkspace } from "./workspace-data";
|
|
5
|
+
import type { LiveStore } from "./live";
|
|
6
6
|
import { Button, Card, CardRow, errorText, text } from "./kit";
|
|
7
7
|
import { Skeleton } from "./motion";
|
|
8
|
-
import { PanelTop, WorkspaceView, useSessionFolds,
|
|
8
|
+
import { PanelTop, WorkspaceView, useSessionFolds, type PanelLinks } from "./panel";
|
|
9
9
|
|
|
10
10
|
export const LARGE_SCREEN = "follow-through-workspace";
|
|
11
11
|
|
|
@@ -13,12 +13,11 @@ export const LARGE_SCREEN = "follow-through-workspace";
|
|
|
13
13
|
* The panel opened as a Paseo screen: the host supplies the page, header and close button, and the
|
|
14
14
|
* layout switches to two columns. Collapse (or Esc) returns to the workspace, where the panel still is.
|
|
15
15
|
*/
|
|
16
|
-
export function FollowLarge(props: PluginScreenProps & PanelLinks) {
|
|
16
|
+
export function FollowLarge(props: PluginScreenProps & PanelLinks & { live?: LiveStore }) {
|
|
17
17
|
const { theme, layout, params, navigation } = props;
|
|
18
18
|
const workspaceId = params.workspaceId ?? "";
|
|
19
19
|
const c = theme.colors;
|
|
20
|
-
const
|
|
21
|
-
const query = useQuery({ queryKey: workspaceKey(workspaceId), queryFn: () => read({ workspaceId }), refetchInterval: 5000, enabled: !!workspaceId });
|
|
20
|
+
const query = useWorkspace(props.live, workspaceId);
|
|
22
21
|
const folds = useSessionFolds(workspaceId);
|
|
23
22
|
const back = () => navigation?.openWorkspace({ workspaceId });
|
|
24
23
|
|
|
@@ -39,10 +38,10 @@ export function FollowLarge(props: PluginScreenProps & PanelLinks) {
|
|
|
39
38
|
return () => doc.removeEventListener("keydown", onKey);
|
|
40
39
|
}, [navigation, workspaceId]);
|
|
41
40
|
|
|
42
|
-
if (query.
|
|
41
|
+
if (query.pending && workspaceId) return <View accessibilityLabel="Loading Follow-up" style={{ flex: 1, backgroundColor: c.surface0, padding: 24, gap: 12, maxWidth: 1240, width: "100%", alignSelf: "center" }}>
|
|
43
42
|
<Skeleton width="30%" height={16} color={c.surface2} /><Skeleton width="60%" height={10} color={c.surface2} /><Skeleton width="100%" height={6} color={c.surface2} radius={3} />
|
|
44
43
|
</View>;
|
|
45
|
-
const w = query.
|
|
44
|
+
const w = query.workspace;
|
|
46
45
|
if (!w) return <View style={{ flex: 1, backgroundColor: c.surface0, padding: layout.compact ? 16 : 24 }}>
|
|
47
46
|
<Card theme={theme} compact={layout.compact} icon="GitPullRequest" title="Nothing to show here" style={{ marginHorizontal: 0, marginTop: 0, maxWidth: 520 }}>
|
|
48
47
|
<CardRow theme={theme}>
|
|
@@ -52,7 +51,7 @@ export function FollowLarge(props: PluginScreenProps & PanelLinks) {
|
|
|
52
51
|
</Card>
|
|
53
52
|
</View>;
|
|
54
53
|
return <WorkspaceView theme={theme} layout={layout} host={props.host} navigation={navigation} workspace={w} large
|
|
55
|
-
loadError={query.error ? "Refresh failed. Showing the last saved state." : query.
|
|
54
|
+
loadError={query.error ? "Refresh failed. Showing the last saved state." : query.loadError}
|
|
56
55
|
openSettings={props.openSettings} openOverview={props.openOverview} folds={folds}
|
|
57
56
|
top={<PanelTop theme={theme} compact={layout.compact} openOverview={props.openOverview} />}
|
|
58
57
|
resize={navigation ? { icon: "Minimize2", label: "Back to the workspace (Esc)", onPress: back } : null} />;
|
package/client/live.tsx
CHANGED
|
@@ -8,11 +8,10 @@ import { needsYou } from "../shared/attention";
|
|
|
8
8
|
import { useSidebarViewActive } from "./inbox";
|
|
9
9
|
import { homeCounts } from "../shared/home";
|
|
10
10
|
import { useHomeModel, type HomeSources } from "./home-data";
|
|
11
|
-
import { onVisible,
|
|
11
|
+
import { onVisible, whileVisible } from "./visibility";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const HIDDEN_POLL_MS = 60_000;
|
|
13
|
+
/** The backstop poll; agent changes `nudge` it sooner (1.4.0). Nothing while the app is hidden. */
|
|
14
|
+
const POLL_MS = 15_000;
|
|
16
15
|
|
|
17
16
|
/** One shared poll of tracked workspaces for the pills, header-button dots and the sidebar count. */
|
|
18
17
|
export function createLiveStore(client: PluginClientContext) {
|
|
@@ -22,6 +21,7 @@ export function createLiveStore(client: PluginClientContext) {
|
|
|
22
21
|
let version = 0;
|
|
23
22
|
const listeners = new Set<() => void>();
|
|
24
23
|
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
24
|
+
let nudged: ReturnType<typeof setTimeout> | null = null;
|
|
25
25
|
let stopped = false;
|
|
26
26
|
/** The worker's list revision this store holds; each poll asks only for what changed since (1.3.0-beta.4). */
|
|
27
27
|
let revision: number | undefined;
|
|
@@ -41,7 +41,7 @@ export function createLiveStore(client: PluginClientContext) {
|
|
|
41
41
|
archived = [...all.values()].filter(w => w.archived);
|
|
42
42
|
emit();
|
|
43
43
|
} catch { /* Keep the last answer through restarts and disconnects. */ }
|
|
44
|
-
finally { if (!stopped) timer =
|
|
44
|
+
finally { if (!stopped) timer = whileVisible(POLL_MS, () => void poll()); }
|
|
45
45
|
};
|
|
46
46
|
const offVisible = onVisible(() => { if (timer) clearTimeout(timer); void poll(); });
|
|
47
47
|
void poll();
|
|
@@ -52,7 +52,9 @@ export function createLiveStore(client: PluginClientContext) {
|
|
|
52
52
|
all: () => [...workspaces.values()],
|
|
53
53
|
archived: () => archived,
|
|
54
54
|
refresh: () => { if (timer) clearTimeout(timer); void poll(); },
|
|
55
|
-
|
|
55
|
+
/** Paseo reported an agent change: one diff read soon, however many updates arrive together. */
|
|
56
|
+
nudge: () => { if (nudged || stopped) return; nudged = setTimeout(() => { nudged = null; if (timer) clearTimeout(timer); void poll(); }, 1_500); },
|
|
57
|
+
stop() { stopped = true; offVisible(); if (timer) clearTimeout(timer); if (nudged) clearTimeout(nudged); listeners.clear(); },
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
export type LiveStore = ReturnType<typeof createLiveStore>;
|
package/client/panel.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import type { InboxStore } from "./inbox-store";
|
|
|
7
7
|
import { useInbox } from "./inbox";
|
|
8
8
|
import { BriefCard, type BriefDeps } from "./brief";
|
|
9
9
|
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
10
|
-
import {
|
|
10
|
+
import { controlRpc, refreshRpc, browserStatusRpc, recoverRpc, sendRpc, inboxBriefRpc } from "../shared/contracts";
|
|
11
11
|
import { summary, type Workspace } from "../shared/model";
|
|
12
12
|
import { followUpObligations, recoveryBatch } from "../shared/follow-up";
|
|
13
13
|
import { settledForDisplay } from "../shared/presentation";
|
|
@@ -16,6 +16,9 @@ import { Button, Card, CardRow, FoldRow, IconButton, errorText, text, useNow, ty
|
|
|
16
16
|
import { Reveal, Skeleton } from "./motion";
|
|
17
17
|
import { WorkspaceHeader } from "./header";
|
|
18
18
|
import { NeedsYouCard, overviewKey, workspaceKey } from "./needs-you";
|
|
19
|
+
import { browserKey, BROWSER_POLL_MS } from "./keys";
|
|
20
|
+
import { useWorkspace } from "./workspace-data";
|
|
21
|
+
import type { LiveStore } from "./live";
|
|
19
22
|
import { StacksCard } from "./stacks";
|
|
20
23
|
import { TasksCard } from "./tasks";
|
|
21
24
|
import { PrSheet } from "./pr-sheet";
|
|
@@ -27,7 +30,7 @@ import { AboutSection } from "./about";
|
|
|
27
30
|
export { overviewKey, workspaceKey };
|
|
28
31
|
|
|
29
32
|
export type PanelLinks = { openSettings: () => void; openOverview: () => void; openLarge?: (workspaceId: string) => void };
|
|
30
|
-
type PanelProps = PluginWorkspacePanelProps & PanelLinks & { inbox?: InboxStore; briefDeps?: BriefDeps };
|
|
33
|
+
type PanelProps = PluginWorkspacePanelProps & PanelLinks & { inbox?: InboxStore; live?: LiveStore; briefDeps?: BriefDeps };
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* The workspace panel (explorer column, or a tab on the phone): this workspace only. A Home button on top, then
|
|
@@ -35,21 +38,21 @@ type PanelProps = PluginWorkspacePanelProps & PanelLinks & { inbox?: InboxStore;
|
|
|
35
38
|
* tasks, questions, spec, activity and Details. What needs you elsewhere lives on Home.
|
|
36
39
|
*/
|
|
37
40
|
export function FollowPanel(props: PanelProps) {
|
|
38
|
-
|
|
39
|
-
const query =
|
|
41
|
+
// Paints from the client's live store; one small read of this workspace on open, no poll (1.4.0).
|
|
42
|
+
const query = useWorkspace(props.live, props.workspaceId);
|
|
40
43
|
const c = props.theme.colors;
|
|
41
44
|
const base = { flex: 1, backgroundColor: c.surface0 };
|
|
42
|
-
if (query.
|
|
43
|
-
if (query.error && !query.
|
|
45
|
+
if (query.pending) return <PanelSkeleton theme={props.theme} compact={props.layout.compact} />;
|
|
46
|
+
if (query.error && !query.workspace) return <View style={[base, { padding: props.layout.compact ? 16 : 12 }]}>
|
|
44
47
|
<Card theme={props.theme} compact={props.layout.compact} icon="CloudOff" title="Can't reach Follow-up" style={{ marginHorizontal: 0, marginTop: 0 }}>
|
|
45
48
|
<CardRow theme={props.theme}>
|
|
46
49
|
<Text accessibilityRole="alert" style={[text(c).meta, { marginBottom: 10 }]}>The plugin didn't answer: {errorText(query.error)}. It may still be starting; your work is saved on the host.</Text>
|
|
47
|
-
<Button title="Try again" icon="RefreshCw" theme={props.theme} compact={props.layout.compact} loading={query.
|
|
50
|
+
<Button title="Try again" icon="RefreshCw" theme={props.theme} compact={props.layout.compact} loading={query.refetching} onPress={() => void query.refetch()} />
|
|
48
51
|
</CardRow>
|
|
49
52
|
</Card>
|
|
50
53
|
</View>;
|
|
51
|
-
if (!query.
|
|
52
|
-
return <PanelWorkspace {...props} workspace={query.
|
|
54
|
+
if (!query.workspace) return <NothingYet {...props} loadError={query.loadError} />;
|
|
55
|
+
return <PanelWorkspace {...props} workspace={query.workspace} loadError={query.error ? "Refresh failed. Showing the last saved state." : query.loadError} />;
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
function PanelSkeleton({ theme, compact }: { theme: Theme; compact: boolean }) {
|
|
@@ -249,7 +252,7 @@ export function WorkspaceView({ theme, layout, workspace: w, navigation, loadErr
|
|
|
249
252
|
const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" | null } | null>(null);
|
|
250
253
|
const [question, setQuestion] = useState<string | null>(null);
|
|
251
254
|
const [specOpen, setSpecOpen] = useState(false);
|
|
252
|
-
const browser = useQuery({ queryKey:
|
|
255
|
+
const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), refetchInterval: BROWSER_POLL_MS });
|
|
253
256
|
const invalidated = () => { void cache.invalidateQueries({ queryKey: workspaceKey(w.id) }); void cache.invalidateQueries({ queryKey: overviewKey }); };
|
|
254
257
|
const auto = useMutation({ mutationFn: (next: boolean) => control({ workspaceId: w.id, enable_auto_sends: next }), onSuccess: (_, next) => { toast.show(next ? "Auto-send on for this workspace" : "Auto-send off · repairs wait for your click"); invalidated(); }, onError: e => toast.error(errorText(e)) });
|
|
255
258
|
const update = useMutation({ mutationFn: () => refresh({ workspaceId: w.id }), onSuccess: () => setTimeout(invalidated, 1200), onError: e => toast.error(errorText(e)) });
|