paseo-follow-up 2.4.0-beta.9 → 2.4.0

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 (97) hide show
  1. package/CHANGELOG.md +159 -0
  2. package/OVERVIEW.md +1 -1
  3. package/README.md +81 -22
  4. package/client/agents.tsx +8 -26
  5. package/client/brief-since.tsx +4 -3
  6. package/client/compass-settings.tsx +156 -87
  7. package/client/display.tsx +2 -1
  8. package/client/header.tsx +2 -2
  9. package/client/home-chrome.tsx +24 -13
  10. package/client/home-data.ts +1 -1
  11. package/client/home-list.tsx +2 -1
  12. package/client/home-view.ts +7 -9
  13. package/client/home.tsx +9 -4
  14. package/client/job-rows.tsx +56 -7
  15. package/client/list-keys.ts +2 -1
  16. package/client/morning-brief-settings.tsx +11 -1
  17. package/client/new-entry.tsx +42 -2
  18. package/client/new-settings.tsx +29 -13
  19. package/client/new.tsx +89 -43
  20. package/client/onboarding.tsx +75 -29
  21. package/client/release-notes.tsx +11 -7
  22. package/client/reviewers.tsx +1 -1
  23. package/client/row-badges.tsx +37 -0
  24. package/client/search-focus.ts +85 -0
  25. package/client/search-key.ts +6 -12
  26. package/client/stacks.tsx +9 -2
  27. package/docs/screenshots/follow-up-slide-1-cover.png +0 -0
  28. package/docs/screenshots/follow-up-slide-2-decision.png +0 -0
  29. package/docs/screenshots/follow-up-slide-3-overseer.png +0 -0
  30. package/docs/screenshots/follow-up-slide-4-repairs.png +0 -0
  31. package/docs/screenshots/follow-up-slide-5-deploy.png +0 -0
  32. package/docs/screenshots/follow-up-slide-6-catch-up.png +0 -0
  33. package/index.client.tsx +12 -6
  34. package/index.server.ts +89 -25
  35. package/package.json +4 -3
  36. package/paseo-plugin.json +7 -9
  37. package/server/about.ts +4 -1
  38. package/server/agent-hook.mjs +12 -4
  39. package/server/agent-settings.ts +19 -3
  40. package/server/brief-sources.ts +4 -2
  41. package/server/compass.ts +310 -41
  42. package/server/daemon.ts +11 -3
  43. package/server/dispatch.ts +3 -2
  44. package/server/engine.ts +19 -6
  45. package/server/github-api.ts +17 -6
  46. package/server/github-setup.ts +126 -0
  47. package/server/github.ts +28 -0
  48. package/server/hook-source.ts +12 -4
  49. package/server/host-features.ts +21 -1
  50. package/server/linear-issues.ts +4 -3
  51. package/server/linear-queue.ts +3 -0
  52. package/server/mcp-source.ts +5 -3
  53. package/server/mcp.mjs +5 -3
  54. package/server/memory.ts +47 -19
  55. package/server/onboarding.ts +3 -2
  56. package/server/pr-actions.ts +12 -1
  57. package/server/pr-stats-sync.ts +4 -2
  58. package/server/pr-stats.ts +4 -0
  59. package/server/ranker.ts +4 -2
  60. package/server/reviewer-config.ts +3 -1
  61. package/server/session-mcp.ts +3 -2
  62. package/server/session-prompt.ts +34 -8
  63. package/server/wait-for-checks.ts +9 -0
  64. package/shared/agent-settings.ts +17 -9
  65. package/shared/attention.ts +4 -0
  66. package/shared/brief-sources.ts +23 -8
  67. package/shared/changelog.ts +32 -8
  68. package/shared/compass.ts +155 -25
  69. package/shared/contracts.ts +2 -2
  70. package/shared/dispatch.ts +61 -6
  71. package/shared/display.ts +4 -1
  72. package/shared/github-setup.ts +46 -0
  73. package/shared/job-rows.ts +40 -6
  74. package/shared/list-entries.ts +3 -2
  75. package/shared/model.ts +6 -0
  76. package/shared/new-name.ts +27 -0
  77. package/shared/new-view.ts +11 -8
  78. package/shared/onboarding.ts +77 -15
  79. package/shared/provider-support.ts +70 -0
  80. package/shared/recommend.ts +3 -2
  81. package/shared/row-badges.ts +24 -0
  82. package/shared/search-focus.ts +76 -0
  83. package/shared/search-key.ts +3 -2
  84. package/shared/settings-nav.ts +2 -1
  85. package/docs/screenshots/follow-up-home.png +0 -0
  86. package/docs/screenshots/follow-up-linked-items.png +0 -0
  87. package/docs/screenshots/follow-up-notes-home.png +0 -0
  88. package/docs/screenshots/follow-up-notes-panel.png +0 -0
  89. package/docs/screenshots/follow-up-panel.png +0 -0
  90. package/docs/screenshots/follow-up-phone.png +0 -0
  91. package/docs/screenshots/follow-up-pill.png +0 -0
  92. package/docs/screenshots/follow-up-pr-sheet.png +0 -0
  93. package/docs/screenshots/follow-up-questions.png +0 -0
  94. package/docs/screenshots/follow-up-send-to-paseo-dark.png +0 -0
  95. package/docs/screenshots/follow-up-send-to-paseo-light.png +0 -0
  96. package/docs/screenshots/follow-up-setup.png +0 -0
  97. package/docs/screenshots/follow-up-sidebar.png +0 -0
package/server/engine.ts CHANGED
@@ -60,6 +60,11 @@ export interface Gateway {
60
60
  /** Whether a batch's message is in its recipient's chat (by messageId). Null: unknown, e.g. reading it would wake the agent. */
61
61
  arrived?(w: Workspace, batch: Batch): Promise<boolean | null>;
62
62
  label(w: Workspace, assigned: boolean): Promise<void>;
63
+ /**
64
+ * Paseo 0.17.1+ draws Follow-up's Done as a sidebar row badge (client/row-badges.tsx), so the worker writes no
65
+ * Done label there and takes back one it wrote before (row-badges-replace-sidebar-labels). Absent or false: the label.
66
+ */
67
+ rowBadges?(): Promise<boolean>;
63
68
  /** A tick begins: the gateway may list agents once for it (a-send-lists-agents-at-most-once-per-tick). */
64
69
  tickStarted?(): void;
65
70
  }
