paseo-follow-up 2.6.0-beta.9 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/THIRD_PARTY_NOTICES.md +4 -0
  3. package/client/action-row.tsx +16 -9
  4. package/client/agent-card.tsx +217 -53
  5. package/client/agents.tsx +46 -3
  6. package/client/brief-since.tsx +3 -2
  7. package/client/brief.tsx +28 -27
  8. package/client/card-blocks.tsx +622 -0
  9. package/client/card-boundary.tsx +34 -0
  10. package/client/card-data.ts +118 -0
  11. package/client/card-viewer.tsx +111 -0
  12. package/client/catch-up.tsx +44 -18
  13. package/client/chat-seen.tsx +56 -0
  14. package/client/chat.tsx +3 -3
  15. package/client/compass-settings.tsx +3 -2
  16. package/client/composers.ts +40 -0
  17. package/client/dialog-frame.tsx +41 -0
  18. package/client/dismiss.tsx +2 -1
  19. package/client/display.tsx +32 -2
  20. package/client/draft-text.ts +39 -0
  21. package/client/float-over.ts +14 -0
  22. package/client/full-window.tsx +24 -0
  23. package/client/grow.ts +46 -0
  24. package/client/header.tsx +7 -9
  25. package/client/hint.tsx +20 -10
  26. package/client/home-chrome.tsx +86 -21
  27. package/client/home-list.tsx +68 -30
  28. package/client/home-view.ts +10 -2
  29. package/client/home.tsx +108 -115
  30. package/client/image-attach.tsx +26 -8
  31. package/client/image-viewer.tsx +9 -20
  32. package/client/kept.ts +47 -0
  33. package/client/kit.tsx +34 -16
  34. package/client/linked.tsx +9 -4
  35. package/client/live.tsx +3 -0
  36. package/client/messages.tsx +10 -3
  37. package/client/more-context.tsx +18 -9
  38. package/client/morning-brief-settings.tsx +8 -5
  39. package/client/motion.tsx +12 -0
  40. package/client/needs-you.tsx +33 -16
  41. package/client/new.tsx +87 -46
  42. package/client/now-lines.tsx +38 -16
  43. package/client/on-screen.tsx +1 -1
  44. package/client/onboarding.tsx +4 -3
  45. package/client/open-link.ts +56 -0
  46. package/client/open-steps.ts +22 -0
  47. package/client/panel-menu.tsx +8 -4
  48. package/client/panel.tsx +114 -48
  49. package/client/pill.tsx +40 -27
  50. package/client/pr-sheet.tsx +13 -10
  51. package/client/pr-stats-settings.tsx +9 -8
  52. package/client/pr-stats.tsx +2 -1
  53. package/client/question-context.tsx +12 -5
  54. package/client/questions.tsx +21 -13
  55. package/client/release-notes.tsx +11 -9
  56. package/client/rename.tsx +20 -17
  57. package/client/reply-draft.ts +93 -0
  58. package/client/report-issue.tsx +34 -22
  59. package/client/reviewers.tsx +2 -2
  60. package/client/rich-text.tsx +273 -9
  61. package/client/row-actions.ts +31 -3
  62. package/client/row-menu.tsx +1 -7
  63. package/client/settings-screens.ts +28 -2
  64. package/client/settings.tsx +12 -9
  65. package/client/shown-cards.tsx +270 -0
  66. package/client/sidebar-view.tsx +47 -24
  67. package/client/slash-commands.tsx +319 -0
  68. package/client/spec.tsx +12 -6
  69. package/client/stacks.tsx +9 -8
  70. package/client/tab-showing.ts +22 -0
  71. package/client/tasks.tsx +14 -3
  72. package/client/text-image.tsx +146 -0
  73. package/client/theme.ts +18 -0
  74. package/client/turn-view.tsx +94 -22
  75. package/client/updates.tsx +58 -4
  76. package/client/visibility.ts +6 -0
  77. package/client/why-it-matters.tsx +2 -1
  78. package/client/workspace-data.ts +22 -5
  79. package/client/your-questions.tsx +92 -33
  80. package/index.client.tsx +23 -9
  81. package/index.server.ts +205 -42
  82. package/package.json +6 -5
  83. package/server/agent-actions.ts +17 -5
  84. package/server/agent-commands.ts +96 -0
  85. package/server/agent-hook.mjs +65 -15
  86. package/server/agent-hooks.ts +11 -0
  87. package/server/agent-parity.ts +19 -3
  88. package/server/agent-settings.ts +15 -0
  89. package/server/cards.ts +287 -0
  90. package/server/check-watches.ts +20 -1
  91. package/server/codex-hooks.ts +142 -0
  92. package/server/context-requests.ts +45 -2
  93. package/server/daemon.ts +53 -10
  94. package/server/discovery.ts +2 -2
  95. package/server/dismiss.ts +5 -2
  96. package/server/dispatch.ts +7 -4
  97. package/server/engine.ts +90 -0
  98. package/server/hook-source.ts +424 -23
  99. package/server/image-store.ts +35 -2
  100. package/server/inbox-directory.ts +1 -1
  101. package/server/mcp-source.ts +149 -41
  102. package/server/mcp.d.mts +2 -2
  103. package/server/mcp.mjs +84 -35
  104. package/server/native-tools.ts +11 -5
  105. package/server/obligations.ts +2 -3
  106. package/server/outside-answers.ts +127 -0
  107. package/server/outside-runs/index.ts +105 -0
  108. package/server/outside-runs/progress.ts +168 -0
  109. package/server/outside-runs/turn-print.ts +21 -0
  110. package/server/pr-owner.ts +4 -3
  111. package/server/questions.ts +8 -7
  112. package/server/report-issue/github.ts +40 -2
  113. package/server/report-issue/index.ts +65 -9
  114. package/server/report-issue-adapter.ts +14 -5
  115. package/server/rpc-timing.ts +15 -4
  116. package/server/scopes.ts +26 -4
  117. package/server/session-prompt.ts +28 -4
  118. package/server/spec.ts +0 -10
  119. package/server/transcript.ts +5 -4
  120. package/server/turn-end.ts +63 -12
  121. package/server/turn-timeline.ts +35 -11
  122. package/server/update-watchdog-source.ts +49 -2
  123. package/server/update-watchdog.mjs +8 -2
  124. package/shared/activity.ts +8 -2
  125. package/shared/agent-commands.ts +165 -0
  126. package/shared/agent-settings.ts +10 -2
  127. package/shared/agent-text.d.mts +13 -2
  128. package/shared/agent-text.mjs +40 -8
  129. package/shared/ask-shape.ts +2 -2
  130. package/shared/attention.ts +64 -12
  131. package/shared/brief.ts +25 -10
  132. package/shared/card-md.ts +47 -0
  133. package/shared/card-view.ts +280 -0
  134. package/shared/cards.ts +228 -0
  135. package/shared/catch-up.ts +15 -5
  136. package/shared/changelog.ts +11 -10
  137. package/shared/chat.ts +17 -5
  138. package/shared/compass.ts +2 -2
  139. package/shared/contracts.ts +43 -12
  140. package/shared/daemon-url.d.mts +4 -1
  141. package/shared/daemon-url.mjs +27 -0
  142. package/shared/dialog-fit.ts +18 -0
  143. package/shared/dispatch.ts +28 -0
  144. package/shared/display.ts +84 -17
  145. package/shared/finished.ts +2 -1
  146. package/shared/grow.ts +15 -0
  147. package/shared/headline.ts +56 -9
  148. package/shared/home-arrange.ts +14 -2
  149. package/shared/home.ts +104 -27
  150. package/shared/images.ts +25 -0
  151. package/shared/link-open.ts +26 -0
  152. package/shared/list-entries.ts +14 -6
  153. package/shared/list.ts +27 -0
  154. package/shared/markdown.ts +241 -0
  155. package/shared/message-sender.ts +1 -1
  156. package/shared/model.ts +24 -6
  157. package/shared/new-view.ts +12 -6
  158. package/shared/now.ts +44 -2
  159. package/shared/onboarding.ts +14 -4
  160. package/shared/outside-run.ts +228 -0
  161. package/shared/overseer.ts +7 -2
  162. package/shared/peek.ts +11 -1
  163. package/shared/pr-actions.ts +10 -6
  164. package/shared/presentation.ts +3 -2
  165. package/shared/progress-run.d.mts +32 -0
  166. package/shared/progress-run.mjs +244 -0
  167. package/shared/provider-support.ts +7 -3
  168. package/shared/questions.ts +18 -4
  169. package/shared/reply-draft.ts +38 -0
  170. package/shared/report-send.ts +1 -1
  171. package/shared/reviewers.ts +3 -1
  172. package/shared/row-menu.ts +15 -3
  173. package/shared/search.ts +25 -12
  174. package/shared/send-shortcut.ts +35 -0
  175. package/shared/settings-nav.ts +8 -3
  176. package/shared/status-invariants.ts +35 -4
  177. package/shared/tab-showing.ts +55 -0
  178. package/shared/task-dup.ts +25 -0
  179. package/shared/task-rows.ts +25 -5
  180. package/shared/turn-checks.d.mts +12 -0
  181. package/shared/turn-checks.mjs +75 -2
  182. package/shared/turn-clamp.ts +10 -0
  183. package/shared/turn.ts +50 -13
  184. package/shared/workspace-layout.ts +4 -4
  185. package/shared/your-questions.ts +87 -5
  186. package/skills/follow-up/SKILL.md +1 -1
