paseo-follow-up 2.2.0 → 2.2.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/client/catch-up.tsx +19 -3
- package/client/dictation.tsx +95 -0
- package/client/needs-you.tsx +12 -2
- package/client/questions.tsx +12 -3
- package/client/tasks.tsx +2 -1
- package/docs/screenshots/follow-up-questions.png +0 -0
- package/docs/screenshots/follow-up-setup.png +0 -0
- package/index.server.ts +2 -2
- package/package.json +1 -1
- package/server/agent-actions.ts +5 -2
- package/server/agent-hook.mjs +1 -1
- package/server/engine.ts +35 -6
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +3 -3
- package/server/mcp.mjs +3 -3
- package/shared/activity.ts +3 -1
- package/shared/attention.ts +20 -1
- package/shared/catch-up.ts +5 -3
- package/shared/contracts.ts +1 -1
- package/shared/dictation.ts +75 -0
- package/shared/headline.ts +1 -0
- package/shared/model.ts +8 -2
- package/shared/send-decision.ts +44 -0
- package/shared/status-invariants.ts +22 -1
- package/shared/task-rows.ts +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
<img src="https://raw.githubusercontent.com/tomgrin10/paseo-follow-up/main/assets/icon.png" width="80" height="80" alt="Follow-up icon">
|
|
2
|
+
|
|
1
3
|
# Follow-up
|
|
2
4
|
|
|
3
5
|
[](https://www.npmjs.com/package/paseo-follow-up)
|
package/client/catch-up.tsx
CHANGED
|
@@ -32,6 +32,7 @@ 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 { hostDictation } from "./dictation";
|
|
35
36
|
import { ownsKey, surfaceVisible } from "../shared/list-keys";
|
|
36
37
|
import { useReducedMotion } from "./motion";
|
|
37
38
|
import { PRIMARY_FORM } from "./dock";
|
|
@@ -63,11 +64,12 @@ function cardWord(card: DeckCard): string {
|
|
|
63
64
|
switch (card.item?.kind) {
|
|
64
65
|
case "merge": return "Merge"; case "reviewers": return "Add reviewers"; case "send": return "Send"; case "answer": return "Your answer";
|
|
65
66
|
case "hold": return "Paused"; case "retry": case "capped": case "message": return "Retry"; case "check": return "Check"; case "decision": return "Blocked";
|
|
67
|
+
case "person": return card.item.review ? "Re-review" : "Someone else";
|
|
66
68
|
default: return card.s.word ?? "Needs you";
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
const cardIcon = (card: DeckCard) => card.kind === "permission" ? "ShieldQuestion" : card.kind === "question" ? "MessageCircleQuestion"
|
|
70
|
-
: card.item?.kind === "merge" ? "GitMerge" : card.item?.kind === "reviewers" ? "UserPlus" : card.item?.kind === "send" ? "Send" : card.kind === "finished" ? "Flag" : card.s.icon;
|
|
72
|
+
: card.item?.kind === "merge" ? "GitMerge" : card.item?.kind === "reviewers" ? "UserPlus" : card.item?.kind === "person" ? "UserRound" : card.item?.kind === "send" ? "Send" : card.kind === "finished" ? "Flag" : card.s.icon;
|
|
71
73
|
/**
|
|
72
74
|
* 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
75
|
* workspace"): the card's kind where one word says it, else "card", the deck's own word ("N skipped" counts cards).
|
|
@@ -169,6 +171,19 @@ export function CatchUp({ theme, compact, deps, navigation, onExit }: { theme: T
|
|
|
169
171
|
case "pick": inCard(`[role="radio"][aria-label^="${hit.arg}. "]`)?.click?.(); break;
|
|
170
172
|
case "own": inCard('[role="radio"][aria-label^="Something else"]')?.click?.(); break;
|
|
171
173
|
case "send": { const b = inCard('[aria-label^="Send your"]') ?? inCard('[aria-label^="Send "]'); if (!b) return; b.click?.(); break; }
|
|
174
|
+
// V: the card's mic (DictationField). No field open yet: Something else opens one first. Focus stays on the
|
|
175
|
+
// mic, so V again stops it (in the field, V would be a letter).
|
|
176
|
+
case "dictate": {
|
|
177
|
+
if (!hostDictation()) return;
|
|
178
|
+
const mic = () => inCard('[data-dictate] [role="button"]') ?? inCard('[data-dictate][role="button"]');
|
|
179
|
+
const hit = (m: El | null) => { m?.click?.(); m?.focus?.(); };
|
|
180
|
+
if (mic()) { hit(mic()); break; }
|
|
181
|
+
const own = inCard('[role="radio"][aria-label^="Something else"]');
|
|
182
|
+
if (!own) return;
|
|
183
|
+
own.click?.();
|
|
184
|
+
setTimeout(() => hit(mic()), 0);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
172
187
|
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
188
|
// Its sheet or popover takes focus itself (MoveResult).
|
|
174
189
|
case "later": if (!click('[aria-label="Later (L)"]')) return; break;
|
|
@@ -378,7 +393,7 @@ function CardView({ card, w, theme, compact, deps, navigation, gone, more, setMo
|
|
|
378
393
|
? <View style={{ gap: 8 }}>
|
|
379
394
|
<RichText plain style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{`${q.id} · ${q.title}`}</RichText>
|
|
380
395
|
<QuestionBody key={q.id} workspace={ws} question={q} theme={theme} compact={compact} inline={false}
|
|
381
|
-
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} onSendReady={setReady} />
|
|
396
|
+
openAgent={id => navigation?.openAgent({ agentId: id })} onAnswered={onDone} onSendReady={setReady} dictate />
|
|
382
397
|
</View>
|
|
383
398
|
: card.kind === "item" && card.item && full
|
|
384
399
|
? <View style={{ borderRadius: 10, borderWidth: 1, borderColor: withAlpha(c.statusWarning, 0.45), overflow: "hidden" }}>
|
|
@@ -583,6 +598,7 @@ export function Finished({ theme, compact, stats, empty, onHome, onSkipped }: {
|
|
|
583
598
|
|
|
584
599
|
/** S: the keys, from the one list the handler reads (shared/catch-up.ts). A dialog over the card; S or its X closes it. */
|
|
585
600
|
export function KeysSheet({ theme, onClose }: { theme: Theme; onClose: () => void }) {
|
|
601
|
+
const dictation = !!hostDictation();
|
|
586
602
|
const c = theme.colors; const t = text(c, false);
|
|
587
603
|
const row = (k: typeof CATCH_UP_KEYS[number]) => <View key={`${k.action}-${k.key}`} style={{ flexDirection: "row", gap: 10, alignItems: "center" }}>
|
|
588
604
|
<View style={{ minWidth: 64 }}><Text style={[t.meta, { alignSelf: "flex-start", paddingHorizontal: 6, borderRadius: 4, borderWidth: 1, borderColor: c.border, color: c.foreground, fontVariant: ["tabular-nums"] }]}>{keyLabel(k.key, isMac())}</Text></View>
|
|
@@ -596,7 +612,7 @@ export function KeysSheet({ theme, onClose }: { theme: Theme; onClose: () => voi
|
|
|
596
612
|
<Text style={[t.label, { flex: 1, fontWeight: "600" }]}>Keys</Text>
|
|
597
613
|
<IconButton theme={theme} compact={false} icon="X" label="Close the keys (S)" tooltip onPress={onClose} />
|
|
598
614
|
</View>
|
|
599
|
-
{section("On a card", CATCH_UP_KEYS.filter(k => !k.when))}
|
|
615
|
+
{section("On a card", CATCH_UP_KEYS.filter(k => !k.when && (!k.needs || dictation)))}
|
|
600
616
|
{section("In More context", CATCH_UP_KEYS.filter(k => k.when === "more"))}
|
|
601
617
|
{section("In the queue", CATCH_UP_KEYS.filter(k => k.when === "rail"))}
|
|
602
618
|
</View>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useEffect, useRef, useState, type ReactNode } from "react";
|
|
2
|
+
import { Platform, View } from "react-native";
|
|
3
|
+
import * as pluginClient from "@getpaseo/plugin/client";
|
|
4
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { Text } from "./text";
|
|
6
|
+
import { text, type Theme } from "./kit";
|
|
7
|
+
import { PressScale, Spinner } from "./motion";
|
|
8
|
+
import { withAlpha } from "./theme";
|
|
9
|
+
import { hostDictationHook, insertDictated, micView, type UseHostDictation } from "../shared/dictation";
|
|
10
|
+
|
|
11
|
+
/** Paseo's dictation hook when this host has one (read per render, so a test host can add or remove it). */
|
|
12
|
+
export const hostDictation = (): UseHostDictation | null => hostDictationHook(pluginClient);
|
|
13
|
+
|
|
14
|
+
/** The caret of a field, for inserting dictated words where the developer was writing. */
|
|
15
|
+
export function useCaret() {
|
|
16
|
+
const sel = useRef<{ start: number; end: number } | null>(null);
|
|
17
|
+
return {
|
|
18
|
+
selection: () => sel.current,
|
|
19
|
+
onSelectionChange: (e: { nativeEvent: { selection: { start: number; end: number } } }) => { sel.current = e.nativeEvent.selection; },
|
|
20
|
+
insert: (words: string, said: string, maxLength?: number) => {
|
|
21
|
+
const next = insertDictated(words, said, sel.current, maxLength);
|
|
22
|
+
sel.current = { start: next.caret, end: next.caret };
|
|
23
|
+
return next.words;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Room the field leaves for the mic in its bottom-right corner. */
|
|
29
|
+
const MIC = { desktop: 32, phone: 36 } as const;
|
|
30
|
+
export type FieldPad = { paddingRight: number; minHeight?: number } | null;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A text field with Paseo's dictation inside it (dictated-text-lands-in-the-field). The mic sits in the field's
|
|
34
|
+
* bottom-right corner, where the words are being written, never on its own; tap to start, tap to stop, and the words
|
|
35
|
+
* land through `onText` in the field's own state, editable, never sent. `field(pad)` draws the field: `pad` is the
|
|
36
|
+
* room to leave for the mic, or null on a Paseo without usePaseoDictation, which renders the field alone, unchanged.
|
|
37
|
+
* One component, so any answer field (Catch up today; Home and the panel later) takes the same mic.
|
|
38
|
+
*/
|
|
39
|
+
export function DictationField({ theme, compact, field, onText, disabled = false, keyHint = false }: {
|
|
40
|
+
theme: Theme; compact: boolean; field: (pad: FieldPad) => ReactNode; onText: (text: string) => void; disabled?: boolean;
|
|
41
|
+
/** Desktop Catch up: the button and its line name the key (V). */ keyHint?: boolean;
|
|
42
|
+
}) {
|
|
43
|
+
const use = hostDictation();
|
|
44
|
+
return use ? <Mic use={use} theme={theme} compact={compact} field={field} onText={onText} disabled={disabled} keyHint={keyHint} /> : <>{field(null)}</>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function Mic({ use, theme, compact, field, onText, disabled, keyHint }: {
|
|
48
|
+
use: UseHostDictation; theme: Theme; compact: boolean; field: (pad: FieldPad) => ReactNode; onText: (text: string) => void; disabled: boolean; keyHint: boolean;
|
|
49
|
+
}) {
|
|
50
|
+
const c = theme.colors; const t = text(c, compact);
|
|
51
|
+
const latest = useRef(onText); latest.current = onText;
|
|
52
|
+
const d = use({ onText: said => latest.current(said) });
|
|
53
|
+
const [explain, setExplain] = useState(false);
|
|
54
|
+
useEffect(() => { if (!d.unavailable) setExplain(false); }, [!!d.unavailable]);
|
|
55
|
+
// Leaving the card mid-recording discards it: nothing is written into a field that's gone.
|
|
56
|
+
const cancel = useRef(d.cancel); cancel.current = d.cancel;
|
|
57
|
+
useEffect(() => () => { void cancel.current().catch(() => undefined); }, []);
|
|
58
|
+
const view = micView(d, { explain, key: keyHint && !compact });
|
|
59
|
+
const press = () => {
|
|
60
|
+
if (view.state === "unavailable") { setExplain(v => !v); return; }
|
|
61
|
+
if (view.state === "listening") { void d.stop().catch(() => undefined); return; }
|
|
62
|
+
if (view.state === "idle") void d.start().catch(() => undefined);
|
|
63
|
+
};
|
|
64
|
+
const live = view.state === "listening";
|
|
65
|
+
// Red is recording (the dot, the Stop button) and failure; the listening words stay neutral.
|
|
66
|
+
const lineColor = view.tone === "live" ? c.foreground : view.tone === "danger" ? c.statusDanger : c.foregroundMuted;
|
|
67
|
+
const size = compact ? MIC.phone : MIC.desktop;
|
|
68
|
+
// The desktop hover title names the key; React Native Web drops `title` on a Pressable, so it goes on a wrapper.
|
|
69
|
+
const tip = useRef<View | null>(null);
|
|
70
|
+
useEffect(() => { if (Platform.OS === "web" && !compact) (tip.current as unknown as { setAttribute?: (k: string, v: string) => void } | null)?.setAttribute?.("title", view.label); }, [view.label, compact]);
|
|
71
|
+
const inactive = disabled || view.disabled;
|
|
72
|
+
const button = <View ref={tip} {...({ dataSet: { dictate: "1" } } as object)} style={{ position: "absolute", right: 6, bottom: 6 }}>
|
|
73
|
+
<PressScale accessibilityRole="button" accessibilityLabel={view.label} accessibilityState={{ disabled: inactive, busy: view.state === "transcribing" }} disabled={inactive} onPress={press}
|
|
74
|
+
hitSlop={compact ? (44 - size) / 2 : 4}
|
|
75
|
+
style={({ pressed, hovered }) => ({ width: size, height: size, borderRadius: size / 2, alignItems: "center", justifyContent: "center",
|
|
76
|
+
backgroundColor: live ? (pressed ? withAlpha(c.statusDanger, 0.85) : c.statusDanger) : pressed ? c.surface2 : hovered ? c.surface2 : "transparent",
|
|
77
|
+
opacity: inactive && view.state !== "transcribing" ? 0.45 : 1 })}>
|
|
78
|
+
{view.state === "transcribing" ? <Spinner color={c.foregroundMuted} size={14} label={view.label} />
|
|
79
|
+
: live ? <View style={{ width: compact ? 12 : 10, height: compact ? 12 : 10, borderRadius: 2, backgroundColor: "#ffffff" }} />
|
|
80
|
+
: <Icon name={view.icon} size={compact ? 18 : 16} color={view.state === "unavailable" ? c.foregroundMuted : c.foreground} />}
|
|
81
|
+
</PressScale>
|
|
82
|
+
</View>;
|
|
83
|
+
return <View style={{ gap: 6 }}>
|
|
84
|
+
<View style={{ position: "relative" }}>
|
|
85
|
+
{field({ paddingRight: size + 12, ...(compact ? { minHeight: size + 12 } : {}) })}
|
|
86
|
+
{button}
|
|
87
|
+
</View>
|
|
88
|
+
{view.line && <View accessibilityLiveRegion="polite" style={{ flexDirection: "row", alignItems: "center", gap: 6, minHeight: 18 }}>
|
|
89
|
+
{live ? <View style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: c.statusDanger, opacity: 0.75 + 0.25 * Math.min(1, Math.max(0, d.volume) * 3) }} />
|
|
90
|
+
: view.state === "transcribing" ? null
|
|
91
|
+
: <Icon name={view.state === "unavailable" ? "MicOff" : "CircleAlert"} size={12} color={lineColor} />}
|
|
92
|
+
<Text style={[t.meta, { color: lineColor, flexShrink: 1 }]}>{view.line}</Text>
|
|
93
|
+
</View>}
|
|
94
|
+
</View>;
|
|
95
|
+
}
|
package/client/needs-you.tsx
CHANGED
|
@@ -34,6 +34,7 @@ function glyph(item: NeedItem, colors: Colors): { name: string; color: string }
|
|
|
34
34
|
case "hold": return { name: "CirclePause", color: colors.statusWarning };
|
|
35
35
|
case "retry": return { name: "OctagonAlert", color: colors.statusDanger };
|
|
36
36
|
case "capped": return { name: "CircleAlert", color: colors.statusWarning };
|
|
37
|
+
case "person": return { name: "UserRound", color: colors.statusWarning };
|
|
37
38
|
case "check": return { name: "CircleHelp", color: colors.statusWarning };
|
|
38
39
|
case "message": return { name: "MessageSquareWarning", color: colors.statusWarning };
|
|
39
40
|
case "decision": return { name: "MessageCircleQuestion", color: colors.statusWarning };
|
|
@@ -114,6 +115,10 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
114
115
|
<Button theme={theme} compact={compact} kind="primary" icon="RotateCcw" title="Retry" accessibilityLabel={`Retry: ${item.title}`} loading={retryTask.isPending} disabled={busy} onPress={() => retryTask.mutate(item.taskKey)} />
|
|
115
116
|
{openMain && <Button theme={theme} compact={compact} icon="MessageSquare" title="Open agent" accessibilityLabel="Open main agent" onPress={openMain} />}
|
|
116
117
|
</>;
|
|
118
|
+
// The agent said only a person can move it: ask the reviewer again (the PR sheet's reviewers), or hand it back.
|
|
119
|
+
case "person": return item.review && item.prKey && actions.openPr
|
|
120
|
+
? <Button theme={theme} compact={compact} icon="UserPlus" title="Ask for re-review" accessibilityLabel={`Ask for a re-review: ${item.title}`} onPress={() => actions.openPr!(item.prKey!, "reviewers")} />
|
|
121
|
+
: null;
|
|
117
122
|
case "check": return <Button theme={theme} compact={compact} icon="RefreshCw" title="Check state" loading={inspect.isPending} disabled={busy} onPress={() => inspect.mutate(item.actionId)} />;
|
|
118
123
|
case "message": return <>
|
|
119
124
|
<Button theme={theme} compact={compact} kind="primary" icon="RotateCcw" title="Retry" accessibilityLabel={`Send it again: ${item.title}`} loading={queueAct.isPending && queueAct.variables?.action === "retry"} disabled={busy} onPress={() => queueAct.mutate({ itemId: item.itemId, action: "retry" })} />
|
|
@@ -136,6 +141,10 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
136
141
|
case "reviewers": return actions.openPr && <Button theme={theme} compact={compact} icon="UserPlus" title="Add reviewers" onPress={() => actions.openPr!(item.prKey, "reviewers")} />;
|
|
137
142
|
}
|
|
138
143
|
};
|
|
144
|
+
// A second, quieter action after the primary and its PR link, so the link never wraps onto a line of its own.
|
|
145
|
+
const secondary = (item: NeedItem) => item.kind === "person"
|
|
146
|
+
? <Button theme={theme} compact={compact} kind="ghost" icon="RotateCcw" title="Send to agent" accessibilityLabel={`Send it back to ${agentName(w)}: ${item.title}`} loading={retryTask.isPending} disabled={busy} onPress={() => retryTask.mutate(item.taskKey)} />
|
|
147
|
+
: null;
|
|
139
148
|
return <PrLinksProvider prs={prLinksByNumber(w.prs)}><View>
|
|
140
149
|
{items.map((item, index) => {
|
|
141
150
|
const g = glyph(item, c);
|
|
@@ -148,12 +157,13 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
148
157
|
const notice = merging?.notice ?? null;
|
|
149
158
|
// The action and its link are one group, so the link never wraps under the button (a long "Add reviewers").
|
|
150
159
|
const pair = act && link ? <View style={{ flexDirection: "row", alignItems: "center", gap: 4, flexShrink: 0 }}>{act}{link}</View> : null;
|
|
151
|
-
const
|
|
160
|
+
const more = secondary(item);
|
|
161
|
+
const button = act || link || more ? <>{pair ?? <>{act}{link}</>}{more}</> : null;
|
|
152
162
|
const said = !!untitled?.has(item.key);
|
|
153
163
|
// Phones: the action sits at the row's right edge so rows never grow a second line of controls. A send batch
|
|
154
164
|
// (the primary, with its task list) and Retry's pair keep their buttons full width under the row.
|
|
155
165
|
// A stack's scope line and a blocker need the row's full width, so those rows put their button under the text.
|
|
156
|
-
const inline = compact && button && item.kind !== "send" && !(item.kind === "retry" && !item.exhausted) && !scopeLine && !notice;
|
|
166
|
+
const inline = compact && button && item.kind !== "send" && !(item.kind === "retry" && !item.exhausted) && item.kind !== "person" && !scopeLine && !notice;
|
|
157
167
|
if (inline) return <CardRow key={item.key} theme={theme} compact first={index === 0 && flush} style={flush ? { paddingHorizontal: 0 } : undefined}>
|
|
158
168
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
159
169
|
{/* A row with the quiet link under it is taller: the glyph stays on the title's line. */}
|
package/client/questions.tsx
CHANGED
|
@@ -17,6 +17,7 @@ import { mootNote, sentence } from "../shared/errors";
|
|
|
17
17
|
import { activity, type ActivityTone } from "../shared/activity";
|
|
18
18
|
import { Button, Card, CardRow, Chip, FoldRow, IconButton, SubmitScope, errorText, text, type Theme } from "./kit";
|
|
19
19
|
import { Spinner } from "./motion";
|
|
20
|
+
import { DictationField, useCaret, type FieldPad } from "./dictation";
|
|
20
21
|
import { NoteLink } from "./brief";
|
|
21
22
|
import { PRIMARY_FORM } from "./dock";
|
|
22
23
|
import { mergedColor, tint, withAlpha, type Colors } from "./theme";
|
|
@@ -101,7 +102,7 @@ export type SendReady = { send: () => void; busy: boolean };
|
|
|
101
102
|
* (the dialog, Needs you on Home and in the panel, the pill, phones): what its field means comes from answerDraft
|
|
102
103
|
* (`one-answer-flow-for-every-question`), never from the surface.
|
|
103
104
|
*/
|
|
104
|
-
export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false, onSendReady }: {
|
|
105
|
+
export function QuestionBody({ workspace: w, question: q, theme, compact, now = Date.now(), dense = false, bodyMaxHeight, openAgent, onAnswered, onDetails, onClose, inline = false, onSendReady, dictate = false }: {
|
|
105
106
|
workspace: ListWorkspace; question: ListQuestion; theme: Theme; compact: boolean; now?: number; dense?: boolean; bodyMaxHeight?: number; openAgent?: (agentId: string) => void; onAnswered?: () => void; onDetails?: () => void;
|
|
106
107
|
/** Inside the Needs you block: its header says the title and when it was asked, its footer what the agent does meanwhile. */
|
|
107
108
|
inline?: boolean;
|
|
@@ -112,6 +113,8 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
112
113
|
* Send outside the card runs exactly this flow (`one-answer-flow-for-every-question`), never a copy of it.
|
|
113
114
|
*/
|
|
114
115
|
onSendReady?: (send: SendReady | null) => void;
|
|
116
|
+
/** Catch up: a mic beside the field (DictationField), when the host has Paseo's dictation. */
|
|
117
|
+
dictate?: boolean;
|
|
115
118
|
}) {
|
|
116
119
|
const c = theme.colors; const t = text(c);
|
|
117
120
|
const toast = useToast(); const cache = useQueryClient();
|
|
@@ -137,6 +140,7 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
137
140
|
// The field is shown only once its role is known: Something else (the answer, so Send waits for words) or Add note
|
|
138
141
|
// on a lettered pick. One rule for every surface (shared/questions.ts answerDraft).
|
|
139
142
|
const draft = answerDraft(q, { choice, words, noteOpen });
|
|
143
|
+
const caret = useCaret();
|
|
140
144
|
const other = draft.own;
|
|
141
145
|
const answer = draft.answer;
|
|
142
146
|
// What Send sends with the answer: Something else's words or a pick's note, from the draft (what-you-typed-is-what-gets-sent).
|
|
@@ -238,8 +242,13 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
238
242
|
const input = draft.field && <View style={{ gap: 6 }}>
|
|
239
243
|
{free && !dense && <Text style={t.meta}>No options were given. Write the decision for the agent.</Text>}
|
|
240
244
|
{!!draft.heading && <Text style={[t.small, { fontWeight: "600" }]}>{draft.heading}</Text>}
|
|
241
|
-
|
|
242
|
-
|
|
245
|
+
{(() => {
|
|
246
|
+
const field = (pad: FieldPad) => <TextInput key={draft.field} accessibilityLabel={draft.label} placeholder={draft.placeholder} placeholderTextColor={c.foregroundMuted}
|
|
247
|
+
multiline value={words} editable={!run.isPending} onChangeText={setWords} onSelectionChange={caret.onSelectionChange} maxLength={2000} autoFocus={!free && (other || noteOpen)} style={[inputStyle(c, compact, draft.field === "answer" && !dense ? 3 : 2), pad]} />;
|
|
248
|
+
// Dictated words land in this same field's words (what-you-typed-is-what-gets-sent), at the caret, never sent.
|
|
249
|
+
return dictate ? <DictationField key={draft.field} theme={theme} compact={compact} keyHint field={field} disabled={run.isPending}
|
|
250
|
+
onText={said => setWords(prev => caret.insert(prev, said, 2000))} /> : field(null);
|
|
251
|
+
})()}
|
|
243
252
|
</View>;
|
|
244
253
|
// Context comes before the options so the developer reads why before choosing.
|
|
245
254
|
const body = <View style={{ gap: dense ? 10 : 14 }}>
|
package/client/tasks.tsx
CHANGED
|
@@ -207,6 +207,7 @@ const chipColor = (r: RepairRow, c: Colors) => r.state === "done" ? c.foreground
|
|
|
207
207
|
function RepairGlyph({ row, w, colors }: { row: RepairRow; w: Workspace; colors: Colors }) {
|
|
208
208
|
if (row.state === "done") return <Icon name="Check" size={14} color={colors.statusSuccess} />;
|
|
209
209
|
if (row.state === "capped") return <Icon name="CircleAlert" size={14} color={colors.statusWarning} />;
|
|
210
|
+
if (row.state === "person") return <Icon name="UserRound" size={14} color={colors.statusWarning} />;
|
|
210
211
|
if (row.state === "manual") return <View style={{ width: 14, height: 14, alignItems: "center", justifyContent: "center" }}><View style={{ width: 7, height: 7, borderRadius: 4, backgroundColor: colors.foregroundMuted, opacity: 0.6 }} /></View>;
|
|
211
212
|
return <DeliveryGlyph state={row.state} w={w} colors={colors} />;
|
|
212
213
|
}
|
|
@@ -223,7 +224,7 @@ function RepairTaskRow({ row, w, theme, compact, onOpen, hit }: { row: RepairRow
|
|
|
223
224
|
: <RichText plain numberOfLines={3} style={[t.body, row.state === "done" ? { color: c.foregroundMuted } : null]}>{repairTitle(row)}</RichText>}
|
|
224
225
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
|
|
225
226
|
<Chip theme={theme} label={row.pr} color={chipColor(row, c)} />
|
|
226
|
-
<Text style={[t.meta, row.state === "capped" ? { color: c.statusWarning } : null, { fontVariant: ["tabular-nums"] }]}>{label}</Text>
|
|
227
|
+
<Text style={[t.meta, row.state === "capped" || row.state === "person" ? { color: c.statusWarning } : null, { fontVariant: ["tabular-nums"] }]}>{label}</Text>
|
|
227
228
|
</View>
|
|
228
229
|
</View>
|
|
229
230
|
<View style={{ paddingTop: 2 }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
Binary file
|
|
Binary file
|
package/index.server.ts
CHANGED
|
@@ -805,10 +805,10 @@ export default function contribute(server: PluginServerContext) {
|
|
|
805
805
|
});
|
|
806
806
|
handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }, context) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action, actorOf(context)); });
|
|
807
807
|
handle(rpc.declareDoneRpc, async ({ agentId, summary }, { paseo }) => { await requireReady(); return engine.declareDone(agentId, summary, await callerWorkspaceId(agentId, paseo, false)); });
|
|
808
|
-
handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result }, { paseo }) => {
|
|
808
|
+
handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result, humanOnly }, { paseo }) => {
|
|
809
809
|
await requireReady();
|
|
810
810
|
const agent = (await paseo.agents.ref(agentId).refresh())?.agent;
|
|
811
|
-
try { return await engine.acknowledge(agentId, batchId, outcome, result, await callerWorkspaceId(agentId, paseo)); }
|
|
811
|
+
try { return await engine.acknowledge(agentId, batchId, outcome, result, await callerWorkspaceId(agentId, paseo), humanOnly); }
|
|
812
812
|
catch (error) {
|
|
813
813
|
if (agent?.workspaceId) await store.mutate(state => {
|
|
814
814
|
const w = state.workspaces.find(w => w.id === agent.workspaceId);
|
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",
|
|
4
|
+
"version": "2.2.1-beta.0",
|
|
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": [
|
package/server/agent-actions.ts
CHANGED
|
@@ -81,10 +81,13 @@ export function controlWorkspace(state: State, input: { workspaceId: string; ena
|
|
|
81
81
|
}
|
|
82
82
|
if (input.clearHold) w.hold = null;
|
|
83
83
|
if (input.retryTask) {
|
|
84
|
-
// Re-arm one capped condition for NO_PROGRESS_CAP more sends; the next refresh puts it in the next message.
|
|
85
|
-
|
|
84
|
+
// Re-arm one capped condition for NO_PROGRESS_CAP more sends; the next refresh puts it in the next message. A
|
|
85
|
+
// person task (the agent said only a person can move it) goes back to the agent the same way: the developer
|
|
86
|
+
// disagrees, so the agent's human-only outcome no longer holds it.
|
|
87
|
+
const h = w.heldTasks?.find(h => (h.held === "capped" || h.held === "person") && h.task.key === input.retryTask);
|
|
86
88
|
if (!h) throw new Error("That task isn't waiting for a retry. Refresh to see its state.");
|
|
87
89
|
const id = conditionId(h.task);
|
|
90
|
+
if (h.held === "person") for (const b of w.batches) if (b.humanOnly && b.tasks.some(t => conditionId(t) === id)) delete b.humanOnly;
|
|
88
91
|
w.taskRetries = { ...w.taskRetries, [id]: (w.taskRetries?.[id] ?? 0) + noProgressSends(w, h.task) };
|
|
89
92
|
w.heldTasks = w.heldTasks!.filter(x => x !== h);
|
|
90
93
|
}
|
package/server/agent-hook.mjs
CHANGED
|
@@ -154,7 +154,7 @@ function paragraphs(lease, contributor, workflow) {
|
|
|
154
154
|
"Keep actual follow-up tasks current with update_obligation: production behavior checks, migrations and decisions, with concise titles, PR dependencies and evidence. Do not add merge/approval/deploy checklist tasks. Deployment-dependent work waits for verified serving revisions and existing production permissions. A task waiting on a PR or another agent is status=waiting; blocked is only for the developer, with ask set to the question they must answer.",
|
|
155
155
|
"Stakeholder replies are follow-up too. When asked to update a requester, capture the original Slack threadUrl, recipient and explicit developer authorization in the task's communication field; referenced messages alone do not authorize posting. Use a concise progress task now and, when needed, a verify-and-reply task with purpose=verified after the relevant deployed PRs. Read existing thread replies and refresh evidence before posting; distinguish fixed, deployed and verified. Record the actual sent replyUrl and result before marking done. If posting is unavailable or its outcome is uncertain, keep the task blocked and check the thread before any retry; never claim a draft was sent. Auto authorizes delivery to you, not external messages. Communication-only requests do not authorize repairs, benchmarks, migrations or other production writes.",
|
|
156
156
|
"Tasks are manual unless explicitly scheduled with trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0}. Only set a trigger from the developer\u2019s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null makes a task manual. Auto controls delivery, not timing or production permissions.",
|
|
157
|
-
batchParagraph(workflow) + " For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason. Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. " + mergeLine(workflow),
|
|
157
|
+
batchParagraph(workflow) + " For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason (humanOnly=true when only a person can move it, such as a stale review the reviewer must re-review or dismiss). Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. " + mergeLine(workflow),
|
|
158
158
|
"Before ending this turn, reconcile the sidebar with what you actually did and call sync_workspace with a short summary, including when no changes are needed. Acknowledge any assigned batch. When the entire goal is fulfilled, use declare_done; otherwise preserve remaining work. Do not launch recovery, start queued repairs, merge, toggle merge-when-ready, or archive as part of this bookkeeping. Auto still governs separate follow-up sends. Subagents report to the main agent instead of claiming workspace ownership.",
|
|
159
159
|
`Prefer the native follow-up MCP tools. For a full historical record, use workspace_status with detail=full. CLI compatibility fallback: FOLLOW_UP_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, "mcp.mjs"))} call <tool> '<json>' --compact. Omit --compact only when an existing script needs the full response. Never ask the developer to maintain the sidebar or run this bridge.`,
|
|
160
160
|
];
|
package/server/engine.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { taskSchedule } from "../shared/task-trigger";
|
|
|
3
3
|
import { STOP_WAIT_MS, settleWithin, type Deadline } from "./teardown";
|
|
4
4
|
import { DEVELOPER, type Actor } from "../shared/actor";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
|
-
import { completionBlockers, completionCheck, completionGate, revokesDone, type CompletionGate, type Workspace, type State, type Batch } from "../shared/model";
|
|
6
|
+
import { completionBlockers, completionCheck, completionGate, revokesDone, type CompletionGate, type Workspace, type State, type Batch, type Task } from "../shared/model";
|
|
7
7
|
import { Store } from "./store";
|
|
8
8
|
import { Github } from "./github";
|
|
9
9
|
import { batchPrompt, messageText, tasksFor, isRecovery, needsPrObservations, type TaskWording } from "./tasks";
|
|
@@ -19,7 +19,7 @@ import { PASEO_UNREACHABLE, deliveryOf, type NewQueueItem, type QueueItem, type
|
|
|
19
19
|
import { recordSnapshot } from "./deployment-anchor";
|
|
20
20
|
import { pruneUnsent } from "./batch-archive";
|
|
21
21
|
import { holdSuperseded, liftHold } from "../shared/status";
|
|
22
|
-
import { conditionId, isCapped, readSince, sendDecision, settleUnacknowledged, UNACKNOWLEDGED_MS } from "../shared/send-decision";
|
|
22
|
+
import { conditionId, isCapped, mootReason, personHeld, readSince, sendDecision, settleUnacknowledged, stillApplies, stuckRepair, UNACKNOWLEDGED_MS } from "../shared/send-decision";
|
|
23
23
|
import { isRepair } from "../shared/task-rows";
|
|
24
24
|
export { settleUnacknowledged, UNACKNOWLEDGED_MS, NO_PROGRESS_CAP } from "../shared/send-decision";
|
|
25
25
|
|
|
@@ -133,6 +133,9 @@ export class Engine {
|
|
|
133
133
|
b.tasks = b.tasks.filter(t => t.kind !== "obligation" || eligible.some(e => e.key === t.key && e.fingerprint === t.fingerprint));
|
|
134
134
|
if (!b.tasks.length) { b.state = "cancelled"; b.result = "No triggered task is due. Unscheduled work remains in Tasks."; }
|
|
135
135
|
}
|
|
136
|
+
// A batch left blocked or unconfirmed by a release before a-batch-item-leaves-once-nothing-applies, whose PRs
|
|
137
|
+
// have since merged or changed, settles at start-up, dormant workspaces included (no tick observes those).
|
|
138
|
+
if (w.enable_tracking && !w.archived) settleMoot(w, eligible, this.now());
|
|
136
139
|
for (const b of w.batches) if (isRecovery(b) && b.state === "pending" && !b.enable_manual_recovery) { b.state = "cancelled"; b.result = "Recovery is now optional. Run recovery when needed; registered work continues independently."; }
|
|
137
140
|
if (["Recovery stopped or failed. Check the recovery agent before retrying.", "Recovery acknowledgment was refused. Check the identity error on this batch."].includes(w.hold ?? "")) w.hold = null;
|
|
138
141
|
}
|
|
@@ -642,14 +645,22 @@ export class Engine {
|
|
|
642
645
|
// One cap (Q49): a send that left a PR condition as it was, acknowledged or not, delivered nothing GitHub shows, so
|
|
643
646
|
// the condition goes out again until it has gone out NO_PROGRESS_CAP times unchanged. An acknowledged one waits
|
|
644
647
|
// for a GitHub read newer than the acknowledgment, so a fix GitHub hasn't shown yet is never sent twice.
|
|
645
|
-
|
|
648
|
+
// A stuck batch re-checks what it asked for like a queued one: once nothing still applies, it settles and leaves
|
|
649
|
+
// Needs you (a-batch-item-leaves-once-nothing-applies).
|
|
650
|
+
settleMoot(w, tasks, this.now());
|
|
651
|
+
// A human-only outcome isn't a delivery that awaits GitHub: its still-open conditions are held as "person" at once.
|
|
652
|
+
const delivered = new Set(w.batches.filter(b => ["sending", "sent", "completed", "blocked", "uncertain"].includes(b.state) && !(b.state === "completed" && (b.unacknowledged || b.humanOnly)))
|
|
646
653
|
.flatMap(b => b.tasks.filter(t => b.state !== "completed" || !isRepair(t) || !readSince(w, t, b.settledAt)).map(conditionId)));
|
|
647
654
|
const open = tasks.filter(t => !delivered.has(conditionId(t)));
|
|
648
655
|
// One rule for every task in a message (Q49): a task the developer keeps for themselves, or a condition that went
|
|
649
656
|
// out NO_PROGRESS_CAP times unchanged, stays out of it; only that task waits, the rest go out.
|
|
650
657
|
const manual = new Set(w.manualTasks ?? []);
|
|
651
658
|
const held: NonNullable<Workspace["heldTasks"]> = [];
|
|
652
|
-
for (const t of open)
|
|
659
|
+
for (const t of open) {
|
|
660
|
+
if (t.kind === "completion") continue;
|
|
661
|
+
const why = manual.has(t.key) ? "manual" : personHeld(w, t) ? "person" : isCapped(w, t) ? "capped" : null;
|
|
662
|
+
if (why) held.push({ task: t, held: why });
|
|
663
|
+
}
|
|
653
664
|
const fresh = open.filter(t => !held.some(h => h.task === t));
|
|
654
665
|
if (held.length || w.heldTasks?.length) w.heldTasks = held;
|
|
655
666
|
let pending = w.batches.find(b => b.state === "pending" && !isRecovery(b));
|
|
@@ -709,7 +720,13 @@ export class Engine {
|
|
|
709
720
|
return { workspace: w, blockers, unconfirmed: gate.unconfirmed, alreadyDone, next: doneGuidance(gate, alreadyDone) };
|
|
710
721
|
});
|
|
711
722
|
}
|
|
712
|
-
|
|
723
|
+
/**
|
|
724
|
+
* Records an agent's outcome. `humanOnly` (with blocked): nothing is left for an agent, only a person can move what is
|
|
725
|
+
* still open. The batch settles completed and its still-open conditions wait as the developer's "person" tasks, a PR
|
|
726
|
+
* item, never "The tasks didn't finish" (a-human-only-outcome-is-a-human-item).
|
|
727
|
+
*/
|
|
728
|
+
async acknowledge(agentId: string, batchId: string, outcome: "completed" | "blocked", result: string, workspaceId?: string, humanOnly?: boolean): Promise<Workspace> {
|
|
729
|
+
if (humanOnly && outcome !== "blocked") throw new Error("humanOnly goes with outcome \"blocked\": use it when nothing is left for an agent and only a person can move what is still open.");
|
|
713
730
|
// Resolved on the snapshot, written to that one workspace (a-send-never-clones-the-whole-state), re-checked inside.
|
|
714
731
|
const target = agentWorkspace(await this.store.snapshot(), agentId, "read", workspaceId);
|
|
715
732
|
const w = await this.store.mutateWorkspace(target.id, w => {
|
|
@@ -719,7 +736,9 @@ export class Engine {
|
|
|
719
736
|
if (!b || !["sending", "sent", "blocked", "uncertain"].includes(b.state)) throw new Error("Batch is not awaiting acknowledgment.");
|
|
720
737
|
if ((b.recipientAgentId ?? w.mainAgentId) !== agentId) throw new Error(`Only the assigned agent can acknowledge this batch: expected agent ${b.recipientAgentId ?? w.mainAgentId}, received agent ${agentId}.`);
|
|
721
738
|
if (outcome === "completed" && b.tasks.some(t => t.kind === "obligation" && w.obligations.some(o => o.id === t.target && o.communication && o.status !== "waived" && (o.status !== "done" || !replyRecorded(o.communication))))) throw new Error("Record the sent reply on each communication task before completing this batch, or acknowledge blocked with the posting/access reason.");
|
|
722
|
-
|
|
739
|
+
if (humanOnly && (isRecovery(b) || completionCheck(b))) throw new Error("humanOnly is for repair batches. Acknowledge this one blocked with the reason.");
|
|
740
|
+
b.state = humanOnly ? "completed" : outcome; b.result = result; b.acknowledgmentError = null; b.settledAt = new Date(this.now()).toISOString();
|
|
741
|
+
if (humanOnly) b.humanOnly = true; else delete b.humanOnly;
|
|
723
742
|
if (outcome === "completed" && w.inventory) for (const task of b.tasks.filter(t => t.kind === "inventory"))
|
|
724
743
|
w.inventory.syncedRevision = Math.max(w.inventory.syncedRevision, Number(task.fingerprint));
|
|
725
744
|
return w;
|
|
@@ -753,6 +772,16 @@ function nextDue(w: Workspace, now: number): number {
|
|
|
753
772
|
|
|
754
773
|
export type DoneResult = { workspace: Workspace; blockers: string[]; unconfirmed: string[]; alreadyDone: boolean; next: string };
|
|
755
774
|
/** The declare_done reply in words: what's missing, who can move it, and whether calling again could help. */
|
|
775
|
+
/**
|
|
776
|
+
* Settles every stuck (blocked or unconfirmed) repair batch that no longer asks for anything (stillApplies over `open`,
|
|
777
|
+
* the tasks the PRs show now), with the reason and the blocker's own time kept for Activity. The same rule reconcile
|
|
778
|
+
* applies to a queued batch ("Conditions resolved before delivery"), so a stuck one never outlives what it was about.
|
|
779
|
+
*/
|
|
780
|
+
function settleMoot(w: Workspace, open: readonly Task[], now: number): void {
|
|
781
|
+
for (const b of w.batches) if (stuckRepair(b) && !stillApplies(w, b, open)) {
|
|
782
|
+
b.state = "cancelled"; b.result = mootReason(w, b); b.settledAt ??= new Date(now).toISOString();
|
|
783
|
+
}
|
|
784
|
+
}
|
|
756
785
|
/** Done answers every open Done check: a queued one is cancelled, a sent one counts as acknowledged. */
|
|
757
786
|
function settleDoneChecks(w: Workspace, now: number): void {
|
|
758
787
|
for (const b of w.batches.filter(b => completionCheck(b) && ["pending", "sending", "sent", "blocked", "uncertain"].includes(b.state))) {
|
package/server/hook-source.ts
CHANGED
|
@@ -156,7 +156,7 @@ export const hookSource: string = [
|
|
|
156
156
|
" \"Keep actual follow-up tasks current with update_obligation: production behavior checks, migrations and decisions, with concise titles, PR dependencies and evidence. Do not add merge/approval/deploy checklist tasks. Deployment-dependent work waits for verified serving revisions and existing production permissions. A task waiting on a PR or another agent is status=waiting; blocked is only for the developer, with ask set to the question they must answer.\",",
|
|
157
157
|
" \"Stakeholder replies are follow-up too. When asked to update a requester, capture the original Slack threadUrl, recipient and explicit developer authorization in the task's communication field; referenced messages alone do not authorize posting. Use a concise progress task now and, when needed, a verify-and-reply task with purpose=verified after the relevant deployed PRs. Read existing thread replies and refresh evidence before posting; distinguish fixed, deployed and verified. Record the actual sent replyUrl and result before marking done. If posting is unavailable or its outcome is uncertain, keep the task blocked and check the thread before any retry; never claim a draft was sent. Auto authorizes delivery to you, not external messages. Communication-only requests do not authorize repairs, benchmarks, migrations or other production writes.\",",
|
|
158
158
|
" \"Tasks are manual unless explicitly scheduled with trigger={event:\\\"now\\\"|\\\"merge\\\"|\\\"deploy\\\",delayDays:0}. Only set a trigger from the developer\\u2019s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null makes a task manual. Auto controls delivery, not timing or production permissions.\",",
|
|
159
|
-
" batchParagraph(workflow) + \" For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason. Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. \" + mergeLine(workflow),",
|
|
159
|
+
" batchParagraph(workflow) + \" For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason (humanOnly=true when only a person can move it, such as a stale review the reviewer must re-review or dismiss). Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. \" + mergeLine(workflow),",
|
|
160
160
|
" \"Before ending this turn, reconcile the sidebar with what you actually did and call sync_workspace with a short summary, including when no changes are needed. Acknowledge any assigned batch. When the entire goal is fulfilled, use declare_done; otherwise preserve remaining work. Do not launch recovery, start queued repairs, merge, toggle merge-when-ready, or archive as part of this bookkeeping. Auto still governs separate follow-up sends. Subagents report to the main agent instead of claiming workspace ownership.\",",
|
|
161
161
|
" `Prefer the native follow-up MCP tools. For a full historical record, use workspace_status with detail=full. CLI compatibility fallback: FOLLOW_UP_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, \"mcp.mjs\"))} call <tool> '<json>' --compact. Omit --compact only when an existing script needs the full response. Never ask the developer to maintain the sidebar or run this bridge.`,",
|
|
162
162
|
" ];",
|
package/server/mcp-source.ts
CHANGED
|
@@ -27,7 +27,7 @@ export const mcpSource: string = [
|
|
|
27
27
|
" [\"register_pr\", \"Register a PR produced by this workspace. Call after every submission. Register parents first; repeat to update its stack or parent after restacking. Supply a disposition for a deliberately closed PR. Set agentMerges: true when you merge this PR yourself (no human review): Follow-up then never asks the developer to add reviewers or merge it, and the workspace reads as waiting on you; set it false to hand the merge back. In a repository set to No review (set_pr_workflow review \\\"none\\\") every PR counts as agentMerges unless you set it false.\", \"follow.register-pr\", { repo: string, number: integer, stack: string, parentNumber: { type: [\"integer\", \"null\"], minimum: 1 }, disposition: string, agentMerges: boolean }, [\"repo\", \"number\", \"stack\"]],",
|
|
28
28
|
" [\"exclude_stack\", \"Correct an unrelated stack registration. Preserve its PRs and requirements in an exclusion audit; future registration is blocked. reason must cite the scope/ownership evidence. obligationIds may include related tasks without PR dependencies. Keep external dependencies separate from owned work.\", \"follow.exclude-stack\", { stack: string, reason: string, obligationIds: array }, [\"stack\", \"reason\"]],",
|
|
29
29
|
" [\"update_obligation\", \"Record concrete follow-up: verification, migrations, decisions or stakeholder replies. Never add approve/merge/deploy checklist tasks. afterPrs uses owner/repo#number keys. Tasks are manual unless explicitly scheduled with trigger={event:\\\"now\\\"|\\\"merge\\\"|\\\"deploy\\\",delayDays:0}. Only set a trigger from the developer’s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null makes a task manual. Auto controls delivery, not timing or production permissions. For Slack replies, communication records the original threadUrl, recipient, purpose (progress or verified), explicit developer authorization and sent replyUrl. Empty authorization never queues a reply; Auto does not authorize external posts. Use a verify-and-reply task after deployment for the final update. Read the thread first; mark blocked when posting is unavailable or uncertain, never treat a draft as sent. Done requires replyUrl and evidence; preserve fields when updating. status=working records you as the agent doing it; pass workingAgentId when another agent (your subagent) is.\", \"follow.obligation\", { id: string, workingAgentId: string, title: string, status: { type: \"string\", enum: [\"pending\", \"waiting\", \"working\", \"blocked\", \"done\", \"waived\"] }, afterPrs: array, dependencyStage: { type: \"string\", enum: [\"merged\", \"deployed\"] }, evidence: string, ask: { ...string, description: \"With blocked: the question the developer must answer (waiting on a PR or agent is status=waiting).\" }, enable_follow_up: boolean, communication, trigger }, [\"title\", \"status\"]],",
|
|
30
|
-
" [\"acknowledge_batch\", \"Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.\", \"follow.acknowledge\", { batchId: string, outcome: { type: \"string\", enum: [\"completed\", \"blocked\"] }, result: { ...string, maxLength: 2000 } }, [\"batchId\", \"outcome\", \"result\"]],",
|
|
30
|
+
" [\"acknowledge_batch\", \"Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. Blocked with humanOnly=true when nothing is left for an agent and only a person can move it (a reviewer must re-review or dismiss a stale review, access must be granted): the developer gets a PR item, not an agent failure. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.\", \"follow.acknowledge\", { batchId: string, outcome: { type: \"string\", enum: [\"completed\", \"blocked\"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: \"boolean\" } }, [\"batchId\", \"outcome\", \"result\"]],",
|
|
31
31
|
" [\"ask_question\", \"Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\\\"Already open as Q18\\\") instead of a second one; to change an open question's options, ask again with supersedes=\\\"Q18\\\". At the end of the turn point at it with needs_you questions=[\\\"Q18\\\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \\\"Something else\\\" choice where the developer writes their own answer; don't add an \\\"Other\\\" option yourself.\", \"follow.ask-question\", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: \"array\", maxItems: 26, items: { type: \"object\", properties: { letter: { type: \"string\", pattern: \"^[A-Z]$\" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: [\"letter\", \"label\"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: \"array\", maxItems: 10, items: { type: \"object\", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: \"string\", pattern: \"^Q\\\\d+$\" } }, [\"title\", \"question\"]],",
|
|
32
32
|
" [\"record_answer\", \"Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \\\"other\\\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.\", \"follow.record-answer\", { id: string, choice: string, words: string }, [\"id\", \"choice\"]],",
|
|
33
33
|
" [\"context_reply\", \"Answer the developer's More context ask with the requestId it gave: { requestId, text }, plain words. Only when asked.\", \"follow.context-reply\", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, [\"requestId\", \"text\"]],",
|
|
@@ -54,7 +54,7 @@ export const mcpSource: string = [
|
|
|
54
54
|
" [\"send_repairs\", \"Send a workspace's next message (its queued tasks) to its main agent now, like Send now. Only when the developer asked. batchId defaults to the queued one.\", \"follow.agent-act\", { workspace: string, batchId: string }, [\"workspace\"]],",
|
|
55
55
|
" [\"set_auto_send\", \"Turn Auto-send on or off for a workspace, or for one task (task: its key), like its switch. Only when the developer asked.\", \"follow.agent-act\", { workspace: string, value: boolean, task: string }, [\"workspace\", \"value\"]],",
|
|
56
56
|
" [\"clear_hold\", \"Resume Follow-up on a held workspace, like the Resume button. Only when the developer asked.\", \"follow.agent-act\", { workspace: string }, [\"workspace\"]],",
|
|
57
|
-
" [\"retry_batch\", \"Retry like the Retry button: an uncertain message (batchId) or one capped task (task: its key). Only when the developer asked.\", \"follow.agent-act\", { workspace: string, batchId: string, task: string }, [\"workspace\"]],",
|
|
57
|
+
" [\"retry_batch\", \"Retry like the Retry button: an uncertain message (batchId), or one capped task or one task waiting on a person (task: its key; Send to agent). Only when the developer asked.\", \"follow.agent-act\", { workspace: string, batchId: string, task: string }, [\"workspace\"]],",
|
|
58
58
|
" [\"track\", \"Follow a workspace again after the developer opted it out in Settings. Follow-up follows every workspace by default. Only when the developer asked.\", \"follow.agent-act\", { workspace: string }, [\"workspace\"]],",
|
|
59
59
|
" [\"workspace_about\", \"Read a workspace's Summary: one sentence on what the workspace is for (a reminder, not a status), plus the Linear issues, PRs, Slack threads and docs found in its own text. Read-only unless refresh=true, which writes a new sentence like the panel's Rewrite; otherwise it writes one only when none is cached (up to ~90 s). workspaceId is a workspace id or exact title from list_prs.\", \"follow.agent-act\", { workspaceId: string, refresh: boolean }, [\"workspaceId\"]],",
|
|
60
60
|
" [\"link_items\", \"Read any workspace's linked items: Linear issues, Slack threads, docs, artifacts (the spec among them) and GitHub issues, each with its origin (registered, manual, spec, published, extracted), plus what was removed. workspaceId is a workspace id from list_prs.\" + read, \"follow.agent-act\", { workspaceId: string }, [\"workspaceId\"]],",
|
|
@@ -298,7 +298,7 @@ export const mcpSource: string = [
|
|
|
298
298
|
" for (const resolve of candidates) try { return await import(resolve()); } catch {}",
|
|
299
299
|
" throw new Error(\"Cannot load the installed Paseo client. Reload Follow-up to refresh its runtime connection.\");",
|
|
300
300
|
"}",
|
|
301
|
-
"const batchInstructionsMain = \"Follow-up batches contain a header with the batchId and ordered tasks. A batch can arrive as one part of a message, after an answer, separated by a line holding only ---; the part starts with its own header. Read workspace_status and refresh live conditions; skip resolved tasks. Process PRs bottom to top, one fully before the next, using the repository's /fix-pr and safe reparent workflow. Validate feedback, verify changes, submit with Graphite --publish, reply/resolve addressed threads and preserve uncommitted work. Post-deploy tasks require verified serving revisions and existing production permissions. Stakeholder update requests are follow-up tasks: retain the original thread, recipient and developer authorization in communication. Use current evidence, distinguish fixed/deployed/verified, and read existing replies before posting. Record the sent replyUrl; a draft or uncertain send stays blocked and must be checked before retrying. Auto authorizes agent delivery only. Acknowledge the header's batchId with acknowledge_batch before finishing (completed with the result, or blocked with the reason), before declare_done for completion batches. Declare Done only after the whole goal and post-merge work are verified. Leave merging and archiving to the developer.\";",
|
|
301
|
+
"const batchInstructionsMain = \"Follow-up batches contain a header with the batchId and ordered tasks. A batch can arrive as one part of a message, after an answer, separated by a line holding only ---; the part starts with its own header. Read workspace_status and refresh live conditions; skip resolved tasks. Process PRs bottom to top, one fully before the next, using the repository's /fix-pr and safe reparent workflow. Validate feedback, verify changes, submit with Graphite --publish, reply/resolve addressed threads and preserve uncommitted work. Post-deploy tasks require verified serving revisions and existing production permissions. Stakeholder update requests are follow-up tasks: retain the original thread, recipient and developer authorization in communication. Use current evidence, distinguish fixed/deployed/verified, and read existing replies before posting. Record the sent replyUrl; a draft or uncertain send stays blocked and must be checked before retrying. Auto authorizes agent delivery only. Acknowledge the header's batchId with acknowledge_batch before finishing (completed with the result, or blocked with the reason; add humanOnly=true when only a person can move it, such as a stale review the reviewer must re-review or dismiss), before declare_done for completion batches. Declare Done only after the whole goal and post-merge work are verified. Leave merging and archiving to the developer.\";",
|
|
302
302
|
"/** A No review repository (Settings → PR workflow → Review): nobody else reviews, so the agent merges its own PRs. */",
|
|
303
303
|
"const noReviewMerge = \"This repository has no review: merge your own PR once CI is green, without asking the developer. Leave archiving to the developer.\";",
|
|
304
304
|
"/**",
|
package/server/mcp.mjs
CHANGED
|
@@ -25,7 +25,7 @@ const tools = [
|
|
|
25
25
|
["register_pr", "Register a PR produced by this workspace. Call after every submission. Register parents first; repeat to update its stack or parent after restacking. Supply a disposition for a deliberately closed PR. Set agentMerges: true when you merge this PR yourself (no human review): Follow-up then never asks the developer to add reviewers or merge it, and the workspace reads as waiting on you; set it false to hand the merge back. In a repository set to No review (set_pr_workflow review \"none\") every PR counts as agentMerges unless you set it false.", "follow.register-pr", { repo: string, number: integer, stack: string, parentNumber: { type: ["integer", "null"], minimum: 1 }, disposition: string, agentMerges: boolean }, ["repo", "number", "stack"]],
|
|
26
26
|
["exclude_stack", "Correct an unrelated stack registration. Preserve its PRs and requirements in an exclusion audit; future registration is blocked. reason must cite the scope/ownership evidence. obligationIds may include related tasks without PR dependencies. Keep external dependencies separate from owned work.", "follow.exclude-stack", { stack: string, reason: string, obligationIds: array }, ["stack", "reason"]],
|
|
27
27
|
["update_obligation", "Record concrete follow-up: verification, migrations, decisions or stakeholder replies. Never add approve/merge/deploy checklist tasks. afterPrs uses owner/repo#number keys. Tasks are manual unless explicitly scheduled with trigger={event:\"now\"|\"merge\"|\"deploy\",delayDays:0}. Only set a trigger from the developer’s requested timing; never infer timing from a title or enable_follow_up alone. Merge/deploy triggers require owned afterPrs; delayDays=14 waits fourteen days after the last dependency event. Now requires no PR dependencies or delay. Deployment timing starts at the first verified fully serving observation and remains conservative when history is unknown. Preserve existing trigger fields on updates; trigger=null makes a task manual. Auto controls delivery, not timing or production permissions. For Slack replies, communication records the original threadUrl, recipient, purpose (progress or verified), explicit developer authorization and sent replyUrl. Empty authorization never queues a reply; Auto does not authorize external posts. Use a verify-and-reply task after deployment for the final update. Read the thread first; mark blocked when posting is unavailable or uncertain, never treat a draft as sent. Done requires replyUrl and evidence; preserve fields when updating. status=working records you as the agent doing it; pass workingAgentId when another agent (your subagent) is.", "follow.obligation", { id: string, workingAgentId: string, title: string, status: { type: "string", enum: ["pending", "waiting", "working", "blocked", "done", "waived"] }, afterPrs: array, dependencyStage: { type: "string", enum: ["merged", "deployed"] }, evidence: string, ask: { ...string, description: "With blocked: the question the developer must answer (waiting on a PR or agent is status=waiting)." }, enable_follow_up: boolean, communication, trigger }, ["title", "status"]],
|
|
28
|
-
["acknowledge_batch", "Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.", "follow.acknowledge", { batchId: string, outcome: { type: "string", enum: ["completed", "blocked"] }, result: { ...string, maxLength: 2000 } }, ["batchId", "outcome", "result"]],
|
|
28
|
+
["acknowledge_batch", "Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. Blocked with humanOnly=true when nothing is left for an agent and only a person can move it (a reviewer must re-review or dismiss a stale review, access must be granted): the developer gets a PR item, not an agent failure. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.", "follow.acknowledge", { batchId: string, outcome: { type: "string", enum: ["completed", "blocked"] }, result: { ...string, maxLength: 2000 }, humanOnly: { type: "boolean" } }, ["batchId", "outcome", "result"]],
|
|
29
29
|
["ask_question", "Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\"Already open as Q18\") instead of a second one; to change an open question's options, ask again with supersedes=\"Q18\". At the end of the turn point at it with needs_you questions=[\"Q18\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \"Something else\" choice where the developer writes their own answer; don't add an \"Other\" option yourself.", "follow.ask-question", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: "array", maxItems: 26, items: { type: "object", properties: { letter: { type: "string", pattern: "^[A-Z]$" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: ["letter", "label"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: "array", maxItems: 10, items: { type: "object", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: "string", pattern: "^Q\\d+$" } }, ["title", "question"]],
|
|
30
30
|
["record_answer", "Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \"other\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.", "follow.record-answer", { id: string, choice: string, words: string }, ["id", "choice"]],
|
|
31
31
|
["context_reply", "Answer the developer's More context ask with the requestId it gave: { requestId, text }, plain words. Only when asked.", "follow.context-reply", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, ["requestId", "text"]],
|
|
@@ -52,7 +52,7 @@ const actionTools = [
|
|
|
52
52
|
["send_repairs", "Send a workspace's next message (its queued tasks) to its main agent now, like Send now. Only when the developer asked. batchId defaults to the queued one.", "follow.agent-act", { workspace: string, batchId: string }, ["workspace"]],
|
|
53
53
|
["set_auto_send", "Turn Auto-send on or off for a workspace, or for one task (task: its key), like its switch. Only when the developer asked.", "follow.agent-act", { workspace: string, value: boolean, task: string }, ["workspace", "value"]],
|
|
54
54
|
["clear_hold", "Resume Follow-up on a held workspace, like the Resume button. Only when the developer asked.", "follow.agent-act", { workspace: string }, ["workspace"]],
|
|
55
|
-
["retry_batch", "Retry like the Retry button: an uncertain message (batchId) or one capped task (task: its key). Only when the developer asked.", "follow.agent-act", { workspace: string, batchId: string, task: string }, ["workspace"]],
|
|
55
|
+
["retry_batch", "Retry like the Retry button: an uncertain message (batchId), or one capped task or one task waiting on a person (task: its key; Send to agent). Only when the developer asked.", "follow.agent-act", { workspace: string, batchId: string, task: string }, ["workspace"]],
|
|
56
56
|
["track", "Follow a workspace again after the developer opted it out in Settings. Follow-up follows every workspace by default. Only when the developer asked.", "follow.agent-act", { workspace: string }, ["workspace"]],
|
|
57
57
|
["workspace_about", "Read a workspace's Summary: one sentence on what the workspace is for (a reminder, not a status), plus the Linear issues, PRs, Slack threads and docs found in its own text. Read-only unless refresh=true, which writes a new sentence like the panel's Rewrite; otherwise it writes one only when none is cached (up to ~90 s). workspaceId is a workspace id or exact title from list_prs.", "follow.agent-act", { workspaceId: string, refresh: boolean }, ["workspaceId"]],
|
|
58
58
|
["link_items", "Read any workspace's linked items: Linear issues, Slack threads, docs, artifacts (the spec among them) and GitHub issues, each with its origin (registered, manual, spec, published, extracted), plus what was removed. workspaceId is a workspace id from list_prs." + read, "follow.agent-act", { workspaceId: string }, ["workspaceId"]],
|
|
@@ -296,7 +296,7 @@ async function loadClient() {
|
|
|
296
296
|
for (const resolve of candidates) try { return await import(resolve()); } catch {}
|
|
297
297
|
throw new Error("Cannot load the installed Paseo client. Reload Follow-up to refresh its runtime connection.");
|
|
298
298
|
}
|
|
299
|
-
const batchInstructionsMain = "Follow-up batches contain a header with the batchId and ordered tasks. A batch can arrive as one part of a message, after an answer, separated by a line holding only ---; the part starts with its own header. Read workspace_status and refresh live conditions; skip resolved tasks. Process PRs bottom to top, one fully before the next, using the repository's /fix-pr and safe reparent workflow. Validate feedback, verify changes, submit with Graphite --publish, reply/resolve addressed threads and preserve uncommitted work. Post-deploy tasks require verified serving revisions and existing production permissions. Stakeholder update requests are follow-up tasks: retain the original thread, recipient and developer authorization in communication. Use current evidence, distinguish fixed/deployed/verified, and read existing replies before posting. Record the sent replyUrl; a draft or uncertain send stays blocked and must be checked before retrying. Auto authorizes agent delivery only. Acknowledge the header's batchId with acknowledge_batch before finishing (completed with the result, or blocked with the reason), before declare_done for completion batches. Declare Done only after the whole goal and post-merge work are verified. Leave merging and archiving to the developer.";
|
|
299
|
+
const batchInstructionsMain = "Follow-up batches contain a header with the batchId and ordered tasks. A batch can arrive as one part of a message, after an answer, separated by a line holding only ---; the part starts with its own header. Read workspace_status and refresh live conditions; skip resolved tasks. Process PRs bottom to top, one fully before the next, using the repository's /fix-pr and safe reparent workflow. Validate feedback, verify changes, submit with Graphite --publish, reply/resolve addressed threads and preserve uncommitted work. Post-deploy tasks require verified serving revisions and existing production permissions. Stakeholder update requests are follow-up tasks: retain the original thread, recipient and developer authorization in communication. Use current evidence, distinguish fixed/deployed/verified, and read existing replies before posting. Record the sent replyUrl; a draft or uncertain send stays blocked and must be checked before retrying. Auto authorizes agent delivery only. Acknowledge the header's batchId with acknowledge_batch before finishing (completed with the result, or blocked with the reason; add humanOnly=true when only a person can move it, such as a stale review the reviewer must re-review or dismiss), before declare_done for completion batches. Declare Done only after the whole goal and post-merge work are verified. Leave merging and archiving to the developer.";
|
|
300
300
|
/** A No review repository (Settings → PR workflow → Review): nobody else reviews, so the agent merges its own PRs. */
|
|
301
301
|
const noReviewMerge = "This repository has no review: merge your own PR once CI is green, without asking the developer. Leave archiving to the developer.";
|
|
302
302
|
/**
|
package/shared/activity.ts
CHANGED
|
@@ -34,7 +34,9 @@ export function activity(w: Workspace): Activity[] {
|
|
|
34
34
|
if (!b.sentAt) continue;
|
|
35
35
|
const n = plural(b.tasks.length, "task");
|
|
36
36
|
rows.push({ key: `sent:${b.id}`, at: b.sentAt, icon: "Send", tone: "muted", text: `Sent ${n} to the main agent`, detail: b.tasks.map(t => shortRefs(t.title, w)).join(" · "), took: null });
|
|
37
|
-
|
|
37
|
+
// A human-only outcome (Batch.humanOnly) isn't finished work: it waits on a person.
|
|
38
|
+
if (b.settledAt && b.state === "completed" && b.humanOnly) rows.push({ key: `done:${b.id}`, at: b.settledAt, icon: "UserRound", tone: "warning", text: `${n} ${b.tasks.length === 1 ? "waits" : "wait"} on a person, not the agent`, detail: b.result || null, took: duration(b.sentAt, b.settledAt) });
|
|
39
|
+
else if (b.settledAt && b.state === "completed") rows.push({ key: `done:${b.id}`, at: b.settledAt, icon: "Wrench", tone: "success", text: `Main agent finished ${n}`, detail: b.result || null, took: duration(b.sentAt, b.settledAt) });
|
|
38
40
|
else if (b.settledAt && ["blocked", "cancelled"].includes(b.state)) rows.push({ key: `stopped:${b.id}`, at: b.settledAt, icon: "OctagonAlert", tone: b.state === "blocked" ? "danger" : "muted", text: b.state === "blocked" ? `${n} didn't finish` : `${n} cancelled`, detail: b.result || null, took: duration(b.sentAt, b.settledAt) });
|
|
39
41
|
}
|
|
40
42
|
for (const p of w.prs) if (p.snapshot?.state === "MERGED" && p.snapshot.mergedAt)
|
package/shared/attention.ts
CHANGED
|
@@ -107,6 +107,12 @@ type NeedItemBase =
|
|
|
107
107
|
| { kind: "retry"; key: string; batchId: string; title: string; detail: string; exhausted: boolean }
|
|
108
108
|
/** One task that went out NO_PROGRESS_CAP times with no change (Q49): Retry sends that task again; the rest of the queue moves on. */
|
|
109
109
|
| { kind: "capped"; key: string; taskKey: string; title: string; detail: string }
|
|
110
|
+
/**
|
|
111
|
+
* A task the agent said only a person can move (Batch.humanOnly): the developer's, never an agent failure
|
|
112
|
+
* (a-human-only-outcome-is-a-human-item). `review`: a review only its reviewer can change, so the item asks for a
|
|
113
|
+
* re-review (the PR sheet's reviewers). Send to agent hands it back (retryTask, the retry_batch tool).
|
|
114
|
+
*/
|
|
115
|
+
| { kind: "person"; key: string; taskKey: string; prKey: string | null; review: boolean; title: string; detail: string }
|
|
110
116
|
/** `finish`: the Done check. It never auto-sends, so it always waits on you. */
|
|
111
117
|
| { kind: "send"; key: string; batchId: string; title: string; tasks: string[]; blocker: string | null; finish?: true }
|
|
112
118
|
| { kind: "decision"; key: string; obligationId: string; title: string; detail: string }
|
|
@@ -129,6 +135,11 @@ const capitalize = (s: string) => s[0].toUpperCase() + s.slice(1);
|
|
|
129
135
|
/** The Needs-you Send while Auto is off: how much waits and why, never the workspace's title (say it once, Q51). */
|
|
130
136
|
export const autoOffLine = (n: number) => `${plural(n, "task")} ready · auto-send is off here`;
|
|
131
137
|
export const agentName = (w: Pick<Workspace, "mainAgentTitle">) => w.mainAgentTitle?.trim() || "the main agent";
|
|
138
|
+
/** A person task's Needs-you title: whom it waits on, never "didn't finish". */
|
|
139
|
+
export function personTitle(t: Pick<Task, "kind" | "title">, number?: number): string {
|
|
140
|
+
if (number === undefined) return `${t.title}: waits on a person, not the agent`;
|
|
141
|
+
return t.kind === "review" ? `#${number} waits on its reviewer` : `#${number} waits on a person, not the agent`;
|
|
142
|
+
}
|
|
132
143
|
/** A capped task's Needs-you title: what is still wrong, in plain words. */
|
|
133
144
|
export function cappedTitle(t: Pick<Task, "kind" | "target" | "title">): string {
|
|
134
145
|
const pr = `#${t.target.split("#")[1] ?? t.target}`;
|
|
@@ -192,6 +203,12 @@ function computeNeedsYou(w: Workspace, now: number): NeedItem[] {
|
|
|
192
203
|
for (const h of (w.heldTasks ?? []).filter(h => h.held === "capped"))
|
|
193
204
|
items.push({ kind: "capped", key: `capped:${h.task.key}`, taskKey: h.task.key, title: cappedTitle(h.task), ...linkFor(h.task.target),
|
|
194
205
|
detail: `Sent ${NO_PROGRESS_CAP} times and GitHub shows no change. Check ${agentName(w)}'s chat, then retry.` });
|
|
206
|
+
for (const h of (w.heldTasks ?? []).filter(h => h.held === "person")) {
|
|
207
|
+
const why = [...w.batches].reverse().find(b => b.humanOnly && b.state === "completed" && b.tasks.some(t => t.key === h.task.key))?.result;
|
|
208
|
+
const pr = w.prs.find(p => p.key === h.task.target);
|
|
209
|
+
items.push({ kind: "person", key: `person:${h.task.key}`, taskKey: h.task.key, prKey: pr?.key ?? null, review: h.task.kind === "review", title: personTitle(h.task, pr?.number), ...linkFor(h.task.target),
|
|
210
|
+
detail: why || `${capitalize(agentName(w))} says nothing is left for an agent here.` });
|
|
211
|
+
}
|
|
195
212
|
for (const a of w.prActions.filter(a => a.state === "uncertain")) {
|
|
196
213
|
const numbers = a.prs.map(key => `#${key.split("#")[1]}`).join(", ");
|
|
197
214
|
items.push({ kind: "check", key: `check:${a.id}`, actionId: a.id, ...(a.prs.length === 1 ? linkFor(a.prs[0]) : {}), title: `Check the ${a.kind === "merge" ? "merge" : a.kind === "request_reviewers" ? "reviewer request" : "merge-when-ready change"} on ${numbers}`, detail: a.result });
|
|
@@ -295,7 +312,9 @@ export function headline(w: Workspace, now = Date.now()): HeadlinePart[] {
|
|
|
295
312
|
else parts.push({ text: `${bar.merged} of ${plural(bar.total, "PR")} merged` });
|
|
296
313
|
const need = needsYou(w, now).length;
|
|
297
314
|
if (need) parts.push({ text: `${need} need${need === 1 ? "s" : ""} you`, tone: "warning" });
|
|
298
|
-
|
|
315
|
+
// A PR whose only open condition waits on a person (a-human-only-outcome-is-a-human-item) isn't the agent's to fix.
|
|
316
|
+
const personOnly = (p: Pr) => !p.snapshot?.conflict && !p.snapshot?.failedChecks?.length && !!w.heldTasks?.some(h => h.held === "person" && h.task.target === p.key);
|
|
317
|
+
const repair = w.prs.filter(p => needsRepair(p) && !personOnly(p)).length;
|
|
299
318
|
if (repair) parts.push({ text: `${repair} to fix`, tone: "danger" });
|
|
300
319
|
return parts;
|
|
301
320
|
}
|
package/shared/catch-up.ts
CHANGED
|
@@ -205,7 +205,7 @@ export function statsOf(s: Session): SessionStats {
|
|
|
205
205
|
* anywhere presets. Paseo takes Shift+? (its shortcuts dialog) and Escape (interrupt agent) when focus is outside a
|
|
206
206
|
* field, which is exactly when these fire, so the sheet is S and leaving is X.
|
|
207
207
|
*/
|
|
208
|
-
export type CatchUpAction = "pick" | "own" | "send" | "skip" | "skip-workspace" | "back" | "more" | "chip" | "ask" | "note" | "later" | "chat" | "rail" | "rail-up" | "rail-down" | "keys" | "leave";
|
|
208
|
+
export type CatchUpAction = "pick" | "own" | "send" | "skip" | "skip-workspace" | "back" | "more" | "chip" | "ask" | "note" | "later" | "chat" | "rail" | "rail-up" | "rail-down" | "keys" | "leave" | "dictate";
|
|
209
209
|
/**
|
|
210
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
211
|
* already is and never appended below the fold. `sheet`: drawn in the phone's dock, above the bar, kept above the
|
|
@@ -225,7 +225,8 @@ export const MOVE_OPENS: Readonly<Record<"more" | "later" | "note" | "chat" | "r
|
|
|
225
225
|
/** A key as this platform spells it: ⌘ on a Mac, Ctrl elsewhere (as the Send button's own hint reads). */
|
|
226
226
|
export const keyLabel = (key: string, mac: boolean) => mac ? key : key.replace("⌘", "Ctrl ");
|
|
227
227
|
|
|
228
|
-
export const CATCH_UP_KEYS: readonly { key: string; what: string; action: CatchUpAction; combos: readonly string[]; when?: "more" | "rail"
|
|
228
|
+
export const CATCH_UP_KEYS: readonly { key: string; what: string; action: CatchUpAction; combos: readonly string[]; when?: "more" | "rail";
|
|
229
|
+
/** Listed only on a host that has it: V is Paseo's dictation, on a Paseo with usePaseoDictation. */ needs?: "dictation" }[] = [
|
|
229
230
|
{ key: "A–H", what: "Pick an option", action: "pick", combos: ["A", "B", "C", "D", "E", "F", "G", "H"] },
|
|
230
231
|
{ key: "W", what: "Write your own answer", action: "own", combos: ["W"] },
|
|
231
232
|
{ key: "⌘↵", what: "Send", action: "send", combos: ["Cmd+Enter", "Ctrl+Enter"] },
|
|
@@ -236,6 +237,7 @@ export const CATCH_UP_KEYS: readonly { key: string; what: string; action: CatchU
|
|
|
236
237
|
{ key: "1–4", what: "Pick a More context ask", action: "chip", combos: ["Digit"], when: "more" },
|
|
237
238
|
{ key: "⌘↵", what: "Ask the agent", action: "ask", combos: ["Cmd+Enter", "Ctrl+Enter"], when: "more" },
|
|
238
239
|
{ key: "N", what: "Add a note", action: "note", combos: ["N"] },
|
|
240
|
+
{ key: "V", what: "Dictate your answer, and stop", action: "dictate", combos: ["V"], needs: "dictation" },
|
|
239
241
|
{ key: "L", what: "Later", action: "later", combos: ["L"] },
|
|
240
242
|
{ key: "O", what: "Open chat", action: "chat", combos: ["O"] },
|
|
241
243
|
{ key: "R", what: "Go to the queue, and back", action: "rail", combos: ["R"] },
|
|
@@ -267,7 +269,7 @@ export function catchUpKey(e: KeyPress, at: { typing: boolean; inMore: boolean;
|
|
|
267
269
|
if (e.shift || e.key.length !== 1) return null;
|
|
268
270
|
const k = e.key.toLowerCase();
|
|
269
271
|
if (/^[a-h]$/.test(k)) return { action: "pick", arg: k.toUpperCase() };
|
|
270
|
-
const byLetter: Record<string, CatchUpAction> = { w: "own", j: "skip", k: "back", m: "more", n: "note", l: "later", o: "chat", r: "rail", s: "keys", x: "leave" };
|
|
272
|
+
const byLetter: Record<string, CatchUpAction> = { w: "own", j: "skip", k: "back", m: "more", n: "note", l: "later", o: "chat", r: "rail", s: "keys", x: "leave", v: "dictate" };
|
|
271
273
|
return byLetter[k] ? { action: byLetter[k] } : null;
|
|
272
274
|
}
|
|
273
275
|
|
package/shared/contracts.ts
CHANGED
|
@@ -46,7 +46,7 @@ export const enrollRpc = defineRpc({ name: "follow.enroll", input: z.strictObjec
|
|
|
46
46
|
export const registerPrRpc = defineRpc({ name: "follow.register-pr", input: z.strictObject({ agentId: idSchema, repo: z.string().regex(/^[\w.-]+\/[\w.-]+$/), number: z.number().int().positive(), stack: textSchema, parentNumber: z.number().int().positive().nullable().optional(), disposition: z.string().max(2000).optional(), agentMerges: z.boolean().optional() }), output: workspaceSchema });
|
|
47
47
|
export const obligationRpc = defineRpc({ name: "follow.obligation", input: z.strictObject({ agentId: idSchema, workingAgentId: idSchema.optional(), id: idSchema.optional(), title: textSchema, status: z.enum(["pending", "waiting", "working", "blocked", "done", "waived"]), afterPrs: z.array(idSchema).optional(), dependencyStage: z.enum(["merged", "deployed"]).optional(), evidence: z.string().max(4000).optional(), ask: z.string().trim().min(1).max(1000).optional(), enable_follow_up: z.boolean().optional(), communication: agentCommunicationSchema.optional(), trigger: taskTriggerSchema.strict().nullable().optional() }), output: workspaceSchema.extend({ updatedObligationId: idSchema }) });
|
|
48
48
|
export const declareDoneRpc = defineRpc({ name: "follow.done", input: z.strictObject({ agentId: idSchema, summary: textSchema }), output: z.object({ workspace: workspaceSchema, blockers: z.array(z.string()), unconfirmed: z.array(z.string()).default([]), alreadyDone: z.boolean().default(false), next: z.string().default("") }) });
|
|
49
|
-
export const acknowledgeRpc = defineRpc({ name: "follow.acknowledge", input: z.strictObject({ agentId: idSchema, batchId: idSchema, outcome: z.enum(["completed", "blocked"]), result: textSchema }), output: workspaceSchema });
|
|
49
|
+
export const acknowledgeRpc = defineRpc({ name: "follow.acknowledge", input: z.strictObject({ agentId: idSchema, batchId: idSchema, outcome: z.enum(["completed", "blocked"]), result: textSchema, /** With blocked: only a person can move what is still open (Batch.humanOnly). */ humanOnly: z.boolean().optional() }), output: workspaceSchema });
|
|
50
50
|
export const controlRpc = defineRpc({ name: "follow.control", input: z.object({ workspaceId: idSchema, enable_auto_sends: z.boolean().optional(), clearHold: z.boolean().optional(), retryBatchId: idSchema.optional(), /** Retry one capped task (Q49): its key. */ retryTask: z.string().max(400).optional(), /** Auto per task: a task key and whether Follow-up sends it. */ taskAuto: z.object({ key: z.string().max(400), auto: z.boolean() }).optional(), /** The developer's "Make main agent": one of the workspace's other root agents. */ mainAgentId: idSchema.optional(),
|
|
51
51
|
/** Later on a workspace-only Needs-you row; null is Bring back now. */ snooze: z.object({ until: z.string().trim().min(1).max(200) }).nullable().optional() }), output: workspaceSchema });
|
|
52
52
|
export const refreshRpc = defineRpc({ name: "follow.refresh", input: z.object({ workspaceId: idSchema.optional() }), output: z.object({ ok: z.boolean() }) });
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dictation in an answer field (dictated-text-lands-in-the-field): the host's usePaseoDictation (Paseo's
|
|
3
|
+
* plugin API, when the host has it) turns speech into text, and the text goes into the same field the keyboard
|
|
4
|
+
* writes to, at the caret, editable, never sent by itself. Pure, so the state machine is tested without a host.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Paseo's PluginDictation, mirrored: the installed SDK may predate it. */
|
|
8
|
+
export type HostDictationStatus = "idle" | "listening" | "transcribing";
|
|
9
|
+
export type HostDictation = {
|
|
10
|
+
readonly unavailable: { readonly reason: "disconnected" | "not_ready"; readonly message: string | null } | null;
|
|
11
|
+
readonly status: HostDictationStatus;
|
|
12
|
+
readonly volume: number;
|
|
13
|
+
readonly error: string | null;
|
|
14
|
+
start(): Promise<void>;
|
|
15
|
+
stop(): Promise<void>;
|
|
16
|
+
cancel(): Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export type UseHostDictation = (options: { onText(text: string): void }) => HostDictation;
|
|
19
|
+
|
|
20
|
+
/** The host's hook, or null when this Paseo has none: then there is no mic, no hint and no space for one. */
|
|
21
|
+
export function hostDictationHook(client: unknown): UseHostDictation | null {
|
|
22
|
+
const hook = client && typeof client === "object" ? (client as { usePaseoDictation?: unknown }).usePaseoDictation : undefined;
|
|
23
|
+
return typeof hook === "function" ? hook as UseHostDictation : null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type MicState = "unavailable" | "idle" | "listening" | "transcribing";
|
|
27
|
+
export type MicView = {
|
|
28
|
+
state: MicState;
|
|
29
|
+
icon: string;
|
|
30
|
+
/** The button's accessible name and desktop tooltip. */
|
|
31
|
+
label: string;
|
|
32
|
+
/** One line under the field, or null. `tone` colors it. */
|
|
33
|
+
line: string | null;
|
|
34
|
+
tone: "muted" | "live" | "danger";
|
|
35
|
+
/** The button does nothing while the words are being written. */
|
|
36
|
+
disabled: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const DICTATE_KEY = "V";
|
|
40
|
+
|
|
41
|
+
/** What the mic shows. `explain`: the developer pressed an unavailable mic, so it says why (never silently nothing). */
|
|
42
|
+
export function micView(d: Pick<HostDictation, "unavailable" | "status" | "error">, o: { explain?: boolean; key?: boolean } = {}): MicView {
|
|
43
|
+
const k = o.key ? ` (${DICTATE_KEY})` : "";
|
|
44
|
+
if (d.unavailable && d.status === "idle") {
|
|
45
|
+
const why = d.unavailable.reason === "disconnected" ? "the host is offline"
|
|
46
|
+
: d.unavailable.message?.trim() || "set up speech-to-text in Paseo's settings";
|
|
47
|
+
return { state: "unavailable", icon: "MicOff", label: "Dictation isn't available", line: o.explain ? `Can't dictate: ${lower(why)}` : null, tone: "muted", disabled: false };
|
|
48
|
+
}
|
|
49
|
+
if (d.status === "listening") return { state: "listening", icon: "Square", label: `Stop dictating${k}`, line: `Listening · Stop${o.key ? ` (${DICTATE_KEY})` : ""} adds it to your answer`, tone: "live", disabled: false };
|
|
50
|
+
if (d.status === "transcribing") return { state: "transcribing", icon: "Mic", label: "Writing down what you said", line: "Writing it down…", tone: "muted", disabled: true };
|
|
51
|
+
return { state: "idle", icon: "Mic", label: `Dictate${k}`, line: d.error ? `Couldn't dictate: ${denied(d.error) ? "microphone access is blocked. Allow it for Paseo in your settings" : lower(d.error)}` : null, tone: "danger", disabled: false };
|
|
52
|
+
}
|
|
53
|
+
const denied = (error: string) => /permission|denied|not ?allowed/i.test(error);
|
|
54
|
+
const lower = (s: string) => {
|
|
55
|
+
const t = s.trim().replace(/[.\s]+$/, "");
|
|
56
|
+
return /^[A-Z][a-z]/.test(t) ? t[0].toLowerCase() + t.slice(1) : t;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Put dictated text where the caret is (replacing a selection), with one space between it and the words around it,
|
|
61
|
+
* within the field's length limit. Returns the new words and where the caret goes (after the inserted text).
|
|
62
|
+
*/
|
|
63
|
+
export function insertDictated(words: string, text: string, selection?: { start: number; end: number } | null, maxLength = 2000): { words: string; caret: number } {
|
|
64
|
+
const said = text.replace(/\s+/g, " ").trim();
|
|
65
|
+
const start = Math.max(0, Math.min(selection?.start ?? words.length, words.length));
|
|
66
|
+
const end = Math.max(start, Math.min(selection?.end ?? start, words.length));
|
|
67
|
+
if (!said) return { words, caret: end };
|
|
68
|
+
const before = words.slice(0, start); const after = words.slice(end);
|
|
69
|
+
const lead = before && !/\s$/.test(before) ? " " : "";
|
|
70
|
+
const trail = after && !/^[\s.,;:!?)]/.test(after) ? " " : "";
|
|
71
|
+
const room = maxLength - before.length - after.length - lead.length - trail.length;
|
|
72
|
+
if (room <= 0) return { words, caret: end };
|
|
73
|
+
const fit = said.slice(0, room);
|
|
74
|
+
return { words: before + lead + fit + trail + after, caret: before.length + lead.length + fit.length };
|
|
75
|
+
}
|
package/shared/headline.ts
CHANGED
|
@@ -178,6 +178,7 @@ export function workspaceHeadline(items: NeedItem[]): Headline | null {
|
|
|
178
178
|
case "hold": return { key: "blocked", label: "On hold", line: top.detail || top.title, source: "workspace" };
|
|
179
179
|
case "retry": return { key: "blocked", label: "Tasks stuck", line: top.title, source: "workspace" };
|
|
180
180
|
case "capped": return { key: "blocked", label: "Task unchanged", line: top.title, source: "workspace" };
|
|
181
|
+
case "person": return { key: "blocked", label: top.review ? "Waits on reviewer" : "Waits on a person", line: top.title, source: "workspace" };
|
|
181
182
|
case "check": return { key: "blocked", label: "Check PR", line: top.title, source: "workspace" };
|
|
182
183
|
case "message": return { key: "blocked", label: "Message not sent", line: top.title, source: "workspace" };
|
|
183
184
|
case "answer": return top.waiting ? { key: "decision", label: "Send answer", line: top.title, source: "workspace" } : { key: "blocked", label: "Check answer", line: top.title, source: "workspace" };
|
package/shared/model.ts
CHANGED
|
@@ -102,6 +102,12 @@ export const batchSchema = z.object({
|
|
|
102
102
|
refusal: z.object({ reason: z.string(), at: z.string() }).nullable().optional(),
|
|
103
103
|
/** The agent's turn ended without acknowledge_batch; Follow-up settled it from GitHub instead (settleUnacknowledged). */
|
|
104
104
|
unacknowledged: z.boolean().optional(),
|
|
105
|
+
/**
|
|
106
|
+
* The agent acknowledged it blocked with nothing left for an agent: only a person can move what is still open (a
|
|
107
|
+
* reviewer re-reviews or dismisses a stale review, access is granted). Settled completed, and its still-open
|
|
108
|
+
* conditions wait as the developer's held "person" tasks (invariant a-human-only-outcome-is-a-human-item).
|
|
109
|
+
*/
|
|
110
|
+
humanOnly: z.boolean().optional(),
|
|
105
111
|
});
|
|
106
112
|
export const workspaceSchema = z.object({
|
|
107
113
|
id: idSchema, title: textSchema, goal: textSchema, mainAgentId: idSchema,
|
|
@@ -158,8 +164,8 @@ export const workspaceSchema = z.object({
|
|
|
158
164
|
undelivered: z.array(z.object({ id: z.string().max(400), agentId: idSchema, agentTitle: z.string().nullable(), state: z.enum(["queued", "failed"]), reason: z.string().nullable(), since: z.string() })).max(20).optional(),
|
|
159
165
|
/** The main agent's title from Paseo, for "Next message to <title>". Absent: "the main agent". */
|
|
160
166
|
mainAgentTitle: z.string().nullable().optional(),
|
|
161
|
-
/** Open tasks kept out of the next message (reconcile): capped (sent NO_PROGRESS_CAP times unchanged)
|
|
162
|
-
heldTasks: z.array(z.object({ task: taskSchema, held: z.enum(["capped", "manual"]) })).optional(),
|
|
167
|
+
/** Open tasks kept out of the next message (reconcile): capped (sent NO_PROGRESS_CAP times unchanged), manual (Auto off for that task) or person (the agent said only a person can move it: Batch.humanOnly). */
|
|
168
|
+
heldTasks: z.array(z.object({ task: taskSchema, held: z.enum(["capped", "manual", "person"]) })).optional(),
|
|
163
169
|
/** Task keys the developer keeps for themselves: never auto-sent (shared/send-decision.ts). */
|
|
164
170
|
manualTasks: z.array(z.string()).optional(),
|
|
165
171
|
/** Per condition ("<key>:<fingerprint>"), the unacknowledged sends counted when the developer pressed Retry. */
|
package/shared/send-decision.ts
CHANGED
|
@@ -116,3 +116,47 @@ export function settleUnacknowledged(w: Workspace, b: Batch, open: readonly Task
|
|
|
116
116
|
b.result = !still.length ? "The turn ended without an acknowledgment; GitHub no longer shows these, so they're done."
|
|
117
117
|
: `The turn ended without an acknowledgment.${done ? ` ${done} done on GitHub.` : ""}${again ? ` ${again} still open ${again === 1 ? "goes" : "go"} in the next message.` : ""}${capped.length ? ` ${capped.length} sent ${NO_PROGRESS_CAP} times with no change ${capped.length === 1 ? "waits" : "wait"} for you.` : ""}`;
|
|
118
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The agent said only a person can move this condition (Batch.humanOnly) and it is still the same condition: it waits
|
|
122
|
+
* as the developer's held "person" task, never an agent failure and never sent again on its own. A changed condition
|
|
123
|
+
* (a new review, a new head) has a new fingerprint and goes out as usual. Invariant a-human-only-outcome-is-a-human-item.
|
|
124
|
+
*/
|
|
125
|
+
export const personHeld = (w: Pick<Workspace, "batches">, t: Pick<Task, "key" | "fingerprint">) => {
|
|
126
|
+
const id = conditionId(t);
|
|
127
|
+
return w.batches.some(b => b.state === "completed" && !!b.humanOnly && b.tasks.some(x => conditionId(x) === id));
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/** Blocked or unconfirmed: a repair batch whose outcome the developer is shown (Needs you's "The tasks didn't finish"). */
|
|
131
|
+
export const stuckRepair = (b: Pick<Batch, "state" | "tasks">) =>
|
|
132
|
+
["blocked", "uncertain"].includes(b.state) && !recoveryBatch(b) && !(b.tasks.length > 0 && b.tasks.every(t => t.kind === "completion"));
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Whether GitHub's answer for the task's PR is known (a complete snapshot and no read error), or the task isn't about a
|
|
136
|
+
* tracked PR (a task's own state is local). Unknown is not off: a PR GitHub didn't answer for still applies.
|
|
137
|
+
*/
|
|
138
|
+
function conditionKnown(w: Pick<Workspace, "prs">, t: Pick<Task, "kind" | "target">): boolean {
|
|
139
|
+
if (t.kind === "obligation") return true;
|
|
140
|
+
const pr = w.prs.find(p => p.key === t.target);
|
|
141
|
+
return !pr || !!pr.snapshot?.complete && !pr.error;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Whether a stuck repair batch still asks for anything: some task's condition (key and fingerprint) is still open in
|
|
146
|
+
* `open` (server/tasks.ts tasksFor, the PRs as they are now), or its PR's state is unknown. Once nothing applies (every
|
|
147
|
+
* PR merged or closed, the review dismissed or replaced, the checks passing, the conflict gone) the batch settles on its
|
|
148
|
+
* own, the same rule reconcile applies to a queued one. Invariant a-batch-item-leaves-once-nothing-applies.
|
|
149
|
+
*/
|
|
150
|
+
export function stillApplies(w: Pick<Workspace, "prs">, b: Pick<Batch, "tasks">, open: readonly Pick<Task, "key" | "fingerprint">[]): boolean {
|
|
151
|
+
const ids = new Set(open.map(conditionId));
|
|
152
|
+
return b.tasks.some(t => ids.has(conditionId(t)) || !conditionKnown(w, t));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Why a stuck batch that stopped mattering settled, in the developer's words ("No longer needed: #1 merged."). */
|
|
156
|
+
export function mootReason(w: Pick<Workspace, "prs">, b: Pick<Batch, "tasks">): string {
|
|
157
|
+
const prs = [...new Set(b.tasks.map(t => t.target))].map(key => w.prs.find(p => p.key === key)).filter(p => !!p);
|
|
158
|
+
const ended = prs.filter(p => p.snapshot?.state === "MERGED" || p.snapshot?.state === "CLOSED");
|
|
159
|
+
if (prs.length && ended.length === prs.length && ended.length === new Set(b.tasks.map(t => t.target)).size)
|
|
160
|
+
return `No longer needed: ${ended.map(p => `#${p.number} ${p.snapshot!.state === "MERGED" ? "merged" : "closed"}`).join(", ")}.`;
|
|
161
|
+
return "No longer needed: GitHub no longer shows what it asked for.";
|
|
162
|
+
}
|
|
@@ -13,7 +13,7 @@ import { asksForReviewers, liveLine, needsYou, type NeedItem } from "./attention
|
|
|
13
13
|
import { HOME_GROUPS, homeCounts, prChip, trackedGroup, type HomeModel } from "./home";
|
|
14
14
|
import { freshPriorities, type Priority } from "./priorities";
|
|
15
15
|
import { agentCard, automaticHold, batchView, holdSuperseded } from "./status";
|
|
16
|
-
import { conditionId, isCapped, NO_PROGRESS_CAP, sendDecision } from "./send-decision";
|
|
16
|
+
import { conditionId, isCapped, NO_PROGRESS_CAP, personHeld, sendDecision, stuckRepair } from "./send-decision";
|
|
17
17
|
import { messageStrip, obligationDelivery, repairRows } from "./task-rows";
|
|
18
18
|
import { followUpObligations } from "./follow-up";
|
|
19
19
|
import { PRESENCE, claimsWorking, taskStatus } from "./task-status";
|
|
@@ -138,11 +138,32 @@ export const INVARIANTS: Invariant[] = [
|
|
|
138
138
|
for (const h of w.heldTasks ?? []) {
|
|
139
139
|
if (h.held === "capped" && !isCapped(w, h.task)) return `${h.task.key} is held as capped below ${NO_PROGRESS_CAP} sends`;
|
|
140
140
|
if (h.held === "manual" && !(w.manualTasks ?? []).includes(h.task.key)) return `${h.task.key} is held as manual without the developer's choice`;
|
|
141
|
+
if (h.held === "person" && !personHeld(w, h.task)) return `${h.task.key} is held for a person without the agent's human-only outcome`;
|
|
141
142
|
if (pending?.tasks.some(t => conditionId(t) === conditionId(h.task))) return `${h.task.key} is held and in the next message`;
|
|
142
143
|
}
|
|
143
144
|
return null;
|
|
144
145
|
},
|
|
145
146
|
},
|
|
147
|
+
{
|
|
148
|
+
id: "a-batch-item-leaves-once-nothing-applies",
|
|
149
|
+
why: "2026-11-18 (2.2.0): a repair batch the agent acknowledged blocked stayed in Needs you as \"The tasks didn't finish\" two hours after its only PR merged; a stuck batch never re-checked what it asked for, while a queued one did. A stuck batch settles once nothing it asked for still applies (every PR merged or closed, or each condition gone).",
|
|
150
|
+
check(w) {
|
|
151
|
+
if (!w.enable_tracking || w.archived) return null;
|
|
152
|
+
const ended = (key: string) => { const p = w.prs.find(p => p.key === key); return !!p && !p.error && !!p.snapshot?.complete && (p.snapshot.state === "MERGED" || p.snapshot.state === "CLOSED"); };
|
|
153
|
+
const moot = w.batches.find(b => stuckRepair(b) && b.tasks.every(t => t.kind !== "obligation" && ended(t.target)));
|
|
154
|
+
return moot ? `${moot.id} is ${moot.state} though every PR it was about has merged or closed` : null;
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: "a-human-only-outcome-is-a-human-item",
|
|
159
|
+
why: "2026-11-18 (2.2.0): the agent reported \"nothing for an agent to fix; needs the reviewer to re-review or dismiss\" and Needs you showed it as an agent failure (\"The tasks didn't finish\", Open main agent). Only a person can move it, so it is the developer's PR item, never a stuck batch.",
|
|
160
|
+
check(w, now) {
|
|
161
|
+
const stuck = w.batches.find(b => b.humanOnly && b.state !== "completed");
|
|
162
|
+
if (stuck) return `${stuck.id} is human-only but ${stuck.state}`;
|
|
163
|
+
const retry = needsYou(w, now).find(i => i.kind === "retry" && w.batches.find(b => b.id === i.batchId)?.humanOnly);
|
|
164
|
+
return retry ? `${retry.key} shows a human-only outcome as an agent failure` : null;
|
|
165
|
+
},
|
|
166
|
+
},
|
|
146
167
|
{
|
|
147
168
|
id: "no-sends-when-idle-claim", why: "2026-11-10 wks_4b27f268: \"sends when the agent is idle\" while the agent was idle and nothing would send",
|
|
148
169
|
check: (w, now) => lines(w, now).find(l => /sends when the agent is idle/i.test(l)) ?? null,
|
package/shared/task-rows.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { sendDecision } from "./send-decision";
|
|
|
19
19
|
export const REPAIR_KINDS: readonly Task["kind"][] = ["conflict", "review", "checks", "restack"];
|
|
20
20
|
export const isRepair = (t: Pick<Task, "kind">) => REPAIR_KINDS.includes(t.kind);
|
|
21
21
|
|
|
22
|
-
export type RepairState = "queued" | "sent" | "capped" | "manual" | "done";
|
|
22
|
+
export type RepairState = "queued" | "sent" | "capped" | "manual" | "person" | "done";
|
|
23
23
|
export type RepairRow = {
|
|
24
24
|
task: Task;
|
|
25
25
|
state: RepairState;
|
|
@@ -84,14 +84,14 @@ export function repairRows(w: Workspace, doneLimit = 20): { open: RepairRow[]; d
|
|
|
84
84
|
const add = (task: Task, state: RepairState, text: string) => { if (!isRepair(task) || seen.has(task.key)) return; seen.add(task.key); open.push({ task, state, text, pr: prOf(task) }); };
|
|
85
85
|
for (const t of sentMessage(w)?.tasks ?? []) add(t, "sent", "Sent");
|
|
86
86
|
for (const t of pendingMessage(w)?.tasks ?? []) add(t, "queued", "Queued");
|
|
87
|
-
for (const h of w.heldTasks ?? []) add(h.task, h.held, h.held === "capped" ? "Needs you · sent twice, no change on GitHub" : "Auto off · stays with you");
|
|
87
|
+
for (const h of w.heldTasks ?? []) add(h.task, h.held, h.held === "capped" ? "Needs you · sent twice, no change on GitHub" : h.held === "person" ? "Needs you · waits on a person, not the agent" : "Auto off · stays with you");
|
|
88
88
|
const done: RepairRow[] = [];
|
|
89
89
|
// Newest settled message first; a task key still open (another fingerprint) isn't done.
|
|
90
90
|
const settled = w.batches.filter(b => b.state === "completed" && b.sentAt && message(b)).sort((a, b) => Date.parse(b.settledAt ?? b.sentAt!) - Date.parse(a.settledAt ?? a.sentAt!));
|
|
91
91
|
for (const b of settled) for (const t of b.tasks) {
|
|
92
92
|
if (!isRepair(t) || seen.has(t.key) || done.length >= doneLimit) continue;
|
|
93
93
|
seen.add(t.key);
|
|
94
|
-
done.push({ task: t, state: "done", text: b.unacknowledged ? "Done · resolved on GitHub" : `Done · ${agent(w)} finished it`, at: b.settledAt, pr: prOf(t) });
|
|
94
|
+
done.push({ task: t, state: "done", text: b.unacknowledged || b.humanOnly ? "Done · resolved on GitHub" : `Done · ${agent(w)} finished it`, at: b.settledAt, pr: prOf(t) });
|
|
95
95
|
}
|
|
96
96
|
return { open, done };
|
|
97
97
|
}
|