paseo-follow-up 2.3.0-beta.0 → 2.3.0-beta.2
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 +17 -7
- package/client/catch-up.tsx +25 -105
- package/client/dismiss.tsx +106 -0
- package/client/home-chrome.tsx +3 -1
- package/client/home.tsx +4 -2
- package/client/inbox-store.ts +11 -1
- package/client/more-context.tsx +177 -0
- package/client/needs-you.tsx +28 -9
- package/client/questions.tsx +43 -8
- package/index.client.tsx +7 -0
- package/index.server.ts +27 -7
- package/package.json +3 -2
- package/server/agent-actions.ts +1 -1
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +10 -1
- package/server/context-requests.ts +6 -3
- package/server/dismiss.ts +62 -0
- package/server/engine.ts +13 -1
- package/server/hook-source.ts +1 -1
- package/server/inbox.ts +29 -4
- package/server/mcp-source.ts +8 -0
- package/server/mcp.mjs +8 -0
- package/server/questions.ts +47 -9
- package/shared/activity.ts +2 -2
- package/shared/attention.ts +50 -3
- package/shared/brief.ts +9 -6
- package/shared/catch-up.ts +29 -1
- package/shared/chat.ts +1 -1
- package/shared/contracts.ts +13 -3
- package/shared/display.ts +4 -3
- package/shared/errors.ts +6 -2
- package/shared/home-keys.ts +2 -2
- package/shared/inbox.ts +21 -3
- package/shared/model.ts +7 -0
- package/shared/paseo-keys.ts +24 -0
- package/shared/questions.ts +29 -1
- package/shared/search-key.ts +8 -8
- package/shared/section-search.ts +2 -2
- package/shared/status-invariants.ts +2 -2
package/server/agent-hook.mjs
CHANGED
|
@@ -13,7 +13,7 @@ const directory = dirname(fileURLToPath(import.meta.url));
|
|
|
13
13
|
/** 1.4.0-beta.2: launched with Follow-up's tools served by Paseo's MCP (follow_<name>), or the follow-up bridge (<name>). Agents opened before the upgrade carry no flag and keep the bridge names. */
|
|
14
14
|
let native = env("TOOLS") === "native";
|
|
15
15
|
// Tool names that read unambiguously in prose; kept identical to server/mcp.mjs's underscore names (a test checks it).
|
|
16
|
-
export const TOOL_NAMES = ["workspace_status", "sync_workspace", "enroll_workspace", "register_pr", "exclude_stack", "update_obligation", "acknowledge_batch", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "link_items", "set_linked_items", "workspace_about", "agent_settings", "needs_you", "declare_done", "list_prs", "add_reviewers", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "inbox_list", "sign_off", "snooze_workspace", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace", "display_settings", "set_display", "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", "rank_status", "rerank_priorities", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "run_recovery", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status", "check_updates", "set_updates", "install_update", "make_main_agent", "retry_move", "report_issue", "report_send", "ai_rename", "catch_up_deck", "context_requests", "ask_context", "context_reply"];
|
|
16
|
+
export const TOOL_NAMES = ["workspace_status", "sync_workspace", "enroll_workspace", "register_pr", "exclude_stack", "update_obligation", "acknowledge_batch", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "link_items", "set_linked_items", "workspace_about", "agent_settings", "needs_you", "declare_done", "list_prs", "add_reviewers", "enable_merge_when_ready", "disable_merge_when_ready", "send_repairs", "set_auto_send", "clear_hold", "retry_batch", "inbox_list", "sign_off", "snooze_workspace", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace", "display_settings", "set_display", "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", "rank_status", "rerank_priorities", "overseer_status", "overseer_start", "overseer_restart", "overseer_ask", "inbox_brief", "brief_action", "queue_list", "queue_action", "inbox_act", "answer_question", "dismiss_question", "dismiss_item", "run_recovery", "set_workspace_spec", "set_task_trigger", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status", "check_updates", "set_updates", "install_update", "make_main_agent", "retry_move", "report_issue", "report_send", "ai_rename", "catch_up_deck", "context_requests", "ask_context", "context_reply"];
|
|
17
17
|
const toolPattern = new RegExp(`(?<![\\w])(${TOOL_NAMES.join("|")})(?![\\w])`, "g");
|
|
18
18
|
/** Names Follow-up's tools the way this agent has them. */
|
|
19
19
|
export function named(text, isNative = native) { return isNative ? text.replace(toolPattern, "follow_$1") : text; }
|
package/server/agent-parity.ts
CHANGED
|
@@ -95,6 +95,14 @@ export const RPC_TOOLS: readonly RpcTool[] = [
|
|
|
95
95
|
{ name: "answer_question", rpc: "follow.answer-question", kind: "planned",
|
|
96
96
|
input: z.strictObject({ workspaceId: id.optional(), questionId: z.string().regex(/^Q\d+$/).optional(), choice: z.string().trim().min(1).max(200).optional(), words: z.string().trim().max(2000).optional(), ...confirm }),
|
|
97
97
|
toRpc: a => ({ workspaceId: a.workspaceId, questionId: a.questionId, choice: a.choice, words: a.words, action: "send" }) },
|
|
98
|
+
// dismissing-anything-in-needs-you-sends-the-agent-nothing: the small x on every Needs-you item and brief.
|
|
99
|
+
{ name: "dismiss_item", rpc: "follow.dismiss", kind: "planned",
|
|
100
|
+
input: z.strictObject({ workspaceId: id.optional(), key: z.string().min(1).max(400).optional(), agentId: id.optional(), undo: z.boolean().optional(), ...confirm }),
|
|
101
|
+
toRpc: a => ({ ...(a.agentId ? { agentId: a.agentId } : { workspaceId: a.workspaceId, key: a.key }), ...(a.undo ? { undo: true } : {}) }),
|
|
102
|
+
guard: (a, caller) => a.agentId === caller ? "dismiss_item dismisses another agent's brief for the developer; your own brief is the developer's to dismiss." : null },
|
|
103
|
+
{ name: "dismiss_question", rpc: "follow.dismiss-question", kind: "planned",
|
|
104
|
+
input: z.strictObject({ workspaceId: id.optional(), questionId: z.string().regex(/^Q\d+$/).optional(), undo: z.boolean().optional(), ...confirm }),
|
|
105
|
+
toRpc: a => ({ workspaceId: a.workspaceId, questionId: a.questionId, ...(a.undo ? { undo: true } : {}) }) },
|
|
98
106
|
// Workspace panel: recovery, refresh, the spec link, task triggers
|
|
99
107
|
{ name: "run_recovery", rpc: "follow.recover", kind: "planned", input: z.strictObject({ workspaceId: id.optional(), ...confirm }) },
|
|
100
108
|
{ name: "refresh", rpc: "follow.refresh", kind: "write", input: z.strictObject({ workspaceId: id.optional() }) },
|
|
@@ -186,6 +194,7 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
|
|
|
186
194
|
"follow.queue-action": { tools: ["queue_action"] },
|
|
187
195
|
"follow.inbox-act": { tools: ["sign_off", "snooze", "set_finish_flags", "inbox_act"] },
|
|
188
196
|
"follow.brief-action": { tools: ["brief_action"] },
|
|
197
|
+
"follow.dismiss": { tools: ["dismiss_item", "dismiss_question"], note: "The small x on every Needs-you item and brief. The server refuses an agent's own brief, question or workspace; undo: true is the toast's Undo. dismiss_question (follow.dismiss-question, which the client no longer calls) stays as the question-only alias of dismiss_item with key question:Qn." },
|
|
189
198
|
"follow.answer-question": { tools: ["answer_question"], note: "The tool sends (action send). Copy and Put in chat (action copy, chat) only move the developer's own words into their clipboard or their composer for them to send; an agent answers by sending, so it has no Put in chat." },
|
|
190
199
|
"follow.workspace-about": { tools: ["workspace_about"] },
|
|
191
200
|
"follow.rename-status": { tools: ["ai_rename"], note: "The dry run shows the name now and the suggestion." },
|
|
@@ -217,6 +226,6 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
|
|
|
217
226
|
* note says where an agent finds what the developer found.
|
|
218
227
|
*/
|
|
219
228
|
export const VIEW_PARITY: Record<string, { tools: readonly string[]; note: string }> = {
|
|
220
|
-
"catch-up": { tools: ["catch_up_deck", "answer_question", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Skip workspace, Back, the phone's drag) changes only the developer's view, so it has no server state and no tool. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
|
|
229
|
+
"catch-up": { tools: ["catch_up_deck", "answer_question", "dismiss_question", "dismiss_item", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Skip workspace, Back, the phone's drag) changes only the developer's view, so it has no server state and no tool. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
|
|
221
230
|
"section-search": { tools: ["workspace_status", "list_prs"], note: "The panel's Pull requests, Tasks and Activity search filters lists an agent already reads whole: workspace_status returns the workspace's PRs (title, branch, failed checks), tasks with their evidence, questions with their answers, and the sends, merges and PR actions the timeline is drawn from; list_prs returns every tracked PR with its checks." },
|
|
222
231
|
};
|
|
@@ -2,7 +2,7 @@ import { readFile } from "node:fs/promises";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { WriteBehind } from "./write-behind";
|
|
5
|
-
import { CONTEXT_ANSWER_MAX, contextFileSchema, plainAnswer, pruneContext, type ContextFile, type ContextRequest, type ContextTarget } from "../shared/catch-up";
|
|
5
|
+
import { CONTEXT_ANSWER_MAX, contextFileSchema, plainAnswer, pruneContext, sameCard, type ContextFile, type ContextRequest, type ContextTarget } from "../shared/catch-up";
|
|
6
6
|
|
|
7
7
|
export const CONTEXT_FILE = "context.json";
|
|
8
8
|
|
|
@@ -63,10 +63,13 @@ export class ContextRequests {
|
|
|
63
63
|
return filter.workspaceId ? live.filter(r => r.workspaceId === filter.workspaceId) : live;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Records an ask. One open ask per card, from whichever surface (`sameCard`: Catch up's key or the question's own):
|
|
68
|
+
* asking again while it's open returns that one (`fresh: false`).
|
|
69
|
+
*/
|
|
67
70
|
async ask(input: AskInput, by: string, askedOf: string | null): Promise<{ request: ContextRequest; fresh: boolean }> {
|
|
68
71
|
const { requests } = await this.load();
|
|
69
|
-
const open = requests.find(r => r.
|
|
72
|
+
const open = requests.find(r => r.state === "asking" && sameCard(r, input));
|
|
70
73
|
if (open) return { request: open, fresh: false };
|
|
71
74
|
const request: ContextRequest = {
|
|
72
75
|
id: `ctx-${randomUUID()}`, ...input, askedOf, state: "asking", answer: null, error: null,
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { actorBy, type Actor } from "../shared/actor";
|
|
2
|
+
import { allNeeds, dismissPrint, isDismissedNeed, type NeedItem } from "../shared/attention";
|
|
3
|
+
import type { Workspace } from "../shared/model";
|
|
4
|
+
import { dismissQuestion, undoDismiss } from "./questions";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Dismiss for every Needs-you item (dismissing-anything-in-needs-you-sends-the-agent-nothing): "this no longer needs
|
|
8
|
+
* me". Only this record changes. Nothing is queued or sent, so no agent spends a turn or a token on it, and nothing
|
|
9
|
+
* Follow-up holds is dropped: a dismissed send's batch stays queued on its Tasks rows, a dismissed retry's batch stays
|
|
10
|
+
* blocked, a paused workspace stays paused, an undelivered message keeps retrying. The item comes back when what it is
|
|
11
|
+
* about changes (dismissPrint), or on Undo.
|
|
12
|
+
*
|
|
13
|
+
* A question closes as dismissed (server/questions.ts dismissQuestion). An agent's turn-end brief is the inbox's
|
|
14
|
+
* (Inbox.dismiss). Everything else is pinned here, on `Workspace.dismissed`.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** How the toast and the tool name the item: "Q3", or what the row says. */
|
|
18
|
+
export function dismissName(item: Pick<NeedItem, "kind" | "title"> & { questionId?: string }): string {
|
|
19
|
+
if (item.kind === "question" && item.questionId) return item.questionId;
|
|
20
|
+
const title = item.title.trim();
|
|
21
|
+
return `"${title.length > 70 ? `${title.slice(0, 69)}…` : title}"`;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Workspace items an agent may not dismiss for the developer: the main agent's own workspace (its asks and its work). */
|
|
25
|
+
function refuseOwn(w: Workspace, actor: Actor): void {
|
|
26
|
+
if (actor.kind === "agent" && actor.agentId === w.mainAgentId)
|
|
27
|
+
throw new Error("This is your own workspace's Needs you: what it asks is the developer's to dismiss. dismiss_item dismisses another workspace's items for the developer.");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function dismissItem(w: Workspace, key: string, actor: Actor, now: number): { name: string } {
|
|
31
|
+
const question = /^question:(Q\d+)$/.exec(key)?.[1];
|
|
32
|
+
if (question) { dismissQuestion(w, question, actor, now); return { name: question }; }
|
|
33
|
+
const item = allNeeds(w, now).find(i => i.key === key);
|
|
34
|
+
// Moot, not failed: the item left Needs you by itself (merged, sent, resumed) before the click landed.
|
|
35
|
+
if (!item) throw new Error(`${key} is already gone from Needs you.`);
|
|
36
|
+
const print = dismissPrint(item, w);
|
|
37
|
+
if (isDismissedNeed(w, key, print)) throw new Error(`${key} is already dismissed.`);
|
|
38
|
+
refuseOwn(w, actor);
|
|
39
|
+
// Keep only dismissals that still hold: a changed item's old print would never match again.
|
|
40
|
+
const live = new Map(allNeeds(w, now).map(i => [i.key, dismissPrint(i, w)]));
|
|
41
|
+
w.dismissed = [...(w.dismissed ?? []).filter(d => d.key !== key && live.get(d.key) === d.print),
|
|
42
|
+
{ key, print, title: item.title.slice(0, 400), at: new Date(now).toISOString(), by: actorBy(actor) }].slice(-100);
|
|
43
|
+
return { name: dismissName(item) };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Undo: the item is back in Needs you as it was. */
|
|
47
|
+
export function undoDismissItem(w: Workspace, key: string, actor: Actor): { name: string } {
|
|
48
|
+
const question = /^question:(Q\d+)$/.exec(key)?.[1];
|
|
49
|
+
if (question) { undoDismiss(w, question); return { name: question }; }
|
|
50
|
+
const entry = w.dismissed?.find(d => d.key === key);
|
|
51
|
+
if (!entry) throw new Error(`${key} isn't dismissed, so there is nothing to undo.`);
|
|
52
|
+
refuseOwn(w, actor);
|
|
53
|
+
w.dismissed = w.dismissed!.filter(d => d.key !== key);
|
|
54
|
+
return { name: dismissName({ kind: "hold", title: entry.title }) };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** What the developer dismissed that still holds, for workspace_status: the agent learns only when it looks. */
|
|
58
|
+
export function dismissedNeeds(w: Workspace, now: number): NonNullable<Workspace["dismissed"]> {
|
|
59
|
+
if (!w.dismissed?.length) return [];
|
|
60
|
+
const all = allNeeds(w, now);
|
|
61
|
+
return w.dismissed.filter(d => all.some(i => i.key === d.key && dismissPrint(i, w) === d.print));
|
|
62
|
+
}
|
package/server/engine.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { completionBlockers, completionCheck, completionGate, revokesDone, type
|
|
|
7
7
|
import { Store } from "./store";
|
|
8
8
|
import { Github } from "./github";
|
|
9
9
|
import { batchPrompt, messageText, tasksFor, isRecovery, needsPrObservations, type TaskWording } from "./tasks";
|
|
10
|
-
import { answerRecipients, developerAnswer, syncTaskQuestions, type AnswerAction } from "./questions";
|
|
10
|
+
import { answerRecipients, developerAnswer, dismissQuestion, undoDismiss, syncTaskQuestions, type AnswerAction } from "./questions";
|
|
11
11
|
import { answerMessage, isOpen as isOpenQuestion, type Question } from "../shared/questions";
|
|
12
12
|
import { reconcileSubmittedStacks } from "./submissions";
|
|
13
13
|
import { applyDiscovery, interruptionHold, startsWithAutoSend, type DiscoveredWorkspace } from "./discovery";
|
|
@@ -418,6 +418,18 @@ export class Engine {
|
|
|
418
418
|
const workspace = findWorkspace(await this.store.snapshot(), workspaceId);
|
|
419
419
|
return { workspace, question: workspace.questions.find(q => q.id === questionId)! };
|
|
420
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* The developer dismisses a question (or an agent for them), or undoes that. Only the record changes: nothing is
|
|
423
|
+
* queued or sent, so the agent spends no turn on it (dismissing-a-question-sends-the-agent-nothing).
|
|
424
|
+
*/
|
|
425
|
+
async dismiss(workspaceId: string, questionId: string, undo: boolean, actor: Actor = DEVELOPER): Promise<{ workspace: Workspace; question: Question }> {
|
|
426
|
+
await this.store.mutateWorkspace(workspaceId, w => {
|
|
427
|
+
if (undo) undoDismiss(w, questionId); else dismissQuestion(w, questionId, actor, this.now());
|
|
428
|
+
w.updatedAt = new Date(this.now()).toISOString();
|
|
429
|
+
});
|
|
430
|
+
const workspace = findWorkspace(await this.store.snapshot(), workspaceId);
|
|
431
|
+
return { workspace, question: workspace.questions.find(q => q.id === questionId)! };
|
|
432
|
+
}
|
|
421
433
|
/** The queue that carries answers; the worker attaches it (tests may leave it off: answers are then only recorded). */
|
|
422
434
|
private queue: MessageQueue | null = null;
|
|
423
435
|
attachQueue(queue: MessageQueue): void {
|
package/server/hook-source.ts
CHANGED
|
@@ -15,7 +15,7 @@ export const hookSource: string = [
|
|
|
15
15
|
"/** 1.4.0-beta.2: launched with Follow-up's tools served by Paseo's MCP (follow_<name>), or the follow-up bridge (<name>). Agents opened before the upgrade carry no flag and keep the bridge names. */",
|
|
16
16
|
"let native = env(\"TOOLS\") === \"native\";",
|
|
17
17
|
"// Tool names that read unambiguously in prose; kept identical to server/mcp.mjs's underscore names (a test checks it).",
|
|
18
|
-
"export const TOOL_NAMES = [\"workspace_status\", \"sync_workspace\", \"enroll_workspace\", \"register_pr\", \"exclude_stack\", \"update_obligation\", \"acknowledge_batch\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"link_items\", \"set_linked_items\", \"workspace_about\", \"agent_settings\", \"needs_you\", \"declare_done\", \"list_prs\", \"add_reviewers\", \"enable_merge_when_ready\", \"disable_merge_when_ready\", \"send_repairs\", \"set_auto_send\", \"clear_hold\", \"retry_batch\", \"inbox_list\", \"sign_off\", \"snooze_workspace\", \"set_finish_flags\", \"set_priorities\", \"agent_digest\", \"route_candidates\", \"send_to_agent\", \"start_workspace\", \"display_settings\", \"set_display\", \"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\", \"rank_status\", \"rerank_priorities\", \"overseer_status\", \"overseer_start\", \"overseer_restart\", \"overseer_ask\", \"inbox_brief\", \"brief_action\", \"queue_list\", \"queue_action\", \"inbox_act\", \"answer_question\", \"run_recovery\", \"set_workspace_spec\", \"set_task_trigger\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\", \"check_updates\", \"set_updates\", \"install_update\", \"make_main_agent\", \"retry_move\", \"report_issue\", \"report_send\", \"ai_rename\", \"catch_up_deck\", \"context_requests\", \"ask_context\", \"context_reply\"];",
|
|
18
|
+
"export const TOOL_NAMES = [\"workspace_status\", \"sync_workspace\", \"enroll_workspace\", \"register_pr\", \"exclude_stack\", \"update_obligation\", \"acknowledge_batch\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"link_items\", \"set_linked_items\", \"workspace_about\", \"agent_settings\", \"needs_you\", \"declare_done\", \"list_prs\", \"add_reviewers\", \"enable_merge_when_ready\", \"disable_merge_when_ready\", \"send_repairs\", \"set_auto_send\", \"clear_hold\", \"retry_batch\", \"inbox_list\", \"sign_off\", \"snooze_workspace\", \"set_finish_flags\", \"set_priorities\", \"agent_digest\", \"route_candidates\", \"send_to_agent\", \"start_workspace\", \"display_settings\", \"set_display\", \"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\", \"rank_status\", \"rerank_priorities\", \"overseer_status\", \"overseer_start\", \"overseer_restart\", \"overseer_ask\", \"inbox_brief\", \"brief_action\", \"queue_list\", \"queue_action\", \"inbox_act\", \"answer_question\", \"dismiss_question\", \"dismiss_item\", \"run_recovery\", \"set_workspace_spec\", \"set_task_trigger\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\", \"check_updates\", \"set_updates\", \"install_update\", \"make_main_agent\", \"retry_move\", \"report_issue\", \"report_send\", \"ai_rename\", \"catch_up_deck\", \"context_requests\", \"ask_context\", \"context_reply\"];",
|
|
19
19
|
"const toolPattern = new RegExp(`(?<![\\\\w])(${TOOL_NAMES.join(\"|\")})(?![\\\\w])`, \"g\");",
|
|
20
20
|
"/** Names Follow-up's tools the way this agent has them. */",
|
|
21
21
|
"export function named(text, isNative = native) { return isNative ? text.replace(toolPattern, \"follow_$1\") : text; }",
|
package/server/inbox.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { copyOnAccess, detach, peek, type Changes } from "./cow";
|
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
import { BRIEF_ORIGINS_MAX, briefOriginSchema, emptyInbox, entrySchema, expired, inboxStateSchema, newEntry, reduce, StaleSignOff, type Entry, type InboxEvent, type InboxRow, type InboxState, type Reason, liveFlag, withoutRunState, FACT_REASONS, prEndEvent, reviewersBriefPr, markNotified, notifiedBefore, prNotice, pruneNotified } from "../shared/inbox";
|
|
15
15
|
import type { State as FollowState, Workspace as FollowWorkspace } from "../shared/model";
|
|
16
|
-
import {
|
|
16
|
+
import { reviewersAskStands } from "../shared/attention";
|
|
17
17
|
import { followUpObligations } from "../shared/follow-up";
|
|
18
18
|
import { configuredReviewers, reviewerLabel, withoutAuthor } from "../shared/reviewers";
|
|
19
19
|
import { classify, finishedReply, turnPrompt, type Sources } from "./inbox-classifier";
|
|
@@ -287,7 +287,7 @@ export type InboxOptions = {
|
|
|
287
287
|
export type BriefDecider = (prev: Entry, next: Entry, at: string) => BriefEvent | null;
|
|
288
288
|
/** Brief steps every inbox event implies: sign-off collapses, undo reopens, an answered prompt retires its slim brief. */
|
|
289
289
|
export function autoBrief(event: InboxEvent, prev?: Entry): BriefEvent | null {
|
|
290
|
-
if (event.type === "sign_off") return { type: "sign_off" };
|
|
290
|
+
if (event.type === "sign_off") return { type: "sign_off", ...(event.dismissed ? { dismissed: true } : {}) };
|
|
291
291
|
// Undoing a Later only moves the snooze back: the brief was never collapsed, so nothing reopens.
|
|
292
292
|
if (event.type === "undo") return prev?.undo?.kind === "snooze" ? null : { type: "undo" };
|
|
293
293
|
if (event.type === "permission_resolved") return { type: "permission_resolved" };
|
|
@@ -957,7 +957,7 @@ export class Inbox {
|
|
|
957
957
|
switch (input.action) {
|
|
958
958
|
case "sign_off": {
|
|
959
959
|
const before = Object.fromEntries((input.agentIds ?? []).map(id => [id, state.entries[id]]));
|
|
960
|
-
each(id => ({ type: "sign_off", ...(input.seqs?.[id] !== undefined ? { seq: input.seqs[id] } : {}), ...(input.muteTurn ? { muteTurn: true } : {}) }));
|
|
960
|
+
each(id => ({ type: "sign_off", ...(input.seqs?.[id] !== undefined ? { seq: input.seqs[id] } : {}), ...(input.muteTurn ? { muteTurn: true } : {}), ...(input.dismissed ? { dismissed: true } : {}) }));
|
|
961
961
|
const done = results.filter(r => r.ok).map(r => r.agentId);
|
|
962
962
|
cleared.push(...done); state.signOffs += done.length;
|
|
963
963
|
if (done.length > 1) state.batchUndo = { at, expires: new Date(now + DAY).toISOString(), unsorted: null, entries: done.map(id => ({ agentId: id, seq: state.entries[id].seq, prev: before[id]?.needs ?? null, prevSnooze: before[id]?.snooze ?? null })) };
|
|
@@ -1033,6 +1033,29 @@ export class Inbox {
|
|
|
1033
1033
|
return appends.map(a => a.agentId);
|
|
1034
1034
|
}
|
|
1035
1035
|
|
|
1036
|
+
/**
|
|
1037
|
+
* Dismiss an agent's turn-end brief (dismissing-anything-in-needs-you-sends-the-agent-nothing): a sign-off that sends
|
|
1038
|
+
* the agent nothing and remembers the ask, so a needs_you restating it isn't flagged again (`dismissedAsk`). Undo
|
|
1039
|
+
* brings the row and its card back. An agent can't dismiss its own brief.
|
|
1040
|
+
*/
|
|
1041
|
+
async dismiss(agentId: string, undo: boolean, actor: Actor = DEVELOPER): Promise<{ name: string }> {
|
|
1042
|
+
if (actor.kind === "agent" && actor.agentId === agentId) throw new Error("This is your own brief: it is the developer's to dismiss. dismiss_item dismisses another agent's brief for the developer.");
|
|
1043
|
+
const e = (await this.store.snapshot()).entries[agentId];
|
|
1044
|
+
if (undo) {
|
|
1045
|
+
if (!e?.dismissedAsk || e.undo?.kind !== "sign_off") throw new Error("This agent's ask isn't dismissed, so there is nothing to undo.");
|
|
1046
|
+
await this.act({ action: "undo", agentIds: [agentId] }, actor);
|
|
1047
|
+
return { name: "the agent's ask" };
|
|
1048
|
+
}
|
|
1049
|
+
if (!e?.needs) throw new Error("This agent's ask is already gone from Needs you.");
|
|
1050
|
+
await this.act({ action: "sign_off", agentIds: [agentId], dismissed: true }, actor);
|
|
1051
|
+
return { name: "the agent's ask" };
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
/** The ask the developer dismissed on this agent's row, if it still stands (cleared by their next message or Undo). */
|
|
1055
|
+
async dismissedAsk(agentId: string): Promise<{ ask: string; kind: string; at: string } | null> {
|
|
1056
|
+
return (await this.store.snapshot()).entries[agentId]?.dismissedAsk ?? null;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1036
1059
|
/** The stored brief for one agent, for Home's detail pane. */
|
|
1037
1060
|
async brief(agentId: string): Promise<Brief | null> {
|
|
1038
1061
|
if (!await this.on()) return null;
|
|
@@ -1109,6 +1132,8 @@ export function briefShare(state: Pick<InboxState, "briefOrigins">, now: number,
|
|
|
1109
1132
|
export type InboxAction = {
|
|
1110
1133
|
action: "sign_off" | "undo" | "snooze" | "unsnooze" | "mute_turn" | "set_finish_flags" | "unsorted_flag" | "unsorted_sign_off" | "batch_undo";
|
|
1111
1134
|
agentIds?: string[]; seqs?: Record<string, number>; until?: string; value?: boolean; muteTurn?: boolean;
|
|
1135
|
+
/** Dismiss (follow.dismiss, never the inbox RPC): a sign-off that remembers the ask, so a restated ask isn't flagged again. */
|
|
1136
|
+
dismissed?: boolean;
|
|
1112
1137
|
};
|
|
1113
1138
|
|
|
1114
1139
|
/**
|
|
@@ -1208,7 +1233,7 @@ export function followUpEvents(follow: FollowState, enablePrClosed: boolean): {
|
|
|
1208
1233
|
if (s.conflict) events.push({ agentId, event: { type: "review", dedupeKey: `${pr.key}:conflict:${s.head}`, detail: `Merge conflict to fix on #${pr.number}`, suppressed: repairing || automatic } });
|
|
1209
1234
|
// Reviewers are the developer's job, and don't wait for threads or CI. Skipped only while a reviewer request
|
|
1210
1235
|
// or merge is already in flight for this PR (so a second request isn't asked for while GitHub catches up).
|
|
1211
|
-
if (
|
|
1236
|
+
if (reviewersAskStands(pr, w))
|
|
1212
1237
|
events.push({ agentId, event: { type: "reviewers", dedupeKey: `${pr.key}:reviewers`, detail: `#${pr.number}`, prKey: pr.key, url: prLink(pr).url,
|
|
1213
1238
|
names: withoutAuthor(configuredReviewers(pr.repo), s.reviewers?.author).map(reviewerLabel) } });
|
|
1214
1239
|
} else if (enablePrClosed) {
|
package/server/mcp-source.ts
CHANGED
|
@@ -101,6 +101,8 @@ export const mcpSource: string = [
|
|
|
101
101
|
" [\"inbox_brief\", \"Read another agent's full Needs-you brief (decisions, options, links): { agentId }.\" + read, \"follow.agent-act\", { agentId: string }, [\"agentId\"]],",
|
|
102
102
|
" [\"brief_action\", \"Answer another agent's brief for the developer, like its card: { agentId, briefId, decisionId + choice, or choices [{ decisionId, choice }], or move: retry (a failed turn) or done (an Action brief: sends \\\"Done: <ask>\\\" as the developer) }. choice \\\"other\\\" is Something else and needs words (top-level, or on its entry in choices); words with a letter is the developer's note, sent with it. Never your own brief.\" + ask, \"follow.agent-act\", { agentId: string, briefId: string, decisionId: string, choice: string, words: string, move: string, choices: { type: \"array\", items: { type: \"object\" } }, ...planned }, []],",
|
|
103
103
|
" [\"inbox_act\", \"The inbox's other actions on other agents' rows: action undo|mute_turn|unsorted_flag|unsorted_sign_off|batch_undo, agentIds.\" + ask, \"follow.agent-act\", { action: string, agentIds: array, muteTurn: boolean, ...planned }, []],",
|
|
104
|
+
" [\"dismiss_item\", \"Dismiss anything in Needs you for the developer, like its small x: { workspaceId, key } for a workspace's item (keys from inbox_list or catch_up_deck: merge:<pr>, reviewers:<pr>, send:<batch>, question:Q3…), or { agentId } for another agent's turn-end brief. Sends no agent anything; the item comes back if it changes. undo: true brings it back. Never your own brief, question or workspace.\" + ask, \"follow.agent-act\", { workspaceId: string, key: string, agentId: string, undo: boolean, ...planned }, []],",
|
|
105
|
+
" [\"dismiss_question\", \"Dismiss another agent's question (Q1…) that no longer matters, for the developer, like its card's Dismiss: { workspaceId, questionId }. Sends that agent nothing. undo: true reopens it. For a question you asked, use withdraw_question.\" + ask, \"follow.agent-act\", { workspaceId: string, questionId: string, undo: boolean, ...planned }, []],",
|
|
104
106
|
" [\"answer_question\", \"Send the developer's answer to another agent's question (Q1…), like its card: { workspaceId, questionId, choice, words }. choice is an option letter, or \\\"other\\\" (Something else) with the developer's answer as words. For a question you asked, use record_answer.\" + ask, \"follow.agent-act\", { workspaceId: string, questionId: string, choice: string, words: string, ...planned }, []],",
|
|
105
107
|
" [\"run_recovery\", \"Run recovery on a workspace, like Run recovery: a separate agent reads its history for missed PRs and tasks. { workspaceId }.\" + ask, \"follow.agent-act\", { workspaceId: string, ...planned }, []],",
|
|
106
108
|
" [\"refresh\", \"Refresh PR status now, like Refresh. Cheap; use when status looks stale.\", \"follow.agent-act\", { workspaceId: string }, []],",
|
|
@@ -262,6 +264,12 @@ export const mcpSource: string = [
|
|
|
262
264
|
" prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads.length, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),",
|
|
263
265
|
" obligations: w.obligations.filter(o => ![\"done\", \"waived\"].includes(o.status)), completedObligations: w.obligations.filter(o => [\"done\", \"waived\"].includes(o.status)).length,",
|
|
264
266
|
" openQuestions: (w.questions ?? []).filter(q => !q.answer && !q.closed).map(q => ({ id: q.id, title: q.title, question: q.question, options: q.options, recommend: q.recommend, big: q.big, mode: q.mode, askedBy: q.askedBy, taskId: q.taskId })),",
|
|
267
|
+
" // Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.",
|
|
268
|
+
" dismissedQuestions: (w.questions ?? []).filter(q => !q.answer && q.closed?.dismissed).slice(-20).map(q => ({ id: q.id, title: q.title, at: q.closed.at, by: q.closed.by, taskId: q.taskId })),",
|
|
269
|
+
" // Needs-you items the developer dismissed (merge, reviewers, a stuck repair…): hidden until they change; nothing was sent.",
|
|
270
|
+
" dismissedItems: (w.dismissed ?? []).slice(-20).map(d => ({ key: d.key, title: d.title, at: d.at, by: d.by })),",
|
|
271
|
+
" // Your own ask the developer dismissed: they don't need it; don't raise it again at a turn's end.",
|
|
272
|
+
" ...(w.dismissedAsk ? { dismissedAsk: w.dismissedAsk } : {}),",
|
|
265
273
|
" spec: w.spec?.url ? { url: w.spec.url, title: w.spec.title, source: w.spec.source } : null,",
|
|
266
274
|
" recentAnswers: (w.questions ?? []).filter(q => q.answer).slice(-5).map(q => ({ id: q.id, title: q.title, choice: q.answer.choice, words: q.answer.words, delivery: q.answer.delivery.state })),",
|
|
267
275
|
" batches: w.batches.filter(b => ![\"completed\", \"cancelled\"].includes(b.state)).map(b => ({ id: b.id, state: b.state, tasks: b.tasks, result: b.result, recipientAgentId: b.recipientAgentId, contextPath: b.contextPath })),",
|
package/server/mcp.mjs
CHANGED
|
@@ -99,6 +99,8 @@ const actionTools = [
|
|
|
99
99
|
["inbox_brief", "Read another agent's full Needs-you brief (decisions, options, links): { agentId }." + read, "follow.agent-act", { agentId: string }, ["agentId"]],
|
|
100
100
|
["brief_action", "Answer another agent's brief for the developer, like its card: { agentId, briefId, decisionId + choice, or choices [{ decisionId, choice }], or move: retry (a failed turn) or done (an Action brief: sends \"Done: <ask>\" as the developer) }. choice \"other\" is Something else and needs words (top-level, or on its entry in choices); words with a letter is the developer's note, sent with it. Never your own brief." + ask, "follow.agent-act", { agentId: string, briefId: string, decisionId: string, choice: string, words: string, move: string, choices: { type: "array", items: { type: "object" } }, ...planned }, []],
|
|
101
101
|
["inbox_act", "The inbox's other actions on other agents' rows: action undo|mute_turn|unsorted_flag|unsorted_sign_off|batch_undo, agentIds." + ask, "follow.agent-act", { action: string, agentIds: array, muteTurn: boolean, ...planned }, []],
|
|
102
|
+
["dismiss_item", "Dismiss anything in Needs you for the developer, like its small x: { workspaceId, key } for a workspace's item (keys from inbox_list or catch_up_deck: merge:<pr>, reviewers:<pr>, send:<batch>, question:Q3…), or { agentId } for another agent's turn-end brief. Sends no agent anything; the item comes back if it changes. undo: true brings it back. Never your own brief, question or workspace." + ask, "follow.agent-act", { workspaceId: string, key: string, agentId: string, undo: boolean, ...planned }, []],
|
|
103
|
+
["dismiss_question", "Dismiss another agent's question (Q1…) that no longer matters, for the developer, like its card's Dismiss: { workspaceId, questionId }. Sends that agent nothing. undo: true reopens it. For a question you asked, use withdraw_question." + ask, "follow.agent-act", { workspaceId: string, questionId: string, undo: boolean, ...planned }, []],
|
|
102
104
|
["answer_question", "Send the developer's answer to another agent's question (Q1…), like its card: { workspaceId, questionId, choice, words }. choice is an option letter, or \"other\" (Something else) with the developer's answer as words. For a question you asked, use record_answer." + ask, "follow.agent-act", { workspaceId: string, questionId: string, choice: string, words: string, ...planned }, []],
|
|
103
105
|
["run_recovery", "Run recovery on a workspace, like Run recovery: a separate agent reads its history for missed PRs and tasks. { workspaceId }." + ask, "follow.agent-act", { workspaceId: string, ...planned }, []],
|
|
104
106
|
["refresh", "Refresh PR status now, like Refresh. Cheap; use when status looks stale.", "follow.agent-act", { workspaceId: string }, []],
|
|
@@ -260,6 +262,12 @@ function currentWork(w) {
|
|
|
260
262
|
prs: w.prs.map(p => ({ key: p.key, stack: p.stack, parent: p.parent, disposition: p.disposition, error: p.error, ...(p.snapshot ? { title: p.snapshot.title, state: p.snapshot.state, head: p.snapshot.head, draft: p.snapshot.draft, reviewDecision: p.snapshot.reviewDecision, conflict: p.snapshot.conflict, openThreads: p.snapshot.threads.length, failedChecks: p.snapshot.failedChecks, otherFailedChecks: p.snapshot.otherFailedChecks ?? [], deployment: p.snapshot.deployment } : {}) })),
|
|
261
263
|
obligations: w.obligations.filter(o => !["done", "waived"].includes(o.status)), completedObligations: w.obligations.filter(o => ["done", "waived"].includes(o.status)).length,
|
|
262
264
|
openQuestions: (w.questions ?? []).filter(q => !q.answer && !q.closed).map(q => ({ id: q.id, title: q.title, question: q.question, options: q.options, recommend: q.recommend, big: q.big, mode: q.mode, askedBy: q.askedBy, taskId: q.taskId })),
|
|
265
|
+
// Dismissed by the developer: no longer matters, nothing was sent. Don't ask these again or point at them.
|
|
266
|
+
dismissedQuestions: (w.questions ?? []).filter(q => !q.answer && q.closed?.dismissed).slice(-20).map(q => ({ id: q.id, title: q.title, at: q.closed.at, by: q.closed.by, taskId: q.taskId })),
|
|
267
|
+
// Needs-you items the developer dismissed (merge, reviewers, a stuck repair…): hidden until they change; nothing was sent.
|
|
268
|
+
dismissedItems: (w.dismissed ?? []).slice(-20).map(d => ({ key: d.key, title: d.title, at: d.at, by: d.by })),
|
|
269
|
+
// Your own ask the developer dismissed: they don't need it; don't raise it again at a turn's end.
|
|
270
|
+
...(w.dismissedAsk ? { dismissedAsk: w.dismissedAsk } : {}),
|
|
263
271
|
spec: w.spec?.url ? { url: w.spec.url, title: w.spec.title, source: w.spec.source } : null,
|
|
264
272
|
recentAnswers: (w.questions ?? []).filter(q => q.answer).slice(-5).map(q => ({ id: q.id, title: q.title, choice: q.answer.choice, words: q.answer.words, delivery: q.answer.delivery.state })),
|
|
265
273
|
batches: w.batches.filter(b => !["completed", "cancelled"].includes(b.state)).map(b => ({ id: b.id, state: b.state, tasks: b.tasks, result: b.result, recipientAgentId: b.recipientAgentId, contextPath: b.contextPath })),
|
package/server/questions.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DEVELOPER, type Actor } from "../shared/actor";
|
|
1
|
+
import { DEVELOPER, actorBy, type Actor } from "../shared/actor";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { blockedOnDeveloper, type Workspace } from "../shared/model";
|
|
4
4
|
import { followUpObligations } from "../shared/follow-up";
|
|
5
|
-
import { OTHER, OTHER_LABEL, QUESTION_MODE_RULES, choiceError, findOpenMatch, isOpen, isOther, nextQuestionId, validChoice, type Question, type QuestionMode } from "../shared/questions";
|
|
5
|
+
import { DISMISS_REASON, OTHER, OTHER_LABEL, QUESTION_MODE_RULES, choiceError, findDismissedMatch, findOpenMatch, isDismissed, isOpen, isOther, nextQuestionId, validChoice, type Question, type QuestionMode } from "../shared/questions";
|
|
6
6
|
|
|
7
7
|
/** "other" and its label both mean Something else, so an agent recording "Something else" lands on the same answer. */
|
|
8
8
|
const normalChoice = (choice: string) => [OTHER, OTHER_LABEL.toLowerCase()].includes(choice.trim().toLowerCase()) ? OTHER : choice.trim();
|
|
@@ -24,8 +24,9 @@ function resolvePr(w: Workspace, ref: string): string {
|
|
|
24
24
|
export type AskOutcome = {
|
|
25
25
|
question: Question; instruction: string;
|
|
26
26
|
/** asked: a new question. duplicate: the same question was already open, so it wasn't asked again. superseded: a
|
|
27
|
-
* changed version of an open question; the old one closed as "Superseded by Qn".
|
|
28
|
-
|
|
27
|
+
* changed version of an open question; the old one closed as "Superseded by Qn". dismissed: the developer dismissed
|
|
28
|
+
* this question, so it wasn't asked again. */
|
|
29
|
+
outcome: "asked" | "duplicate" | "superseded" | "dismissed";
|
|
29
30
|
/** The question that was already open (duplicate) or that this one replaced (superseded). */
|
|
30
31
|
of: string | null;
|
|
31
32
|
};
|
|
@@ -54,8 +55,12 @@ export function askQuestion(w: Workspace, agentId: string, input: AskInput, mode
|
|
|
54
55
|
if (opts.supersedes) {
|
|
55
56
|
replace = w.questions.find(q => q.id === opts.supersedes) ?? null;
|
|
56
57
|
if (!replace) throw new Error(`No question ${opts.supersedes} in this workspace.`);
|
|
57
|
-
|
|
58
|
+
// A dismissed question may be asked again on purpose, when something really changed: it stays dismissed.
|
|
59
|
+
if (!isOpen(replace) && !isDismissed(replace)) throw new Error(`${replace.id} is already ${replace.answer ? "answered" : "closed"}; ask without supersedes.`);
|
|
58
60
|
} else {
|
|
61
|
+
// dismissing-a-question-sends-the-agent-nothing: what the developer dismissed doesn't come back as a new card.
|
|
62
|
+
const dismissed = findDismissedMatch(w.questions, shape, agentId);
|
|
63
|
+
if (dismissed && !findOpenMatch(w.questions, shape, agentId)) return { question: dismissed, outcome: "dismissed", of: dismissed.id, instruction: dismissedInstruction(dismissed) };
|
|
59
64
|
const match = findOpenMatch(w.questions, shape, agentId);
|
|
60
65
|
if (match?.verdict === "same") {
|
|
61
66
|
const open = match.question;
|
|
@@ -72,7 +77,7 @@ export function askQuestion(w: Workspace, agentId: string, input: AskInput, mode
|
|
|
72
77
|
askedBy: agentId, askedAt: new Date(now).toISOString(), mode, answer: null, closed: null, via: opts.via ?? "ask",
|
|
73
78
|
};
|
|
74
79
|
w.questions.push(question);
|
|
75
|
-
if (replace) replace.closed = { at: question.askedAt, reason: `Superseded by ${question.id}.`, by: agentId };
|
|
80
|
+
if (replace && isOpen(replace)) replace.closed = { at: question.askedAt, reason: `Superseded by ${question.id}.`, by: agentId };
|
|
76
81
|
const rule = QUESTION_MODE_RULES[mode].rule({ recommend, big: question.big });
|
|
77
82
|
const instruction = [
|
|
78
83
|
`Asked ${question.id}${replace ? ` (it replaces ${replace.id}, now closed as superseded)` : ""}. Question mode: ${QUESTION_MODE_RULES[mode].label}. ${rule}`,
|
|
@@ -106,6 +111,35 @@ export function withdrawQuestion(w: Workspace, agentId: string, id: string, reas
|
|
|
106
111
|
return q;
|
|
107
112
|
}
|
|
108
113
|
|
|
114
|
+
/** What an agent hears when it asks, or points at, a question the developer dismissed. */
|
|
115
|
+
export const dismissedInstruction = (q: Pick<Question, "id" | "title">) =>
|
|
116
|
+
`The developer dismissed ${q.id} (${q.title}): it no longer matters, so it isn't asked again and nothing was sent to you. Carry on without it and don't raise it again, at a turn's end either. If something really changed, ask again with supersedes="${q.id}".`;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The developer dismisses a question that no longer matters (dismissing-a-question-sends-the-agent-nothing). It closes
|
|
120
|
+
* as dismissed and leaves Needs you; nothing is queued or sent, so the agent spends no turn and no tokens on it. It
|
|
121
|
+
* learns only when it looks: workspace_status, or asking or pointing at it again. An agent may dismiss another agent's
|
|
122
|
+
* question for the developer (dismiss_question), never one it asked or owns: that is withdraw_question.
|
|
123
|
+
*/
|
|
124
|
+
export function dismissQuestion(w: Workspace, id: string, actor: Actor, now: number): Question {
|
|
125
|
+
const q = w.questions.find(q => q.id === id);
|
|
126
|
+
if (!q) throw new Error(`No question ${id} in this workspace.`);
|
|
127
|
+
if (!isOpen(q)) throw new Error(`${id} is already ${q.answer ? "answered" : isDismissed(q) ? "dismissed" : "closed"}.`);
|
|
128
|
+
if (actor.kind === "agent" && (actor.agentId === q.askedBy || actor.agentId === w.mainAgentId))
|
|
129
|
+
throw new Error(`${id} is your own question: use withdraw_question with a reason. dismiss_question dismisses another agent's question for the developer.`);
|
|
130
|
+
q.closed = { at: new Date(now).toISOString(), reason: DISMISS_REASON, by: actorBy(actor), dismissed: true };
|
|
131
|
+
return q;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** Undo: a dismissed question opens again as it was. Only a dismissal can be undone this way. */
|
|
135
|
+
export function undoDismiss(w: Workspace, id: string): Question {
|
|
136
|
+
const q = w.questions.find(q => q.id === id);
|
|
137
|
+
if (!q) throw new Error(`No question ${id} in this workspace.`);
|
|
138
|
+
if (!isDismissed(q)) throw new Error(`${id} isn't dismissed, so there is nothing to undo.`);
|
|
139
|
+
q.closed = null;
|
|
140
|
+
return q;
|
|
141
|
+
}
|
|
142
|
+
|
|
109
143
|
/** Delivery states a Resend (Retry, Try now) applies to. */
|
|
110
144
|
export const RESENDABLE: readonly string[] = ["queued", "retrying", "failed", "unconfirmed"];
|
|
111
145
|
/** How the developer's answer leaves the card: sent by Follow-up, copied, or put in the agent's chat (Paseo 0.16), or sent again. */
|
|
@@ -115,6 +149,7 @@ export type AnswerAction = "send" | "copy" | "chat" | "resend";
|
|
|
115
149
|
export function developerAnswer(w: Workspace, id: string, choice: string, words: string | undefined, action: AnswerAction, now: number, actor: Actor = DEVELOPER): Question {
|
|
116
150
|
const q = w.questions.find(q => q.id === id);
|
|
117
151
|
if (!q) throw new Error(`No question ${id} in this workspace.`);
|
|
152
|
+
if (isDismissed(q)) throw new Error(`${id} was dismissed, so nothing was sent.`);
|
|
118
153
|
if (q.closed) throw new Error(`${id} was withdrawn: ${q.closed.reason}`);
|
|
119
154
|
const at = new Date(now).toISOString();
|
|
120
155
|
if (action === "resend") {
|
|
@@ -179,11 +214,12 @@ export function decisionOf(q: Question): NeedsYouDecision {
|
|
|
179
214
|
* questions. A second call in the same turn replaces only the questions the first call created, never one it linked.
|
|
180
215
|
*/
|
|
181
216
|
export function needsYouQuestions(w: Workspace, agentId: string, call: { decisions?: NeedsYouDecision[]; questions?: string[] }, mode: QuestionMode, now: number,
|
|
182
|
-
previous: { createdIds?: string[]; questionIds?: string[] } | null): { questionIds: string[]; createdIds: string[]; decisions: NeedsYouDecision[] } {
|
|
183
|
-
const questionIds: string[] = [], createdIds: string[] = [], decisions: NeedsYouDecision[] = [];
|
|
217
|
+
previous: { createdIds?: string[]; questionIds?: string[] } | null): { questionIds: string[]; createdIds: string[]; decisions: NeedsYouDecision[]; dismissed: string[] } {
|
|
218
|
+
const questionIds: string[] = [], createdIds: string[] = [], decisions: NeedsYouDecision[] = [], dismissed: string[] = [];
|
|
184
219
|
for (const id of call.questions ?? []) {
|
|
185
220
|
const q = w.questions.find(q => q.id === id);
|
|
186
221
|
if (!q) throw new Error(`No question ${id} in this workspace.`);
|
|
222
|
+
if (isDismissed(q)) throw new Error(dismissedInstruction(q));
|
|
187
223
|
if (!isOpen(q)) throw new Error(`${id} is already ${q.answer ? "answered" : "closed"}, so it isn't open any more. Leave it out.`);
|
|
188
224
|
if (questionIds.includes(id)) continue;
|
|
189
225
|
questionIds.push(id); decisions.push(decisionOf(q));
|
|
@@ -191,6 +227,8 @@ export function needsYouQuestions(w: Workspace, agentId: string, call: { decisio
|
|
|
191
227
|
for (const d of call.decisions ?? []) {
|
|
192
228
|
const options = (d.options ?? []).map((o, i) => ({ letter: String.fromCharCode(65 + i), label: o.label, ...(o.consequence ? { consequence: o.consequence } : {}) }));
|
|
193
229
|
const r = askQuestion(w, agentId, { title: d.question.slice(0, 120), question: d.question, options, ...(d.options?.length ? { recommend: String.fromCharCode(65 + d.recommend!) } : {}) }, mode, now, { via: "needs_you" });
|
|
230
|
+
// A decision the developer dismissed doesn't come back on the card.
|
|
231
|
+
if (r.outcome === "dismissed") { dismissed.push(r.question.id); continue; }
|
|
194
232
|
if (questionIds.includes(r.question.id)) continue;
|
|
195
233
|
questionIds.push(r.question.id);
|
|
196
234
|
decisions.push(r.outcome === "duplicate" ? decisionOf(r.question) : d);
|
|
@@ -202,5 +240,5 @@ export function needsYouQuestions(w: Workspace, agentId: string, call: { decisio
|
|
|
202
240
|
const q = w.questions.find(q => q.id === id);
|
|
203
241
|
if (q && isOpen(q) && !questionIds.includes(id) && q.via !== "ask") q.closed = { at: new Date(now).toISOString(), reason: "Replaced by a newer needs_you call.", by: agentId };
|
|
204
242
|
}
|
|
205
|
-
return { questionIds, createdIds, decisions };
|
|
243
|
+
return { questionIds, createdIds, decisions, dismissed };
|
|
206
244
|
}
|
package/shared/activity.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ListWorkspace as Workspace } from "./list";
|
|
|
2
2
|
import { recoveryBatch } from "./follow-up";
|
|
3
3
|
import { shortRefs } from "./attention";
|
|
4
4
|
import { isGithubFlow } from "./pr-actions";
|
|
5
|
-
import { answerLabel, answerStatus } from "./questions";
|
|
5
|
+
import { answerLabel, answerStatus, closedLine } from "./questions";
|
|
6
6
|
|
|
7
7
|
export type ActivityTone = "merged" | "success" | "warning" | "danger" | "muted";
|
|
8
8
|
export type Activity = { key: string; at: string; icon: string; tone: ActivityTone; text: string; detail: string | null; took: string | null };
|
|
@@ -59,7 +59,7 @@ export function activity(w: Workspace): Activity[] {
|
|
|
59
59
|
const said = !s.delivered ? s.label : q.answer.by === "agent" ? "Answered in chat" : "Answered";
|
|
60
60
|
rows.push({ key: `answered:${q.id}`, at: q.answer.at, icon: "MessageCircleReply", tone: s.delivered ? "success" : "muted", text: ref, detail: `${said}: ${answerLabel(q, q.answer.choice, q.answer.words)}`, took: duration(q.askedAt, q.answer.at) });
|
|
61
61
|
}
|
|
62
|
-
if (q.closed) rows.push({ key: `withdrawn:${q.id}`, at: q.closed.at, icon: "MessageCircleOff", tone: "muted", text: ref, detail:
|
|
62
|
+
if (q.closed) rows.push({ key: `withdrawn:${q.id}`, at: q.closed.at, icon: "MessageCircleOff", tone: "muted", text: ref, detail: closedLine(q), took: null });
|
|
63
63
|
}
|
|
64
64
|
if (w.completion) rows.push({ key: "done", at: w.completion.declaredAt, icon: "CircleCheck", tone: "success", text: "Main agent declared Done", detail: null, took: null });
|
|
65
65
|
return rows.filter(r => Number.isFinite(Date.parse(r.at))).sort((a, b) => Date.parse(b.at) - Date.parse(a.at) || a.key.localeCompare(b.key));
|
package/shared/attention.ts
CHANGED
|
@@ -186,10 +186,57 @@ export function asksForReviewers(pr: Pr, w: Pick<Workspace, "prActions">): boole
|
|
|
186
186
|
return !agentMerges(pr) && noReviewers(pr) && !pr.snapshot!.draft && configuredReviewers(pr.repo).length > 0 && !w.prActions.some(a => prActionBlocks(a, [pr.key]));
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
/**
|
|
190
|
-
|
|
189
|
+
/**
|
|
190
|
+
* What an item's dismissal is pinned to (dismissing-anything-in-needs-you-sends-the-agent-nothing): Dismiss hides the
|
|
191
|
+
* item while this print matches, and a change to what it is about makes a new print, so a real new problem comes back.
|
|
192
|
+
* Per kind, what "changed" means:
|
|
193
|
+
* - merge, reviewers: the PR's head commit (a new push asks again).
|
|
194
|
+
* - retry: the batch, its state, attempts and result (a new failure, or the next attempt failing).
|
|
195
|
+
* - capped, person: the task's fingerprint (what GitHub shows for it) and why it is held.
|
|
196
|
+
* - send: the batch and its tasks' fingerprints (a new batch, or a task added or changed).
|
|
197
|
+
* - decision: the task's revision and ask. hold: the pause's reason. check: the action and its result.
|
|
198
|
+
* - answer: the delivery state and the answer (failed again after a Retry, copied then put in chat).
|
|
199
|
+
* - message: the queue item and its state (queued past the stuck mark, then failed).
|
|
200
|
+
* A question never needs a print: its dismissal closes it (server/questions.ts dismissQuestion).
|
|
201
|
+
*/
|
|
202
|
+
export function dismissPrint(i: NeedItem, w: Workspace): string {
|
|
203
|
+
switch (i.kind) {
|
|
204
|
+
case "hold": return `${w.hold ?? ""}`;
|
|
205
|
+
case "retry": { const b = w.batches.find(b => b.id === i.batchId); return `${i.batchId}|${b?.state ?? ""}|${b?.attempts ?? 0}|${b?.result ?? ""}`; }
|
|
206
|
+
case "capped": case "person": { const h = (w.heldTasks ?? []).find(h => h.task.key === i.taskKey); return `${i.taskKey}|${h?.task.fingerprint ?? ""}|${i.detail}`; }
|
|
207
|
+
case "send": { const b = w.batches.find(b => b.id === i.batchId); return `${i.batchId}|${(b?.tasks ?? []).map(t => `${t.key}:${t.fingerprint}`).sort().join(",")}`; }
|
|
208
|
+
case "decision": { const o = w.obligations.find(o => o.id === i.obligationId); return `${i.obligationId}|${o?.revision ?? ""}|${i.detail}`; }
|
|
209
|
+
case "question": return i.questionId;
|
|
210
|
+
case "answer": { const a = (w.questions ?? []).find(q => q.id === i.questionId)?.answer; return `${i.questionId}|${a?.delivery.state ?? ""}|${a?.at ?? ""}|${a?.choice ?? ""}|${a?.words ?? ""}`; }
|
|
211
|
+
case "check": return `${i.actionId}|${i.detail}`;
|
|
212
|
+
case "message": { const m = (w.undelivered ?? []).find(m => m.id === i.itemId); return `${i.itemId}|${m?.state ?? ""}`; }
|
|
213
|
+
case "merge": case "reviewers": return `${i.prKey}|${w.prs.find(p => p.key === i.prKey)?.snapshot?.head ?? ""}`;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/** The developer dismissed this item and it hasn't changed since (dismissPrint). */
|
|
217
|
+
export const isDismissedNeed = (w: Pick<Workspace, "dismissed">, key: string, print: string) => !!w.dismissed?.some(d => d.key === key && d.print === print);
|
|
218
|
+
/**
|
|
219
|
+
* Whether the reviewers ask for this PR stands: it asks (asksForReviewers) and the developer hasn't dismissed it since
|
|
220
|
+
* its last push. The inbox's "Add reviewers" flag reads this, so dismissing the ask in Needs you drops the agent row's
|
|
221
|
+
* flag too, and the two never disagree (reviewers-ask-agrees).
|
|
222
|
+
*/
|
|
223
|
+
export function reviewersAskStands(pr: Pr, w: Pick<Workspace, "prActions" | "dismissed">): boolean {
|
|
224
|
+
return asksForReviewers(pr, w) && !isDismissedNeed(w, `reviewers:${pr.key}`, `${pr.key}|${pr.snapshot?.head ?? ""}`);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Every Needs-you item, dismissed ones included: what Dismiss looks an item up in (server/dismiss.ts) and what
|
|
229
|
+
* workspace_status reads to say what the developer dismissed. Every count and surface reads needsYou.
|
|
230
|
+
*/
|
|
231
|
+
const allNeedsOnce = perSnapshot(computeAllNeeds);
|
|
232
|
+
export const allNeeds = (w: Workspace, now = Date.now()): NeedItem[] => [...allNeedsOnce(w, now)];
|
|
233
|
+
/** What needs the developer, most urgent first, without what they dismissed. Answered once per store snapshot and clock reading (perSnapshot); each caller gets its own array. */
|
|
234
|
+
const needsYouOnce = perSnapshot((w: Workspace, now: number) => {
|
|
235
|
+
const all = allNeedsOnce(w, now);
|
|
236
|
+
return w.dismissed?.length ? all.filter(i => !isDismissedNeed(w, i.key, dismissPrint(i, w))) : all;
|
|
237
|
+
});
|
|
191
238
|
export const needsYou = (w: Workspace, now = Date.now()): NeedItem[] => [...needsYouOnce(w, now)];
|
|
192
|
-
function
|
|
239
|
+
function computeAllNeeds(w: Workspace, now: number): NeedItem[] {
|
|
193
240
|
if (!w.enable_tracking || w.archived) return [];
|
|
194
241
|
const items: NeedItem[] = [];
|
|
195
242
|
const questions = w.questions ?? [];
|
package/shared/brief.ts
CHANGED
|
@@ -311,6 +311,7 @@ export const RESOLVED = {
|
|
|
311
311
|
replaced: "Replaced by a newer card",
|
|
312
312
|
movedOn: "No longer needed · the agent moved on",
|
|
313
313
|
withdrawn: "The agent withdrew this question",
|
|
314
|
+
dismissed: "You dismissed this question",
|
|
314
315
|
factEnded: "No longer needed · the PR moved on",
|
|
315
316
|
} as const;
|
|
316
317
|
const OWN_OUTCOMES: readonly string[] = Object.values(RESOLVED);
|
|
@@ -370,7 +371,8 @@ export type BriefEvent =
|
|
|
370
371
|
| { type: "option"; decisionId: string; choice: string; words?: string }
|
|
371
372
|
/** Several decisions answered together (1.4.0): every pick at once; the rest were skipped on purpose. */
|
|
372
373
|
| { type: "options"; picks: { decisionId: string; choice: string; words?: string }[] }
|
|
373
|
-
|
|
374
|
+
/** `dismissed`: the developer's Dismiss (a sign-off that sends nothing and remembers the ask): the card reads Dismissed. */
|
|
375
|
+
| { type: "sign_off"; dismissed?: boolean }
|
|
374
376
|
/** The developer did an Action brief's ask and said so with Done; the server already sent "Done: <ask>". */
|
|
375
377
|
| { type: "done" }
|
|
376
378
|
| { type: "undo" }
|
|
@@ -378,7 +380,7 @@ export type BriefEvent =
|
|
|
378
380
|
/** A PR's new state: lands only on the open brief whose facts are about that PR. */
|
|
379
381
|
| { type: "facts"; prKey: string; facts: BriefFact[] }
|
|
380
382
|
/** Every question the brief points at is settled, by any path (briefQuestionsEvent): an answer, or null if withdrawn. */
|
|
381
|
-
| { type: "questions"; answers: Record<string, { choice: string; words: string | null } | null
|
|
383
|
+
| { type: "questions"; answers: Record<string, { choice: string; words: string | null } | null>; /** Every unanswered one was dismissed by the developer. */ dismissed?: boolean }
|
|
382
384
|
/** The PR facts a Follow-up card reported no longer hold (shared/inbox.ts FACT_REASONS): its card of these kinds closes. */
|
|
383
385
|
| { type: "fact_ended"; kinds: BriefKind[] };
|
|
384
386
|
|
|
@@ -450,7 +452,7 @@ export function briefStep(prev: Brief | null, event: BriefEvent, now: string): {
|
|
|
450
452
|
{ const b = collapse(prev, "answered", "Done"); return { brief: b, appends: [b] }; }
|
|
451
453
|
case "sign_off":
|
|
452
454
|
if (prev?.state !== "open") return keep;
|
|
453
|
-
{ const b = collapse(prev, "signed", "Signed off"); return { brief: b, appends: [b] }; }
|
|
455
|
+
{ const b = collapse(prev, "signed", event.dismissed ? "Dismissed" : "Signed off"); return { brief: b, appends: [b] }; }
|
|
454
456
|
case "undo":
|
|
455
457
|
if (prev?.state !== "signed") return keep;
|
|
456
458
|
{ const b: Brief = { ...prev, state: "open", outcome: null, outcomeAt: null }; return { brief: b, appends: [b] }; }
|
|
@@ -461,7 +463,7 @@ export function briefStep(prev: Brief | null, event: BriefEvent, now: string): {
|
|
|
461
463
|
if (prev?.state !== "open" || !prev.questionIds.length || !prev.questionIds.every(id => id in event.answers)) return keep;
|
|
462
464
|
const decisions = prev.decisions.map(d => { const a = event.answers[d.id]; return a && !d.chosen ? { ...d, chosen: a.choice, words: a.words?.trim() || null } : d; });
|
|
463
465
|
const answered = prev.questionIds.some(id => event.answers[id]);
|
|
464
|
-
const b = answered ? { ...collapse(prev, "answered", answeredOutcome(decisions)), decisions } : collapse(prev, "superseded", RESOLVED.withdrawn);
|
|
466
|
+
const b = answered ? { ...collapse(prev, "answered", answeredOutcome(decisions)), decisions } : collapse(prev, "superseded", event.dismissed ? RESOLVED.dismissed : RESOLVED.withdrawn);
|
|
465
467
|
return { brief: b, appends: [b] };
|
|
466
468
|
}
|
|
467
469
|
case "fact_ended":
|
|
@@ -585,14 +587,15 @@ export function shownBrief(row: Brief, live: { brief: Brief | null } | undefined
|
|
|
585
587
|
export function briefQuestionsEvent(b: Brief, questions: readonly Question[]): Extract<BriefEvent, { type: "questions" }> | null {
|
|
586
588
|
if (b.state !== "open" || !b.questionIds.length) return null;
|
|
587
589
|
const answers: Record<string, { choice: string; words: string | null } | null> = {};
|
|
590
|
+
let dismissed = true;
|
|
588
591
|
for (const id of b.questionIds) {
|
|
589
592
|
const q = questions.find(q => q.id === id);
|
|
590
593
|
if (!q) return null;
|
|
591
594
|
if (q.answer) answers[id] = { choice: q.answer.choice, words: q.answer.words ?? null };
|
|
592
|
-
else if (q.closed) answers[id] = null;
|
|
595
|
+
else if (q.closed) { answers[id] = null; dismissed &&= !!q.closed.dismissed; }
|
|
593
596
|
else return null;
|
|
594
597
|
}
|
|
595
|
-
return { type: "questions", answers };
|
|
598
|
+
return { type: "questions", answers, ...(dismissed && Object.values(answers).some(a => a === null) ? { dismissed: true } : {}) };
|
|
596
599
|
}
|
|
597
600
|
|
|
598
601
|
/** The developer's option click, in the existing answer format so Follow-up's answer card renders it. */
|