@@ -1,23 +1,27 @@
1
- import { useEffect, useState } from "react";
2
- import { View } from "react-native";
1
+ import { useContext, useEffect, useRef, useState, type ReactNode } from "react";
2
+ import { View, type NativeScrollEvent, type NativeSyntheticEvent, type ScrollView as NativeScrollView } from "react-native";
3
+ import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
3
4
  import { usePaseo } from "@getpaseo/plugin/client";
4
- import { Text } from "./text";
5
+ import { Pressable, Text } from "./text";
5
6
  import type { InboxStore } from "./inbox-store";
6
7
  import { useInbox } from "./inbox";
7
8
  import { AgentLines } from "./now-lines";
8
9
  import { FoldButton, PANEL_FOLDS, useFold } from "./fold";
9
10
  import { HintBubble, HintIcon, useHint } from "./hint";
10
11
  import { ReplyBox } from "./home";
12
+ import { LetListOut, RaiseSlot } from "./float-over";
11
13
  import { TurnView, useTurn } from "./turn-view";
12
14
  import { useMarkTimelineOnScreen } from "./on-screen";
13
15
  import { Spinner } from "./motion";
14
16
  import { PrLinksProvider } from "./rich-text";
15
17
  import { prLinksByNumber } from "../shared/presentation";
16
- import { raised, runningColor } from "./theme";
18
+ import { raised, runningColor, type Colors } from "./theme";
17
19
  import type { Theme } from "./kit";
18
20
  import type { Workspace } from "../shared/model";
19
21
  import type { InboxRow } from "../shared/inbox";
20
- import { turnSource } from "../shared/turn";
22
+ import { MAX_TURNS, turnSource, type Turn } from "../shared/turn";
23
+ import { useChatBeside } from "./composers";
24
+ import { IconButton } from "./kit";
21
25
 
22
26
  /** Where the workspace view is mounted. Only two things differ by place: the head's own controls and the reply box. */
23
27
  export type ViewPlace = "home" | "panel" | "tab";
@@ -25,19 +29,22 @@ export type ViewPlace = "home" | "panel" | "tab";
25
29
  const NO_INBOX = { subscribe: () => () => undefined, version: () => 0, rows: () => [] } as unknown as InboxStore;
26
30
  const NO_ROWS: readonly InboxRow[] = [];
27
31
 
28
- export const STEPS_HINT = "Live while shown. A resting agent's steps come from its saved transcript, so it is never woken.";
32
+ export const STEPS_HINT = "The agent's chat: live while it's awake, or its saved chat while it's asleep, so it isn't woken.";
29
33
  const HOME_REPLY_HINT = " Sending clears Needs you; Sign off & next moves on without a reply.";
30
34
 
31
35
  /**
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.
36
+ * The agent card (docs/client.md#the-workspace-view): one row per agent (client/now-lines.tsx), then the Chat section's body
37
+ * (the peek's rows, client/turn-view.tsx: the developer's messages, the agent's replies, steps grouped) and the reply box
38
+ * right under it, so reading and replying are one place. The card has one header line: the selected agent's row carries
39
+ * the Chat controls at its right end (the ? hint, the caption, the fold and Open chat), so who and their state lead and
40
+ * what to do with their chat follows on the same line. With several agents every agent keeps its row (each one's state
41
+ * at a glance) and a row switches the body and the box to its agent, its controls moving with the selection; Cmd/Ctrl
42
+ * opens its chat. The body reads live while shown and an unloaded agent's saved transcript otherwise, never waking it
43
+ * (invariant 1). The fold folds the body and the box; the rows stay.
37
44
  *
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.
45
+ * The side panel (`place` "panel") sits beside the workspace's chat, so it never draws the reply box and its Chat
46
+ * starts folded; the developer's own fold choice wins everywhere (invariant 132). Home's pane and the main tab mark
47
+ * the selected agent's timeline as on screen while its body shows, so its status-line peek stays shut.
41
48
  */
