paseo-follow-up 2.4.2 → 2.6.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/OVERVIEW.md +1 -1
  3. package/README.md +0 -1
  4. package/client/home.tsx +16 -8
  5. package/client/live.tsx +4 -3
  6. package/client/new-settings.tsx +1 -1
  7. package/client/onboarding.tsx +50 -118
  8. package/client/panel.tsx +2 -1
  9. package/client/release-notes.tsx +98 -123
  10. package/client/setup-dialog.tsx +168 -0
  11. package/client/setup-gate.tsx +69 -0
  12. package/client/setup-ui.ts +27 -0
  13. package/client/tasks.tsx +38 -8
  14. package/client/updates.tsx +6 -6
  15. package/index.client.tsx +1 -1
  16. package/index.server.ts +46 -4
  17. package/package.json +1 -1
  18. package/server/agent-hook.mjs +6 -4
  19. package/server/agent-parity.ts +2 -2
  20. package/server/ai-jobs.ts +26 -5
  21. package/server/engine.ts +6 -2
  22. package/server/hook-source.ts +6 -4
  23. package/server/job-agent.ts +13 -2
  24. package/server/mcp-source.ts +4 -4
  25. package/server/mcp.mjs +4 -4
  26. package/server/obligations.ts +7 -5
  27. package/server/release-notes.ts +5 -5
  28. package/server/scheduled-tasks.ts +92 -0
  29. package/server/session-prompt.ts +30 -3
  30. package/server/turn-end.ts +130 -0
  31. package/server/wait-jobs.ts +18 -2
  32. package/server/wait.ts +17 -12
  33. package/shared/agent-settings.ts +9 -8
  34. package/shared/attention.ts +4 -0
  35. package/shared/changelog.ts +33 -0
  36. package/shared/compass.ts +5 -4
  37. package/shared/contracts.ts +4 -4
  38. package/shared/job-rows.ts +2 -2
  39. package/shared/message-sender.ts +2 -0
  40. package/shared/new-name.ts +4 -1
  41. package/shared/onboarding.ts +17 -13
  42. package/shared/provider-support.ts +83 -34
  43. package/shared/queue.ts +1 -1
  44. package/shared/recommend.ts +1 -1
  45. package/shared/settings-nav.ts +3 -1
  46. package/shared/setup-popup.ts +28 -0
  47. package/shared/task-due.ts +3 -1
  48. package/shared/task-trigger.ts +125 -1
  49. package/shared/wait.ts +2 -2
  50. package/skills/follow-up/SKILL.md +1 -1
package/server/wait.ts CHANGED
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import type { AgentToolDefinition, AgentToolContext, PluginSessionOpenRequest } from "@getpaseo/plugin/server";
3
3
  import { WaitJobs, waitInput, prepareInput } from "./wait-jobs";
4
4
  import type { WaitStatus } from "../shared/wait";
5
+ import { providerCaps } from "../shared/provider-support";
5
6
 
6
7
  /**
7
8
  * Wait: bounded foreground waits for finite background jobs, folded in from the standalone paseo-wait plugin
@@ -15,8 +16,10 @@ import type { WaitStatus } from "../shared/wait";
15
16
  * can't serve plugin tools (Paseo 0.14, daemon.mcp.injectIntoAgents=false, the provider's Paseo tools off) get no
16
17
  * Wait; the standalone plugin's loopback MCP was not carried over.
17
18
  *
18
- * Claude only: it sets CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0 so Claude Code doesn't move a long MCP call to the
19
- * background (this also applies to the session's other long MCP calls), and relies on Bash run_in_background.
19
+ * Every provider with a shell tool (an-agent-on-any-provider-gets-follow-up). On Claude Code it sets
20
+ * CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=0 so Claude Code doesn't move a long MCP call to the background (this also
21
+ * applies to the session's other long MCP calls), and relies on Bash run_in_background; any other provider gets a
22
+ * command that detaches itself (wait-jobs.ts `detached`).
20
23
  */
21
24
  export const WAIT_TOOLS = ["wait_prepare_job", "wait_for_job", "wait_get_job"] as const;
22
25
  export const WAIT_LABEL = "follow-up-wait/enabled";
@@ -35,17 +38,17 @@ export function standaloneWaitInstalled(config: WaitPaseoConfig | null): boolean
35
38
  return !!entry && entry.enabled !== false;
36
39
  }
37
40
 
