paseo-follow-up 1.4.0-beta.12 → 1.4.0-beta.13

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
@@ -183,7 +183,7 @@ The choices live in `agents.json` in Follow-up's data folder. Anything missing o
183
183
  Install the beta:
184
184
 
185
185
  ```sh
186
- paseo plugin update follow-through --version 1.4.0-beta.12
186
+ paseo plugin update follow-through --version 1.4.0-beta.13
187
187
  # or, for a fresh install:
188
188
  paseo plugin install npm:paseo-follow-up@beta
189
189
  ```
package/index.server.ts CHANGED
@@ -760,9 +760,23 @@ export default function contribute(server: PluginServerContext) {
760
760
  const trust = new TrustBypass(directory, {
761
761
  enabled: async () => (await inboxSettings()).enable_trust_bypass,
762
762
  // The mode the provider reports now; never the one the agent was created with.
763
- mode: async agentId => { const agent = (await trustApi!.agents.ref(agentId).refresh())?.agent; return agent?.currentModeId ?? agent?.runtimeInfo?.modeId ?? null; },
764
- approve: (agentId, requestId) => trustApi!.agents.ref(agentId).respondToPermission({ requestId, response: { behavior: "allow" } }),
763
+ // Before any handler context exists (the load sweep below), the same reads go through a daemon connection.
764
+ mode: async agentId => {
765
+ const agent = trustApi ? (await trustApi.agents.ref(agentId).refresh())?.agent : (await withDaemon(client => client.fetchAgent(agentId)))?.agent;
766
+ return agent?.currentModeId ?? agent?.runtimeInfo?.modeId ?? null;
767
+ },
768
+ approve: (agentId, requestId) => trustApi
769
+ ? trustApi.agents.ref(agentId).respondToPermission({ requestId, response: { behavior: "allow" } })
770
+ : withDaemon(client => client.respondToPermission(agentId, requestId, { behavior: "allow" })),
765
771
  });
772
+ // Prompts already pending when Follow-up loaded or updated raise no new event: sweep them once, from the startup
773
+ // agent list (metadata only; only loaded agents can have a pending prompt, so no agent is loaded or refreshed).
774
+ void ready.then(async () => {
775
+ if (loadError || stopped) return;
776
+ const decisions = await trust.sweep((await gateway.directory.read()).agents.map(row => row.agent));
777
+ const approved = decisions.filter(d => d.approved).length;
778
+ if (approved) console.warn(`[follow-up] trust bypass approved ${approved} prompt(s) already pending at load`);
779
+ }).catch(() => undefined);
766
780
  handle(rpc.trustBypassRpc, async () => trust.recent(20));
767
781
 
768
782
  const removers = [
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.12",
4
+ "version": "1.4.0-beta.13",
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/daemon.ts CHANGED
@@ -24,12 +24,13 @@ import { DaemonDirectory, type DirectoryRows } from "./directory";
24
24
  type RecoveryAgentOptions = Partial<PluginBeforeRequests["agent.create"]["config"]> & { workspaceId: string; labels: Record<string, string>; idempotencyKey: string; env: Record<string, string> };
25
25
 
26
26
  export const paseoHome = process.env.PASEO_HOME ?? join(homedir(), ".paseo");
27
- export type Agent = { id: string; provider: string; cwd: string; model?: string | null; currentModeId?: string | null; thinkingOptionId?: string | null; features?: { id: string; value: unknown }[]; persistence?: { sessionId: string; nativeHandle?: string } | null; title?: string | null; createdAt: string; workspaceId?: string; status: string; archivedAt?: string | null; labels: Record<string, string>; lastUserMessageAt: string | null; pendingPermissions: unknown[]; activeTurn?: unknown; lastError?: string | null };
27
+ export type Agent = { id: string; provider: string; cwd: string; model?: string | null; currentModeId?: string | null; runtimeInfo?: { modeId?: string | null } | null; thinkingOptionId?: string | null; features?: { id: string; value: unknown }[]; persistence?: { sessionId: string; nativeHandle?: string } | null; title?: string | null; createdAt: string; workspaceId?: string; status: string; archivedAt?: string | null; labels: Record<string, string>; lastUserMessageAt: string | null; pendingPermissions: unknown[]; activeTurn?: unknown; lastError?: string | null };
28
28
  type WorkspaceRow = { id: string; name: string; projectId?: string | null; labels?: string[]; archivingAt?: string | null };
29
29
  export interface Daemon {
30
30
  connect(): Promise<void>; close(): Promise<void>;
31
31
  listProjects(): Promise<{ projects: Project[] }>;
32
32
  fetchAgent(id: string): Promise<{ agent: Agent } | null>;
33
+ respondToPermission(agentId: string, requestId: string, response: { behavior: "allow" }): Promise<void>;
33
34
  fetchAgents(options?: unknown): Promise<{ entries: { agent: Agent }[]; pageInfo: { hasMore: boolean; nextCursor: string | null } }>;
34
35
  fetchWorkspaces(options?: unknown): Promise<{ entries: WorkspaceRow[]; pageInfo: { hasMore: boolean; nextCursor: string | null } }>;
35
36
  fetchAgentTimeline(id: string, options: unknown): Promise<{ entries: { item: unknown; seqStart: number; timestamp?: string }[]; startCursor: { epoch: string; seq: number } | null; endCursor?: { epoch: string; seq: number } | null; epoch?: string; reset?: boolean; hasOlder: boolean; error: string | null; gap: boolean; staleCursor: boolean }>;
@@ -49,6 +49,9 @@ export function summarize(request: PermissionRequestShape, max = 160): string {
49
49
  return line.length > max ? `${line.slice(0, max - 1)}…` : line;
50
50
  }
51
51
 
52
+ /** An agent as Paseo's agent list reports it (metadata only: listing never loads an agent). */
53
+ export type ListedAgent = { id: string; status?: string; archivedAt?: string | null; pendingPermissions?: unknown[] | null };
54
+
52
55
  export type Approval = { at: string; agentId: string; tool: string; summary: string; mode: string };
53
56
  export type Decision = { approved: true; mode: string } | { approved: false; reason: "off" | "not-a-tool" | "mode" | "error"; mode?: string | null };
54
57
 
@@ -77,6 +80,24 @@ export class TrustBypass {
77
80
  return { approved: true, mode };
78
81
  }
79
82
 
83
+ /**
84
+ * Prompts that were already pending when Follow-up loaded or updated never raise a new event, so they would wait for
85
+ * the developer. Runs each one through `handle`, the same checks as a new prompt (setting, plain tool, current mode).
86
+ * Only agents the list shows with a pending prompt: those are loaded (an unloaded agent has none), so nothing here
87
+ * loads or wakes an agent. Archived and closed agents are skipped.
88
+ */
89
+ async sweep(agents: readonly ListedAgent[]): Promise<Decision[]> {
90
+ const decisions: Decision[] = [];
91
+ for (const agent of agents) {
92
+ if (agent.archivedAt || agent.status === "closed" || !agent.pendingPermissions?.length) continue;
93
+ for (const request of agent.pendingPermissions) {
94
+ if (typeof request !== "object" || request === null || typeof (request as { id?: unknown }).id !== "string") continue;
95
+ decisions.push(await this.handle(agent, request as PermissionRequestShape));
96
+ }
97
+ }
98
+ return decisions;
99
+ }
100
+
80
101
  /** Appends one line; past keep × 1.5 lines, keeps the newest `keep`. Serialized so concurrent approvals don't race the trim. */
81
102
  private record(entry: Approval): Promise<void> {
82
103
  const keep = this.o.keep ?? 500;