42
49
  export function AgentCard({ workspace: w, inbox, theme, compact, steps, now, place, openAgent, onSent, reply }: {
43
50
  workspace: Workspace; inbox?: InboxStore; theme: Theme; compact: boolean;
@@ -46,7 +53,7 @@ export function AgentCard({ workspace: w, inbox, theme, compact, steps, now, pla
46
53
  openAgent?: (agentId: string) => void;
47
54
  /** After a reply went out (Home refreshes its inbox rows). */
48
55
  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. */
56
+ /** Draw the reply box under the Chat section: never in the side panel, and not on a phone's Home, whose dock has it. */
50
57
  reply: boolean;
51
58
  }) {
52
59
  const c = theme.colors;
@@ -56,58 +63,215 @@ export function AgentCard({ workspace: w, inbox, theme, compact, steps, now, pla
56
63
  useEffect(() => { setSelected(w.mainAgentId); }, [w.mainAgentId]);
57
64
  const name = selected === w.mainAgentId ? "the main agent" : rows.find(r => r.agentId === selected)?.title?.trim() || w.taskAgents?.[selected]?.title?.trim() || "the agent";
58
65
  const pick = (agentId: string, chat: boolean) => { if (chat && openAgent) openAgent(agentId); else setSelected(agentId); };
66
+ // Beside that same agent's chat (the side panel next to Paseo's agent view), Chat would repeat what's on screen, so
67
+ // the card keeps its agent rows and leaves Chat out (a-chat-beside-isn-t-repeated). Another agent's Chat still shows.
68
+ const beside = useChatBeside(place === "panel" ? selected : null);
69
+ const chat = useChat(selected, place, !beside);
70
+ // The reply box's `/` list open below the box draws past the card's edge, like the hint (client/float-over.ts).
71
+ const [listOut, setListOut] = useState(false);
72
+ const out = chat.hintOpen || listOut;
73
+ // In columns the card sits in its own slot: the slot rises with it, over the cards after it.
74
+ const raise = useContext(RaiseSlot);
75
+ useEffect(() => { raise?.(out); }, [raise, out]);
76
+ const controls = beside ? undefined : (offset: number) => <ChatControls chat={chat} agentId={selected} name={name} theme={theme} compact={compact} openAgent={openAgent} reply={reply} offset={offset} />;
77
+ // No agent has a row (nothing known about it yet): the plain Chat header keeps the controls.
78
+ const plain = beside ? null : <ChatHeader chat={chat} theme={theme} compact={compact}><ChatControls chat={chat} agentId={selected} name={name} theme={theme} compact={compact} openAgent={openAgent} reply={reply} named={false} /></ChatHeader>;
79
+ return <View {...({ dataSet: { followAgentCard: "" } } as object)} style={[{ marginHorizontal: compact ? 16 : 12, marginTop: 12, borderRadius: 8, overflow: out ? "visible" : "hidden", zIndex: out ? 30 : undefined, backgroundColor: c.surface0 }, raised(c)]}>
80
+ <LetListOut.Provider value={setListOut}>
81
+ <View style={{ zIndex: chat.hintOpen ? 30 : undefined }}>
82
+ <AgentLines workspace={w} inbox={inbox} theme={theme} compact={compact} now={now} openAgent={openAgent} peek={place === "panel"} bare selected={selected} onSelect={pick}
83
+ controls={controls} raised={chat.hintOpen} fallback={plain} />
84
+ </View>
85
+ {!beside && chat.open && <View style={{ borderTopWidth: 1, borderTopColor: c.border, paddingTop: 4 }}>
86
+ <ChatBody chat={chat} agentId={selected} name={name} theme={theme} compact={compact} steps={steps} reply={reply} prs={w.prs} onSent={onSent} />
87
+ </View>}
88
+ </LetListOut.Provider>
89
+ </View>;
90
+ }
91
+
92
+ /** One agent's Chat state: its fold, its read (never waking it), how far back it reads, and its ? hint. */
93
+ function useChat(agentId: string | null, place: ViewPlace, shown = true, onHint?: (open: boolean) => void) {
94
+ const fold = useFold(PANEL_FOLDS.steps, place !== "panel");
95
+ const open = fold.open;
96
+ useMarkTimelineOnScreen(place !== "panel" && open ? agentId : null);
97
+ // How many turns back it reads (Show earlier messages), per agent for the app session, so a remount keeps it.
98
+ const [turns, setTurns] = useState(() => readBack(agentId));
99
+ useEffect(() => { setTurns(readBack(agentId)); }, [agentId]);
100
+ const turn = useTurn(agentId, open && shown, turns);
101
+ const earlier = () => { if (!agentId) return; const next = Math.min(MAX_TURNS, turns + 1); turnsBack.set(agentId, next); setTurns(next); };
59
102
  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} />
103
+ const help = useHint(next => { setHintOpen(next); onHint?.(next); });
104
+ // A failed refresh keeps the rows it has and says so in the caption; with nothing read yet, the error takes their place.
105
+ const stale = !!turn.error && !!turn.turn;
106
+ const caption = stale ? "couldn't refresh" : turn.running ? "live" : turnSource(turn);
107
+ return { fold, open, turn, turns, earlier, help, hintOpen, stale, caption, place };
108
+ }
109
+ type ChatState = ReturnType<typeof useChat>;
110
+
111
+ const chatHint = (chat: ChatState, reply: boolean) => STEPS_HINT + (chat.place === "home" && reply ? HOME_REPLY_HINT : "");
112
+
113
+ /**
114
+ * Chat's controls, at the right end of a header line (the agent card's selected row, or the plain Chat header): the
115
+ * ? hint, the fold (the caption "live", "saved chat" or "couldn't refresh" with its chevron; its name stays "Chat,
116
+ * <caption>") and Open chat. The hint bubble opens under the line they sit on.
117
+ */
118
+ function ChatControls({ chat, agentId, name, theme, compact, openAgent, reply = false, offset = 0, named = true }: {
119
+ chat: ChatState; agentId: string | null; name: string; theme: Theme; compact: boolean; openAgent?: (agentId: string) => void; reply?: boolean;
120
+ /** Drawn this far down (the agent row's first line). */
121
+ offset?: number;
122
+ /** The fold names its section ("Chat · live"): on an agent's row, where nothing else says what it folds. */
123
+ named?: boolean;
124
+ }) {
125
+ const c = theme.colors;
126
+ const hint = chatHint(chat, reply);
127
+ return <>
128
+ <View style={{ flexShrink: 1, minWidth: 0, flexDirection: "row", alignItems: "center", gap: compact ? 0 : 2, paddingLeft: 8, paddingRight: compact ? 4 : 6, marginTop: offset }}>
129
+ <HintIcon hint={chat.help} text={hint} theme={theme} compact={compact} label="About Chat" />
130
+ <FoldButton open={chat.open} onToggle={chat.fold.toggle} label={chat.caption ? `Chat, ${chat.caption}` : "Chat"} theme={theme} chevron="end"
131
+ style={(hovered, pressed) => ({ flexShrink: 1, minWidth: compact ? 44 : 28, flexDirection: "row", alignItems: "center", justifyContent: "flex-end", gap: 5, paddingHorizontal: compact ? 10 : 6, minHeight: compact ? 44 : 28, borderRadius: 6, backgroundColor: pressed ? c.surface2 : hovered ? c.surface1 : "transparent" })}>
132
+ {named && <Text numberOfLines={1} style={{ flexShrink: 0, color: c.foregroundMuted, fontSize: 12, fontWeight: "500" }}>Chat</Text>}
133
+ {named && !!chat.caption && <Text style={{ flexShrink: 0, color: c.foregroundMuted, fontSize: 12 }}>·</Text>}
134
+ {chat.turn.running && !chat.stale && <View style={{ width: 6, height: 6, borderRadius: 3, backgroundColor: runningColor(c) }} />}
135
+ {!!chat.caption && <Text numberOfLines={1} style={{ flexShrink: 1, color: c.foregroundMuted, fontSize: 12 }}>{chat.caption}</Text>}
136
+ </FoldButton>
137
+ {openAgent && agentId && <IconButton icon="Maximize2" label={`Open ${name}'s chat`} theme={theme} compact={compact} tooltip onPress={() => openAgent(agentId)} />}
64
138
  </View>
139
+ <HintBubble hint={chat.help} text={hint} theme={theme} align="end" />
140
+ </>;
141
+ }
142
+
143
+ /** A header line titled "Chat", for where no agent row carries the controls (Home's pane without a workspace, the Overseer). */
144
+ function ChatHeader({ chat, theme, compact, children }: { chat: ChatState; theme: Theme; compact: boolean; children: ReactNode }) {
145
+ const c = theme.colors;
146
+ return <View style={{ zIndex: chat.hintOpen ? 30 : undefined, flexDirection: "row", alignItems: "center", minHeight: compact ? 56 : 40 }}>
147
+ <Text numberOfLines={1} style={{ flex: 1, minWidth: 0, paddingLeft: compact ? 14 : 12, color: c.foreground, fontSize: compact ? 13 : 12, fontWeight: "600" }}>Chat</Text>
148
+ {children}
65
149
  </View>;
66
150
  }
67
151
 
152
+ /** Chat's body and (when `reply`) the reply box under it. */
153
+ function ChatBody({ chat, agentId, name, theme, compact, steps, reply, prs = [], onSent, empty }: {
154
+ chat: ChatState; agentId: string | null; name: string; theme: Theme; compact: boolean; steps: number; reply: boolean; prs?: Workspace["prs"]; onSent?: () => void; empty?: string;
155
+ }) {
156
+ const paseo = usePaseo();
157
+ return <>
158
+ <View style={{ paddingHorizontal: compact ? 14 : 12, paddingBottom: reply ? 0 : 12 }}>
159
+ <StepsBody key={agentId ?? ""} height={stepsHeight(steps, compact)} theme={theme} compact={compact} turn={chat.turn.turn} error={chat.turn.turn ? null : chat.turn.error} waiting={!!agentId && !chat.turn.turn && !chat.turn.error}
160
+ empty={empty ?? (reply ? "No messages yet. Write to the agent below, or open its chat." : "No messages yet. Open its chat to write to it.")}
161
+ prs={prs} turns={chat.turns} onEarlier={chat.earlier} />
162
+ </View>
163
+ {reply && agentId && <ReplyBox theme={theme} compact={compact} agentName={name} hint={null} placeholder={`Reply to ${name}`} target={{ kind: "agent", agentId }} draft={agentId}
164
+ onSend={async (text, images) => { await paseo.agents.ref(agentId).send(text, images?.length ? { images } : undefined); onSent?.(); }} />}
165
+ </>;
166
+ }
167
+
68
168
  /**
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.
169
+ * The Chat section on its own, for one agent, under a plain "Chat" header with the same controls: Home's pane for a
170
+ * row with no workspace and the Overseer. Never wakes the agent.
71
171
  */
72
- export function RecentSteps({ agentId, name, theme, compact, steps, place, reply, prs = [], onSent, onHint, empty }: {
172
+ export function RecentSteps({ agentId, name, theme, compact, steps, place, reply, prs = [], onSent, onHint, empty, openAgent }: {
73
173
  agentId: string | null; name: string; theme: Theme; compact: boolean; steps: number; place: ViewPlace; reply: boolean;
74
174
  prs?: Workspace["prs"]; onSent?: () => void;
75
- /** The ? hint opened or closed (the card lets it draw past its edge). */
175
+ /** The ? hint opened or closed (the owner lets it draw past its edge). */
76
176
  onHint?: (open: boolean) => void;
77
177
  /** What an empty turn says; the default points at the reply box or the chat. */
78
178
  empty?: string;
179
+ /** Opens the agent's own chat tab (the header's button); the one way the surface already navigates. */
180
+ openAgent?: (agentId: string) => void;
181
+ }) {
182
+ const chat = useChat(agentId, place, true, onHint);
183
+ return <View style={{ zIndex: chat.hintOpen ? 30 : undefined }}>
184
+ <ChatHeader chat={chat} theme={theme} compact={compact}>
185
+ <ChatControls chat={chat} agentId={agentId} name={name} theme={theme} compact={compact} openAgent={openAgent} reply={reply} named={false} />
186
+ </ChatHeader>
187
+ {chat.open && <ChatBody chat={chat} agentId={agentId} name={name} theme={theme} compact={compact} steps={steps} reply={reply} prs={prs} onSent={onSent} empty={empty} />}
188
+ </View>;
189
+ }
190
+
191
+ /** Turns read back per agent this app session (Show earlier messages), so a remount or a fold keeps the scroll-back. */
192
+ const turnsBack = new Map<string, number>();
193
+ const readBack = (agentId: string | null) => (agentId && turnsBack.get(agentId)) || 1;
194
+
195
+ /**
196
+ * The steps' fixed height: from the layout tier's row count (shared/workspace-layout.ts), so it never jumps with what
197
+ * it holds; the rows scroll inside it. A phone gets a little more, its rows wrap sooner.
198
+ */
199
+ export function stepsHeight(rows: number, compact: boolean): number {
200
+ return Math.round(Math.min(460, Math.max(compact ? 300 : 260, rows * 50)));
201
+ }
202
+
203
+ /** Within this many pixels of the end counts as reading the newest step: new rows keep it pinned. */
204
+ const PIN_SLACK = 24;
205
+ /** A quick read draws nothing; the spinner shows only after this, so a cached or fast read never flashes it. */
206
+ const SPINNER_DELAY_MS = 300;
207
+
208
+ /**
209
+ * The Chat section's body (invariant 135): one fixed-height scroll, the same for a live turn and a saved one. It opens at the
210
+ * newest step and stays there as steps arrive, unless the developer scrolled up: then a Latest button takes them
211
+ * down. Show earlier messages at the top reads one more turn back (saved transcript or live tail, never waking), and
212
+ * keeps what was on screen where it was.
213
+ */
214
+ function StepsBody({ height, theme, compact, turn, error, waiting, empty, prs, turns, onEarlier }: {
215
+ height: number; theme: Theme; compact: boolean; turn: Turn | null; error: string | null; waiting: boolean; empty: string;
216
+ prs: Workspace["prs"]; turns: number; onEarlier: () => void;
79
217
  }) {
80
218
  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>}
219
+ const ref = useRef<NativeScrollView | null>(null);
220
+ const m = useRef({ y: 0, view: 0, content: 0, pinned: true, anchor: null as null | { content: number; y: number } });
221
+ const [fresh, setFresh] = useState(false);
222
+ const [spin, setSpin] = useState(false);
223
+ // Scrolled off the top: a hairline marks the edge, so a line cut there reads as more above, not a glitch.
224
+ const [under, setUnder] = useState(false);
225
+ useEffect(() => { if (!waiting) { setSpin(false); return; } const t = setTimeout(() => setSpin(true), SPINNER_DELAY_MS); return () => clearTimeout(t); }, [waiting]);
226
+ // A read back lands as a new turn object with more rows; until then the control says it's reading.
227
+ const [asked, setAsked] = useState<Turn | null>(null);
228
+ const loadingEarlier = !!asked && asked === turn;
229
+ useEffect(() => { if (asked && asked !== turn) setAsked(null); }, [turn, asked]);
230
+ const onScroll = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
231
+ const { contentOffset, layoutMeasurement, contentSize } = e.nativeEvent;
232
+ m.current.y = contentOffset.y; m.current.view = layoutMeasurement.height; m.current.content = contentSize.height;
233
+ m.current.pinned = contentOffset.y + layoutMeasurement.height >= contentSize.height - PIN_SLACK;
234
+ if (m.current.pinned && fresh) setFresh(false);
235
+ if ((contentOffset.y > 2) !== under) setUnder(contentOffset.y > 2);
236
+ };
237
+ const onContent = (_w: number, h: number) => {
238
+ const before = m.current.content; m.current.content = h;
239
+ const anchor = m.current.anchor;
240
+ if (anchor && h > anchor.content) { m.current.anchor = null; ref.current?.scrollTo({ y: anchor.y + (h - anchor.content), animated: false }); return; }
241
+ if (m.current.pinned) ref.current?.scrollToEnd({ animated: false });
242
+ else if (h > before + 1) setFresh(true);
243
+ };
244
+ const toEnd = () => { m.current.pinned = true; setFresh(false); ref.current?.scrollToEnd({ animated: true }); };
245
+ const earlier = () => { m.current.anchor = { content: m.current.content, y: m.current.y }; m.current.pinned = false; setAsked(turn); onEarlier(); };
246
+ const note = (text: string) => <View style={{ height, justifyContent: "center" }}><Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{text}</Text></View>;
247
+ if (error) return note(`Couldn't read the steps: ${error}`);
248
+ if (!turn) return <View style={{ height, justifyContent: "center", alignItems: "flex-start" }}>{spin && <Spinner color={c.foregroundMuted} size={12} label="Reading the agent's steps" />}</View>;
249
+ if (turn.empty) return note(empty);
250
+ const more = !!turn.older && turns < MAX_TURNS;
251
+ return <View style={{ height }}>
252
+ <ScrollView ref={ref} style={{ flex: 1 }} contentContainerStyle={{ paddingTop: more ? 0 : 4, paddingBottom: 8, gap: 8 }} onScroll={onScroll} scrollEventThrottle={32}
253
+ onContentSizeChange={onContent} onLayout={e => { m.current.view = e.nativeEvent.layout.height; if (m.current.pinned) ref.current?.scrollToEnd({ animated: false }); }}
254
+ showsVerticalScrollIndicator nestedScrollEnabled {...({ dataSet: { followSteps: "" } } as object)}>
255
+ {more && <EarlierButton c={c} compact={compact} loading={loadingEarlier} onPress={earlier} />}
256
+ <PrLinksProvider prs={prLinksByNumber(prs)}><TurnView turn={turn} theme={theme} compact={compact} full /></PrLinksProvider>
257
+ </ScrollView>
258
+ {under && <View pointerEvents="none" style={{ position: "absolute", left: 0, right: 0, top: 0, height: 1, backgroundColor: c.border }} />}
259
+ {fresh && <View pointerEvents="box-none" style={{ position: "absolute", left: 0, right: 0, bottom: 10, alignItems: "center" }}>
260
+ <Pressable accessibilityRole="button" accessibilityLabel="Go to the latest steps" onPress={toEnd}
261
+ style={state => ({ flexDirection: "row", alignItems: "center", gap: 5, minHeight: compact ? 36 : 28, paddingHorizontal: 12, borderRadius: 999, borderWidth: 1, borderColor: c.border,
262
+ backgroundColor: (state as { hovered?: boolean }).hovered || state.pressed ? c.surface2 : c.surface1, ...raised(c) })}>
263
+ <Icon name="ArrowDown" size={13} color={c.foreground} />
264
+ <Text style={{ color: c.foreground, fontSize: 12, fontWeight: "500" }}>Latest</Text>
265
+ </Pressable>
109
266
  </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
267
  </View>;
113
268
  }
269
+
270
+ function EarlierButton({ c, compact, loading, onPress }: { c: Colors; compact: boolean; loading: boolean; onPress: () => void }) {
271
+ return <Pressable accessibilityRole="button" accessibilityLabel="Show earlier messages" disabled={loading} onPress={onPress}
272
+ style={state => ({ flexDirection: "row", alignItems: "center", justifyContent: "center", gap: 6, minHeight: compact ? 40 : 30, borderRadius: 6,
273
+ backgroundColor: (state as { hovered?: boolean }).hovered || state.pressed ? c.surface1 : "transparent" })}>
274
+ {loading ? <Spinner color={c.foregroundMuted} size={12} label="Reading earlier messages" /> : <Icon name="ChevronUp" size={13} color={c.foregroundMuted} />}
275
+ <Text style={{ color: c.foregroundMuted, fontSize: 12, fontWeight: "500" }}>{loading ? "Reading earlier messages" : "Show earlier messages"}</Text>
276
+ </Pressable>;
277
+ }
package/client/agents.tsx CHANGED
@@ -1,10 +1,13 @@
1
1
  import { ActivityIndicator, View } from "react-native";
2
- import { Text } from "./text";
2
+ import { Pressable, Text } from "./text";
3
+ import { OUTSIDE_RUNS_GUIDE, runsSettingsCopy } from "../shared/outside-run";
4
+ import { outsideRunsKey, useOutsideRuns } from "./updates";
3
5
  import type { PluginSurfaceProps } from "@getpaseo/plugin/client";
4
6
  import { useRpc } from "@getpaseo/plugin/client";
7
+ import { openLink } from "./open-link";
5
8
  import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, SettingsSwitch, useToast } from "@getpaseo/plugin/client/ui";
6
9
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
7
- import { agentSettingsRpc, setAgentSettingRpc, setWaitRpc } from "../shared/contracts";
10
+ import { agentSettingsRpc, setAgentSettingRpc, setOutsideRunsRpc, setWaitRpc } from "../shared/contracts";
8
11
  import { WAIT_HOST_NOTE, WAIT_NOT_ATTACHED, waitNote, waitSwitchCopy } from "../shared/wait";
9
12
  import { hasSame, isJobRole, type AgentRole, type AgentSettingsView, type SavedRole } from "../shared/agent-settings";
10
13
  import { NO_PROMPT_MODE, SETTINGS_ORDER, isReset, resetEntry } from "../shared/job-rows";
@@ -71,13 +74,53 @@ export function WaitSettings({ theme }: Pick<PluginSurfaceProps, "theme">) {
71
74
  {wait && <SettingsCard>
72
75
  {/* Paseo 0.16 (reason "host"): what the host does comes first and stays whether the switch is on or off; it's
73
76
  information, not a problem, so no alert. */}
74
- {wait.host && <Text style={[t.body, { color: c.foreground, paddingHorizontal: 16, paddingVertical: 14 }]}>{WAIT_HOST_NOTE}</Text>}
77
+ {/* A note, not a setting (P3-21): muted meta text, the card's switch below is the setting. */}
78
+ {wait.host && <Text style={[t.meta, { paddingHorizontal: 16, paddingTop: 12, paddingBottom: 4 }]}>{WAIT_HOST_NOTE}</Text>}
75
79
  <SettingsSwitch label={copy.title} hint={copy.hint} value={wait.enable_wait} disabled={change.isPending} onValueChange={value => change.mutate(value)} />
76
80
  {note && wait.enable_wait && wait.reason !== "host" && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusWarning, paddingHorizontal: 16, paddingBottom: 12 }]}>{`${WAIT_NOT_ATTACHED} ${note}`}</Text>}
77
81
  </SettingsCard>}
78
82
  </SettingsSection>;
79
83
  }
