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
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** A provider's modes, as Paseo lists them. */
|
|
2
|
+
export interface ProviderModes {
|
|
3
|
+
modes?: readonly { id: string; label?: string | null }[] | null;
|
|
4
|
+
defaultModeId?: string | null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface WriterModeChoice {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Claude's "Accept File Edits", which a provider extending Claude lists too.
|
|
13
|
+
const ACCEPT_EDITS_MODE = "acceptEdits";
|
|
14
|
+
// A writer that only plans writes nothing, so the mode is not offered.
|
|
15
|
+
const PLAN_MODE = "plan";
|
|
16
|
+
|
|
17
|
+
/** The modes the stand-up writer can be started in: the provider's, less the one that only plans. */
|
|
18
|
+
export function writerModeChoices(provider: ProviderModes): WriterModeChoice[] {
|
|
19
|
+
return (provider.modes ?? [])
|
|
20
|
+
.filter((mode) => mode.id !== PLAN_MODE)
|
|
21
|
+
.map((mode) => ({ id: mode.id, label: mode.label?.trim() || mode.id }));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface WriterMode {
|
|
25
|
+
/** The mode the writer starts in; absent where the provider names none. */
|
|
26
|
+
modeId?: string;
|
|
27
|
+
/** A mode was asked for and the provider does not offer it. */
|
|
28
|
+
fellBack: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The mode the writer starts in. `wanted` is the settings' mode, empty for none: then, and for a
|
|
33
|
+
* mode the provider does not offer, it is the provider's mode that accepts edits, else its
|
|
34
|
+
* default. Codex's and OpenCode's default modes edit in the workspace without asking already.
|
|
35
|
+
*/
|
|
36
|
+
export function writerMode(provider: ProviderModes, wanted: string): WriterMode {
|
|
37
|
+
const choices = writerModeChoices(provider);
|
|
38
|
+
const asked = wanted.trim();
|
|
39
|
+
if (asked !== "" && choices.some((mode) => mode.id === asked)) {
|
|
40
|
+
return { modeId: asked, fellBack: false };
|
|
41
|
+
}
|
|
42
|
+
const acceptsEdits = choices.some((mode) => mode.id === ACCEPT_EDITS_MODE);
|
|
43
|
+
const modeId = acceptsEdits ? ACCEPT_EDITS_MODE : (provider.defaultModeId ?? undefined);
|
|
44
|
+
return { ...(modeId ? { modeId } : {}), fellBack: asked !== "" };
|
|
45
|
+
}
|
package/shared/contracts.ts
CHANGED
|
@@ -120,9 +120,22 @@ export const WorkspacePullRequestSchema = z.object({
|
|
|
120
120
|
});
|
|
121
121
|
export type WorkspacePullRequest = z.output<typeof WorkspacePullRequestSchema>;
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* A sub-agent a provider runs inside an agent's own session, as the tool call that started it.
|
|
125
|
+
* It is no Paseo agent: it has no session of its own. `type` is the kind of sub-agent the
|
|
126
|
+
* provider names ("Explore"), never its task.
|
|
127
|
+
*/
|
|
128
|
+
export const SubagentCallSchema = z.object({ id: z.string(), type: z.string() });
|
|
129
|
+
export type SubagentCall = z.output<typeof SubagentCallSchema>;
|
|
130
|
+
export const SubagentCallsSchema = z.record(z.string(), z.array(SubagentCallSchema));
|
|
131
|
+
export type SubagentCalls = z.output<typeof SubagentCallsSchema>;
|
|
132
|
+
|
|
123
133
|
export const OfficeWorkspaceSchema = z.object({
|
|
124
134
|
id: z.string(),
|
|
135
|
+
/** The name its team goes by: the office's own when the owner gave one, else the workspace's. */
|
|
125
136
|
name: z.string(),
|
|
137
|
+
/** The workspace's own name in Paseo; present only while the team goes by another. */
|
|
138
|
+
workspaceName: z.string().optional(),
|
|
126
139
|
projectName: z.string(),
|
|
127
140
|
branch: z.string().optional(),
|
|
128
141
|
ticket: WorkspaceTicketSchema.optional(),
|
|
@@ -468,6 +481,8 @@ export const OfficeSnapshotSchema = z.object({
|
|
|
468
481
|
activity: z.record(z.string(), z.string()),
|
|
469
482
|
/** The step of each running agent: the tool call it is at, or made since the read before. */
|
|
470
483
|
doing: z.record(z.string(), ActivityStepSchema).optional(),
|
|
484
|
+
/** The provider's own sub-agents each running agent has at work now; absent from an older server. */
|
|
485
|
+
subagents: SubagentCallsSchema.optional(),
|
|
471
486
|
/** Each agent's own checklist, kept after the agent stops. */
|
|
472
487
|
checklists: ChecklistsSchema.optional(),
|
|
473
488
|
checklistProgress: ChecklistCountsSchema.optional(),
|
|
@@ -493,6 +508,7 @@ export const OfficeEventSchema = z.discriminatedUnion("type", [
|
|
|
493
508
|
type: z.literal("activity"),
|
|
494
509
|
activity: z.record(z.string(), z.string()),
|
|
495
510
|
doing: z.record(z.string(), ActivityStepSchema).optional(),
|
|
511
|
+
subagents: SubagentCallsSchema.optional(),
|
|
496
512
|
checklists: ChecklistsSchema.optional(),
|
|
497
513
|
checklistProgress: ChecklistCountsSchema.optional(),
|
|
498
514
|
}),
|
|
@@ -750,6 +766,44 @@ export const notesWriteRpc = defineRpc({
|
|
|
750
766
|
output: z.object({ started: z.boolean() }),
|
|
751
767
|
});
|
|
752
768
|
|
|
769
|
+
/**
|
|
770
|
+
* Gives a workspace's team a name of the office's own, kept on the workspace; an empty name goes
|
|
771
|
+
* back to the workspace's. The team's tenure follows the name.
|
|
772
|
+
*/
|
|
773
|
+
export const teamRenameRpc = defineRpc({
|
|
774
|
+
name: "office.team.rename.request",
|
|
775
|
+
input: z.object({ workspaceId: z.string().min(1), name: z.string().max(200) }),
|
|
776
|
+
output: z.union([
|
|
777
|
+
z.object({ ok: z.literal(true), name: z.string() }),
|
|
778
|
+
z.object({ ok: z.literal(false), problem: z.string() }),
|
|
779
|
+
]),
|
|
780
|
+
});
|
|
781
|
+
|
|
782
|
+
export const WriterModesSchema = z.object({
|
|
783
|
+
/** The provider the writer would start on now, by its label. */
|
|
784
|
+
provider: z.string(),
|
|
785
|
+
/** Its modes the writer can start in, by the provider's own names. */
|
|
786
|
+
modes: z.array(z.object({ id: z.string(), label: z.string() })),
|
|
787
|
+
/** The mode the settings come to; null where the provider names none. */
|
|
788
|
+
modeId: z.string().nullable(),
|
|
789
|
+
/** The settings name a mode this provider does not offer. */
|
|
790
|
+
fellBack: z.boolean(),
|
|
791
|
+
});
|
|
792
|
+
export type WriterModes = z.output<typeof WriterModesSchema>;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* The modes the stand-up writer can start in, for the settings. `problem` when no provider is
|
|
796
|
+
* ready or the settings cannot be read.
|
|
797
|
+
*/
|
|
798
|
+
export const notesModesRpc = defineRpc({
|
|
799
|
+
name: "office.notes.modes.request",
|
|
800
|
+
input: z.object({}),
|
|
801
|
+
output: z.union([
|
|
802
|
+
WriterModesSchema.extend({ ok: z.literal(true) }),
|
|
803
|
+
z.object({ ok: z.literal(false), problem: z.string() }),
|
|
804
|
+
]),
|
|
805
|
+
});
|
|
806
|
+
|
|
753
807
|
const JiraConnectionSchema = z.object({
|
|
754
808
|
baseUrl: z.string().max(500),
|
|
755
809
|
email: z.string().max(320),
|
package/shared/model.ts
CHANGED
|
@@ -7,6 +7,8 @@ import type {
|
|
|
7
7
|
OfficeSnapshot,
|
|
8
8
|
OfficeWorkspace,
|
|
9
9
|
Post,
|
|
10
|
+
SubagentCall,
|
|
11
|
+
SubagentCalls,
|
|
10
12
|
} from "./contracts.js";
|
|
11
13
|
import { dutyRows, type DutyRow } from "./duties.js";
|
|
12
14
|
import { DUTY, LOBBY } from "./names.js";
|
|
@@ -26,6 +28,11 @@ export interface OfficeRow {
|
|
|
26
28
|
* them, so it is not idle. 0 for everyone else.
|
|
27
29
|
*/
|
|
28
30
|
waitingOn: number;
|
|
31
|
+
/**
|
|
32
|
+
* The provider's own sub-agents a running agent has at work, inside its session. They are no
|
|
33
|
+
* agents of the office: only the 3D floor draws them. Absent for an agent with none.
|
|
34
|
+
*/
|
|
35
|
+
subagents?: readonly SubagentCall[];
|
|
29
36
|
}
|
|
30
37
|
|
|
31
38
|
export interface OfficeRoom {
|
|
@@ -170,6 +177,7 @@ function orderRows(
|
|
|
170
177
|
activity: Readonly<Record<string, string>>,
|
|
171
178
|
doing: Readonly<Record<string, ActivityStep>>,
|
|
172
179
|
waitingOn: ReadonlyMap<string, number>,
|
|
180
|
+
subagents: Readonly<SubagentCalls> = {},
|
|
173
181
|
): OfficeRow[] {
|
|
174
182
|
const sorted = [...agents].sort(byCreation);
|
|
175
183
|
const ids = new Set(sorted.map((agent) => agent.id));
|
|
@@ -195,6 +203,7 @@ function orderRows(
|
|
|
195
203
|
activity: running ? (activity[agent.id] ?? null) : null,
|
|
196
204
|
step: running ? (doing[agent.id] ?? null) : null,
|
|
197
205
|
waitingOn: waitingOn.get(agent.id) ?? 0,
|
|
206
|
+
...(running && subagents[agent.id]?.length ? { subagents: subagents[agent.id] } : {}),
|
|
198
207
|
});
|
|
199
208
|
for (const child of children.get(agent.id) ?? []) visit(child, 1);
|
|
200
209
|
}
|
|
@@ -280,7 +289,13 @@ export function buildOfficeModel(state: OfficeSnapshot): OfficeModel {
|
|
|
280
289
|
subtitle,
|
|
281
290
|
lobby,
|
|
282
291
|
workspace,
|
|
283
|
-
rows: orderRows(
|
|
292
|
+
rows: orderRows(
|
|
293
|
+
byRoom.get(id) ?? [],
|
|
294
|
+
state.activity,
|
|
295
|
+
state.doing ?? {},
|
|
296
|
+
waitingOn,
|
|
297
|
+
state.subagents,
|
|
298
|
+
),
|
|
284
299
|
posts: visiblePosts(posts),
|
|
285
300
|
todos,
|
|
286
301
|
};
|
package/shared/settings.ts
CHANGED
|
@@ -52,6 +52,7 @@ const HostValuesSchema = z.object({
|
|
|
52
52
|
agentTools: z.boolean().default(true),
|
|
53
53
|
notesFolder: z.string().default(""),
|
|
54
54
|
notesTimeZone: z.string().default(""),
|
|
55
|
+
notesMode: z.string().max(100).default(""),
|
|
55
56
|
notesDays: z
|
|
56
57
|
.array(z.number())
|
|
57
58
|
.default([1, 2, 3, 4, 5])
|
|
@@ -117,7 +118,8 @@ const SUNDAY_TO_THURSDAY = [0, 1, 2, 3, 4];
|
|
|
117
118
|
/**
|
|
118
119
|
* Host-wide. `agentTools` off removes the office tools from agent sessions opened afterwards.
|
|
119
120
|
* `notesFolder` is the absolute path the stand-up notes are written in, empty for none, and
|
|
120
|
-
* `notesTimeZone` the IANA zone of their 8:00 run, empty for the host's. `
|
|
121
|
+
* `notesTimeZone` the IANA zone of their 8:00 run, empty for the host's. `notesMode` is the
|
|
122
|
+
* mode the notes writer starts in, by its provider's id, empty for the office's own choice. `notesDays` are the
|
|
121
123
|
* weekdays of that run, 0 for Sunday to 6 for Saturday, in order; none is no run. `floorPlan` is
|
|
122
124
|
* the 3D floor's plan: `pro` the company floor, `cozy` one open room, or `hq` headquarters. `jiraProjects`
|
|
123
125
|
* and `sentryProjects` are the comma separated projects checked for incidents, `sentryOrg` their
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** On a workspace: the office's own name for its team. Paseo never reads the key. */
|
|
2
|
+
export const TEAM_NAME_KEY = "office.team.name";
|
|
3
|
+
export const TEAM_NAME_MAX = 40;
|
|
4
|
+
|
|
5
|
+
/** A team name as it is kept: one line, trimmed, at most TEAM_NAME_MAX characters; "" for none. */
|
|
6
|
+
export function tidyTeamName(name: string): string {
|
|
7
|
+
return name.replace(/\s+/g, " ").trim().slice(0, TEAM_NAME_MAX);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** The team name stored on a workspace, or null when it has none. */
|
|
11
|
+
export function storedTeamName(metadata: Readonly<Record<string, unknown>> | null | undefined) {
|
|
12
|
+
const stored = metadata?.[TEAM_NAME_KEY];
|
|
13
|
+
const name = typeof stored === "string" ? tidyTeamName(stored) : "";
|
|
14
|
+
return name === "" ? null : name;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The name a workspace's team goes by: the office's own, else the workspace's. */
|
|
18
|
+
export function teamNameOf(workspace: {
|
|
19
|
+
name: string;
|
|
20
|
+
metadata?: Readonly<Record<string, unknown>> | null;
|
|
21
|
+
}): string {
|
|
22
|
+
return storedTeamName(workspace.metadata) ?? workspace.name;
|
|
23
|
+
}
|