paseo-follow-up 2.4.0-beta.7 → 2.4.0-beta.8

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/client/agents.tsx CHANGED
@@ -6,7 +6,7 @@ import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, Settings
6
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
7
  import { agentSettingsRpc, setAgentSettingRpc, setWaitRpc } from "../shared/contracts";
8
8
  import { WAIT_HOST_NOTE, WAIT_NOT_ATTACHED, waitNote, waitSwitchCopy } from "../shared/wait";
9
- import { hasSame, isJobRole, type AgentRole, type AgentSettingsView, type SavedRole } from "../shared/agent-settings";
9
+ import { OUTSIDE_READS, guardedProvider, hasSame, isJobRole, type AgentRole, type AgentSettingsView, type SavedRole } from "../shared/agent-settings";
10
10
  import { NO_PROMPT_MODE, SETTINGS_ORDER, isReset, resetEntry } from "../shared/job-rows";
11
11
  import { JobRows, agentSettingsKey, useAgentSettings, type JobExtra } from "./job-rows";
12
12
  import { Button, errorText, text, type Theme } from "./kit";
@@ -36,6 +36,11 @@ export function AgentSettings({ theme, compact }: Pick<PluginSurfaceProps, "them
36
36
  <SettingsCard>
37
37
  <JobRows theme={theme} compact={compact} order={SETTINGS_ORDER} extra={more} />
38
38
  </SettingsCard>
39
+ {/* A job role on a provider Follow-up can't take tools from: what it no longer reads, and why (invariant 81). */}
40
+ {(data?.roles ?? []).filter(r => isJobRole(r.role) && !guardedProvider(r.provider) && OUTSIDE_READS[r.role]).map(r => {
41
+ const label = data?.catalog?.providers.find(p => p.id === r.provider)?.label ?? r.provider;
42
+ return <Text key={r.role} accessibilityRole="alert" style={[t.meta, { color: c.statusWarning, paddingHorizontal: 4 }]}>{unguardedLine(r.role, label)}</Text>;
43
+ })}
39
44
  {/* Once, after the rows: what can't be picked and why (the pickers only list what can). */}
40
45
  {!!data?.catalog && unavailableLine(data.catalog.providers) && <Text style={[t.meta, { paddingHorizontal: 4 }]}>{unavailableLine(data.catalog.providers)}</Text>}
41
46
  </SettingsSection>;
@@ -116,6 +121,10 @@ function RoleMore({ r, save, busy, theme, compact, invalid }: { r: Role; save: (
116
121
  const roleDefaultText = (role: AgentRole) => role === "recovery" ? "the main agent's setup" : role === "dispatch" ? "the Overseer's agent" : role === "overseer" ? "Claude, newest Opus" : role === "about" ? "Claude Haiku" : "Claude Sonnet, hourly";
117
122
  /** "Not available in Paseo: Claude and Pi (turned off in Paseo); Antigravity (not installed)." Grouped by reason; a
118
123
  * provider whose name is also on a ready one isn't listed, so the line never contradicts the rows. */
124
+ /** "On OpenCode, AI priority doesn't rank, since what it reads was written by other people…" (invariant 81). */
125
+ export const unguardedLine = (role: AgentRole, label: string) =>
126
+ `On ${label}, ${OUTSIDE_READS[role]}, since what they read was written by other people and Follow-up can't take ${label}'s tools away. Pick Claude or Codex for all of it.`;
127
+
119
128
  function unavailableLine(providers: readonly { label: string; available: boolean; reason: string | null }[]): string | null {
120
129
  const ready = new Set(providers.filter(p => p.available).map(p => p.label));
121
130
  const groups = new Map<string, string[]>();
@@ -1,6 +1,6 @@
1
- import { useEffect, useState } from "react";
1
+ import { useEffect, useState, type ReactNode } from "react";
2
2
  import { ActivityIndicator, TextInput, View } from "react-native";
3
- import { useRpc } from "@getpaseo/plugin/client";
3
+ import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
4
4
  import { Icon, SettingsSection, useToast } from "@getpaseo/plugin/client/ui";
5
5
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
6
6
  import { Pressable, Text } from "./text";
@@ -11,6 +11,7 @@ import { compassFindRpc, compassRpc, readCompassRpc, setCompassRpc } from "../sh
11
11
  import {
12
12
  COMPASS, ROLES, ROLE_INFO, type CompassChange, type CompassNote, type CompassSource, type GlossaryEntry, type Place, type Preset, type PresetView, type Role, type Who,
13
13
  } from "../shared/compass";
14
+ import { type PlanView } from "../shared/morning-brief";
14
15
 
15
16
  export const compassKey = ["follow-up", "compass"];
16
17
 
@@ -26,6 +27,8 @@ type View_ = {
26
27
  lastRead: { at: string; trigger: string; ok: boolean; notes: number; error: string | null } | null;
27
28
  today: { extractions: number; cap: number };
28
29
  running: boolean;
30
+ /** This week's plan (Settings → Compass reads every priority input in one view). */
31
+ plan?: PlanView;
29
32
  };
30
33
  type Found = { id: string; name: string; place: Place };
31
34
 
@@ -37,21 +40,33 @@ const whoWhere = (s: CompassSource) => s.who.kind === "person" && s.places.lengt
37
40
  const day = (d: string) => new Date(`${d}T12:00:00`).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" });
38
41
  const whoName = (w: Who) => w.kind === "person" ? w.person.name : w.kind === "people" ? w.people.map(p => p.name).join(", ") : w.kind === "me" ? "You" : "Everyone";
39
42
 
40
- /**
41
- * Settings → Morning brief → Compass (docs/compass.md): the people and places that set the developer's priorities, how
42
- * to read them, and the glossary. One editor for every source; presets only fill its fields. Every change goes through
43
- * the RPC `set_compass` runs, and Read now through `read_compass`.
44
- */
45
- export function CompassSection({ theme, compact }: { theme: Theme; compact: boolean }) {
46
- const c = theme.colors; const t = text(c, compact);
47
- const read = useRpc(compassRpc); const write = useRpc(setCompassRpc); const readNow = useRpc(readCompassRpc);
48
- const cache = useQueryClient(); const toast = useToast();
49
- const query = useQuery({ queryKey: compassKey, queryFn: async () => await read({}) as View_, refetchInterval: q => q.state.data?.running ? 2_000 : 30_000 });
50
- const change = useMutation({
43
+ /** Settings → Compass's one read: the sources, their notes, the plan and the inputs (`follow.compass`, as `compass` reads it). */
44
+ export function useCompassView<T = View_>() {
45
+ const read = useRpc(compassRpc);
46
+ return useQuery({ queryKey: compassKey, queryFn: async () => await read({}) as T, refetchInterval: q => (q.state.data as View_ | undefined)?.running ? 2_000 : 30_000 });
47
+ }
48
+ function useCompassChange() {
49
+ const write = useRpc(setCompassRpc); const cache = useQueryClient(); const toast = useToast();
50
+ return useMutation({
51
51
  mutationFn: async (input: CompassChange) => await write(input) as View_,
52
52
  onSuccess: value => cache.setQueryData(compassKey, value),
53
53
  onError: error => toast.error(errorText(error)),
54
54
  });
55
+ }
56
+
57
+ /**
58
+ * Settings → Compass → What sets your priorities (docs/compass.md, one-place-for-priority-inputs): every input AI
59
+ * priority reads, in one list. First the Compass sources, the people and places the developer picked (one editor for
60
+ * every source; presets only fill its fields), then `after`: the built-in inputs (the Linear queue, DMs and mentions,
61
+ * the calendar, mail, review requests) and the mcpproxy servers Ask could read. Every change goes through the RPC
62
+ * `set_compass` runs, and Read now through `read_compass`.
63
+ */
64
+ export function CompassSection({ theme, compact, after }: { theme: Theme; compact: boolean; after?: ReactNode }) {
65
+ const c = theme.colors; const t = text(c, compact);
66
+ const readNow = useRpc(readCompassRpc);
67
+ const cache = useQueryClient(); const toast = useToast();
68
+ const query = useCompassView();
69
+ const change = useCompassChange();
55
70
  const reading = useMutation({
56
71
  mutationFn: async () => await readNow({}) as { running: boolean; view: View_ },
57
72
  onSuccess: r => cache.setQueryData(compassKey, r.view),
@@ -60,7 +75,7 @@ export function CompassSection({ theme, compact }: { theme: Theme; compact: bool
60
75
  const [editing, setEditing] = useState<string | "new" | null>(null);
61
76
  const data = query.data;
62
77
  const full = !!data && data.settings.sources.length >= COMPASS.sources;
63
- return <SettingsSection title="Compass" info="The people and places that set your priorities. Follow-up reads what they say each workday morning, keeps a note of each priority with their words, and AI priority ranks your work by it. Only the people you pick are read, only through read-only tools, and a fast model with no tools reads it. Agents can set it up too.">
78
+ return <SettingsSection title="What sets your priorities" info="Everything AI priority, Needs you and the brief read, in one list. The people you add are read each workday morning: Follow-up keeps a note of each priority with their words, and AI priority ranks your work by it. Only the people you pick are read, only through read-only tools, and a fast model with no tools reads them. Nothing is ever posted. Agents can set it up too.">
64
79
  {query.isPending && <ActivityIndicator accessibilityLabel="Loading Compass" color={c.foregroundMuted} style={{ alignSelf: "flex-start", marginVertical: 8 }} />}
65
80
  {query.error && <Text style={[t.meta, { color: c.statusWarning }]}>{`Couldn't load Compass: ${errorText(query.error)}`}</Text>}
66
81
  {data?.blocked && <Line icon="TriangleAlert" tone={c.statusWarning} text={data.blocked} theme={theme} compact={compact} />}
@@ -76,6 +91,7 @@ export function CompassSection({ theme, compact }: { theme: Theme; compact: bool
76
91
  onToggle={on => change.mutate({ source: { id: s.id, enabled: on } })} />)}
77
92
  {editing === "new" && <SourceEditor view={data} first={data.settings.sources.length === 0} busy={change.isPending} theme={theme} compact={compact} onCancel={() => setEditing(null)}
78
93
  onSave={input => change.mutate(input, { onSuccess: () => setEditing(null) })} />}
94
+ {after}
79
95
  </View>}
80
96
  {data && editing !== "new" && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
81
97
  {full
@@ -84,8 +100,17 @@ export function CompassSection({ theme, compact }: { theme: Theme; compact: bool
84
100
  {data.settings.sources.length > 0 && <Button title="Read now" icon="RotateCcw" kind="ghost" theme={theme} compact={compact} loading={reading.isPending || data.running} disabled={!!data.blocked} onPress={() => reading.mutate()} />}
85
101
  {data.settings.sources.length > 0 && <Text style={t.meta}>{statusLine(data)}</Text>}
86
102
  </View>}
87
- {data && <ReadingNotes value={data.settings.instructions} busy={change.isPending} theme={theme} compact={compact} onSave={v => change.mutate({ instructions: v })} />}
88
- {data && <Glossary entries={data.settings.glossary} busy={change.isPending} theme={theme} compact={compact} onSave={g => change.mutate({ glossary: g })} />}
103
+ </SettingsSection>;
104
+ }
105
+
106
+ /** Settings → Compass → How to read your Compass: the words every source is read with, and the glossary. */
107
+ export function CompassReading({ theme, compact }: { theme: Theme; compact: boolean }) {
108
+ const query = useCompassView(); const change = useCompassChange();
109
+ const data = query.data;
110
+ if (!data) return null;
111
+ return <SettingsSection title="How to read your Compass" info="Words every source is read with; each source's own How to read this comes after them. They change how messages are understood, never what is read.">
112
+ <ReadingNotes value={data.settings.instructions} busy={change.isPending} theme={theme} compact={compact} onSave={v => change.mutate({ instructions: v })} />
113
+ <Glossary entries={data.settings.glossary} busy={change.isPending} theme={theme} compact={compact} onSave={g => change.mutate({ glossary: g })} />
89
114
  </SettingsSection>;
90
115
  }
91
116
 
@@ -123,6 +148,7 @@ function SourceRow({ view, source, first, busy, onEdit, onToggle, theme, compact
123
148
  <Text style={[t.meta, { color: c.foreground }]}>{ROLE_INFO[r].label}</Text>
124
149
  </View>)}
125
150
  </View>
151
+ {source.enabled && source.roles.includes("plan") && <PlanLine source={source} plan={view.plan} theme={theme} compact={compact} />}
126
152
  {source.instructions ? <RichText plain numberOfLines={2} style={[t.meta, { fontStyle: "italic" }]}>{`“${source.instructions}”`}</RichText> : null}
127
153
  {source.enabled && (live
128
154
  ? <Pressable accessibilityRole="button" accessibilityState={{ expanded: open }} accessibilityLabel={`${open ? "Hide" : "Show"} ${live} note${live === 1 ? "" : "s"} from ${source.label}`} onPress={() => setOpen(o => !o)} hitSlop={compact ? 0 : 6}
@@ -144,6 +170,29 @@ function SourceRow({ view, source, first, busy, onEdit, onToggle, theme, compact
144
170
  </View>;
145
171
  }
146
172
 
173
+ /**
174
+ * This week's plan under the source that posted it ("This week's plan · Week of Nov 23 · posted Sun 18:05 · 14 items, 3
175
+ * without an issue", with Open), or that none has come from it yet. Plans come from Compass on arrival.
176
+ */
177
+ function PlanLine({ source, plan, theme, compact }: { source: CompassSource; plan?: PlanView; theme: Theme; compact: boolean }) {
178
+ const c = theme.colors; const t = text(c, compact);
179
+ if (!plan || plan.mode === "off" || plan.source === "env") return null;
180
+ const mine = plan.found?.source === source.id ? plan.found : plan.previous?.source === source.id && !plan.found ? plan.previous : null;
181
+ const inUse = !!mine && plan.url === mine.url;
182
+ const posted = mine?.postedAt ? new Date(mine.postedAt).toLocaleString([], { weekday: "short", hour: "2-digit", minute: "2-digit", hourCycle: "h23" }) : null;
183
+ const last = inUse && plan.previous?.url === mine?.url && !plan.found;
184
+ const line = inUse ? `Shared ${last ? "last week's plan" : "this week's plan"}${plan.read?.title ? `, ${plan.read.title}` : ""}${posted ? ` · ${posted}` : ""}`
185
+ : mine ? "Shared a plan; a pasted link is in use instead" : "No plan shared yet: the newest claude.ai artifact becomes the plan";
186
+ return <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
187
+ <View style={{ paddingTop: compact ? 4 : 3 }}><Icon name={inUse ? "Check" : "Map"} size={12} color={inUse ? c.statusSuccess : c.foregroundMuted} /></View>
188
+ <RichText plain style={[t.meta, { flexShrink: 1, minWidth: 0 }]}>{line}</RichText>
189
+ {inUse && <Pressable accessibilityRole="link" accessibilityLabel={`Open this week's plan from ${source.label}`} onPress={() => void openExternalUrl(mine!.url).catch(() => undefined)} hitSlop={compact ? 0 : 6}
190
+ style={{ minHeight: compact ? 44 : 20, marginTop: compact ? -12 : 0, justifyContent: compact ? "center" : "flex-start" }}>
191
+ <Text style={[t.meta, { color: c.accent, fontWeight: "600" }]}>Open</Text>
192
+ </Pressable>}
193
+ </View>;
194
+ }
195
+
147
196
  /**
148
197
  * What Compass understood from a source: each live note, the words it quotes, its date and where it went. The quote is
149
198
  * the proof (a-compass-note-quotes-its-source), so it is always shown.
@@ -284,7 +333,6 @@ function ReadingNotes({ value, busy, onSave, theme, compact }: { value: string;
284
333
  useEffect(() => setDraft(value), [value]);
285
334
  const dirty = draft.trim() !== value.trim();
286
335
  return <SubmitScope enabled={dirty && !busy} onSubmit={() => onSave(draft)} style={{ gap: 6 }}>
287
- <Text style={[t.label, { color: c.foreground }]}>How to read your Compass</Text>
288
336
  <TextInput accessibilityLabel="How to read your Compass" multiline value={draft} onChangeText={v => setDraft(v.slice(0, COMPASS.instructions))} placeholder="P0 means today. 'The renewal' is the acme renewal. Customer asks wait for the plan unless they name a date."
289
337
  placeholderTextColor={c.foregroundMuted} style={{ minHeight: 72, padding: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0, textAlignVertical: "top" }} />
290
338
  <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>