paseo-follow-up 2.6.0 → 2.7.0-beta.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/README.md +35 -17
- package/client/about.tsx +8 -2
- package/client/agents.tsx +1 -1
- package/client/brief-since.tsx +13 -7
- package/client/brief.tsx +61 -39
- package/client/button-visibility.ts +7 -3
- package/client/card-data.ts +24 -2
- package/client/catch-up.tsx +13 -10
- package/client/chat.tsx +15 -4
- package/client/created.tsx +15 -34
- package/client/daily-brief.tsx +83 -0
- package/client/dismiss.tsx +21 -6
- package/client/display.tsx +64 -38
- package/client/floating-surface.tsx +2 -1
- package/client/home-chrome.tsx +33 -9
- package/client/home-data.ts +18 -4
- package/client/home-list.tsx +80 -25
- package/client/home-view.ts +38 -3
- package/client/home.tsx +77 -48
- package/client/i18n.tsx +45 -0
- package/client/inbox-store.ts +34 -4
- package/client/inbox.tsx +19 -5
- package/client/install-scope.ts +80 -0
- package/client/job-rows.tsx +11 -4
- package/client/kit.tsx +11 -4
- package/client/last-known.ts +70 -0
- package/client/live.tsx +29 -14
- package/client/moments.tsx +66 -0
- package/client/more-context.tsx +19 -3
- package/client/motion.tsx +25 -2
- package/client/move-testids.ts +6 -0
- package/client/needs-you.tsx +15 -10
- package/client/onboarding-read.ts +12 -0
- package/client/onboarding.tsx +97 -152
- package/client/panel.tsx +37 -1
- package/client/pending-removals.ts +45 -0
- package/client/pill.tsx +16 -11
- package/client/pr-controls.tsx +6 -1
- package/client/pr-sheet.tsx +72 -3
- package/client/question-context.tsx +30 -18
- package/client/question-draft.ts +117 -0
- package/client/questions.tsx +193 -81
- package/client/release-notes.tsx +8 -7
- package/client/review-mode.tsx +2 -2
- package/client/row-actions.ts +30 -8
- package/client/row-chips.tsx +246 -0
- package/client/search-focus.ts +24 -4
- package/client/search-key.ts +8 -4
- package/client/settings.tsx +3 -3
- package/client/setup-gate.tsx +28 -4
- package/client/setup-ui.ts +10 -3
- package/client/shipping.tsx +23 -6
- package/client/shown-cards.tsx +18 -10
- package/client/sidebar-view.tsx +19 -4
- package/client/stacks.tsx +2 -1
- package/client/timeline-card.tsx +54 -0
- package/client/toast-store.ts +22 -7
- package/client/toasts.tsx +2 -2
- package/client/turn-view.tsx +68 -10
- package/client/updates.tsx +2 -0
- package/client/view-at.ts +19 -0
- package/client/view-r-header.tsx +155 -0
- package/client/view-r.tsx +715 -0
- package/client/workspace-data.ts +7 -1
- package/index.client.tsx +42 -7
- package/index.server.ts +117 -31
- package/package.json +2 -1
- package/scripts/inline.mjs +22 -8
- package/server/about.ts +30 -4
- package/server/agent-actions.ts +71 -18
- package/server/agent-hook.mjs +24 -6
- package/server/agent-hooks.ts +29 -0
- package/server/agent-parity.ts +7 -3
- package/server/ai-jobs.ts +44 -10
- package/server/ask.ts +2 -2
- package/server/brief-sources.ts +5 -5
- package/server/brief-timeline.ts +9 -1
- package/server/compass.ts +4 -1
- package/server/daemon-endpoint/index.d.mts +24 -0
- package/server/daemon-endpoint/index.mjs +145 -0
- package/{shared → server}/daemon-url.d.mts +3 -1
- package/server/daemon-url.mjs +48 -0
- package/server/daemon.ts +5 -4
- package/server/discovery.ts +3 -3
- package/server/engine.ts +57 -8
- package/server/github.ts +7 -3
- package/server/hook-source.ts +72 -35
- package/server/inbox.ts +65 -6
- package/server/mcp-source.ts +252 -81
- package/server/mcp.mjs +33 -36
- package/server/message-queue.ts +5 -0
- package/server/onboarding.ts +16 -3
- package/server/pr-actions.ts +3 -0
- package/server/pr-workflow.ts +9 -6
- package/server/ranker.ts +29 -8
- package/server/rename.ts +1 -1
- package/server/tasks.ts +17 -4
- package/server/turn-end.ts +17 -0
- package/server/turn-events.ts +2 -2
- package/server/turn-usage.ts +47 -0
- package/server/update-watchdog-source.ts +174 -18
- package/server/update-watchdog.mjs +3 -2
- package/server/usage-record.ts +69 -0
- package/server/wait-jobs.ts +11 -8
- package/shared/about.ts +2 -1
- package/shared/agent-settings.ts +10 -1
- package/shared/agent-text.d.mts +5 -1
- package/shared/agent-text.mjs +48 -29
- package/shared/attention.ts +29 -19
- package/shared/brief-sources.ts +6 -3
- package/shared/brief.ts +35 -4
- package/shared/catch-up.ts +6 -0
- package/shared/chat.ts +30 -22
- package/shared/contracts.ts +24 -6
- package/shared/daily-brief.ts +184 -0
- package/shared/display.ts +34 -2
- package/shared/errors.ts +3 -1
- package/shared/headline.ts +6 -2
- package/shared/home.ts +70 -12
- package/shared/i18n.ts +224 -0
- package/shared/inbox.ts +46 -5
- package/shared/job-rows.ts +7 -4
- package/shared/last-known.ts +63 -0
- package/shared/model.ts +28 -1
- package/shared/moments.ts +166 -0
- package/shared/onboarding.ts +77 -67
- package/shared/optimistic-removals.ts +145 -0
- package/shared/peek.ts +26 -1
- package/shared/pr-workflow.ts +64 -4
- package/shared/question-draft.ts +60 -0
- package/shared/questions.ts +21 -1
- package/shared/row-chips.ts +167 -0
- package/shared/row-menu.ts +26 -13
- package/shared/search-focus.ts +34 -2
- package/shared/search-key.ts +10 -0
- package/shared/send-decision.ts +32 -2
- package/shared/settings-nav.ts +1 -1
- package/shared/settings.ts +11 -0
- package/shared/setup-popup.ts +10 -3
- package/shared/spin.ts +17 -0
- package/shared/status-invariants.ts +187 -5
- package/shared/status.ts +21 -4
- package/shared/task-status.ts +23 -1
- package/shared/task-view.ts +1 -1
- package/shared/usage-record.ts +84 -0
- package/shared/view-r.ts +173 -0
- package/client/card-store.ts +0 -21
- package/shared/daemon-url.mjs +0 -39
package/client/created.tsx
CHANGED
|
@@ -3,7 +3,8 @@ import { useEffect } from "react";
|
|
|
3
3
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
4
|
import { useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
5
5
|
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
6
|
-
import {
|
|
6
|
+
import { Text } from "./text";
|
|
7
|
+
import { TimelineCard } from "./timeline-card";
|
|
7
8
|
import { Spinner } from "./motion";
|
|
8
9
|
import { RichText } from "./rich-text";
|
|
9
10
|
import { BRAND_ICONS } from "./brand-icons";
|
|
@@ -84,7 +85,6 @@ function CreatedCardView({ item, theme, layout, deps }: PluginTimelineItemProps<
|
|
|
84
85
|
// Green while working; hollow (no fill) for a closed session or an archived agent.
|
|
85
86
|
const dot = presence.tone === "working" ? c.statusSuccess : presence.tone === "closed" || presence.tone === "archived" ? "closed" : null;
|
|
86
87
|
const wordColor = presence.tone === "working" ? c.statusSuccess : c.foregroundMuted;
|
|
87
|
-
const tile = compact ? 32 : 28;
|
|
88
88
|
const chipColor = (tone: "success" | "danger" | "warning" | "merged" | "muted") => tone === "success" ? c.statusSuccess : tone === "danger" ? c.statusDanger : tone === "warning" ? c.statusWarning : tone === "merged" ? mergedColor(c) : c.foregroundMuted;
|
|
89
89
|
const glyph = card.phase === "starting" ? <Spinner color={c.foregroundMuted} size={13} label={card.kind === "agent" ? "Starting" : "Creating"} />
|
|
90
90
|
: failed ? <Icon name="CircleAlert" size={15} color={c.statusDanger} />
|
|
@@ -93,39 +93,20 @@ function CreatedCardView({ item, theme, layout, deps }: PluginTimelineItemProps<
|
|
|
93
93
|
: <Icon name={card.provider === "codex" ? "SquareTerminal" : "Bot"} size={15} color={c.foregroundMuted} />;
|
|
94
94
|
const label = [title, presence.word, meta, follow?.question ? `${follow.question.id} · ${follow.question.title}` : "", ...(follow?.chips.map(x => x.text) ?? []), follow?.line ?? ""].filter(Boolean).join(". ");
|
|
95
95
|
const open = () => { if (!opens || !card.id) return; if (card.kind === "agent") deps.openAgent(card.id); else deps.openWorkspace(card.id); };
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
</View>
|
|
103
|
-
<View style={{ flex: 1, minWidth: 0 }}>
|
|
104
|
-
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
105
|
-
<Text numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foreground, fontSize: compact ? 14 : 13, lineHeight: compact ? 20 : 18, fontWeight: card.phase === "created" && opens ? "600" : "500" }}>{title}</Text>
|
|
106
|
-
{!!presence.word && <Text style={{ color: wordColor, fontSize: 12, lineHeight: 17 }}>{presence.word}{presence.link ? <Text style={{ color: c.foregroundMuted }}> · </Text> : null}{presence.link ? <Text style={{ color: c.foreground, fontWeight: "500" }}>{presence.link}</Text> : null}</Text>}
|
|
107
|
-
{opens && <Icon name="ChevronRight" size={14} color={c.foregroundMuted} />}
|
|
108
|
-
</View>
|
|
109
|
-
{!!meta && <Text numberOfLines={failed ? 2 : 1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17, marginTop: 1 }}>{meta}</Text>}
|
|
110
|
-
{follow && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6, marginTop: 6 }}>
|
|
111
|
-
{follow.question && <View style={{ flexDirection: "row", alignItems: "center", gap: 4, borderRadius: 5, paddingHorizontal: 6, paddingVertical: 1, backgroundColor: tint(c.statusWarning, c) }}>
|
|
112
|
-
<Icon name="CircleHelp" size={12} color={c.statusWarning} /><RichText plain style={{ color: c.statusWarning, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}>{follow.question.id}</RichText>
|
|
113
|
-
</View>}
|
|
114
|
-
{follow.question && <RichText plain numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{follow.question.title}</RichText>}
|
|
115
|
-
{follow.chips.map(x => <View key={x.text} style={{ borderRadius: 5, paddingHorizontal: 6, paddingVertical: 1, backgroundColor: x.tone === "muted" ? c.surface2 : tint(chipColor(x.tone), c) }}>
|
|
116
|
-
<Text style={{ color: chipColor(x.tone), fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}>{x.text}</Text>
|
|
117
|
-
</View>)}
|
|
118
|
-
{!!follow.line && <Text numberOfLines={1} style={{ flexShrink: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{follow.line}</Text>}
|
|
96
|
+
return <TimelineCard theme={theme} compact={compact} glyph={glyph} dot={dot} title={title} strong={card.phase === "created" && opens} word={presence.word} wordColor={wordColor} link={presence.link}
|
|
97
|
+
meta={meta} metaLines={failed ? 2 : 1} onPress={opens ? open : null} label={label}
|
|
98
|
+
hint={card.kind === "agent" ? presence.link === "Open chat" ? "Opens the agent's chat" : "Opens the agent" : "Opens the workspace"}>
|
|
99
|
+
{follow && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6, marginTop: 6 }}>
|
|
100
|
+
{follow.question && <View style={{ flexDirection: "row", alignItems: "center", gap: 4, borderRadius: 5, paddingHorizontal: 6, paddingVertical: 1, backgroundColor: tint(c.statusWarning, c) }}>
|
|
101
|
+
<Icon name="CircleHelp" size={12} color={c.statusWarning} /><RichText plain style={{ color: c.statusWarning, fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}>{follow.question.id}</RichText>
|
|
119
102
|
</View>}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
: <View accessible accessibilityLabel={label} style={{ ...frame, backgroundColor: c.surface1 }}>{body}</View>}
|
|
128
|
-
</View>;
|
|
103
|
+
{follow.question && <RichText plain numberOfLines={1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{follow.question.title}</RichText>}
|
|
104
|
+
{follow.chips.map(x => <View key={x.text} style={{ borderRadius: 5, paddingHorizontal: 6, paddingVertical: 1, backgroundColor: x.tone === "muted" ? c.surface2 : tint(chipColor(x.tone), c) }}>
|
|
105
|
+
<Text style={{ color: chipColor(x.tone), fontSize: 12, lineHeight: 17, fontVariant: ["tabular-nums"] }}>{x.text}</Text>
|
|
106
|
+
</View>)}
|
|
107
|
+
{!!follow.line && <Text numberOfLines={1} style={{ flexShrink: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{follow.line}</Text>}
|
|
108
|
+
</View>}
|
|
109
|
+
</TimelineCard>;
|
|
129
110
|
}
|
|
130
111
|
|
|
131
112
|
/**
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// The daily brief's own parts of Home's brief pane (docs/morning-brief.md#the-daily-brief): the day line and the
|
|
2
|
+
// "Needs you today" list (phones). The model is shared/daily-brief.ts (invariant 197): the pane draws dailyBrief() over Home's
|
|
3
|
+
// live model, and `daily_brief` answers from the same function on the worker.
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
|
+
import { View } from "react-native";
|
|
6
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
7
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
8
|
+
import { dailyBriefRpc } from "../shared/contracts";
|
|
9
|
+
import { clock, type BriefMeetingInput, type DailyBrief, type DayLine, type TodayItem } from "../shared/daily-brief";
|
|
10
|
+
import { text, type Theme } from "./kit";
|
|
11
|
+
import { Pressable, Text } from "./text";
|
|
12
|
+
import { RichText } from "./rich-text";
|
|
13
|
+
import { openNew } from "./new";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Today's meetings as the morning read kept them, read when the pane mounts and again when the worker's queue or
|
|
17
|
+
* ranking moves (`revision`): never on a timer, never a calendar read (the-brief-has-one-timer).
|
|
18
|
+
*/
|
|
19
|
+
export function useDailyMeetings(revision: string): { meetings: BriefMeetingInput[] | null; timeZone: string | null } {
|
|
20
|
+
const read = useRpc(dailyBriefRpc);
|
|
21
|
+
const [got, setGot] = useState<{ meetings: BriefMeetingInput[] | null; timeZone: string | null }>({ meetings: null, timeZone: null });
|
|
22
|
+
const load = useCallback(async () => {
|
|
23
|
+
try { const r = await read({}); setGot({ meetings: r.meetings, timeZone: r.timeZone }); } catch { /* keep what was shown: no day line beats a wrong one */ }
|
|
24
|
+
}, [read]);
|
|
25
|
+
useEffect(() => { void load(); }, [load, revision]);
|
|
26
|
+
return got;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const pct = (m: number, d: DayLine) => `${((m - d.from) / (d.to - d.from)) * 100}%` as `${number}%`;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Today on one line (DESIGN.md: colour carries meaning, so no status colour here): the track, meetings as solid marks,
|
|
33
|
+
* the longest open stretch still ahead as a quiet fill, now as a thin rule in ink.
|
|
34
|
+
*/
|
|
35
|
+
export function DayLineView({ day, theme, compact }: { day: DayLine; theme: Theme; compact: boolean }) {
|
|
36
|
+
const c = theme.colors; const t = text(c, compact);
|
|
37
|
+
const ticks = [day.from, ...[12 * 60, 16 * 60].filter(m => m > day.from && m < day.to), day.to];
|
|
38
|
+
const label = day.meetings.length
|
|
39
|
+
? `Today's meetings: ${day.meetings.map(m => `${m.title} at ${m.time}`).join(", ")}.${day.now !== null ? ` Now ${clock(day.now)}.` : ""}${day.longest ? ` Longest open stretch ahead: ${clock(day.longest.from)} to ${clock(day.longest.to)}.` : ""}`
|
|
40
|
+
: "No meetings today.";
|
|
41
|
+
const span = (from: number, to: number) => ({ left: pct(from, day), width: pct(to - from + day.from, day) });
|
|
42
|
+
return <View accessible accessibilityLabel={label} style={{ height: 36 }}>
|
|
43
|
+
<View style={{ position: "absolute", left: 0, right: 0, top: 11, height: 2, borderRadius: 1, backgroundColor: c.border }} />
|
|
44
|
+
{day.longest && <View style={{ position: "absolute", ...span(day.longest.from, day.longest.to), top: 7, height: 10, borderRadius: 5, backgroundColor: c.surface2, borderWidth: 1, borderColor: c.border }} />}
|
|
45
|
+
{day.meetings.map((m, i) => <View key={`m${i}`} style={{ position: "absolute", ...span(m.from, m.from + Math.max(m.to - m.from, 12)), top: 5, height: 14, borderRadius: 3, backgroundColor: c.foregroundMuted }} />)}
|
|
46
|
+
{day.now !== null && <View style={{ position: "absolute", left: pct(day.now, day), top: 1, width: 2, height: 22, marginLeft: -1, borderRadius: 1, backgroundColor: c.foreground }} />}
|
|
47
|
+
{ticks.map((m, i) => <Text key={`t${m}`} importantForAccessibility="no" style={[t.small, { position: "absolute", top: 22, ...(i === 0 ? { left: 0 } : i === ticks.length - 1 ? { right: 0 } : { left: pct(m, day), marginLeft: -12, width: 24, textAlign: "center" as const }) }]}>{clock(m).slice(0, 2)}</Text>)}
|
|
48
|
+
</View>;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** One numbered line: a title in plain words and why it's here; a tap opens its row (or Start… for an issue). */
|
|
52
|
+
function TodayRow({ item, n, theme, onSelect }: { item: TodayItem; n: number; theme: Theme; onSelect: (key: string) => void }) {
|
|
53
|
+
const c = theme.colors; const t = text(c, true);
|
|
54
|
+
const go = () => item.open.kind === "row" ? onSelect(item.open.key) : openNew({ source: item.open.key });
|
|
55
|
+
return <Pressable accessibilityRole="button" accessibilityLabel={`${n}. ${item.title}. ${item.why}. ${item.open.kind === "issue" ? "Start" : "Open"}.`} onPress={go}
|
|
56
|
+
style={state => ({ flexDirection: "row", alignItems: "flex-start", gap: 10, minHeight: 48, paddingVertical: 8, paddingHorizontal: 8, marginHorizontal: -8, borderRadius: 8,
|
|
57
|
+
backgroundColor: state.pressed ? c.surface2 : (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>
|
|
58
|
+
<Text style={[t.meta, { width: 14, textAlign: "right", paddingTop: 1 }]}>{n}</Text>
|
|
59
|
+
<View style={{ flex: 1, minWidth: 0, gap: 1 }}>
|
|
60
|
+
<RichText plain numberOfLines={2} style={t.label}>{item.title}</RichText>
|
|
61
|
+
{!!item.why && <RichText plain numberOfLines={2} style={t.meta}>{item.why}</RichText>}
|
|
62
|
+
</View>
|
|
63
|
+
<View style={{ paddingTop: 2 }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
64
|
+
</Pressable>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* "Needs you today" on a phone, where the brief is its own screen: one list, issues nobody's on first, then Home's Needs
|
|
69
|
+
* you, capped (shared/daily-brief.ts). Desktop draws Home's Needs you right beside the pane in the same order, so the
|
|
70
|
+
* pane leaves the list out there instead of saying it twice.
|
|
71
|
+
*/
|
|
72
|
+
export function TodayList({ brief, theme, onSelect, onMore }: { brief: DailyBrief; theme: Theme; onSelect: (key: string) => void; onMore?: () => void }) {
|
|
73
|
+
const c = theme.colors; const t = text(c, true);
|
|
74
|
+
const total = brief.today.length + brief.more;
|
|
75
|
+
if (!total) return <Text style={[t.body, { color: c.foregroundMuted }]}>Nothing needs you today.</Text>;
|
|
76
|
+
return <View style={{ gap: 0 }}>
|
|
77
|
+
<Text accessibilityRole="header" style={[t.section, { marginBottom: 2 }]}>{`Needs you today · ${total}`}</Text>
|
|
78
|
+
{brief.today.map((item, i) => <TodayRow key={item.id} item={item} n={i + 1} theme={theme} onSelect={onSelect} />)}
|
|
79
|
+
{brief.more > 0 && (onMore
|
|
80
|
+
? <Pressable accessibilityRole="link" onPress={onMore} hitSlop={8} style={{ paddingVertical: 6, minHeight: 44, justifyContent: "center" }}><Text style={[t.meta, { color: c.foreground }]}>+{brief.more} more in Needs you</Text></Pressable>
|
|
81
|
+
: <Text style={[t.meta, { paddingVertical: 6 }]}>+{brief.more} more in Needs you</Text>)}
|
|
82
|
+
</View>;
|
|
83
|
+
}
|
package/client/dismiss.tsx
CHANGED
|
@@ -12,6 +12,8 @@ import { isLight, readable, solidFor, tint, withAlpha } from "./theme";
|
|
|
12
12
|
import { liveBriefKey, overviewKey, workspaceKey } from "./keys";
|
|
13
13
|
import { hasToastHost, pushToast, runAction } from "./toast-store";
|
|
14
14
|
import type { InboxStore } from "./inbox-store";
|
|
15
|
+
import { confirmRemoval, dropRemoval, hideNow, restoreNow } from "./pending-removals";
|
|
16
|
+
import { ISSUES, type Restore } from "../shared/optimistic-removals";
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Dismiss, the same on every Needs-you item (dismissing-anything-in-needs-you-sends-the-agent-nothing): a small muted x
|
|
@@ -60,8 +62,11 @@ const targetKey = (t: DismissTarget) => "agentId" in t ? `agent:${t.agentId}` :
|
|
|
60
62
|
let inbox: InboxStore | null = null;
|
|
61
63
|
export function bindDismissInbox(store: InboxStore | null): void { inbox = store; }
|
|
62
64
|
|
|
63
|
-
/**
|
|
64
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Dismiss one item, with Undo in the toast. `onDismissed` runs at once, before the request: the card moves on.
|
|
67
|
+
* `restore` is what Undo needs to draw the item again where the client's copy no longer has it (a "Nobody's on it" row).
|
|
68
|
+
*/
|
|
69
|
+
export function useDismiss(after?: () => void): (target: DismissTarget, options?: { onDismissed?: () => void; restore?: Restore }) => void {
|
|
65
70
|
const rpc = useRpc(dismissRpc);
|
|
66
71
|
const toast = useToast();
|
|
67
72
|
const cache = useQueryClient();
|
|
@@ -72,17 +77,27 @@ export function useDismiss(after?: () => void): (target: DismissTarget, options?
|
|
|
72
77
|
after?.();
|
|
73
78
|
};
|
|
74
79
|
const call = (t: DismissTarget, undo: boolean) => "agentId" in t && inbox ? inbox.dismiss(t.agentId, undo) : rpc({ ...t, ...(undo ? { undo: true } : {}) });
|
|
75
|
-
|
|
80
|
+
// every-remove-is-instant: a workspace's item and a "Nobody's on it" row read dismissed on the click, everywhere
|
|
81
|
+
// (client/pending-removals.ts), before the request; a refusal brings it back with the reason. Undo is the same in
|
|
82
|
+
// reverse: back on the click, gone again with a note if refused. An agent's ask is the inbox store's own patch.
|
|
83
|
+
const at = (t: DismissTarget): [string, string] | null => "workspaceId" in t ? [t.workspaceId, t.key] : "issue" in t ? [ISSUES, t.issue] : null;
|
|
84
|
+
const hide = (t: DismissTarget) => { const a = at(t); if (a) hideNow(...a); };
|
|
85
|
+
const settled = (t: DismissTarget) => { const a = at(t); if (a) confirmRemoval(...a); };
|
|
86
|
+
const back = (t: DismissTarget) => { const a = at(t); if (a) dropRemoval(...a); };
|
|
87
|
+
const undo = (t: DismissTarget, name: string, restore: Restore) => void runAction({ label: `Undo remove ${name}`, toast,
|
|
88
|
+
run: () => { const a = at(t); if (a) restoreNow(...a, restore); return call(t, true); },
|
|
89
|
+
onSuccess: () => { settled(t); refresh(t); }, onError: () => back(t),
|
|
76
90
|
success: () => `${name.charAt(0).toUpperCase()}${name.slice(1)} is back in Needs you`, failure: `Couldn't bring back ${name}` }, `dismiss:${targetKey(t)}`);
|
|
77
91
|
return (t, options = {}) => {
|
|
78
92
|
options.onDismissed?.();
|
|
79
|
-
void runAction({ label: "Remove", toast, run: () => call(t, false), onSuccess: () => refresh(t), failure: "Couldn't remove it",
|
|
93
|
+
void runAction({ label: "Remove", toast, run: () => { hide(t); return call(t, false); }, onSuccess: () => { settled(t); refresh(t); }, failure: "Couldn't remove it",
|
|
94
|
+
onError: () => back(t),
|
|
80
95
|
// Already gone (merged, answered, sent elsewhere): nothing to say, the surface shows what happened.
|
|
81
|
-
reconcile: () => refresh(t),
|
|
96
|
+
reconcile: () => { settled(t); refresh(t); },
|
|
82
97
|
success: r => {
|
|
83
98
|
const message = removedMessage(r.name, "owner" in r ? r.owner : undefined);
|
|
84
99
|
if (!hasToastHost()) return message;
|
|
85
|
-
pushToast("success", message, [{ label: "Undo", onPress: () => undo(t, r.name) }], { durationMs: DISMISS_UNDO_MS, keep: true });
|
|
100
|
+
pushToast("success", message, [{ label: "Undo", onPress: () => undo(t, r.name, options.restore ?? {}) }], { durationMs: DISMISS_UNDO_MS, keep: true });
|
|
86
101
|
return null;
|
|
87
102
|
} }, `dismiss:${targetKey(t)}`);
|
|
88
103
|
};
|
package/client/display.tsx
CHANGED
|
@@ -4,15 +4,18 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
4
4
|
import { displayFeed, inboxListRpc, trustBypassRpc } from "../shared/contracts";
|
|
5
5
|
import { openFeed } from "./feeds";
|
|
6
6
|
import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, SettingsSwitch } from "@getpaseo/plugin/client/ui";
|
|
7
|
-
import { isMac, searchShortcutOf, searchShortcutOptions, type SearchShortcut , isDesktopApp, newShortcutHint, newShortcutOptions, newShortcutPreset, type NewShortcut} from "../shared/search-key";
|
|
7
|
+
import { isMac, searchShortcutHint, searchShortcutOf, searchShortcutOptions, type SearchShortcut , isDesktopApp, newShortcutHint, newShortcutOptions, newShortcutPreset, type NewShortcut} from "../shared/search-key";
|
|
8
8
|
import { useEffect, useSyncExternalStore } from "react";
|
|
9
9
|
import { ActivityIndicator, Platform, View } from "react-native";
|
|
10
10
|
import { Text } from "./text";
|
|
11
11
|
import { sharedRead } from "./shared-read";
|
|
12
|
-
import { DEFAULT_OPEN_WORKSPACE_ON, displayPreferences, displayRpc, trustCountText, type OpenWorkspaceOn } from "../shared/display";
|
|
12
|
+
import { BRIEF_NUDGE_HINT, DEFAULT_OPEN_WORKSPACE_ON, displayPreferences, displayRpc, trustCountText, type OpenWorkspaceOn } from "../shared/display";
|
|
13
13
|
import { sidebarVisibility } from "./sidebar-visibility";
|
|
14
14
|
import { appVisible, onVisible } from "./visibility";
|
|
15
15
|
import { NEW_NAME } from "../shared/new-name";
|
|
16
|
+
import { isLanguageChoice, languageOptions, languageRowShown, localesNow, SAME_AS_PASEO } from "../shared/i18n";
|
|
17
|
+
import { useAppLocale, useText } from "./i18n";
|
|
18
|
+
import { recallLastKnown, registerLastKnown } from "./last-known";
|
|
16
19
|
|
|
17
20
|
type Display = import("zod").infer<typeof displayPreferences.schema>;
|
|
18
21
|
const listeners = new Set<(values: Display) => void>();
|
|
@@ -21,13 +24,34 @@ export function subscribeDisplay(listener: (values: Display) => void) { listener
|
|
|
21
24
|
let latest: Display | null = null;
|
|
22
25
|
listeners.add(values => { latest = values; });
|
|
23
26
|
export const displayValues = (): Display | null => latest;
|
|
27
|
+
/** Hands Display values to every follower (the settings screen's read, the feed, tests). */
|
|
28
|
+
export function publishDisplay(values: Display) { for (const listener of listeners) listener(values); }
|
|
24
29
|
/**
|
|
25
30
|
* Display enable_cards as this client last read it, live: false only once a read said off (unknown is on, invariant 7).
|
|
26
31
|
* Every place that draws an agent's card, or a link to one, asks this, so off draws none (docs/cards.md).
|
|
27
32
|
*/
|
|
33
|
+
/** Display enable_new_workspace_view (invariant 220): the index-and-reader view. Off until the document says on. */
|
|
34
|
+
export function useNewView(): boolean {
|
|
35
|
+
return useSyncExternalStore(subscribeDisplay, () => latest?.enable_new_workspace_view === true, () => false);
|
|
36
|
+
}
|
|
28
37
|
export function useCardsOn(): boolean {
|
|
29
38
|
return useSyncExternalStore(subscribeDisplay, () => latest?.enable_cards !== false, () => true);
|
|
30
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Display enable_summaries, live (off-means-fully-off): false only once a read said off. Off, no surface asks the worker
|
|
42
|
+
* for a Summary, draws one or offers Rewrite.
|
|
43
|
+
*/
|
|
44
|
+
export function useSummariesOn(): boolean {
|
|
45
|
+
return useSyncExternalStore(subscribeDisplay, () => latest?.enable_summaries !== false, () => true);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Display enable_chat_cards as this client last read it (off-means-fully-off): false only once a read said off. Every
|
|
49
|
+
* timeline transformer and renderer Follow-up adds to a chat asks this, so off leaves Paseo's own rows.
|
|
50
|
+
*/
|
|
51
|
+
export const chatCardsOn = (): boolean => latest?.enable_chat_cards !== false;
|
|
52
|
+
export function useChatCardsOn(): boolean {
|
|
53
|
+
return useSyncExternalStore(subscribeDisplay, chatCardsOn, () => true);
|
|
54
|
+
}
|
|
31
55
|
/**
|
|
32
56
|
* The Display document as it arrives (the feed's push or a read), for Home's order (client/home-view.ts): one
|
|
33
57
|
* follow.display-feed per client, the Display store's (invariant 142). A late follower gets the last document at once.
|
|
@@ -79,41 +103,34 @@ export function PermissionsSection({ theme }: Pick<PluginSurfaceProps, "theme">)
|
|
|
79
103
|
}
|
|
80
104
|
|
|
81
105
|
/**
|
|
82
|
-
* Settings →
|
|
83
|
-
*
|
|
106
|
+
* Settings → General → Language (invariant 199): Follow-up's own language. Same as Paseo follows the app; any other
|
|
107
|
+
* choice is only Follow-up's, so a language Paseo doesn't offer can still show here. Each language in its own name.
|
|
84
108
|
*/
|
|
85
|
-
export function
|
|
109
|
+
export function LanguageSection({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
86
110
|
const settings = useSettings(displayPreferences);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
return
|
|
111
|
+
const t = useText();
|
|
112
|
+
const app = useAppLocale();
|
|
113
|
+
// With English the only language, a picker has one real choice: no row (the setting and set_display still exist).
|
|
114
|
+
if (settings.status !== "ready" || !languageRowShown()) return null;
|
|
115
|
+
const locales = localesNow();
|
|
116
|
+
const value = isLanguageChoice(settings.values.language, locales) ? settings.values.language : SAME_AS_PASEO;
|
|
117
|
+
return <SettingsSection title={t("settings.language.title")}>
|
|
94
118
|
<SettingsCard>
|
|
95
|
-
<
|
|
96
|
-
|
|
119
|
+
<SettingsSelect label={t("settings.language.label")} hint={t("settings.language.hint")} value={value} options={languageOptions(t, locales, app)} disabled={settings.saving}
|
|
120
|
+
onValueChange={(language: string) => void settings.save({ ...settings.values, language }, settings.revision)} />
|
|
97
121
|
</SettingsCard>
|
|
98
122
|
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** A neutral "Beta" chip for section titles. */
|
|
103
|
-
export function BetaChip({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
104
|
-
return <View style={{ paddingHorizontal: 6, paddingVertical: 1, borderRadius: 4, backgroundColor: theme.colors.surface2 }}>
|
|
105
|
-
<Text style={{ color: theme.colors.foregroundMuted, fontSize: 11, lineHeight: 15 }}>Beta</Text>
|
|
106
|
-
</View>;
|
|
123
|
+
</SettingsSection>;
|
|
107
124
|
}
|
|
108
125
|
|
|
109
|
-
/**
|
|
126
|
+
/** The Chats & display tab: In your chats, Where it shows, Opening and Keyboard (what each switch touches). */
|
|
110
127
|
export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
111
128
|
const settings = useSettings(displayPreferences);
|
|
112
129
|
const list = useRpc(inboxListRpc);
|
|
113
130
|
const share = useQuery({ queryKey: ["follow-up", "brief-share"], queryFn: () => list({}), refetchInterval: 60_000 });
|
|
114
131
|
const values = settings.status === "ready" ? settings.values : undefined;
|
|
115
132
|
useEffect(() => {
|
|
116
|
-
if (values !== undefined)
|
|
133
|
+
if (values !== undefined) publishDisplay(values);
|
|
117
134
|
}, [values]);
|
|
118
135
|
|
|
119
136
|
if (settings.status === "loading") return <ActivityIndicator accessibilityLabel="Loading display settings" color={theme.colors.foregroundMuted} />;
|
|
@@ -132,26 +149,38 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
132
149
|
const save = (patch: Partial<Display>) => void settings.save({ ...settings.values, ...patch }, settings.revision);
|
|
133
150
|
return (
|
|
134
151
|
<>
|
|
135
|
-
<SettingsSection title="
|
|
152
|
+
<SettingsSection title="In your chats" info="What Follow-up adds to your agents' chats and what it tells agents. Off takes a feature away completely: nothing drawn, no words to agents, no extra turns. Needs you and Home still list everything.">
|
|
136
153
|
<SettingsCard>
|
|
137
|
-
<SettingsSwitch label="Sidebar item" hint="Opens Follow-up with Needs you first. Its badge counts the agents that need you." value={settings.values.showSidebar} disabled={settings.saving} onValueChange={(showSidebar) => save({ showSidebar })} />
|
|
138
|
-
<SettingsSwitch label="Workspace header button" hint="An icon in each workspace header. A dot appears when that workspace needs you." value={settings.values.enable_header_button} disabled={settings.saving} onValueChange={(enable_header_button) => save({ enable_header_button })} />
|
|
139
154
|
<SettingsSwitch label="Composer pill" hint="One pill above the message box, only while that agent or its workspace needs you." value={settings.values.enable_composer_pill} disabled={settings.saving} onValueChange={(enable_composer_pill) => save({ enable_composer_pill })} />
|
|
155
|
+
<SettingsSwitch label="Cards in chats" hint="The card at the end of a turn saying what the agent needs, and cards for repairs, answers and Done. Off: chats show Paseo's own rows." value={settings.values.enable_chat_cards} disabled={settings.saving} onValueChange={(enable_chat_cards) => save({ enable_chat_cards })} />
|
|
156
|
+
<SettingsSwitch label="Ask agents to state what they need" hint={BRIEF_NUDGE_HINT} value={settings.values.enable_brief_nudge} disabled={settings.saving || !settings.values.enable_inbox} onValueChange={(enable_brief_nudge) => save({ enable_brief_nudge })} />
|
|
157
|
+
<SettingsSwitch label="Agent cards" hint="Screenshots, benchmarks and reports agents show in the workspace view. Off: none are shown and agents can't add them." value={settings.values.enable_cards} disabled={settings.saving} onValueChange={(enable_cards) => save({ enable_cards })} />
|
|
158
|
+
<SettingsSwitch label="Questions you ask in chat" hint="They land in Your questions with the answer. Off: they stay in the chat. /ask still adds one." value={settings.values.enable_chat_questions} disabled={settings.saving} onValueChange={(enable_chat_questions) => save({ enable_chat_questions })} />
|
|
140
159
|
</SettingsCard>
|
|
160
|
+
{settings.values.enable_inbox && !!share.data?.briefStats && <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12, lineHeight: 17, paddingHorizontal: 4 }}>{briefShareText(share.data.briefStats)}</Text>}
|
|
141
161
|
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
|
|
142
162
|
</SettingsSection>
|
|
163
|
+
<SettingsSection title="Where it shows" info="Command-K (Ctrl-K on Windows and Linux) works whatever you hide here. Agents stay in Needs you until you sign them off or write to them; opening an agent doesn't clear it.">
|
|
164
|
+
<SettingsCard>
|
|
165
|
+
<SettingsSwitch label="Sidebar item" hint="Opens Follow-up with Needs you first. Its badge counts the agents that need you." value={settings.values.showSidebar} disabled={settings.saving} onValueChange={(showSidebar) => save({ showSidebar })} />
|
|
166
|
+
<SettingsSwitch label="Workspace header button" hint="An icon in each workspace header. A dot appears when that workspace needs you." value={settings.values.enable_header_button} disabled={settings.saving} onValueChange={(enable_header_button) => save({ enable_header_button })} />
|
|
167
|
+
<SettingsSwitch label="Needs-you inbox" hint="Off: no agent is flagged. The pill still shows workspace items, and the sidebar badge counts workspaces instead." value={settings.values.enable_inbox} disabled={settings.saving} onValueChange={(enable_inbox) => save({ enable_inbox })} />
|
|
168
|
+
<SettingsSwitch label="Flag merged and closed PRs" hint="At the lowest priority, as the cue to archive." value={settings.values.enable_inbox_pr_closed} disabled={settings.saving || !settings.values.enable_inbox} onValueChange={(enable_inbox_pr_closed) => save({ enable_inbox_pr_closed })} />
|
|
169
|
+
</SettingsCard>
|
|
170
|
+
</SettingsSection>
|
|
143
171
|
<SettingsSection title="Opening from the sidebar and Home" info="A workspace in Follow-up's sidebar list or Home's Open. Cmd or Ctrl-click opens the other one.">
|
|
144
172
|
<SettingsCard>
|
|
145
173
|
<SettingsSelect label="Open a workspace on" hint="Its workspace view: PRs, what the agents are doing and a reply box. Or its main agent's chat."
|
|
146
174
|
value={settings.values.open_workspace_on ?? DEFAULT_OPEN_WORKSPACE_ON} options={[{ value: "view", label: "Workspace view" }, { value: "chat", label: "Main agent's chat" }]} disabled={settings.saving}
|
|
147
175
|
onValueChange={(open_workspace_on: OpenWorkspaceOn) => save({ open_workspace_on })} />
|
|
148
176
|
<SettingsSwitch label="Show Follow-up beside the chat" hint="Opening a chat from Follow-up also opens its workspace view in the side panel. Off: just the chat." value={settings.values.enable_dock_beside_chat} disabled={settings.saving} onValueChange={(enable_dock_beside_chat) => save({ enable_dock_beside_chat })} />
|
|
177
|
+
<SettingsSwitch label="New workspace view (beta)" hint="Everything in the workspace as a list on the left, the item you pick read whole on the right. Off: the view you have today." value={settings.values.enable_new_workspace_view} disabled={settings.saving} onValueChange={(enable_new_workspace_view) => save({ enable_new_workspace_view })} />
|
|
149
178
|
</SettingsCard>
|
|
150
179
|
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
|
|
151
180
|
</SettingsSection>
|
|
152
181
|
{Platform.OS === "web" && <SettingsSection title="Keyboard" info="Follow-up's key never takes one Paseo uses, and inside a code editor the editor keeps it. Pick None to keep it free.">
|
|
153
182
|
<SettingsCard>
|
|
154
|
-
<SettingsSelect label="Search from anywhere" hint=
|
|
183
|
+
<SettingsSelect label="Search from anywhere" hint={searchShortcutHint}
|
|
155
184
|
value={searchShortcutOf(settings.values.search_shortcut)} options={searchShortcutOptions(isMac())} disabled={settings.saving}
|
|
156
185
|
onValueChange={(search_shortcut: SearchShortcut) => save({ search_shortcut })} />
|
|
157
186
|
<SettingsSelect label={`${NEW_NAME} from anywhere`} hint={newShortcutHint(isDesktopApp(), isMac())}
|
|
@@ -159,14 +188,6 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
159
188
|
onValueChange={(new_shortcut: NewShortcut) => save({ new_shortcut })} />
|
|
160
189
|
</SettingsCard>
|
|
161
190
|
</SettingsSection>}
|
|
162
|
-
<SettingsSection title="Needs-you inbox" trailing={<BetaChip theme={theme} />} info="Agents stay in Needs you until you sign them off or write to them. Opening an agent doesn't clear it.">
|
|
163
|
-
<SettingsCard>
|
|
164
|
-
<SettingsSwitch label="Needs-you inbox" hint="Off: no agent is flagged. The pill still shows workspace items, and the sidebar badge counts workspaces instead." value={settings.values.enable_inbox} disabled={settings.saving} onValueChange={(enable_inbox) => save({ enable_inbox })} />
|
|
165
|
-
<SettingsSwitch label="Flag merged and closed PRs" hint="At the lowest priority, as the cue to archive." value={settings.values.enable_inbox_pr_closed} disabled={settings.saving || !settings.values.enable_inbox} onValueChange={(enable_inbox_pr_closed) => save({ enable_inbox_pr_closed })} />
|
|
166
|
-
<SettingsSwitch label="Ask agents to state what they need" hint="A Claude Code agent that ends a turn without saying what you need is asked once to state it, for the card at the end of its chat. Other providers only get the instruction." value={settings.values.enable_brief_nudge} disabled={settings.saving || !settings.values.enable_inbox} onValueChange={(enable_brief_nudge) => save({ enable_brief_nudge })} />
|
|
167
|
-
</SettingsCard>
|
|
168
|
-
{settings.values.enable_inbox && !!share.data?.briefStats && <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12, lineHeight: 17, paddingHorizontal: 4 }}>{briefShareText(share.data.briefStats)}</Text>}
|
|
169
|
-
</SettingsSection>
|
|
170
191
|
</>
|
|
171
192
|
);
|
|
172
193
|
}
|
|
@@ -198,7 +219,7 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
|
|
|
198
219
|
if (!disposed && result.status === "ready") {
|
|
199
220
|
latestDoc = result; for (const follower of docFollowers) follower(result);
|
|
200
221
|
const parsed = displayPreferences.schema.safeParse(result.values);
|
|
201
|
-
if (parsed.success) { sidebar.set(parsed.data.showSidebar);
|
|
222
|
+
if (parsed.success) { sidebar.set(parsed.data.showSidebar); publishDisplay(parsed.data); }
|
|
202
223
|
}
|
|
203
224
|
};
|
|
204
225
|
// Changes made on this client notify at once. Paseo 0.16 pushes other clients' and agents' changes
|
|
@@ -208,11 +229,16 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
|
|
|
208
229
|
const pollDisplay = () => { if (timer) return; void refresh(); timer = setInterval(() => { if (appVisible()) void refresh(); }, 60_000); };
|
|
209
230
|
const stopPoll = () => { if (timer) clearInterval(timer); timer = null; };
|
|
210
231
|
// The feed went down (the worker restarted): read now and poll until it is back.
|
|
232
|
+
// a-client-restart-never-blanks-follow-up (invariant 213): the last client's Display document draws the first frame
|
|
233
|
+
// (the header button and pill wait on these values); the feed's first event replaces it.
|
|
234
|
+
const kept = recallLastKnown("display", displayFeed.event);
|
|
235
|
+
if (kept) apply(kept);
|
|
236
|
+
const offKeep = registerLastKnown("display", () => latestDoc);
|
|
211
237
|
const feed = openFeed(client, displayFeed, {}, { event: doc => { generation += 1; apply(doc); }, down: pollDisplay, up: stopPoll });
|
|
212
238
|
if (!feed) pollDisplay();
|
|
213
239
|
const offVisible = onVisible(() => { if (!feed?.live) void refresh(); });
|
|
214
240
|
return () => {
|
|
215
|
-
disposed = true; feed?.stop();
|
|
241
|
+
disposed = true; offKeep(); feed?.stop();
|
|
216
242
|
if (timer) clearInterval(timer); offVisible();
|
|
217
243
|
listeners.delete(update); latestDoc = null;
|
|
218
244
|
sidebar.dispose();
|
|
@@ -62,7 +62,8 @@ export function FloatingSurface({ children, anchor, side = "below", width = 256,
|
|
|
62
62
|
const at = floatingPlacement(target ?? { x: 0, y: 0, width: 0, height: 0 }, { width, height: size?.height ?? 0 }, area, anchor ? "point" : side);
|
|
63
63
|
const content = <View ref={contentRef as never} role={role} aria-label={label} {...({ dataSet: { ...dataSet, floatingOwner: owner } } as object)}
|
|
64
64
|
onLayout={e => { const next = e.nativeEvent.layout; setSize(old => old?.width === next.width && old.height === next.height ? old : { width: next.width, height: next.height }); onSize?.(next); }}
|
|
65
|
-
|
|
65
|
+
// The caller's own maxHeight (a peek's cap) still holds: the placement's is only the viewport's.
|
|
66
|
+
style={[style, { position: "absolute", ...at, ...(typeof style?.maxHeight === "number" ? { maxHeight: Math.min(style.maxHeight, at.maxHeight) } : {}), left: at.left - (modal ? 0 : box?.x ?? 0), top: at.top - (modal ? 0 : box?.y ?? 0), zIndex: 1000, opacity: size && target ? 1 : 0, overflow: "hidden" }]}>
|
|
66
67
|
<ScrollView style={{ flexShrink: 1, minHeight: 0 }} contentContainerStyle={{ gap: style?.gap }} keyboardShouldPersistTaps="handled">{children}</ScrollView>
|
|
67
68
|
</View>;
|
|
68
69
|
return <>
|
package/client/home-chrome.tsx
CHANGED
|
@@ -22,7 +22,9 @@ import { Spinner } from "./motion";
|
|
|
22
22
|
import { withAlpha, type Colors } from "./theme";
|
|
23
23
|
import { focusRing, text, type Theme } from "./kit";
|
|
24
24
|
import { MenuItemContent, menuGlyph, menuItemRow } from "./menu-item";
|
|
25
|
-
import { useSearchFocusField } from "./search-focus";
|
|
25
|
+
import { useFilterStepField, useSearchFocusField } from "./search-focus";
|
|
26
|
+
import { filterAgainLine, filterChipTitle, homeSearchChipTitle } from "../shared/search-key";
|
|
27
|
+
import type { FilterStepOwner } from "../shared/search-focus";
|
|
26
28
|
import { useLinkedIndex } from "./linked";
|
|
27
29
|
import { Field } from "./field";
|
|
28
30
|
|
|
@@ -135,7 +137,9 @@ export function useSlashToFocus(omnibox: Omnibox, enabled = true) {
|
|
|
135
137
|
* The one query field: Home's omnibox (SearchField) and the sidebar view's filter (FilterField) are this with
|
|
136
138
|
* different words. `dense` is the phone layout: a 44px field with a rounder shape and body-size text.
|
|
137
139
|
*/
|
|
138
|
-
export function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, slashTitle, onSubmit, onArrow, listKeys = false, count, autoFocus = false, onEscape, onLayoutQuery, trailing, onLayout }: {
|
|
140
|
+
export function QueryField({ theme, value, onChange, placeholder, icon, dense, inputRef, slashHint, slashTitle, onSubmit, onArrow, listKeys = false, count, autoFocus = false, onEscape, onLayoutQuery, trailing, onLayout, onFocusChange }: {
|
|
141
|
+
/** Hears the field taking and losing the caret (the sidebar filter's "again" line). */
|
|
142
|
+
onFocusChange?: (focused: boolean) => void;
|
|
139
143
|
/** The field's own layout (Home's search: a waiting search request tries again). */
|
|
140
144
|
onLayout?: () => void;
|
|
141
145
|
/** A control at the field's end, before its ✕ (Home's search asking the Overseer: Add image). */
|
|
@@ -185,7 +189,7 @@ export function QueryField({ theme, value, onChange, placeholder, icon, dense, i
|
|
|
185
189
|
<Field ref={inputRef} onLayout={onLayout} value={value} onChangeText={q => { onLayoutQuery?.(capture.current.change(q)); onChange(q); }} placeholder={placeholder} placeholderTextColor={c.foregroundMuted}
|
|
186
190
|
accessibilityLabel={fullPlaceholder(placeholder)} autoFocus={autoFocus} autoCorrect={false} autoCapitalize="none" spellCheck={false} returnKeyType="go"
|
|
187
191
|
{...(listKeys || onLayout ? { dataSet: { ...(listKeys ? { listKeys: "1" } : {}), ...(onLayout ? { followUpSearch: "1" } : {}) } } as object : {})}
|
|
188
|
-
onFocus={() => setFocused(true)} onBlur={() => setFocused(false)}
|
|
192
|
+
onFocus={() => { setFocused(true); onFocusChange?.(true); }} onBlur={() => { setFocused(false); onFocusChange?.(false); }}
|
|
189
193
|
onSubmitEditing={onSubmit}
|
|
190
194
|
// A single-line field blurs on submit by default, which dropped focus on the page after a search pick while the
|
|
191
195
|
// results stayed up, so the second Enter reached nothing (the-selected-workspace-opens-with-enter).
|
|
@@ -218,16 +222,18 @@ export const searchPlaceholder = (askOn: boolean, dense: boolean): readonly stri
|
|
|
218
222
|
* focuses it on Home either way (useSlashToFocus).
|
|
219
223
|
*/
|
|
220
224
|
/** `onEnter`: the active result, or null when the query is empty (Home then opens its selection). */
|
|
221
|
-
export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem | null) => void; anywhereKey?: string | null
|
|
225
|
+
export function SearchField({ theme, omnibox, dense, onEnter, anywhereKey, sidebarView = false }: { theme: Theme; omnibox: Omnibox; dense: boolean; onEnter: (item: OmniboxItem | null) => void; anywhereKey?: string | null;
|
|
226
|
+
/** Follow-up's sidebar view is showing, so the key's first press goes to its filter (the chip's title says both). */
|
|
227
|
+
sidebarView?: boolean }) {
|
|
222
228
|
const { query, setQuery, move, inputRef, askOn } = omnibox;
|
|
223
229
|
const placeholder = searchPlaceholder(askOn, dense);
|
|
224
230
|
// The bar stays one line: a paste or drop lands here, and Home draws the thumbnails on their own line under it.
|
|
225
231
|
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 || "/"}
|
|
226
232
|
trailing={<AttachImageButton model={omnibox.images} theme={theme} compact={dense} label="Add image for the Overseer" />}
|
|
227
|
-
slashTitle={anywhereKey ?
|
|
233
|
+
slashTitle={anywhereKey ? homeSearchChipTitle(anywhereKey, sidebarView) : "/ focuses the search"}
|
|
228
234
|
onSubmit={() => { const item = omnibox.enterItem(); if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} /></ImageField>;
|
|
229
235
|
return <QueryField theme={theme} onLayoutQuery={omnibox.setPhysical} value={query} onChange={setQuery} placeholder={placeholder} icon="Search" dense={dense} inputRef={inputRef} onLayout={omnibox.onSearchLayout} slashHint={anywhereKey || "/"}
|
|
230
|
-
slashTitle={anywhereKey ?
|
|
236
|
+
slashTitle={anywhereKey ? homeSearchChipTitle(anywhereKey, sidebarView) : "/ focuses the search"}
|
|
231
237
|
onSubmit={() => { const item = omnibox.enterItem(); if (item || !query.trim()) onEnter(item ?? null); }} onArrow={move} listKeys={!query.trim()} />;
|
|
232
238
|
}
|
|
233
239
|
|
|
@@ -271,11 +277,29 @@ export function useListFilter(model: HomeModel, sources: HomeSources, aboutOvers
|
|
|
271
277
|
const enterKey = () => overseerActive ? OVERSEER_FIRST : results?.[active]?.key ?? null;
|
|
272
278
|
return { query, setQuery, setPhysical, layoutHint: layoutHint((results ?? []).flatMap(r => r.hit ? [r.hit] : [])), results, active, overseerActive, move, enterKey, inputRef };
|
|
273
279
|
}
|
|
274
|
-
/**
|
|
275
|
-
|
|
276
|
-
|
|
280
|
+
/**
|
|
281
|
+
* "Filter workspaces": a filter icon, so it never reads as Paseo's own Search (the Command Center, ⌘K). It is the
|
|
282
|
+
* search key's first stop (the-search-key-tries-the-sidebar-filter-first), so its chip names that key (never ⌘K), and
|
|
283
|
+
* while it holds the caret `FilterAgainLine`, under the control row, says what the key does next. A phone has no key:
|
|
284
|
+
* no chip, no line.
|
|
285
|
+
*/
|
|
286
|
+
export function FilterField({ theme, filter, dense, onEnter, step, searchKey, onFocusChange }: { theme: Theme; filter: ListFilter; dense: boolean; onEnter: (key: string) => void;
|
|
287
|
+
/** The search key's first stop, and the key's label (null: None). */
|
|
288
|
+
step?: FilterStepOwner; searchKey?: string | null; onFocusChange?: (focused: boolean) => void }) {
|
|
289
|
+
const query = filter.query;
|
|
290
|
+
useFilterStepField(step, filter.inputRef, () => query);
|
|
291
|
+
const key = filterKey(dense, step, searchKey);
|
|
292
|
+
return <QueryField theme={theme} onLayoutQuery={filter.setPhysical} value={filter.query} onChange={filter.setQuery} placeholder={["Filter workspaces", "Filter"]} icon="ListFilter" dense={dense} inputRef={filter.inputRef}
|
|
293
|
+
slashHint={key ?? false} slashTitle={key ? filterChipTitle(key) : undefined} onFocusChange={onFocusChange}
|
|
277
294
|
onSubmit={() => { const key = filter.enterKey(); if (key) onEnter(key); }} onArrow={filter.move} listKeys={!filter.query.trim()} />;
|
|
278
295
|
}
|
|
296
|
+
/** The key the filter names: web at desktop width only, with a key set. */
|
|
297
|
+
export const filterKey = (dense: boolean, step: FilterStepOwner | undefined, searchKey: string | null | undefined): string | null => !dense && Platform.OS === "web" && step ? searchKey ?? null : null;
|
|
298
|
+
/** Under the sidebar's control row while the filter holds the caret: what the search key does next. */
|
|
299
|
+
export function FilterAgainLine({ theme, keyLabel, shown }: { theme: Theme; keyLabel: string | null; shown: boolean }) {
|
|
300
|
+
if (!keyLabel || !shown) return null;
|
|
301
|
+
return <Text numberOfLines={1} style={{ ...text(theme.colors, false).meta, paddingTop: 4, paddingHorizontal: 2 }}>{filterAgainLine(keyLabel)}</Text>;
|
|
302
|
+
}
|
|
279
303
|
|
|
280
304
|
/** Kept outside the textbox: never changes the query or adds a decision to the search flow. */
|
|
281
305
|
export function LayoutNotice({ theme, query, dense }: { theme: Theme; query?: string | null; dense: boolean }) {
|
package/client/home-data.ts
CHANGED
|
@@ -7,6 +7,11 @@ import type { ArchiveFacts } from "../shared/row-menu";
|
|
|
7
7
|
import type { InboxStore } from "./inbox-store";
|
|
8
8
|
import type { LiveStore } from "./live";
|
|
9
9
|
import type { HomeExtras } from "./home-view";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { recallLastKnown, registerLastKnown } from "./last-known";
|
|
12
|
+
|
|
13
|
+
/** What a kept Paseo row must have to draw; the rest is the row as it was kept (shared/home.ts PaseoWorkspaceLite). */
|
|
14
|
+
const keptLite = z.array(z.object({ id: z.string(), name: z.string() }).passthrough());
|
|
10
15
|
|
|
11
16
|
type Descriptor = { id: string; name?: string | null; title?: string | null; projectDisplayName?: string | null; projectCustomName?: string | null; activityAt?: string | null; archivingAt?: string | null;
|
|
12
17
|
workspaceKind?: ArchiveFacts["kind"]; status?: string | null; diffStat?: { additions: number; deletions: number } | null;
|
|
@@ -37,29 +42,38 @@ export function createPaseoWorkspaces(client: PluginClientContext, hooks: { onAd
|
|
|
37
42
|
const emit = () => { if (pending) return; pending = setTimeout(() => { pending = null; version++; for (const l of listeners) l(); }, 50); };
|
|
38
43
|
const put = (w: Descriptor) => { if (w.archivingAt) { remove(w.id); return; } map.set(w.id, lite(w)); hooks.onAdd?.(w.id); emit(); };
|
|
39
44
|
const remove = (id: string) => { if (map.delete(id)) emit(); hooks.onRemove?.(id); };
|
|
45
|
+
// a-client-restart-never-blanks-follow-up (invariant 213): the last client's rows draw the first frame and register
|
|
46
|
+
// their header buttons at once; a kept row the first whole listing doesn't name is removed then.
|
|
47
|
+
const kept = recallLastKnown("paseo", keptLite) as PaseoWorkspaceLite[] | null;
|
|
48
|
+
const seeded = new Set<string>();
|
|
49
|
+
for (const w of kept ?? []) { map.set(w.id, w); seeded.add(w.id); hooks.onAdd?.(w.id); }
|
|
50
|
+
if (seeded.size) version++;
|
|
51
|
+
const offKeep = registerLastKnown("paseo", () => map.size ? [...map.values()] : null);
|
|
40
52
|
const unsubscribe = client.paseo.workspaces.subscribe(update => {
|
|
41
53
|
if (update.kind === "remove") remove(update.id);
|
|
42
|
-
else put(update.workspace as Descriptor);
|
|
54
|
+
else { seeded.delete(update.workspace.id); put(update.workspace as Descriptor); }
|
|
43
55
|
});
|
|
44
56
|
void (async () => {
|
|
45
57
|
const page = await client.paseo.workspaces.list({ subscribe: {}, page: { limit: 200 } });
|
|
46
58
|
if (stopped) { await page.subscription.release(); return; }
|
|
47
59
|
release = () => page.subscription.release();
|
|
48
|
-
|
|
60
|
+
const listed = (w: unknown) => { seeded.delete((w as Descriptor).id); put(w as Descriptor); };
|
|
61
|
+
page.entries.forEach(listed);
|
|
49
62
|
let cursor = page.pageInfo.nextCursor;
|
|
50
63
|
while (cursor && !stopped) {
|
|
51
64
|
const next = await client.paseo.workspaces.list({ page: { limit: 200, cursor } });
|
|
52
|
-
next.entries.forEach(
|
|
65
|
+
next.entries.forEach(listed);
|
|
53
66
|
if (next.pageInfo.nextCursor === cursor) break;
|
|
54
67
|
cursor = next.pageInfo.nextCursor;
|
|
55
68
|
}
|
|
69
|
+
if (!stopped) for (const id of [...seeded]) { seeded.delete(id); remove(id); }
|
|
56
70
|
})().catch(() => undefined);
|
|
57
71
|
return {
|
|
58
72
|
subscribe(listener: () => void) { listeners.add(listener); return () => { listeners.delete(listener); }; },
|
|
59
73
|
version: () => version,
|
|
60
74
|
all: () => [...map.values()],
|
|
61
75
|
get: (id: string) => map.get(id),
|
|
62
|
-
async stop() { stopped = true; if (pending) clearTimeout(pending); listeners.clear(); unsubscribe(); await release?.(); },
|
|
76
|
+
async stop() { stopped = true; offKeep(); if (pending) clearTimeout(pending); listeners.clear(); unsubscribe(); await release?.(); },
|
|
63
77
|
};
|
|
64
78
|
}
|
|
65
79
|
export type PaseoWorkspaces = ReturnType<typeof createPaseoWorkspaces>;
|