paseo-follow-up 2.6.0-beta.3 → 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.
Files changed (115) hide show
  1. package/README.md +1 -1
  2. package/client/agent-card.tsx +113 -0
  3. package/client/brief-since.tsx +2 -1
  4. package/client/brief.tsx +72 -20
  5. package/client/catch-up.tsx +3 -2
  6. package/client/compass-settings.tsx +8 -7
  7. package/client/display.tsx +14 -2
  8. package/client/dock.ts +31 -0
  9. package/client/docked-pane.tsx +10 -50
  10. package/client/field.tsx +33 -0
  11. package/client/floating-surface.tsx +1 -1
  12. package/client/header.tsx +18 -7
  13. package/client/hint.tsx +60 -0
  14. package/client/home-chrome.tsx +92 -32
  15. package/client/home-data.ts +43 -2
  16. package/client/home-list.tsx +110 -31
  17. package/client/home-view.ts +22 -6
  18. package/client/home.tsx +87 -38
  19. package/client/inbox-store.ts +37 -1
  20. package/client/keyboard.tsx +159 -0
  21. package/client/kit.tsx +10 -3
  22. package/client/large.tsx +18 -52
  23. package/client/linked.tsx +3 -2
  24. package/client/live.tsx +41 -8
  25. package/client/more-context.tsx +3 -2
  26. package/client/morning-brief-settings.tsx +4 -3
  27. package/client/needs-you.tsx +17 -8
  28. package/client/new-settings.tsx +4 -3
  29. package/client/new.tsx +6 -4
  30. package/client/now-lines.tsx +28 -8
  31. package/client/on-screen.tsx +43 -0
  32. package/client/pane-allowlist.ts +0 -2
  33. package/client/panel.tsx +119 -40
  34. package/client/pending-answers.ts +74 -14
  35. package/client/pr-sheet.tsx +3 -1
  36. package/client/pr-stats-settings.tsx +5 -4
  37. package/client/question-context.tsx +63 -0
  38. package/client/questions.tsx +50 -54
  39. package/client/rename.tsx +3 -2
  40. package/client/report-issue.tsx +3 -2
  41. package/client/reviewers.tsx +3 -2
  42. package/client/row-actions.ts +12 -4
  43. package/client/search-key.ts +4 -7
  44. package/client/settings.tsx +5 -3
  45. package/client/shared-read.ts +22 -0
  46. package/client/shipping.tsx +3 -2
  47. package/client/sidebar-view.tsx +24 -7
  48. package/client/spec.tsx +4 -3
  49. package/client/stacks.tsx +3 -3
  50. package/client/tasks.tsx +11 -10
  51. package/client/theme.ts +0 -8
  52. package/client/toast-store.ts +22 -0
  53. package/client/turn-view.tsx +377 -0
  54. package/client/why-it-matters.tsx +3 -2
  55. package/client/workspace-data.ts +13 -3
  56. package/client/your-questions.tsx +8 -6
  57. package/docs/screenshots/follow-up-slide-1-cover.png +0 -0
  58. package/docs/screenshots/follow-up-slide-2-decision.png +0 -0
  59. package/docs/screenshots/follow-up-slide-3-overseer.png +0 -0
  60. package/docs/screenshots/follow-up-slide-4-repairs.png +0 -0
  61. package/docs/screenshots/follow-up-slide-5-deploy.png +0 -0
  62. package/docs/screenshots/follow-up-slide-6-catch-up.png +0 -0
  63. package/index.client.tsx +26 -18
  64. package/index.server.ts +37 -11
  65. package/package.json +3 -2
  66. package/paseo-plugin.json +1 -1
  67. package/scripts/build.mjs +5 -2
  68. package/scripts/inline.mjs +22 -0
  69. package/server/agent-actions.ts +36 -10
  70. package/server/agent-hook.mjs +75 -151
  71. package/server/agent-parity.ts +3 -0
  72. package/server/feeds.ts +17 -8
  73. package/server/hook-source.ts +282 -151
  74. package/server/list-cache.ts +29 -11
  75. package/server/mcp-source.ts +246 -58
  76. package/server/mcp.d.mts +9 -6
  77. package/server/mcp.mjs +111 -58
  78. package/server/native-tools.ts +23 -10
  79. package/server/overseer-prompt-source.ts +2 -2
  80. package/server/overseer-prompt.md +2 -2
  81. package/server/session-prompt.ts +48 -22
  82. package/server/transcript.ts +68 -0
  83. package/server/turn-end.ts +19 -26
  84. package/shared/agent-text.d.mts +28 -0
  85. package/shared/agent-text.mjs +133 -0
  86. package/shared/ask-shape.ts +28 -0
  87. package/shared/attention.ts +4 -3
  88. package/shared/brief.ts +13 -5
  89. package/shared/chat.ts +2 -2
  90. package/shared/contracts.ts +17 -6
  91. package/shared/display.ts +43 -6
  92. package/shared/follow-up.ts +2 -1
  93. package/shared/history.ts +79 -28
  94. package/shared/home-arrange.ts +99 -0
  95. package/shared/home.ts +15 -4
  96. package/shared/linear-queue.ts +7 -0
  97. package/shared/list-entries.ts +34 -7
  98. package/shared/list.ts +44 -2
  99. package/shared/model.ts +1 -1
  100. package/shared/now.ts +2 -2
  101. package/shared/optimistic-answers.ts +79 -0
  102. package/shared/overseer.ts +4 -3
  103. package/shared/peek.ts +86 -0
  104. package/shared/pr-actions.ts +2 -1
  105. package/shared/pr-status.ts +19 -1
  106. package/shared/presentation.ts +1 -1
  107. package/shared/row-menu.ts +10 -1
  108. package/shared/settings-nav.ts +2 -0
  109. package/shared/sort.ts +6 -0
  110. package/shared/status-invariants.ts +14 -0
  111. package/shared/task-due.ts +4 -16
  112. package/shared/turn-checks.d.mts +30 -0
  113. package/shared/turn-checks.mjs +71 -0
  114. package/shared/turn.ts +211 -0
  115. package/shared/workspace-layout.ts +62 -0
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
- [![Follow-up in 36 seconds: Home, Catch up, automatic follow-ups, the Overseer](https://cdn.jsdelivr.net/gh/tomgrin10/paseo-follow-up@635e600d3390e23ea786492780755afda591bb45/docs/screenshots/follow-up-demo-v2-poster.png)](https://cdn.jsdelivr.net/gh/tomgrin10/paseo-follow-up@635e600d3390e23ea786492780755afda591bb45/docs/screenshots/follow-up-demo-v2.mp4)
17
+ [![Follow-up in 36 seconds: Home, Catch up, automatic follow-ups, the Overseer](https://cdn.jsdelivr.net/gh/tomgrin10/paseo-follow-up@4b3fc08b7c8176d751c83c37ca471f61db4001ec/docs/screenshots/follow-up-demo-v2-poster.png)](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
+ }
@@ -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(() => { if (seen.current === revision) return; seen.current = revision; void reload(); }, [revision, reload]);
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, TextInput, copyText, useToast } from "@getpaseo/plugin/client/ui";
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}><TextInput accessibilityLabel={`Your answer${numbered ? ` to question ${i + 1}` : ""}, required`} placeholder="Your answer (required)" placeholderTextColor={c.foregroundMuted} autoFocus multiline maxLength={2000}
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}><TextInput 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"}
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
- const id = runUndoable("Telling the agent it's done", { label: "Done", toast, run: async (): Promise<unknown> => doneQ && workspace ? answerQuestion({ workspaceId: workspace.id, questionId: doneQ.id, choice: TASK_DONE.letter, ...(notesOpen[doneQ.id] && notes[doneQ.id]?.trim() ? { words: notes[doneQ.id].trim() } : {}), ...withImages(), action: "send" })
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 => { setMarked(null); setError(errorText(e)); }, reconcile: e => { setMarked(null); reconcile(e); } }, () => setMarked(null), `done:${b.id}`, () => deps.endDone?.(agentId));
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); setMarked(null); });
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)) { const out = await act({ agentId, briefId: b.id, answerId, ...(list.length === 1 ? list[0] : { choices: list }), ...images }); img.clear(); return out; }
548
- // The images ride the first answer's message: one message to the agent carries them once.
549
- for (const [i, x] of list.entries()) await answerQuestion({ workspaceId: workspace!.id, questionId: x.decisionId, choice: x.choice, ...(x.words ? { words: x.words } : {}), ...(i === 0 ? images : {}), action: "send" });
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(workspace!.id) });
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
- {(!compact || why) && <View style={{ borderTopWidth: 1, borderTopColor: c.border, paddingHorizontal: pad, paddingVertical: 8, flexDirection: "row", alignItems: "center", gap: 6 }}>
612
- <Icon name="Info" size={12} color={c.foregroundMuted} />
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
  }
