paseo-office 0.2.2 → 0.2.4
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 +78 -1
- package/client/machine-card.tsx +41 -0
- package/client/notes-mode-row.tsx +140 -0
- package/client/office-state.ts +1 -0
- package/client/office-surface.tsx +28 -3
- package/client/scene-picker.tsx +20 -1
- package/client/structure-view.tsx +2 -0
- package/client/team-name.tsx +81 -0
- package/client/use-device-switch.ts +7 -1
- package/client/use-plan-usage.ts +46 -0
- package/client/use-street.ts +7 -1
- package/client/world/adapter.ts +58 -4
- package/client/world/use-world-feed.ts +32 -2
- package/client/world/world-api.ts +28 -1
- package/client/world/world-bridge.ts +4 -0
- package/docs/office.md +66 -2
- package/index.server.ts +52 -2
- package/package.json +1 -1
- package/server/activity.ts +80 -9
- package/server/directory.ts +5 -1
- package/server/hub.ts +9 -0
- package/server/life-feed.ts +13 -0
- package/server/live-ports.ts +33 -11
- package/server/notes-schedule.ts +2 -0
- package/server/notes-writer.ts +9 -1
- package/server/plan-usage.ts +51 -0
- package/server/tenure.ts +10 -0
- package/server/world.generated.ts +1 -1
- package/server/writer-mode.ts +45 -0
- package/shared/contracts.ts +72 -0
- package/shared/model.ts +16 -1
- package/shared/names.ts +2 -0
- package/shared/plan-usage.ts +86 -0
- package/shared/settings.ts +29 -2
- 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
|
@@ -2,6 +2,7 @@ import { BrandingSchema } from "./branding.js";
|
|
|
2
2
|
import { AppearanceSchema } from "./appearance.js";
|
|
3
3
|
import { WORDS_LANGUAGES } from "./scene-language.js";
|
|
4
4
|
import { defineRpc, defineSubscription } from "@getpaseo/plugin";
|
|
5
|
+
import { PlanUsageSchema } from "./plan-usage.js";
|
|
5
6
|
import { z } from "zod";
|
|
6
7
|
// In their own file, so code that needs only a name does not load the schemas.
|
|
7
8
|
import { ACTIVITY_KINDS, TEST_RESULTS } from "./names.js";
|
|
@@ -120,9 +121,22 @@ export const WorkspacePullRequestSchema = z.object({
|
|
|
120
121
|
});
|
|
121
122
|
export type WorkspacePullRequest = z.output<typeof WorkspacePullRequestSchema>;
|
|
122
123
|
|
|
124
|
+
/**
|
|
125
|
+
* A sub-agent a provider runs inside an agent's own session, as the tool call that started it.
|
|
126
|
+
* It is no Paseo agent: it has no session of its own. `type` is the kind of sub-agent the
|
|
127
|
+
* provider names ("Explore"), never its task.
|
|
128
|
+
*/
|
|
129
|
+
export const SubagentCallSchema = z.object({ id: z.string(), type: z.string() });
|
|
130
|
+
export type SubagentCall = z.output<typeof SubagentCallSchema>;
|
|
131
|
+
export const SubagentCallsSchema = z.record(z.string(), z.array(SubagentCallSchema));
|
|
132
|
+
export type SubagentCalls = z.output<typeof SubagentCallsSchema>;
|
|
133
|
+
|
|
123
134
|
export const OfficeWorkspaceSchema = z.object({
|
|
124
135
|
id: z.string(),
|
|
136
|
+
/** The name its team goes by: the office's own when the owner gave one, else the workspace's. */
|
|
125
137
|
name: z.string(),
|
|
138
|
+
/** The workspace's own name in Paseo; present only while the team goes by another. */
|
|
139
|
+
workspaceName: z.string().optional(),
|
|
126
140
|
projectName: z.string(),
|
|
127
141
|
branch: z.string().optional(),
|
|
128
142
|
ticket: WorkspaceTicketSchema.optional(),
|
|
@@ -203,10 +217,14 @@ export const WakeStateSchema = z.object({
|
|
|
203
217
|
export type WakeState = z.output<typeof WakeStateSchema>;
|
|
204
218
|
|
|
205
219
|
/** A running agent's newest tool call: what it is for, and a key that changes with each call. */
|
|
220
|
+
/** The most characters of what a step is at. */
|
|
221
|
+
export const STEP_LABEL_MAX = 80;
|
|
222
|
+
|
|
206
223
|
export const ActivityStepSchema = z.object({
|
|
207
224
|
kind: z.enum(ACTIVITY_KINDS),
|
|
208
225
|
key: z.string(),
|
|
209
226
|
result: z.enum(TEST_RESULTS).optional(),
|
|
227
|
+
label: z.string().max(STEP_LABEL_MAX).optional(),
|
|
210
228
|
});
|
|
211
229
|
|
|
212
230
|
/** The most steps of one agent's checklist the office sends. */
|
|
@@ -468,6 +486,8 @@ export const OfficeSnapshotSchema = z.object({
|
|
|
468
486
|
activity: z.record(z.string(), z.string()),
|
|
469
487
|
/** The step of each running agent: the tool call it is at, or made since the read before. */
|
|
470
488
|
doing: z.record(z.string(), ActivityStepSchema).optional(),
|
|
489
|
+
/** The provider's own sub-agents each running agent has at work now; absent from an older server. */
|
|
490
|
+
subagents: SubagentCallsSchema.optional(),
|
|
471
491
|
/** Each agent's own checklist, kept after the agent stops. */
|
|
472
492
|
checklists: ChecklistsSchema.optional(),
|
|
473
493
|
checklistProgress: ChecklistCountsSchema.optional(),
|
|
@@ -493,6 +513,7 @@ export const OfficeEventSchema = z.discriminatedUnion("type", [
|
|
|
493
513
|
type: z.literal("activity"),
|
|
494
514
|
activity: z.record(z.string(), z.string()),
|
|
495
515
|
doing: z.record(z.string(), ActivityStepSchema).optional(),
|
|
516
|
+
subagents: SubagentCallsSchema.optional(),
|
|
496
517
|
checklists: ChecklistsSchema.optional(),
|
|
497
518
|
checklistProgress: ChecklistCountsSchema.optional(),
|
|
498
519
|
}),
|
|
@@ -750,6 +771,57 @@ export const notesWriteRpc = defineRpc({
|
|
|
750
771
|
output: z.object({ started: z.boolean() }),
|
|
751
772
|
});
|
|
752
773
|
|
|
774
|
+
/**
|
|
775
|
+
* Gives a workspace's team a name of the office's own, kept on the workspace; an empty name goes
|
|
776
|
+
* back to the workspace's. The team's tenure follows the name.
|
|
777
|
+
*/
|
|
778
|
+
export const teamRenameRpc = defineRpc({
|
|
779
|
+
name: "office.team.rename.request",
|
|
780
|
+
input: z.object({ workspaceId: z.string().min(1), name: z.string().max(200) }),
|
|
781
|
+
output: z.union([
|
|
782
|
+
z.object({ ok: z.literal(true), name: z.string() }),
|
|
783
|
+
z.object({ ok: z.literal(false), problem: z.string() }),
|
|
784
|
+
]),
|
|
785
|
+
});
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* The plans of the providers Paseo can read, with their limits. Read when asked, from Paseo's own
|
|
789
|
+
* usage sources: the office keeps none of it.
|
|
790
|
+
*/
|
|
791
|
+
export const planUsageRpc = defineRpc({
|
|
792
|
+
name: "office.plan.usage.request",
|
|
793
|
+
input: z.object({}),
|
|
794
|
+
output: z.union([
|
|
795
|
+
z.object({ ok: z.literal(true), providers: z.array(PlanUsageSchema) }),
|
|
796
|
+
z.object({ ok: z.literal(false), problem: z.string() }),
|
|
797
|
+
]),
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
export const WriterModesSchema = z.object({
|
|
801
|
+
/** The provider the writer would start on now, by its label. */
|
|
802
|
+
provider: z.string(),
|
|
803
|
+
/** Its modes the writer can start in, by the provider's own names. */
|
|
804
|
+
modes: z.array(z.object({ id: z.string(), label: z.string() })),
|
|
805
|
+
/** The mode the settings come to; null where the provider names none. */
|
|
806
|
+
modeId: z.string().nullable(),
|
|
807
|
+
/** The settings name a mode this provider does not offer. */
|
|
808
|
+
fellBack: z.boolean(),
|
|
809
|
+
});
|
|
810
|
+
export type WriterModes = z.output<typeof WriterModesSchema>;
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* The modes the stand-up writer can start in, for the settings. `problem` when no provider is
|
|
814
|
+
* ready or the settings cannot be read.
|
|
815
|
+
*/
|
|
816
|
+
export const notesModesRpc = defineRpc({
|
|
817
|
+
name: "office.notes.modes.request",
|
|
818
|
+
input: z.object({}),
|
|
819
|
+
output: z.union([
|
|
820
|
+
WriterModesSchema.extend({ ok: z.literal(true) }),
|
|
821
|
+
z.object({ ok: z.literal(false), problem: z.string() }),
|
|
822
|
+
]),
|
|
823
|
+
});
|
|
824
|
+
|
|
753
825
|
const JiraConnectionSchema = z.object({
|
|
754
826
|
baseUrl: z.string().max(500),
|
|
755
827
|
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/names.ts
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
/** A limit of a provider's plan: the 5 hours, the week. `usedPct` is 0 to 100. */
|
|
4
|
+
export const PlanWindowSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
label: z.string(),
|
|
7
|
+
usedPct: z.number(),
|
|
8
|
+
/** Epoch ms of the reset; null when the provider does not say. */
|
|
9
|
+
resetsAt: z.number().nullable(),
|
|
10
|
+
});
|
|
11
|
+
export type PlanWindow = z.output<typeof PlanWindowSchema>;
|
|
12
|
+
|
|
13
|
+
/** A provider whose plan Paseo can read, with the limits it reports. */
|
|
14
|
+
export const PlanUsageSchema = z.object({
|
|
15
|
+
provider: z.string(),
|
|
16
|
+
name: z.string(),
|
|
17
|
+
plan: z.string().nullable(),
|
|
18
|
+
windows: z.array(PlanWindowSchema),
|
|
19
|
+
});
|
|
20
|
+
export type PlanUsage = z.output<typeof PlanUsageSchema>;
|
|
21
|
+
|
|
22
|
+
/** From this much used, a limit is close; from this much, nearly gone. As upstream warns. */
|
|
23
|
+
export const PLAN_WARN_PCT = 80;
|
|
24
|
+
export const PLAN_DANGER_PCT = 95;
|
|
25
|
+
/** A limit counts as used up a hair under 100: the readings stop there. */
|
|
26
|
+
export const PLAN_OUT_PCT = 99.5;
|
|
27
|
+
|
|
28
|
+
export type PlanTone = "ok" | "warning" | "danger";
|
|
29
|
+
|
|
30
|
+
export function planTone(usedPct: number): PlanTone {
|
|
31
|
+
if (usedPct >= PLAN_DANGER_PCT) return "danger";
|
|
32
|
+
return usedPct >= PLAN_WARN_PCT ? "warning" : "ok";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The limit closest to used up, of every provider; null when none is read. */
|
|
36
|
+
export function closestLimit(
|
|
37
|
+
usage: readonly PlanUsage[],
|
|
38
|
+
): { provider: PlanUsage; window: PlanWindow } | null {
|
|
39
|
+
let closest: { provider: PlanUsage; window: PlanWindow } | null = null;
|
|
40
|
+
for (const provider of usage) {
|
|
41
|
+
for (const window of provider.windows) {
|
|
42
|
+
if (closest === null || window.usedPct > closest.window.usedPct) {
|
|
43
|
+
closest = { provider, window };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return closest;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** When a limit resets, from now: "resets in 2 h 10 min"; empty when the provider does not say. */
|
|
51
|
+
export function resetText(resetsAt: number | null, now: number): string {
|
|
52
|
+
if (resetsAt === null) return "";
|
|
53
|
+
const minutes = Math.ceil((resetsAt - now) / 60_000);
|
|
54
|
+
if (minutes <= 0) return "resets now";
|
|
55
|
+
if (minutes < 60) return `resets in ${minutes} min`;
|
|
56
|
+
const hours = Math.floor(minutes / 60);
|
|
57
|
+
if (hours < 48) return `resets in ${hours} h ${minutes % 60} min`;
|
|
58
|
+
return `resets in ${Math.floor(hours / 24)} d ${hours % 24} h`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The closest limit in a few words, for the toolbar; null while every limit is under the warning. */
|
|
62
|
+
export function planNote(
|
|
63
|
+
usage: readonly PlanUsage[],
|
|
64
|
+
): { text: string; tone: "warning" | "danger" } | null {
|
|
65
|
+
const closest = closestLimit(usage);
|
|
66
|
+
if (closest === null || closest.window.usedPct < PLAN_WARN_PCT) return null;
|
|
67
|
+
const { provider, window } = closest;
|
|
68
|
+
const text =
|
|
69
|
+
window.usedPct >= PLAN_OUT_PCT
|
|
70
|
+
? `Out of ${provider.name}`
|
|
71
|
+
: `${provider.name} ${Math.floor(window.usedPct)}%`;
|
|
72
|
+
return { text, tone: window.usedPct >= PLAN_DANGER_PCT ? "danger" : "warning" };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The providers with a limit used up, by id, with the name the floor shows for each. */
|
|
76
|
+
export function providersOut(usage: readonly PlanUsage[], now: number): Map<string, string> {
|
|
77
|
+
const out = new Map<string, string>();
|
|
78
|
+
for (const provider of usage) {
|
|
79
|
+
const full = provider.windows.some(
|
|
80
|
+
(window) =>
|
|
81
|
+
window.usedPct >= PLAN_OUT_PCT && (window.resetsAt === null || window.resetsAt > now),
|
|
82
|
+
);
|
|
83
|
+
if (full) out.set(provider.provider, provider.name);
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
package/shared/settings.ts
CHANGED
|
@@ -46,18 +46,38 @@ export function isTokenSafe(address: string): boolean {
|
|
|
46
46
|
export const FLOOR_PLANS = ["pro", "cozy", "hq"] as const;
|
|
47
47
|
export type FloorPlanChoice = (typeof FLOOR_PLANS)[number];
|
|
48
48
|
|
|
49
|
+
/** The owner's notes on the 3D floor's whiteboard: this many, each this long, typed with `;` between. */
|
|
50
|
+
export const STICKY_NOTES_MAX = 4;
|
|
51
|
+
export const STICKY_NOTE_MAX = 60;
|
|
52
|
+
const STICKY_NOTES_TEXT_MAX = 400;
|
|
53
|
+
|
|
54
|
+
/** The notes of the setting's text: trimmed, none empty, cut to what the board has room for. */
|
|
55
|
+
export function stickyNotesOf(text: string): string[] {
|
|
56
|
+
return text
|
|
57
|
+
.split(/[;\n]/)
|
|
58
|
+
.map((note) => note.trim())
|
|
59
|
+
.filter((note) => note !== "")
|
|
60
|
+
.slice(0, STICKY_NOTES_MAX)
|
|
61
|
+
.map((note) =>
|
|
62
|
+
note.length > STICKY_NOTE_MAX ? `${note.slice(0, STICKY_NOTE_MAX - 1)}…` : note,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
49
66
|
const HostValuesSchema = z.object({
|
|
50
67
|
...brandFields,
|
|
51
68
|
archiveOnDeparture: z.boolean().default(false),
|
|
52
69
|
agentTools: z.boolean().default(true),
|
|
53
70
|
notesFolder: z.string().default(""),
|
|
54
71
|
notesTimeZone: z.string().default(""),
|
|
72
|
+
notesMode: z.string().max(100).default(""),
|
|
55
73
|
notesDays: z
|
|
56
74
|
.array(z.number())
|
|
57
75
|
.default([1, 2, 3, 4, 5])
|
|
58
76
|
.transform((days) => [...days].sort((a, b) => a - b)),
|
|
59
77
|
// A plan this build does not know (a later build's, or a hand edit) reads as the company floor.
|
|
60
78
|
floorPlan: z.enum(FLOOR_PLANS).default("pro").catch("pro"),
|
|
79
|
+
streamerMode: z.boolean().default(true),
|
|
80
|
+
stickyNotes: z.string().max(STICKY_NOTES_TEXT_MAX).default(""),
|
|
61
81
|
jiraProjects: z.string().default(""),
|
|
62
82
|
sentryOrg: z.string().default(""),
|
|
63
83
|
sentryProjects: z.string().default(""),
|
|
@@ -117,9 +137,13 @@ const SUNDAY_TO_THURSDAY = [0, 1, 2, 3, 4];
|
|
|
117
137
|
/**
|
|
118
138
|
* Host-wide. `agentTools` off removes the office tools from agent sessions opened afterwards.
|
|
119
139
|
* `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. `
|
|
140
|
+
* `notesTimeZone` the IANA zone of their 8:00 run, empty for the host's. `notesMode` is the
|
|
141
|
+
* mode the notes writer starts in, by its provider's id, empty for the office's own choice. `notesDays` are the
|
|
121
142
|
* weekdays of that run, 0 for Sunday to 6 for Saturday, in order; none is no run. `floorPlan` is
|
|
122
|
-
* the 3D floor's plan: `pro` the company floor, `cozy` one open room, or `hq` headquarters.
|
|
143
|
+
* the 3D floor's plan: `pro` the company floor, `cozy` one open room, or `hq` headquarters.
|
|
144
|
+
* `streamerMode` on (the default) keeps file names, commands and sites out of what the office
|
|
145
|
+
* sends to the floor; off, a person's bubble names what they are at. `stickyNotes` are the
|
|
146
|
+
* owner's notes on the 3D whiteboard, with `;` between them. `jiraProjects`
|
|
123
147
|
* and `sentryProjects` are the comma separated projects checked for incidents, `sentryOrg` their
|
|
124
148
|
* Sentry organisation and `sentryUrl` the Sentry the token is sent to.
|
|
125
149
|
*/
|
|
@@ -150,6 +174,8 @@ export const officeHostSettings = defineSettings({
|
|
|
150
174
|
/** Outdoor environments for the 3D floor. */
|
|
151
175
|
export const OFFICE_SCENES = ["plain", "city", "countryside", "beach"] as const;
|
|
152
176
|
export type OfficeScene = (typeof OFFICE_SCENES)[number];
|
|
177
|
+
export const OFFICE_GRAPHICS = ["auto", "low", "medium", "high"] as const;
|
|
178
|
+
export type OfficeGraphics = (typeof OFFICE_GRAPHICS)[number];
|
|
153
179
|
export const OFFICE_LIGHTING = ["auto", "day", "night"] as const;
|
|
154
180
|
export type OfficeLighting = (typeof OFFICE_LIGHTING)[number];
|
|
155
181
|
|
|
@@ -175,6 +201,7 @@ export const officeDeviceSettings = defineSettings({
|
|
|
175
201
|
street: z.boolean().optional(),
|
|
176
202
|
scene: z.enum(OFFICE_SCENES).optional(),
|
|
177
203
|
lighting: z.enum(OFFICE_LIGHTING).optional(),
|
|
204
|
+
graphics: z.enum(OFFICE_GRAPHICS).optional(),
|
|
178
205
|
sessionsHidden: z.boolean().optional(),
|
|
179
206
|
view: z.enum(OFFICE_VIEWS).optional(),
|
|
180
207
|
rungIncidents: z.record(z.string(), z.number()).default({}),
|
|
@@ -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
|
+
}
|