paseo-follow-up 1.4.0-beta.3 → 1.4.0-beta.5
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 +3 -1
- package/README.md +14 -1
- package/client/agents.tsx +127 -0
- package/client/home-view.ts +3 -1
- package/client/home.tsx +19 -5
- package/client/settings.tsx +2 -0
- package/index.server.ts +56 -6
- package/package.json +1 -1
- package/server/about.ts +15 -4
- package/server/agent-actions.ts +11 -2
- package/server/agent-hook.mjs +32 -8
- package/server/agent-settings.ts +124 -0
- package/server/ai-jobs.ts +75 -20
- package/server/daemon.ts +7 -3
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +1 -1
- package/server/mcp.mjs +3 -2
- package/server/overseer.ts +50 -6
- package/server/recovery-config.ts +17 -0
- package/shared/about.ts +6 -3
- package/shared/agent-settings.ts +169 -0
- package/shared/contracts.ts +8 -1
- package/shared/overseer.ts +5 -0
package/OVERVIEW.md
CHANGED
|
@@ -40,4 +40,6 @@ The Needs-you inbox (beta) keeps one flag per root agent in `plugin-data/follow-
|
|
|
40
40
|
The brief (beta) is stored on the agent's inbox entry and appended to its timeline as a Follow-up row; re-appending replaces that row, and the restart check ignores the `updatedAt` change the append causes because it never reads `updatedAt`. To build a brief Follow-up reads only what it already has: the agent's `needs_you` call, the permission request's title, the failed turn's error message, Session Guard's note and reset time for a paused agent, and its own PR state. It does not read or quote the agent's reply. While the inbox is on, every root Paseo agent on Claude Code or Codex gets Follow-up's MCP bridge with the `needs_you` tool only (tracked main agents keep their full set), and `plugin-data/follow-through/brief.json` records whether the inbox and the nudge are on and which agents have a permission prompt showing. Clicking an option or Retry sends one message as you; it is logged in the delivery ledger as yours, so it clears the flag. The Stop hook, part of the same reversible provider hooks Follow-up already installs, now also runs for those root Claude Code sessions: if the turn ended without `needs_you`, it blocks the stop once with a one-line request to call it, records that it did in `hook-state`, and never blocks the same turn again. It reads `brief.json`, its own per-turn marker and the time of the agent's last `needs_you` call, and nothing else. Turn it off with *Ask agents to state what they need*; turning the inbox off stops it too.
|
|
41
41
|
|
|
42
42
|
The Overseer (beta) is one Claude agent in a Follow-up workspace under `plugin-data/follow-through/overseer-home`, labelled `follow-up.overseer=1` and created only when you click Start. Its id is kept in `plugin-data/follow-through/overseer.json`. Discovery, tracking, auto-send and Needs you skip its workspace. At the start of each of its turns, the provider hook adds a digest from `plugin-data/follow-through/overseer-digest.json` and records what it showed in `hook-state/overseer-seen-<agent>.json`. The worker builds that file from Paseo's workspace list (metadata only, at most once a minute) and Follow-up's own state. It rewrites the file only when the content changes, and skips it while the resource governor pauses background work. Its tools are `workstreams`, `agent_digest`, `route_candidates`, `send_to_agent` and `start_workspace`. For an agent that isn't loaded, `agent_digest` reads the provider's transcript on disk, read-only (Claude Code's `projects/<cwd>/<session>.jsonl`, Codex's `sessions/**/rollout-*-<thread>.jsonl`; only the last 512 KB, and never the credentials in Paseo's agent record). Without a transcript it uses Follow-up's goal and PR titles. It never reads that agent's timeline. `send_to_agent` writes your words to the delivery ledger first: as yours only when they answer that agent's open ask, otherwise as Follow-up's. It wakes a resting agent only because you asked for it. `start_workspace` runs only after your approval, through a dry run and confirm. The Overseer can't merge, archive or post anywhere.
|
|
43
|
-
"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 a headless `claude -p`
|
|
43
|
+
"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
|
+
|
|
45
|
+
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.
|
package/README.md
CHANGED
|
@@ -152,12 +152,25 @@ Turn it off under Settings → **Overseer (beta)**. While it's off, search has n
|
|
|
152
152
|
|
|
153
153
|

|
|
154
154
|
|
|
155
|
+
### Choosing models
|
|
156
|
+
|
|
157
|
+
Settings → **Agents** has one card for each agent Follow-up runs for you. Each card says what the agent does and what it uses now ("Claude · Haiku"). It lets you pick the provider, model, effort and, for full agents, the permission mode, and each card has **Reset to default**. The list comes from the providers and models Paseo knows about, read when you open the screen. Providers that aren't installed or are turned off are listed with the reason.
|
|
158
|
+
|
|
159
|
+
| Agent | Default | Notes |
|
|
160
|
+
|---|---|---|
|
|
161
|
+
| What's this about? | Claude · Haiku | One small call per overview, no tools. Claude (`claude -p`) or Codex (`codex exec`). Also sets how many overviews are written ahead per day (60). |
|
|
162
|
+
| Overseer | Claude · newest Opus, Bypass | A change applies when you restart it. Its pane on Home offers **Restart with …**, and the new Overseer gets the old one's last steps. |
|
|
163
|
+
| Recovery | Same as main agent | Or pick a provider and model. Switching provider keeps the main agent's tools and instructions. |
|
|
164
|
+
| Priority ranker | Claude · Sonnet, hourly, up to 24 a day | One call per run, no tools. Claude or Codex. |
|
|
165
|
+
|
|
166
|
+
The choices live in `agents.json` in Follow-up's data folder. Anything missing or invalid there falls back to the default. Agents can read the choices with the read-only `agent_settings` tool. The About footer names the model that wrote each overview ("Summarized by Haiku · 2h ago").
|
|
167
|
+
|
|
155
168
|

|
|
156
169
|
|
|
157
170
|
Install the beta:
|
|
158
171
|
|
|
159
172
|
```sh
|
|
160
|
-
paseo plugin update follow-through --version 1.4.0-beta.
|
|
173
|
+
paseo plugin update follow-through --version 1.4.0-beta.5
|
|
161
174
|
# or, for a fresh install:
|
|
162
175
|
paseo plugin install npm:paseo-follow-up@beta
|
|
163
176
|
```
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ActivityIndicator, Text, View } from "react-native";
|
|
2
|
+
import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
|
|
3
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { agentSettingsRpc, setAgentSettingRpc } from "../shared/contracts";
|
|
7
|
+
import { AGENT_ROLES, JOB_PROVIDERS, ROLE_DEFAULTS, ROLE_INFO, isJobRole, modelName, providerName, type AgentRole, type AgentSettingsView, type CatalogProvider, type SavedRole } from "../shared/agent-settings";
|
|
8
|
+
import { Button, errorText, text, type Theme } from "./kit";
|
|
9
|
+
|
|
10
|
+
const key = ["follow-through", "agent-settings"];
|
|
11
|
+
const SAME = "__same";
|
|
12
|
+
const DEFAULT = "__default";
|
|
13
|
+
/** Each provider's "don't ask" mode, used when a Paseo agent role moves to it. */
|
|
14
|
+
const BYPASS: Record<string, string> = { claude: "bypassPermissions", codex: "full-access" };
|
|
15
|
+
|
|
16
|
+
type Role = AgentSettingsView["roles"][number];
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Settings → Agents: one card per special role. What it does and what it uses now, then provider, model, effort,
|
|
20
|
+
* mode and limits. The provider catalog is read once when this screen opens (cached on the server), never polled.
|
|
21
|
+
*/
|
|
22
|
+
export function AgentSettings({ theme, compact }: Pick<PluginSurfaceProps, "theme"> & { compact: boolean }) {
|
|
23
|
+
const c = theme.colors; const t = text(c);
|
|
24
|
+
const read = useRpc(agentSettingsRpc); const write = useRpc(setAgentSettingRpc); const cache = useQueryClient(); const toast = useToast();
|
|
25
|
+
const query = useQuery({ queryKey: key, queryFn: () => read({ catalog: true }), staleTime: 5 * 60_000,
|
|
26
|
+
// Only while Paseo is still discovering providers (right after it starts): ask again until they settle.
|
|
27
|
+
refetchInterval: q => (q.state.data as AgentSettingsView | undefined)?.catalog?.providers.some(p => p.reason === "Still loading") && q.state.dataUpdateCount < 10 ? 5000 : false });
|
|
28
|
+
const change = useMutation({
|
|
29
|
+
mutationFn: (input: { role: AgentRole; entry: SavedRole | null }) => write(input),
|
|
30
|
+
onSuccess: (value, input) => {
|
|
31
|
+
cache.setQueryData(key, value);
|
|
32
|
+
void cache.invalidateQueries({ queryKey: ["follow-through", "about"] });
|
|
33
|
+
const r = value.roles.find(x => x.role === input.role);
|
|
34
|
+
if (r) toast.show(input.role === "overseer" ? `Overseer: ${r.summary}. Restart it from Home to switch.` : `${ROLE_INFO[input.role].title}: ${r.summary}`, { variant: "success" });
|
|
35
|
+
},
|
|
36
|
+
onError: error => toast.error(errorText(error)),
|
|
37
|
+
});
|
|
38
|
+
const data = query.data;
|
|
39
|
+
const info = "Which agent Follow-up uses for each of its own jobs. Defaults: Claude Haiku for overviews, Claude Opus for the Overseer, the main agent's own setup for recovery, Claude Sonnet for priority ranking. What's this about? and the ranker are one-shot jobs, so they run on Claude or Codex only; the Overseer and recovery can use any provider Paseo has. Changes apply from the next call; the Overseer switches when you restart it.";
|
|
40
|
+
return <SettingsSection title="Agents" info={info}>
|
|
41
|
+
{query.isPending && <ActivityIndicator accessibilityLabel="Loading agent settings" color={c.foregroundMuted} style={{ alignSelf: "flex-start", marginVertical: 8 }} />}
|
|
42
|
+
{query.error && <SettingsCard><SettingsAction label="Couldn't load agent settings" hint={errorText(query.error)} actionLabel="Retry" onPress={() => void query.refetch()} /></SettingsCard>}
|
|
43
|
+
{data?.catalog?.error && <SettingsCard><SettingsAction label="Couldn't read Paseo's providers" hint={`${data.catalog.error} The current choices still work; pickers show only what's saved.`} actionLabel="Retry" onPress={() => void read({ catalog: true, fresh: true }).then(v => cache.setQueryData(key, v), e => toast.error(errorText(e)))} /></SettingsCard>}
|
|
44
|
+
{/* Once for the section, not per card: what can't be picked and why. */}
|
|
45
|
+
{!!data?.catalog?.providers.some(p => !p.available) && <Text style={[t.meta, { paddingHorizontal: 4 }]}>{`Not available in Paseo: ${data.catalog.providers.filter(p => !p.available).map(p => `${p.label} (${(p.reason ?? "unavailable").replace(/\.$/, "")})`).join(", ")}.`}</Text>}
|
|
46
|
+
{data && AGENT_ROLES.map(role => {
|
|
47
|
+
const r = data.roles.find(x => x.role === role);
|
|
48
|
+
return r ? <RoleCard key={role} r={r} invalid={data.invalid.includes(role)} catalog={data.catalog?.providers ?? []} busy={change.isPending}
|
|
49
|
+
save={entry => change.mutate({ role, entry })} theme={theme} compact={compact} /> : null;
|
|
50
|
+
})}
|
|
51
|
+
</SettingsSection>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function RoleCard({ r, invalid, catalog, busy, save, theme, compact }: { r: Role; invalid: boolean; catalog: CatalogProvider[]; busy: boolean; save: (entry: SavedRole | null) => void; theme: Theme; compact: boolean }) {
|
|
55
|
+
const c = theme.colors; const t = text(c);
|
|
56
|
+
const role = r.role;
|
|
57
|
+
const jobs = isJobRole(role);
|
|
58
|
+
const usable = catalog.filter(p => p.available && (!jobs || (JOB_PROVIDERS as readonly string[]).includes(p.id)));
|
|
59
|
+
const current = catalog.find(p => p.id === r.provider);
|
|
60
|
+
const base: SavedRole = { provider: r.provider, model: r.model, thinking: r.thinking, ...(jobs ? {} : { mode: r.mode }), ...(role === "recovery" ? { same: r.same } : {}),
|
|
61
|
+
...(jobs ? { dailyCap: r.dailyCap ?? undefined, maxPromptChars: r.maxPromptChars ?? undefined } : {}), ...(role === "ranker" ? { cadenceMinutes: r.cadenceMinutes ?? undefined } : {}) };
|
|
62
|
+
const set = (patch: SavedRole) => save({ ...base, ...patch });
|
|
63
|
+
const providerLabel = providerName(r.provider, current?.label);
|
|
64
|
+
// Saved on a provider Paseo can't use right now: say so plainly, with what happens and the way out.
|
|
65
|
+
const blocked = !r.same && catalog.length > 0 && !usable.some(p => p.id === r.provider);
|
|
66
|
+
const blockedReason = !current ? "not in Paseo's provider list" : !current.available ? (current.reason ?? "unavailable").replace(/\.$/, "") : "can't run one-shot jobs";
|
|
67
|
+
|
|
68
|
+
const providerOptions = [
|
|
69
|
+
...(role === "recovery" ? [{ value: SAME, label: "Same as main agent" }] : []),
|
|
70
|
+
...usable.map(p => ({ value: p.id, label: p.label })),
|
|
71
|
+
...(!r.same && !usable.some(p => p.id === r.provider) ? [{ value: r.provider, label: `${providerLabel} · unavailable` }] : []),
|
|
72
|
+
];
|
|
73
|
+
const pickProvider = (value: string) => {
|
|
74
|
+
if (value === SAME) return set({ same: true });
|
|
75
|
+
const p = catalog.find(x => x.id === value);
|
|
76
|
+
const defaults = ROLE_DEFAULTS[role];
|
|
77
|
+
const same = value === defaults.provider;
|
|
78
|
+
set({ same: false, provider: value, model: same ? defaults.model : null, thinking: null, ...(jobs ? {} : { mode: same ? defaults.mode : BYPASS[value] ?? p?.defaultMode ?? null }) });
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const models = current?.models ?? [];
|
|
82
|
+
const model = r.model ? models.find(m => m.id === r.model) : null;
|
|
83
|
+
const providerDefault = models.find(m => m.isDefault);
|
|
84
|
+
const defaultModel = role === "overseer" && r.provider === "claude" ? "Default (newest Opus)" : providerDefault ? `Default (${providerDefault.label})` : "Default";
|
|
85
|
+
const modelOptions = [{ value: DEFAULT, label: defaultModel }, ...models.map(m => ({ value: m.id, label: m.label })),
|
|
86
|
+
...(r.model && !model ? [{ value: r.model, label: modelName(r.model) }] : [])];
|
|
87
|
+
const thinking = (model ?? providerDefault)?.thinking ?? [];
|
|
88
|
+
const thinkingDefault = thinking.find(o => o.isDefault);
|
|
89
|
+
const modes = current?.modes ?? [];
|
|
90
|
+
const modeDefault = modes.find(m => m.id === current?.defaultMode);
|
|
91
|
+
const modeLabel = (m: { id: string; label: string }) => BYPASS[r.provider] === m.id ? `${m.label} · no prompts` : m.label;
|
|
92
|
+
|
|
93
|
+
const reset = <Button theme={theme} compact={compact} kind="ghost" icon="RotateCcw" title="Reset to default" accessibilityHint={`Back to ${roleDefaultText(role)}`} disabled={busy || (r.isDefault && !invalid)} onPress={() => save(null)} />;
|
|
94
|
+
return <SettingsCard>
|
|
95
|
+
<View style={{ paddingHorizontal: 16, paddingTop: 14, paddingBottom: 10, gap: 2 }}>
|
|
96
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
97
|
+
<Text accessibilityRole="header" style={[t.title, { flex: 1 }]}>{ROLE_INFO[role].title}</Text>
|
|
98
|
+
{!compact && reset}
|
|
99
|
+
</View>
|
|
100
|
+
<Text style={t.meta}>{ROLE_INFO[role].does}{role === "overseer" ? " A running Overseer keeps its model until you restart it from Home." : ""}</Text>
|
|
101
|
+
{invalid && <Text style={t.meta}>Part of the saved setting wasn't valid, so its default is used.</Text>}
|
|
102
|
+
{blocked && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning }]}>{`${providerLabel} isn't available (${blockedReason}). ${role === "about" ? "Overviews will fail" : role === "ranker" ? "Ranking will fail" : role === "overseer" ? "Starting or restarting the Overseer will fail" : "Recovery agents won't start"} until you pick another provider or reset.`}</Text>}
|
|
103
|
+
</View>
|
|
104
|
+
<SettingsSelect label="Provider" value={r.same ? SAME : r.provider} options={providerOptions} disabled={busy || !catalog.length} onValueChange={pickProvider} />
|
|
105
|
+
{!r.same && <SettingsSelect label="Model" value={r.model ?? DEFAULT} options={modelOptions} disabled={busy || !catalog.length}
|
|
106
|
+
onValueChange={value => set({ model: value === DEFAULT ? null : value, thinking: null })} />}
|
|
107
|
+
{!r.same && (thinking.length > 0 || !!r.thinking) && <SettingsSelect label="Effort" hint={!thinking.length && !blocked && model ? "This model lists no effort levels in Paseo; the saved one is still passed on." : undefined} value={r.thinking ?? DEFAULT}
|
|
108
|
+
options={[{ value: DEFAULT, label: thinkingDefault ? `Default (${thinkingDefault.label})` : "Default" }, ...thinking.map(o => ({ value: o.id, label: o.label })), ...(r.thinking && !thinking.some(o => o.id === r.thinking) ? [{ value: r.thinking, label: r.thinking }] : [])]} disabled={busy}
|
|
109
|
+
onValueChange={value => set({ thinking: value === DEFAULT ? null : value })} />}
|
|
110
|
+
{!jobs && !r.same && modes.length > 0 && <SettingsSelect label="Permissions" hint="It runs unattended, so pick a mode that doesn't prompt." value={r.mode ?? DEFAULT}
|
|
111
|
+
options={[{ value: DEFAULT, label: modeDefault ? `Default (${modeLabel(modeDefault)})` : "Default" }, ...modes.map(m => ({ value: m.id, label: modeLabel(m) }))]} disabled={busy}
|
|
112
|
+
onValueChange={value => set({ mode: value === DEFAULT ? null : value })} />}
|
|
113
|
+
{role === "about" && <SettingsSelect label="Written ahead per day" hint="Overviews written in the background for workspaces in Needs you. Opening a workspace always writes one when needed."
|
|
114
|
+
value={String(r.dailyCap ?? 60)} options={withCurrent([0, 20, 60, 120, 200], r.dailyCap ?? 60).map(n => ({ value: String(n), label: n === 0 ? "None" : String(n) }))} disabled={busy}
|
|
115
|
+
onValueChange={value => set({ dailyCap: Number(value) })} />}
|
|
116
|
+
{role === "ranker" && <SettingsSelect label="Ranks every" value={String(r.cadenceMinutes ?? 60)} disabled={busy}
|
|
117
|
+
options={withCurrent([15, 30, 60, 120, 240], r.cadenceMinutes ?? 60).map(n => ({ value: String(n), label: n < 60 ? `${n} minutes` : n === 60 ? "Hour" : `${n / 60} hours` }))}
|
|
118
|
+
onValueChange={value => set({ cadenceMinutes: Number(value) })} />}
|
|
119
|
+
{role === "ranker" && <SettingsSelect label="At most per day" value={String(r.dailyCap ?? 24)} disabled={busy}
|
|
120
|
+
options={withCurrent([6, 12, 24, 48, 96], r.dailyCap ?? 24).map(n => ({ value: String(n), label: String(n) }))}
|
|
121
|
+
onValueChange={value => set({ dailyCap: Number(value) })} />}
|
|
122
|
+
{compact && <View style={{ flexDirection: "row", paddingHorizontal: 8, paddingVertical: 6 }}>{reset}</View>}
|
|
123
|
+
</SettingsCard>;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const roleDefaultText = (role: AgentRole) => role === "recovery" ? "the main agent's setup" : role === "overseer" ? "Claude, newest Opus" : role === "about" ? "Claude Haiku" : "Claude Sonnet, hourly";
|
|
127
|
+
const withCurrent = (list: number[], value: number) => [...new Set([...list, value])].sort((a, b) => a - b);
|
package/client/home-view.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PluginClientContext } from "@getpaseo/plugin/client";
|
|
2
|
-
import { overseerAskRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, usageRpc } from "../shared/contracts";
|
|
2
|
+
import { overseerAskRpc, overseerRestartRpc, overseerStartRpc, overseerStatusRpc, prioritiesRpc, 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";
|
|
@@ -99,6 +99,8 @@ export function createHomeExtras(client: PluginClientContext) {
|
|
|
99
99
|
async startOverseer() { overseer = await client.rpc(overseerStartRpc, {}); emit(); return overseer; },
|
|
100
100
|
/** Sends the omnibox's ask to the Overseer, starting it on first use. */
|
|
101
101
|
async askOverseer(text: string) { overseer = await client.rpc(overseerAskRpc, { text }); emit(); return overseer; },
|
|
102
|
+
/** Settings → Agents changed: a new Overseer on the configured agent, handed the old one's last steps. */
|
|
103
|
+
async restartOverseer() { overseer = await client.rpc(overseerRestartRpc, {}); emit(); return overseer; },
|
|
102
104
|
agents: () => [...agents.values()],
|
|
103
105
|
/** Bumped by ⌘K "Follow-up: Search"; the visible search field focuses when it changes. */
|
|
104
106
|
focusToken: () => focusToken,
|
package/client/home.tsx
CHANGED
|
@@ -100,7 +100,7 @@ export function FollowHome(props: PluginScreenProps & { deps: HomeDeps }) {
|
|
|
100
100
|
if (params.view === "log") return <LogView theme={theme} compact={compact} sources={deps.sources} onHome={deps.openHome} onOpen={key => { setSelected(key); deps.openHome(); }} />;
|
|
101
101
|
|
|
102
102
|
const detail = selected === OVERSEER_KEY && overseer
|
|
103
|
-
? <OverseerPane theme={theme} compact={compact} o={overseer} focus={replyFocus} pending={pendingAsk} agentId={overseerStatus?.agentId ?? null} deps={deps} navigation={navigation} onBack={compact ? () => setSelected(null) : undefined} />
|
|
103
|
+
? <OverseerPane theme={theme} compact={compact} o={overseer} focus={replyFocus} pending={pendingAsk} agentId={overseerStatus?.agentId ?? null} model={overseerStatus?.model ?? null} restartWith={overseerStatus?.restartWith ?? null} configured={overseerStatus?.configured ?? null} deps={deps} navigation={navigation} onBack={compact ? () => setSelected(null) : undefined} />
|
|
104
104
|
: current
|
|
105
105
|
? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} onBack={compact ? () => setSelected(null) : undefined} />
|
|
106
106
|
: <BriefPane theme={theme} compact={compact} pane={pane} onSelect={key => setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
|
|
@@ -296,7 +296,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, onB
|
|
|
296
296
|
* The Overseer's conversation on Home (1.4.0-beta.0): the tail and a reply box, like any agent's detail pane, plus its
|
|
297
297
|
* decision card when it asks which agent should get a task. Before the first start, one Start button.
|
|
298
298
|
*/
|
|
299
|
-
function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, deps, navigation, onBack }: { theme: Theme; compact: boolean; o: OverseerRowState; focus?: number; pending?: string | null; agentId: string | null; deps: HomeDeps; navigation: PluginScreenProps["navigation"]; onBack?: () => void }) {
|
|
299
|
+
function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, model, restartWith, configured, deps, navigation, onBack }: { theme: Theme; compact: boolean; o: OverseerRowState; focus?: number; pending?: string | null; agentId: string | null; model: string | null; restartWith: string | null; configured: string | null; deps: HomeDeps; navigation: PluginScreenProps["navigation"]; onBack?: () => void }) {
|
|
300
300
|
const c = theme.colors; const t = text(c);
|
|
301
301
|
const toast = useToast();
|
|
302
302
|
const { inbox, extras } = deps.sources;
|
|
@@ -307,6 +307,11 @@ function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, d
|
|
|
307
307
|
const brief = useQuery({ queryKey: ["follow-through", "overseer-brief", agentId, row?.seq ?? 0], queryFn: () => readBrief({ agentId: agentId! }), enabled: !!agentId && !!row?.brief });
|
|
308
308
|
const b = brief.data?.brief?.state === "open" ? brief.data.brief : null;
|
|
309
309
|
const [starting, setStarting] = useState(false);
|
|
310
|
+
const [restarting, setRestarting] = useState(false);
|
|
311
|
+
const restart = async () => {
|
|
312
|
+
if (restarting) return; setRestarting(true);
|
|
313
|
+
try { const next = await extras.restartOverseer(); toast.show(`The Overseer now runs on ${next?.model ?? restartWith}; its recent conversation was handed over`, { variant: "success" }); } catch (e) { toast.error(errorText(e)); } finally { setRestarting(false); }
|
|
314
|
+
};
|
|
310
315
|
const start = async () => {
|
|
311
316
|
if (starting) return; setStarting(true);
|
|
312
317
|
try { await extras.startOverseer(); toast.show("The Overseer is ready", { variant: "success" }); } catch (e) { toast.error(errorText(e)); } finally { setStarting(false); }
|
|
@@ -315,17 +320,23 @@ function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, d
|
|
|
315
320
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
316
321
|
{onBack && <IconButton theme={theme} compact icon="ChevronLeft" label="Back to Home" onPress={onBack} />}
|
|
317
322
|
<Icon name="MessagesSquare" size={16} color={c.foreground} />
|
|
318
|
-
<Text accessibilityRole="header" style={[t.title, {
|
|
323
|
+
<Text accessibilityRole="header" style={[t.title, { fontSize: 16 }]}>Overseer</Text>
|
|
324
|
+
<Text numberOfLines={1} style={[t.meta, { flex: 1, minWidth: 0 }]}>{model ?? ""}</Text>
|
|
319
325
|
{agentId && navigation && (compact
|
|
320
326
|
? <IconButton theme={theme} compact icon="PanelRightOpen" label="Open full" onPress={() => navigation.openAgent({ agentId })} />
|
|
321
327
|
: <Button theme={theme} icon="PanelRightOpen" title="Open full" accessibilityHint="Opens the Overseer's whole chat" onPress={() => navigation.openAgent({ agentId })} />)}
|
|
322
328
|
</View>
|
|
329
|
+
{/* Settings → Agents changed: offered, never done mid-conversation on its own. */}
|
|
330
|
+
{agentId && restartWith && <View style={{ flexDirection: "row", alignItems: "center", gap: 8, flexWrap: "wrap", paddingTop: 6 }}>
|
|
331
|
+
<Text style={[t.meta, { flex: 1, minWidth: 180 }]}>{`Running ${model ?? "its first model"} · Settings say ${restartWith}`}</Text>
|
|
332
|
+
<Button theme={theme} compact={compact} icon="RefreshCw" title={`Restart with ${short(restartWith)}`} accessibilityHint={`Starts a new Overseer on ${restartWith} and hands it the recent conversation`} loading={restarting} onPress={() => void restart()} />
|
|
333
|
+
</View>}
|
|
323
334
|
</View>;
|
|
324
335
|
if (o.state === "start") return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
|
|
325
336
|
{header}
|
|
326
337
|
<ScrollView contentContainerStyle={{ padding: compact ? 16 : 20, gap: 12 }}>
|
|
327
|
-
<Text style={[t.body, { fontSize: 15, lineHeight: 22 }]}>One
|
|
328
|
-
<Text style={t.meta}>It never merges, posts to people or archives. It starts a new workspace only when you say so. It runs on Opus in its own workspace, which stays off your lists.</Text>
|
|
338
|
+
<Text style={[t.body, { fontSize: 15, lineHeight: 22 }]}>One agent that knows every workspace's state. Tell it "the PRs look good, assign reviewers on all" or "tell the SCIM agent to use option B", and it finds the right agent and passes it on.</Text>
|
|
339
|
+
<Text style={t.meta}>It never merges, posts to people or archives. It starts a new workspace only when you say so. It runs on {configured ?? "Claude · Newest Opus"} in its own workspace, which stays off your lists. Change the model in Follow-up settings → Agents.</Text>
|
|
329
340
|
<View style={{ flexDirection: "row" }}><Button theme={theme} compact={compact} kind="primary" icon="Play" title="Start the Overseer" loading={starting} onPress={() => void start()} /></View>
|
|
330
341
|
</ScrollView>
|
|
331
342
|
</View>;
|
|
@@ -347,6 +358,9 @@ function OverseerPane({ theme, compact, o, focus = 0, pending = null, agentId, d
|
|
|
347
358
|
</View>;
|
|
348
359
|
}
|
|
349
360
|
|
|
361
|
+
/** "Codex · GPT-6-Luna · low" → "GPT-6-Luna · low": the button already says it's the Overseer's provider change. */
|
|
362
|
+
const short = (summary: string) => summary.split(" · ").slice(1).join(" · ") || summary;
|
|
363
|
+
|
|
350
364
|
function Step({ step, c, last }: { step: TailStep; c: Colors; last: boolean }) {
|
|
351
365
|
const t = text(c);
|
|
352
366
|
if (step.kind === "tool") return <View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
package/client/settings.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import { followSettingsRpc, projectSettingsRpc, setFollowSettingsRpc, setProject
|
|
|
9
9
|
import { errorText, text } from "./kit";
|
|
10
10
|
import { DisplaySections } from "./display";
|
|
11
11
|
import { ReviewerSettings } from "./reviewers";
|
|
12
|
+
import { AgentSettings } from "./agents";
|
|
12
13
|
|
|
13
14
|
const settingsKey = ["follow-through", "project-settings"];
|
|
14
15
|
|
|
@@ -119,6 +120,7 @@ export function FollowSettings({ theme, layout }: PluginSurfaceProps) {
|
|
|
119
120
|
<SettingsSection title="Reviewers" info="Who Add reviewers asks on a PR. Set a list per repository, or a default for every repository without one. A login is a GitHub user (octocat) or a team (org/team). Teammates each keep their own lists.">
|
|
120
121
|
<ReviewerSettings theme={theme} compact={layout.compact} />
|
|
121
122
|
</SettingsSection>
|
|
123
|
+
<AgentSettings theme={theme} compact={layout.compact} />
|
|
122
124
|
<QuestionSettings theme={theme} />
|
|
123
125
|
<DisplaySections theme={theme} />
|
|
124
126
|
</ScrollView>;
|
package/index.server.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { askQuestion, recordAnswer, syncTaskQuestions, withdrawQuestion } from "
|
|
|
4
4
|
import { agentSetSpec, developerSetSpec } from "./server/spec";
|
|
5
5
|
import type { PluginServerContext, PluginHandlerContext } from "@getpaseo/plugin/server";
|
|
6
6
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
7
|
+
import { mkdirSync, renameSync, writeFileSync } from "node:fs";
|
|
7
8
|
import { join } from "node:path";
|
|
8
9
|
import { randomUUID } from "node:crypto";
|
|
9
10
|
import * as rpc from "./shared/contracts";
|
|
@@ -52,6 +53,8 @@ import { pages, withDaemon } from "./server/daemon";
|
|
|
52
53
|
import { AiJobs } from "./server/ai-jobs";
|
|
53
54
|
import { AboutService, AboutStore, liveSources, rootHistory, type AboutContext } from "./server/about";
|
|
54
55
|
import { readTranscript } from "./server/transcript";
|
|
56
|
+
import { AgentSettingsStore, ProviderCatalog, type CatalogSource } from "./server/agent-settings";
|
|
57
|
+
import { labelsFor, providerName, resolveRole, roleSummary, type AgentSettingsView } from "./shared/agent-settings";
|
|
55
58
|
import type { LoadSignals } from "./shared/agent-load";
|
|
56
59
|
import { BRIEF_KIND, BRIEF_VERSION, prState, validateNeedsYou, type Brief, type NeedsYouRecord } from "./shared/brief";
|
|
57
60
|
|
|
@@ -62,6 +65,18 @@ export default function contribute(server: PluginServerContext) {
|
|
|
62
65
|
const questionMode = async (): Promise<QuestionMode> => { try { const state = await questionSettings.read(); return state.status === "ready" ? state.values.mode : DEFAULT_QUESTION_MODE; } catch { return DEFAULT_QUESTION_MODE; } };
|
|
63
66
|
const directory = join(paseoHome, "plugin-data", "follow-through");
|
|
64
67
|
const bridge = join(directory, "mcp.mjs");
|
|
68
|
+
/**
|
|
69
|
+
* Native tools live in this process: a reload or update drops them from every open session (Paseo 0.15.2 re-attaches
|
|
70
|
+
* only when a session reopens, which it does before that agent's next prompt). Each worker gets an instance id and each
|
|
71
|
+
* native session records the instance that attached its tools, so the agent hook can tell an agent mid-turn that its
|
|
72
|
+
* follow_ tools are gone and the bridge still works. Written synchronously, before any session can open.
|
|
73
|
+
*/
|
|
74
|
+
const toolsInstance = randomUUID();
|
|
75
|
+
try {
|
|
76
|
+
mkdirSync(join(directory, "hook-state"), { recursive: true, mode: 0o700 });
|
|
77
|
+
writeFileSync(join(directory, `tools-instance.json.${toolsInstance}`), JSON.stringify({ instance: toolsInstance }), { mode: 0o600 });
|
|
78
|
+
renameSync(join(directory, `tools-instance.json.${toolsInstance}`), join(directory, "tools-instance.json"));
|
|
79
|
+
} catch { /* Without it the hook assumes the tools are attached, as before. */ }
|
|
65
80
|
// Every RPC handler, also callable in-process: native agent tools run the same handlers the stdio bridge reaches.
|
|
66
81
|
const handlers = new Map<string, { input: { parseAsync(value: unknown): Promise<unknown> }; run: (input: any, context: PluginHandlerContext) => unknown }>();
|
|
67
82
|
const handle: PluginServerContext["handle"] = (contract, handler) => { handlers.set(contract.name, { input: contract.input, run: handler as never }); server.handle(contract, handler); };
|
|
@@ -70,6 +85,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
70
85
|
const agentHooks = new AgentHooks(directory, clientEntry());
|
|
71
86
|
const historyCache = HistoryCache.at(directory);
|
|
72
87
|
const gateway = new PaseoGateway(undefined, undefined, undefined, historyCache);
|
|
88
|
+
// Settings → Agents: which agent each special role uses, in agents.json (defaults when absent).
|
|
89
|
+
const agentSettings = new AgentSettingsStore(directory);
|
|
90
|
+
gateway.recoveryRole = () => agentSettings.role("recovery");
|
|
73
91
|
const graphite = new Graphite();
|
|
74
92
|
const github = new Github(undefined, graphite, new Deployments());
|
|
75
93
|
const browser = new BrowserBridge();
|
|
@@ -232,6 +250,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
232
250
|
if (process.env.FOLLOW_THROUGH_FORCE_STDIO !== "1" && nativeToolsAvailable(request, await paseoConfig())) {
|
|
233
251
|
const flags = { recovery, brief: !!brief && !recovery, root: root && !recovery, overseer: overseer && !recovery };
|
|
234
252
|
const env = { ...request.env, FOLLOW_THROUGH_TOOLS: "native", FOLLOW_THROUGH_PROVIDER: request.provider, ...(flags.root ? { FOLLOW_THROUGH_ROOT: "1" } : {}), ...(flags.overseer ? { FOLLOW_THROUGH_OVERSEER: "1" } : {}) };
|
|
253
|
+
if (/^[\w-]+$/.test(request.agentId)) await writeFile(join(directory, "hook-state", `native-${request.agentId}.json`), JSON.stringify({ instance: toolsInstance }), { mode: 0o600 }).catch(() => undefined);
|
|
235
254
|
return { ...request, env, tools: [...request.tools, ...nativeTools(flags, live, invoke)] };
|
|
236
255
|
}
|
|
237
256
|
return withSessionMcp({ ...request, env: { ...request.env, FOLLOW_THROUGH_TOOLS: "stdio", FOLLOW_THROUGH_PROVIDER: request.provider } }, directory, clientEntry(), paseoHome, recovery, process.env, brief, root, overseer, providers) as R;
|
|
@@ -538,11 +557,41 @@ export default function contribute(server: PluginServerContext) {
|
|
|
538
557
|
};
|
|
539
558
|
const overseerOn = async () => (await inboxSettings()).enable_overseer !== false;
|
|
540
559
|
overseer = new Overseer({ directory, store, inbox, priorities: priorityStore, workspaces: paseoWorkspaces, enabled: overseerOn, paseoHome, tight: async () => !governor.allowsBackground(),
|
|
541
|
-
windowMs: async () => activeWindowMs(await store.snapshot()),
|
|
542
|
-
|
|
560
|
+
windowMs: async () => activeWindowMs(await store.snapshot()), agent: () => agentSettings.role("overseer"),
|
|
561
|
+
// Harness override only (isolated test daemons): "provider/model" wins over Settings → Agents.
|
|
562
|
+
provider: process.env.FOLLOW_UP_OVERSEER_PROVIDER || undefined });
|
|
563
|
+
const overseerStatus = async () => {
|
|
564
|
+
const [s, info] = await Promise.all([overseer!.state(), overseer!.agentInfo()]);
|
|
565
|
+
// Labels from the last catalog Settings read (never fetched here: this is polled), so both surfaces say the same.
|
|
566
|
+
const catalog = providerCatalog.peek();
|
|
567
|
+
const runningModel = info.running?.model.replace(/^[^/]+\//, "") ?? "";
|
|
568
|
+
const running = info.running ? { ...resolveRole(null, "overseer"), provider: info.running.provider, model: runningModel || null } : null;
|
|
569
|
+
const model = running ? (runningModel ? roleSummary(running, labelsFor(running, catalog)) : `${providerName(running.provider, labelsFor(running, catalog).provider)} · Opus`) : null;
|
|
570
|
+
const role = await agentSettings.role("overseer");
|
|
571
|
+
const configured = roleSummary(role, labelsFor(role, catalog));
|
|
572
|
+
return { enabled: await overseerOn(), agentId: s.agentId, workspaceId: s.workspaceId, startedAt: s.startedAt, generation: s.generation, error: s.error,
|
|
573
|
+
model, restartWith: info.restart ? configured : null, configured };
|
|
574
|
+
};
|
|
543
575
|
handle(rpc.overseerStatusRpc, async () => { await requireReady(); return overseerStatus(); });
|
|
544
576
|
handle(rpc.overseerStartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.start(paseo as unknown as OverseerPaseo); return overseerStatus(); });
|
|
545
577
|
handle(rpc.overseerAskRpc, async ({ text }, { paseo }) => { await requireReady(); seen(paseo); await overseer!.ask(paseo as unknown as OverseerPaseo, text); return overseerStatus(); });
|
|
578
|
+
handle(rpc.overseerRestartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.restart(paseo as unknown as OverseerPaseo); return overseerStatus(); });
|
|
579
|
+
// The provider catalog for Settings → Agents: read only when that screen asks, cached ten minutes.
|
|
580
|
+
const providerCatalog = new ProviderCatalog(async () => {
|
|
581
|
+
const paseo = api;
|
|
582
|
+
if (!paseo) throw new Error("Paseo isn't connected yet");
|
|
583
|
+
// Paseo discovers providers lazily: on the first read they're still loading, so wait a little for them.
|
|
584
|
+
const snapshot = await paseo.providers.snapshot() as unknown as { entries?: { status?: string }[] };
|
|
585
|
+
if (!snapshot.entries?.some(e => e.status === "loading")) return snapshot as Awaited<ReturnType<CatalogSource>>;
|
|
586
|
+
return await paseo.providers.waitForReady({ timeoutMs: 8000 }).catch(() => snapshot) as unknown as Awaited<ReturnType<CatalogSource>>;
|
|
587
|
+
});
|
|
588
|
+
const agentSettingsView = async (catalog: boolean, fresh = false): Promise<AgentSettingsView> => {
|
|
589
|
+
const [{ invalid }, roles] = await Promise.all([agentSettings.load(), agentSettings.all()]);
|
|
590
|
+
const cat = catalog ? await providerCatalog.read(fresh) : null;
|
|
591
|
+
return { roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r, labelsFor(r, cat)) })), invalid, catalog: cat };
|
|
592
|
+
};
|
|
593
|
+
handle(rpc.agentSettingsRpc, async ({ catalog, fresh }, { paseo }) => { await requireReady(); seen(paseo); return agentSettingsView(!!catalog, !!fresh); });
|
|
594
|
+
handle(rpc.setAgentSettingRpc, async ({ role, entry }, { paseo }) => { await requireReady(); seen(paseo); await agentSettings.save(role, entry); return agentSettingsView(true); });
|
|
546
595
|
handle(rpc.overseerActRpc, async ({ agentId, tool, args }, { paseo }) => {
|
|
547
596
|
await requireReady(); seen(paseo);
|
|
548
597
|
if (!(OVERSEER_TOOLS as readonly string[]).includes(tool)) throw new Error(`Unknown Overseer tool ${tool}.`);
|
|
@@ -584,6 +633,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
584
633
|
};
|
|
585
634
|
};
|
|
586
635
|
const about = new AboutService({
|
|
636
|
+
role: () => agentSettings.role("about"),
|
|
587
637
|
store: new AboutStore(directory), jobs: aiJobs, sources: liveSources(),
|
|
588
638
|
workspace: async id => (await store.snapshot()).workspaces.find(w => w.id === id && w.enable_tracking && !w.archived) ?? null,
|
|
589
639
|
context: aboutContext, usage: () => usage.read(),
|
|
@@ -605,7 +655,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
605
655
|
if (!stopped) aboutTimer = setTimeout(() => void aboutLoop(), 10 * 60_000);
|
|
606
656
|
};
|
|
607
657
|
aboutTimer = setTimeout(() => void aboutLoop(), 60_000);
|
|
608
|
-
const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about });
|
|
658
|
+
const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings });
|
|
609
659
|
handle(rpc.prioritiesRpc, async () => ({ items: await priorityStore.read() }));
|
|
610
660
|
// Provider limits are non-essential: at critical memory only the VM meter is served.
|
|
611
661
|
handle(rpc.usageRpc, async () => ({ ...(governor.allowsExtras() ? await usage.read() : NO_USAGE), resources: governor.current() }));
|
|
@@ -705,9 +755,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
705
755
|
await ready;
|
|
706
756
|
if (loadError || stopped || request.purpose !== "interactive") return request;
|
|
707
757
|
// The Overseer: needs_you (no Stop-hook nudge), the action tools and its routing tools. Never tracked.
|
|
708
|
-
if (request.labels[OVERSEER_LABEL] === "1" &&
|
|
709
|
-
const env = { ...request.env, FOLLOW_THROUGH_OVERSEER: "1", FOLLOW_THROUGH_BRIEF:
|
|
710
|
-
return withTools({ ...request, env }, false,
|
|
758
|
+
if (request.labels[OVERSEER_LABEL] === "1" && ["claude", "codex"].includes(request.provider)) {
|
|
759
|
+
const env = { ...request.env, FOLLOW_THROUGH_OVERSEER: "1", FOLLOW_THROUGH_BRIEF: request.provider };
|
|
760
|
+
return withTools({ ...request, env }, false, request.provider, true, true);
|
|
711
761
|
}
|
|
712
762
|
const saved = await store.snapshot();
|
|
713
763
|
let w = saved.workspaces.find(w => w.enable_tracking && !w.archived && (w.mainAgentId === request.agentId || w.batches.some(b => b.recipientAgentId === request.agentId && !b.settledAt && b.tasks.every(t => t.kind === "inventory") && ["sending", "sent", "uncertain", "blocked"].includes(b.state))));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.4.0-beta.
|
|
4
|
+
"version": "1.4.0-beta.5",
|
|
5
5
|
"description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
package/server/about.ts
CHANGED
|
@@ -214,7 +214,7 @@ export async function enrichLinks(links: AboutLink[], sources: AboutSources): Pr
|
|
|
214
214
|
return { links: out.filter((l): l is AboutLink => !!l), failed: [...failed], issues, prBodies };
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
export function overviewPrompt(inputs: AboutInputs, extra: { issues: { key: string; title: string; description: string }[]; prBodies: { key: string; title: string; body: string }[] }): string {
|
|
217
|
+
export function overviewPrompt(inputs: AboutInputs, extra: { issues: { key: string; title: string; description: string }[]; prBodies: { key: string; title: string; body: string }[] }, cap: number = LIMITS.promptChars): string {
|
|
218
218
|
const section = (title: string, lines: string[]) => lines.length ? `## ${title}\n${lines.join("\n")}\n` : "";
|
|
219
219
|
const prompt = [
|
|
220
220
|
"You write the \"What's this about?\" note for one workspace in a developer's agent dashboard. The developer (Tom) opens it when the workspace name alone doesn't remind him what it is.",
|
|
@@ -230,7 +230,7 @@ export function overviewPrompt(inputs: AboutInputs, extra: { issues: { key: stri
|
|
|
230
230
|
section("Subagents it launched", inputs.subagents.map(s => `- ${s}`)),
|
|
231
231
|
section(`The latest conversation (last ${inputs.tail.length} items, oldest first)`, inputs.tail),
|
|
232
232
|
].join("\n");
|
|
233
|
-
return prompt.length >
|
|
233
|
+
return prompt.length > cap ? prompt.slice(0, cap) : prompt;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
// ---------- the store and the service ----------
|
|
@@ -283,6 +283,8 @@ export type AboutDeps = {
|
|
|
283
283
|
roomForBackground?(): Promise<boolean>;
|
|
284
284
|
/** Writing on open or Refresh only below the governor's higher threshold; above it, the cache is served. */
|
|
285
285
|
roomOnDemand?(): Promise<boolean>;
|
|
286
|
+
/** The "about" role from Settings → Agents: provider, model, effort, daily cap and prompt cap. Default: Claude Haiku, 60 a day. */
|
|
287
|
+
role?(): Promise<{ provider: string; model: string | null; thinking: string | null; dailyCap: number | null; maxPromptChars: number | null }>;
|
|
286
288
|
now?: () => number;
|
|
287
289
|
};
|
|
288
290
|
|
|
@@ -344,6 +346,7 @@ export class AboutService {
|
|
|
344
346
|
if (!usageAllows(usage.accounts)) return { started: 0, skipped: "usage" };
|
|
345
347
|
const ctx = this.deps.context();
|
|
346
348
|
if (!ctx) return { started: 0, skipped: "no-session" };
|
|
349
|
+
const cap = (await this.role()).dailyCap ?? DAILY_BACKGROUND_CAP;
|
|
347
350
|
let started = 0;
|
|
348
351
|
for (const id of workspaceIds) {
|
|
349
352
|
if (this.inflight.has(id)) continue;
|
|
@@ -355,7 +358,7 @@ export class AboutService {
|
|
|
355
358
|
const inputs = await collectInputs(w, ctx);
|
|
356
359
|
const hash = inputsHash(inputs);
|
|
357
360
|
if (!needsOverview(file.entries[id] ?? null, hash, this.now(), { failedAt: file.failures[id]?.at ?? null })) continue;
|
|
358
|
-
const budget = await this.deps.store.mutate(f => { const b = dailyBudget(f.daily, this.now(),
|
|
361
|
+
const budget = await this.deps.store.mutate(f => { const b = dailyBudget(f.daily, this.now(), cap); if (b.allowed) f.daily = b.next; return b.allowed; });
|
|
359
362
|
if (!budget) return { started, skipped: "daily-cap" };
|
|
360
363
|
// One at a time: the job runner's concurrency is shared with whatever the developer opens.
|
|
361
364
|
await this.start(w, inputs, hash);
|
|
@@ -364,10 +367,17 @@ export class AboutService {
|
|
|
364
367
|
return { started, skipped: null };
|
|
365
368
|
}
|
|
366
369
|
|
|
370
|
+
private async role() {
|
|
371
|
+
const fallback = { provider: "claude", model: "haiku", thinking: null, dailyCap: DAILY_BACKGROUND_CAP, maxPromptChars: LIMITS.promptChars };
|
|
372
|
+
return this.deps.role ? await this.deps.role().catch(() => fallback) : fallback;
|
|
373
|
+
}
|
|
374
|
+
|
|
367
375
|
private start(w: Workspace, inputs: AboutInputs, hash: string): Promise<void> {
|
|
368
376
|
const work = (async () => {
|
|
369
377
|
const enriched = await enrichLinks(workspaceLinks(inputs), this.deps.sources);
|
|
370
|
-
const
|
|
378
|
+
const role = await this.role();
|
|
379
|
+
const result = await this.deps.jobs.run<OverviewOutput>({ name: "about", provider: role.provider, ...(role.model ? { model: role.model } : {}), thinking: role.thinking,
|
|
380
|
+
prompt: overviewPrompt(inputs, enriched, role.maxPromptChars ?? LIMITS.promptChars), maxPromptChars: Math.max(role.maxPromptChars ?? LIMITS.promptChars, LIMITS.promptChars), schema: overviewOutputSchema, maxOutputChars: 2000, timeoutMs: 90_000 });
|
|
371
381
|
const at = this.now();
|
|
372
382
|
if (!result.ok) { await this.deps.store.mutate(f => { f.failures[w.id] = { at, error: result.error }; }); return; }
|
|
373
383
|
const record: AboutRecord = {
|
|
@@ -376,6 +386,7 @@ export class AboutService {
|
|
|
376
386
|
links: enriched.links,
|
|
377
387
|
basis: { chat: inputs.tail.length > 0, source: inputs.source, prs: inputs.prs.length, issues: enriched.issues.map(i => i.key) },
|
|
378
388
|
failed: enriched.failed, costUsd: result.costUsd,
|
|
389
|
+
by: { provider: role.provider, model: role.model ?? role.provider },
|
|
379
390
|
};
|
|
380
391
|
await this.deps.store.mutate(f => { f.entries[w.id] = record; delete f.failures[w.id]; });
|
|
381
392
|
})().catch(async error => { await this.deps.store.mutate(f => { f.failures[w.id] = { at: this.now(), error: (error instanceof Error ? error.message : String(error)).slice(0, 300) }; }).catch(() => undefined); })
|
package/server/agent-actions.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { findWorkspace } from "./engine";
|
|
|
11
11
|
import type { InboxAction } from "./inbox";
|
|
12
12
|
import { priorityInputSchema, type Priority } from "../shared/priorities";
|
|
13
13
|
import type { AboutView } from "../shared/about";
|
|
14
|
+
import { ROLE_INFO, roleSummary, type RoleConfig } from "../shared/agent-settings";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Agent parity: every action the developer can click in Follow-up has a tool that runs the same server path.
|
|
@@ -20,10 +21,10 @@ import type { AboutView } from "../shared/about";
|
|
|
20
21
|
* return a dry-run plan first; `confirm: true` with that plan's id runs it. Every agent write is recorded in
|
|
21
22
|
* the inbox ledger as `by: "agent:<id>"`, which never counts as the developer writing to the agent.
|
|
22
23
|
*/
|
|
23
|
-
export const AGENT_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", "workspace_about"] as const;
|
|
24
|
+
export const AGENT_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", "workspace_about", "agent_settings"] as const;
|
|
24
25
|
export type AgentTool = typeof AGENT_TOOLS[number];
|
|
25
26
|
/** Tools that only read. */
|
|
26
|
-
export const READ_ONLY_TOOLS: readonly AgentTool[] = ["list_prs", "inbox_list", "workspace_about"];
|
|
27
|
+
export const READ_ONLY_TOOLS: readonly AgentTool[] = ["list_prs", "inbox_list", "workspace_about", "agent_settings"];
|
|
27
28
|
/** Tools that can't be undone from Follow-up. */
|
|
28
29
|
export const DESTRUCTIVE_TOOLS: readonly AgentTool[] = ["merge"];
|
|
29
30
|
/** Tools that plan first and run only with `confirm: true` and the plan's id. */
|
|
@@ -66,6 +67,8 @@ export type AgentActionDeps = {
|
|
|
66
67
|
priorities?: { write(batch: Priority[], replace: boolean): Promise<Priority[]> };
|
|
67
68
|
/** "What's this about?": the overview and links for one workspace, written now if there is none yet. */
|
|
68
69
|
about?: { view(workspaceId: string, opts: { open?: boolean; wait?: boolean }): Promise<AboutView> };
|
|
70
|
+
/** Settings → Agents, read-only: which agent each special role uses. No write tool. */
|
|
71
|
+
agentSettings?: { all(): Promise<Record<string, RoleConfig>> };
|
|
69
72
|
now?: () => number;
|
|
70
73
|
};
|
|
71
74
|
|
|
@@ -87,6 +90,7 @@ export const TOOL_INPUT: Record<AgentTool, z.ZodType> = {
|
|
|
87
90
|
track: z.strictObject({ workspace: id }),
|
|
88
91
|
inbox_list: z.strictObject({ flagged_only: z.boolean().optional() }),
|
|
89
92
|
workspace_about: z.strictObject({ workspaceId: id }),
|
|
93
|
+
agent_settings: z.strictObject({}),
|
|
90
94
|
sign_off: z.strictObject({ agentIds: agentIds.optional(), ...confirm }),
|
|
91
95
|
snooze: z.strictObject({ agentIds: agentIds.optional(), until: z.string().trim().min(1).max(200).optional(), ...confirm }),
|
|
92
96
|
set_finish_flags: z.strictObject({ agentIds: agentIds.optional(), value: z.boolean().optional(), ...confirm }),
|
|
@@ -127,6 +131,11 @@ export class AgentActions {
|
|
|
127
131
|
case "list_prs": return this.listPrs(args);
|
|
128
132
|
case "inbox_list": return this.inboxList(caller, args);
|
|
129
133
|
case "workspace_about": return this.workspaceAbout(args as { workspaceId: string });
|
|
134
|
+
case "agent_settings": {
|
|
135
|
+
if (!this.d.agentSettings) throw new Error("agent_settings isn't available in this Follow-up.");
|
|
136
|
+
const roles = await this.d.agentSettings.all();
|
|
137
|
+
return { roles: Object.values(roles).map(r => ({ ...r, summary: roleSummary(r), does: ROLE_INFO[r.role].does })), change: "Tom changes these in Follow-up settings → Agents." };
|
|
138
|
+
}
|
|
130
139
|
case "add_reviewers": return this.planReviewers(caller, args);
|
|
131
140
|
case "merge": return this.planPr(caller, tool, "merge", args);
|
|
132
141
|
case "enable_merge_when_ready": return this.planPr(caller, tool, "enable_mwr", args);
|