paseo-follow-up 1.4.0-beta.2 → 1.4.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +15 -4
- package/README.md +59 -6
- package/client/about.tsx +22 -12
- package/client/agents.tsx +132 -0
- package/client/brief.tsx +200 -72
- package/client/chat.tsx +12 -4
- package/client/display.tsx +62 -11
- package/client/header.tsx +40 -19
- package/client/home-chrome.tsx +135 -40
- package/client/home-list.tsx +90 -35
- package/client/home-view.ts +66 -8
- package/client/home.tsx +268 -77
- package/client/inbox-store.ts +15 -7
- package/client/keys.ts +3 -0
- package/client/kit.tsx +46 -15
- package/client/large.tsx +9 -10
- package/client/live.tsx +8 -6
- package/client/needs-you.tsx +36 -8
- package/client/onboarding.tsx +455 -0
- package/client/panel.tsx +98 -23
- package/client/pill.tsx +41 -21
- package/client/pr-controls.tsx +38 -14
- package/client/pr-sheet.tsx +8 -6
- package/client/questions.tsx +6 -4
- package/client/reviewers.tsx +63 -21
- package/client/settings-shell.tsx +77 -0
- package/client/settings.tsx +145 -49
- package/client/shipping.tsx +186 -0
- package/client/spec.tsx +1 -1
- package/client/stacks.tsx +4 -3
- package/client/tasks.tsx +1 -1
- package/client/theme.ts +21 -0
- package/client/visibility.ts +7 -0
- package/client/workspace-data.ts +37 -0
- package/docs/screenshots/decision-card-answered-phone-light.png +0 -0
- package/docs/screenshots/decision-card-expanded-chat-light.png +0 -0
- package/docs/screenshots/decision-card-partial-phone-dark.png +0 -0
- package/docs/screenshots/decision-card-unanswered-phone-dark.png +0 -0
- package/index.client.tsx +27 -8
- package/index.server.ts +257 -24
- package/package.json +5 -3
- package/server/about.ts +15 -4
- package/server/agent-actions.ts +75 -6
- package/server/agent-hook.mjs +54 -16
- package/server/agent-parity.ts +149 -0
- package/server/agent-settings.ts +124 -0
- package/server/ai-jobs.ts +88 -23
- package/server/daemon.ts +165 -105
- package/server/directory.ts +165 -0
- package/server/discovery.ts +34 -6
- package/server/engine.ts +31 -9
- package/server/etag.ts +14 -0
- package/server/github.ts +66 -5
- package/server/hook-source.ts +1 -1
- package/server/inbox-directory.ts +14 -19
- package/server/inbox.ts +28 -1
- package/server/mcp-source.ts +1 -1
- package/server/mcp.d.mts +3 -1
- package/server/mcp.mjs +83 -10
- package/server/native-tools.ts +3 -2
- package/server/onboarding.ts +101 -0
- package/server/overseer-prompt-source.ts +1 -1
- package/server/overseer-prompt.md +1 -0
- package/server/overseer.ts +72 -8
- package/server/pr-actions.ts +91 -15
- package/server/pr-workflow.ts +188 -0
- package/server/questions.ts +1 -1
- package/server/ranker.ts +431 -0
- package/server/recovery-config.ts +17 -0
- package/server/scopes.ts +20 -8
- package/server/tasks.ts +9 -3
- package/server/trust-bypass.ts +125 -0
- package/shared/about.ts +8 -3
- package/shared/activity.ts +3 -1
- package/shared/agent-settings.ts +169 -0
- package/shared/attention.ts +8 -4
- package/shared/brief.ts +44 -0
- package/shared/chat.ts +3 -1
- package/shared/contracts.ts +42 -4
- package/shared/display.ts +16 -1
- package/shared/headline.ts +5 -0
- package/shared/home.ts +6 -0
- package/shared/model.ts +12 -1
- package/shared/onboarding.ts +243 -0
- package/shared/overseer.ts +10 -2
- package/shared/pr-actions.ts +26 -4
- package/shared/pr-workflow.ts +133 -0
- package/shared/questions.ts +17 -0
- package/shared/ranker.ts +237 -0
- package/shared/search.ts +25 -5
- package/shared/settings-nav.ts +97 -0
- package/skills/follow-through/SKILL.md +3 -1
package/client/brief.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useState, useSyncExternalStore } from "react";
|
|
2
|
+
import { browserKey, BROWSER_POLL_MS } from "./keys";
|
|
2
3
|
import { Platform, Pressable, Text, View, useWindowDimensions } from "react-native";
|
|
3
4
|
import { useQuery } from "@tanstack/react-query";
|
|
4
5
|
import { openExternalUrl, useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
5
6
|
import { Icon, copyText } from "@getpaseo/plugin/client/ui";
|
|
6
|
-
import { BRIEF_KIND, BRIEF_VERSION, briefSchema, collapsedLine, extrasFit, nothingNeededLine, isTight, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
7
|
+
import { BRIEF_KIND, BRIEF_VERSION, askedDecisions, pickedCount, briefSchema, collapsedLine, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, selectsFirst, sendBar, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
7
8
|
import { age } from "../shared/inbox";
|
|
8
9
|
import { briefKey, HEADLINE_WORD } from "../shared/headline";
|
|
9
10
|
/** The card's kind word comes from the same table as the pill and the Needs-you row. */
|
|
@@ -11,7 +12,7 @@ const word = (kind: Brief["kind"]) => HEADLINE_WORD[briefKey(kind)];
|
|
|
11
12
|
import { briefActionRpc, browserStatusRpc } from "../shared/contracts";
|
|
12
13
|
import { errorText } from "../shared/errors";
|
|
13
14
|
import type { Workspace } from "../shared/model";
|
|
14
|
-
import { useNow } from "./kit";
|
|
15
|
+
import { text, useNow } from "./kit";
|
|
15
16
|
import { PrSheet } from "./pr-sheet";
|
|
16
17
|
import { isLight, withAlpha, type Colors } from "./theme";
|
|
17
18
|
|
|
@@ -34,9 +35,12 @@ const ACTS: Brief["kind"][] = ["decision", "action", "review", "reviewers", "per
|
|
|
34
35
|
const ICON: Record<Brief["kind"], string> = { decision: "MessageCircleQuestion", action: "Hand", review: "GitPullRequest", reviewers: "UserPlus", permission: "ShieldQuestion", paused: "CirclePause", error: "CircleX", done: "CircleCheck", unknown: "CircleDashed" };
|
|
35
36
|
const kindTone = (kind: Brief["kind"], c: Colors) => kind === "error" ? c.statusDanger : kind === "review" || kind === "done" ? c.statusSuccess : kind === "unknown" ? c.foregroundMuted : c.statusWarning;
|
|
36
37
|
const factTone = (tone: string, c: Colors) => tone === "ok" ? c.statusSuccess : tone === "warn" ? c.statusWarning : tone === "bad" ? c.statusDanger : c.foregroundMuted;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
/** The time in the device's own format (12- or 24-hour), like the chat's timestamps. */
|
|
39
|
+
const clock = (iso: string | null) => { if (!iso) return ""; const d = new Date(iso); return Number.isFinite(d.getTime()) ? d.toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) : ""; };
|
|
40
|
+
/** Whether the focused element got focus from the keyboard (a tap or click doesn't draw the ring). */
|
|
41
|
+
const keyboardFocus = () => { try { return !!(globalThis as { document?: { activeElement?: { matches?(q: string): boolean } | null } }).document?.activeElement?.matches?.(":focus-visible"); } catch { return true; } };
|
|
42
|
+
/** Web keyboard focus: a visible ring, since sending an answer is one-shot. Not after a tap, where it read as a state. */
|
|
43
|
+
const ring = (focused: boolean | undefined, c: Colors) => focused && Platform.OS === "web" && keyboardFocus() ? ({ outlineWidth: 2, outlineStyle: "solid", outlineColor: withAlpha(c.accent, 0.6), outlineOffset: 2 } as object) : {};
|
|
40
44
|
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] ?? ""; };
|
|
41
45
|
|
|
42
46
|
function Btn({ label, icon, primary, onPress, c, compact, disabled }: { label: string; icon?: string; primary?: boolean; onPress: () => void; c: Colors; compact: boolean; disabled?: boolean }) {
|
|
@@ -50,22 +54,61 @@ function Btn({ label, icon, primary, onPress, c, compact, disabled }: { label: s
|
|
|
50
54
|
</Pressable>;
|
|
51
55
|
}
|
|
52
56
|
|
|
53
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Picks on a multi-decision card, per brief, shared by every copy of the card on this client (the chat, the panel and
|
|
59
|
+
* Home render the same brief), so a pick made in one shows in the others. In memory only; nothing is sent until Send.
|
|
60
|
+
*/
|
|
61
|
+
const pickStore = (() => {
|
|
62
|
+
const picks = new Map<string, Record<string, string>>(); const listeners = new Set<() => void>();
|
|
63
|
+
const none: Record<string, string> = {};
|
|
64
|
+
return {
|
|
65
|
+
subscribe(l: () => void) { listeners.add(l); return () => { listeners.delete(l); }; },
|
|
66
|
+
get: (briefId: string) => picks.get(briefId) ?? none,
|
|
67
|
+
/** Picks `letter`; picking the same letter again clears that decision (it can then be skipped). */
|
|
68
|
+
set(briefId: string, decisionId: string, letter: string) {
|
|
69
|
+
const next = { ...picks.get(briefId) };
|
|
70
|
+
if (next[decisionId] === letter) delete next[decisionId]; else next[decisionId] = letter;
|
|
71
|
+
picks.set(briefId, next); for (const l of listeners) l();
|
|
72
|
+
},
|
|
73
|
+
clear(briefId: string) { if (picks.delete(briefId)) for (const l of listeners) l(); },
|
|
74
|
+
};
|
|
75
|
+
})();
|
|
76
|
+
const usePicks = (briefId: string) => useSyncExternalStore(pickStore.subscribe, () => pickStore.get(briefId), () => pickStore.get(briefId));
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* One option. `send` answers on tap (a single-decision card); `select` marks it as this decision's pick (a card with
|
|
80
|
+
* several decisions, sent together); `readonly` shows a past card, the chosen option marked and the rest dimmed.
|
|
81
|
+
*/
|
|
82
|
+
function OptionRow({ option, recommended, sending, disabled, tight, open, onToggle, onPress, c, compact, mode = "send", selected = false, answered = false }: {
|
|
54
83
|
option: BriefDecision["options"][number]; recommended: boolean; sending: boolean; disabled: boolean; tight: boolean; open: boolean; onToggle: () => void; onPress: () => void; c: Colors; compact: boolean;
|
|
84
|
+
mode?: "send" | "select" | "readonly"; selected?: boolean; answered?: boolean;
|
|
55
85
|
}) {
|
|
56
86
|
const strong = withAlpha(c.foreground, isLight(c) ? 0.38 : 0.42);
|
|
57
87
|
const showDetail = !!option.consequence && (!tight || open);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
const readonly = mode === "readonly";
|
|
89
|
+
const marked = selected && mode !== "send";
|
|
90
|
+
// While picking, only a pick is loud: a recommendation keeps its label but not the filled badge, so it never looks
|
|
91
|
+
// picked. A past card mutes what wasn't picked through colour, not opacity, so it stays readable.
|
|
92
|
+
const dim = !readonly && disabled && !sending;
|
|
93
|
+
const muted = readonly && answered && !selected;
|
|
94
|
+
const loudRecommend = recommended && mode === "send";
|
|
95
|
+
const border = marked ? c.accent : loudRecommend ? strong : c.border;
|
|
96
|
+
const badge = marked ? c.accent : loudRecommend ? c.foreground : c.surface2;
|
|
97
|
+
const badgeText = marked ? c.accentForeground : loudRecommend ? c.surface1 : muted ? c.foregroundMuted : c.foreground;
|
|
98
|
+
const label = mode === "select" ? `${option.letter}: ${option.label}${recommended ? " (recommended)" : ""}` : readonly ? `${option.letter}: ${option.label}${selected ? " (your answer)" : ""}` : `Answer ${option.letter}: ${option.label}${recommended ? " (recommended)" : ""}`;
|
|
99
|
+
return <View style={{ flexDirection: "row", alignItems: "stretch", borderRadius: 8, borderWidth: 1, borderColor: border, backgroundColor: marked && !readonly ? withAlpha(c.accent, isLight(c) ? 0.06 : 0.1) : "transparent", opacity: dim ? 0.45 : 1, overflow: "hidden" }}>
|
|
100
|
+
<Pressable accessibilityRole={mode === "select" ? "radio" : readonly ? "text" : "button"} accessibilityLabel={label} accessibilityHint={mode === "select" && selected ? "Tap again to clear" : option.consequence ?? undefined}
|
|
101
|
+
accessibilityState={mode === "select" ? { checked: selected, disabled } : { disabled: disabled || readonly, busy: sending }} disabled={disabled || readonly} onPress={onPress}
|
|
102
|
+
style={({ hovered, pressed, focused }: { hovered?: boolean; pressed: boolean; focused?: boolean }) => ({ ...ring(focused, c), flex: 1, flexDirection: "row", alignItems: "flex-start", gap: 10, paddingVertical: readonly ? (compact ? 8 : 7) : compact ? 11 : 9, paddingHorizontal: 10, minHeight: readonly ? 0 : compact ? 44 : 0,
|
|
103
|
+
backgroundColor: readonly ? "transparent" : pressed ? c.surface2 : hovered && !disabled ? withAlpha(c.foreground, 0.05) : "transparent" })}>
|
|
104
|
+
<View style={{ width: 22, height: 22, borderRadius: 5, alignItems: "center", justifyContent: "center", backgroundColor: badge }}>
|
|
105
|
+
{marked ? <Icon name="Check" size={13} color={badgeText} /> : <Text style={{ fontSize: 12, fontWeight: "700", color: badgeText }}>{option.letter}</Text>}
|
|
64
106
|
</View>
|
|
65
107
|
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
66
108
|
<View style={{ flexDirection: "row", alignItems: "center", columnGap: 8, flexWrap: "wrap" }}>
|
|
67
|
-
<Text style={{ color: c.foreground, fontSize: 14, lineHeight: 20, fontWeight: "600" }}>{option.label}</Text>
|
|
68
|
-
{recommended && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontWeight: "600" }}>Recommended</Text>}
|
|
109
|
+
<Text style={{ color: muted ? c.foregroundMuted : c.foreground, fontSize: 14, lineHeight: 20, fontWeight: muted ? "400" : "600" }}>{marked ? `${option.letter} · ` : ""}{option.label}</Text>
|
|
110
|
+
{recommended && !readonly && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontWeight: "600" }}>Recommended</Text>}
|
|
111
|
+
{readonly && selected && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontWeight: "600" }}>Your answer</Text>}
|
|
69
112
|
{sending && <Text accessibilityLiveRegion="polite" style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>Sending…</Text>}
|
|
70
113
|
</View>
|
|
71
114
|
{showDetail && <Text style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>{option.consequence}</Text>}
|
|
@@ -78,21 +121,128 @@ function OptionRow({ option, recommended, sending, disabled, tight, open, onTogg
|
|
|
78
121
|
</View>;
|
|
79
122
|
}
|
|
80
123
|
|
|
81
|
-
|
|
82
|
-
|
|
124
|
+
/**
|
|
125
|
+
* The card's body: decisions, error text, details, context, facts and links, and the agent's extra ask. Shared by the
|
|
126
|
+
* open card and by a past card's read-only "Show full question", so a past question reads exactly as it was asked.
|
|
127
|
+
*/
|
|
128
|
+
function BriefBody({ b, c, compact, tight, embedded, height, mode, picks, onPick, busy, onSend }: {
|
|
129
|
+
b: Brief; c: Colors; compact: boolean; tight: boolean; embedded: boolean; height: number;
|
|
130
|
+
mode: "send" | "select" | "readonly"; picks: Record<string, string>; onPick: (decisionId: string, letter: string) => void; busy: string | null; onSend?: (key: string) => void;
|
|
131
|
+
}) {
|
|
132
|
+
const [open, setOpen] = useState<Record<string, boolean>>({});
|
|
133
|
+
const [details, setDetails] = useState(false);
|
|
134
|
+
const readonly = mode === "readonly";
|
|
135
|
+
const extra = !!b.context || b.facts.length > 0 || b.links.length > 0;
|
|
136
|
+
const showExtra = readonly || !tight || details || extrasFit(b, height);
|
|
137
|
+
const numbered = b.decisions.length > 1;
|
|
138
|
+
return <>
|
|
139
|
+
{b.decisions.map((d, i) => <View key={d.id} accessibilityRole={mode === "select" ? "radiogroup" : undefined} accessibilityLabel={mode === "select" ? d.question : undefined} style={{ gap: 8 }}>
|
|
140
|
+
{(numbered || d.question.trim() !== b.ask.trim()) && <Text style={{ color: c.foreground, fontSize: 14, lineHeight: 20, fontWeight: numbered ? "600" : "400" }}>{numbered ? `${i + 1}. ` : ""}{d.question}</Text>}
|
|
141
|
+
{d.options.length > 0 && <View style={{ gap: 6 }}>
|
|
142
|
+
{d.options.map(o => <OptionRow key={o.letter} option={o} recommended={d.recommend === o.letter} mode={mode} selected={readonly ? d.chosen === o.letter : picks[d.id] === o.letter} answered={readonly && !!d.chosen}
|
|
143
|
+
sending={busy === `${d.id}:${o.letter}`} disabled={!!busy} tight={tight && !readonly}
|
|
144
|
+
open={!!open[`${d.id}:${o.letter}`]} onToggle={() => setOpen(v => ({ ...v, [`${d.id}:${o.letter}`]: !v[`${d.id}:${o.letter}`] }))}
|
|
145
|
+
onPress={() => mode === "send" ? onSend?.(`${d.id}:${o.letter}`) : onPick(d.id, o.letter)} c={c} compact={compact} />)}
|
|
146
|
+
</View>}
|
|
147
|
+
{readonly && b.state === "answered" && d.options.length > 0 && !d.chosen && numbered && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>Skipped</Text>}
|
|
148
|
+
{!readonly && mode === "send" && !tight && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{embedded ? d.options.length ? "Or answer in your own words below." : "Reply below." : d.options.length ? `Or type ${letters(d)} in the composer, or reply in your own words.` : "Reply in the composer."}</Text>}
|
|
149
|
+
{!readonly && (mode === "select" || tight) && !d.options.length && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{embedded ? "Reply below." : "Reply in the composer."}</Text>}
|
|
150
|
+
</View>)}
|
|
151
|
+
|
|
152
|
+
{!!b.mono && !b.ask.endsWith(b.mono) && <View style={{ borderRadius: 8, backgroundColor: withAlpha(c.statusDanger, isLight(c) ? 0.07 : 0.1), paddingHorizontal: 10, paddingVertical: 8 }}>
|
|
153
|
+
<Text selectable numberOfLines={tight && !readonly ? 3 : undefined} style={{ color: c.foreground, fontFamily: mono(), fontSize: 12, lineHeight: 18 }}>{b.mono}</Text>
|
|
154
|
+
</View>}
|
|
155
|
+
|
|
156
|
+
{!readonly && extra && tight && !extrasFit(b, height) && <Pressable accessibilityRole="button" aria-expanded={details} accessibilityLabel={details ? "Hide details" : "Show details"} onPress={() => setDetails(v => !v)} hitSlop={6}
|
|
157
|
+
style={{ flexDirection: "row", alignItems: "center", gap: 4, alignSelf: "flex-start", minHeight: compact ? 44 : 24 }}>
|
|
158
|
+
<View style={{ transform: [{ rotate: details ? "90deg" : "0deg" }] }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
159
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18, fontWeight: "500" }}>Details</Text>
|
|
160
|
+
</Pressable>}
|
|
161
|
+
|
|
162
|
+
{showExtra && !!b.context && <Text selectable numberOfLines={readonly ? undefined : 4} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{b.context}</Text>}
|
|
163
|
+
|
|
164
|
+
{showExtra && (b.facts.length > 0 || b.links.length > 0) && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
165
|
+
{b.facts.slice(0, 3).map((f, i) => { const col = factTone(f.tone, c); return <View key={`f${i}`} style={{ flexDirection: "row", alignItems: "center", gap: 5, paddingHorizontal: 8, minHeight: 24, borderRadius: 6, backgroundColor: f.tone === "muted" ? c.surface2 : withAlpha(col, isLight(c) ? 0.1 : 0.14) }}>
|
|
166
|
+
<Icon name={f.icon} size={12} color={col} />
|
|
167
|
+
<Text style={{ color: f.tone === "muted" || isLight(c) ? c.foreground : col, fontSize: 12, lineHeight: 16, fontWeight: "500" }}>{f.label}</Text>
|
|
168
|
+
</View>; })}
|
|
169
|
+
{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}
|
|
170
|
+
style={{ flexDirection: "row", alignItems: "center", gap: 5, paddingHorizontal: 8, minHeight: 24, borderRadius: 6, backgroundColor: c.surface2 }}>
|
|
171
|
+
<Icon name={l.url ? "ExternalLink" : l.pr ? "GitPullRequest" : "File"} size={12} color={c.foregroundMuted} />
|
|
172
|
+
<Text selectable={!l.url} numberOfLines={1} style={{ color: c.foreground, fontSize: 12, lineHeight: 16, fontWeight: "500", maxWidth: 260 }}>{l.label}</Text>
|
|
173
|
+
</Pressable>)}
|
|
174
|
+
</View>}
|
|
175
|
+
</>;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** The decision-card's send bar: one message for every pick, or an explicit partial send that names what it skips. */
|
|
179
|
+
function SendBar({ b, picks, busy, error, onSend, c, compact }: { b: Brief; picks: Record<string, string>; busy: string | null; error: string | null; onSend: () => void; c: Colors; compact: boolean }) {
|
|
180
|
+
const bar = sendBar(b, picks);
|
|
181
|
+
return <View style={{ gap: 6 }}>
|
|
182
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 10 }}>
|
|
183
|
+
<Btn label={busy === "answers" ? "Sending…" : bar.label} icon="Send" primary={bar.ready && !bar.partial} disabled={!bar.ready || !!busy} onPress={onSend} c={c} compact={compact} />
|
|
184
|
+
{!bar.ready && <Text style={{ flexShrink: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>Pick your answers, then send them in one message.</Text>}
|
|
185
|
+
</View>
|
|
186
|
+
{bar.skipped && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{bar.skipped}</Text>}
|
|
187
|
+
{!!error && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>Couldn't send: {error} Your picks are kept; try again.</Text>}
|
|
188
|
+
</View>;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** "Show full question" / "Show original": a past card opens back up, read-only. */
|
|
192
|
+
function Reveal({ label, open, onPress, c, compact }: { label: string; open: boolean; onPress: () => void; c: Colors; compact: boolean }) {
|
|
193
|
+
const text = open ? label.replace(/^Show/, "Hide") : label;
|
|
194
|
+
return <Pressable accessibilityRole="button" aria-expanded={open} accessibilityLabel={text} onPress={onPress} hitSlop={6}
|
|
195
|
+
style={({ focused }: { pressed: boolean; focused?: boolean }) => ({ ...ring(focused, c), flexDirection: "row", alignItems: "center", gap: 4, alignSelf: "flex-start", minHeight: compact ? 44 : 24 })}>
|
|
196
|
+
<View style={{ transform: [{ rotate: open ? "90deg" : "0deg" }] }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
197
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18, fontWeight: "500" }}>{text}</Text>
|
|
198
|
+
</Pressable>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* A card that's no longer open keeps its question (1.4.0). Answered: the ask, each decision with what was picked, and
|
|
203
|
+
* "Show full question" opens the original read-only. Superseded or signed off: the one muted line, plus "Show original".
|
|
204
|
+
*/
|
|
205
|
+
function Past({ b, c, now, compact, height }: { b: Brief; c: Colors; now: number; compact: boolean; height: number }) {
|
|
206
|
+
const [expanded, setExpanded] = useState(false);
|
|
83
207
|
const answered = b.state === "answered";
|
|
208
|
+
const asked = askedDecisions(b);
|
|
209
|
+
const picked = answered && asked.some(d => d.chosen);
|
|
84
210
|
const icon = b.state === "superseded" ? "History" : "CircleCheck";
|
|
85
211
|
const color = b.state === "superseded" ? c.foregroundMuted : c.statusSuccess;
|
|
86
|
-
const right = answered && b.outcomeAt ? `
|
|
87
|
-
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
212
|
+
const right = answered && b.outcomeAt ? `Answered ${clock(b.outcomeAt)}` : age(b.outcomeAt ?? b.at, now);
|
|
213
|
+
const body = expanded && <View style={{ gap: 10, paddingTop: 4 }}>
|
|
214
|
+
<BriefBody b={b} c={c} compact={compact} tight={false} embedded height={height} mode="readonly" picks={{}} onPick={() => undefined} busy={null} />
|
|
215
|
+
</View>;
|
|
216
|
+
if (!picked) return <View accessibilityLiveRegion="polite" style={{ marginVertical: 10, gap: 6, paddingVertical: 8, paddingHorizontal: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border }}>
|
|
217
|
+
<View style={{ flexDirection: "row", gap: 10, alignItems: answered ? "flex-start" : "center", minHeight: 24 }}>
|
|
218
|
+
<View style={{ paddingTop: answered ? 2 : 0 }}><Icon name={icon} size={15} color={color} /></View>
|
|
219
|
+
{answered
|
|
220
|
+
? <View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
221
|
+
<Text numberOfLines={expanded ? undefined : 1} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.ask}</Text>
|
|
222
|
+
<Text style={{ color: c.foreground, fontSize: 14, lineHeight: 20, fontWeight: "600" }}>{b.outcome}</Text>
|
|
223
|
+
</View>
|
|
224
|
+
: <Text numberOfLines={expanded ? undefined : 1} style={{ flex: 1, minWidth: 0, color: c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>{collapsedLine(b)}</Text>}
|
|
225
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{right}</Text>
|
|
226
|
+
</View>
|
|
227
|
+
{hasOriginal(b) && <View style={{ paddingLeft: 25 }}><Reveal label={answered ? "Show full question" : "Show original"} open={expanded} onPress={() => setExpanded(v => !v)} c={c} compact={compact} /></View>}
|
|
228
|
+
{body}
|
|
229
|
+
</View>;
|
|
230
|
+
// Answered with picks: the ask, then each decision's question and the picked option, so the answer is never
|
|
231
|
+
// separated from what it answered.
|
|
232
|
+
return <View accessibilityRole="summary" accessibilityLabel={`Answered: ${b.ask}`} style={{ marginVertical: 10, gap: 8, paddingVertical: 10, paddingHorizontal: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border }}>
|
|
233
|
+
<View style={{ flexDirection: "row", gap: 8, alignItems: "flex-start" }}>
|
|
234
|
+
<View style={{ paddingTop: 2 }}><Icon name="CircleCheck" size={15} color={c.statusSuccess} /></View>
|
|
235
|
+
<Text style={{ flex: 1, minWidth: 0, color: c.foreground, fontSize: 14, lineHeight: 20, fontWeight: "600" }}>{b.ask}</Text>
|
|
236
|
+
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 20, fontVariant: ["tabular-nums"] }}>{right}</Text>
|
|
237
|
+
</View>
|
|
238
|
+
{!expanded && <View style={{ gap: 6, paddingLeft: 23 }}>
|
|
239
|
+
{pastRows(b).map(r => <View key={r.id} style={{ gap: 1 }}>
|
|
240
|
+
{!!r.question && <Text numberOfLines={2} style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{r.question}</Text>}
|
|
241
|
+
<Text style={{ color: r.answer ? c.foreground : c.foregroundMuted, fontSize: 13, lineHeight: 19, fontWeight: r.answer ? "600" : "400" }}>{r.answer ?? "Skipped"}</Text>
|
|
242
|
+
</View>)}
|
|
243
|
+
</View>}
|
|
244
|
+
<View style={{ paddingLeft: 23 }}><Reveal label="Show full question" open={expanded} onPress={() => setExpanded(v => !v)} c={c} compact={compact} /></View>
|
|
245
|
+
{expanded && <View style={{ paddingLeft: 23 }}>{body}</View>}
|
|
96
246
|
</View>;
|
|
97
247
|
}
|
|
98
248
|
|
|
@@ -105,12 +255,12 @@ export function BriefCard({ item, theme, layout, agentId, deps, embedded = false
|
|
|
105
255
|
const browserRead = useRpc(browserStatusRpc);
|
|
106
256
|
const [busy, setBusy] = useState<string | null>(null);
|
|
107
257
|
const [error, setError] = useState<string | null>(null);
|
|
108
|
-
const [
|
|
109
|
-
const
|
|
258
|
+
const [why, setWhy] = useState(false);
|
|
259
|
+
const picks = usePicks(b.id);
|
|
110
260
|
const [sheet, setSheet] = useState<{ key: string; intent: "merge" | "reviewers" } | null>(null);
|
|
111
261
|
const workspace = b.workspaceId ? deps.workspace(b.workspaceId) : undefined;
|
|
112
|
-
const browser = useQuery({ queryKey:
|
|
113
|
-
if (b.state !== "open") return <
|
|
262
|
+
const browser = useQuery({ queryKey: browserKey, queryFn: () => browserRead({}), refetchInterval: BROWSER_POLL_MS, enabled: !!sheet });
|
|
263
|
+
if (b.state !== "open") return <Past b={b} c={c} now={now} compact={compact} height={height} />;
|
|
114
264
|
|
|
115
265
|
const attention = c.statusWarning;
|
|
116
266
|
const acts = b.flagged && ACTS.includes(b.kind);
|
|
@@ -161,9 +311,10 @@ export function BriefCard({ item, theme, layout, agentId, deps, embedded = false
|
|
|
161
311
|
}
|
|
162
312
|
|
|
163
313
|
const tight = isTight(b, compact, height);
|
|
164
|
-
const extra = !!b.context || b.facts.length > 0 || b.links.length > 0;
|
|
165
|
-
const showExtra = !tight || details || extrasFit(b, height);
|
|
166
314
|
const pad = compact ? 14 : 16;
|
|
315
|
+
const multi = selectsFirst(b);
|
|
316
|
+
const sendOne = (key: string) => { const [decisionId, choice] = key.split(":"); void run(key, () => act({ agentId, briefId: b.id, decisionId, choice })); };
|
|
317
|
+
const sendAll = () => void run("answers", async () => { await act({ agentId, briefId: b.id, choices: Object.entries(picks).map(([decisionId, choice]) => ({ decisionId, choice })) }); pickStore.clear(b.id); });
|
|
167
318
|
return <View accessibilityRole="summary" accessibilityLabel={`${acts ? "Needs you" : word(b.kind)}: ${b.ask}`}
|
|
168
319
|
style={{ marginVertical: embedded ? 0 : 10, borderRadius: 12, borderWidth: 1, borderColor: border, backgroundColor: c.surface1, overflow: "hidden" }}>
|
|
169
320
|
<View style={{ paddingHorizontal: pad, paddingTop: compact ? 12 : 14, paddingBottom: 14, gap: tight ? 10 : 12 }}>
|
|
@@ -172,63 +323,40 @@ export function BriefCard({ item, theme, layout, agentId, deps, embedded = false
|
|
|
172
323
|
<Icon name={ICON[b.kind]} size={14} color={tone} />
|
|
173
324
|
<Text style={{ color: acts ? attention : tone, fontSize: 12, lineHeight: 16, fontWeight: "600" }}>{acts ? "Needs you" : word(b.kind)}</Text>
|
|
174
325
|
{acts && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{word(b.kind)}</Text>}
|
|
326
|
+
{multi && <Text accessibilityLiveRegion="polite" style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>· {pickedCount(b, picks)} of {askedDecisions(b).length} picked</Text>}
|
|
175
327
|
<View style={{ flex: 1 }} />
|
|
176
328
|
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontVariant: ["tabular-nums"] }}>{ageText}</Text>
|
|
329
|
+
{/* Phones: where the card's facts come from sits behind ⓘ instead of a footer under every card. */}
|
|
330
|
+
{compact && <Pressable accessibilityRole="button" accessibilityLabel={why ? "Hide where this comes from" : "Where this comes from"} aria-expanded={why} accessibilityState={{ expanded: why }}
|
|
331
|
+
onPress={() => setWhy(v => !v)} style={{ width: 44, height: 44, marginVertical: -15, marginRight: -14, alignItems: "center", justifyContent: "center" }}>
|
|
332
|
+
<Icon name="Info" size={14} color={why ? c.foreground : c.foregroundMuted} />
|
|
333
|
+
</Pressable>}
|
|
177
334
|
</View>
|
|
178
|
-
|
|
335
|
+
{/* The ask role on phones (react-native-web ignores hitSlop, so the ⓘ above is a real 44 box); desktop keeps 19/26. */}
|
|
336
|
+
<Text accessibilityRole="header" style={compact ? text(c, true).ask : { color: c.foreground, fontSize: 19, lineHeight: 26, fontWeight: "600", letterSpacing: -0.2 }}>{b.ask}</Text>
|
|
179
337
|
</View>
|
|
180
338
|
|
|
181
|
-
{b
|
|
182
|
-
{(
|
|
183
|
-
{d.options.length > 0 && <View style={{ gap: 6 }}>
|
|
184
|
-
{d.options.map(o => <OptionRow key={o.letter} option={o} recommended={d.recommend === o.letter} sending={busy === `${d.id}:${o.letter}`} disabled={!!busy} tight={tight}
|
|
185
|
-
open={!!open[`${d.id}:${o.letter}`]} onToggle={() => setOpen(v => ({ ...v, [`${d.id}:${o.letter}`]: !v[`${d.id}:${o.letter}`] }))}
|
|
186
|
-
onPress={() => void run(`${d.id}:${o.letter}`, () => act({ agentId, briefId: b.id, decisionId: d.id, choice: o.letter }))} c={c} compact={compact} />)}
|
|
187
|
-
</View>}
|
|
188
|
-
{!tight && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{embedded ? d.options.length ? "Or answer in your own words below." : "Reply below." : d.options.length ? `Or type ${letters(d)} in the composer, or reply in your own words.` : "Reply in the composer."}</Text>}
|
|
189
|
-
{tight && !d.options.length && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{embedded ? "Reply below." : "Reply in the composer."}</Text>}
|
|
190
|
-
</View>)}
|
|
339
|
+
<BriefBody b={b} c={c} compact={compact} tight={tight} embedded={embedded} height={height} mode={multi ? "select" : "send"} picks={picks}
|
|
340
|
+
onPick={(decisionId, letter) => { if (!busy) pickStore.set(b.id, decisionId, letter); }} busy={busy} onSend={sendOne} />
|
|
191
341
|
|
|
192
|
-
{
|
|
193
|
-
<Text selectable numberOfLines={tight ? 3 : undefined} style={{ color: c.foreground, fontFamily: mono(), fontSize: 12, lineHeight: 18 }}>{b.mono}</Text>
|
|
194
|
-
</View>}
|
|
195
|
-
|
|
196
|
-
{extra && tight && !extrasFit(b, height) && <Pressable accessibilityRole="button" aria-expanded={details} accessibilityLabel={details ? "Hide details" : "Show details"} onPress={() => setDetails(v => !v)} hitSlop={6}
|
|
197
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 4, alignSelf: "flex-start", minHeight: compact ? 44 : 24 }}>
|
|
198
|
-
<View style={{ transform: [{ rotate: details ? "90deg" : "0deg" }] }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
199
|
-
<Text style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 18, fontWeight: "500" }}>Details</Text>
|
|
200
|
-
</Pressable>}
|
|
201
|
-
|
|
202
|
-
{showExtra && !!b.context && <Text selectable numberOfLines={4} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{b.context}</Text>}
|
|
203
|
-
|
|
204
|
-
{showExtra && (b.facts.length > 0 || b.links.length > 0) && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 6 }}>
|
|
205
|
-
{b.facts.slice(0, 3).map((f, i) => { const col = factTone(f.tone, c); return <View key={`f${i}`} style={{ flexDirection: "row", alignItems: "center", gap: 5, paddingHorizontal: 8, minHeight: 24, borderRadius: 6, backgroundColor: f.tone === "muted" ? c.surface2 : withAlpha(col, isLight(c) ? 0.1 : 0.14) }}>
|
|
206
|
-
<Icon name={f.icon} size={12} color={col} />
|
|
207
|
-
<Text style={{ color: f.tone === "muted" || isLight(c) ? c.foreground : col, fontSize: 12, lineHeight: 16, fontWeight: "500" }}>{f.label}</Text>
|
|
208
|
-
</View>; })}
|
|
209
|
-
{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}
|
|
210
|
-
style={{ flexDirection: "row", alignItems: "center", gap: 5, paddingHorizontal: 8, minHeight: 24, borderRadius: 6, backgroundColor: c.surface2 }}>
|
|
211
|
-
<Icon name={l.url ? "ExternalLink" : l.pr ? "GitPullRequest" : "File"} size={12} color={c.foregroundMuted} />
|
|
212
|
-
<Text selectable={!l.url} numberOfLines={1} style={{ color: c.foreground, fontSize: 12, lineHeight: 16, fontWeight: "500", maxWidth: 260 }}>{l.label}</Text>
|
|
213
|
-
</Pressable>)}
|
|
214
|
-
</View>}
|
|
342
|
+
{multi && <SendBar b={b} picks={picks} busy={busy} error={error} onSend={sendAll} c={c} compact={compact} />}
|
|
215
343
|
|
|
216
344
|
{!embedded && moves.length > 0 && <View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
217
|
-
{moves.map((m, i) => <Btn key={m.kind} label={busy === m.kind ? `${m.label}…` : m.label} icon={MOVE_ICON[m.kind]} primary={i === 0} disabled={!!busy} onPress={() => press(m)} c={c} compact={compact} />)}
|
|
345
|
+
{moves.map((m, i) => <Btn key={m.kind} label={busy === m.kind ? `${m.label}…` : m.label} icon={MOVE_ICON[m.kind]} primary={i === 0 && !multi} disabled={!!busy} onPress={() => press(m)} c={c} compact={compact} />)}
|
|
218
346
|
</View>}
|
|
219
347
|
|
|
220
|
-
{!!error && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
348
|
+
{!!error && !multi && <Text accessibilityRole="alert" style={{ color: c.statusDanger, fontSize: 13, lineHeight: 18 }}>{error}</Text>}
|
|
221
349
|
|
|
222
350
|
{!!b.also && <View style={{ gap: 3, borderTopWidth: 1, borderTopColor: c.border, paddingTop: 10 }}>
|
|
223
351
|
<Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16, fontWeight: "600" }}>Also, from the agent:</Text>
|
|
224
352
|
<Text style={{ color: c.foreground, fontSize: 14, lineHeight: 20 }}>{b.also.ask}</Text>
|
|
225
|
-
{
|
|
353
|
+
{!tight && !!b.also.context && <Text numberOfLines={3} style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{b.also.context}</Text>}
|
|
226
354
|
</View>}
|
|
227
355
|
</View>
|
|
228
|
-
<View style={{ borderTopWidth: 1, borderTopColor: c.border, paddingHorizontal: pad, paddingVertical: 8, flexDirection: "row", alignItems: "center", gap: 6 }}>
|
|
356
|
+
{(!compact || why) && <View style={{ borderTopWidth: 1, borderTopColor: c.border, paddingHorizontal: pad, paddingVertical: 8, flexDirection: "row", alignItems: "center", gap: 6 }}>
|
|
229
357
|
<Icon name="Info" size={12} color={c.foregroundMuted} />
|
|
230
358
|
<Text style={{ flex: 1, color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{b.sourceLine}</Text>
|
|
231
|
-
</View>
|
|
359
|
+
</View>}
|
|
232
360
|
{workspace && sheet && <PrSheet workspace={workspace} prKey={sheet.key} intent={sheet.intent} theme={theme} compact={compact} browserReady={browser.data?.ready ?? false} onClose={() => setSheet(null)} />}
|
|
233
361
|
</View>;
|
|
234
362
|
}
|
package/client/chat.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { Platform, Pressable, Text, View } from "react-native";
|
|
|
3
3
|
import type { PluginClientContext, PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
4
4
|
import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
|
|
5
5
|
import { answerCardSchema, batchCardSchema, followShellCall, followToolName, parseBatchPrompt, readText, toolRow, toolRowSchema, type AnswerCard, type BatchCard, type ToolRow } from "../shared/chat";
|
|
6
|
-
import { parseAnswerMessage } from "../shared/questions";
|
|
6
|
+
import { parseAnswerMessage, parseAnswersMessage } from "../shared/questions";
|
|
7
7
|
import { Reveal } from "./motion";
|
|
8
8
|
import { tint, withAlpha } from "./theme";
|
|
9
9
|
|
|
@@ -104,16 +104,22 @@ function AnswerCardView({ item, theme }: PluginTimelineItemProps<AnswerCard>) {
|
|
|
104
104
|
<View style={{ borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, overflow: "hidden" }}>
|
|
105
105
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: 12, paddingTop: 10, paddingBottom: 6 }}>
|
|
106
106
|
<Icon name="MessageCircleReply" size={14} color={c.statusSuccess} />
|
|
107
|
-
<Text numberOfLines={1} style={{ flex: 1, color: c.foreground, fontSize: 13, lineHeight: 18, fontWeight: "600" }}>Your answer{/^D\d+$/.test(card.id) ? "" : ` to ${card.id}`} · {card.title}</Text>
|
|
107
|
+
<Text numberOfLines={card.answers ? 2 : 1} style={{ flex: 1, color: c.foreground, fontSize: 13, lineHeight: 18, fontWeight: "600" }}>{card.answers ? `Your answers · ${card.title}` : <>Your answer{/^D\d+$/.test(card.id) ? "" : ` to ${card.id}`} · {card.title}</>}</Text>
|
|
108
108
|
<Pressable accessibilityRole="button" aria-expanded={expanded} accessibilityLabel={expanded ? "Hide the full message" : "Show the full message"} onPress={() => setExpanded(v => !v)} hitSlop={6}
|
|
109
109
|
style={state => ({ paddingHorizontal: 6, paddingVertical: 2, borderRadius: 4, backgroundColor: state.pressed ? c.surface2 : "transparent" })}>
|
|
110
110
|
<Text style={{ color: c.foregroundMuted, fontSize: 12 }}>{expanded ? "Hide" : "Full message"}</Text>
|
|
111
111
|
</Pressable>
|
|
112
112
|
</View>
|
|
113
|
-
<View style={{ paddingHorizontal: 12, paddingBottom: 10, gap:
|
|
113
|
+
{card.answers ? <View style={{ paddingHorizontal: 12, paddingBottom: 10, gap: 8 }}>
|
|
114
|
+
{/* Each answer sits under the question it answers, so the chat says what was decided without scrolling back. */}
|
|
115
|
+
{card.answers.map((a, i) => <View key={a.id} style={{ gap: 1 }}>
|
|
116
|
+
{!!a.question && <Text style={{ color: c.foregroundMuted, fontSize: 12, lineHeight: 16 }}>{i + 1}. {a.question}</Text>}
|
|
117
|
+
<Text selectable style={{ color: a.choice ? c.foreground : c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{a.choice ? <><Text style={{ fontWeight: "600" }}>{a.choice}</Text>{a.label ? ` · ${a.label}` : ""}</> : "Skipped · still open"}</Text>
|
|
118
|
+
</View>)}
|
|
119
|
+
</View> : <View style={{ paddingHorizontal: 12, paddingBottom: 10, gap: 3 }}>
|
|
114
120
|
<Text selectable style={{ color: c.foreground, fontSize: 13, lineHeight: 19 }}><Text style={{ fontWeight: "600", fontVariant: ["tabular-nums"] }}>{card.choice}</Text>{card.label ? ` · ${card.label}` : ""}</Text>
|
|
115
121
|
{!!card.words && <Text selectable style={{ color: c.foregroundMuted, fontSize: 13, lineHeight: 19 }}>{card.words}</Text>}
|
|
116
|
-
</View>
|
|
122
|
+
</View>}
|
|
117
123
|
{expanded && <View style={{ borderTopWidth: 1, borderTopColor: c.border }}>
|
|
118
124
|
<ScrollView style={[{ maxHeight: 300 }, Platform.OS === "web" ? ({ overscrollBehavior: "contain" } as object) : null]} contentContainerStyle={{ padding: 12 }}>
|
|
119
125
|
<Text selectable style={{ color: c.foregroundMuted, fontFamily: mono(), fontSize: 12, lineHeight: 18 }}>{card.text}</Text>
|
|
@@ -149,6 +155,8 @@ export function contributeChat(client: PluginClientContext) {
|
|
|
149
155
|
client.addTimelineTransformer({
|
|
150
156
|
id: "follow-batch-prompts", query: { itemType: "user_message" },
|
|
151
157
|
transform({ item }) {
|
|
158
|
+
const several = parseAnswersMessage(item.text);
|
|
159
|
+
if (several) return { items: [{ type: "plugin" as const, kind: ANSWER_KIND, version: 1, data: { id: several.answers.map(a => a.id).join(", "), title: several.title, choice: "", label: null, words: null, text: item.text, answers: several.answers } }] };
|
|
152
160
|
const answer = parseAnswerMessage(item.text);
|
|
153
161
|
if (answer) return { items: [{ type: "plugin" as const, kind: ANSWER_KIND, version: 1, data: { ...answer, text: item.text } }] };
|
|
154
162
|
const card = parseBatchPrompt(item.text);
|
package/client/display.tsx
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { PluginClientContext, PluginSidebarItemContribution, PluginSurfaceProps } from "@getpaseo/plugin/client";
|
|
2
2
|
import { useRpc, useSettings } from "@getpaseo/plugin/client";
|
|
3
3
|
import { useQuery } from "@tanstack/react-query";
|
|
4
|
-
import { inboxListRpc } from "../shared/contracts";
|
|
4
|
+
import { inboxListRpc, trustBypassRpc } from "../shared/contracts";
|
|
5
5
|
import { SettingsAction, SettingsCard, SettingsSection, SettingsSwitch } from "@getpaseo/plugin/client/ui";
|
|
6
6
|
import { useEffect } from "react";
|
|
7
7
|
import { ActivityIndicator, Text, View } from "react-native";
|
|
8
|
-
import { displayPreferences, displayRpc } from "../shared/display";
|
|
8
|
+
import { displayPreferences, displayRpc, trustCountText } from "../shared/display";
|
|
9
9
|
import { sidebarVisibility } from "./sidebar-visibility";
|
|
10
|
+
import { appVisible, onVisible } from "./visibility";
|
|
10
11
|
|
|
11
12
|
type Display = import("zod").infer<typeof displayPreferences.schema>;
|
|
12
13
|
const listeners = new Set<(values: Display) => void>();
|
|
@@ -21,7 +22,59 @@ export function briefShareText(stats: { days: number; total: number; tool: numbe
|
|
|
21
22
|
return `Last ${stats.days} days: agents stated what they need on ${stats.tool} of ${stats.total} flagged turns (${pct}%).${rest ? ` ${rest[0].toUpperCase()}${rest.slice(1)}.` : ""}`;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
function TrustCount({ theme, inCard = false }: Pick<PluginSurfaceProps, "theme"> & { inCard?: boolean }) {
|
|
26
|
+
const read = useRpc(trustBypassRpc);
|
|
27
|
+
const stats = useQuery({ queryKey: ["follow-through", "trust-bypass"], queryFn: () => read({}), refetchInterval: 60_000 });
|
|
28
|
+
const text = trustCountText(stats.data);
|
|
29
|
+
if (!text) return null;
|
|
30
|
+
return <View style={inCard ? { paddingHorizontal: 16, paddingVertical: 10 } : { paddingHorizontal: 4 }}>
|
|
31
|
+
<Text numberOfLines={1} style={{ color: theme.colors.foregroundMuted, fontSize: 12, lineHeight: 17 }}>{text}</Text>
|
|
32
|
+
</View>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The Overseer and AI priority switches, at the top of their cards in Settings → Agents. Same Display preferences as
|
|
37
|
+
* before (enable_overseer, enable_ranker); only where they show moved.
|
|
38
|
+
*/
|
|
39
|
+
export function PreferenceSwitch({ field, theme }: { field: "enable_overseer" | "enable_ranker"; theme: PluginSurfaceProps["theme"] }) {
|
|
40
|
+
const settings = useSettings(displayPreferences);
|
|
41
|
+
if (settings.status !== "ready") return null;
|
|
42
|
+
const copy = field === "enable_overseer"
|
|
43
|
+
? { label: "Run the Overseer", hint: "Off hides its row on Home and stops its digest. An Overseer you already started stays in its workspace; Follow-up never archives it." }
|
|
44
|
+
: { label: "Rank with AI", hint: "Ranks Home's Priority sort from Linear, Slack, GitHub and the weekly plan. Read-only; runs hourly on workdays when something changed." };
|
|
45
|
+
return <>
|
|
46
|
+
<SettingsSwitch label={copy.label} hint={copy.hint} value={settings.values[field]} disabled={settings.saving}
|
|
47
|
+
onValueChange={value => void settings.save({ ...settings.values, [field]: value }, settings.revision)} />
|
|
48
|
+
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger, paddingHorizontal: 16, paddingBottom: 8 }}>{settings.saveError}</Text>}
|
|
49
|
+
</>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Permissions, in Settings → Following after Defaults: Trust bypass agents and how many prompts it approved.
|
|
54
|
+
* Same Display preference as before (enable_trust_bypass); only where it shows moved.
|
|
55
|
+
*/
|
|
56
|
+
export function PermissionsSection({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
57
|
+
const settings = useSettings(displayPreferences);
|
|
58
|
+
if (settings.status !== "ready") return null;
|
|
59
|
+
// The hint stands on its own (the tooltip only adds who still asks); the count sits inside the card, under its switch.
|
|
60
|
+
return <SettingsSection title="Permissions" info="Agents in any other mode still ask, and so do questions and plan approval.">
|
|
61
|
+
<SettingsCard>
|
|
62
|
+
<SettingsSwitch label="Trust bypass agents" hint="Claude Code in Bypass and Codex in Full access still stop on some tool calls. This approves them while the agent is in that mode. Questions and plan approval still come to you." value={settings.values.enable_trust_bypass} disabled={settings.saving}
|
|
63
|
+
onValueChange={enable_trust_bypass => void settings.save({ ...settings.values, enable_trust_bypass }, settings.revision)} />
|
|
64
|
+
{settings.values.enable_trust_bypass && <TrustCount theme={theme} inCard />}
|
|
65
|
+
</SettingsCard>
|
|
66
|
+
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
|
|
67
|
+
</SettingsSection>;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A neutral "Beta" chip for section titles. */
|
|
71
|
+
export function BetaChip({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
72
|
+
return <View style={{ paddingHorizontal: 6, paddingVertical: 1, borderRadius: 4, backgroundColor: theme.colors.surface2 }}>
|
|
73
|
+
<Text style={{ color: theme.colors.foregroundMuted, fontSize: 11, lineHeight: 15 }}>Beta</Text>
|
|
74
|
+
</View>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** "Sidebar & pills" and "Needs-you inbox", the Inbox & display tab of Follow-up's settings. */
|
|
25
78
|
export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
26
79
|
const settings = useSettings(displayPreferences);
|
|
27
80
|
const list = useRpc(inboxListRpc);
|
|
@@ -55,7 +108,7 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
55
108
|
</SettingsCard>
|
|
56
109
|
{settings.saveError && <Text accessibilityRole="alert" style={{ color: theme.colors.statusDanger }}>{settings.saveError}</Text>}
|
|
57
110
|
</SettingsSection>
|
|
58
|
-
<SettingsSection title="Needs-you inbox
|
|
111
|
+
<SettingsSection title="Needs-you inbox" trailing={<BetaChip theme={theme} />} info="Agents stay in Needs you until you sign them off or write to them. Opening an agent doesn't clear it.">
|
|
59
112
|
<SettingsCard>
|
|
60
113
|
<SettingsSwitch label="Needs-you inbox" hint="Off: no agent is flagged. The pill still shows workspace items, and the sidebar badge counts workspaces instead." value={settings.values.enable_inbox} disabled={settings.saving} onValueChange={(enable_inbox) => save({ enable_inbox })} />
|
|
61
114
|
<SettingsSwitch label="Flag merged and closed PRs" hint="At the lowest priority, as the cue to archive." value={settings.values.enable_inbox_pr_closed} disabled={settings.saving || !settings.values.enable_inbox} onValueChange={(enable_inbox_pr_closed) => save({ enable_inbox_pr_closed })} />
|
|
@@ -63,11 +116,6 @@ export function DisplaySections({ theme }: Pick<PluginSurfaceProps, "theme">) {
|
|
|
63
116
|
</SettingsCard>
|
|
64
117
|
{settings.values.enable_inbox && !!share.data?.briefStats && <Text style={{ color: theme.colors.foregroundMuted, fontSize: 12, lineHeight: 17, paddingHorizontal: 4 }}>{briefShareText(share.data.briefStats)}</Text>}
|
|
65
118
|
</SettingsSection>
|
|
66
|
-
<SettingsSection title="Overseer (beta)" info="One agent you can ask about all your work. It sends each task to the agent that owns it and asks you when it isn't sure.">
|
|
67
|
-
<SettingsCard>
|
|
68
|
-
<SettingsSwitch label="Overseer" hint="Off hides its row on Home and stops its digest. An Overseer you already started stays in its workspace; Follow-up never archives it." value={settings.values.enable_overseer} disabled={settings.saving} onValueChange={(enable_overseer) => save({ enable_overseer })} />
|
|
69
|
-
</SettingsCard>
|
|
70
|
-
</SettingsSection>
|
|
71
119
|
</>
|
|
72
120
|
);
|
|
73
121
|
}
|
|
@@ -98,11 +146,14 @@ export function contributeDisplay(client: PluginClientContext, item: PluginSideb
|
|
|
98
146
|
// Retain the last valid preference through temporary disconnects.
|
|
99
147
|
} finally { pending = false; }
|
|
100
148
|
};
|
|
149
|
+
// Changes made on this client notify at once; other clients' changes are picked up within a minute, and not at all
|
|
150
|
+
// while the app is hidden (it reads once on return).
|
|
101
151
|
void refresh();
|
|
102
|
-
const timer = setInterval(() => void refresh(),
|
|
152
|
+
const timer = setInterval(() => { if (appVisible()) void refresh(); }, 60_000);
|
|
153
|
+
const offVisible = onVisible(() => void refresh());
|
|
103
154
|
return () => {
|
|
104
155
|
disposed = true;
|
|
105
|
-
clearInterval(timer);
|
|
156
|
+
clearInterval(timer); offVisible();
|
|
106
157
|
listeners.delete(update);
|
|
107
158
|
sidebar.dispose();
|
|
108
159
|
};
|