paseo-follow-up 2.6.0-beta.2 → 2.6.0-beta.4
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/OVERVIEW.md +1 -5
- package/README.md +1 -1
- package/client/agent-card.tsx +113 -0
- package/client/brief-since.tsx +2 -1
- package/client/brief.tsx +72 -20
- package/client/catch-up.tsx +22 -9
- package/client/compass-settings.tsx +8 -7
- package/client/display.tsx +14 -2
- package/client/dock.ts +31 -0
- package/client/docked-pane.tsx +10 -50
- package/client/field.tsx +33 -0
- package/client/floating-surface.tsx +79 -0
- package/client/fold.tsx +49 -0
- package/client/header.tsx +18 -7
- package/client/hint.tsx +60 -0
- package/client/home-chrome.tsx +93 -32
- package/client/home-data.ts +43 -2
- package/client/home-list.tsx +110 -31
- package/client/home-view.ts +22 -6
- package/client/home.tsx +87 -38
- package/client/inbox-store.ts +37 -1
- package/client/keyboard.tsx +159 -0
- package/client/kit.tsx +46 -20
- package/client/large.tsx +18 -52
- package/client/linked.tsx +3 -2
- package/client/live.tsx +41 -8
- package/client/messages.tsx +3 -1
- package/client/more-context.tsx +9 -7
- package/client/morning-brief-settings.tsx +4 -3
- package/client/needs-you.tsx +27 -8
- package/client/new-settings.tsx +4 -3
- package/client/new.tsx +6 -4
- package/client/now-lines.tsx +28 -8
- package/client/on-screen.tsx +43 -0
- package/client/pane-allowlist.ts +0 -2
- package/client/panel.tsx +141 -52
- package/client/pending-answers.ts +74 -14
- package/client/pr-sheet.tsx +3 -1
- package/client/pr-stats-settings.tsx +5 -4
- package/client/question-context.tsx +63 -0
- package/client/questions.tsx +52 -55
- package/client/rename.tsx +3 -2
- package/client/report-issue.tsx +3 -2
- package/client/review-mode.tsx +3 -2
- package/client/reviewers.tsx +3 -2
- package/client/row-actions.ts +12 -4
- package/client/row-menu.tsx +7 -23
- package/client/scroll-allowlist.ts +1 -0
- package/client/search-key.ts +4 -7
- package/client/settings-shell.tsx +9 -15
- package/client/settings.tsx +30 -9
- package/client/shared-read.ts +22 -0
- package/client/shipping.tsx +3 -2
- package/client/sidebar-view.tsx +24 -7
- package/client/spec.tsx +4 -3
- package/client/stacks.tsx +23 -14
- package/client/tasks.tsx +18 -17
- package/client/theme.ts +0 -8
- package/client/toast-store.ts +22 -0
- package/client/turn-view.tsx +377 -0
- package/client/why-it-matters.tsx +3 -2
- package/client/workspace-data.ts +13 -3
- package/client/your-questions.tsx +26 -11
- package/docs/screenshots/follow-up-slide-1-cover.png +0 -0
- package/docs/screenshots/follow-up-slide-2-decision.png +0 -0
- package/docs/screenshots/follow-up-slide-3-overseer.png +0 -0
- package/docs/screenshots/follow-up-slide-4-repairs.png +0 -0
- package/docs/screenshots/follow-up-slide-5-deploy.png +0 -0
- package/docs/screenshots/follow-up-slide-6-catch-up.png +0 -0
- package/index.client.tsx +26 -18
- package/index.server.ts +41 -13
- package/package.json +3 -2
- package/paseo-plugin.json +1 -1
- package/scripts/build.mjs +5 -2
- package/scripts/inline.mjs +22 -0
- package/server/agent-actions.ts +39 -13
- package/server/agent-hook.mjs +75 -151
- package/server/agent-parity.ts +4 -0
- package/server/check-watches.ts +8 -7
- package/server/compass.ts +5 -0
- package/server/daemon.ts +1 -0
- package/server/discovery.ts +2 -1
- package/server/engine.ts +37 -8
- package/server/feeds.ts +17 -8
- package/server/hook-source.ts +282 -151
- package/server/list-cache.ts +29 -11
- package/server/mcp-source.ts +249 -61
- package/server/mcp.d.mts +9 -6
- package/server/mcp.mjs +114 -61
- package/server/native-tools.ts +23 -10
- package/server/obligations.ts +5 -4
- package/server/overseer-prompt-source.ts +2 -2
- package/server/overseer-prompt.md +2 -2
- package/server/questions.ts +2 -1
- package/server/report-issue-adapter.ts +2 -2
- package/server/scheduled-tasks.ts +10 -8
- package/server/session-prompt.ts +48 -22
- package/server/tasks.ts +2 -1
- package/server/transcript.ts +68 -0
- package/server/turn-end.ts +19 -26
- package/server/wait-jobs.ts +28 -4
- package/server/wait-runner-source.ts +1 -1
- package/server/wait-runner.sh +1 -1
- package/shared/activity.ts +2 -1
- package/shared/agent-text.d.mts +28 -0
- package/shared/agent-text.mjs +133 -0
- package/shared/ask-shape.ts +28 -0
- package/shared/attention.ts +8 -7
- package/shared/brief.ts +13 -5
- package/shared/chat.ts +2 -2
- package/shared/contracts.ts +21 -7
- package/shared/display.ts +43 -6
- package/shared/finished.ts +18 -0
- package/shared/floating.ts +38 -0
- package/shared/follow-up.ts +2 -1
- package/shared/history.ts +95 -49
- package/shared/home-arrange.ts +99 -0
- package/shared/home.ts +17 -4
- package/shared/linear-queue.ts +7 -0
- package/shared/list-entries.ts +34 -7
- package/shared/list.ts +44 -2
- package/shared/model.ts +18 -5
- package/shared/now.ts +14 -5
- package/shared/optimistic-answers.ts +79 -0
- package/shared/overseer.ts +4 -3
- package/shared/peek.ts +86 -0
- package/shared/pr-actions.ts +2 -1
- package/shared/pr-status.ts +61 -0
- package/shared/presentation.ts +3 -23
- package/shared/row-menu.ts +10 -1
- package/shared/send-decision.ts +37 -4
- package/shared/settings-nav.ts +17 -0
- package/shared/sort.ts +6 -0
- package/shared/status-invariants.ts +27 -0
- package/shared/task-due.ts +9 -20
- package/shared/task-dup.ts +2 -1
- package/shared/task-status.ts +2 -1
- package/shared/turn-checks.d.mts +30 -0
- package/shared/turn-checks.mjs +71 -0
- package/shared/turn.ts +211 -0
- package/shared/workspace-layout.ts +62 -0
package/OVERVIEW.md
CHANGED
|
@@ -26,11 +26,7 @@ you, in one place, ranked.
|
|
|
26
26
|
|
|
27
27
|
It never merges, requests reviewers, archives, answers a question for you or wakes a resting agent on its own.
|
|
28
28
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
```sh
|
|
32
|
-
paseo plugin install npm:paseo-follow-up
|
|
33
|
-
```
|
|
29
|
+
## Requirements
|
|
34
30
|
|
|
35
31
|
You need Paseo 0.15 or later and Node 22+ on the machine Paseo runs on. A signed-in GitHub CLI there is optional and
|
|
36
32
|
turns on the PR features. Then open Follow-up in Paseo's sidebar: a two-minute setup walks you through the rest.
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ your attention instead. The work comes to you, in one place, ranked.
|
|
|
14
14
|
|
|
15
15
|
<img alt="Follow-up: Every agent, one inbox. Home lists every workspace by what it needs from you, with an agent's question and its lettered options open beside the list" src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/docs/screenshots/follow-up-slide-1-cover.png">
|
|
16
16
|
|
|
17
|
-
[](https://cdn.jsdelivr.net/gh/tomgrin10/paseo-follow-up@4b3fc08b7c8176d751c83c37ca471f61db4001ec/docs/screenshots/follow-up-demo-v2.mp4)
|
|
18
18
|
|
|
19
19
|
36 seconds: Home, Catch up, automatic follow-ups, the Overseer.
|
|
20
20
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { usePaseo } from "@getpaseo/plugin/client";
|
|
4
|
+
import { Text } from "./text";
|
|
5
|
+
import type { InboxStore } from "./inbox-store";
|
|
6
|
+
import { useInbox } from "./inbox";
|
|
7
|
+
import { AgentLines } from "./now-lines";
|
|
8
|
+
import { FoldButton, PANEL_FOLDS, useFold } from "./fold";
|
|
9
|
+
import { HintBubble, HintIcon, useHint } from "./hint";
|
|
10
|
+
import { ReplyBox } from "./home";
|
|
11
|
+
import { TurnView, useTurn } from "./turn-view";
|
|
12
|
+
import { useMarkTimelineOnScreen } from "./on-screen";
|
|
13
|
+
import { Spinner } from "./motion";
|
|
14
|
+
import { PrLinksProvider } from "./rich-text";
|
|
15
|
+
import { prLinksByNumber } from "../shared/presentation";
|
|
16
|
+
import { raised, runningColor } from "./theme";
|
|
17
|
+
import type { Theme } from "./kit";
|
|
18
|
+
import type { Workspace } from "../shared/model";
|
|
19
|
+
import type { InboxRow } from "../shared/inbox";
|
|
20
|
+
import { turnSource } from "../shared/turn";
|
|
21
|
+
|
|
22
|
+
/** Where the workspace view is mounted. Only two things differ by place: the head's own controls and the reply box. */
|
|
23
|
+
export type ViewPlace = "home" | "panel" | "tab";
|
|
24
|
+
|
|
25
|
+
const NO_INBOX = { subscribe: () => () => undefined, version: () => 0, rows: () => [] } as unknown as InboxStore;
|
|
26
|
+
const NO_ROWS: readonly InboxRow[] = [];
|
|
27
|
+
|
|
28
|
+
export const STEPS_HINT = "Live while shown. A resting agent's steps come from its saved transcript, so it is never woken.";
|
|
29
|
+
const HOME_REPLY_HINT = " Sending clears Needs you; Sign off & next moves on without a reply.";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The agent card (docs/client.md#the-workspace-view): one row per agent (client/now-lines.tsx), then Recent steps (the
|
|
33
|
+
* peek's rows, client/turn-view.tsx: the developer's messages, the agent's replies, steps grouped) and the reply box
|
|
34
|
+
* right under them, so reading and replying are one place. A row switches the steps and the box to its agent; Cmd/Ctrl
|
|
35
|
+
* opens its chat. Recent steps reads live while shown and an unloaded agent's saved transcript otherwise, never waking
|
|
36
|
+
* it (invariant 1). Its fold (the arrow on the Recent steps line) folds the steps and the box; the rows stay.
|
|
37
|
+
*
|
|
38
|
+
* The side panel (`place` "panel") sits beside the workspace's chat, so it never draws the reply box and its Recent
|
|
39
|
+
* steps start folded; the developer's own fold choice wins everywhere (invariant 132). Home's pane and the main tab mark
|
|
40
|
+
* the selected agent's timeline as on screen while its steps show, so its status-line peek stays shut.
|
|
41
|
+
*/
|
|
42
|
+
export function AgentCard({ workspace: w, inbox, theme, compact, steps, now, place, openAgent, onSent, reply }: {
|
|
43
|
+
workspace: Workspace; inbox?: InboxStore; theme: Theme; compact: boolean;
|
|
44
|
+
/** How many rows of steps the layout tier shows (shared/workspace-layout.ts). */
|
|
45
|
+
steps: number; now: number; place: ViewPlace;
|
|
46
|
+
openAgent?: (agentId: string) => void;
|
|
47
|
+
/** After a reply went out (Home refreshes its inbox rows). */
|
|
48
|
+
onSent?: () => void;
|
|
49
|
+
/** Draw the reply box under Recent steps: never in the side panel, and not on a phone's Home, whose dock has it. */
|
|
50
|
+
reply: boolean;
|
|
51
|
+
}) {
|
|
52
|
+
const c = theme.colors;
|
|
53
|
+
const rows = useInbox(inbox ?? NO_INBOX, () => inbox?.rows() ?? NO_ROWS);
|
|
54
|
+
const [selected, setSelected] = useState(w.mainAgentId);
|
|
55
|
+
// A new main agent (Make main agent, a claim) moves the card to it.
|
|
56
|
+
useEffect(() => { setSelected(w.mainAgentId); }, [w.mainAgentId]);
|
|
57
|
+
const name = selected === w.mainAgentId ? "the main agent" : rows.find(r => r.agentId === selected)?.title?.trim() || w.taskAgents?.[selected]?.title?.trim() || "the agent";
|
|
58
|
+
const pick = (agentId: string, chat: boolean) => { if (chat && openAgent) openAgent(agentId); else setSelected(agentId); };
|
|
59
|
+
const [hintOpen, setHintOpen] = useState(false);
|
|
60
|
+
return <View style={[{ marginHorizontal: compact ? 16 : 12, marginTop: 12, borderRadius: 8, overflow: hintOpen ? "visible" : "hidden", zIndex: hintOpen ? 30 : undefined, backgroundColor: c.surface0 }, raised(c)]}>
|
|
61
|
+
<AgentLines workspace={w} inbox={inbox} theme={theme} compact={compact} now={now} openAgent={openAgent} peek={place === "panel"} bare selected={selected} onSelect={pick} />
|
|
62
|
+
<View style={{ borderTopWidth: 1, borderTopColor: c.border }}>
|
|
63
|
+
<RecentSteps agentId={selected} name={name} theme={theme} compact={compact} steps={steps} place={place} reply={reply} prs={w.prs} onSent={onSent} onHint={setHintOpen} />
|
|
64
|
+
</View>
|
|
65
|
+
</View>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Recent steps for one agent, with its fold, its ? hint and (when `reply`) the reply box under it: the agent card's
|
|
70
|
+
* lower half, and on its own in Home's pane for a row with no workspace and for the Overseer. Never wakes the agent.
|
|
71
|
+
*/
|
|
72
|
+
export function RecentSteps({ agentId, name, theme, compact, steps, place, reply, prs = [], onSent, onHint, empty }: {
|
|
73
|
+
agentId: string | null; name: string; theme: Theme; compact: boolean; steps: number; place: ViewPlace; reply: boolean;
|
|
74
|
+
prs?: Workspace["prs"]; onSent?: () => void;
|
|
75
|
+
/** The ? hint opened or closed (the card lets it draw past its edge). */
|
|
76
|
+
onHint?: (open: boolean) => void;
|
|
77
|
+
/** What an empty turn says; the default points at the reply box or the chat. */
|
|
78
|
+
empty?: string;
|
|
79
|
+
}) {
|
|
80
|
+
const c = theme.colors;
|
|
81
|
+
const fold = useFold(PANEL_FOLDS.steps, place !== "panel");
|
|
82
|
+
const open = fold.open;
|
|
83
|
+
useMarkTimelineOnScreen(place !== "panel" && open ? agentId : null);
|
|
84
|
+
const turn = useTurn(agentId, open);
|
|
85
|
+
const paseo = usePaseo();
|
|
86
|
+
const [hintOpen, setHintOpen] = useState(false);
|
|
87
|
+
const help = useHint(next => { setHintOpen(next); onHint?.(next); });
|
|
88
|
+
const caption = turn.running ? "live" : turnSource(turn);
|
|
89
|
+
const hint = STEPS_HINT + (place === "home" && reply ? HOME_REPLY_HINT : "");
|
|
90
|
+
return <View style={{ zIndex: hintOpen ? 30 : undefined }}>
|
|
91
|
+
<View style={{ zIndex: hintOpen ? 30 : undefined, flexDirection: "row", alignItems: "center" }}>
|
|
92
|
+
<FoldButton open={open} onToggle={fold.toggle} label={caption ? `Recent steps, ${caption}` : "Recent steps"} theme={theme} chevron="end"
|
|
93
|
+
style={(hovered, pressed) => ({ flex: 1, minWidth: 0, flexDirection: "row", alignItems: "center", gap: 7, paddingHorizontal: compact ? 14 : 12, paddingVertical: 8, minHeight: compact ? 44 : undefined, backgroundColor: pressed ? c.surface2 : hovered ? c.surface1 : "transparent" })}>
|
|
94
|
+
<Text numberOfLines={1} style={{ flexShrink: 0, color: c.foreground, fontSize: compact ? 13 : 12, fontWeight: "600" }}>Recent steps</Text>
|
|
95
|
+
<HintIcon hint={help} text={hint} theme={theme} compact={compact} />
|
|
96
|
+
<View style={{ flex: 1, minWidth: 0, flexDirection: "row", justifyContent: "flex-end", alignItems: "center", gap: 5 }}>
|
|
97
|
+
{turn.running && <View style={{ width: 6, height: 6, borderRadius: 3, backgroundColor: runningColor(c) }} />}
|
|
98
|
+
{!!caption && <Text numberOfLines={1} style={{ flexShrink: 1, color: c.foregroundMuted, fontSize: 12 }}>{caption}</Text>}
|
|
99
|
+
</View>
|
|
100
|
+
</FoldButton>
|
|
101
|
+
<HintBubble hint={help} text={hint} theme={theme} />
|
|
102
|
+
</View>
|
|
103
|
+
{open && <View style={{ paddingHorizontal: compact ? 14 : 12, paddingBottom: reply ? 0 : 12, gap: 8 }}>
|
|
104
|
+
{turn.error ? <Text style={{ color: c.foregroundMuted, fontSize: 12 }}>{`Couldn't read the steps: ${turn.error}`}</Text>
|
|
105
|
+
: !agentId ? null
|
|
106
|
+
: !turn.turn ? <Spinner color={c.foregroundMuted} size={12} label="Reading the agent's steps" />
|
|
107
|
+
: turn.turn.empty ? <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{empty ?? (reply ? "No messages yet. Write to the agent below, or open its chat." : "No messages yet. Open its chat to write to it.")}</Text>
|
|
108
|
+
: <PrLinksProvider prs={prLinksByNumber(prs)}><TurnView turn={turn.turn} theme={theme} maxRows={steps} /></PrLinksProvider>}
|
|
109
|
+
</View>}
|
|
110
|
+
{open && reply && agentId && <ReplyBox theme={theme} compact={compact} agentName={name} hint={null} placeholder={`Reply to ${name}`} target={{ kind: "agent", agentId }}
|
|
111
|
+
onSend={async (text, images) => { await paseo.agents.ref(agentId).send(text, images?.length ? { images } : undefined); onSent?.(); }} />}
|
|
112
|
+
</View>;
|
|
113
|
+
}
|
package/client/brief-since.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { queueMoved } from "../shared/linear-queue";
|
|
1
2
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
3
|
import { PagedRows } from "./paged-list";
|
|
3
4
|
import { Platform, View } from "react-native";
|
|
@@ -120,7 +121,7 @@ export function SinceBlock({ theme, compact, openQueue, onStarted, navigation, r
|
|
|
120
121
|
const { view, error, reload } = useQueueView({ open: true });
|
|
121
122
|
// The home feed's queue revision moved (a sweep ended, or a dismissal): an open brief pane re-reads, no timer.
|
|
122
123
|
const seen = useRef(revision);
|
|
123
|
-
useEffect(() => {
|
|
124
|
+
useEffect(() => { const moved = queueMoved(seen.current, revision); seen.current = revision; if (moved) void reload(); }, [revision, reload]);
|
|
124
125
|
const actions = useActions();
|
|
125
126
|
if (error && !view) return <View style={{ gap: 4, marginTop: 6 }}>
|
|
126
127
|
<Text accessibilityRole="header" style={t.section}>Your Linear queue</Text>
|
package/client/brief.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import { Pressable, Text } from "./text";
|
|
|
5
5
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { openExternalUrl, useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
7
7
|
import { deliveryStatus } from "../shared/queue";
|
|
8
|
-
import { Icon,
|
|
9
|
-
import { BRIEF_KIND, briefCardAsk, BRIEF_VERSION, askedDecisions, cardPicks, notedCount, pickedCount, briefSchema, collapsedLine, outcomeLabel, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
8
|
+
import { Icon, copyText, useToast } from "@getpaseo/plugin/client/ui";
|
|
9
|
+
import { BRIEF_KIND, briefCardAsk, BRIEF_VERSION, askedDecisions, cardPicks, decisionQuestion, notedCount, pickedCount, briefSchema, collapsedLine, outcomeLabel, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId, answeredOutcome, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
10
10
|
import { needsYou } from "../shared/attention";
|
|
11
11
|
import { age, briefOutlived } from "../shared/inbox";
|
|
12
12
|
import { noReviewReposVersion, onNoReviewRepos } from "../shared/pr-workflow";
|
|
@@ -17,6 +17,7 @@ import { answerQuestionRpc, briefActionRpc, browserStatusRpc, inboxBriefRpc } fr
|
|
|
17
17
|
import { ImageField, useImageAttachments, type ImageAttachments } from "./image-attach";
|
|
18
18
|
import { errorText, mootNote } from "../shared/errors";
|
|
19
19
|
import { PRIMARY_FORM } from "./dock";
|
|
20
|
+
import { QuestionContextBlock } from "./question-context";
|
|
20
21
|
import { OTHER, OTHER_LABEL, OWN_ANSWER_HINT, briefAnswerStatus, isDoneOnly, isOpen, isOther, TASK_DONE, type Question } from "../shared/questions";
|
|
21
22
|
import type { ListQuestion, ListWorkspace } from "../shared/list";
|
|
22
23
|
import { useDetailGate, useWorkspace } from "./workspace-data";
|
|
@@ -30,6 +31,8 @@ import { PrSheet } from "./pr-sheet";
|
|
|
30
31
|
import { isLight, withAlpha, type Colors } from "./theme";
|
|
31
32
|
import { dismissToast, notice, runAction, runUndoable } from "./toasts";
|
|
32
33
|
import { DismissX, RevealScope, useDismiss } from "./dismiss";
|
|
34
|
+
import { clearPendingAnswer, confirmPendingAnswer, failPendingAnswer, markSentHere, setPendingAnswer } from "./pending-answers";
|
|
35
|
+
import { Field } from "./field";
|
|
33
36
|
|
|
34
37
|
/**
|
|
35
38
|
* The brief card (design §2): the ask in one line, decisions as option rows, only the context needed, and the one
|
|
@@ -48,6 +51,8 @@ export type BriefDeps = {
|
|
|
48
51
|
/** Done's Undo window, so the composer pill says Done (and its Undo cancels the same toast) until it ends. */
|
|
49
52
|
noteDone?(agentId: string, cancel: () => void): void;
|
|
50
53
|
endDone?(agentId: string): void;
|
|
54
|
+
/** answering-is-optimistic: the agent's inbox row reads as answered while the card's answer is on its way; returns the rollback. */
|
|
55
|
+
holdAnswered?(agentId: string): () => void;
|
|
51
56
|
};
|
|
52
57
|
|
|
53
58
|
const mono = () => (Platform.OS === "ios" ? "Menlo" : "ui-monospace, SFMono-Regular, Menlo, monospace");
|
|
@@ -164,7 +169,12 @@ export function NoteLink({ icon, label, a11y, disabled, onPress, c, compact }: {
|
|
|
164
169
|
* The card's body: decisions, error text, details, context, facts and links, and the agent's extra ask. Shared by the
|
|
165
170
|
* open card and by a past card's read-only "Show full question", so a past question reads exactly as it was asked.
|
|
166
171
|
*/
|
|
167
|
-
export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks, onPick, busy, onSend, words = {}, onWords, onSendOther, notes = {}, notesOpen = {}, onNote, onNoteOpen, doneIds = [], img }: {
|
|
172
|
+
export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks, onPick, busy, onSend, words = {}, onWords, onSendOther, notes = {}, notesOpen = {}, onNote, onNoteOpen, doneIds = [], img, workspace, openAgent }: {
|
|
173
|
+
/**
|
|
174
|
+
* The brief's workspace (list form): a decision that is a tracked question draws that question's context under it,
|
|
175
|
+
* as QuestionBody does (one-answer-flow-for-every-question). Absent: the card has only its own snapshot.
|
|
176
|
+
*/
|
|
177
|
+
workspace?: ListWorkspace; openAgent?: (agentId: string) => void;
|
|
168
178
|
/** The card's pasted images (one model for its answer and note fields). Absent: read-only copies. */
|
|
169
179
|
img?: ImageAttachments;
|
|
170
180
|
/** one-done-button: decisions answered by the card's Done button (an action card), drawn without option rows. */
|
|
@@ -194,6 +204,7 @@ export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks,
|
|
|
194
204
|
return <>
|
|
195
205
|
{b.decisions.map((d, i) => { const done = !readonly && doneIds.includes(d.id); return <View key={d.id} accessibilityRole={mode === "select" ? "radiogroup" : undefined} accessibilityLabel={mode === "select" ? d.question : undefined} style={{ gap: 8 }}>
|
|
196
206
|
{(numbered || d.question.trim() !== b.ask.trim()) && <RichText style={{ color: c.foreground, fontSize: 14, lineHeight: 20, fontWeight: numbered ? "600" : "400" }}>{`${numbered ? `${i + 1}. ` : ""}${d.question}`}</RichText>}
|
|
207
|
+
{(() => { const q = workspace ? decisionQuestion(b, d.id, workspace.questions) : null; return q && workspace ? <QuestionContextBlock workspace={workspace} question={q} theme={{ colors: c }} compact={compact} open={!readonly && isOpen(q)} openAgent={openAgent} /> : null; })()}
|
|
197
208
|
{d.options.length > 0 && <View style={{ gap: 6 }}>
|
|
198
209
|
{!done && d.options.map(o => <OptionRow key={o.letter} option={o} recommended={d.recommend === o.letter} mode={mode} answerLabel={answerLabel} selected={readonly ? d.chosen === o.letter : picks[d.id] === o.letter} answered={readonly && !!d.chosen}
|
|
199
210
|
sending={busy === `${d.id}:${o.letter}`} disabled={!!busy} tight={tight && !readonly} withNote={!!notesOpen[d.id] && !!notes[d.id]?.trim()}
|
|
@@ -205,7 +216,7 @@ export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks,
|
|
|
205
216
|
onPress={() => onPick(d.id, OTHER)} c={c} compact={compact} />}
|
|
206
217
|
{/* Something else's field with its Send answer, kept on screen together while typing (DockedPane). */}
|
|
207
218
|
{!readonly && isOther(picks[d.id]) && <View {...PRIMARY_FORM} style={{ gap: 8 }}>
|
|
208
|
-
<WithImages img={img} c={c} compact={compact} row={rowAt === d.id}><
|
|
219
|
+
<WithImages img={img} c={c} compact={compact} row={rowAt === d.id}><Field accessibilityLabel={`Your answer${numbered ? ` to question ${i + 1}` : ""}, required`} placeholder="Your answer (required)" placeholderTextColor={c.foregroundMuted} autoFocus multiline maxLength={2000}
|
|
209
220
|
value={words[d.id] ?? ""} editable={!busy} onChangeText={t => onWords?.(d.id, t)}
|
|
210
221
|
style={{ minHeight: compact ? 66 : 58, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 8, borderWidth: 1, borderColor: words[d.id]?.trim() ? c.border : withAlpha(c.accent, 0.7), color: c.foreground, backgroundColor: c.surface0, fontSize: 14, lineHeight: 20, textAlignVertical: "top" }} /></WithImages>
|
|
211
222
|
{mode === "send" && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10 }}>
|
|
@@ -216,7 +227,7 @@ export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks,
|
|
|
216
227
|
{/* A note on a lettered pick ("A, but…"): quiet until asked for, never in the way of the one-tap answer. */}
|
|
217
228
|
{!readonly && !isOther(picks[d.id]) && (notesOpen[d.id] ? <View {...PRIMARY_FORM} style={{ gap: 6, marginTop: 2 }}>
|
|
218
229
|
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontWeight: "600" }}>Note</Text>
|
|
219
|
-
<WithImages img={img} c={c} compact={compact} row={rowAt === d.id}><
|
|
230
|
+
<WithImages img={img} c={c} compact={compact} row={rowAt === d.id}><Field accessibilityLabel={`Note for the agent${numbered ? ` on decision ${i + 1}` : ""}, optional`} placeholder={mode === "select" ? "Sent with your pick for this decision" : "Sent with the option you tap"}
|
|
220
231
|
placeholderTextColor={c.foregroundMuted} autoFocus={focusNote === d.id} multiline maxLength={2000} value={notes[d.id] ?? ""} editable={!busy} onChangeText={t => onNote?.(d.id, t)}
|
|
221
232
|
style={{ minHeight: compact ? 66 : 58, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 8, borderWidth: 1, borderColor: c.border, color: c.foreground, backgroundColor: c.surface0, fontSize: 14, lineHeight: 20, textAlignVertical: "top" }} /></WithImages>
|
|
222
233
|
<NoteLink icon="X" label="Remove note" a11y={`Remove the note${numbered ? ` on decision ${i + 1}` : ""}`} disabled={!!busy} onPress={() => { onNote?.(d.id, ""); onNoteOpen?.(d.id, false); setFocusNote(null); }} c={c} compact={compact} />
|
|
@@ -275,6 +286,14 @@ function SendBar({ b, picks, noted = 0, busy, error, onSend, c, compact }: { b:
|
|
|
275
286
|
</View>;
|
|
276
287
|
}
|
|
277
288
|
|
|
289
|
+
/** Where the card's facts come from: the desktop footer, or on phones the line the header's ⓘ reveals under itself. */
|
|
290
|
+
function SourceLine({ b, c }: { b: Pick<Brief, "sourceLine">; c: Colors }) {
|
|
291
|
+
return <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
|
|
292
|
+
<View style={{ paddingTop: 2 }}><Icon name="Info" size={12} color={c.foregroundMuted} /></View>
|
|
293
|
+
<Text accessibilityLiveRegion="polite" style={{ flex: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.sourceLine}</Text>
|
|
294
|
+
</View>;
|
|
295
|
+
}
|
|
296
|
+
|
|
278
297
|
/** "Show full question" / "Show original": a past card opens back up, read-only. */
|
|
279
298
|
const CONTEXT_LINES = 4;
|
|
280
299
|
/**
|
|
@@ -296,7 +315,7 @@ function Reveal({ label, openLabel, open, onPress, c, compact }: { label: string
|
|
|
296
315
|
* A card that's no longer open keeps its question (1.4.0). Answered: the ask, each decision with what was picked, and
|
|
297
316
|
* "Show full question" opens the original read-only. Superseded or signed off: the one muted line, plus "Show original".
|
|
298
317
|
*/
|
|
299
|
-
function Past({ b, c, now, compact, height, pending = false, onResend, resending = false, questions = [] }: { b: Brief; c: Colors; now: number; compact: boolean; height: number; pending?: boolean; onResend?: () => void; resending?: boolean; questions?: readonly ListQuestion[] }) {
|
|
318
|
+
function Past({ b, c, now, compact, height, pending = false, onResend, resending = false, questions = [], workspace }: { workspace?: ListWorkspace; b: Brief; c: Colors; now: number; compact: boolean; height: number; pending?: boolean; onResend?: () => void; resending?: boolean; questions?: readonly ListQuestion[] }) {
|
|
300
319
|
const [expanded, setExpanded] = useState(false);
|
|
301
320
|
const answered = b.state === "answered";
|
|
302
321
|
// Its questions' answers as every surface reads them (briefAnswerStatus): copied or in the message box is "not sent
|
|
@@ -325,7 +344,7 @@ function Past({ b, c, now, compact, height, pending = false, onResend, resending
|
|
|
325
344
|
{onResend && delivery.action && <Btn label={resending ? "Sending…" : delivery.action === "retry" ? "Retry" : "Try now"} icon="RotateCcw" primary={delivery.action === "retry"} onPress={onResend} disabled={resending} c={c} compact={compact} hint={delivery.action === "retry" ? "Sends the same answer again" : "Tries sending it now"} />}
|
|
326
345
|
</View>;
|
|
327
346
|
const body = expanded && <View style={{ gap: 10, paddingTop: 4 }}>
|
|
328
|
-
<BriefBody b={b} c={c} compact={compact} tight={false} embedded height={height} mode="readonly" picks={{}} onPick={() => undefined} busy={null} />
|
|
347
|
+
<BriefBody b={b} c={c} compact={compact} tight={false} embedded height={height} mode="readonly" picks={{}} onPick={() => undefined} busy={null} workspace={workspace} />
|
|
329
348
|
</View>;
|
|
330
349
|
if (!picked) return <View accessibilityLiveRegion="polite" accessibilityLabel={spoken} style={{ marginVertical: 10, gap: 6, paddingVertical: 8, paddingHorizontal: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border }}>
|
|
331
350
|
<View style={{ flexDirection: "row", gap: 10, alignItems: answered ? "flex-start" : "center", minHeight: 24 }}>
|
|
@@ -415,6 +434,8 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
415
434
|
const [marked, setMarked] = useState<string | null>(null);
|
|
416
435
|
// The send landed: green at once, before the server's answered brief replaces the card.
|
|
417
436
|
const [sent, setSent] = useState(false);
|
|
437
|
+
// A brief-only decision answered from this card: drawn answered at once, until the server's answered brief replaces it.
|
|
438
|
+
const [answering, setAnswering] = useState<Brief | null>(null);
|
|
418
439
|
const dismiss = useDismiss();
|
|
419
440
|
const picks = usePicks(b.id);
|
|
420
441
|
const words = useWords(b.id);
|
|
@@ -434,9 +455,10 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
434
455
|
// An add-reviewers card for a PR the agent merges itself isn't an ask: gone the moment the repository flips to No
|
|
435
456
|
// review, back on Undo (invariant a-no-review-repo-never-asks-for-review-or-merge).
|
|
436
457
|
if (b.state === "open" && !liveBrief(b)) return null;
|
|
437
|
-
if (shown.brief.state !== "open") return <Past b={shown.brief} c={c} now={now} compact={compact} height={height} onResend={b.answerId ? resend : undefined} resending={sending === "resend"} questions={workspace?.questions} />;
|
|
458
|
+
if (shown.brief.state !== "open") return <Past b={shown.brief} c={c} now={now} compact={compact} height={height} onResend={b.answerId ? resend : undefined} resending={sending === "resend"} questions={workspace?.questions} workspace={workspace} />;
|
|
438
459
|
// Muted until the send lands: the server's answered brief then replaces this, green.
|
|
439
460
|
if (marked) return <Past b={{ ...b, state: "answered", outcome: "Done", outcomeAt: marked }} pending={!sent} c={c} now={now} compact={compact} height={height} />;
|
|
461
|
+
if (answering) return <Past b={answering} c={c} now={now} compact={compact} height={height} questions={workspace?.questions} />;
|
|
440
462
|
|
|
441
463
|
const attention = c.statusWarning;
|
|
442
464
|
const flaggedAct = b.flagged && ACTS.includes(b.kind);
|
|
@@ -468,11 +490,17 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
468
490
|
if (busy || marked) return;
|
|
469
491
|
setError(null); setSent(false); setMarked(new Date().toISOString());
|
|
470
492
|
const doneId = newAnswerId();
|
|
471
|
-
|
|
493
|
+
// answering-is-optimistic: the action card it answers reads as answered everywhere from the click; Undo (nothing
|
|
494
|
+
// sent) or a failure brings it back.
|
|
495
|
+
const words = doneQ && notesOpen[doneQ.id] && notes[doneQ.id]?.trim() ? notes[doneQ.id].trim() : undefined;
|
|
496
|
+
const card = doneQ && workspace ? { wid: workspace.id, qid: doneQ.id } : null;
|
|
497
|
+
if (card) { setPendingAnswer(card.wid, card.qid, { choice: TASK_DONE.letter, words }); markSentHere(card.wid, card.qid); }
|
|
498
|
+
const undone = () => { setMarked(null); if (card) clearPendingAnswer(card.wid, card.qid); };
|
|
499
|
+
const id = runUndoable("Telling the agent it's done", { label: "Done", toast, run: async (): Promise<unknown> => card ? answerQuestion({ workspaceId: card.wid, questionId: card.qid, choice: TASK_DONE.letter, ...(words ? { words } : {}), ...withImages(), action: "send" })
|
|
472
500
|
: act({ agentId, briefId: b.id, move: "done", answerId: doneId }), success: "Marked done. The agent has it.",
|
|
473
|
-
failure: "Done not sent", open: () => deps.openAgent(agentId), onSuccess: () => setSent(true), onError: e => {
|
|
501
|
+
failure: "Done not sent", open: () => deps.openAgent(agentId), onSuccess: () => { setSent(true); if (card) confirmPendingAnswer(card.wid, card.qid); }, onError: e => { undone(); setError(errorText(e)); }, reconcile: e => { undone(); reconcile(e); } }, undone, `done:${b.id}`, () => deps.endDone?.(agentId));
|
|
474
502
|
// The pill's Undo is this toast's Undo: it closes the toast (so nothing is sent) and reopens the card.
|
|
475
|
-
if (id !== null) deps.noteDone?.(agentId, () => { dismissToast(id);
|
|
503
|
+
if (id !== null) deps.noteDone?.(agentId, () => { dismissToast(id); undone(); });
|
|
476
504
|
};
|
|
477
505
|
// A merge move reads what its click merges ("Merge 3 PRs"), then "Merging…".
|
|
478
506
|
// An add-reviewers move that names whom it asks reads "Add reviewers", "Requesting…", then "Requested"
|
|
@@ -540,15 +568,38 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
540
568
|
// (briefQuestionsEvent). Only a decision with no tracked question goes through the brief's own action.
|
|
541
569
|
type DecisionPick = { decisionId: string; choice: string; words?: string };
|
|
542
570
|
const asQuestions = (list: DecisionPick[]) => !!workspace && list.length > 0 && list.every(x => b.questionIds.includes(x.decisionId) && workspace.questions.some(q => q.id === x.decisionId && !q.answer && !q.closed));
|
|
571
|
+
/**
|
|
572
|
+
* answering-is-optimistic: the card reads as answered the moment Send is pressed, and so does every other surface. A
|
|
573
|
+
* decision backed by a question goes in flight like any question answer (pending-answers: the overlaid workspace
|
|
574
|
+
* answers it, so this card's shownBrief resolves too); a brief-only decision is answered here (`answering`) and its
|
|
575
|
+
* inbox row is held as answered (`holdAnswered`). A failure lets both go: the card is back with its picks, words and
|
|
576
|
+
* images (cleared only once the server has them), the reason under it, and the toast's Retry.
|
|
577
|
+
*/
|
|
543
578
|
const answer = async (list: DecisionPick[], answerId: string) => {
|
|
544
579
|
// The field already says why (before Send); a key or a bar's Send can't get past it either.
|
|
545
580
|
if (img.blocked) throw new Error(img.blocked);
|
|
546
581
|
const images = withImages();
|
|
547
|
-
if (!asQuestions(list)) {
|
|
548
|
-
|
|
549
|
-
|
|
582
|
+
if (!asQuestions(list)) {
|
|
583
|
+
const chosen = new Map(list.map(x => [x.decisionId, x]));
|
|
584
|
+
const decisions = b.decisions.map(d => chosen.has(d.id) ? { ...d, chosen: chosen.get(d.id)!.choice, words: chosen.get(d.id)!.words ?? null } : d);
|
|
585
|
+
setAnswering({ ...b, state: "answered", decisions, outcome: answeredOutcome(decisions), outcomeAt: new Date().toISOString(), delivery: { state: "sending", error: null } });
|
|
586
|
+
const release = deps.holdAnswered?.(agentId);
|
|
587
|
+
try { const out = await act({ agentId, briefId: b.id, answerId, ...(list.length === 1 ? list[0] : { choices: list }), ...images }); img.clear(); return out; }
|
|
588
|
+
catch (e) { setAnswering(null); release?.(); throw e; }
|
|
589
|
+
}
|
|
590
|
+
const wid = workspace!.id;
|
|
591
|
+
for (const x of list) { setPendingAnswer(wid, x.decisionId, { choice: x.choice, words: x.words }); markSentHere(wid, x.decisionId); }
|
|
592
|
+
try {
|
|
593
|
+
// The images ride the first answer's message: one message to the agent carries them once.
|
|
594
|
+
for (const [i, x] of list.entries()) { await answerQuestion({ workspaceId: wid, questionId: x.decisionId, choice: x.choice, ...(x.words ? { words: x.words } : {}), ...(i === 0 ? images : {}), action: "send" }); confirmPendingAnswer(wid, x.decisionId); }
|
|
595
|
+
} catch (e) {
|
|
596
|
+
// The questions are open again on every surface, each with what was picked and "Not sent · Retry"; this card
|
|
597
|
+
// carries the reason too, with its picks and words (cleared only on success).
|
|
598
|
+
for (const x of list) failPendingAnswer(wid, x.decisionId, errorText(e));
|
|
599
|
+
throw e;
|
|
600
|
+
}
|
|
550
601
|
img.clear();
|
|
551
|
-
void cache.invalidateQueries({ queryKey: liveBriefKey(agentId) }); void cache.invalidateQueries({ queryKey: workspaceKey(
|
|
602
|
+
void cache.invalidateQueries({ queryKey: liveBriefKey(agentId) }); void cache.invalidateQueries({ queryKey: workspaceKey(wid) });
|
|
552
603
|
};
|
|
553
604
|
// A tap sends the letter, with the note when one is typed; a sent answer clears the card (clearCard).
|
|
554
605
|
const sendOne = (key: string) => { const [decisionId, choice] = key.split(":"); void run(key, async answerId => { await answer(cardPicks({ [decisionId]: choice }, {}, notesOpen[decisionId] ? notes : {}), answerId); clearCard(b.id); }); };
|
|
@@ -581,6 +632,9 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
581
632
|
{/* The x is always the card's last control, in its top-right corner, on every Needs-you item. */}
|
|
582
633
|
{x}
|
|
583
634
|
</View>
|
|
635
|
+
{/* A disclosure shows what it reveals next to itself (a-disclosure-reveals-beside-itself): on phones the ⓘ's
|
|
636
|
+
line is the element right after the header row, never the footer, which a tall card puts off screen. */}
|
|
637
|
+
{compact && why && <SourceLine b={b} c={c} />}
|
|
584
638
|
{/* The ask role on phones (react-native-web ignores hitSlop, so the ⓘ above is a real 44 box); desktop keeps 19/26. */}
|
|
585
639
|
{/* Bare: a section of the Needs you block, so the same size as its question titles. */}
|
|
586
640
|
<RichText accessibilityRole="header" style={compact || bare ? text(c, compact).ask : { color: c.foreground, fontSize: 19, lineHeight: 26, fontWeight: "600", letterSpacing: -0.2 }}>{askText}</RichText>
|
|
@@ -589,7 +643,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
589
643
|
<BriefBody b={b} c={c} compact={compact} tight={tight} embedded={embedded} height={height} mode={multi ? "select" : "send"} picks={picks}
|
|
590
644
|
onPick={(decisionId, letter) => { if (!busy) pickStore.set(b.id, decisionId, letter); }} busy={busy} onSend={sendOne}
|
|
591
645
|
words={words} onWords={(decisionId, t) => wordStore.set(b.id, decisionId, t)} onSendOther={sendOther}
|
|
592
|
-
notes={notes} notesOpen={notesOpen} onNote={(decisionId, t) => noteStore.set(b.id, decisionId, t)} onNoteOpen={(decisionId, open) => noteOpenStore.set(b.id, decisionId, open ? "1" : "")} doneIds={doneQ ? [doneQ.id] : []} img={img} />
|
|
646
|
+
notes={notes} notesOpen={notesOpen} onNote={(decisionId, t) => noteStore.set(b.id, decisionId, t)} onNoteOpen={(decisionId, open) => noteOpenStore.set(b.id, decisionId, open ? "1" : "")} doneIds={doneQ ? [doneQ.id] : []} img={img} workspace={workspace} openAgent={deps.openAgent} />
|
|
593
647
|
|
|
594
648
|
{multi && <SendBar b={b} picks={sendable} noted={notedCount(sendable, openNotes)} busy={busy} error={error} onSend={sendAll} c={c} compact={compact} />}
|
|
595
649
|
|
|
@@ -608,10 +662,8 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
|
|
|
608
662
|
{!tight && !!b.also.context && <RichText linkColor={c.foreground} numberOfLines={3} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{b.also.context}</RichText>}
|
|
609
663
|
</View>}
|
|
610
664
|
</SubmitScope>
|
|
611
|
-
{
|
|
612
|
-
|
|
613
|
-
<Text style={{ flex: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.sourceLine}</Text>
|
|
614
|
-
</View>}
|
|
665
|
+
{/* Desktop: where the card's facts come from is its footer, always shown. */}
|
|
666
|
+
{!compact && <View style={{ borderTopWidth: 1, borderTopColor: c.border, paddingHorizontal: pad, paddingVertical: 8 }}><SourceLine b={b} c={c} /></View>}
|
|
615
667
|
{detail.workspace && sheet && <PrSheet workspace={detail.workspace} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
|
|
616
668
|
</RevealScope>;
|
|
617
669
|
}
|
package/client/catch-up.tsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { floatingScopes } from "../shared/floating";
|
|
2
|
+
import { FloatingSurface } from "./floating-surface";
|
|
1
3
|
// Catch up: everything in Needs you, one card at a time (docs/design/catch-up.md, docs/needs-you.md#catch-up). It
|
|
2
4
|
// renders the same components the panel and Home use (QuestionBody, NeedsYouList, BriefCard, the permission block), so
|
|
3
5
|
// the answer flow is the shared one, never a fork (one-answer-flow-for-every-question). The deck's order and every
|
|
@@ -7,7 +9,7 @@ import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactN
|
|
|
7
9
|
import { Animated, PanResponder, Platform, View } from "react-native";
|
|
8
10
|
import { Pressable, Text } from "./text";
|
|
9
11
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
10
|
-
import { Icon, ScrollView
|
|
12
|
+
import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
|
|
11
13
|
import { ImageField, useImageAttachments } from "./image-attach";
|
|
12
14
|
import type { ImageUpload } from "../shared/images";
|
|
13
15
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -42,6 +44,7 @@ import { PRIMARY_FORM } from "./dock";
|
|
|
42
44
|
import { MorePanel, MoveResult, ContextAnswer } from "./more-context";
|
|
43
45
|
import { AnswerActions, AnswerView, ReplyForm, useQuestionActs } from "./your-questions";
|
|
44
46
|
import { questionLine, questionsByWorkspace } from "../shared/your-questions";
|
|
47
|
+
import { Field } from "./field";
|
|
45
48
|
|
|
46
49
|
export { MorePanel, MoveResult, ContextAnswer };
|
|
47
50
|
|
|
@@ -164,18 +167,20 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
164
167
|
if (!doc || typeof win.addEventListener !== "function") return;
|
|
165
168
|
const mac = isMac();
|
|
166
169
|
const root = () => rootRef.current as unknown as Root | null;
|
|
167
|
-
const
|
|
170
|
+
const scopes = () => { const r = root(); return r ? floatingScopes(r, doc) : []; };
|
|
171
|
+
const inCard = (q: string) => scopes().map(r => r.querySelector(`[data-catch-up-card] ${q}`)).find(Boolean) ?? null;
|
|
168
172
|
const railItems = () => Array.from(root()?.querySelectorAll("[data-catch-up-rail] [role=\"button\"]") ?? []);
|
|
169
173
|
const onKey = (e: Ev) => {
|
|
170
174
|
const el = e.target as El | null;
|
|
171
175
|
const r = root();
|
|
172
176
|
const onBody = !el || el === doc.body;
|
|
173
|
-
if (!r || !ownsKey({ inside: !!el &&
|
|
177
|
+
if (!r || !ownsKey({ inside: !!el && scopes().some(s => s.contains(el)), onBody, claimBody: true, visible: onBody && surfaceVisible(r, doc) })) return;
|
|
174
178
|
const typing = !!el && (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || !!el.isContentEditable);
|
|
175
179
|
const hit = catchUpKey({ key: e.key, meta: e.metaKey, ctrl: e.ctrlKey, alt: e.altKey, shift: e.shiftKey, composing: e.isComposing, mac },
|
|
176
180
|
{ typing, inMore: !!el?.closest?.("[data-catch-up-more]"), moreOpen: more, inRail: !!el?.closest?.("[data-catch-up-rail]"), answer: card?.kind === "answer" });
|
|
177
181
|
if (!hit || finished && !["back", "keys", "leave", "rail"].includes(hit.action)) return;
|
|
178
|
-
const
|
|
182
|
+
const query = (q: string) => scopes().map(s => s.querySelector(q)).find(Boolean) ?? null;
|
|
183
|
+
const click = (q: string) => { const b = query(q); b?.click?.(); return !!b; };
|
|
179
184
|
switch (hit.action) {
|
|
180
185
|
case "skip": skip(); break;
|
|
181
186
|
case "skip-workspace": if (wsLeft < 2) return; skipWs(); break;
|
|
@@ -211,7 +216,7 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
211
216
|
case "done": if (!click('[data-catch-up-card] [aria-label="Done (D)"]')) return; break;
|
|
212
217
|
case "reply": if (!click('[data-catch-up-card] [aria-label="Reply (W)"]')) return; break;
|
|
213
218
|
case "task": if (!click('[data-catch-up-card] [aria-label="Make a task (T)"]')) return; break;
|
|
214
|
-
case "chip":
|
|
219
|
+
case "chip": scopes().flatMap(s => Array.from(s.querySelectorAll("[data-catch-up-more] [role=\"radio\"]")))[Number(hit.arg) - 1]?.click?.(); break;
|
|
215
220
|
case "ask": if (!click('[data-catch-up-more] [data-ask-agent] [role="button"]')) return; break;
|
|
216
221
|
case "rail": {
|
|
217
222
|
const items = railItems();
|
|
@@ -481,7 +486,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
481
486
|
</View>;
|
|
482
487
|
const toggleMore = () => { setLaterOpen(false); setMore(v => !v); };
|
|
483
488
|
const toggleLater = () => { setMore(false); setLaterOpen(v => !v); };
|
|
484
|
-
const popover = (open: ReactNode, label: string, width: number) => open && <MoveResult place="popover" theme={theme} label={label} width={width}>{open}</MoveResult>;
|
|
489
|
+
const popover = (open: ReactNode, label: string, width: number) => open && <MoveResult place="popover" theme={theme} label={label} width={width} onClose={() => { setMore(false); setLaterOpen(false); }}>{open}</MoveResult>;
|
|
485
490
|
|
|
486
491
|
// The deck's moves: in thumb reach on phones, under the card on desktop. Once the card has an answer to send, Send to
|
|
487
492
|
// agent takes the bar's primary slot: the question's own Send (onSendReady), so one click, one flow. Icon-only moves
|
|
@@ -573,6 +578,14 @@ export type KeySection = { title: string; keys: readonly { key: string; what: st
|
|
|
573
578
|
* over the screen; S or its X closes it.
|
|
574
579
|
*/
|
|
575
580
|
export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: given, keyWidth = 64 }: { theme: Theme; onClose: () => void; label?: string; sections?: readonly KeySection[]; /** The key column, wide enough for the list's longest key so every description lines up. */ keyWidth?: number }) {
|
|
581
|
+
useEffect(() => {
|
|
582
|
+
if (Platform.OS !== "web") return;
|
|
583
|
+
type Key = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; preventDefault(): void; stopPropagation(): void };
|
|
584
|
+
const win = globalThis as unknown as { addEventListener?(t: string, f: (e: Key) => void): void; removeEventListener?(t: string, f: (e: Key) => void): void };
|
|
585
|
+
const key = (e: Key) => { if (e.key.toLowerCase() === "s" && !e.metaKey && !e.ctrlKey && !e.altKey) { e.preventDefault(); e.stopPropagation(); onClose(); } };
|
|
586
|
+
win.addEventListener?.("keydown", key);
|
|
587
|
+
return () => win.removeEventListener?.("keydown", key);
|
|
588
|
+
}, [onClose]);
|
|
576
589
|
const dictation = !!hostDictation();
|
|
577
590
|
const sections = given ?? catchUpSections(dictation);
|
|
578
591
|
const c = theme.colors; const t = text(c, false);
|
|
@@ -580,7 +593,7 @@ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: g
|
|
|
580
593
|
<View style={{ width: keyWidth }}><Text style={[t.meta, { alignSelf: "flex-start", paddingHorizontal: 6, borderRadius: 4, borderWidth: 1, borderColor: c.border, color: c.foreground, fontVariant: ["tabular-nums"] }]}>{keyLabel(k.key, isMac())}</Text></View>
|
|
581
594
|
<Text style={[t.meta, { flex: 1, minWidth: 0 }]}>{k.what}</Text>
|
|
582
595
|
</View>;
|
|
583
|
-
return <
|
|
596
|
+
return <FloatingSurface modal={false} side="top-right" label={label} width={236 + keyWidth} onClose={onClose} style={{ padding: 16, gap: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12 }}>
|
|
584
597
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
585
598
|
<Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
|
|
586
599
|
<IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
|
|
@@ -588,7 +601,7 @@ export function KeysSheet({ theme, onClose, label = "Catch up keys", sections: g
|
|
|
588
601
|
{sections.filter(s => s.keys.length).map(s => <View key={s.title} style={{ gap: 6 }}>
|
|
589
602
|
<Text style={[t.small, { fontWeight: "600" }]}>{s.title}</Text>{s.keys.map(row)}
|
|
590
603
|
</View>)}
|
|
591
|
-
</
|
|
604
|
+
</FloatingSurface>;
|
|
592
605
|
}
|
|
593
606
|
/** Catch up's sheet: the dictation key only where the host has a mic. */
|
|
594
607
|
const catchUpSections = (dictation: boolean): readonly KeySection[] => [
|
|
@@ -628,7 +641,7 @@ function NoteRow({ theme, compact, agentId }: { theme: Theme; compact: boolean;
|
|
|
628
641
|
void agent.handle?.send(words.trim(), images ? { images } : undefined); setWords(""); img.clear();
|
|
629
642
|
};
|
|
630
643
|
return <ImageField model={img} theme={theme} compact={compact}><View {...PRIMARY_FORM} style={{ flexDirection: "row", alignItems: "flex-end", gap: 8 }}>
|
|
631
|
-
<
|
|
644
|
+
<Field accessibilityLabel="Tell the agent something" placeholder="Tell the agent something" placeholderTextColor={c.foregroundMuted} value={words} onChangeText={setWords} multiline
|
|
632
645
|
style={{ flex: 1, minHeight: compact ? 44 : 36, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, backgroundColor: c.surface0 }} />
|
|
633
646
|
<IconButton theme={theme} compact={compact} icon="Send" label="Send to the agent" tooltip={!compact} disabled={!words.trim() || !!img.blocked} onPress={send} />
|
|
634
647
|
</View></ImageField>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from "react";
|
|
2
|
-
import { ActivityIndicator,
|
|
2
|
+
import { ActivityIndicator, View } from "react-native";
|
|
3
3
|
import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
|
|
4
4
|
import { Icon, SettingsSection, SettingsSelect, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
5
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
} from "../shared/compass";
|
|
15
15
|
import { type PlanView } from "../shared/morning-brief";
|
|
16
16
|
import { NEW_NAME, NEW_OF } from "../shared/new-name";
|
|
17
|
+
import { Field } from "./field";
|
|
17
18
|
|
|
18
19
|
export const compassKey = ["follow-up", "compass"];
|
|
19
20
|
|
|
@@ -353,13 +354,13 @@ function SourceEditor({ view, source, first, busy, onSave, onCancel, onRemove, t
|
|
|
353
354
|
</View>
|
|
354
355
|
{!ruled && <View style={{ gap: 6 }}>
|
|
355
356
|
<Text style={[t.meta, { color: c.foreground, fontWeight: "600" }]}>How to read this</Text>
|
|
356
|
-
<
|
|
357
|
+
<Field accessibilityLabel="How to read this source" multiline value={notes} onChangeText={v => setNotes(v.slice(0, COMPASS.sourceInstructions))} placeholder={kind === "doc" ? "Lines under 'This week' are the plan. A line starting with ! is urgent." : "P0 means today, P1 this week. Ignore hiring talk."}
|
|
357
358
|
placeholderTextColor={c.foregroundMuted} style={{ minHeight: 64, padding: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0, textAlignVertical: "top" }} />
|
|
358
359
|
<Text style={t.meta}>{`Your words for the model that reads it. They change how it is read, never what is read. ${notes.length}/${COMPASS.sourceInstructions}`}</Text>
|
|
359
360
|
</View>}
|
|
360
361
|
<View style={row}>
|
|
361
362
|
{labelCol("Name")}
|
|
362
|
-
<
|
|
363
|
+
<Field accessibilityLabel="Source name" value={label} onChangeText={setLabel} placeholder={kind === "tracker" ? "priority/high" : kind === "doc" ? "Now" : kind === "calendar" ? "Calendar deadlines" : "Dana · product"} placeholderTextColor={c.foregroundMuted}
|
|
363
364
|
style={{ flex: 1, minWidth: 160, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0 }} />
|
|
364
365
|
</View>
|
|
365
366
|
<View style={[row, { justifyContent: "space-between" }]}>
|
|
@@ -400,7 +401,7 @@ function FindPicker({ kind, onPick, onCancel, theme, compact }: { kind: FindKind
|
|
|
400
401
|
return <SubmitScope enabled={file && q.trim().length >= 2} onSubmit={() => setDebounced(q.trim())} style={{ borderWidth: 1, borderColor: c.border, borderRadius: 8, backgroundColor: c.surface0, overflow: "hidden" }}>
|
|
401
402
|
<View style={{ flexDirection: "row", gap: 8, padding: 8, alignItems: "center" }}>
|
|
402
403
|
{auto ? <Text style={[t.meta, { flex: 1 }]}>{results.isFetching ? "Looking…" : "The calendars your calendar tool lists"}</Text>
|
|
403
|
-
: <
|
|
404
|
+
: <Field autoFocus accessibilityLabel={copy.label} value={q} onChangeText={setQ} placeholder={copy.placeholder}
|
|
404
405
|
placeholderTextColor={c.foregroundMuted} autoCapitalize="none" autoCorrect={false}
|
|
405
406
|
style={{ flex: 1, minWidth: 0, minHeight: compact ? 44 : 32, paddingHorizontal: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface1, ...(file && q ? { fontFamily: "ui-monospace, Menlo, monospace" } : {}) }} />}
|
|
406
407
|
{file && <Button title="Check" theme={theme} compact={compact} disabled={q.trim().length < 2} loading={results.isFetching} onPress={() => setDebounced(q.trim())} />}
|
|
@@ -425,7 +426,7 @@ function ReadingNotes({ value, busy, onSave, theme, compact }: { value: string;
|
|
|
425
426
|
useEffect(() => setDraft(value), [value]);
|
|
426
427
|
const dirty = draft.trim() !== value.trim();
|
|
427
428
|
return <SubmitScope enabled={dirty && !busy} onSubmit={() => onSave(draft)} style={{ gap: 6 }}>
|
|
428
|
-
<
|
|
429
|
+
<Field accessibilityLabel="How to read your Compass" multiline value={draft} onChangeText={v => setDraft(v.slice(0, COMPASS.instructions))} placeholder="P0 means today. 'The renewal' is the acme renewal. Customer asks wait for the plan unless they name a date."
|
|
429
430
|
placeholderTextColor={c.foregroundMuted} style={{ minHeight: 72, padding: 10, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, fontSize: 13, backgroundColor: c.surface0, textAlignVertical: "top" }} />
|
|
430
431
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
|
|
431
432
|
<Text style={[t.meta, { flex: 1, minWidth: 180 }]}>{`For every source. ${draft.length}/${COMPASS.instructions}`}</Text>
|
|
@@ -454,9 +455,9 @@ function Glossary({ entries, busy, onSave, theme, compact }: { entries: Glossary
|
|
|
454
455
|
</Pressable>
|
|
455
456
|
</View>)}
|
|
456
457
|
{entries.length < COMPASS.glossary && <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
|
|
457
|
-
<
|
|
458
|
+
<Field accessibilityLabel="Word" value={words} onChangeText={setWords} placeholder="Phoenix" placeholderTextColor={c.foregroundMuted} style={[field, { flexGrow: 1, flexBasis: 120, minWidth: 0 }]} />
|
|
458
459
|
<Icon name="ArrowRight" size={12} color={c.foregroundMuted} />
|
|
459
|
-
<
|
|
460
|
+
<Field accessibilityLabel="Issue key" value={key} onChangeText={setKey} placeholder="ACME-40" autoCapitalize="characters" placeholderTextColor={c.foregroundMuted} style={[field, { flexGrow: 1, flexBasis: 100, minWidth: 0, fontFamily: "ui-monospace, Menlo, monospace" }]} />
|
|
460
461
|
<Button title="Add" icon="Plus" theme={theme} compact={compact} loading={busy} disabled={words.trim().length < 2 || key.trim().length < 3} onPress={add} />
|
|
461
462
|
</View>}
|
|
462
463
|
</View>;
|
package/client/display.tsx
CHANGED
|
@@ -8,7 +8,8 @@ import { isMac, searchShortcutOf, searchShortcutOptions, type SearchShortcut , i
|
|
|
8
8
|
import { useEffect } from "react";
|
|
9
9
|
import { ActivityIndicator, Platform, View } from "react-native";
|
|
10
10
|
import { Text } from "./text";
|
|
11
|
-
import {
|
|
11
|
+
import { sharedRead } from "./shared-read";
|
|
12
|
+
import { DEFAULT_OPEN_WORKSPACE_ON, displayPreferences, displayRpc, trustCountText, type OpenWorkspaceOn } from "../shared/display";
|
|
12
13
|
import { sidebarVisibility } from "./sidebar-visibility";
|
|
13
14
|
import { appVisible, onVisible } from "./visibility";
|
|
14
15
|
import { NEW_NAME } from "../shared/new-name";
|
|
@@ -16,6 +17,10 @@ import { NEW_NAME } from "../shared/new-name";
|
|
|
16
17
|
type Display = import("zod").infer<typeof displayPreferences.schema>;
|
|
17
18
|
const listeners = new Set<(values: Display) => void>();
|
|
18
19
|
export function subscribeDisplay(listener: (values: Display) => void) { listeners.add(listener); return () => { listeners.delete(listener); }; }
|
|
20
|
+
/** The last Display values this client read (null until the first read): for choices made on a click, like where to open a workspace. */
|
|
21
|
+
let latest: Display | null = null;
|
|
22
|
+
listeners.add(values => { latest = values; });
|
|
23
|
+
export const displayValues = (): Display | null => latest;
|
|
19
24
|
|
|
20
25
|
/** R2's measurement, where it's cheap to look: how often agents stated what they need on a flagged turn. */
|
|
21
26
|
export function briefShareText(stats: { days: number; total: number; tool: number; structured: number; fallback: number } | undefined): string {
|
|
@@ -99,6 +104,13 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
99
104
|
</SettingsCard>
|
|
100
105
|
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
|
|
101
106
|
</SettingsSection>
|
|
107
|
+
<SettingsSection title="Opening a workspace" info="From Follow-up's sidebar list and Home's Open. Cmd or Ctrl-click opens the other one.">
|
|
108
|
+
<SettingsCard>
|
|
109
|
+
<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."
|
|
110
|
+
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}
|
|
111
|
+
onValueChange={(open_workspace_on: OpenWorkspaceOn) => save({ open_workspace_on })} />
|
|
112
|
+
</SettingsCard>
|
|
113
|
+
</SettingsSection>
|
|
102
114
|
{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.">
|
|
103
115
|
<SettingsCard>
|
|
104
116
|
<SettingsSelect label="Search from anywhere" hint="Jumps to Home's search from any screen, even mid-message. On Home, / works too."
|
|
@@ -138,7 +150,7 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
|
|
|
138
150
|
pending = true;
|
|
139
151
|
const currentGeneration = generation;
|
|
140
152
|
try {
|
|
141
|
-
const result = await client.rpc(displayRpc.read, {});
|
|
153
|
+
const result = await sharedRead("settings.display.read", () => client.rpc(displayRpc.read, {}));
|
|
142
154
|
if (generation === currentGeneration) apply(result);
|
|
143
155
|
} catch {
|
|
144
156
|
// Retain the last valid preference through temporary disconnects.
|