paseo-follow-up 1.4.0-beta.1 → 1.4.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/OVERVIEW.md CHANGED
@@ -31,7 +31,7 @@ Every root agent Paseo launches (tracked or not) gets Follow-up's action tools:
31
31
 
32
32
  ## Data and access
33
33
 
34
- This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent history and configuration, GitHub status and existing CLI authentication, and keeps its state in `plugin-data/follow-through` on the daemon host. It registers scoped MCP tools and reversible provider hooks for tracked sessions and, while the Needs-you inbox is on, the `needs_you` tool and its Stop-hook nudge for root agents (see below). To find the spec link it reads completed Claude Artifact publish results in the workspace's root sessions, never page content, chat links or the repository; a link you set wins over the agent's, which wins over detection. Repair prompts go to your configured agent and provider. For the provider meters it calls the Smart Session plugin's `smart-session.subscriptions` and `smart-session.budget` RPCs at most once a minute, or reads the newest rows of its `plugin-data/smart-session/accounts-YYYY-MM.jsonl`; it never asks ZeroSub to refresh or switch. It has no Slack identity and no background channel scanning; replies to stakeholders need your authorization and a sent-message receipt from the agent.
34
+ This is a trusted, unsandboxed plugin. It reads workspace metadata, saved agent history and configuration, GitHub status and existing CLI authentication, and keeps its state in `plugin-data/follow-through` on the daemon host. It attaches scoped agent tools per session (served by Paseo's own MCP as `follow_*` on Paseo 0.15+, a per-launch stdio bridge otherwise; never a global MCP registration, and it removes the user-scope `follow-through` entry older versions wrote, keeping a `.follow-through-unregister.bak` of each file) and reversible provider hooks for tracked sessions and, while the Needs-you inbox is on, the `needs_you` tool and its Stop-hook nudge for root agents (see below). To find the spec link it reads completed Claude Artifact publish results in the workspace's root sessions, never page content, chat links or the repository; a link you set wins over the agent's, which wins over detection. Repair prompts go to your configured agent and provider. For the provider meters it calls the Smart Session plugin's `smart-session.subscriptions` and `smart-session.budget` RPCs at most once a minute, or reads the newest rows of its `plugin-data/smart-session/accounts-YYYY-MM.jsonl`; it never asks ZeroSub to refresh or switch. It has no Slack identity and no background channel scanning; replies to stakeholders need your authorization and a sent-message receipt from the agent.
35
35
 
36
36
  Reviewer lists live in `plugin-data/follow-through/reviewers.json` (owner-only), apart from `state.json`. Each list is per repository, plus a default for repositories without one, and each user keeps their own. Collaborator and team suggestions are read with `gh api` only when you open Add reviewer. They are cached for ten minutes, and never polled.
37
37
 
package/README.md CHANGED
@@ -153,7 +153,7 @@ Turn it off under Settings → **Overseer (beta)**.
153
153
  Install the beta:
154
154
 
155
155
  ```sh
156
- paseo plugin update follow-through --version 1.4.0-beta.1
156
+ paseo plugin update follow-through --version 1.4.0-beta.2
157
157
  # or, for a fresh install:
158
158
  paseo plugin install npm:paseo-follow-up@beta
159
159
  ```
package/index.server.ts CHANGED
@@ -29,12 +29,15 @@ import { lifecycleOnly, recoveryBatch } from "./shared/follow-up";
29
29
  import { Deployments } from "./server/deployments";
30
30
  import { AgentHooks } from "./server/agent-hooks";
31
31
  import { withSessionMcp } from "./server/session-mcp";
32
+ import { nativeTools, nativeToolsAvailable, type Invoke, type Live } from "./server/native-tools";
33
+ import { removeGlobalRegistrations } from "./server/mcp-registrations";
34
+ import { scopes } from "./server/scopes";
32
35
  import { updateObligation } from "./server/obligations";
33
36
  import { Inbox, type GuardPause } from "./server/inbox";
34
37
  import { daemonDirectory, guardPath } from "./server/inbox-directory";
35
38
  import { fileSources } from "./server/inbox-classifier";
36
39
  import { onBeforeSend } from "./server/daemon";
37
- import { copyFile, readFile, rename } from "node:fs/promises";
40
+ import { copyFile, readFile, rename, stat } from "node:fs/promises";
38
41
  import { HistoryCache } from "./server/history-cache";
39
42
  import { Governor } from "./server/governor";
40
43
  import { ListCache } from "./server/list-cache";
@@ -59,6 +62,9 @@ export default function contribute(server: PluginServerContext) {
59
62
  const questionMode = async (): Promise<QuestionMode> => { try { const state = await questionSettings.read(); return state.status === "ready" ? state.values.mode : DEFAULT_QUESTION_MODE; } catch { return DEFAULT_QUESTION_MODE; } };
60
63
  const directory = join(paseoHome, "plugin-data", "follow-through");
61
64
  const bridge = join(directory, "mcp.mjs");
65
+ // Every RPC handler, also callable in-process: native agent tools run the same handlers the stdio bridge reaches.
66
+ const handlers = new Map<string, { input: { parseAsync(value: unknown): Promise<unknown> }; run: (input: any, context: PluginHandlerContext) => unknown }>();
67
+ const handle: PluginServerContext["handle"] = (contract, handler) => { handlers.set(contract.name, { input: contract.input, run: handler as never }); server.handle(contract, handler); };
62
68
  const store = new Store(directory, 1_000);
63
69
  store.onChanged = scopeWriter(directory);
64
70
  const agentHooks = new AgentHooks(directory, clientEntry());
@@ -192,6 +198,8 @@ export default function contribute(server: PluginServerContext) {
192
198
  unlock = await store.lock();
193
199
  await mkdir(directory, { recursive: true, mode: 0o700 });
194
200
  await writeFile(bridge, mcpSource, { mode: 0o600 });
201
+ // 1.4.0-beta.2: tools are per agent now; drop the old user-scope registrations that spawned mcp.mjs in every session.
202
+ void removeGlobalRegistrations().then(results => { const removed = results.filter(r => r.status === "removed").map(r => r.path); if (removed.length) console.warn(`[follow-up] removed the global follow-through MCP registration from ${removed.length} file(s); backups end in .follow-through-unregister.bak`); });
195
203
  governor.start();
196
204
  await engine.recover();
197
205
  await migrateTracking();
@@ -206,6 +214,28 @@ export default function contribute(server: PluginServerContext) {
206
214
  await writeBriefState().catch(() => undefined);
207
215
  })().catch(() => { loadError = "Follow-through could not start. Check its saved state and worker lock."; });
208
216
  const requireReady = async () => { await ready; if (loadError || stopped) throw new Error(loadError ?? "Follow-through is stopping"); };
217
+ // 1.4.0-beta.2: Follow-up's tools per agent: natively through Paseo's MCP when the host serves plugin tools,
218
+ // otherwise the stdio bridge for this launch only. FOLLOW_THROUGH_TOOLS tells the hooks which names the agent has.
219
+ let configCache: { mtimeMs: number; value: unknown } | null = null;
220
+ const paseoConfig = async () => {
221
+ try { const path = join(paseoHome, "config.json"); const { mtimeMs } = await stat(path); if (configCache?.mtimeMs !== mtimeMs) configCache = { mtimeMs, value: JSON.parse(await readFile(path, "utf8")) }; return configCache.value as Parameters<typeof nativeToolsAvailable>[1]; } catch { return null; }
222
+ };
223
+ const live = async (agentId: string): Promise<Live> => ({ role: scopes(await store.snapshot())[agentId]?.role ?? null, inbox: (await inboxSettings()).enable_inbox });
224
+ const invoke: Invoke = async (method, input, context) => {
225
+ const handler = handlers.get(method); if (!handler) throw new Error(`Unknown Follow-up method ${method}.`);
226
+ return handler.run(await handler.input.parseAsync(input), { paseo: context.paseo });
227
+ };
228
+ const withTools = async <R extends Parameters<typeof withSessionMcp>[0]>(request: R, recovery: boolean, brief: string | null, root: boolean, overseer = false): Promise<R> => {
229
+ // FOLLOW_THROUGH_TOOL_PROVIDERS / FOLLOW_THROUGH_FORCE_STDIO exist for the isolated harness (scripts/check-native-tools.mjs).
230
+ const providers = (process.env.FOLLOW_THROUGH_TOOL_PROVIDERS ?? "claude,codex").split(",");
231
+ if (request.purpose !== "interactive" || !providers.includes(request.provider) || request.labels["plugin-tools/enabled"] === "false") return request;
232
+ if (process.env.FOLLOW_THROUGH_FORCE_STDIO !== "1" && nativeToolsAvailable(request, await paseoConfig())) {
233
+ const flags = { recovery, brief: !!brief && !recovery, root: root && !recovery, overseer: overseer && !recovery };
234
+ const env = { ...request.env, FOLLOW_THROUGH_TOOLS: "native", FOLLOW_THROUGH_PROVIDER: request.provider, ...(flags.root ? { FOLLOW_THROUGH_ROOT: "1" } : {}), ...(flags.overseer ? { FOLLOW_THROUGH_OVERSEER: "1" } : {}) };
235
+ return { ...request, env, tools: [...request.tools, ...nativeTools(flags, live, invoke)] };
236
+ }
237
+ return withSessionMcp({ ...request, env: { ...request.env, FOLLOW_THROUGH_TOOLS: "stdio", FOLLOW_THROUGH_PROVIDER: request.provider } }, directory, clientEntry(), paseoHome, recovery, process.env, brief, root, overseer, providers) as R;
238
+ };
209
239
  const loop = async () => {
210
240
  await ready;
211
241
  if (stopped || loadError) return;
@@ -244,8 +274,8 @@ export default function contribute(server: PluginServerContext) {
244
274
  return agent.workspaceId;
245
275
  };
246
276
 
247
- server.handle(rpc.projectSettingsRpc, async () => { await requireReady(); return { projects: await gateway.projects(await store.snapshot()) }; });
248
- server.handle(rpc.setProjectTrackingRpc, async ({ projectId, enable_default_tracking }) => {
277
+ handle(rpc.projectSettingsRpc, async () => { await requireReady(); return { projects: await gateway.projects(await store.snapshot()) }; });
278
+ handle(rpc.setProjectTrackingRpc, async ({ projectId, enable_default_tracking }) => {
249
279
  await requireReady();
250
280
  const projects = await gateway.projects(await store.snapshot());
251
281
  if (!projects.some(p => p.id === projectId)) throw new Error("This project is no longer available. Refresh settings.");
@@ -259,8 +289,8 @@ export default function contribute(server: PluginServerContext) {
259
289
  workspaces: state.workspaces.filter(w => !w.archived).map(w => ({ id: w.id, title: w.title, enable_tracking: w.enable_tracking, enable_auto_sends: w.enable_auto_sends, optedOut: optedOut(state, w.id), dormant: !!w.dormant, parked: !!state.autoSendsParked?.includes(w.id) }))
260
290
  .sort((a, b) => a.title.localeCompare(b.title) || a.id.localeCompare(b.id)) };
261
291
  };
262
- server.handle(rpc.followSettingsRpc, async () => { await requireReady(); return followSettings(); });
263
- server.handle(rpc.setFollowSettingsRpc, async ({ enable_follow_every, enable_auto_sends_default, activeWindowDays, workspace }) => {
292
+ handle(rpc.followSettingsRpc, async () => { await requireReady(); return followSettings(); });
293
+ handle(rpc.setFollowSettingsRpc, async ({ enable_follow_every, enable_auto_sends_default, activeWindowDays, workspace }) => {
264
294
  await requireReady();
265
295
  await store.mutate(state => {
266
296
  if (activeWindowDays !== undefined) state.activeWindowDays = activeWindowDays;
@@ -282,7 +312,7 @@ export default function contribute(server: PluginServerContext) {
282
312
  void engine.tick();
283
313
  return followSettings();
284
314
  });
285
- server.handle(rpc.prOwnerRpc, async ({ repo, number }, { paseo }) => {
315
+ handle(rpc.prOwnerRpc, async ({ repo, number }, { paseo }) => {
286
316
  await requireReady();
287
317
  const owner = prOwner(await store.snapshot(), repo, number);
288
318
  if (!owner) return { owner: null };
@@ -290,7 +320,7 @@ export default function contribute(server: PluginServerContext) {
290
320
  if (!agent || agent.archivedAt || agent.workspaceId !== owner.workspaceId) return { owner: null };
291
321
  return { owner };
292
322
  });
293
- server.handle(rpc.prWorkspacesRpc, async ({ repo, number }, { paseo }) => {
323
+ handle(rpc.prWorkspacesRpc, async ({ repo, number }, { paseo }) => {
294
324
  await requireReady();
295
325
  const state = await store.snapshot();
296
326
  if (!browserRepositories(state).includes(repo.toLowerCase())) return { tracked: false, workspaces: [], more: 0 };
@@ -301,9 +331,9 @@ export default function contribute(server: PluginServerContext) {
301
331
  const view = browserWorkspaces(entries);
302
332
  return { tracked: true, ...view, workspaces: view.workspaces.map(w => ({ ...w, title: w.title.slice(0, 200), agentStatus: w.agentStatus.slice(0, 40), state: w.state.slice(0, 200) })) };
303
333
  });
304
- server.handle(rpc.listRpc, async ({ since }) => { await ready; return { ...listCache.answer(await store.snapshot(), since), error: loadError ?? hookError ?? engine.error }; });
305
- server.handle(rpc.getRpc, async ({ workspaceId }) => { await ready; return { workspace: (await store.snapshot()).workspaces.find(w => w.id === workspaceId && w.enable_tracking) ?? null, error: loadError ?? hookError ?? engine.error }; });
306
- server.handle(rpc.syncWorkspaceRpc, async ({ agentId, summary }, { paseo }) => {
334
+ handle(rpc.listRpc, async ({ since }) => { await ready; return { ...listCache.answer(await store.snapshot(), since), error: loadError ?? hookError ?? engine.error }; });
335
+ handle(rpc.getRpc, async ({ workspaceId }) => { await ready; return { workspace: (await store.snapshot()).workspaces.find(w => w.id === workspaceId && w.enable_tracking) ?? null, error: loadError ?? hookError ?? engine.error }; });
336
+ handle(rpc.syncWorkspaceRpc, async ({ agentId, summary }, { paseo }) => {
307
337
  await requireReady();
308
338
  const workspaceId = await callerWorkspaceId(agentId, paseo, false);
309
339
  const w = agentWorkspace(await store.snapshot(), agentId, "write", workspaceId, "pr");
@@ -311,11 +341,11 @@ export default function contribute(server: PluginServerContext) {
311
341
  await agentHooks.confirm(w.id, agentId, summary);
312
342
  return { workspaceId: w.id, synced: true as const };
313
343
  });
314
- server.handle(rpc.agentStatusRpc, async ({ agentId }, { paseo }) => { await requireReady(); const workspaceId = await callerWorkspaceId(agentId, paseo); return agentWorkspace(await store.snapshot(), agentId, "read", workspaceId, "pr"); });
315
- server.handle(rpc.activateRpc, async ({ workspaceId }) => { await requireReady(); return engine.activate(workspaceId); });
316
- server.handle(rpc.sendRpc, async ({ workspaceId, batchId }) => { await requireReady(); return engine.sendPending(workspaceId, batchId); });
317
- server.handle(rpc.recoverRpc, async ({ workspaceId }) => { await requireReady(); return engine.startRecovery(workspaceId); });
318
- server.handle(rpc.enrollRpc, async ({ agentId, workspaceId, goal }, { paseo }) => {
344
+ handle(rpc.agentStatusRpc, async ({ agentId }, { paseo }) => { await requireReady(); const workspaceId = await callerWorkspaceId(agentId, paseo); return agentWorkspace(await store.snapshot(), agentId, "read", workspaceId, "pr"); });
345
+ handle(rpc.activateRpc, async ({ workspaceId }) => { await requireReady(); return engine.activate(workspaceId); });
346
+ handle(rpc.sendRpc, async ({ workspaceId, batchId }) => { await requireReady(); return engine.sendPending(workspaceId, batchId); });
347
+ handle(rpc.recoverRpc, async ({ workspaceId }) => { await requireReady(); return engine.startRecovery(workspaceId); });
348
+ handle(rpc.enrollRpc, async ({ agentId, workspaceId, goal }, { paseo }) => {
319
349
  await requireReady();
320
350
  const agent = (await paseo.agents.ref(agentId).refresh())?.agent;
321
351
  if (!agent?.workspaceId || !await isWorkspaceRoot(agent, async id => (await paseo.agents.ref(id).refresh())?.agent)) throw new Error("Choose an available main agent in this workspace.");
@@ -334,7 +364,7 @@ export default function contribute(server: PluginServerContext) {
334
364
  return w;
335
365
  });
336
366
  });
337
- server.handle(rpc.registerPrRpc, async ({ agentId, repo, number, stack, parentNumber, disposition }, { paseo }) => {
367
+ handle(rpc.registerPrRpc, async ({ agentId, repo, number, stack, parentNumber, disposition }, { paseo }) => {
338
368
  await requireReady();
339
369
  const workspaceId = await callerWorkspaceId(agentId, paseo);
340
370
  const result = await store.mutate(state => {
@@ -359,7 +389,7 @@ export default function contribute(server: PluginServerContext) {
359
389
  });
360
390
  void engine.tick(); return result;
361
391
  });
362
- server.handle(rpc.excludeStackRpc, async ({ agentId, stack, reason, obligationIds }, { paseo }) => {
392
+ handle(rpc.excludeStackRpc, async ({ agentId, stack, reason, obligationIds }, { paseo }) => {
363
393
  await requireReady();
364
394
  const workspaceId = await callerWorkspaceId(agentId, paseo);
365
395
  const result = await store.mutate(state => {
@@ -369,7 +399,7 @@ export default function contribute(server: PluginServerContext) {
369
399
  });
370
400
  void engine.tick(); return result;
371
401
  });
372
- server.handle(rpc.obligationRpc, async ({ agentId, ...input }, { paseo }) => {
402
+ handle(rpc.obligationRpc, async ({ agentId, ...input }, { paseo }) => {
373
403
  await requireReady();
374
404
  const workspaceId = await callerWorkspaceId(agentId, paseo);
375
405
  const result = await store.mutate(state => {
@@ -380,7 +410,7 @@ export default function contribute(server: PluginServerContext) {
380
410
  });
381
411
  void engine.tick(); return result;
382
412
  });
383
- server.handle(rpc.askQuestionRpc, async ({ agentId, ...input }, { paseo }) => {
413
+ handle(rpc.askQuestionRpc, async ({ agentId, ...input }, { paseo }) => {
384
414
  await requireReady();
385
415
  const workspaceId = await callerWorkspaceId(agentId, paseo);
386
416
  const mode = await questionMode();
@@ -391,7 +421,7 @@ export default function contribute(server: PluginServerContext) {
391
421
  return { workspaceId: w.id, question, mode, instruction };
392
422
  });
393
423
  });
394
- server.handle(rpc.recordAnswerRpc, async ({ agentId, id, choice, words }, { paseo }) => {
424
+ handle(rpc.recordAnswerRpc, async ({ agentId, id, choice, words }, { paseo }) => {
395
425
  await requireReady();
396
426
  const workspaceId = await callerWorkspaceId(agentId, paseo);
397
427
  return store.mutate(state => {
@@ -399,7 +429,7 @@ export default function contribute(server: PluginServerContext) {
399
429
  return { workspaceId: w.id, question: recordAnswer(w, agentId, id, choice, words, Date.now()) };
400
430
  });
401
431
  });
402
- server.handle(rpc.withdrawQuestionRpc, async ({ agentId, id, reason }, { paseo }) => {
432
+ handle(rpc.withdrawQuestionRpc, async ({ agentId, id, reason }, { paseo }) => {
403
433
  await requireReady();
404
434
  const workspaceId = await callerWorkspaceId(agentId, paseo);
405
435
  return store.mutate(state => {
@@ -407,7 +437,7 @@ export default function contribute(server: PluginServerContext) {
407
437
  return { workspaceId: w.id, question: withdrawQuestion(w, agentId, id, reason, Date.now()) };
408
438
  });
409
439
  });
410
- server.handle(rpc.setSpecRpc, async ({ agentId, url, title }, { paseo }) => {
440
+ handle(rpc.setSpecRpc, async ({ agentId, url, title }, { paseo }) => {
411
441
  await requireReady();
412
442
  const workspaceId = await callerWorkspaceId(agentId, paseo);
413
443
  return store.mutate(state => {
@@ -416,7 +446,7 @@ export default function contribute(server: PluginServerContext) {
416
446
  return { workspaceId: w.id, spec: w.spec, applied, message };
417
447
  });
418
448
  });
419
- server.handle(rpc.workspaceSpecRpc, async input => {
449
+ handle(rpc.workspaceSpecRpc, async input => {
420
450
  await requireReady();
421
451
  return store.mutate(state => {
422
452
  const w = findWorkspace(state, input.workspaceId);
@@ -425,9 +455,9 @@ export default function contribute(server: PluginServerContext) {
425
455
  return w;
426
456
  });
427
457
  });
428
- server.handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action); });
429
- server.handle(rpc.declareDoneRpc, async ({ agentId, summary }, { paseo }) => { await requireReady(); return engine.declareDone(agentId, summary, await callerWorkspaceId(agentId, paseo, false)); });
430
- server.handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result }, { paseo }) => {
458
+ handle(rpc.answerQuestionRpc, async ({ workspaceId, questionId, choice, words, action }) => { await requireReady(); return engine.answer(workspaceId, questionId, choice, words, action); });
459
+ handle(rpc.declareDoneRpc, async ({ agentId, summary }, { paseo }) => { await requireReady(); return engine.declareDone(agentId, summary, await callerWorkspaceId(agentId, paseo, false)); });
460
+ handle(rpc.acknowledgeRpc, async ({ agentId, batchId, outcome, result }, { paseo }) => {
431
461
  await requireReady();
432
462
  const agent = (await paseo.agents.ref(agentId).refresh())?.agent;
433
463
  try { return await engine.acknowledge(agentId, batchId, outcome, result, await callerWorkspaceId(agentId, paseo)); }
@@ -440,12 +470,12 @@ export default function contribute(server: PluginServerContext) {
440
470
  throw error;
441
471
  }
442
472
  });
443
- server.handle(rpc.controlRpc, async input => {
473
+ handle(rpc.controlRpc, async input => {
444
474
  await requireReady();
445
475
  return store.mutate(state => controlWorkspace(state, input));
446
476
  });
447
- server.handle(rpc.refreshRpc, async () => { await requireReady(); void engine.tick(); return { ok: true }; });
448
- server.handle(rpc.refineTasksRpc, async ({ workspaceId, tasks }) => {
477
+ handle(rpc.refreshRpc, async () => { await requireReady(); void engine.tick(); return { ok: true }; });
478
+ handle(rpc.refineTasksRpc, async ({ workspaceId, tasks }) => {
449
479
  await requireReady();
450
480
  const result = await store.mutate(state => {
451
481
  const w = findWorkspace(state, workspaceId);
@@ -461,7 +491,7 @@ export default function contribute(server: PluginServerContext) {
461
491
  });
462
492
  void engine.tick(); return result;
463
493
  });
464
- server.handle(rpc.taskTriggerRpc, async ({ workspaceId, obligationId, expectedRevision, trigger, afterPrs }) => {
494
+ handle(rpc.taskTriggerRpc, async ({ workspaceId, obligationId, expectedRevision, trigger, afterPrs }) => {
465
495
  await requireReady();
466
496
  const result = await store.mutate(state => {
467
497
  const w = findWorkspace(state, workspaceId);
@@ -474,13 +504,13 @@ export default function contribute(server: PluginServerContext) {
474
504
  });
475
505
  void engine.tick(); return result;
476
506
  });
477
- server.handle(rpc.browserStatusRpc, async () => { await requireReady(); return browser.status(); });
478
- server.handle(rpc.browserExchangeRpc, async ({ clientId, ready: browserReady, acceptJobs, results, repositories }) => { await requireReady(); return { ...browser.exchange(clientId, browserReady, results, acceptJobs, repositories), repositories: browserRepositories(await store.snapshot()) }; });
479
- server.handle(rpc.prControlStatusRpc, async ({ workspaceId, prKey }) => { await requireReady(); return actions.status(workspaceId, prKey); });
480
- server.handle(rpc.preparePrActionRpc, async ({ workspaceId, prKey, kind }) => { await requireReady(); return actions.prepare(workspaceId, prKey, kind); });
481
- server.handle(rpc.confirmPrActionRpc, async ({ planId, scope }) => { await requireReady(); const result = await actions.confirm(planId, scope); void engine.tick(); return result; });
482
- server.handle(rpc.checkPrActionRpc, async ({ workspaceId, actionId }) => { await requireReady(); return actions.check(workspaceId, actionId); });
483
- server.handle(rpc.requestReviewersRpc, async ({ workspaceId, prKey, reviewers, remember }) => {
507
+ handle(rpc.browserStatusRpc, async () => { await requireReady(); return browser.status(); });
508
+ handle(rpc.browserExchangeRpc, async ({ clientId, ready: browserReady, acceptJobs, results, repositories }) => { await requireReady(); return { ...browser.exchange(clientId, browserReady, results, acceptJobs, repositories), repositories: browserRepositories(await store.snapshot()) }; });
509
+ handle(rpc.prControlStatusRpc, async ({ workspaceId, prKey }) => { await requireReady(); return actions.status(workspaceId, prKey); });
510
+ handle(rpc.preparePrActionRpc, async ({ workspaceId, prKey, kind }) => { await requireReady(); return actions.prepare(workspaceId, prKey, kind); });
511
+ handle(rpc.confirmPrActionRpc, async ({ planId, scope }) => { await requireReady(); const result = await actions.confirm(planId, scope); void engine.tick(); return result; });
512
+ handle(rpc.checkPrActionRpc, async ({ workspaceId, actionId }) => { await requireReady(); return actions.check(workspaceId, actionId); });
513
+ handle(rpc.requestReviewersRpc, async ({ workspaceId, prKey, reviewers, remember }) => {
484
514
  await requireReady();
485
515
  // "Remember for <repo>" saves first: it's the developer's choice whatever GitHub answers.
486
516
  if (reviewers && remember) await reviewerStore.save(prKey.split("#")[0], reviewers);
@@ -492,9 +522,9 @@ export default function contribute(server: PluginServerContext) {
492
522
  for (const w of (await store.snapshot()).workspaces) for (const p of w.prs) seen.add(repoKey(p.repo));
493
523
  return { config, repos: [...seen].sort() };
494
524
  };
495
- server.handle(rpc.reviewerSettingsRpc, async () => { await requireReady(); return reviewerSettings(); });
496
- server.handle(rpc.saveReviewersRpc, async ({ repo, reviewers }) => { await requireReady(); await reviewerStore.save(repo, reviewers); return reviewerSettings(); });
497
- server.handle(rpc.reviewerSuggestionsRpc, async ({ repo }) => { await requireReady(); return reviewerSuggestions.suggest(repo); });
525
+ handle(rpc.reviewerSettingsRpc, async () => { await requireReady(); return reviewerSettings(); });
526
+ handle(rpc.saveReviewersRpc, async ({ repo, reviewers }) => { await requireReady(); await reviewerStore.save(repo, reviewers); return reviewerSettings(); });
527
+ handle(rpc.reviewerSuggestionsRpc, async ({ repo }) => { await requireReady(); return reviewerSuggestions.suggest(repo); });
498
528
 
499
529
  const priorityStore = new PriorityStore(directory);
500
530
  // Paseo's workspace descriptors for the Overseer (name, project, branch): metadata only, one paged read. The
@@ -510,9 +540,9 @@ export default function contribute(server: PluginServerContext) {
510
540
  overseer = new Overseer({ directory, store, inbox, priorities: priorityStore, workspaces: paseoWorkspaces, enabled: overseerOn, paseoHome, tight: async () => !governor.allowsBackground(),
511
541
  windowMs: async () => activeWindowMs(await store.snapshot()), provider: process.env.FOLLOW_UP_OVERSEER_PROVIDER || undefined });
512
542
  const overseerStatus = async () => { const s = await overseer!.state(); return { enabled: await overseerOn(), agentId: s.agentId, workspaceId: s.workspaceId, startedAt: s.startedAt, generation: s.generation, error: s.error }; };
513
- server.handle(rpc.overseerStatusRpc, async () => { await requireReady(); return overseerStatus(); });
514
- server.handle(rpc.overseerStartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.start(paseo as unknown as OverseerPaseo); return overseerStatus(); });
515
- server.handle(rpc.overseerActRpc, async ({ agentId, tool, args }, { paseo }) => {
543
+ handle(rpc.overseerStatusRpc, async () => { await requireReady(); return overseerStatus(); });
544
+ handle(rpc.overseerStartRpc, async (_input, { paseo }) => { await requireReady(); seen(paseo); await overseer!.start(paseo as unknown as OverseerPaseo); return overseerStatus(); });
545
+ handle(rpc.overseerActRpc, async ({ agentId, tool, args }, { paseo }) => {
516
546
  await requireReady(); seen(paseo);
517
547
  if (!(OVERSEER_TOOLS as readonly string[]).includes(tool)) throw new Error(`Unknown Overseer tool ${tool}.`);
518
548
  return overseer!.act(paseo as unknown as OverseerPaseo, agentId, tool as OverseerTool, args);
@@ -558,7 +588,7 @@ export default function contribute(server: PluginServerContext) {
558
588
  context: aboutContext, usage: () => usage.read(),
559
589
  firstMessage: async agentId => { await historyCache.load(); return historyCache.get(agentId)?.history.goal ?? null; }, roomForBackground: async () => governor.allowsBackground(), roomOnDemand: async () => governor.allowsExtras(),
560
590
  });
561
- server.handle(rpc.workspaceAboutRpc, async ({ workspaceId, open, refresh }, { paseo }) => { await requireReady(); seen(paseo); return about.view(workspaceId, { open, refresh }); });
591
+ handle(rpc.workspaceAboutRpc, async ({ workspaceId, open, refresh }, { paseo }) => { await requireReady(); seen(paseo); return about.view(workspaceId, { open, refresh }); });
562
592
  // Pre-write overviews for what's in Needs you, so opening one there is instant. Every 10 minutes, capped per day.
563
593
  let aboutTimer: ReturnType<typeof setTimeout> | null = null;
564
594
  const aboutLoop = async () => {
@@ -575,10 +605,10 @@ export default function contribute(server: PluginServerContext) {
575
605
  };
576
606
  aboutTimer = setTimeout(() => void aboutLoop(), 60_000);
577
607
  const agentActions = new AgentActions({ store, prActions: actions, engine, inbox, priorities: priorityStore, about });
578
- server.handle(rpc.prioritiesRpc, async () => ({ items: await priorityStore.read() }));
608
+ handle(rpc.prioritiesRpc, async () => ({ items: await priorityStore.read() }));
579
609
  // Provider limits are non-essential: at critical memory only the VM meter is served.
580
- server.handle(rpc.usageRpc, async () => ({ ...(governor.allowsExtras() ? await usage.read() : NO_USAGE), resources: governor.current() }));
581
- server.handle(rpc.agentActRpc, async ({ agentId, tool, args }, { paseo }) => {
610
+ handle(rpc.usageRpc, async () => ({ ...(governor.allowsExtras() ? await usage.read() : NO_USAGE), resources: governor.current() }));
611
+ handle(rpc.agentActRpc, async ({ agentId, tool, args }, { paseo }) => {
582
612
  await requireReady(); seen(paseo);
583
613
  if (!(AGENT_TOOLS as readonly string[]).includes(tool)) throw new Error(`Unknown Follow-up tool ${tool}.`);
584
614
  if (!/^[\w-]+$/.test(agentId)) throw new Error("Unsupported agent identity.");
@@ -592,10 +622,10 @@ export default function contribute(server: PluginServerContext) {
592
622
  void engine.tick();
593
623
  return result;
594
624
  });
595
- server.handle(rpc.inboxListRpc, async () => { await requireReady(); return { ...await inbox.list(), error: inboxError }; });
596
- server.handle(rpc.inboxBriefRpc, async ({ agentId }) => { await requireReady(); return { brief: await inbox.brief(agentId) }; });
597
- server.handle(rpc.inboxActRpc, async input => { await requireReady(); return inbox.act(input); });
598
- server.handle(rpc.needsYouRpc, async ({ agentId, ...input }, { paseo }) => {
625
+ handle(rpc.inboxListRpc, async () => { await requireReady(); return { ...await inbox.list(), error: inboxError }; });
626
+ handle(rpc.inboxBriefRpc, async ({ agentId }) => { await requireReady(); return { brief: await inbox.brief(agentId) }; });
627
+ handle(rpc.inboxActRpc, async input => { await requireReady(); return inbox.act(input); });
628
+ handle(rpc.needsYouRpc, async ({ agentId, ...input }, { paseo }) => {
599
629
  await requireReady(); seen(paseo);
600
630
  if (!(await inboxSettings()).enable_inbox) throw new Error("The Needs-you inbox is off, so there's no brief to fill. Finish with your normal reply.");
601
631
  if (!/^[\w-]+$/.test(agentId)) throw new Error("Unsupported agent identity.");
@@ -635,7 +665,7 @@ export default function contribute(server: PluginServerContext) {
635
665
  await rename(temporary, needsYouPath(agentId));
636
666
  return { ok: true as const, briefId: `brief:${turn?.turnId ?? record.at}` };
637
667
  });
638
- server.handle(rpc.briefActionRpc, async ({ agentId, briefId, decisionId, choice, move }, { paseo }) => {
668
+ handle(rpc.briefActionRpc, async ({ agentId, briefId, decisionId, choice, move }, { paseo }) => {
639
669
  await requireReady(); seen(paseo);
640
670
  const brief = await inbox.briefAction(agentId, { briefId, decisionId, choice, move }, async (text, messageId) => {
641
671
  await paseo.agents.ref(agentId).send(text, { messageId, activeTurnBehavior: "steer" });
@@ -676,7 +706,7 @@ export default function contribute(server: PluginServerContext) {
676
706
  // The Overseer: needs_you (no Stop-hook nudge), the action tools and its routing tools. Never tracked.
677
707
  if (request.labels[OVERSEER_LABEL] === "1" && request.provider !== "codex") {
678
708
  const env = { ...request.env, FOLLOW_THROUGH_OVERSEER: "1", FOLLOW_THROUGH_BRIEF: "claude" };
679
- return withSessionMcp({ ...request, env }, directory, clientEntry(), paseoHome, false, process.env, "claude", true, true);
709
+ return withTools({ ...request, env }, false, "claude", true, true);
680
710
  }
681
711
  const saved = await store.snapshot();
682
712
  let w = saved.workspaces.find(w => w.enable_tracking && !w.archived && (w.mainAgentId === request.agentId || w.batches.some(b => b.recipientAgentId === request.agentId && !b.settledAt && b.tasks.every(t => t.kind === "inventory") && ["sending", "sent", "uncertain", "blocked"].includes(b.state))));
@@ -704,11 +734,11 @@ export default function contribute(server: PluginServerContext) {
704
734
  if (!w) {
705
735
  // Root agents get the action tools (agent parity) and, while the inbox is on, needs_you.
706
736
  if (!root) return request;
707
- return withSessionMcp({ ...request, env: { ...request.env, ...(brief ? { FOLLOW_THROUGH_BRIEF: brief } : {}) } }, directory, clientEntry(), paseoHome, false, process.env, brief, true);
737
+ return withTools({ ...request, env: { ...request.env, ...(brief ? { FOLLOW_THROUGH_BRIEF: brief } : {}) } }, false, brief, true);
708
738
  }
709
739
  const recovery = w.mainAgentId !== request.agentId && !w.contributorAgentIds?.includes(request.agentId);
710
740
  const main = !recovery && w.mainAgentId === request.agentId ? brief : null;
711
- return withSessionMcp({ ...request, env: { ...request.env, FOLLOW_THROUGH_CLI: bridge, FOLLOW_THROUGH_CLIENT_ENTRY: clientEntry(), ...(recovery ? { FOLLOW_THROUGH_RECOVERY: "1" } : {}), ...(main ? { FOLLOW_THROUGH_BRIEF: main } : {}) } }, directory, clientEntry(), paseoHome, recovery, process.env, main, root && !recovery);
741
+ return withTools({ ...request, env: { ...request.env, FOLLOW_THROUGH_CLI: bridge, FOLLOW_THROUGH_CLIENT_ENTRY: clientEntry(), ...(recovery ? { FOLLOW_THROUGH_RECOVERY: "1" } : {}), ...(main ? { FOLLOW_THROUGH_BRIEF: main } : {}) } }, recovery, main, root && !recovery);
712
742
  }),
713
743
  server.on("agent.turn_ended", async (event, { paseo, signal }) => {
714
744
  await ready;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "1.4.0-beta.1",
4
+ "version": "1.4.0-beta.2",
5
5
  "description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
6
6
  "type": "module",
7
7
  "files": [
@@ -24,9 +24,10 @@
24
24
  "scripts": {
25
25
  "typecheck": "tsc --noEmit",
26
26
  "test": "tsx --test tests/*.test.ts",
27
- "verify": "npm run typecheck && npm test && node --test button-visibility.test.mjs && npm run test:scale",
27
+ "verify": "npm run typecheck && npm test && node --test button-visibility.test.mjs && npm run test:scale && npm run test:native",
28
28
  "preview": "node scripts/check-install.mjs --keep",
29
29
  "test:install": "node scripts/check-install.mjs",
30
+ "test:native": "node scripts/check-native-tools.mjs --agents 10",
30
31
  "prepare": "node scripts/build.mjs",
31
32
  "test:scale": "node scripts/scale-check.mjs --workspaces 120 --awake 5 --churn 35 --idle 30 --rss-budget 240 --cpu-budget 3"
32
33
  },
@@ -1,10 +1,19 @@
1
1
  #!/usr/bin/env node
2
2
  import { readFile, writeFile, mkdir, rename } from "node:fs/promises";
3
3
  import { dirname, join } from "node:path";
4
- import { fileURLToPath } from "node:url";
4
+ import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
 
7
7
  const directory = dirname(fileURLToPath(import.meta.url));
8
+ /** 1.4.0-beta.2: launched with Follow-up's tools served by Paseo's MCP (follow_<name>), or the follow-through bridge (<name>). Agents opened before the upgrade carry no flag and keep the bridge names. */
9
+ const native = process.env.FOLLOW_THROUGH_TOOLS === "native";
10
+ // Tool names that read unambiguously in prose; kept identical to server/mcp.mjs's underscore names (a test checks it).
11
+ 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", "workspace_about", "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", "set_finish_flags", "set_priorities", "agent_digest", "route_candidates", "send_to_agent", "start_workspace"];
12
+ const toolPattern = new RegExp(`(?<![\\w])(${TOOL_NAMES.join("|")})(?![\\w])`, "g");
13
+ /** Names Follow-up's tools the way this agent has them. */
14
+ export function named(text, isNative = native) { return isNative ? text.replace(toolPattern, "follow_$1") : text; }
15
+ /** Whether a tool call is Follow-up's own, under either name set (mcp__follow-through__x, follow-through.x, mcp__paseo__follow_x, paseo.follow_x). */
16
+ export function isFollowTool(tool) { return /follow[\s_-]*through/i.test(tool) || /^(?:mcp__paseo__|paseo[.:/])follow_[a-z_]+$/.test(tool); }
8
17
  const quietRevision = 1;
9
18
  const quietInstruction = "Do routine bookkeeping silently. Do not announce tracker calls, say you updated/synced the sidebar, recap panel state, or add plugin-status commentary/final paragraphs. Put receipts and evidence in the tools. User-facing messages should cover the actual work outcome, or a decision/blocker requiring the developer; answer sidebar status only when explicitly asked. If this continuation is bookkeeping only, use the tools and finish without another recap or repeating your previous answer.";
10
19
  const stopReason = "Silently complete this workspace's sidebar bookkeeping before finishing.";
@@ -68,11 +77,14 @@ async function save(path, value) {
68
77
  await rename(temporary, path);
69
78
  }
70
79
  function instructions(lease, contributor = false) {
80
+ return named(paragraphs(lease, contributor).filter(p => !(native && /^Prefer (?:the )?native/i.test(p))).join("\n\n"));
81
+ }
82
+ function paragraphs(lease, contributor) {
71
83
  if (contributor) return [
72
84
  "Maintain PR tracking for this session in its tracked workspace. Read workspace_status now and after compaction. Register every PR you submit, including from secondary git worktrees, with register_pr; register parents before children. References and external dependencies are not owned PRs. Call sync_workspace before finishing. The designated main agent retains goal, task, scope and completion authority.",
73
85
  quietInstruction,
74
86
  `Prefer native Follow-through tools. CLI fallback: FOLLOW_THROUGH_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, "mcp.mjs"))} call <tool> '<json>' --compact. Do not ask the developer to maintain the sidebar.`,
75
- ].join("\n\n");
87
+ ];
76
88
  return [
77
89
  "Maintain this tracked workspace's Follow-through sidebar as part of your normal work; do not wait for a developer reminder.",
78
90
  quietInstruction,
@@ -85,8 +97,26 @@ function instructions(lease, contributor = false) {
85
97
  "Follow-through batches contain a batch ID and task list. Read workspace_status and refresh live conditions before acting; skip resolved tasks. Process dependent PRs bottom to top, one PR fully before the next. Use the repository's /fix-pr workflow, validate feedback, verify changes, submit through Graphite with --publish, and reply/resolve addressed threads. Follow the repository's safe reparent procedure for merged parents and preserve uncommitted work. For post-deploy tasks, verify the currently serving revision contains every dependency and record behavioral results separately. Acknowledge the header's batch ID with acknowledge_batch before finishing: completed with the result, or blocked with the reason. Verify the entire goal and post-merge work before declare_done; acknowledge a completion batch first. Merging and archiving remain the developer's actions.",
86
98
  "Before ending this turn, reconcile the sidebar with what you actually did and call sync_workspace with a short summary, including when no changes are needed. Acknowledge any assigned batch. When the entire goal is fulfilled, use declare_done; otherwise preserve remaining work. Do not launch recovery, start queued repairs, merge, toggle merge-when-ready, or archive as part of this bookkeeping. Auto still governs separate follow-up sends. Subagents report to the main agent instead of claiming workspace ownership.",
87
99
  `Prefer the native follow-through MCP tools. For a full historical record, use workspace_status with detail=full. CLI compatibility fallback: FOLLOW_THROUGH_CLIENT_ENTRY=${quote(lease.clientEntry)} node ${quote(join(directory, "mcp.mjs"))} call <tool> '<json>' --compact. Omit --compact only when an existing script needs the full response. Never ask the developer to maintain the sidebar or run this bridge.`,
88
- ].join("\n\n");
100
+ ];
101
+ }
102
+ /** With native tools there's no MCP initialize reply, so the role text it carried comes from the hook instead. */
103
+ async function nativeExtras(brief) {
104
+ if (!native) return [];
105
+ const bridge = await import(pathToFileURL(join(directory, "mcp.mjs")).href).catch(() => null);
106
+ if (!bridge) return [];
107
+ return [
108
+ brief?.enable_inbox && process.env.FOLLOW_THROUGH_BRIEF ? bridge.needsYouInstruction : null,
109
+ process.env.FOLLOW_THROUGH_ROOT === "1" ? bridge.actionInstruction : null,
110
+ process.env.FOLLOW_THROUGH_OVERSEER === "1" ? bridge.overseerInstruction : null,
111
+ ].filter(Boolean).map(text => named(text));
89
112
  }
113
+ /**
114
+ * Claude Code keeps hook context for the whole session and re-runs SessionStart after compaction, so the same text
115
+ * on every prompt only costs tokens (~1.3k per turn for a tracked main agent): send it once per session and again
116
+ * only when it changes. Other providers keep the per-prompt text.
117
+ */
118
+ export function shouldRepeat(provider, turn, hash) { return provider !== "claude" || turn?.contextHash !== hash; }
119
+ const digest = text => createHash("sha256").update(text).digest("hex").slice(0, 16);
90
120
  async function main() {
91
121
  const agentId = process.env.PASEO_AGENT_ID;
92
122
  if (!agentId || !/^[\w-]+$/.test(agentId) || process.env.FOLLOW_THROUGH_RECOVERY === "1") return;
@@ -98,6 +128,11 @@ async function main() {
98
128
  if (lease.expiresAt < Date.now() || !lease.clientEntry) return;
99
129
  // The Overseer: a fresh digest at the start of every turn; no sidebar bookkeeping and no Stop-hook nudge.
100
130
  if (process.env.FOLLOW_THROUGH_OVERSEER === "1") {
131
+ if (event.hook_event_name === "SessionStart") {
132
+ const extras = await nativeExtras(await json(join(directory, "brief.json")).catch(() => null));
133
+ if (extras.length) process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: "SessionStart", additionalContext: extras.join("\n\n") } }) + "\n");
134
+ return;
135
+ }
101
136
  if (event.hook_event_name !== "UserPromptSubmit") return;
102
137
  const file = await json(join(directory, "overseer-digest.json")).catch(() => null);
103
138
  if (!file || file.agentId !== agentId) return;
@@ -119,26 +154,32 @@ async function main() {
119
154
  // The brief nudge applies to root agents launched with FOLLOW_THROUGH_BRIEF, tracked or not.
120
155
  const provider = process.env.FOLLOW_THROUGH_BRIEF || null;
121
156
  const brief = provider ? await json(join(directory, "brief.json")).catch(() => null) : null;
122
- if (!workspace && !(brief?.enable_inbox && brief?.enable_brief_nudge)) return;
157
+ if (!workspace && !(brief?.enable_inbox && brief?.enable_brief_nudge) && !(native && process.env.FOLLOW_THROUGH_ROOT === "1")) return;
123
158
  const context = () => instructions(lease, contributor);
159
+ const sessionText = async () => [workspace ? context() : null, ...await nativeExtras(brief)].filter(Boolean).join("\n\n");
124
160
  const name = event.hook_event_name;
125
161
  if (!["SessionStart", "UserPromptSubmit", "PostToolUse", "Stop"].includes(name)) return;
126
162
  const session = createHash("sha256").update(String(event.session_id ?? agentId)).digest("hex").slice(0, 24);
127
163
  const path = join(directory, "hook-state", `${agentId}-${session}.json`);
128
164
  const turn = await json(path).catch(() => null);
129
165
  const emit = text => process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: name, additionalContext: text } }) + "\n");
130
- if (name === "SessionStart") { if (workspace) emit(context()); return; }
166
+ if (name === "SessionStart") {
167
+ const text = await sessionText();
168
+ if (text) { emit(text); await save(path, { ...turn, contextHash: digest(text) }); }
169
+ return;
170
+ }
131
171
  if (name === "UserPromptSubmit") {
132
172
  if (turn?.stopped && String(event.prompt ?? "").startsWith(stopReason)) return;
133
- await save(path, { startedAt: Date.now(), dirtyAt: null, stopped: false, quietRevision });
134
- if (workspace) emit(context());
173
+ const text = await sessionText(); const hash = text ? digest(text) : null;
174
+ await save(path, { startedAt: Date.now(), dirtyAt: null, stopped: false, quietRevision, contextHash: hash });
175
+ if (text && shouldRepeat(process.env.FOLLOW_THROUGH_PROVIDER, turn, hash)) emit(text);
135
176
  return;
136
177
  }
137
178
  if (name === "PostToolUse") {
138
179
  if (!workspace) return;
139
180
  const tool = String(event.tool_name ?? "");
140
181
  const args = JSON.stringify(event.tool_input ?? {});
141
- const trackedTool = /follow[\s_-]*through/i.test(tool) || args.includes(join(directory, "mcp.mjs"));
182
+ const trackedTool = isFollowTool(tool) || args.includes(join(directory, "mcp.mjs"));
142
183
  const dirty = !trackedTool && /(bash|shell|exec_command|write_stdin|edit|write|apply_patch|notebook)/i.test(tool);
143
184
  const upgrade = turn?.quietRevision !== quietRevision;
144
185
  if (dirty || upgrade) await save(path, { ...turn, startedAt: turn?.startedAt ?? (dirty ? Date.now() : 0), stopped: turn?.stopped ?? false, ...(dirty ? { dirtyAt: Date.now() } : {}), quietRevision });
@@ -155,7 +196,7 @@ async function main() {
155
196
  const nudge = shouldNudge({ provider, brief, agentId, contributor, recovery: false, subagent: false, stopHookActive: !!event.stop_hook_active, turn, called });
156
197
  if (!sync && !nudge) return;
157
198
  await save(path, { ...turn, startedAt: turn?.startedAt ?? Date.now(), stopped: true, ...(nudge ? { nudgedAt: Date.now() } : {}) });
158
- const reasons = [sync ? stopReason + " This is metadata bookkeeping only; do not start queued repairs or recovery.\n\n" + context() : null, nudge ? nudgeReason : null].filter(Boolean);
199
+ const reasons = [sync ? stopReason + " This is metadata bookkeeping only; do not start queued repairs or recovery.\n\n" + context() : null, nudge ? named(nudgeReason) : null].filter(Boolean);
159
200
  process.stdout.write(JSON.stringify({ decision: "block", reason: reasons.join("\n\n") }) + "\n");
160
201
  }
161
202
  // Tests import shouldNudge without running the hook.