paseo-office 0.2.5 → 0.2.7

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.
@@ -0,0 +1,316 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
+ import { Pressable, StyleSheet, Text, View } from "react-native";
3
+ import { Icon, TextInput } from "@getpaseo/plugin/client/ui";
4
+ import { useRpc } from "@getpaseo/plugin/client";
5
+ import { vaultReportRpc, vaultSearchRpc, vaultTalkRpc } from "../shared/contracts.js";
6
+ import {
7
+ RULE_TEXT,
8
+ type PromptReport,
9
+ type VaultHit,
10
+ type VaultMessage,
11
+ type VaultTalk,
12
+ } from "../shared/vault.js";
13
+ import { ActionButton } from "./action-button.js";
14
+ import { OfficeModal as Modal } from "./office-modal.js";
15
+ import { SegmentPill } from "./segment-pill.js";
16
+ import type { OfficeStyles } from "./styles.js";
17
+
18
+ type Tab = "search" | "report";
19
+
20
+ const OFF =
21
+ "The history vault is off. With History vault on in the office's settings, the office keeps what is said in each conversation in a file on this host, and it can be searched here.";
22
+
23
+ const layout = StyleSheet.create({
24
+ search: { flexDirection: "row", alignItems: "center", gap: 8 },
25
+ field: { flex: 1 },
26
+ list: { gap: 12 },
27
+ hit: { gap: 2 },
28
+ head: { flexDirection: "row", justifyContent: "space-between", gap: 8 },
29
+ rule: { gap: 3 },
30
+ });
31
+
32
+ function whenText(at: number): string {
33
+ const date = new Date(at);
34
+ const pad = (value: number) => String(value).padStart(2, "0");
35
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}`;
36
+ }
37
+
38
+ const WHO = { user: "You", assistant: "Agent" } as const;
39
+
40
+ function Hit({
41
+ hit,
42
+ onOpen,
43
+ styles,
44
+ }: {
45
+ hit: VaultHit;
46
+ onOpen(agentId: string): void;
47
+ styles: OfficeStyles;
48
+ }) {
49
+ const press = useCallback(() => onOpen(hit.agentId), [onOpen, hit.agentId]);
50
+ return (
51
+ <Pressable
52
+ accessibilityRole="button"
53
+ accessibilityLabel={`${hit.name}, ${whenText(hit.at)}: ${hit.snippet}`}
54
+ onPress={press}
55
+ style={layout.hit}
56
+ >
57
+ <View style={layout.head}>
58
+ <Text style={styles.host.name} numberOfLines={1}>
59
+ {hit.name}
60
+ </Text>
61
+ <Text style={styles.host.note}>
62
+ {hit.team} · {whenText(hit.at)}
63
+ </Text>
64
+ </View>
65
+ <Text style={styles.host.note}>
66
+ {WHO[hit.role]}: {hit.snippet}
67
+ </Text>
68
+ </Pressable>
69
+ );
70
+ }
71
+
72
+ function Message({ message, styles }: { message: VaultMessage; styles: OfficeStyles }) {
73
+ return (
74
+ <View style={layout.hit}>
75
+ <Text style={styles.host.note}>
76
+ {WHO[message.role]} · {whenText(message.at)}
77
+ </Text>
78
+ <Text selectable style={styles.rowMeta}>
79
+ {message.text}
80
+ </Text>
81
+ </View>
82
+ );
83
+ }
84
+
85
+ function Talk({ talk, onBack, styles }: { talk: VaultTalk; onBack(): void; styles: OfficeStyles }) {
86
+ return (
87
+ <View style={styles.host.body}>
88
+ <View style={layout.head}>
89
+ <Text accessibilityRole="header" style={styles.host.title}>
90
+ {talk.name} · {talk.team}
91
+ </Text>
92
+ <ActionButton label="Back" pendingLabel="Back" onPress={onBack} styles={styles} />
93
+ </View>
94
+ <View style={layout.list}>
95
+ {talk.messages.map((message) => (
96
+ <Message key={`${message.at}:${message.role}`} message={message} styles={styles} />
97
+ ))}
98
+ </View>
99
+ </View>
100
+ );
101
+ }
102
+
103
+ function Report({ report, styles }: { report: PromptReport; styles: OfficeStyles }) {
104
+ if (report.total === 0) {
105
+ return <Text style={styles.host.empty}>No prompt of the last seven days is in the vault.</Text>;
106
+ }
107
+ return (
108
+ <View style={styles.host.body}>
109
+ <Text style={styles.host.title}>
110
+ {report.clean} of {report.total} prompts had nothing to improve
111
+ </Text>
112
+ <View style={layout.list}>
113
+ {report.rules.map((entry) => (
114
+ <View key={entry.rule} style={layout.rule}>
115
+ <Text style={styles.host.name}>
116
+ {RULE_TEXT[entry.rule].title}: {entry.count}
117
+ </Text>
118
+ <Text style={styles.host.note}>{RULE_TEXT[entry.rule].advice}</Text>
119
+ {entry.examples.map((example, index) => (
120
+ // (two prompts of the same words are two examples)
121
+ // oxlint-disable-next-line react/no-array-index-key
122
+ <Text key={`${index}:${example}`} style={styles.rowMeta}>
123
+ “{example}”
124
+ </Text>
125
+ ))}
126
+ </View>
127
+ ))}
128
+ </View>
129
+ <Text style={styles.host.note}>
130
+ The prompt helper&apos;s rules, applied on this host to the prompts of the last seven days
131
+ that are in the vault. No model reads them.
132
+ </Text>
133
+ </View>
134
+ );
135
+ }
136
+
137
+ interface Found {
138
+ on: boolean;
139
+ hits: VaultHit[];
140
+ query: string;
141
+ }
142
+
143
+ function problemOf(error: unknown): string {
144
+ return error instanceof Error ? error.message : String(error);
145
+ }
146
+
147
+ /** The search: what was asked last, what it found, and the conversation that is open. */
148
+ function useVaultSearch() {
149
+ const search = useRpc(vaultSearchRpc);
150
+ const read = useRpc(vaultTalkRpc);
151
+ const [draft, setDraft] = useState("");
152
+ const [found, setFound] = useState<Found | null>(null);
153
+ const [talk, setTalk] = useState<VaultTalk | null>(null);
154
+ const [problem, setProblem] = useState<string | null>(null);
155
+ const submit = useCallback(async () => {
156
+ const query = draft.trim();
157
+ setProblem(null);
158
+ try {
159
+ const answer = await search({ query });
160
+ setFound({ ...answer, query });
161
+ } catch (error) {
162
+ setProblem(`The vault cannot be searched: ${problemOf(error)}`);
163
+ }
164
+ }, [draft, search]);
165
+ const open = useCallback(
166
+ (agentId: string) => {
167
+ setProblem(null);
168
+ read({ agentId }).then(
169
+ (answer) => {
170
+ if (answer.talk === null) setProblem("That conversation is no longer in the vault.");
171
+ else setTalk(answer.talk);
172
+ return undefined;
173
+ },
174
+ (error: unknown) => setProblem(`The conversation cannot be read: ${problemOf(error)}`),
175
+ );
176
+ },
177
+ [read],
178
+ );
179
+ const back = useCallback(() => setTalk(null), []);
180
+ return { draft, setDraft, found, talk, problem, submit, open, back };
181
+ }
182
+
183
+ function Search({ styles }: { styles: OfficeStyles }) {
184
+ const { draft, setDraft, found, talk, problem, submit, open, back } = useVaultSearch();
185
+ const submitNow = useCallback(() => void submit(), [submit]);
186
+ const field = useMemo(() => [styles.fieldInput, layout.field], [styles]);
187
+ if (talk !== null) return <Talk talk={talk} onBack={back} styles={styles} />;
188
+ return (
189
+ <View style={styles.host.body}>
190
+ <View style={layout.search}>
191
+ <TextInput
192
+ accessibilityLabel="Search the history"
193
+ value={draft}
194
+ onChangeText={setDraft}
195
+ onSubmitEditing={submitNow}
196
+ placeholder="Words said in a conversation"
197
+ autoCapitalize="none"
198
+ autoCorrect={false}
199
+ style={field}
200
+ />
201
+ <ActionButton
202
+ label="Find"
203
+ pendingLabel="Finding..."
204
+ onPress={submit}
205
+ disabled={draft.trim() === ""}
206
+ styles={styles}
207
+ primary
208
+ />
209
+ </View>
210
+ {problem && (
211
+ <Text accessibilityRole="alert" style={styles.actionError}>
212
+ {problem}
213
+ </Text>
214
+ )}
215
+ {found !== null && !found.on && <Text style={styles.host.empty}>{OFF}</Text>}
216
+ {found !== null && found.on && found.hits.length === 0 && (
217
+ <Text style={styles.host.empty}>Nothing in the vault has “{found.query}”.</Text>
218
+ )}
219
+ {found !== null && found.hits.length > 0 && (
220
+ <View style={layout.list}>
221
+ {found.hits.map((hit) => (
222
+ <Hit
223
+ key={`${hit.agentId}:${hit.at}:${hit.role}`}
224
+ hit={hit}
225
+ onOpen={open}
226
+ styles={styles}
227
+ />
228
+ ))}
229
+ </View>
230
+ )}
231
+ </View>
232
+ );
233
+ }
234
+
235
+ function ReportTab({ styles }: { styles: OfficeStyles }) {
236
+ const ask = useRpc(vaultReportRpc);
237
+ // Kept in a ref: the report is read once when the tab shows, whatever the call's identity.
238
+ const asking = useRef(ask);
239
+ asking.current = ask;
240
+ const [read, setRead] = useState<{ on: boolean; report: PromptReport } | string | null>(null);
241
+ useEffect(() => {
242
+ let ended = false;
243
+ asking.current({}).then(
244
+ (answer) => {
245
+ if (!ended) setRead(answer);
246
+ return undefined;
247
+ },
248
+ (error: unknown) => {
249
+ if (!ended) setRead(`The report cannot be read: ${problemOf(error)}`);
250
+ },
251
+ );
252
+ return () => {
253
+ ended = true;
254
+ };
255
+ }, []);
256
+ if (read === null) return <Text style={styles.host.empty}>Reading the prompts...</Text>;
257
+ if (typeof read === "string") {
258
+ return (
259
+ <Text accessibilityRole="alert" style={styles.actionError}>
260
+ {read}
261
+ </Text>
262
+ );
263
+ }
264
+ if (!read.on) return <Text style={styles.host.empty}>{OFF}</Text>;
265
+ return <Report report={read.report} styles={styles} />;
266
+ }
267
+
268
+ export interface VaultCardProps {
269
+ open: boolean;
270
+ styles: OfficeStyles;
271
+ onClose(): void;
272
+ }
273
+
274
+ /** The history vault: a search of what was said, and the week's prompts against the prompt helper's rules. */
275
+ export function VaultCard({ open, styles, onClose }: VaultCardProps) {
276
+ const [tab, setTab] = useState<Tab>("search");
277
+ const change = useCallback(
278
+ (next: boolean) => {
279
+ if (!next) onClose();
280
+ },
281
+ [onClose],
282
+ );
283
+ const icon = useMemo(
284
+ () => <Icon name="Archive" size={18} color={String(styles.host.label.color)} />,
285
+ [styles],
286
+ );
287
+ return (
288
+ <Modal icon={icon} title="History" open={open} onOpenChange={change}>
289
+ <Modal.Content>
290
+ {open && (
291
+ <View style={styles.host.body}>
292
+ <View role="group" aria-label="History" style={styles.segments}>
293
+ <SegmentPill<Tab>
294
+ value="search"
295
+ name="Search"
296
+ on={tab === "search"}
297
+ disabled={false}
298
+ onPress={setTab}
299
+ styles={styles}
300
+ />
301
+ <SegmentPill<Tab>
302
+ value="report"
303
+ name="Prompt report"
304
+ on={tab === "report"}
305
+ disabled={false}
306
+ onPress={setTab}
307
+ styles={styles}
308
+ />
309
+ </View>
310
+ {tab === "search" ? <Search styles={styles} /> : <ReportTab styles={styles} />}
311
+ </View>
312
+ )}
313
+ </Modal.Content>
314
+ </Modal>
315
+ );
316
+ }
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
+ ## History vault and the prompt report
550
+
551
+ **History vault** (Settings, host-wide, off by default) has the office keep what is said in each
552
+ conversation: the prompts and the replies, not the tool calls. It reads an agent's timeline through
553
+ Paseo when it first sees the agent and after each of its turns, for every provider, so it holds
554
+ what was said while an office surface was open. A message is cut at 2,000 characters, a
555
+ conversation at its newest 300 messages, and the vault at its 200 most recent conversations. It is
556
+ one file on the host, `office/vault.json`, mode 600; turning the setting off stops the reading and
557
+ hides what is kept, and deleting the file empties it.
558
+
559
+ **History**, in the toolbar of a wide office and at the top of the Activity tab, searches it with **Find**: the
560
+ newest 40 messages that hold every word typed, each with the words around the match. A hit opens
561
+ its conversation, which stays readable after the agent is archived.
562
+
563
+ **Prompt report**, the card's other tab, puts the last seven days' prompts in the vault against the
564
+ prompt helper's rules (`shared/upstream/prompt-coach.js`): how many had nothing to improve, and for
565
+ each rule how many prompts it spoke to, with up to three of them. It is worked out on the host by
566
+ the helper's own code. No model reads the prompts.
567
+
519
568
  ## Streamer mode, graphics and sticky notes
520
569
 
521
570
  **Streamer mode** (Settings, host-wide, on by default) keeps file names, commands, search queries
package/index.server.ts CHANGED
@@ -9,7 +9,7 @@ import { createStreetWatch, streetReaders } from "./server/street-watch.js";
9
9
  import { streetSubscription } from "./shared/contracts.js";
10
10
  import { createLifeFeed } from "./server/life-feed.js";
11
11
  import { createLifeFile, createSaveQueue, type LifeFile } from "./server/life-store.js";
12
- import { liftFile, tenureFile, timelineFile } from "./server/paths.js";
12
+ import { liftFile, tenureFile, timelineFile, vaultFile } from "./server/paths.js";
13
13
  import { createDepartureArchiver } from "./server/home-departure.js";
14
14
  import {
15
15
  lifeSubscription,
@@ -45,6 +45,16 @@ import {
45
45
  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
+ import { promptReport } from "./shared/vault.js";
49
+ import { pinnedNote } from "./shared/alerts.js";
50
+ import { createWatchers } from "./server/watchers.js";
51
+ import {
52
+ VAULT_TAIL_LIMIT,
53
+ VaultFileSchema,
54
+ createVault,
55
+ type Vault,
56
+ type VaultFile,
57
+ } from "./server/vault.js";
48
58
  import {
49
59
  TIMELINE_KEEP_MS,
50
60
  TimelineFileSchema,
@@ -120,6 +130,11 @@ import {
120
130
  notesModesRpc,
121
131
  planUsageRpc,
122
132
  timelineRpc,
133
+ alertDismissRpc,
134
+ alertsRpc,
135
+ vaultReportRpc,
136
+ vaultSearchRpc,
137
+ vaultTalkRpc,
123
138
  teamRenameRpc,
124
139
  trackersSaveRpc,
125
140
  trackersTestRpc,
@@ -159,6 +174,8 @@ export interface OfficePluginDeps {
159
174
  tenureFile: LifeFile<TenureLedger>;
160
175
  /** Where the timeline is kept; without it the timeline lasts as long as the server. */
161
176
  timelineFile?: LifeFile<TimelineFile>;
177
+ /** Where the history vault is kept; without it the vault lasts as long as the server. */
178
+ vaultFile?: LifeFile<VaultFile>;
162
179
  liftFile: LifeFile<LiftKept>;
163
180
  /** The owner's duty list. */
164
181
  dutiesFile: LifeFile<DutiesFile>;
@@ -222,7 +239,24 @@ export function createOfficePlugin(
222
239
  const holder = createPaseoHolder();
223
240
  // Off until the settings are read: nothing is named before the host has said it may be.
224
241
  let stepsNamed = false;
225
- const hubPorts = liveHubPorts(holder, deps.clock, log, () => stepsNamed);
242
+ // The owner's pinned notes; empty until the settings are read.
243
+ let pinnedNotes = "";
244
+ const watchers = createWatchers({
245
+ now: () => deps.clock.now(),
246
+ named: () => stepsNamed,
247
+ pinnedNotes: () => pinnedNotes,
248
+ remind: (agentId, notes) => {
249
+ if (!holder.held()) return;
250
+ holder
251
+ .require()
252
+ .agents.ref(agentId)
253
+ .send(pinnedNote(notes), { activeTurnBehavior: "steer" })
254
+ .catch((error: unknown) =>
255
+ log(`[office] pinned notes to ${agentId}: ${errorMessage(error)}`),
256
+ );
257
+ },
258
+ });
259
+ const hubPorts = liveHubPorts(holder, deps.clock, log, () => stepsNamed, watchers.tail);
226
260
  // Set once its file is read; what the office sees before that is not kept.
227
261
  let timeline: TimelineLog | null = null;
228
262
  const hub = createHub({
@@ -237,6 +271,36 @@ export function createOfficePlugin(
237
271
  deps.timelineFile === undefined
238
272
  ? null
239
273
  : createSaveQueue(deps.timelineFile, deps.clock, log, 30_000);
274
+ // Off until the settings are read: nothing is kept before the owner has said it may be.
275
+ let vaultOn = false;
276
+ let vault: Vault | null = null;
277
+ const vaultSaves =
278
+ deps.vaultFile === undefined ? null : createSaveQueue(deps.vaultFile, deps.clock, log, 30_000);
279
+ let stopVault: (() => void) | undefined;
280
+ const vaultReady = (async () => {
281
+ const kept = (await deps.vaultFile?.load()) ?? null;
282
+ vault = createVault(
283
+ {
284
+ tail: async (agentId) => {
285
+ const page = await holder
286
+ .require()
287
+ .agents.ref(agentId)
288
+ .timeline.refetch({ direction: "tail", limit: VAULT_TAIL_LIMIT });
289
+ return page.entries.map((entry) => ({
290
+ at: Date.parse(entry.timestamp),
291
+ seq: entry.seqEnd,
292
+ item: entry.item,
293
+ }));
294
+ },
295
+ on: () => vaultOn,
296
+ save: (file) => vaultSaves?.save(file),
297
+ log,
298
+ },
299
+ kept,
300
+ );
301
+ stopVault = hub.watch(vault.view);
302
+ })().catch((error: unknown) => log(`[office] history vault unavailable: ${errorMessage(error)}`));
303
+ const stopWatchers = hub.watch(watchers.view);
240
304
  let stopTimeline: (() => void) | undefined;
241
305
  const timelineReady = (async () => {
242
306
  const kept = (await deps.timelineFile?.load()) ?? null;
@@ -470,6 +534,8 @@ export function createOfficePlugin(
470
534
  function settingsUnreadable(reason: string): void {
471
535
  agentToolsOn = false;
472
536
  stepsNamed = false;
537
+ vaultOn = false;
538
+ pinnedNotes = "";
473
539
  office.setPickupEnabled(false);
474
540
  const message = `The office's settings cannot be read: ${reason}`;
