paseo-follow-up 2.2.0-beta.3 → 2.2.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/OVERVIEW.md +1 -1
- package/assets/icon.png +0 -0
- package/assets/icon.svg +1 -1
- package/client/catch-up.tsx +216 -80
- package/client/follow-up-icon.ts +3 -3
- package/client/questions.tsx +15 -2
- package/docs/screenshots/follow-up-home.png +0 -0
- package/docs/screenshots/follow-up-linked-items.png +0 -0
- package/docs/screenshots/follow-up-panel.png +0 -0
- package/docs/screenshots/follow-up-phone.png +0 -0
- package/docs/screenshots/follow-up-pill.png +0 -0
- package/docs/screenshots/follow-up-pr-sheet.png +0 -0
- package/docs/screenshots/follow-up-sidebar.png +0 -0
- package/index.server.ts +13 -28
- package/package.json +2 -1
- package/server/agent-parity.ts +4 -3
- package/server/context-requests.ts +23 -9
- package/server/graphite.ts +15 -3
- package/server/pr-workflow.ts +2 -3
- package/shared/catch-up.ts +98 -21
- package/shared/contracts.ts +4 -2
package/OVERVIEW.md
CHANGED
|
@@ -36,7 +36,7 @@ This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent
|
|
|
36
36
|
|
|
37
37
|
Follow-up reads Paseo's agent, workspace and project lists into one in-memory directory shared by discovery, runtime checks, the Needs-you inbox, the Overseer and every client RPC. It reads the lists once at start, then patches the directory from lifecycle events: turn started or ended, permission requested or resolved, agent created, closed or archived, workspace created or archived. A change marks it dirty, and a dirty directory re-reads at most once a minute; a clean one re-reads every ten minutes. Before anything that would load an agent (a timeline or provider-subagent read), Follow-up re-reads that one agent, because the cached copy may predate Paseo unloading it. Provider subagents are asked about only when a send is due or waiting for acknowledgment, or completion is being checked. The Done label is sent only when it changes. In the app, the panel, the larger view and the pill draw from the client's shared workspace poll, which runs every 15 s plus a refresh shortly after Paseo reports an agent change. The inbox runs the same way and passes the tag of the list it holds, so an unchanged list comes back empty. Display preferences re-read once a minute. None of these poll while the app is hidden.
|
|
38
38
|
|
|
39
|
-
The PR workflow setting lives in `plugin-data/follow-up/pr-workflow.json` (owner-only): the default, per-repository overrides, merge methods and the review-fix instruction. Auto-detection reads only files: PATH for a `gt` executable,
|
|
39
|
+
The PR workflow setting lives in `plugin-data/follow-up/pr-workflow.json` (owner-only): the default, per-repository overrides, merge methods and the review-fix instruction. Auto-detection reads only files: PATH for a `gt` executable, `<config>/graphite/user_config`, `<config>/graphite/auth`, then `~/.graphite_user_config` for a sign-in token's presence (`<config>` is `$XDG_CONFIG_HOME` or `~/.config`) (never sent anywhere by detection), and `<git dir>/.graphite_repo_config` in the checkout of the repository's Paseo project, then in the working directories of tracked workspaces with PRs in that repository (from the agent list Follow-up already has). It never runs `gt` and caches for ten minutes. Repositories that resolve to GitHub get no Graphite API calls; their readiness, merge method and auto-merge come from the same `gh api graphql` query that already reads each PR, so there is no extra polling. The first start with this setting seeds the review-fix instruction to `/fix-pr` when `~/.claude/commands/fix-pr.md` or `~/.claude/skills/fix-pr/SKILL.md` exists, once.
|
|
40
40
|
|
|
41
41
|
Reviewer lists live in `plugin-data/follow-up/reviewers.json` (owner-only), apart from `state.json`. Each list is per repository, plus a default for repositories without one, and each user keeps their own. Collaborator and team suggestions are read with `gh api` only when you open Add reviewer. They are cached for ten minutes, and never polled.
|
|
42
42
|
|
package/assets/icon.png
CHANGED
|
Binary file
|
package/assets/icon.svg
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256"><title>Follow-up</title><rect width="256" height="256" rx="52" fill="#
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256"><title>Follow-up</title><rect width="256" height="256" rx="52" fill="#222126"/><g transform="translate(24.8 24.8) scale(8.6)"><path d="M6.95 19.21C7.25 19.11 8.19 18.91 8.75 18.59C9.3 18.27 9.7 18 10.29 17.29C10.89 16.58 11.8 15.23 12.34 14.32C12.87 13.41 13.14 12.75 13.51 11.84C13.88 10.93 14.29 9.96 14.57 8.87C14.84 7.78 15.17 6.23 15.18 5.28C15.2 4.33 14.88 3.61 14.63 3.18C14.38 2.74 14.04 2.66 13.7 2.68C13.36 2.7 12.92 2.85 12.58 3.3C12.25 3.75 11.93 4.48 11.72 5.4C11.5 6.33 11.32 7.8 11.29 8.87C11.25 9.94 11.36 10.93 11.53 11.84C11.71 12.75 11.97 13.58 12.34 14.32C12.71 15.06 13.23 15.8 13.76 16.3C14.29 16.79 14.98 17.03 15.49 17.29C16.01 17.55 16.63 17.75 16.86 17.85" fill="none" stroke="#ffffff" stroke-width="1.42" stroke-linecap="round" stroke-linejoin="round"/><circle cx="4.85" cy="19.15" r="2.14" fill="none" stroke="#ffffff" stroke-width="1.42"/><circle cx="20.01" cy="18.03" r="1.92" fill="#B79CF0"/></g></svg>
|
package/client/catch-up.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// the answer flow is the shared one, never a fork (one-answer-flow-for-every-question). The deck's order and every
|
|
4
4
|
// move are the pure session in shared/catch-up.ts (context-never-blocks-the-deck, the-card-on-screen-never-moves).
|
|
5
5
|
import { useEffect, useMemo, useRef, useState, useSyncExternalStore, type ReactNode } from "react";
|
|
6
|
-
import { PanResponder, Platform, View } from "react-native";
|
|
6
|
+
import { Animated, PanResponder, Platform, View } from "react-native";
|
|
7
7
|
import { Pressable, Text } from "./text";
|
|
8
8
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
9
9
|
import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
|
|
@@ -15,14 +15,14 @@ import { age, snoozeUntil } from "../shared/inbox";
|
|
|
15
15
|
import { laterChoices } from "../shared/row-menu";
|
|
16
16
|
import { errorText } from "../shared/errors";
|
|
17
17
|
import { CATCH_UP_RAIL_DEFAULT, CATCH_UP_RAIL_MAX, CATCH_UP_RAIL_MIN } from "../shared/display";
|
|
18
|
-
import { CATCH_UP_KEYS, CONTEXT_ASKS, MODE, askHeadline, catchUpKey, keyLabel, deckCards, groupOf, park, prevPos, settle as settleCard, startSession, statsOf, sync, type ContextRequest, type DeckCard, type Outcome, type Session } from "../shared/catch-up";
|
|
18
|
+
import { CATCH_UP_KEYS, CONTEXT_ASKS, MODE, askHeadline, catchUpKey, keyLabel, deckCards, groupOf, openInWorkspace, park, prevPos, applySwipe, skipWorkspace, swipeLock, swipeOutcome, settle as settleCard, startSession, statsOf, sync, type ContextRequest, type DeckCard, type Outcome, type Session } from "../shared/catch-up";
|
|
19
19
|
import type { Workspace } from "../shared/model";
|
|
20
20
|
import type { ListWorkspace } from "../shared/list";
|
|
21
|
-
import { bottomInset, Button, IconButton, text, type Theme } from "./kit";
|
|
21
|
+
import { bottomInset, Button, focusSoon, IconButton, SubmitScope, text, type Theme } from "./kit";
|
|
22
22
|
import { glyphColor } from "./home-list";
|
|
23
23
|
import { useHomeModel, type HomeSources } from "./home-data";
|
|
24
24
|
import { useInbox } from "./inbox";
|
|
25
|
-
import { QuestionBody } from "./questions";
|
|
25
|
+
import { QuestionBody, type SendReady } from "./questions";
|
|
26
26
|
import { NeedsYouList } from "./needs-you";
|
|
27
27
|
import { BriefCard, type BriefDeps } from "./brief";
|
|
28
28
|
import { SummaryLine } from "./about";
|
|
@@ -32,6 +32,8 @@ import { mergedColor, withAlpha, tint } from "./theme";
|
|
|
32
32
|
import { RichText } from "./rich-text";
|
|
33
33
|
import { DisplaySplit, PermissionBlock, useAgentLive } from "./home";
|
|
34
34
|
import { DockedPane } from "./docked-pane";
|
|
35
|
+
import { ownsKey, surfaceVisible } from "../shared/list-keys";
|
|
36
|
+
import { useReducedMotion } from "./motion";
|
|
35
37
|
import { PRIMARY_FORM } from "./dock";
|
|
36
38
|
|
|
37
39
|
/** react-native-web's data attribute, so the option-letter keys find this card's radios. */
|
|
@@ -66,6 +68,16 @@ function cardWord(card: DeckCard): string {
|
|
|
66
68
|
}
|
|
67
69
|
const cardIcon = (card: DeckCard) => card.kind === "permission" ? "ShieldQuestion" : card.kind === "question" ? "MessageCircleQuestion"
|
|
68
70
|
: card.item?.kind === "merge" ? "GitMerge" : card.item?.kind === "reviewers" ? "UserPlus" : card.item?.kind === "send" ? "Send" : card.kind === "finished" ? "Flag" : card.s.icon;
|
|
71
|
+
/**
|
|
72
|
+
* The card Skip names what it skips, so it never reads as the workspace (Tom, beta.3: "at first I thought it skips the
|
|
73
|
+
* workspace"): the card's kind where one word says it, else "card", the deck's own word ("N skipped" counts cards).
|
|
74
|
+
*/
|
|
75
|
+
export function skipNoun(card: Pick<DeckCard, "kind" | "item">): string {
|
|
76
|
+
return card.kind === "question" ? "question" : card.kind === "permission" ? "permission" : card.item?.kind === "merge" ? "merge" : "card";
|
|
77
|
+
}
|
|
78
|
+
/** The card Skip's tooltip and accessible name: what it does and that the card comes back. */
|
|
79
|
+
export const skipCardHint = (noun: string) => `Skip this ${noun}. It comes back after the rest`;
|
|
80
|
+
export const skipWorkspaceHint = (n: number) => `Skip this workspace's ${n} cards. They come back after the rest`;
|
|
69
81
|
/** The newest ask about this card, if any. */
|
|
70
82
|
const askFor = (context: readonly ContextRequest[], key: string) => [...context].reverse().find(r => r.cardKey === key) ?? null;
|
|
71
83
|
|
|
@@ -93,19 +105,14 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
93
105
|
useEffect(() => { void extras.refreshContext(); }, [session.pos]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
94
106
|
|
|
95
107
|
const [more, setMore] = useState(false);
|
|
96
|
-
// M opens More context below the card's answers; bring it into view so the key's result is never off screen.
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
if (!more || Platform.OS !== "web") return;
|
|
99
|
-
const t = setTimeout(() => (globalThis as { document?: { querySelector(q: string): { scrollIntoView?(o: object): void } | null } }).document
|
|
100
|
-
?.querySelector("[data-catch-up-more]")?.scrollIntoView?.({ block: "nearest", behavior: "smooth" }), 50);
|
|
101
|
-
return () => clearTimeout(t);
|
|
102
|
-
}, [more]);
|
|
103
108
|
const key = session.order[session.pos];
|
|
104
109
|
const card = cardOf(key);
|
|
105
110
|
const gone = !!key && session.outcomes[key] === "gone";
|
|
106
111
|
const finished = session.pos >= session.order.length;
|
|
107
112
|
const settle = (outcome: Outcome) => { setMore(false); setSession(s => settleCard(s, outcome)); };
|
|
108
113
|
const skip = () => settle("skipped");
|
|
114
|
+
const skipWs = () => { setMore(false); setSession(skipWorkspace); };
|
|
115
|
+
const wsLeft = openInWorkspace(session).length;
|
|
109
116
|
const back = () => { setMore(false); setSession(s => ({ ...s, pos: prevPos(s) })); };
|
|
110
117
|
const jump = (i: number) => { setMore(false); setSession(s => ({ ...s, pos: i })); };
|
|
111
118
|
const w = card?.s.workspaceId ? live.get(card.s.workspaceId) : undefined;
|
|
@@ -113,9 +120,9 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
113
120
|
const nextCard = cardOf(session.order[session.pos + 1]);
|
|
114
121
|
useWorkspace(live, nextCard?.s.workspaceId ?? "", { enabled: !!nextCard?.s.workspaceId });
|
|
115
122
|
|
|
116
|
-
const ask = async (
|
|
123
|
+
const ask = async (words: string) => {
|
|
117
124
|
if (!card) return;
|
|
118
|
-
const out = await extras.askContext({ workspaceId: card.s.workspaceId, agentId: card.s.agentId, cardKey: card.key, card: cardLabel(card, w).slice(0, 300),
|
|
125
|
+
const out = await extras.askContext({ workspaceId: card.s.workspaceId, agentId: card.s.agentId, cardKey: card.key, card: cardLabel(card, w).slice(0, 300), ask: words });
|
|
119
126
|
setMore(false);
|
|
120
127
|
// context-never-blocks-the-deck: the workstream waits, the deck moves on.
|
|
121
128
|
if (out.request.state === "asking") setSession(s => park(s, out.request.id, card.key));
|
|
@@ -123,42 +130,55 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
123
130
|
|
|
124
131
|
// Desktop keys (CATCH_UP_KEYS, catchUpKey in shared/catch-up.ts): every move has one. The card's controls are found
|
|
125
132
|
// by the names they already carry (option letters, Later (L), Open chat (O)), so a key does exactly what a click does.
|
|
133
|
+
// every-catch-up-key-works-wherever-focus-is: one owner for these keys whatever else is mounted. The listener is the
|
|
134
|
+
// window's, in the capture phase, so it runs before any document listener (Follow-up's list keys take j and k there
|
|
135
|
+
// and stop them); it takes a key only when focus is inside this screen, or on nothing while this screen is the one on
|
|
136
|
+
// view (a Catch up Paseo keeps mounted behind a tab never does), and it finds every control inside its own root.
|
|
126
137
|
const [keysOpen, setKeysOpen] = useState(false);
|
|
138
|
+
const rootRef = useRef<View>(null);
|
|
127
139
|
useEffect(() => {
|
|
128
140
|
if (Platform.OS !== "web" || compact) return;
|
|
129
|
-
type Ev = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; shiftKey: boolean; isComposing: boolean; target: unknown; preventDefault(): void };
|
|
141
|
+
type Ev = { key: string; metaKey: boolean; ctrlKey: boolean; altKey: boolean; shiftKey: boolean; isComposing: boolean; target: unknown; preventDefault(): void; stopPropagation(): void };
|
|
130
142
|
type El = { tagName?: string; isContentEditable?: boolean; click?(): void; focus?(): void; closest?(q: string): El | null };
|
|
131
|
-
type
|
|
132
|
-
|
|
143
|
+
type Root = El & { querySelector(q: string): El | null; querySelectorAll(q: string): ArrayLike<El>; contains(n: unknown): boolean; checkVisibility?(): boolean; getClientRects?(): { length: number } };
|
|
144
|
+
type Doc = { body?: unknown; visibilityState?: string };
|
|
145
|
+
type Win = { addEventListener(t: string, f: (e: Ev) => void, capture?: boolean): void; removeEventListener(t: string, f: (e: Ev) => void, capture?: boolean): void };
|
|
146
|
+
const doc = (globalThis as { document?: Doc }).document; const win = globalThis as unknown as Win;
|
|
147
|
+
if (!doc || typeof win.addEventListener !== "function") return;
|
|
133
148
|
const mac = isMac();
|
|
134
|
-
const
|
|
135
|
-
const
|
|
149
|
+
const root = () => rootRef.current as unknown as Root | null;
|
|
150
|
+
const inCard = (q: string) => root()?.querySelector(`[data-catch-up-card] ${q}`) ?? null;
|
|
151
|
+
const railItems = () => Array.from(root()?.querySelectorAll("[data-catch-up-rail] [role=\"button\"]") ?? []);
|
|
136
152
|
const onKey = (e: Ev) => {
|
|
137
153
|
const el = e.target as El | null;
|
|
154
|
+
const r = root();
|
|
155
|
+
const onBody = !el || el === doc.body;
|
|
156
|
+
if (!r || !ownsKey({ inside: !!el && r.contains(el), onBody, claimBody: true, visible: onBody && surfaceVisible(r, doc) })) return;
|
|
138
157
|
const typing = !!el && (el.tagName === "INPUT" || el.tagName === "TEXTAREA" || !!el.isContentEditable);
|
|
139
158
|
const hit = catchUpKey({ key: e.key, meta: e.metaKey, ctrl: e.ctrlKey, alt: e.altKey, shift: e.shiftKey, composing: e.isComposing, mac },
|
|
140
159
|
{ typing, inMore: !!el?.closest?.("[data-catch-up-more]"), moreOpen: more, inRail: !!el?.closest?.("[data-catch-up-rail]") });
|
|
141
160
|
if (!hit || finished && !["back", "keys", "leave", "rail"].includes(hit.action)) return;
|
|
142
|
-
const click = (q: string) => { const b =
|
|
161
|
+
const click = (q: string) => { const b = r.querySelector(q); b?.click?.(); return !!b; };
|
|
143
162
|
switch (hit.action) {
|
|
144
163
|
case "skip": skip(); break;
|
|
164
|
+
case "skip-workspace": if (wsLeft < 2) return; skipWs(); break;
|
|
145
165
|
case "back": back(); break;
|
|
146
|
-
case "more": setMore(v => !v); break;
|
|
166
|
+
case "more": if (!click('[data-catch-up-card-moves] [aria-label="More context"]')) setMore(v => !v); break;
|
|
147
167
|
case "keys": setKeysOpen(v => !v); break;
|
|
148
168
|
case "leave": onExit(); break;
|
|
149
169
|
case "pick": inCard(`[role="radio"][aria-label^="${hit.arg}. "]`)?.click?.(); break;
|
|
150
170
|
case "own": inCard('[role="radio"][aria-label^="Something else"]')?.click?.(); break;
|
|
151
171
|
case "send": { const b = inCard('[aria-label^="Send your"]') ?? inCard('[aria-label^="Send "]'); if (!b) return; b.click?.(); break; }
|
|
152
|
-
case "note": { const add = inCard('[aria-label^="Add a note"]'); if (add) add.click?.(); else
|
|
153
|
-
|
|
172
|
+
case "note": { const add = inCard('[aria-label^="Add a note"]'); if (add) add.click?.(); else r.querySelector('[aria-label="Tell the agent something"]')?.focus?.(); break; }
|
|
173
|
+
// Its sheet or popover takes focus itself (MoveResult).
|
|
174
|
+
case "later": if (!click('[aria-label="Later (L)"]')) return; break;
|
|
154
175
|
case "chat": if (!click('[aria-label="Open chat (O)"]')) return; break;
|
|
155
|
-
case "chip":
|
|
156
|
-
case "ask
|
|
157
|
-
case "ask-agent": if (!click('[data-catch-up-more] [data-ask-agent] [role="button"]')) return; break;
|
|
176
|
+
case "chip": r.querySelectorAll("[data-catch-up-more] [role=\"radio\"]")[Number(hit.arg) - 1]?.click?.(); break;
|
|
177
|
+
case "ask": if (!click('[data-catch-up-more] [data-ask-agent] [role="button"]')) return; break;
|
|
158
178
|
case "rail": {
|
|
159
179
|
const items = railItems();
|
|
160
180
|
if (el?.closest?.("[data-catch-up-rail]")) { (el as { blur?(): void }).blur?.(); break; }
|
|
161
|
-
(
|
|
181
|
+
(r.querySelector("[data-catch-up-rail] [data-catch-up-here]") ?? items[0])?.focus?.();
|
|
162
182
|
break;
|
|
163
183
|
}
|
|
164
184
|
case "rail-up": case "rail-down": {
|
|
@@ -169,15 +189,55 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
169
189
|
default: return;
|
|
170
190
|
}
|
|
171
191
|
e.preventDefault();
|
|
192
|
+
// Acted: nothing else handles it (a list's j/k under a document listener).
|
|
193
|
+
e.stopPropagation();
|
|
172
194
|
};
|
|
173
|
-
|
|
174
|
-
return () =>
|
|
195
|
+
win.addEventListener("keydown", onKey, true);
|
|
196
|
+
return () => win.removeEventListener("keydown", onKey, true);
|
|
175
197
|
});
|
|
176
|
-
// Phones:
|
|
198
|
+
// Phones: the card follows the finger (Paseo's sidebar drag): left skips this card, right goes Back, the card about to
|
|
199
|
+
// show peeks underneath, and a drag held halfway stays there. The direction locks in the first SWIPE_LOCK_PX, so a
|
|
200
|
+
// vertical scroll stays a scroll. Answers are never a swipe: a stray thumb must not decide anything. Reduced motion:
|
|
201
|
+
// no follow, just the move on release. Transforms only (translateX), on the native driver where there is one.
|
|
202
|
+
const reduced = useReducedMotion();
|
|
203
|
+
const drag = useRef(new Animated.Value(0)).current;
|
|
204
|
+
const [dragDir, setDragDir] = useState<"skip-workspace" | "back" | null>(null);
|
|
205
|
+
const width = useRef(390);
|
|
206
|
+
const lock = useRef<"x" | "y" | null>(null);
|
|
207
|
+
// The finger's own offset from where it went down: react-native-web's accumulated gestureState.dx runs ahead of a
|
|
208
|
+
// mouse drag, so the card would outrun the pointer. Every touch start passes the capture phase, so it is read there.
|
|
209
|
+
const origin = useRef({ x: 0, y: 0 });
|
|
210
|
+
type Touch = { nativeEvent: { pageX: number; pageY: number } };
|
|
211
|
+
const offset = (e: Touch) => ({ dx: e.nativeEvent.pageX - origin.current.x, dy: e.nativeEvent.pageY - origin.current.y });
|
|
212
|
+
const canBack = session.pos > 0;
|
|
177
213
|
const pan = useMemo(() => PanResponder.create({
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
214
|
+
onStartShouldSetPanResponderCapture: e => { origin.current = { x: e.nativeEvent.pageX, y: e.nativeEvent.pageY }; lock.current = null; return false; },
|
|
215
|
+
onMoveShouldSetPanResponderCapture: e => {
|
|
216
|
+
if (!compact || finished) return false;
|
|
217
|
+
const { dx, dy } = offset(e);
|
|
218
|
+
const l = swipeLock(dx, dy);
|
|
219
|
+
if (!l) return false;
|
|
220
|
+
lock.current ??= l;
|
|
221
|
+
return lock.current === "x";
|
|
222
|
+
},
|
|
223
|
+
onPanResponderTerminationRequest: () => false,
|
|
224
|
+
onPanResponderMove: e => {
|
|
225
|
+
const { dx } = offset(e);
|
|
226
|
+
setDragDir(dx < 0 ? "skip-workspace" : canBack ? "back" : null);
|
|
227
|
+
// Nothing behind the first card: the drag resists instead of revealing an empty space.
|
|
228
|
+
if (!reduced) drag.setValue(dx > 0 && !canBack ? dx * 0.25 : dx);
|
|
229
|
+
},
|
|
230
|
+
onPanResponderRelease: (e, g) => {
|
|
231
|
+
lock.current = null;
|
|
232
|
+
const out = swipeOutcome({ dx: offset(e).dx, vx: g.vx, width: width.current, canBack });
|
|
233
|
+
// Left skips the whole workspace (Skip workspace, ⇧J); right is Back. The same applySwipe the tests run.
|
|
234
|
+
const act = () => { drag.setValue(0); setDragDir(null); setMore(false); setSession(s => applySwipe(s, out)); };
|
|
235
|
+
if (out === "stay") { setDragDir(null); if (!reduced) Animated.spring(drag, { toValue: 0, bounciness: 0, speed: 20, useNativeDriver: Platform.OS !== "web" }).start(); else drag.setValue(0); return; }
|
|
236
|
+
if (reduced) { act(); return; }
|
|
237
|
+
Animated.timing(drag, { toValue: (out === "skip-workspace" ? -1 : 1) * width.current, duration: 160, useNativeDriver: Platform.OS !== "web" }).start(act);
|
|
238
|
+
},
|
|
239
|
+
onPanResponderTerminate: () => { lock.current = null; setDragDir(null); drag.setValue(0); },
|
|
240
|
+
}), [compact, key, finished, canBack, reduced]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
181
241
|
|
|
182
242
|
const stats = statsOf(session);
|
|
183
243
|
const total = session.order.length;
|
|
@@ -191,7 +251,7 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
191
251
|
{!compact && <IconButton theme={theme} compact={compact} icon="X" label={`Leave ${MODE.name} (X)`} tooltip onPress={onExit} />}
|
|
192
252
|
<Text accessibilityRole="header" style={[t.title, { flex: 1 }]}>{finished || !total ? MODE.name : <>{MODE.name} <Text style={{ color: c.foregroundMuted, fontWeight: "400", fontVariant: ["tabular-nums"] }}>{MODE.progress(session.pos + 1, total).slice(MODE.name.length + 1)}</Text></>}</Text>
|
|
193
253
|
{waitingChip}
|
|
194
|
-
{!compact && <Pressable accessibilityRole="button" accessibilityLabel="Show the keys (S)" onPress={() => setKeysOpen(v => !v)}><Text style={t.small}>{finished ? "S keys · X leave" : "J skip · K back · M more context · S keys
|
|
254
|
+
{!compact && <Pressable accessibilityRole="button" accessibilityLabel="Show the keys (S)" onPress={() => setKeysOpen(v => !v)}><Text style={t.small}>{finished ? "S keys · X leave" : "J skip card · ⇧J skip workspace · K back · M more context · S keys"}</Text></Pressable>}
|
|
195
255
|
</View>
|
|
196
256
|
{/* One segment per card: done in the foreground colour, skipped hollow, waiting for context amber-tinted, the current one amber. */}
|
|
197
257
|
{total > 0 && <View accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={{ flexDirection: "row", gap: 3 }}>
|
|
@@ -210,7 +270,7 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
210
270
|
: <CardView key={card.key} card={card} w={w} theme={theme} compact={compact} deps={deps} navigation={navigation} gone={gone} more={more} setMore={setMore}
|
|
211
271
|
request={askFor(context, card.key)} waiting={!!session.parked[card.s.key]} onAsk={ask}
|
|
212
272
|
sameWorkspace={session.order.filter(k => cardOf(k)?.s.key === card.s.key)}
|
|
213
|
-
onDone={() => settle("done")} onSkip={skip} onBack={session.pos > 0 ? back : undefined} onLater={() => settle("later")} />;
|
|
273
|
+
onDone={() => settle("done")} onSkip={skip} onSkipWorkspace={wsLeft > 1 ? skipWs : undefined} wsLeft={wsLeft} onBack={session.pos > 0 ? back : undefined} onLater={() => settle("later")} />;
|
|
214
274
|
|
|
215
275
|
const rail = <ScrollView {...({ dataSet: { catchUpRail: "1" } } as object)} contentContainerStyle={{ paddingVertical: 8 }}>
|
|
216
276
|
{session.order.map((k, i) => {
|
|
@@ -233,8 +293,26 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
233
293
|
})}
|
|
234
294
|
</ScrollView>;
|
|
235
295
|
|
|
236
|
-
|
|
237
|
-
|
|
296
|
+
// Under the dragged card: the one the release would show, so the drag says where it goes.
|
|
297
|
+
// The peek says exactly what the release does: where Skip workspace lands (skipWorkspace itself), or Back's card.
|
|
298
|
+
const ahead = dragDir === "skip-workspace" ? skipWorkspace(session) : null;
|
|
299
|
+
const peekKey = ahead ? ahead.order[ahead.pos] : dragDir === "back" ? session.order[prevPos(session)] : undefined;
|
|
300
|
+
const peekWhat = dragDir === "back" ? "Back" : wsLeft > 1 ? `Skip workspace · ${wsLeft} cards` : `Skip ${card ? skipNoun(card) : "card"}`;
|
|
301
|
+
const peekCard = cardOf(peekKey);
|
|
302
|
+
const peek = compact && dragDir && <View accessibilityElementsHidden importantForAccessibility="no-hide-descendants" pointerEvents="none"
|
|
303
|
+
style={{ position: "absolute", top: 0, bottom: 0, left: 0, right: 0, backgroundColor: c.surface1, justifyContent: "center", alignItems: dragDir === "skip-workspace" ? "flex-end" : "flex-start", paddingHorizontal: 20 }}>
|
|
304
|
+
<View style={{ maxWidth: "42%", gap: 4, alignItems: dragDir === "skip-workspace" ? "flex-end" : "flex-start" }}>
|
|
305
|
+
<Icon name={dragDir === "back" ? "ChevronLeft" : wsLeft > 1 ? "ChevronsRight" : "ArrowRight"} size={18} color={c.foregroundMuted} />
|
|
306
|
+
<Text style={[t.small, { fontWeight: "600" }]}>{peekWhat}</Text>
|
|
307
|
+
<Text numberOfLines={2} style={[t.meta, { textAlign: dragDir === "skip-workspace" ? "right" : "left" }]}>{peekCard ? `${peekCard.s.title} · ${cardLabel(peekCard, peekCard.s.workspaceId ? live.get(peekCard.s.workspaceId) : undefined)}` : MODE.endOfDeck}</Text>
|
|
308
|
+
</View>
|
|
309
|
+
</View>;
|
|
310
|
+
const main = <View style={{ flex: 1, minWidth: 0, overflow: "hidden" }} onLayout={e => { width.current = e.nativeEvent.layout.width; }} {...pan.panHandlers}>
|
|
311
|
+
{peek}
|
|
312
|
+
<Animated.View {...({ dataSet: { catchUpDrag: "1" } } as object)} style={{ flex: 1, backgroundColor: c.surface0, transform: [{ translateX: drag }],
|
|
313
|
+
...(dragDir ? { shadowColor: "#000", shadowOpacity: 0.18, shadowRadius: 12, shadowOffset: { width: 0, height: 0 } } : {}) }}>{body}</Animated.View>
|
|
314
|
+
</View>;
|
|
315
|
+
return <View ref={rootRef} {...({ dataSet: { catchUpRoot: "1" } } as object)} style={{ flex: 1, backgroundColor: c.surface0 }}>
|
|
238
316
|
{progress}
|
|
239
317
|
<View style={{ flex: 1, borderTopWidth: 1, borderTopColor: c.border }}>
|
|
240
318
|
{/* Desktop: the queue rail beside the card, resizable (side-panes-are-resizable); its width is the Display field catch_up_rail_fraction. */}
|
|
@@ -248,23 +326,24 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
248
326
|
}
|
|
249
327
|
|
|
250
328
|
/** One card: who and what, the ask through its own surface's component, then the deck's moves pinned to the bottom. */
|
|
251
|
-
function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMore, request, waiting, onAsk, sameWorkspace, onDone, onSkip, onBack, onLater }: {
|
|
329
|
+
function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMore, request, waiting, onAsk, sameWorkspace, onDone, onSkip, onSkipWorkspace, wsLeft, onBack, onLater }: {
|
|
252
330
|
card: DeckCard; w: ListWorkspace | undefined; theme: Theme; compact: boolean; deps: CatchUpDeps; navigation: Nav; gone: boolean; more: boolean; setMore: (v: boolean | ((v: boolean) => boolean)) => void;
|
|
253
|
-
request: ContextRequest | null; waiting: boolean; onAsk: (
|
|
254
|
-
sameWorkspace: string[]; onDone: () => void; onSkip: () => void; onBack?: () => void; onLater: () => void;
|
|
331
|
+
request: ContextRequest | null; waiting: boolean; onAsk: (words: string) => Promise<void>;
|
|
332
|
+
sameWorkspace: string[]; onDone: () => void; onSkip: () => void; onSkipWorkspace?: () => void; wsLeft: number; onBack?: () => void; onLater: () => void;
|
|
255
333
|
}) {
|
|
256
334
|
const c = theme.colors; const t = text(c, compact);
|
|
257
335
|
const s = card.s;
|
|
258
336
|
const { workspace: full } = useWorkspace(deps.sources.live, s.workspaceId ?? "");
|
|
259
337
|
const ws = openRowCopy<ListWorkspace>(w, full);
|
|
260
|
-
const overseerOn = useSyncExternalStore(deps.sources.extras.subscribe, () => deps.sources.extras.overseer()?.enabled !== false, () => true);
|
|
261
338
|
const [laterOpen, setLaterOpen] = useState(false);
|
|
339
|
+
const [ready, setReady] = useState<SendReady | null>(null);
|
|
262
340
|
const openChat = () => { if (!navigation) return; if (s.agentId) navigation.openAgent({ agentId: s.agentId }); else if (s.workspaceId) navigation.openWorkspace({ workspaceId: s.workspaceId }); };
|
|
263
341
|
const word = cardWord(card);
|
|
264
342
|
const color = card.item?.kind === "merge" ? mergedColor(c) : card.kind === "finished" ? c.foregroundMuted : c.statusWarning;
|
|
265
343
|
const q = card.kind === "question" ? ws?.questions.find(x => x.id === card.questionId) ?? null : null;
|
|
266
344
|
const nth = sameWorkspace.indexOf(card.key);
|
|
267
345
|
const agentName = s.agent ?? "the agent";
|
|
346
|
+
const noun = skipNoun(card);
|
|
268
347
|
|
|
269
348
|
const head = <View style={{ gap: 6 }}>
|
|
270
349
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 6 }}>
|
|
@@ -275,7 +354,16 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
275
354
|
{sameWorkspace.length > 1 ? ` · ${nth + 1} of ${sameWorkspace.length} here` : ""}
|
|
276
355
|
</Text>
|
|
277
356
|
</View>
|
|
278
|
-
|
|
357
|
+
{/* Skip workspace sits on the line of the workspace it skips, top right, the same place on phone and desktop (Tom,
|
|
358
|
+
beta.4: "maybe put the skip workspace button at the top right?"). Only while more than one card is left; the meta
|
|
359
|
+
line's "1 of 2 here" gives the count, and its accessible name says it. Negative margins keep its 44 px target
|
|
360
|
+
from pushing the title line apart. */}
|
|
361
|
+
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
362
|
+
<Text accessibilityRole="header" numberOfLines={2} style={[compact ? t.title : [t.title, { fontSize: 17, lineHeight: 23 }], { flex: 1 }]}>{s.title}{s.agent ? <Text style={{ color: c.foregroundMuted, fontWeight: "400" }}>{` › ${s.agent}`}</Text> : null}</Text>
|
|
363
|
+
{onSkipWorkspace && <View style={{ marginVertical: compact ? -10 : -6, marginRight: compact ? -14 : -11 }}>
|
|
364
|
+
<Tip label={`${skipWorkspaceHint(wsLeft)} (⇧J)`}><Button theme={theme} compact={compact} kind="ghost" icon="ChevronsRight" title="Skip workspace" accessibilityLabel={skipWorkspaceHint(wsLeft)} accessibilityHint={compact ? undefined : "Shift+J"} onPress={onSkipWorkspace} /></Tip>
|
|
365
|
+
</View>}
|
|
366
|
+
</View>
|
|
279
367
|
{ws && <SummaryLine key={ws.id} workspace={ws} theme={theme} compact={compact} />}
|
|
280
368
|
{full && <ReferencesLine workspace={full} theme={theme} compact={compact} />}
|
|
281
369
|
</View>;
|
|
@@ -290,7 +378,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
290
378
|
? <View style={{ gap: 8 }}>
|
|
291
379
|
<RichText plain style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{`${q.id} · ${q.title}`}</RichText>
|
|
292
380
|
<QuestionBody key={q.id} workspace={ws} question={q} theme={theme} compact={compact} inline={false}
|
|
293
|
-
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} />
|
|
381
|
+
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} onSendReady={setReady} />
|
|
294
382
|
</View>
|
|
295
383
|
: card.kind === "item" && card.item && full
|
|
296
384
|
? <View style={{ borderRadius: 10, borderWidth: 1, borderColor: withAlpha(c.statusWarning, 0.45), overflow: "hidden" }}>
|
|
@@ -306,44 +394,92 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
306
394
|
|
|
307
395
|
// Add context without answering: every card that isn't a question has the agent's reply box (a question has its note).
|
|
308
396
|
const reply = card.kind !== "question" && s.agentId && <NoteRow theme={theme} compact={compact} agentId={s.agentId} />;
|
|
309
|
-
const contextBlock = request && <ContextAnswer theme={theme} compact={compact} request={request} waiting={waiting} agent={agentName} openChat={openChat} />;
|
|
310
|
-
|
|
397
|
+
const contextBlock = request && <ContextAnswer theme={theme} compact={compact} request={request} waiting={waiting} agent={agentName} openChat={openChat} openAgent={navigation ? id => navigation.openAgent({ agentId: id }) : undefined} />;
|
|
398
|
+
// a-move-bar-action-opens-in-view (MOVE_OPENS): More context and Later open where the eye is, a sheet above the
|
|
399
|
+
// phone's bar or a popover on their button on desktop, never appended below the card.
|
|
400
|
+
const closeMore = () => { setMore(false); if (!compact) focusSoon("catch-up-more"); };
|
|
401
|
+
const moreBlock = more && <MorePanel theme={theme} compact={compact} onClose={closeMore} onAsk={onAsk} />;
|
|
311
402
|
const later = (until: string) => { setLaterOpen(false); if (s.agentId) void deps.sources.inbox.snooze([s.agentId], until); onLater(); };
|
|
312
|
-
const
|
|
313
|
-
|
|
403
|
+
const laterBlock = laterOpen && <View {...({ dataSet: { catchUpLater: "1" } } as object)} accessibilityRole="menu" accessibilityLabel="Later" style={{ gap: 8 }}>
|
|
404
|
+
<Text style={[t.small, { fontWeight: "600" }]}>Back in your Needs you</Text>
|
|
405
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", gap: 8 }}>
|
|
406
|
+
{laterChoices(new Date()).map(([k, label]) => <Button key={k} theme={theme} compact={compact} kind="ghost" icon="AlarmClock" title={label} onPress={() => later(snoozeUntil(k, new Date()))} />)}
|
|
407
|
+
</View>
|
|
314
408
|
</View>;
|
|
409
|
+
const toggleMore = () => { setLaterOpen(false); setMore(v => !v); };
|
|
410
|
+
const toggleLater = () => { setMore(false); setLaterOpen(v => !v); };
|
|
411
|
+
const popover = (open: ReactNode, label: string, width: number) => open && <MoveResult place="popover" theme={theme} label={label} width={width}>{open}</MoveResult>;
|
|
315
412
|
|
|
316
|
-
// The deck's moves: in thumb reach on phones, under the card on desktop.
|
|
317
|
-
//
|
|
318
|
-
|
|
413
|
+
// The deck's moves: in thumb reach on phones, under the card on desktop. Once the card has an answer to send, Send to
|
|
414
|
+
// agent takes the bar's primary slot: the question's own Send (onSendReady), so one click, one flow. Icon-only moves
|
|
415
|
+
// carry their name for screen readers and as a desktop tooltip.
|
|
416
|
+
const send = ready && (compact
|
|
417
|
+
? <View style={{ flex: 1 }}><Button theme={theme} compact grow kind="primary" icon="Send" title="Send" accessibilityLabel="Send to agent" shortcut disabled={ready.busy} onPress={ready.send} /></View>
|
|
418
|
+
: <Button theme={theme} kind="primary" icon="Send" title="Send to agent" shortcut disabled={ready.busy} onPress={ready.send} />);
|
|
419
|
+
const moves = <View {...({ dataSet: { catchUpCardMoves: "1" } } as object)} style={{ flexDirection: "row", alignItems: "center", gap: 8, paddingHorizontal: compact ? 12 : 0, paddingTop: compact ? 10 : 4 }}>
|
|
319
420
|
<IconButton theme={theme} compact={compact} icon="ChevronLeft" label={compact ? "Back" : "Back (K or ←)"} tooltip={!compact} disabled={!onBack} onPress={() => onBack?.()} />
|
|
320
|
-
{compact ? <
|
|
321
|
-
: <Tip label="More context (M)"><Button theme={theme} icon="Sparkles" title="More context" accessibilityHint="M" onPress={
|
|
322
|
-
<IconButton theme={theme} compact={compact} icon="AlarmClock" label={compact ? "Later" : "Later (L)"} tooltip={!compact} disabled={!s.agentId} onPress={
|
|
421
|
+
{compact ? <IconButton theme={theme} compact icon="Sparkles" label="More context" onPress={toggleMore} />
|
|
422
|
+
: <View>{popover(moreBlock, "More context", 560)}<Tip label="More context (M)"><Button theme={theme} icon="Sparkles" title="More context" accessibilityHint="M" nativeID="catch-up-more" onPress={toggleMore} /></Tip></View>}
|
|
423
|
+
<View>{!compact && popover(laterBlock, "Later", 380)}<IconButton theme={theme} compact={compact} icon="AlarmClock" label={compact ? "Later" : "Later (L)"} tooltip={!compact} disabled={!s.agentId} onPress={toggleLater} /></View>
|
|
323
424
|
<IconButton theme={theme} compact={compact} icon="MessageSquare" label={compact ? "Open chat" : "Open chat (O)"} tooltip={!compact} disabled={!navigation} onPress={openChat} />
|
|
324
425
|
{!compact && <View style={{ flex: 1 }} />}
|
|
325
|
-
{
|
|
326
|
-
|
|
426
|
+
{/* Two skips, named apart: this card (J), and the whole workspace (⇧J), shown only while it has more than one card left. */}
|
|
427
|
+
{compact ? ready ? <IconButton theme={theme} compact icon="ArrowRight" label={skipCardHint(noun)} onPress={onSkip} />
|
|
428
|
+
: <View style={{ flex: 1 }}><Button theme={theme} compact grow icon="ArrowRight" title={`Skip ${noun}`} accessibilityLabel={skipCardHint(noun)} onPress={onSkip} /></View>
|
|
429
|
+
: <>
|
|
430
|
+
<Tip label={`${skipCardHint(noun)} (J or →)`}><Button theme={theme} icon="ArrowRight" title={`Skip ${noun}`} accessibilityLabel={skipCardHint(noun)} accessibilityHint="J" onPress={onSkip} /></Tip>
|
|
431
|
+
</>}
|
|
432
|
+
{send}
|
|
327
433
|
</View>;
|
|
328
434
|
|
|
329
435
|
// a-focused-field-and-its-send-stay-in-view: the phone's bar is DockedPane's dock, so while a field has focus or the
|
|
330
|
-
// keyboard is up the bar steps aside and the field (Something else, a note
|
|
436
|
+
// keyboard is up the bar steps aside and the field (Something else, a note) keeps its Send in view. An open sheet
|
|
437
|
+
// stays (the pane stops above the keyboard), so More context's ask box and its Ask buttons stay in view too.
|
|
438
|
+
const sheet = compact && (moreBlock || laterBlock);
|
|
331
439
|
return <DockedPane compact={compact}
|
|
332
440
|
contentContainerStyle={{ padding: compact ? 16 : 28, gap: compact ? 16 : 18, ...(compact ? {} : { maxWidth: 720, width: "100%", alignSelf: "center" }) }}
|
|
333
|
-
dock={({ yields }) => compact && !yields && <View style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
|
|
441
|
+
dock={({ yields, typingInContent }) => compact && (sheet && !typingInContent || !yields) && <View style={[{ borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface0 }, bottomInset(compact)]}>
|
|
442
|
+
{sheet && !typingInContent && <MoveResult place="sheet" theme={theme} label={moreBlock ? "More context" : "Later"}>{sheet}</MoveResult>}
|
|
443
|
+
{!yields && moves}
|
|
444
|
+
</View>}>
|
|
334
445
|
{goneBanner}
|
|
335
446
|
{head}
|
|
336
447
|
{contextBlock}
|
|
337
448
|
<View {...CARD_MARK} style={{ gap: 16 }}>{askBlock}</View>
|
|
338
449
|
{reply}
|
|
339
|
-
{
|
|
340
|
-
{!compact &&
|
|
341
|
-
{!compact && moves}
|
|
450
|
+
{/* Desktop: ⌘↵ anywhere on the bar sends, as the bar's Send says (its own SubmitScope). */}
|
|
451
|
+
{!compact && <SubmitScope enabled={!!ready && !ready.busy} onSubmit={() => ready?.send()}>{moves}</SubmitScope>}
|
|
342
452
|
</DockedPane>;
|
|
343
453
|
}
|
|
344
454
|
|
|
455
|
+
/**
|
|
456
|
+
* Where a move's result opens (MOVE_OPENS, a-move-bar-action-opens-in-view): a sheet in the phone's dock or a popover
|
|
457
|
+
* on its desktop button. Focus moves into it (its first choice), and on the web it scrolls into view the least distance.
|
|
458
|
+
*/
|
|
459
|
+
export function MoveResult({ place, theme, label, width, children }: { place: "sheet" | "popover"; theme: Theme; label: string; width?: number; children: ReactNode }) {
|
|
460
|
+
const c = theme.colors;
|
|
461
|
+
const ref = useRef<View>(null);
|
|
462
|
+
useEffect(() => {
|
|
463
|
+
if (Platform.OS !== "web") return;
|
|
464
|
+
const t = setTimeout(() => {
|
|
465
|
+
const node = ref.current as unknown as { querySelector?(q: string): { focus?(o?: object): void } | null; scrollIntoView?(o: object): void } | null;
|
|
466
|
+
node?.scrollIntoView?.({ block: "nearest" });
|
|
467
|
+
// The first choice: More context's suggestions ("I don't get it" leads), else Later's first time.
|
|
468
|
+
(node?.querySelector?.('[role="radio"]') ?? node?.querySelector?.('[role="menu"] [role="button"]'))?.focus?.({ preventScroll: true });
|
|
469
|
+
}, 0);
|
|
470
|
+
return () => clearTimeout(t);
|
|
471
|
+
}, []);
|
|
472
|
+
return <View ref={ref} {...({ dataSet: { moveResult: place } } as object)} role="dialog" accessibilityLabel={label}
|
|
473
|
+
style={[{ padding: place === "sheet" ? 14 : 16, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 },
|
|
474
|
+
place === "sheet"
|
|
475
|
+
? { marginHorizontal: 12, marginTop: 12 }
|
|
476
|
+
: { position: "absolute", zIndex: 20, left: 0, bottom: "100%", marginBottom: 8, width, shadowColor: "#000", shadowOpacity: 0.22, shadowRadius: 16, shadowOffset: { width: 0, height: 6 } }]}>
|
|
477
|
+
{children}
|
|
478
|
+
</View>;
|
|
479
|
+
}
|
|
480
|
+
|
|
345
481
|
/** What came back for this card: the answer, "answered in its chat", a failure, or (seen going Back) that it's still asking. */
|
|
346
|
-
function ContextAnswer({ theme, compact, request, waiting, agent, openChat }: { theme: Theme; compact: boolean; request: ContextRequest; waiting: boolean; agent: string; openChat: () => void }) {
|
|
482
|
+
export function ContextAnswer({ theme, compact, request, waiting, agent, openChat, openAgent }: { theme: Theme; compact: boolean; request: ContextRequest; waiting: boolean; agent: string; openChat: () => void; openAgent?: (agentId: string) => void }) {
|
|
347
483
|
const c = theme.colors; const t = text(c, compact);
|
|
348
484
|
const who = request.target === "overseer" ? "Overseer" : agent === "the agent" ? "The agent" : agent;
|
|
349
485
|
const asking = request.state === "asking";
|
|
@@ -354,8 +490,11 @@ function ContextAnswer({ theme, compact, request, waiting, agent, openChat }: {
|
|
|
354
490
|
</View>
|
|
355
491
|
{request.state === "answered" && request.answer && <RichText selectable style={t.body}>{request.answer}</RichText>}
|
|
356
492
|
{request.state === "chat" && <View style={{ gap: 8 }}>
|
|
357
|
-
<Text style={t.body}>{`${who} answered in its chat.`}</Text>
|
|
358
|
-
|
|
493
|
+
<Text style={t.body}>{who === "Overseer" ? "The Overseer answered in its own chat, not here: it can't reply on a card." : `${who} answered in its chat.`}</Text>
|
|
494
|
+
{/* A 2.2.0-beta.3 ask of the Overseer: its answer is in the Overseer's chat (an-ask-goes-only-to-an-agent-that-can-answer-it). */}
|
|
495
|
+
<View style={{ flexDirection: "row" }}>{who === "Overseer"
|
|
496
|
+
? <Button theme={theme} compact={compact} icon="MessageSquare" title="Open Overseer" disabled={!request.askedOf || !openAgent} onPress={() => request.askedOf && openAgent?.(request.askedOf)} />
|
|
497
|
+
: <Button theme={theme} compact={compact} icon="MessageSquare" title="Open chat" onPress={openChat} />}</View>
|
|
359
498
|
</View>}
|
|
360
499
|
{request.state === "failed" && <Text style={t.body}>{request.error ?? "The ask didn't go through. Try again, or open the chat."}</Text>}
|
|
361
500
|
</View>;
|
|
@@ -378,24 +517,23 @@ function BriefAsk({ s, theme, compact, deps }: { s: DeckCard["s"]; theme: Theme;
|
|
|
378
517
|
}
|
|
379
518
|
|
|
380
519
|
/**
|
|
381
|
-
* More context: "I don't get it" first (most asks just need explaining), then the developer's own words
|
|
382
|
-
*
|
|
383
|
-
* developer asked.
|
|
520
|
+
* More context: "I don't get it" first (most asks just need explaining), then the developer's own words, to one place:
|
|
521
|
+
* the card's workspace's main agent, the one that can answer on the card (an-ask-goes-only-to-an-agent-that-can-answer-
|
|
522
|
+
* it). It may wake, because the developer asked. The deck moves on and this workspace comes back when the answer is ready.
|
|
384
523
|
*/
|
|
385
|
-
function MorePanel({ theme, compact,
|
|
524
|
+
export function MorePanel({ theme, compact, onClose, onAsk }: { theme: Theme; compact: boolean; onClose: () => void; onAsk: (words: string) => Promise<void> }) {
|
|
386
525
|
const c = theme.colors; const t = text(c, compact);
|
|
387
526
|
const [words, setWords] = useState<string>(CONTEXT_ASKS[0].text);
|
|
388
527
|
const [picked, setPicked] = useState<string>(CONTEXT_ASKS[0].id);
|
|
389
|
-
const [busy, setBusy] = useState
|
|
528
|
+
const [busy, setBusy] = useState(false);
|
|
390
529
|
const [error, setError] = useState<string | null>(null);
|
|
391
|
-
const send = (
|
|
530
|
+
const send = () => {
|
|
392
531
|
if (!words.trim() || busy) return;
|
|
393
|
-
setBusy(
|
|
532
|
+
setBusy(true); setError(null);
|
|
394
533
|
// The words stay unless the ask is recorded.
|
|
395
|
-
onAsk(
|
|
534
|
+
onAsk(words.trim()).catch(e => setError(errorText(e))).finally(() => setBusy(false));
|
|
396
535
|
};
|
|
397
|
-
|
|
398
|
-
return <View {...({ dataSet: { catchUpMore: "1" } } as object)} style={{ gap: 10, padding: compact ? 14 : 16, borderRadius: 12, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1 }}>
|
|
536
|
+
return <View {...({ dataSet: { catchUpMore: "1" } } as object)} style={{ gap: 10 }}>
|
|
399
537
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
400
538
|
<Icon name="Sparkles" size={14} color={c.foreground} />
|
|
401
539
|
<Text style={[t.label, { flex: 1, fontWeight: "600" }]}>More context</Text>
|
|
@@ -410,20 +548,18 @@ function MorePanel({ theme, compact, agent, hasAgent, overseerOn, onClose, onAsk
|
|
|
410
548
|
<View {...PRIMARY_FORM} style={{ gap: 10 }}>
|
|
411
549
|
<TextInput accessibilityLabel="What do you want to know?" placeholder="What do you want to know?" placeholderTextColor={c.foregroundMuted} value={words} multiline
|
|
412
550
|
onChangeText={v => { setWords(v); setPicked(CONTEXT_ASKS.find(x => x.text === v)?.id ?? ""); }}
|
|
413
|
-
style={{ minHeight: compact ?
|
|
551
|
+
style={{ minHeight: compact ? 84 : 56, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, backgroundColor: c.surface0 }} />
|
|
414
552
|
{!!error && <Text accessibilityRole="alert" style={[t.meta, { color: c.statusDanger }]}>{error}</Text>}
|
|
415
|
-
<View
|
|
416
|
-
|
|
417
|
-
accessibilityHint={compact ? "
|
|
418
|
-
{hasAgent && <View {...({ dataSet: { askAgent: "1" } } as object)} style={compact ? { flexGrow: 1 } : null}><Button theme={theme} compact={compact} grow={compact} kind={overseerOn ? "secondary" : "primary"} icon="MessageSquareText" title={agentLabel} loading={busy === "agent"} disabled={!words.trim() || !!busy}
|
|
419
|
-
accessibilityHint={compact ? "Sends it to the agent, which may wake it" : `Sends it to the agent, which may wake it. ${keyLabel("⌘⇧↵", isMac())}`} onPress={() => send("agent")} /></View>}
|
|
553
|
+
<View {...({ dataSet: { askAgent: "1" } } as object)} style={{ flexDirection: "row" }}>
|
|
554
|
+
<Button theme={theme} compact={compact} grow={compact} kind="primary" icon="MessageSquareText" title="Ask the agent" loading={busy} disabled={!words.trim() || busy}
|
|
555
|
+
accessibilityHint={compact ? "Asks this workspace's main agent, which may wake it" : `Asks this workspace's main agent, which may wake it. ${keyLabel("⌘↵", isMac())}`} onPress={send} />
|
|
420
556
|
</View>
|
|
421
557
|
</View>
|
|
422
558
|
<Text style={t.small}>This workspace steps aside while you keep going, and comes back as your next card with the answer. Back reaches it any time.</Text>
|
|
423
559
|
</View>;
|
|
424
560
|
}
|
|
425
561
|
|
|
426
|
-
function Finished({ theme, compact, stats, empty, onHome, onSkipped }: { theme: Theme; compact: boolean; stats: ReturnType<typeof statsOf>; empty: boolean; onHome: () => void; onSkipped: () => void }) {
|
|
562
|
+
export function Finished({ theme, compact, stats, empty, onHome, onSkipped }: { theme: Theme; compact: boolean; stats: ReturnType<typeof statsOf>; empty: boolean; onHome: () => void; onSkipped: () => void }) {
|
|
427
563
|
const c = theme.colors; const t = text(c, compact);
|
|
428
564
|
// "All caught up" only when it is true: a skipped or waiting card means the developer is not, so the end says so.
|
|
429
565
|
const caughtUp = !stats.skipped && !stats.waiting;
|
|
@@ -455,7 +591,7 @@ export function KeysSheet({ theme, onClose }: { theme: Theme; onClose: () => voi
|
|
|
455
591
|
const section = (title: string, keys: readonly typeof CATCH_UP_KEYS[number][]) => <View style={{ gap: 6 }}>
|
|
456
592
|
<Text style={[t.small, { fontWeight: "600" }]}>{title}</Text>{keys.map(row)}
|
|
457
593
|
</View>;
|
|
458
|
-
return <View
|
|
594
|
+
return <View role="dialog" accessibilityLabel="Catch up keys" style={{ position: "absolute", zIndex: 10, right: 20, top: 8, width: 300, padding: 16, gap: 12, borderRadius: 10, borderWidth: 1, borderColor: c.border, backgroundColor: c.surface1, shadowColor: "#000", shadowOpacity: 0.25, shadowRadius: 12 }}>
|
|
459
595
|
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
460
596
|
<Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
|
|
461
597
|
<IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
|
package/client/follow-up-icon.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import type { PluginSvgIcon } from "@getpaseo/plugin/client";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Follow-up's own mark: a
|
|
4
|
+
* Follow-up's own mark: a cursive l that runs on from a start ring to a filled dot (the work, followed until it's done).
|
|
5
5
|
* One 24-unit glyph in `currentColor`, so the host `Icon` colours it with the theme. It is the brand icon on every
|
|
6
6
|
* surface that stands for Follow-up itself (sidebar row, header button, panel tab, Settings, the open command, the
|
|
7
7
|
* large view's empty state). Pull requests keep lucide GitPullRequest. assets/icon.svg is the same mark on the app tile.
|
|
8
8
|
* tests/follow-up-icon.test.ts checks it with the SDK's validator and that no brand surface falls back to GitPullRequest.
|
|
9
9
|
*/
|
|
10
10
|
export const FOLLOW_UP_ICON: PluginSvgIcon = {
|
|
11
|
-
svg: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="
|
|
11
|
+
svg: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.95 19.21C7.25 19.11 8.19 18.91 8.75 18.59C9.3 18.27 9.7 18 10.29 17.29C10.89 16.58 11.8 15.23 12.34 14.32C12.87 13.41 13.14 12.75 13.51 11.84C13.88 10.93 14.29 9.96 14.57 8.87C14.84 7.78 15.17 6.23 15.18 5.28C15.2 4.33 14.88 3.61 14.63 3.18C14.38 2.74 14.04 2.66 13.7 2.68C13.36 2.7 12.92 2.85 12.58 3.3C12.25 3.75 11.93 4.48 11.72 5.4C11.5 6.33 11.32 7.8 11.29 8.87C11.25 9.94 11.36 10.93 11.53 11.84C11.71 12.75 11.97 13.58 12.34 14.32C12.71 15.06 13.23 15.8 13.76 16.3C14.29 16.79 14.98 17.03 15.49 17.29C16.01 17.55 16.63 17.75 16.86 17.85" fill="none" stroke="currentColor" stroke-width="1.42" stroke-linecap="round" stroke-linejoin="round"/><circle cx="4.85" cy="19.15" r="2.14" fill="none" stroke="currentColor" stroke-width="1.42"/><circle cx="20.01" cy="18.03" r="1.92" fill="currentColor"/></svg>`,
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
/** Where the end dot sits, as a fraction of the icon box: the header button's Needs-you badge covers it. */
|
|
15
|
-
export const FOLLOW_UP_DOT = { x:
|
|
15
|
+
export const FOLLOW_UP_DOT = { x: 20.01 / 24, y: 18.03 / 24 };
|
|
16
16
|
|
|
17
17
|
/** The header button's Needs-you dot, in px. */
|
|
18
18
|
export const NEED_DOT = 7;
|
package/client/questions.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The question dialog and its answer form. The layout of options with a recommendation, the
|
|
2
2
|
// "what the agent does meanwhile" line and Copy are adapted from Progress
|
|
3
3
|
// (@stevecastaneda/paseo-progress, MIT, © 2026 Steve Castaneda); see THIRD_PARTY_NOTICES.md.
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
4
|
+
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
import { View } from "react-native";
|
|
6
6
|
import { Pressable, Text, copyable } from "./text";
|
|
7
7
|
import { openExternalUrl, useRpc } from "@getpaseo/plugin/client";
|
|
@@ -92,18 +92,26 @@ export function OptionCard({ theme, letter, label, consequence, recommended, sel
|
|
|
92
92
|
|
|
93
93
|
const inputStyle = (c: Colors, compact: boolean, lines: number) => ({ minHeight: compact ? 44 : 18 * lines + 16, paddingHorizontal: 10, paddingVertical: 8, borderRadius: 6, borderWidth: 1, borderColor: c.border, color: c.foreground, backgroundColor: c.surface1, fontSize: 13, lineHeight: 18, textAlignVertical: "top" as const });
|
|
94
94
|
|
|
95
|
+
/** A sendable answer, handed to a surface that also offers Send outside the form (Catch up's move bar). */
|
|
96
|
+
export type SendReady = { send: () => void; busy: boolean };
|
|
97
|
+
|
|
95
98
|
/**
|
|
96
99
|
* One question with its answer form. Send records the answer and messages the asking agent straight
|
|
97
100
|
* away; Copy records it and puts a reply on the clipboard instead. The one answer flow every question surface draws
|
|
98
101
|
* (the dialog, Needs you on Home and in the panel, the pill, phones): what its field means comes from answerDraft
|
|
99
102
|
* (`one-answer-flow-for-every-question`), never from the surface.
|
|
100
103
|
*/
|
|
101
|
-
export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false }: {
|
|
104
|
+
export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false, onSendReady }: {
|
|
102
105
|
workspace: ListWorkspace; question: ListQuestion; theme: Theme; compact: boolean; now?: number; dense?: boolean; bodyMaxHeight?: number; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: () => void;
|
|
103
106
|
/** Inside the Needs you block: its header says the title and when it was asked, its footer what the agent does meanwhile. */
|
|
104
107
|
inline?: boolean;
|
|
105
108
|
/** The dialog's close: Send and Copy close it at once and report the outcome as a toast. */
|
|
106
109
|
onClose?: () => void;
|
|
110
|
+
/**
|
|
111
|
+
* Catch up's move bar: told whenever this answer becomes sendable (or stops being), with this form's own Send, so a
|
|
112
|
+
* Send outside the card runs exactly this flow (`one-answer-flow-for-every-question`), never a copy of it.
|
|
113
|
+
*/
|
|
114
|
+
onSendReady?: (send: SendReady | null) => void;
|
|
107
115
|
}) {
|
|
108
116
|
const c = theme.colors; const t = text(c);
|
|
109
117
|
const toast = useToast(); const cache = useQueryClient();
|
|
@@ -189,6 +197,11 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
189
197
|
});
|
|
190
198
|
onClose?.(); onAnswered?.();
|
|
191
199
|
};
|
|
200
|
+
// The footer's Send calls the latest quick through a ref, so it never sends a stale choice or words.
|
|
201
|
+
const quickRef = useRef(quick); quickRef.current = quick;
|
|
202
|
+
const sendable = open && !!answer;
|
|
203
|
+
useEffect(() => { onSendReady?.(sendable ? { send: () => quickRef.current("send"), busy: run.isPending } : null); }, [sendable, run.isPending]);
|
|
204
|
+
useEffect(() => () => onSendReady?.(null), []);
|
|
192
205
|
// The body says Not sent · Retry itself, with the button; the state line stays on what the agent is doing.
|
|
193
206
|
const state = meanwhile(w, q, null);
|
|
194
207
|
const delivery = deliveryLine(w, q, now);
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/index.server.ts
CHANGED
|
@@ -14,8 +14,8 @@ import { agentSetSpec, developerSetSpec } from "./server/spec";
|
|
|
14
14
|
import type { PluginServerContext, PluginHandlerContext, PluginHookContext, PluginSessionOpenRequest } from "@getpaseo/plugin/server";
|
|
15
15
|
import type { PluginRpcContract, PluginSubscriptionContract } from "@getpaseo/plugin";
|
|
16
16
|
import { ValueFeed, WorkspacesFeed } from "./server/feeds";
|
|
17
|
-
import { ContextRequests } from "./server/context-requests";
|
|
18
|
-
import { agentContextPrompt, deckCards
|
|
17
|
+
import { ContextRequests, contextRecipient } from "./server/context-requests";
|
|
18
|
+
import { agentContextPrompt, deckCards } from "./shared/catch-up";
|
|
19
19
|
import { buildHome } from "./shared/home";
|
|
20
20
|
import { needsYou } from "./shared/attention";
|
|
21
21
|
import type { SortMode } from "./shared/sort";
|
|
@@ -490,7 +490,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
490
490
|
const rows = await gateway.directory.read().catch(() => null);
|
|
491
491
|
const status = new Map((rows?.agents ?? []).map(({ agent }) => [agent.id, agent.status]));
|
|
492
492
|
await contextRequests.reconcile(r => {
|
|
493
|
-
const item =
|
|
493
|
+
const item = queue.get(`message:${r.askedOf}:${r.id}`);
|
|
494
494
|
return { sent: item?.state === "sent" ? item.settledAt ?? null : null, failed: item?.state === "cancelled" || item?.state === "failed" && item.gone ? item.reason ?? "The ask couldn't reach the agent." : null,
|
|
495
495
|
idle: rows ? status.get(r.askedOf!) !== "running" : false };
|
|
496
496
|
});
|
|
@@ -953,31 +953,19 @@ export default function contribute(server: PluginServerContext) {
|
|
|
953
953
|
handle(rpc.overseerStatusRpc, async () => { await requireReady(); return overseerStatus(); });
|
|
954
954
|
handle(rpc.overseerStartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.start(paseo as unknown as OverseerPaseo); return overseerStatus(); });
|
|
955
955
|
handle(rpc.overseerAskRpc, async ({ text }, { paseo }) => { await requireReady(); seen(paseo); await overseer!.ask(paseo as unknown as OverseerPaseo, text); return overseerStatus(); });
|
|
956
|
-
// Catch up's More context: the ask is recorded and answered at once
|
|
957
|
-
//
|
|
958
|
-
// it: the developer asked, the one exception to never-wake (invariant 1).
|
|
956
|
+
// Catch up's More context: the ask is recorded and answered at once, and goes through the message queue (invariant
|
|
957
|
+
// 36) to the card's workspace's main agent, the only role with context_reply (an-ask-goes-only-to-an-agent-that-can-
|
|
958
|
+
// answer-it). Asking may wake it: the developer asked, the one exception to never-wake (invariant 1).
|
|
959
959
|
handle(rpc.contextAskRpc, async (input, context) => {
|
|
960
960
|
await requireReady();
|
|
961
961
|
const actor = actorOf(context);
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
else {
|
|
970
|
-
const paseo = (context as { paseo?: unknown }).paseo;
|
|
971
|
-
void (async () => {
|
|
972
|
-
try {
|
|
973
|
-
const workspace = input.workspaceId ? (await gateway.directory.read().catch(() => null))?.workspaces.find(w => w.id === input.workspaceId)?.name ?? "a workspace" : "a workspace";
|
|
974
|
-
if (!await overseerOn()) throw new Error("The Overseer is off. Turn it on in Settings → Agents, or ask the agent.");
|
|
975
|
-
const s = await overseer!.ask(paseo as unknown as OverseerPaseo, overseerContextPrompt(r, workspace));
|
|
976
|
-
if (s.agentId) { await contextRequests.setAskedOf(r.id, s.agentId); await contextRequests.delivered(r.id, new Date().toISOString()); }
|
|
977
|
-
} catch (error) { await contextRequests.fail(r.id, error instanceof Error ? error.message : String(error)); }
|
|
978
|
-
})();
|
|
979
|
-
}
|
|
980
|
-
return out;
|
|
962
|
+
// The worker's own snapshot, never a daemon read (an-ack-never-waits).
|
|
963
|
+
const w = input.workspaceId ? (await store.snapshot()).workspaces.find(x => x.id === input.workspaceId) : undefined;
|
|
964
|
+
const to = contextRecipient(w, actor.kind === "agent" ? actor.agentId : null);
|
|
965
|
+
if ("error" in to) throw new Error(to.error);
|
|
966
|
+
const out = await contextRequests.ask({ ...input, target: "agent" }, actorBy(actor), to.agentId);
|
|
967
|
+
if (out.fresh) enqueueMessage(to.agentId, agentContextPrompt(out.request), out.request.id, actorBy(actor));
|
|
968
|
+
return input.target === "overseer" ? { ...out, note: "More context always asks the card's own main agent, which can answer on the card; the Overseer can't, so target is ignored." } : out;
|
|
981
969
|
});
|
|
982
970
|
// Built when read (a-derived-view-is-built-when-read), from state the worker holds: no daemon request but the
|
|
983
971
|
// directory's cached workspace list.
|
|
@@ -997,9 +985,6 @@ export default function contribute(server: PluginServerContext) {
|
|
|
997
985
|
handle(rpc.contextListRpc, async ({ workspaceId }) => ({ requests: await contextRequests.list(workspaceId ? { workspaceId } : {}) }));
|
|
998
986
|
handle(rpc.contextReplyRpc, async ({ agentId, requestId, text }) => {
|
|
999
987
|
await requireReady();
|
|
1000
|
-
const r = (await contextRequests.list()).find(x => x.id === requestId);
|
|
1001
|
-
// The Overseer may have been (re)started by the ask itself, so its id is checked now, not when it was asked.
|
|
1002
|
-
if (r?.target === "overseer" && r.askedOf !== agentId && (await overseerStatus().catch(() => null))?.agentId === agentId) await contextRequests.setAskedOf(r.id, agentId);
|
|
1003
988
|
await contextRequests.reply(requestId, agentId, text);
|
|
1004
989
|
return { ok: true };
|
|
1005
990
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.2.0-beta.
|
|
4
|
+
"version": "2.2.0-beta.5",
|
|
5
5
|
"description": "A Paseo plugin that follows every workspace until the work is done: one Home for what needs you, questions you answer anywhere, and repairs that send themselves.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@types/react": "~19.2.0",
|
|
54
54
|
"react": "19.1.0",
|
|
55
55
|
"react-native": "0.81.5",
|
|
56
|
+
"react-test-renderer": "19.1.0",
|
|
56
57
|
"tsx": "^4.20.0",
|
|
57
58
|
"typescript": "^5.9.3",
|
|
58
59
|
"zod": "^4.4.3"
|
package/server/agent-parity.ts
CHANGED
|
@@ -75,8 +75,9 @@ export const RPC_TOOLS: readonly RpcTool[] = [
|
|
|
75
75
|
{ name: "ask_context", rpc: "follow.context-ask", kind: "planned", before: { rpc: "follow.context-list", input: a => ({ workspaceId: a.workspaceId ?? undefined }) },
|
|
76
76
|
input: z.strictObject({ workspaceId: id.nullable().optional(), agentId: id.nullable().optional(), cardKey: z.string().min(1).max(400).optional(), card: z.string().trim().min(1).max(300).optional(),
|
|
77
77
|
target: z.enum(["overseer", "agent"]).optional(), ask: z.string().trim().min(1).max(2000).optional(), ...confirm }),
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
// target is accepted and ignored: the server sends every ask to the card's workspace main agent, and refuses an
|
|
79
|
+
// agent asking itself (an-ask-goes-only-to-an-agent-that-can-answer-it).
|
|
80
|
+
toRpc: a => ({ workspaceId: a.workspaceId ?? null, agentId: a.agentId ?? null, cardKey: a.cardKey, card: a.card, target: a.target, ask: a.ask }) },
|
|
80
81
|
// Needs-you: the brief card and the inbox's other actions
|
|
81
82
|
// The message queue: what waits to go to agents, and Retry or Cancel on one item (a card's Retry, Needs you's message row).
|
|
82
83
|
{ name: "queue_list", rpc: "follow.queue-list", kind: "read", input: z.strictObject({ workspaceId: id.optional(), agentId: id.optional() }) },
|
|
@@ -216,6 +217,6 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
|
|
|
216
217
|
* note says where an agent finds what the developer found.
|
|
217
218
|
*/
|
|
218
219
|
export const VIEW_PARITY: Record<string, { tools: readonly string[]; note: string }> = {
|
|
219
|
-
"catch-up": { tools: ["catch_up_deck", "answer_question", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Back) changes only the developer's view. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
|
|
220
|
+
"catch-up": { tools: ["catch_up_deck", "answer_question", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Skip workspace, Back, the phone's drag) changes only the developer's view, so it has no server state and no tool. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
|
|
220
221
|
"section-search": { tools: ["workspace_status", "list_prs"], note: "The panel's Pull requests, Tasks and Activity search filters lists an agent already reads whole: workspace_status returns the workspace's PRs (title, branch, failed checks), tasks with their evidence, questions with their answers, and the sends, merges and PR actions the timeline is drawn from; list_prs returns every tracked PR with its checks." },
|
|
221
222
|
};
|
|
@@ -8,9 +8,22 @@ export const CONTEXT_FILE = "context.json";
|
|
|
8
8
|
|
|
9
9
|
export type AskInput = { workspaceId: string | null; agentId: string | null; cardKey: string; card: string; target: ContextTarget; ask: string };
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* an-ask-goes-only-to-an-agent-that-can-answer-it: who a More context ask goes to. Always the card's workspace's main
|
|
13
|
+
* agent (CONTEXT_REPLY_ROLE), the only role that has context_reply, whoever is named on the card: a contributor's
|
|
14
|
+
* question, or a recovery agent's, is still the workstream's, and its main agent answers. A workspace Follow-up doesn't
|
|
15
|
+
* track has no main agent, so nothing there could answer on the card, and the ask is refused with a way on. A main
|
|
16
|
+
* agent that was closed is still asked: the queue resumes it, or fails the ask if it is gone, and the card comes back.
|
|
17
|
+
*/
|
|
18
|
+
export function contextRecipient(workspace: { enable_tracking: boolean; mainAgentId: string } | undefined, caller: string | null): { agentId: string } | { error: string } {
|
|
19
|
+
if (!workspace?.enable_tracking || !workspace.mainAgentId) return { error: "Follow-up doesn't track this card's workspace, so no agent can answer on the card. Open its chat to ask there." };
|
|
20
|
+
if (caller && workspace.mainAgentId === caller) return { error: "ask_context asks another agent about its card for the developer; explain your own ask in your reply." };
|
|
21
|
+
return { agentId: workspace.mainAgentId };
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
/**
|
|
12
25
|
* Catch up's More context requests (docs/needs-you.md#catch-up): what the developer asked about a card, who answers
|
|
13
|
-
* (the
|
|
26
|
+
* (the card's workspace's main agent), and the answer once `context_reply` brings it. The value lives in memory and
|
|
14
27
|
* saves behind the reply (an-ack-never-waits-on-the-disk); a change calls `onChange`, which pushes Home's feed, so the
|
|
15
28
|
* client learns an answer arrived without polling. Small by construction: at most CONTEXT_MAX requests, none older
|
|
16
29
|
* than CONTEXT_KEEP_MS.
|
|
@@ -29,7 +42,13 @@ export class ContextRequests {
|
|
|
29
42
|
let value: ContextFile;
|
|
30
43
|
try { value = contextFileSchema.parse(JSON.parse(await readFile(join(this.directory, CONTEXT_FILE), "utf8"))); }
|
|
31
44
|
catch { value = { requests: [] }; } // Lost context requests cost a re-ask, never a broken Home.
|
|
32
|
-
this.value
|
|
45
|
+
if (this.value) return this.value;
|
|
46
|
+
// 2.2.0-beta.3 could ask the Overseer, which has no context_reply: an ask of it still open never ends on its own.
|
|
47
|
+
// Its answer, if any, is in the Overseer's chat (an-ask-goes-only-to-an-agent-that-can-answer-it).
|
|
48
|
+
const at = new Date(this.now()).toISOString();
|
|
49
|
+
const stuck = value.requests.some(r => r.target === "overseer" && r.state === "asking");
|
|
50
|
+
this.value = stuck ? { requests: value.requests.map(r => r.target === "overseer" && r.state === "asking" ? { ...r, state: "chat" as const, settledAt: at } : r) } : value;
|
|
51
|
+
if (stuck) this.persist.set(this.value);
|
|
33
52
|
return this.value;
|
|
34
53
|
}
|
|
35
54
|
private save(requests: ContextRequest[]): void {
|
|
@@ -67,11 +86,6 @@ export class ContextRequests {
|
|
|
67
86
|
return next;
|
|
68
87
|
}
|
|
69
88
|
|
|
70
|
-
/** Who replies is learnt after the send (the Overseer's id). */
|
|
71
|
-
setAskedOf(id: string, askedOf: string): Promise<ContextRequest | null> {
|
|
72
|
-
return this.update(id, r => r.askedOf === askedOf ? r : { ...r, askedOf });
|
|
73
|
-
}
|
|
74
|
-
|
|
75
89
|
/**
|
|
76
90
|
* The asked agent's answer (context_reply). Only the agent it was asked of may answer it (ownership comes from the
|
|
77
91
|
* daemon, invariant 5); an answer to a settled request replaces it, so a corrected reply wins.
|
|
@@ -85,12 +99,12 @@ export class ContextRequests {
|
|
|
85
99
|
return (await this.update(id, x => ({ ...x, state: "answered", answer, error: null, settledAt: new Date(this.now()).toISOString() })))!;
|
|
86
100
|
}
|
|
87
101
|
|
|
88
|
-
/** The send failed for good (
|
|
102
|
+
/** The send failed for good (the agent is gone): the card comes back saying so. */
|
|
89
103
|
fail(id: string, error: string): Promise<ContextRequest | null> {
|
|
90
104
|
return this.update(id, r => r.state !== "asking" ? r : { ...r, state: "failed", error: error.slice(0, 500), settledAt: new Date(this.now()).toISOString() });
|
|
91
105
|
}
|
|
92
106
|
|
|
93
|
-
/** The ask reached its agent (the queue sent it
|
|
107
|
+
/** The ask reached its agent (the queue sent it). Earlier deliveries win: it is the first. */
|
|
94
108
|
delivered(id: string, at: string): Promise<ContextRequest | null> {
|
|
95
109
|
return this.update(id, r => r.state !== "asking" || r.deliveredAt ? r : { ...r, deliveredAt: at });
|
|
96
110
|
}
|
package/server/graphite.ts
CHANGED
|
@@ -14,10 +14,22 @@ export function mergeScheduling(status: unknown): Scheduling {
|
|
|
14
14
|
export class GraphiteWriteError extends Error {
|
|
15
15
|
constructor(message: string, readonly uncertain: boolean) { super(message); }
|
|
16
16
|
}
|
|
17
|
+
/** Shared by sign-in detection and API requests. Never surface config contents or parse errors. */
|
|
18
|
+
export async function graphiteAuthToken(environment: NodeJS.ProcessEnv = process.env): Promise<string | null> {
|
|
19
|
+
const home = environment.HOME ?? homedir();
|
|
20
|
+
const config = environment.XDG_CONFIG_HOME ?? join(home, ".config");
|
|
21
|
+
for (const path of [join(config, "graphite", "user_config"), join(config, "graphite", "auth"), join(home, ".graphite_user_config")]) {
|
|
22
|
+
try {
|
|
23
|
+
const authToken: unknown = JSON.parse(await readFile(path, "utf8"))?.authToken;
|
|
24
|
+
if (typeof authToken === "string" && authToken.length > 0) return authToken;
|
|
25
|
+
} catch { /* Missing, unreadable or invalid files don't prevent checking older locations. */ }
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
async function requestGraphite(route: "mergeability-status" | "merge", body: Record<string, unknown>): Promise<unknown> {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
if (typeof authToken !== "string" || !authToken) throw new GraphiteWriteError("Graphite authentication unavailable.", false);
|
|
31
|
+
const authToken = await graphiteAuthToken();
|
|
32
|
+
if (!authToken) throw new GraphiteWriteError("Graphite CLI authentication is unavailable.", false);
|
|
21
33
|
const controller = new AbortController();
|
|
22
34
|
const timeout = setTimeout(() => controller.abort(), 8_000);
|
|
23
35
|
try {
|
package/server/pr-workflow.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { access, constants, readFile, stat } from "node:fs/promises";
|
|
2
2
|
import { delimiter, isAbsolute, join, resolve } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
|
+
import { graphiteAuthToken } from "./graphite";
|
|
4
5
|
import { WriteBehind } from "./write-behind";
|
|
5
6
|
import { repoKey } from "../shared/reviewers";
|
|
6
7
|
import {
|
|
@@ -26,9 +27,7 @@ export const fsProbe = (environment: NodeJS.ProcessEnv = process.env): Probe =>
|
|
|
26
27
|
return false;
|
|
27
28
|
},
|
|
28
29
|
async signedIn() {
|
|
29
|
-
|
|
30
|
-
try { const { authToken } = JSON.parse(await readFile(join(config, "graphite", "auth"), "utf8")); return typeof authToken === "string" && authToken.length > 0; }
|
|
31
|
-
catch { return false; }
|
|
30
|
+
return (await graphiteAuthToken(environment)) !== null;
|
|
32
31
|
},
|
|
33
32
|
async initialised(path) {
|
|
34
33
|
const common = await gitCommonDir(path);
|
package/shared/catch-up.ts
CHANGED
|
@@ -60,7 +60,9 @@ export type SessionStats = { done: number; skipped: number; later: number; gone:
|
|
|
60
60
|
* A Catch up session. `order` is every card key seen this session (done ones stay, so Back works); `pos` is the card
|
|
61
61
|
* on screen, `order.length` once nothing is left. `parked` maps a workstream waiting for More context to its request.
|
|
62
62
|
*/
|
|
63
|
-
export type Session = { order: string[]; pos: number; outcomes: Record<string, Outcome>; parked: Record<string, string>; lapped?: boolean
|
|
63
|
+
export type Session = { order: string[]; pos: number; outcomes: Record<string, Outcome>; parked: Record<string, string>; lapped?: boolean;
|
|
64
|
+
/** Skip workspace jumped from `to` and landed on `from` (undefined: the finished screen): Back from there returns to `to`. */
|
|
65
|
+
back?: { to: string; from: string | undefined } };
|
|
64
66
|
|
|
65
67
|
export const startSession = (cards: readonly Pick<DeckCard, "key">[]): Session => ({ order: cards.map(c => c.key), pos: 0, outcomes: {}, parked: {} });
|
|
66
68
|
|
|
@@ -81,8 +83,65 @@ export function advance(s: Session, from: number): Pick<Session, "pos" | "lapped
|
|
|
81
83
|
}
|
|
82
84
|
export const nextPos = (s: Session, from: number): number => advance(s, from).pos;
|
|
83
85
|
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Back: the card before, whatever happened to it (done cards show what was sent; a parked one shows it is asking).
|
|
88
|
+
* Right after Skip workspace, Back returns to the card it was pressed on, not the last card of the skipped workspace.
|
|
89
|
+
*/
|
|
90
|
+
export function prevPos(s: Session): number {
|
|
91
|
+
if (s.back && s.order[s.pos] === s.back.from) { const i = s.order.indexOf(s.back.to); if (i >= 0) return i; }
|
|
92
|
+
return Math.max(0, Math.min(s.pos, s.order.length) - 1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The cards of the on-screen card's workspace still to act on, the current one included: Skip workspace shows only above one. */
|
|
96
|
+
export function openInWorkspace(s: Session, key = s.order[s.pos]): string[] {
|
|
97
|
+
if (key === undefined) return [];
|
|
98
|
+
const g = groupOf(key);
|
|
99
|
+
return s.order.filter(k => groupOf(k) === g && open(s, k));
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Skip workspace: every card of this workspace still to act on is skipped at once (each counts as one skipped card) and
|
|
104
|
+
* the deck moves to the next workspace. They come back on the second pass like any skipped card; on the second pass
|
|
105
|
+
* itself it moves past the rest of them.
|
|
106
|
+
*/
|
|
107
|
+
export function skipWorkspace(s: Session): Session {
|
|
108
|
+
const key = s.order[s.pos];
|
|
109
|
+
if (key === undefined) return s;
|
|
110
|
+
const g = groupOf(key);
|
|
111
|
+
const outcomes = { ...s.outcomes };
|
|
112
|
+
for (const k of openInWorkspace(s)) outcomes[k] = "skipped";
|
|
113
|
+
const next: Session = { ...s, outcomes };
|
|
114
|
+
let at = advance(next, s.pos);
|
|
115
|
+
while (at.pos < s.order.length && groupOf(s.order[at.pos]) === g) at = advance({ ...next, lapped: at.lapped }, at.pos);
|
|
116
|
+
return { ...next, ...at, back: { to: key, from: s.order[at.pos] } };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** Phone drag: which way a touch is going, decided once it has moved this far, so a vertical scroll stays a scroll. */
|
|
120
|
+
export const SWIPE_LOCK_PX = 8;
|
|
121
|
+
export function swipeLock(dx: number, dy: number): "x" | "y" | null {
|
|
122
|
+
if (Math.max(Math.abs(dx), Math.abs(dy)) < SWIPE_LOCK_PX) return null;
|
|
123
|
+
return Math.abs(dx) > 1.5 * Math.abs(dy) ? "x" : "y";
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* A released drag: past `SWIPE_COMMIT` of the card's width, or flung faster than `SWIPE_FLING` px/ms the same way, left
|
|
127
|
+
* skips the workspace and right goes Back (when there is a card to go back to); anything else springs back. Left is the
|
|
128
|
+
* workspace, not the card (Tom, 2.2.0-beta.4: "it makes more sense for the drag left to skip the whole workspace"); the
|
|
129
|
+
* bar's Skip stays the way to skip one card. With one card left in the workspace the two are the same.
|
|
130
|
+
*/
|
|
131
|
+
export const SWIPE_COMMIT = 0.35;
|
|
132
|
+
export const SWIPE_FLING = 0.5;
|
|
133
|
+
export type SwipeOutcome = "skip-workspace" | "back" | "stay";
|
|
134
|
+
export function swipeOutcome(g: { dx: number; vx: number; width: number; canBack: boolean }): SwipeOutcome {
|
|
135
|
+
const far = Math.abs(g.dx) > SWIPE_COMMIT * g.width;
|
|
136
|
+
const fling = Math.abs(g.vx) > SWIPE_FLING && Math.sign(g.vx) === Math.sign(g.dx);
|
|
137
|
+
if (!far && !fling) return "stay";
|
|
138
|
+
if (g.dx < 0) return "skip-workspace";
|
|
139
|
+
return g.canBack && g.dx > 0 ? "back" : "stay";
|
|
140
|
+
}
|
|
141
|
+
/** What a released drag does to the session: the screen and the tests run this one function. */
|
|
142
|
+
export function applySwipe(s: Session, out: SwipeOutcome): Session {
|
|
143
|
+
return out === "skip-workspace" ? skipWorkspace(s) : out === "back" ? { ...s, pos: prevPos(s) } : s;
|
|
144
|
+
}
|
|
86
145
|
|
|
87
146
|
/** Records what happened to the card on screen and moves on. */
|
|
88
147
|
export function settle(s: Session, outcome: Outcome, key = s.order[s.pos]): Session {
|
|
@@ -127,7 +186,7 @@ export function sync(s: Session, live: readonly Pick<DeckCard, "key">[], settled
|
|
|
127
186
|
order = [...rest.slice(0, at), ...back, ...rest.slice(at)];
|
|
128
187
|
pos = current === undefined ? at : order.indexOf(current);
|
|
129
188
|
}
|
|
130
|
-
return { order, pos, outcomes, parked };
|
|
189
|
+
return { ...s, order, pos, outcomes, parked };
|
|
131
190
|
}
|
|
132
191
|
|
|
133
192
|
/** The progress line's numbers: the card on screen out of every card this session, and what is waiting for context. */
|
|
@@ -146,7 +205,23 @@ export function statsOf(s: Session): SessionStats {
|
|
|
146
205
|
* anywhere presets. Paseo takes Shift+? (its shortcuts dialog) and Escape (interrupt agent) when focus is outside a
|
|
147
206
|
* field, which is exactly when these fire, so the sheet is S and leaving is X.
|
|
148
207
|
*/
|
|
149
|
-
export type CatchUpAction = "pick" | "own" | "send" | "skip" | "
|
|
208
|
+
export type CatchUpAction = "pick" | "own" | "send" | "skip" | "skip-workspace" | "back" | "more" | "chip" | "ask" | "note" | "later" | "chat" | "rail" | "rail-up" | "rail-down" | "keys" | "leave";
|
|
209
|
+
/**
|
|
210
|
+
* a-move-bar-action-opens-in-view: where each move-bar action opens what it opens, so its result is where the eye
|
|
211
|
+
* already is and never appended below the fold. `sheet`: drawn in the phone's dock, above the bar, kept above the
|
|
212
|
+
* keyboard. `popover`: anchored to its button on desktop. `focus`: a field or row takes focus, and DockedPane (phone)
|
|
213
|
+
* or the browser (desktop) scrolls it into view. `navigates`: leaves Catch up for the chat.
|
|
214
|
+
*/
|
|
215
|
+
export type MovePlace = "sheet" | "popover" | "focus" | "navigates";
|
|
216
|
+
export const MOVE_OPENS: Readonly<Record<"more" | "later" | "note" | "chat" | "rail", { phone: MovePlace | null; desktop: MovePlace }>> = {
|
|
217
|
+
more: { phone: "sheet", desktop: "popover" },
|
|
218
|
+
later: { phone: "sheet", desktop: "popover" },
|
|
219
|
+
note: { phone: "focus", desktop: "focus" },
|
|
220
|
+
chat: { phone: "navigates", desktop: "navigates" },
|
|
221
|
+
// The queue rail is desktop only.
|
|
222
|
+
rail: { phone: null, desktop: "focus" },
|
|
223
|
+
};
|
|
224
|
+
|
|
150
225
|
/** A key as this platform spells it: ⌘ on a Mac, Ctrl elsewhere (as the Send button's own hint reads). */
|
|
151
226
|
export const keyLabel = (key: string, mac: boolean) => mac ? key : key.replace("⌘", "Ctrl ");
|
|
152
227
|
|
|
@@ -154,12 +229,12 @@ export const CATCH_UP_KEYS: readonly { key: string; what: string; action: CatchU
|
|
|
154
229
|
{ key: "A–H", what: "Pick an option", action: "pick", combos: ["A", "B", "C", "D", "E", "F", "G", "H"] },
|
|
155
230
|
{ key: "W", what: "Write your own answer", action: "own", combos: ["W"] },
|
|
156
231
|
{ key: "⌘↵", what: "Send", action: "send", combos: ["Cmd+Enter", "Ctrl+Enter"] },
|
|
157
|
-
{ key: "J / →", what: "Skip", action: "skip", combos: ["J", "ArrowRight"] },
|
|
232
|
+
{ key: "J / →", what: "Skip this card (it comes back after the rest)", action: "skip", combos: ["J", "ArrowRight"] },
|
|
233
|
+
{ key: "⇧J", what: "Skip workspace (all its cards come back after the rest)", action: "skip-workspace", combos: ["Shift+J"] },
|
|
158
234
|
{ key: "K / ←", what: "Back", action: "back", combos: ["K", "ArrowLeft"] },
|
|
159
235
|
{ key: "M", what: "More context", action: "more", combos: ["M"] },
|
|
160
236
|
{ key: "1–4", what: "Pick a More context ask", action: "chip", combos: ["Digit"], when: "more" },
|
|
161
|
-
{ key: "⌘↵", what: "Ask the
|
|
162
|
-
{ key: "⌘⇧↵", what: "Ask the agent", action: "ask-agent", combos: ["Cmd+Shift+Enter", "Ctrl+Shift+Enter"], when: "more" },
|
|
237
|
+
{ key: "⌘↵", what: "Ask the agent", action: "ask", combos: ["Cmd+Enter", "Ctrl+Enter"], when: "more" },
|
|
163
238
|
{ key: "N", what: "Add a note", action: "note", combos: ["N"] },
|
|
164
239
|
{ key: "L", what: "Later", action: "later", combos: ["L"] },
|
|
165
240
|
{ key: "O", what: "Open chat", action: "chat", combos: ["O"] },
|
|
@@ -179,8 +254,8 @@ export function catchUpKey(e: KeyPress, at: { typing: boolean; inMore: boolean;
|
|
|
179
254
|
if (e.composing || e.alt) return null;
|
|
180
255
|
const mod = e.mac ? e.meta : e.ctrl;
|
|
181
256
|
if (e.key === "Enter" && mod && (e.mac ? !e.ctrl : !e.meta)) {
|
|
182
|
-
if (e.shift) return
|
|
183
|
-
if (at.moreOpen && (!at.typing || at.inMore)) return { action: "ask
|
|
257
|
+
if (e.shift) return null;
|
|
258
|
+
if (at.moreOpen && (!at.typing || at.inMore)) return { action: "ask" };
|
|
184
259
|
return at.typing ? null : { action: "send" };
|
|
185
260
|
}
|
|
186
261
|
if (at.typing || e.meta || e.ctrl) return null;
|
|
@@ -188,6 +263,7 @@ export function catchUpKey(e: KeyPress, at: { typing: boolean; inMore: boolean;
|
|
|
188
263
|
if (e.key === "ArrowRight") return { action: "skip" };
|
|
189
264
|
if (e.key === "ArrowLeft") return { action: "back" };
|
|
190
265
|
if (at.moreOpen && /^[1-4]$/.test(e.key)) return { action: "chip", arg: e.key };
|
|
266
|
+
if (e.shift && e.key.toLowerCase() === "j") return { action: "skip-workspace" };
|
|
191
267
|
if (e.shift || e.key.length !== 1) return null;
|
|
192
268
|
const k = e.key.toLowerCase();
|
|
193
269
|
if (/^[a-h]$/.test(k)) return { action: "pick", arg: k.toUpperCase() };
|
|
@@ -215,7 +291,11 @@ export const MODE = {
|
|
|
215
291
|
|
|
216
292
|
// More context ------------------------------------------------------------------------------------------------------
|
|
217
293
|
|
|
218
|
-
/**
|
|
294
|
+
/**
|
|
295
|
+
* Who answered. Every ask goes to the card's workspace's main agent (`agent`; asking may wake it, because the developer
|
|
296
|
+
* asked). `overseer` is only read from files written by 2.2.0-beta.3, which could route an ask to the Overseer: it never
|
|
297
|
+
* had context_reply, so those settle as `chat` on load (an-ask-goes-only-to-an-agent-that-can-answer-it).
|
|
298
|
+
*/
|
|
219
299
|
export const CONTEXT_TARGETS = ["overseer", "agent"] as const;
|
|
220
300
|
export type ContextTarget = typeof CONTEXT_TARGETS[number];
|
|
221
301
|
/** asking → answered (the reply came with context_reply), chat (the agent ended its turn without it: read its chat), failed. */
|
|
@@ -246,7 +326,7 @@ export const contextRequestSchema = z.object({
|
|
|
246
326
|
target: z.enum(CONTEXT_TARGETS),
|
|
247
327
|
/** The developer's words, or a suggestion's text. */
|
|
248
328
|
ask: z.string().min(1).max(2000),
|
|
249
|
-
/** The agent that should reply
|
|
329
|
+
/** The agent that should reply: the workspace's main agent (an Overseer's id on beta.3 files). */
|
|
250
330
|
askedOf: z.string().nullable(),
|
|
251
331
|
state: z.enum(CONTEXT_STATES),
|
|
252
332
|
answer: z.string().max(CONTEXT_ANSWER_MAX).nullable(),
|
|
@@ -284,15 +364,12 @@ export function agentContextPrompt(r: Pick<ContextRequest, "id" | "card" | "ask"
|
|
|
284
364
|
].join("\n");
|
|
285
365
|
}
|
|
286
366
|
|
|
287
|
-
/**
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
`Reply with ${REPLY_TOOL} and requestId "${r.id}" so the answer shows on their card.`,
|
|
294
|
-
].join("\n");
|
|
295
|
-
}
|
|
367
|
+
/**
|
|
368
|
+
* an-ask-goes-only-to-an-agent-that-can-answer-it: the role a More context ask is routed to. context_reply is a tool
|
|
369
|
+
* of this role only (server/mcp-source.ts toolList: contributors, recovery agents and untracked agents such as the
|
|
370
|
+
* Overseer don't get it), so an ask is only ever delivered where its answer can reach the card.
|
|
371
|
+
*/
|
|
372
|
+
export const CONTEXT_REPLY_ROLE = "main" as const;
|
|
296
373
|
|
|
297
374
|
/** A request older than CONTEXT_KEEP_MS goes, then the oldest past CONTEXT_MAX; an asking one is kept while it is young. */
|
|
298
375
|
export function pruneContext(requests: readonly ContextRequest[], now: number): ContextRequest[] {
|
package/shared/contracts.ts
CHANGED
|
@@ -210,8 +210,10 @@ export const overseerAskRpc = defineRpc({ name: "follow.overseer-ask", input: z.
|
|
|
210
210
|
// asked agent's reply. The ask answers once it is recorded; the send to the agent goes through the message queue.
|
|
211
211
|
export const contextAskRpc = defineRpc({ name: "follow.context-ask", input: z.strictObject({
|
|
212
212
|
workspaceId: z.string().min(1).max(200).nullable(), agentId: z.string().min(1).max(200).nullable(), cardKey: z.string().min(1).max(400),
|
|
213
|
-
card: z.string().trim().min(1).max(300),
|
|
214
|
-
|
|
213
|
+
card: z.string().trim().min(1).max(300),
|
|
214
|
+
/** Ignored: every ask goes to the card's workspace's main agent. Still accepted, so older callers don't break. */
|
|
215
|
+
target: z.enum(CONTEXT_TARGETS).optional(), ask: z.string().trim().min(1).max(2000) }),
|
|
216
|
+
output: z.object({ request: contextRequestSchema, fresh: z.boolean(), note: z.string().optional() }) });
|
|
215
217
|
export const contextListRpc = defineRpc({ name: "follow.context-list", input: z.strictObject({ workspaceId: z.string().max(200).optional() }), output: z.object({ requests: z.array(contextRequestSchema) }) });
|
|
216
218
|
/** Catch up's deck as the developer's Home would deal it (agent parity: an agent sees what the developer goes through). */
|
|
217
219
|
export const catchUpDeckRpc = defineRpc({ name: "follow.catch-up-deck", input: z.strictObject({}), output: z.object({
|