paseo-follow-up 2.6.0-beta.13 → 2.6.0-beta.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,20 +4,25 @@ What changed in each version of Follow-up, newest first. Follow-up shows "What's
4
4
 
5
5
  ## 2.6.0 (2026-11-30)
6
6
 
7
- Agents can show you their work right in Follow-up, Follow-up can be your sidebar, and lots of small stuff got fixed.
7
+ A new workspace view, a redesigned sidebar, agents that show you their work, and lots of fixes.
8
8
 
9
- - **Follow-up can be your sidebar.** Pick it in Paseo's sidebar settings. It looks like Paseo's own list, with your pins on top and status counts you tap to filter.
9
+ - **Clicking a workspace in the sidebar opens its new workspace view**, with all you need to run it: PRs and checks, what needs you, each agent's chat with a reply box, your questions, tasks and activity.
10
+
11
+ ![The workspace view in its own tab: the workspace's PRs and their progress, a question waiting in Needs you, and the main agent's chat](https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/7790cf60072ca6a2c802761eca7a5d1299d13f63/docs/screenshots/follow-up-notes-260-view.png#1120x512)
12
+
13
+ - **The sidebar got a redesign.** It looks like Paseo's own list, with your pins on top and status counts you tap to filter.
10
14
 
11
15
  ![Follow-up as Paseo's sidebar: status counts under the filter, the Overseer and two pinned workspaces on top, then Needs you](https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/1e525ee3ebf415c5c8f173dc883326bdaff5bdc6/docs/screenshots/follow-up-notes-260-sidebar.png#321x380)
12
16
 
13
- - **One workspace view everywhere.** Home's pane, the side panel and its own tab show the same view, laid out for the width. Sections fold, and each agent's chat sits right there with a reply box.
14
- - **Agents can show you things.** Screenshots, before and after shots, benchmarks, tables or a report show up as cards in the workspace view, next to the question they're about.
17
+ - **Agents can show you things.** Screenshots, benchmarks, tables or a report show up as cards in the workspace view, by the question they're about.
15
18
 
16
19
  ![An agent's card in the workspace view: before and after latency as bars for p50, p95 and p99, a table of endpoints with the change, and a link to a flame graph](https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/ea45a1394e99759323d7015e7f35810f51f8ad85/docs/screenshots/follow-up-notes-260-cards.png#550x441)
17
20
 
18
- - **Ask an agent something** from the panel or Home, or with /ask in its chat. The answer stays in Your questions.
19
- - **See what an agent is up to.** Each agent's line says what it's working on, and resting the pointer on it shows its latest steps. Type / in a reply box for its commands and skills, also mid-message.
20
- - **Works with any agent Paseo runs**, not only Claude Code and Codex. Repairs also reach agents Paseo put to sleep, things open faster, and plenty of smaller fixes.
21
+ - **Progress runs show up here.** The agent's line shows the Progress ticket, and its questions and stuck tickets land in Needs you, answerable right there.
22
+ - **Ask an agent something** from the panel or Home, or with /ask in its chat; the answer stays in Your questions. Rest the pointer on an agent's line for its latest steps.
23
+ - **Works with any agent Paseo runs**, and repairs reach agents Paseo put to sleep.
24
+
25
+ Agent cards, questions you ask in chat and Follow-up beside the chat can each be turned off in Settings. More in the [full changelog](https://github.com/tomgrin10/paseo-follow-up/releases/tag/v2.6.0).
21
26
 
22
27
  <details><summary>Full changelog since 2.5.1</summary>
23
28
 
@@ -40,7 +45,7 @@ Agents can show you their work right in Follow-up, Follow-up can be your sidebar
40
45
  - Every running workspace says what each agent is working on and what it's doing now, on Home and at the top of the panel: "Capping the retry gap 2 of 4 · working 6m".
41
46
  - A first install opens a welcome popup with what Follow-up does and a Set up button, and setup now runs inside it. Close it any time: Home shows Finish setup, which opens it again where you left off.
42
47
  - One workspace view in Home's pane, the right side panel and a new main-area tab, laid out from its width (one to three columns). Each agent's Chat section and the reply box sit together, read without waking the agent.
43
- - Opening a workspace from Follow-up's sidebar list opens its view or its main agent's chat (Settings → Inbox & display → Opening a workspace); Cmd/Ctrl-click opens the other.
48
+ - Opening a workspace from Follow-up's sidebar list opens its view or its main agent's chat (Settings → Inbox & display → Opening from the sidebar and Home); Cmd/Ctrl-click opens the other.
44
49
  - Permissions appear in Needs you with Allow and Deny; amber now marks only what needs you, and section help sits behind a ? icon.
45
50
  - Your questions: ask an agent from the panel or Home, or type /ask in its chat, and the answer stays with Done, Reply and Make a task for 30 days.
46
51
  - An answer you haven't read shows in Needs you and Catch up. When the agent answers in its chat instead, Follow-up keeps its reply as the answer.
@@ -5,7 +5,7 @@ import { displayFeed, inboxListRpc, trustBypassRpc } from "../shared/contracts";
5
5
  import { openFeed } from "./feeds";
6
6
  import { SettingsAction, SettingsCard, SettingsSection, SettingsSelect, SettingsSwitch } from "@getpaseo/plugin/client/ui";
7
7
  import { isMac, searchShortcutOf, searchShortcutOptions, type SearchShortcut , isDesktopApp, newShortcutHint, newShortcutOptions, newShortcutPreset, type NewShortcut} from "../shared/search-key";
8
- import { useEffect } from "react";
8
+ import { useEffect, useSyncExternalStore } from "react";
9
9
  import { ActivityIndicator, Platform, View } from "react-native";
10
10
  import { Text } from "./text";
11
11
  import { sharedRead } from "./shared-read";
@@ -21,6 +21,13 @@ export function subscribeDisplay(listener: (values: Display) => void) { listener
21
21
  let latest: Display | null = null;
22
22
  listeners.add(values => { latest = values; });
23
23
  export const displayValues = (): Display | null => latest;
24
+ /**
25
+ * Display enable_cards as this client last read it, live: false only once a read said off (unknown is on, invariant 7).
26
+ * Every place that draws an agent's card, or a link to one, asks this, so off draws none (docs/cards.md).
27
+ */
28
+ export function useCardsOn(): boolean {
29
+ return useSyncExternalStore(subscribeDisplay, () => latest?.enable_cards !== false, () => true);
30
+ }
24
31
  /**
25
32
  * The Display document as it arrives (the feed's push or a read), for Home's order (client/home-view.ts): one
26
33
  * follow.display-feed per client, the Display store's (invariant 142). A late follower gets the last document at once.
@@ -71,6 +78,27 @@ export function PermissionsSection({ theme }: Pick<PluginSurfaceProps, "theme">)
71
78
  </SettingsSection>;
72
79
  }
73
80
 
81
+ /**
82
+ * Settings → Agents → Questions, a card under the question mode: the switches that take a 2.6 feature from agents
83
+ * (shared/agent-text.mjs featuresOff). Off, agents aren't offered the tool or told about it, so it costs no tokens.
84
+ */
85
+ export function AgentFeatureRows({ theme }: Pick<PluginSurfaceProps, "theme">) {
86
+ const settings = useSettings(displayPreferences);
87
+ if (settings.status === "loading") return null;
88
+ if (settings.status !== "ready") return <SettingsCard>
89
+ <SettingsAction label="Couldn't load Agent cards and Questions you ask in chat" hint={settings.error} actionLabel="Retry" onPress={() => void settings.reload()} />
90
+ {settings.status === "invalid" && <SettingsAction label="Replace invalid display settings with defaults" actionLabel="Reset" disabled={settings.saving} onPress={() => void settings.reset()} />}
91
+ </SettingsCard>;
92
+ const save = (patch: Partial<Display>) => void settings.save({ ...settings.values, ...patch }, settings.revision);
93
+ return <>
94
+ <SettingsCard>
95
+ <SettingsSwitch label="Agent cards" hint="Screenshots, benchmarks and reports agents show in the workspace view. Off: none are shown and agents can't add them." value={settings.values.enable_cards} disabled={settings.saving} onValueChange={(enable_cards) => save({ enable_cards })} />
96
+ <SettingsSwitch label="Questions you ask in chat" hint="They land in Your questions with the answer. Off: they stay in the chat. /ask still adds one." value={settings.values.enable_chat_questions} disabled={settings.saving} onValueChange={(enable_chat_questions) => save({ enable_chat_questions })} />
97
+ </SettingsCard>
98
+ {settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
99
+ </>;
100
+ }
101
+
74
102
  /** A neutral "Beta" chip for section titles. */
75
103
  export function BetaChip({ theme }: Pick<PluginSurfaceProps, "theme">) {
76
104
  return <View style={{ paddingHorizontal: 6, paddingVertical: 1, borderRadius: 4, backgroundColor: theme.colors.surface2 }}>
@@ -112,12 +140,14 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
112
140
  </SettingsCard>
113
141
  {settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
114
142
  </SettingsSection>
115
- <SettingsSection title="Opening a workspace" info="From Follow-up's sidebar list and Home's Open. Cmd or Ctrl-click opens the other one.">
143
+ <SettingsSection title="Opening from the sidebar and Home" info="A workspace in Follow-up's sidebar list or Home's Open. Cmd or Ctrl-click opens the other one.">
116
144
  <SettingsCard>
117
145
  <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."
118
146
  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}
119
147
  onValueChange={(open_workspace_on: OpenWorkspaceOn) => save({ open_workspace_on })} />
148
+ <SettingsSwitch label="Show Follow-up beside the chat" hint="Opening a chat from Follow-up also opens its workspace view in the side panel. Off: just the chat." value={settings.values.enable_dock_beside_chat} disabled={settings.saving} onValueChange={(enable_dock_beside_chat) => save({ enable_dock_beside_chat })} />
120
149
  </SettingsCard>
150
+ {settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
121
151
  </SettingsSection>
122
152
  {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.">
123
153
  <SettingsCard>
package/client/home.tsx CHANGED
@@ -71,7 +71,7 @@ import { useMarkTimelineOnScreen } from "./on-screen";
71
71
  import { WorkspaceView, useSessionFolds } from "./panel";
72
72
  import { RecentSteps } from "./agent-card";
73
73
  import { rowOpenSteps } from "../shared/display";
74
- import { runOpenSteps } from "./open-steps";
74
+ import { dockBesideChat, runOpenSteps } from "./open-steps";
75
75
  import { displayValues } from "./display";
76
76
  import type { Workspace } from "../shared/model";
77
77
  import type { SearchKey } from "./search-key";
@@ -261,7 +261,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
261
261
  // The chat (Enter, Open on chat): its agent's chat with Follow-up docked in the side panel, never the tab beside it.
262
262
  const openFull = useCallback((s: Workstream) => {
263
263
  if (!navigation) return;
264
- runOpenSteps(rowOpenSteps(s, "chat", false, compact), homeOpeners(navigation, deps));
264
+ runOpenSteps(rowOpenSteps(s, "chat", false, compact, dockBesideChat()), homeOpeners(navigation, deps));
265
265
  }, [navigation, compact, deps]);
266
266
  // The row menu's Answer: select the row (phones: open its screen) with that question's card open.
267
267
  const [ask, setAsk] = useState<{ key: string; id: string; n: number } | null>(() => params.question && params.item ? { key: params.item, id: params.question, n: 1 } : null);
@@ -665,7 +665,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
665
665
  const folds = useSessionFolds(s.workspaceId ?? "");
666
666
  // Open: the workspace view's tab or the agent's chat, as Display open_workspace_on says (Enter still opens the chat,
667
667
  // invariant 57).
668
- const openPlan = rowOpenSteps(s, displayValues()?.open_workspace_on, false, compact);
668
+ const openPlan = rowOpenSteps(s, displayValues()?.open_workspace_on, false, compact, dockBesideChat());
669
669
  const opensView = openPlan.some(step => step.kind === "view");
670
670
  const open = () => { if (navigation) runOpenSteps(openPlan, homeOpeners(navigation, deps)); };
671
671
  // A workspace row is the workspace view (invariant 135), with Home's own moves in its head and, on a phone, its dock.
package/client/linked.tsx CHANGED
@@ -1,6 +1,7 @@
1
1
  import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
2
2
  import { useOpenLink } from "./open-link";
3
3
  import { SpecCardChip } from "./shown-cards";
4
+ import { useCardsOn } from "./display";
4
5
  import { Platform, View, type TextInput as NativeTextInput } from "react-native";
5
6
  import { Pressable, Text } from "./text";
6
7
  import { useRpc } from "@getpaseo/plugin/client";
@@ -110,7 +111,7 @@ export function ReferencesLine({ workspace: w, theme, compact }: { workspace: Wo
110
111
  const sheets = useLinkedSheets(w, theme, compact);
111
112
  const counts = query.data?.counts as LinkedView["counts"] | undefined;
112
113
  // The agent keeps its spec as the card `spec` (docs/cards.md): the header's spec link goes to that card.
113
- const specCard = !!w.shownCards?.some(s => s.id === "spec");
114
+ const specCard = useCardsOn() && !!w.shownCards?.some(s => s.id === "spec");
114
115
  if (!referencesShown(w.spec?.url || (specCard ? "card" : null), counts)) return sheets.element;
115
116
  const model = linkedChip(counts, compact ? CHIP_MAX.phone : CHIP_MAX.desktop);
116
117
  return <>
@@ -1,8 +1,12 @@
1
1
  import { rowOpenSteps, type OpenStep } from "../shared/display";
2
+ import { displayValues } from "./display";
2
3
 
3
4
  /** What each step of `rowOpenSteps` does on this surface. */
4
5
  export type StepOpeners = { [K in OpenStep["kind"]]: (id: string) => void };
5
6
 
7
+ /** Display enable_dock_beside_chat as this client last read it (undefined until the first read: dock, invariant 7). */
8
+ export const dockBesideChat = (): boolean | undefined => displayValues()?.enable_dock_beside_chat;
9
+
6
10
  /** Runs a row's open steps in order (invariant 135): every surface that opens a picked row goes through here. */
7
11
  export function runOpenSteps(steps: readonly OpenStep[], open: StepOpeners): void {
8
12
  for (const step of steps) open[step.kind](step.kind === "agent" ? step.agentId : step.workspaceId);
@@ -11,8 +15,8 @@ export function runOpenSteps(steps: readonly OpenStep[], open: StepOpeners): voi
11
15
  /**
12
16
  * Open chat, wherever it's offered (Home's Enter and Open full, a row menu's Open chat, the workspace view's More and its
13
17
  * tab's Open chat): the agent's chat with the view docked in the side panel beside it (`rowOpenSteps` with the chat;
14
- * none on a phone). 2.6.0-beta.12: the view's More opened the chat alone, so Home's pane menu never docked.
18
+ * none on a phone, nor with Display enable_dock_beside_chat off). 2.6.0-beta.12: the view's More opened the chat alone, so Home's pane menu never docked.
15
19
  */
16
20
  export function openRowChat(row: { agentId: string | null; workspaceId: string | null }, compact: boolean, open: StepOpeners): void {
17
- runOpenSteps(rowOpenSteps(row, "chat", false, compact), open);
21
+ runOpenSteps(rowOpenSteps(row, "chat", false, compact, dockBesideChat()), open);
18
22
  }
@@ -1,6 +1,6 @@
1
1
  import { createContext, useContext, type ReactNode } from "react";
2
2
  import { useOpenLink } from "./open-link";
3
- import { Platform, StyleSheet, View, type StyleProp, type TextStyle } from "react-native";
3
+ import { Platform, StyleSheet, View, type StyleProp, type TextStyle, type ViewStyle } from "react-native";
4
4
  import { Text } from "./text";
5
5
  import { linkify, type NumberedPr } from "../shared/links";
6
6
  import { highlightRuns, type Range } from "../shared/search";
@@ -32,6 +32,22 @@ export function PrLinksProvider({ prs, children }: { prs: ReadonlyMap<number, Nu
32
32
  // Web: a long URL has no spaces to wrap at, so let it break anywhere rather than push the sheet sideways.
33
33
  const wrap: TextStyle = Platform.OS === "web" ? { overflowWrap: "anywhere", wordBreak: "break-word" } as unknown as TextStyle : {};
34
34
 
35
+ /** Style keys that only style words. Everything else in a caller's style (flex, padding, margins, width...) is layout. */
36
+ const TEXT_KEYS = new Set(["color", "fontFamily", "fontSize", "fontStyle", "fontWeight", "fontVariant", "letterSpacing", "lineHeight",
37
+ "textAlign", "textAlignVertical", "textDecorationLine", "textDecorationStyle", "textDecorationColor", "textShadowColor", "textShadowOffset",
38
+ "textShadowRadius", "textTransform", "writingDirection", "includeFontPadding", "userSelect", "whiteSpace", "wordBreak", "overflowWrap", "fontFeatureSettings"]);
39
+ /**
40
+ * A caller's style split into what styles the words (`text`, for every inner piece) and what lays out the whole
41
+ * RichText (`box`, for its outer element once): `rich-text-caller-style-is-the-outer-box`. A caller's `flex: 1` on
42
+ * every inner piece made a list's marker grow like its text, putting each item's words halfway across.
43
+ */
44
+ export function splitStyle(style: StyleProp<TextStyle>): { text: TextStyle; box: ViewStyle } {
45
+ const text: Record<string, unknown> = {}; const box: Record<string, unknown> = {};
46
+ for (const [k, v] of Object.entries(StyleSheet.flatten(style) ?? {})) (TEXT_KEYS.has(k) ? text : box)[k] = v;
47
+ return { text: text as TextStyle, box: box as ViewStyle };
48
+ }
49
+ const textOf = (style: StyleProp<TextStyle>) => splitStyle(style).text;
50
+
35
51
  /** One link: underlined, an anchor on web (Tab reaches it, Enter opens it), opened through Paseo's one link opener. */
36
52
  function LinkRun({ url, label, linkColor, open, children }: { url: string; label?: string; linkColor?: string; open: (url: string) => void; children: ReactNode }) {
37
53
  return <Text accessibilityRole="link" accessibilityLabel={label ?? `Open ${typeof children === "string" ? children : url}`} accessibilityHint="Opens in your browser"
@@ -79,14 +95,15 @@ export function RichText({ children, style, linkColor, numberOfLines, selectable
79
95
  if (hasImage(children ?? "")) {
80
96
  const parts = imageParts(children ?? "");
81
97
  if (thumbs) {
82
- return <View style={{ gap: 6, minWidth: 0, alignSelf: "stretch" }}>{parts.map((part, i) => typeof part === "string"
83
- ? (part.trim() ? <RichText key={i} style={style} linkColor={linkColor} selectable={selectable} accessibilityRole={accessibilityRole}>{part.trim()}</RichText> : null)
84
- : <TextImage key={i} alt={part.alt} src={part.src} colors={markdown} linkColor={linkColor} open={open} style={style} />)}</View>;
98
+ const { text: words, box } = splitStyle(style);
99
+ return <View style={[{ gap: 6, minWidth: 0, alignSelf: "stretch" }, box]}>{parts.map((part, i) => typeof part === "string"
100
+ ? (part.trim() ? <RichText key={i} style={words} linkColor={linkColor} selectable={selectable} accessibilityRole={accessibilityRole}>{part.trim()}</RichText> : null)
101
+ : <TextImage key={i} alt={part.alt} src={part.src} colors={markdown} linkColor={linkColor} open={open} style={words} />)}</View>;
85
102
  }
86
103
  return <Text style={[style, wrap]} numberOfLines={numberOfLines} selectable={selectable} accessibilityRole={accessibilityRole} {...(tooltip && Platform.OS === "web" ? { title: tooltip } as object : {})}>
87
104
  {parts.map((part, i) => typeof part === "string"
88
105
  ? (plain ? part : linkify(part, prs).map((r, j) => r.url ? <LinkRun key={`${i}.${j}`} url={r.url} label={r.label ?? `Open ${r.text}`} linkColor={linkColor} open={open}>{r.text}</LinkRun> : r.text))
89
- : <ImageChip key={i} alt={part.alt} src={part.src} colors={markdown} linkColor={linkColor} open={plain ? undefined : open} style={style} />)}
106
+ : <ImageChip key={i} alt={part.alt} src={part.src} colors={markdown} linkColor={linkColor} open={plain ? undefined : open} style={textOf(style)} />)}
90
107
  </Text>;
91
108
  }
92
109
  const runs = linkify(children ?? "", prs);
@@ -146,10 +163,11 @@ const lineOf = (c: Colors | undefined) => withAlpha(c?.border ?? NEUTRAL, c ? 0.
146
163
  /** Spans inside one <Text>: styled runs, Markdown links, and bare URLs or PR refs linked by shared/links.ts (`plain`: no links, the words only). */
147
164
  function Spans({ spans, colors: c, linkColor, prs, open, style, plain, mark }: { spans: MdSpan[]; mark?: (text: string, i: number) => ReactNode } & MdProps) {
148
165
  // Inline code a step smaller than the words around it (a 17 px title, 13 px meta), never a fixed 12 beside them.
149
- const around = StyleSheet.flatten(style)?.fontSize;
166
+ const words = textOf(style);
167
+ const around = words.fontSize;
150
168
  const codeSize = typeof around === "number" ? Math.max(11, Math.round(around * 0.9)) : 12;
151
169
  return <>{spans.map((s, i) => {
152
- if (s.image) return <ImageChip key={i} alt={s.text} src={s.image} colors={c} linkColor={linkColor} open={plain ? undefined : open} style={style} />;
170
+ if (s.image) return <ImageChip key={i} alt={s.text} src={s.image} colors={c} linkColor={linkColor} open={plain ? undefined : open} style={words} />;
153
171
  const look: TextStyle = {
154
172
  // A one-line row's code keeps regular weight: semibold on a tint reads as a search hit there (hitStyle).
155
173
  ...(s.bold && !(plain && s.code) ? { fontWeight: "600" } : null),
@@ -157,11 +175,11 @@ function Spans({ spans, colors: c, linkColor, prs, open, style, plain, mark }: {
157
175
  ...(s.strike ? { textDecorationLine: "line-through" } : null),
158
176
  ...(s.code ? { fontFamily: monoFamily, fontSize: codeSize, backgroundColor: tintOf(c, 0.16), borderRadius: 3, ...(Platform.OS === "web" ? { paddingHorizontal: 3 } : null) } : null),
159
177
  };
160
- const words = mark ? mark(s.text, i) : s.text;
161
- if (plain) return Object.keys(look).length || mark ? <Text key={i} style={look}>{words}</Text> : s.text;
178
+ const shown = mark ? mark(s.text, i) : s.text;
179
+ if (plain) return Object.keys(look).length || mark ? <Text key={i} style={look}>{shown}</Text> : s.text;
162
180
  if (s.url) return <Text key={i} style={look}><LinkRun url={s.url} linkColor={linkColor} open={open}>{s.text}</LinkRun></Text>;
163
181
  const runs = s.code ? [{ text: s.text } as { text: string; url?: string; label?: string }] : linkify(s.text, prs);
164
- if (!runs.some(r => r.url)) return Object.keys(look).length || mark ? <Text key={i} style={look}>{words}</Text> : s.text;
182
+ if (!runs.some(r => r.url)) return Object.keys(look).length || mark ? <Text key={i} style={look}>{shown}</Text> : s.text;
165
183
  return <Text key={i} style={look}>{runs.map((r, j) => r.url ? <LinkRun key={j} url={r.url} label={r.label ?? `Open ${r.text}`} linkColor={linkColor} open={open}>{r.text}</LinkRun> : r.text)}</Text>;
166
184
  })}</>;
167
185
  }
@@ -179,7 +197,7 @@ function SpanBlock({ spans, textStyle, numberOfLines, ...p }: { spans: MdSpan[];
179
197
  }
180
198
  return <View style={{ gap: 6, minWidth: 0, flex: 1, alignSelf: "stretch" }}>{groups.map((g, i) => Array.isArray(g)
181
199
  ? (g.some(s => s.text.trim()) ? <Text key={i} style={textStyle} numberOfLines={numberOfLines} selectable={p.selectable}><Spans spans={trimEnds(g)} {...p} /></Text> : null)
182
- : <TextImage key={i} alt={g.text} src={g.image!} colors={p.colors} linkColor={p.linkColor} open={p.open} style={p.style} />)}</View>;
200
+ : <TextImage key={i} alt={g.text} src={g.image!} colors={p.colors} linkColor={p.linkColor} open={p.open} style={textOf(p.style)} />)}</View>;
183
201
  }
184
202
  /** A run's leading and trailing spaces and line breaks dropped (they sat against an image now on its own line). */
185
203
  function trimEnds(spans: MdSpan[]): MdSpan[] {
@@ -227,7 +245,9 @@ function MarkdownText({ source, numberOfLines, ...p }: { source: string; numberO
227
245
  if (blocks.length === 1 && blocks[0]!.kind === "paragraph" && !(p.thumbs && blocks[0]!.spans.some(s => s.image))) {
228
246
  return <Text style={[p.style, wrap]} numberOfLines={numberOfLines} selectable={p.selectable}><Spans spans={blocks[0]!.spans} {...p} /></Text>;
229
247
  }
230
- return <View style={{ gap: 6, minWidth: 0, alignSelf: "stretch" }}>{renderBlocks(blocks, numberOfLines ?? Infinity, p).nodes}</View>;
248
+ // Several blocks: the caller's layout goes on this box once, and only its text style reaches the blocks inside.
249
+ const { text, box } = splitStyle(p.style);
250
+ return <View style={[{ gap: 6, minWidth: 0, alignSelf: "stretch" }, box]}>{renderBlocks(blocks, numberOfLines ?? Infinity, { ...p, style: text }).nodes}</View>;
231
251
  }
232
252
 
233
253
  const lines = (t: string) => t.split("\n").reduce((n, l) => n + Math.max(1, Math.ceil(l.length / CHARS_PER_LINE)), 0);
@@ -244,7 +264,8 @@ const spanLines = (spans: MdSpan[], thumbs?: boolean) => { const words = spans.f
244
264
  */
245
265
  function renderBlocks(blocks: MdBlock[], budget: number, p: MdProps, muted = false): { nodes: ReactNode[]; used: number; cut: boolean } {
246
266
  const c = p.colors;
247
- const base: StyleProp<TextStyle> = [p.style, wrap, muted ? (c ? { color: c.foregroundMuted } : { opacity: 0.75 }) : null];
267
+ // Text style only: a caller's layout (flex, padding, margins) is the outer box's, never each block's or marker's.
268
+ const base: StyleProp<TextStyle> = [textOf(p.style), wrap, muted ? (c ? { color: c.foregroundMuted } : { opacity: 0.75 }) : null];
248
269
  const out: ReactNode[] = [];
249
270
  const bounded = Number.isFinite(budget);
250
271
  let left = budget;
@@ -263,13 +284,18 @@ function renderBlocks(blocks: MdBlock[], budget: number, p: MdProps, muted = fal
263
284
  }
264
285
  case "list": {
265
286
  const rows: ReactNode[] = [];
287
+ // One number column for the whole list ("10." as wide as "9."), and a nested item's marker under its parent's
288
+ // words: indent by the top level's marker column plus the gap.
289
+ const numbered = (m: string) => /^\d/.test(m);
290
+ const numW = Math.max(18, 8 * Math.max(0, ...b.items.filter(x => numbered(x.marker)).map(x => x.marker.length)) + 2);
291
+ const step = (b.ordered ? numW : 10) + 6;
266
292
  for (let j = 0; j < b.items.length; j++) {
267
293
  if (left <= 0) { cut = true; break; }
268
294
  const it = b.items[j]!;
269
295
  const n = spanLines(it.spans, p.thumbs);
270
296
  const block = SpanBlock({ spans: it.spans, textStyle: base, numberOfLines: bounded ? left : undefined, ...p });
271
- rows.push(<View key={j} style={{ flexDirection: "row", gap: 6, paddingLeft: it.depth * 14, minWidth: 0 }}>
272
- <Text style={[base, { flexShrink: 0, minWidth: b.ordered ? 18 : 10 }, c ? { color: c.foregroundMuted } : { opacity: 0.75 }]}>{it.marker}</Text>
297
+ rows.push(<View key={j} style={{ flexDirection: "row", gap: 6, paddingLeft: it.depth * step, minWidth: 0 }}>
298
+ <Text style={[base, { flexShrink: 0, minWidth: numbered(it.marker) ? numW : 10, fontVariant: ["tabular-nums"] }, c ? { color: c.foregroundMuted } : { opacity: 0.75 }]}>{it.marker}</Text>
273
299
  {block ?? <Text style={[base, { flex: 1, minWidth: 0 }]} numberOfLines={bounded ? left : undefined} selectable={p.selectable}><Spans spans={it.spans} {...p} /></Text>}
274
300
  </View>);
275
301
  if (n > left) cut = true;
@@ -13,7 +13,7 @@ import { skipToken, useMutation, useQuery, useQueryClient } from "@tanstack/reac
13
13
  import { followSettingsRpc, projectSettingsRpc, setFollowSettingsRpc, setProjectTrackingRpc } from "../shared/contracts";
14
14
  import { DEFAULT_MAX_AUTO_SENDS, MAX_AUTO_SENDS_RANGE } from "../shared/send-decision";
15
15
  import { Switch, bottomInset, errorText, space, text, type Theme } from "./kit";
16
- import { DisplaySections, PermissionsSection } from "./display";
16
+ import { AgentFeatureRows, DisplaySections, PermissionsSection } from "./display";
17
17
  import { ReviewerSettings, reviewerSettingsKey } from "./reviewers";
18
18
  import { AgentSettings, OutsideRunsSettings, OwnerQuestionLine, WaitSettings, agentSettingsKey } from "./agents";
19
19
  import { ShippingSettings } from "./shipping";
@@ -45,7 +45,7 @@ function QuestionSettings({ theme }: Pick<PluginSurfaceProps, "theme">) {
45
45
  const c = theme.colors;
46
46
  const settings = useSettings(questionPreferences);
47
47
  const toast = useToast();
48
- const info = "Agents ask decisions they can't make themselves in Follow-up, with lettered options and a recommendation. The mode tells the agent what to do until you answer, and applies to questions asked from now on. Big questions, ones that would reach outside this computer or that most of the work depends on, always wait.";
48
+ const info = "Agents ask decisions they can't make themselves in Follow-up, with lettered options and a recommendation. The mode tells the agent what to do until you answer, and applies to questions asked from now on. Big questions, ones that would reach outside this computer or that most of the work depends on, always wait. Below: what agents may add to Follow-up. Off, they aren't told about it.";
49
49
  return <SettingsSection title="Questions" info={info}>
50
50
  {settings.status === "loading" && <ActivityIndicator accessibilityLabel="Loading question settings" color={c.foregroundMuted} style={{ alignSelf: "flex-start", marginVertical: 8 }} />}
51
51
  {(settings.status === "error" || settings.status === "invalid") && <SettingsCard>
@@ -59,6 +59,7 @@ function QuestionSettings({ theme }: Pick<PluginSurfaceProps, "theme">) {
59
59
  <OwnerQuestionLine theme={theme} />
60
60
  </SettingsCard>}
61
61
  {settings.status === "ready" && settings.saveError && <Text accessibilityRole="alert" style={{ color: c.statusDanger }}>{settings.saveError}</Text>}
62
+ <AgentFeatureRows theme={theme} />
62
63
  </SettingsSection>;
63
64
  }
64
65
 
@@ -200,7 +201,7 @@ function WorkspacesFold({ theme, compact, all, autoDefault, busy, set }: { theme
200
201
  </Disclosure>;
201
202
  }
202
203
 
203
- /** Agents: Questions, Wait for background jobs, then the four agent cards. The Overseer and AI priority switches lead their own cards. */
204
+ /** Agents: Questions (the mode, then Agent cards and chat questions), Wait for background jobs, then the four agent cards. The Overseer and AI priority switches lead their own cards. */
204
205
  function AgentsCategory({ theme, compact }: { theme: Theme; compact: boolean }) {
205
206
  return <>
206
207
  <QuestionSettings theme={theme} />
@@ -22,6 +22,7 @@ import type { Workstream } from "../shared/home";
22
22
  import { CARD_VIEW, cardHint, cardMode, foldedBudget, freshLabel, pointedCards, stableOrder, startsFolded } from "../shared/card-view";
23
23
  import { BlockView, MiniThumb, firstImage, flushBlock, type BlockCtx } from "./card-blocks";
24
24
  import { CardHere, canOpenLarge, goToCard, openCardLarge, registerCard, useCardAct, useCards, type ViewCard } from "./card-data";
25
+ import { useCardsOn } from "./display";
25
26
 
26
27
  /**
27
28
  * What agents show the developer in the workspace view (docs/cards.md, the design's "Where cards live"): each card is the
@@ -145,10 +146,12 @@ function CardLoading({ title, theme, compact }: { title: string; theme: Theme; c
145
146
  * view opens, then stable: a card that updates keeps its place.
146
147
  */
147
148
  export function useShownCards(w: Workspace, { theme, compact, now, openQuestion }: { theme: Theme; compact: boolean; now: number; openQuestion?: (id: string) => void }): { pointed: ReactNode; others: { id: string; node: ReactNode }[] } {
148
- const data = useCards(w.id, w.shownCards);
149
+ // Display enable_cards off: no card is drawn or read; the saved cards come back when it's on.
150
+ const on = useCardsOn();
151
+ const data = useCards(w.id, on ? w.shownCards : undefined);
149
152
  const asked = useMemo(() => pointedCards(w.questions), [w.questions]);
150
153
  const order = useRef<string[] | null>(null);
151
- const listed = w.shownCards ?? [];
154
+ const listed = on ? w.shownCards ?? [] : [];
152
155
  if (listed.length) order.current = stableOrder(order.current, listed);
153
156
  const byId = new Map(data.cards.map(cd => [cd.id, cd]));
154
157
  const node = (id: string, pointed: boolean) => {
@@ -156,7 +159,7 @@ export function useShownCards(w: Workspace, { theme, compact, now, openQuestion
156
159
  if (!cd) return data.pending ? <CardLoading key={id} title={listed.find(s => s.id === id)?.title ?? ""} theme={theme} compact={compact} /> : null;
157
160
  return <ShownCard key={id} card={cd} workspace={w} theme={theme} compact={compact} now={now} pointed={pointed} openQuestion={openQuestion} />;
158
161
  };
159
- const ids = order.current ?? [];
162
+ const ids = on ? order.current ?? [] : [];
160
163
  const pointedIds = ids.filter(id => asked.has(id));
161
164
  return {
162
165
  pointed: pointedIds.length ? <>{pointedIds.map(id => node(id, true))}</> : null,
@@ -170,8 +173,10 @@ export function useShownCards(w: Workspace, { theme, compact, now, openQuestion
170
173
  */
171
174
  export function CardLinkRow({ workspace: w, cardId, theme, compact, dense = false }: { workspace: Pick<Workspace, "id" | "shownCards">; cardId: string; theme: Theme; compact: boolean; dense?: boolean }) {
172
175
  const c = theme.colors; const t = text(c, compact);
173
- const data = useCards(w.id, w.shownCards, !dense);
176
+ const on = useCardsOn();
177
+ const data = useCards(w.id, w.shownCards, !dense && on);
174
178
  const listed = w.shownCards?.find(s => s.id === cardId);
179
+ if (!on) return null;
175
180
  if (!listed) return <Text style={t.meta}>The card this pointed at was removed.</Text>;
176
181
  const card = data.cards.find(x => x.id === cardId);
177
182
  const thumb = card ? firstImage(card.blocks) : null;
@@ -235,7 +240,7 @@ export function CardScreen({ params, theme, layout, live, navigation }: PluginSc
235
240
  /** The header's spec link when the agent keeps its spec as the card `spec`: it goes to that card. */
236
241
  export function SpecCardChip({ workspace: w, theme, compact }: { workspace: Pick<Workspace, "id" | "shownCards">; theme: Theme; compact: boolean }) {
237
242
  const c = theme.colors;
238
- const spec = w.shownCards?.find(s => s.id === "spec");
243
+ const spec = useCardsOn() ? w.shownCards?.find(s => s.id === "spec") : undefined;
239
244
  if (!spec) return null;
240
245
  return <Pressable accessibilityRole="link" accessibilityLabel={`The spec: ${spec.title}`} onPress={() => goToCard(w.id, "spec", compact)} hitSlop={compact ? 0 : 6}
241
246
  style={s => ({ flexDirection: "row", alignItems: "center", gap: 4, minHeight: compact ? 32 : 20, paddingHorizontal: 6, borderRadius: 999, maxWidth: 260, backgroundColor: s.pressed ? c.surface2 : c.surface1 })}>
@@ -4,7 +4,7 @@ import { useCallback, useMemo, useState, useSyncExternalStore, type ComponentTyp
4
4
  import { Platform, View } from "react-native";
5
5
  import { displayValues } from "./display";
6
6
  import { rowOpenSteps } from "../shared/display";
7
- import { runOpenSteps } from "./open-steps";
7
+ import { dockBesideChat, runOpenSteps } from "./open-steps";
8
8
  import { Text } from "./text";
9
9
  import { UndoBar, useInbox, useSidebarViewMounted } from "./inbox";
10
10
  import { HomeList, OVERSEER_KEY, type OverseerRowState } from "./home-list";
@@ -108,7 +108,7 @@ export function inboxSidebarView(sources: HomeSources, openOverseerHome: () => v
108
108
  const agent = s?.agentId ? agentRef.get(s.agentId) : undefined;
109
109
  const workspace = s?.workspaceId ? workspaceRef.get(s.workspaceId) : undefined;
110
110
  if (!s) return;
111
- const steps = rowOpenSteps({ agentId: agent ? s.agentId : null, workspaceId: s.workspaceId }, displayValues()?.open_workspace_on, modifiedPick(), touch);
111
+ const steps = rowOpenSteps({ agentId: agent ? s.agentId : null, workspaceId: s.workspaceId }, displayValues()?.open_workspace_on, modifiedPick(), touch, dockBesideChat());
112
112
  if (steps.length) runOpenSteps(steps, { agent: () => agent && view.navigation.openAgent(agent), workspace: () => workspace && view.navigation.openWorkspace(workspace), view: openView, side: dockSide });
113
113
  else if (workspace) view.navigation.openWorkspace(workspace);
114
114
  }, [full, agentRef, workspaceRef, view.navigation, overseer, overseerAgent, touch]);
package/index.server.ts CHANGED
@@ -533,12 +533,15 @@ export default function contribute(server: PluginServerContext) {
533
533
  try { const out = await run(refs); if (refs.length) await imageStore.remove(unqueued()); return out; }
534
534
  catch (error) { await imageStore.remove(unqueued()); throw error; }
535
535
  };
536
- /** What the bridge and the Stop hook read: is the inbox on, may agents be nudged, who has a prompt showing. */
536
+ /**
537
+ * What the bridge and the Stop hook read: is the inbox on, may agents be nudged, who has a prompt showing, and the
538
+ * switches that take a feature from agents (shared/agent-text.mjs featuresOff: enable_cards, enable_chat_questions).
539
+ */
537
540
  const writeBriefState = async () => {
538
541
  const values = await inboxSettings();
539
542
  const path = join(directory, "brief.json");
540
543
  const temporary = `${path}.${randomUUID()}`;
541
- await writeFile(temporary, JSON.stringify({ enable_inbox: values.enable_inbox, enable_brief_nudge: values.enable_brief_nudge, pending: inbox.pendingPermissions(), at: Date.now() }), { mode: 0o600 });
544
+ await writeFile(temporary, JSON.stringify({ enable_inbox: values.enable_inbox, enable_brief_nudge: values.enable_brief_nudge, enable_cards: values.enable_cards, enable_chat_questions: values.enable_chat_questions, pending: inbox.pendingPermissions(), at: Date.now() }), { mode: 0o600 });
542
545
  await rename(temporary, path);
543
546
  };
544
547
  let inboxError: string | null = null;
@@ -726,7 +729,7 @@ export default function contribute(server: PluginServerContext) {
726
729
  gateway.rowBadges = hostAtLeast(ROW_BADGES_SINCE, () => withDaemon(async client => (client as ServerInfoClient).getLastServerInfoMessage?.()));
727
730
  const wait = new Wait(join(directory, "wait"), { enabled: () => agentSettings.waitEnabled(), config: async () => await paseoConfig() as WaitPaseoConfig | null, hostBackgroundWork, legacyDirectory: existsSync(dataDirs(paseoHome).legacy) ? join(dataDirs(paseoHome).legacy, "wait") : null });
728
731
  const currentWait = async () => waitStatus(await agentSettings.waitEnabled(), await paseoConfig() as WaitPaseoConfig | null, await hostBackgroundWork());
729
- const live = async (agentId: string): Promise<Live> => ({ role: scopes(await store.snapshot())[agentId]?.role ?? null, inbox: (await inboxSettings()).enable_inbox });
732
+ const live = async (agentId: string): Promise<Live> => { const display = await inboxSettings(); return { role: scopes(await store.snapshot())[agentId]?.role ?? null, inbox: display.enable_inbox, off: agentText.featuresOff(display) }; };
730
733
  const invoke: Invoke = async (method, input, context) => {
731
734
  const handler = handlers.get(method); if (!handler) throw new Error(`Unknown Follow-up method ${method}.`);
732
735
  return handler.run(await handler.input.parseAsync(input), { paseo: context.paseo });
@@ -741,7 +744,7 @@ export default function contribute(server: PluginServerContext) {
741
744
  if (request.purpose !== "interactive" || (providers && !providers.includes(request.provider)) || request.labels["plugin-tools/enabled"] === "false") return request;
742
745
  if (process.env.FOLLOW_UP_FORCE_STDIO !== "1" && nativeToolsAvailable(request, await paseoConfig())) {
743
746
  toolTransport = "native (Paseo's agent MCP)";
744
- const flags = { recovery, brief: !!brief && !recovery, root: root && !recovery, overseer: overseer && !recovery };
747
+ const flags = { recovery, brief: !!brief && !recovery, root: root && !recovery, overseer: overseer && !recovery, off: agentText.featuresOff(await inboxSettings()) };
745
748
  const env = { ...request.env, FOLLOW_UP_TOOLS: "native", FOLLOW_UP_PROVIDER: request.provider, ...(flags.root ? { FOLLOW_UP_ROOT: "1" } : {}), ...(flags.overseer ? { FOLLOW_UP_OVERSEER: "1" } : {}) };
746
749
  if (/^[\w-]+$/.test(request.agentId)) await writeFile(join(directory, "hook-state", `native-${request.agentId}.json`), JSON.stringify({ instance: toolsInstance }), { mode: 0o600 }).catch(() => undefined);
747
750
  return { ...request, env, tools: [...request.tools, ...nativeTools(flags, live, invoke, workflowSummary([...knownRepos(await store.snapshot())].map(r => prWorkflow.cachedWorkflow(r))), agentId => changedLead?.(agentId) ?? Promise.resolve(null))] };
@@ -2428,7 +2431,7 @@ export default function contribute(server: PluginServerContext) {
2428
2431
  workspace: async (agentId, native) => {
2429
2432
  const entry = scopes(await store.snapshot(), w => prWorkflow.agentWorkflow(workspaceRepo(w), touchedRepos(w)))[agentId];
2430
2433
  if (!entry || entry.role === "recovery") return null;
2431
- return agentText.workspaceText({ contributor: entry.role === "contributor", workflow: entry.workflow, native, clientEntry: clientEntry(), bridge: join(directory, "mcp.mjs") });
2434
+ return agentText.workspaceText({ contributor: entry.role === "contributor", workflow: entry.workflow, native, clientEntry: clientEntry(), bridge: join(directory, "mcp.mjs"), off: agentText.featuresOff(await inboxSettings()) });
2432
2435
  },
2433
2436
  record: async (agentId, hash) => {
2434
2437
  if (/^[\w-]+$/.test(agentId)) await writeFile(join(directory, promptRecordPath(agentId)), JSON.stringify({ hash, at: Date.now() } satisfies PromptRecord), { mode: 0o600 });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "2.6.0-beta.13",
4
+ "version": "2.6.0-beta.14",
5
5
  "description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
6
6
  "type": "module",
7
7
  "files": [
@@ -6,7 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
  import { createHash, randomUUID } from "node:crypto";
7
7
  // One place for Follow-up's words and the one turn-end decision (shared/agent-text.mjs, shared/turn-checks.mjs).
8
8
  // scripts/build.mjs inlines both into hook-source.ts, so the copy in the data directory still imports nothing else.
9
- import { named, detachedNotice, quietInstruction, stopReason, nudgeReason, syncBookkeeping, syncCall, checksLine, pollNudge, workspaceText, demotedNotice, needsYouInstruction, actionInstruction, overseerInstruction, waitInstruction, backgroundWorkInstruction, runLineChange } from "../shared/agent-text.mjs";
9
+ import { featuresOff, named, detachedNotice, quietInstruction, stopReason, nudgeReason, syncBookkeeping, syncCall, checksLine, pollNudge, workspaceText, demotedNotice, needsYouInstruction, actionInstruction, overseerInstruction, waitInstruction, backgroundWorkInstruction, runLineChange } from "../shared/agent-text.mjs";
10
10
  import { isAskInput, pickNudges, turnEndDecision, dueBlock, bookkeepingTurn, treeFingerprint, runStat, TREE_GIT_TIMEOUT_MS } from "../shared/turn-checks.mjs";
11
11
  import { ProgressLog, progressLines, reduceProgressRun } from "../shared/progress-run.mjs";
12
12
 
@@ -128,8 +128,8 @@ const say = text => named(text, native);
128
128
  * The tracked workspace's instructions (shared/agent-text.mjs workspaceText), with the bridge in this data directory.
129
129
  * The worker builds the same text for a provider without the hook (server/session-prompt.ts).
130
130
  */
131
- export function workspaceInstructions({ contributor = false, workflow, native: isNative = native, clientEntry, dir = directory }) {
132
- return workspaceText({ contributor, workflow, native: isNative, clientEntry, bridge: join(dir, "mcp.mjs") });
131
+ export function workspaceInstructions({ contributor = false, workflow, native: isNative = native, clientEntry, dir = directory, off = [] }) {
132
+ return workspaceText({ contributor, workflow, native: isNative, clientEntry, bridge: join(dir, "mcp.mjs"), off });
133
133
  }
134
134
 
135
135
  /** With native tools there's no MCP initialize reply, so the role text it carried comes from the hook instead. */
@@ -251,7 +251,9 @@ async function main() {
251
251
  if (event.hook_event_name === "SessionStart") { const extras = await waitExtras(); if (extras.length) process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: extras.join("\n\n") } }) + "\n"); }
252
252
  return;
253
253
  }
254
- const context = () => workspaceInstructions({ contributor, workflow, clientEntry: lease.clientEntry });
254
+ // Display switches that take a feature from agents (brief.json; unreadable: none off, invariant 7).
255
+ const off = featuresOff(brief ?? (workspace ? await json(join(directory, "brief.json")).catch(() => null) : null));
256
+ const context = () => workspaceInstructions({ contributor, workflow, clientEntry: lease.clientEntry, off });
255
257
  // Paseo 0.17: the workspace text is in the system prompt (part "workspace"), and hook-state/prompt-<agent>.json records
256
258
  // which. Left out while it is still that text; a changed one (a role or workflow change, an enrollment) is said once,
257
259
  // here or in the next Follow-up tool result, whichever comes first, and recorded (server/session-prompt.ts).
package/server/daemon.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { OutsideRuns } from "./outside-runs";
2
2
  import type { OutsideRun } from "../shared/outside-run";
3
- import { daemonUrl } from "../shared/daemon-url.mjs";
3
+ import { daemonFailure, daemonSocketFactory, daemonUrl } from "../shared/daemon-url.mjs";
4
4
  import { imageSupport, imagesLeftOff } from "./image-support";
5
5
  import { taskAgentStates } from "../shared/task-status";
6
6
  import { settleWithin, type Deadline } from "./teardown";
@@ -156,10 +156,13 @@ let reopened: () => void = () => {};
156
156
  export function onDaemonReconnect(note: () => void): void { reopened = note; }
157
157
  export type SharedConnect = <T>(work: (client: Daemon) => Promise<T>) => Promise<T>;
158
158
  type Shared = { client: Promise<Daemon>; opened: number; users: number; retired: boolean };
159
- export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { maxMs?: number; now?: () => number } = {}): SharedConnect {
160
- const maxMs = o.maxMs ?? SHARED_CLIENT_MAX_MS, now = o.now ?? Date.now;
159
+ export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { maxMs?: number; now?: () => number; log?: (line: string) => void } = {}): SharedConnect {
160
+ const maxMs = o.maxMs ?? SHARED_CLIENT_MAX_MS, now = o.now ?? Date.now, log = o.log ?? (line => console.warn(line));
161
161
  let current: Shared | null = null;
162
162
  let lost = false;
163
+ // A failed open logs its real cause once (callers like deliverTo only say "Paseo unreachable"); the same cause
164
+ // again is quiet until a connection opens or the cause changes.
165
+ let logged: string | null = null;
163
166
  const close = async (entry: Shared) => {
164
167
  if (current === entry) current = null;
165
168
  const client = await entry.client.catch(() => null);
@@ -171,10 +174,14 @@ export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { maxM
171
174
  if (stopped) throw new Error("Follow-up is stopping");
172
175
  if (current && now() - current.opened >= maxMs) { current.retired = true; const old = current; current = null; settle(old); }
173
176
  if (!current) {
174
- const client = open().then(c => { if (stopped) { void c.close().catch(() => undefined); throw new Error("Follow-up is stopping"); } clients.add(c); if (lost) { lost = false; reopened(); } return c; });
177
+ const client = open().then(c => { if (stopped) { void c.close().catch(() => undefined); throw new Error("Follow-up is stopping"); } clients.add(c); logged = null; if (lost) { lost = false; reopened(); } return c; });
175
178
  const entry: Shared = { client, opened: now(), users: 0, retired: false };
176
179
  current = entry;
177
- void client.catch(() => { lost = true; if (current === entry) current = null; });
180
+ void client.catch(error => {
181
+ lost = true; if (current === entry) current = null;
182
+ const line = error instanceof Error ? error.message : String(error);
183
+ if (!stopped && line !== logged) { logged = line; log(`[follow-up] ${line}`); }
184
+ });
178
185
  }
179
186
  const entry = current;
180
187
  entry.users++;
@@ -193,11 +200,27 @@ export function sharedDaemon(open: () => Promise<Daemon> = openDaemon, o: { maxM
193
200
  }
194
201
  };
195
202
  }
203
+ /**
204
+ * The WebSocket class the worker's daemon client opens: the `ws` package Paseo's client ships with, resolved beside
205
+ * that client (daemon-clients-reach-every-listener). Null when this Paseo has none, and the client keeps its default.
206
+ */
207
+ export function socketModule(entry: string = clientEntry()): (new (...args: any[]) => unknown) | null {
208
+ try { const ws = createRequire(entry)("ws"); return ws.WebSocket ?? ws; } catch { return null; }
209
+ }
210
+ /** DaemonClient's options for the worker: daemonOptions plus the WebSocket that reaches every listener. */
211
+ export async function workerClientOptions(ws = socketModule()): Promise<Record<string, unknown>> {
212
+ return { ...await daemonOptions(), ...(ws ? { webSocketFactory: daemonSocketFactory(ws, homedir()) } : {}) };
213
+ }
196
214
  async function openDaemon(): Promise<Daemon> {
197
215
  const module = require(["@getpaseo", "client", "internal", "daemon-client"].join("/")) as Module;
198
- const client = traceDaemon(new module.DaemonClient(await daemonOptions()));
216
+ const options = await workerClientOptions();
217
+ const client = traceDaemon(new module.DaemonClient(options));
199
218
  try { await client.connect(); return client; }
200
- catch (error) { await client.close().catch(() => undefined); throw error; }
219
+ catch (error) { await client.close().catch(() => undefined); throw new DaemonConnectError(String(options.url), error); }
220
+ }
221
+ /** A daemon connection that didn't open, with the client's own reason (logged once by sharedDaemon). */
222
+ export class DaemonConnectError extends Error {
223
+ constructor(readonly url: string, readonly reason: unknown) { super(daemonFailure(url, reason)); this.name = "DaemonConnectError"; }
201
224
  }
202
225
  /** The worker's shared connection (PaseoGateway's default). */
203
226
  export const sharedConnect = sharedDaemon();