paseo-follow-up 2.4.0-beta.9 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +159 -0
- package/OVERVIEW.md +1 -1
- package/README.md +81 -22
- package/client/agents.tsx +8 -26
- package/client/brief-since.tsx +4 -3
- package/client/compass-settings.tsx +156 -87
- package/client/display.tsx +2 -1
- package/client/header.tsx +2 -2
- package/client/home-chrome.tsx +24 -13
- package/client/home-data.ts +1 -1
- package/client/home-list.tsx +2 -1
- package/client/home-view.ts +7 -9
- package/client/home.tsx +9 -4
- package/client/job-rows.tsx +56 -7
- package/client/list-keys.ts +2 -1
- package/client/morning-brief-settings.tsx +11 -1
- package/client/new-entry.tsx +42 -2
- package/client/new-settings.tsx +29 -13
- package/client/new.tsx +89 -43
- package/client/onboarding.tsx +75 -29
- package/client/release-notes.tsx +11 -7
- package/client/reviewers.tsx +1 -1
- package/client/row-badges.tsx +37 -0
- package/client/search-focus.ts +85 -0
- package/client/search-key.ts +6 -12
- package/client/stacks.tsx +9 -2
- package/docs/screenshots/follow-up-slide-1-cover.png +0 -0
- package/docs/screenshots/follow-up-slide-2-decision.png +0 -0
- package/docs/screenshots/follow-up-slide-3-overseer.png +0 -0
- package/docs/screenshots/follow-up-slide-4-repairs.png +0 -0
- package/docs/screenshots/follow-up-slide-5-deploy.png +0 -0
- package/docs/screenshots/follow-up-slide-6-catch-up.png +0 -0
- package/index.client.tsx +12 -6
- package/index.server.ts +89 -25
- package/package.json +4 -3
- package/paseo-plugin.json +7 -9
- package/server/about.ts +4 -1
- package/server/agent-hook.mjs +12 -4
- package/server/agent-settings.ts +19 -3
- package/server/brief-sources.ts +4 -2
- package/server/compass.ts +310 -41
- package/server/daemon.ts +11 -3
- package/server/dispatch.ts +3 -2
- package/server/engine.ts +19 -6
- package/server/github-api.ts +17 -6
- package/server/github-setup.ts +126 -0
- package/server/github.ts +28 -0
- package/server/hook-source.ts +12 -4
- package/server/host-features.ts +21 -1
- package/server/linear-issues.ts +4 -3
- package/server/linear-queue.ts +3 -0
- package/server/mcp-source.ts +5 -3
- package/server/mcp.mjs +5 -3
- package/server/memory.ts +47 -19
- package/server/onboarding.ts +3 -2
- package/server/pr-actions.ts +12 -1
- package/server/pr-stats-sync.ts +4 -2
- package/server/pr-stats.ts +4 -0
- package/server/ranker.ts +4 -2
- package/server/reviewer-config.ts +3 -1
- package/server/session-mcp.ts +3 -2
- package/server/session-prompt.ts +34 -8
- package/server/wait-for-checks.ts +9 -0
- package/shared/agent-settings.ts +17 -9
- package/shared/attention.ts +4 -0
- package/shared/brief-sources.ts +23 -8
- package/shared/changelog.ts +32 -8
- package/shared/compass.ts +155 -25
- package/shared/contracts.ts +2 -2
- package/shared/dispatch.ts +61 -6
- package/shared/display.ts +4 -1
- package/shared/github-setup.ts +46 -0
- package/shared/job-rows.ts +40 -6
- package/shared/list-entries.ts +3 -2
- package/shared/model.ts +6 -0
- package/shared/new-name.ts +27 -0
- package/shared/new-view.ts +11 -8
- package/shared/onboarding.ts +77 -15
- package/shared/provider-support.ts +70 -0
- package/shared/recommend.ts +3 -2
- package/shared/row-badges.ts +24 -0
- package/shared/search-focus.ts +76 -0
- package/shared/search-key.ts +3 -2
- package/shared/settings-nav.ts +2 -1
- package/docs/screenshots/follow-up-home.png +0 -0
- package/docs/screenshots/follow-up-linked-items.png +0 -0
- package/docs/screenshots/follow-up-notes-home.png +0 -0
- package/docs/screenshots/follow-up-notes-panel.png +0 -0
- package/docs/screenshots/follow-up-panel.png +0 -0
- package/docs/screenshots/follow-up-phone.png +0 -0
- package/docs/screenshots/follow-up-pill.png +0 -0
- package/docs/screenshots/follow-up-pr-sheet.png +0 -0
- package/docs/screenshots/follow-up-questions.png +0 -0
- package/docs/screenshots/follow-up-send-to-paseo-dark.png +0 -0
- package/docs/screenshots/follow-up-send-to-paseo-light.png +0 -0
- package/docs/screenshots/follow-up-setup.png +0 -0
- package/docs/screenshots/follow-up-sidebar.png +0 -0
|
@@ -4,21 +4,22 @@ import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
|
|
|
4
4
|
import { Icon, SettingsSection, SettingsSelect, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
5
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { Pressable, Text } from "./text";
|
|
7
|
-
import { Button, SubmitScope, Switch, errorText, text, type Theme } from "./kit";
|
|
7
|
+
import { Button, IconButton, SubmitScope, Switch, errorText, text, type Theme } from "./kit";
|
|
8
8
|
import { RichText } from "./rich-text";
|
|
9
9
|
import { raised, tint } from "./theme";
|
|
10
10
|
import { compassFindRpc, compassRpc, readCompassRpc, setCompassRpc } from "../shared/contracts";
|
|
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
|
-
CADENCES, type CompassSettings,
|
|
13
|
+
CADENCES, type CompassSettings, trackerRef,
|
|
14
14
|
} from "../shared/compass";
|
|
15
15
|
import { type PlanView } from "../shared/morning-brief";
|
|
16
|
+
import { NEW_NAME, NEW_OF } from "../shared/new-name";
|
|
16
17
|
|
|
17
18
|
export const compassKey = ["follow-up", "compass"];
|
|
18
19
|
|
|
19
20
|
type View_ = {
|
|
20
21
|
settings: { sources: CompassSource[]; instructions: string; glossary: GlossaryEntry[]; cadence: CompassSettings["cadence"]; routing: CompassSettings["routing"] };
|
|
21
|
-
readers: { conversation: boolean; history: boolean };
|
|
22
|
+
readers: { conversation: boolean; history: boolean; doc: boolean; tracker: boolean; calendar: boolean };
|
|
22
23
|
presets: PresetView[];
|
|
23
24
|
blocked: string | null;
|
|
24
25
|
places: Record<string, { status: string; readAt: string | null; at: string | null; error: string | null }>;
|
|
@@ -31,13 +32,18 @@ type View_ = {
|
|
|
31
32
|
/** This week's plan (Settings → Compass reads every priority input in one view). */
|
|
32
33
|
plan?: PlanView;
|
|
33
34
|
};
|
|
34
|
-
type Found = { id: string; name: string; place: Place };
|
|
35
|
+
type Found = { id: string; name: string; place: Place; detail?: string };
|
|
36
|
+
type FindKind = "people" | "channels" | "docs" | "file" | "trackers" | "calendars";
|
|
35
37
|
|
|
36
38
|
const clock = (iso: string) => new Date(iso).toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hourCycle: "h23" });
|
|
37
|
-
const placeName = (p: Place) => p.kind === "conversation" ? (p.sub === "dm" ? `DM with ${p.name}` : `#${p.name}`)
|
|
38
|
-
|
|
39
|
+
const placeName = (p: Place) => p.kind === "conversation" ? (p.sub === "dm" ? `DM with ${p.name}` : `#${p.name}`)
|
|
40
|
+
: p.kind === "tracker" ? `${trackerRef(p.id)?.tracker === "github" ? "GitHub" : "Linear"} ${p.scope} ${p.name}` : p.kind === "doc" && p.path ? `${p.name} (this machine)` : p.kind === "calendar" && p.filter === "with-guests" ? `${p.name}, meetings with guests` : p.name;
|
|
41
|
+
/**
|
|
42
|
+
* "DM with Dana" when the source is one person read in their DM; "Dana in #planning"; "Everyone in #team"; a tracker
|
|
43
|
+
* or calendar place alone (its items are read by rule, so nobody's words are picked).
|
|
44
|
+
*/
|
|
39
45
|
const whoWhere = (s: CompassSource) => s.who.kind === "person" && s.places.length === 1 && s.places[0].kind === "conversation" && s.places[0].sub === "dm" && s.places[0].id === s.who.person.id
|
|
40
|
-
? placeName(s.places[0]) : `${whoName(s.who)} in ${s.places.map(placeName).join(", ")}`;
|
|
46
|
+
? placeName(s.places[0]) : s.places.every(p => p.kind === "tracker" || p.kind === "calendar") ? s.places.map(placeName).join(", ") : `${whoName(s.who)} in ${s.places.map(placeName).join(", ")}`;
|
|
41
47
|
const day = (d: string) => new Date(`${d}T12:00:00`).toLocaleDateString([], { weekday: "short", month: "short", day: "numeric" });
|
|
42
48
|
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";
|
|
43
49
|
|
|
@@ -81,9 +87,9 @@ export function CompassSection({ theme, compact, after }: { theme: Theme; compac
|
|
|
81
87
|
{query.error && <Text style={[t.meta, { color: c.statusWarning }]}>{`Couldn't load Compass: ${errorText(query.error)}`}</Text>}
|
|
82
88
|
{data?.blocked && <Line icon="TriangleAlert" tone={c.statusWarning} text={data.blocked} theme={theme} compact={compact} />}
|
|
83
89
|
{data && <View style={{ ...raised(c), borderRadius: 10, backgroundColor: c.surface1, overflow: "hidden" }}>
|
|
84
|
-
{data.settings.sources.length === 0 && editing !== "new" && <View style={{ padding: compact ? 14 : 12, gap: 4 }}>
|
|
90
|
+
{data.settings.sources.length === 0 && editing !== "new" && <View style={{ padding: compact ? 14 : 12, paddingBottom: 2, gap: 4 }}>
|
|
85
91
|
<Text style={[t.label, { color: c.foreground }]}>Nobody sets your priorities here yet</Text>
|
|
86
|
-
<Text style={t.meta}>Add the person
|
|
92
|
+
<Text style={t.meta}>Add the person, channel, doc, tracker or calendar that decides what you work on first, like your product lead's DM. Or ask the Overseer to set it up for you.</Text>
|
|
87
93
|
</View>}
|
|
88
94
|
{data.settings.sources.map((s, i) => editing === s.id
|
|
89
95
|
? <SourceEditor key={s.id} view={data} source={s} first={i === 0} busy={change.isPending} theme={theme} compact={compact} onCancel={() => setEditing(null)}
|
|
@@ -92,15 +98,16 @@ export function CompassSection({ theme, compact, after }: { theme: Theme; compac
|
|
|
92
98
|
onToggle={on => change.mutate({ source: { id: s.id, enabled: on } })} />)}
|
|
93
99
|
{editing === "new" && <SourceEditor view={data} first={data.settings.sources.length === 0} busy={change.isPending} theme={theme} compact={compact} onCancel={() => setEditing(null)}
|
|
94
100
|
onSave={input => change.mutate(input, { onSuccess: () => setEditing(null) })} />}
|
|
101
|
+
{/* Right under the sources it adds to, before the built-in inputs: on a phone it never sits a screen below them. */}
|
|
102
|
+
{editing !== "new" && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, paddingHorizontal: compact ? 14 : 12, paddingVertical: compact ? 10 : 10, borderTopWidth: data.settings.sources.length || editing ? 1 : 0, borderTopColor: c.border }}>
|
|
103
|
+
{full
|
|
104
|
+
? <Text style={t.meta}>{`Compass holds ${COMPASS.sources} sources. Remove one to add another.`}</Text>
|
|
105
|
+
: <Button title="Add a source" icon="Plus" theme={theme} compact={compact} disabled={!!editing} onPress={() => setEditing("new")} />}
|
|
106
|
+
{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()} />}
|
|
107
|
+
{data.settings.sources.length > 0 && <Text style={[t.meta, { flexShrink: 1 }]}>{statusLine(data)}</Text>}
|
|
108
|
+
</View>}
|
|
95
109
|
{after}
|
|
96
110
|
</View>}
|
|
97
|
-
{data && editing !== "new" && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
|
|
98
|
-
{full
|
|
99
|
-
? <Text style={t.meta}>{`Compass holds ${COMPASS.sources} sources. Remove one to add another.`}</Text>
|
|
100
|
-
: <Button title="Add a source" icon="Plus" theme={theme} compact={compact} disabled={!!editing} onPress={() => setEditing("new")} />}
|
|
101
|
-
{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()} />}
|
|
102
|
-
{data.settings.sources.length > 0 && <Text style={t.meta}>{statusLine(data)}</Text>}
|
|
103
|
-
</View>}
|
|
104
111
|
</SettingsSection>;
|
|
105
112
|
}
|
|
106
113
|
|
|
@@ -118,7 +125,7 @@ export function CompassReading({ theme, compact }: { theme: Theme; compact: bool
|
|
|
118
125
|
/** The daytime read's choices (the-brief-has-one-timer): only while Follow-up is open, on workdays 08:00-20:00. */
|
|
119
126
|
const CADENCE_LABEL: Record<CompassSettings["cadence"], string> = { off: "Mornings only", "1h": "Every hour", "2h": "Every 2 hours", "4h": "Every 4 hours" };
|
|
120
127
|
/** Where Compass's suggestions go: an issue nobody started that a source said matters. */
|
|
121
|
-
const ROUTING_LABEL: Record<CompassSettings["routing"]["suggestions"], string> = { "needs-you-and-new":
|
|
128
|
+
const ROUTING_LABEL: Record<CompassSettings["routing"]["suggestions"], string> = { "needs-you-and-new": `Needs you and ${NEW_NAME}`, "new-only": `${NEW_NAME} only`, off: "Off" };
|
|
122
129
|
|
|
123
130
|
/**
|
|
124
131
|
* When's Compass rows: the daytime read (Off, 1, 2 or 4 h while the app is open) and where suggestions go. The same
|
|
@@ -132,7 +139,7 @@ export function CompassWhen({ theme, compact, part }: { theme: Theme; compact: b
|
|
|
132
139
|
// One row each, so the settings card draws its divider between them.
|
|
133
140
|
if (part === "cadence") return <SettingsSelect label="During the day" hint={s.cadence === "off" ? "Compass reads once, at the morning read. Read now reads at once." : "While Follow-up is open, on workdays from 08:00 to 20:00. Each read takes only what's new, and nothing is read while the app is closed."}
|
|
134
141
|
value={s.cadence} disabled={change.isPending} options={CADENCES.map(v => ({ value: v, label: CADENCE_LABEL[v] }))} onValueChange={cadence => change.mutate({ cadence: cadence as CompassSettings["cadence"] })} />;
|
|
135
|
-
return <SettingsSelect label="Issues nobody's on" hint={s.routing.suggestions === "off" ? "Compass notes still reorder AI priority; none suggests an issue." : s.routing.suggestions === "new-only" ?
|
|
142
|
+
return <SettingsSelect label="Issues nobody's on" hint={s.routing.suggestions === "off" ? "Compass notes still reorder AI priority; none suggests an issue." : s.routing.suggestions === "new-only" ? `Listed first in ${NEW_OF} My issues, with why.` : `A strong ask due within ${s.routing.urgentWithinWorkdays} workdays goes to Needs you, from a source with Needs you on. The rest are first in ${NEW_NAME}.`}
|
|
136
143
|
value={s.routing.suggestions} disabled={change.isPending} options={(Object.keys(ROUTING_LABEL) as CompassSettings["routing"]["suggestions"][]).map(v => ({ value: v, label: ROUTING_LABEL[v] }))}
|
|
137
144
|
onValueChange={suggestions => change.mutate({ routing: { suggestions: suggestions as CompassSettings["routing"]["suggestions"] } })} />;
|
|
138
145
|
}
|
|
@@ -155,40 +162,35 @@ function Line({ icon, tone, text: line, theme, compact }: { icon: string; tone:
|
|
|
155
162
|
</View>;
|
|
156
163
|
}
|
|
157
164
|
|
|
158
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* One source, in the same row style as the built-in inputs below it (one list): its name, one line with its roles,
|
|
167
|
+
* where it reads and its notes, a warning when a place failed, then a chevron that opens the rest (the plan it brought,
|
|
168
|
+
* its reading notes, its live notes, Edit) and its switch.
|
|
169
|
+
*/
|
|
159
170
|
function SourceRow({ view, source, first, busy, onEdit, onToggle, theme, compact }: { view: View_; source: CompassSource; first: boolean; busy: boolean; onEdit: () => void; onToggle: (on: boolean) => void; theme: Theme; compact: boolean }) {
|
|
160
171
|
const c = theme.colors; const t = text(c, compact);
|
|
161
172
|
const notes = view.notes.filter(n => n.source === source.id); const live = notes.length;
|
|
162
173
|
const [open, setOpen] = useState(false);
|
|
163
|
-
const
|
|
164
|
-
const
|
|
174
|
+
const states = source.places.map(p => view.places[`${p.kind}:${p.id}`]);
|
|
175
|
+
const bad = states.find(p => p && (p.status === "failed" || p.status === "paused"));
|
|
176
|
+
const slow = states.some(p => p?.status === "slow-path");
|
|
177
|
+
// A place's note that isn't a failure (a busy place's newest 40, a long gap's newest pages) rides under the meta line.
|
|
178
|
+
const info = states.find(p => p && (p.status === "ok" || p.status === "slow-path") && p.error)?.error ?? null;
|
|
179
|
+
const meta = [source.roles.map(r => ROLE_INFO[r].label).join(", "), whoWhere(source), source.enabled ? (live ? `${live} note${live === 1 ? "" : "s"} live` : "no notes live") : null, slow ? "read by search, slower" : null].filter(Boolean).join(" · ");
|
|
165
180
|
return <View style={{ flexDirection: "row", gap: 10, alignItems: "flex-start", padding: compact ? 14 : 12, borderTopWidth: first ? 0 : 1, borderTopColor: c.border }}>
|
|
166
|
-
<View style={{ flex: 1, minWidth: 0, gap:
|
|
181
|
+
<View style={{ flex: 1, minWidth: 0, gap: 3 }}>
|
|
167
182
|
<RichText plain style={[t.label, { color: source.enabled ? c.foreground : c.foregroundMuted }]}>{source.label}</RichText>
|
|
168
|
-
<
|
|
169
|
-
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
170
|
-
{source.roles.map(r => <View key={r} style={{ paddingHorizontal: 8, minHeight: 20, justifyContent: "center", borderRadius: 999, backgroundColor: c.surface2 }}>
|
|
171
|
-
<Text style={[t.meta, { color: c.foreground }]}>{ROLE_INFO[r].label}</Text>
|
|
172
|
-
</View>)}
|
|
173
|
-
</View>
|
|
174
|
-
{source.enabled && source.roles.includes("plan") && <PlanLine source={source} plan={view.plan} theme={theme} compact={compact} />}
|
|
175
|
-
{source.instructions ? <RichText plain numberOfLines={2} style={[t.meta, { fontStyle: "italic" }]}>{`“${source.instructions}”`}</RichText> : null}
|
|
176
|
-
{source.enabled && (live
|
|
177
|
-
? <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}
|
|
178
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 4, alignSelf: "flex-start", minHeight: compact ? 44 : 20 }}>
|
|
179
|
-
<Text style={[t.meta, { color: c.foreground }]}>{`${live} note${live === 1 ? "" : "s"} live`}</Text>
|
|
180
|
-
<Icon name={open ? "ChevronUp" : "ChevronDown"} size={12} color={c.foregroundMuted} />
|
|
181
|
-
{slow && <Text style={t.meta}>· read by search, the slower path</Text>}
|
|
182
|
-
</Pressable>
|
|
183
|
-
: <Text style={t.meta}>{["No notes live", slow ? "read by search, the slower path" : null].filter(Boolean).join(" · ")}</Text>)}
|
|
184
|
-
{source.enabled && open && <NoteList notes={notes} view={view} theme={theme} compact={compact} />}
|
|
183
|
+
<RichText plain style={t.meta}>{meta}</RichText>
|
|
185
184
|
{source.enabled && bad?.error && <Line icon="TriangleAlert" tone={c.statusWarning} text={bad.error} theme={theme} compact={compact} />}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
<
|
|
190
|
-
|
|
185
|
+
{source.enabled && !bad && info && <Text style={t.meta}>{info}</Text>}
|
|
186
|
+
{open && <View style={{ gap: 8, paddingTop: 8 }}>
|
|
187
|
+
{source.enabled && source.roles.includes("plan") && <PlanLine source={source} plan={view.plan} theme={theme} compact={compact} />}
|
|
188
|
+
{source.instructions ? <RichText plain style={[t.meta, { fontStyle: "italic" }]}>{`“${source.instructions}”`}</RichText> : source.places.every(p => p.kind === "tracker" || p.kind === "calendar") ? <Text style={t.meta}>Read by rule, with no model.</Text> : <Text style={t.meta}>No reading notes: read with its roles' notes and yours.</Text>}
|
|
189
|
+
{source.enabled && live > 0 && <NoteList notes={notes} view={view} theme={theme} compact={compact} />}
|
|
190
|
+
<View style={{ flexDirection: "row" }}><Button title="Edit source" icon="Pencil" theme={theme} compact={compact} disabled={busy} onPress={onEdit} accessibilityLabel={`Edit ${source.label}`} /></View>
|
|
191
|
+
</View>}
|
|
191
192
|
</View>
|
|
193
|
+
<IconButton theme={theme} compact={compact} icon={open ? "ChevronUp" : "ChevronDown"} label={`${open ? "Hide" : "Show"} ${source.label}'s notes and settings`} onPress={() => setOpen(o => !o)} />
|
|
192
194
|
<Switch theme={theme} compact={compact} label={compact ? "" : source.enabled ? "On" : "Off"} accessibilityLabel={`Read ${source.label}`} value={source.enabled} disabled={busy} onChange={onToggle} />
|
|
193
195
|
</View>;
|
|
194
196
|
}
|
|
@@ -222,31 +224,53 @@ function PlanLine({ source, plan, theme, compact }: { source: CompassSource; pla
|
|
|
222
224
|
*/
|
|
223
225
|
function NoteList({ notes, view, theme, compact }: { notes: CompassNote[]; view: View_; theme: Theme; compact: boolean }) {
|
|
224
226
|
const c = theme.colors; const t = text(c, compact);
|
|
227
|
+
// A rule note (tracker, calendar) quotes its title then its fields: the title is already the note's line, so only the
|
|
228
|
+
// fields show; a meeting's raw start time is said by "Until" instead.
|
|
229
|
+
const quoteOf = (n: CompassNote) => {
|
|
230
|
+
if (!n.quote) return null;
|
|
231
|
+
const cut = n.quote.indexOf(" · ");
|
|
232
|
+
if (cut < 0 || !n.quote.slice(0, cut).includes(n.what)) return n.quote;
|
|
233
|
+
const rest = n.quote.slice(cut + 3);
|
|
234
|
+
return /^\d{4}-\d\d-\d\d(T|$)/.test(rest) ? null : rest;
|
|
235
|
+
};
|
|
225
236
|
const where = (n: CompassNote) => n.match.workspace ? view.workspaces[n.match.workspace] ?? "its workspace" : n.match.issue ? n.match.issue : "not matched to a workspace";
|
|
226
237
|
return <View style={{ gap: 10, paddingTop: 2 }}>
|
|
227
238
|
{notes.map(n => <View key={n.id} style={{ gap: 2, paddingLeft: 10, borderLeftWidth: 2, borderLeftColor: c.border }}>
|
|
228
239
|
<RichText plain style={[t.body, { color: c.foreground }]}>{n.what}</RichText>
|
|
229
|
-
{n
|
|
240
|
+
{quoteOf(n) && <RichText plain numberOfLines={3} style={[t.meta, { fontStyle: "italic" }]}>{`“${quoteOf(n)}”`}</RichText>}
|
|
230
241
|
<Text style={[t.meta, { fontVariant: ["tabular-nums"] }]}>{[n.until ? `Until ${day(n.until)}` : null, ROLE_INFO[n.role].label, where(n)].filter(Boolean).join(" · ")}</Text>
|
|
231
242
|
</View>)}
|
|
232
243
|
</View>;
|
|
233
244
|
}
|
|
234
245
|
|
|
246
|
+
/** What the editor picks places with, by the kind of place a source reads. */
|
|
247
|
+
const PICKS: Record<Place["kind"], { kinds: FindKind[]; first: string; more: string }> = {
|
|
248
|
+
conversation: { kinds: ["channels"], first: "Pick a channel", more: "Add" },
|
|
249
|
+
doc: { kinds: ["docs", "file"], first: "Pick a doc", more: "Add" },
|
|
250
|
+
tracker: { kinds: ["trackers"], first: "Pick a project or label", more: "Add" },
|
|
251
|
+
calendar: { kinds: ["calendars"], first: "Pick a calendar", more: "Add" },
|
|
252
|
+
};
|
|
253
|
+
type WhoMode = "people" | "anyone" | "me";
|
|
254
|
+
|
|
235
255
|
/**
|
|
236
|
-
* The one editor for adding and changing a source. A preset only fills the fields.
|
|
237
|
-
*
|
|
256
|
+
* The one editor for adding and changing a source. A preset only fills the fields. Every place is picked from what a
|
|
257
|
+
* reader finds (compass_find: the chat, docs, tracker and calendar tools' own results, or a file checked on this
|
|
258
|
+
* machine), so every place has its reader's own id. Whose words count for a conversation or a doc: some people,
|
|
259
|
+
* everyone there, or you; a tracker's or a calendar's items are read by rule, so nobody is picked.
|
|
238
260
|
*/
|
|
239
261
|
function SourceEditor({ view, source, first, busy, onSave, onCancel, onRemove, theme, compact }: { view: View_; source?: CompassSource; first: boolean; busy: boolean; onSave: (c: CompassChange) => void; onCancel: () => void; onRemove?: () => void; theme: Theme; compact: boolean }) {
|
|
240
262
|
const c = theme.colors; const t = text(c, compact);
|
|
241
263
|
const [preset, setPreset] = useState<Preset | null>(source ? null : view.presets.find(p => p.offered) ?? null);
|
|
242
264
|
const [people, setPeople] = useState<Found[]>(source ? source.who.kind === "person" ? [{ id: source.who.person.id, name: source.who.person.name, place: null! }] : source.who.kind === "people" ? source.who.people.map(p => ({ id: p.id, name: p.name, place: null! })) : [] : []);
|
|
243
|
-
const [
|
|
265
|
+
const [mode, setMode] = useState<WhoMode>(source ? (source.who.kind === "me" ? "me" : source.who.kind === "anyone" ? "anyone" : "people") : preset?.who === "me" ? "me" : preset?.who === "anyone" ? "anyone" : "people");
|
|
244
266
|
const [places, setPlaces] = useState<Place[]>(source?.places ?? []);
|
|
245
267
|
const [roles, setRoles] = useState<Role[]>(source?.roles ?? preset?.roles ?? ["priorities"]);
|
|
246
268
|
const [label, setLabel] = useState(source?.label ?? "");
|
|
247
269
|
const [notes, setNotes] = useState(source?.instructions ?? "");
|
|
248
|
-
const [picking, setPicking] = useState<
|
|
249
|
-
const
|
|
270
|
+
const [picking, setPicking] = useState<FindKind | null>(null);
|
|
271
|
+
const kind: Place["kind"] = source?.places[0]?.kind ?? preset?.reader ?? "conversation";
|
|
272
|
+
const ruled = kind === "tracker" || kind === "calendar";
|
|
273
|
+
const usePreset = (p: Preset) => { setPreset(p); setRoles(p.roles); setMode(p.who === "me" ? "me" : p.who === "anyone" ? "anyone" : "people"); setPlaces([]); setPicking(null); if (p.who !== "person" && p.who !== "people") setPeople([]); };
|
|
250
274
|
const dmOnly = preset?.sub === "dm";
|
|
251
275
|
const addPerson = (f: Found) => {
|
|
252
276
|
setPicking(null);
|
|
@@ -255,18 +279,30 @@ function SourceEditor({ view, source, first, busy, onSave, onCancel, onRemove, t
|
|
|
255
279
|
if (dmOnly) setPlaces(ps => ps.some(p => p.id === f.id) ? ps : [...ps, f.place].slice(0, COMPASS.places));
|
|
256
280
|
if (!label && !source) setLabel(f.name);
|
|
257
281
|
};
|
|
258
|
-
const
|
|
282
|
+
const addPlace = (f: Found) => { setPicking(null); setPlaces(ps => ps.some(p => p.kind === f.place.kind && p.id === f.place.id) ? ps : [...ps, f.place].slice(0, COMPASS.places)); if (!label && !source && (ruled || mode !== "people")) setLabel(kind === "calendar" ? "Calendar deadlines" : f.name); };
|
|
283
|
+
// Trackers and calendars are read by rule: their items, whoever wrote them (a calendar is yours).
|
|
284
|
+
const who: Who | null = ruled ? (kind === "calendar" ? { kind: "me" } : { kind: "anyone" }) : mode === "me" ? { kind: "me" } : mode === "anyone" ? { kind: "anyone" }
|
|
285
|
+
: people.length === 1 ? { kind: "person", person: { id: people[0].id, name: people[0].name } } : people.length > 1 ? { kind: "people", people: people.map(p => ({ id: p.id, name: p.name })) } : null;
|
|
259
286
|
const ready = !!who && places.length > 0 && roles.length > 0;
|
|
260
287
|
const save = () => who && onSave({ source: { ...(source ? { id: source.id } : {}), ...(label.trim() ? { label: label.trim() } : {}), who, places, roles, instructions: notes } });
|
|
261
|
-
const chip = (title: string, onRemoveChip: () => void, key: string) => <View key={key} style={{ flexDirection: "row", alignItems: "center", gap: 4, minHeight: compact ? 44 : 28, paddingLeft: 10, paddingRight: 4, borderRadius: 6, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface0 }}>
|
|
262
|
-
<Text style={t.body}>{title}</Text>
|
|
288
|
+
const chip = (title: string, onRemoveChip: () => void, key: string) => <View key={key} style={{ flexDirection: "row", alignItems: "center", gap: 4, minHeight: compact ? 44 : 28, maxWidth: "100%", paddingLeft: 10, paddingRight: 4, borderRadius: 6, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface0 }}>
|
|
289
|
+
<Text numberOfLines={1} style={[t.body, { flexShrink: 1 }]}>{title}</Text>
|
|
263
290
|
<Pressable accessibilityRole="button" accessibilityLabel={`Remove ${title}`} onPress={onRemoveChip} hitSlop={6} style={{ minWidth: compact ? 36 : 22, minHeight: compact ? 36 : 22, alignItems: "center", justifyContent: "center" }}>
|
|
264
291
|
<Icon name="X" size={12} color={c.foregroundMuted} />
|
|
265
292
|
</Pressable>
|
|
266
293
|
</View>;
|
|
267
|
-
|
|
294
|
+
// On a phone a label sits on its own line above its controls, as "Start from" does; on desktop, a column.
|
|
295
|
+
const labelCol = (s: string) => <Text style={[t.meta, compact ? { width: "100%" } : { width: 96 }]}>{s}</Text>;
|
|
268
296
|
const row = { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 } as const;
|
|
297
|
+
const pill = (on: boolean, title: string, onPress: () => void, role: "radio" | "checkbox", key: string) => <Pressable key={key} accessibilityRole={role} accessibilityState={{ checked: on }} onPress={onPress}
|
|
298
|
+
style={state => ({ minHeight: compact ? 44 : 28, paddingHorizontal: 10, borderRadius: 999, justifyContent: "center", borderWidth: 1, borderColor: on ? c.accent : c.border,
|
|
299
|
+
backgroundColor: on ? tint(c.accent, c) : (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
|
|
300
|
+
<Text style={{ color: on ? c.foreground : c.foregroundMuted, fontSize: 12, fontWeight: "500" }}>{title}</Text>
|
|
301
|
+
</Pressable>;
|
|
302
|
+
const picks = PICKS[kind].kinds.filter(k => k !== "docs" || view.readers.doc);
|
|
303
|
+
const missing = view.presets.filter(p => !p.offered);
|
|
269
304
|
return <SubmitScope enabled={ready && !busy} onSubmit={save} style={{ padding: compact ? 14 : 12, gap: 12, borderTopWidth: first ? 0 : 1, borderTopColor: c.border, backgroundColor: c.surface1 }}>
|
|
305
|
+
{!source && <Text accessibilityRole="header" style={[t.body, { color: c.foreground, fontWeight: "600" }]}>New source</Text>}
|
|
270
306
|
{!source && <View style={{ gap: 6 }}>
|
|
271
307
|
<Text style={[t.meta, { color: c.foreground, fontWeight: "600" }]}>Start from</Text>
|
|
272
308
|
<View style={row}>
|
|
@@ -277,40 +313,53 @@ function SourceEditor({ view, source, first, busy, onSave, onCancel, onRemove, t
|
|
|
277
313
|
</Pressable>)}
|
|
278
314
|
</View>
|
|
279
315
|
{preset && <Text style={t.meta}>{preset.hint}</Text>}
|
|
280
|
-
{
|
|
316
|
+
{/* A preset whose reader isn't here is never a dead control: it isn't offered, and one line says why. */}
|
|
317
|
+
{[...new Set(missing.map(p => p.why))].map(why => <Text key={why} style={t.meta}>{`${missing.filter(p => p.why === why).map(p => p.label).join(", ")}: ${why}`}</Text>)}
|
|
318
|
+
</View>}
|
|
319
|
+
{!ruled && <View style={{ gap: 6 }}>
|
|
320
|
+
{!dmOnly && <View style={row}>
|
|
321
|
+
{labelCol("Whose words")}
|
|
322
|
+
{(["people", "anyone", "me"] as const).map(m => pill(mode === m, m === "people" ? "Some people" : m === "anyone" ? "Everyone there" : "Yours", () => { setMode(m); if (m !== "people") { setPeople([]); setPicking(null); } }, "radio", m))}
|
|
323
|
+
</View>}
|
|
324
|
+
{mode === "people" && <View style={row}>
|
|
325
|
+
{dmOnly ? labelCol("Whose words") : !compact && labelCol("")}
|
|
326
|
+
{people.map(p => chip(p.name, () => { setPeople(ps => ps.filter(x => x.id !== p.id)); if (dmOnly) setPlaces(ps => ps.filter(x => x.id !== p.id)); }, p.id))}
|
|
327
|
+
{people.length < COMPASS.people && <Button title={people.length ? "Add a person" : "Pick a person"} icon="Plus" kind={people.length ? "ghost" : "secondary"} theme={theme} compact={compact} onPress={() => setPicking(picking === "people" ? null : "people")} />}
|
|
328
|
+
</View>}
|
|
329
|
+
{mode === "anyone" && <Text style={t.meta}>{`Everyone's messages there, the newest ${COMPASS.items} a read. Your reading notes can narrow it ("only the leads").`}</Text>}
|
|
281
330
|
</View>}
|
|
282
|
-
<View style={row}>
|
|
283
|
-
{labelCol("Whose words")}
|
|
284
|
-
{me ? <Text style={t.body}>Yours</Text> : people.map(p => chip(p.name, () => { setPeople(ps => ps.filter(x => x.id !== p.id)); if (dmOnly) setPlaces(ps => ps.filter(x => x.id !== p.id)); }, p.id))}
|
|
285
|
-
{!me && people.length < COMPASS.people && <Button title={people.length ? "Add a person" : "Pick a person"} icon="Plus" kind={people.length ? "ghost" : "secondary"} theme={theme} compact={compact} onPress={() => setPicking(picking === "people" ? null : "people")} />}
|
|
286
|
-
</View>
|
|
287
331
|
{picking === "people" && <FindPicker kind="people" theme={theme} compact={compact} onCancel={() => setPicking(null)} onPick={addPerson} />}
|
|
288
332
|
<View style={row}>
|
|
289
333
|
{labelCol("Where")}
|
|
290
334
|
{places.map(p => chip(placeName(p), () => setPlaces(ps => ps.filter(x => x !== p)), `${p.kind}:${p.id}`))}
|
|
291
|
-
{places.length < COMPASS.places && !dmOnly && <Button title={
|
|
335
|
+
{places.length < COMPASS.places && !dmOnly && picks.map((k, i) => <Button key={k} title={k === "file" ? "A file on this machine" : places.length ? PICKS[kind].more : PICKS[kind].first} icon={k === "file" ? "FileText" : "Plus"}
|
|
336
|
+
kind={places.length || i > 0 ? "ghost" : "secondary"} theme={theme} compact={compact} onPress={() => setPicking(picking === k ? null : k)} />)}
|
|
292
337
|
{dmOnly && !places.length && <Text style={t.meta}>Their DM with you, once you pick them.</Text>}
|
|
293
338
|
</View>
|
|
294
|
-
{picking
|
|
339
|
+
{picking && picking !== "people" && <FindPicker kind={picking} theme={theme} compact={compact} onCancel={() => setPicking(null)} onPick={addPlace} />}
|
|
340
|
+
{kind === "calendar" && places.length > 0 && <View style={row}>
|
|
341
|
+
{labelCol("Which events")}
|
|
342
|
+
{(["with-guests", "all"] as const).map(f => pill((places[0].kind === "calendar" ? places[0].filter ?? "all" : "all") === f, f === "with-guests" ? "Meetings with guests" : "All events",
|
|
343
|
+
() => setPlaces(ps => ps.map(p => p.kind === "calendar" ? { ...p, filter: f } : p)), "radio", f))}
|
|
344
|
+
</View>}
|
|
345
|
+
{ruled && <Text style={t.meta}>{kind === "tracker"
|
|
346
|
+
? "Read by rule, with no model: each open issue in it is a note quoting its own fields, and one that leaves it ends its note."
|
|
347
|
+
: "Read by rule, with no model: a meeting in the next two weeks lends its date to the work it matches; one about nothing here isn't kept."}</Text>}
|
|
295
348
|
<View style={{ gap: 6 }}>
|
|
296
|
-
<Text style={[t.meta, { color: c.foreground, fontWeight: "600" }]}>What
|
|
349
|
+
<Text style={[t.meta, { color: c.foreground, fontWeight: "600" }]}>What it tells you</Text>
|
|
297
350
|
<View style={row}>
|
|
298
|
-
{ROLES.map(r => { const on = roles.includes(r); return
|
|
299
|
-
style={state => ({ minHeight: compact ? 44 : 28, paddingHorizontal: 10, borderRadius: 999, justifyContent: "center", borderWidth: 1, borderColor: on ? c.accent : c.border,
|
|
300
|
-
backgroundColor: on ? tint(c.accent, c) : (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
|
|
301
|
-
<Text style={{ color: on ? c.foreground : c.foregroundMuted, fontSize: 12, fontWeight: "500" }}>{ROLE_INFO[r].label}</Text>
|
|
302
|
-
</Pressable>; })}
|
|
351
|
+
{ROLES.map(r => { const on = roles.includes(r); return pill(on, ROLE_INFO[r].label, () => setRoles(rs => on ? rs.filter(x => x !== r) : [...rs, r]), "checkbox", r); })}
|
|
303
352
|
</View>
|
|
304
353
|
</View>
|
|
305
|
-
<View style={{ gap: 6 }}>
|
|
354
|
+
{!ruled && <View style={{ gap: 6 }}>
|
|
306
355
|
<Text style={[t.meta, { color: c.foreground, fontWeight: "600" }]}>How to read this</Text>
|
|
307
|
-
<TextInput accessibilityLabel="How to read this source" multiline value={notes} onChangeText={v => setNotes(v.slice(0, COMPASS.sourceInstructions))} placeholder="P0 means today, P1 this week. Ignore hiring talk."
|
|
356
|
+
<TextInput accessibilityLabel="How to read this source" multiline value={notes} onChangeText={v => setNotes(v.slice(0, COMPASS.sourceInstructions))} placeholder={kind === "doc" ? "Lines under 'This week' are the plan. A line starting with ! is urgent." : "P0 means today, P1 this week. Ignore hiring talk."}
|
|
308
357
|
placeholderTextColor={c.foregroundMuted} style={{ minHeight: 64, padding: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0, textAlignVertical: "top" }} />
|
|
309
|
-
<Text style={t.meta}>{`Your words for the model that reads it. They change how
|
|
310
|
-
</View>
|
|
358
|
+
<Text style={t.meta}>{`Your words for the model that reads it. They change how it is read, never what is read. ${notes.length}/${COMPASS.sourceInstructions}`}</Text>
|
|
359
|
+
</View>}
|
|
311
360
|
<View style={row}>
|
|
312
361
|
{labelCol("Name")}
|
|
313
|
-
<TextInput accessibilityLabel="Source name" value={label} onChangeText={setLabel} placeholder="Dana · product" placeholderTextColor={c.foregroundMuted}
|
|
362
|
+
<TextInput accessibilityLabel="Source name" value={label} onChangeText={setLabel} placeholder={kind === "tracker" ? "priority/high" : kind === "doc" ? "Now" : kind === "calendar" ? "Calendar deadlines" : "Dana · product"} placeholderTextColor={c.foregroundMuted}
|
|
314
363
|
style={{ flex: 1, minWidth: 160, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0 }} />
|
|
315
364
|
</View>
|
|
316
365
|
<View style={[row, { justifyContent: "space-between" }]}>
|
|
@@ -320,33 +369,53 @@ function SourceEditor({ view, source, first, busy, onSave, onCancel, onRemove, t
|
|
|
320
369
|
</View>
|
|
321
370
|
{onRemove && <Button title="Remove source" kind="ghost" icon="Trash2" theme={theme} compact={compact} disabled={busy} onPress={onRemove} />}
|
|
322
371
|
</View>
|
|
323
|
-
{!ready && <Text style={t.meta}>{!who ? "Pick whose words count." : !places.length ? "Pick where to read
|
|
372
|
+
{!ready && <Text style={t.meta}>{!who ? "Pick whose words count." : !places.length ? "Pick where to read." : "Give it at least one role."}</Text>}
|
|
324
373
|
</SubmitScope>;
|
|
325
374
|
}
|
|
326
375
|
|
|
327
|
-
|
|
328
|
-
|
|
376
|
+
const FIND_COPY: Record<FindKind, { label: string; placeholder: string }> = {
|
|
377
|
+
people: { label: "Search people", placeholder: "Search people by name" },
|
|
378
|
+
channels: { label: "Search channels", placeholder: "Search channels by name" },
|
|
379
|
+
docs: { label: "Search docs", placeholder: "Search pages by title" },
|
|
380
|
+
file: { label: "File path", placeholder: "/home/you/notes/now.md" },
|
|
381
|
+
trackers: { label: "Search trackers", placeholder: "A Linear project, or owner/repo for GitHub" },
|
|
382
|
+
calendars: { label: "Calendars", placeholder: "" },
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* A place or person from a reader's own results (compass_find): people, channels, docs, a file checked on this machine,
|
|
387
|
+
* tracker scopes, calendars. Only results with the reader's own id can be picked. A file is checked on Enter or
|
|
388
|
+
* Check; calendars list at once.
|
|
389
|
+
*/
|
|
390
|
+
function FindPicker({ kind, onPick, onCancel, theme, compact }: { kind: FindKind; onPick: (f: Found) => void; onCancel: () => void; theme: Theme; compact: boolean }) {
|
|
329
391
|
const c = theme.colors; const t = text(c, compact);
|
|
330
392
|
const find = useRpc(compassFindRpc);
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
const
|
|
393
|
+
const file = kind === "file"; const auto = kind === "calendars";
|
|
394
|
+
const [q, setQ] = useState(""); const [debounced, setDebounced] = useState(auto ? "calendar" : "");
|
|
395
|
+
useEffect(() => { if (file || auto) return; const id = setTimeout(() => setDebounced(q.trim()), 350); return () => clearTimeout(id); }, [q, file, auto]);
|
|
396
|
+
const results = useQuery({ queryKey: ["follow-up", "compass-find", kind, debounced], enabled: debounced.length >= 2, staleTime: file ? 0 : 60_000,
|
|
334
397
|
queryFn: async () => await find({ kind, query: debounced }) as { results: Found[]; error: string | null } });
|
|
335
|
-
|
|
398
|
+
const copy = FIND_COPY[kind];
|
|
399
|
+
// Its own scope: Enter checks a file here, and never reaches the editor's scope around it (which would swallow it).
|
|
400
|
+
return <SubmitScope enabled={file && q.trim().length >= 2} onSubmit={() => setDebounced(q.trim())} style={{ borderWidth: 1, borderColor: c.border, borderRadius: 8, backgroundColor: c.surface0, overflow: "hidden" }}>
|
|
336
401
|
<View style={{ flexDirection: "row", gap: 8, padding: 8, alignItems: "center" }}>
|
|
337
|
-
<
|
|
338
|
-
|
|
339
|
-
|
|
402
|
+
{auto ? <Text style={[t.meta, { flex: 1 }]}>{results.isFetching ? "Looking…" : "The calendars your calendar tool lists"}</Text>
|
|
403
|
+
: <TextInput autoFocus accessibilityLabel={copy.label} value={q} onChangeText={setQ} placeholder={copy.placeholder}
|
|
404
|
+
placeholderTextColor={c.foregroundMuted} autoCapitalize="none" autoCorrect={false}
|
|
405
|
+
style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface1, ...(file && q ? { fontFamily: "ui-monospace, Menlo, monospace" } : {}) }} />}
|
|
406
|
+
{file && <Button title="Check" theme={theme} compact={compact} disabled={q.trim().length < 2} loading={results.isFetching} onPress={() => setDebounced(q.trim())} />}
|
|
340
407
|
<Button title="Cancel" kind="ghost" theme={theme} compact={compact} onPress={onCancel} />
|
|
341
408
|
</View>
|
|
342
|
-
{
|
|
409
|
+
{file && !debounced && <Text style={[t.meta, { paddingHorizontal: 12, paddingBottom: 8 }]}>A Markdown or text file, up to 64 KB. Compass reads it only when it changes, and its path never leaves this machine.</Text>}
|
|
410
|
+
{!file && !auto && results.isFetching && <Text style={[t.meta, { paddingHorizontal: 12, paddingBottom: 8 }]}>Searching…</Text>}
|
|
343
411
|
{results.data?.error && <Text style={[t.meta, { paddingHorizontal: 12, paddingBottom: 8, color: c.statusWarning }]}>{results.data.error}</Text>}
|
|
344
412
|
{(results.data?.results ?? []).map(r => <Pressable key={r.id} accessibilityRole="button" onPress={() => onPick(r)}
|
|
345
|
-
style={state => ({ minHeight: compact ? 44 : 34, paddingHorizontal: 12, justifyContent: "center", borderTopWidth: 1, borderTopColor: c.border, backgroundColor: state.pressed || (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
|
|
346
|
-
<Text style={t.body}>{kind === "
|
|
413
|
+
style={state => ({ minHeight: compact ? 44 : 34, paddingHorizontal: 12, paddingVertical: 6, justifyContent: "center", borderTopWidth: 1, borderTopColor: c.border, backgroundColor: state.pressed || (state as { hovered?: boolean }).hovered ? c.surface2 : "transparent" })}>
|
|
414
|
+
<Text style={t.body}>{kind === "channels" ? `#${r.name}` : r.name}</Text>
|
|
415
|
+
{r.detail && <RichText plain style={t.meta}>{r.detail}</RichText>}
|
|
347
416
|
</Pressable>)}
|
|
348
417
|
{debounced.length >= 2 && !results.isFetching && !results.data?.results.length && !results.data?.error && <Text style={[t.meta, { paddingHorizontal: 12, paddingBottom: 8 }]}>{`Nothing matches "${debounced}".`}</Text>}
|
|
349
|
-
</
|
|
418
|
+
</SubmitScope>;
|
|
350
419
|
}
|
|
351
420
|
|
|
352
421
|
/** "How to read your Compass": the developer's words for every source, saved on Save. */
|
package/client/display.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { Text } from "./text";
|
|
|
11
11
|
import { displayPreferences, displayRpc, trustCountText } from "../shared/display";
|
|
12
12
|
import { sidebarVisibility } from "./sidebar-visibility";
|
|
13
13
|
import { appVisible, onVisible } from "./visibility";
|
|
14
|
+
import { NEW_NAME } from "../shared/new-name";
|
|
14
15
|
|
|
15
16
|
type Display = import("zod").infer<typeof displayPreferences.schema>;
|
|
16
17
|
const listeners = new Set<(values: Display) => void>();
|
|
@@ -103,7 +104,7 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
103
104
|
<SettingsSelect label="Search from anywhere" hint="Jumps to Home's search from any screen, even mid-message. On Home, / works too."
|
|
104
105
|
value={searchShortcutOf(settings.values.search_shortcut)} options={searchShortcutOptions(isMac())} disabled={settings.saving}
|
|
105
106
|
onValueChange={(search_shortcut: SearchShortcut) => save({ search_shortcut })} />
|
|
106
|
-
<SettingsSelect label=
|
|
107
|
+
<SettingsSelect label={`${NEW_NAME} from anywhere`} hint={newShortcutHint(isDesktopApp(), isMac())}
|
|
107
108
|
value={newShortcutPreset(settings.values.new_shortcut, isDesktopApp())} options={newShortcutOptions(isMac())} disabled={settings.saving}
|
|
108
109
|
onValueChange={(new_shortcut: NewShortcut) => save({ new_shortcut })} />
|
|
109
110
|
</SettingsCard>
|
package/client/header.tsx
CHANGED
|
@@ -94,8 +94,8 @@ export function WorkspaceHeader({ workspace: w, theme, compact, now, onSettings,
|
|
|
94
94
|
<Text style={[t.meta, { flex: 1, color: c.statusWarning }]}>{notice}</Text>
|
|
95
95
|
</View>}
|
|
96
96
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 4, marginTop: 2, minHeight: compact ? 44 : 28 }}>
|
|
97
|
-
<Text numberOfLines={1} style={[t.small, { flexShrink: 1 }, stale ? { color: c.statusWarning } : null]}>{checked ? `Checked ${ago(checked, now)}${stale ? " · may be out of date" : ""}` : "Checks GitHub every 15s"}</Text>
|
|
98
|
-
<IconButton icon="RefreshCw" label="Refresh PR status" onPress={onRefresh} theme={theme} compact={compact} disabled={refreshing} spinning={refreshing} />
|
|
97
|
+
<Text numberOfLines={1} style={[t.small, { flexShrink: 1 }, stale && !w.githubOff ? { color: c.statusWarning } : null]}>{w.githubOff ? "Not checking GitHub" : checked ? `Checked ${ago(checked, now)}${stale ? " · may be out of date" : ""}` : "Checks GitHub every 15s"}</Text>
|
|
98
|
+
<IconButton icon="RefreshCw" label={w.githubOff ? "Check GitHub again" : "Refresh PR status"} onPress={onRefresh} theme={theme} compact={compact} disabled={refreshing} spinning={refreshing} />
|
|
99
99
|
<View style={{ flex: 1 }} />
|
|
100
100
|
<Switch theme={theme} compact={compact} label="Auto-send" accessibilityLabel="Auto-send repairs" hint="Send repairs to the main agent on its own when the agent is idle. Off means each message waits for your click."
|
|
101
101
|
value={w.enable_auto_sends} disabled={autoPending} onChange={onAuto} />
|
package/client/home-chrome.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import { Spinner } from "./motion";
|
|
|
18
18
|
import { withAlpha, type Colors } from "./theme";
|
|
19
19
|
import { text, type Theme } from "./kit";
|
|
20
20
|
import { MenuItemContent, menuGlyph, menuItemRow } from "./menu-item";
|
|
21
|
+
import { useSearchFocusField } from "./search-focus";
|
|
21
22
|
import { useLinkedIndex } from "./linked";
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -37,6 +38,13 @@ export type Omnibox = {
|
|
|
37
38
|
active: number;
|
|
38
39
|
move(delta: number): void;
|
|
39
40
|
inputRef: React.RefObject<TextInput | null>;
|
|
41
|
+
/** The search field's onLayout: a waiting search request tries again when the field comes on screen. */
|
|
42
|
+
onSearchLayout: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Asks for the caret in the search (every-search-request-lands-in-the-visible-search), only when a Home search is on
|
|
45
|
+
* screen: true when it asked. A Home kept mounted behind another screen asks nothing.
|
|
46
|
+
*/
|
|
47
|
+
focusSearch(): boolean;
|
|
40
48
|
/** The Overseer is on, so a query can also be an ask. */
|
|
41
49
|
askOn: boolean;
|
|
42
50
|
/** Images pasted or dropped on the search while the Overseer is on: they go with the ask (every-agent-field-takes-images). */
|
|
@@ -73,12 +81,12 @@ export function useOmnibox(model: HomeModel, sources: HomeSources, extraProvider
|
|
|
73
81
|
const fallback = defaultActive(results);
|
|
74
82
|
const current = active ?? fallback;
|
|
75
83
|
const move = useCallback((delta: number) => setActive(a => Math.max(0, Math.min((results?.length ?? 1) - 1, (a ?? fallback) + delta))), [results, fallback]);
|
|
76
|
-
// ⌘K
|
|
77
|
-
//
|
|
78
|
-
const
|
|
79
|
-
|
|
84
|
+
// every-search-request-lands-in-the-visible-search: this field takes a search request (the key, ⌘K, `/`) while it is
|
|
85
|
+
// the one on screen, on mount, on layout, or when focus moves without the developer (client/search-focus.ts).
|
|
86
|
+
const onSearchLayout = useSearchFocusField(sources.extras.searchFocus, inputRef);
|
|
87
|
+
const focusSearch = useCallback(() => { const f = sources.extras.searchFocus; if (!f.shown()) return false; f.request(); return true; }, [sources.extras.searchFocus]);
|
|
80
88
|
const hint = layoutHint((results ?? []).flatMap(r => r.hit ? [r.hit] : []));
|
|
81
|
-
return { query, setQuery, setPhysical, layoutHint: hint, results, active: Math.min(current, Math.max(0, (results?.length ?? 1) - 1)), move, inputRef, askOn, images };
|
|
89
|
+
return { query, setQuery, setPhysical, layoutHint: hint, results, active: Math.min(current, Math.max(0, (results?.length ?? 1) - 1)), move, inputRef, onSearchLayout, focusSearch, askOn, images };
|
|
82
90
|
}
|
|
83
91
|
|
|
84
92
|
type DomKey = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; target: unknown; preventDefault(): void };
|
|
@@ -91,19 +99,22 @@ export function useSlashToFocus(omnibox: Omnibox, enabled = true) {
|
|
|
91
99
|
if (e.key !== "/" || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
92
100
|
const target = e.target as { tagName?: string; isContentEditable?: boolean } | null;
|
|
93
101
|
if (target && (target.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName ?? ""))) return;
|
|
94
|
-
|
|
95
|
-
|
|
102
|
+
// The one owner of search focus: only the Home search on screen takes it, so a Home kept mounted behind
|
|
103
|
+
// another screen neither swallows the key nor focuses a hidden field.
|
|
104
|
+
if (omnibox.focusSearch()) e.preventDefault();
|
|
96
105
|
};
|
|
97
106
|
doc.addEventListener("keydown", onKey);
|
|
98
107
|
return () => doc.removeEventListener("keydown", onKey);
|
|
99
|
-
}, [omnibox.
|
|
108
|
+
}, [omnibox.focusSearch, enabled]);
|
|
100
109
|
}
|
|
101
110
|
|
|
102
111
|
/**
|
|
103
112
|
* The one query field: Home's omnibox (SearchField) and the sidebar view's filter (FilterField) are this with
|
|
104
113
|
* different words. `dense` is the phone layout: a 44px field with a rounder shape and body-size text.
|
|
105
114
|
*/
|
|
106
|
-
export function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, slashTitle, onSubmit, onArrow, listKeys = false, count, autoFocus = false, onEscape, onLayoutQuery, trailing }: {
|
|
115
|
+
export function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, slashTitle, onSubmit, onArrow, listKeys = false, count, autoFocus = false, onEscape, onLayoutQuery, trailing, onLayout }: {
|
|
116
|
+
/** The field's own layout (Home's search: a waiting search request tries again). */
|
|
117
|
+
onLayout?: () => void;
|
|
107
118
|
/** A control at the field's end, before its ✕ (Home's search asking the Overseer: Add image). */
|
|
108
119
|
trailing?: ReactNode;
|
|
109
120
|
/** Its arrows step into the list below (client/list-keys.ts): the sidebar filter, and Home's search while empty. */
|
|
@@ -146,9 +157,9 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
|
|
|
146
157
|
return <View style={{ flex: 1, minWidth: 0, flexDirection: "row", alignItems: "center", gap: dense ? 8 : 6, height: dense ? 44 : 32, paddingHorizontal: dense ? 12 : 8, borderRadius: dense ? 12 : 6,
|
|
147
158
|
borderWidth: 1, borderColor: focused ? withAlpha(c.foreground, 0.35) : c.border, backgroundColor: c.surface1 }}>
|
|
148
159
|
<Icon name={icon as never} size={dense ? 16 : 13} color={c.foregroundMuted} />
|
|
149
|
-
<TextInput ref={inputRef} value={value} onChangeText={q => { onLayoutQuery?.(capture.current.change(q)); onChange(q); }} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
|
|
160
|
+
<TextInput ref={inputRef} onLayout={onLayout} value={value} onChangeText={q => { onLayoutQuery?.(capture.current.change(q)); onChange(q); }} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
|
|
150
161
|
accessibilityLabel={placeholder} autoFocus={autoFocus} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
|
|
151
|
-
{...(listKeys ? { dataSet: { listKeys: "1" } } as object : {})}
|
|
162
|
+
{...(listKeys || onLayout ? { dataSet: { ...(listKeys ? { listKeys: "1" } : {}), ...(onLayout ? { followUpSearch: "1" } : {}) } } as object : {})}
|
|
152
163
|
onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
|
|
153
164
|
onSubmitEditing={onSubmit}
|
|
154
165
|
// A single-line field blurs on submit by default, which dropped focus on the page after a search pick while the
|
|
@@ -181,11 +192,11 @@ export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey }: { t
|
|
|
181
192
|
const { query, setQuery, results, active, move, inputRef, askOn } = omnibox;
|
|
182
193
|
const placeholder = askOn ? dense ? "Search or ask the Overseer" : "Search, or ask the Overseer" : "Search workspaces, branches, PRs";
|
|
183
194
|
// The bar stays one line: a paste or drop lands here, and Home draws the thumbnails on their own line under it.
|
|
184
|
-
if (askOn) return <ImageField model={omnibox.images} theme={theme} compact={dense} row={false} attach="inline" style={{ flex: 1, minWidth: 0 }}><QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} slashHint={anywhereKey || "/"}
|
|
195
|
+
if (askOn) return <ImageField model={omnibox.images} theme={theme} compact={dense} row={false} attach="inline" style={{ flex: 1, minWidth: 0 }}><QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} onLayout={omnibox.onSearchLayout} slashHint={anywhereKey || "/"}
|
|
185
196
|
trailing={<AttachImageButton model={omnibox.images} theme={theme} compact={dense} label="Add image for the Overseer" />}
|
|
186
197
|
slashTitle={anywhereKey ? `${anywhereKey} from anywhere · / on Home` : "/ focuses the search"}
|
|
187
198
|
onSubmit={() => { const item = results?.[active]; if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} /></ImageField>;
|
|
188
|
-
return <QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} slashHint={anywhereKey || "/"}
|
|
199
|
+
return <QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} onLayout={omnibox.onSearchLayout} slashHint={anywhereKey || "/"}
|
|
189
200
|
slashTitle={anywhereKey ? `${anywhereKey} from anywhere · / on Home` : "/ focuses the search"}
|
|
190
201
|
onSubmit={() => { const item = results?.[active]; if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} />;
|
|
191
202
|
}
|
package/client/home-data.ts
CHANGED
|
@@ -64,7 +64,7 @@ export type HomeSources = { inbox: InboxStore; live: LiveStore; paseo: PaseoWork
|
|
|
64
64
|
|
|
65
65
|
/** One shared minute clock. Ages subscribe to it themselves, so a tick never re-renders the list rows. */
|
|
66
66
|
const clock = { now: Date.now(), listeners: new Set<() => void>(), timer: null as ReturnType<typeof setInterval> | null };
|
|
67
|
-
function subscribeClock(listener: () => void) {
|
|
67
|
+
export function subscribeClock(listener: () => void) {
|
|
68
68
|
clock.listeners.add(listener);
|
|
69
69
|
if (!clock.timer) clock.timer = setInterval(() => { clock.now = Date.now(); for (const l of clock.listeners) l(); }, 60_000);
|
|
70
70
|
return () => { clock.listeners.delete(listener); if (!clock.listeners.size && clock.timer) { clearInterval(clock.timer); clock.timer = null; } };
|
package/client/home-list.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
|
2
|
+
import { NEW_NAME } from "../shared/new-name";
|
|
2
3
|
import { View, type FlatList as NativeFlatList } from "react-native";
|
|
3
4
|
import { Pressable, Text } from "./text";
|
|
4
5
|
import { Icon, FlatList } from "@getpaseo/plugin/client/ui";
|
|
@@ -130,7 +131,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
130
131
|
letterSpacing: item.key === "l:archived" && !touch ? 0.6 : 0, textTransform: item.key === "l:archived" && !touch ? "uppercase" : "none", paddingHorizontal: dense ? 8 : 16, ...(item.key === "l:older" && touch ? { paddingLeft: TOUCH_ROW_TEXT } : null), paddingTop: 12, paddingBottom: 4 }}>{item.text}</Text>;
|
|
131
132
|
case "empty": return <View accessibilityRole="summary" style={{ marginHorizontal: 16, marginTop: 20, gap: 6 }}>
|
|
132
133
|
<Text accessibilityRole="header" style={{ color: c.foreground, fontSize: 17, lineHeight: 23, fontWeight: "600" }}>Nothing followed yet</Text>
|
|
133
|
-
<Text style={{ color: c.foregroundMuted, fontSize: 14, lineHeight: 20 }}>
|
|
134
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 14, lineHeight: 20 }}>{`Workspaces show up here once their agents work. Start one with ${NEW_NAME}, from an issue, a PR or your words.`}</Text>
|
|
134
135
|
{emptyAction ? <View style={{ flexDirection: "row", marginTop: 6 }}>{emptyAction}</View> : null}
|
|
135
136
|
</View>;
|
|
136
137
|
case "slot": return <View style={{ paddingVertical: 10 }}>{afterNeeds}</View>;
|