paseo-follow-up 2.6.0-beta.6 → 2.6.0-beta.8
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/client/home-chrome.tsx +8 -4
- package/client/pill.tsx +6 -13
- package/index.server.ts +3 -3
- package/package.json +5 -1
- package/server/agent-actions.ts +9 -1
- package/server/bounded-reply.ts +42 -0
- package/server/daemon.ts +2 -1
- package/server/mcp-source.ts +16 -1
- package/server/mcp.mjs +2 -1
- package/server/report-issue-adapter.ts +49 -10
- package/shared/daemon-url.d.mts +2 -0
- package/shared/daemon-url.mjs +12 -0
- package/shared/finished.ts +2 -0
- package/shared/history.ts +4 -2
package/client/home-chrome.tsx
CHANGED
|
@@ -406,11 +406,15 @@ export function StatusStrip({ theme, model, filter, onFilter, touch, dense }: {
|
|
|
406
406
|
const chips = <>
|
|
407
407
|
{STRIP.filter(s => !touch || counts[s.id] > 0 || filter === s.id).map(s => chip(s.id, s.label, counts[s.id], filter === s.id, () => onFilter(filter === s.id ? null : s.id), s.id === "needs" && counts.needs ? c.statusWarning : undefined))}
|
|
408
408
|
{counts.later > 0 && chip("later", "Later", counts.later, filter === "later", () => onFilter(filter === "later" ? null : "later"))}
|
|
409
|
-
{
|
|
409
|
+
{/* On a phone it sits in the chips' 44 row (a box, not a lineHeight, which a large font would scale), so a wrapped line keeps the strip's rhythm. */}
|
|
410
|
+
{counts.archivable > 0 && (touch
|
|
411
|
+
? <View testID="strip-archivable" style={{ minHeight: 44, justifyContent: "center" }}><Text style={{ color: c.statusSuccess, fontSize: 12, paddingHorizontal: 6 }}>{counts.archivable} to archive</Text></View>
|
|
412
|
+
: <Text style={{ color: c.statusSuccess, fontSize: 12, paddingHorizontal: 6 }}>{counts.archivable} to archive</Text>)}
|
|
410
413
|
</>;
|
|
411
|
-
// Phones: only groups that have something,
|
|
412
|
-
|
|
413
|
-
|
|
414
|
+
// Phones: only groups that have something, wrapping onto a second line when a narrow screen or a large font needs it
|
|
415
|
+
// (nothing-hides-past-the-edge: a sideways scroller cut its last chip at the edge with nothing saying more was there).
|
|
416
|
+
if (touch) return <View accessibilityRole="toolbar" accessibilityLabel="Status"
|
|
417
|
+
style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: 8, paddingHorizontal: 12, paddingVertical: 2 }}>{chips}</View>;
|
|
414
418
|
return <View accessibilityRole="toolbar" accessibilityLabel="Status" style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", columnGap: dense ? 0 : 2, rowGap: 2, paddingHorizontal: dense ? 4 : 10 }}>
|
|
415
419
|
{chips}
|
|
416
420
|
</View>;
|
package/client/pill.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import { View } from "react-native";
|
|
|
5
5
|
import { Pressable, Text } from "./text";
|
|
6
6
|
import { useQuery } from "@tanstack/react-query";
|
|
7
7
|
import { useRpc, type PluginButtonContentProps, type PluginButtonIconProps, type PluginButtonRegistration, type PluginClientContext } from "@getpaseo/plugin/client";
|
|
8
|
-
import { Icon
|
|
8
|
+
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
9
9
|
import { browserStatusRpc } from "../shared/contracts";
|
|
10
10
|
import { activeNeeds, needsYou, type NeedItem } from "../shared/attention";
|
|
11
11
|
import { briefQuestionIds, echoedItems, HEADLINE_ICON, todoLine, HEADLINE_TONE, pillState, todoLabel, withoutBriefQuestions, type PillState } from "../shared/headline";
|
|
@@ -214,18 +214,11 @@ export function PillPopover(props: PluginButtonContentProps & { deps: Deps }) {
|
|
|
214
214
|
<Button theme={props.theme} compact={touch} grow={touch} icon="ArrowRight" title="Sign off & next"
|
|
215
215
|
onPress={() => done(() => { void deps.inbox.signOff([agentId]); deps.openNext(agentId); })} />
|
|
216
216
|
</View>
|
|
217
|
-
{
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
{laterChoices(new Date()).map(([id, title]) => <Chip key={id} title={title.replace(/^In 1 hour$/, "1 hour")} theme={props.theme} compact onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
|
|
223
|
-
</ScrollView>
|
|
224
|
-
</View>
|
|
225
|
-
: <View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 6 }}>
|
|
226
|
-
<Text style={[t.meta, { marginRight: 2 }]}>Later</Text>
|
|
227
|
-
{laterChoices(new Date()).map(([id, title]) => <Chip key={id} title={title} theme={props.theme} compact={touch} onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
|
|
228
|
-
</View>}
|
|
217
|
+
{/* Later's choices wrap onto a second line where they don't fit (nothing-hides-past-the-edge), phones included. */}
|
|
218
|
+
<View style={{ flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: touch ? 8 : 6 }}>
|
|
219
|
+
<Text style={[t.meta, { marginRight: 2 }]}>Later</Text>
|
|
220
|
+
{laterChoices(new Date()).map(([id, title]) => <Chip key={id} title={touch ? title.replace(/^In 1 hour$/, "1 hour") : title} theme={props.theme} compact={touch} onPress={() => done(() => void deps.inbox.snooze([agentId], snoozeUntil(id, new Date())))} />)}
|
|
221
|
+
</View>
|
|
229
222
|
</View>}
|
|
230
223
|
|
|
231
224
|
{/* 3. The workspace's own items, only when there are some. */}
|
package/index.server.ts
CHANGED
|
@@ -1959,9 +1959,9 @@ export default function contribute(server: PluginServerContext) {
|
|
|
1959
1959
|
github: githubApi(), updates: () => updatesView(), call: (method, input) => rpcBridge.call(method, input ?? {}), snapshot: () => store.snapshot(),
|
|
1960
1960
|
resources: () => governor.current(), serverInfo: () => withDaemon(async client => (client as ServerInfoClient).getLastServerInfoMessage?.() as never), logs: logRing,
|
|
1961
1961
|
toolTransport: () => toolTransport, startedAt,
|
|
1962
|
-
// A report about one workspace: its agents from the directory (metadata only, wakes nothing).
|
|
1963
|
-
agents: async workspaceId => ((await gateway.directory.read().catch(() => null))?.agents ?? []).map(r => r.agent).filter(a => a.workspaceId === workspaceId && !a.
|
|
1964
|
-
.map(a => ({ id: a.id, title: a.title ?? null, provider: a.provider, status: a.status })),
|
|
1962
|
+
// A report about one workspace: its agents from the directory (metadata only, wakes nothing); archived ones count, never rows.
|
|
1963
|
+
agents: async workspaceId => ((await gateway.directory.read().catch(() => null))?.agents ?? []).map(r => r.agent).filter(a => a.workspaceId === workspaceId && !a.background)
|
|
1964
|
+
.map(a => ({ id: a.id, title: a.title ?? null, provider: a.provider, status: a.status, archived: !!a.archivedAt, lastActivityAt: a.lastUserMessageAt ?? a.createdAt })),
|
|
1965
1965
|
});
|
|
1966
1966
|
const agentActions = new AgentActions({ timeZone: () => clientTimeZone, autoSendsHeld: () => !governor.allowsBackground(), store, prActions: actions, engine, inbox, priorities: priorityStore, about, agentSettings, wait: { status: currentWait }, prWorkflows: () => prWorkflowView(), rpc: rpcBridge, display: displayBridge, report: { run: (caller, args) => reportKit.reporter.run(caller, args) }, agentTitle: async id => (await api?.agents.ref(id).refresh().catch(() => null))?.agent?.title ?? null,
|
|
1967
1967
|
pins: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paseo-follow-up",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "2.6.0-beta.
|
|
4
|
+
"version": "2.6.0-beta.8",
|
|
5
5
|
"description": "Every agent, one inbox. Follow-up brings what all your coding agents need from you into one ranked list, and follows their work through merge, deploy and after.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"files": [
|
|
@@ -65,6 +65,10 @@
|
|
|
65
65
|
"typescript": "^5.9.3",
|
|
66
66
|
"zod": "^4.4.3"
|
|
67
67
|
},
|
|
68
|
+
"allowScripts": {
|
|
69
|
+
"esbuild": false,
|
|
70
|
+
"fsevents": false
|
|
71
|
+
},
|
|
68
72
|
"license": "MIT",
|
|
69
73
|
"author": "Tom Gringauz",
|
|
70
74
|
"repository": {
|
package/server/agent-actions.ts
CHANGED
|
@@ -33,6 +33,7 @@ import { DEFAULT_SORT, MENU_SORTS } from "../shared/sort";
|
|
|
33
33
|
import { DEFAULT_HOME_VIEW, GROUPINGS, parseHomeView, SHOW_ITEMS } from "../shared/home-arrange";
|
|
34
34
|
import { SCALE } from "../shared/scale";
|
|
35
35
|
import { boundDone, newestFirst, pageInput } from "../shared/paged";
|
|
36
|
+
import { boundReply } from "./bounded-reply";
|
|
36
37
|
import { dispatchInputSchema } from "../shared/dispatch";
|
|
37
38
|
import type { DispatchInput, DispatchPlan } from "./dispatch";
|
|
38
39
|
|
|
@@ -241,8 +242,15 @@ export class AgentActions {
|
|
|
241
242
|
private now: () => number;
|
|
242
243
|
constructor(private d: AgentActionDeps) { this.reviewersFor = d.reviewersFor ?? configuredReviewers; this.now = d.now ?? Date.now; }
|
|
243
244
|
|
|
244
|
-
/**
|
|
245
|
+
/**
|
|
246
|
+
* Runs one tool for a verified root agent. The caller's identity is checked by the RPC before this. Every reply goes
|
|
247
|
+
* through `boundReply`: a stored workspace inside it comes as workspace_status's summary (invariant 63, TOOL_BUDGET).
|
|
248
|
+
*/
|
|
245
249
|
async run(caller: string, tool: AgentTool, raw: unknown): Promise<unknown> {
|
|
250
|
+
return boundReply(await this.dispatch(caller, tool, raw));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
private async dispatch(caller: string, tool: AgentTool, raw: unknown): Promise<unknown> {
|
|
246
254
|
const parsed = TOOL_INPUT[tool].safeParse(raw ?? {});
|
|
247
255
|
if (!parsed.success) throw new Error(`${tool}: ${parsed.error.issues.map(i => `${i.path.join(".") || "arguments"} ${i.message}`).join("; ")}`);
|
|
248
256
|
const args = parsed.data as Record<string, any>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { compact } from "./mcp.mjs";
|
|
2
|
+
import { agentView } from "../shared/history";
|
|
3
|
+
import { TOOL_BUDGET } from "../shared/paged";
|
|
4
|
+
import type { Workspace } from "../shared/model";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An agent tool's answer stays under TOOL_BUDGET (invariant 63). A stored workspace record grows with use: every PR it
|
|
8
|
+
* ever had, every task and question, every batch. A reply that carries one whole (a planned action's confirm returns the
|
|
9
|
+
* workspace it changed) gets it as workspace_status's summary instead (`agentView`, then `compact`): live work whole
|
|
10
|
+
* while it fits, finished items as the newest few and a count with how to page them, fitted to the room the rest of the
|
|
11
|
+
* reply leaves. AgentActions.run passes every action's reply through here; tests/bounded-tools.test.ts scans every tool.
|
|
12
|
+
*/
|
|
13
|
+
export const isWorkspaceRecord = (x: unknown): x is Workspace => {
|
|
14
|
+
const w = x as Partial<Workspace> | null;
|
|
15
|
+
return !!w && typeof w === "object" && typeof w.id === "string" && Array.isArray(w.prs) && Array.isArray(w.obligations) && Array.isArray(w.questions) && Array.isArray(w.batches);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const PLACEHOLDER = Symbol("workspace");
|
|
19
|
+
|
|
20
|
+
/** Replace each workspace record (to depth 4) with `swap(w)`; the same object back when there is none. */
|
|
21
|
+
function replace(value: unknown, swap: (w: Workspace) => unknown, depth = 0): unknown {
|
|
22
|
+
if (isWorkspaceRecord(value)) return swap(value);
|
|
23
|
+
if (depth >= 4 || !value || typeof value !== "object") return value;
|
|
24
|
+
if (Array.isArray(value)) {
|
|
25
|
+
const out = value.map(v => replace(v, swap, depth + 1));
|
|
26
|
+
return out.some((v, i) => v !== value[i]) ? out : value;
|
|
27
|
+
}
|
|
28
|
+
let changed = false;
|
|
29
|
+
const out: Record<string, unknown> = {};
|
|
30
|
+
for (const [k, v] of Object.entries(value)) { out[k] = replace(v, swap, depth + 1); if (out[k] !== v) changed = true; }
|
|
31
|
+
return changed ? out : value;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function boundReply(reply: unknown, budget = TOOL_BUDGET): unknown {
|
|
35
|
+
let count = 0;
|
|
36
|
+
const shell = replace(reply, () => { count++; return PLACEHOLDER; });
|
|
37
|
+
if (!count) return reply;
|
|
38
|
+
const rest = JSON.stringify(shell, (_k, v) => v === PLACEHOLDER ? {} : v)?.length ?? 0;
|
|
39
|
+
const room = Math.max(2_000, Math.floor((budget - rest) / count));
|
|
40
|
+
const summary = (w: Workspace) => compact("workspace_status", {}, agentView(w, { budget: room }, undefined, v => compact("workspace_status", {}, v)));
|
|
41
|
+
return replace(reply, summary);
|
|
42
|
+
}
|
package/server/daemon.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { daemonUrl } from "../shared/daemon-url.mjs";
|
|
1
2
|
import { imageSupport, imagesLeftOff } from "./image-support";
|
|
2
3
|
import { taskAgentStates } from "../shared/task-status";
|
|
3
4
|
import { settleWithin, type Deadline } from "./teardown";
|
|
@@ -118,7 +119,7 @@ export async function daemonOptions(): Promise<Record<string, unknown>> {
|
|
|
118
119
|
let url = process.env.PASEO_DAEMON_URL;
|
|
119
120
|
if (!url) {
|
|
120
121
|
const config = JSON.parse(await readFile(join(paseoHome, "config.json"), "utf8"));
|
|
121
|
-
url =
|
|
122
|
+
url = daemonUrl(config);
|
|
122
123
|
}
|
|
123
124
|
return { url, clientId: "follow-up-worker", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10_000, suppressSendErrors: true, ...(password ? { password } : {}) };
|
|
124
125
|
}
|
package/server/mcp-source.ts
CHANGED
|
@@ -9,6 +9,21 @@ export const mcpSource: string = [
|
|
|
9
9
|
"import { join, delimiter } from \"node:path\";",
|
|
10
10
|
"import { homedir } from \"node:os\";",
|
|
11
11
|
"// Follow-up's words live in one place; scripts/build.mjs inlines them into mcp-source.ts (the bridge runs as one file).",
|
|
12
|
+
"// ---- inlined from shared/daemon-url.mjs by scripts/build.mjs ----",
|
|
13
|
+
"/**",
|
|
14
|
+
" * One config-to-URL rule for the worker and standalone bridge (inlined by scripts/build.mjs).",
|
|
15
|
+
" * Match Paseo's getMainListenAddress: socket/pipe paths are literal; TCP lists use the trimmed first entry.",
|
|
16
|
+
" */",
|
|
17
|
+
"export function daemonUrl(config, override) {",
|
|
18
|
+
" if (override) return override;",
|
|
19
|
+
" const listen = config.daemon?.listen ?? \"127.0.0.1:6767\";",
|
|
20
|
+
" if (listen.startsWith(\"pipe://\") || listen.startsWith(\"unix://\")) return `ws+unix://${listen.slice(7)}:/ws`;",
|
|
21
|
+
" if (listen.startsWith(\"\\\\\\\\.\\\\pipe\\\\\") || listen.startsWith(\"/\") || listen.startsWith(\"~\")) return `ws+unix://${listen}:/ws`;",
|
|
22
|
+
" const main = listen.split(\",\", 1)[0].trim();",
|
|
23
|
+
" return `ws://${/^\\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;",
|
|
24
|
+
"}",
|
|
25
|
+
"",
|
|
26
|
+
"// ---- end of shared/daemon-url.mjs ----",
|
|
12
27
|
"// ---- inlined from shared/agent-text.mjs by scripts/build.mjs ----",
|
|
13
28
|
"/**",
|
|
14
29
|
" * Everything Follow-up says to an agent, in one place (one-place-for-agent-text): the workspace instructions, the role",
|
|
@@ -567,7 +582,7 @@ export const mcpSource: string = [
|
|
|
567
582
|
" let password = process.env.PASEO_PASSWORD;",
|
|
568
583
|
" if (!password && process.env.PASEO_PASSWORD_FILE) password = (await readFile(process.env.PASEO_PASSWORD_FILE, \"utf8\")).trim();",
|
|
569
584
|
" if (!password && home === join(homedir(), \".paseo\")) password = await readFile(join(homedir(), \"paseo-hub/secrets/daemon-password\"), \"utf8\").then(s => s.trim()).catch(() => undefined);",
|
|
570
|
-
" const client = new DaemonClient({ url: process.env.PASEO_DAEMON_URL
|
|
585
|
+
" const client = new DaemonClient({ url: daemonUrl(config, process.env.PASEO_DAEMON_URL), clientId: \"follow-up-mcp\", clientType: \"cli\", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });",
|
|
571
586
|
" try {",
|
|
572
587
|
" await client.connect();",
|
|
573
588
|
" let last;",
|
package/server/mcp.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { existsSync, realpathSync } from "node:fs";
|
|
|
7
7
|
import { join, delimiter } from "node:path";
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
// Follow-up's words live in one place; scripts/build.mjs inlines them into mcp-source.ts (the bridge runs as one file).
|
|
10
|
+
import { daemonUrl } from "../shared/daemon-url.mjs";
|
|
10
11
|
import { bridgeInstructions } from "../shared/agent-text.mjs";
|
|
11
12
|
|
|
12
13
|
/** Set by the worker's prelude (shared/legacy.ts withRuntimePrelude); absent when a test imports this file. */
|
|
@@ -430,7 +431,7 @@ async function call(method, input) {
|
|
|
430
431
|
let password = process.env.PASEO_PASSWORD;
|
|
431
432
|
if (!password && process.env.PASEO_PASSWORD_FILE) password = (await readFile(process.env.PASEO_PASSWORD_FILE, "utf8")).trim();
|
|
432
433
|
if (!password && home === join(homedir(), ".paseo")) password = await readFile(join(homedir(), "paseo-hub/secrets/daemon-password"), "utf8").then(s => s.trim()).catch(() => undefined);
|
|
433
|
-
const client = new DaemonClient({ url: process.env.PASEO_DAEMON_URL
|
|
434
|
+
const client = new DaemonClient({ url: daemonUrl(config, process.env.PASEO_DAEMON_URL), clientId: "follow-up-mcp", clientType: "cli", reconnect: { enabled: false }, connectTimeoutMs: 10000, suppressSendErrors: true, ...(password ? { password } : {}) });
|
|
434
435
|
try {
|
|
435
436
|
await client.connect();
|
|
436
437
|
let last;
|
|
@@ -5,6 +5,9 @@ import { summary, type State, type Workspace } from "../shared/model";
|
|
|
5
5
|
import { checksState } from "../shared/pr-status";
|
|
6
6
|
import type { Resources } from "../shared/resources";
|
|
7
7
|
import type { UpdatesView } from "../shared/updates";
|
|
8
|
+
import { agentView } from "../shared/history";
|
|
9
|
+
import { finishedAgent } from "../shared/finished";
|
|
10
|
+
import { PAGE, TOOL_BUDGET } from "../shared/paged";
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Follow-up's adapter for the shared Report-an-issue module (server/report-issue/): its repository, its tool name,
|
|
@@ -28,10 +31,19 @@ export type FollowUpReportDeps = {
|
|
|
28
31
|
toolTransport: () => string;
|
|
29
32
|
startedAt: number;
|
|
30
33
|
/** A workspace's agents from the directory (metadata only; never loads one), for a report about that workspace. */
|
|
31
|
-
agents?: (workspaceId: string) => Promise<
|
|
34
|
+
agents?: (workspaceId: string) => Promise<ReportAgent[]>;
|
|
32
35
|
now?: () => number;
|
|
33
36
|
};
|
|
34
37
|
|
|
38
|
+
/** One agent of the workspace, from the directory: `archived` and `closed` ones are history (`finishedAgent`). */
|
|
39
|
+
export type ReportAgent = { id: string; title: string | null; provider: string; status: string; archived?: boolean; lastActivityAt?: string | null };
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The room a report's local view may take: TOOL_BUDGET less what the first reply carries beside it (the procedure,
|
|
43
|
+
* the issueGets rows, the note; ~6k). tests/report-subject-budget.test.ts measures the whole reply.
|
|
44
|
+
*/
|
|
45
|
+
export const REPORT_LOCAL_ROOM = TOOL_BUDGET - 10_000;
|
|
46
|
+
|
|
35
47
|
const ago = (ms: number) => { const m = Math.round(ms / 60_000); return m < 60 ? `${m}m` : `${Math.floor(m / 60)}h ${m % 60}m`; };
|
|
36
48
|
const onOff = (v: unknown) => v === true ? "on" : v === false ? "off" : "unknown";
|
|
37
49
|
|
|
@@ -111,22 +123,49 @@ export async function workspaceSubject(d: FollowUpReportDeps, workspaceId: strin
|
|
|
111
123
|
const now = (d.now ?? Date.now)();
|
|
112
124
|
const agents = await d.agents?.(workspaceId).catch(() => []) ?? [];
|
|
113
125
|
const logs = d.logs.recent(40).filter(l => l.includes(workspaceId));
|
|
114
|
-
return { local: workspaceLocal(w, agents, logs, now), section: workspaceSection(w, agents, logs, now), privateTitles: workspaceTexts(w) };
|
|
126
|
+
return { local: workspaceLocal(w, agents, logs, now), section: workspaceSection(w, agents.filter(a => !a.archived), logs, now), privateTitles: workspaceTexts(w) };
|
|
115
127
|
}
|
|
116
128
|
|
|
117
|
-
|
|
129
|
+
/**
|
|
130
|
+
* Follow-up's view of the workspace, bounded like workspace_status (invariant 63's TOOL_BUDGET): `agentView` decides
|
|
131
|
+
* what comes (live work whole while it fits, finished items the newest `PAGE.recentDone` plus a count in `history`,
|
|
132
|
+
* glances when needed) and this only reshapes it into short rows. Live agents are rows (the main agent first, then
|
|
133
|
+
* running ones, newest first, at most `PAGE.toolPage`); closed and archived ones are counts. 2026-11-28, 2.6.0-beta.6:
|
|
134
|
+
* built from the raw lists, one busy workspace's view was 168,664 characters (every PR, agent and task it ever had).
|
|
135
|
+
*/
|
|
136
|
+
function workspaceLocal(w: Workspace, agents: ReportAgent[], logs: string[], now: number) {
|
|
118
137
|
const st = summary(w, now);
|
|
119
|
-
return
|
|
138
|
+
const at = (a: ReportAgent) => { const t = Date.parse(a.lastActivityAt ?? ""); return Number.isFinite(t) ? t : 0; };
|
|
139
|
+
const live = agents.filter(a => !finishedAgent(a))
|
|
140
|
+
.sort((a, b) => Number(b.id === w.mainAgentId) - Number(a.id === w.mainAgentId) || Number(b.status === "running") - Number(a.status === "running") || at(b) - at(a));
|
|
141
|
+
const head = {
|
|
120
142
|
workspaceId: w.id, title: w.title, goal: w.goal, status: `${st.status}: ${st.label}${st.reason ? ` (${st.reason})` : ""}`,
|
|
121
143
|
following: w.enable_tracking, autoSend: w.enable_auto_sends, hold: w.hold, archived: w.archived, sendWait: w.sendWait ?? null, mainBusy: w.mainBusy ?? null,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
agents: agents.map(a => ({ ...a, main: a.id === w.mainAgentId })),
|
|
144
|
+
};
|
|
145
|
+
const rest = {
|
|
146
|
+
agents: live.slice(0, PAGE.toolPage).map(a => ({ id: a.id, title: a.title, provider: a.provider, status: a.status, main: a.id === w.mainAgentId })),
|
|
147
|
+
...(live.length > PAGE.toolPage ? { agentsMore: live.length - PAGE.toolPage } : {}),
|
|
148
|
+
agentsFinished: { closed: agents.filter(a => !a.archived && finishedAgent(a)).length, archived: agents.filter(a => a.archived).length },
|
|
128
149
|
recentWarnings: logs,
|
|
129
150
|
};
|
|
151
|
+
type V = ReturnType<typeof agentView<Workspace>>;
|
|
152
|
+
const rows = (v: V) => ({
|
|
153
|
+
...head,
|
|
154
|
+
prs: v.prs.map(p => {
|
|
155
|
+
const g = p as typeof p & { glance?: true; snapshot: (typeof p.snapshot & { failedChecksCount?: number }) | null };
|
|
156
|
+
return { pr: `${p.repo}#${p.number}`, title: p.snapshot?.title ?? null, state: p.snapshot?.state ?? "unknown", draft: p.snapshot?.draft ?? null,
|
|
157
|
+
checks: !p.snapshot ? "unknown" : g.glance ? (g.snapshot?.failedChecksCount ? "failed" : "not read here") : checksState(p.snapshot),
|
|
158
|
+
conflict: p.snapshot?.conflict ?? null, review: p.snapshot?.reviewDecision ?? null, error: p.error, observed: age(p.snapshot?.observedAt, now) };
|
|
159
|
+
}),
|
|
160
|
+
tasks: v.obligations.map(o => ({ id: o.id, title: o.title, status: o.status })),
|
|
161
|
+
questions: v.questions.map(q => ({ id: q.id, title: q.title, ...(typeof (q as { question?: unknown }).question === "string" ? { question: (q as { question: string }).question } : {}),
|
|
162
|
+
state: q.closed ? "closed" : q.answer ? "answered" : "open" })),
|
|
163
|
+
batches: v.batches.map(b => ({ id: b.id, state: b.state, tasks: b.tasks.length })),
|
|
164
|
+
history: v.history,
|
|
165
|
+
...(v.live && Object.values(v.live).some(x => x.more) ? { live: v.live } : {}),
|
|
166
|
+
...rest,
|
|
167
|
+
});
|
|
168
|
+
return rows(agentView(w, { budget: REPORT_LOCAL_ROOM }, undefined, rows));
|
|
130
169
|
}
|
|
131
170
|
|
|
132
171
|
function workspaceSection(w: Workspace, agents: { id: string; provider: string; status: string }[], logs: string[], now: number) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One config-to-URL rule for the worker and standalone bridge (inlined by scripts/build.mjs).
|
|
3
|
+
* Match Paseo's getMainListenAddress: socket/pipe paths are literal; TCP lists use the trimmed first entry.
|
|
4
|
+
*/
|
|
5
|
+
export function daemonUrl(config, override) {
|
|
6
|
+
if (override) return override;
|
|
7
|
+
const listen = config.daemon?.listen ?? "127.0.0.1:6767";
|
|
8
|
+
if (listen.startsWith("pipe://") || listen.startsWith("unix://")) return `ws+unix://${listen.slice(7)}:/ws`;
|
|
9
|
+
if (listen.startsWith("\\\\.\\pipe\\") || listen.startsWith("/") || listen.startsWith("~")) return `ws+unix://${listen}:/ws`;
|
|
10
|
+
const main = listen.split(",", 1)[0].trim();
|
|
11
|
+
return `ws://${/^\d+$/.test(main) ? `127.0.0.1:${main}` : main}/ws`;
|
|
12
|
+
}
|
package/shared/finished.ts
CHANGED
|
@@ -16,3 +16,5 @@ export function finishedQuestion(q: Pick<Question, "id" | "answer" | "closed">,
|
|
|
16
16
|
export const finishedBatch = (b: { settledAt: string | null; state: string; movedOn?: unknown }): boolean =>
|
|
17
17
|
!!b.movedOn || b.state === "completed" || b.state === "cancelled" || b.state === "blocked" && !!b.settledAt;
|
|
18
18
|
export const finishedPrAction = (a: { state: string }): boolean => a.state !== "sending";
|
|
19
|
+
/** An agent that is archived or closed is history: a count, never a row (a report's local view, invariant 154). */
|
|
20
|
+
export const finishedAgent = (a: { status: string; archived?: boolean | null }): boolean => !!a.archived || a.status === "closed";
|
package/shared/history.ts
CHANGED
|
@@ -55,8 +55,10 @@ type AgentW = Hist & { prs: readonly ListPr[]; obligations: readonly { status: s
|
|
|
55
55
|
* workspace_status: live items whole while they fit, otherwise schema-backed glances and live evidence pages.
|
|
56
56
|
* Every finished kind keeps its newest `PAGE.recentDone`; evidence pages never empty other sections. A busy workspace
|
|
57
57
|
* (350 merged PRs, 400 settled batches) made the summary ~207k characters, over a tool result's limit.
|
|
58
|
+
* `budget` is the room `sent(view)` may take: TOOL_BUDGET for workspace_status, less where the view is one part of a
|
|
59
|
+
* larger reply (a report's local view, an action's receipt; server/bounded-reply.ts).
|
|
58
60
|
*/
|
|
59
|
-
export function agentView<W extends AgentW, X extends object = {}>(w: W, { kind, live, offset, limit }: { kind?: HistoryKind; live?: HistoryKind; offset?: number; limit?: number } = {}, extra?: X, sent: (view: W & X & { history: AgentHistory; live?: AgentHistory }) => unknown = view => view): W & X & { history: AgentHistory; live?: AgentHistory } {
|
|
61
|
+
export function agentView<W extends AgentW, X extends object = {}>(w: W, { kind, live, offset, limit, budget = TOOL_BUDGET }: { kind?: HistoryKind; live?: HistoryKind; offset?: number; limit?: number; budget?: number } = {}, extra?: X, sent: (view: W & X & { history: AgentHistory; live?: AgentHistory }) => unknown = view => view): W & X & { history: AgentHistory; live?: AgentHistory } {
|
|
60
62
|
// RPC validation rejects ambiguous selectors; direct readers still receive useful state.
|
|
61
63
|
if (kind) live = undefined;
|
|
62
64
|
const requested = Math.min(limit ?? PAGE.toolPage, PAGE.maxLimit);
|
|
@@ -65,7 +67,7 @@ export function agentView<W extends AgentW, X extends object = {}>(w: W, { kind,
|
|
|
65
67
|
const view = { ...agentViewOf(w, { kind, live, offset, limit: size, compactLive, glanceChars, liveGlances }), ...(extra ?? {}) } as W & X & { history: AgentHistory; live?: AgentHistory };
|
|
66
68
|
// Measure what the transport sends. Compact all live sections before shrinking an evidence page;
|
|
67
69
|
// each other section keeps its glance, including all five recent records of every finished kind.
|
|
68
|
-
if (JSON.stringify(sent(view)).length <=
|
|
70
|
+
if (JSON.stringify(sent(view)).length <= budget) return view;
|
|
69
71
|
if (!compactLive) { compactLive = true; continue; }
|
|
70
72
|
if ((kind || live) && size > 1) { size = Math.max(1, Math.floor(size / 2)); continue; }
|
|
71
73
|
if (glanceChars > 60) { glanceChars = Math.floor(glanceChars / 2); continue; }
|