475
541
  log(`[office] ${message}`);
@@ -490,6 +556,8 @@ export function createOfficePlugin(
490
556
  hub.setBrand(hostBrand(state.values, deps.env));
491
557
  agentToolsOn = state.values.agentTools;
492
558
  stepsNamed = !state.values.streamerMode;
559
+ vaultOn = state.values.historyVault;
560
+ pinnedNotes = state.values.pinnedNotes;
493
561
  office.setPickupEnabled(agentToolsOn && holder.held());
494
562
  weather.settingsChanged(state.values);
495
563
  await notesSchedule.sync(state.values);
@@ -699,6 +767,24 @@ export function createOfficePlugin(
699
767
  const start = Math.max(from, end - TIMELINE_KEEP_MS);
700
768
  return { ok: true as const, timeline: timeline.read(start, end) };
701
769
  });
770
+ server.handle(alertsRpc, async () => ({ alerts: watchers.alerts() }));
771
+ server.handle(alertDismissRpc, async ({ id }) => {
772
+ watchers.dismiss(id);
773
+ return { alerts: watchers.alerts() };
774
+ });
775
+ server.handle(vaultSearchRpc, async ({ query }) => {
776
+ await vaultReady;
777
+ return { on: vaultOn, hits: vaultOn ? (vault?.search(query) ?? []) : [] };
778
+ });
779
+ server.handle(vaultTalkRpc, async ({ agentId }) => {
780
+ await vaultReady;
781
+ return { talk: vaultOn ? (vault?.talk(agentId) ?? null) : null };
782
+ });
783
+ server.handle(vaultReportRpc, async () => {
784
+ await vaultReady;
785
+ const from = deps.clock.now() - 7 * 24 * 60 * 60 * 1000;
786
+ return { on: vaultOn, report: vault?.report(from) ?? promptReport([]) };
787
+ });
702
788
  server.handle(planUsageRpc, async (_input, context) => {
703
789
  holder.remember(context.paseo);
704
790
  try {
@@ -917,6 +1003,9 @@ export function createOfficePlugin(
917
1003
  await lifeReady;
918
1004
  stopLife?.();
919
1005
  stopTimeline?.();
1006
+ stopWatchers();
1007
+ stopVault?.();
1008
+ await vaultSaves?.flush();
920
1009
  await timelineSaves?.flush();
921
1010
  for (const close of listeners.values()) close();
922
1011
  await Promise.all([tenureSaves.flush(), liftSaved]);
@@ -949,6 +1038,7 @@ export default function contribute(server: PluginServerContext): () => Promise<v
949
1038
  }),
950
1039
  tenureFile: createLifeFile(tenureFile(process.env, homedir()), TenureLedgerSchema),
951
1040
  timelineFile: createLifeFile(timelineFile(process.env, homedir()), TimelineFileSchema),
1041
+ vaultFile: createLifeFile(vaultFile(process.env, homedir()), VaultFileSchema),
952
1042
  liftFile: createLifeFile(liftFile(process.env, homedir()), LiftKeptSchema),
953
1043
  dutiesFile: dutiesFileStore(dutiesFile(process.env, homedir()), { now: () => Date.now(), log }),
954
1044
  chatStore: createChatStore({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-office",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
  "description": "A community port of my-office for Paseo: your agents at their desks, in 3D.",
5
5
  "keywords": [
6
6
  "3d",
@@ -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,
package/server/paths.ts CHANGED
@@ -81,6 +81,11 @@ export function timelineFile(env: NodeJS.ProcessEnv, home: string) {
81
81
  return join(officeDir(env, home), "timeline.json");
82
82
  }
83
83
 
84
+ /** What was said in each conversation, while the owner has the history vault on. */
85
+ export function vaultFile(env: NodeJS.ProcessEnv, home: string) {
86
+ return join(officeDir(env, home), "vault.json");
87
+ }
88
+
84
89
  export function tenureFile(env: NodeJS.ProcessEnv, home: string) {
85
90
  return join(officeDir(env, home), "tenure.json");
86
91
  }