80
84
 
85
+ /**
86
+ * Settings → Agents → "Show <plugin> runs" (docs/outside-runs.md, docs/progress.md): one switch, on by default, shown only
87
+ * once a run file was seen on this host. Off: Follow-up stops reading it and drops every item and agent line from it; the
88
+ * owner is untouched either way. An unknown format turns the switch off and disabled, and its hint says why. The hint's
89
+ * link opens the guide page. Every word comes from the owner's name (runsSettingsCopy).
90
+ */
91
+ export function OutsideRunsSettings({ theme }: Pick<PluginSurfaceProps, "theme">) {
92
+ const c = theme.colors; const t = text(c);
93
+ const read = useRpc(agentSettingsRpc); const write = useRpc(setOutsideRunsRpc); const cache = useQueryClient(); const toast = useToast();
94
+ const query = useQuery({ queryKey: key, queryFn: () => read({ catalog: true }), staleTime: 5 * 60_000 });
95
+ const change = useMutation({
96
+ mutationFn: (progress: boolean) => write({ progress }),
97
+ onSuccess: value => { cache.setQueryData(key, value); cache.setQueryData(outsideRunsKey, value.outsideRuns ?? null);
98
+ if (value.outsideRuns) toast.show(`${runsSettingsCopy(value.outsideRuns).label}: ${value.outsideRuns.enabled ? "on" : "off"}`, { variant: "success" }); },
99
+ onError: error => toast.error(errorText(error)),
100
+ });
101
+ const status = query.data?.outsideRuns;
102
+ if (!status?.seen) return null;
103
+ const copy = runsSettingsCopy(status);
104
+ return <SettingsSection title="Other plugins">
105
+ <SettingsCard>
106
+ <SettingsSwitch label={copy.label} hint={copy.hint} value={status.enabled && !status.unknownFormat} disabled={change.isPending || !!status.unknownFormat} onValueChange={value => change.mutate(value)} />
107
+ <Pressable accessibilityRole="link" accessibilityLabel={`${copy.guide} (opens the guide)`} hitSlop={6} onPress={() => void openLink(OUTSIDE_RUNS_GUIDE).catch(() => toast.error("Couldn't open the link here"))}
108
+ style={{ alignSelf: "flex-start", minHeight: 44, justifyContent: "center", paddingHorizontal: 16, paddingBottom: 4 }}>
109
+ <Text style={[t.small, { color: c.accent }]}>{copy.guide}</Text>
110
+ </Pressable>
111
+ </SettingsCard>
112
+ </SettingsSection>;
113
+ }
114
+
115
+ /** Under Questions while another plugin's runs show: each plugin's mode governs its own questions, and this says whose. */
116
+ export function OwnerQuestionLine({ theme }: Pick<PluginSurfaceProps, "theme">) {
117
+ const t = text(theme.colors);
118
+ const line = useOutsideRuns().data;
119
+ const said = line ? runsSettingsCopy(line).questionLine : null;
120
+ if (!said) return null;
121
+ return <Text style={[t.meta, { paddingHorizontal: 16, paddingTop: 10, paddingBottom: 12 }]}>{said}</Text>;
122
+ }
123
+
81
124
  /** A row's More in Settings: permissions (Paseo agents), limits and schedule (jobs), and Reset to defaults. */
