paseo-follow-up 2.1.0-beta.4 → 2.1.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/brief.tsx +12 -7
- package/client/chat.tsx +15 -6
- package/client/needs-you.tsx +25 -7
- package/client/questions.tsx +21 -15
- package/client/report-issue.tsx +2 -2
- package/client/spec.tsx +1 -1
- package/index.server.ts +92 -15
- package/package.json +1 -1
- package/server/agent-actions.ts +1 -1
- package/server/agent-hook.mjs +7 -2
- package/server/agent-parity.ts +5 -0
- package/server/daemon.ts +86 -32
- package/server/engine.ts +212 -122
- package/server/hook-source.ts +7 -2
- package/server/inbox.ts +64 -64
- package/server/linked.ts +28 -6
- package/server/local-titles.ts +67 -0
- package/server/mcp-source.ts +4 -2
- package/server/mcp.mjs +4 -2
- package/server/message-queue.ts +384 -0
- package/server/overseer.ts +12 -3
- package/server/questions.ts +4 -2
- package/server/report-send.ts +3 -2
- package/server/spec.ts +18 -29
- package/server/store.ts +9 -2
- package/server/teardown.ts +7 -1
- package/server/transcript-titles.ts +165 -0
- package/shared/about.ts +1 -0
- package/shared/attention.ts +12 -3
- package/shared/brief.ts +2 -3
- package/shared/chat.ts +1 -1
- package/shared/contracts.ts +5 -1
- package/shared/headline.ts +1 -0
- package/shared/linked-display.ts +6 -1
- package/shared/linked.ts +2 -2
- package/shared/local-titles.ts +68 -0
- package/shared/model.ts +6 -0
- package/shared/overseer.ts +3 -0
- package/shared/questions.ts +35 -7
- package/shared/queue.ts +173 -0
- package/shared/spec.ts +1 -0
- package/shared/status-invariants.ts +22 -0
package/client/brief.tsx
CHANGED
|
@@ -4,8 +4,9 @@ import { Platform, View, useWindowDimensions } from "react-native";
|
|
|
4
4
|
import { Pressable, Text } from "./text";
|
|
5
5
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
6
|
import { openExternalUrl, useRpc, type PluginClientContext, type PluginTimelineItemProps } from "@getpaseo/plugin/client";
|
|
7
|
+
import { deliveryStatus } from "../shared/queue";
|
|
7
8
|
import { Icon, TextInput, copyText, useToast } from "@getpaseo/plugin/client/ui";
|
|
8
|
-
import { BRIEF_KIND, BRIEF_VERSION, askedDecisions, cardPicks, notedCount, pickedCount, briefSchema, collapsedLine, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId,
|
|
9
|
+
import { BRIEF_KIND, BRIEF_VERSION, askedDecisions, cardPicks, notedCount, pickedCount, briefSchema, collapsedLine, extrasFit, hasOriginal, nothingNeededLine, isTight, pastRows, pastTone, selectsFirst, sendBar, shownBrief, pastAsk, liveBrief, newAnswerId, type Brief, type BriefDecision, type BriefMove } from "../shared/brief";
|
|
9
10
|
import { age } from "../shared/inbox";
|
|
10
11
|
import { noReviewReposVersion, onNoReviewRepos } from "../shared/pr-workflow";
|
|
11
12
|
import { briefKey, HEADLINE_WORD } from "../shared/headline";
|
|
@@ -287,17 +288,21 @@ function Past({ b, c, now, compact, height, pending = false, onResend, resending
|
|
|
287
288
|
const picked = answered && asked.some(d => d.chosen);
|
|
288
289
|
// The answer is recorded the moment Send is pressed; getting it to the agent can take Paseo a minute or more (a dormant
|
|
289
290
|
// agent resumes first). Until it lands the card reads as in progress, and if every retry failed it says so with Send again.
|
|
290
|
-
|
|
291
|
+
// The message queue's state, worded as on every card (shared/queue.ts deliveryStatus).
|
|
292
|
+
const delivery = b.delivery ? deliveryStatus({ state: b.delivery.state, reason: b.delivery.error, nextAt: b.delivery.nextAt }) : null;
|
|
293
|
+
const sending = pending || !!delivery?.pending || unsent;
|
|
291
294
|
const failed = b.delivery?.state === "failed";
|
|
295
|
+
const cancelled = b.delivery?.state === "cancelled";
|
|
292
296
|
// Pending reads as in progress (a dashed circle), and becomes the solid check when the send lands.
|
|
293
297
|
const icon = b.state === "superseded" ? "History" : failed ? "CircleAlert" : sending ? "CircleDashed" : "CircleCheck";
|
|
294
298
|
const spoken = pending ? `Done, sending (undo available): ${ask}` : unsent ? `${status!.label}: ${ask}` : failed ? `Answer not delivered: ${ask}` : sending ? `Answered, sending to the agent: ${ask}` : undefined;
|
|
295
|
-
const color = failed ? c.
|
|
299
|
+
const color = failed ? c.statusWarning : pastTone(b.state, sending) === "success" ? c.statusSuccess : c.foregroundMuted;
|
|
296
300
|
// A Done card already says "Done" as its outcome; its time stands alone rather than repeating it.
|
|
297
|
-
const right =
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
+
const right = delivery && !pending ? delivery.label : unsent ? status!.label : answered && b.outcomeAt ? (b.outcome === "Done" ? clock(b.outcomeAt) : `Answered ${clock(b.outcomeAt)}`) : age(b.outcomeAt ?? b.at, now);
|
|
302
|
+
// Failed (the rare loud case) says so with Retry; a timer's wait (Queued, Retrying) offers Try now; Cancelled says why.
|
|
303
|
+
const undelivered = (indent: number) => delivery && !pending && (failed || cancelled || delivery.action === "try-now") && <View style={{ paddingLeft: indent, gap: 8, alignItems: "flex-start" }}>
|
|
304
|
+
<Text accessibilityRole={failed ? "alert" : undefined} style={{ color: failed ? c.statusWarning : c.foregroundMuted, fontSize: 13, lineHeight: 18 }}>{failed ? `${delivery.detail} Your answer is kept.` : delivery.detail}</Text>
|
|
305
|
+
{onResend && delivery.action && <Btn label={resending ? "Sending…" : delivery.action === "retry" ? "Retry" : "Try now"} icon="RotateCcw" primary={delivery.action === "retry"} onPress={onResend} disabled={resending} c={c} compact={compact} hint={delivery.action === "retry" ? "Sends the same answer again" : "Tries sending it now"} />}
|
|
301
306
|
</View>;
|
|
302
307
|
const body = expanded && <View style={{ gap: 10, paddingTop: 4 }}>
|
|
303
308
|
<BriefBody b={b} c={c} compact={compact} tight={false} embedded height={height} mode="readonly" picks={{}} onPick={() => undefined} busy={null} />
|
package/client/chat.tsx
CHANGED
|
@@ -5,6 +5,7 @@ import type { PluginClientContext, PluginTimelineItemProps } from "@getpaseo/plu
|
|
|
5
5
|
import { Icon, ScrollView } from "@getpaseo/plugin/client/ui";
|
|
6
6
|
import { answerCardSchema, answerCardWhose, batchCardSchema, createMomentLedger, followTimelineItem, parseBatchPrompt, toolRowSchema, type AnswerCard, type BatchCard, type ToolRow } from "../shared/chat";
|
|
7
7
|
import { parseAnswerMessage, parseAnswersMessage } from "../shared/questions";
|
|
8
|
+
import { envelopeParts } from "../shared/queue";
|
|
8
9
|
import { CREATED_KIND, CREATED_VERSION, createdCard } from "../shared/created";
|
|
9
10
|
import { timelineSupported } from "./created";
|
|
10
11
|
import { unconfirmedNote, unconfirmedRefs } from "../shared/status";
|
|
@@ -138,6 +139,16 @@ function AnswerCardView({ item, theme }: PluginTimelineItemProps<AnswerCard>) {
|
|
|
138
139
|
</View>;
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
/** One Follow-up part of a user message as its chat card: an answer (one or several decisions) or a repair batch. */
|
|
143
|
+
function promptCard(text: string) {
|
|
144
|
+
const several = parseAnswersMessage(text);
|
|
145
|
+
if (several) return { type: "plugin" as const, kind: ANSWER_KIND, version: 1, data: { id: several.answers.map(a => a.id).join(", "), title: several.title, choice: "", label: null, words: null, text, answers: several.answers } as Record<string, unknown> };
|
|
146
|
+
const answer = parseAnswerMessage(text);
|
|
147
|
+
if (answer) return { type: "plugin" as const, kind: ANSWER_KIND, version: 1, data: { ...answer, text } as Record<string, unknown> };
|
|
148
|
+
const card = parseBatchPrompt(text);
|
|
149
|
+
return card ? { type: "plugin" as const, kind: BATCH_KIND, version: 1, data: card as Record<string, unknown> } : null;
|
|
150
|
+
}
|
|
151
|
+
|
|
141
152
|
export function contributeChat(client: PluginClientContext) {
|
|
142
153
|
// A host whose client API has no timeline transformers or renderers keeps every plain row.
|
|
143
154
|
if (!timelineSupported(client)) return () => {};
|
|
@@ -159,12 +170,10 @@ export function contributeChat(client: PluginClientContext) {
|
|
|
159
170
|
client.addTimelineTransformer({
|
|
160
171
|
id: "follow-batch-prompts", query: { itemType: "user_message" },
|
|
161
172
|
transform({ item }) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
const card = parseBatchPrompt(item.text);
|
|
167
|
-
return card ? { items: [{ type: "plugin" as const, kind: BATCH_KIND, version: 1, data: card }] } : undefined;
|
|
173
|
+
// One message can carry several parts (an answer and the repairs that rode along, shared/queue.ts): a card each,
|
|
174
|
+
// in order. A part no card recognises keeps the whole message as Paseo's plain row.
|
|
175
|
+
const cards = envelopeParts(item.text).map(promptCard);
|
|
176
|
+
return cards.every(Boolean) ? { items: cards as never } : undefined;
|
|
168
177
|
},
|
|
169
178
|
}),
|
|
170
179
|
client.addTimelineRenderer({ kind: TOOL_KIND, version: 1, schema: toolRowSchema, Component: ToolRowView }),
|
package/client/needs-you.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Pressable, Text } from "./text";
|
|
|
4
4
|
import { Icon, useToast } from "@getpaseo/plugin/client/ui";
|
|
5
5
|
import { useRpc } from "@getpaseo/plugin/client";
|
|
6
6
|
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
7
|
-
import { answerQuestionRpc, checkPrActionRpc, controlRpc, sendRpc } from "../shared/contracts";
|
|
7
|
+
import { answerQuestionRpc, checkPrActionRpc, controlRpc, queueActionRpc, sendRpc } from "../shared/contracts";
|
|
8
8
|
import { agentName, needsYou, workspaceSnoozed, type NeedItem } from "../shared/attention";
|
|
9
9
|
import { laterLabel } from "./inbox";
|
|
10
10
|
import { sameText } from "../shared/home";
|
|
@@ -26,6 +26,7 @@ import { PrLinksProvider, RichText } from "./rich-text";
|
|
|
26
26
|
import { useMergeButtons } from "./merge-button";
|
|
27
27
|
import { mergeScope } from "../shared/merge-click";
|
|
28
28
|
import { prLinksByNumber } from "../shared/presentation";
|
|
29
|
+
import { deliveryStatus } from "../shared/queue";
|
|
29
30
|
export { overviewKey, workspaceKey };
|
|
30
31
|
|
|
31
32
|
function glyph(item: NeedItem, colors: Colors): { name: string; color: string } {
|
|
@@ -34,6 +35,7 @@ function glyph(item: NeedItem, colors: Colors): { name: string; color: string }
|
|
|
34
35
|
case "retry": return { name: "OctagonAlert", color: colors.statusDanger };
|
|
35
36
|
case "capped": return { name: "CircleAlert", color: colors.statusWarning };
|
|
36
37
|
case "check": return { name: "CircleHelp", color: colors.statusWarning };
|
|
38
|
+
case "message": return { name: "MessageSquareWarning", color: colors.statusWarning };
|
|
37
39
|
case "decision": return { name: "MessageCircleQuestion", color: colors.statusWarning };
|
|
38
40
|
case "question": return { name: item.state === "stopped" ? "CirclePause" : "MessageCircleQuestion", color: colors.statusWarning };
|
|
39
41
|
case "answer": return item.waiting ? { name: item.waiting === "in-chat" ? "MessageSquareText" : "Copy", color: colors.statusWarning } : { name: "TriangleAlert", color: colors.statusWarning };
|
|
@@ -56,7 +58,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
56
58
|
useReviewerSettings();
|
|
57
59
|
const toast = useToast();
|
|
58
60
|
const cache = useQueryClient();
|
|
59
|
-
const control = useRpc(controlRpc); const send = useRpc(sendRpc); const check = useRpc(checkPrActionRpc); const answer = useRpc(answerQuestionRpc);
|
|
61
|
+
const control = useRpc(controlRpc); const send = useRpc(sendRpc); const check = useRpc(checkPrActionRpc); const answer = useRpc(answerQuestionRpc); const queueAction = useRpc(queueActionRpc);
|
|
60
62
|
const refresh = () => { void cache.invalidateQueries({ queryKey: workspaceKey(w.id) }); void cache.invalidateQueries({ queryKey: overviewKey }); };
|
|
61
63
|
const fail = (error: Error) => { toast.error(errorText(error)); refresh(); };
|
|
62
64
|
const resume = useMutation({ mutationFn: () => control({ workspaceId: w.id, clearHold: true }), onSuccess: () => { toast.show("Follow-up resumed", { variant: "success" }); refresh(); actions.after?.(); }, onError: fail });
|
|
@@ -80,15 +82,24 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
80
82
|
}, onSuccess: (result, questionId) => {
|
|
81
83
|
const d = result.question.answer?.delivery;
|
|
82
84
|
if (d?.state === "sent") toast.show(`Sent your ${questionId} answer to ${agentName(w)}`, { variant: "success" });
|
|
83
|
-
else if (d?.state === "
|
|
84
|
-
else toast.show(
|
|
85
|
+
else if (d?.state === "failed" || d?.state === "cancelled") toast.show(deliveryStatus({ state: d.state, reason: d.reason }).detail, { variant: "warning" });
|
|
86
|
+
else toast.show(`Sending your ${questionId} answer to ${agentName(w)}`, { variant: "info" });
|
|
85
87
|
refresh(); actions.after?.();
|
|
86
88
|
}, onError: fail });
|
|
89
|
+
// Retry on a failed answer: the developer checked the chat, so the queue resends it now (shared/queue.ts).
|
|
90
|
+
const resendAnswer = useMutation({ mutationFn: (questionId: string) => {
|
|
91
|
+
const a = w.questions.find(q => q.id === questionId)?.answer;
|
|
92
|
+
if (!a) throw new Error(`${questionId} has no recorded answer`);
|
|
93
|
+
return answer({ workspaceId: w.id, questionId, choice: a.choice, words: a.words ?? undefined, action: "resend" });
|
|
94
|
+
}, onSuccess: (_result, questionId) => { toast.show(`Sending your ${questionId} answer again`, { variant: "info" }); refresh(); actions.after?.(); }, onError: fail });
|
|
95
|
+
// A forward or report that didn't go out (Workspace.undelivered): Retry or Cancel its queue item, the queue tools' path.
|
|
96
|
+
const queueAct = useMutation({ mutationFn: (input: { itemId: string; action: "retry" | "cancel" }) => queueAction(input),
|
|
97
|
+
onSuccess: (_r, input) => { toast.show(input.action === "retry" ? "Sending it again" : "Cancelled; it won't be sent", { variant: "info" }); refresh(); actions.after?.(); }, onError: fail });
|
|
87
98
|
const inspect = useMutation({ mutationFn: (actionId: string) => check({ workspaceId: w.id, actionId }), onSuccess: reply => { toast.show(reply.result, { variant: reply.state === "failed" ? "warning" : "info" }); refresh(); }, onError: fail });
|
|
88
99
|
const items = rows ?? needsYou(w, now);
|
|
89
100
|
const mergeControl = useMergeButtons(w);
|
|
90
101
|
if (!items.length) return null;
|
|
91
|
-
const busy = resume.isPending || retry.isPending || retryTask.isPending || deliver.isPending || sendAnswer.isPending || inspect.isPending;
|
|
102
|
+
const busy = resume.isPending || retry.isPending || retryTask.isPending || deliver.isPending || sendAnswer.isPending || resendAnswer.isPending || queueAct.isPending || inspect.isPending;
|
|
92
103
|
const openMain = actions.openAgent ? () => actions.openAgent!(w.mainAgentId) : undefined;
|
|
93
104
|
const action = (item: NeedItem) => {
|
|
94
105
|
switch (item.kind) {
|
|
@@ -104,6 +115,10 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
104
115
|
{openMain && <Button theme={theme} compact={compact} icon="MessageSquare" title="Open agent" accessibilityLabel="Open main agent" onPress={openMain} />}
|
|
105
116
|
</>;
|
|
106
117
|
case "check": return <Button theme={theme} compact={compact} icon="RefreshCw" title="Check state" loading={inspect.isPending} disabled={busy} onPress={() => inspect.mutate(item.actionId)} />;
|
|
118
|
+
case "message": return <>
|
|
119
|
+
<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" })} />
|
|
120
|
+
<Button theme={theme} compact={compact} kind="ghost" icon="X" title="Cancel" accessibilityLabel={`Don't send it: ${item.title}`} loading={queueAct.isPending && queueAct.variables?.action === "cancel"} disabled={busy} onPress={() => queueAct.mutate({ itemId: item.itemId, action: "cancel" })} />
|
|
121
|
+
</>;
|
|
107
122
|
case "decision": return openMain && <Button theme={theme} compact={compact} icon="MessageSquare" title="Answer in chat" onPress={openMain} />;
|
|
108
123
|
case "question": return actions.openQuestion && <Button theme={theme} compact={compact} icon="MessageCircleReply" title="Answer" accessibilityLabel={`Answer ${item.title}`} onPress={() => actions.openQuestion!(item.questionId)} />;
|
|
109
124
|
case "answer": return item.waiting
|
|
@@ -111,7 +126,10 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
111
126
|
<Button theme={theme} compact={compact} icon="Send" title="Send" accessibilityLabel={`Send your ${item.questionId} answer to ${agentName(w)}`} loading={sendAnswer.isPending} disabled={busy} onPress={() => sendAnswer.mutate(item.questionId)} />
|
|
112
127
|
{actions.openQuestion && !compact && <Button theme={theme} compact={compact} kind="ghost" title="Open" accessibilityLabel={`Open ${item.questionId}`} onPress={() => actions.openQuestion!(item.questionId)} />}
|
|
113
128
|
</>
|
|
114
|
-
:
|
|
129
|
+
: <>
|
|
130
|
+
<Button theme={theme} compact={compact} kind="primary" icon="RotateCcw" title="Retry" accessibilityLabel={`Send your ${item.questionId} answer again`} loading={resendAnswer.isPending} disabled={busy} onPress={() => resendAnswer.mutate(item.questionId)} />
|
|
131
|
+
{actions.openAgent && <Button theme={theme} compact={compact} kind="ghost" icon="MessageSquare" title="Open agent" accessibilityLabel={`Open the agent's chat to check for your ${item.questionId} answer`} onPress={() => { const q = w.questions.find(x => x.id === item.questionId); actions.openAgent!(q?.askedBy ?? w.mainAgentId); }} />}
|
|
132
|
+
</>;
|
|
115
133
|
case "send": return <Button theme={theme} compact={compact} kind="primary" icon="Send" title={item.finish ? "Ask to finish" : `Send ${item.tasks.length} task${item.tasks.length === 1 ? "" : "s"}`} accessibilityLabel={item.finish ? `Ask to finish: ${FINISH_ASK}` : `Send ${item.tasks.length} task${item.tasks.length === 1 ? "" : "s"} to ${agentName(w)}`} accessibilityHint={item.blocker ?? undefined} loading={deliver.isPending} disabled={busy || !!item.blocker} onPress={() => deliver.mutate(item.batchId)} />;
|
|
116
134
|
// One click merges what the button names (a-click-on-merge-merges); the sheet's confirm only when the scope can't be known.
|
|
117
135
|
case "merge": return mergeControl(item.prKey, { theme, compact, fallback: actions.openPr ? () => actions.openPr!(item.prKey, "merge") : undefined }).button;
|
|
@@ -142,7 +160,7 @@ export function NeedsYouList({ workspace: w, theme, compact, actions, now = Date
|
|
|
142
160
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start", paddingTop: 2 } : undefined}><Icon name={g.name} size={16} color={g.color} /></View>
|
|
143
161
|
<View style={{ flex: 1, minWidth: 0, gap: 2 }}>
|
|
144
162
|
{!said && <RichText numberOfLines={2} style={t.label}>{item.title}</RichText>}
|
|
145
|
-
{"detail" in item && !!item.detail && !sameText(item.detail, item.title.replace(/^Q\d+ · /, "")) && <RichText linkColor={c.foreground} numberOfLines={1} style={t.meta}>{item.detail}</RichText>}
|
|
163
|
+
{"detail" in item && !!item.detail && !sameText(item.detail, item.title.replace(/^Q\d+ · /, "")) && <RichText linkColor={c.foreground} numberOfLines={item.kind === "answer" || item.kind === "message" ? 3 : 1} style={t.meta}>{item.detail}</RichText>}
|
|
146
164
|
{item.kind === "reviewers" && <NoReviewLink repo={item.prKey.split("#")[0]} theme={theme} compact />}
|
|
147
165
|
</View>
|
|
148
166
|
<View style={item.kind === "reviewers" ? { alignSelf: "flex-start" } : undefined}>{pair ?? button}</View>
|
package/client/questions.tsx
CHANGED
|
@@ -10,8 +10,9 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
10
10
|
import { answerQuestionRpc } from "../shared/contracts";
|
|
11
11
|
import type { Workspace } from "../shared/model";
|
|
12
12
|
import type { ListQuestion, ListWorkspace } from "../shared/list";
|
|
13
|
-
import { OTHER, OTHER_LABEL, answerHeading, answerLabel, answerStatus, answerMessage, isOpen, isOther, questionState, type Question } from "../shared/questions";
|
|
13
|
+
import { OTHER, OTHER_LABEL, answerHeading, answerLabel, answerStatus, answerMessage, answerHasActions, resendTitle, isOpen, isOther, questionState, type Question } from "../shared/questions";
|
|
14
14
|
import { ago } from "../shared/attention";
|
|
15
|
+
import { RETRYING_DETAIL, deliveryStatus } from "../shared/queue";
|
|
15
16
|
import { mootNote, sentence } from "../shared/errors";
|
|
16
17
|
import { activity, type ActivityTone } from "../shared/activity";
|
|
17
18
|
import { Button, Card, CardRow, Chip, FoldRow, IconButton, SubmitScope, errorText, text, type Theme } from "./kit";
|
|
@@ -53,9 +54,12 @@ function deliveryLine(w: ListWorkspace, q: ListQuestion, now: number): { icon: s
|
|
|
53
54
|
if (!d) return null;
|
|
54
55
|
switch (d.state) {
|
|
55
56
|
case "sent": return { icon: "CircleCheck", tone: "success", text: `Sent to ${who(w, d.to)} ${ago(d.at, now)}` };
|
|
56
|
-
|
|
57
|
-
case "
|
|
58
|
-
|
|
57
|
+
// The queue's states read one way everywhere (shared/queue.ts deliveryStatus).
|
|
58
|
+
case "sending": case "queued": case "retrying": case "failed": case "cancelled": {
|
|
59
|
+
const s = deliveryStatus({ state: d.state, reason: d.reason, nextAt: d.nextAt });
|
|
60
|
+
return { icon: s.tone === "spinner" ? "" : d.state === "queued" ? "Clock" : d.state === "retrying" ? "RotateCcw" : d.state === "cancelled" ? "CircleSlash" : "TriangleAlert", tone: s.tone === "danger" ? "warning" : s.tone, text: s.detail };
|
|
61
|
+
}
|
|
62
|
+
case "unconfirmed": return { icon: "RotateCcw", tone: "muted", text: RETRYING_DETAIL };
|
|
59
63
|
case "copied": return { icon: "Copy", tone: "muted", text: `Copied ${ago(d.at, now)}. Paste it into the agent's chat, or send it from here.` };
|
|
60
64
|
case "signed-off": return { icon: "Check", tone: "muted", text: `You signed it off ${ago(d.at, now)}; Follow-up didn't see it in the chat.` };
|
|
61
65
|
case "in-chat": return { icon: "MessageSquareText", tone: "muted", text: `Put in ${who(w, d.to)}'s chat ${ago(d.at, now)}. Send it there, or send it from here.` };
|
|
@@ -131,8 +135,8 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
131
135
|
const d = result.question.answer?.delivery;
|
|
132
136
|
if (action === "copy") toast.show(`Copied the ${q.id} answer. Paste it into the agent's chat.`, { variant: "success" });
|
|
133
137
|
else if (d?.state === "sent") toast.show(`Sent your ${q.id} answer to the agent`, { variant: "success" });
|
|
134
|
-
else if (d?.state === "
|
|
135
|
-
else toast.show(
|
|
138
|
+
else if (d?.state === "failed" || d?.state === "cancelled") toast.show(deliveryStatus({ state: d.state, reason: d.reason }).detail, { variant: "warning" });
|
|
139
|
+
else toast.show(`Answer saved. Follow-up delivers it and retries on its own.`, { variant: "info" });
|
|
136
140
|
refresh();
|
|
137
141
|
},
|
|
138
142
|
onError: error => { toast.error(errorText(error)); refresh(); },
|
|
@@ -167,8 +171,9 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
167
171
|
if (action === "copy") return { message: `Copied the ${q.id} answer. Paste it into the agent's chat.` };
|
|
168
172
|
if (action === "chat") return { message: `Your ${q.id} answer is in ${agent}'s chat. Send it there.` };
|
|
169
173
|
if (d?.state === "sent") return { message: `Sent to ${agent}` };
|
|
170
|
-
if (d?.state === "
|
|
171
|
-
|
|
174
|
+
if (d?.state === "failed" || d?.state === "cancelled") return { tone: "warning", message: deliveryStatus({ state: d.state, reason: d.reason }).detail };
|
|
175
|
+
// Recorded and queued: Follow-up sends it within seconds and retries on its own.
|
|
176
|
+
return { message: `Sending to ${agent}` };
|
|
172
177
|
},
|
|
173
178
|
onSuccess: () => { clearPendingAnswer(w.id, q.id); refresh(); },
|
|
174
179
|
onError: error => { failPendingAnswer(w.id, q.id, errorText(error)); refresh(); },
|
|
@@ -237,10 +242,11 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
237
242
|
{(open || isOther(q.answer?.choice)) && <OptionCard theme={theme} compact={compact} dense={dense} own label={OTHER_LABEL} consequence={open && !dense ? "Write your own answer" : undefined} recommended={false}
|
|
238
243
|
selected={(open ? choice : q.answer?.choice) === OTHER} disabled={!open || run.isPending} onPress={() => { setChoice(OTHER); if (pinned) setNoteOpen(true); }} />}
|
|
239
244
|
</View>}
|
|
240
|
-
{/* Not sent yet (copied, or in the agent's message box) never reads as answered: no check, no green
|
|
241
|
-
|
|
245
|
+
{/* Not sent yet (copied, or in the agent's message box) never reads as answered: no check, no green. Only a
|
|
246
|
+
delivered answer is green; queued, retrying or failed keeps the check but stays neutral (answerHeading). */}
|
|
247
|
+
{heading && <View style={{ gap: 6, padding: 10, borderRadius: 8, backgroundColor: heading.delivered ? tint(c.statusSuccess, c) : c.surface1 }}>
|
|
242
248
|
<View style={{ flexDirection: "row", gap: 6 }}>
|
|
243
|
-
<View style={{ paddingTop: 2 }}><Icon name={heading.waiting ? "CircleDashed" : "CircleCheck"} size={13} color={heading.
|
|
249
|
+
<View style={{ paddingTop: 2 }}><Icon name={heading.waiting ? "CircleDashed" : "CircleCheck"} size={13} color={heading.delivered ? c.statusSuccess : c.foregroundMuted} /></View>
|
|
244
250
|
<RichText selectable style={[t.label, { flex: 1 }]}>{heading.text}</RichText>
|
|
245
251
|
</View>
|
|
246
252
|
{!!q.answer?.words && <RichText selectable style={[t.meta, { color: c.foreground, paddingLeft: 19 }]}>{q.answer.words}</RichText>}
|
|
@@ -258,7 +264,7 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
258
264
|
</View>}
|
|
259
265
|
{open && !pinned && input}
|
|
260
266
|
</View>;
|
|
261
|
-
const actions = (open || q.answer &&
|
|
267
|
+
const actions = (open || q.answer && answerHasActions(q.answer.delivery)) && <View style={{ gap: 6 }}>
|
|
262
268
|
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 8 }}>
|
|
263
269
|
{open && <Button shortcut theme={theme} compact={compact} grow={compact} kind="primary" icon="Send" title="Send to agent" accessibilityLabel={`Send your ${q.id} answer to the agent`} accessibilityHint={other && !words.trim() ? "Write your answer first" : compact ? `Puts your answer straight into the asking agent's chat, even mid-turn. Follow-up keeps it under ${q.id}.` : undefined} disabled={!answer || run.isPending} onPress={() => quick("send")} />}
|
|
264
270
|
{open && composer && <Button theme={theme} compact={compact} icon="MessageSquareText" title="Put in chat" accessibilityLabel={`Put your ${q.id} answer in the agent's chat, to read over and send there`} disabled={!answer || run.isPending} onPress={putIn} />}
|
|
@@ -266,10 +272,10 @@ export function QuestionBody({ workspace: w, question: q, theme, compact, now =
|
|
|
266
272
|
{open && !composer && <Button theme={theme} compact={compact} icon="Copy" title="Copy" accessibilityLabel={`Copy your ${q.id} answer instead of sending it`} disabled={!answer || run.isPending} onPress={() => quick("copy")} />}
|
|
267
273
|
{open && composer && <IconButton theme={theme} compact={compact} icon="Copy" label="Copy answer" tooltip disabled={!answer || run.isPending} onPress={() => quick("copy")} />}
|
|
268
274
|
{(q.answer?.delivery.state === "copied" || q.answer?.delivery.state === "in-chat") && <Button shortcut theme={theme} compact={compact} kind="primary" icon="Send" title="Send to agent" accessibilityLabel={`Send your ${q.id} answer to the agent`} loading={run.isPending} onPress={() => run.mutate("send")} />}
|
|
269
|
-
{q.answer &&
|
|
270
|
-
{q.answer &&
|
|
275
|
+
{q.answer && resendTitle(q.answer.delivery) && <Button theme={theme} compact={compact} kind={q.answer.delivery.state === "failed" ? "primary" : undefined} icon="RotateCcw" title={resendTitle(q.answer.delivery)!} accessibilityLabel={q.answer.delivery.state === "failed" ? `Send the ${q.id} answer again` : `Try sending the ${q.id} answer now`} loading={run.isPending} onPress={() => run.mutate("resend")} />}
|
|
276
|
+
{q.answer && (q.answer.delivery.state === "failed" || q.answer.delivery.state === "cancelled") && <Button theme={theme} compact={compact} kind="ghost" icon="Copy" title="Copy" accessibilityLabel={`Copy the ${q.id} answer`} onPress={() => { void copyText(answerMessage(q, q.answer!.choice, q.answer!.words)).then(() => toast.show("Copied", { variant: "success" }), () => toast.error("Couldn't copy here")); }} />}
|
|
271
277
|
{q.answer?.delivery.state === "in-chat" && composer && <Button theme={theme} compact={compact} kind="ghost" icon="MessageSquareText" title="Open chat" accessibilityLabel={`Open the chat your ${q.id} answer is in`} onPress={() => { onClose?.(); void composer.focus().catch(() => undefined); }} />}
|
|
272
|
-
{q.answer?.delivery.state === "unconfirmed" && openAgent && <Button theme={theme} compact={compact} kind="ghost" icon="MessageSquare" title="Open agent" onPress={() => openAgent(q.askedBy ?? w.mainAgentId)} />}
|
|
278
|
+
{(q.answer?.delivery.state === "failed" || q.answer?.delivery.state === "unconfirmed") && openAgent && <Button theme={theme} compact={compact} kind="ghost" icon="MessageSquare" title="Open agent" onPress={() => openAgent(q.askedBy ?? w.mainAgentId)} />}
|
|
273
279
|
{pinned && open && !free && !other && !noteOpen && <Button theme={theme} compact={compact} kind="ghost" icon="Pencil" title="Note" accessibilityLabel={`Add a note for the agent about ${q.id}`} onPress={() => setNoteOpen(true)} />}
|
|
274
280
|
{dense && onDetails && <IconButton theme={theme} compact={compact} icon="Maximize2" label={`Open ${q.id} with its links and full context`} onPress={onDetails} />}
|
|
275
281
|
</View>
|
package/client/report-issue.tsx
CHANGED
|
@@ -73,7 +73,7 @@ function Segmented({ value, onChange, theme, compact }: { value: ReportKind; onC
|
|
|
73
73
|
</View>;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
type Phase = { kind: "edit" } | { kind: "sending" } | { kind: "sent"; agentId: string; title: string; started: boolean } | { kind: "failed"; message: string };
|
|
76
|
+
type Phase = { kind: "edit" } | { kind: "sending" } | { kind: "sent"; agentId: string; title: string; started: boolean; queued?: boolean } | { kind: "failed"; message: string };
|
|
77
77
|
|
|
78
78
|
export function ReportSheet({ request, theme, layout, openAgent, onClose }: { request: ReportRequest; theme: Theme; layout: PluginHostProps["layout"]; openAgent?: (agentId: string) => void; onClose: () => void }) {
|
|
79
79
|
const c = theme.colors; const compact = layout.compact; const t = text(c, compact);
|
|
@@ -123,7 +123,7 @@ export function ReportSheet({ request, theme, layout, openAgent, onClose }: { re
|
|
|
123
123
|
<View accessibilityRole="alert" style={{ flexDirection: "row", gap: 10, padding: 12, borderRadius: 8, backgroundColor: tint(c.statusSuccess, c) }}>
|
|
124
124
|
<Icon name="CircleCheck" size={16} color={c.statusSuccess} />
|
|
125
125
|
<View style={{ flex: 1 }}>
|
|
126
|
-
<Text style={t.label}>{phase.started ? `Started ${phase.title}` : `Sent to ${phase.title}`}</Text>
|
|
126
|
+
<Text style={t.label}>{phase.started ? `Started ${phase.title}` : phase.queued ? `Sending to ${phase.title}. Follow-up retries until it lands.` : `Sent to ${phase.title}`}</Text>
|
|
127
127
|
<Text style={t.body}>It'll ask you anything it needs in that chat, then show you the issue before filing it.</Text>
|
|
128
128
|
</View>
|
|
129
129
|
</View>
|
package/client/spec.tsx
CHANGED
|
@@ -109,7 +109,7 @@ export function SpecSheet({ workspace: w, open, theme, compact, onClose }: { wor
|
|
|
109
109
|
{others.map(a => <View key={a.url} style={{ flexDirection: "row", alignItems: "center", gap: 8 }}>
|
|
110
110
|
<Icon name="FileText" size={13} color={c.foregroundMuted} />
|
|
111
111
|
<View style={{ flex: 1, minWidth: 0 }}>
|
|
112
|
-
<Text numberOfLines={1} style={t.body}>{a.title ?? "
|
|
112
|
+
<Text numberOfLines={1} style={t.body}>{a.title ?? "Claude artifact"}</Text>
|
|
113
113
|
<Text numberOfLines={1} style={t.small}>{a.publishes > 1 ? `Published ${a.publishes} times` : "Published once"}{a.lastAt ? ` · ${ago(a.lastAt)}` : ""}</Text>
|
|
114
114
|
</View>
|
|
115
115
|
<Button theme={theme} compact={compact} kind="ghost" icon="ArrowUpRight" title="Open" accessibilityLabel={`Open ${a.title ?? "artifact"}`} onPress={() => openUrl(a.url)} />
|
package/index.server.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TranscriptTitleLookup, TranscriptTitleStore, trackedTitleTranscripts } from "./server/transcript-titles";
|
|
2
|
+
import { fillLinkedTitles, fillWorkspaceTitles, localTitles, workspaceNeedsTitles, type TitleIndex } from "./shared/local-titles";
|
|
1
3
|
import { stopWorker } from "./server/teardown";
|
|
2
4
|
import { WriteHealth } from "./server/write-behind";
|
|
3
5
|
import { actorBy, actorOf, type Actor } from "./shared/actor";
|
|
@@ -60,7 +62,9 @@ import { updateObligation } from "./server/obligations";
|
|
|
60
62
|
import { Inbox, INBOX_WRITE_MS, type GuardPause } from "./server/inbox";
|
|
61
63
|
import { daemonDirectory, guardPath } from "./server/inbox-directory";
|
|
62
64
|
import { fileSources } from "./server/inbox-classifier";
|
|
63
|
-
import { onBeforeSend } from "./server/daemon";
|
|
65
|
+
import { onBeforeSend, onDaemonReconnect } from "./server/daemon";
|
|
66
|
+
import { MessageQueue, undeliveredEntry } from "./server/message-queue";
|
|
67
|
+
import { queueView } from "./shared/queue";
|
|
64
68
|
import { copyFile, readFile, rename, stat } from "node:fs/promises";
|
|
65
69
|
import { HistoryCache } from "./server/history-cache";
|
|
66
70
|
import { Governor } from "./server/governor";
|
|
@@ -214,7 +218,16 @@ export default function contribute(server: PluginServerContext) {
|
|
|
214
218
|
actions.settleTasks = w => engine.settleTasks(w);
|
|
215
219
|
const governor = new Governor();
|
|
216
220
|
const linkedStore = new LinkedStore(directory);
|
|
217
|
-
const linked = new LinkedService({ store: linkedStore, sources: liveLinkedSources(), roomForBackground: async () => governor.allowsBackground()
|
|
221
|
+
const linked = new LinkedService({ store: linkedStore, sources: liveLinkedSources(), roomForBackground: async () => governor.allowsBackground(),
|
|
222
|
+
workspaces: async () => (await store.snapshot()).workspaces,
|
|
223
|
+
titlesChanged: async (titles: TitleIndex) => {
|
|
224
|
+
for (const w of (await store.snapshot()).workspaces) {
|
|
225
|
+
if (!w.enable_tracking) continue;
|
|
226
|
+
if (workspaceNeedsTitles(w, titles)) await store.mutateWorkspace(w.id, current => { fillWorkspaceTitles(current, titles); });
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
const transcriptTitles = new TranscriptTitleLookup({ store: new TranscriptTitleStore(directory), paths: (workspaces, priority) => trackedTitleTranscripts(paseoHome, workspaces, undefined, priority) });
|
|
218
231
|
// Extraction rides discovery's own timeline batch (loaded agents only): no extra reads (shared/linked-extract.ts).
|
|
219
232
|
gateway.linkRefs = batch => void linked.note(batch).catch(() => undefined);
|
|
220
233
|
const listCache = new ListCache();
|
|
@@ -234,11 +247,6 @@ export default function contribute(server: PluginServerContext) {
|
|
|
234
247
|
if (!api) { unsent.set(`${agentId}|${brief.id}`, { agentId, brief }); return; }
|
|
235
248
|
await api.agents.ref(agentId).timeline.append({ type: "plugin", id: brief.id, kind: BRIEF_KIND, version: BRIEF_VERSION, data: brief });
|
|
236
249
|
};
|
|
237
|
-
/** A message to one agent: through the plugin session once a handler has seen one, else a daemon connection (worker start). */
|
|
238
|
-
const sendTo = (agentId: string) => async (text: string, messageId: string) => {
|
|
239
|
-
if (api) await api.agents.ref(agentId).send(text, { messageId, activeTurnBehavior: "steer" });
|
|
240
|
-
else await withDaemon(client => client.sendMessage(agentId, text, { messageId, activeTurnBehavior: "steer" }));
|
|
241
|
-
};
|
|
242
250
|
const seen = (paseo: PaseoApi) => {
|
|
243
251
|
api = paseo;
|
|
244
252
|
for (const [key, row] of unsent) { unsent.delete(key); void append(row.agentId, row.brief).catch(() => undefined); }
|
|
@@ -298,7 +306,40 @@ export default function contribute(server: PluginServerContext) {
|
|
|
298
306
|
catch { return null; }
|
|
299
307
|
},
|
|
300
308
|
});
|
|
301
|
-
onBeforeSend((agentId, messageId) => inbox.noteDelivery(agentId, messageId));
|
|
309
|
+
onBeforeSend((agentId, messageId, by) => inbox.noteDelivery(agentId, messageId, by === "developer" || by?.startsWith("agent:") ? by as "developer" | `agent:${string}` : undefined));
|
|
310
|
+
// a-message-is-saved-before-sent-and-arrives-once: every message to an agent goes through one queue (queue.json).
|
|
311
|
+
const queue = new MessageQueue(directory, { deliverTo: (target, text, messageId, by) => gateway.deliverTo(target, text, messageId, by), arrived: (agentId, messageId, since, marker) => gateway.arrivedMessage(agentId, messageId, since, marker), probe: () => gateway.probe() }, { health: writeHealth });
|
|
312
|
+
engine.attachQueue(queue);
|
|
313
|
+
inbox.attachQueue(queue);
|
|
314
|
+
// Overseer forwards and reports handed to an agent: no record of their own, so the queue item is their status
|
|
315
|
+
// (follow_queue_list). Archived agents cancel, with the reason on the item.
|
|
316
|
+
queue.register("message", {
|
|
317
|
+
async resolve(item) {
|
|
318
|
+
const rows = await gateway.directory.read().catch(() => null);
|
|
319
|
+
if (!rows) return { defer: "Paseo unreachable" };
|
|
320
|
+
const agent = rows.agents.find(r => r.agent.id === item.ref.agentId)?.agent;
|
|
321
|
+
if (!agent || agent.archivedAt) return { cancel: "The agent was archived, so the message wasn't sent." };
|
|
322
|
+
return { target: { workspaceId: null, recipients: [item.ref.agentId!] } };
|
|
323
|
+
},
|
|
324
|
+
// No card of its own: one that didn't go out (Failed, or Queued past MESSAGE_STUCK_MS) shows in its workspace's
|
|
325
|
+
// Needs you with Retry and Cancel, and leaves it once sent or cancelled.
|
|
326
|
+
async project(item) {
|
|
327
|
+
const w = (await store.snapshot()).workspaces.find(w => w.id === item.key && w.enable_tracking && !w.archived);
|
|
328
|
+
if (!w) return;
|
|
329
|
+
const has = w.undelivered?.find(m => m.id === item.id);
|
|
330
|
+
const entry = undeliveredEntry(item, Date.now(), gateway.directory.cached(item.ref.agentId!)?.title ?? null, has?.since ?? null, queue.scale);
|
|
331
|
+
if (!entry && !has || entry && has && JSON.stringify(entry) === JSON.stringify(has)) return;
|
|
332
|
+
await store.mutateWorkspace(w.id, x => {
|
|
333
|
+
const rest = (x.undelivered ?? []).filter(m => m.id !== item.id);
|
|
334
|
+
x.undelivered = entry ? [...rest, entry].slice(-20) : rest;
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
});
|
|
338
|
+
const enqueueMessage = (agentId: string, text: string, messageId: string, by?: string) => {
|
|
339
|
+
const key = gateway.directory.cached(agentId)?.workspaceId ?? `agent:${agentId}`;
|
|
340
|
+
queue.enqueue({ id: `message:${agentId}:${messageId}`, kind: "message", key, ref: { agentId }, messageId, text, ...(by ? { by } : {}), priority: "now", state: "queued" });
|
|
341
|
+
};
|
|
342
|
+
onDaemonReconnect(() => queue.reconnected());
|
|
302
343
|
/** What the bridge and the Stop hook read: is the inbox on, may agents be nudged, who has a prompt showing. */
|
|
303
344
|
const writeBriefState = async () => {
|
|
304
345
|
const values = await inboxSettings();
|
|
@@ -406,6 +447,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
406
447
|
// 1.4.0-beta.2: tools are per agent now; drop the old user-scope registrations that spawned mcp.mjs in every session.
|
|
407
448
|
void removeGlobalRegistrations().then(results => { const removed = results.filter(r => r.status === "removed").map(r => r.path); if (removed.length) console.warn(`[follow-up] removed the global follow-up MCP registration from ${removed.length} file(s); backups end in .follow-up-unregister.bak`); });
|
|
408
449
|
governor.start();
|
|
450
|
+
await linked.backfill();
|
|
409
451
|
await engine.recover();
|
|
410
452
|
await migrateTracking();
|
|
411
453
|
await dedupeQuestions();
|
|
@@ -422,8 +464,13 @@ export default function contribute(server: PluginServerContext) {
|
|
|
422
464
|
await agentHooks.start().catch(() => { hookError = "Automatic sidebar instructions could not be registered for every provider. Check Claude/Codex hook settings; following still works."; });
|
|
423
465
|
hookTimer = setInterval(() => void agentHooks.heartbeat().catch(() => {}), 30_000);
|
|
424
466
|
await writeBriefState().catch(() => undefined);
|
|
425
|
-
//
|
|
426
|
-
|
|
467
|
+
// The message queue: answers recorded before a reload (or before the upgrade from 2.0's per-answer senders) join it,
|
|
468
|
+
// a send a reload cut off is read back from the agent's chat before it goes again, and everything due goes now.
|
|
469
|
+
await queue.load();
|
|
470
|
+
await engine.adoptAnswers().catch(error => console.warn(`[follow-up] couldn't move answers onto the queue: ${error instanceof Error ? error.message : String(error)}`));
|
|
471
|
+
await engine.adoptBatches().catch(error => console.warn(`[follow-up] couldn't move batches onto the queue: ${error instanceof Error ? error.message : String(error)}`));
|
|
472
|
+
await inbox.adoptOutbox().catch(error => console.warn(`[follow-up] couldn't move the answer outbox onto the queue: ${error instanceof Error ? error.message : String(error)}`));
|
|
473
|
+
queue.start();
|
|
427
474
|
})().catch(() => { loadError = "Follow-up could not start. Check its saved state and worker lock."; });
|
|
428
475
|
for (const file of [store, reviewerStore.persist, agentSettings.persist, prWorkflow.persist, inbox.store.persist]) file.health = writeHealth;
|
|
429
476
|
const requireReady = async () => { if (waiting) throw new Error(waiting); await ready; if (loadError || stopped) throw new Error(loadError ?? "Follow-up is stopping"); };
|
|
@@ -672,9 +719,11 @@ export default function contribute(server: PluginServerContext) {
|
|
|
672
719
|
handle(rpc.setSpecRpc, async ({ agentId, url, title }, { paseo }) => {
|
|
673
720
|
await requireReady();
|
|
674
721
|
const workspaceId = await callerWorkspaceId(agentId, paseo);
|
|
722
|
+
const links = await linkedStore.read();
|
|
675
723
|
return store.mutate(state => {
|
|
676
724
|
const w = agentWorkspace(state, agentId, "write", workspaceId);
|
|
677
725
|
const { applied, message } = agentSetSpec(w, agentId, url, title, Date.now());
|
|
726
|
+
fillWorkspaceTitles(w, localTitles(state.workspaces, links));
|
|
678
727
|
return { workspaceId: w.id, spec: w.spec, applied, message };
|
|
679
728
|
});
|
|
680
729
|
});
|
|
@@ -721,10 +770,12 @@ export default function contribute(server: PluginServerContext) {
|
|
|
721
770
|
});
|
|
722
771
|
handle(rpc.workspaceSpecRpc, async (input, context) => {
|
|
723
772
|
await requireReady();
|
|
773
|
+
const links = await linkedStore.read();
|
|
724
774
|
return store.mutate(state => {
|
|
725
775
|
const w = findWorkspace(state, input.workspaceId);
|
|
726
776
|
if (!w.enable_tracking || w.archived) throw new Error("Follow-up isn't following this workspace. Turn it back on in Follow-up settings, under Workspace exceptions.");
|
|
727
777
|
developerSetSpec(w, input, Date.now(), actorOf(context));
|
|
778
|
+
fillWorkspaceTitles(w, localTitles(state.workspaces, links));
|
|
728
779
|
return w;
|
|
729
780
|
});
|
|
730
781
|
});
|
|
@@ -851,7 +902,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
851
902
|
branch: w.gitRuntime?.currentBranch ?? null, pr: w.githubRuntime?.pullRequest?.title ? { number: w.githubRuntime.pullRequest.number ?? null, title: w.githubRuntime.pullRequest.title } : null }));
|
|
852
903
|
};
|
|
853
904
|
const overseerOn = async () => (await inboxSettings()).enable_overseer !== false;
|
|
854
|
-
overseer = new Overseer({ directory, store, inbox, sources: senderSources, priorities: priorityStore, workspaces: paseoWorkspaces, enabled: overseerOn, paseoHome, tight: async () => !governor.allowsBackground(),
|
|
905
|
+
overseer = new Overseer({ directory, store, inbox, enqueue: enqueueMessage, sources: senderSources, priorities: priorityStore, workspaces: paseoWorkspaces, enabled: overseerOn, paseoHome, tight: async () => !governor.allowsBackground(),
|
|
855
906
|
windowMs: async () => activeWindowMs(await store.snapshot()), agent: () => agentSettings.role("overseer"),
|
|
856
907
|
// Harness override only (isolated test daemons): "provider/model" wins over Settings → Agents.
|
|
857
908
|
provider: process.env.FOLLOW_UP_OVERSEER_PROVIDER || undefined,
|
|
@@ -1126,6 +1177,21 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1126
1177
|
if (!stopped) linkedTimer = setTimeout(() => void linkedLoop(), 10 * 60_000);
|
|
1127
1178
|
};
|
|
1128
1179
|
linkedTimer = setTimeout(() => void linkedLoop(), 90_000);
|
|
1180
|
+
// Local title recovery is independent of a panel/RPC response: one shared index, at most 4 MB for an unnamed backlog.
|
|
1181
|
+
let titleTimer: ReturnType<typeof setTimeout> | null = null;
|
|
1182
|
+
const titleLoop = async () => {
|
|
1183
|
+
await ready;
|
|
1184
|
+
if (stopped || loadError) return;
|
|
1185
|
+
if (governor.allowsBackground()) try {
|
|
1186
|
+
const state = await store.snapshot(), file = await linkedStore.read();
|
|
1187
|
+
await transcriptTitles.tick(state.workspaces, file.workspaces, async titles => {
|
|
1188
|
+
await linkedStore.mutate(file => { fillLinkedTitles(file, titles); });
|
|
1189
|
+
for (const w of (await store.snapshot()).workspaces) if (w.enable_tracking && workspaceNeedsTitles(w, titles)) await store.mutateWorkspace(w.id, current => { fillWorkspaceTitles(current, titles); });
|
|
1190
|
+
});
|
|
1191
|
+
} catch { /* a local miss never prevents following work */ }
|
|
1192
|
+
if (!stopped) titleTimer = setTimeout(() => void titleLoop(), 30_000);
|
|
1193
|
+
};
|
|
1194
|
+
titleTimer = setTimeout(() => void titleLoop(), 30_000);
|
|
1129
1195
|
// Developer RPCs as agent tools (server/agent-parity.ts): the same handler the button's RPC runs.
|
|
1130
1196
|
const rpcBridge = {
|
|
1131
1197
|
async validate(method: string, input: unknown) { const h = handlers.get(method); if (!h) throw new Error(`Unknown Follow-up method ${method}.`); return h.input.parseAsync(input); },
|
|
@@ -1173,7 +1239,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1173
1239
|
handle(rpc.reportSendRpc, async (input, { paseo }) => {
|
|
1174
1240
|
seen(paseo);
|
|
1175
1241
|
return sendReport({
|
|
1176
|
-
rows: () => gateway.directory.read().catch(() => null), multiplicity: hostMultiplicity, sendTo: (agentId, prompt, messageId) =>
|
|
1242
|
+
rows: () => gateway.directory.read().catch(() => null), multiplicity: hostMultiplicity, sendTo: async (agentId, prompt, messageId) => enqueueMessage(agentId, prompt, messageId, "developer"),
|
|
1177
1243
|
agentTitle: async agentId => (await gateway.directory.read().catch(() => null))?.agents.find(r => r.agent.id === agentId)?.agent.title ?? null,
|
|
1178
1244
|
provider: async () => ({ provider: await providerModel(paseo as unknown as OverseerPaseo, (await agentSettings.role("overseer").catch(() => null))?.provider?.split("/")[0] ?? "claude") }),
|
|
1179
1245
|
paseo: paseo as unknown as ReportSendDeps["paseo"],
|
|
@@ -1200,6 +1266,17 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1200
1266
|
// Home, the sidebar badge and the pills poll this; an unchanged list answers in a few bytes (see inboxAnswer).
|
|
1201
1267
|
handle(rpc.inboxListRpc, async ({ etag }) => { await requireReady(); const handedBack = noReviewRepoList().length ? (await store.snapshot()).workspaces.flatMap(w => w.prs.filter(handsMergeBack).map(p => p.key)) : [];
|
|
1202
1268
|
return inboxAnswer({ ...await inbox.list(), error: inboxError, ...(handedBack.length ? { handedBack } : {}) }, etag); });
|
|
1269
|
+
handle(rpc.queueListRpc, async ({ workspaceId, agentId }) => {
|
|
1270
|
+
await requireReady();
|
|
1271
|
+
const { items, recent } = queue.list({ ...(workspaceId ? { key: workspaceId } : {}), ...(agentId ? { agentId } : {}) });
|
|
1272
|
+
return { items: items.map(queueView), recent: recent.map(queueView) };
|
|
1273
|
+
});
|
|
1274
|
+
// Retry or Cancel one item: the card's buttons, Needs you's message row and follow_queue_action run this.
|
|
1275
|
+
handle(rpc.queueActionRpc, async ({ itemId, action }) => {
|
|
1276
|
+
await requireReady();
|
|
1277
|
+
const item = action === "retry" ? await queue.retry(itemId) : await queue.cancel(itemId, "Cancelled; it won't be sent.");
|
|
1278
|
+
return { item: queueView(item) };
|
|
1279
|
+
});
|
|
1203
1280
|
handle(rpc.inboxBriefRpc, async ({ agentId }) => { await requireReady(); return { brief: await inbox.brief(agentId) }; });
|
|
1204
1281
|
handle(rpc.inboxActRpc, async (input, context) => {
|
|
1205
1282
|
await requireReady();
|
|
@@ -1299,7 +1376,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1299
1376
|
handle(rpc.briefActionRpc, async ({ agentId, briefId, decisionId, choice, words, choices, move, answerId }, context) => {
|
|
1300
1377
|
const { paseo } = context;
|
|
1301
1378
|
await requireReady(); seen(paseo);
|
|
1302
|
-
const brief = await inbox.briefAction(agentId, { briefId, decisionId, choice, words, choices, move, answerId },
|
|
1379
|
+
const brief = await inbox.briefAction(agentId, { briefId, decisionId, choice, words, choices, move, answerId }, actorOf(context));
|
|
1303
1380
|
return { brief };
|
|
1304
1381
|
});
|
|
1305
1382
|
|
|
@@ -1489,11 +1566,11 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1489
1566
|
const stop = () => stopping ??= (async () => {
|
|
1490
1567
|
process.off("disconnect", hostGone);
|
|
1491
1568
|
restoreConsole();
|
|
1492
|
-
stopped = true; wait.close(); updater.stop(); pluginMove.stop(); governor.stop(); if (timer) clearTimeout(timer); if (aboutTimer) clearTimeout(aboutTimer); if (linkedTimer) clearTimeout(linkedTimer); aiJobs.stop(); ranker = null; if (inboxTimer) clearTimeout(inboxTimer); inbox.stop(); rpcTiming.stop(); if (hookTimer) clearInterval(hookTimer); memoryWatch?.stop(); displayOff?.(); usageWatch?.close(); removers.forEach(remove => remove());
|
|
1569
|
+
stopped = true; wait.close(); updater.stop(); pluginMove.stop(); governor.stop(); if (timer) clearTimeout(timer); if (aboutTimer) clearTimeout(aboutTimer); if (linkedTimer) clearTimeout(linkedTimer); if (titleTimer) clearTimeout(titleTimer); aiJobs.stop(); ranker = null; if (inboxTimer) clearTimeout(inboxTimer); inbox.stop(); queue.stop(); rpcTiming.stop(); if (hookTimer) clearInterval(hookTimer); memoryWatch?.stop(); displayOff?.(); usageWatch?.close(); removers.forEach(remove => remove());
|
|
1493
1570
|
// One deadline for every wait (worker-stop-never-waits-on-a-stuck-pass, server/teardown.ts): start-up and the work
|
|
1494
1571
|
// in flight may be stuck on a daemon or CLI that never answers. Work that ends inside the deadline is saved; what
|
|
1495
1572
|
// outlives it can't write, because the store closes before the lock is released.
|
|
1496
|
-
await stopWorker({ files: [reviewerStore, agentSettings, prWorkflow], ready, hooks: hooksStarted ? () => agentHooks.stop() : undefined, actions, closeConnections, engine, store, inbox: inbox.store, unlock });
|
|
1573
|
+
await stopWorker({ files: [reviewerStore, agentSettings, prWorkflow, queue], ready, hooks: hooksStarted ? () => agentHooks.stop() : undefined, actions, closeConnections, engine, store, inbox: inbox.store, unlock });
|
|
1497
1574
|
})();
|
|
1498
1575
|
return stop;
|
|
1499
1576
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.1.0-beta.
|
|
4
|
+
"version": "2.1.0-beta.5",
|
|
5
5
|
"description": "A Paseo plugin that follows every workspace until the work is done: one Home for what needs you, questions you answer anywhere, and repairs that send themselves.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
package/server/agent-actions.ts
CHANGED
|
@@ -47,7 +47,7 @@ export function rowPrs(state: State, r: InboxRow, now: number): PrLink[] {
|
|
|
47
47
|
return [...out.values()];
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export const AGENT_TOOLS = ["make_main_agent", "list_prs", "add_reviewers", "merge", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "track", "inbox_list", "sign_off", "snooze", "snooze_workspace", "set_finish_flags", "set_priorities", "workspace_about", "agent_settings", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "priorities", "rank_status", "rerank_priorities", "usage", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "inbox_act", "answer_question", "run_recovery", "refresh", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "link_items", "set_linked_items", "updates_status", "check_updates", "set_updates", "install_update", "display_settings", "set_display", "retry_move", "report_issue", "report_send", "ai_rename"] as const;
|
|
50
|
+
export const AGENT_TOOLS = ["make_main_agent", "list_prs", "add_reviewers", "merge", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "track", "inbox_list", "sign_off", "snooze", "snooze_workspace", "set_finish_flags", "set_priorities", "workspace_about", "agent_settings", "follow_settings", "set_follow_settings", "project_settings", "set_project_tracking", "pr_workflow", "set_pr_workflow", "reviewer_settings", "reviewer_suggestions", "save_reviewers", "set_agent_setting", "set_wait_for_jobs", "onboarding_status", "onboarding_checks", "set_onboarding", "priorities", "rank_status", "rerank_priorities", "usage", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "run_recovery", "refresh", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "link_items", "set_linked_items", "updates_status", "check_updates", "set_updates", "install_update", "display_settings", "set_display", "retry_move", "report_issue", "report_send", "ai_rename"] as const;
|
|
51
51
|
export type AgentTool = typeof AGENT_TOOLS[number];
|
|
52
52
|
/** Tools that only read. */
|
|
53
53
|
export const READ_ONLY_TOOLS: readonly AgentTool[] = ["list_prs", "inbox_list", "workspace_about", "agent_settings", "display_settings", ...RPC_TOOLS.filter(t => t.kind === "read").map(t => t.name as AgentTool)];
|