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/home.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useText } from "./i18n";
|
|
2
|
+
import { MOVE_TEST_IDS } from "./move-testids";
|
|
1
3
|
import { allQuestions } from "../shared/outside-run";
|
|
2
4
|
import { useKept } from "./kept";
|
|
3
5
|
import { type ReactNode, useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
@@ -19,7 +21,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
19
21
|
import { browserStatusRpc, controlRpc, inboxBriefRpc, sendRpc } from "../shared/contracts";
|
|
20
22
|
import { needsYou, workspaceSnoozed } from "../shared/attention";
|
|
21
23
|
import { briefAsks, briefCardShown, liveBrief } from "../shared/brief";
|
|
22
|
-
import { briefPane, followUpLog, lastWorkdayEnd, nextNeeds, paneButtons, prChipSpoken, sameText, sinceLabel, type HomeGroupId, type HomeModel, type LogLine, type Workstream } from "../shared/home";
|
|
24
|
+
import { HOME_GROUPS, briefPane, followUpLog, lastWorkdayEnd, nextNeeds, paneButtons, prChipSpoken, sameText, sinceLabel, type HomeGroupId, type HomeModel, type LogLine, type Workstream } from "../shared/home";
|
|
23
25
|
import { age, backLabel, snoozeUntil, type InboxRow } from "../shared/inbox";
|
|
24
26
|
import { errorText } from "../shared/errors";
|
|
25
27
|
import { prLinksByNumber } from "../shared/presentation";
|
|
@@ -29,6 +31,8 @@ import { ReferencesLine } from "./linked";
|
|
|
29
31
|
import { WhyItMatters } from "./why-it-matters";
|
|
30
32
|
import { bottomGap, bottomInset, Button, focusSoon, IconButton, space, SubmitScope, text, type Theme } from "./kit";
|
|
31
33
|
import { DispatchRows, NewHost, openNew, useNewOpen } from "./new";
|
|
34
|
+
import { DayLineView, TodayList, useDailyMeetings } from "./daily-brief";
|
|
35
|
+
import { dailyBrief, type DailyBrief } from "../shared/daily-brief";
|
|
32
36
|
import { NobodyRows, QueueScreen, SinceBlock } from "./brief-since";
|
|
33
37
|
import type { NewKey } from "./search-key";
|
|
34
38
|
import { DockedPane } from "./docked-pane";
|
|
@@ -49,7 +53,8 @@ import type { OmniboxItem } from "../shared/search";
|
|
|
49
53
|
import { DisplayMenu, FilterLine, LayoutNotice, ListTop, SearchField, StatusStrip, UsageMeters, useOmnibox, useSlashToFocus } from "./home-chrome";
|
|
50
54
|
import { arrangedCounts, homeViewFiltered } from "../shared/home-arrange";
|
|
51
55
|
import { useArranged, useHomeModel, useTick, type HomeSources } from "./home-data";
|
|
52
|
-
import { laterLabel, useInbox, UndoBar, useNextRelay } from "./inbox";
|
|
56
|
+
import { laterLabel, useInbox, UndoBar, useNextRelay, useSidebarViewActive } from "./inbox";
|
|
57
|
+
import { livePeekQuestion, useRowChipActions, type ChipRow } from "./row-chips";
|
|
53
58
|
import { Spinner } from "./motion";
|
|
54
59
|
import { Setup, SetupOffer, useOnboarding } from "./onboarding";
|
|
55
60
|
import { FinishSetupLine, SetupGate } from "./setup-gate";
|
|
@@ -111,6 +116,8 @@ export type HomeDeps = {
|
|
|
111
116
|
/** The PR stats page (`?view=stats`, docs/pr-stats.md#the-page); a phone's person opens as its own screen. */
|
|
112
117
|
openStats?(params?: StatsParams): void;
|
|
113
118
|
openHome(): void;
|
|
119
|
+
/** Home's list filtered to one group (`?group=`): a phone's brief is its own screen, so its Waiting line goes back here. */
|
|
120
|
+
openGroup?(group: HomeGroupId): void;
|
|
114
121
|
/** Phones: open one Home item as its own screen, so the host's ← (and Android back) returns to the list. */
|
|
115
122
|
openItem?(key: string, extra?: { question?: string }): void;
|
|
116
123
|
briefDeps: BriefDeps;
|
|
@@ -165,6 +172,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
165
172
|
const omnibox = useOmnibox(model, deps.sources);
|
|
166
173
|
const searchKey = deps.searchKey;
|
|
167
174
|
const anywhereKey = useSyncExternalStore(searchKey?.subscribe ?? noSubscribe, searchKey?.label ?? noLabel, searchKey?.label ?? noLabel);
|
|
175
|
+
const sidebarView = useSidebarViewActive();
|
|
168
176
|
useSlashToFocus(omnibox, params.view !== "log" && params.view !== "catchup" && params.view !== "stats" && params.view !== "queue");
|
|
169
177
|
const [filter, setFilter] = useState<HomeGroupId | null>(null);
|
|
170
178
|
const [selected, setSelected] = useState<string | null>(() => params.item ?? (params.select ? `agent:${params.select}` : null));
|
|
@@ -180,10 +188,15 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
180
188
|
// An already-open Home asked to show an item (the sidebar view's Overseer row: Start and Restart live here). `at` makes
|
|
181
189
|
// the same item twice a second request.
|
|
182
190
|
useEffect(() => { if (params.item && params.at) setSelected(params.item); }, [params.item, params.at]);
|
|
191
|
+
// The brief's "N waiting on others" on a phone: Home's list, filtered to that group (deps.openGroup).
|
|
192
|
+
useEffect(() => { if (params.group && (HOME_GROUPS as readonly string[]).includes(params.group)) { setFilter(params.group as HomeGroupId); setSelected(null); } }, [params.group, params.at]);
|
|
183
193
|
// Phones show one thing at a time. A row opens its own screen (pushed by the host) instead of swapping in place, so the
|
|
184
194
|
// host's ← is the only back control and it lands on the list. Desktop selects in place beside the list.
|
|
185
195
|
const route = compact && deps.openItem ? deps.openItem : null;
|
|
186
196
|
const onSelect = useCallback((key: string) => { if (route) route(key); else setSelected(key === BRIEF_KEY ? null : key); }, [route]);
|
|
197
|
+
// #397: a row's chips act in place; +N and Write answer show the ask in full (the pane, or the item's screen on a phone).
|
|
198
|
+
const peekQuestion = useMemo(() => livePeekQuestion(deps.sources.live), [deps.sources.live]);
|
|
199
|
+
const onChip = useRowChipActions(inbox, useCallback((s: ChipRow) => onSelect(s.key), [onSelect]));
|
|
187
200
|
// A key names a row (`ws:…`, an agent row) or, from a ⌘K or chat link, an agent (`agent:<id>`): one lookup for both.
|
|
188
201
|
const resolve = (key: string | null) => key ? model.byKey.get(key) ?? (key.startsWith("agent:") ? [...model.byKey.values()].find(x => x.agentId === key.slice(6)) ?? null : null) : null;
|
|
189
202
|
const current = resolve(selected);
|
|
@@ -195,6 +208,10 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
195
208
|
const deckSize = useMemo(() => { const unread = questionsByWorkspace(questions); return deckCards({ model, rows, items: id => { const w = deps.sources.live.get(id); return w ? needsYou(w as never) : []; }, answers: id => unread.get(id)?.unread ?? [] }).length; }, [model, rows, tracked, deps.sources.live, questions]);
|
|
196
209
|
const pane = useMemo(() => briefPane({ model, rows, tracked: deps.sources.live.all(), now: Date.now() }), [model, rows, tracked, deps.sources.live]);
|
|
197
210
|
const rank = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.rank, deps.sources.extras.rank);
|
|
211
|
+
// The daily brief (invariant 197): Home's live model plus the morning read's meetings, re-read when a ranking or the queue moves.
|
|
212
|
+
const day = useDailyMeetings(`${queue.revision ?? ""}|${rank?.lastRunAt ?? ""}`);
|
|
213
|
+
const brief = useMemo(() => dailyBrief({ model, pane, nobody: queue.needs, meetings: day.meetings, now: Date.now(),
|
|
214
|
+
timeZone: day.timeZone ?? queue.timeZone ?? Intl.DateTimeFormat().resolvedOptions().timeZone }), [model, pane, queue, day]);
|
|
198
215
|
const overseerStatus = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.overseer, deps.sources.extras.overseer);
|
|
199
216
|
const prStatsOn = useSyncExternalStore(deps.sources.extras.subscribe, deps.sources.extras.prStatsOn, deps.sources.extras.prStatsOn);
|
|
200
217
|
const openStats = prStatsOn && deps.openStats ? () => deps.openStats!() : undefined;
|
|
@@ -306,7 +323,8 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
306
323
|
? <OverseerPane theme={theme} compact={compact} o={overseer} focus={replyFocus} pending={pendingAsk} agentId={overseerStatus?.agentId ?? null} model={overseerStatus?.model ?? null} restartWith={overseerStatus?.restartWith ?? null} configured={overseerStatus?.configured ?? null} deps={deps} navigation={navigation} onBack={compact && !route ? () => setSelected(null) : undefined} />
|
|
307
324
|
: current
|
|
308
325
|
? <DetailPane key={current.key} s={current} model={model} theme={theme} compact={compact} deps={deps} openFull={openFull} signOffNext={signOffNext} ask={ask?.key === current.key ? ask : null} onBack={compact && !route ? () => setSelected(null) : undefined} openAgent={navigation ? agentId => navigation.openAgent({ agentId }) : undefined} navigation={navigation} />
|
|
309
|
-
: <BriefPane theme={theme} compact={compact} pane={pane} catchUp={deps.openCatchUp} deckSize={deckSize} onSelect={key => route ? route(key) : setSelected(key)}
|
|
326
|
+
: <BriefPane theme={theme} compact={compact} pane={pane} brief={brief} catchUp={deps.openCatchUp} deckSize={deckSize} onSelect={key => route ? route(key) : setSelected(key)}
|
|
327
|
+
onWaiting={() => compact && deps.openGroup ? deps.openGroup("waiting") : setFilter("waiting")} openLog={deps.openLog} sources={deps.sources}
|
|
310
328
|
queue={deps.openQueue ? <SinceBlock theme={theme} compact={compact} openQueue={deps.openQueue} onStarted={() => deps.sources.extras.refreshDispatches()} navigation={navigation} raised={raisedKeys} revision={queue.revision} /> : null} />;
|
|
311
329
|
// Nothing followed at all: no sort, no meters, just the empty state and its action.
|
|
312
330
|
const nothing = model.groups.every(g => !g.items.length);
|
|
@@ -320,7 +338,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
320
338
|
const [keysOpen, setKeysOpen] = useState(false);
|
|
321
339
|
const list = <HomeList model={model} theme={theme} dense={compact} touch={compact} selectedKey={selected} onSelect={onSelect} briefLine={briefLine}
|
|
322
340
|
keys={{ mode: "select", onOpen: openKey, onKeys: () => setKeysOpen(v => !v), scope: homeRef, claimBody: true }}
|
|
323
|
-
results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} arranged={arranged} view={view} facts={facts} overseer={overseer} asking={asking} menu={rowMenu} onSendNow={sendNow}
|
|
341
|
+
results={omnibox.results} activeResult={omnibox.active} onResult={item => void pick(item)} filter={filter} arranged={arranged} view={view} facts={facts} overseer={overseer} asking={asking} menu={rowMenu} onSendNow={sendNow} onChip={onChip}
|
|
324
342
|
// Phones: the host header already says Follow-up, so no "Home" title row; search, sort and settings share one row and
|
|
325
343
|
// the meters move to the end of the list.
|
|
326
344
|
footer={omnibox.results ? undefined : compact
|
|
@@ -336,7 +354,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
336
354
|
{/* zIndex: on web every View is its own stacking context, so the sort menu only paints and hit-tests above the
|
|
337
355
|
strip and meters below if this row sits above them. */}
|
|
338
356
|
<View style={{ zIndex: 2, flexDirection: "row", alignItems: "center", gap: compact ? 2 : 6, paddingLeft: compact ? 16 : 16, paddingRight: compact ? 6 : 16 }}>
|
|
339
|
-
<SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => void pick(item)} anywhereKey={anywhereKey} />
|
|
357
|
+
<SearchField theme={theme} omnibox={omnibox} dense={compact} onEnter={item => void pick(item)} anywhereKey={anywhereKey} sidebarView={sidebarView} />
|
|
340
358
|
{compact && <IconButton theme={theme} compact icon="Plus" label={NEW_NAME} onPress={() => openNew()} />}
|
|
341
359
|
{!(compact && nothing) && <DisplayMenu theme={theme} mode={model.sort} onSort={deps.sources.extras.setSort} view={view} onView={deps.sources.extras.setView} projects={arranged.projects} labels={arranged.labels} rankedAt={model.rankedAt} touch={compact} rank={rank} onRerank={deps.sources.extras.rankNow} />}
|
|
342
360
|
{compact && openStats && <IconButton theme={theme} compact icon="ChartNoAxesColumn" label="PR stats" onPress={openStats} />}
|
|
@@ -365,15 +383,18 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
365
383
|
{model.needs === 0 && <><SetupOffer theme={theme} compact view={props.onboarding} /><FinishSetupLine theme={theme} compact /></>}
|
|
366
384
|
</View> : updateNotice} />;
|
|
367
385
|
|
|
386
|
+
// Read on a question row opens its card from the list's own copy (invariant 200): beside the row on desktop, a sheet on a phone.
|
|
368
387
|
if (compact) return <View style={{ flex: 1, backgroundColor: c.surface0 }}>
|
|
388
|
+
<PeekHost where="main" theme={theme} compact lines={false} questions={peekQuestion}>
|
|
369
389
|
{current || selected === OVERSEER_KEY && overseer || selected === BRIEF_KEY ? detail : list}
|
|
390
|
+
</PeekHost>
|
|
370
391
|
{updateSheets}
|
|
371
392
|
<View style={{ position: "absolute", left: 12, right: 12, bottom: bottomGap(true) + (current || selected === OVERSEER_KEY ? 132 : 0) }}><UndoBar store={inbox} theme={theme} touch /></View>
|
|
372
393
|
{newHost}
|
|
373
394
|
</View>;
|
|
374
395
|
return <View ref={homeRef} style={{ flex: 1, flexDirection: "row", backgroundColor: c.surface0 }}>
|
|
375
396
|
{/* A row with an agent peeks at its turn beside it (client/turn-view.tsx), except the selected one: its pane shows it. */}
|
|
376
|
-
<PeekHost where="main" theme={theme} compact={false} openAgent={navigation ? agentId => navigation.openAgent({ agentId }) : undefined} names={id => inbox.rows().find(r => r.agentId === id)?.title ?? "Agent"}>
|
|
397
|
+
<PeekHost where="main" theme={theme} compact={false} questions={peekQuestion} openAgent={navigation ? agentId => navigation.openAgent({ agentId }) : undefined} names={id => inbox.rows().find(r => r.agentId === id)?.title ?? "Agent"}>
|
|
377
398
|
<HomeSplit theme={theme} detail={detail} main={<View style={{ flex: 1, minWidth: 0 }}>
|
|
378
399
|
{list}
|
|
379
400
|
{updateSheets}
|
|
@@ -500,6 +521,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
500
521
|
/** The row menu's Answer: open this question's card (n changes on every pick, so the same question reopens). */
|
|
501
522
|
ask?: { id: string; n: number } | null;
|
|
502
523
|
}) {
|
|
524
|
+
const tr = useText();
|
|
503
525
|
const c = theme.colors; const t = text(c, compact);
|
|
504
526
|
const toast = useToast();
|
|
505
527
|
const { inbox, live } = deps.sources;
|
|
@@ -600,14 +622,14 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
600
622
|
const canMove = plan.buttons.includes("sign_off") || plan.buttons.includes("later");
|
|
601
623
|
const actionBar = !compact && (plan.buttons.includes("sign_off") || plan.buttons.includes("later")) && <View style={{ gap: 8 }}>
|
|
602
624
|
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
603
|
-
<Button nativeID={PANE_PRIMARY} theme={theme} compact={compact} kind={plan.primary === "sign_off" ? "primary" : "secondary"} icon={signOffIcon} title="
|
|
625
|
+
<Button nativeID={PANE_PRIMARY} theme={theme} compact={compact} kind={plan.primary === "sign_off" ? "primary" : "secondary"} icon={signOffIcon} testID={MOVE_TEST_IDS.signOff} title={tr("moves.signOff")} loading={busy === "sign_off"}
|
|
604
626
|
onPress={() => void run("sign_off", () => inbox.signOff([s.agentId!]))} />
|
|
605
|
-
<Button theme={theme} compact={compact} icon="ArrowRight" title="
|
|
606
|
-
<Button theme={theme} compact={compact} icon="AlarmClock" title="
|
|
627
|
+
<Button theme={theme} compact={compact} icon="ArrowRight" testID={MOVE_TEST_IDS.signOffNext} title={tr("moves.signOffNext")} onPress={() => signOffNext(s)} />
|
|
628
|
+
<Button theme={theme} compact={compact} icon="AlarmClock" testID={MOVE_TEST_IDS.later} title={tr("moves.laterOpen")} onPress={() => setLaterOpen(v => !v)} />
|
|
607
629
|
</View>
|
|
608
630
|
{laterOpen && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
609
|
-
{laterChoices(new Date()).map(([k, label]) =>
|
|
610
|
-
<Button key={k} theme={theme} compact={compact} kind="ghost" title={label} onPress={() => { setLaterOpen(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }} />)}
|
|
631
|
+
{laterChoices(new Date(), tr).map(([k, label]) =>
|
|
632
|
+
<Button key={k} testID={`${MOVE_TEST_IDS.later}-${k}`} theme={theme} compact={compact} kind="ghost" title={label} onPress={() => { setLaterOpen(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }} />)}
|
|
611
633
|
</View>}
|
|
612
634
|
</View>;
|
|
613
635
|
|
|
@@ -629,19 +651,19 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
629
651
|
</View>)}
|
|
630
652
|
</View>;
|
|
631
653
|
|
|
632
|
-
const laterTimes = laterChoices(new Date());
|
|
654
|
+
const laterTimes = laterChoices(new Date(), tr);
|
|
633
655
|
// Phones: the moves sit in the dock above the composer, in thumb reach, on one row: Sign off, Sign off & next, Later.
|
|
634
656
|
const narrow = useWindowDimensions().width < 380;
|
|
635
657
|
// The dock's extras step aside while a field in the pane has focus (DockedPane, a-focused-field-and-its-send-stay-in-view).
|
|
636
658
|
const moves = compact && canMove && <View style={{ flexDirection: "row", gap: 8, paddingHorizontal: 12, paddingTop: 10 }}>
|
|
637
|
-
<View style={{ flex: 1 }}><Button nativeID={PANE_PRIMARY} theme={theme} compact grow kind={plan.primary === "sign_off" && !itemFirst ? "primary" : "secondary"} icon={narrow ? undefined : signOffIcon} title="
|
|
659
|
+
<View style={{ flex: 1 }}><Button nativeID={PANE_PRIMARY} theme={theme} compact grow kind={plan.primary === "sign_off" && !itemFirst ? "primary" : "secondary"} icon={narrow ? undefined : signOffIcon} testID={MOVE_TEST_IDS.signOff} title={tr("moves.signOff")} loading={busy === "sign_off"}
|
|
638
660
|
onPress={() => void run("sign_off", () => inbox.signOff([s.agentId!]))} /></View>
|
|
639
|
-
<View style={{ flex: 1.3 }}><Button theme={theme} compact grow icon={narrow ? undefined : "ArrowRight"} title="
|
|
640
|
-
<Button theme={theme} compact icon={narrow ? undefined : "AlarmClock"} title="
|
|
661
|
+
<View style={{ flex: 1.3 }}><Button theme={theme} compact grow icon={narrow ? undefined : "ArrowRight"} testID={MOVE_TEST_IDS.signOffNext} title={tr("moves.signOffNext")} onPress={() => signOffNext(s)} /></View>
|
|
662
|
+
<Button theme={theme} compact icon={narrow ? undefined : "AlarmClock"} testID={MOVE_TEST_IDS.later} title={tr("moves.later")} accessibilityLabel={tr("moves.laterOpen")} onPress={() => setLaterSheet(true)} />
|
|
641
663
|
</View>;
|
|
642
|
-
const laterModal = compact && <Modal title="
|
|
664
|
+
const laterModal = compact && <Modal title={tr("moves.laterSheet")} open={laterSheet} onOpenChange={setLaterSheet}>
|
|
643
665
|
<Modal.Content contentContainerStyle={{ paddingVertical: 8 }}>
|
|
644
|
-
{laterTimes.map(([k, label]) => <Pressable key={k} accessibilityRole="button" onPress={() => { setLaterSheet(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }}
|
|
666
|
+
{laterTimes.map(([k, label]) => <Pressable key={k} testID={`${MOVE_TEST_IDS.later}-${k}`} accessibilityRole="button" onPress={() => { setLaterSheet(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }}
|
|
645
667
|
style={({ pressed }) => ({ minHeight: 48, justifyContent: "center", paddingHorizontal: 16, backgroundColor: pressed ? c.surface2 : "transparent" })}>
|
|
646
668
|
<Text style={t.body}>{label}</Text>
|
|
647
669
|
</Pressable>)}
|
|
@@ -685,15 +707,15 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
685
707
|
moves={() => compact ? null : <View style={{ gap: 8, marginTop: 4 }}>
|
|
686
708
|
{(!row?.needs && s.sendNow) ? <DetailSendNow s={s} theme={theme} compact={compact} deps={deps} /> : null}
|
|
687
709
|
{canMove && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
688
|
-
<Button nativeID={PANE_PRIMARY} theme={theme} compact={compact} kind={plan.primary === "sign_off" && !asks.length && !agent.permissions.length ? "primary" : "secondary"} icon={signOffIcon} title="
|
|
710
|
+
<Button nativeID={PANE_PRIMARY} theme={theme} compact={compact} kind={plan.primary === "sign_off" && !asks.length && !agent.permissions.length ? "primary" : "secondary"} icon={signOffIcon} testID={MOVE_TEST_IDS.signOff} title={tr("moves.signOff")} loading={busy === "sign_off"}
|
|
689
711
|
onPress={() => void run("sign_off", () => inbox.signOff([s.agentId!]))} />
|
|
690
712
|
{/* P2-8: named at every width (the row wraps when the pane is narrow), never a bare → and alarm. */}
|
|
691
|
-
<Button theme={theme} compact={compact} icon="ArrowRight" title="
|
|
692
|
-
<Button theme={theme} compact={compact} icon="AlarmClock" title="
|
|
713
|
+
<Button theme={theme} compact={compact} icon="ArrowRight" testID={MOVE_TEST_IDS.signOffNext} title={tr("moves.signOffNext")} onPress={() => signOffNext(s)} />
|
|
714
|
+
<Button theme={theme} compact={compact} icon="AlarmClock" testID={MOVE_TEST_IDS.later} title={tr("moves.laterOpen")} onPress={() => setLaterOpen(v => !v)} />
|
|
693
715
|
</View>}
|
|
694
716
|
{laterOpen && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
695
|
-
{laterChoices(new Date()).map(([k, label]) =>
|
|
696
|
-
<Button key={k} theme={theme} compact={compact} kind="ghost" title={label} onPress={() => { setLaterOpen(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }} />)}
|
|
717
|
+
{laterChoices(new Date(), tr).map(([k, label]) =>
|
|
718
|
+
<Button key={k} testID={`${MOVE_TEST_IDS.later}-${k}`} theme={theme} compact={compact} kind="ghost" title={label} onPress={() => { setLaterOpen(false); void inbox.snooze([s.agentId!], snoozeUntil(k, new Date())); }} />)}
|
|
697
719
|
</View>}
|
|
698
720
|
{laterBlock}
|
|
699
721
|
</View>}
|
|
@@ -950,7 +972,7 @@ export const IMAGES_STAY_HERE = "Images stay in this box; the chat's box shows o
|
|
|
950
972
|
|
|
951
973
|
// ---------- brief pane ----------
|
|
952
974
|
|
|
953
|
-
function BriefPane({ theme, compact, pane, onSelect, openLog, sources, catchUp, deckSize = 0, queue = null }: { theme: Theme; compact: boolean; pane: ReturnType<typeof briefPane>; onSelect: (key: string) => void; openLog: () => void; sources: HomeSources; catchUp?: () => void; deckSize?: number; queue?: ReactNode }) {
|
|
975
|
+
function BriefPane({ theme, compact, pane, brief, onSelect, onWaiting, openLog, sources, catchUp, deckSize = 0, queue = null }: { theme: Theme; compact: boolean; pane: ReturnType<typeof briefPane>; brief: DailyBrief; onSelect: (key: string) => void; onWaiting: () => void; openLog: () => void; sources: HomeSources; catchUp?: () => void; deckSize?: number; queue?: ReactNode }) {
|
|
954
976
|
const c = theme.colors; const t = text(c, compact);
|
|
955
977
|
useTick(30_000);
|
|
956
978
|
const now = Date.now();
|
|
@@ -967,34 +989,29 @@ function BriefPane({ theme, compact, pane, onSelect, openLog, sources, catchUp,
|
|
|
967
989
|
return <ScrollView style={{ flex: 1 }} contentContainerStyle={{ padding: compact ? 16 : 22, gap: 10 }}>
|
|
968
990
|
{/* Phones: the headline leads and the date sits under it; desktop keeps the date as an eyebrow. */}
|
|
969
991
|
{!compact && <Text style={t.meta}>{date} · {time}</Text>}
|
|
970
|
-
<Text accessibilityRole="header" style={t.headline}>{
|
|
992
|
+
<Text accessibilityRole="header" style={t.headline}>{brief.headline}</Text>
|
|
971
993
|
{compact && <Text style={t.meta}>Morning brief · {date} · {time}</Text>}
|
|
972
|
-
{
|
|
994
|
+
{/* The day line: today's meetings from the morning read (shared/daily-brief.ts); none read today, none drawn. */}
|
|
995
|
+
{brief.day && <DayLineView day={brief.day} theme={theme} compact={compact} />}
|
|
996
|
+
<View style={{ height: 6 }} />
|
|
997
|
+
{catchUp && deckSize > 0 ? <CatchUpButton theme={theme} compact={compact} count={deckSize} onPress={catchUp} plain /> : null}
|
|
998
|
+
{/* Needs you today (phones, where the brief is its own screen): one list, each line opens its own thing (a row, Start…
|
|
999
|
+
for an issue nobody's on). Desktop leaves it out: Home's Needs you is right beside the pane, in the same order. */}
|
|
1000
|
+
{compact && <><View style={{ height: 8 }} /><TodayList brief={brief} theme={theme} onSelect={onSelect} /></>}
|
|
973
1001
|
{/* The Morning brief's Linear queue: what moved since the developer last read it (client/brief-since.tsx). */}
|
|
974
1002
|
{queue}
|
|
975
|
-
{
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
{
|
|
981
|
-
|
|
982
|
-
:
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
<Text style={[t.meta, { color: c.foreground }]}>View log</Text>
|
|
988
|
-
<Icon name="ChevronRight" size={14} color={c.foregroundMuted} />
|
|
989
|
-
</Pressable>
|
|
990
|
-
: section("Done while you were away", <Pressable accessibilityRole="link" onPress={openLog} hitSlop={8}><Text style={[t.small, { color: c.foreground }]}>{pane.away.count} · log</Text></Pressable>)}
|
|
991
|
-
{!(compact && !pane.away.count) && <>
|
|
992
|
-
{pane.away.top.length ? pane.away.top.map(l => <LogRow key={l.key} l={l} c={c} />) : <Text style={t.meta}>Follow-up didn't act on its own since {sinceLabel(now)}.</Text>}
|
|
993
|
-
<Text style={t.meta}>No merges, no messages to people. Those stay yours.</Text>
|
|
994
|
-
</>}
|
|
995
|
-
|
|
996
|
-
{section("Sources")}
|
|
997
|
-
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 14 }}>
|
|
1003
|
+
{/* Already sorted: what cleared, what Follow-up did on its own (Done while away, one line into the log) and what
|
|
1004
|
+
waits on others, in one block instead of three (docs/morning-brief.md#the-daily-brief). */}
|
|
1005
|
+
{section("Already sorted", <Pressable accessibilityRole="link" accessibilityLabel={`View log: ${pane.away.count} things Follow-up did on its own`} onPress={openLog} hitSlop={8}
|
|
1006
|
+
style={compact ? { minHeight: 44, justifyContent: "center", flexDirection: "row", alignItems: "center", gap: 4 } : { flexDirection: "row", alignItems: "center", gap: 4 }}>
|
|
1007
|
+
<Text style={[t.small, { color: c.foreground }]}>View log</Text><Icon name="ChevronRight" size={12} color={c.foregroundMuted} /></Pressable>)}
|
|
1008
|
+
<View style={{ gap: 4 }}>
|
|
1009
|
+
{brief.sorted.cleared && <SortedLine c={c} t={t} icon="Check" text={`${brief.sorted.cleared} since ${sinceLabel(now)}`} />}
|
|
1010
|
+
<SortedLine c={c} t={t} icon="History" text={brief.sorted.away ? `Follow-up acted on its own ${brief.sorted.away === 1 ? "once" : `${brief.sorted.away} times`}; no merges, no messages to people` : `Follow-up didn't act on its own since ${sinceLabel(now)}`} />
|
|
1011
|
+
{/* A count that opens Home's Waiting on others group, not the group's rows again. */}
|
|
1012
|
+
{brief.sorted.waiting > 0 && <SortedLine c={c} t={t} icon="Hourglass" text={`${brief.sorted.waiting} waiting on others`} onPress={onWaiting} />}
|
|
1013
|
+
</View>
|
|
1014
|
+
<View accessibilityLabel="Sources" style={{ flexDirection: "row", flexWrap: "wrap", gap: 14, marginTop: 6 }}>
|
|
998
1015
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>{dot(offline === null)}<Text style={t.meta}>Paseo {offline === null ? "live" : `offline ${age(new Date(offline).toISOString(), now)}`}</Text></View>
|
|
999
1016
|
{githubOff
|
|
1000
1017
|
? <View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}><View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: c.foregroundMuted }} /><Text style={t.meta}>{githubOff === "missing" ? "GitHub not connected" : "GitHub signed out"}</Text></View>
|
|
@@ -1003,6 +1020,18 @@ function BriefPane({ theme, compact, pane, onSelect, openLog, sources, catchUp,
|
|
|
1003
1020
|
</ScrollView>;
|
|
1004
1021
|
}
|
|
1005
1022
|
|
|
1023
|
+
function SortedLine({ c, t, icon, text: words, onPress }: { c: Colors; t: ReturnType<typeof text>; icon: string; text: string; onPress?: () => void }) {
|
|
1024
|
+
const body = <>
|
|
1025
|
+
<View style={{ paddingTop: 2 }}><Icon name={icon} size={13} color={c.foregroundMuted} /></View>
|
|
1026
|
+
<Text style={[t.body, { flex: 1, minWidth: 0 }]}>{words}</Text>
|
|
1027
|
+
{onPress && <View style={{ paddingTop: 3 }}><Icon name="ChevronRight" size={12} color={c.foregroundMuted} /></View>}
|
|
1028
|
+
</>;
|
|
1029
|
+
const row = { flexDirection: "row" as const, alignItems: "flex-start" as const, gap: 8 };
|
|
1030
|
+
return onPress
|
|
1031
|
+
? <Pressable accessibilityRole="link" accessibilityLabel={`${words}: show them`} onPress={onPress} hitSlop={8} style={state => ({ ...row, borderRadius: 6, backgroundColor: (state as { hovered?: boolean }).hovered ? c.surface1 : "transparent" })}>{body}</Pressable>
|
|
1032
|
+
: <View style={row}>{body}</View>;
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1006
1035
|
function LogRow({ l, c, onOpen }: { l: LogLine; c: Colors; onOpen?: () => void }) {
|
|
1007
1036
|
const t = text(c);
|
|
1008
1037
|
const tone = l.tone === "success" ? c.statusSuccess : l.tone === "danger" ? c.statusDanger : l.tone === "warning" ? c.statusWarning : l.tone === "merged" ? mergedColor(c) : c.foregroundMuted;
|
package/client/i18n.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as sdk from "@getpaseo/plugin/client";
|
|
2
|
+
import { useMemo, useSyncExternalStore } from "react";
|
|
3
|
+
import { english, localesNow, resolveLocale, translator, type Tr } from "../shared/i18n";
|
|
4
|
+
import { displayValues, subscribeDisplay } from "./display";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Follow-up's text in its own language (invariant 199, docs/translations.md): Display `language`, or with Same as
|
|
8
|
+
* Paseo the app's language, read from the SDK's translation runtime. Paseo 0.15 has none, and a surface outside a
|
|
9
|
+
* plugin contribution has no provider: both read English, never a crash.
|
|
10
|
+
*/
|
|
11
|
+
let probe: unknown = null;
|
|
12
|
+
export function useAppLocale(): string | undefined {
|
|
13
|
+
const use = (sdk as { useTranslation?: (messages: never) => { locale: string } }).useTranslation;
|
|
14
|
+
if (typeof use !== "function") return undefined;
|
|
15
|
+
try {
|
|
16
|
+
probe ??= (sdk as { defineTranslations: (d: unknown) => unknown }).defineTranslations({ resources: { en: { language: "English" } } });
|
|
17
|
+
return use(probe as never).locale;
|
|
18
|
+
} catch { return undefined; }
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Display `language` as this client last read it, live. */
|
|
22
|
+
export function useLanguageSetting(): string | undefined {
|
|
23
|
+
return useSyncExternalStore(subscribeDisplay, () => displayValues()?.language, () => undefined);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The lookup every Follow-up surface reads its words through. */
|
|
27
|
+
export function useText(): Tr {
|
|
28
|
+
const app = useAppLocale();
|
|
29
|
+
const setting = useLanguageSetting();
|
|
30
|
+
const locale = resolveLocale(setting, app);
|
|
31
|
+
// The locales are read at render time, so a language added under test or by a render run reaches the next render.
|
|
32
|
+
const resource = localesNow()[locale];
|
|
33
|
+
return useMemo(() => locale === "en" ? english : translator(locale), [locale, resource]);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
let appLocaleNow: () => string | undefined = () => undefined;
|
|
37
|
+
/** index.client.tsx hands the host's language here (Paseo 0.16's `client.i18n.locale`; absent on 0.15). */
|
|
38
|
+
export function setAppLocaleSource(source: () => string | undefined) { appLocaleNow = source; }
|
|
39
|
+
|
|
40
|
+
/** Outside React (⌘K items, the row menu's builder): the setting's language, or the app's from the host. */
|
|
41
|
+
export function textNow(): Tr {
|
|
42
|
+
let app: string | undefined;
|
|
43
|
+
try { app = appLocaleNow(); } catch { app = undefined; }
|
|
44
|
+
return translator(resolveLocale(displayValues()?.language, app));
|
|
45
|
+
}
|
package/client/inbox-store.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { onNoReviewRepos, setHandedBackPrs } from "../shared/pr-workflow";
|
|
|
9
9
|
import { subscribeDisplay } from "./display";
|
|
10
10
|
import { onVisible, whileVisible } from "./visibility";
|
|
11
11
|
import { createDoneWindows } from "./done-windows";
|
|
12
|
+
import { recallLastKnown, registerLastKnown } from "./last-known";
|
|
12
13
|
|
|
13
14
|
type List = RpcOutput<typeof inboxListRpc>;
|
|
14
15
|
/**
|
|
@@ -51,6 +52,12 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
51
52
|
const rpcList = (): Promise<List> => client.rpc(inboxListRpc, data?.etag ? { etag: data.etag } : {});
|
|
52
53
|
const act = (input: RpcInput<typeof inboxActRpc>) => client.rpc(inboxActRpc, input);
|
|
53
54
|
|
|
55
|
+
// a-client-restart-never-blanks-follow-up (invariant 213): the last client's rows draw the first frame. Kept without
|
|
56
|
+
// its etag, so the first read is never answered "unchanged" against it; the feed's first event replaces it.
|
|
57
|
+
const kept = recallLastKnown("inbox", inboxListRpc.output);
|
|
58
|
+
if (kept) { data = { ...kept, etag: undefined }; setHandedBackPrs(kept.handedBack ?? []); }
|
|
59
|
+
const offKeep = registerLastKnown("inbox", () => data ? { ...data, etag: undefined, unchanged: undefined } : null);
|
|
60
|
+
|
|
54
61
|
let feed: Feed | null = null;
|
|
55
62
|
const pushed = () => feed?.live === true;
|
|
56
63
|
/** Sign-offs queued while the worker was unreachable go out before the next read. */
|
|
@@ -68,6 +75,7 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
68
75
|
data = next; offlineSince = null; failures = 0; shown = null;
|
|
69
76
|
// The worker's copy has moved on from a brief answered here (answered, or a newer one): nothing left to hold.
|
|
70
77
|
if (answering.size) answering = new Map([...answering].filter(([id, at]) => next.rows.some(r => r.agentId === id && r.brief?.state === "open" && r.brief.at === at)));
|
|
78
|
+
if (restoring.size) restoring = new Map([...restoring].filter(([id, h]) => next.rows.some(r => r.agentId === id && r.signedOffAt === h.signedOffAt)));
|
|
71
79
|
setHandedBackPrs(next.handedBack ?? []);
|
|
72
80
|
// Rows signed off while offline stay hidden until the replay lands.
|
|
73
81
|
emit();
|
|
@@ -104,7 +112,7 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
104
112
|
* The rows every surface draws: the daemon's, minus add-reviewers asks for PRs the agent merges itself
|
|
105
113
|
* (shared/inbox.ts withoutWithdrawnAsks). Cached per answer and per review-mode change, so selectors stay stable.
|
|
106
114
|
*/
|
|
107
|
-
const view = () => shown ??= { rows: (data?.rows ?? []).map(r => answeredHere(settled(withoutWithdrawnAsks(r)))), overseer: data?.overseer ? withoutWithdrawnAsks(data.overseer) : null };
|
|
115
|
+
const view = () => shown ??= { rows: (data?.rows ?? []).map(r => restoredHere(answeredHere(settled(withoutWithdrawnAsks(r))))), overseer: data?.overseer ? withoutWithdrawnAsks(data.overseer) : null };
|
|
108
116
|
/** answering-is-optimistic: a row whose questions the developer answered reads as the server will make it (settleWith). */
|
|
109
117
|
let workspaceOf: ((id: string) => { questions: readonly Pick<Question, "id" | "answer" | "closed">[] } | undefined) | null = null;
|
|
110
118
|
const settled = (r: InboxRow): InboxRow => workspaceOf && r.workspaceId ? withSettledBrief(r, workspaceOf(r.workspaceId)) : r;
|
|
@@ -115,6 +123,20 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
115
123
|
let answering = new Map<string, string | undefined>();
|
|
116
124
|
// The answer goes out as the developer's message, which clears the flag (shared/inbox.ts, rule #11).
|
|
117
125
|
const answeredHere = (r: InboxRow): InboxRow => r.brief?.state === "open" && answering.has(r.agentId) && answering.get(r.agentId) === r.brief.at ? { ...r, needs: null, snooze: null, brief: { ...r.brief, state: "answered" } } : r;
|
|
126
|
+
/**
|
|
127
|
+
* every-remove-is-instant: an agent's ask dismissed here keeps the row as it was (`dismissedFrom`), so its Undo puts it
|
|
128
|
+
* back on the click. The restore holds while the worker's copy still shows the dismissal it undoes (same
|
|
129
|
+
* `signedOffAt`), so a push sent before the Undo never takes it away; a refusal lets go.
|
|
130
|
+
*/
|
|
131
|
+
const dismissedFrom = new Map<string, InboxRow>();
|
|
132
|
+
let restoring = new Map<string, { from: InboxRow; signedOffAt: string | null | undefined }>();
|
|
133
|
+
const restoredHere = (r: InboxRow): InboxRow => {
|
|
134
|
+
const h = restoring.get(r.agentId);
|
|
135
|
+
if (!h || r.signedOffAt !== h.signedOffAt) return r;
|
|
136
|
+
// The dismissal's own marks go (server/inbox.ts undo); a brief that moved on since stays the worker's.
|
|
137
|
+
const brief = r.brief && h.from.brief && r.brief.at === h.from.brief.at ? h.from.brief : r.brief;
|
|
138
|
+
return { ...r, needs: h.from.needs, snooze: h.from.snooze, signedOffAt: h.from.signedOffAt, undoable: h.from.undoable, muteTurn: h.from.muteTurn, brief };
|
|
139
|
+
};
|
|
118
140
|
const patch = (agentIds: string[], change: (row: InboxRow) => InboxRow) => {
|
|
119
141
|
if (!data) return;
|
|
120
142
|
data = { ...data, rows: data.rows.map(r => agentIds.includes(r.agentId) ? change(r) : r) }; shown = null;
|
|
@@ -155,15 +177,23 @@ export function createInboxStore(client: PluginClientContext) {
|
|
|
155
177
|
clearRecent() { recent = null; emit(); },
|
|
156
178
|
refresh,
|
|
157
179
|
nudge,
|
|
158
|
-
stop() { stopped = true; feed?.stop(); offVisible(); offNoReview(); if (timer) clearTimeout(timer); if (nudged) clearTimeout(nudged); listeners.clear(); unsubscribe(); },
|
|
180
|
+
stop() { stopped = true; offKeep(); feed?.stop(); offVisible(); offNoReview(); if (timer) clearTimeout(timer); if (nudged) clearTimeout(nudged); listeners.clear(); unsubscribe(); },
|
|
159
181
|
|
|
160
182
|
/**
|
|
161
183
|
* Dismiss an agent's ask (dismissing-anything-in-needs-you-sends-the-agent-nothing): it leaves Needs you at once and
|
|
162
184
|
* the agent is sent nothing. The caller's toast carries Undo (`undo: true`), so no Undo bar here.
|
|
163
185
|
*/
|
|
164
186
|
async dismiss(agentId: string, undo = false) {
|
|
165
|
-
|
|
166
|
-
|
|
187
|
+
const row = data?.rows.find(r => r.agentId === agentId);
|
|
188
|
+
if (!undo) {
|
|
189
|
+
if (row) dismissedFrom.set(agentId, row);
|
|
190
|
+
patch([agentId], r => ({ ...r, needs: null, snooze: null, signedOffAt: new Date().toISOString(), undoable: true })); emit();
|
|
191
|
+
} else {
|
|
192
|
+
const from = dismissedFrom.get(agentId);
|
|
193
|
+
if (from && row) { restoring = new Map(restoring).set(agentId, { from, signedOffAt: row.signedOffAt }); shown = null; emit(); }
|
|
194
|
+
}
|
|
195
|
+
try { const out = await client.rpc(dismissRpc, { agentId, ...(undo ? { undo: true } : {}) }); if (undo) dismissedFrom.delete(agentId); return out; }
|
|
196
|
+
catch (error) { if (undo && restoring.has(agentId)) { restoring = new Map(restoring); restoring.delete(agentId); shown = null; emit(); } throw error; }
|
|
167
197
|
finally { refresh(); }
|
|
168
198
|
},
|
|
169
199
|
|
package/client/inbox.tsx
CHANGED
|
@@ -8,6 +8,9 @@ import { nextAfter, snoozeUntil, wakeLabel, type InboxRow } from "../shared/inbo
|
|
|
8
8
|
import { Button, focusSoon, rowDomId, type Theme } from "./kit";
|
|
9
9
|
import { raised } from "./theme";
|
|
10
10
|
import type { InboxStore } from "./inbox-store";
|
|
11
|
+
import { textNow } from "./i18n";
|
|
12
|
+
import { subscribeDisplay } from "./display";
|
|
13
|
+
import type { Tr } from "../shared/i18n";
|
|
11
14
|
|
|
12
15
|
|
|
13
16
|
export function useInbox<T>(store: InboxStore, select: () => T): T {
|
|
@@ -82,13 +85,24 @@ export function useSidebarViewActive(): boolean {
|
|
|
82
85
|
|
|
83
86
|
/** ⌘K items and /ok. The keyboard path is ⌘K, "ok", Enter. */
|
|
84
87
|
export function contributeInboxCommands(client: PluginClientContext, store: InboxStore, openNext: (from: string | null) => void) {
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
// The moves' titles are in Follow-up's language (invariant 199): registered again when it changes.
|
|
89
|
+
const moveItems = (t: Tr) => [
|
|
90
|
+
client.addCommandCenterItem({ id: "inbox-sign-off-next", title: t("commands.signOffNext"), icon: "ArrowRight", keywords: ["ok", "done", "ack", "needs you", "sign off", "next"], context: "agent",
|
|
87
91
|
onSelect({ agent }) { void store.signOff([agent.id]); openNext(agent.id); } }),
|
|
88
|
-
client.addCommandCenterItem({ id: "inbox-sign-off", title: "
|
|
92
|
+
client.addCommandCenterItem({ id: "inbox-sign-off", title: t("commands.signOff"), icon: "Check", keywords: ["ok", "done", "ack", "needs you", "sign off"], context: "agent",
|
|
89
93
|
onSelect({ agent }) { void store.signOff([agent.id]); } }),
|
|
90
|
-
client.addCommandCenterItem({ id: "inbox-later", title: "
|
|
94
|
+
client.addCommandCenterItem({ id: "inbox-later", title: t("commands.laterTomorrow"), icon: "AlarmClock", keywords: ["ok", "snooze", "later", "needs you"], context: "agent",
|
|
91
95
|
onSelect({ agent }) { void store.snooze([agent.id], snoozeUntil("tomorrow", new Date())); } }),
|
|
96
|
+
];
|
|
97
|
+
let shown = textNow();
|
|
98
|
+
let moves = moveItems(shown);
|
|
99
|
+
const offDisplay = subscribeDisplay(() => {
|
|
100
|
+
const next = textNow();
|
|
101
|
+
if (next("commands.signOffNext") === shown("commands.signOffNext") && next("commands.laterTomorrow") === shown("commands.laterTomorrow")) return;
|
|
102
|
+
for (const r of moves) r();
|
|
103
|
+
shown = next; moves = moveItems(next);
|
|
104
|
+
});
|
|
105
|
+
const removers = [
|
|
92
106
|
client.addCommandCenterItem({ id: "inbox-undo", title: "Follow-up: undo last sign-off or Later", icon: "Undo2", keywords: ["ok", "undo", "needs you", "sign off", "later", "snooze"], context: "global",
|
|
93
107
|
onSelect() { void store.undo(); } }),
|
|
94
108
|
client.addCommandCenterItem({ id: "inbox-next", title: "Follow-up: Next needs-you", icon: "Inbox", keywords: ["ok", "next", "needs you", "inbox"], context: "global",
|
|
@@ -96,7 +110,7 @@ export function contributeInboxCommands(client: PluginClientContext, store: Inbo
|
|
|
96
110
|
client.addSlashCommand({ name: "ok", description: "Sign off this agent (Needs you). /ok next opens the next one", argumentHint: "[next]", context: "agent",
|
|
97
111
|
onSubmit({ agent, args }) { void store.signOff([agent.id]); if (/^\s*next\b/i.test(args)) openNext(agent.id); } }),
|
|
98
112
|
];
|
|
99
|
-
return () => { for (const r of removers) r(); };
|
|
113
|
+
return () => { offDisplay(); for (const r of moves) r(); for (const r of removers) r(); };
|
|
100
114
|
}
|
|
101
115
|
|
|
102
116
|
/** "Sign off & next" target, honouring D9 and skipping the agent just signed off. */
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useQueryClient, type QueryClient } from "@tanstack/react-query";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Reads kept for the whole app session follow the installed version (invariant 198,
|
|
6
|
+
* `install-scoped-reads-follow-the-installed-version`). A live update whose client code didn't change (an rc becoming
|
|
7
|
+
* a stable) leaves Paseo's client running with its query cache: Paseo re-evaluates a plugin only when its client
|
|
8
|
+
* bundle changes. So a read the client keeps for the session (`staleTime: Infinity`) would keep the old version's
|
|
9
|
+
* answer until the app reloads. Every such read uses a key in `INSTALL_SCOPED_KEYS`, and `watchInstalledVersion`
|
|
10
|
+
* refetches them all the moment any reply in the cache carries a different installed version: the updater's view
|
|
11
|
+
* (its poll while installing, an install's reply, a refetch), the release notes' own read, or the worker's home feed
|
|
12
|
+
* (`reportInstalledVersion`): every subscribe gets the feed's current value first, so a worker restarted by a reload or
|
|
13
|
+
* an update, and an app that reconnects after missing the update (2026-12-01 live: the relay connection dropped while
|
|
14
|
+
* 2.6.0 started), report the new version within seconds.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const releaseNotesKey = ["follow-up", "release-notes"];
|
|
18
|
+
/** The updater's view (`client/updates.tsx` reads it). */
|
|
19
|
+
export const updatesKey = ["follow-up", "updates"];
|
|
20
|
+
export const onboardingKey = ["follow-up", "onboarding"];
|
|
21
|
+
|
|
22
|
+
/** Every read the client keeps for the session: each refetches when the installed version changes. */
|
|
23
|
+
export const INSTALL_SCOPED_KEYS: readonly (readonly string[])[] = [releaseNotesKey, onboardingKey];
|
|
24
|
+
|
|
25
|
+
/** Replies that name the installed version (`version` on each). */
|
|
26
|
+
const VERSION_SOURCES: readonly (readonly string[])[] = [updatesKey, releaseNotesKey];
|
|
27
|
+
|
|
28
|
+
const sameKey = (a: readonly unknown[], b: readonly unknown[]) => a.length === b.length && a.every((x, i) => x === b[i]);
|
|
29
|
+
const versionOf = (data: unknown) => {
|
|
30
|
+
const v = (data as { version?: unknown } | undefined)?.version;
|
|
31
|
+
return typeof v === "string" && v ? v : null;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
let reported: string | null = null;
|
|
35
|
+
const reporters = new Set<(version: string) => void>();
|
|
36
|
+
/** The worker's own word on the installed version (the home feed's `version`), told to every watching cache. */
|
|
37
|
+
export function reportInstalledVersion(version: string | null | undefined): void {
|
|
38
|
+
if (!version) return;
|
|
39
|
+
reported = version;
|
|
40
|
+
reporters.forEach(l => l(version));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const watched = new WeakMap<QueryClient, { users: number; stop: () => void }>();
|
|
44
|
+
|
|
45
|
+
/** Starts following the installed version on `cache` (shared by every caller; the last stop ends it). */
|
|
46
|
+
export function watchInstalledVersion(cache: QueryClient): () => void {
|
|
47
|
+
const entry = watched.get(cache);
|
|
48
|
+
if (entry) { entry.users++; return () => release(cache); }
|
|
49
|
+
let known: string | null = null;
|
|
50
|
+
for (const key of VERSION_SOURCES) known ??= versionOf(cache.getQueryData(key));
|
|
51
|
+
known ??= reported;
|
|
52
|
+
const note = (version: string | null) => {
|
|
53
|
+
if (!version || version === known) return;
|
|
54
|
+
const was = known; known = version;
|
|
55
|
+
if (was == null) return;
|
|
56
|
+
for (const key of INSTALL_SCOPED_KEYS) void cache.invalidateQueries({ queryKey: key, exact: true, refetchType: "all" }, { cancelRefetch: false });
|
|
57
|
+
};
|
|
58
|
+
const offCache = cache.getQueryCache().subscribe(event => {
|
|
59
|
+
if (event.type !== "updated" || event.action.type !== "success") return;
|
|
60
|
+
if (VERSION_SOURCES.some(key => sameKey(key, event.query.queryKey))) note(versionOf(event.query.state.data));
|
|
61
|
+
});
|
|
62
|
+
// The worker's report also refreshes the updater's view, so Home's version line and Settings read the new version.
|
|
63
|
+
const onReport = (version: string) => { if (version !== known) void cache.invalidateQueries({ queryKey: updatesKey, exact: true }, { cancelRefetch: false }); note(version); };
|
|
64
|
+
reporters.add(onReport);
|
|
65
|
+
const offWorker = () => { reporters.delete(onReport); };
|
|
66
|
+
watched.set(cache, { users: 1, stop: () => { offCache(); offWorker(); } });
|
|
67
|
+
return () => release(cache);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function release(cache: QueryClient) {
|
|
71
|
+
const entry = watched.get(cache);
|
|
72
|
+
if (!entry || --entry.users > 0) return;
|
|
73
|
+
watched.delete(cache); entry.stop();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Follows the installed version on this surface's query cache while it is mounted (every install-scoped read calls it). */
|
|
77
|
+
export function useInstalledVersion(): void {
|
|
78
|
+
const cache = useQueryClient();
|
|
79
|
+
useEffect(() => watchInstalledVersion(cache), [cache]);
|
|
80
|
+
}
|