paseo-office 0.2.1 → 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.
@@ -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
- subs: never[];
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
@@ -472,7 +493,7 @@ The gear in fullscreen opens **Office settings** over the floor. You can also op
472
493
  | ---------- | -------------------------------------------------------------------------------------------- |
473
494
  | Appearance | Office view, floor plan, outdoor scene, lighting, sound, scene language and shared branding. |
474
495
  | Automation | Agent wake-ups, agent tools, stand-up notes folder, time zone and scheduled days. |
475
- | Services | Jira projects, Sentry organization and projects, and the optional weather service. |
496
+ | Services | Jira and Sentry connections and projects, and the optional weather service. |
476
497
 
477
498
  View and sound preferences apply to the device. The host stores the floor plan, branding, automation and integration settings. The [branding defaults](#custom-branding) can also come from the daemon environment.
478
499
 
@@ -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
@@ -589,12 +621,23 @@ office sets them from its settings each time it starts and at each save, and sto
589
621
  ## Incidents
590
622
 
591
623
  The office rings my-office's incident alarm for a new Jira bug or Sentry issue. "Jira projects"
592
- takes project keys, and a new issue of type Bug in one of them rings; it needs
593
- `ATLASSIAN_BASE_URL`, `ATLASSIAN_EMAIL` and `ATLASSIAN_API_TOKEN` in the daemon's environment.
594
- "Sentry organisation", "Sentry projects" and "Sentry address" (`https://sentry.io` by default) do
595
- the same for a new unresolved Sentry issue with `SENTRY_AUTH_TOKEN`. A changed token takes a daemon
596
- restart, and the settings name the variables to set, never a value. Jira does not refuse a project
597
- key it does not know, so a mistyped key rings nothing and shows no problem.
624
+ takes project keys, and a new issue of type Bug in one of them rings. "Sentry organisation",
625
+ "Sentry projects" and "Sentry address" (`https://sentry.io` by default) do the same for a new
626
+ unresolved Sentry issue. Jira does not refuse a project key it does not know, so a mistyped key
627
+ rings nothing and shows no problem.
628
+
629
+ Each tracker needs a sign-in, set under Services in the office's settings. Jira takes its
630
+ address, the account's email and an API token; Sentry takes an auth token. "Save connection"
631
+ writes them to `office/trackers.json` in Paseo's home on the host, a file only the daemon's user
632
+ can read (mode 600). The tokens are stored there as typed, not encrypted. A saved token is never
633
+ sent back to the app: its field stays empty, and the settings say only where the sign-in comes
634
+ from. "Test connection" sends one signed-in request with what is typed and saves nothing; a
635
+ Sentry test asks the organisation and address already set. "Remove" deletes a saved connection.
636
+ A save holds from the next check, with no daemon restart.
637
+
638
+ A host with no saved connection reads `ATLASSIAN_BASE_URL`, `ATLASSIAN_EMAIL` and
639
+ `ATLASSIAN_API_TOKEN`, and `SENTRY_AUTH_TOKEN`, from the daemon's environment, as before. A saved
640
+ connection comes first, and a changed variable takes a daemon restart.
598
641
 
599
642
  The first check records what exists and rings nothing. Each check reads from the last successful
600
643
  one less 10 minutes, because Jira compares `created` to the minute; the office writes the time in
@@ -705,8 +748,10 @@ quarterly fire drill. They run on the office clock. During the 12:30–13:30 des
705
748
  floor pauses new activities. Street outings are separate.
706
749
 
707
750
  The accountant reads provider-reported spending. HR uses the repository’s first commit month for
708
- birthdays. The tenure ledger identifies each team by workspace name. A rename starts a new team
709
- record and the previous name goes quiet. The first set of workspaces is permanent. A later team
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
710
755
  can graduate after 20 turns over
711
756
  two days. A previously active team can have a farewell after 30 quiet days. The lift is serviced
712
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
@@ -34,14 +34,24 @@ import { createHub } from "./server/hub.js";
34
34
  import { createWeatherService } from "./server/weather-service.js";
35
35
  import { createWeatherReader } from "./server/weather-read.js";
36
36
  import { createIncidentsCheck, type IncidentsCheckState } from "./server/incidents-check.js";
37
- import { jiraEnv } from "./server/incidents-jira.js";
37
+ import { TrackerProblem } from "./server/incidents-http.js";
38
+ import { probeJira } from "./server/incidents-jira.js";
38
39
  import {
39
40
  createIncidentsSchedule,
40
41
  INCIDENTS_SCHEDULE,
41
42
  incidentsReaders,
43
+ type IncidentsSettings,
42
44
  } from "./server/incidents-schedule.js";
43
- import { sentryToken } from "./server/incidents-sentry.js";
45
+ import { probeSentry } from "./server/incidents-sentry.js";
44
46
  import { createIncidentsStore, type IncidentsStore } from "./server/incidents-store.js";
47
+ import { TEAM_NAME_KEY, teamNameOf, tidyTeamName } from "./shared/team-name.js";
48
+ import {
49
+ changeSavedTrackers,
50
+ createTrackerCredentialsStore,
51
+ NO_SAVED_TRACKERS,
52
+ trackerCredentials,
53
+ type TrackerCredentialsStore,
54
+ } from "./server/tracker-credentials.js";
45
55
  import { tidyAgent } from "./server/janitor.js";
46
56
  import {
47
57
  liveAgentPorts,
@@ -49,6 +59,7 @@ import {
49
59
  liveHubPorts,
50
60
  liveJanitorPorts,
51
61
  liveNotesPorts,
62
+ readWriterModes,
52
63
  liveScriptLogPorts,
53
64
  liveSkillsPorts,
54
65
  } from "./server/live-ports.js";
@@ -83,6 +94,7 @@ import {
83
94
  dutiesFile,
84
95
  hostSkillFolders,
85
96
  incidentsFile,
97
+ trackersFile,
86
98
  notesWriterFile,
87
99
  type SkillFolder,
88
100
  } from "./server/paths.js";
@@ -97,6 +109,13 @@ import {
97
109
  dutiesSaveRpc,
98
110
  dutyActedRpc,
99
111
  incidentsDismissRpc,
112
+ notesModesRpc,
113
+ teamRenameRpc,
114
+ trackersSaveRpc,
115
+ trackersTestRpc,
116
+ type TrackersChange,
117
+ type TrackersProbe,
118
+ type TrackersResult,
100
119
  janitorRpc,
101
120
  machineSubscription,
102
121
  notesReadRpc,
@@ -123,13 +142,15 @@ export interface OfficePluginDeps {
123
142
  notesStore: NotesStore;
124
143
  /** Where the incidents check keeps the open incidents and what each tracker has shown. */
125
144
  incidentsStore: IncidentsStore;
145
+ /** Where the tracker connections saved from the settings are kept. */
146
+ trackerStore: TrackerCredentialsStore;
126
147
  /** Where the team chat keeps its conversation. */
127
148
  chatStore: ChatStore;
128
149
  tenureFile: LifeFile<TenureLedger>;
129
150
  liftFile: LifeFile<LiftKept>;
130
151
  /** The owner's duty list. */
131
152
  dutiesFile: LifeFile<DutiesFile>;
132
- /** The daemon's environment: the trackers' tokens are read from it. */
153
+ /** The daemon's environment: a tracker with no saved connection takes its token from it. */
133
154
  env: NodeJS.ProcessEnv;
134
155
  clock: Clock;
135
156
  log(message: string): void;
@@ -291,18 +312,40 @@ export function createOfficePlugin(
291
312
  // The check's last state, kept so a save that changes the schedule's error pushes it again.
292
313
  // Null until the store was read: the snapshot has no incidents before then.
293
314
  let checked: IncidentsCheckState | null = null;
315
+ // The connections saved from the settings, read once and kept: a save replaces them here too.
316
+ let savedTrackers = NO_SAVED_TRACKERS;
317
+ const trackersLoaded = deps.trackerStore.load().then(
318
+ (saved) => {
319
+ savedTrackers = saved;
320
+ return undefined;
321
+ },
322
+ (error: unknown) => log(`[office] tracker connections failed to load: ${errorMessage(error)}`),
323
+ );
324
+ const credentials = () => trackerCredentials(savedTrackers, deps.env);
294
325
  function pushIncidents(): void {
295
326
  if (checked === null) return;
327
+ const { jira, sentry } = credentials();
296
328
  hub.setIncidents({
297
329
  ...checked,
298
- jiraReady: jiraEnv(deps.env) !== null,
299
- sentryReady: sentryToken(deps.env) !== null,
330
+ jiraReady: jira !== null,
331
+ sentryReady: sentry !== null,
332
+ connections: {
333
+ jira: {
334
+ source: jira?.source ?? "none",
335
+ baseUrl: jira?.baseUrl ?? "",
336
+ email: jira?.email ?? "",
337
+ },
338
+ sentry: { source: sentry?.source ?? "none" },
339
+ },
300
340
  scheduleError: incidentsSchedule.error(),
301
341
  });
302
342
  }
303
343
  // The settings are read at each run, so a save holds from the next check.
304
344
  const incidents = createIncidentsCheck({
305
- readers: async () => incidentsReaders(await readHostSettings(), deps.env),
345
+ readers: async () => {
346
+ await trackersLoaded;
347
+ return incidentsReaders(await readHostSettings(), credentials());
348
+ },
306
349
  store: deps.incidentsStore,
307
350
  now: () => deps.clock.now(),
308
351
  log,
@@ -416,7 +459,11 @@ export function createOfficePlugin(
416
459
  await writer
417
460
  .settingsChanged()
418
461
  .catch((error: unknown) => log(`[office] notes state failed: ${errorMessage(error)}`));
419
- const trackersOn = Object.keys(incidentsReaders(state.values, deps.env)).length > 0;
462
+ await followTrackers(state.values);
463
+ }
464
+ async function followTrackers(values: IncidentsSettings): Promise<void> {
465
+ await trackersLoaded;
466
+ const trackersOn = Object.keys(incidentsReaders(values, credentials())).length > 0;
420
467
  await incidentsSchedule.sync(trackersOn);
421
468
  // With every tracker off no run comes again. One run with no reader drops the problems and
422
469
  // closes what is a day old.
@@ -565,6 +612,88 @@ export function createOfficePlugin(
565
612
  server.handle(incidentsDismissRpc, ({ ids }) =>
566
613
  guarded("incidents dismiss", async () => ({ dismissed: await incidents.dismiss(ids) })),
567
614
  );
615
+ async function saveTrackers(input: TrackersChange): Promise<TrackersResult> {
616
+ await trackersLoaded;
617
+ const changed = changeSavedTrackers(savedTrackers, input);
618
+ if ("problem" in changed) return { ok: false, problem: changed.problem };
619
+ await deps.trackerStore.save(changed.saved);
620
+ savedTrackers = changed.saved;
621
+ // The check's schedule follows the new connection; the settings may be unreadable.
622
+ await readHostSettings().then(followTrackers, pushIncidents);
623
+ return { ok: true };
624
+ }
625
+ async function probeTracker(input: TrackersProbe): Promise<void | string> {
626
+ const kept = credentials();
627
+ if (input.tracker === "jira") {
628
+ // The typed connection as a save would keep it, with the token in use when none is typed.
629
+ const token = input.token.trim() || (kept.jira?.token ?? "");
630
+ const typed = changeSavedTrackers(NO_SAVED_TRACKERS, {
631
+ action: "save-jira",
632
+ ...input,
633
+ token,
634
+ });
635
+ if ("problem" in typed) return typed.problem;
636
+ if (typed.saved.jira === undefined) return "Enter the Jira connection";
637
+ return probeJira({ ...typed.saved.jira, tokenVariable: "the Jira API token" });
638
+ }
639
+ const token = input.token.trim() || (kept.sentry?.token ?? "");
640
+ if (token === "") return "Enter the Sentry auth token";
641
+ const { sentryUrl: url, sentryOrg: org } = await readHostSettings();
642
+ if (org.trim() === "") return "Set the Sentry organisation first";
643
+ return probeSentry({ url, org, token, tokenVariable: "the Sentry auth token" });
644
+ }
645
+ async function testTracker(input: TrackersProbe): Promise<TrackersResult> {
646
+ await trackersLoaded;
647
+ try {
648
+ const problem = await probeTracker(input);
649
+ return typeof problem === "string" ? { ok: false, problem } : { ok: true };
650
+ } catch (error) {
651
+ // A tracker's problem is written to be shown; anything else may quote what was typed.
652
+ if (error instanceof TrackerProblem) return { ok: false, problem: error.message };
653
+ throw error;
654
+ }
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
+ });
685
+ // One save at a time: each starts from what the one before it kept.
686
+ let trackerSaves: Promise<unknown> = Promise.resolve();
687
+ server.handle(trackersSaveRpc, (input) => {
688
+ const run = trackerSaves.then(() =>
689
+ guarded("tracker connection save", () => saveTrackers(input)),
690
+ );
691
+ trackerSaves = run.catch(() => undefined);
692
+ return run;
693
+ });
694
+ server.handle(trackersTestRpc, (input) =>
695
+ guarded("tracker connection test", () => testTracker(input)),
696
+ );
568
697
  server.handle(chatRpc, (input, context) => {
569
698
  holder.remember(context.paseo);
570
699
  return guarded("chat", async () => {
@@ -663,7 +792,8 @@ export function createOfficePlugin(
663
792
  ? (await context.paseo.agents.ref(agent.parentAgentId).refresh())?.agent.workspaceId
664
793
  : null);
665
794
  if (!workspaceId) return null;
666
- return (await context.paseo.workspaces.ref(workspaceId).refresh())?.name ?? null;
795
+ const workspace = await context.paseo.workspaces.ref(workspaceId).refresh();
796
+ return workspace ? teamNameOf(workspace) : null;
667
797
  });
668
798
  } catch (error) {
669
799
  log(`[office] agent.turn.after failed: ${errorMessage(error)}`);
@@ -755,6 +885,10 @@ export default function contribute(server: PluginServerContext): () => Promise<v
755
885
  }),
756
886
  notesStore: createNotesStore({ file: notesWriterFile(process.env, homedir()), log }),
757
887
  incidentsStore: createIncidentsStore({ file: incidentsFile(process.env, homedir()), log }),
888
+ trackerStore: createTrackerCredentialsStore({
889
+ file: trackersFile(process.env, homedir()),
890
+ log,
891
+ }),
758
892
  tenureFile: createLifeFile(tenureFile(process.env, homedir()), TenureLedgerSchema),
759
893
  liftFile: createLifeFile(liftFile(process.env, homedir()), LiftKeptSchema),
760
894
  dutiesFile: dutiesFileStore(dutiesFile(process.env, homedir()), { now: () => Date.now(), log }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paseo-office",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "A community port of my-office for Paseo: your agents at their desks, in 3D.",
5
5
  "keywords": [
6
6
  "3d",
@@ -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
- ports.onChange(next, steps, checklists, progress);
456
+ previousSubagents = subagentsText;
457
+ ports.onChange(next, steps, checklists, progress, subagents);
421
458
  }
422
459
 
423
460
  function runLogged(): void {
@@ -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: workspace.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 } : {}),
package/server/hub.ts CHANGED
@@ -12,6 +12,7 @@ import type {
12
12
  OfficeSnapshot,
13
13
  OfficeWorkspace,
14
14
  Post,
15
+ SubagentCalls,
15
16
  WakeState,
16
17
  WorkspaceScript,
17
18
  } from "../shared/contracts.js";
@@ -54,6 +55,7 @@ export interface HubPorts {
54
55
  doing: ActivitySteps,
55
56
  checklists: Readonly<Checklists>,
56
57
  progress?: Readonly<ChecklistCounts>,
58
+ subagents?: Readonly<SubagentCalls>,
57
59
  ) => void,
58
60
  ): () => void;
59
61
  timers: Timers;
@@ -138,6 +140,8 @@ export function createHub(ports: HubPorts): Hub {
138
140
  // Kept after an agent stops, as the poller reads only running agents; dropped when it leaves.
139
141
  let checklists: Checklists = {};
140
142
  let checklistProgress: ChecklistCounts = {};
143
+ /** The provider's own sub-agents each running agent has at work, as the last round read them. */
144
+ let subagents: Readonly<SubagentCalls> = {};
141
145
  let boards: Record<string, readonly Post[]> = {};
142
146
  let wake: WakeState = { paused: false, queued: {} };
143
147
  let notes: NotesState | null = null;
@@ -168,6 +172,7 @@ export function createHub(ports: HubPorts): Hub {
168
172
  workspaces: [...view.workspaces],
169
173
  activity: { ...activity },
170
174
  doing: { ...doing },
175
+ ...(Object.keys(subagents).length ? { subagents: { ...subagents } } : {}),
171
176
  checklists: { ...checklists },
172
177
  ...(Object.keys(checklistProgress).length
173
178
  ? { checklistProgress: { ...checklistProgress } }
@@ -285,6 +290,7 @@ export function createHub(ports: HubPorts): Hub {
285
290
  type: "activity",
286
291
  activity: { ...activity },
287
292
  doing: { ...doing },
293
+ ...(Object.keys(subagents).length ? { subagents: { ...subagents } } : {}),
288
294
  checklists: { ...checklists },
289
295
  ...(Object.keys(checklistProgress).length
290
296
  ? { checklistProgress: { ...checklistProgress } }
@@ -335,9 +341,11 @@ export function createHub(ports: HubPorts): Hub {
335
341
  steps: ActivitySteps,
336
342
  report: Readonly<Checklists>,
337
343
  progress: Readonly<ChecklistCounts> = {},
344
+ working: Readonly<SubagentCalls> = {},
338
345
  ): void {
339
346
  activity = next;
340
347
  doing = steps;
348
+ subagents = working;
341
349
  const listed = new Set(view.agents.map((agent) => agent.id));
342
350
  const fresh = Object.entries(report).filter(([agentId]) => listed.has(agentId));
343
351
  const merged = Object.entries({ ...checklists, ...Object.fromEntries(fresh) });
@@ -444,6 +452,7 @@ export function createHub(ports: HubPorts): Hub {
444
452
  doing = {};
445
453
  checklists = {};
446
454
  checklistProgress = {};
455
+ subagents = {};
447
456
  const stop = stopDirectory;
448
457
  stopDirectory = null;
449
458
  view = EMPTY_VIEW;