paseo-follow-up 2.2.0 → 2.2.1-beta.1
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/home.tsx +26 -1
- package/client/needs-you.tsx +12 -2
- package/client/questions.tsx +12 -3
- package/client/tasks.tsx +8 -5
- package/docs/screenshots/follow-up-questions.png +0 -0
- package/docs/screenshots/follow-up-setup.png +0 -0
- package/index.server.ts +4 -2
- package/package.json +1 -1
- package/server/agent-actions.ts +5 -2
- package/server/agent-hook.mjs +1 -1
- package/server/daemon.ts +28 -13
- package/server/engine.ts +53 -11
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +4 -4
- package/server/mcp.mjs +4 -4
- package/shared/activity.ts +3 -1
- package/shared/attention.ts +28 -4
- 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 +18 -3
- package/shared/send-decision.ts +82 -4
- package/shared/status-invariants.ts +38 -3
- 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/home.tsx
CHANGED
|
@@ -137,7 +137,7 @@ function HomeBody(props: PluginScreenProps & { deps: HomeDeps; onboarding: Onboa
|
|
|
137
137
|
try {
|
|
138
138
|
const after = await send({ workspaceId: s.workspaceId, batchId: s.sendNow.batchId });
|
|
139
139
|
const b = after.batches.find(x => x.id === s.sendNow!.batchId);
|
|
140
|
-
toast.show(!b || ["sent", "sending", "completed"].includes(b.state) ? `Sent to ${s.title}` : b.result || "Queued. It goes out when the agent is free.", { variant: !b || ["sent", "sending", "completed"].includes(b.state) ? "success" : "info" });
|
|
140
|
+
toast.show(!b || ["sent", "sending", "completed"].includes(b.state) ? `Sent to ${s.title}` : b.result || "Queued. It goes out when the main agent is free.", { variant: !b || ["sent", "sending", "completed"].includes(b.state) ? "success" : "info" });
|
|
141
141
|
} catch (e) { toast.error(errorText(e)); } finally { deps.sources.live.refresh(); }
|
|
142
142
|
}, [send, toast, deps.sources.live]);
|
|
143
143
|
// The omnibox's "Ask the Overseer" row: send, then show the conversation it lands in.
|
|
@@ -368,6 +368,30 @@ function useTail(handle: ReturnType<typeof useAgentLive>["handle"], key: string,
|
|
|
368
368
|
return { steps, error, seenAt, asleep, loading, woken: wake > 0, load: () => setWake(n => n + 1) };
|
|
369
369
|
}
|
|
370
370
|
|
|
371
|
+
/**
|
|
372
|
+
* Send now under a queued message's line in the detail pane: phones list Sending rows without it (dense rows), so this
|
|
373
|
+
* is where a phone sends a waiting repair (a-repair-goes-to-a-free-main-agent). The same Send as the row's and the
|
|
374
|
+
* Tasks strip's: taken while the main agent is busy, it goes the moment the main agent is free.
|
|
375
|
+
*/
|
|
376
|
+
function DetailSendNow({ s, theme, compact, deps }: { s: Workstream; theme: Theme; compact: boolean; deps: HomeDeps }) {
|
|
377
|
+
const send = useRpc(sendRpc); const toast = useToast();
|
|
378
|
+
const [busy, setBusy] = useState(false);
|
|
379
|
+
const n = s.sendNow!.count;
|
|
380
|
+
const press = async () => {
|
|
381
|
+
if (!s.workspaceId || !s.sendNow) return;
|
|
382
|
+
setBusy(true);
|
|
383
|
+
try {
|
|
384
|
+
const after = await send({ workspaceId: s.workspaceId, batchId: s.sendNow.batchId });
|
|
385
|
+
const b = after.batches.find(x => x.id === s.sendNow!.batchId);
|
|
386
|
+
const out = !b || ["sent", "sending", "completed"].includes(b.state);
|
|
387
|
+
toast.show(out ? `Sent to ${s.title}` : b.result || "Queued. It goes out when the main agent is free.", { variant: out ? "success" : "info" });
|
|
388
|
+
} catch (e) { toast.error(errorText(e)); } finally { setBusy(false); deps.sources.live.refresh(); }
|
|
389
|
+
};
|
|
390
|
+
return <View style={{ flexDirection: "row" }}>
|
|
391
|
+
<Button theme={theme} compact={compact} kind="secondary" title="Send now" accessibilityLabel={`Send ${n} task${n === 1 ? "" : "s"} to ${s.title} now`} loading={busy} disabled={busy} onPress={() => void press()} />
|
|
392
|
+
</View>;
|
|
393
|
+
}
|
|
394
|
+
|
|
371
395
|
function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask, onBack }: {
|
|
372
396
|
s: Workstream; model: HomeModel; theme: Theme; compact: boolean; deps: HomeDeps;
|
|
373
397
|
openFull: (s: Workstream) => void; signOffNext: (s: Workstream) => void; onBack?: () => void;
|
|
@@ -556,6 +580,7 @@ function DetailPane({ s, model, theme, compact, deps, openFull, signOffNext, ask
|
|
|
556
580
|
: echoed || (b && compact && b.source === "none" && asks.length) ? null
|
|
557
581
|
: row?.needs && !agent.permissions.length && !b ? <Text style={compact ? t.ask : [t.body, { fontSize: 15, lineHeight: 21, fontWeight: "600" }]}>{s.line || s.word || "Needs you"}</Text>
|
|
558
582
|
: !row?.needs && s.line ? <Text style={t.body}>{s.line}</Text> : null}
|
|
583
|
+
{!row?.needs && s.sendNow && <DetailSendNow s={s} theme={theme} compact={compact} deps={deps} />}
|
|
559
584
|
{w && <NeedsYouBlock workspace={w} theme={theme} compact={compact} now={Date.now()} style={{ marginHorizontal: 0, marginTop: 0 }}
|
|
560
585
|
brief={inBlock ? b : null} briefCard={inBlock && <BriefCard {...({ embedded: true, bare: true, item: { data: b }, theme, layout: { compact }, agentId: s.agentId, deps: deps.briefDeps } as unknown as Parameters<typeof BriefCard>[0])} />}
|
|
561
586
|
actions={{ openPr: (key, intent) => setSheet({ key, intent }), openQuestion: setQuestion, openAgent: () => openFull(s) }} />}
|
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
|
@@ -169,14 +169,16 @@ function StripRow({ strip, w, theme, compact, onPreview, openAgent }: { strip: M
|
|
|
169
169
|
try {
|
|
170
170
|
const result = await send({ workspaceId: w.id, batchId: strip.batchId });
|
|
171
171
|
const b = result.batches.find(x => x.id === strip.batchId);
|
|
172
|
-
toast.show(!b || ["sent", "sending", "completed"].includes(b.state) ? `Sent to ${strip.to}` : b.state === "pending" ? "Queued. It goes out when the agent is free." : b.result || "The message couldn't be sent.", { variant: !b || ["sent", "sending", "completed"].includes(b.state) ? "success" : "info" });
|
|
172
|
+
toast.show(!b || ["sent", "sending", "completed"].includes(b.state) ? `Sent to ${strip.to}` : b.state === "pending" ? "Queued. It goes out when the main agent is free." : b.result || "The message couldn't be sent.", { variant: !b || ["sent", "sending", "completed"].includes(b.state) ? "success" : "info" });
|
|
173
173
|
} catch (error) { toast.error(error instanceof Error ? error.message : "The message couldn't be sent."); }
|
|
174
174
|
finally { setBusy(false); void cache.invalidateQueries(); }
|
|
175
175
|
};
|
|
176
|
-
|
|
176
|
+
// The why is the point of the row (a-repair-goes-to-a-free-main-agent): it keeps a readable width, and the buttons
|
|
177
|
+
// wrap under it in a narrow panel instead of squeezing it into a column.
|
|
178
|
+
return <View accessibilityRole="summary" style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8, rowGap: 8, paddingHorizontal: compact ? 14 : 12, paddingVertical: compact ? 12 : 8, borderTopWidth: 1, borderTopColor: c.border, backgroundColor: c.surface1 }}>
|
|
177
179
|
<Icon name="Send" size={13} color={c.foregroundMuted} />
|
|
178
|
-
<Text style={[t.meta, {
|
|
179
|
-
<View style={{ flexDirection: "row", gap: 8, marginLeft:
|
|
180
|
+
<Text style={[t.meta, { flexGrow: 1, flexShrink: 1, flexBasis: compact ? "80%" : 240, minWidth: 0 }]}><Text style={{ color: c.foreground, fontWeight: "500" }}>{line.lead}</Text>{line.rest}</Text>
|
|
181
|
+
<View style={{ flexDirection: "row", gap: 8, marginLeft: "auto" }}>
|
|
180
182
|
{strip.phase === "queued" && <Button theme={theme} compact={compact} title="Preview" accessibilityLabel={`Preview the next message to ${strip.to}`} onPress={onPreview} />}
|
|
181
183
|
{strip.phase === "queued" && strip.sendNow && <Button theme={theme} compact={compact} title="Send now" accessibilityLabel={`Send ${tasks(strip.count)} to ${strip.to} now`} loading={busy} disabled={busy} onPress={() => void sendNow()} />}
|
|
182
184
|
{strip.phase === "sent" && openAgent && <Button theme={theme} compact={compact} title="Open agent" accessibilityLabel={`Open ${strip.to}`} onPress={() => openAgent(strip.recipientId)} />}
|
|
@@ -207,6 +209,7 @@ const chipColor = (r: RepairRow, c: Colors) => r.state === "done" ? c.foreground
|
|
|
207
209
|
function RepairGlyph({ row, w, colors }: { row: RepairRow; w: Workspace; colors: Colors }) {
|
|
208
210
|
if (row.state === "done") return <Icon name="Check" size={14} color={colors.statusSuccess} />;
|
|
209
211
|
if (row.state === "capped") return <Icon name="CircleAlert" size={14} color={colors.statusWarning} />;
|
|
212
|
+
if (row.state === "person") return <Icon name="UserRound" size={14} color={colors.statusWarning} />;
|
|
210
213
|
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
214
|
return <DeliveryGlyph state={row.state} w={w} colors={colors} />;
|
|
212
215
|
}
|
|
@@ -223,7 +226,7 @@ function RepairTaskRow({ row, w, theme, compact, onOpen, hit }: { row: RepairRow
|
|
|
223
226
|
: <RichText plain numberOfLines={3} style={[t.body, row.state === "done" ? { color: c.foregroundMuted } : null]}>{repairTitle(row)}</RichText>}
|
|
224
227
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
|
|
225
228
|
<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>
|
|
229
|
+
<Text style={[t.meta, row.state === "capped" || row.state === "person" ? { color: c.statusWarning } : null, { fontVariant: ["tabular-nums"] }]}>{label}</Text>
|
|
227
230
|
</View>
|
|
228
231
|
</View>
|
|
229
232
|
<View style={{ paddingTop: 2 }}><Icon name="ChevronRight" size={14} color={c.foregroundMuted} /></View>
|
|
Binary file
|
|
Binary file
|
package/index.server.ts
CHANGED
|
@@ -196,6 +196,8 @@ export default function contribute(server: PluginServerContext) {
|
|
|
196
196
|
// Settings → Agents: which agent each special role uses, in agents.json (defaults when absent).
|
|
197
197
|
const agentSettings = new AgentSettingsStore(directory);
|
|
198
198
|
gateway.recoveryRole = () => agentSettings.role("recovery");
|
|
199
|
+
// The main agent's own background job holds its repairs only while Wait for background jobs is on (Q96 = A).
|
|
200
|
+
gateway.waitForJobs = () => agentSettings.waitEnabled();
|
|
199
201
|
const graphite = new Graphite();
|
|
200
202
|
const github = new Github(undefined, graphite, new Deployments(undefined, undefined, undefined, undefined, repo => prWorkflow.current().repos[repoKey(repo)]?.deploy));
|
|
201
203
|
github.workflow = repo => prWorkflow.workflow(repo);
|
|
@@ -805,10 +807,10 @@ export default function contribute(server: PluginServerContext) {
|
|
|
805
807
|
});
|
|
806
808
|
handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }, context) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action, actorOf(context)); });
|
|
807
809
|
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 }) => {
|
|
810
|
+
handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result, humanOnly }, { paseo }) => {
|
|
809
811
|
await requireReady();
|
|
810
812
|
const agent = (await paseo.agents.ref(agentId).refresh())?.agent;
|
|
811
|
-
try { return await engine.acknowledge(agentId, batchId, outcome, result, await callerWorkspaceId(agentId, paseo)); }
|
|
813
|
+
try { return await engine.acknowledge(agentId, batchId, outcome, result, await callerWorkspaceId(agentId, paseo), humanOnly); }
|
|
812
814
|
catch (error) {
|
|
813
815
|
if (agent?.workspaceId) await store.mutate(state => {
|
|
814
816
|
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.
|
|
4
|
+
"version": "2.2.1-beta.1",
|
|
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/daemon.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { readSharedJson } from "./shared-file";
|
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
10
|
import type { Workspace, Batch } from "../shared/model";
|
|
11
11
|
import type { Gateway, Runtime } from "./engine";
|
|
12
|
+
import { MAIN_WAIT, QUIET_WAIT, repairWait } from "../shared/send-decision";
|
|
12
13
|
import type { State } from "../shared/model";
|
|
13
14
|
import { defaultTracking, followsEvery, optedOut, projectSetting, type Project } from "../shared/settings";
|
|
14
15
|
import { recoveryHandoff } from "./recovery-handoff";
|
|
@@ -480,6 +481,9 @@ export class PaseoGateway implements Gateway {
|
|
|
480
481
|
*/
|
|
481
482
|
/** A new engine tick: sends re-list agents at most once in it (a-send-lists-agents-at-most-once-per-tick). */
|
|
482
483
|
tickStarted(): void { this.directory.tickStarted(); }
|
|
484
|
+
/** Settings → Agents → Wait for background jobs (index.server.ts sets it). Unset or unreadable: on (Unknown is not off). */
|
|
485
|
+
waitForJobs?: () => Promise<boolean>;
|
|
486
|
+
private async waitsForJobs(): Promise<boolean> { try { return (await this.waitForJobs?.()) ?? true; } catch { return true; } }
|
|
483
487
|
async observe(w: Workspace, fresh = false): Promise<Runtime> {
|
|
484
488
|
const [rows, compacting, pauses] = await Promise.all([this.directory.read(fresh ? { fresh: "agents" } : {}), this.compacting(w.mainAgentId), this.guard.read()]);
|
|
485
489
|
const { agents, workspaces } = rows;
|
|
@@ -500,29 +504,37 @@ export class PaseoGateway implements Gateway {
|
|
|
500
504
|
const guarded = this.guard.waiting(pauses, { agentIds: [w.mainAgentId, ...scoped.map(agent => agent.id)], workspaceId: w.id, excludedAgentIds: [...recoveryIds].filter((id): id is string => !!id) });
|
|
501
505
|
const guardedInterruptionId = this.guard.ownsInterruption(pauses, w.mainAgentId, w.interruption)?.id;
|
|
502
506
|
const context = { guardedInterruptionId, mainTurnId: turnIdOf(a.activeTurn), mainTitle: a.title?.trim() || null };
|
|
503
|
-
if (guarded || !pauses && workspace.labels?.some(label => /^(Paused|Paused by Session Guard)$/i.test(label))) return { taskAgents, ...context, guarded: true, busy: false, reason: "Waiting for Session Guard to resume this workspace", archived: false };
|
|
504
|
-
if (compacting) return { taskAgents, busy: true, reason: "Smart Session is compacting the main agent", archived: false };
|
|
507
|
+
if (guarded || !pauses && workspace.labels?.some(label => /^(Paused|Paused by Session Guard)$/i.test(label))) return { taskAgents, ...context, guarded: true, busy: false, mainBusy: "guard", reason: "Waiting for Session Guard to resume this workspace", archived: false };
|
|
508
|
+
if (compacting) return { taskAgents, busy: true, mainBusy: "compacting", reason: "Smart Session is compacting the main agent", archived: false };
|
|
505
509
|
const mainLoaded = isLoaded(a), mainRecent = recentlyUsed(a, this.windowMs, this.now());
|
|
506
510
|
if (conversationGone(a.lastError)) return { taskAgents, busy: false, reason: a.lastError ?? "Conversation not found", archived: false, gone: a.lastError ?? "Conversation not found", mainLoaded, mainRecent };
|
|
507
|
-
if (a.pendingPermissions.length || a.status === "error") return { taskAgents, busy: false, reason: a.status === "error" ? "Main agent needs recovery" : "Main agent is waiting for a permission or answer", archived: false };
|
|
508
|
-
|
|
511
|
+
if (a.pendingPermissions.length || a.status === "error") return { taskAgents, busy: false, ...(a.status === "error" ? {} : { mainBusy: "permission" as const }), reason: a.status === "error" ? "Main agent needs recovery" : "Main agent is waiting for a permission or answer", archived: false };
|
|
512
|
+
// One busy computation, two scopes (Q96 = A, a-repair-goes-to-a-free-main-agent). `busy` and `backgroundBusy` are the
|
|
513
|
+
// whole workspace: Done, a sent message's turn, "all work finished". `mainBusy` is the main agent's own work, and only
|
|
514
|
+
// it holds a repair: its turn, and its own background job while Wait for background jobs is on. Another agent in the
|
|
515
|
+
// workspace (a subagent the main agent started) and provider subagents never hold a repair. 2026-11-18: a repair sat
|
|
516
|
+
// pending over two hours while the main agent was idle and a subagent it started ran one task after another.
|
|
517
|
+
let busy = false; let backgroundBusy = false; let mainBusy: "turn" | "jobs" | null = null;
|
|
509
518
|
const members = here.filter(agent => !recoveryIds.has(agent.id) && !isRecovery(agent.labels));
|
|
510
519
|
for (const agent of members) {
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
520
|
+
const main = agent.id === w.mainAgentId;
|
|
521
|
+
if (["running", "initializing"].includes(agent.status)) { busy = true; if (main) mainBusy = "turn"; else backgroundBusy = true; }
|
|
522
|
+
// 0.16: work an agent started and ended its turn on (a shell, a task) is still work: no Done yet, and the main
|
|
523
|
+
// agent's own job holds its repairs while Wait for background jobs is on.
|
|
524
|
+
else if (backgroundCount(agent) > 0) { backgroundBusy = true; if (main && await this.waitsForJobs()) mainBusy = "jobs"; }
|
|
514
525
|
}
|
|
515
|
-
// Subagents only decide
|
|
516
|
-
//
|
|
517
|
-
const
|
|
518
|
-
|
|
526
|
+
// Subagents only decide the whole workspace's quiet: Done, a sent message's turn, and the Done check's send (a fresh
|
|
527
|
+
// read). Repairs never wait for them (Q96 = A), so a queued repair, or its send, never lists subagents (2026-11-12).
|
|
528
|
+
const doneCheckGoing = (b: Workspace["batches"][number]) => fresh && ["pending", "sending"].includes(b.state) && b.tasks.some(t => t.kind === "completion");
|
|
529
|
+
// A Done declaration is waiting to be accepted: Done needs the whole workspace quiet, subagents included.
|
|
530
|
+
const subagentsMatter = !!w.completion || !!w.declaration || w.batches.some(b => !b.tasks.every(t => t.kind === "inventory") && (b.state === "sent" || doneCheckGoing(b)));
|
|
519
531
|
const idleLoaded = members.filter(agent => isLoaded(agent) && !["running", "initializing"].includes(agent.status));
|
|
520
532
|
if (subagentsMatter && !backgroundBusy && idleLoaded.length) await this.connect(async client => {
|
|
521
533
|
for (const listed of idleLoaded) {
|
|
522
534
|
if (await subagentsRunning(client, listed, "Subagent observation unavailable", this.directory)) { busy = true; backgroundBusy = true; break; }
|
|
523
535
|
}
|
|
524
536
|
});
|
|
525
|
-
return { taskAgents, ...context, busy, reason: null, archived: false, backgroundBusy, mainLoaded, mainRecent };
|
|
537
|
+
return { taskAgents, ...context, busy, reason: null, archived: false, backgroundBusy, mainBusy, mainLoaded, mainRecent };
|
|
526
538
|
}
|
|
527
539
|
async recoveryRuntime(w: Workspace, batch: Batch): Promise<{ busy: boolean; reason: string | null }> {
|
|
528
540
|
return this.connect(async client => {
|
|
@@ -551,7 +563,10 @@ export class PaseoGateway implements Gateway {
|
|
|
551
563
|
// The dispatch observed fresh this tick; this re-check reads the same tick's list (a-send-lists-agents-at-most-once-per-tick).
|
|
552
564
|
try { runtime = await this.observe(w, true); }
|
|
553
565
|
catch { throw new DeliveryDeferred("Agent or Session Guard state is unavailable; follow-up will wait and retry."); }
|
|
554
|
-
|
|
566
|
+
// A repair waits only for the main agent itself (Q96 = A); the Done check for the whole workspace to be quiet.
|
|
567
|
+
const main = repairWait(runtime);
|
|
568
|
+
const holds = batch.tasks.some(t => t.kind === "completion") ? (runtime.busy || runtime.backgroundBusy ? QUIET_WAIT : null) : main && MAIN_WAIT[main];
|
|
569
|
+
if (holds || runtime.reason || runtime.archived) throw new DeliveryDeferred(holds || runtime.reason || "The workspace was archived.");
|
|
555
570
|
}
|
|
556
571
|
await this.connect(async client => {
|
|
557
572
|
const recipient = batch.recipientAgentId ?? w.mainAgentId;
|