paseo-follow-up 1.4.0-beta.14 → 1.4.0-beta.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -197,7 +197,7 @@ The choices live in `agents.json` in Follow-up's data folder. Anything missing o
197
197
  Install the beta:
198
198
 
199
199
  ```sh
200
- paseo plugin update follow-through --version 1.4.0-beta.14
200
+ paseo plugin update follow-through --version 1.4.0-beta.16
201
201
  # or, for a fresh install:
202
202
  paseo plugin install npm:paseo-follow-up@beta
203
203
  ```
@@ -74,7 +74,7 @@ export function Setup({ theme, compact, view, deps }: { theme: Theme; compact: b
74
74
 
75
75
  const body = step === "intro" ? <IntroStep theme={theme} compact={compact} follow={follow.data ?? null} />
76
76
  : step === "checks" ? <ChecksStep theme={theme} compact={compact} checks={checks} deps={deps} />
77
- : step === "defaults" ? <DefaultsStep theme={theme} compact={compact} />
77
+ : step === "defaults" ? <DefaultsStep theme={theme} compact={compact} held={view.holdsAutoSends} />
78
78
  : step === "reviewers" ? <ReviewerSettings theme={theme} compact={compact} />
79
79
  : <HelpersStep theme={theme} compact={compact} deps={deps} checks={checks.data?.checks ?? null} />;
80
80
  const lead: Record<OnboardingStep, string> = {
@@ -305,7 +305,7 @@ function SwitchRow({ theme, compact, label, hint, value, onChange, disabled, fir
305
305
  </View>;
306
306
  }
307
307
 
308
- function DefaultsStep({ theme, compact }: { theme: Theme; compact: boolean }) {
308
+ function DefaultsStep({ theme, compact, held }: { theme: Theme; compact: boolean; held: boolean }) {
309
309
  const c = theme.colors; const t = text(c);
310
310
  const follow = useFollowSettings(); const write = useRpc(setFollowSettingsRpc); const cache = useQueryClient(); const toast = useToast();
311
311
  const display = useSettings(displayPreferences);
@@ -348,7 +348,7 @@ function DefaultsStep({ theme, compact }: { theme: Theme; compact: boolean }) {
348
348
  </View>}
349
349
  </SwitchRow>
350
350
  <SwitchRow theme={theme} compact={compact} label="Send repairs automatically" value={data?.enable_auto_sends_default ?? null} disabled={change.isPending}
351
- hint={`Review threads and failed checks go to the workspace's agent on their own, once it's idle. Off: each batch waits for your click.${followed ? ` Here it also applies to the ${followed} already followed.` : ""}`}
351
+ hint={`Review threads and failed checks go to the workspace's agent on their own, once it's idle. Off: each batch waits for your click.${followed ? ` Here it also applies to the ${followed} already followed.` : ""}${held ? " Nothing goes out on its own until you finish setup." : ""}`}
352
352
  onChange={v => change.mutate(autoSendWrites(v, list))} />
353
353
  <SwitchRow theme={theme} compact={compact} label="Trust bypass agents" value={trust}
354
354
  hint="An agent you started in bypass or full access sometimes still stops on a tool prompt. Follow-up approves those so it keeps going, and logs each one. Off brings the prompts back."
package/index.server.ts CHANGED
@@ -104,6 +104,7 @@ export default function contribute(server: PluginServerContext) {
104
104
  const governor = new Governor();
105
105
  const listCache = new ListCache();
106
106
  engine.paused = () => !governor.allowsBackground();
107
+ engine.autoSendsHeld = () => onboarding.holdsAutoSends();
107
108
  const archive = batchArchive(directory);
108
109
  engine.archive = archive;
109
110
  const usage = new UsageReader(paseoHome);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "paseo-follow-up",
3
3
  "private": false,
4
- "version": "1.4.0-beta.14",
4
+ "version": "1.4.0-beta.16",
5
5
  "description": "Follow every workspace PR stack in Paseo, answer agent questions, batch repairs for the main agent, and see what needs you.",
6
6
  "type": "module",
7
7
  "files": [
package/server/engine.ts CHANGED
@@ -45,6 +45,8 @@ export class Engine {
45
45
  private stopped = false;
46
46
  /** Set by the resource governor: while true, background refresh (scans, observation, auto-sends) waits. */
47
47
  paused: () => boolean = () => false;
48
+ /** Set by the worker: while true (a fresh install mid-setup), batches queue but nothing is sent on its own. */
49
+ autoSendsHeld: () => boolean = () => false;
48
50
  /** Where pruned never-sent batches go (see pruneUnsent); the worker appends them to an archive file. */
49
51
  archive: (workspaceId: string, batches: Batch[]) => Promise<void> = async () => {};
50
52
  /** Background refreshes skipped while paused, for tests and the resource check. */
@@ -142,7 +144,7 @@ export class Engine {
142
144
  const pending = current.batches.find(b => b.state === "pending" && !isRecovery(b));
143
145
  // Auto-send only reaches an agent that is loaded and recently used: sending to a dormant one would wake it.
144
146
  // Completion checks never go out on their own; they wait for Tom or the agent's next live turn.
145
- if (current.enable_auto_sends && !current.archived && !current.hold && pending && !current.dormant && !current.goneAgent &&
147
+ if (current.enable_auto_sends && !this.autoSendsHeld() && !current.archived && !current.hold && pending && !current.dormant && !current.goneAgent &&
146
148
  !completionBatch(pending) && runtime.mainLoaded !== false && runtime.mainRecent !== false &&
147
149
  !runtime.busy && !runtime.backgroundBusy && !runtime.reason &&
148
150
  !current.batches.some(b => !isRecovery(b) && ["sending", "sent", "blocked", "uncertain"].includes(b.state)) &&
@@ -225,7 +227,7 @@ export class Engine {
225
227
  const current = findWorkspace(await this.store.snapshot(), workspaceId);
226
228
  const batch = current.batches.find(b => b.id === batchId && b.state === "pending");
227
229
  if (batch && isRecovery(batch)) throw new Error("Recovery requires its own explicit action.");
228
- if (!batch || !current.enable_tracking || current.archived || current.hold || this.stopped || (automatic && !current.enable_auto_sends)) throw new Error("Workspace or queue is no longer ready to send");
230
+ if (!batch || !current.enable_tracking || current.archived || current.hold || this.stopped || (automatic && (!current.enable_auto_sends || this.autoSendsHeld()))) throw new Error("Workspace or queue is no longer ready to send");
229
231
  if (current.goneAgent?.agentId === current.mainAgentId) throw new Error(GONE_REASON);
230
232
  if (needsPrObservations(current, batch) && current.prs.some(p => p.error || !p.snapshot?.complete)) throw new Error("PR status is incomplete; refresh before sending repairs");
231
233
  const runtime = await this.gateway.observe(current, true);
@@ -1,6 +1,6 @@
1
1
  import { readdir, readFile, rename, writeFile } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
- import { applyOnboarding, classifyGhError, classifyInstall, ghCheck, initialOnboarding, offerVisible, onboardingFileSchema, onboardingView, providerChecks, toolsCheck,
3
+ import { applyOnboarding, classifyGhError, holdsAutoSends, classifyInstall, ghCheck, initialOnboarding, offerVisible, onboardingFileSchema, onboardingView, providerChecks, toolsCheck,
4
4
  type Check, type Checks, type GhResult, type OnboardingAction, type OnboardingFile, type OnboardingStep, type OnboardingView, type ProviderInfo, type ProviderUse, type ToolsInput } from "../shared/onboarding";
5
5
 
6
6
  /**
@@ -43,6 +43,8 @@ export class OnboardingStore {
43
43
  this.tail = next.catch(() => undefined);
44
44
  return next;
45
45
  }
46
+ /** Whether the engine holds auto-sends (fresh install mid-setup). Synchronous: reads what init or the last write cached. */
47
+ holdsAutoSends(): boolean { return holdsAutoSends(this.cached); }
46
48
  /** The client's view. The first time the existing-install offer is shown, its day starts. */
47
49
  async view(): Promise<OnboardingView> {
48
50
  let file = (await this.load()) ?? await this.init();
package/server/ranker.ts CHANGED
@@ -112,11 +112,12 @@ export function parseSlackSearch(text: string, self: string | null): RankMessage
112
112
  /** `gh search prs --review-requested=@me --json number,title,url,repository,author`. */
113
113
  export function parseReviewRequests(stdout: string): RankReview[] {
114
114
  let j: unknown; try { j = JSON.parse(stdout); } catch { return []; }
115
- if (!Array.isArray(j)) return [];
116
- return j.flatMap(raw => {
117
- const r = raw as { number?: unknown; title?: unknown; url?: unknown; repository?: { nameWithOwner?: unknown; name?: unknown }; author?: { login?: unknown } };
118
- const repo = str(r.repository?.nameWithOwner) ?? str(r.repository?.name);
119
- return typeof r.number === "number" && repo && str(r.title) ? [{ repo, number: r.number, title: str(r.title)!, url: str(r.url), author: str(r.author?.login) }] : [];
115
+ // REST `search/issues` ({items}) or `gh search prs --json` (an array).
116
+ const list = Array.isArray(j) ? j : Array.isArray((j as { items?: unknown })?.items) ? (j as { items: unknown[] }).items : [];
117
+ return list.flatMap(raw => {
118
+ const r = raw as { number?: unknown; title?: unknown; url?: unknown; html_url?: unknown; repository_url?: unknown; repository?: { nameWithOwner?: unknown; name?: unknown }; author?: { login?: unknown }; user?: { login?: unknown } };
119
+ const repo = str(r.repository?.nameWithOwner) ?? str(r.repository?.name) ?? /\/repos\/([^/]+\/[^/]+)$/.exec(str(r.repository_url) ?? "")?.[1] ?? null;
120
+ return typeof r.number === "number" && repo && str(r.title) ? [{ repo, number: r.number, title: str(r.title)!, url: str(r.html_url) ?? str(r.url), author: str(r.author?.login) ?? str(r.user?.login) }] : [];
120
121
  });
121
122
  }
122
123
 
@@ -198,17 +199,20 @@ export function liveRankSources(jobs: AiJobs, opts: { run?: Run; slackSelf?: str
198
199
  // that one gh child only, never stored.
199
200
  const status = await run("gh", ["auth", "status", "--hostname", "github.com"], 15_000).catch(e => String((e as { stdout?: string; stderr?: string }).stdout ?? "") + String((e as { stderr?: string }).stderr ?? ""));
200
201
  const accounts = ghAccounts(status);
201
- const search = (env?: Record<string, string>) => run("gh", ["search", "prs", "--review-requested=@me", "--state=open", "--limit=30", "--json", "number,title,url,repository,author"], 30_000, env).then(parseReviewRequests);
202
+ // REST search: `gh search prs` goes through GraphQL search, whose secondary limit a busy work account hits often
203
+ // (it then read as "no review requests").
204
+ const search = (env?: Record<string, string>) => run("gh", ["api", "-X", "GET", "search/issues", "-f", "q=is:pr is:open archived:false review-requested:@me", "-f", "per_page=30"], 30_000, env).then(parseReviewRequests);
202
205
  if (accounts.length <= 1) return search();
203
- const seen = new Set<string>(); const out: RankReview[] = []; let read = 0;
206
+ const seen = new Set<string>(); const out: RankReview[] = []; let read = 0; let failed = 0;
204
207
  for (const user of accounts) {
205
208
  try {
206
209
  const token = (await run("gh", ["auth", "token", "--hostname", "github.com", "--user", user], 15_000)).trim();
207
210
  for (const r of await search(token ? { GH_TOKEN: token } : undefined)) { const k = `${r.repo}#${r.number}`; if (!seen.has(k)) { seen.add(k); out.push(r); } }
208
211
  read++;
209
- } catch { /* that account can't search; the others still count */ }
212
+ } catch { failed++; /* the others still count */ }
210
213
  }
211
- if (!read) throw new Error("No gh account could search review requests.");
214
+ // An account that couldn't search may hold the requests: none found plus a failure is a failure, not "none".
215
+ if (!read || (failed && !out.length)) throw new Error(`${failed} gh account(s) couldn't search review requests.`);
212
216
  return out;
213
217
  },
214
218
  async planning(url) {
@@ -37,6 +37,8 @@ export const onboardingFileSchema = z.object({
37
37
  /** When the existing-install offer was first shown; it disappears a day later. */
38
38
  offeredAt: z.string().nullable().default(null),
39
39
  offerDismissed: z.boolean().default(false),
40
+ /** When a fresh install first finished or skipped setup. Auto-send is held until then; a later restart doesn't hold it again. */
41
+ settledAt: z.string().nullable().default(null),
40
42
  });
41
43
  export type OnboardingFile = z.infer<typeof onboardingFileSchema>;
42
44
 
@@ -47,6 +49,8 @@ export const onboardingViewSchema = z.object({
47
49
  step: z.enum(ONBOARDING_STEPS),
48
50
  show: z.boolean(),
49
51
  offer: z.boolean(),
52
+ /** Auto-send waits until setup is finished or skipped (fresh install only). */
53
+ holdsAutoSends: z.boolean().default(false),
50
54
  });
51
55
  export type OnboardingView = z.infer<typeof onboardingViewSchema>;
52
56
 
@@ -59,7 +63,15 @@ export function classifyInstall(present: readonly string[]): InstallKind {
59
63
  }
60
64
 
61
65
  export function initialOnboarding(install: InstallKind, now: Date): OnboardingFile {
62
- return { version: 1, install, status: install === "fresh" ? "new" : "idle", step: null, createdAt: now.toISOString(), updatedAt: null, offeredAt: null, offerDismissed: false };
66
+ return { version: 1, install, status: install === "fresh" ? "new" : "idle", step: null, createdAt: now.toISOString(), updatedAt: null, offeredAt: null, offerDismissed: false, settledAt: null };
67
+ }
68
+
69
+ /**
70
+ * Auto-send waits on a fresh install until setup is finished or skipped, so nothing goes to an agent before the
71
+ * developer has seen the switch. Existing installs, and a fresh one that already settled, keep sending as before.
72
+ */
73
+ export function holdsAutoSends(file: OnboardingFile | null): boolean {
74
+ return !!file && file.install === "fresh" && !file.settledAt && (file.status === "new" || file.status === "active");
63
75
  }
64
76
 
65
77
  export const OFFER_MS = 24 * 3600_000;
@@ -71,7 +83,7 @@ export function offerVisible(file: OnboardingFile, now: number): boolean {
71
83
  }
72
84
 
73
85
  export function onboardingView(file: OnboardingFile, now: number): OnboardingView {
74
- return { install: file.install, status: file.status, step: file.step ?? "intro", show: file.status === "new" || file.status === "active", offer: offerVisible(file, now) };
86
+ return { install: file.install, status: file.status, step: file.step ?? "intro", show: file.status === "new" || file.status === "active", offer: offerVisible(file, now), holdsAutoSends: holdsAutoSends(file) };
75
87
  }
76
88
 
77
89
  export const ONBOARDING_ACTIONS = ["start", "step", "finish", "skip", "restart", "dismiss-offer"] as const;
@@ -84,8 +96,8 @@ export function applyOnboarding(file: OnboardingFile, action: OnboardingAction,
84
96
  switch (action) {
85
97
  case "start": return { ...next, status: "active", step: file.status === "active" ? file.step ?? "intro" : "intro" };
86
98
  case "step": return { ...next, status: file.status === "new" || file.status === "idle" ? "active" : file.status, step: step ?? file.step };
87
- case "finish": return { ...next, status: "done" };
88
- case "skip": return { ...next, status: "skipped", offerDismissed: true };
99
+ case "finish": return { ...next, status: "done", settledAt: file.settledAt ?? at };
100
+ case "skip": return { ...next, status: "skipped", offerDismissed: true, settledAt: file.settledAt ?? at };
89
101
  // "Set up Follow-up again" from Settings or ⌘K: always from the start, any install kind.
90
102
  case "restart": return { ...next, status: "active", step: "intro", offerDismissed: true };
91
103
  case "dismiss-offer": return { ...next, offerDismissed: true };