82
125
  function RoleMore({ r, save, busy, theme, compact, invalid }: { r: Role; save: (entry: SavedRole | null) => void; busy: boolean; theme: Theme; compact: boolean; invalid: boolean }) {
83
126
  const c = theme.colors; const t = text(c);
@@ -1,4 +1,5 @@
1
1
  import { queueMoved } from "../shared/linear-queue";
2
+ import { RichText } from "./rich-text";
2
3
  import { useCallback, useEffect, useRef, useState } from "react";
3
4
  import { PagedRows } from "./paged-list";
4
5
  import { Platform, View } from "react-native";
@@ -186,7 +187,7 @@ function QueueRow({ i, change, c, compact, timeZone, navigation }: { i: QueueIss
186
187
  <Text style={[t.meta, { color: chip.warn ? c.statusWarning : c.foreground }]}>{chip.text}</Text>
187
188
  </View>}
188
189
  {/* Phones: the workspace is a word on the meta line; the row itself opens it. */}
189
- {compact && ws && <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}><Icon name="Folder" size={12} color={c.foregroundMuted} /><Text numberOfLines={1} style={[t.meta, { color: c.foreground }]}>{ws.title}</Text></View>}
190
+ {compact && ws && <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}><Icon name="Folder" size={12} color={c.foregroundMuted} /><RichText plain numberOfLines={1} style={[t.meta, { color: c.foreground }]}>{ws.title}</RichText></View>}
190
191
  </View>
