paseo-follow-up 2.2.0-beta.1 → 2.2.0-beta.3
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 +4 -2
- package/client/catch-up.tsx +497 -0
- package/client/dock.ts +70 -0
- package/client/docked-pane.tsx +108 -0
- package/client/home-view.ts +21 -3
- package/client/home.tsx +59 -42
- package/client/onboarding.tsx +17 -40
- package/client/questions.tsx +11 -4
- package/index.client.tsx +4 -1
- package/index.server.ts +79 -4
- package/package.json +1 -1
- package/server/agent-actions.ts +4 -4
- package/server/agent-hook.mjs +1 -1
- package/server/agent-parity.ts +11 -0
- package/server/context-requests.ts +124 -0
- package/server/daemon.ts +20 -13
- package/server/delivery.ts +8 -0
- package/server/hook-source.ts +1 -1
- package/server/mcp-source.ts +6 -2
- package/server/mcp.mjs +6 -2
- package/server/message-queue.ts +34 -12
- package/server/transcript.ts +56 -0
- package/shared/attention.ts +3 -2
- package/shared/catch-up.ts +312 -0
- package/shared/chat.ts +1 -1
- package/shared/contracts.ts +15 -0
- package/shared/display.ts +7 -0
- package/shared/questions.ts +7 -2
- package/shared/queue.ts +28 -3
- package/shared/status-invariants.ts +14 -0
package/index.server.ts
CHANGED
|
@@ -14,6 +14,11 @@ import { agentSetSpec, developerSetSpec } from "./server/spec";
|
|
|
14
14
|
import type { PluginServerContext, PluginHandlerContext, PluginHookContext, PluginSessionOpenRequest } from "@getpaseo/plugin/server";
|
|
15
15
|
import type { PluginRpcContract, PluginSubscriptionContract } from "@getpaseo/plugin";
|
|
16
16
|
import { ValueFeed, WorkspacesFeed } from "./server/feeds";
|
|
17
|
+
import { ContextRequests } from "./server/context-requests";
|
|
18
|
+
import { agentContextPrompt, deckCards, overseerContextPrompt } from "./shared/catch-up";
|
|
19
|
+
import { buildHome } from "./shared/home";
|
|
20
|
+
import { needsYou } from "./shared/attention";
|
|
21
|
+
import type { SortMode } from "./shared/sort";
|
|
17
22
|
import type { ZodType, output as zOutput } from "zod";
|
|
18
23
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
19
24
|
import { isTimeZone } from "./shared/inbox";
|
|
@@ -207,6 +212,8 @@ export default function contribute(server: PluginServerContext) {
|
|
|
207
212
|
prWorkflow.onChanged = () => { void store.snapshot().then(state => store.onChanged(state)).catch(() => undefined); };
|
|
208
213
|
const browser = new BrowserBridge();
|
|
209
214
|
const reviewerStore = new ReviewerConfigStore(directory);
|
|
215
|
+
const contextRequests = new ContextRequests(directory);
|
|
216
|
+
contextRequests.onChange = () => feeds.home();
|
|
210
217
|
// an-ack-never-waits-on-the-disk (server/write-behind.ts): these files save behind the reply; one still failing after
|
|
211
218
|
// SURFACE_AFTER attempts shows as the worker's error line until it lands.
|
|
212
219
|
const writeHealth = new WriteHealth();
|
|
@@ -324,6 +331,12 @@ export default function contribute(server: PluginServerContext) {
|
|
|
324
331
|
// No card of its own: one that didn't go out (Failed, or Queued past MESSAGE_STUCK_MS) shows in its workspace's
|
|
325
332
|
// Needs you with Retry and Cancel, and leaves it once sent or cancelled.
|
|
326
333
|
async project(item) {
|
|
334
|
+
// A More context ask rides the queue under its request id: the send's settle is its delivery, a send that can't
|
|
335
|
+
// happen fails it (context-never-blocks-the-deck: the card comes back either way).
|
|
336
|
+
if (item.messageId?.startsWith("ctx-")) {
|
|
337
|
+
if (item.state === "sent") await contextRequests.delivered(item.messageId, item.settledAt ?? new Date().toISOString());
|
|
338
|
+
else if (item.state === "cancelled" || item.state === "failed" && item.gone) await contextRequests.fail(item.messageId, item.reason ?? "The ask couldn't reach the agent.");
|
|
339
|
+
}
|
|
327
340
|
const w = (await store.snapshot()).workspaces.find(w => w.id === item.key && w.enable_tracking && !w.archived);
|
|
328
341
|
if (!w) return;
|
|
329
342
|
const has = w.undelivered?.find(m => m.id === item.id);
|
|
@@ -471,8 +484,19 @@ export default function contribute(server: PluginServerContext) {
|
|
|
471
484
|
await engine.adoptBatches().catch(error => console.warn(`[follow-up] couldn't move batches onto the queue: ${error instanceof Error ? error.message : String(error)}`));
|
|
472
485
|
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
486
|
queue.start();
|
|
487
|
+
// An ask still open from before a restart is re-derived from the queue's record and the cached agent list: nothing
|
|
488
|
+
// is woken, and nothing waits on it (context-never-blocks-the-deck).
|
|
489
|
+
void (async () => {
|
|
490
|
+
const rows = await gateway.directory.read().catch(() => null);
|
|
491
|
+
const status = new Map((rows?.agents ?? []).map(({ agent }) => [agent.id, agent.status]));
|
|
492
|
+
await contextRequests.reconcile(r => {
|
|
493
|
+
const item = r.target === "agent" ? queue.get(`message:${r.askedOf}:${r.id}`) : null;
|
|
494
|
+
return { sent: item?.state === "sent" ? item.settledAt ?? null : null, failed: item?.state === "cancelled" || item?.state === "failed" && item.gone ? item.reason ?? "The ask couldn't reach the agent." : null,
|
|
495
|
+
idle: rows ? status.get(r.askedOf!) !== "running" : false };
|
|
496
|
+
});
|
|
497
|
+
})().catch(error => console.warn(`[follow-up] couldn't re-check open context asks: ${error instanceof Error ? error.message : String(error)}`));
|
|
474
498
|
})().catch(() => { loadError = "Follow-up could not start. Check its saved state and worker lock."; });
|
|
475
|
-
for (const file of [store, reviewerStore.persist, agentSettings.persist, prWorkflow.persist, inbox.store.persist]) file.health = writeHealth;
|
|
499
|
+
for (const file of [store, contextRequests.persist, reviewerStore.persist, agentSettings.persist, prWorkflow.persist, inbox.store.persist]) file.health = writeHealth;
|
|
476
500
|
const requireReady = async () => { if (waiting) throw new Error(waiting); await ready; if (loadError || stopped) throw new Error(loadError ?? "Follow-up is stopping"); };
|
|
477
501
|
// 1.4.0-beta.2: Follow-up's tools per agent: natively through Paseo's MCP when the host serves plugin tools,
|
|
478
502
|
// otherwise the stdio bridge for this launch only. FOLLOW_UP_TOOLS tells the hooks which names the agent has.
|
|
@@ -929,6 +953,56 @@ export default function contribute(server: PluginServerContext) {
|
|
|
929
953
|
handle(rpc.overseerStatusRpc, async () => { await requireReady(); return overseerStatus(); });
|
|
930
954
|
handle(rpc.overseerStartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.start(paseo as unknown as OverseerPaseo); return overseerStatus(); });
|
|
931
955
|
handle(rpc.overseerAskRpc, async ({ text }, { paseo }) => { await requireReady(); seen(paseo); await overseer!.ask(paseo as unknown as OverseerPaseo, text); return overseerStatus(); });
|
|
956
|
+
// Catch up's More context: the ask is recorded and answered at once; the Overseer's send runs after the reply (it may
|
|
957
|
+
// start the Overseer), the agent's goes through the message queue (invariant 36). Asking the card's agent may wake
|
|
958
|
+
// it: the developer asked, the one exception to never-wake (invariant 1). The Overseer reads without waking anyone.
|
|
959
|
+
handle(rpc.contextAskRpc, async (input, context) => {
|
|
960
|
+
await requireReady();
|
|
961
|
+
const actor = actorOf(context);
|
|
962
|
+
if (actor.kind === "agent" && input.target === "agent" && input.agentId === actor.agentId) throw new Error("ask_context asks another agent about its card for the developer; explain your own ask in your reply.");
|
|
963
|
+
if (input.target === "agent" && !input.agentId) throw new Error("This card has no agent to ask. Ask the Overseer instead.");
|
|
964
|
+
// Recorded at once, never waiting on Paseo (an-ack-never-waits): the Overseer's id is learnt after its send.
|
|
965
|
+
const out = await contextRequests.ask(input, actorBy(actor), input.target === "agent" ? input.agentId : null);
|
|
966
|
+
if (!out.fresh) return out;
|
|
967
|
+
const r = out.request;
|
|
968
|
+
if (input.target === "agent") enqueueMessage(input.agentId!, agentContextPrompt(r), r.id, actorBy(actor));
|
|
969
|
+
else {
|
|
970
|
+
const paseo = (context as { paseo?: unknown }).paseo;
|
|
971
|
+
void (async () => {
|
|
972
|
+
try {
|
|
973
|
+
const workspace = input.workspaceId ? (await gateway.directory.read().catch(() => null))?.workspaces.find(w => w.id === input.workspaceId)?.name ?? "a workspace" : "a workspace";
|
|
974
|
+
if (!await overseerOn()) throw new Error("The Overseer is off. Turn it on in Settings → Agents, or ask the agent.");
|
|
975
|
+
const s = await overseer!.ask(paseo as unknown as OverseerPaseo, overseerContextPrompt(r, workspace));
|
|
976
|
+
if (s.agentId) { await contextRequests.setAskedOf(r.id, s.agentId); await contextRequests.delivered(r.id, new Date().toISOString()); }
|
|
977
|
+
} catch (error) { await contextRequests.fail(r.id, error instanceof Error ? error.message : String(error)); }
|
|
978
|
+
})();
|
|
979
|
+
}
|
|
980
|
+
return out;
|
|
981
|
+
});
|
|
982
|
+
// Built when read (a-derived-view-is-built-when-read), from state the worker holds: no daemon request but the
|
|
983
|
+
// directory's cached workspace list.
|
|
984
|
+
handle(rpc.catchUpDeckRpc, async () => {
|
|
985
|
+
await requireReady();
|
|
986
|
+
const [state, list, paseoList, priorities, settings, context] = await Promise.all([store.snapshot(), inbox.list(), paseoWorkspaces(), priorityStore.read(), inboxSettings(), contextRequests.list()]);
|
|
987
|
+
const tracked = state.workspaces.filter(w => w.enable_tracking);
|
|
988
|
+
const byId = new Map(tracked.map(w => [w.id, w]));
|
|
989
|
+
const model = buildHome({ rows: list.rows, tracked, paseo: paseoList, now: Date.now(), sort: (settings as { home_sort?: SortMode }).home_sort, priorities });
|
|
990
|
+
const cards = deckCards({ model, rows: list.rows, items: id => { const w = byId.get(id); return w ? needsYou(w) : []; } });
|
|
991
|
+
return { cards: cards.map(c => {
|
|
992
|
+
const r = [...context].reverse().find(x => x.cardKey === c.key);
|
|
993
|
+
return { key: c.key, kind: c.kind, workspaceId: c.s.workspaceId, agentId: c.s.agentId, title: c.s.title, line: c.s.line, questionId: c.questionId ?? null,
|
|
994
|
+
item: c.item && "title" in c.item ? String((c.item as { title?: unknown }).title ?? "") || null : null, context: r ? { id: r.id, state: r.state, target: r.target } : null };
|
|
995
|
+
}) };
|
|
996
|
+
});
|
|
997
|
+
handle(rpc.contextListRpc, async ({ workspaceId }) => ({ requests: await contextRequests.list(workspaceId ? { workspaceId } : {}) }));
|
|
998
|
+
handle(rpc.contextReplyRpc, async ({ agentId, requestId, text }) => {
|
|
999
|
+
await requireReady();
|
|
1000
|
+
const r = (await contextRequests.list()).find(x => x.id === requestId);
|
|
1001
|
+
// The Overseer may have been (re)started by the ask itself, so its id is checked now, not when it was asked.
|
|
1002
|
+
if (r?.target === "overseer" && r.askedOf !== agentId && (await overseerStatus().catch(() => null))?.agentId === agentId) await contextRequests.setAskedOf(r.id, agentId);
|
|
1003
|
+
await contextRequests.reply(requestId, agentId, text);
|
|
1004
|
+
return { ok: true };
|
|
1005
|
+
});
|
|
932
1006
|
handle(rpc.overseerRestartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.restart(paseo as unknown as OverseerPaseo); return overseerStatus(); });
|
|
933
1007
|
// The provider catalog for Settings → Agents: read only when that screen asks, cached ten minutes.
|
|
934
1008
|
const providerCatalog = new ProviderCatalog(async () => {
|
|
@@ -1303,9 +1377,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1303
1377
|
const [items, rank, overseerView] = await Promise.all([priorityStore.read(), ranker!.status(), overseerStatus()]);
|
|
1304
1378
|
// The worker's live resources change every tick: the client reads those once when Home opens (follow.usage).
|
|
1305
1379
|
const meters = governor.allowsExtras() ? await usage.read() : NO_USAGE;
|
|
1306
|
-
return { priorities: items, rank, overseer: overseerView, usage: { available: meters.available, source: meters.source, accounts: meters.accounts }, usageLive: !!usageWatch };
|
|
1380
|
+
return { priorities: items, rank, overseer: overseerView, usage: { available: meters.available, source: meters.source, accounts: meters.accounts }, usageLive: !!usageWatch, context: await contextRequests.list() };
|
|
1307
1381
|
},
|
|
1308
|
-
key: v => JSON.stringify([v.priorities, v.rank, v.overseer, usageKey(v.usage), v.usageLive]),
|
|
1382
|
+
key: v => JSON.stringify([v.priorities, v.rank, v.overseer, usageKey(v.usage), v.usageLive, v.context]),
|
|
1309
1383
|
// Smart Session's files are watched only while someone looks at Home (server/usage.ts watch()).
|
|
1310
1384
|
onFirst: () => { usageWatch = usage.watch(() => void homeFeed.changed()); },
|
|
1311
1385
|
onLast: () => { usageWatch?.close(); usageWatch = null; },
|
|
@@ -1449,6 +1523,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1449
1523
|
// handlers below read the patched rows.
|
|
1450
1524
|
server.on("agent.turn_started", async event => gateway.directory.turnStarted(event.agent, event.turnId)),
|
|
1451
1525
|
server.on("agent.turn_ended", async event => gateway.directory.turnEnded(event.agent, event.outcome)),
|
|
1526
|
+
server.on("agent.turn_ended", async event => contextRequests.turnEnded(event.agent.id)),
|
|
1452
1527
|
server.on("agent.permission_requested", async event => gateway.directory.permissionRequested(event.agent.id, event.request as { id?: string })),
|
|
1453
1528
|
server.on("agent.permission_resolved", async event => gateway.directory.permissionResolved(event.agent.id, event.requestId)),
|
|
1454
1529
|
server.on("agent.archived", async event => gateway.directory.agentArchived(event.agent.id, event.archivedAt)),
|
|
@@ -1570,7 +1645,7 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1570
1645
|
// One deadline for every wait (worker-stop-never-waits-on-a-stuck-pass, server/teardown.ts): start-up and the work
|
|
1571
1646
|
// in flight may be stuck on a daemon or CLI that never answers. Work that ends inside the deadline is saved; what
|
|
1572
1647
|
// outlives it can't write, because the store closes before the lock is released.
|
|
1573
|
-
await stopWorker({ files: [reviewerStore, agentSettings, prWorkflow, queue], ready, hooks: hooksStarted ? () => agentHooks.stop() : undefined, actions, closeConnections, engine, store, inbox: inbox.store, unlock });
|
|
1648
|
+
await stopWorker({ files: [contextRequests, reviewerStore, agentSettings, prWorkflow, queue], ready, hooks: hooksStarted ? () => agentHooks.stop() : undefined, actions, closeConnections, engine, store, inbox: inbox.store, unlock });
|
|
1574
1649
|
})();
|
|
1575
1650
|
return stop;
|
|
1576
1651
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.2.0-beta.
|
|
4
|
+
"version": "2.2.0-beta.3",
|
|
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
|
@@ -22,7 +22,7 @@ import { DISPLAY_TOOLS, RPC_TOOLS, type RpcTool } from "./agent-parity";
|
|
|
22
22
|
import { waitNote, type WaitStatus } from "../shared/wait";
|
|
23
23
|
import { reportInputSchema } from "./report-issue";
|
|
24
24
|
import type { RenameStatus } from "../shared/rename";
|
|
25
|
-
import { DISPLAY_KEYS, displayPreferences, HOME_DETAIL_DEFAULT } from "../shared/display";
|
|
25
|
+
import { DISPLAY_KEYS, displayPreferences, HOME_DETAIL_DEFAULT, CATCH_UP_RAIL_DEFAULT } from "../shared/display";
|
|
26
26
|
import { DEFAULT_SEARCH_SHORTCUT, SEARCH_SHORTCUTS } from "../shared/search-key";
|
|
27
27
|
import { DEFAULT_SORT, SORT_MODES } from "../shared/sort";
|
|
28
28
|
|
|
@@ -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", "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;
|
|
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", "catch_up_deck", "context_requests", "ask_context"] 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)];
|
|
@@ -326,14 +326,14 @@ export class AgentActions {
|
|
|
326
326
|
private async displayTool(caller: string, tool: "display_settings" | "set_display", args: Record<string, any>) {
|
|
327
327
|
if (!this.d.display) throw new Error(`${tool} isn't available in this Follow-up.`);
|
|
328
328
|
const current = await this.d.display.read();
|
|
329
|
-
if (tool === "display_settings") return { values: { home_sort: DEFAULT_SORT, home_detail_fraction: HOME_DETAIL_DEFAULT, search_shortcut: DEFAULT_SEARCH_SHORTCUT, ...current.values }, sorts: SORT_MODES, search_shortcuts: SEARCH_SHORTCUTS, change: "set_display changes these, only when the developer asked. home_sort orders Home and the sidebar view. home_detail_fraction is the share of Home's width its right pane takes (0.2 to 0.8, default 0.42). search_shortcut is the key that opens Home's search from anywhere: mod-slash (⌘/ or Ctrl+/, the default), mod-shift-k, mod-shift-h or none." };
|
|
329
|
+
if (tool === "display_settings") return { values: { home_sort: DEFAULT_SORT, home_detail_fraction: HOME_DETAIL_DEFAULT, catch_up_rail_fraction: CATCH_UP_RAIL_DEFAULT, search_shortcut: DEFAULT_SEARCH_SHORTCUT, ...current.values }, sorts: SORT_MODES, search_shortcuts: SEARCH_SHORTCUTS, change: "set_display changes these, only when the developer asked. home_sort orders Home and the sidebar view. home_detail_fraction is the share of Home's width its right pane takes (0.2 to 0.8, default 0.42). catch_up_rail_fraction is the share of the Catch up screen its queue rail takes on a desktop (0.16 to 0.5, default 0.28). search_shortcut is the key that opens Home's search from anywhere: mod-slash (⌘/ or Ctrl+/, the default), mod-shift-k, mod-shift-h or none." };
|
|
330
330
|
const values = args.values as Record<string, boolean | string | number> | undefined;
|
|
331
331
|
if (!values || !Object.keys(values).length) throw new Error("set_display: give values, e.g. { enable_trust_bypass: false } or { home_sort: \"recent\" }. display_settings lists them.");
|
|
332
332
|
const unknown = Object.keys(values).filter(k => !DISPLAY_KEYS.includes(k));
|
|
333
333
|
if (unknown.length) throw new Error(`set_display: unknown setting ${unknown.join(", ")}. display_settings lists them.`);
|
|
334
334
|
const parsed = displayPreferences.schema.safeParse({ ...current.values, ...values });
|
|
335
335
|
if (!parsed.success) throw new Error(`set_display: ${parsed.error.issues.map(i => `${i.path.join(".")}: ${i.message}`).join("; ")}`);
|
|
336
|
-
const was = (k: string) => current.values[k] ?? (k === "home_sort" ? DEFAULT_SORT : k === "home_detail_fraction" ? HOME_DETAIL_DEFAULT : k === "search_shortcut" ? DEFAULT_SEARCH_SHORTCUT : undefined);
|
|
336
|
+
const was = (k: string) => current.values[k] ?? (k === "home_sort" ? DEFAULT_SORT : k === "home_detail_fraction" ? HOME_DETAIL_DEFAULT : k === "catch_up_rail_fraction" ? CATCH_UP_RAIL_DEFAULT : k === "search_shortcut" ? DEFAULT_SEARCH_SHORTCUT : undefined);
|
|
337
337
|
const changes = Object.entries(values).filter(([k, v]) => was(k) !== v).map(([key, to]) => ({ key, from: was(key), to }));
|
|
338
338
|
const planId = changes.length ? this.plan(caller, "set_display", async () => {
|
|
339
339
|
const now = await this.d.display!.read();
|
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"];
|
|
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"];
|
|
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
|
@@ -69,6 +69,14 @@ export const RPC_TOOLS: readonly RpcTool[] = [
|
|
|
69
69
|
{ name: "overseer_start", rpc: "follow.overseer-start", kind: "planned", before: { rpc: "follow.overseer-status" }, input: z.strictObject({ ...confirm }) },
|
|
70
70
|
{ name: "overseer_restart", rpc: "follow.overseer-restart", kind: "planned", before: { rpc: "follow.overseer-status" }, input: z.strictObject({ ...confirm }) },
|
|
71
71
|
{ name: "overseer_ask", rpc: "follow.overseer-ask", kind: "planned", input: z.strictObject({ text: z.string().trim().min(1).max(2000).optional(), ...confirm }) },
|
|
72
|
+
// Catch up: the deck, and More context (ask, read the asks); the asked agent answers with context_reply
|
|
73
|
+
{ name: "catch_up_deck", rpc: "follow.catch-up-deck", kind: "read", input: none },
|
|
74
|
+
{ name: "context_requests", rpc: "follow.context-list", kind: "read", input: z.strictObject({ workspaceId: id.optional() }) },
|
|
75
|
+
{ name: "ask_context", rpc: "follow.context-ask", kind: "planned", before: { rpc: "follow.context-list", input: a => ({ workspaceId: a.workspaceId ?? undefined }) },
|
|
76
|
+
input: z.strictObject({ workspaceId: id.nullable().optional(), agentId: id.nullable().optional(), cardKey: z.string().min(1).max(400).optional(), card: z.string().trim().min(1).max(300).optional(),
|
|
77
|
+
target: z.enum(["overseer", "agent"]).optional(), ask: z.string().trim().min(1).max(2000).optional(), ...confirm }),
|
|
78
|
+
toRpc: a => ({ workspaceId: a.workspaceId ?? null, agentId: a.agentId ?? null, cardKey: a.cardKey, card: a.card, target: a.target, ask: a.ask }),
|
|
79
|
+
guard: (a, caller) => a.target === "agent" && a.agentId === caller ? "ask_context asks another agent about its card; explain your own ask in your reply." : null },
|
|
72
80
|
// Needs-you: the brief card and the inbox's other actions
|
|
73
81
|
// The message queue: what waits to go to agents, and Retry or Cancel on one item (a card's Retry, Needs you's message row).
|
|
74
82
|
{ name: "queue_list", rpc: "follow.queue-list", kind: "read", input: z.strictObject({ workspaceId: id.optional(), agentId: id.optional() }) },
|
|
@@ -171,6 +179,8 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
|
|
|
171
179
|
"follow.overseer-restart": { tools: ["overseer_restart"] },
|
|
172
180
|
"follow.overseer-ask": { tools: ["overseer_ask"] },
|
|
173
181
|
"follow.inbox-list": { tools: ["inbox_list"] },
|
|
182
|
+
"follow.context-ask": { tools: ["ask_context"] },
|
|
183
|
+
"follow.context-list": { tools: ["context_requests"] },
|
|
174
184
|
"follow.inbox-brief": { tools: ["inbox_brief"] },
|
|
175
185
|
"follow.queue-action": { tools: ["queue_action"] },
|
|
176
186
|
"follow.inbox-act": { tools: ["sign_off", "snooze", "set_finish_flags", "inbox_act"] },
|
|
@@ -206,5 +216,6 @@ export const PARITY: Record<string, { tools: readonly string[]; note?: string }
|
|
|
206
216
|
* note says where an agent finds what the developer found.
|
|
207
217
|
*/
|
|
208
218
|
export const VIEW_PARITY: Record<string, { tools: readonly string[]; note: string }> = {
|
|
219
|
+
"catch-up": { tools: ["catch_up_deck", "answer_question", "brief_action", "inbox_act", "snooze", "ask_context"], note: "Catch up deals Needs you one card at a time; moving between cards (Skip, Back) changes only the developer's view. catch_up_deck reads the same deck, and every act on a card is a tool: answer_question, brief_action, inbox_act and snooze (Later), ask_context (More context). A permission is Paseo's own respond_to_permission." },
|
|
209
220
|
"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." },
|
|
210
221
|
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { WriteBehind } from "./write-behind";
|
|
5
|
+
import { CONTEXT_ANSWER_MAX, contextFileSchema, plainAnswer, pruneContext, type ContextFile, type ContextRequest, type ContextTarget } from "../shared/catch-up";
|
|
6
|
+
|
|
7
|
+
export const CONTEXT_FILE = "context.json";
|
|
8
|
+
|
|
9
|
+
export type AskInput = { workspaceId: string | null; agentId: string | null; cardKey: string; card: string; target: ContextTarget; ask: string };
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Catch up's More context requests (docs/needs-you.md#catch-up): what the developer asked about a card, who answers
|
|
13
|
+
* (the Overseer or the card's agent), and the answer once `context_reply` brings it. The value lives in memory and
|
|
14
|
+
* saves behind the reply (an-ack-never-waits-on-the-disk); a change calls `onChange`, which pushes Home's feed, so the
|
|
15
|
+
* client learns an answer arrived without polling. Small by construction: at most CONTEXT_MAX requests, none older
|
|
16
|
+
* than CONTEXT_KEEP_MS.
|
|
17
|
+
*/
|
|
18
|
+
export class ContextRequests {
|
|
19
|
+
private value: ContextFile | null = null;
|
|
20
|
+
readonly persist: WriteBehind<ContextFile>;
|
|
21
|
+
onChange: () => void = () => undefined;
|
|
22
|
+
constructor(readonly directory: string, private now: () => number = Date.now) {
|
|
23
|
+
this.persist = new WriteBehind({ path: join(directory, CONTEXT_FILE), encode: v => JSON.stringify(v) });
|
|
24
|
+
}
|
|
25
|
+
async flush(): Promise<void> { await this.persist.flush(); }
|
|
26
|
+
|
|
27
|
+
private async load(): Promise<ContextFile> {
|
|
28
|
+
if (this.value) return this.value;
|
|
29
|
+
let value: ContextFile;
|
|
30
|
+
try { value = contextFileSchema.parse(JSON.parse(await readFile(join(this.directory, CONTEXT_FILE), "utf8"))); }
|
|
31
|
+
catch { value = { requests: [] }; } // Lost context requests cost a re-ask, never a broken Home.
|
|
32
|
+
this.value ??= value;
|
|
33
|
+
return this.value;
|
|
34
|
+
}
|
|
35
|
+
private save(requests: ContextRequest[]): void {
|
|
36
|
+
this.value = contextFileSchema.parse({ requests: pruneContext(requests, this.now()) });
|
|
37
|
+
this.persist.set(this.value);
|
|
38
|
+
this.onChange();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async list(filter: { workspaceId?: string } = {}): Promise<ContextRequest[]> {
|
|
42
|
+
const { requests } = await this.load();
|
|
43
|
+
const live = pruneContext(requests, this.now());
|
|
44
|
+
return filter.workspaceId ? live.filter(r => r.workspaceId === filter.workspaceId) : live;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Records an ask. One open ask per card: asking again while it's open returns that one (`fresh: false`). */
|
|
48
|
+
async ask(input: AskInput, by: string, askedOf: string | null): Promise<{ request: ContextRequest; fresh: boolean }> {
|
|
49
|
+
const { requests } = await this.load();
|
|
50
|
+
const open = requests.find(r => r.cardKey === input.cardKey && r.state === "asking");
|
|
51
|
+
if (open) return { request: open, fresh: false };
|
|
52
|
+
const request: ContextRequest = {
|
|
53
|
+
id: `ctx-${randomUUID()}`, ...input, askedOf, state: "asking", answer: null, error: null,
|
|
54
|
+
askedAt: new Date(this.now()).toISOString(), settledAt: null, deliveredAt: null, by,
|
|
55
|
+
};
|
|
56
|
+
this.save([...requests, request]);
|
|
57
|
+
return { request, fresh: true };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
private async update(id: string, change: (r: ContextRequest) => ContextRequest | null): Promise<ContextRequest | null> {
|
|
61
|
+
const { requests } = await this.load();
|
|
62
|
+
const i = requests.findIndex(r => r.id === id);
|
|
63
|
+
if (i < 0) return null;
|
|
64
|
+
const next = change(requests[i]);
|
|
65
|
+
if (!next || next === requests[i]) return requests[i];
|
|
66
|
+
this.save(requests.map((r, j) => j === i ? next : r));
|
|
67
|
+
return next;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Who replies is learnt after the send (the Overseer's id). */
|
|
71
|
+
setAskedOf(id: string, askedOf: string): Promise<ContextRequest | null> {
|
|
72
|
+
return this.update(id, r => r.askedOf === askedOf ? r : { ...r, askedOf });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The asked agent's answer (context_reply). Only the agent it was asked of may answer it (ownership comes from the
|
|
77
|
+
* daemon, invariant 5); an answer to a settled request replaces it, so a corrected reply wins.
|
|
78
|
+
*/
|
|
79
|
+
async reply(id: string, caller: string, text: string): Promise<ContextRequest> {
|
|
80
|
+
const r = (await this.list()).find(x => x.id === id);
|
|
81
|
+
if (!r) throw new Error(`No open context request ${id}. It may have expired; the developer can ask again.`);
|
|
82
|
+
if (r.askedOf !== caller) throw new Error("This context request was asked of another agent.");
|
|
83
|
+
const answer = plainAnswer(text).slice(0, CONTEXT_ANSWER_MAX);
|
|
84
|
+
if (!answer) throw new Error("context_reply: give text, the explanation for the developer.");
|
|
85
|
+
return (await this.update(id, x => ({ ...x, state: "answered", answer, error: null, settledAt: new Date(this.now()).toISOString() })))!;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The send failed for good (no Overseer, the agent archived): the card comes back saying so. */
|
|
89
|
+
fail(id: string, error: string): Promise<ContextRequest | null> {
|
|
90
|
+
return this.update(id, r => r.state !== "asking" ? r : { ...r, state: "failed", error: error.slice(0, 500), settledAt: new Date(this.now()).toISOString() });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** The ask reached its agent (the queue sent it; the Overseer took it). Earlier deliveries win: it is the first. */
|
|
94
|
+
delivered(id: string, at: string): Promise<ContextRequest | null> {
|
|
95
|
+
return this.update(id, r => r.state !== "asking" || r.deliveredAt ? r : { ...r, deliveredAt: at });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* An agent's turn ended. Every ask it owes that was delivered before now and still has no context_reply settles as
|
|
100
|
+
* `chat`: the answer is in its chat, and the card comes back with Open chat. Delivery, not the turn's start, is the
|
|
101
|
+
* test, so a prompt steered into a turn already running counts, and nothing in memory is lost on a restart. Costs a
|
|
102
|
+
* lookup in a list of at most CONTEXT_MAX; no reads.
|
|
103
|
+
*/
|
|
104
|
+
async turnEnded(agentId: string): Promise<void> {
|
|
105
|
+
const owed = (await this.list()).filter(r => r.state === "asking" && r.askedOf === agentId && r.deliveredAt && Date.parse(r.deliveredAt) <= this.now());
|
|
106
|
+
for (const r of owed) await this.update(r.id, x => x.state !== "asking" ? x : { ...x, state: "chat", settledAt: new Date(this.now()).toISOString() });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* After a restart: anything still asking is re-derived from what the worker can read without waking anyone. `sent`
|
|
111
|
+
* says when the queue delivered it (null: not yet, or not a queued ask); `idle` says the agent isn't in a turn now.
|
|
112
|
+
* Delivered to an agent that is idle means its turn ended while the worker was down, so it settles as `chat`; a send
|
|
113
|
+
* that failed for good fails the ask.
|
|
114
|
+
*/
|
|
115
|
+
async reconcile(look: (r: ContextRequest) => { sent: string | null; failed: string | null; idle: boolean }): Promise<void> {
|
|
116
|
+
for (const r of (await this.list()).filter(x => x.state === "asking" && x.askedOf)) {
|
|
117
|
+
const seen = look(r);
|
|
118
|
+
if (seen.failed) { await this.fail(r.id, seen.failed); continue; }
|
|
119
|
+
const at = r.deliveredAt ?? seen.sent;
|
|
120
|
+
if (at && !r.deliveredAt) await this.delivered(r.id, at);
|
|
121
|
+
if (at && seen.idle) await this.turnEnded(r.askedOf!);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
package/server/daemon.ts
CHANGED
|
@@ -28,7 +28,7 @@ export { ConversationGone } from "./delivery";
|
|
|
28
28
|
import { compactionDelivered, turnIdOf } from "../shared/status";
|
|
29
29
|
import { activeWindowMs, backgroundCount, isLive, isLoaded, recentlyUsed, workspaceActive, conversationGone, DEFAULT_ACTIVE_WINDOW_DAYS, DAY_MS } from "./agent-load";
|
|
30
30
|
import { HistoryCache } from "./history-cache";
|
|
31
|
-
import { agentRecord,
|
|
31
|
+
import { agentRecord, markerInFile, transcriptFile } from "./transcript";
|
|
32
32
|
import { DaemonDirectory, type DirectoryRows } from "./directory";
|
|
33
33
|
import { traceDaemon } from "./request-trace";
|
|
34
34
|
import type { TurnTimeline } from "./turn-timeline";
|
|
@@ -620,19 +620,24 @@ export class PaseoGateway implements Gateway {
|
|
|
620
620
|
/**
|
|
621
621
|
* Whether `messageId` reached the agent since `since`. A loaded agent: its timeline, where Paseo records the message
|
|
622
622
|
* with its clientMessageId when it accepts it (before the provider runs). An unloaded one is never read (that would
|
|
623
|
-
* wake it, Invariant 1): its provider transcript on disk is searched for `marker` instead,
|
|
624
|
-
*
|
|
623
|
+
* wake it, Invariant 1): its provider transcript on disk is searched for `marker` instead, as it is for a loaded agent
|
|
624
|
+
* whose timeline read can't tell (a busy one); it says "not there" only when the part read reaches back to the send
|
|
625
|
+
* (markerInFile). Null: unknown.
|
|
625
626
|
*/
|
|
626
627
|
async arrivedMessage(agentId: string, messageId: string, since: string, marker: string): Promise<boolean | null> {
|
|
627
|
-
const
|
|
628
|
+
const sinceMs = Date.parse(since) - 60_000;
|
|
629
|
+
const timeline = await this.connect(async client => {
|
|
628
630
|
const a = (await client.fetchAgent(agentId))?.agent;
|
|
629
631
|
if (!a) return null;
|
|
630
|
-
if (!isLoaded(a)) return
|
|
631
|
-
return timelineHas(client, agentId, messageId,
|
|
632
|
+
if (!isLoaded(a)) return null;
|
|
633
|
+
return timelineHas(client, agentId, messageId, sinceMs);
|
|
632
634
|
}).catch(() => null);
|
|
633
|
-
|
|
634
|
-
|
|
635
|
+
// The timeline can't tell (the agent isn't loaded, or a busy one wrote more than the read's pages since the send):
|
|
636
|
+
// the provider transcript on disk decides, read back to the send. Only an unconfirmed item gets here.
|
|
637
|
+
return timeline ?? this.transcriptArrived(agentId, marker, sinceMs);
|
|
635
638
|
}
|
|
639
|
+
/** The transcript half of arrivedMessage (tests replace it): markerInFile over the agent's provider transcript. */
|
|
640
|
+
transcriptArrived: (agentId: string, marker: string, sinceMs: number) => Promise<boolean | null> = (agentId, marker, sinceMs) => transcriptHas(paseoHome, agentId, marker, sinceMs);
|
|
636
641
|
async handoff(w: Workspace, callerId: string): Promise<{ batchId: string; fromAgentId: string } | null> {
|
|
637
642
|
return this.connect(async client => {
|
|
638
643
|
const caller = (await client.fetchAgent(callerId))?.agent;
|
|
@@ -755,15 +760,17 @@ async function timelineHas(client: Daemon, agentId: string, messageId: string, s
|
|
|
755
760
|
}
|
|
756
761
|
return null;
|
|
757
762
|
}
|
|
758
|
-
/**
|
|
759
|
-
|
|
763
|
+
/**
|
|
764
|
+
* The agent's provider transcript on disk holds `marker`, read back from its end to the send (markerInFile, at most
|
|
765
|
+
* MARKER_READ_MAX_BYTES). Never wakes the agent. False only when the part read reaches back to `sinceMs` and holds no marker: the agent isn't loaded, so nothing of Paseo's is still
|
|
766
|
+
* holding the message, and a provider writes a prompt to its transcript when it takes it. Anything else is unknown.
|
|
767
|
+
*/
|
|
768
|
+
async function transcriptHas(home: string, agentId: string, marker: string, sinceMs: number): Promise<boolean | null> {
|
|
760
769
|
if (!marker) return null;
|
|
761
770
|
try {
|
|
762
771
|
const record = await agentRecord(home, agentId);
|
|
763
772
|
const file = record && await transcriptFile(record);
|
|
764
773
|
if (!file) return null;
|
|
765
|
-
|
|
766
|
-
const needle = JSON.stringify(marker).slice(1, -1);
|
|
767
|
-
return tail.some(line => line.includes(needle)) ? true : null;
|
|
774
|
+
return await markerInFile(file, sinceMs, marker);
|
|
768
775
|
} catch { return null; }
|
|
769
776
|
}
|
package/server/delivery.ts
CHANGED
|
@@ -4,6 +4,14 @@ export class DeliveryDeferred extends Error {}
|
|
|
4
4
|
/** The provider no longer has the agent's conversation: every send fails, so Follow-up stops sending to it. */
|
|
5
5
|
export class ConversationGone extends Error { constructor(readonly agentId: string, reason: string) { super(reason); this.name = "ConversationGone"; } }
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Paseo 0.16 refused the messageId itself (its per-agent, per-messageId receipt): agent_request_outcome_unknown (a
|
|
9
|
+
* receipt left pending by a daemon that died mid-send; every later send under that id is refused for good) or
|
|
10
|
+
* agent_request_key_conflict (the id was used for other text). Nothing was sent now; whether the first one landed is
|
|
11
|
+
* for the chat to say.
|
|
12
|
+
*/
|
|
13
|
+
export const idRefused = (error: unknown): boolean => /agent_request_(outcome_unknown|key_conflict)/.test(error instanceof Error ? error.message : String(error));
|
|
14
|
+
|
|
7
15
|
/** A UUID-shaped id fixed by `seed`: the same answer always goes out under the same messageId. */
|
|
8
16
|
export function stableMessageId(seed: string): string {
|
|
9
17
|
const h = createHash("sha256").update(seed).digest("hex");
|
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\"];",
|
|
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\"];",
|
|
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/mcp-source.ts
CHANGED
|
@@ -30,6 +30,7 @@ export const mcpSource: string = [
|
|
|
30
30
|
" [\"acknowledge_batch\", \"Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.\", \"follow.acknowledge\", { batchId: string, outcome: { type: \"string\", enum: [\"completed\", \"blocked\"] }, result: { ...string, maxLength: 2000 } }, [\"batchId\", \"outcome\", \"result\"]],",
|
|
31
31
|
" [\"ask_question\", \"Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\\\"Already open as Q18\\\") instead of a second one; to change an open question's options, ask again with supersedes=\\\"Q18\\\". At the end of the turn point at it with needs_you questions=[\\\"Q18\\\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \\\"Something else\\\" choice where the developer writes their own answer; don't add an \\\"Other\\\" option yourself.\", \"follow.ask-question\", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: \"array\", maxItems: 26, items: { type: \"object\", properties: { letter: { type: \"string\", pattern: \"^[A-Z]$\" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: [\"letter\", \"label\"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: \"array\", maxItems: 10, items: { type: \"object\", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: \"string\", pattern: \"^Q\\\\d+$\" } }, [\"title\", \"question\"]],",
|
|
32
32
|
" [\"record_answer\", \"Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \\\"other\\\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.\", \"follow.record-answer\", { id: string, choice: string, words: string }, [\"id\", \"choice\"]],",
|
|
33
|
+
" [\"context_reply\", \"Answer the developer's More context ask with the requestId it gave: { requestId, text }, plain words. Only when asked.\", \"follow.context-reply\", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, [\"requestId\", \"text\"]],",
|
|
33
34
|
" [\"withdraw_question\", \"Withdraw a question that no longer matters, with a short reason.\", \"follow.withdraw-question\", { id: string, reason: string }, [\"id\", \"reason\"]],",
|
|
34
35
|
" [\"set_spec\", \"Register the link to this workspace's spec: the Claude artifact (or doc) you keep summarizing the goal, decisions and status. Call it once after the first publish, with the URL from the publish result, and again only if the link changes. Follow-up shows it in the workspace header.\", \"follow.set-spec\", { url: { ...string, maxLength: 2000 }, title: { ...string, maxLength: 120 } }, [\"url\"]],",
|
|
35
36
|
" [\"link_item\", \"Link what this workspace's work is about: the Linear issue, Slack thread, doc or artifact you started from or opened for it. ref is its URL or Linear key; why is one short line. Don't link things you only mention. A PR isn't a linked item: register it with register_pr. An unknown Linear key is refused.\", \"follow.link-item\", { ref: { ...string, maxLength: 2000 }, why: { ...string, maxLength: 140 }, title: { ...string, maxLength: 200 } }, [\"ref\"]],",
|
|
@@ -92,6 +93,9 @@ export const mcpSource: string = [
|
|
|
92
93
|
" [\"overseer_start\", \"Start the Overseer, like Start on Home.\" + ask, \"follow.agent-act\", { ...planned }, []],",
|
|
93
94
|
" [\"overseer_restart\", \"Restart the Overseer (with the model Settings → Agents names now).\" + ask, \"follow.agent-act\", { ...planned }, []],",
|
|
94
95
|
" [\"overseer_ask\", \"Send the developer's words to the Overseer, as its box on Home does: { text }.\" + ask, \"follow.agent-act\", { text: string, ...planned }, []],",
|
|
96
|
+
" [\"catch_up_deck\", \"Read Catch up's deck: everything that needs the developer, one card per ask in Home's order, with any More context ask on it.\" + read, \"follow.agent-act\", {}, []],",
|
|
97
|
+
" [\"context_requests\", \"Read Catch up's More context asks: what the developer asked about a card, who answers, the state and the answer.\" + read, \"follow.agent-act\", { workspaceId: string }, []],",
|
|
98
|
+
" [\"ask_context\", \"Ask the Overseer or a card's agent to explain a card for the developer, like Catch up's More context: { workspaceId, agentId, cardKey, card, target: overseer | agent, ask } (cardKey and card from catch_up_deck).\" + ask, \"follow.agent-act\", { workspaceId: string, agentId: string, cardKey: string, card: string, target: { type: \"string\", enum: [\"overseer\", \"agent\"] }, ask: string, ...planned }, []],",
|
|
95
99
|
" [\"queue_list\", \"Read Follow-up's message queue: answers, repairs and forwards waiting to reach agents, with each one's state (queued, sending, retrying, failed), why it waits and when it tries next, plus the newest sent: { workspaceId?, agentId? }.\" + read, \"follow.agent-act\", { workspaceId: string, agentId: string }, []],",
|
|
96
100
|
" [\"queue_action\", \"Retry a queued or failed message now, or cancel it so it never goes: { itemId, action: retry | cancel } (ids from queue_list).\" + ask, \"follow.agent-act\", { itemId: string, action: { type: \"string\", enum: [\"retry\", \"cancel\"] }, ...planned }, []],",
|
|
97
101
|
" [\"inbox_brief\", \"Read another agent's full Needs-you brief (decisions, options, links): { agentId }.\" + read, \"follow.agent-act\", { agentId: string }, [\"agentId\"]],",
|
|
@@ -130,7 +134,7 @@ export const mcpSource: string = [
|
|
|
130
134
|
"const overseerNames = new Set(overseerTools.map(t => t[0]));",
|
|
131
135
|
"const overseerInstruction = \"You are Follow-up's Overseer. Route the developer's asks with route_candidates and send_to_agent; ask with needs_you kind=decision when unsure; start_workspace only when the developer asked or approved. Never merge, post to people or archive.\";",
|
|
132
136
|
"const actionNames = new Set(actionTools.map(t => t[0]));",
|
|
133
|
-
"const readOnlyTools = new Set([\"queue_list\", \"workspace_status\", \"list_prs\", \"inbox_list\", \"workstreams\", \"agent_digest\", \"route_candidates\", \"workspace_about\", \"link_items\", \"agent_settings\", \"display_settings\", \"follow_settings\", \"project_settings\", \"pr_workflow\", \"reviewer_settings\", \"reviewer_suggestions\", \"onboarding_status\", \"onboarding_checks\", \"priorities\", \"rank_status\", \"usage\", \"overseer_status\", \"inbox_brief\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\"]);",
|
|
137
|
+
"const readOnlyTools = new Set([\"catch_up_deck\", \"context_requests\", \"queue_list\", \"workspace_status\", \"list_prs\", \"inbox_list\", \"workstreams\", \"agent_digest\", \"route_candidates\", \"workspace_about\", \"link_items\", \"agent_settings\", \"display_settings\", \"follow_settings\", \"project_settings\", \"pr_workflow\", \"reviewer_settings\", \"reviewer_suggestions\", \"onboarding_status\", \"onboarding_checks\", \"priorities\", \"rank_status\", \"usage\", \"overseer_status\", \"inbox_brief\", \"pr_controls\", \"browser_status\", \"trust_bypass_status\", \"release_notes\", \"updates_status\"]);",
|
|
134
138
|
"const destructiveTools = new Set([\"merge\"]);",
|
|
135
139
|
"const actionInstruction = \"Follow-up's action tools let you do anything the developer can click, across every tracked workspace and every Settings tab. Read freely: list_prs, inbox_list, inbox_brief, workspace_about, agent_settings, display_settings, follow_settings, project_settings, pr_workflow, reviewer_settings, onboarding_status, priorities, rank_status, usage, overseer_status, pr_controls. Hand the main role on, or claim it, with make_main_agent. Act only when the developer asks (\\\"the PRs look good, assign reviewers on all\\\": list_prs needs_reviewers=true, add_reviewers with those keys, then confirm the plan): add_reviewers, merge, enable/disable_merge_when_ready, send_repairs, set_auto_send, clear_hold, retry_batch, track, run_recovery, set_priorities, rerank_priorities; settings with set_display (trust bypass too), set_follow_settings, set_project_tracking, set_pr_workflow, save_reviewers, set_agent_setting, set_wait_for_jobs, set_onboarding; snooze_workspace; ai_rename; and sign_off/snooze/set_finish_flags/inbox_act/brief_action/answer_question for other agents. Planned tools return a dry run showing what changes; run it with confirm=true and its planId. Never sign yourself off or answer your own brief.\";",
|
|
136
140
|
"",
|
|
@@ -149,7 +153,7 @@ export const mcpSource: string = [
|
|
|
149
153
|
" // Contributors get make_main_agent only (its claim rules apply); recovery sessions get none.",
|
|
150
154
|
" const acting = !actions || recovery ? [] : contributor ? actionTools.filter(t => t[0] === \"make_main_agent\" || t[0] === \"report_issue\") : actionTools;",
|
|
151
155
|
" if (briefOnly) return [...(brief ? tools.filter(t => t[0] === \"needs_you\") : []), ...acting];",
|
|
152
|
-
" return [...tools.filter(t => t[0] === \"needs_you\" ? brief && !recovery && !contributor : contributor ? [\"workspace_status\", \"register_pr\", \"sync_workspace\", \"link_item\", \"unlink_item\"].includes(t[0]) : !recovery || ![\"declare_done\", \"sync_workspace\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\"].includes(t[0])), ...acting];",
|
|
156
|
+
" return [...tools.filter(t => t[0] === \"needs_you\" ? brief && !recovery && !contributor : contributor ? [\"workspace_status\", \"register_pr\", \"sync_workspace\", \"link_item\", \"unlink_item\"].includes(t[0]) : !recovery || ![\"declare_done\", \"sync_workspace\", \"ask_question\", \"record_answer\", \"withdraw_question\", \"set_spec\", \"link_item\", \"unlink_item\", \"context_reply\"].includes(t[0])), ...acting];",
|
|
153
157
|
"}",
|
|
154
158
|
"/** Whether this session may call needs_you: launched as a root agent (FOLLOW_UP_BRIEF) and the inbox is on. */",
|
|
155
159
|
"async function briefEnabled() {",
|
package/server/mcp.mjs
CHANGED
|
@@ -28,6 +28,7 @@ const tools = [
|
|
|
28
28
|
["acknowledge_batch", "Record a follow-up result. Complete only after verifying all tasks; blocked surfaces the reason to the developer. Always acknowledge before ending a repair turn. Keep the result within 2000 characters.", "follow.acknowledge", { batchId: string, outcome: { type: "string", enum: ["completed", "blocked"] }, result: { ...string, maxLength: 2000 } }, ["batchId", "outcome", "result"]],
|
|
29
29
|
["ask_question", "Ask the developer a decision you can't make yourself. Give a short title, the question, lettered options A, B, C… with what each means for them, and recommend the option you'd pick. Set big only when building ahead would send something off this computer, set something people or programs outside the repo rely on, or most remaining work would build on it. Link a PR (owner/repo#number) or task id when it is about one. The reply says the question mode and exactly what to do until the answer arrives. Asking something already open returns the open question (\"Already open as Q18\") instead of a second one; to change an open question's options, ask again with supersedes=\"Q18\". At the end of the turn point at it with needs_you questions=[\"Q18\"], don't restate it. URLs and owner/repo#123 in the question, background and options are clickable for the developer. Every card already ends with a built-in \"Something else\" choice where the developer writes their own answer; don't add an \"Other\" option yourself.", "follow.ask-question", { title: { ...string, maxLength: 120 }, question: { ...string, maxLength: 2000 }, options: { type: "array", maxItems: 26, items: { type: "object", properties: { letter: { type: "string", pattern: "^[A-Z]$" }, label: { ...string, maxLength: 200 }, consequence: { ...string, maxLength: 600 } }, required: ["letter", "label"], additionalProperties: false } }, recommend: string, big: string, background: string, links: { type: "array", maxItems: 10, items: { type: "object", properties: { url: string, path: string, label: string }, additionalProperties: false } }, pr: string, task: string, supersedes: { type: "string", pattern: "^Q\\d+$" } }, ["title", "question"]],
|
|
30
30
|
["record_answer", "Record the developer's answer when they answered a question in chat instead of in Follow-up. choice is an option letter, \"other\" when they chose none of your options (words is then required: their answer), or their short answer when there were no options; words is what they said.", "follow.record-answer", { id: string, choice: string, words: string }, ["id", "choice"]],
|
|
31
|
+
["context_reply", "Answer the developer's More context ask with the requestId it gave: { requestId, text }, plain words. Only when asked.", "follow.context-reply", { requestId: { ...string, maxLength: 80 }, text: { ...string, minLength: 1, maxLength: 4000 } }, ["requestId", "text"]],
|
|
31
32
|
["withdraw_question", "Withdraw a question that no longer matters, with a short reason.", "follow.withdraw-question", { id: string, reason: string }, ["id", "reason"]],
|
|
32
33
|
["set_spec", "Register the link to this workspace's spec: the Claude artifact (or doc) you keep summarizing the goal, decisions and status. Call it once after the first publish, with the URL from the publish result, and again only if the link changes. Follow-up shows it in the workspace header.", "follow.set-spec", { url: { ...string, maxLength: 2000 }, title: { ...string, maxLength: 120 } }, ["url"]],
|
|
33
34
|
["link_item", "Link what this workspace's work is about: the Linear issue, Slack thread, doc or artifact you started from or opened for it. ref is its URL or Linear key; why is one short line. Don't link things you only mention. A PR isn't a linked item: register it with register_pr. An unknown Linear key is refused.", "follow.link-item", { ref: { ...string, maxLength: 2000 }, why: { ...string, maxLength: 140 }, title: { ...string, maxLength: 200 } }, ["ref"]],
|
|
@@ -90,6 +91,9 @@ const actionTools = [
|
|
|
90
91
|
["overseer_start", "Start the Overseer, like Start on Home." + ask, "follow.agent-act", { ...planned }, []],
|
|
91
92
|
["overseer_restart", "Restart the Overseer (with the model Settings → Agents names now)." + ask, "follow.agent-act", { ...planned }, []],
|
|
92
93
|
["overseer_ask", "Send the developer's words to the Overseer, as its box on Home does: { text }." + ask, "follow.agent-act", { text: string, ...planned }, []],
|
|
94
|
+
["catch_up_deck", "Read Catch up's deck: everything that needs the developer, one card per ask in Home's order, with any More context ask on it." + read, "follow.agent-act", {}, []],
|
|
95
|
+
["context_requests", "Read Catch up's More context asks: what the developer asked about a card, who answers, the state and the answer." + read, "follow.agent-act", { workspaceId: string }, []],
|
|
96
|
+
["ask_context", "Ask the Overseer or a card's agent to explain a card for the developer, like Catch up's More context: { workspaceId, agentId, cardKey, card, target: overseer | agent, ask } (cardKey and card from catch_up_deck)." + ask, "follow.agent-act", { workspaceId: string, agentId: string, cardKey: string, card: string, target: { type: "string", enum: ["overseer", "agent"] }, ask: string, ...planned }, []],
|
|
93
97
|
["queue_list", "Read Follow-up's message queue: answers, repairs and forwards waiting to reach agents, with each one's state (queued, sending, retrying, failed), why it waits and when it tries next, plus the newest sent: { workspaceId?, agentId? }." + read, "follow.agent-act", { workspaceId: string, agentId: string }, []],
|
|
94
98
|
["queue_action", "Retry a queued or failed message now, or cancel it so it never goes: { itemId, action: retry | cancel } (ids from queue_list)." + ask, "follow.agent-act", { itemId: string, action: { type: "string", enum: ["retry", "cancel"] }, ...planned }, []],
|
|
95
99
|
["inbox_brief", "Read another agent's full Needs-you brief (decisions, options, links): { agentId }." + read, "follow.agent-act", { agentId: string }, ["agentId"]],
|
|
@@ -128,7 +132,7 @@ const overseerTools = [
|
|
|
128
132
|
const overseerNames = new Set(overseerTools.map(t => t[0]));
|
|
129
133
|
const overseerInstruction = "You are Follow-up's Overseer. Route the developer's asks with route_candidates and send_to_agent; ask with needs_you kind=decision when unsure; start_workspace only when the developer asked or approved. Never merge, post to people or archive.";
|
|
130
134
|
const actionNames = new Set(actionTools.map(t => t[0]));
|
|
131
|
-
const readOnlyTools = new Set(["queue_list", "workspace_status", "list_prs", "inbox_list", "workstreams", "agent_digest", "route_candidates", "workspace_about", "link_items", "agent_settings", "display_settings", "follow_settings", "project_settings", "pr_workflow", "reviewer_settings", "reviewer_suggestions", "onboarding_status", "onboarding_checks", "priorities", "rank_status", "usage", "overseer_status", "inbox_brief", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status"]);
|
|
135
|
+
const readOnlyTools = new Set(["catch_up_deck", "context_requests", "queue_list", "workspace_status", "list_prs", "inbox_list", "workstreams", "agent_digest", "route_candidates", "workspace_about", "link_items", "agent_settings", "display_settings", "follow_settings", "project_settings", "pr_workflow", "reviewer_settings", "reviewer_suggestions", "onboarding_status", "onboarding_checks", "priorities", "rank_status", "usage", "overseer_status", "inbox_brief", "pr_controls", "browser_status", "trust_bypass_status", "release_notes", "updates_status"]);
|
|
132
136
|
const destructiveTools = new Set(["merge"]);
|
|
133
137
|
const actionInstruction = "Follow-up's action tools let you do anything the developer can click, across every tracked workspace and every Settings tab. Read freely: list_prs, inbox_list, inbox_brief, workspace_about, agent_settings, display_settings, follow_settings, project_settings, pr_workflow, reviewer_settings, onboarding_status, priorities, rank_status, usage, overseer_status, pr_controls. Hand the main role on, or claim it, with make_main_agent. Act only when the developer asks (\"the PRs look good, assign reviewers on all\": list_prs needs_reviewers=true, add_reviewers with those keys, then confirm the plan): add_reviewers, merge, enable/disable_merge_when_ready, send_repairs, set_auto_send, clear_hold, retry_batch, track, run_recovery, set_priorities, rerank_priorities; settings with set_display (trust bypass too), set_follow_settings, set_project_tracking, set_pr_workflow, save_reviewers, set_agent_setting, set_wait_for_jobs, set_onboarding; snooze_workspace; ai_rename; and sign_off/snooze/set_finish_flags/inbox_act/brief_action/answer_question for other agents. Planned tools return a dry run showing what changes; run it with confirm=true and its planId. Never sign yourself off or answer your own brief.";
|
|
134
138
|
|
|
@@ -147,7 +151,7 @@ function toolList(recovery = env("RECOVERY") === "1", contributor = false, brief
|
|
|
147
151
|
// Contributors get make_main_agent only (its claim rules apply); recovery sessions get none.
|
|
148
152
|
const acting = !actions || recovery ? [] : contributor ? actionTools.filter(t => t[0] === "make_main_agent" || t[0] === "report_issue") : actionTools;
|
|
149
153
|
if (briefOnly) return [...(brief ? tools.filter(t => t[0] === "needs_you") : []), ...acting];
|
|
150
|
-
return [...tools.filter(t => t[0] === "needs_you" ? brief && !recovery && !contributor : contributor ? ["workspace_status", "register_pr", "sync_workspace", "link_item", "unlink_item"].includes(t[0]) : !recovery || !["declare_done", "sync_workspace", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item"].includes(t[0])), ...acting];
|
|
154
|
+
return [...tools.filter(t => t[0] === "needs_you" ? brief && !recovery && !contributor : contributor ? ["workspace_status", "register_pr", "sync_workspace", "link_item", "unlink_item"].includes(t[0]) : !recovery || !["declare_done", "sync_workspace", "ask_question", "record_answer", "withdraw_question", "set_spec", "link_item", "unlink_item", "context_reply"].includes(t[0])), ...acting];
|
|
151
155
|
}
|
|
152
156
|
/** Whether this session may call needs_you: launched as a root agent (FOLLOW_UP_BRIEF) and the inbox is on. */
|
|
153
157
|
async function briefEnabled() {
|