paseo-office 0.2.6 → 0.2.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/alert-card.tsx +195 -0
- package/client/host-switches.tsx +71 -0
- package/client/host-work.tsx +97 -0
- package/client/machine-card.tsx +22 -2
- package/client/office-surface.tsx +15 -0
- package/client/timeline-card.tsx +29 -0
- package/client/use-alerts.ts +71 -0
- package/client/world/adapter.ts +30 -1
- package/client/world/use-world-feed.ts +6 -4
- package/client/world/world-api.ts +2 -0
- package/docs/office.md +49 -0
- package/index.server.ts +45 -1
- package/package.json +1 -1
- package/server/forgotten-work.ts +104 -0
- package/server/live-ports.ts +7 -0
- package/server/watchers.ts +308 -0
- package/shared/alerts.ts +48 -0
- package/shared/contracts.ts +26 -0
- package/shared/forgotten.ts +71 -0
- package/shared/settings.ts +10 -1
- package/shared/timeline.ts +27 -0
package/client/world/adapter.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlanUsage } from "../../shared/plan-usage.js";
|
|
2
|
+
import type { CacheClock } from "../../shared/settings.js";
|
|
2
3
|
import { shirtColor } from "../../shared/appearance.js";
|
|
3
4
|
import type { OfficeBrand } from "../brand.js";
|
|
4
5
|
import {
|
|
@@ -73,6 +74,7 @@ function subId(parentId: string, callId: string): string {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
const NOBODY_OUT: ReadonlyMap<string, string> = new Map();
|
|
77
|
+
const CACHE_MS = { "5m": 5 * 60_000, "1h": 60 * 60_000 } as const;
|
|
76
78
|
|
|
77
79
|
/** The plans as the scene reads them: a name and how much of each limit is used. */
|
|
78
80
|
export function worldLimits(usage: readonly PlanUsage[]): WorldLimit[] {
|
|
@@ -85,12 +87,35 @@ export function worldLimits(usage: readonly PlanUsage[]): WorldLimit[] {
|
|
|
85
87
|
}));
|
|
86
88
|
}
|
|
87
89
|
|
|
90
|
+
/**
|
|
91
|
+
* A resting person's prompt cache, guessed: warm for the setting's time after the turn's end.
|
|
92
|
+
* Nothing for whoever is not resting, when the setting is off, or when the host did not say when
|
|
93
|
+
* the turn ended.
|
|
94
|
+
*/
|
|
95
|
+
function cacheOf(
|
|
96
|
+
agent: OfficeAgent,
|
|
97
|
+
resting: boolean,
|
|
98
|
+
idle: number,
|
|
99
|
+
cacheClock: CacheClock,
|
|
100
|
+
): Pick<WorldSession, "cache"> {
|
|
101
|
+
if (!resting || cacheClock === "off" || !Number.isFinite(idle)) return {};
|
|
102
|
+
return {
|
|
103
|
+
cache: {
|
|
104
|
+
until: idle + CACHE_MS[cacheClock],
|
|
105
|
+
ttl: cacheClock,
|
|
106
|
+
tokens: agent.context?.usedTokens ?? 0,
|
|
107
|
+
guessed: true,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
88
112
|
function toSession(
|
|
89
113
|
row: OfficeRow,
|
|
90
114
|
team: string,
|
|
91
115
|
checks: WorkspacePullRequest["checks"] | undefined,
|
|
92
116
|
born: Readonly<Record<string, string>>,
|
|
93
117
|
out: ReadonlyMap<string, string>,
|
|
118
|
+
cacheClock: CacheClock,
|
|
94
119
|
): WorldSession {
|
|
95
120
|
const { agent } = row;
|
|
96
121
|
const title = agentTitle(agent);
|
|
@@ -119,6 +144,7 @@ function toSession(
|
|
|
119
144
|
? { doneAt: idle, idleSince: agent.idleSince }
|
|
120
145
|
: {}),
|
|
121
146
|
stuck,
|
|
147
|
+
...cacheOf(agent, status === "rest" && !stuck, idle, cacheClock),
|
|
122
148
|
...(row.waitingOn > 0 ? { waitingOn: row.waitingOn } : {}),
|
|
123
149
|
subs: (row.subagents ?? []).map((sub) => ({ id: subId(agent.id, sub.id), type: sub.type })),
|
|
124
150
|
...(agent.context === undefined && agent.costUsd === undefined
|
|
@@ -142,11 +168,14 @@ export function worldPeople(
|
|
|
142
168
|
desks: number,
|
|
143
169
|
born: Readonly<Record<string, string>> = {},
|
|
144
170
|
out: ReadonlyMap<string, string> = NOBODY_OUT,
|
|
171
|
+
cacheClock: CacheClock = "off",
|
|
145
172
|
): WorldPeople {
|
|
146
173
|
const rows = model.rooms.flatMap((room) =>
|
|
147
174
|
room.rows.map((row) => ({ row, team: room.name, checks: room.workspace?.pullRequest?.checks })),
|
|
148
175
|
);
|
|
149
|
-
const all = rows.map(({ row, team, checks }) =>
|
|
176
|
+
const all = rows.map(({ row, team, checks }) =>
|
|
177
|
+
toSession(row, team, checks, born, out, cacheClock),
|
|
178
|
+
);
|
|
150
179
|
const order = new Map(all.map((session, index) => [session.id, index]));
|
|
151
180
|
const seated =
|
|
152
181
|
all.length <= desks
|
|
@@ -103,9 +103,13 @@ export function useWorldFeed(
|
|
|
103
103
|
// Whose plan is used up is named on their session, so the scene knows who takes the break.
|
|
104
104
|
const usage = usePlanUsageValue();
|
|
105
105
|
const out = useMemo(() => providersOut(usage, Date.now()), [usage]);
|
|
106
|
+
// The host's settings: the cache clock here, streamer mode and the sticky notes below.
|
|
107
|
+
const host = useSettings(officeHostSettings);
|
|
108
|
+
const hostValues = host.status === "ready" ? host.values : null;
|
|
109
|
+
const cacheClock = hostValues?.cacheClock ?? "off";
|
|
106
110
|
const people = useMemo(
|
|
107
|
-
() => worldPeople(model, PLAN_DESKS[plan], life?.born, out),
|
|
108
|
-
[model, plan, life?.born, out],
|
|
111
|
+
() => worldPeople(model, PLAN_DESKS[plan], life?.born, out, cacheClock),
|
|
112
|
+
[model, plan, life?.born, out, cacheClock],
|
|
109
113
|
);
|
|
110
114
|
useEffect(() => {
|
|
111
115
|
const scene = world.current;
|
|
@@ -128,8 +132,6 @@ export function useWorldFeed(
|
|
|
128
132
|
}, [worldReadings, api]);
|
|
129
133
|
|
|
130
134
|
// The host's: whether bubbles name what a person is at, and the owner's notes on the whiteboard.
|
|
131
|
-
const host = useSettings(officeHostSettings);
|
|
132
|
-
const hostValues = host.status === "ready" ? host.values : null;
|
|
133
135
|
const streamer = hostValues?.streamerMode ?? null;
|
|
134
136
|
const notesText = hostValues?.stickyNotes ?? null;
|
|
135
137
|
useEffect(() => {
|
|
@@ -30,6 +30,8 @@ export interface WorldSession {
|
|
|
30
30
|
git: { repo: string; ci?: "red" | "green"; born?: string };
|
|
31
31
|
/** At work, waiting for the user's answer, or resting. */
|
|
32
32
|
status: "work" | "wait" | "rest";
|
|
33
|
+
/** The prompt cache's clock, guessed from the turn's end: the cup on a resting desk steams until `until` (epoch ms). */
|
|
34
|
+
cache?: { until: number; ttl: "5m" | "1h"; tokens: number; guessed: true };
|
|
33
35
|
/** The plan the person runs on, only while that plan is used up: named on their tag, and they take a break. */
|
|
34
36
|
acct?: string;
|
|
35
37
|
/** Which mark the scene puts on the person's screen. */
|
package/docs/office.md
CHANGED
|
@@ -516,6 +516,55 @@ surface is open on some device, at the directory's changes and the 5-second acti
|
|
|
516
516
|
the office was closed is a gap in every lane, not a rest, and the week's figures count only what
|
|
517
517
|
was seen. `office.timeline.request` reads it.
|
|
518
518
|
|
|
519
|
+
## What the office notices
|
|
520
|
+
|
|
521
|
+
Upstream does these with Claude Code hooks. Here the office's server does them from what it reads
|
|
522
|
+
anyway: each running agent's newest timeline entries every 5 seconds, and the directory
|
|
523
|
+
(`server/watchers.ts`). So they work for every provider, only while an office surface is open, and
|
|
524
|
+
a few seconds after the fact, not before it. Each is a card in the Attention strip; opening it
|
|
525
|
+
shows what can be done.
|
|
526
|
+
|
|
527
|
+
- **A loop.** The same call (the tool and what it was given) failed three times running. **Stop**
|
|
528
|
+
ends the turn; **Send a hint** sends a line into it. It goes when the agent gets past it or its
|
|
529
|
+
turn ends.
|
|
530
|
+
- **A refused call.** The provider's auto mode refused a call. The card has the call and the
|
|
531
|
+
reason, for half an hour. Nothing waits on it.
|
|
532
|
+
- **Two agents in one file.** Both changed the same path within ten minutes. **Tell both** sends
|
|
533
|
+
each a line about the other.
|
|
534
|
+
- **A taken port.** A command failed with "address already in use". **Tell the agent** sends it a
|
|
535
|
+
line to use another port, naming the session whose server holds it when the Host readings say.
|
|
536
|
+
- **Failing checks.** The checks of a workspace's pull request fail. **Fix it** sends the failing
|
|
537
|
+
checks to an agent of that workspace that is resting; while none rests, the card says so.
|
|
538
|
+
|
|
539
|
+
A line sent from a card joins the agent's running turn ("steer"), except Fix it, which is a
|
|
540
|
+
prompt. With streamer mode on, a card names the tool and not the file or the command.
|
|
541
|
+
|
|
542
|
+
**Pinned notes** (Settings) are said again to an agent whose conversation is compacted during a
|
|
543
|
+
turn, as a line into that turn. A compaction of a resting agent sends nothing, since that would
|
|
544
|
+
start a turn.
|
|
545
|
+
|
|
546
|
+
Not done here: blocking a call before it runs and undoing a turn's edits. Both need real Claude
|
|
547
|
+
Code hooks written into the host's `~/.claude/settings.json`.
|
|
548
|
+
|
|
549
|
+
## Plan and machine tools
|
|
550
|
+
|
|
551
|
+
- **What eats your plan.** Under This week in the Timeline card: the five agents that used the
|
|
552
|
+
most in the last seven days, by cost where their provider reports one and by time at work
|
|
553
|
+
otherwise. It is as detailed as what Paseo reports per agent, and counts what the office saw.
|
|
554
|
+
- **Forgotten work.** In the Host card, **Check** looks in each workspace's folder, and in the
|
|
555
|
+
other worktrees of its repository, for files not committed, commits no remote has, and stashes
|
|
556
|
+
(`office.forgotten.request`, `server/forgotten-work.ts`). It answers with counts only. It runs
|
|
557
|
+
git, so it reads when asked, not on a timer.
|
|
558
|
+
- **Models.** The Host card lists each agent that has sub-agents with its model and the models
|
|
559
|
+
they run on. A provider's own sub-agents (Claude's Agent tool) are not Paseo agents and have no
|
|
560
|
+
model the office can read.
|
|
561
|
+
- **The cache clock.** On the 3D floor a resting desk has a cup that steams while the session's
|
|
562
|
+
prompt cache is taken to be warm, and stands cold after. Paseo does not report the cache, so
|
|
563
|
+
it is an estimate from the end of the last turn: an hour by default, five minutes or no cup in
|
|
564
|
+
Settings.
|
|
565
|
+
- **Accounts.** The Host card's plan limits are per provider. Switching accounts is the
|
|
566
|
+
`account-switcher` plugin's; the office handles no sign-in.
|
|
567
|
+
|
|
519
568
|
## History vault and the prompt report
|
|
520
569
|
|
|
521
570
|
**History vault** (Settings, host-wide, off by default) has the office keep what is said in each
|
package/index.server.ts
CHANGED
|
@@ -46,6 +46,9 @@ import { probeSentry } from "./server/incidents-sentry.js";
|
|
|
46
46
|
import { createIncidentsStore, type IncidentsStore } from "./server/incidents-store.js";
|
|
47
47
|
import { projectPlanUsage } from "./server/plan-usage.js";
|
|
48
48
|
import { promptReport } from "./shared/vault.js";
|
|
49
|
+
import { pinnedNote } from "./shared/alerts.js";
|
|
50
|
+
import { createWatchers } from "./server/watchers.js";
|
|
51
|
+
import { readForgotten, type Checkout } from "./server/forgotten-work.js";
|
|
49
52
|
import {
|
|
50
53
|
VAULT_TAIL_LIMIT,
|
|
51
54
|
VaultFileSchema,
|
|
@@ -128,6 +131,9 @@ import {
|
|
|
128
131
|
notesModesRpc,
|
|
129
132
|
planUsageRpc,
|
|
130
133
|
timelineRpc,
|
|
134
|
+
alertDismissRpc,
|
|
135
|
+
alertsRpc,
|
|
136
|
+
forgottenRpc,
|
|
131
137
|
vaultReportRpc,
|
|
132
138
|
vaultSearchRpc,
|
|
133
139
|
vaultTalkRpc,
|
|
@@ -235,7 +241,24 @@ export function createOfficePlugin(
|
|
|
235
241
|
const holder = createPaseoHolder();
|
|
236
242
|
// Off until the settings are read: nothing is named before the host has said it may be.
|
|
237
243
|
let stepsNamed = false;
|
|
238
|
-
|
|
244
|
+
// The owner's pinned notes; empty until the settings are read.
|
|
245
|
+
let pinnedNotes = "";
|
|
246
|
+
const watchers = createWatchers({
|
|
247
|
+
now: () => deps.clock.now(),
|
|
248
|
+
named: () => stepsNamed,
|
|
249
|
+
pinnedNotes: () => pinnedNotes,
|
|
250
|
+
remind: (agentId, notes) => {
|
|
251
|
+
if (!holder.held()) return;
|
|
252
|
+
holder
|
|
253
|
+
.require()
|
|
254
|
+
.agents.ref(agentId)
|
|
255
|
+
.send(pinnedNote(notes), { activeTurnBehavior: "steer" })
|
|
256
|
+
.catch((error: unknown) =>
|
|
257
|
+
log(`[office] pinned notes to ${agentId}: ${errorMessage(error)}`),
|
|
258
|
+
);
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
const hubPorts = liveHubPorts(holder, deps.clock, log, () => stepsNamed, watchers.tail);
|
|
239
262
|
// Set once its file is read; what the office sees before that is not kept.
|
|
240
263
|
let timeline: TimelineLog | null = null;
|
|
241
264
|
const hub = createHub({
|
|
@@ -279,6 +302,15 @@ export function createOfficePlugin(
|
|
|
279
302
|
);
|
|
280
303
|
stopVault = hub.watch(vault.view);
|
|
281
304
|
})().catch((error: unknown) => log(`[office] history vault unavailable: ${errorMessage(error)}`));
|
|
305
|
+
const stopWatchers = hub.watch(watchers.view);
|
|
306
|
+
// The workspaces' folders as the directory last reported them, for the forgotten-work read.
|
|
307
|
+
let checkouts: Checkout[] = [];
|
|
308
|
+
const stopCheckouts = hub.watch((view) => {
|
|
309
|
+
checkouts = (view?.workspaces ?? []).flatMap((workspace) => {
|
|
310
|
+
const folder = view?.folders?.[workspace.id];
|
|
311
|
+
return folder ? [{ workspaceId: workspace.id, name: workspace.name, folder }] : [];
|
|
312
|
+
});
|
|
313
|
+
});
|
|
282
314
|
let stopTimeline: (() => void) | undefined;
|
|
283
315
|
const timelineReady = (async () => {
|
|
284
316
|
const kept = (await deps.timelineFile?.load()) ?? null;
|
|
@@ -513,6 +545,7 @@ export function createOfficePlugin(
|
|
|
513
545
|
agentToolsOn = false;
|
|
514
546
|
stepsNamed = false;
|
|
515
547
|
vaultOn = false;
|
|
548
|
+
pinnedNotes = "";
|
|
516
549
|
office.setPickupEnabled(false);
|
|
517
550
|
const message = `The office's settings cannot be read: ${reason}`;
|
|
518
551
|
log(`[office] ${message}`);
|
|
@@ -534,6 +567,7 @@ export function createOfficePlugin(
|
|
|
534
567
|
agentToolsOn = state.values.agentTools;
|
|
535
568
|
stepsNamed = !state.values.streamerMode;
|
|
536
569
|
vaultOn = state.values.historyVault;
|
|
570
|
+
pinnedNotes = state.values.pinnedNotes;
|
|
537
571
|
office.setPickupEnabled(agentToolsOn && holder.held());
|
|
538
572
|
weather.settingsChanged(state.values);
|
|
539
573
|
await notesSchedule.sync(state.values);
|
|
@@ -743,6 +777,14 @@ export function createOfficePlugin(
|
|
|
743
777
|
const start = Math.max(from, end - TIMELINE_KEEP_MS);
|
|
744
778
|
return { ok: true as const, timeline: timeline.read(start, end) };
|
|
745
779
|
});
|
|
780
|
+
server.handle(forgottenRpc, async () => ({
|
|
781
|
+
items: await readForgotten(checkouts, execCommand),
|
|
782
|
+
}));
|
|
783
|
+
server.handle(alertsRpc, async () => ({ alerts: watchers.alerts() }));
|
|
784
|
+
server.handle(alertDismissRpc, async ({ id }) => {
|
|
785
|
+
watchers.dismiss(id);
|
|
786
|
+
return { alerts: watchers.alerts() };
|
|
787
|
+
});
|
|
746
788
|
server.handle(vaultSearchRpc, async ({ query }) => {
|
|
747
789
|
await vaultReady;
|
|
748
790
|
return { on: vaultOn, hits: vaultOn ? (vault?.search(query) ?? []) : [] };
|
|
@@ -974,6 +1016,8 @@ export function createOfficePlugin(
|
|
|
974
1016
|
await lifeReady;
|
|
975
1017
|
stopLife?.();
|
|
976
1018
|
stopTimeline?.();
|
|
1019
|
+
stopWatchers();
|
|
1020
|
+
stopCheckouts();
|
|
977
1021
|
stopVault?.();
|
|
978
1022
|
await vaultSaves?.flush();
|
|
979
1023
|
await timelineSaves?.flush();
|
package/package.json
CHANGED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { Forgotten } from "../shared/forgotten.js";
|
|
2
|
+
import type { Exec } from "./repo-age.js";
|
|
3
|
+
|
|
4
|
+
/** The most checkouts looked at in one read. */
|
|
5
|
+
export const FORGOTTEN_MAX = 40;
|
|
6
|
+
|
|
7
|
+
export interface Checkout {
|
|
8
|
+
workspaceId: string | null;
|
|
9
|
+
name: string;
|
|
10
|
+
folder: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function lines(text: string): string[] {
|
|
14
|
+
return text.split("\n").filter((line) => line.trim() !== "");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The lines `git` prints for these arguments in a folder; null when git cannot say. */
|
|
18
|
+
async function git(exec: Exec, folder: string, args: string[]): Promise<string[] | null> {
|
|
19
|
+
try {
|
|
20
|
+
const { stdout } = await exec("git", args, {
|
|
21
|
+
cwd: folder,
|
|
22
|
+
timeout: 10_000,
|
|
23
|
+
maxBuffer: 1 << 22,
|
|
24
|
+
// Reading must not take a lock an agent's own git is waiting for.
|
|
25
|
+
env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" },
|
|
26
|
+
});
|
|
27
|
+
return lines(stdout);
|
|
28
|
+
} catch {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A repository's other worktrees: the folders `git worktree list` names besides the ones given. */
|
|
34
|
+
async function otherWorktrees(
|
|
35
|
+
exec: Exec,
|
|
36
|
+
folder: string,
|
|
37
|
+
known: ReadonlySet<string>,
|
|
38
|
+
): Promise<string[]> {
|
|
39
|
+
const listed = await git(exec, folder, ["worktree", "list", "--porcelain"]);
|
|
40
|
+
if (listed === null) return [];
|
|
41
|
+
return listed
|
|
42
|
+
.filter((line) => line.startsWith("worktree "))
|
|
43
|
+
.map((line) => line.slice("worktree ".length))
|
|
44
|
+
.filter((path) => !known.has(path));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function readCheckout(exec: Exec, checkout: Checkout): Promise<Forgotten | null> {
|
|
48
|
+
const changed = await git(exec, checkout.folder, ["status", "--porcelain"]);
|
|
49
|
+
// Not a repository, or one git cannot read: nothing to say of it.
|
|
50
|
+
if (changed === null) return null;
|
|
51
|
+
// Commits no remote has: also the ones of a branch that was never pushed.
|
|
52
|
+
const unpushed = await git(exec, checkout.folder, [
|
|
53
|
+
"log",
|
|
54
|
+
"--oneline",
|
|
55
|
+
"HEAD",
|
|
56
|
+
"--not",
|
|
57
|
+
"--remotes",
|
|
58
|
+
]);
|
|
59
|
+
const stashes = await git(exec, checkout.folder, ["stash", "list"]);
|
|
60
|
+
const found = {
|
|
61
|
+
name: checkout.name,
|
|
62
|
+
workspaceId: checkout.workspaceId,
|
|
63
|
+
changed: changed.length,
|
|
64
|
+
unpushed: unpushed?.length ?? 0,
|
|
65
|
+
stashes: stashes?.length ?? 0,
|
|
66
|
+
};
|
|
67
|
+
return found.changed + found.unpushed + found.stashes === 0 ? null : found;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The checkouts with unfinished work: each workspace's folder, and the worktrees of their
|
|
72
|
+
* repositories that no workspace has. Counts only: no file name, branch or message is read out.
|
|
73
|
+
* A stash belongs to the repository, so every worktree of it reports the same stashes; they are
|
|
74
|
+
* counted on the first.
|
|
75
|
+
*/
|
|
76
|
+
export async function readForgotten(
|
|
77
|
+
workspaces: readonly Checkout[],
|
|
78
|
+
exec: Exec,
|
|
79
|
+
): Promise<Forgotten[]> {
|
|
80
|
+
const known = new Set(workspaces.map((workspace) => workspace.folder));
|
|
81
|
+
const checkouts: Checkout[] = workspaces.slice(0, FORGOTTEN_MAX);
|
|
82
|
+
for (const workspace of workspaces) {
|
|
83
|
+
if (checkouts.length >= FORGOTTEN_MAX) break;
|
|
84
|
+
for (const path of await otherWorktrees(exec, workspace.folder, known)) {
|
|
85
|
+
known.add(path);
|
|
86
|
+
const name = path.split(/[\\/]/).at(-1) ?? path;
|
|
87
|
+
checkouts.push({ workspaceId: null, name, folder: path });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const stashed = new Set<string>();
|
|
91
|
+
const found: Forgotten[] = [];
|
|
92
|
+
for (const checkout of checkouts.slice(0, FORGOTTEN_MAX)) {
|
|
93
|
+
const item = await readCheckout(exec, checkout);
|
|
94
|
+
if (item === null) continue;
|
|
95
|
+
if (item.stashes > 0) {
|
|
96
|
+
const common = await git(exec, checkout.folder, ["rev-parse", "--git-common-dir"]);
|
|
97
|
+
const repo = common?.[0] ?? checkout.folder;
|
|
98
|
+
if (stashed.has(repo)) item.stashes = 0;
|
|
99
|
+
stashed.add(repo);
|
|
100
|
+
}
|
|
101
|
+
if (item.changed + item.unpushed + item.stashes > 0) found.push(item);
|
|
102
|
+
}
|
|
103
|
+
return found;
|
|
104
|
+
}
|
package/server/live-ports.ts
CHANGED
|
@@ -21,6 +21,7 @@ import type { SkillFolder } from "./paths.js";
|
|
|
21
21
|
import type { ScriptLogPorts } from "./script-log.js";
|
|
22
22
|
import { nodeSkillFiles, type SkillsPorts } from "./skills.js";
|
|
23
23
|
import type { Timers } from "./timers.js";
|
|
24
|
+
import type { WatchedEntry } from "./watchers.js";
|
|
24
25
|
|
|
25
26
|
/** Hub ports on the daemon's own API. The holder is set before the first attach. */
|
|
26
27
|
export function liveHubPorts(
|
|
@@ -29,6 +30,8 @@ export function liveHubPorts(
|
|
|
29
30
|
log: (message: string) => void,
|
|
30
31
|
/** Whether steps name what they are at: the host's streamer mode is off. */
|
|
31
32
|
named: () => boolean = () => false,
|
|
33
|
+
/** Told each read's entries, for whoever watches the calls themselves. */
|
|
34
|
+
onTail?: (agentId: string, entries: readonly WatchedEntry[]) => void,
|
|
32
35
|
): HubPorts {
|
|
33
36
|
return {
|
|
34
37
|
openDirectory: (onChange, onEnd) => openPaseoDirectory(holder.require(), onChange, log, onEnd),
|
|
@@ -40,6 +43,10 @@ export function liveHubPorts(
|
|
|
40
43
|
const page = await paseo.agents
|
|
41
44
|
.ref(agentId)
|
|
42
45
|
.timeline.refetch({ direction: "tail", limit: ACTIVITY_TAIL_LIMIT });
|
|
46
|
+
onTail?.(
|
|
47
|
+
agentId,
|
|
48
|
+
page.entries.map((entry) => ({ seq: entry.seqEnd, item: entry.item })),
|
|
49
|
+
);
|
|
43
50
|
return page.entries.map((entry) => entry.item);
|
|
44
51
|
},
|
|
45
52
|
timers,
|