191
192
  </View>
192
193
  </View>;
@@ -202,7 +203,7 @@ function QueueRow({ i, change, c, compact, timeZone, navigation }: { i: QueueIss
202
203
  ? <Pressable accessibilityRole="button" accessibilityLabel={`Open ${ws.title}`} disabled={!navigation} onPress={open}
203
204
  style={(s: Hover) => ({ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 32, paddingHorizontal: 10, borderRadius: 8, borderWidth: 1, borderColor: c.border, backgroundColor: s.pressed ? c.surface2 : s.hovered ? c.surface1 : "transparent", maxWidth: 240, ...focusRing(c, s.focused) })}>
204
205
  <Icon name="Folder" size={14} color={c.foregroundMuted} />
205
- <Text numberOfLines={1} style={[t.small, { fontSize: 12, color: c.foreground, flexShrink: 1 }]}>{ws.title}</Text>
206
+ <RichText plain numberOfLines={1} style={[t.small, { fontSize: 12, color: c.foreground, flexShrink: 1 }]}>{ws.title}</RichText>
206
207
  <Icon name="ChevronRight" size={14} color={c.foregroundMuted} />
207
208
  </Pressable>
208
209
  : <Pressable accessibilityRole="button" accessibilityLabel={`Start ${i.key} in ${NEW_NAME}`} onPress={open}
package/client/brief.tsx CHANGED
@@ -1,9 +1,11 @@
1
1
  import { useMemo, useState, useSyncExternalStore, type ReactNode } from "react";
2
+ import { useKept } from "./kept";
3
+ import { LinkWorkspaceProvider, openLinkQuietly } from "./open-link";
2
4
  import { browserKey, liveBriefKey, LIVE_BRIEF_POLL_MS, workspaceKey } from "./keys";
3
5
  import { Platform, View, useWindowDimensions } from "react-native";
4
6
  import { Pressable, Text } from "./text";
5
7
  import { useQuery, useQueryClient } from "@tanstack/react-query";
6
- import { openExternalUrl, useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
8
+ import { useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
7
9
  import { deliveryStatus } from "../shared/queue";
8
10
  import { Icon, copyText, useToast } from "@getpaseo/plugin/client/ui";
9
11
  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";
@@ -28,7 +30,7 @@ import { useReviewerButtons } from "./reviewers-button";
28
30
  import { prLinksByNumber } from "../shared/presentation";
29
31
  import { cardStore } from "./card-store";
30
32
  import { PrSheet } from "./pr-sheet";
31
- import { isLight, withAlpha, type Colors } from "./theme";
33
+ import { disabledPrimary, isLight, withAlpha, type Colors } from "./theme";
32
34
  import { dismissToast, notice, runAction, runUndoable } from "./toasts";
33
35
  import { DismissX, RevealScope, useDismiss } from "./dismiss";
34
36
  import { clearPendingAnswer, confirmPendingAnswer, failPendingAnswer, markSentHere, setPendingAnswer } from "./pending-answers";
@@ -68,14 +70,16 @@ const ring = (focused: boolean | undefined, c: Colors) => focusRing(focused, c);
68
70
  const letters = (d: BriefDecision) => { const l = d.options.map(o => o.letter); return l.length > 1 ? `${l.slice(0, -1).join(", ")} or ${l.at(-1)}` : l[0] ?? ""; };
69
71
 
70
72
  function Btn({ label, icon, primary, onPress, c, compact, disabled, shortcut = false, hint }: { label: string; icon?: string; primary?: boolean; onPress: () => void; c: Colors; compact: boolean; disabled?: boolean; shortcut?: boolean; hint?: string }) {
71
- const fg = primary ? c.accentForeground : c.foreground;
73
+ // A disabled primary is neutral (disabledPrimary), the same as kit's Button: no faded accent, no key hint.
74
+ const off = primary && disabled ? disabledPrimary(c) : null;
75
+ const fg = off ? off.text : primary ? c.accentForeground : c.foreground;
72
76
  return <Pressable accessibilityRole="button" accessibilityLabel={label} accessibilityHint={hint} accessibilityState={{ disabled }} disabled={disabled} onPress={onPress}
73
- style={({ hovered, pressed, focused }: { hovered?: boolean; pressed: boolean; focused?: boolean }) => ({ ...ring(focused, c), minHeight: compact ? 44 : 32, paddingHorizontal: compact ? 14 : 12, borderRadius: 6, flexDirection: "row", alignItems: "center", gap: 6, justifyContent: "center", opacity: disabled ? 0.5 : 1,
74
- backgroundColor: primary ? (pressed ? withAlpha(c.accent, 0.85) : hovered ? withAlpha(c.accent, 0.92) : c.accent) : pressed || hovered ? c.surface2 : "transparent",
77
+ style={({ hovered, pressed, focused }: { hovered?: boolean; pressed: boolean; focused?: boolean }) => ({ ...ring(focused, c), minHeight: compact ? 44 : 32, paddingHorizontal: compact ? 14 : 12, borderRadius: 6, flexDirection: "row", alignItems: "center", gap: 6, justifyContent: "center", opacity: disabled && !off ? 0.5 : 1,
78
+ backgroundColor: off ? off.fill : primary ? (pressed ? withAlpha(c.accent, 0.85) : hovered ? withAlpha(c.accent, 0.92) : c.accent) : pressed || hovered ? c.surface2 : "transparent",
75
79
  borderWidth: primary ? 0 : 1, borderColor: c.border, flexGrow: compact ? 1 : 0 })}>
76
80
  {icon ? <Icon name={icon} size={compact ? 16 : 14} color={fg} /> : null}
77
81
  <Text numberOfLines={1} style={{ color: fg, fontSize: compact ? 14 : 13, lineHeight: compact ? 19 : 17, fontWeight: "600" }}>{label}</Text>
78
- {shortcut && !compact && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no" style={{ color: fg, opacity: 0.6, fontSize: 11, lineHeight: 16, fontWeight: "500" }}>{submitHint()}</Text>}
82
+ {shortcut && !disabled && !compact && Platform.OS === "web" && <Text accessibilityElementsHidden importantForAccessibility="no" style={{ color: fg, opacity: 0.6, fontSize: 11, lineHeight: 16, fontWeight: "500" }}>{submitHint()}</Text>}
79
83
  </Pressable>;
80
84
  }
81
85
 
@@ -263,7 +267,7 @@ export function BriefBody({ b, c, compact, tight, embedded, height, mode, picks,
263
267
  <Icon name={f.icon} size={12} color={col} />
264
268
  <Text style={{ color: f.tone === "muted" || isLight(c) ? c.foreground : col, fontSize: 12, lineHeight: 16, fontWeight: "500" }}>{f.label}</Text>
265
269
  </View>; })}
266
- {b.links.map((l, i) => <Pressable key={`l${i}`} accessibilityRole={l.url ? "link" : "text"} disabled={!l.url} onPress={() => l.url && void openExternalUrl(l.url).catch(() => undefined)} hitSlop={compact ? 10 : 4}
270
+ {b.links.map((l, i) => <Pressable key={`l${i}`} accessibilityRole={l.url ? "link" : "text"} disabled={!l.url} onPress={() => l.url && openLinkQuietly(l.url, { workspaceId: b.workspaceId })} hitSlop={compact ? 10 : 4}
267
271
  style={{ flexDirection: "row", alignItems: "center", gap: 5, paddingHorizontal: 8, minHeight: 24, borderRadius: 6, backgroundColor: c.surface2 }}>
268
272
  <Icon name={l.url ? "ExternalLink" : l.pr ? "GitPullRequest" : "File"} size={12} color={c.foregroundMuted} />
269
273
  <Text selectable={!l.url} numberOfLines={1} style={{ color: c.foreground, fontSize: 12, lineHeight: 16, fontWeight: "500", maxWidth: 260 }}>{l.label}</Text>
@@ -286,11 +290,14 @@ function SendBar({ b, picks, noted = 0, busy, error, onSend, c, compact }: { b:
286
290
  </View>;
287
291
  }
288
292
 
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 }) {
293
+ /**
294
+ * What the card can't say itself (where to act, or why Follow-up couldn't): the desktop footer, or on phones the line
295
+ * right after the header row, always shown. A card without a line has neither (`a-source-line-says-something`).
296
+ */
297
+ function SourceLine({ b, c }: { b: { sourceLine: string }; c: Colors }) {
291
298
  return <View style={{ flexDirection: "row", alignItems: "flex-start", gap: 6 }}>
292
299
  <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>
300
+ <Text style={{ flex: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.sourceLine}</Text>
294
301
  </View>;
295
302
  }
296
303
 
@@ -389,7 +396,7 @@ type BriefCardProps = PluginTimelineItemProps<Brief> & { deps: BriefDeps; embedd
389
396
  export function BriefCard(props: BriefCardProps) {
390
397
  const workspace = props.item.data.workspaceId ? props.deps.workspace(props.item.data.workspaceId) : undefined;
391
398
  const prs = useMemo(() => workspace ? prLinksByNumber(workspace.prs) : undefined, [workspace?.prs]);
392
- return <PrLinksProvider prs={prs}><BriefCardBody {...props} /></PrLinksProvider>;
399
+ return <LinkWorkspaceProvider workspaceId={props.item.data.workspaceId}><PrLinksProvider prs={prs}><BriefCardBody {...props} /></PrLinksProvider></LinkWorkspaceProvider>;
393
400
  }
394
401
 
395
402
  function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, snoozed = false, bare = false, onDismissed }: BriefCardProps) {
@@ -429,7 +436,6 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
429
436
  const busy = sending ?? (shown.actionable ? null : "checking");
430
437
  const [error, setError] = useState<string | null>(null);
431
438
  const toast = useToast();
432
- const [why, setWhy] = useState(false);
433
439
  // Done collapses the card the moment it's pressed; the server's answered brief replaces this when the send lands.
434
440
  const [marked, setMarked] = useState<string | null>(null);
435
441
  // The send landed: green at once, before the server's answered brief replaces the card.
@@ -441,7 +447,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
441
447
  const words = useWords(b.id);
442
448
  const notes = useNotes(b.id);
443
449
  const notesOpen = useNotesOpen(b.id);
444
- const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
450
+ const [sheet, setSheet] = useKept<{ key: string; intent: "merge" | "reviewers" } | null>(`brief:${b.id}:sheet`, null);
445
451
  // The PR sheet draws review and deploy detail the list form leaves out: one read of the full workspace while it's open.
446
452
  const detail = useWorkspace(undefined, row.workspaceId ?? "", { enabled: !!sheet });
447
453
  useDetailGate(detail.failure, !!sheet, () => setSheet(null));
@@ -517,7 +523,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
517
523
  const one = oneClick(m);
518
524
  if (one) one.run();
519
525
  else if ((m.kind === "merge" || m.kind === "add_reviewers") && m.prKey) { if (workspace?.prs.some(p => p.key === m.prKey)) setSheet({ key: m.prKey, intent: m.kind === "merge" ? "merge" : "reviewers" }); else if (b.workspaceId) deps.openPanel(b.workspaceId); }
520
- else if (m.kind === "open_pr" && m.url) void openExternalUrl(m.url).catch(() => undefined);
526
+ else if (m.kind === "open_pr" && m.url) openLinkQuietly(m.url, { workspaceId: b.workspaceId });
521
527
  else if (m.kind === "sign_off_next") { deps.signOff(agentId); deps.openNext(agentId); }
522
528
  else if (m.kind === "retry") void run("retry", answerId => act({ agentId, briefId: b.id, move: "retry", answerId }), "Retry didn't start");
523
529
  else if (m.kind === "done") markDone();
@@ -540,7 +546,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
540
546
  if (b.slim) {
541
547
  // Permission: Paseo's own prompt below is the control (F9). Fallback: the paragraph is right above.
542
548
  // The label and age share the top line so the ask always gets the full width; at a narrow panel the move wraps under it.
543
- return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you: " : ""}${askText}. ${b.sourceLine}`}
549
+ return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you: " : ""}${askText}.${b.sourceLine ? ` ${b.sourceLine}` : ""}`}
544
550
  style={[{ marginVertical: embedded ? 0 : 10, gap: 4, paddingHorizontal: 12, paddingVertical: 10, borderRadius: 10, borderWidth: 1, borderColor: border }, bare && BARE]}>
545
551
  <View style={{ flexDirection: "row", alignItems: "center", gap: 7 }}>
546
552
  <Icon name={ICON[b.kind]} size={14} color={tone} />
@@ -614,7 +620,7 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
614
620
  const sendOther = (decisionId: string) => { const text = words[decisionId]?.trim(); if (text) void run(`${decisionId}:${OTHER}`, async answerId => { await answer([{ decisionId, choice: OTHER, words: text }], answerId); clearCard(b.id); }); };
615
621
  return <RevealScope accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you" : flaggedAct ? "Later" : word(b.kind)}: ${askText}`}
616
622
  style={[{ marginVertical: embedded ? 0 : 10, borderRadius: 12, borderWidth: 1, borderColor: border, backgroundColor: c.surface1, overflow: "hidden" }, bare && BARE]}>
617
- <SubmitScope enabled={!!keySend && !busy} onSubmit={() => keySend?.()} style={{ paddingHorizontal: pad, paddingTop: compact ? 12 : 14, paddingBottom: 14, gap: tight ? 10 : 12 }}>
623
+ <SubmitScope message compact={compact} enabled={!!keySend && !busy} onSubmit={() => keySend?.()} style={{ paddingHorizontal: pad, paddingTop: compact ? 12 : 14, paddingBottom: 14, gap: tight ? 10 : 12 }}>
618
624
  <View style={{ gap: 4 }}>
619
625
  <View style={{ flexDirection: "row", alignItems: "center", gap: 7 }}>
620
626
  <Icon name={ICON[b.kind]} size={14} color={tone} />
@@ -624,18 +630,13 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
624
630
  <View style={{ flex: 1 }} />
625
631
  {/* In Later the age would read as a second clock beside "Later until"; the pane header keeps it. */}
626
632
  {!snoozed && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{ageText}</Text>}
627
- {/* Phones: where the card's facts come from sits behind ⓘ instead of a footer under every card. */}
628
- {compact && <Pressable accessibilityRole="button" accessibilityLabel={why ? "Hide where this comes from" : "Where this comes from"} aria-expanded={why} accessibilityState={{ expanded: why }}
629
- onPress={() => setWhy(v => !v)} style={{ width: 44, height: 44, marginVertical: -15, marginRight: x ? -10 : -14, alignItems: "center", justifyContent: "center" }}>
630
- <Icon name="Info" size={14} color={why ? c.foreground : c.foregroundMuted} />
631
- </Pressable>}
632
633
  {/* The x is always the card's last control, in its top-right corner, on every Needs-you item. */}
633
634
  {x}
634
635
  </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} />}
638
- {/* The ask role on phones (react-native-web ignores hitSlop, so the ⓘ above is a real 44 box); desktop keeps 19/26. */}
636
+ {/* Phones: the card's source line, when it has one, is the element right after the header row, always shown: every
637
+ line says where to act, so hiding it would cost a tap for nothing, and a footer sits off screen on a tall card. */}
638
+ {compact && !!b.sourceLine && <SourceLine b={{ sourceLine: b.sourceLine }} c={c} />}
639
+ {/* The ask role on phones; desktop keeps 19/26. */}
639
640
  {/* Bare: a section of the Needs you block, so the same size as its question titles. */}
640
641
  <RichText accessibilityRole="header" style={compact || bare ? text(c, compact).ask : { color: c.foreground, fontSize: 19, lineHeight: 26, fontWeight: "600", letterSpacing: -0.2 }}>{askText}</RichText>
641
642
  </View>
@@ -662,8 +663,8 @@ function BriefCardBody({ item, theme, layout, agentId, deps, embedded = false, s
662
663
  {!tight && !!b.also.context && <RichText linkColor={c.foreground} numberOfLines={3} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{b.also.context}</RichText>}
663
664
  </View>}
664
665
  </SubmitScope>
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>}
666
+ {/* Desktop: the card's source line is its footer, always shown when the card has one. */}
667
+ {!compact && !!b.sourceLine && <View style={{ borderTopWidth: 1, borderTopColor: c.border, paddingHorizontal: pad, paddingVertical: 8 }}><SourceLine b={{ sourceLine: b.sourceLine }} c={c} /></View>}
667
668
  {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)} />}
668
669
  </RevealScope>;
669
670
  }