paseo-office 0.2.2 → 0.2.3
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/host-switches.tsx +17 -0
- package/client/notes-mode-row.tsx +140 -0
- package/client/office-state.ts +1 -0
- package/client/structure-view.tsx +2 -0
- package/client/team-name.tsx +81 -0
- package/client/world/adapter.ts +34 -1
- package/client/world/world-api.ts +12 -1
- package/docs/office.md +36 -2
- package/index.server.ts +35 -1
- package/package.json +1 -1
- package/server/activity.ts +40 -3
- package/server/directory.ts +5 -1
- package/server/hub.ts +9 -0
- package/server/life-feed.ts +13 -0
- package/server/live-ports.ts +30 -11
- package/server/notes-schedule.ts +2 -0
- package/server/notes-writer.ts +9 -1
- package/server/tenure.ts +10 -0
- package/server/world.generated.ts +1 -1
- package/server/writer-mode.ts +45 -0
- package/shared/contracts.ts +54 -0
- package/shared/model.ts +16 -1
- package/shared/settings.ts +3 -1
- package/shared/team-name.ts +23 -0
package/client/host-switches.tsx
CHANGED
|
@@ -13,6 +13,7 @@ import { wakeSummary } from "./board-text.js";
|
|
|
13
13
|
import { FLOOR_PLAN_LABEL, FloorPlanRow } from "./floor-plan-row.js";
|
|
14
14
|
import { LabeledSwitch } from "./labeled-switch.js";
|
|
15
15
|
import { NOTES_DAYS_LABEL, NotesDays } from "./notes-days.js";
|
|
16
|
+
import { NOTES_MODE_LABEL, NotesModeRow } from "./notes-mode-row.js";
|
|
16
17
|
import { JiraConnection, SentryConnection } from "./tracker-connections.js";
|
|
17
18
|
import type { OfficeStyles } from "./styles.js";
|
|
18
19
|
import type { BoardActions } from "./use-board-actions.js";
|
|
@@ -29,6 +30,7 @@ type HostSetting =
|
|
|
29
30
|
| "Notes folder"
|
|
30
31
|
| "Time zone"
|
|
31
32
|
| typeof NOTES_DAYS_LABEL
|
|
33
|
+
| typeof NOTES_MODE_LABEL
|
|
32
34
|
| typeof FLOOR_PLAN_LABEL
|
|
33
35
|
| "Jira projects"
|
|
34
36
|
| "Sentry organisation"
|
|
@@ -166,6 +168,10 @@ export function HostSwitches({
|
|
|
166
168
|
(next: number[]) => change(NOTES_DAYS_LABEL, { notesDays: next }),
|
|
167
169
|
[change],
|
|
168
170
|
);
|
|
171
|
+
const saveMode = useCallback(
|
|
172
|
+
(next: string) => change(NOTES_MODE_LABEL, { notesMode: next }),
|
|
173
|
+
[change],
|
|
174
|
+
);
|
|
169
175
|
const savePlan = useCallback(
|
|
170
176
|
(next: FloorPlanChoice) => change(FLOOR_PLAN_LABEL, { floorPlan: next }),
|
|
171
177
|
[change],
|
|
@@ -261,6 +267,12 @@ export function HostSwitches({
|
|
|
261
267
|
problem={saveProblem(NOTES_DAYS_LABEL)}
|
|
262
268
|
styles={styles}
|
|
263
269
|
/>
|
|
270
|
+
<NotesModeRow
|
|
271
|
+
value={storedMode(stored)}
|
|
272
|
+
onSave={saveMode}
|
|
273
|
+
problem={saveProblem(NOTES_MODE_LABEL)}
|
|
274
|
+
styles={styles}
|
|
275
|
+
/>
|
|
264
276
|
</View>
|
|
265
277
|
{problems.length > 0 ? (
|
|
266
278
|
<View style={styles.headerProblems}>
|
|
@@ -297,6 +309,11 @@ export function HostSwitches({
|
|
|
297
309
|
);
|
|
298
310
|
}
|
|
299
311
|
|
|
312
|
+
/** The stored writer mode; null while the settings are read or cannot be read. */
|
|
313
|
+
function storedMode(values: HostValues | null): string | null {
|
|
314
|
+
return values === null ? null : values.notesMode;
|
|
315
|
+
}
|
|
316
|
+
|
|
300
317
|
type TrackerField = "jiraProjects" | "sentryOrg" | "sentryProjects" | "sentryUrl";
|
|
301
318
|
|
|
302
319
|
/** A tracker field's stored text; null while the settings are read or cannot be read. */
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import { Text, View } from "react-native";
|
|
3
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { notesModesRpc, type WriterModes } from "../shared/contracts.js";
|
|
5
|
+
import { SegmentPill } from "./segment-pill.js";
|
|
6
|
+
import type { OfficeStyles } from "./styles.js";
|
|
7
|
+
|
|
8
|
+
/** The row's label, and the setting a refused save names. */
|
|
9
|
+
export const NOTES_MODE_LABEL = "Writer mode";
|
|
10
|
+
/** The pill for no mode set: the office picks, as it did before the setting. */
|
|
11
|
+
const OWN_CHOICE = "Office's choice";
|
|
12
|
+
const HINT =
|
|
13
|
+
"The mode the stand-up writer starts in. Nobody answers its questions at 8:00, so a mode that asks leaves the note unwritten.";
|
|
14
|
+
// The modes that ask for nothing: Claude's and Codex's.
|
|
15
|
+
const UNATTENDED: ReadonlySet<string> = new Set(["bypassPermissions", "full-access"]);
|
|
16
|
+
const UNATTENDED_HINT = "In this mode the writer runs any tool or command without asking.";
|
|
17
|
+
|
|
18
|
+
export interface NotesModeRowProps {
|
|
19
|
+
/** The stored mode's id, empty for none; null while the settings are read or cannot be read. */
|
|
20
|
+
value: string | null;
|
|
21
|
+
/** Resolves once the host has answered, and never rejects. */
|
|
22
|
+
onSave(next: string): Promise<unknown>;
|
|
23
|
+
problem: string | null;
|
|
24
|
+
styles: OfficeStyles;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
type Asked = WriterModes | { problem: string } | null;
|
|
28
|
+
|
|
29
|
+
/** What stands under the pills beside the hint: the fallback, the warning, or why none is listed. */
|
|
30
|
+
function noteOf(asked: Asked, shown: string | null): string | null {
|
|
31
|
+
if (asked === null) return null;
|
|
32
|
+
if ("problem" in asked) return `The writer's modes cannot be listed: ${asked.problem}`;
|
|
33
|
+
if (asked.fellBack) {
|
|
34
|
+
const used = asked.modes.find((mode) => mode.id === asked.modeId)?.label ?? "its default";
|
|
35
|
+
return `${asked.provider} has no mode "${shown}": the writer starts in ${used}.`;
|
|
36
|
+
}
|
|
37
|
+
return shown !== null && UNATTENDED.has(shown) ? UNATTENDED_HINT : null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The stand-up writer's mode, as pills of the modes its provider offers, by the provider's own
|
|
42
|
+
* names. The host is asked for them when the row shows and after each save, since the stored
|
|
43
|
+
* mode decides what it says of a fallback. A press shows, and the row takes no other, until the
|
|
44
|
+
* host has answered.
|
|
45
|
+
*/
|
|
46
|
+
export function NotesModeRow({ value, onSave, problem, styles }: NotesModeRowProps) {
|
|
47
|
+
const ask = useRpc(notesModesRpc);
|
|
48
|
+
const mounted = useRef(true);
|
|
49
|
+
const [asked, setAsked] = useState<Asked>(null);
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
mounted.current = true;
|
|
52
|
+
return () => {
|
|
53
|
+
mounted.current = false;
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
// Kept in a ref: the row asks again when the stored mode changes, not when the call's identity does.
|
|
57
|
+
const asking = useRef(ask);
|
|
58
|
+
asking.current = ask;
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (value === null) return;
|
|
61
|
+
void asking.current({}).then(
|
|
62
|
+
(answer) => {
|
|
63
|
+
if (mounted.current) setAsked(answer.ok ? answer : { problem: answer.problem });
|
|
64
|
+
return undefined;
|
|
65
|
+
},
|
|
66
|
+
(error: unknown) => {
|
|
67
|
+
if (mounted.current) {
|
|
68
|
+
setAsked({ problem: error instanceof Error ? error.message : String(error) });
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
}, [value]);
|
|
73
|
+
const [wanted, setWanted] = useState<string | null>(null);
|
|
74
|
+
const shown = wanted ?? value;
|
|
75
|
+
const saving = useRef(false);
|
|
76
|
+
const choose = useCallback(
|
|
77
|
+
(next: string) => {
|
|
78
|
+
if (shown === null || saving.current || next === shown) return;
|
|
79
|
+
saving.current = true;
|
|
80
|
+
setWanted(next);
|
|
81
|
+
void onSave(next).finally(() => {
|
|
82
|
+
saving.current = false;
|
|
83
|
+
if (mounted.current) setWanted(null);
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
[shown, onSave],
|
|
87
|
+
);
|
|
88
|
+
const modes = asked !== null && "modes" in asked ? asked.modes : [];
|
|
89
|
+
// A stored mode this provider lacks still shows as a pill, so what is stored can be seen.
|
|
90
|
+
const stored = shown !== null && shown !== "" && !modes.some((mode) => mode.id === shown);
|
|
91
|
+
const disabled = shown === null || wanted !== null;
|
|
92
|
+
const note = wanted === null ? noteOf(asked, shown) : null;
|
|
93
|
+
return (
|
|
94
|
+
<View style={styles.headerField}>
|
|
95
|
+
<Text style={styles.sheetLabel}>{NOTES_MODE_LABEL}</Text>
|
|
96
|
+
<View
|
|
97
|
+
role="group"
|
|
98
|
+
aria-label={NOTES_MODE_LABEL}
|
|
99
|
+
style={disabled ? styles.segmentsDisabled : styles.segments}
|
|
100
|
+
>
|
|
101
|
+
<SegmentPill
|
|
102
|
+
value=""
|
|
103
|
+
name={OWN_CHOICE}
|
|
104
|
+
on={shown === ""}
|
|
105
|
+
disabled={disabled}
|
|
106
|
+
onPress={choose}
|
|
107
|
+
styles={styles}
|
|
108
|
+
/>
|
|
109
|
+
{modes.map((mode) => (
|
|
110
|
+
<SegmentPill
|
|
111
|
+
key={mode.id}
|
|
112
|
+
value={mode.id}
|
|
113
|
+
name={mode.label}
|
|
114
|
+
on={shown === mode.id}
|
|
115
|
+
disabled={disabled}
|
|
116
|
+
onPress={choose}
|
|
117
|
+
styles={styles}
|
|
118
|
+
/>
|
|
119
|
+
))}
|
|
120
|
+
{stored && shown !== null ? (
|
|
121
|
+
<SegmentPill
|
|
122
|
+
value={shown}
|
|
123
|
+
name={shown}
|
|
124
|
+
on
|
|
125
|
+
disabled={disabled}
|
|
126
|
+
onPress={choose}
|
|
127
|
+
styles={styles}
|
|
128
|
+
/>
|
|
129
|
+
) : null}
|
|
130
|
+
</View>
|
|
131
|
+
<Text style={styles.fieldHint}>{HINT}</Text>
|
|
132
|
+
{note === null ? null : <Text style={styles.fieldHint}>{note}</Text>}
|
|
133
|
+
{problem === null ? null : (
|
|
134
|
+
<Text accessibilityRole="alert" style={styles.actionError}>
|
|
135
|
+
{problem}
|
|
136
|
+
</Text>
|
|
137
|
+
)}
|
|
138
|
+
</View>
|
|
139
|
+
);
|
|
140
|
+
}
|
package/client/office-state.ts
CHANGED
|
@@ -26,6 +26,7 @@ export function applyOfficeEvent(state: OfficeSnapshot, event: OfficeEvent): Off
|
|
|
26
26
|
...state,
|
|
27
27
|
activity: event.activity,
|
|
28
28
|
doing: event.doing ?? {},
|
|
29
|
+
subagents: event.subagents,
|
|
29
30
|
checklists: event.checklists ?? {},
|
|
30
31
|
checklistProgress: event.checklistProgress,
|
|
31
32
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TeamName } from "./team-name.js";
|
|
1
2
|
import { useCallback, useEffect, useId, useMemo, useState } from "react";
|
|
2
3
|
import {
|
|
3
4
|
Platform,
|
|
@@ -241,6 +242,7 @@ function RoomCard({
|
|
|
241
242
|
{room.subtitle}
|
|
242
243
|
</Text>
|
|
243
244
|
) : null}
|
|
245
|
+
<TeamName room={room} styles={styles} />
|
|
244
246
|
</View>
|
|
245
247
|
{room.rows.length === 0 ? <Text style={styles.empty}>No agents</Text> : null}
|
|
246
248
|
{room.rows.map((row, index) => (
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { useRpc } from "@getpaseo/plugin/client";
|
|
4
|
+
import { TextInput } from "@getpaseo/plugin/client/ui";
|
|
5
|
+
import { teamRenameRpc } from "../shared/contracts.js";
|
|
6
|
+
import type { OfficeRoom } from "../shared/model.js";
|
|
7
|
+
import { TEAM_NAME_MAX } from "../shared/team-name.js";
|
|
8
|
+
import { ActionButton } from "./action-button.js";
|
|
9
|
+
import type { OfficeStyles } from "./styles.js";
|
|
10
|
+
|
|
11
|
+
interface TeamNameProps {
|
|
12
|
+
room: OfficeRoom;
|
|
13
|
+
styles: OfficeStyles;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const HINT = "The office's own name for this team. Empty goes back to the workspace's name.";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Gives a room's team a name of the office's own: a line under the room's title that opens a
|
|
20
|
+
* field. The workspace keeps its name in Paseo; while the team goes by another, the line says
|
|
21
|
+
* which workspace it is.
|
|
22
|
+
*/
|
|
23
|
+
export function TeamName({ room, styles }: TeamNameProps) {
|
|
24
|
+
const rename = useRpc(teamRenameRpc);
|
|
25
|
+
const [open, setOpen] = useState(false);
|
|
26
|
+
const [draft, setDraft] = useState("");
|
|
27
|
+
const workspace = room.workspace;
|
|
28
|
+
const own = workspace?.workspaceName;
|
|
29
|
+
const start = useCallback(() => {
|
|
30
|
+
// The field starts from the team's own name, empty while it goes by the workspace's.
|
|
31
|
+
setDraft(own === undefined ? "" : room.name);
|
|
32
|
+
setOpen(true);
|
|
33
|
+
}, [own, room.name]);
|
|
34
|
+
const cancel = useCallback(() => setOpen(false), []);
|
|
35
|
+
const save = useCallback(async () => {
|
|
36
|
+
if (!workspace) return;
|
|
37
|
+
const answer = await rename({ workspaceId: workspace.id, name: draft });
|
|
38
|
+
if (!answer.ok) throw new Error(answer.problem);
|
|
39
|
+
setOpen(false);
|
|
40
|
+
}, [rename, workspace, draft]);
|
|
41
|
+
if (!workspace) return null;
|
|
42
|
+
if (!open) {
|
|
43
|
+
return (
|
|
44
|
+
<Pressable
|
|
45
|
+
accessibilityRole="button"
|
|
46
|
+
accessibilityLabel={`Rename team ${room.name}`}
|
|
47
|
+
onPress={start}
|
|
48
|
+
>
|
|
49
|
+
<Text style={styles.fieldHint}>
|
|
50
|
+
{own === undefined ? "Rename team" : `Workspace ${own} · Rename team`}
|
|
51
|
+
</Text>
|
|
52
|
+
</Pressable>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return (
|
|
56
|
+
<View style={styles.headerField}>
|
|
57
|
+
<TextInput
|
|
58
|
+
accessibilityLabel="Team name"
|
|
59
|
+
accessibilityHint={HINT}
|
|
60
|
+
value={draft}
|
|
61
|
+
onChangeText={setDraft}
|
|
62
|
+
maxLength={TEAM_NAME_MAX}
|
|
63
|
+
placeholder={own ?? room.name}
|
|
64
|
+
autoCapitalize="none"
|
|
65
|
+
autoCorrect={false}
|
|
66
|
+
style={styles.fieldInput}
|
|
67
|
+
/>
|
|
68
|
+
<Text style={styles.fieldHint}>{HINT}</Text>
|
|
69
|
+
<View style={styles.actions}>
|
|
70
|
+
<ActionButton
|
|
71
|
+
label="Save team name"
|
|
72
|
+
pendingLabel="Saving..."
|
|
73
|
+
onPress={save}
|
|
74
|
+
primary
|
|
75
|
+
styles={styles}
|
|
76
|
+
/>
|
|
77
|
+
<ActionButton label="Cancel" pendingLabel="Cancel" onPress={cancel} styles={styles} />
|
|
78
|
+
</View>
|
|
79
|
+
</View>
|
|
80
|
+
);
|
|
81
|
+
}
|
package/client/world/adapter.ts
CHANGED
|
@@ -65,6 +65,11 @@ function rank(session: WorldSession): number {
|
|
|
65
65
|
return session.status === "work" ? 1 : 2;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/** A sub-agent's id in the scene: its call's id is only unique within its parent's session. */
|
|
69
|
+
function subId(parentId: string, callId: string): string {
|
|
70
|
+
return `${parentId}:${callId}`;
|
|
71
|
+
}
|
|
72
|
+
|
|
68
73
|
function toSession(
|
|
69
74
|
row: OfficeRow,
|
|
70
75
|
team: string,
|
|
@@ -98,7 +103,7 @@ function toSession(
|
|
|
98
103
|
: {}),
|
|
99
104
|
stuck,
|
|
100
105
|
...(row.waitingOn > 0 ? { waitingOn: row.waitingOn } : {}),
|
|
101
|
-
subs: [],
|
|
106
|
+
subs: (row.subagents ?? []).map((sub) => ({ id: subId(agent.id, sub.id), type: sub.type })),
|
|
102
107
|
...(agent.context === undefined && agent.costUsd === undefined
|
|
103
108
|
? {}
|
|
104
109
|
: {
|
|
@@ -237,6 +242,8 @@ interface Told {
|
|
|
237
242
|
running: Run | null;
|
|
238
243
|
/** How full the context was, 0 to 1; null when unknown. */
|
|
239
244
|
full: number | null;
|
|
245
|
+
/** The sub-agents the scene had been told of. */
|
|
246
|
+
subs?: readonly string[];
|
|
240
247
|
}
|
|
241
248
|
export type WorldMemory = ReadonlyMap<string, Told>;
|
|
242
249
|
|
|
@@ -246,6 +253,30 @@ export interface WorldChanges {
|
|
|
246
253
|
memory: WorldMemory;
|
|
247
254
|
}
|
|
248
255
|
|
|
256
|
+
/**
|
|
257
|
+
* A sub-agent that came since the scene was last told walks in, and one that is gone leaves.
|
|
258
|
+
* Someone seen for the first time gets neither: the scene seats who is already there (`subs`).
|
|
259
|
+
*/
|
|
260
|
+
function subEvents(session: WorldSession, was: Told | undefined): WorldEvent[] {
|
|
261
|
+
if (was === undefined) return [];
|
|
262
|
+
const told = was.subs ?? [];
|
|
263
|
+
const here = new Set(session.subs.map((sub) => sub.id));
|
|
264
|
+
const starts = session.subs
|
|
265
|
+
.filter((sub) => !told.includes(sub.id))
|
|
266
|
+
.map(
|
|
267
|
+
(sub): WorldEvent => ({
|
|
268
|
+
sess: session.id,
|
|
269
|
+
type: "substart",
|
|
270
|
+
agent: sub.id,
|
|
271
|
+
label: sub.type,
|
|
272
|
+
}),
|
|
273
|
+
);
|
|
274
|
+
const stops = told
|
|
275
|
+
.filter((id) => !here.has(id))
|
|
276
|
+
.map((id): WorldEvent => ({ sess: session.id, type: "substop", agent: id }));
|
|
277
|
+
return [...starts, ...stops];
|
|
278
|
+
}
|
|
279
|
+
|
|
249
280
|
/**
|
|
250
281
|
* A turn that starts, one that ends, a new error; none for someone seen for the first time. An
|
|
251
282
|
* agent that turns busy because a sub-agent started gets no prompt: nobody sent it one. Its own
|
|
@@ -329,6 +360,7 @@ export function worldChanges(before: WorldMemory | null, people: WorldPeople): W
|
|
|
329
360
|
}
|
|
330
361
|
const full = fullness(session);
|
|
331
362
|
if (tidied(was?.full ?? null, full)) events.push({ sess: session.id, type: "compact" });
|
|
363
|
+
for (const event of subEvents(session, was)) events.push(event);
|
|
332
364
|
const steps = stepEvents(session, people.steps.get(session.id), was);
|
|
333
365
|
for (const event of steps.events) events.push({ sess: session.id, ...event });
|
|
334
366
|
memory.set(session.id, {
|
|
@@ -338,6 +370,7 @@ export function worldChanges(before: WorldMemory | null, people: WorldPeople): W
|
|
|
338
370
|
step: steps.step,
|
|
339
371
|
running: steps.running,
|
|
340
372
|
full,
|
|
373
|
+
subs: session.subs.map((sub) => sub.id),
|
|
341
374
|
});
|
|
342
375
|
}
|
|
343
376
|
return { events, memory };
|
|
@@ -44,7 +44,11 @@ export interface WorldSession {
|
|
|
44
44
|
* Paseo's `paseo-entry.js` does, for the `subwait` bubble.
|
|
45
45
|
*/
|
|
46
46
|
waitingOn?: number;
|
|
47
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The provider's own sub-agents the agent has at work. The scene seats the ones already there
|
|
49
|
+
* when the person is first drawn; later ones come by `substart` and go by `substop`.
|
|
50
|
+
*/
|
|
51
|
+
subs: { id: string; type: string }[];
|
|
48
52
|
/**
|
|
49
53
|
* The context window, in tokens: the paper on the desk grows with it, and a flag stands in it
|
|
50
54
|
* from 85%. Absent when the provider has not said.
|
|
@@ -59,6 +63,10 @@ export interface WorldSession {
|
|
|
59
63
|
export interface WorldEvent {
|
|
60
64
|
sess: string;
|
|
61
65
|
type: WorldEventType;
|
|
66
|
+
/** On `substart` and `substop`: the sub-agent's id. */
|
|
67
|
+
agent?: string;
|
|
68
|
+
/** On `substart`: the kind of sub-agent, which is the name over its head. */
|
|
69
|
+
label?: string;
|
|
62
70
|
/** On a `fail` that is not the agent's own: what failed. The scene words the bubble by it. */
|
|
63
71
|
of?: "deploy";
|
|
64
72
|
}
|
|
@@ -77,6 +85,9 @@ export type WorldEventType =
|
|
|
77
85
|
| "web"
|
|
78
86
|
| "mcp"
|
|
79
87
|
| "agent"
|
|
88
|
+
/** A sub-agent of the provider's own comes in through the door, and leaves with its report. */
|
|
89
|
+
| "substart"
|
|
90
|
+
| "substop"
|
|
80
91
|
| "plan"
|
|
81
92
|
| "test"
|
|
82
93
|
| "commit"
|
package/docs/office.md
CHANGED
|
@@ -63,6 +63,15 @@ script), it is a command.
|
|
|
63
63
|
The reads are 5 s apart. A tool call that starts and ends between two of them, as a web search
|
|
64
64
|
often does, is the step of the read after it, for that one read.
|
|
65
65
|
|
|
66
|
+
A provider can also run sub-agents inside an agent's own session, as Claude's Agent tool does.
|
|
67
|
+
Those are no Paseo agents: they have no session, no card and no row. The office finds them in
|
|
68
|
+
the agent's timeline, as `Task` or `Agent` calls that still run, at its 5 s reads, and the 3D
|
|
69
|
+
floor draws each one as upstream draws a sub-agent: it comes in through the door, takes its brief
|
|
70
|
+
from the agent that started it, works, reports back when its call ends, and leaves. Its name is
|
|
71
|
+
the kind of sub-agent the provider gives ("Explore"), never its task. A call that starts and ends
|
|
72
|
+
between two reads is not seen, and a call older than the tail the office reads is missed. The 2D
|
|
73
|
+
floor and the lists do not show them.
|
|
74
|
+
|
|
66
75
|
An agent whose own turn has ended is not idle while an agent it started, or one those started,
|
|
67
76
|
runs, starts or waits for you: it waits on them. `waitingOnOf` in `shared/model.ts` is the one
|
|
68
77
|
place the rule is worked out. On both floors such an agent stays at its desk, at work; the
|
|
@@ -84,6 +93,18 @@ turn, and is offered only on a host whose SDK has an agent's
|
|
|
84
93
|
"Open session" shows the session in the office's column (see below) in every app, and the card
|
|
85
94
|
closes as it does. In walk-in mode, face an agent and press **E** or tap the on-screen prompt to open their workspace. The same action wakes a sleeping character. **Open in workspace** also opens the selected session’s Paseo workbench over the office. In the browser it uses the paired host’s own workspace, including files, diffs, terminals and session tools. **Office controls** offers session replies, permissions and the room board on native clients and when the workspace cannot be embedded. Closing the overlay returns to the same floor and camera.
|
|
86
95
|
|
|
96
|
+
## Team names
|
|
97
|
+
|
|
98
|
+
A room is a workspace and goes by the workspace's name, which is often a branch or a ticket.
|
|
99
|
+
"Rename team", under a room's title in the List view, gives the team a name of the office's own,
|
|
100
|
+
at most 40 characters. It is kept on the workspace in the plugin's data (`office.team.name`), so
|
|
101
|
+
it needs a host that keeps plugin data on workspaces, and every device sees it. The office shows
|
|
102
|
+
it wherever it showed the workspace's name: the room and its board, the session lists, the
|
|
103
|
+
stand-up and its notes, the team chat and the 3D floor. The workspace keeps its own name in Paseo,
|
|
104
|
+
and the room's card says which workspace it is. An empty name goes back to the workspace's.
|
|
105
|
+
|
|
106
|
+
The 3D floor remembers where a team sat by its name, so a renamed team is seated as a new one.
|
|
107
|
+
|
|
87
108
|
## Views
|
|
88
109
|
|
|
89
110
|
The office has three views: a 3D floor, a 2D floor and the list. A switch over the floor's top
|
|
@@ -568,6 +589,17 @@ its turn again, no new writer starts. "Stand-up notes" under the Stand-up card's
|
|
|
568
589
|
notes reader at the month’s newest entry. Select a date to read that entry, or use the month arrows to browse earlier files. The entry strip also includes the file’s introduction and Contents when present. Contents links open their entries. The
|
|
569
590
|
server reads only `daily-standup-YYYYMM.md` directly in the notes folder.
|
|
570
591
|
|
|
592
|
+
"Writer mode" in the settings is the mode the writer starts in. Its pills are the modes of the
|
|
593
|
+
provider the writer runs on, by the provider's own names, less the one that only plans: for Claude
|
|
594
|
+
Always Ask, Accept File Edits, Auto mode and Bypass; for Codex Default Permissions, Auto-review and
|
|
595
|
+
Full Access. "Office's choice" is no mode set: the writer accepts file edits where its provider
|
|
596
|
+
offers that, else takes the provider's default. Accepting edits approves edits only, so a writer
|
|
597
|
+
that calls another tool or a command then waits for an answer nobody gives at 8:00 and leaves no
|
|
598
|
+
entry; a mode that asks for less lets it finish. A mode that asks for nothing (Bypass, Full Access)
|
|
599
|
+
runs any tool or command unattended, and the row says so. A stored mode the provider does not
|
|
600
|
+
offer falls back to the office's choice, and the row says which mode is used. The mode holds from
|
|
601
|
+
the next run.
|
|
602
|
+
|
|
571
603
|
## Schedules
|
|
572
604
|
|
|
573
605
|
The office runs three schedules of its own (`server/local-schedules.ts`): the stand-up notes at 08:00
|
|
@@ -716,8 +748,10 @@ quarterly fire drill. They run on the office clock. During the 12:30–13:30 des
|
|
|
716
748
|
floor pauses new activities. Street outings are separate.
|
|
717
749
|
|
|
718
750
|
The accountant reads provider-reported spending. HR uses the repository’s first commit month for
|
|
719
|
-
birthdays. The tenure ledger identifies each team by
|
|
720
|
-
|
|
751
|
+
birthdays. The tenure ledger identifies each team by the name it goes by. A team that
|
|
752
|
+
takes another name, the office's own or its workspace's in Paseo, keeps its record while the
|
|
753
|
+
office runs; a workspace renamed in Paseo while the office is not loaded starts a new record and
|
|
754
|
+
the previous name goes quiet. The first set of workspaces is permanent. A later team
|
|
721
755
|
can graduate after 20 turns over
|
|
722
756
|
two days. A previously active team can have a farewell after 30 quiet days. The lift is serviced
|
|
723
757
|
for three minutes at server start or five when the scene build has changed. Commits put letters in the post box and pushes send the postman to collect them. The other indoor scenes
|
package/index.server.ts
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
} from "./server/incidents-schedule.js";
|
|
45
45
|
import { probeSentry } from "./server/incidents-sentry.js";
|
|
46
46
|
import { createIncidentsStore, type IncidentsStore } from "./server/incidents-store.js";
|
|
47
|
+
import { TEAM_NAME_KEY, teamNameOf, tidyTeamName } from "./shared/team-name.js";
|
|
47
48
|
import {
|
|
48
49
|
changeSavedTrackers,
|
|
49
50
|
createTrackerCredentialsStore,
|
|
@@ -58,6 +59,7 @@ import {
|
|
|
58
59
|
liveHubPorts,
|
|
59
60
|
liveJanitorPorts,
|
|
60
61
|
liveNotesPorts,
|
|
62
|
+
readWriterModes,
|
|
61
63
|
liveScriptLogPorts,
|
|
62
64
|
liveSkillsPorts,
|
|
63
65
|
} from "./server/live-ports.js";
|
|
@@ -107,6 +109,8 @@ import {
|
|
|
107
109
|
dutiesSaveRpc,
|
|
108
110
|
dutyActedRpc,
|
|
109
111
|
incidentsDismissRpc,
|
|
112
|
+
notesModesRpc,
|
|
113
|
+
teamRenameRpc,
|
|
110
114
|
trackersSaveRpc,
|
|
111
115
|
trackersTestRpc,
|
|
112
116
|
type TrackersChange,
|
|
@@ -649,6 +653,35 @@ export function createOfficePlugin(
|
|
|
649
653
|
throw error;
|
|
650
654
|
}
|
|
651
655
|
}
|
|
656
|
+
server.handle(teamRenameRpc, async ({ workspaceId, name }, context) => {
|
|
657
|
+
holder.remember(context.paseo);
|
|
658
|
+
try {
|
|
659
|
+
const workspace = context.paseo.workspaces.ref(workspaceId);
|
|
660
|
+
const current = await workspace.refresh();
|
|
661
|
+
if (current === null) return { ok: false as const, problem: "The workspace is gone" };
|
|
662
|
+
const next = tidyTeamName(name);
|
|
663
|
+
// Null removes the key, and the team goes by the workspace's name again.
|
|
664
|
+
await workspace.setMetadata({ [TEAM_NAME_KEY]: next === "" ? null : next });
|
|
665
|
+
const shown = next === "" ? current.name : next;
|
|
666
|
+
// The directory's next view would carry the tenure over too; a restart before it would not.
|
|
667
|
+
(await lifeReady)?.renamed(teamNameOf(current), shown);
|
|
668
|
+
return { ok: true as const, name: shown };
|
|
669
|
+
} catch (error) {
|
|
670
|
+
log(`[office] team rename failed: ${errorMessage(error)}`);
|
|
671
|
+
return { ok: false as const, problem: errorMessage(error) };
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
server.handle(notesModesRpc, async (_input, context) => {
|
|
675
|
+
holder.remember(context.paseo);
|
|
676
|
+
try {
|
|
677
|
+
const values = await readHostSettings();
|
|
678
|
+
// The provider is asked for the notes folder, as the writer's start asks it.
|
|
679
|
+
const cwd = values.notesFolder.trim() || homedir();
|
|
680
|
+
return { ok: true as const, ...(await readWriterModes(holder, cwd, values.notesMode)) };
|
|
681
|
+
} catch (error) {
|
|
682
|
+
return { ok: false as const, problem: errorMessage(error) };
|
|
683
|
+
}
|
|
684
|
+
});
|
|
652
685
|
// One save at a time: each starts from what the one before it kept.
|
|
653
686
|
let trackerSaves: Promise<unknown> = Promise.resolve();
|
|
654
687
|
server.handle(trackersSaveRpc, (input) => {
|
|
@@ -759,7 +792,8 @@ export function createOfficePlugin(
|
|
|
759
792
|
? (await context.paseo.agents.ref(agent.parentAgentId).refresh())?.agent.workspaceId
|
|
760
793
|
: null);
|
|
761
794
|
if (!workspaceId) return null;
|
|
762
|
-
|
|
795
|
+
const workspace = await context.paseo.workspaces.ref(workspaceId).refresh();
|
|
796
|
+
return workspace ? teamNameOf(workspace) : null;
|
|
763
797
|
});
|
|
764
798
|
} catch (error) {
|
|
765
799
|
log(`[office] agent.turn.after failed: ${errorMessage(error)}`);
|
package/package.json
CHANGED
package/server/activity.ts
CHANGED
|
@@ -5,6 +5,8 @@ import {
|
|
|
5
5
|
type ChecklistCounts,
|
|
6
6
|
type ChecklistProgress,
|
|
7
7
|
type Checklists,
|
|
8
|
+
type SubagentCall,
|
|
9
|
+
type SubagentCalls,
|
|
8
10
|
} from "../shared/contracts.js";
|
|
9
11
|
import type { ActivityKind, ActivityStep, TestResult } from "../shared/names.js";
|
|
10
12
|
import { errorMessage } from "./errors.js";
|
|
@@ -286,6 +288,30 @@ export function readChecklist(items: readonly ActivityItem[]): {
|
|
|
286
288
|
return { steps, progress };
|
|
287
289
|
}
|
|
288
290
|
|
|
291
|
+
/** The most sub-agents told of one agent: a tail holds no more calls than it has items. */
|
|
292
|
+
const SUBAGENTS_MAX = 12;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* The sub-agents an agent has at work: its `Task` or `Agent` calls in the tail that still run, the
|
|
296
|
+
* oldest first. Each is told by its call's id and the kind of sub-agent the provider names, never
|
|
297
|
+
* by its task, which is the prompt it was given. A call older than the tail is not seen.
|
|
298
|
+
*/
|
|
299
|
+
export function runningSubagents(items: readonly ActivityItem[]): SubagentCall[] {
|
|
300
|
+
const calls: SubagentCall[] = [];
|
|
301
|
+
const seen = new Set<string>();
|
|
302
|
+
for (const item of items) {
|
|
303
|
+
if (item.type !== "tool_call" || item.status !== "running") continue;
|
|
304
|
+
const id = item.callId;
|
|
305
|
+
if (typeof id !== "string" || id === "" || seen.has(id)) continue;
|
|
306
|
+
if (toolKind(item) !== "subagent") continue;
|
|
307
|
+
seen.add(id);
|
|
308
|
+
const named = field(item.detail, "subAgentType");
|
|
309
|
+
const type = typeof named === "string" ? named.trim().slice(0, 40) : "";
|
|
310
|
+
calls.push({ id, type: type === "" ? "agent" : type });
|
|
311
|
+
}
|
|
312
|
+
return calls.slice(-SUBAGENTS_MAX);
|
|
313
|
+
}
|
|
314
|
+
|
|
289
315
|
/** What the poller knows of each running agent: its line, and its step when it is at one. */
|
|
290
316
|
export type ActivityLines = Readonly<Record<string, string>>;
|
|
291
317
|
export type ActivitySteps = Readonly<Record<string, ActivityStep>>;
|
|
@@ -306,6 +332,8 @@ export interface ActivityPorts {
|
|
|
306
332
|
doing: ActivitySteps,
|
|
307
333
|
checklists: Readonly<Checklists>,
|
|
308
334
|
progress: Readonly<ChecklistCounts>,
|
|
335
|
+
/** The sub-agents each agent read this round has at work; an agent with none is absent. */
|
|
336
|
+
subagents: Readonly<SubagentCalls>,
|
|
309
337
|
): void;
|
|
310
338
|
}
|
|
311
339
|
|
|
@@ -337,6 +365,7 @@ export function startActivityPoller(ports: ActivityPorts): ActivityPoller {
|
|
|
337
365
|
let previous: ActivityLines = {};
|
|
338
366
|
let previousSteps: ActivitySteps = {};
|
|
339
367
|
let previousChecklists = "[{},{}]";
|
|
368
|
+
let previousSubagents = "{}";
|
|
340
369
|
let wasRunning: readonly string[] = [];
|
|
341
370
|
// The calls each agent's last read saw, kept while the poller runs: an agent's next turn is
|
|
342
371
|
// read against them too. A prompt ends the look back, so an old turn's call is never told.
|
|
@@ -348,9 +377,12 @@ export function startActivityPoller(ports: ActivityPorts): ActivityPoller {
|
|
|
348
377
|
steps: Record<string, ActivityStep>,
|
|
349
378
|
checklists: Checklists,
|
|
350
379
|
progress: ChecklistCounts,
|
|
380
|
+
subagents: SubagentCalls,
|
|
351
381
|
): Promise<void> {
|
|
352
382
|
try {
|
|
353
383
|
const items = await ports.tail(agentId);
|
|
384
|
+
const working = runningSubagents(items);
|
|
385
|
+
if (working.length > 0) subagents[agentId] = working;
|
|
354
386
|
const line = describeActivity(items);
|
|
355
387
|
if (line !== null) next[agentId] = line;
|
|
356
388
|
const seen = seenCalls.get(agentId);
|
|
@@ -398,10 +430,12 @@ export function startActivityPoller(ports: ActivityPorts): ActivityPoller {
|
|
|
398
430
|
const steps: Record<string, ActivityStep> = {};
|
|
399
431
|
const checklists: Checklists = {};
|
|
400
432
|
const progress: ChecklistCounts = {};
|
|
433
|
+
// An agent whose read failed has none here, so its sub-agents leave until a read succeeds.
|
|
434
|
+
const subagents: SubagentCalls = {};
|
|
401
435
|
const running = [...ports.running()];
|
|
402
436
|
for (const agentId of running) {
|
|
403
437
|
if (stopped) return;
|
|
404
|
-
await readOne(agentId, next, steps, checklists, progress);
|
|
438
|
+
await readOne(agentId, next, steps, checklists, progress, subagents);
|
|
405
439
|
}
|
|
406
440
|
for (const agentId of wasRunning) {
|
|
407
441
|
if (stopped) return;
|
|
@@ -409,15 +443,18 @@ export function startActivityPoller(ports: ActivityPorts): ActivityPoller {
|
|
|
409
443
|
}
|
|
410
444
|
wasRunning = running;
|
|
411
445
|
const checklistsText = JSON.stringify([checklists, progress]);
|
|
446
|
+
const subagentsText = JSON.stringify(subagents);
|
|
412
447
|
const unchanged =
|
|
413
448
|
sameLines(previous, next) &&
|
|
414
449
|
sameSteps(previousSteps, steps) &&
|
|
415
|
-
checklistsText === previousChecklists
|
|
450
|
+
checklistsText === previousChecklists &&
|
|
451
|
+
subagentsText === previousSubagents;
|
|
416
452
|
if (stopped || unchanged) return;
|
|
417
453
|
previous = next;
|
|
418
454
|
previousSteps = steps;
|
|
419
455
|
previousChecklists = checklistsText;
|
|
420
|
-
|
|
456
|
+
previousSubagents = subagentsText;
|
|
457
|
+
ports.onChange(next, steps, checklists, progress, subagents);
|
|
421
458
|
}
|
|
422
459
|
|
|
423
460
|
function runLogged(): void {
|
package/server/directory.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type WorkspaceTicket,
|
|
14
14
|
} from "../shared/contracts.js";
|
|
15
15
|
import { APPEARANCE_KEY, AppearanceSchema } from "../shared/appearance.js";
|
|
16
|
+
import { storedTeamName } from "../shared/team-name.js";
|
|
16
17
|
import { NEXT_KEY, NUMBER_KEY, storedNumber } from "./subagent-names.js";
|
|
17
18
|
|
|
18
19
|
// PARENT_AGENT_ID_LABEL in packages/protocol/src/agent-labels.ts. Server code may import the
|
|
@@ -352,9 +353,12 @@ export function projectWorkspace(workspace: DirectoryWorkspaceInput): OfficeWork
|
|
|
352
353
|
const pullRequest = pullRequestOf(workspace);
|
|
353
354
|
const { additions = 0, deletions = 0 } = workspace.diffStat ?? {};
|
|
354
355
|
const scripts = (workspace.scripts ?? []).map(scriptOf);
|
|
356
|
+
const teamName = storedTeamName(workspace.metadata);
|
|
355
357
|
return {
|
|
356
358
|
id: workspace.id,
|
|
357
|
-
name
|
|
359
|
+
// The team's name is the workspace's everywhere in the office once the owner has given one.
|
|
360
|
+
name: teamName ?? workspace.name,
|
|
361
|
+
...(teamName === null ? {} : { workspaceName: workspace.name }),
|
|
358
362
|
projectName: workspace.projectDisplayName,
|
|
359
363
|
...(branch ? { branch } : {}),
|
|
360
364
|
...(ticket ? { ticket } : {}),
|