@@ -9,7 +9,7 @@ import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactN
9
9
  import { Animated, PanResponder, Platform, View } from "react-native";
10
10
  import { Pressable, Text } from "./text";
11
11
  import { useRpc } from "@getpaseo/plugin/client";
12
- import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
12
+ import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
13
13
  import { ImageField, useImageAttachments } from "./image-attach";
14
14
  import type { ImageUpload } from "../shared/images";
15
15
  import { useQuery } from "@tanstack/react-query";
@@ -44,6 +44,7 @@ import { PRIMARY_FORM } from "./dock";
44
44
  import { MorePanel, MoveResult, ContextAnswer } from "./more-context";
45
45
  import { AnswerActions, AnswerView, ReplyForm, useQuestionActs } from "./your-questions";
46
46
  import { questionLine, questionsByWorkspace } from "../shared/your-questions";
47
+ import { Field } from "./field";
47
48
 
48
49
  export { MorePanel, MoveResult, ContextAnswer };
49
50
 
@@ -640,7 +641,7 @@ function NoteRow({ theme, compact, agentId }: { theme: Theme; compact: boolean;
640
641
  void agent.handle?.send(words.trim(), images ? { images } : undefined); setWords(""); img.clear();
641
642
  };
642
643
  return <ImageField model={img} theme={theme} compact={compact}><View {...PRIMARY_FORM} style={{ flexDirection: "row", alignItems: "flex-end", gap: 8 }}>
643
- <TextInput accessibilityLabel="Tell the agent something" placeholder="Tell the agent something" placeholderTextColor={c.foregroundMuted} value={words} onChangeText={setWords} multiline
644
+ <Field accessibilityLabel="Tell the agent something" placeholder="Tell the agent something" placeholderTextColor={c.foregroundMuted} value={words} onChangeText={setWords} multiline
644
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 }} />
645
646
  <IconButton theme={theme} compact={compact} icon="Send" label="Send to the agent" tooltip={!compact} disabled={!words.trim() || !!img.blocked} onPress={send} />
