@omercnet/paseo-pr-radar 3.2.2 → 3.2.3-next.492.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.
- package/README.md +3 -1
- package/client/directory-load.ts +4 -2
- package/client/directory-observation.ts +42 -7
- package/client/radar.ts +19 -2
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -29,7 +29,9 @@ DevTools before capture. Both PNGs come from an isolated Paseo test daemon at 2
|
|
|
29
29
|
- Ready: authored pull requests that are mergeable with settled checks and reviews.
|
|
30
30
|
- Viewer labels: `YOURS`, `REVIEW`, and `EXTERNAL`.
|
|
31
31
|
- Contextual actions: ask an existing agent or start one in the linked workspace.
|
|
32
|
-
- Linked workspaces and agents include those in background workspaces.
|
|
32
|
+
- Linked workspaces and agents include those in background workspaces. Helpers, meaning background
|
|
33
|
+
agents that Paseo hides from tabs, lists and attention, never appear on a row. They also do not
|
|
34
|
+
count toward its active agents, attention, permission state or the sidebar count.
|
|
33
35
|
|
|
34
36
|
Paseo supplies normalized workspace pull request status. A daemon-side plugin handler uses the authenticated `gh` CLI to distinguish authored pull requests from review requests. If viewer lookup fails, PR Radar falls back conservatively and does not claim that a row needs the user.
|
|
35
37
|
|
package/client/directory-load.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type AgentEntry, isHelperAgent, type PaseoApi, type PaseoWorkspace } from "./radar";
|
|
2
2
|
|
|
3
3
|
const PAGE_LIMIT = 200;
|
|
4
4
|
const MAX_PAGES = 10;
|
|
5
5
|
|
|
6
|
+
// `includeBackground` keeps user agents in background workspaces, but on hosts with background
|
|
7
|
+
// agents it also returns helpers, so they are dropped here.
|
|
6
8
|
export async function loadAgents(paseo: PaseoApi) {
|
|
7
9
|
const entries: AgentEntry[] = [];
|
|
8
10
|
let cursor: string | undefined;
|
|
@@ -13,7 +15,7 @@ export async function loadAgents(paseo: PaseoApi) {
|
|
|
13
15
|
sort: [{ key: "created_at", direction: "desc" }],
|
|
14
16
|
page: { limit: PAGE_LIMIT, ...(cursor ? { cursor } : {}) },
|
|
15
17
|
});
|
|
16
|
-
entries.push(...result.entries);
|
|
18
|
+
entries.push(...result.entries.filter((entry) => !isHelperAgent(entry.agent)));
|
|
17
19
|
truncated = result.pageInfo.hasMore;
|
|
18
20
|
cursor = result.pageInfo.nextCursor ?? undefined;
|
|
19
21
|
if (!truncated || !cursor) break;
|
|
@@ -1,4 +1,34 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { isHelperAgent, type PaseoApi } from "./radar";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Tracks helpers seen on the agent stream so their updates do not refetch the directory. Helpers
|
|
5
|
+
* are fixed at creation, so an upsert identifies one and the later removal reuses that knowledge.
|
|
6
|
+
* Anything unrecognised still invalidates.
|
|
7
|
+
*/
|
|
8
|
+
function helperUpdateFilter() {
|
|
9
|
+
const helperIds = new Set<string>();
|
|
10
|
+
return (message: unknown): boolean => {
|
|
11
|
+
if (typeof message !== "object" || message === null) return false;
|
|
12
|
+
const { type, payload } = message as {
|
|
13
|
+
type?: unknown;
|
|
14
|
+
payload?: {
|
|
15
|
+
kind?: unknown;
|
|
16
|
+
agent?: { id?: unknown } | null;
|
|
17
|
+
agentId?: unknown;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
if (type !== "agent_update" || !payload) return false;
|
|
21
|
+
if (payload.kind === "upsert" && payload.agent && typeof payload.agent.id === "string") {
|
|
22
|
+
if (!isHelperAgent(payload.agent)) return false;
|
|
23
|
+
helperIds.add(payload.agent.id);
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (payload.kind === "remove" && typeof payload.agentId === "string") {
|
|
27
|
+
return helperIds.delete(payload.agentId);
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
2
32
|
|
|
3
33
|
export function observeDirectoryInvalidation(
|
|
4
34
|
paseo: PaseoApi,
|
|
@@ -17,10 +47,13 @@ export function observeDirectoryInvalidation(
|
|
|
17
47
|
if (!stopped) invalidate();
|
|
18
48
|
}, debounceMs);
|
|
19
49
|
};
|
|
20
|
-
const attach = (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
50
|
+
const attach = (
|
|
51
|
+
subscription: {
|
|
52
|
+
subscribe(observer: { snapshot(): void; update(message: unknown): void }): () => void;
|
|
53
|
+
release(): Promise<void>;
|
|
54
|
+
},
|
|
55
|
+
ignore: (message: unknown) => boolean = () => false,
|
|
56
|
+
) => {
|
|
24
57
|
subscriptions.push(subscription);
|
|
25
58
|
if (stopped) {
|
|
26
59
|
void subscription.release().catch(() => undefined);
|
|
@@ -29,14 +62,16 @@ export function observeDirectoryInvalidation(
|
|
|
29
62
|
unsubscribes.push(
|
|
30
63
|
subscription.subscribe({
|
|
31
64
|
snapshot: scheduleInvalidation,
|
|
32
|
-
update:
|
|
65
|
+
update: (message) => {
|
|
66
|
+
if (!ignore(message)) scheduleInvalidation();
|
|
67
|
+
},
|
|
33
68
|
}),
|
|
34
69
|
);
|
|
35
70
|
};
|
|
36
71
|
|
|
37
72
|
void paseo.agents
|
|
38
73
|
.list({ subscribe: {}, includeBackground: true, signal: lifetime.signal })
|
|
39
|
-
.then(({ subscription }) => attach(subscription))
|
|
74
|
+
.then(({ subscription }) => attach(subscription, helperUpdateFilter()))
|
|
40
75
|
.catch(() => undefined);
|
|
41
76
|
void paseo.workspaces
|
|
42
77
|
.list({ subscribe: {}, includeBackground: true })
|
package/client/radar.ts
CHANGED
|
@@ -117,7 +117,22 @@ function agentTitle(entry: AgentEntry): string {
|
|
|
117
117
|
return entry.agent.title?.trim() || entry.agent.id.slice(0, 7);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
/**
|
|
121
|
+
* Helpers are background agents (fixed at creation) or legacy internal agents. Paseo hides them
|
|
122
|
+
* from tabs, lists and attention. `includeBackground` still admits them, because it also admits
|
|
123
|
+
* user agents in background workspaces, so callers filter on the agent's own flags. The flags are
|
|
124
|
+
* read structurally: SDK lines before 0.16 do not declare `background`.
|
|
125
|
+
*/
|
|
126
|
+
export function isHelperAgent(agent: object): boolean {
|
|
127
|
+
return (
|
|
128
|
+
("background" in agent && agent.background === true) ||
|
|
129
|
+
("internal" in agent && agent.internal === true)
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** A PR row's view of an agent, or null for a helper, which never belongs on a row. */
|
|
134
|
+
export function toRadarAgent(entry: AgentEntry): RadarAgent | null {
|
|
135
|
+
if (isHelperAgent(entry.agent)) return null;
|
|
121
136
|
return {
|
|
122
137
|
id: entry.agent.id,
|
|
123
138
|
title: agentTitle(entry),
|
|
@@ -329,8 +344,10 @@ export function buildRadarSnapshot(
|
|
|
329
344
|
for (const entry of entries) {
|
|
330
345
|
const workspaceId = entry.agent.workspaceId;
|
|
331
346
|
if (!workspaceId) continue;
|
|
347
|
+
const agent = toRadarAgent(entry);
|
|
348
|
+
if (!agent) continue;
|
|
332
349
|
const agents = agentsByWorkspace.get(workspaceId) ?? [];
|
|
333
|
-
agents.push(
|
|
350
|
+
agents.push(agent);
|
|
334
351
|
agentsByWorkspace.set(workspaceId, agents);
|
|
335
352
|
}
|
|
336
353
|
for (const agents of agentsByWorkspace.values()) sortAgents(agents);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-pr-radar",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.3-next.492.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A viewer-aware delivery queue for pull requests linked to Paseo workspaces.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@biomejs/biome": "^2.5.10",
|
|
51
|
-
"@getpaseo/cli": "0.16.0-beta.
|
|
52
|
-
"@getpaseo/client": "0.16.0-beta.
|
|
53
|
-
"@getpaseo/plugin": "0.16.0-beta.
|
|
54
|
-
"@getpaseo/protocol": "0.16.0-beta.
|
|
51
|
+
"@getpaseo/cli": "0.16.0-beta.2",
|
|
52
|
+
"@getpaseo/client": "0.16.0-beta.2",
|
|
53
|
+
"@getpaseo/plugin": "0.16.0-beta.2",
|
|
54
|
+
"@getpaseo/protocol": "0.16.0-beta.2",
|
|
55
55
|
"@tanstack/react-query": "^5.102.3",
|
|
56
56
|
"@types/node": "^24.10.1",
|
|
57
57
|
"@types/react": "^19.2.18",
|