@@ -132,7 +137,7 @@ export class Engine {
132
137
  statusCheck: (w: Workspace, now: number, inputs?: string) => Promise<void> = async () => {};
133
138
  /** Background refreshes skipped while paused, for tests and the resource check. */
134
139
  skipped = 0;
135
- constructor(readonly store: Store, private github: Pick<Github, "observe"> & Partial<Pick<Github, "waitUntil">>, private gateway: Gateway, private now = Date.now, private settleMs = 60_000, private nudgeMs = NUDGE_MS) {}
140
+ constructor(readonly store: Store, private github: Pick<Github, "observe"> & Partial<Pick<Github, "waitUntil" | "off">>, private gateway: Gateway, private now = Date.now, private settleMs = 60_000, private nudgeMs = NUDGE_MS) {}
136
141
  async recover(): Promise<void> {
137
142
  await this.store.mutate(state => {
138
143
  for (const w of state.workspaces) {
@@ -199,6 +204,8 @@ export class Engine {
199
204
  }
200
205
  /** Reads one workspace's PRs fresh and records what came back, nothing else (a Refresh of a dormant workspace). */
201
206
  private async refreshPrs(w: Workspace): Promise<void> {
207
+ // GitHub off (works-without-github) is one fact for the host; observe reads nothing then.
208
+ const off = (await this.github.off?.().catch(() => null)) ?? null;
202
209
  const observations = await this.github.observe(w.prs, { background: true, fresh: new Set(w.prs.map(p => p.key)) });
203
210
  await this.store.mutateWorkspace(w.id, current => {
204
211
  for (const p of current.prs) {
@@ -270,6 +277,8 @@ export class Engine {
270
277
  const keys = (ws: Workspace[]) => new Set(ws.flatMap(w => w.prs.map(p => p.key)));
271
278
  const hot = keys(active.filter(isHot));
272
279
  const read = o.affected ? active.filter(w => o.affected!.has(w.id)) : active;
280
+ // GitHub off (works-without-github) is one fact for the host; observe reads nothing then.
281
+ const off = (await this.github.off?.().catch(() => null)) ?? null;
273
282
  const observations = await this.github.observe(read.flatMap(w => w.prs), o.background || o.workspaceId ? { background: true, hot, fresh: keys(active.filter(w => w.id === o.workspaceId)), watched: this.checkWatches?.watched() } : {});
274
283
  // A nudge observes only its workspaces (a-nudge-costs-its-workspace); the timer's tick observes every active one.
275
284
  for (const original of o.affected ? read : active) {
@@ -281,9 +290,10 @@ export class Engine {
281
290
  // rules, like the 120 s acknowledgement, run on that pass). The checks cost a ~200-byte JSON and a shallow compare per PR.
282
291
  const runtimeKey = JSON.stringify(runtime);
283
292
  const githubWait = this.githubWait(original);
293
+ const githubOff = original.prs.length ? off : null;
284
294
  const last = this.observedPass.get(original.id);
285
295
  // A scheduled task due since the last pass makes it a full pass, so a trigger fires at its time, not up to a minute late.
286
- const untouched = (original.githubWait?.until ?? null) === githubWait && !!last && last.w === original && last.runtime === runtimeKey && this.now() - last.at < OBSERVE_FULL_MS && this.now() < last.dueAt && o.workspaceId !== original.id &&
296
+ const untouched = (original.githubWait?.until ?? null) === githubWait && (original.githubOff ?? null) === githubOff && !!last && last.w === original && last.runtime === runtimeKey && this.now() - last.at < OBSERVE_FULL_MS && this.now() < last.dueAt && o.workspaceId !== original.id &&
287
297
  original.prs.every(p => { const seen = observations.get(p.key); return !seen || seen.error === p.error && sameSnapshot(seen.snapshot, p.snapshot, !isHot(original) && !awaitsRead(original)); });
288
298
  if (!untouched) this.observationWrites++;
289
299
  if (!untouched) await this.store.mutateWorkspace(original.id, w => {
@@ -291,6 +301,7 @@ export class Engine {
291
301
  w.backgroundBusy = runtime.backgroundBusy ?? false;
292
302
  w.mainBusy = repairWait(runtime);
293
303
  if ((w.githubWait?.until ?? null) !== githubWait) w.githubWait = githubWait ? { until: githubWait } : null;
304
+ if ((w.githubOff ?? null) !== githubOff) w.githubOff = githubOff;
294
305
  if (runtime.mainTitle !== undefined && (w.mainAgentTitle ?? null) !== runtime.mainTitle) w.mainAgentTitle = runtime.mainTitle;
295
306
  if (runtime.gone && w.goneAgent?.agentId !== w.mainAgentId) w.goneAgent = { agentId: w.mainAgentId, at: new Date(this.now()).toISOString(), reason: runtime.gone };
296
307
  if (w.goneAgent?.agentId === w.mainAgentId) w.runtimeReason = GONE_REASON;
@@ -384,10 +395,12 @@ export class Engine {
384
395
  if (due && !repairWait(runtime) && !runtime.reason) await this.queue!.retry(heldItem!.id).catch(() => undefined);
385
396
  current = findWorkspace(await this.store.snapshot(), original.id);
386
397
  const done = !current.archived && !!current.completion && completionBlockers(current, this.now()).length === 0;
387
- if (done || current.managedDoneLabel) {
388
- if (done && !current.managedDoneLabel) await this.store.mutateWorkspace(current.id, w => { w.managedDoneLabel = true; });
389
- await this.gateway.label(current, done);
390
- if (!done) await this.store.mutateWorkspace(current.id, w => { w.managedDoneLabel = false; });
398
+ // On a host with row badges the client's Done badge says it; a label we wrote before comes off once.
399
+ const labelled = done && !(await this.gateway.rowBadges?.().catch(() => false));
400
+ if (labelled || current.managedDoneLabel) {
401
+ if (labelled && !current.managedDoneLabel) await this.store.mutateWorkspace(current.id, w => { w.managedDoneLabel = true; });
402
+ await this.gateway.label(current, labelled);
403
+ if (!labelled) await this.store.mutateWorkspace(current.id, w => { w.managedDoneLabel = false; });
391
404
  }
392
405
  const after = findWorkspace(await this.store.snapshot(), original.id);
393
406
  this.observedPass.set(original.id, { w: after, runtime: runtimeKey, at: untouched ? last!.at : this.now(), dueAt: nextDue(after, this.now()) });
@@ -4,6 +4,8 @@ import { readFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { join } from "node:path";
6
6
  import { promisify } from "node:util";
7
+ import { GithubOffError } from "../shared/github-setup";
8
+ import { githubSetup, type GithubSetup } from "./github-setup";
7
9
 
8
10
  const exec = promisify(execFile);
9
11
  type Node = Record<string, any>;
@@ -118,7 +120,7 @@ export const PER_TOKEN_CONCURRENCY = 4;
118
120
  /** GitHub's GraphQL answer when the account's budget is spent: HTTP 200 with this error type (2026-11-12 live). */
119
121
  const LIMIT_TYPES = new Set(["RATE_LIMIT", "RATE_LIMITED"]);
120
122
  const limitError = (resetAt: number, status: number) => Object.assign(new Error("GitHub API rate limit exceeded"), { status, rateLimited: true, resetAt });
121
- export function httpApi(o: { tokens?: TokenSource; accountToken?: (account: string | null) => Promise<string>; status?: () => Promise<string>; request?: typeof fetch; base?: string; timeoutMs?: number; now?: () => number; log?: (line: string) => void } = {}): GithubApi & AccountReads & RestSend {
123
+ export function httpApi(o: { setup?: Pick<GithubSetup, "current" | "invalidate"> | null; tokens?: TokenSource; accountToken?: (account: string | null) => Promise<string>; status?: () => Promise<string>; request?: typeof fetch; base?: string; timeoutMs?: number; now?: () => number; log?: (line: string) => void } = {}): GithubApi & AccountReads & RestSend {
122
124
  const tokens = o.tokens ?? ghTokens();
123
125
  const accountToken = o.accountToken ?? ghAccountToken();
124
126
  const request = o.request ?? fetch;
@@ -126,9 +128,17 @@ export function httpApi(o: { tokens?: TokenSource; accountToken?: (account: stri
126
128
  const base = (o.base ?? process.env.FOLLOW_UP_GITHUB_API ?? "https://api.github.com").replace(/\/$/, "");
127
129
  const cache = new Map<string, Promise<string>>();
128
130
  // Owners are keyed by name, accounts by "@login" (null: gh's active account).
129
- const token = (key: string) => {
131
+ // GitHub is optional (works-without-github): while the host has no gh or no sign-in, every call answers
132
+ // GithubOffError at once, with nothing spawned, retried or logged. A lookup that fails while GitHub reads as on asks
133
+ // the setup to check again, so a sign-out is noticed once, not on every read.
134
+ const setup = o.setup === undefined ? null : o.setup;
135
+ const token = async (key: string): Promise<string> => {
136
+ if (setup) { const state = await setup.current(); if (!state.on) throw new GithubOffError(state.off); }
130
137
  let value = cache.get(key);
131
- if (!value) { value = key.startsWith("@") ? accountToken(key.slice(1) || null) : tokens(key); cache.set(key, value); void value.catch(() => cache.delete(key)); }
138
+ if (!value) {
139
+ value = key.startsWith("@") ? accountToken(key.slice(1) || null) : tokens(key); cache.set(key, value);
140
+ void value.catch(error => { cache.delete(key); if (error instanceof GithubAuthError) setup?.invalidate(); });
141
+ }
132
142
  return value;
133
143
  };
134
144
  const status = o.status ?? (async () => { const { env, bin } = realGh(process.env); return new Promise<string>(resolve => execFile(bin, ["auth", "status", "--hostname", "github.com"], { env, timeout: 15_000 }, (_e, stdout, stderr) => resolve(`${stdout ?? ""}${stderr ?? ""}`))); });
@@ -158,7 +168,7 @@ export function httpApi(o: { tokens?: TokenSource; accountToken?: (account: stri
158
168
  const text = await response.text();
159
169
  if (text.length > LIMIT) throw new Error("GitHub response exceeds the read limit");
160
170
  if (raw) { let data: unknown = null; try { data = text ? JSON.parse(text) : null; } catch { data = text; } return { status: response.status, data }; }
161
- if (response.status === 401) throw new GithubAuthError("GitHub refused the token (HTTP 401)");
171
+ if (response.status === 401) { setup?.invalidate(); throw new GithubAuthError("GitHub refused the token (HTTP 401)"); }
162
172
  const reset = () => Number(response.headers?.get("x-ratelimit-reset")) * 1000 || now() + Number(response.headers?.get("retry-after") || 60) * 1000;
163
173
  if ((response.status === 403 || response.status === 429) && (response.headers?.get("x-ratelimit-remaining") === "0" || response.headers?.get("retry-after"))) {
164
174
  const at = reset(); resting.set(secret, at); throw limitError(at, response.status);
@@ -178,7 +188,8 @@ export function httpApi(o: { tokens?: TokenSource; accountToken?: (account: stri
178
188
  return {
179
189
  graphql: async (repo, query, variables) => call(ownerOf(repo), repo, `${base}/graphql`, { method: "POST", body: JSON.stringify({ query, variables }) }) as Promise<Node>,
180
190
  rest: (repo, path) => call(ownerOf(repo), repo, `${base}/${path.replace(/^\//, "")}`, { method: "GET" }),
181
- accounts: () => {
191
+ accounts: async () => {
192
+ if (setup) { const state = await setup.current(); if (!state.on) throw new GithubOffError(state.off); }
182
193
  if (!accounts || accounts.until <= now()) { const value = status().then(ghAccounts); accounts = { until: now() + 3_600_000, value }; void value.catch(() => { accounts = null; }); }
183
194
  return accounts.value;
184
195
  },
@@ -189,4 +200,4 @@ export function httpApi(o: { tokens?: TokenSource; accountToken?: (account: stri
189
200
 
190
201
  let shared: (GithubApi & AccountReads & RestSend) | null = null;
191
202
  /** The worker's one client: every read path shares its per-owner and per-account token cache. */
192
- export function githubApi(): GithubApi & AccountReads & RestSend { return shared ??= httpApi(); }
203
+ export function githubApi(): GithubApi & AccountReads & RestSend { return shared ??= httpApi({ setup: githubSetup() }); }
@@ -0,0 +1,126 @@
1
+ import { execFile } from "node:child_process";
2
+ import { readFileSync, statSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { delimiter, join } from "node:path";
5
+ import type { GithubOff } from "../shared/github-setup";
6
+
7
+ /**
8
+ * Whether GitHub is on for this host (invariant 110, `works-without-github`): the GitHub CLI installed, or an explicit
9
+ * GH_TOKEN/GITHUB_TOKEN, and a token it can hand out. Every GitHub read (`githubApi`), write and agent tool asks here
10
+ * first, so while GitHub is off nothing spawns gh, retries or logs on a timer.
11
+ *
12
+ * Cheap to ask: the answer is cached, and while GitHub is off it is checked again only when the host changed in a way
13
+ * that could turn it on (a `gh` appeared on PATH, gh's hosts.yml was written by `gh auth login`, a token env var
14
+ * appeared), looked at with a few stat calls at most every `LOOK_MS`. A token gh refuses later (`invalidate`) checks
15
+ * once more. So installing gh and signing in is picked up without a restart.
16
+ */
17
+ export const LOOK_MS = 30_000;
18
+
19
+ export type SetupState = { on: true; explicit: boolean } | { on: false; off: GithubOff };
20
+ type Run = (bin: string, args: string[], env: NodeJS.ProcessEnv) => Promise<string>;
21
+ type Deps = { env?: NodeJS.ProcessEnv; now?: () => number; run?: Run; stat?: (path: string) => { mtimeMs: number; size: number; isFile: boolean } | null; read?: (path: string) => string };
22
+
23
+ const defaultStat = (path: string) => { try { const s = statSync(path); return { mtimeMs: s.mtimeMs, size: s.size, isFile: s.isFile() }; } catch { return null; } };
24
+ const defaultRead = (path: string) => { try { return readFileSync(path, "utf8"); } catch { return ""; } };
25
+ const defaultRun: Run = (bin, args, env) => new Promise((resolve, reject) => execFile(bin, args, { env, timeout: 15_000 }, (error, stdout) => error ? reject(error) : resolve(stdout)));
26
+
27
+ const hung = (error: unknown) => { const e = error as { killed?: boolean; signal?: string | null; code?: unknown } | null; return !!e && (e.killed === true || !!e.signal || e.code === "ETIMEDOUT"); };
28
+
29
+ export class GithubSetup {
30
+ private state: SetupState | null = null;
31
+ private checking: Promise<SetupState> | null = null;
32
+ private print = "";
33
+ private lookedAt = -Infinity;
34
+ private listeners = new Set<(state: SetupState) => void>();
35
+ constructor(private deps: Deps = {}) {}
36
+ private get env() { return this.deps.env ?? process.env; }
37
+ private get now() { return (this.deps.now ?? Date.now)(); }
38
+ private stat(path: string) { return (this.deps.stat ?? defaultStat)(path); }
39
+
40
+ /** The gh binary token lookups run (never the ~/.local/bin wrapper): FOLLOW_UP_GH_BIN, /usr/bin/gh, else gh on PATH. Null when there is none. */
41
+ binary(): string | null {
42
+ const env = this.env;
43
+ if (env.FOLLOW_UP_GH_BIN) return this.stat(env.FOLLOW_UP_GH_BIN)?.isFile ? env.FOLLOW_UP_GH_BIN : null;
44
+ if (this.stat("/usr/bin/gh")?.isFile) return "/usr/bin/gh";
45
+ for (const dir of (env.PATH ?? "").split(delimiter)) if (dir && this.stat(join(dir, "gh"))?.isFile) return join(dir, "gh");
46
+ return null;
47
+ }
48
+ private mapPath() { const env = this.env; return env.GH_ACCOUNT_MAP || join(env.HOME || homedir(), ".config/gh/account-map"); }
49
+ /** The accounts the account map names (owner account per line, `*` for the rest), in order, once each. */
50
+ private mapAccounts(): string[] {
51
+ const raw = (this.deps.read ?? defaultRead)(this.mapPath());
52
+ const accounts = raw.split("\n").map(line => line.trim().split(/\s+/)).filter(([o, a]) => o && !o.startsWith("#") && a).map(([, a]) => a!);
53
+ return [...new Set(accounts)].slice(0, 8);
54
+ }
55
+ private explicit() { return !!(this.env.GH_TOKEN || this.env.GITHUB_TOKEN); }
56
+ /** What could turn GitHub on: the binary, gh's hosts.yml (written by gh auth login) and a token env var. */
57
+ private fingerprint(): string {
58
+ const env = this.env;
59
+ const config = env.GH_CONFIG_DIR || join(env.XDG_CONFIG_HOME || join(env.HOME || homedir(), ".config"), "gh");
60
+ const hosts = this.stat(join(config, "hosts.yml"));
61
+ const map = this.stat(this.mapPath());
62
+ return JSON.stringify([this.binary(), this.explicit(), hosts ? [hosts.mtimeMs, hosts.size] : null, map ? [map.mtimeMs, map.size] : null]);
63
+ }
64
+ private async probe(): Promise<SetupState> {
65
+ if (this.explicit()) return { on: true, explicit: true };
66
+ const bin = this.binary();
67
+ if (!bin) return { on: false, off: "missing" };
68
+ const { GH_TOKEN: _a, GITHUB_TOKEN: _b, ...env } = this.env;
69
+ const runEnv = { ...env, DBUS_SESSION_BUS_ADDRESS: env.DBUS_SESSION_BUS_ADDRESS || "unix:path=/nonexistent/gh-no-session-bus" };
70
+ // Signed in means a token the reads can use, found the way they find one (ghTokens): gh's active account, else an
71
+ // account the account map names (`gh auth token --user`), so a host with accounts but no active one is on.
72
+ for (const account of [null, ...this.mapAccounts()]) {
73
+ const answer = await (this.deps.run ?? defaultRun)(bin, ["auth", "token", ...(account ? ["--user", account] : [])], runEnv)
74
+ .then(s => ({ token: s.trim() }), (error: unknown) => ({ error }));
75
+ if ("token" in answer && answer.token) return { on: true, explicit: false };
76
+ // A gh that never answered (timed out, killed) said nothing about signing in: unknown is not off (invariant 7),
77
+ // so GitHub stays on and its reads answer as they would; only a gh that ran and refused counts as signed out.
78
+ if ("error" in answer && hung(answer.error)) return { on: true, explicit: false };
79
+ }
80
+ return { on: false, off: "signed-out" };
81
+ }
82
+ private set(next: SetupState) {
83
+ const changed = JSON.stringify(next) !== JSON.stringify(this.state);
84
+ this.state = next;
85
+ if (changed) for (const listener of this.listeners) { try { listener(next); } catch { /* a listener's own problem */ } }
86
+ }
87
+ /** Checks again now (setup's Check again, a token GitHub refused). */
88
+ check(): Promise<SetupState> {
89
+ this.checking ??= (async () => {
90
+ this.print = this.fingerprint(); this.lookedAt = this.now;
91
+ const next = await this.probe();
92
+ this.set(next);
93
+ return next;
94
+ })().finally(() => { this.checking = null; });
95
+ return this.checking;
96
+ }
97
+ /**
98
+ * The current answer, checked once on first use. While off, a look (stats only) at most every LOOK_MS; a changed
99
+ * fingerprint checks again. Never spawns while nothing changed.
100
+ */
101
+ async current(): Promise<SetupState> {
102
+ if (this.checking) return this.checking;
103
+ if (!this.state) return this.check();
104
+ if (!this.state.on && this.now - this.lookedAt >= LOOK_MS) {
105
+ this.lookedAt = this.now;
106
+ if (this.fingerprint() !== this.print) return this.check();
107
+ }
108
+ return this.state;
109
+ }
110
+ /** Why GitHub is off as last known, without waiting (null: on, or not checked yet; unknown is not off). */
111
+ off(): GithubOff | null { return this.state && !this.state.on ? this.state.off : null; }
112
+ /** Whether a write can run: on, and a gh binary to run it. Null when it can, else why not. */
113
+ async writeOff(): Promise<GithubOff | null> {
114
+ const state = await this.current();
115
+ if (!state.on) return state.off;
116
+ return this.binary() ? null : "missing";
117
+ }
118
+ /** A read found the token refused or gone: check again (once; a check in flight is shared). */
119
+ invalidate(): void { if (this.state?.on && !this.state.explicit) void this.check(); }
120
+ /** Called when the answer changes (the engine re-reads PRs at once when GitHub comes on). */
121
+ onChange(listener: (state: SetupState) => void): () => void { this.listeners.add(listener); return () => this.listeners.delete(listener); }
122
+ }
123
+
124
+ let shared: GithubSetup | null = null;
125
+ /** The worker's one answer, shared by every GitHub path. */
126
+ export function githubSetup(): GithubSetup { return shared ??= new GithubSetup(); }
package/server/github.ts CHANGED
@@ -7,6 +7,8 @@ import type { Deployments } from "./deployments";
7
7
  import { notSetUpEvidence } from "../shared/task-trigger";
8
8
  import { budgetTier, cadence, dueForRead, probeVerdict, SAFETY_READ_MS, type Budget, type Fingerprint } from "../shared/poll";
9
9
  import { cliApi, githubApi, type GithubApi } from "./github-api";
10
+ import { githubSetup, type GithubSetup } from "./github-setup";
11
+ import { githubOffText, type GithubOff } from "../shared/github-setup";
10
12
  import { splitReviewers, TEAM_SLUG, USER_LOGIN } from "../shared/reviewers";
11
13
  const exec = promisify(execFile);
12
14
  type Node = Record<string, any>;
@@ -182,7 +184,26 @@ export class Github {
182
184
  constructor(run?: (args: string[], repo: string) => Promise<string>, private graphite?: Pick<Graphite, "observe" | "status">, private deployments?: Pick<Deployments, "observe">, api?: GithubApi, private now = Date.now) {
183
185
  this.run = run ?? (async (args, repo) => (await exec("gh", args, { env: ghEnvironment(repo), timeout: 25_000, maxBuffer: 4 * 1024 * 1024 })).stdout);
184
186
  this.api = api ?? (run ? cliApi(run) : githubApi());
187
+ this.setup = api || run ? null : githubSetup();
185
188
  }
189
+ /** Whether GitHub is on for the host (works-without-github); null in tests that inject their own GitHub. */
190
+ setup: (Pick<GithubSetup, "current" | "writeOff"> & Partial<Pick<GithubSetup, "off" | "binary">>) | null;
191
+ /** Why GitHub is off right now, or null: what every PR surface and agent tool says instead of reading. */
192
+ async off(): Promise<GithubOff | null> { if (!this.setup) return null; const state = await this.setup.current(); return state.on ? null : state.off; }
193
+ /**
194
+ * Why GitHub is off as last known, without waiting: what a GitHub action's gate answers from, so an RPC never waits
195
+ * on a gh check before it replies (an-ack-never-waits-on-the-disk). Unknown is not off (invariant 7): it starts the
196
+ * check and goes on, and the read or write itself answers if GitHub turns out to be off.
197
+ */
198
+ offNow(): GithubOff | null {
199
+ const off = this.setup?.off?.() ?? null;
200
+ if (this.setup && off === null) void this.setup.current().catch(() => undefined);
201
+ return off;
202
+ }
203
+ /** offNow for a write, which also needs a gh binary to run (a stat, no spawn). */
204
+ writeOffNow(): GithubOff | null { return this.offNow() ?? (this.setup?.binary && !this.setup.binary() ? "missing" : null); }
205
+ /** Why a write can't run (no GitHub, or no gh to run it), or null. */
206
+ async writeOff(): Promise<GithubOff | null> { return this.setup ? this.setup.writeOff() : null; }
186
207
  async requestReviewers(pr: Pr, reviewers: string[]): Promise<void> {
187
208
  if (!reviewers.length || reviewers.some(login => !USER_LOGIN.test(login) && !TEAM_SLUG.test(login))) throw new Error("No eligible reviewers selected.");
188
209
  // People go in reviewers[], teams (org/slug) in team_reviewers[] by slug; GitHub resolves the slug in the repository's org.
@@ -270,6 +291,13 @@ export class Github {
270
291
  */
271
292
  async observe(prs: Pr[], o: { background?: boolean; fresh?: Set<string>; hot?: Set<string>; watched?: ReadonlyMap<string, number> } = {}): Promise<Map<string, Observation>> {
272
293
  const result = new Map<string, Observation>();
294
+ // GitHub off (works-without-github): nothing is read. A PR keeps what is known; the workspace says why in one line.
295
+ const off = await this.off();
296
+ if (off) {
297
+ const why = githubOffText(off, "PR status");
298
+ for (const p of prs) { const known = this.standIn(p, p.repo.split("/")[0], why); result.set(p.key, known.snapshot ? { ...known, error: why } : known); }
299
+ return result;
300
+ }
273
301
  const repositories = [...new Set(prs.map(p => p.repo))];
274
302
  const modes = new Map<string, PrWorkflow>();
275
303
  for (const repo of repositories) modes.set(repo, this.workflow ? await this.workflow(repo).catch((): PrWorkflow => "github") : "graphite");
@@ -192,9 +192,17 @@ export const hookSource: string = [
192
192
  "// Linked items (shared/linked.ts): what the work is about, registered on purpose rather than guessed from mentions.",
193
193
  "const linkInstruction = \"When you start from a Linear issue, Slack thread or doc, or open a new one for this work, call link_item with its URL. Don't link things you only mention. A PR isn't a link: register it.\";",
194
194
  "function instructions(lease, contributor = false, workflow) {",
195
- " return named(paragraphs(lease, contributor, workflow).filter(p => !(native && /^Prefer (?:the )?native/i.test(p))).join(\"\\n\\n\"));",
195
+ " return workspaceInstructions({ contributor, workflow, clientEntry: lease.clientEntry });",
196
196
  "}",
197
- "function paragraphs(lease, contributor, workflow) {",
197
+ "/**",
198
+ " * The tracked workspace's instructions. The hook adds them at SessionStart; for a provider Follow-up has no hook in",
199
+ " * (anything but Claude Code and Codex) the worker puts the same text in the session's system prompt",
200
+ " * (server/session-prompt.ts), importing this file with globalThis.followUpHookLibrary set so main() doesn't run.",
201
+ " */",
202
+ "export function workspaceInstructions({ contributor = false, workflow, native: isNative = native, clientEntry, dir = directory }) {",
203
+ " return named(paragraphs({ clientEntry }, contributor, workflow, dir).filter(p => !(isNative && /^Prefer (?:the )?native/i.test(p))).join(\"\\n\\n\"), isNative);",
204
+ "}",
205
+ "function paragraphs(lease, contributor, workflow, directory) {",
198
206
  " if (contributor) return [",
199
207
  " \"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.\",",
200
208
  " linkInstruction,",
@@ -373,7 +381,7 @@ export const hookSource: string = [
373
381
  " const reasons = [detached ? detachedNotice : null, dueText, sync ? stopReason + \" This is metadata bookkeeping only; do not start queued repairs or recovery.\\n\\n\" + context() : null, nudge ? named(nudgeReason) : null].filter(Boolean);",
374
382
  " process.stdout.write(JSON.stringify({ decision: \"block\", reason: reasons.join(\"\\n\\n\") }) + \"\\n\");",
375
383
  "}",
376
- "// Tests import shouldNudge without running the hook.",
377
- "if (env(\"HOOK_IMPORT\") !== \"1\") main().catch(() => {});",
384
+ "// Tests import shouldNudge without running the hook; the worker imports workspaceInstructions the same way.",
385
+ "if (env(\"HOOK_IMPORT\") !== \"1\" && !globalThis.followUpHookLibrary) main().catch(() => {});",
378
386
  "",
379
387
  ].join("\n");
@@ -1,3 +1,4 @@
1
+ import { compareVersions, parseVersion } from "../shared/version";
1
2
  /**
2
3
  * What the Paseo host says it can do, from the daemon's server_info `features` (the daemon client keeps the last one
3
4
  * it got while connecting: `getLastServerInfoMessage()`). Paseo 0.16 advertises `agentBackgroundWork`: it tracks an
@@ -7,7 +8,7 @@
7
8
  * The answer can't change without a daemon restart, which restarts this worker too, so the first real answer is
8
9
  * kept. A failed or empty read answers false (Wait stays as on 0.15) and is asked again next time.
9
10
  */
10
- export type ServerInfo = { features?: Record<string, unknown> | null } | null | undefined;
11
+ export type ServerInfo = { features?: Record<string, unknown> | null; version?: unknown } | null | undefined;
11
12
 
12
13
  export function hostFeature(feature: string, read: () => Promise<ServerInfo>): () => Promise<boolean> {
13
14
  let known: boolean | undefined;
@@ -19,3 +20,22 @@ export function hostFeature(feature: string, read: () => Promise<ServerInfo>): (
19
20
  return known = info.features?.[feature] === true;
20
21
  };
21
22
  }
23
+
24
+ /**
25
+ * Whether the host's version is at least `min` (a release: a prerelease of `min` answers false), for what server_info
26
+ * names no feature for. Paseo 0.17.1 draws plugin badges on sidebar workspace rows (`addWorkspaceRowBadgeItem`) and
27
+ * says so only by its version. Kept like `hostFeature`: an unknown version answers false and is asked again.
28
+ */
29
+ export function hostAtLeast(min: string, read: () => Promise<ServerInfo>): () => Promise<boolean> {
30
+ let known: boolean | undefined;
31
+ return async () => {
32
+ if (known !== undefined) return known;
33
+ let info: ServerInfo;
34
+ try { info = await read(); } catch { return false; }
35
+ const version = typeof info?.version === "string" ? info.version : "";
36
+ if (!parseVersion(version)) return false;
37
+ return known = compareVersions(version, min) >= 0;
38
+ };
39
+ }
40
+ /** The first Paseo that draws plugin workspace-row badges. */
41
+ export const ROW_BADGES_SINCE = "0.17.1";
@@ -16,6 +16,7 @@ export const PAGES_MAX = 40;
16
16
  export const OPEN_PAGES_PER_LIMIT = 3;
17
17
 
18
18
  import type { LinearList } from "../shared/linear-issues";
19
+ import { NEW_NAME } from "../shared/new-name";
19
20
  export type { LinearList };
20
21
 
21
22
  /** "Linear isn't connected": mcpproxy isn't installed, or it has no Linear server or tool. Anything else is a read error. */
@@ -84,7 +85,7 @@ export class LinearIssues {
84
85
  // open issues, at most OPEN_PAGES_PER_LIMIT pages per page wanted (and PAGES_MAX in all).
85
86
  const pages = Math.min(PAGES_MAX, Math.ceil(limit / PAGE_SIZE) * OPEN_PAGES_PER_LIMIT);
86
87
  for (let page = 0; page < pages && openIssues(issues).length < limit; page++) {
87
- const r = parseIssuePage(await this.call("list_issues", { assignee: "me", orderBy: "updatedAt", limit: PAGE_SIZE, fields: LIST_FIELDS, ...(cursor ? { cursor } : {}) }, "your Linear issues for New"), true);
88
+ const r = parseIssuePage(await this.call("list_issues", { assignee: "me", orderBy: "updatedAt", limit: PAGE_SIZE, fields: LIST_FIELDS, ...(cursor ? { cursor } : {}) }, `your Linear issues for ${NEW_NAME}`), true);
88
89
  if (!r.readable && page === 0) throw new Error("Linear's reply couldn't be read.");
89
90
  issues.push(...r.issues);
90
91
  cursor = r.next;
@@ -99,7 +100,7 @@ export class LinearIssues {
99
100
  async search(query: string, limit = PAGE_SIZE): Promise<LinearList> {
100
101
  const at = this.now();
101
102
  try {
102
- const r = parseIssuePage(await this.call("list_issues", { query: query.slice(0, 200), orderBy: "updatedAt", limit: Math.min(limit, PAGE_SIZE), fields: LIST_FIELDS }, "search Linear for New"), null);
103
+ const r = parseIssuePage(await this.call("list_issues", { query: query.slice(0, 200), orderBy: "updatedAt", limit: Math.min(limit, PAGE_SIZE), fields: LIST_FIELDS }, `search Linear for ${NEW_NAME}`), null);
103
104
  return { status: "ok", issues: r.issues, at, more: !!r.next };
104
105
  } catch (error) {
105
106
  return { status: linearMissing(error) ? "missing" : "error", issues: [], at, error: readError(error), more: false };
@@ -107,7 +108,7 @@ export class LinearIssues {
107
108
  }
108
109
  /** One issue with its description; null when Linear says there's no such issue. Throws when it couldn't be read. */
109
110
  async get(key: string): Promise<LinearIssue | null> {
110
- return parseIssue(await this.call("get_issue", { id: key, fields: ISSUE_FIELDS }, "the issue pasted into New"));
111
+ return parseIssue(await this.call("get_issue", { id: key, fields: ISSUE_FIELDS }, `the issue pasted into ${NEW_NAME}`));
111
112
  }
112
113
  }
113
114
 
@@ -257,6 +257,9 @@ export class LinearQueue {
257
257
  * The ranker's Linear input: the queue's top issues by priority plus every issue changed since the last workday's
258
258
  * sweep (stable all day, so opening the brief doesn't re-rank), each with its change. No snapshot yet: one sweep first.
259
259
  */
260
+ /** Every issue in the newest sweep, most urgent first (Compass's Linear tracker places): no sweep of its own. */
261
+ async snapshotIssues(): Promise<QueueIssue[]> { return queueIssues(current(await this.read())); }
262
+
260
263
  async forRanker(): Promise<(QueueIssue & { change: string | null })[]> {
261
264
  let file = await this.read();
262
265
  if (!current(file)) { await this.sweep("ranker"); file = await this.read(); }
@@ -83,8 +83,8 @@ export const mcpSource: string = [
83
83
  " [\"set_brief_sources\", \"Alias of set_compass inputs (goes in the next minor). Change the built-in inputs: on ({\\\"mcp:<server>\\\": true|false, \\\"gh\\\": …}, ids from brief_sources; Paseo and servers with no read tools can't be turned on; an Ask source turns on only after a preview under 24 h old), retry (one source id: read it again now), check (ask mcpproxy again), preview (an Ask source's id: one ask now, nothing turned on; read the items with brief_sources).\" + ask, \"follow.agent-act\", { on: { type: \"object\" }, retry: string, check: boolean, preview: string, ...planned }, []],",
84
84
  " // Compass (docs/compass.md): the sources that set the developer's priorities.",
85
85
  " [\"compass\", \"Read everything that sets the developer's priorities: the Compass sources (who, places, roles, reading notes), the glossary, each place's last read, the live notes (what was said, by whom, until when, the workspace it found or unplaced), the presets the connected tools allow, blocked (why Compass doesn't read: the Summaries provider has no guard), plan (this week's plan, as brief_plan), inputs (the built-in inputs: queue, chat, calendar, mail, review requests, Ask servers) and brief (the queue's settings and clock). workspace: only that workspace's notes.\" + read, \"follow.agent-act\", { workspace: string }, []],",
86
- " [\"compass_find\", \"Find people or conversations for a Compass source (kind people|channels, query): ids from the chat tool's own search, each with the place set_compass takes. The only way to learn a place id.\" + read, \"follow.agent-act\", { kind: { type: \"string\", enum: [\"people\", \"channels\"] }, query: string }, [\"kind\", \"query\"]],",
87
- " [\"set_compass\", \"Change the developer's Compass: source (add without id, edit with id: label, who {kind: person|people|me}, places from compass_find, roles priorities|plan|deadlines|customer|self|background, instructions: How to read this, enable_needs_you, enabled), remove (a source id), instructions (How to read your Compass), glossary [{words, means: {issue}|{workspace}|{account}}], expiry, plan ({mode: compass|link|off, link, replaceWhenNewer, find}), inputs ({on: {id: bool}, retry, check, preview}: the built-in inputs), queue ({states, chatHours, calendarDays}), routing ({suggestions: needs-you-and-new|new-only|off, urgentStrength: high|normal, urgentWithinWorkdays}: where suggestions about issues nobody started go), cadence (off|1h|2h|4h: the daytime read while the app is open, workdays 08:00-20:00). A new place is read over the last week at once.\" + ask, \"follow.agent-act\", { source: { type: \"object\" }, remove: string, instructions: string, glossary: { type: \"array\", items: { type: \"object\" } }, expiry: { type: \"object\" }, plan: { type: \"object\" }, inputs: { type: \"object\" }, queue: { type: \"object\" }, routing: { type: \"object\" }, cadence: { type: \"string\", enum: [\"off\", \"1h\", \"2h\", \"4h\"] }, ...planned }, []],",
86
+ " [\"compass_find\", \"Find a place for a Compass source, with the place set_compass takes (the only way to learn a place id): kind people|channels (chat search), docs (docs search), file (an absolute path to a .md or .txt file on this machine), trackers (words: the Linear queue's projects and milestones; \\\"owner/repo [words]\\\": its GitHub labels and milestones), calendars.\" + read, \"follow.agent-act\", { kind: { type: \"string\", enum: [\"people\", \"channels\", \"docs\", \"file\", \"trackers\", \"calendars\"] }, query: string }, [\"kind\", \"query\"]],",
87
+ " [\"set_compass\", \"Change the developer's Compass: source (add without id, edit with id: label, who {kind: person|people|anyone|me}, places from compass_find, roles priorities|plan|deadlines|customer|self|background, instructions: How to read this, enable_needs_you, enabled), remove (a source id), instructions (How to read your Compass), glossary [{words, means: {issue}|{workspace}|{account}}], expiry, plan ({mode: compass|link|off, link, replaceWhenNewer, find}), inputs ({on: {id: bool}, retry, check, preview}: the built-in inputs), queue ({states, chatHours, calendarDays}), routing ({suggestions: needs-you-and-new|new-only|off, urgentStrength: high|normal, urgentWithinWorkdays}: where suggestions about issues nobody started go), cadence (off|1h|2h|4h: the daytime read while the app is open, workdays 08:00-20:00). A new place is read over the last week at once.\" + ask, \"follow.agent-act\", { source: { type: \"object\" }, remove: string, instructions: string, glossary: { type: \"array\", items: { type: \"object\" } }, expiry: { type: \"object\" }, plan: { type: \"object\" }, inputs: { type: \"object\" }, queue: { type: \"object\" }, routing: { type: \"object\" }, cadence: { type: \"string\", enum: [\"off\", \"1h\", \"2h\", \"4h\"] }, ...planned }, []],",
88
88
  " [\"compass_note\", \"Change one Compass note, or pass it to an agent: action pin (a new note on a workspace in your words: workspace, what, optional until YYYY-MM-DD and strength high|normal|low), edit (id, then until, strength or workspace), unpin (id: it ends now), tell (id: one message with the note to its workspace's main agent; only on the developer's ask). Note ids come from compass.\" + ask, \"follow.agent-act\", { action: { type: \"string\", enum: [\"pin\", \"edit\", \"unpin\", \"tell\"] }, id: string, workspace: string, what: string, until: string, strength: { type: \"string\", enum: [\"high\", \"normal\", \"low\"] }, ...planned }, [\"action\"]],",
89
89
  " [\"why_suggested\", \"Why a workspace or issue ranks where it does: the live Compass notes behind it (workspace, issue key, or one note id), each with what was said, the quote, who, the source and role, the date, and how it was matched (glossary, key, title score, by hand), plus needsYou: whether it is a suggestion (an issue nobody started), urgent (in Needs you as Nobody's on it) or first in New, and why.\" + read, \"follow.agent-act\", { workspace: string, issue: string, note: string }, []],",
90
90
  " [\"read_compass\", \"Read the developer's Compass sources now, like Read now: waits up to 30 s, then returns running.\" + ask, \"follow.agent-act\", { ...planned }, []],",
@@ -100,7 +100,7 @@ export const mcpSource: string = [
100
100
  " // Settings, onboarding, Home and the panel, one developer RPC each (server/agent-parity.ts). Writes plan first.",
101
101
  " [\"make_main_agent\", \"Make yourself or another root agent of this workspace its main agent (the one that asks the developer, reports Needs-you and calls Done). requested=developer when the developer asked for it (refused only while the main is mid-turn); requested=self for your own claim, allowed only when the main is archived, gone or closed 30 minutes, or you registered every open PR and the main has been idle 24 hours, and never within 30 minutes of a change or 2 hours after you lost the role. Give a one-line reason the developer sees. Returns a dry run; run it with confirm=true and the planId.\", \"follow.agent-act\", { agentId: string, reason: string, requested: { type: \"string\", enum: [\"developer\", \"self\"] }, ...planned }, []],",
102
102
  " [\"display_settings\", \"Read Settings → Display: the header button, sidebar item, composer pill, Needs-you inbox, closed-PR flags, brief nudge, Overseer, ranker and trust bypass switches.\" + read, \"follow.agent-act\", {}, []],",
103
- " [\"set_display\", \"Change Settings → Display switches, Home's order, the width of Home's right pane and the search-from-anywhere key, e.g. { values: { enable_trust_bypass: false } } or { values: { home_sort: \\\"recent\\\" } } or { values: { home_detail_fraction: 0.5 } } or { values: { search_shortcut: \\\"mod-shift-k\\\" } }. Keys from display_settings.\" + ask, \"follow.agent-act\", { values: { type: \"object\", additionalProperties: { type: [\"boolean\", \"string\", \"number\"] } }, ...planned }, []],",
103
+ " [\"set_display\", \"Change Settings → Display switches (enable_new_sidebar_row: the sidebar's New row), Home's order, the width of Home's right pane and the search-from-anywhere key, e.g. { values: { enable_trust_bypass: false } } or { values: { home_sort: \\\"recent\\\" } } or { values: { home_detail_fraction: 0.5 } } or { values: { search_shortcut: \\\"mod-shift-k\\\" } }. Keys from display_settings.\" + ask, \"follow.agent-act\", { values: { type: \"object\", additionalProperties: { type: [\"boolean\", \"string\", \"number\"] } }, ...planned }, []],",
104
104
  " [\"follow_settings\", \"Read Settings → Following: follow every workspace, the Auto-send default, the active window, and per-workspace exceptions.\" + read, \"follow.agent-act\", {}, []],",
105
105
  " [\"set_follow_settings\", \"Change Settings → Following: enable_follow_every, enable_auto_sends_default, activeWindowDays (1-60), or one workspace's exception { workspaceId, follow, enable_auto_sends }.\" + ask, \"follow.agent-act\", { enable_follow_every: boolean, enable_auto_sends_default: boolean, activeWindowDays: { type: \"integer\", minimum: 1, maximum: 60 }, workspace: { type: \"object\" }, ...planned }, []],",
106
106
  " [\"project_settings\", \"Read each project and whether Follow-up follows its new workspaces by default.\" + read, \"follow.agent-act\", {}, []],",
@@ -311,6 +311,8 @@ export const mcpSource: string = [
311
311
  " nextMessage: w.nextMessageInfo ?? null, sending: w.sending ?? null, heldTasks: w.heldTasks ?? [],",
312
312
  " // GitHub budget low: Follow-up's PR reads wait until this time (null: they run); PR statuses are from the last read.",
313
313
  " githubWait: w.githubWait ?? null,",
314
+ " // GitHub off on this host (missing: no gh; signed-out): PR status, repairs, merge and wait_for_checks are off until gh is set up.",
315
+ " ...(w.githubOff ? { githubOff: w.githubOff } : {}),",
314
316
  " excludedStacks: w.excludedStacks.map(s => ({ name: s.name, reason: s.reason, prs: s.prs.map(p => p.key) })), ...(w.prWorkflow ? { prWorkflow: w.prWorkflow } : {}), detail: \"summary\" };",
315
317
  "}",
316
318
  "function compact(tool, input, result) {",
package/server/mcp.mjs CHANGED
@@ -81,8 +81,8 @@ const actionTools = [
81
81
  ["set_brief_sources", "Alias of set_compass inputs (goes in the next minor). Change the built-in inputs: on ({\"mcp:<server>\": true|false, \"gh\": …}, ids from brief_sources; Paseo and servers with no read tools can't be turned on; an Ask source turns on only after a preview under 24 h old), retry (one source id: read it again now), check (ask mcpproxy again), preview (an Ask source's id: one ask now, nothing turned on; read the items with brief_sources)." + ask, "follow.agent-act", { on: { type: "object" }, retry: string, check: boolean, preview: string, ...planned }, []],
82
82
  // Compass (docs/compass.md): the sources that set the developer's priorities.
83
83
  ["compass", "Read everything that sets the developer's priorities: the Compass sources (who, places, roles, reading notes), the glossary, each place's last read, the live notes (what was said, by whom, until when, the workspace it found or unplaced), the presets the connected tools allow, blocked (why Compass doesn't read: the Summaries provider has no guard), plan (this week's plan, as brief_plan), inputs (the built-in inputs: queue, chat, calendar, mail, review requests, Ask servers) and brief (the queue's settings and clock). workspace: only that workspace's notes." + read, "follow.agent-act", { workspace: string }, []],
84
- ["compass_find", "Find people or conversations for a Compass source (kind people|channels, query): ids from the chat tool's own search, each with the place set_compass takes. The only way to learn a place id." + read, "follow.agent-act", { kind: { type: "string", enum: ["people", "channels"] }, query: string }, ["kind", "query"]],
85
- ["set_compass", "Change the developer's Compass: source (add without id, edit with id: label, who {kind: person|people|me}, places from compass_find, roles priorities|plan|deadlines|customer|self|background, instructions: How to read this, enable_needs_you, enabled), remove (a source id), instructions (How to read your Compass), glossary [{words, means: {issue}|{workspace}|{account}}], expiry, plan ({mode: compass|link|off, link, replaceWhenNewer, find}), inputs ({on: {id: bool}, retry, check, preview}: the built-in inputs), queue ({states, chatHours, calendarDays}), routing ({suggestions: needs-you-and-new|new-only|off, urgentStrength: high|normal, urgentWithinWorkdays}: where suggestions about issues nobody started go), cadence (off|1h|2h|4h: the daytime read while the app is open, workdays 08:00-20:00). A new place is read over the last week at once." + ask, "follow.agent-act", { source: { type: "object" }, remove: string, instructions: string, glossary: { type: "array", items: { type: "object" } }, expiry: { type: "object" }, plan: { type: "object" }, inputs: { type: "object" }, queue: { type: "object" }, routing: { type: "object" }, cadence: { type: "string", enum: ["off", "1h", "2h", "4h"] }, ...planned }, []],
84
+ ["compass_find", "Find a place for a Compass source, with the place set_compass takes (the only way to learn a place id): kind people|channels (chat search), docs (docs search), file (an absolute path to a .md or .txt file on this machine), trackers (words: the Linear queue's projects and milestones; \"owner/repo [words]\": its GitHub labels and milestones), calendars." + read, "follow.agent-act", { kind: { type: "string", enum: ["people", "channels", "docs", "file", "trackers", "calendars"] }, query: string }, ["kind", "query"]],
85
+ ["set_compass", "Change the developer's Compass: source (add without id, edit with id: label, who {kind: person|people|anyone|me}, places from compass_find, roles priorities|plan|deadlines|customer|self|background, instructions: How to read this, enable_needs_you, enabled), remove (a source id), instructions (How to read your Compass), glossary [{words, means: {issue}|{workspace}|{account}}], expiry, plan ({mode: compass|link|off, link, replaceWhenNewer, find}), inputs ({on: {id: bool}, retry, check, preview}: the built-in inputs), queue ({states, chatHours, calendarDays}), routing ({suggestions: needs-you-and-new|new-only|off, urgentStrength: high|normal, urgentWithinWorkdays}: where suggestions about issues nobody started go), cadence (off|1h|2h|4h: the daytime read while the app is open, workdays 08:00-20:00). A new place is read over the last week at once." + ask, "follow.agent-act", { source: { type: "object" }, remove: string, instructions: string, glossary: { type: "array", items: { type: "object" } }, expiry: { type: "object" }, plan: { type: "object" }, inputs: { type: "object" }, queue: { type: "object" }, routing: { type: "object" }, cadence: { type: "string", enum: ["off", "1h", "2h", "4h"] }, ...planned }, []],
86
86
  ["compass_note", "Change one Compass note, or pass it to an agent: action pin (a new note on a workspace in your words: workspace, what, optional until YYYY-MM-DD and strength high|normal|low), edit (id, then until, strength or workspace), unpin (id: it ends now), tell (id: one message with the note to its workspace's main agent; only on the developer's ask). Note ids come from compass." + ask, "follow.agent-act", { action: { type: "string", enum: ["pin", "edit", "unpin", "tell"] }, id: string, workspace: string, what: string, until: string, strength: { type: "string", enum: ["high", "normal", "low"] }, ...planned }, ["action"]],
87
87
  ["why_suggested", "Why a workspace or issue ranks where it does: the live Compass notes behind it (workspace, issue key, or one note id), each with what was said, the quote, who, the source and role, the date, and how it was matched (glossary, key, title score, by hand), plus needsYou: whether it is a suggestion (an issue nobody started), urgent (in Needs you as Nobody's on it) or first in New, and why." + read, "follow.agent-act", { workspace: string, issue: string, note: string }, []],
88
88
  ["read_compass", "Read the developer's Compass sources now, like Read now: waits up to 30 s, then returns running." + ask, "follow.agent-act", { ...planned }, []],
@@ -98,7 +98,7 @@ const actionTools = [
98
98
  // Settings, onboarding, Home and the panel, one developer RPC each (server/agent-parity.ts). Writes plan first.
99
99
  ["make_main_agent", "Make yourself or another root agent of this workspace its main agent (the one that asks the developer, reports Needs-you and calls Done). requested=developer when the developer asked for it (refused only while the main is mid-turn); requested=self for your own claim, allowed only when the main is archived, gone or closed 30 minutes, or you registered every open PR and the main has been idle 24 hours, and never within 30 minutes of a change or 2 hours after you lost the role. Give a one-line reason the developer sees. Returns a dry run; run it with confirm=true and the planId.", "follow.agent-act", { agentId: string, reason: string, requested: { type: "string", enum: ["developer", "self"] }, ...planned }, []],
100
100
  ["display_settings", "Read Settings → Display: the header button, sidebar item, composer pill, Needs-you inbox, closed-PR flags, brief nudge, Overseer, ranker and trust bypass switches." + read, "follow.agent-act", {}, []],
101
- ["set_display", "Change Settings → Display switches, Home's order, the width of Home's right pane and the search-from-anywhere key, e.g. { values: { enable_trust_bypass: false } } or { values: { home_sort: \"recent\" } } or { values: { home_detail_fraction: 0.5 } } or { values: { search_shortcut: \"mod-shift-k\" } }. Keys from display_settings." + ask, "follow.agent-act", { values: { type: "object", additionalProperties: { type: ["boolean", "string", "number"] } }, ...planned }, []],
101
+ ["set_display", "Change Settings → Display switches (enable_new_sidebar_row: the sidebar's New row), Home's order, the width of Home's right pane and the search-from-anywhere key, e.g. { values: { enable_trust_bypass: false } } or { values: { home_sort: \"recent\" } } or { values: { home_detail_fraction: 0.5 } } or { values: { search_shortcut: \"mod-shift-k\" } }. Keys from display_settings." + ask, "follow.agent-act", { values: { type: "object", additionalProperties: { type: ["boolean", "string", "number"] } }, ...planned }, []],
102
102
  ["follow_settings", "Read Settings → Following: follow every workspace, the Auto-send default, the active window, and per-workspace exceptions." + read, "follow.agent-act", {}, []],
103
103
  ["set_follow_settings", "Change Settings → Following: enable_follow_every, enable_auto_sends_default, activeWindowDays (1-60), or one workspace's exception { workspaceId, follow, enable_auto_sends }." + ask, "follow.agent-act", { enable_follow_every: boolean, enable_auto_sends_default: boolean, activeWindowDays: { type: "integer", minimum: 1, maximum: 60 }, workspace: { type: "object" }, ...planned }, []],
104
104
  ["project_settings", "Read each project and whether Follow-up follows its new workspaces by default." + read, "follow.agent-act", {}, []],
@@ -309,6 +309,8 @@ function currentWork(w) {
309
309
  nextMessage: w.nextMessageInfo ?? null, sending: w.sending ?? null, heldTasks: w.heldTasks ?? [],
310
310
  // GitHub budget low: Follow-up's PR reads wait until this time (null: they run); PR statuses are from the last read.
311
311
  githubWait: w.githubWait ?? null,
312
+ // GitHub off on this host (missing: no gh; signed-out): PR status, repairs, merge and wait_for_checks are off until gh is set up.
313
+ ...(w.githubOff ? { githubOff: w.githubOff } : {}),
312
314
  excludedStacks: w.excludedStacks.map(s => ({ name: s.name, reason: s.reason, prs: s.prs.map(p => p.key) })), ...(w.prWorkflow ? { prWorkflow: w.prWorkflow } : {}), detail: "summary" };
313
315
  }
314
316
  function compact(tool, input, result) {