646
647
  </View></ImageField>;
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useState, type ReactNode } from "react";
2
- import { ActivityIndicator, TextInput, View } from "react-native";
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
- <TextInput accessibilityLabel="How to read this source" multiline value={notes} onChangeText={v => setNotes(v.slice(0, COMPASS.sourceInstructions))} placeholder={kind === "doc" ? "Lines under 'This week' are the plan. A line starting with ! is urgent." : "P0 means today, P1 this week. Ignore hiring talk."}
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
- <TextInput accessibilityLabel="Source name" value={label} onChangeText={setLabel} placeholder={kind === "tracker" ? "priority/high" : kind === "doc" ? "Now" : kind === "calendar" ? "Calendar deadlines" : "Dana · product"} placeholderTextColor={c.foregroundMuted}
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
- : <TextInput autoFocus accessibilityLabel={copy.label} value={q} onChangeText={setQ} placeholder={copy.placeholder}
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
- <TextInput 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
+ <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
- <TextInput accessibilityLabel="Word" value={words} onChangeText={setWords} placeholder="Phoenix" placeholderTextColor={c.foregroundMuted} style={[field, { flexGrow: 1, flexBasis: 120, minWidth: 0 }]} />
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
- <TextInput 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
+ <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>;
@@ -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 { displayPreferences, displayRpc, trustCountText } from "../shared/display";
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.
package/client/dock.ts CHANGED
@@ -68,3 +68,34 @@ export const KEYBOARD_MIN = 150;
68
68
  * dataSet into data-* attributes (dataset.primaryForm); its types don't list dataSet, hence the spread.
69
69
  */
70
70
  export const PRIMARY_FORM = { dataSet: { primaryForm: "1" } } as object;
71
+
72
+ /**
73
+ * Native (`the-keyboard-never-covers-a-field`): what to do so the focused field shows above the keyboard. Window
74
+ * coordinates throughout. `room`: what stays clear under the field (its Send, for a primary form). With a scroll view
75
+ * around the field, scroll it (as far as its content goes), and lift the whole room by what scrolling can't cover,
76
+ * never so far that the field's top leaves the screen. A field that already shows does nothing.
77
+ */
78
+ export function revealPlan(i: {
79
+ fieldTop: number; fieldBottom: number; keyboardTop: number; room: number;
80
+ scroll?: { top: number; bottom: number; offset: number; maxOffset: number } | null;
81
+ }): { scrollTo: number | null; lift: number } {
82
+ const s = i.scroll ?? null;
83
+ const visibleBottom = Math.min(i.keyboardTop, s ? s.bottom : Infinity);
84
+ const visibleTop = s ? s.top : 0;
85
+ if (i.fieldBottom <= visibleBottom && i.fieldTop >= visibleTop) return { scrollTo: null, lift: 0 };
86
+ // Above the scroll view's top edge (the field scrolled away): bring its top back under the edge.
87
+ if (s && i.fieldTop < visibleTop) {
88
+ const up = Math.min(s.offset, visibleTop + REVEAL_GAP - i.fieldTop);
89
+ return { scrollTo: up > 0 ? Math.round(s.offset - up) : null, lift: 0 };
90
+ }
91
+ const want = i.fieldBottom - (visibleBottom - Math.max(REVEAL_GAP, i.room));
92
+ const take = s ? Math.max(0, Math.min(want, s.maxOffset - s.offset)) : 0;
93
+ const top = i.fieldTop - take, bottom = i.fieldBottom - take;
94
+ const covered = bottom - (i.keyboardTop - REVEAL_GAP);
95
+ const lift = bottom > i.keyboardTop ? Math.max(0, Math.min(covered, top - REVEAL_GAP)) : 0;
96
+ return { scrollTo: take > 0 ? Math.round(s!.offset + take) : null, lift: Math.round(lift) };
97
+ }
98
+
99
+ /** How much of a room (its bottom edge at `roomBottom`) the keyboard covers; 0 with no keyboard. Window coordinates. */
100
+ export const roomOverlap = (roomBottom: number | null, keyboardTop: number | null): number =>
101
+ roomBottom === null || keyboardTop === null ? 0 : Math.max(0, Math.round(roomBottom - keyboardTop));