38
- /** Whether this host serves plugin tools to Claude agents at all (request.tools is checked per session). */
39
- function hostServesTools(config: WaitPaseoConfig | null): boolean {
41
+ /** Whether this host serves plugin tools to this provider's agents at all (request.tools is checked per session). */
42
+ function hostServesTools(config: WaitPaseoConfig | null, provider = "claude"): boolean {
40
43
  if (config?.daemon?.mcp?.enabled === false || config?.daemon?.mcp?.injectIntoAgents === false) return false;
41
- const policy = config?.agents?.providers?.claude?.paseoTools;
44
+ const policy = config?.agents?.providers?.[provider]?.paseoTools;
42
45
  if (policy?.enabled === false) return false;
43
46
  return !policy?.disabledTools?.some(name => (WAIT_TOOLS as readonly string[]).includes(name));
44
47
  }
45
48
 
46
49
  /** What Settings → Agents shows: the switch, and why Wait is off when it is on. */
47
- export function waitStatus(enabled: boolean, config: WaitPaseoConfig | null, hostBackgroundWork = false): WaitStatus {
48
- const reason = !enabled ? "off" : standaloneWaitInstalled(config) ? "standalone" : hostBackgroundWork ? "host" : !hostServesTools(config) ? "no-agent-tools" : null;
50
+ export function waitStatus(enabled: boolean, config: WaitPaseoConfig | null, hostBackgroundWork = false, provider = "claude"): WaitStatus {
51
+ const reason = !enabled ? "off" : standaloneWaitInstalled(config) ? "standalone" : hostBackgroundWork ? "host" : !hostServesTools(config, provider) ? "no-agent-tools" : null;
49
52
  return { enable_wait: enabled, active: reason === null, reason, ...(hostBackgroundWork ? { host: true } : {}) };
50
53
  }
51
54
 
@@ -64,7 +67,7 @@ export class Wait {
64
67
  name: "wait_prepare_job",
65
68
  description: "For a finite shell command that may take a while and whose result you need before finishing (tests, builds, installs, deploy checks): prepare it here instead of running it directly. Returns jobId and bashCommand and runs nothing. Run that exact bashCommand with native Bash run_in_background=true, then call wait_for_job instead of ending your turn. The command is stopped after timeoutSeconds (default 3 hours, at most 12); a stopped job reports timedOut.",
66
69
  input: prepareInput,
67
- execute: async (input, context) => { guard(context); return json(await this.jobs.prepare(owner(context), input as z.input<typeof prepareInput>)); },
70
+ execute: async (input, context) => { guard(context); return json(await this.jobs.prepare(owner(context), input as z.input<typeof prepareInput>, providerCaps(context.agent.provider).wait)); },
68
71
  },
69
72
  {
70
73
  name: "wait_get_job",
@@ -94,22 +97,24 @@ export class Wait {
94
97
  }
95
98
 
96
99
  /**
97
- * Adds Wait's tools to an interactive Claude session, unless it's off, opted out, or the standalone plugin has it.
100
+ * Adds Wait's tools to an interactive session on any provider, unless it's off, opted out, or the standalone plugin has it.
98
101
  * On a Paseo 0.16 host (agentBackgroundWork) it attaches nothing and leaves Claude Code's MCP auto-background alone;
99
102
  * FOLLOW_UP_BACKGROUND_WORK=1 makes the hook say "run it in the background and end your turn" instead.
100
103
  */
101
104
  async open<R extends PluginSessionOpenRequest>(request: R, options: { background?: boolean } = {}): Promise<R> {
102
105
  // A Paseo 0.16 background agent is another plugin's helper: no Wait (server/background-agents.ts).
103
- if (options.background || request.purpose !== "interactive" || request.provider !== "claude") return request;
106
+ if (options.background || request.purpose !== "interactive") return request;
107
+ const claude = request.provider === "claude";
104
108
  if (request.labels["plugin-tools/enabled"] === "false" || request.labels["paseo-wait/enabled"] === "false" || request.labels[WAIT_LABEL] === "false") return request;
105
109
  if (!(await this.deps.enabled())) return request;
106
110
  const config = await this.deps.config();
107
- const status = waitStatus(true, config, await this.deps.hostBackgroundWork?.().catch(() => false));
111
+ // Paseo 0.16's own background work is Claude Code's (agentBackgroundWork); every other provider gets Wait's tools.
112
+ const status = waitStatus(true, config, claude && await this.deps.hostBackgroundWork?.().catch(() => false), request.provider);
108
113
  // Paseo 0.16: no plugin tools needed for the host's own background work, so this comes before the tool checks.
109
114
  if (status.reason === "host") return { ...request, env: { ...request.env, FOLLOW_UP_BACKGROUND_WORK: "1" } };
110
115
  if (!Array.isArray(request.tools) || request.tools.some(tool => (WAIT_TOOLS as readonly string[]).includes(tool.name))) return request;
111
116
  if (!status.active) return request;
112
- return { ...request, env: { ...request.env, CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS: "0", FOLLOW_UP_WAIT: "1" }, tools: [...request.tools, ...this.tools] };
117
+ return { ...request, env: { ...request.env, ...(claude ? { CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS: "0" } : {}), FOLLOW_UP_WAIT: "1" }, tools: [...request.tools, ...this.tools] };
113
118
  }
114
119
 
115
120
  close() { this.jobs.close(); }
@@ -1,3 +1,4 @@
1
+ import { GUARDED_PHRASE, guardedProvider } from "./provider-support";
1
2
  import { z } from "zod";
2
3
  import { waitStatusSchema } from "./wait";
3
4
  import { NEW_NAME, NEW_WORK } from "./new-name";
@@ -18,20 +19,20 @@ import { NEW_NAME, NEW_WORK } from "./new-name";
18
19
  export const AGENT_ROLES = ["about", "overseer", "recovery", "ranker", "dispatch"] as const;
19
20
  export type AgentRole = typeof AGENT_ROLES[number];
20
21
  /**
21
- * One-shot jobs run on any Paseo provider. These two have a headless CLI fast path (server/ai-jobs.ts); every other
22
- * provider runs the job as a short-lived hidden agent (server/job-agent.ts).
22
+ * One-shot jobs run on any Paseo provider. Claude, Codex and Pi run through their own headless CLI (server/ai-jobs.ts);
23
+ * every other provider runs the job as a short-lived hidden agent (server/job-agent.ts).
23
24
  */
24
- export const CLI_JOB_PROVIDERS = ["claude", "codex"] as const;
25
+ export const CLI_JOB_PROVIDERS = ["claude", "codex", "pi"] as const;
25
26
  export const isJobRole = (role: AgentRole) => role === "about" || role === "ranker";
26
27
  /**
27
- * Whether Follow-up can take every tool away from a job on this provider: Claude under the job guard's grant, Codex in
28
- * its read-only sandbox. Any other provider runs a job as a Paseo agent with its own tools
29
- * (a-job-that-reads-outside-content-can-only-read), so a job that reads words someone else wrote doesn't run there.
28
+ * Whether Follow-up can take every tool away from a job on this provider (shared/provider-support.ts providerCaps:
29
+ * Claude under the job guard, Codex in its read-only sandbox, Pi with no tools, OpenCode with every permission denied).
30
+ * On any other a job that reads words someone else wrote doesn't run (a-job-that-reads-outside-content-can-only-read).
30
31
  */
31
- export const guardedProvider = (provider: string) => (CLI_JOB_PROVIDERS as readonly string[]).includes(provider);
32
+ export { guardedProvider };
32
33
  /** The one line a refused job leaves (Settings → Agents, the source, the job's error). */
33
34
  export const unguardedJobWhy = (providerLabel: string, what: string) =>
34
- `${what} doesn't run on ${providerLabel}: it reads words other people wrote, and Follow-up can't take ${providerLabel}'s tools away. Pick Claude or Codex in Settings → Agents.`;
35
+ `${what} doesn't run on ${providerLabel}: it reads words other people wrote, and ${providerLabel} can't promise Follow-up a job with no tools. Pick ${GUARDED_PHRASE} in Settings → Agents.`;
35
36
  /**
36
37
  * A job whose whole work reads words other people wrote (AI priority), so it runs only on a guarded provider: it's never
37
38
  * recommended on any other, and with no guarded provider available its row says so and shows it off.
@@ -9,6 +9,7 @@ import { IDLE_REASON, MAIN_WAIT, NO_PROGRESS_CAP, QUIET_WAIT, holdsQueue, mainWa
9
9
  import { workingLine } from "./task-status";
10
10
  import { owedTask } from "./task-view";
11
11
  import { taskDue } from "./task-due";
12
+ import { clockLabel, pendingAt } from "./task-trigger";
12
13
  import { followUpObligations, recoveryBatch } from "./follow-up";
13
14
  import { orderedStacks, prLink, settledForDisplay, type PrLink } from "./presentation";
14
15
  import { downstackScan, githubApproved, graphiteReady, isGithubFlow, mergeBlockers, prActionBlocks } from "./pr-actions";
@@ -502,6 +503,9 @@ export function liveLine(w: Workspace, now = Date.now()): { icon: LiveIcon; text
502
503
  // A wait the agent declared (a waiting task: a release, a reload window, a detached job) says what it waits on. The
503
504
  // waiting icon, Home's Waiting group and the brief's "Waiting on others" already say it waits, so the line doesn't.
504
505
  // With what moves it ("· after #232 merges"), so the line never reads as if that task were happening now.
506
+ // A wait with its own check-back time names the time (the soonest one): "Registry publish · checks back 12:15".
507
+ const timed = followUpObligations(w).filter(o => o.status === "waiting" && o.enable_follow_up && pendingAt(o.trigger)).sort((a, b) => a.trigger!.at!.localeCompare(b.trigger!.at!))[0];
508
+ if (timed) return { icon: "waiting", text: `${timed.title} · checks back ${clockLabel(timed.trigger!.at!, now)}`, since: null };
505
509
  const waiting = followUpObligations(w).find(o => o.status === "waiting");
506
510
  if (waiting) { const d = taskDue(waiting, w, now); const moves = d && !d.due ? d.label : null; return { icon: "waiting", text: moves ? `${waiting.title} · ${moves[0].toLowerCase()}${moves.slice(1)}` : waiting.title, since: null }; }
507
511
  // GitHub off (works-without-github): nothing is retrying and the statuses below are from before, so the line says
@@ -234,6 +234,8 @@ export const releaseNotesViewSchema = z.object({
234
234
  enable_whats_new: z.boolean().default(true),
235
235
  /** Every shipped release note, newest first. */
236
236
  notes: z.array(releaseNoteSchema),
237
+ /** The GitHub release pages (`releasesUrl` of package.json's repository), where the full changelogs live; null if none. */
238
+ releases: z.string().nullable().default(null),
237
239
  });
238
240
  export type ReleaseNotesView = z.infer<typeof releaseNotesViewSchema>;
239
241
 
@@ -252,6 +254,37 @@ export function recentNotes(view: Pick<ReleaseNotesView, "version" | "previous"
252
254
  return since.length ? since : view.notes.filter(n => n.version === notesVersion(view.version));
253
255
  }
254
256
 
257
+ /** A version in the notes feed: its curated notes, and whether it is the one this host runs. */
258
+ export type FeedNote = ReleaseNote & { installed: boolean };
259
+ /**
260
+ * What's new and the release notes are one scroll, like Paseo's own (invariant 120, `notes-read-like-one-feed`): every
261
+ * stable version's curated notes, newest first, each with its number and date, the running version marked Installed.
262
+ * `notes` are the installed package's (none newer than it is shown from there); `pending` are an update's notes, from
263
+ * the updater, for versions out but not installed, shown above it. Betas never appear: they ship no curated notes, and
264
+ * what they carried reaches people in the next stable's section. A major's rc counts as its major (`notesVersion`).
265
+ */
266
+ export function notesFeed(notes: readonly ReleaseNote[], installed: string, pending: readonly ReleaseNote[] = []): FeedNote[] {
267
+ const running = notesVersion(installed);
268
+ const stable = (n: ReleaseNote) => parseVersion(n.version)?.pre.length === 0 && hasContent(n);
269
+ const byVersion = new Map<string, ReleaseNote>();
270
+ for (const n of notes) if (stable(n) && compareVersions(n.version, running) <= 0) byVersion.set(n.version, n);
271
+ for (const n of pending) if (stable(n) && compareVersions(n.version, running) > 0 && !byVersion.has(n.version)) byVersion.set(n.version, n);
272
+ return [...byVersion.values()].sort((a, b) => compareVersions(b.version, a.version)).map(n => ({ ...n, installed: n.version === running }));
273
+ }
274
+
275
+ /**
276
+ * The GitHub release pages for a package.json `repository` (an object with `url`, or a string: a URL, `git@`, or the
277
+ * `github:owner/repo` and `owner/repo` shorthands), where each version's full changelog lives. null when it isn't GitHub.
278
+ */
279
+ export function releasesUrl(repository: unknown): string | null {
280
+ const raw = typeof repository === "string" ? repository : typeof (repository as { url?: unknown } | null)?.url === "string" ? (repository as { url: string }).url : null;
281
+ if (!raw) return null;
282
+ const m = /^(?:git\+)?(?:https?:\/\/|git:\/\/|ssh:\/\/git@)github\.com\/([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(raw)
283
+ ?? /^git@github\.com:([\w.-]+)\/([\w.-]+?)(?:\.git)?$/.exec(raw)
284
+ ?? /^(?:github:)?([\w-][\w.-]*)\/([\w.-]+?)(?:\.git)?$/.exec(raw);
285
+ return m ? `https://github.com/${m[1]}/${m[2]}/releases` : null;
286
+ }
287
+
255
288
  /** "just now", "12m ago", "2h ago", "3 days ago". */
256
289
  export function agoText(ms: number): string {
257
290
  const m = Math.floor(ms / 60_000);
package/shared/compass.ts CHANGED
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { WEEKDAYS, zoned, type Clock, type Weekday } from "./linear-queue";
3
3
  import { issueKey, keysIn } from "./issue-workspace";
4
4
  import { guardedProvider } from "./agent-settings";
5
+ import { GUARDED_PHRASE } from "./provider-support";
5
6
 
6
7
  /**
7
8
  * Compass (docs/compass.md): Follow-up takes the developer's priorities from where the developer takes them. A
@@ -330,13 +331,13 @@ export function defaultLabel(who: Who, places: readonly Place[]): string {
330
331
  // ---------- the guard: which providers a Compass job may run on ----------
331
332
 
332
333
  /**
333
- * Compass extraction reads other people's words, so it runs only where Follow-up can take every tool away: Claude
334
- * under the job guard's empty grant, Codex in its read-only sandbox (a-job-that-reads-outside-content-can-only-read).
335
- * Any other provider runs as a Paseo agent with its own tools, so Compass doesn't read there, and says why.
334
+ * Compass extraction reads other people's words, so it runs only where Follow-up can take every tool away
335
+ * (shared/provider-support.ts providerCaps guard; a-job-that-reads-outside-content-can-only-read). On any other provider
336
+ * Compass doesn't read, and says why.
336
337
  */
337
338
  export { guardedProvider };
338
339
  export const unguardedWhy = (providerLabel: string) =>
339
- `Compass doesn't read on ${providerLabel}: Follow-up can't take its tools away. Pick Claude or Codex for Summaries in Settings → Agents.`;
340
+ `Compass doesn't read on ${providerLabel}: Follow-up can't take its tools away. Pick ${GUARDED_PHRASE} for Summaries in Settings → Agents.`;
340
341
 
341
342
  // ---------- notes ----------
342
343
 
@@ -22,7 +22,7 @@ import { briefSchema } from "./brief";
22
22
  import { idSchema, textSchema, workspaceSchema } from "./model";
23
23
  import { listEntrySchema } from "./list";
24
24
  import { communicationSchema } from "./communication";
25
- import { taskTriggerSchema } from "./task-trigger";
25
+ import { taskTriggerInputSchema } from "./task-trigger";
26
26
  import { QUESTION_MODES, questionSchema } from "./questions";
27
27
  import { specSchema } from "./spec";
28
28
  import { HOME_GROUPS } from "./home";
@@ -53,7 +53,7 @@ export const agentStatusRpc = defineRpc({ name: "follow.agent-status", input: z.
53
53
  export const syncWorkspaceRpc = defineRpc({ name: "follow.sync", input: z.strictObject({ agentId: idSchema, summary: z.string().trim().min(1).max(1000) }), output: z.object({ workspaceId: idSchema, synced: z.literal(true) }) });
54
54
  export const enrollRpc = defineRpc({ name: "follow.enroll", input: z.strictObject({ workspaceId: idSchema.optional(), agentId: idSchema, goal: textSchema }), output: workspaceSchema });
55
55
  export const registerPrRpc = defineRpc({ name: "follow.register-pr", input: z.strictObject({ agentId: idSchema, repo: z.string().regex(/^[\w.-]+\/[\w.-]+$/), number: z.number().int().positive(), stack: textSchema, parentNumber: z.number().int().positive().nullable().optional(), disposition: z.string().max(2000).optional(), agentMerges: z.boolean().optional() }), output: workspaceSchema });
56
- export const obligationRpc = defineRpc({ name: "follow.obligation", input: z.strictObject({ agentId: idSchema, workingAgentId: idSchema.optional(), id: idSchema.optional(), title: textSchema, status: z.enum(["pending", "waiting", "working", "blocked", "done", "waived"]), afterPrs: z.array(idSchema).optional(), dependencyStage: z.enum(["merged", "deployed"]).optional(), evidence: z.string().max(4000).optional(), ask: z.string().trim().min(1).max(1000).optional(), question: z.string().regex(/^Q\d+$/).optional(), need: z.enum(["decision", "action"]).optional(), enable_follow_up: z.boolean().optional(), communication: agentCommunicationSchema.optional(), trigger: taskTriggerSchema.strict().nullable().optional(), recheck: z.string().trim().min(1).max(40).optional(), new: z.boolean().optional() }), output: workspaceSchema.extend({ updatedObligationId: idSchema, note: z.string().optional() }) });
56
+ export const obligationRpc = defineRpc({ name: "follow.obligation", input: z.strictObject({ agentId: idSchema, workingAgentId: idSchema.optional(), id: idSchema.optional(), title: textSchema, status: z.enum(["pending", "waiting", "working", "blocked", "done", "waived"]), afterPrs: z.array(idSchema).optional(), dependencyStage: z.enum(["merged", "deployed"]).optional(), evidence: z.string().max(4000).optional(), ask: z.string().trim().min(1).max(1000).optional(), question: z.string().regex(/^Q\d+$/).optional(), need: z.enum(["decision", "action"]).optional(), enable_follow_up: z.boolean().optional(), communication: agentCommunicationSchema.optional(), trigger: taskTriggerInputSchema.strict().nullable().optional(), recheck: z.string().trim().min(1).max(40).optional(), new: z.boolean().optional() }), output: workspaceSchema.extend({ updatedObligationId: idSchema, note: z.string().optional() }) });
57
57
  export const declareDoneRpc = defineRpc({ name: "follow.done", input: z.strictObject({ agentId: idSchema, summary: textSchema }), output: z.object({ workspace: workspaceSchema, blockers: z.array(z.string()), unconfirmed: z.array(z.string()).default([]), alreadyDone: z.boolean().default(false), next: z.string().default("") }) });
58
58
  export const acknowledgeRpc = defineRpc({ name: "follow.acknowledge", input: z.strictObject({ agentId: idSchema, batchId: idSchema, /** in_progress: the agent or its own subagent is already on it (Batch.inProgress). */ outcome: z.enum(["completed", "blocked", "in_progress"]), result: textSchema, /** With blocked: only a person can move what is still open (Batch.humanOnly). */ humanOnly: z.boolean().optional(), /** The part only a person can move, with any outcome (Batch.waitingOn). */ waitingOn: z.string().max(500).optional() }), output: workspaceSchema });
59
59
  export const controlRpc = defineRpc({ name: "follow.control", input: z.object({ workspaceId: idSchema, enable_auto_sends: z.boolean().optional(), clearHold: z.boolean().optional(), retryBatchId: idSchema.optional(), /** Retry one capped task (Q49): its key. */ retryTask: z.string().max(400).optional(), /** Auto per task: a task key and whether Follow-up sends it. */ taskAuto: z.object({ key: z.string().max(400), auto: z.boolean() }).optional(), /** The developer's "Make main agent": one of the workspace's other root agents. */ mainAgentId: idSchema.optional(),
@@ -124,8 +124,8 @@ export const renameWorkspaceRpc = defineRpc({ name: "follow.rename-workspace", i
124
124
  export const usageRpc = defineRpc({ name: "follow.usage", input: z.object({}), output: usageSchema });
125
125
  // Trust bypass agents: how many permission prompts were approved today, and the newest few (tool and a short summary).
126
126
  export const trustBypassRpc = defineRpc({ name: "follow.trust-bypass", input: z.object({}), output: z.object({ today: z.number().int().nonnegative(), recent: z.array(z.object({ at: z.string(), agentId: z.string(), tool: z.string(), summary: z.string(), mode: z.string() })).max(20) }) });
127
- export const refineTasksRpc = defineRpc({ name: "follow.refine-tasks", input: z.object({ workspaceId: idSchema, tasks: z.array(z.object({ id: idSchema, title: textSchema, afterPrs: z.array(idSchema), dependencyStage: z.enum(["merged", "deployed"]), enable_follow_up: z.boolean(), communication: communicationSchema.optional(), trigger: taskTriggerSchema.nullable().optional() })).max(SCALE.perWorkspace) }), output: workspaceSchema });
128
- export const taskTriggerRpc = defineRpc({ name: "follow.set-task-trigger", input: z.object({ workspaceId: idSchema, obligationId: idSchema, expectedRevision: z.number().int().nonnegative(), trigger: taskTriggerSchema.nullable(), afterPrs: z.array(idSchema) }), output: workspaceSchema });
127
+ export const refineTasksRpc = defineRpc({ name: "follow.refine-tasks", input: z.object({ workspaceId: idSchema, tasks: z.array(z.object({ id: idSchema, title: textSchema, afterPrs: z.array(idSchema), dependencyStage: z.enum(["merged", "deployed"]), enable_follow_up: z.boolean(), communication: communicationSchema.optional(), trigger: taskTriggerInputSchema.nullable().optional() })).max(SCALE.perWorkspace) }), output: workspaceSchema });
128
+ export const taskTriggerRpc = defineRpc({ name: "follow.set-task-trigger", input: z.object({ workspaceId: idSchema, obligationId: idSchema, expectedRevision: z.number().int().nonnegative(), trigger: taskTriggerInputSchema.strict().nullable(), afterPrs: z.array(idSchema) }), output: workspaceSchema });
129
129
 
130
130
  // Narrow integration: no inventory, messages, paths, or credentials cross this RPC.
131
131
  export const prOwnerRpc = defineRpc({ name: "follow.pr-owner", input: z.strictObject({ repo: z.string().regex(/^[\w.-]+\/[\w.-]+$/), number: z.number().int().positive() }), output: z.object({ owner: z.object({ workspaceId: idSchema, agentId: idSchema }).nullable() }) });
@@ -67,12 +67,12 @@ export function jobRow(r: RoleView, catalog: Catalog | null | undefined): JobRow
67
67
  const title = ROLE_INFO[role].title;
68
68
  const blocked = known && needsGuard(role) && !providers.some(p => p.available && guardedProvider(p.id));
69
69
  if (blocked) {
70
- notice = { tone: "warning", text: `${title} reads other people's messages, so it runs only on Claude Code or Codex, where Follow-up can keep it read-only. ${guardAction(providers)} to use it.` };
70
+ notice = { tone: "warning", text: `${title} reads other people's messages, so it runs only where Follow-up can keep it read-only. ${guardAction(providers)} to use it.` };
71
71
  } else if (broken) {
72
72
  const name = current?.label ?? roleSummary(r).split(" · ")[0];
73
73
  notice = { tone: "warning", text: `${name} isn't available here, so ${WONT_RUN[role]}.${recPick ? ` Recommended: ${recPick}.` : ""}` };
74
74
  } else if (known && needsGuard(role) && !r.same && !guardedProvider(r.provider)) {
75
- notice = { tone: "warning", text: `${title} reads other people's messages, so it runs only on Claude Code or Codex, where Follow-up can keep it read-only.${recPick ? ` Recommended: ${recPick}.` : ""}` };
75
+ notice = { tone: "warning", text: `${title} reads other people's messages, so it runs only where Follow-up can keep it read-only.${recPick ? ` Recommended: ${recPick}.` : ""}` };
76
76
  } else if (recPick) notice = { tone: "muted", text: `Recommended: ${recPick}` };
77
77
  return {
78
78
  role, title: ROLE_INFO[role].title, does: ROLE_INFO[role].does, need: ROLE_NEED[role],
@@ -56,6 +56,8 @@ export const HOOK_TEXT_PREFIXES = [
56
56
  "Follow-up was updated while this session was open",
57
57
  "Do routine bookkeeping silently.",
58
58
  "Maintain this tracked workspace's Follow-up sidebar",
59
+ // The same checks as one message, for a provider without the hook (server/turn-end.ts).
60
+ "Follow-up turn-end check:",
59
61
  ] as const;
60
62
  /** A provider's wrapper around hook feedback: Codex's `<hook_prompt …>` element or Claude Code's "Stop hook feedback:" line. */
61
63
  function hookBody(text: string): string | null {
@@ -15,7 +15,10 @@ export const OLD_NAMES = ["new"] as const;
15
15
  /** The sidebar row's switch (Display `enable_new_sidebar_row`), in Settings → Dispatch. One copy for every place it shows. */
16
16
  export const NEW_ROW = {
17
17
  label: `${NEW_NAME} in the sidebar`,
18
- hint: (key: string | null, palette = "⌘K") => `A row at the top of the sidebar that opens ${NEW_NAME}. Off: ${NEW_NAME} stays on Home${key ? `, under ${key}` : ""} and in ${palette}.`,
18
+ // A phone has no keyboard: `palette: null` (compact) names no shortcut and no palette, only Home.
19
+ hint: (key: string | null, palette: string | null = "⌘K") => palette === null
20
+ ? `A row at the top of the sidebar that opens ${NEW_NAME}. Off: ${NEW_NAME} stays on Home.`
21
+ : `A row at the top of the sidebar that opens ${NEW_NAME}. Off: ${NEW_NAME} stays on Home${key ? `, under ${key}` : ""} and in ${palette}.`,
19
22
  /**
20
23
  * Paseo's own "New workspace" row sits beside it and does less (an empty workspace, no issue or action). Paseo
21
24
  * 0.17 keeps which sidebar rows show per device in its own settings and gives plugins no way to change them or to
@@ -206,19 +206,25 @@ const joinNames = (names: string[]) => names.length > 1 ? `${names.slice(0, -1).
206
206
  /** Text that starts a sentence starts capitalised ("the Overseer, …" after a stop reads "The Overseer, …"). */
207
207
  export const sentenceStart = (text: string) => text.charAt(0).toUpperCase() + text.slice(1);
208
208
 
209
- /** Claude and Codex keep a row even when no helper uses them: they're the two most setups have. */
210
- const KNOWN_PROVIDERS = ["claude", "codex"];
209
+ /**
210
+ * The order rows and switch offers prefer among providers that are there. No provider gets a row for being on this
211
+ * list: a provider no helper uses and that isn't ready isn't shown (an-agent-on-any-provider-gets-follow-up), so a
212
+ * developer with only Pi sees Pi, never Claude and Codex as missing.
213
+ */
214
+ const PREFERRED = ["claude", "codex"];
211
215
  const nameOf = (catalog: { providers: ProviderInfo[] }, id: string) => providerName(id, catalog.providers.find(p => p.id === id)?.label);
212
216
 
213
217
  /**
214
- * One row per provider a helper uses (any provider id), plus a quiet row for each other provider that's ready and for
215
- * Claude and Codex. A provider no helper uses is optional: never a failure. A missing provider's fix offers to switch
216
- * its helpers to one that's ready, preferring Claude, then Codex, then the catalog's order.
218
+ * One row per provider a helper uses (any provider id), plus a quiet row for each other provider that's ready. A
219
+ * provider no helper uses and that isn't there gets no row. A missing provider's fix offers to switch its helpers to
220
+ * one that's ready, preferring Claude, then Codex, then the catalog's order.
217
221
  */
218
222
  export function providerChecks(catalog: { providers: ProviderInfo[]; error: string | null } | null, use: ProviderUse): Check[] {
219
223
  if (!catalog || (catalog.error && !catalog.providers.length)) return [{ id: "providers", label: "Helper agents", state: "warn", detail: catalog?.error ?? "Couldn't read Paseo's providers.", fix: fix("Check again in a moment.") }];
220
224
  const ready = catalog.providers.filter(p => p.available).map(p => p.id).sort((x, y) => rank(x) - rank(y));
221
- const ids = [...new Set([...KNOWN_PROVIDERS.filter(id => use[id]?.length || catalog.providers.some(p => p.id === id)), ...Object.keys(use).filter(id => use[id]?.length), ...ready])];
225
+ // A provider Paseo is still checking keeps its row: it may be the one the developer has.
226
+ const checking = catalog.providers.filter(p => !p.available && (p.reason === "Still loading" || unsettled(p))).map(p => p.id);
227
+ const ids = [...new Set([...ready, ...checking, ...Object.keys(use).filter(id => use[id]?.length).sort((x, y) => rank(x) - rank(y))])];
222
228
  const rows: Check[] = [];
223
229
  const pendingAny = catalog.providers.some(unsettled);
224
230
  for (const id of ids) {
@@ -236,15 +242,13 @@ export function providerChecks(catalog: { providers: ProviderInfo[]; error: stri
236
242
  if (!ready.length && !pendingAny) continue;
237
243
  if (!users.length) { rows.push({ id: `provider-${id}`, label, state: "off", detail: `${why}. Optional: no helper uses it.`, fix: null }); continue; }
238
244
  const setup = PROVIDER_FIX[id] ?? { text: `Set up ${label} on the computer running Paseo, then check again.`, command: null };
239
- // A job that runs only on Claude Code or Codex (AI priority) can't move to another provider, so it never offers to.
245
+ // A job that runs only where it can have no tools (AI priority) never moves to a provider that can't promise that.
240
246
  const guarded = users.filter(u => GUARDED_TITLES.includes(u));
241
247
  const movable = users.filter(u => !GUARDED_TITLES.includes(u));
242
248
  const other = ready.find(x => x !== id && (guarded.length && !movable.length ? guardedProvider(x) : true));
243
- // Another provider runs everything else: missing this one only costs the guarded job, an optional extra.
244
- if (!movable.length && ready.length && !ready.some(guardedProvider)) {
245
- rows.push({ id: `provider-${id}`, label, state: "off", detail: `${why}. Optional: ${joinNames(guarded)} runs only on Claude Code or Codex.`, fix: fix(setup.text, setup.command) });
246
- continue;
247
- }
249
+ // Another provider runs everything else and only a read-only job (AI priority) is left on this one: the helpers
250
+ // step already says why it can't run here and what to install, so no row names a provider the developer lacks.
251
+ if (!movable.length && ready.length && !ready.some(guardedProvider)) continue;
248
252
  const switchable = guarded.length && other && !guardedProvider(other) ? movable : users;
249
253
  rows.push({ id: `provider-${id}`, label, state: "fail", detail: `${why}. ${sentenceStart(joinNames(users))} won't run until it is.`,
250
254
  fix: other && switchable.length ? fix(`${setup.text} Or switch ${switchable.length === users.length ? "those helpers" : joinNames(switchable)} to ${nameOf(catalog, other)} in Settings → Agents.`, setup.command, "agents") : fix(setup.text, setup.command) });
@@ -256,7 +260,7 @@ export function providerChecks(catalog: { providers: ProviderInfo[]; error: stri
256
260
  return rows;
257
261
  }
258
262
  const GUARDED_TITLES = (Object.keys(ROLE_INFO) as AgentRole[]).filter(needsGuard).map(r => ROLE_INFO[r].title);
259
- const rank = (id: string) => { const i = KNOWN_PROVIDERS.indexOf(id); return i < 0 ? KNOWN_PROVIDERS.length : i; };
263
+ const rank = (id: string) => { const i = PREFERRED.indexOf(id); return i < 0 ? PREFERRED.length : i; };
260
264
 
261
265
  export type ToolsInput = {
262
266
  /** Paseo's config.json (or null when unreadable). */
@@ -1,24 +1,50 @@
1
1
  /**
2
- * What Follow-up gives an agent on each kind of provider (an-agent-on-any-provider-gets-follow-up). Paseo runs agents
3
- * on many providers (Claude Code, Codex, OpenCode, Pi, Copilot, Cursor, Kimi, Kiro, any ACP agent); Follow-up's core
4
- * works on every one, and the few parts that need Claude Code or Codex say so in one line.
2
+ * What Follow-up gives an agent on each provider (an-agent-on-any-provider-gets-follow-up): one capability model,
3
+ * read by every feature instead of its own provider check. Paseo runs agents on many providers (Claude Code, Codex,
4
+ * OpenCode, Pi, Oh My Pi, Copilot, Cursor, Kimi, Kiro, any ACP agent); every feature works on each one, and where a
5
+ * provider can't give what a feature needs, it says so in one line.
5
6
  *
6
7
  * - Tools: every provider. Paseo serves plugin tools through its agent MCP to any provider that takes MCP servers.
7
- * - Instructions: Claude Code and Codex through the SessionStart hook (or the system prompt on Paseo 0.17); every other
8
- * provider through the system prompt only (Paseo 0.17's appendSystemPrompt), which Paseo passes to OpenCode, Pi and
9
- * plugin providers but not yet to ACP agents.
10
- * - Turn-end checks (the sync, needs_you and due-task reminders), per-turn context and Wait: hooks, which exist only in
11
- * Claude Code and Codex.
12
- * - Helper jobs: any provider (server/job-agent.ts); a job that reads other people's words needs Claude or Codex
13
- * (sources-are-read-only, shared/agent-settings.ts guardedProvider).
8
+ * - Instructions: Claude Code and Codex through the hook (or the system prompt on Paseo 0.17); OpenCode, Pi and other
9
+ * non-ACP providers through the system prompt (appendSystemPrompt); ACP agents through a tool (Paseo doesn't pass a
10
+ * plugin's system prompt to them yet): `follow_session_instructions`, which every tool description points at.
11
+ * - Turn-end checks (the sync, needs_you and due-task reminders): Claude Code and Codex through the Stop hook; every
12
+ * other provider through Paseo's turn-end event (server/turn-end.ts): one message, only when something is due.
13
+ * - Wait: every provider with a shell tool. Claude Code backgrounds the command itself; any other provider runs a
14
+ * command that detaches itself (server/wait-jobs.ts).
15
+ * - Read-only jobs (a job that reads words other people wrote, sources-are-read-only): only where the provider itself
16
+ * guarantees the job has no tools. Claude Code (the job guard), Codex (read-only sandbox, no shell) and Pi
17
+ * (`--no-tools`) through their CLIs; OpenCode through a session whose every permission is denied. Nothing else
18
+ * guarantees it, so such a job never runs there.
14
19
  */
15
20
 
21
+ /** How a read-only job is guaranteed on a provider: its own CLI with no tools, or a Paseo session with every tool denied. */
22
+ export type JobGuard = "cli" | "session";
23
+ export type ProviderCaps = {
24
+ /** Follow-up's hook is installed in this provider (server/agent-hooks.ts). */
25
+ hooks: boolean;
26
+ /** How Follow-up's instructions reach a session. */
27
+ instructions: "hook" | "system-prompt" | "tool";
28
+ /** Who runs the turn-end checks. */
29
+ turnEnd: "hook" | "event";
30
+ /** How Wait's command goes to the background: the provider's own background Bash, or a command that detaches itself. */
31
+ wait: "background-bash" | "detached";
32
+ /** How a read-only job is guaranteed here; null: it can't be, so a job that reads other people's words never runs here. */
33
+ guard: JobGuard | null;
34
+ };
35
+
16
36
  /** Providers Follow-up installs its hook into (server/agent-hooks.ts: Claude Code's settings.json, Codex's hooks.json). */
17
37
  export const HOOK_PROVIDERS = ["claude", "codex"] as const;
18
- export const hasHooks = (provider: string) => (HOOK_PROVIDERS as readonly string[]).includes(provider);
19
-
20
- /** Paseo 0.17.4's ACP providers: their sessions don't take a plugin's system prompt, so they get the tools only. */
38
+ /** Providers whose own CLI runs a one-shot job with no tools at all (server/ai-jobs.ts defaultRunner). */
39
+ export const CLI_GUARD_PROVIDERS = ["claude", "codex", "pi"] as const;
40
+ /** Providers whose Paseo session takes a permission rule denying every tool (server/job-agent.ts lockedConfig). */
41
+ export const SESSION_GUARD_PROVIDERS = ["opencode"] as const;
42
+ /** Paseo 0.17.4's ACP providers: their sessions don't take a plugin's system prompt. */
21
43
  export const ACP_PROVIDERS = ["copilot", "cursor", "kimi", "kiro", "trae", "acp"] as const;
44
+
45
+ const has = (list: readonly string[], id: string) => list.includes(id);
46
+ export const hasHooks = (provider: string) => has(HOOK_PROVIDERS, provider);
47
+
22
48
  type ProviderConfig = { agents?: { providers?: Record<string, { extends?: unknown } | null | undefined> } } | null | undefined;
23
49
  /**
24
50
  * Whether Paseo runs this provider over ACP: one of its built-in ACP providers, or a provider in Paseo's config whose
@@ -29,42 +55,65 @@ export function isAcp(provider: string, config?: ProviderConfig): boolean {
29
55
  const custom = config?.agents?.providers ?? {};
30
56
  const seen = new Set<string>();
31
57
  for (let id: unknown = provider; typeof id === "string" && !seen.has(id); id = custom[id]?.extends) {
32
- if ((ACP_PROVIDERS as readonly string[]).includes(id)) return true;
58
+ if (has(ACP_PROVIDERS, id)) return true;
33
59
  seen.add(id);
34
60
  }
35
61
  return false;
36
62
  }
37
- const list = (names: string[]) => names.length <= 1 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names.at(-1)}`;
63
+
64
+ /**
65
+ * The one capability model. `acp` overrides the config lookup when the caller already knows (Settings' catalog). A
66
+ * custom provider id the developer added is guarded only when it *is* one of the guarded providers: an `extends`
67
+ * chain can point at a different command, so nothing is assumed from it.
68
+ */
69
+ export function providerCaps(provider: string, opts: { config?: ProviderConfig; acp?: boolean } = {}): ProviderCaps {
70
+ const hooks = hasHooks(provider);
71
+ const acp = opts.acp ?? isAcp(provider, opts.config);
72
+ return {
73
+ hooks,
74
+ instructions: hooks ? "hook" : acp ? "tool" : "system-prompt",
75
+ turnEnd: hooks ? "hook" : "event",
76
+ wait: provider === "claude" ? "background-bash" : "detached",
77
+ guard: has(CLI_GUARD_PROVIDERS, provider) ? "cli" : has(SESSION_GUARD_PROVIDERS, provider) ? "session" : null,
78
+ };
79
+ }
80
+ /** Whether a job that reads other people's words can run on this provider (sources-are-read-only). */
81
+ export const guardedProvider = (provider: string) => providerCaps(provider).guard !== null;
82
+
83
+ const list = (names: string[], and = "and") => names.length <= 1 ? names.join("") : `${names.slice(0, -1).join(", ")} ${and} ${names.at(-1)}`;
84
+ /** The guarded providers' names, for "Install …" when none is there. */
85
+ const GUARDED_NAMES = ["Claude Code", "Codex", "OpenCode", "Pi"];
86
+ /** The guarded providers in one phrase, for every line that says where a read-only job runs. */
87
+ export const GUARDED_PHRASE = list(GUARDED_NAMES, "or");
38
88
 
39
89
  type NoteProvider = { id: string; label: string; available: boolean; reason?: string | null; acp?: boolean };
40
90
 
41
91
  /**
42
- * What to do to get what needs Claude Code or Codex, from what Paseo has: use them when one is available, turn one on
43
- * when Paseo has it turned off, install one otherwise. Never "pick" a provider the developer can't pick.
92
+ * What to do to run a job that reads other people's words, from what Paseo has: use a guarded provider that is there,
93
+ * turn one on when Paseo has it turned off, install one otherwise. Never "pick" a provider the developer can't pick.
44
94
  */
45
95
  export function guardAction(providers: readonly NoteProvider[]): string {
46
- const guarded = providers.filter(p => hasHooks(p.id));
47
- if (guarded.some(p => p.available)) return "Use Claude Code or Codex";
48
- if (guarded.some(p => /turned off/i.test(p.reason ?? ""))) return "Turn on Claude Code or Codex in Paseo";
49
- return "Install Claude Code or Codex";
96
+ const guarded = providers.filter(p => guardedProvider(p.id));
97
+ const ready = guarded.filter(p => p.available).map(p => p.label);
98
+ if (ready.length) return `Use ${list(ready, "or")}`;
99
+ const off = guarded.filter(p => /turned off/i.test(p.reason ?? "")).map(p => p.label);
100
+ if (off.length) return `Turn on ${list(off, "or")} in Paseo's Providers settings`;
101
+ return `Install ${list(GUARDED_NAMES, "or")}`;
50
102
  }
51
103
 
52
104
  /**
53
- * Settings → Agents' one block under the helper rows, at most two short lines: what works on the developer's other
54
- * providers (and, for ACP agents, the one thing Paseo doesn't pass yet), then what needs Claude Code or Codex with the
55
- * one thing to do (guardAction). `summariesOn` is the provider Summaries runs on: off Claude and Codex it leaves out
56
- * linked items, and Compass and Ask read nothing (sources-are-read-only). Why AI priority can't run is on its row.
57
- * Empty when there's nothing to say.
105
+ * Settings → Agents' one block under the helper rows: only what a provider the developer has can't do, at most two
106
+ * short lines, one wording per rule (the rows say "reads other people's messages … read-only" too). ACP agents read
107
+ * Follow-up's instructions through a tool (Paseo doesn't pass a plugin's system prompt to them): said once, with
108
+ * nothing to do. `summariesOn` is the provider Summaries runs on: off a guarded provider it leaves out linked items, and
109
+ * Compass and Ask read nothing (sources-are-read-only). Why AI priority can't run is on its row. Empty when every
110
+ * feature works.
58
111
  */
59
112
  export function providerNotes(providers: readonly NoteProvider[], summariesOn: string | null): string[] {
60
- const others = providers.filter(p => p.available && !hasHooks(p.id));
61
- const acp = others.filter(p => p.acp ?? isAcp(p.id)).map(p => p.label);
62
- const needs = [
63
- ...(others.length ? ["turn-end reminders", "Wait for background jobs"] : []),
64
- ...(summariesOn && !hasHooks(summariesOn) ? ["Summaries' linked issues", "Compass", "Ask"] : []),
65
- ];
113
+ const acp = providers.filter(p => p.available && !hasHooks(p.id) && (p.acp ?? isAcp(p.id))).map(p => p.label);
114
+ const needs = summariesOn && !guardedProvider(summariesOn) ? ["Summaries' linked issues", "Compass", "Ask"] : [];
66
115
  return [
67
- others.length ? `Works on ${list(others.map(p => p.label))}: Follow-up's tools, PR tracking and repairs.${acp.length ? ` Paseo doesn't pass Follow-up's instructions to ${list(acp)} yet.` : ""}` : null,
68
- needs.length ? `Needs Claude Code or Codex: ${list(needs)}. ${guardAction(providers)} for ${needs.length > 1 ? "these" : "it"}.` : null,
116
+ acp.length ? `${list(acp)} ${acp.length > 1 ? "read" : "reads"} Follow-up's instructions from a tool at the start of each session. Nothing to set up.` : null,
117
+ needs.length ? `Compass, Ask and Summaries' linked issues read other people's messages, so they need Summaries on an agent Follow-up can keep read-only. ${guardAction(providers)} for Summaries; until then Compass and Ask stay off and Summaries leave out linked issues.` : null,
69
118
  ].filter((x): x is string => !!x);
70
119
  }
package/shared/queue.ts CHANGED
@@ -10,7 +10,7 @@ import { imageRefSchema, MAX_IMAGES } from "./images";
10
10
  * runs the prompt (agent-manager recordSubmittedPrompt). So a send that left without a confirmation is never resent
11
11
  * blind: the agent's chat is read for it first.
12
12
  */
13
- export const QUEUE_KINDS = ["answer", "brief", "repair", "recovery", "message", "checks"] as const;
13
+ export const QUEUE_KINDS = ["answer", "brief", "repair", "recovery", "message", "checks", "scheduled"] as const;
14
14
  export type QueueKind = typeof QUEUE_KINDS[number];
15
15
 
16
16
  /**
@@ -65,7 +65,7 @@ const lowEffort = (m: CatalogModel) => m.thinking.find(t => /^(minimal|low)$/i.t
65
65
  export function recommend(role: AgentRole, catalog: readonly CatalogProvider[]): Recommendation {
66
66
  const tier = ROLE_TIER[role];
67
67
  if (tier === "same") return { role, same: true, provider: ROLE_DEFAULTS[role].provider, model: null, thinking: null, source: "same", hint: null };
68
- // Never recommend a provider a job can't run on: AI priority only on Claude or Codex (sources-are-read-only).
68
+ // Never recommend a provider a job can't run on: AI priority only where a job can have no tools (sources-are-read-only).
69
69
  const providers = order(catalog).filter(p => !needsGuard(role) || guardedProvider(p.id));
70
70
  if (!providers.length) return { role, same: false, provider: null, model: null, thinking: null, source: "none", hint: null };
71
71
  if (providers[0].id === "claude") { const d = ROLE_DEFAULTS[role]; return { role, same: false, provider: d.provider, model: d.model, thinking: d.thinking, source: "default", hint: null }; }
@@ -1,5 +1,6 @@
1
1
  import { reviewerLabel, type ReviewerConfig, type ReviewerEntry } from "./reviewers";
2
2
  import { NEW_OF, NEW_WORK } from "./new-name";
3
+ import { SETUP_CLOSED_KEY } from "./setup-popup";
3
4
 
4
5
  /**
5
6
  * The settings screen's categories, summaries and saved view state. Pure, so grouping, summaries and persistence are
@@ -97,7 +98,8 @@ export const homeGroupOpen = (group: string, store: KeyValue = deviceStorage): b
97
98
  };
98
99
  export const writeHomeGroupOpen = (group: string, open: boolean, store: KeyValue = deviceStorage) => { if (group !== "needs") store.set(homeFoldKey(group), open ? "1" : "0"); };
99
100
  /** Every key that is view state: what a device copies into its document the first time (never home_sort). */
100
- export const isViewKey = (key: string) => key === CATEGORY_KEY || key.startsWith("follow-up.settings.fold.") || (key.startsWith("follow-up.home.fold.") && key !== homeFoldKey("needs")) || key === "follow-up.whats-new.seen";
101
+ // Setup's Close (shared/setup-popup.ts) is this device's: a put-away popup stays away after a reload.
102
+ export const isViewKey = (key: string) => key === CATEGORY_KEY || key.startsWith("follow-up.settings.fold.") || (key.startsWith("follow-up.home.fold.") && key !== homeFoldKey("needs")) || key === "follow-up.whats-new.seen" || key === SETUP_CLOSED_KEY;
101
103
 
102
104
  const names = (list: readonly ReviewerEntry[], max = 3) => list.length <= max ? list.map(reviewerLabel).join(", ") : `${list.slice(0, max).map(reviewerLabel).join(", ")} +${list.length - max}`;
103
105
  /** Anything saved: then Reviewers starts collapsed, since it's set up. */
@@ -0,0 +1,28 @@
1
+ import type { OnboardingStep, OnboardingView } from "./onboarding";
2
+
3
+ /**
4
+ * Setup's popup (setup-is-one-popup, client/setup-gate.tsx): when it opens, when Close has put it away, and Home's
5
+ * "Finish setup" line. Pure: the server's onboarding view says whether setup is under way; `closed` is this device's
6
+ * Close (SETUP_CLOSED_KEY in the device's view state); `done` holds the done page after Finish, when the server
7
+ * already says setup is over. Close never reaches the server: setup stays on its step, and agents' setup tools see the
8
+ * same state as before.
9
+ */
10
+
11
+ /** The device key Close sets. Finish setup clears it, and so does setup ending (finished or skipped). */
12
+ export const SETUP_CLOSED_KEY = "follow-up.setup.closed";
13
+
14
+ export type SetupPopup = "open" | "closed" | "none";
15
+
16
+ export function setupPopup({ view, closed, done }: { view: OnboardingView | undefined; closed: boolean; done: boolean }): SetupPopup {
17
+ if (done) return "open";
18
+ if (!view?.show) return "none";
19
+ return closed ? "closed" : "open";
20
+ }
21
+
22
+ /** Home's one line while the popup is put away: it opens setup again on the step it was left on. */
23
+ export function finishSetupLine(view: OnboardingView | undefined, closed: boolean): { label: "Finish setup"; step: OnboardingStep } | null {
24
+ return setupPopup({ view, closed, done: false }) === "closed" ? { label: "Finish setup", step: view!.step } : null;
25
+ }
26
+
27
+ /** One popup per app session: the first Follow-up surface to want it draws it; the rest draw nothing. */
28
+ export const setupOwner = (owner: string | null, surface: string): string => owner ?? surface;