paseo-follow-up 2.0.2-beta.3 → 2.1.0-beta.1
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/README.md +28 -0
- package/client/brief.tsx +2 -4
- package/client/home-chrome.tsx +6 -3
- package/client/home-list.tsx +67 -93
- package/client/home.tsx +12 -1
- package/client/kit.tsx +5 -0
- package/client/list-keys.ts +101 -0
- package/client/panel-menu.tsx +1 -1
- package/client/rename.tsx +2 -2
- package/client/row-actions.ts +1 -1
- package/client/sidebar-view.tsx +25 -6
- package/client/theme.ts +10 -0
- package/index.client.tsx +3 -2
- package/index.server.ts +1 -1
- package/package.json +1 -1
- package/server/agent-actions.ts +1 -1
- package/server/mcp-source.ts +1 -1
- package/server/mcp.mjs +1 -1
- package/server/rename.ts +20 -6
- package/shared/contracts.ts +1 -1
- package/shared/list-entries.ts +82 -0
- package/shared/list-keys.ts +76 -0
- package/shared/overseer.ts +32 -0
- package/shared/rename.ts +1 -1
- package/shared/row-menu.ts +1 -1
package/README.md
CHANGED
|
@@ -157,6 +157,34 @@ and GitHub PR status with your existing credentials, and keeps its state in `$PA
|
|
|
157
157
|
gives agents scoped tools and installs reversible hooks for Claude Code and Codex. [OVERVIEW.md](OVERVIEW.md) has the
|
|
158
158
|
full data-access statement.
|
|
159
159
|
|
|
160
|
+
## Memory on Linux
|
|
161
|
+
|
|
162
|
+
On Linux (glibc), a Follow-up that stays up for hours can slowly grow in memory: the allocator keeps memory Follow-up
|
|
163
|
+
already freed. macOS isn't affected. Three allocator settings in the Paseo daemon's environment stop the growth. Every
|
|
164
|
+
process Paseo starts inherits them.
|
|
165
|
+
|
|
166
|
+
If a systemd unit runs Paseo, add them to it (the unit name is your own; `paseo` here):
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
systemctl --user edit paseo
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
```ini
|
|
173
|
+
[Service]
|
|
174
|
+
Environment=MALLOC_ARENA_MAX=2 MALLOC_MMAP_THRESHOLD_=131072 MALLOC_TRIM_THRESHOLD_=131072
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Then `systemctl --user restart paseo`. If the unit already reads an `EnvironmentFile=` (say `~/.config/paseo/env`),
|
|
178
|
+
put the three `NAME=value` lines there instead. If you start the daemon from a shell, stop it and start it with them:
|
|
179
|
+
|
|
180
|
+
```sh
|
|
181
|
+
paseo daemon stop
|
|
182
|
+
MALLOC_ARENA_MAX=2 MALLOC_MMAP_THRESHOLD_=131072 MALLOC_TRIM_THRESHOLD_=131072 paseo daemon start
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
In our test harness (140 workspaces, 45 idle minutes) Follow-up grew about 20 MB without them and 3 to 6 MB with them,
|
|
186
|
+
at no measurable CPU cost. To undo it, remove the settings and restart Paseo.
|
|
187
|
+
|
|
160
188
|
## Docs
|
|
161
189
|
|
|
162
190
|
- [CHANGELOG.md](CHANGELOG.md): release notes.
|
package/client/brief.tsx
CHANGED
|
@@ -16,7 +16,7 @@ import { errorText, mootNote } from "../shared/errors";
|
|
|
16
16
|
import { OTHER, OTHER_LABEL, briefAnswerStatus, isOther, type Question } from "../shared/questions";
|
|
17
17
|
import type { ListQuestion, ListWorkspace } from "../shared/list";
|
|
18
18
|
import { useDetailGate, useWorkspace } from "./workspace-data";
|
|
19
|
-
import { SubmitScope, submitHint, text, useNow } from "./kit";
|
|
19
|
+
import { SubmitScope, focusRing, submitHint, text, useNow } from "./kit";
|
|
20
20
|
import { PrLinksProvider, RichText } from "./rich-text";
|
|
21
21
|
import { useMergeButtons } from "./merge-button";
|
|
22
22
|
import { prLinksByNumber } from "../shared/presentation";
|
|
@@ -50,10 +50,8 @@ const kindTone = (kind: Brief["kind"], c: Colors) => kind === "error" ? c.status
|
|
|
50
50
|
const factTone = (tone: string, c: Colors) => tone === "ok" ? c.statusSuccess : tone === "warn" ? c.statusWarning : tone === "bad" ? c.statusDanger : c.foregroundMuted;
|
|
51
51
|
/** The time in the device's own format (12- or 24-hour), like the chat's timestamps. */
|
|
52
52
|
const clock = (iso: string | null) => { if (!iso) return ""; const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : ""; };
|
|
53
|
-
/** Whether the focused element got focus from the keyboard (a tap or click doesn't draw the ring). */
|
|
54
|
-
const keyboardFocus = () => { try { return !!(globalThis as { document?: { activeElement?: { matches?(q: string): boolean } | null } }).document?.activeElement?.matches?.(":focus-visible"); } catch { return true; } };
|
|
55
53
|
/** Web keyboard focus: a visible ring, since sending an answer is one-shot. Not after a tap, where it read as a state. */
|
|
56
|
-
const ring = (focused: boolean | undefined, c: Colors) => focused
|
|
54
|
+
const ring = (focused: boolean | undefined, c: Colors) => focusRing(focused, c);
|
|
57
55
|
const letters = (d: BriefDecision) => { const l = d.options.map(o => o.letter); return l.length > 1 ? `${l.slice(0, -1).join(", ")} or ${l.at(-1)}` : l[0] ?? ""; };
|
|
58
56
|
|
|
59
57
|
function Btn({ label, icon, primary, onPress, c, compact, disabled, shortcut = false, hint }: { label: string; icon?: string; primary?: boolean; onPress: () => void; c: Colors; compact: boolean; disabled?: boolean; shortcut?: boolean; hint?: string }) {
|
package/client/home-chrome.tsx
CHANGED
|
@@ -92,7 +92,9 @@ export function useSlashToFocus(omnibox: Omnibox, enabled = true) {
|
|
|
92
92
|
* The one query field: Home's omnibox (SearchField) and the sidebar view's filter (FilterField) are this with
|
|
93
93
|
* different words. `dense` is the phone layout: a 44px field with a rounder shape and body-size text.
|
|
94
94
|
*/
|
|
95
|
-
function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, onSubmit, onArrow }: {
|
|
95
|
+
function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, onSubmit, onArrow, listKeys = false }: {
|
|
96
|
+
/** Its arrows step into the list below (client/list-keys.ts): the sidebar filter, and Home's search while empty. */
|
|
97
|
+
listKeys?: boolean;
|
|
96
98
|
theme: Theme; value: string; onChange: (q: string) => void; placeholder: string; icon: string; dense: boolean;
|
|
97
99
|
inputRef: { current: TextInput | null }; slashHint: boolean; onSubmit?: () => void; onArrow?: (delta: number) => void;
|
|
98
100
|
}) {
|
|
@@ -103,6 +105,7 @@ function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef
|
|
|
103
105
|
<Icon name={icon as never} size={dense ? 16 : 13} color={c.foregroundMuted} />
|
|
104
106
|
<TextInput ref={inputRef} value={value} onChangeText={onChange} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
|
|
105
107
|
accessibilityLabel={placeholder} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
|
|
108
|
+
{...(listKeys ? { dataSet: { listKeys: "1" } } as object : {})}
|
|
106
109
|
onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
|
|
107
110
|
onSubmitEditing={onSubmit}
|
|
108
111
|
onKeyPress={e => {
|
|
@@ -123,7 +126,7 @@ export function SearchField({ theme, omnibox, dense, onEnter }: { theme: Theme;
|
|
|
123
126
|
const { query, setQuery, results, active, move, inputRef, askOn } = omnibox;
|
|
124
127
|
const placeholder = askOn ? dense ? "Search or ask the Overseer" : "Search, or ask the Overseer" : "Search workspaces, branches, PRs";
|
|
125
128
|
return <QueryField theme={theme} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} slashHint
|
|
126
|
-
onSubmit={() => { const item = results?.[active]; if (item) onEnter(item); }} onArrow={move} />;
|
|
129
|
+
onSubmit={() => { const item = results?.[active]; if (item) onEnter(item); }} onArrow={move} listKeys={!query.trim()} />;
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
/**
|
|
@@ -148,7 +151,7 @@ export function useListFilter(model: HomeModel, sources: HomeSources): ListFilte
|
|
|
148
151
|
}
|
|
149
152
|
/** "Filter workspaces": a filter icon and no key binding, so it never reads as Paseo's own Search (the Command Center, ⌘K). */
|
|
150
153
|
export function FilterField({ theme, filter, dense }: { theme: Theme; filter: ListFilter; dense: boolean }) {
|
|
151
|
-
return <QueryField theme={theme} value={filter.query} onChange={filter.setQuery} placeholder="Filter workspaces" icon="ListFilter" dense={dense} inputRef={filter.inputRef} slashHint={false} />;
|
|
154
|
+
return <QueryField theme={theme} value={filter.query} onChange={filter.setQuery} placeholder="Filter workspaces" icon="ListFilter" dense={dense} inputRef={filter.inputRef} slashHint={false} listKeys />;
|
|
152
155
|
}
|
|
153
156
|
|
|
154
157
|
// ---------- sort ----------
|
package/client/home-list.tsx
CHANGED
|
@@ -2,14 +2,17 @@ import { memo, useCallback, useEffect, useMemo, useRef, useState, type ReactNode
|
|
|
2
2
|
import { FlatList, View } from "react-native";
|
|
3
3
|
import { Pressable, Text } from "./text";
|
|
4
4
|
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
5
|
-
import {
|
|
6
|
-
import { ASK_KEY, excerpt, FIELD_LABEL, highlightRuns,
|
|
5
|
+
import { type Badge, type HomeGroupId, type HomeModel, type Workstream } from "../shared/home";
|
|
6
|
+
import { ASK_KEY, excerpt, FIELD_LABEL, highlightRuns, type OmniboxItem, type Range, type RowHit, type SearchHit } from "../shared/search";
|
|
7
7
|
import { AskRow, PriorityLine } from "./home-chrome";
|
|
8
8
|
import { age, wakeLabel, wakeShort } from "../shared/inbox";
|
|
9
9
|
import { headlineColor, mergedColor, readable, runningColor, tint, toneColor, withAlpha, type Colors } from "./theme";
|
|
10
10
|
import { useMinute } from "./home-data";
|
|
11
11
|
import { Spinner } from "./motion";
|
|
12
|
-
import { Button, rowDomId, type Theme } from "./kit";
|
|
12
|
+
import { Button, focusRing, rowDomId, type Theme } from "./kit";
|
|
13
|
+
import { useListKeys } from "./list-keys";
|
|
14
|
+
import { walkOrder } from "../shared/list-keys";
|
|
15
|
+
import { BRIEF_KEY, OVERSEER_KEY, QUIET_PAGE, listEntries, type Entry } from "../shared/list-entries";
|
|
13
16
|
import { RowMenu, useRowMenuTrigger, type OpenRowMenu, type RowMenuOpen } from "./row-menu";
|
|
14
17
|
import type { RowMenuItem, RowMenuSection } from "../shared/row-menu";
|
|
15
18
|
import { homeGroupOpen, writeHomeGroupOpen } from "../shared/settings-nav";
|
|
@@ -21,25 +24,12 @@ import { useViewVersion } from "./view-store";
|
|
|
21
24
|
* that changes one row redraws only that row.
|
|
22
25
|
*/
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
export const BRIEF_KEY = "brief";
|
|
26
|
-
export const OVERSEER_KEY = "overseer";
|
|
27
|
+
export { BRIEF_KEY, OVERSEER_KEY, archivedRow } from "../shared/list-entries";
|
|
27
28
|
/** The pinned Overseer row: not started yet (a one-time Start), working, asking, idle, or failed to come back. */
|
|
28
|
-
export type OverseerRowState = { state: "start" | "idle" | "running" | "asks" | "error"; line: string
|
|
29
|
+
export type OverseerRowState = { state: "start" | "idle" | "running" | "asks" | "error"; line: string;
|
|
30
|
+
/** A list filter's match in `line`, highlighted like a row's (the sidebar view's "Filter workspaces"). */
|
|
31
|
+
ranges?: Range[] };
|
|
29
32
|
|
|
30
|
-
type Entry =
|
|
31
|
-
| { type: "brief"; key: string }
|
|
32
|
-
| { type: "overseer"; key: string }
|
|
33
|
-
| { type: "header"; key: string; group: HomeGroupId; title: string; count: number; open: boolean }
|
|
34
|
-
| { type: "row"; key: string; s: Workstream; hit?: RowHit | null }
|
|
35
|
-
| { type: "fold"; key: string; project: string; count: number; archivable: number; open: boolean }
|
|
36
|
-
| { type: "more"; key: string; project: string; left: number }
|
|
37
|
-
| { type: "result"; key: string; item: WorkspaceItem; index: number; s: Workstream; hit: RowHit; archived: boolean }
|
|
38
|
-
| { type: "ask"; key: string; ask: string; index: number }
|
|
39
|
-
| { type: "label"; key: string; text: string }
|
|
40
|
-
| { type: "hold"; key: string; text: string }
|
|
41
|
-
| { type: "empty"; key: string }
|
|
42
|
-
| { type: "slot"; key: string };
|
|
43
33
|
|
|
44
34
|
export type HomeListProps = {
|
|
45
35
|
model: HomeModel;
|
|
@@ -74,6 +64,8 @@ export type HomeListProps = {
|
|
|
74
64
|
filter?: HomeGroupId | null;
|
|
75
65
|
/** The pinned Overseer row under the brief. Absent: the Overseer is off (or this surface has none). */
|
|
76
66
|
overseer?: OverseerRowState | null;
|
|
67
|
+
/** A narrow list (Paseo's sidebar view): the Overseer row stacks like every row there, title then its line. */
|
|
68
|
+
stackOverseer?: boolean;
|
|
77
69
|
/** An omnibox ask is on its way to the Overseer. */
|
|
78
70
|
asking?: boolean;
|
|
79
71
|
/** Sending rows' Send now (only where the server would take it: Workstream.sendNow). Absent: the list offers none. */
|
|
@@ -84,11 +76,20 @@ export type HomeListProps = {
|
|
|
84
76
|
* own Copy/Paste menu opens instead.
|
|
85
77
|
*/
|
|
86
78
|
menu: { build: (s: Workstream) => RowMenuSection[]; pick: (s: Workstream, item: RowMenuItem) => void };
|
|
79
|
+
/**
|
|
80
|
+
* Desktop and web keys (client/list-keys.ts, one-keyboard-walk-for-every-list): ↑/↓ and j/k walk the rows in this
|
|
81
|
+
* list's order, Home/End jump, Enter opens. "select" moves the selection (Home); "focus" moves only the focus and
|
|
82
|
+
* Enter opens (the sidebar view). `scope`: where the keys count (default: this list); `claimBody`: also with
|
|
83
|
+
* nothing focused.
|
|
84
|
+
*/
|
|
85
|
+
keys?: { mode: "select" | "focus"; onOpen: (key: string) => void; scope?: { current: unknown }; claimBody?: boolean };
|
|
86
|
+
/** The selected row's fill. Paseo's sidebar view passes its own selected-item colour (sidebarSelected); Home: surface2. */
|
|
87
|
+
selectedBg?: string;
|
|
87
88
|
};
|
|
88
89
|
|
|
89
90
|
const noMenu: OpenRowMenu = () => undefined;
|
|
90
91
|
|
|
91
|
-
export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, emptyAction, results, hits = null, activeResult = 0, onResult, filter = null, overseer = null, asking = false, menu, onSendNow }: HomeListProps) {
|
|
92
|
+
export function HomeList({ model, theme, dense = false, touch, selectedKey, onSelect, briefLine, renderExpanded, header, footer, top, afterNeeds, emptyAction, results, hits = null, activeResult = 0, onResult, filter = null, overseer = null, stackOverseer = false, asking = false, menu, onSendNow, keys, selectedBg }: HomeListProps) {
|
|
92
93
|
const c = theme.colors;
|
|
93
94
|
const [openMenu, setOpenMenu] = useState<RowMenuOpen | null>(null);
|
|
94
95
|
const build = menu.build;
|
|
@@ -107,54 +108,9 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
107
108
|
const toggle = useCallback((key: string) => { if (key === "needs") setNeedsClosed(v => !v); else writeHomeGroupOpen(key, !homeGroupOpen(key)); }, []);
|
|
108
109
|
const toggleProject = useCallback((p: string) => setOpenProjects(s => { const n = new Set(s); if (n.has(p)) n.delete(p); else n.add(p); return n; }), []);
|
|
109
110
|
|
|
110
|
-
const data = useMemo(() => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// Search ignores the sort and the groups: ranked by match, archived ones last under their own label.
|
|
114
|
-
let archivedShown = false;
|
|
115
|
-
results.forEach((item, index) => {
|
|
116
|
-
if (item.ask !== undefined) {
|
|
117
|
-
// The ask row closes the list; with no match it follows the "no match" line.
|
|
118
|
-
if (index === 0) out.push({ type: "label", key: "l:none", text: "No workspace, branch or PR matches." });
|
|
119
|
-
out.push({ type: "ask", key: item.key, ask: item.ask, index });
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
if (item.hit.group === "archived" && !archivedShown) { archivedShown = true; out.push({ type: "label", key: "l:archived", text: "Archived" }); }
|
|
123
|
-
const live = model.byKey.get(item.key);
|
|
124
|
-
const s = live ?? archivedRow(item.hit);
|
|
125
|
-
out.push({ type: "result", key: `r:${item.provider}:${item.key}`, item, index, s, hit: rowHit(item.hit, s), archived: !live });
|
|
126
|
-
});
|
|
127
|
-
if (!results.length) out.push({ type: "label", key: "l:none", text: "No workspace, branch or PR matches." });
|
|
128
|
-
return out;
|
|
129
|
-
}
|
|
130
|
-
if (briefLine !== undefined && !filter) out.push({ type: "brief", key: BRIEF_KEY });
|
|
131
|
-
if (overseer && !filter) out.push({ type: "overseer", key: OVERSEER_KEY });
|
|
132
|
-
for (const g of model.groups) {
|
|
133
|
-
if (filter && g.id !== filter) continue;
|
|
134
|
-
const open = !!filter || !!hits || !closed.has(g.id);
|
|
135
|
-
// Phones with one group filtered: the chip above already says "N Needs you ×"; no header repeating it.
|
|
136
|
-
if (!(touch && filter)) out.push({ type: "header", key: `h:${g.id}`, group: g.id, title: g.title, count: g.items.length, open });
|
|
137
|
-
if (!open) { if (g.id === "needs" && afterNeeds && !filter) out.push({ type: "slot", key: "s:afterNeeds" }); continue; }
|
|
138
|
-
// One hold line per machine, once, at the top of Sending (the model has it only while Sending has rows).
|
|
139
|
-
if (g.id === "sending" && model.hold) out.push({ type: "hold", key: "l:hold", text: model.hold });
|
|
140
|
-
const hitOf = (s: Workstream) => { const h = hits?.get(s.key); return h ? rowHit(h, s) : null; };
|
|
141
|
-
if (g.id !== "quiet") { for (const s of g.items) out.push({ type: "row", key: s.key, s, hit: hitOf(s) }); if (g.id === "needs" && afterNeeds && !filter) out.push({ type: "slot", key: "s:afterNeeds" }); continue; }
|
|
142
|
-
for (const f of quietFolds(g.items)) {
|
|
143
|
-
const fopen = !!hits || openProjects.has(f.project);
|
|
144
|
-
out.push({ type: "fold", key: `f:${f.project}`, project: f.project, count: f.items.length, archivable: f.archivable, open: fopen });
|
|
145
|
-
if (!fopen) continue;
|
|
146
|
-
const shown = (pages[f.project] ?? 1) * QUIET_PAGE;
|
|
147
|
-
for (const s of f.items.slice(0, shown)) out.push({ type: "row", key: s.key, s, hit: hitOf(s) });
|
|
148
|
-
if (f.items.length > shown) out.push({ type: "more", key: `m:${f.project}`, project: f.project, left: f.items.length - shown });
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// Phones: nothing followed yet says so and what fills the list, instead of a blank screen under the pinned rows.
|
|
152
|
-
if (hits && !out.some(e => e.type === "row")) out.push({ type: "label", key: "l:none", text: "No workspace matches." });
|
|
153
|
-
else if (touch && !filter && !hits && model.groups.every(g => !g.items.length)) out.push({ type: "empty", key: "l:nothing" });
|
|
154
|
-
return out;
|
|
155
|
-
if (filter && !out.length) out.push({ type: "label", key: "l:empty", text: `Nothing in ${GROUP_TITLE[filter as HomeGroupId]} right now.` });
|
|
156
|
-
return out;
|
|
157
|
-
}, [model, closed, openProjects, pages, briefLine, results, hits, filter, !!overseer, touch, !!afterNeeds]);
|
|
111
|
+
const data = useMemo(() => listEntries({ model, closed, openProjects, pages, briefLine, results, hits, filter, overseer: !!overseer, touch, afterNeeds: !!afterNeeds }),
|
|
112
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
113
|
+
[model, closed, openProjects, pages, briefLine, results, hits, filter, !!overseer, touch, !!afterNeeds]);
|
|
158
114
|
// A result picks through onResult; Row only knows its key.
|
|
159
115
|
const pickResult = useCallback((key: string) => {
|
|
160
116
|
const item = results?.find(i => !i.ask && i.key === key);
|
|
@@ -178,7 +134,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
178
134
|
onSelect={pickResult} onMenu={item.archived ? noMenu : onMenu} />;
|
|
179
135
|
case "ask": return <AskRow ask={item.ask} theme={theme} active={item.index === activeResult} dense={dense} touch={touch} sending={!!asking} onPress={() => onResult?.({ provider: "overseer", key: ASK_KEY, ask: item.ask })} />;
|
|
180
136
|
case "brief": return <BriefRow theme={theme} line={briefLine ?? ""} selected={!touch && (selectedKey === null || selectedKey === BRIEF_KEY)} touch={touch} onSelect={onSelect} />;
|
|
181
|
-
case "overseer": return overseer ? <OverseerRow theme={theme} o={overseer} selected={selectedKey === OVERSEER_KEY} touch={touch} onSelect={onSelect} /> : null;
|
|
137
|
+
case "overseer": return overseer ? <OverseerRow theme={theme} o={overseer} selected={selectedKey === OVERSEER_KEY} touch={touch} stacked={stackOverseer} onSelect={onSelect} selectedBg={selectedBg} /> : null;
|
|
182
138
|
case "header": return <GroupHeader theme={theme} title={item.title} count={item.count} open={item.open} tone={item.group === "needs" && item.count ? c.statusWarning : undefined} dense={dense} touch={touch} onPress={() => toggle(item.group)} />;
|
|
183
139
|
case "fold": return <Pressable accessibilityRole="button" aria-expanded={item.open} accessibilityState={{ expanded: item.open }} accessibilityLabel={`${item.project}, ${item.count}. ${item.open ? "Collapse" : "Expand"}`} onPress={() => toggleProject(item.project)}
|
|
184
140
|
style={state => ({ flexDirection: "row", alignItems: "center", gap: 8, minHeight: touch ? 44 : dense ? 28 : 34, paddingHorizontal: dense ? 8 : 16, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
@@ -194,14 +150,26 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
194
150
|
case "row": {
|
|
195
151
|
const selected = selectedKey === item.key;
|
|
196
152
|
return <View>
|
|
197
|
-
<Row s={item.s} theme={theme} dense={dense} touch={touch} selected={selected} onSelect={onSelect} sig={item.s.sig} onMenu={onMenu} menuOpen={menuKey === item.key} hit={item.hit} onSendNow={onSendNow} />
|
|
153
|
+
<Row s={item.s} theme={theme} dense={dense} touch={touch} selected={selected} onSelect={onSelect} sig={item.s.sig} onMenu={onMenu} menuOpen={menuKey === item.key} hit={item.hit} onSendNow={onSendNow} selectedBg={selectedBg} />
|
|
198
154
|
{selected && renderExpanded ? renderExpanded(item.s) : null}
|
|
199
155
|
</View>;
|
|
200
156
|
}
|
|
201
157
|
}
|
|
202
|
-
}, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, pickResult, model, overseer?.state, overseer?.line, asking, afterNeeds, emptyAction, onMenu, menuKey, onSendNow]);
|
|
158
|
+
}, [theme, c, dense, touch, selectedKey, onSelect, briefLine, renderExpanded, toggle, toggleProject, activeResult, onResult, pickResult, model, overseer?.state, overseer?.line, overseer?.ranges, stackOverseer, asking, afterNeeds, emptyAction, onMenu, menuKey, onSendNow, selectedBg]);
|
|
203
159
|
|
|
204
160
|
const listRef = useRef<FlatList<Entry>>(null);
|
|
161
|
+
const rootRef = useRef<View>(null);
|
|
162
|
+
// The keyboard walk: the rows as drawn, the brief and the Overseer first (they're rows too). A search walks its
|
|
163
|
+
// results through the omnibox instead.
|
|
164
|
+
const order = useMemo(() => results ? [] : walkOrder(data), [data, results]);
|
|
165
|
+
useListKeys({
|
|
166
|
+
enabled: !!keys && !touch && !results, order, mode: keys?.mode ?? "focus",
|
|
167
|
+
// Home draws the brief as selected while nothing is.
|
|
168
|
+
selectedKey: selectedKey ?? (order[0] === BRIEF_KEY ? BRIEF_KEY : null),
|
|
169
|
+
scope: () => (keys?.scope?.current ?? rootRef.current) as { contains(n: unknown): boolean; checkVisibility?(): boolean } | null,
|
|
170
|
+
claimBody: keys?.claimBody, onSelect, onOpen: key => keys?.onOpen(key),
|
|
171
|
+
reveal: key => { const index = data.findIndex(e => e.key === key); if (index >= 0) listRef.current?.scrollToIndex({ index, viewPosition: 0.5, animated: false }); },
|
|
172
|
+
});
|
|
205
173
|
// Keep the keyboard-active result in view.
|
|
206
174
|
useEffect(() => {
|
|
207
175
|
if (!results?.length) return;
|
|
@@ -214,7 +182,7 @@ export function HomeList({ model, theme, dense = false, touch, selectedKey, onSe
|
|
|
214
182
|
style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 8 }} keyboardShouldPersistTaps="handled" />;
|
|
215
183
|
const overlay = openMenu ? <RowMenu key={`${openMenu.s.key}:${openMenu.anchor?.x ?? "sheet"}:${openMenu.anchor?.y ?? ""}`} menu={openMenu} theme={theme} onClose={() => setOpenMenu(null)} onPick={item => menu.pick(openMenu.s, item)} /> : null;
|
|
216
184
|
// The wrapper is always there, so opening the menu never remounts the list (and its scroll).
|
|
217
|
-
return <View style={{ flex: 1, minHeight: 0 }}>{top}{list}{overlay}</View>;
|
|
185
|
+
return <View ref={rootRef} style={{ flex: 1, minHeight: 0 }}>{top}{list}{overlay}</View>;
|
|
218
186
|
}
|
|
219
187
|
|
|
220
188
|
function GroupHeader({ theme, title, count, open, tone, dense, touch, onPress }: { theme: Theme; title: string; count: number; open: boolean; tone?: string; dense: boolean; touch: boolean; onPress: () => void }) {
|
|
@@ -231,8 +199,8 @@ function GroupHeader({ theme, title, count, open, tone, dense, touch, onPress }:
|
|
|
231
199
|
|
|
232
200
|
function BriefRow({ theme, line, selected, touch, onSelect }: { theme: Theme; line: string; selected: boolean; touch: boolean; onSelect: (key: string) => void }) {
|
|
233
201
|
const c = theme.colors;
|
|
234
|
-
return <Pressable accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={`Morning brief. ${line}`} onPress={() => onSelect(BRIEF_KEY)}
|
|
235
|
-
style={state => ({ flexDirection: "row", alignItems: "center", gap: 10, minHeight: touch ? 52 : 40, paddingHorizontal: 16, backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
202
|
+
return <Pressable nativeID={rowDomId(BRIEF_KEY)} accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={`Morning brief. ${line}`} onPress={() => onSelect(BRIEF_KEY)}
|
|
203
|
+
style={state => ({ ...focusRing((state as { focused?: boolean }).focused, c, true), flexDirection: "row", alignItems: "center", gap: 10, minHeight: touch ? 52 : 40, paddingHorizontal: 16, backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
236
204
|
<Icon name="Sun" size={touch ? 16 : 15} color={c.foregroundMuted} />
|
|
237
205
|
<Text style={{ color: c.foreground, fontSize: touch ? 14 : 13, fontWeight: "600" }}>Morning brief</Text>
|
|
238
206
|
<Text numberOfLines={1} style={{ flex: 1, color: c.foregroundMuted, fontSize: touch ? 13 : 12 }}>{line}</Text>
|
|
@@ -240,18 +208,29 @@ function BriefRow({ theme, line, selected, touch, onSelect }: { theme: Theme; li
|
|
|
240
208
|
</Pressable>;
|
|
241
209
|
}
|
|
242
210
|
|
|
243
|
-
function OverseerRow({ theme, o, selected, touch, onSelect }: { theme: Theme; o: OverseerRowState; selected: boolean; touch: boolean; onSelect: (key: string) => void }) {
|
|
211
|
+
function OverseerRow({ theme, o, selected, touch, stacked = false, onSelect, selectedBg }: { theme: Theme; o: OverseerRowState; selected: boolean; touch: boolean; stacked?: boolean; onSelect: (key: string) => void; selectedBg?: string }) {
|
|
244
212
|
const c = theme.colors;
|
|
245
213
|
const tone = o.state === "asks" ? c.statusWarning : o.state === "error" ? c.statusDanger : o.state === "running" ? runningColor(c) : c.foregroundMuted;
|
|
246
|
-
|
|
247
|
-
|
|
214
|
+
const icon = o.state === "running" ? <Spinner color={tone} size={13} label="Overseer working" /> : <Icon name="MessagesSquare" size={touch ? 16 : 15} color={o.state === "idle" || o.state === "start" ? c.foregroundMuted : tone} />;
|
|
215
|
+
const lineColor = o.state === "asks" || o.state === "error" ? tone : c.foregroundMuted;
|
|
216
|
+
// Wide Home: one line, the phone's shorter start line. Stacked (the sidebar view): the whole line, wrapping to two.
|
|
217
|
+
const line = marks(!stacked && touch && o.state === "start" ? "Ask about any workspace" : o.line, stacked || !(touch && o.state === "start") ? o.ranges : null, c);
|
|
218
|
+
return <Pressable nativeID={rowDomId(OVERSEER_KEY)} accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={`Overseer. ${o.line}`} onPress={() => onSelect(OVERSEER_KEY)}
|
|
219
|
+
style={state => ({ ...focusRing((state as { focused?: boolean }).focused, c, true), flexDirection: "row", alignItems: stacked ? "flex-start" : "center", gap: 10, minHeight: touch ? 52 : 40, paddingLeft: 14, paddingRight: 16, paddingVertical: stacked ? (touch ? 12 : 8) : 0, borderBottomWidth: 1, borderBottomColor: c.border,
|
|
248
220
|
// Its ask isn't a Needs-you row (it's yours to route), so the edge marks it the way blocking rows are marked.
|
|
249
221
|
borderLeftWidth: 2, borderLeftColor: o.state === "asks" || o.state === "error" ? withAlpha(tone, 0.9) : "transparent",
|
|
250
|
-
backgroundColor: selected ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
251
|
-
{
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
222
|
+
backgroundColor: selected ? selectedBg ?? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
223
|
+
{stacked ? <View style={{ paddingTop: 2 }}>{icon}</View> : icon}
|
|
224
|
+
{stacked
|
|
225
|
+
? <View style={{ flex: 1, gap: 2 }}>
|
|
226
|
+
<Text style={{ color: c.foreground, fontSize: touch ? 14 : 13, fontWeight: "600" }}>Overseer</Text>
|
|
227
|
+
<Text numberOfLines={2} style={{ color: lineColor, fontSize: touch ? 13 : 12, lineHeight: touch ? 18 : 16 }}>{line}</Text>
|
|
228
|
+
</View>
|
|
229
|
+
: <>
|
|
230
|
+
<Text style={{ color: c.foreground, fontSize: touch ? 14 : 13, fontWeight: "600" }}>Overseer</Text>
|
|
231
|
+
<Text numberOfLines={1} style={{ flex: 1, color: lineColor, fontSize: touch ? 13 : 12 }}>{line}</Text>
|
|
232
|
+
{touch && <Icon name="ChevronRight" size={16} color={c.foregroundMuted} />}
|
|
233
|
+
</>}
|
|
255
234
|
</Pressable>;
|
|
256
235
|
}
|
|
257
236
|
|
|
@@ -317,19 +296,14 @@ export function marks(text: string, ranges: Range[] | null | undefined, c: Color
|
|
|
317
296
|
return highlightRuns(text, ranges).map((r, i) => r.hit ? <Text key={i} style={{ color: c.foreground, fontWeight: "600", backgroundColor: withAlpha(c.statusWarning, 0.22), borderRadius: 2 }}>{r.text}</Text> : r.text);
|
|
318
297
|
}
|
|
319
298
|
|
|
320
|
-
/** A search hit on a workspace Follow-up has archived: a muted row with the Archive glyph, reading "Archived". */
|
|
321
|
-
export function archivedRow(hit: SearchHit): Workstream {
|
|
322
|
-
return { key: hit.key, agentId: null, workspaceId: hit.key.startsWith("ws:") ? hit.key.slice(3) : null, title: hit.title, agent: null, project: null, group: "quiet", tier: null,
|
|
323
|
-
icon: "Archive", tone: "muted", line: "Archived", word: null, badges: [], pr: null, at: null, readyToArchive: false, sig: `archived:${hit.key}` } as unknown as Workstream;
|
|
324
|
-
}
|
|
325
299
|
|
|
326
300
|
/**
|
|
327
301
|
* One row component for every list, Home's groups and search results alike (search-row-is-the-list-row). A search
|
|
328
302
|
* passes `hit`: the matched words are highlighted where they already are (title, "› agent", the ask line), and a match
|
|
329
303
|
* in a field the row doesn't show replaces line 2 with "<Field> · excerpt", so a result is exactly as tall as the row.
|
|
330
304
|
*/
|
|
331
|
-
type RowProps = { s: Workstream; sig: string; theme: Theme; dense: boolean; touch: boolean; selected: boolean; onSelect: (key: string) => void; onMenu: OpenRowMenu; menuOpen?: boolean; hit?: RowHit | null; onSendNow?: (s: Workstream) => Promise<void
|
|
332
|
-
const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMenu, menuOpen = false, hit = null, onSendNow }: RowProps) {
|
|
305
|
+
type RowProps = { s: Workstream; sig: string; theme: Theme; dense: boolean; touch: boolean; selected: boolean; onSelect: (key: string) => void; onMenu: OpenRowMenu; menuOpen?: boolean; hit?: RowHit | null; onSendNow?: (s: Workstream) => Promise<void>; selectedBg?: string };
|
|
306
|
+
const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMenu, menuOpen = false, hit = null, onSendNow, selectedBg }: RowProps) {
|
|
333
307
|
const c = theme.colors;
|
|
334
308
|
const trigger = useRowMenuTrigger(s, onMenu, touch);
|
|
335
309
|
const archived = s.icon === "Archive" && s.sig.startsWith("archived:");
|
|
@@ -353,10 +327,10 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
|
|
|
353
327
|
const label = [s.title + (s.agent ? ` › ${s.agent}` : ""), s.word, s.line, hit?.via && `${FIELD_LABEL[hit.via.field]}: ${hit.via.text}`, wake && `Later until ${wake}`, waited && (waited === "now" ? "just now" : `waiting ${waited}`)].filter(Boolean).join(". ");
|
|
354
328
|
return <Pressable ref={trigger.ref} nativeID={rowDomId(s.key)} accessibilityRole="button" accessibilityState={{ selected }} accessibilityLabel={label} accessibilityHint={quickActionsHint(touch)}
|
|
355
329
|
onPress={() => onSelect(s.key)} onLongPress={trigger.onLongPress} delayLongPress={450}
|
|
356
|
-
style={state => ({ flexDirection: "row", alignItems: dense ? "flex-start" : "center", gap: touch ? 10 : dense ? 8 : 10, minHeight: touch ? 56 : dense ? 36 : 38, paddingLeft: touch ? 14 : dense ? 8 : 16, paddingRight: touch ? 16 : dense ? 8 : 16, paddingVertical: touch ? 12 : dense ? 6 : 0,
|
|
330
|
+
style={state => ({ ...focusRing((state as { focused?: boolean }).focused, c, true), flexDirection: "row", alignItems: dense ? "flex-start" : "center", gap: touch ? 10 : dense ? 8 : 10, minHeight: touch ? 56 : dense ? 36 : 38, paddingLeft: touch ? 14 : dense ? 8 : 16, paddingRight: touch ? 16 : dense ? 8 : 16, paddingVertical: touch ? 12 : dense ? 6 : 0,
|
|
357
331
|
...(touch ? { borderBottomWidth: 1, borderBottomColor: withAlpha(c.border, 0.6) } : {}),
|
|
358
332
|
borderLeftWidth: 2, borderLeftColor: blocking ? withAlpha(color, 0.9) : "transparent",
|
|
359
|
-
backgroundColor: selected
|
|
333
|
+
backgroundColor: selected ? selectedBg ?? c.surface2 : menuOpen || state.pressed && touch ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
360
334
|
<View style={{ width: touch ? 18 : 16, alignItems: "center", paddingTop: touch ? 2 : dense ? 1 : 0 }}>
|
|
361
335
|
{s.tone === "running" && s.icon === "LoaderCircle" ? <Spinner color={color} size={13} label="Running" /> : <Icon name={s.icon} size={touch ? 17 : 15} color={color} />}
|
|
362
336
|
</View>
|
|
@@ -394,7 +368,7 @@ const Row = memo(function Row({ s, theme, dense, touch, selected, onSelect, onMe
|
|
|
394
368
|
</View>{!!s.priority?.reason && <View style={{ paddingRight: 40 }}><PriorityLine reason={s.priority.reason} source={s.priority.source} c={c} /></View>}</View>}
|
|
395
369
|
{!touch && <RowTime s={s} c={c} size={dense ? 11 : 12} />}
|
|
396
370
|
</Pressable>;
|
|
397
|
-
}, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect && a.onMenu === b.onMenu && a.menuOpen === b.menuOpen && a.hit === b.hit && a.onSendNow === b.onSendNow);
|
|
371
|
+
}, (a, b) => a.sig === b.sig && a.selected === b.selected && a.theme === b.theme && a.dense === b.dense && a.touch === b.touch && a.onSelect === b.onSelect && a.onMenu === b.onMenu && a.menuOpen === b.menuOpen && a.hit === b.hit && a.onSendNow === b.onSendNow && a.selectedBg === b.selectedBg);
|
|
398
372
|
|
|
399
373
|
/** The machine-wide auto-send hold, once above Sending's rows: the same words on every width (shared/sending.ts). */
|
|
400
374
|
function HoldLine({ theme, text: line, dense, touch }: { theme: Theme; text: string; dense: boolean; touch: boolean }) {
|
package/client/home.tsx
CHANGED
|
@@ -93,6 +93,9 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
93
93
|
} : undefined, [navigation, compact, deps]);
|
|
94
94
|
useNextRelay(inbox, params, openAgentRow, openWorkspaceRelay);
|
|
95
95
|
useEffect(() => { if (params.select) setSelected(`agent:${params.select}`); }, [params.select]);
|
|
96
|
+
// An already-open Home asked to show an item (the sidebar view's Overseer row: Start and Restart live here). `at` makes
|
|
97
|
+
// the same item twice a second request.
|
|
98
|
+
useEffect(() => { if (params.item && params.at) setSelected(params.item); }, [params.item, params.at]);
|
|
96
99
|
// Phones show one thing at a time. A row opens its own screen (pushed by the host) instead of swapping in place, so the
|
|
97
100
|
// host's ← is the only back control and it lands on the list. Desktop selects in place beside the list.
|
|
98
101
|
const route = compact && deps.openItem ? deps.openItem : null;
|
|
@@ -151,6 +154,8 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
151
154
|
setSelected(s.key); setAsk(a => ({ key: s.key, id, n: (a?.n ?? 0) + 1 }));
|
|
152
155
|
}, [route, deps]);
|
|
153
156
|
const omniRef = useRef(omnibox); omniRef.current = omnibox;
|
|
157
|
+
// Home's keys count anywhere on Home (the list and its detail), not just in the list.
|
|
158
|
+
const homeRef = useRef<View>(null);
|
|
154
159
|
const prefillAsk = useCallback((text: string) => { omniRef.current.setQuery(text); setTimeout(() => omniRef.current.inputRef.current?.focus(), 0); }, []);
|
|
155
160
|
const rowMenu = useRowMenu({ sources: deps.sources, openFull, openQuestion, prefillAsk, overseerOn: !!overseerStatus?.enabled });
|
|
156
161
|
const signOffNext = useCallback((s: Workstream) => {
|
|
@@ -174,7 +179,13 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
174
179
|
: <BriefPane theme={theme} compact={compact} pane={pane} onSelect={key => route ? route(key) : setSelected(key)} openLog={deps.openLog} sources={deps.sources} />;
|
|
175
180
|
// Nothing followed at all: no sort, no meters, just the empty state and its action.
|
|
176
181
|
const nothing = model.groups.every(g => !g.items.length);
|
|
182
|
+
// Enter on a row: its chat, as Open full does. The brief has nothing to open; the Overseer opens once it runs.
|
|
183
|
+
const openKey = (key: string) => {
|
|
184
|
+
if (key === OVERSEER_KEY) { const id = overseerStatus?.agentId; if (id && navigation) navigation.openAgent({ agentId: id }); return; }
|
|
185
|
+
const s = model.byKey.get(key); if (s) openFull(s);
|
|
186
|
+
};
|
|
177
187
|
const list = <HomeList model={model} theme={theme} dense={compact} touch={compact} selectedKey={selected} onSelect={onSelect} briefLine={briefLine}
|
|
188
|
+
keys={{ mode: "select", onOpen: openKey, scope: homeRef, claimBody: true }}
|
|
178
189
|
results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} overseer={overseer} asking={asking} menu={rowMenu} onSendNow={sendNow}
|
|
179
190
|
// Phones: the host header already says Follow-up, so no "Home" title row; search, sort and settings share one row and
|
|
180
191
|
// the meters move to the end of the list.
|
|
@@ -213,7 +224,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
213
224
|
{updateSheets}
|
|
214
225
|
<View style={{ position: "absolute", left: 12, right: 12, bottom: bottomGap(true) + (current || selected === OVERSEER_KEY ? 132 : 0) }}><UndoBar store={inbox} theme={theme} touch /></View>
|
|
215
226
|
</View>;
|
|
216
|
-
return <View style={{ flex: 1, flexDirection: "row", backgroundColor: c.surface0 }}>
|
|
227
|
+
return <View ref={homeRef} style={{ flex: 1, flexDirection: "row", backgroundColor: c.surface0 }}>
|
|
217
228
|
<View style={{ flex: 1, minWidth: 0, borderRightWidth: 1, borderRightColor: c.border }}>
|
|
218
229
|
{list}
|
|
219
230
|
{updateSheets}
|
package/client/kit.tsx
CHANGED
|
@@ -241,5 +241,10 @@ export function focusSoon(id: string, tries = 20): void {
|
|
|
241
241
|
if (el) { el.focus(); return; }
|
|
242
242
|
if (tries > 0) setTimeout(() => focusSoon(id, tries - 1), 50);
|
|
243
243
|
}
|
|
244
|
+
/** Web: the focus came from the keyboard (:focus-visible), so a click never draws the ring. */
|
|
245
|
+
export const keyboardFocus = () => { try { return !!(globalThis as { document?: { activeElement?: { matches?(q: string): boolean } | null } }).document?.activeElement?.matches?.(":focus-visible"); } catch { return true; } };
|
|
246
|
+
/** The keyboard focus ring: buttons ring outside (offset 2); list rows ring inside their own bounds (`inset`). */
|
|
247
|
+
export const focusRing = (focused: boolean | undefined, c: Colors, inset = false) => focused && Platform.OS === "web" && keyboardFocus()
|
|
248
|
+
? ({ outlineWidth: 2, outlineStyle: "solid", outlineColor: withAlpha(c.accent, 0.6), outlineOffset: inset ? -2 : 2 } as object) : {};
|
|
244
249
|
/** The DOM id of a Home row, for focusSoon. */
|
|
245
250
|
export const rowDomId = (key: string) => `follow-up-row-${key.replace(/[^\w-]/g, "_")}`;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useEffect, useRef } from "react";
|
|
2
|
+
import { Platform } from "react-native";
|
|
3
|
+
import { listMove, ownsKey, surfaceVisible, walkTarget } from "../shared/list-keys";
|
|
4
|
+
import { rowDomId } from "./kit";
|
|
5
|
+
|
|
6
|
+
type Row = { focus(o?: { preventScroll?: boolean }): void; scrollIntoView?(o?: { block?: string }): void };
|
|
7
|
+
type Node = { contains(other: unknown): boolean; querySelector?(selector: string): Row | null; checkVisibility?(): boolean; getClientRects?(): { length: number } };
|
|
8
|
+
type Target = { tagName?: string; isContentEditable?: boolean; id?: string; closest?(selector: string): unknown } | null;
|
|
9
|
+
type DomKey = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; shiftKey: boolean; target: unknown; preventDefault(): void; stopPropagation(): void };
|
|
10
|
+
type Doc = { body: unknown; activeElement: unknown; visibilityState?: string; querySelector(selector: string): Row | null;
|
|
11
|
+
addEventListener(t: string, f: (e: DomKey) => void, capture?: boolean): void; removeEventListener(t: string, f: (e: DomKey) => void, capture?: boolean): void };
|
|
12
|
+
|
|
13
|
+
export type ListKeysOptions = {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
/** The rows in the order the list draws them (brief, Overseer, then every row of an open group). */
|
|
16
|
+
order: readonly string[];
|
|
17
|
+
/**
|
|
18
|
+
* "select": the selection follows the keys (Home: its detail pane follows). "focus": only the focus moves, and Enter
|
|
19
|
+
* opens the row (the sidebar view: opening loads a chat and moves the main pane, so it waits for Enter).
|
|
20
|
+
*/
|
|
21
|
+
mode: "select" | "focus";
|
|
22
|
+
selectedKey: string | null;
|
|
23
|
+
/** The surface the keys belong to: they act only while focus is inside it. */
|
|
24
|
+
scope: () => Node | null;
|
|
25
|
+
/**
|
|
26
|
+
* Keys pressed with nothing focused (the page body) are this surface's too: Home, the main screen. Only while its
|
|
27
|
+
* root is on screen: a Home kept mounted behind another tab or chat leaves body keys to what's in front.
|
|
28
|
+
*/
|
|
29
|
+
claimBody?: boolean;
|
|
30
|
+
onSelect: (key: string) => void;
|
|
31
|
+
onOpen: (key: string) => void;
|
|
32
|
+
/** A row the virtualized list hasn't drawn yet: scroll it in, so it can take focus. */
|
|
33
|
+
reveal: (key: string) => void;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The one keyboard walk for a list of rows (invariant one-keyboard-walk-for-every-list): ↑/↓ and j/k step, Home/End
|
|
38
|
+
* jump, Enter opens. The focus moves with the keys, so the row's focus ring marks it and the browser keeps it in view.
|
|
39
|
+
* Not while typing, except the arrows in the list's own query field (`dataSet={{ listKeys: "1" }}`), which step into
|
|
40
|
+
* the list. Web and desktop only; phones have no hardware-key walk.
|
|
41
|
+
*/
|
|
42
|
+
export function useListKeys(options: ListKeysOptions): void {
|
|
43
|
+
const ref = useRef(options); ref.current = options;
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
const doc = (globalThis as { document?: Doc }).document;
|
|
46
|
+
if (!options.enabled || Platform.OS !== "web" || !doc) return;
|
|
47
|
+
const onKey = (e: DomKey) => {
|
|
48
|
+
const { order, mode, selectedKey, scope, claimBody, onSelect, onOpen, reveal } = ref.current;
|
|
49
|
+
const target = e.target as Target;
|
|
50
|
+
const typing = !!target && (!!target.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(target.tagName ?? ""));
|
|
51
|
+
if (typing && !target?.closest?.("[data-list-keys]")) return;
|
|
52
|
+
// A row menu or a dialog over the list keeps its own keys.
|
|
53
|
+
if (target?.closest?.('[role="menu"],[role="dialog"],[aria-modal="true"]')) return;
|
|
54
|
+
const root = scope();
|
|
55
|
+
const onBody = !target || target === doc.body;
|
|
56
|
+
if (!ownsKey({ inside: !!target && !!root?.contains(target), onBody, claimBody: !!claimBody,
|
|
57
|
+
visible: !!claimBody && surfaceVisible(root, doc) })) return;
|
|
58
|
+
const move = listMove(e, typing);
|
|
59
|
+
if (!move) return;
|
|
60
|
+
const focused = !typing && target?.id ? order.find(k => rowDomId(k) === target.id) ?? null : null;
|
|
61
|
+
if (move === "open") {
|
|
62
|
+
// Only a focused row opens: Enter on a header, a chip or a button keeps doing what that control does.
|
|
63
|
+
if (!focused) return;
|
|
64
|
+
e.preventDefault(); e.stopPropagation(); onOpen(focused);
|
|
65
|
+
// The sidebar view: if opening the chat left focus nowhere, give it back to the row, so ↓ ↓ Enter keeps
|
|
66
|
+
// walking. If Paseo put it somewhere (the composer), it stays there: never taken back.
|
|
67
|
+
if (mode === "focus") keepWalking(doc, scope() ?? doc, focused, reveal);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const to = walkTarget({ order, focused, selectedKey, mode, typing, move });
|
|
71
|
+
if (!to) return;
|
|
72
|
+
e.preventDefault(); e.stopPropagation();
|
|
73
|
+
if (mode === "select" && to !== selectedKey) onSelect(to);
|
|
74
|
+
focusRow(scope() ?? doc, to, reveal);
|
|
75
|
+
};
|
|
76
|
+
doc.addEventListener("keydown", onKey, true);
|
|
77
|
+
return () => doc.removeEventListener("keydown", onKey, true);
|
|
78
|
+
}, [options.enabled]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Focus a row inside this surface: Home and the sidebar view draw the same rows (the same ids) side by side, so the
|
|
83
|
+
* lookup never leaves the surface's own root.
|
|
84
|
+
*/
|
|
85
|
+
function keepWalking(doc: Doc, root: Pick<Node, "querySelector">, key: string, reveal: (key: string) => void, waits = [300, 900, 1800]): void {
|
|
86
|
+
const [wait, ...rest] = waits;
|
|
87
|
+
if (wait === undefined) return;
|
|
88
|
+
setTimeout(() => {
|
|
89
|
+
const active = doc.activeElement;
|
|
90
|
+
if (active && active !== doc.body) return;
|
|
91
|
+
focusRow(root, key, reveal);
|
|
92
|
+
keepWalking(doc, root, key, reveal, rest);
|
|
93
|
+
}, wait);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function focusRow(root: Pick<Node, "querySelector">, key: string, reveal: (key: string) => void, tries = 10): void {
|
|
97
|
+
const el = root.querySelector?.(`#${rowDomId(key)}`) ?? null;
|
|
98
|
+
if (el) { el.focus({ preventScroll: true }); el.scrollIntoView?.({ block: "nearest" }); return; }
|
|
99
|
+
if (tries === 10) reveal(key);
|
|
100
|
+
if (tries > 0) requestAnimationFrame(() => focusRow(root, key, reveal, tries - 1));
|
|
101
|
+
}
|
package/client/panel-menu.tsx
CHANGED
|
@@ -8,7 +8,7 @@ import { useRowMenu } from "./row-actions";
|
|
|
8
8
|
import type { HomeSources } from "./home-data";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* The panel header's More button: the same row menu Home and the sidebar show for this workspace (Rename with AI
|
|
11
|
+
* The panel header's More button: the same row menu Home and the sidebar show for this workspace (Rename title with AI
|
|
12
12
|
* among it), so there is one menu everywhere. A popover under the button on desktop, the sheet on phones.
|
|
13
13
|
*/
|
|
14
14
|
export function PanelMore({ w, sources, theme, compact, openAgent, openQuestion, showMenu }: {
|
package/client/rename.tsx
CHANGED
|
@@ -14,7 +14,7 @@ import { Spinner } from "./motion";
|
|
|
14
14
|
import { hasToastHost, pushToast, runAction } from "./toast-store";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* Rename with AI (docs/ai-roles.md#rename-with-ai): one dialog for every entry point (row menus, the panel's More
|
|
17
|
+
* Rename title with AI (docs/ai-roles.md#rename-title-with-ai): one dialog for every entry point (row menus, the panel's More
|
|
18
18
|
* menu, ⌘K). It asks for a suggestion as it opens, shows it in an editable field, and renames only on Rename. The
|
|
19
19
|
* toast after it carries Undo; for 24 hours the dialog also offers Undo last rename.
|
|
20
20
|
*/
|
|
@@ -106,7 +106,7 @@ export function RenameDialog({ request, theme, compact, onClose }: { request: Re
|
|
|
106
106
|
// Only near the limit: the reason text covers the rest (words, keys, branch names).
|
|
107
107
|
const showCounter = counter > NAME_MAX_CHARS - 15;
|
|
108
108
|
const waiting = phase === "suggesting" && !name;
|
|
109
|
-
return <Modal title="Rename with AI" icon={<Icon name="Sparkles" size={18} color={c.foregroundMuted} />} open onOpenChange={next => { if (!next) onClose(); }}>
|
|
109
|
+
return <Modal title="Rename title with AI" icon={<Icon name="Sparkles" size={18} color={c.foregroundMuted} />} open onOpenChange={next => { if (!next) onClose(); }}>
|
|
110
110
|
<Modal.Content contentContainerStyle={{ padding: compact ? 16 : 20 }}>
|
|
111
111
|
<SubmitScope enabled={canRename} onSubmit={apply} style={{ gap: compact ? 16 : 14, maxWidth: 520 }}>
|
|
112
112
|
<View style={{ gap: 2 }}>
|
package/client/row-actions.ts
CHANGED
|
@@ -85,7 +85,7 @@ export function useRowMenu(host: RowMenuHost) {
|
|
|
85
85
|
case "copy_branch": return runAction({ label: "Copy branch", run: () => copyText(arg), success: "Branch name copied", failure: "Couldn't copy here" });
|
|
86
86
|
case "copy_pr": return runAction({ label: "Copy PR link", run: () => copyText(arg), success: arg.includes("\n") ? "PR links copied" : "PR link copied", failure: "Couldn't copy here" });
|
|
87
87
|
case "rewrite_summary": return runAction({ label: "Rewrite summary", run: async () => cache.setQueryData(aboutKey(workspaceId), await about({ workspaceId, open: true, refresh: true })), success: "Summary rewritten" }, `about:${workspaceId}`);
|
|
88
|
-
case "rename_ai": return runAction({ label: "Rename with AI", run: async () => openRename({ workspaceId, title: s.title }), success: null });
|
|
88
|
+
case "rename_ai": return runAction({ label: "Rename title with AI", run: async () => openRename({ workspaceId, title: s.title }), success: null });
|
|
89
89
|
case "make_main": return runAction({ label: "Make main agent", run: async () => { await control({ workspaceId, mainAgentId: arg }); after(); }, success: `${s.agent ?? "That agent"} is now the main agent` }, `main:${workspaceId}`);
|
|
90
90
|
case "stop_following": return runAction({ label: "Stop following", run: async () => { await setFollow({ workspace: { workspaceId, follow: false } }); after(); }, success: `Stopped following ${s.title}` }, `follow:${workspaceId}`);
|
|
91
91
|
}
|
package/client/sidebar-view.tsx
CHANGED
|
@@ -3,13 +3,15 @@ import type { PluginClientContext, PluginHostProps } from "@getpaseo/plugin/clie
|
|
|
3
3
|
import { useCallback, useMemo, useSyncExternalStore, type ComponentType } from "react";
|
|
4
4
|
import { View } from "react-native";
|
|
5
5
|
import { Text } from "./text";
|
|
6
|
-
import { UndoBar, useSidebarViewMounted } from "./inbox";
|
|
7
|
-
import { HomeList } from "./home-list";
|
|
6
|
+
import { UndoBar, useInbox, useSidebarViewMounted } from "./inbox";
|
|
7
|
+
import { HomeList, OVERSEER_KEY, type OverseerRowState } from "./home-list";
|
|
8
|
+
import { sidebarSelected } from "./theme";
|
|
8
9
|
import { FilterField, SortMenu, useListFilter } from "./home-chrome";
|
|
9
10
|
import { useHomeModel, type HomeSources } from "./home-data";
|
|
10
11
|
import { useRowMenu } from "./row-actions";
|
|
11
12
|
import { RenameHost } from "./rename";
|
|
12
13
|
import type { Workstream } from "../shared/home";
|
|
14
|
+
import { listOverseerRow, overseerRowTarget } from "../shared/overseer";
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* Phase 2: Home's list as Paseo's sidebar (the same HomeList component Home uses). `addSidebarView` and the ref queries exist on Paseo main
|
|
@@ -38,7 +40,8 @@ export function sidebarViewHost(client: PluginClientContext): SidebarViewHost |
|
|
|
38
40
|
return typeof candidate.addSidebarView === "function" && typeof hooks.useAgents === "function" && typeof hooks.useWorkspaces === "function" ? candidate as SidebarViewHost : null;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
/** `openOverseerHome`: Follow-up Home with the Overseer selected, where Start and Restart live. */
|
|
44
|
+
export function inboxSidebarView(sources: HomeSources, openOverseerHome: () => void) {
|
|
42
45
|
return function NeedsYouSidebar(view: SidebarViewProps) {
|
|
43
46
|
const refs = sdk as unknown as RefSdk;
|
|
44
47
|
useSidebarViewMounted();
|
|
@@ -51,26 +54,42 @@ export function inboxSidebarView(sources: HomeSources) {
|
|
|
51
54
|
const workspaces = refs.useWorkspaces({});
|
|
52
55
|
const agentRef = useMemo(() => new Map(agents.map(r => [r.id, r])), [agents]);
|
|
53
56
|
const workspaceRef = useMemo(() => new Map(workspaces.map(r => [r.id, r])), [workspaces]);
|
|
57
|
+
// Home's pinned Overseer row, the same state (one-row-everywhere); a filter keeps it only when it's about it.
|
|
58
|
+
const overseerStatus = useSyncExternalStore(sources.extras.subscribe, sources.extras.overseer, sources.extras.overseer);
|
|
59
|
+
const overseerInbox = useInbox(sources.inbox, () => sources.inbox.overseer());
|
|
60
|
+
const overseer: OverseerRowState | null = listOverseerRow(overseerStatus, overseerInbox, filter.query);
|
|
61
|
+
const overseerAgent = overseerStatus?.agentId ?? null;
|
|
54
62
|
const touch = view.layout.compact;
|
|
55
63
|
const c = view.theme.colors;
|
|
56
64
|
const activeAgent = view.active.agent?.id ?? null;
|
|
57
65
|
const activeWorkspace = view.active.workspace?.id ?? null;
|
|
58
66
|
const selectedKey = useMemo(() => {
|
|
67
|
+
if (overseer && activeAgent && activeAgent === overseerAgent) return OVERSEER_KEY;
|
|
59
68
|
const all = [...full.byKey.values()];
|
|
60
69
|
return all.find(s => activeAgent && s.agentId === activeAgent)?.key ?? all.find(s => activeWorkspace && s.workspaceId === activeWorkspace)?.key ?? null;
|
|
61
|
-
}, [full, activeAgent, activeWorkspace]);
|
|
70
|
+
}, [full, activeAgent, activeWorkspace, overseer, overseerAgent]);
|
|
62
71
|
const onSelect = useCallback((key: string) => {
|
|
72
|
+
if (key === OVERSEER_KEY) {
|
|
73
|
+
// A live Overseer opens its chat like any row; Start and a failed restart need Home's Overseer pane.
|
|
74
|
+
const ref = overseerAgent ? agentRef.get(overseerAgent) : undefined;
|
|
75
|
+
if (overseer && overseerRowTarget(overseer.state) === "chat" && ref) view.navigation.openAgent(ref); else openOverseerHome();
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
63
78
|
const s = full.byKey.get(key);
|
|
64
79
|
const agent = s?.agentId ? agentRef.get(s.agentId) : undefined;
|
|
65
80
|
const workspace = s?.workspaceId ? workspaceRef.get(s.workspaceId) : undefined;
|
|
66
81
|
if (agent) view.navigation.openAgent(agent); else if (workspace) view.navigation.openWorkspace(workspace);
|
|
67
|
-
}, [full, agentRef, workspaceRef, view.navigation]);
|
|
82
|
+
}, [full, agentRef, workspaceRef, view.navigation, overseer, overseerAgent]);
|
|
68
83
|
// The row menu, as on Home (rename among it). No omnibox here, so no Ask; Open and Answer go to the chat.
|
|
69
84
|
const openKey = (s: Workstream) => onSelect(s.key);
|
|
70
85
|
const menu = useRowMenu({ sources, openFull: openKey, openQuestion: openKey, overseerOn: false });
|
|
71
86
|
if (!sources.inbox.enabled()) return <View style={{ padding: 12 }}><Text style={{ color: c.foregroundMuted, fontSize: 12 }}>The Needs-you inbox is off. Turn it on in Follow-up's display settings.</Text></View>;
|
|
72
87
|
return <View style={{ flex: 1 }}>
|
|
73
|
-
<HomeList model={model} hits={filter.hits} theme={view.theme} dense touch={touch} selectedKey={selectedKey} onSelect={onSelect} menu={menu}
|
|
88
|
+
<HomeList model={model} hits={filter.hits} theme={view.theme} dense touch={touch} selectedKey={selectedKey} onSelect={onSelect} menu={menu} overseer={overseer} stackOverseer
|
|
89
|
+
// Each open loads a chat and moves the main pane, so the keys move the focus and Enter opens.
|
|
90
|
+
keys={{ mode: "focus", onOpen: onSelect }}
|
|
91
|
+
// The open chat's row wears Paseo's own selected-item fill, so it reads like a selected native item.
|
|
92
|
+
selectedBg={sidebarSelected(c)}
|
|
74
93
|
// One row, nothing else (invariant 8): the filter takes the width, the sort is an icon. zIndex keeps the
|
|
75
94
|
// sort menu above the list on web, where every View is its own stacking context.
|
|
76
95
|
top={<View style={{ zIndex: 10, flexDirection: "row", alignItems: "center", gap: touch ? 8 : 4, paddingHorizontal: touch ? 12 : 8, paddingVertical: touch ? 8 : 6, borderBottomWidth: 1, borderBottomColor: c.border }}>
|
package/client/theme.ts
CHANGED
|
@@ -46,6 +46,16 @@ export function withAlpha(color: string, alpha: number): string {
|
|
|
46
46
|
return rgb ? `rgba(${rgb.join(", ")}, ${alpha})` : color;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
/**
|
|
50
|
+
* The selected row in Paseo's sidebar, as Paseo draws its own (surfaceSidebarSelected, which the plugin theme doesn't
|
|
51
|
+
* carry). Light themes: the sidebar ground is surface2, and Paseo selects with surface4, two steps darker; the
|
|
52
|
+
* foreground at 14% over the ground lands there (#f4f4f5 -> #d4d4d8 in the default theme). Dark themes: surface2, the
|
|
53
|
+
* same step Paseo uses.
|
|
54
|
+
*/
|
|
55
|
+
export function sidebarSelected(colors: Colors): string {
|
|
56
|
+
return isLight(colors) ? withAlpha(colors.foreground, 0.14) : colors.surface2;
|
|
57
|
+
}
|
|
58
|
+
|
|
49
59
|
/** A tag fill in the same hue as its text: 12% on light grounds, 16% on dark ones. */
|
|
50
60
|
export function tint(color: string, colors: Colors): string {
|
|
51
61
|
return withAlpha(color, isLight(colors) ? 0.12 : 0.16);
|
package/index.client.tsx
CHANGED
|
@@ -18,6 +18,7 @@ import { createInboxStore } from "./client/inbox-store";
|
|
|
18
18
|
import { contributeInboxCommands } from "./client/inbox";
|
|
19
19
|
import type { BriefDeps } from "./client/brief";
|
|
20
20
|
import { inboxSidebarView, sidebarViewHost } from "./client/sidebar-view";
|
|
21
|
+
import { OVERSEER_KEY } from "./client/home-list";
|
|
21
22
|
import { contributeBrief } from "./client/brief";
|
|
22
23
|
import { clientTimeZoneRpc, setOnboardingRpc } from "./shared/contracts";
|
|
23
24
|
import { isCategory, writeCategory } from "./shared/settings-nav";
|
|
@@ -104,7 +105,7 @@ export default function contribute(host: PluginClientContext) {
|
|
|
104
105
|
// Without a link yet, open the panel, where the spec link can be added.
|
|
105
106
|
if (url) void openExternalUrl(url).catch(() => undefined); else openPanel(PANEL, { location: location() });
|
|
106
107
|
} }),
|
|
107
|
-
client.addCommandCenterItem({ id: "follow-up-rename", title: "Follow-up: Rename
|
|
108
|
+
client.addCommandCenterItem({ id: "follow-up-rename", title: "Follow-up: Rename title with AI", icon: "Sparkles", keywords: ["rename", "name", "title", "AI", "suggest"], context: "workspace", onSelect({ workspace, openPanel }) {
|
|
108
109
|
// The dialog lives in Follow-up's surfaces: open the panel, which mounts a host, then ask.
|
|
109
110
|
openPanel(PANEL, { location: location() }); setTimeout(() => openRename({ workspaceId: workspace.id }), 0); } }),
|
|
110
111
|
client.addCommandCenterItem({ id: "follow-up-overview", title: "Follow-up: Home", icon: "House", keywords: ["home", "workspaces", "needs you", "inbox", "attention", "brief", "overview"], context: "global", onSelect({ openScreen }) { openScreen({ screenId: OVERVIEW }); } }),
|
|
@@ -139,7 +140,7 @@ export default function contribute(host: PluginClientContext) {
|
|
|
139
140
|
removers.push(extras.subscribe(syncAsk), () => removeAsk?.());
|
|
140
141
|
// Phase 2: only on hosts with the sidebar-view API (Paseo main after 2026-11-07).
|
|
141
142
|
const views = sidebarViewHost(host);
|
|
142
|
-
if (views) removers.push(views.addSidebarView({ id: "needs-you", title: "Follow-up: Needs you", description: "Agents that need you until you sign them off, then your workspaces.", Component: inboxSidebarView(sources) }));
|
|
143
|
+
if (views) removers.push(views.addSidebarView({ id: "needs-you", title: "Follow-up: Needs you", description: "Agents that need you until you sign them off, then your workspaces.", Component: inboxSidebarView(sources, () => client.openScreen({ screenId: OVERVIEW, params: { item: OVERSEER_KEY, at: String(Date.now()) } })) }));
|
|
143
144
|
|
|
144
145
|
return async () => {
|
|
145
146
|
setReportFallback(null); setReportError(null);
|
package/index.server.ts
CHANGED
|
@@ -1061,7 +1061,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1061
1061
|
firstMessage: async agentId => { await historyCache.load(); return historyCache.get(agentId)?.history.goal ?? null; }, roomForBackground: async () => governor.allowsBackground(), roomOnDemand: async () => governor.allowsExtras(),
|
|
1062
1062
|
});
|
|
1063
1063
|
handle(rpc.workspaceAboutRpc, async ({ workspaceId, open, refresh }, { paseo }) => { await requireReady(); seen(paseo); return about.view(workspaceId, { open, refresh }); });
|
|
1064
|
-
// Rename with AI (server/rename.ts): stored data only, Summaries' model, Paseo's own workspace title.
|
|
1064
|
+
// Rename title with AI (server/rename.ts): stored data only, Summaries' model, Paseo's own workspace title.
|
|
1065
1065
|
const renamer = new RenameService({
|
|
1066
1066
|
store: new RenameStore(directory), jobs: aiJobs, role: () => agentSettings.role("about"),
|
|
1067
1067
|
titles: renameDaemon(withDaemon as never, () => gateway.directory.markDirty()),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.0
|
|
4
|
+
"version": "2.1.0-beta.1",
|
|
5
5
|
"description": "A Paseo plugin that follows every workspace until the work is done: one Home for what needs you, questions you answer anywhere, and repairs that send themselves.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
package/server/agent-actions.ts
CHANGED
|
@@ -436,7 +436,7 @@ export class AgentActions {
|
|
|
436
436
|
|
|
437
437
|
/** Later and Bring back now on a workspace-only Needs-you row, planned like snooze. Same mutator as the row menu. */
|
|
438
438
|
/**
|
|
439
|
-
* Rename with AI (server/rename.ts): the dry run asks for a suggestion (or takes `title`, or plans Undo) and shows the
|
|
439
|
+
* Rename title with AI (server/rename.ts): the dry run asks for a suggestion (or takes `title`, or plans Undo) and shows the
|
|
440
440
|
* name now and the name after; confirm runs the dialog's Rename with that exact name.
|
|
441
441
|
*/
|
|
442
442
|
private async planRename(caller: string, args: { workspaceId?: string; title?: string; undo?: boolean }) {
|
package/server/mcp-source.ts
CHANGED
|
@@ -57,7 +57,7 @@ export const mcpSource: string = [
|
|
|
57
57
|
" [\"track\", \"Follow a workspace again after the developer opted it out in Settings. Follow-up follows every workspace by default. Only when the developer asked.\", \"follow.agent-act\", { workspace: string }, [\"workspace\"]],",
|
|
58
58
|
" [\"workspace_about\", \"Read a workspace's Summary: one sentence on what the workspace is for (a reminder, not a status), plus the Linear issues, PRs, Slack threads and docs found in its own text. Read-only unless refresh=true, which writes a new sentence like the panel's Rewrite; otherwise it writes one only when none is cached (up to ~90 s). workspaceId is a workspace id or exact title from list_prs.\", \"follow.agent-act\", { workspaceId: string, refresh: boolean }, [\"workspaceId\"]],",
|
|
59
59
|
" [\"link_items\", \"Read any workspace's linked items: Linear issues, Slack threads, docs, artifacts (the spec among them) and GitHub issues, each with its origin (registered, manual, spec, published, extracted), plus what was removed. workspaceId is a workspace id from list_prs.\" + read, \"follow.agent-act\", { workspaceId: string }, [\"workspaceId\"]],",
|
|
60
|
-
" [\"ai_rename\", \"Rename a workspace with a short AI-suggested name, like Rename with AI. title skips the model; undo=true restores the name before the last rename (24 h).\" + ask, \"follow.agent-act\", { workspaceId: string, title: string, undo: boolean, ...planned }, [\"workspaceId\"]],",
|
|
60
|
+
" [\"ai_rename\", \"Rename a workspace with a short AI-suggested name, like Rename title with AI. title skips the model; undo=true restores the name before the last rename (24 h).\" + ask, \"follow.agent-act\", { workspaceId: string, title: string, undo: boolean, ...planned }, [\"workspaceId\"]],",
|
|
61
61
|
" [\"set_linked_items\", \"Change a workspace's linked items for the developer, like the Linked items list: action add (ref: URL or Linear key), remove (ref) or undo (ref, a removal).\" + ask, \"follow.agent-act\", { workspaceId: string, action: { type: \"string\", enum: [\"add\", \"remove\", \"undo\"] }, ref: string, title: string, ...planned }, []],",
|
|
62
62
|
" [\"agent_settings\", \"Read which agent each of Follow-up's special roles uses (Summaries, Overseer, Recovery, AI priority): provider, model, effort, mode and limits, and whether Wait for background jobs is on. Read-only; the developer changes them in Follow-up settings → Agents.\", \"follow.agent-act\", {}, []],",
|
|
63
63
|
" [\"inbox_list\", \"Read the developer's Needs-you inbox: each root agent, whether it is flagged and why, snoozes and finish flags. Your own row has self=true; prs lists the PRs a row is about, each with the url its row opens.\", \"follow.agent-act\", { flagged_only: boolean }, []],",
|
package/server/mcp.mjs
CHANGED
|
@@ -55,7 +55,7 @@ const actionTools = [
|
|
|
55
55
|
["track", "Follow a workspace again after the developer opted it out in Settings. Follow-up follows every workspace by default. Only when the developer asked.", "follow.agent-act", { workspace: string }, ["workspace"]],
|
|
56
56
|
["workspace_about", "Read a workspace's Summary: one sentence on what the workspace is for (a reminder, not a status), plus the Linear issues, PRs, Slack threads and docs found in its own text. Read-only unless refresh=true, which writes a new sentence like the panel's Rewrite; otherwise it writes one only when none is cached (up to ~90 s). workspaceId is a workspace id or exact title from list_prs.", "follow.agent-act", { workspaceId: string, refresh: boolean }, ["workspaceId"]],
|
|
57
57
|
["link_items", "Read any workspace's linked items: Linear issues, Slack threads, docs, artifacts (the spec among them) and GitHub issues, each with its origin (registered, manual, spec, published, extracted), plus what was removed. workspaceId is a workspace id from list_prs." + read, "follow.agent-act", { workspaceId: string }, ["workspaceId"]],
|
|
58
|
-
["ai_rename", "Rename a workspace with a short AI-suggested name, like Rename with AI. title skips the model; undo=true restores the name before the last rename (24 h)." + ask, "follow.agent-act", { workspaceId: string, title: string, undo: boolean, ...planned }, ["workspaceId"]],
|
|
58
|
+
["ai_rename", "Rename a workspace with a short AI-suggested name, like Rename title with AI. title skips the model; undo=true restores the name before the last rename (24 h)." + ask, "follow.agent-act", { workspaceId: string, title: string, undo: boolean, ...planned }, ["workspaceId"]],
|
|
59
59
|
["set_linked_items", "Change a workspace's linked items for the developer, like the Linked items list: action add (ref: URL or Linear key), remove (ref) or undo (ref, a removal)." + ask, "follow.agent-act", { workspaceId: string, action: { type: "string", enum: ["add", "remove", "undo"] }, ref: string, title: string, ...planned }, []],
|
|
60
60
|
["agent_settings", "Read which agent each of Follow-up's special roles uses (Summaries, Overseer, Recovery, AI priority): provider, model, effort, mode and limits, and whether Wait for background jobs is on. Read-only; the developer changes them in Follow-up settings → Agents.", "follow.agent-act", {}, []],
|
|
61
61
|
["inbox_list", "Read the developer's Needs-you inbox: each root agent, whether it is flagged and why, snoozes and finish flags. Your own row has self=true; prs lists the PRs a row is about, each with the url its row opens.", "follow.agent-act", { flagged_only: boolean }, []],
|
package/server/rename.ts
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import type { AiJobs, JobResult } from "./ai-jobs";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* Rename with AI (docs/ai-roles.md#rename-with-ai). The suggestion is one small job on Summaries' model, built from
|
|
14
|
+
* Rename title with AI (docs/ai-roles.md#rename-title-with-ai). The suggestion is one small job on Summaries' model, built from
|
|
15
15
|
* stored data only (state, the Summary record, linked items, the cached directory's agent titles), so it never reads
|
|
16
16
|
* a chat or loads an agent. The rename itself is Paseo's own workspace title, and every rename is kept in
|
|
17
17
|
* `rename.json` for 24 hours so it can be undone.
|
|
@@ -24,18 +24,32 @@ export type WorkspaceTitles = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* The daemon side of WorkspaceTitles:
|
|
27
|
+
* The daemon side of WorkspaceTitles: workspace list reads paged until the exact id is found, and set_workspace_title. Nothing else is
|
|
28
28
|
* reachable from here: no agent fetch, no timeline (rename-never-wakes-an-agent, tests/rename.test.ts).
|
|
29
29
|
*/
|
|
30
|
+
type WorkspaceTitleRow = { id: string; name: string; title?: string | null };
|
|
30
31
|
type TitleDaemon = {
|
|
31
|
-
|
|
32
|
+
supportsBackgroundWorkspaces?(): boolean;
|
|
33
|
+
findWorkspace?(workspaceId: string): Promise<WorkspaceTitleRow | null>;
|
|
34
|
+
fetchWorkspaces(options?: unknown): Promise<{ entries: WorkspaceTitleRow[]; pageInfo: { hasMore: boolean; nextCursor: string | null } }>;
|
|
32
35
|
setWorkspaceTitle(workspaceId: string, title: string | null): Promise<unknown>;
|
|
33
36
|
};
|
|
34
37
|
export function renameDaemon(connect: <T>(work: (client: TitleDaemon) => Promise<T>) => Promise<T>, onChange?: () => void): WorkspaceTitles {
|
|
35
38
|
return {
|
|
36
39
|
get: id => connect(async client => {
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
// idPrefix is accepted on the wire but ignored by the server. Never treat a list as an id lookup.
|
|
41
|
+
let row: WorkspaceTitleRow | null = null;
|
|
42
|
+
if (typeof client.findWorkspace === "function") row = await client.findWorkspace(id);
|
|
43
|
+
else {
|
|
44
|
+
const filter = client.supportsBackgroundWorkspaces?.() === true ? { includeBackground: true } : {};
|
|
45
|
+
let cursor: string | undefined;
|
|
46
|
+
do {
|
|
47
|
+
const page = await client.fetchWorkspaces({ filter, page: { limit: 200, ...(cursor ? { cursor } : {}) } });
|
|
48
|
+
row = page.entries.find(e => e.id === id) ?? null;
|
|
49
|
+
if (row) break;
|
|
50
|
+
cursor = page.pageInfo.nextCursor ?? undefined;
|
|
51
|
+
} while (cursor);
|
|
52
|
+
}
|
|
39
53
|
return row ? { title: typeof row.title === "string" && row.title.trim() ? row.title : null, name: row.name } : null;
|
|
40
54
|
}),
|
|
41
55
|
set: async (id, title) => { await connect(client => client.setWorkspaceTitle(id, title)); onChange?.(); },
|
|
@@ -89,7 +103,7 @@ export class RenameService {
|
|
|
89
103
|
// One retry with the reason; never a bigger model or more effort.
|
|
90
104
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
91
105
|
const allowed = await this.d.store.mutate(file => { const b = dailyBudget(file.daily, this.now(), RENAME_DAILY_CAP); if (b.allowed) file.daily = b.next; return b.allowed; });
|
|
92
|
-
if (!allowed) throw new Error(`Rename with AI has made its ${RENAME_DAILY_CAP} suggestions for today. Type a name instead.`);
|
|
106
|
+
if (!allowed) throw new Error(`Rename title with AI has made its ${RENAME_DAILY_CAP} suggestions for today. Type a name instead.`);
|
|
93
107
|
const r: JobResult<{ name: string }> = await this.d.jobs.run({ name: "rename", prompt: renamePrompt(inputs, rejected), schema: renameReplySchema, system: RENAME_SYSTEM,
|
|
94
108
|
provider: role.provider, model: role.model ?? undefined, thinking: role.thinking, timeoutMs: 45_000, maxPromptChars: 8000, maxOutputChars: 600 });
|
|
95
109
|
if (!r.ok) { if (r.reason === "invalid-json" || r.reason === "invalid-shape") { rejected = { name: "", reason: "It wasn't the JSON object asked for." }; continue; } throw new Error(`Couldn't suggest a name: ${r.error}`); }
|
package/shared/contracts.ts
CHANGED
|
@@ -92,7 +92,7 @@ export const prioritiesRpc = defineRpc({ name: "follow.priorities", input: z.obj
|
|
|
92
92
|
/** Provider session limits from the Smart Session plugin, for Home's meters. Hidden when it isn't installed. */
|
|
93
93
|
/** Summary: collapsed reads the cache; open may start an overview; refresh always does. */
|
|
94
94
|
export const workspaceAboutRpc = defineRpc({ name: "follow.workspace-about", input: z.object({ workspaceId: idSchema, open: z.boolean().optional(), refresh: z.boolean().optional() }), output: aboutViewSchema });
|
|
95
|
-
// Rename with AI (shared/rename.ts): the dialog's state and one suggestion, and the rename or its Undo.
|
|
95
|
+
// Rename title with AI (shared/rename.ts): the dialog's state and one suggestion, and the rename or its Undo.
|
|
96
96
|
export const renameStatusRpc = defineRpc({ name: "follow.rename-status", input: z.object({ workspaceId: idSchema, suggest: z.boolean().optional() }), output: renameStatusSchema });
|
|
97
97
|
export const renameWorkspaceRpc = defineRpc({ name: "follow.rename-workspace", input: z.object({ workspaceId: idSchema, title: z.string().max(300).optional(), undo: z.boolean().optional() }), output: renameResultSchema });
|
|
98
98
|
export const usageRpc = defineRpc({ name: "follow.usage", input: z.object({}), output: usageSchema });
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { GROUP_TITLE, quietFolds, type HomeGroupId, type HomeModel, type Workstream } from "./home";
|
|
2
|
+
import { rowHit, type OmniboxItem, type RowHit, type SearchHit, type WorkspaceItem } from "./search";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What HomeList draws, in order: one entry per row, header, fold and line (client/home-list.tsx). Pure, so the keyboard
|
|
6
|
+
* walk's order (walkOrder, shared/list-keys.ts) is testable: it is exactly the rows drawn.
|
|
7
|
+
*/
|
|
8
|
+
export const QUIET_PAGE = 20;
|
|
9
|
+
export const BRIEF_KEY = "brief";
|
|
10
|
+
export const OVERSEER_KEY = "overseer";
|
|
11
|
+
export type Entry =
|
|
12
|
+
| { type: "brief"; key: string }
|
|
13
|
+
| { type: "overseer"; key: string }
|
|
14
|
+
| { type: "header"; key: string; group: HomeGroupId; title: string; count: number; open: boolean }
|
|
15
|
+
| { type: "row"; key: string; s: Workstream; hit?: RowHit | null }
|
|
16
|
+
| { type: "fold"; key: string; project: string; count: number; archivable: number; open: boolean }
|
|
17
|
+
| { type: "more"; key: string; project: string; left: number }
|
|
18
|
+
| { type: "result"; key: string; item: WorkspaceItem; index: number; s: Workstream; hit: RowHit; archived: boolean }
|
|
19
|
+
| { type: "ask"; key: string; ask: string; index: number }
|
|
20
|
+
| { type: "label"; key: string; text: string }
|
|
21
|
+
| { type: "hold"; key: string; text: string }
|
|
22
|
+
| { type: "empty"; key: string }
|
|
23
|
+
| { type: "slot"; key: string };
|
|
24
|
+
|
|
25
|
+
/** A search hit on a workspace Follow-up has archived: a muted row with the Archive glyph, reading "Archived". */
|
|
26
|
+
export function archivedRow(hit: SearchHit): Workstream {
|
|
27
|
+
return { key: hit.key, agentId: null, workspaceId: hit.key.startsWith("ws:") ? hit.key.slice(3) : null, title: hit.title, agent: null, project: null, group: "quiet", tier: null,
|
|
28
|
+
icon: "Archive", tone: "muted", line: "Archived", word: null, badges: [], pr: null, at: null, readyToArchive: false, sig: `archived:${hit.key}` } as unknown as Workstream;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type ListEntriesInput = {
|
|
32
|
+
model: HomeModel; closed: Set<string>; openProjects: Set<string>; pages: Record<string, number>; briefLine: string | null | undefined;
|
|
33
|
+
results: OmniboxItem[] | null | undefined; hits: Map<string, SearchHit> | null; filter: HomeGroupId | null; overseer: boolean; touch: boolean; afterNeeds: boolean;
|
|
34
|
+
};
|
|
35
|
+
export function listEntries({ model, closed, openProjects, pages, briefLine, results, hits, filter, overseer, touch, afterNeeds }: ListEntriesInput): Entry[] {
|
|
36
|
+
const out: Entry[] = [];
|
|
37
|
+
if (results) {
|
|
38
|
+
// Search ignores the sort and the groups: ranked by match, archived ones last under their own label.
|
|
39
|
+
let archivedShown = false;
|
|
40
|
+
results.forEach((item, index) => {
|
|
41
|
+
if (item.ask !== undefined) {
|
|
42
|
+
// The ask row closes the list; with no match it follows the "no match" line.
|
|
43
|
+
if (index === 0) out.push({ type: "label", key: "l:none", text: "No workspace, branch or PR matches." });
|
|
44
|
+
out.push({ type: "ask", key: item.key, ask: item.ask, index });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (item.hit.group === "archived" && !archivedShown) { archivedShown = true; out.push({ type: "label", key: "l:archived", text: "Archived" }); }
|
|
48
|
+
const live = model.byKey.get(item.key);
|
|
49
|
+
const s = live ?? archivedRow(item.hit);
|
|
50
|
+
out.push({ type: "result", key: `r:${item.provider}:${item.key}`, item, index, s, hit: rowHit(item.hit, s), archived: !live });
|
|
51
|
+
});
|
|
52
|
+
if (!results.length) out.push({ type: "label", key: "l:none", text: "No workspace, branch or PR matches." });
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
if (briefLine !== undefined && !filter) out.push({ type: "brief", key: BRIEF_KEY });
|
|
56
|
+
if (overseer && !filter) out.push({ type: "overseer", key: OVERSEER_KEY });
|
|
57
|
+
for (const g of model.groups) {
|
|
58
|
+
if (filter && g.id !== filter) continue;
|
|
59
|
+
const open = !!filter || !!hits || !closed.has(g.id);
|
|
60
|
+
// Phones with one group filtered: the chip above already says "N Needs you ×"; no header repeating it.
|
|
61
|
+
if (!(touch && filter)) out.push({ type: "header", key: `h:${g.id}`, group: g.id, title: g.title, count: g.items.length, open });
|
|
62
|
+
if (!open) { if (g.id === "needs" && afterNeeds && !filter) out.push({ type: "slot", key: "s:afterNeeds" }); continue; }
|
|
63
|
+
// One hold line per machine, once, at the top of Sending (the model has it only while Sending has rows).
|
|
64
|
+
if (g.id === "sending" && model.hold) out.push({ type: "hold", key: "l:hold", text: model.hold });
|
|
65
|
+
const hitOf = (s: Workstream) => { const h = hits?.get(s.key); return h ? rowHit(h, s) : null; };
|
|
66
|
+
if (g.id !== "quiet") { for (const s of g.items) out.push({ type: "row", key: s.key, s, hit: hitOf(s) }); if (g.id === "needs" && afterNeeds && !filter) out.push({ type: "slot", key: "s:afterNeeds" }); continue; }
|
|
67
|
+
for (const f of quietFolds(g.items)) {
|
|
68
|
+
const fopen = !!hits || openProjects.has(f.project);
|
|
69
|
+
out.push({ type: "fold", key: `f:${f.project}`, project: f.project, count: f.items.length, archivable: f.archivable, open: fopen });
|
|
70
|
+
if (!fopen) continue;
|
|
71
|
+
const shown = (pages[f.project] ?? 1) * QUIET_PAGE;
|
|
72
|
+
for (const s of f.items.slice(0, shown)) out.push({ type: "row", key: s.key, s, hit: hitOf(s) });
|
|
73
|
+
if (f.items.length > shown) out.push({ type: "more", key: `m:${f.project}`, project: f.project, left: f.items.length - shown });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Phones: nothing followed yet says so and what fills the list, instead of a blank screen under the pinned rows.
|
|
77
|
+
if (hits && !out.some(e => e.type === "row")) out.push({ type: "label", key: "l:none", text: "No workspace matches." });
|
|
78
|
+
else if (touch && !filter && !hits && model.groups.every(g => !g.items.length)) out.push({ type: "empty", key: "l:nothing" });
|
|
79
|
+
return out;
|
|
80
|
+
if (filter && !out.length) out.push({ type: "label", key: "l:empty", text: `Nothing in ${GROUP_TITLE[filter as HomeGroupId]} right now.` });
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walking a list of rows from the keyboard (desktop and web), the keys and the step. Home and Paseo's sidebar view
|
|
3
|
+
* walk HomeList with these through one hook (client/list-keys.ts; invariant one-keyboard-walk-for-every-list).
|
|
4
|
+
*/
|
|
5
|
+
export type ListMove = "next" | "prev" | "first" | "last" | "open";
|
|
6
|
+
export type ListKeyEvent = { key: string; metaKey?: boolean; ctrlKey?: boolean; altKey?: boolean; shiftKey?: boolean };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Which move a key is. Modified keys stay Paseo's: ⌘[ ⌘] and ⌘1…9 (Ctrl, or Alt on the web) walk its own sidebar.
|
|
10
|
+
* Escape (Paseo's interrupt) and Space (its voice toggle) are never ours. In the list's own query field only the
|
|
11
|
+
* arrows count, so j, k, Home, End and Enter still type there.
|
|
12
|
+
*/
|
|
13
|
+
export function listMove(e: ListKeyEvent, typing: boolean): ListMove | null {
|
|
14
|
+
if (e.metaKey || e.ctrlKey || e.altKey) return null;
|
|
15
|
+
if (e.key === "ArrowDown") return "next";
|
|
16
|
+
if (e.key === "ArrowUp") return "prev";
|
|
17
|
+
if (typing || e.shiftKey) return null;
|
|
18
|
+
switch (e.key) {
|
|
19
|
+
case "j": return "next";
|
|
20
|
+
case "k": return "prev";
|
|
21
|
+
case "Home": return "first";
|
|
22
|
+
case "End": return "last";
|
|
23
|
+
case "Enter": return "open";
|
|
24
|
+
default: return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The row a move lands on: one step, clamped at both ends (no wrap). From no row (or one that left), the first. */
|
|
29
|
+
export function stepKey(order: readonly string[], current: string | null, move: Exclude<ListMove, "open">): string | null {
|
|
30
|
+
if (!order.length) return null;
|
|
31
|
+
if (move === "last") return order[order.length - 1];
|
|
32
|
+
const i = current === null ? -1 : order.indexOf(current);
|
|
33
|
+
if (move === "first" || i < 0) return order[0];
|
|
34
|
+
return order[Math.max(0, Math.min(order.length - 1, i + (move === "next" ? 1 : -1)))];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The walk's order: the rows a list draws, in order (shared/list-entries.ts), so the brief and the Overseer come first
|
|
39
|
+
* and a collapsed group, a closed Quiet fold or a filtered-out row is never a stop. A search walks its results instead.
|
|
40
|
+
*/
|
|
41
|
+
export function walkOrder(entries: readonly { type: string; key: string }[]): string[] {
|
|
42
|
+
return entries.filter(e => e.type === "brief" || e.type === "overseer" || e.type === "row").map(e => e.key);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Whether a key belongs to this surface: focus inside it, or (Home) nothing focused while Home is on screen. Home and
|
|
47
|
+
* the sidebar view sit side by side, so focus in one never moves the other; and a Home kept mounted behind another tab
|
|
48
|
+
* or chat never takes a body key, which there scrolls the chat in front.
|
|
49
|
+
*/
|
|
50
|
+
export function ownsKey(input: { inside: boolean; onBody: boolean; claimBody: boolean; visible: boolean }): boolean {
|
|
51
|
+
return input.inside || input.claimBody && input.onBody && input.visible;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
type Visible = { checkVisibility?(): boolean; getClientRects?(): { length: number } };
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether a surface is on screen: its page is the visible one and its root is laid out (not display:none, nor inside a
|
|
58
|
+
* hidden ancestor). `checkVisibility` where the engine has it, else laid-out boxes. No root yet: not visible.
|
|
59
|
+
*/
|
|
60
|
+
export function surfaceVisible(root: Visible | null | undefined, doc: { visibilityState?: string }): boolean {
|
|
61
|
+
if (!root) return false;
|
|
62
|
+
if (doc.visibilityState !== undefined && doc.visibilityState !== "visible") return false;
|
|
63
|
+
if (typeof root.checkVisibility === "function") return root.checkVisibility();
|
|
64
|
+
return (root.getClientRects?.().length ?? 0) > 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Where a move lands. From the list's own query field the arrows enter the list: at the selection on Home ("select"),
|
|
69
|
+
* at the first match in the sidebar view ("focus"). Otherwise one step from the focused row, or from the selection.
|
|
70
|
+
*/
|
|
71
|
+
export function walkTarget(input: { order: readonly string[]; focused: string | null; selectedKey: string | null; mode: "select" | "focus"; typing: boolean; move: Exclude<ListMove, "open"> }): string | null {
|
|
72
|
+
const { order, focused, selectedKey, mode, typing, move } = input;
|
|
73
|
+
const from = focused ?? (selectedKey !== null && order.includes(selectedKey) ? selectedKey : null);
|
|
74
|
+
if (typing) return mode === "select" && from ? from : order[0] ?? null;
|
|
75
|
+
return stepKey(order, from, move);
|
|
76
|
+
}
|
package/shared/overseer.ts
CHANGED
|
@@ -310,3 +310,35 @@ export function overseerRowState(status: { enabled: boolean; agentId: string | n
|
|
|
310
310
|
if (row?.brief?.state === "open" && row.brief.kind === "decision" && row.needs && !row.snooze) return { state: "asks", line: `Asks you · ${row.brief.ask}` };
|
|
311
311
|
return { state: "idle", line: "Ask about any workspace or agent" };
|
|
312
312
|
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* The pinned Overseer row on a surface with a list filter (Paseo's sidebar view; invariant one-row-everywhere): the
|
|
316
|
+
* same row Home pins, from overseerRowState. While "Filter workspaces" holds a query, the row stays only when the
|
|
317
|
+
* query is about it ("over", "asks", words of its line), the way Home's search keeps the Overseer reachable through
|
|
318
|
+
* its Ask row; anything else hides it, so a filtered list shows only what matches.
|
|
319
|
+
*/
|
|
320
|
+
export function listOverseerRow(status: Parameters<typeof overseerRowState>[0], row: Parameters<typeof overseerRowState>[1], query: string): (NonNullable<ReturnType<typeof overseerRowState>> & { ranges?: [number, number][] }) | null {
|
|
321
|
+
const o = overseerRowState(status, row);
|
|
322
|
+
if (!o || !overseerMatches(o, query)) return null;
|
|
323
|
+
const ranges = overseerLineRanges(o.line, query);
|
|
324
|
+
return ranges.length ? { ...o, ranges } : o;
|
|
325
|
+
}
|
|
326
|
+
/** Where the query sits in the row's line, for the filter's highlight (the same marks rows get). */
|
|
327
|
+
export function overseerLineRanges(line: string, query: string): [number, number][] {
|
|
328
|
+
const q = query.trim().toLowerCase();
|
|
329
|
+
if (!q) return [];
|
|
330
|
+
const out: [number, number][] = [];
|
|
331
|
+
const text = line.toLowerCase();
|
|
332
|
+
for (let i = text.indexOf(q); i >= 0; i = text.indexOf(q, i + q.length)) out.push([i, i + q.length]);
|
|
333
|
+
return out;
|
|
334
|
+
}
|
|
335
|
+
/** An empty query, or one found in "Overseer" plus the row's line. */
|
|
336
|
+
export function overseerMatches(o: { line: string }, query: string): boolean {
|
|
337
|
+
const q = query.trim().toLowerCase();
|
|
338
|
+
return !q || `overseer ${o.line}`.toLowerCase().includes(q);
|
|
339
|
+
}
|
|
340
|
+
/** What selecting the pinned row does where the list opens chats: a live Overseer opens its chat; Start and a
|
|
341
|
+
* failed restart open Home's Overseer pane, where those controls live. */
|
|
342
|
+
export function overseerRowTarget(state: NonNullable<ReturnType<typeof overseerRowState>>["state"]): "chat" | "home" {
|
|
343
|
+
return state === "start" || state === "error" ? "home" : "chat";
|
|
344
|
+
}
|
package/shared/rename.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Rename with AI (docs/ai-roles.md#rename-with-ai): a short workspace name from what Follow-up already stored.
|
|
4
|
+
* Rename title with AI (docs/ai-roles.md#rename-title-with-ai): a short workspace name from what Follow-up already stored.
|
|
5
5
|
* Pure: the name rules, the prompt and the ledger's Undo rules, shared by the worker, the dialog and the tests.
|
|
6
6
|
*/
|
|
7
7
|
|
package/shared/row-menu.ts
CHANGED
|
@@ -136,7 +136,7 @@ export function rowMenu(input: RowMenuInput): RowMenuSection[] {
|
|
|
136
136
|
add("tidy", [
|
|
137
137
|
!!branch && { key: "copy_branch", action: "copy_branch", label: "Copy branch name", icon: "GitBranch", arg: branch },
|
|
138
138
|
links.length > 0 && { key: "copy_pr", action: "copy_pr", label: links.length === 1 ? "Copy PR link" : `Copy ${links.length} PR links`, icon: "Link", arg: links.join("\n") },
|
|
139
|
-
!!s.workspaceId && { key: "rename_ai", action: "rename_ai", label: "Rename with AI…", icon: "Sparkles" },
|
|
139
|
+
!!s.workspaceId && { key: "rename_ai", action: "rename_ai", label: "Rename title with AI…", icon: "Sparkles" },
|
|
140
140
|
!!w && { key: "rewrite_summary", action: "rewrite_summary", label: "Rewrite summary", icon: "RefreshCw" },
|
|
141
141
|
multiRootOther && { key: "make_main", action: "make_main", label: `Make ${s.agent} the main agent…`, icon: "Crown", arg: s.agentId!,
|
|
142
142
|
confirm: `Make ${s.agent} the main agent of ${s.title}? It takes over the goal, tasks, questions and Done.` },
|