paseo-office 0.2.0 → 0.2.2

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.
Files changed (143) hide show
  1. package/OVERVIEW.md +27 -0
  2. package/README.md +65 -134
  3. package/client/action-button.tsx +4 -1
  4. package/client/activity-panel.tsx +6 -4
  5. package/client/agent-appearance.tsx +257 -0
  6. package/client/agent-card.tsx +2 -1
  7. package/client/agent-picker-text.ts +23 -4
  8. package/client/agent-picker.tsx +5 -8
  9. package/client/board-sheet.tsx +48 -16
  10. package/client/board-text.ts +12 -2
  11. package/client/brand.ts +1 -0
  12. package/client/chat-chrome.tsx +318 -0
  13. package/client/chat-compose-tools.tsx +314 -0
  14. package/client/chat-dictation.tsx +133 -0
  15. package/client/chat-more.tsx +119 -0
  16. package/client/chat-panel.tsx +401 -146
  17. package/client/chat-quick.tsx +198 -0
  18. package/client/chat-text.ts +25 -6
  19. package/client/column-sheet.tsx +93 -23
  20. package/client/conversation-model.ts +19 -5
  21. package/client/duty-sheet.tsx +321 -0
  22. package/client/duty-text.ts +20 -0
  23. package/client/fullscreen-header.tsx +28 -13
  24. package/client/fullscreen-theme.ts +38 -0
  25. package/client/host-details.tsx +269 -0
  26. package/client/host-styles.ts +129 -0
  27. package/client/host-switches.tsx +212 -83
  28. package/client/incidents-card.tsx +2 -1
  29. package/client/janitor-card.tsx +1 -1
  30. package/client/library-card.tsx +2 -1
  31. package/client/list-text.ts +8 -6
  32. package/client/lobby-board.tsx +73 -53
  33. package/client/machine-card.tsx +225 -85
  34. package/client/messenger-styles.ts +216 -0
  35. package/client/new-agent-form.tsx +153 -61
  36. package/client/new-agent-model.ts +2 -0
  37. package/client/notes-card.tsx +111 -83
  38. package/client/notes-days.tsx +1 -1
  39. package/client/office-brand-context.ts +44 -0
  40. package/client/office-column.tsx +2 -1
  41. package/client/office-keyboard.ts +79 -0
  42. package/client/office-link.ts +7 -1
  43. package/client/office-mark.tsx +29 -0
  44. package/client/office-modal.tsx +440 -0
  45. package/client/office-settings.tsx +75 -30
  46. package/client/office-state.ts +12 -2
  47. package/client/office-surface.tsx +591 -81
  48. package/client/pixel/actors.ts +2 -1
  49. package/client/pixel/art.ts +33 -19
  50. package/client/pixel/pixel-office.tsx +2 -2
  51. package/client/prompt-coach.tsx +152 -0
  52. package/client/qa-card.tsx +2 -1
  53. package/client/review-card.tsx +2 -1
  54. package/client/room-board.tsx +26 -2
  55. package/client/scene-picker.tsx +158 -0
  56. package/client/scene-previews.ts +10 -0
  57. package/client/session-pane.tsx +25 -5
  58. package/client/session-panel-detail.tsx +238 -0
  59. package/client/session-panel.tsx +222 -137
  60. package/client/session-styles.ts +224 -1
  61. package/client/session-transcript.tsx +243 -0
  62. package/client/sessions-panel.tsx +181 -22
  63. package/client/sessions-text.ts +18 -0
  64. package/client/settings-sections.tsx +126 -0
  65. package/client/sidebar-launcher.ts +29 -0
  66. package/client/ssh-hosts.tsx +331 -0
  67. package/client/ssh-metrics.ts +76 -0
  68. package/client/standup-card.tsx +2 -1
  69. package/client/structure-view.tsx +20 -3
  70. package/client/styles.ts +170 -62
  71. package/client/team-chat-preview.tsx +96 -0
  72. package/client/tracker-connections.tsx +252 -0
  73. package/client/transcript-styles.ts +90 -0
  74. package/client/use-device-switch.ts +21 -12
  75. package/client/use-duty-actions.ts +43 -0
  76. package/client/use-group-photo.ts +48 -0
  77. package/client/use-new-agent.ts +4 -0
  78. package/client/use-street.ts +8 -0
  79. package/client/workspace-office-tools.tsx +102 -0
  80. package/client/workspace-overlay-route.web.ts +47 -0
  81. package/client/workspace-overlay.tsx +195 -0
  82. package/client/world/adapter.ts +37 -2
  83. package/client/world/escape.ts +58 -0
  84. package/client/world/use-world-feed.ts +6 -2
  85. package/client/world/workspace-dock.ts +6 -0
  86. package/client/world/world-api.ts +45 -4
  87. package/client/world/world-bridge-page.ts +14 -3
  88. package/client/world/world-bridge.ts +50 -5
  89. package/client/world/world-frame.web.ts +8 -0
  90. package/client/world/world-view-native.tsx +31 -10
  91. package/client/world/world-view-shared.ts +36 -7
  92. package/client/world/world-view.tsx +93 -21
  93. package/docs/office.md +165 -64
  94. package/index.client.tsx +13 -6
  95. package/index.server.ts +232 -16
  96. package/package.json +2 -1
  97. package/server/activity.ts +42 -19
  98. package/server/agent-tools.ts +11 -5
  99. package/server/board-service.ts +381 -10
  100. package/server/brand-logo.ts +34 -0
  101. package/server/chat-group.ts +83 -0
  102. package/server/chat-service.ts +406 -62
  103. package/server/chat-store.ts +1 -4
  104. package/server/directory.ts +22 -7
  105. package/server/duty-service.ts +230 -0
  106. package/server/group-photo.ts +39 -0
  107. package/server/home-departure.ts +47 -0
  108. package/server/hub.ts +43 -1
  109. package/server/incidents-jira.ts +19 -7
  110. package/server/incidents-schedule.ts +10 -10
  111. package/server/incidents-sentry.ts +34 -8
  112. package/server/live-ports.ts +114 -18
  113. package/server/lobby-pickup.ts +170 -0
  114. package/server/machine/details.ts +91 -0
  115. package/server/mention-queue.ts +14 -0
  116. package/server/office.ts +110 -6
  117. package/server/paths.ts +14 -0
  118. package/server/ssh/LICENSE.paseo +211 -0
  119. package/server/ssh/client.ts +401 -0
  120. package/server/ssh/discovery.ts +230 -0
  121. package/server/ssh/installed.ts +104 -0
  122. package/server/ssh/monitor.ts +104 -0
  123. package/server/ssh/pid-files.ts +194 -0
  124. package/server/ssh/read.ts +136 -0
  125. package/server/subagent-names.ts +4 -0
  126. package/server/tracker-credentials.ts +141 -0
  127. package/server/words.generated.ts +1 -1
  128. package/server/world.generated.ts +1 -1
  129. package/shared/appearance.ts +43 -0
  130. package/shared/branding.ts +53 -0
  131. package/shared/chat-words.ts +2 -2
  132. package/shared/contracts.ts +199 -5
  133. package/shared/duties.ts +100 -0
  134. package/shared/host-details.ts +25 -0
  135. package/shared/lobby-assignment.ts +34 -0
  136. package/shared/model.ts +9 -1
  137. package/shared/names.ts +2 -0
  138. package/shared/settings.ts +14 -3
  139. package/shared/ssh.ts +34 -0
  140. package/shared/upstream/README.md +1 -3
  141. package/shared/upstream/chat-engine.d.ts +4 -0
  142. package/shared/upstream/prompt-coach.d.ts +6 -0
  143. package/shared/upstream/prompt-coach.js +178 -0
@@ -1,3 +1,4 @@
1
+ import { useSceneBrand } from "../office-brand-context.js";
1
2
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
3
  import { Text, View } from "react-native";
3
4
  import { worldBrand, type WorldPlan } from "./adapter.js";
@@ -13,6 +14,7 @@ import { bridgePageScript } from "./world-bridge-page.js";
13
14
  import { WorldLoading } from "./world-loading.js";
14
15
  import { messageOf } from "./world-loader.js";
15
16
  import {
17
+ useHomeDeparture,
16
18
  useStandupBell,
17
19
  useWorldScript,
18
20
  worldStartOptions,
@@ -41,6 +43,8 @@ function WorldViewNativeScene({
41
43
  theme,
42
44
  styles,
43
45
  plan,
46
+ scene,
47
+ night,
44
48
  street,
45
49
  focusRoomId,
46
50
  focusRequest,
@@ -50,20 +54,25 @@ function WorldViewNativeScene({
50
54
  machine,
51
55
  onOpenMachine,
52
56
  onOpenResources,
53
- onOpenSession,
57
+ onOpenAgentWorkspace,
54
58
  onOpenLibrary,
55
59
  onOpenNotes,
60
+ onPhotoReady,
56
61
  meeting,
57
62
  weather,
58
63
  incidents,
59
64
  onOpenIncidents,
65
+ onOpenDuties,
66
+ onDutyActed,
60
67
  onProblem,
61
68
  sound,
62
69
  }: WorldViewNativeSceneProps) {
63
70
  const Frame = kitScriptFrame();
64
71
  const onBell = useStandupBell();
72
+ const onWentHome = useHomeDeparture();
65
73
  const { life, say: onLife, tell: onTenure } = useLife();
66
74
  const words = useSceneWords();
75
+ const brand = useSceneBrand();
67
76
  const latest = useRef<WorldLatest>({
68
77
  model,
69
78
  theme,
@@ -73,13 +82,18 @@ function WorldViewNativeScene({
73
82
  onSelectBoard,
74
83
  onOpenMachine,
75
84
  onOpenResources,
76
- onOpenSession,
85
+ onOpenAgentWorkspace,
77
86
  onOpenLibrary,
78
87
  onOpenNotes,
79
88
  onOpenIncidents,
89
+ onOpenDuties,
90
+ onDutyActed,
80
91
  onBell,
81
92
  onLife,
93
+ onWentHome,
82
94
  onTenure,
95
+ scene,
96
+ night,
83
97
  street,
84
98
  onSound: sound.set,
85
99
  onProblem,
@@ -94,13 +108,18 @@ function WorldViewNativeScene({
94
108
  onSelectBoard,
95
109
  onOpenMachine,
96
110
  onOpenResources,
97
- onOpenSession,
111
+ onOpenAgentWorkspace,
98
112
  onOpenLibrary,
99
113
  onOpenNotes,
100
114
  onOpenIncidents,
115
+ onOpenDuties,
116
+ onDutyActed,
101
117
  onBell,
102
118
  onLife,
119
+ onWentHome,
103
120
  onTenure,
121
+ scene,
122
+ night,
104
123
  street,
105
124
  onSound: sound.set,
106
125
  onProblem,
@@ -117,14 +136,14 @@ function WorldViewNativeScene({
117
136
  // order: start goes first, then whatever the feed sends once `api` is set.
118
137
  useEffect(() => {
119
138
  const handle = frame.current;
120
- if (words.status !== "ready" || page === null || handle === null) return undefined;
121
- const made = createWorldBridge((text) => handle.post(text));
139
+ if (!brand || words.status !== "ready" || page === null || handle === null) return undefined;
140
+ const made = createWorldBridge((text) => handle.post(text), onPhotoReady);
122
141
  bridge.current = made;
123
142
  try {
124
143
  made.api.start(
125
144
  worldStartOptions(latest, {
126
145
  focus: noFocus,
127
- brand: worldBrand(null),
146
+ brand: worldBrand(brand),
128
147
  photo: false,
129
148
  language: words.language,
130
149
  words: words.words,
@@ -141,7 +160,7 @@ function WorldViewNativeScene({
141
160
  bridge.current = null;
142
161
  setApi(null);
143
162
  };
144
- }, [page, plan, words.status, words.language, words.words]);
163
+ }, [page, plan, brand, words.status, words.language, words.words, onPhotoReady]);
145
164
 
146
165
  const { note: feedNote } = useWorldFeed(api, {
147
166
  model,
@@ -155,6 +174,7 @@ function WorldViewNativeScene({
155
174
  weather,
156
175
  incidents,
157
176
  streetNote: street?.kit === null,
177
+ night,
158
178
  sound: sound.on,
159
179
  plan,
160
180
  });
@@ -190,12 +210,13 @@ function WorldViewNativeScene({
190
210
  * The office in 3D on the phone's script frame, on the host's plan. A changed plan unmounts the
191
211
  * `ScriptFrame` and mounts a new one: the scene's page starts once.
192
212
  */
193
- export function WorldViewNative({ plan, streetOn = false, ...rest }: WorldViewProps) {
194
- const { street, loading } = useStreetStart(streetOn);
213
+ export function WorldViewNative({ plan, streetOn = false, scene, ...rest }: WorldViewProps) {
214
+ const { street, loading } = useStreetStart(scene ? scene === "city" : streetOn);
195
215
  if (loading || plan === null) return <WorldLoading styles={rest.styles} />;
196
216
  return (
197
217
  <WorldViewNativeScene
198
- key={plan + String(street !== null)}
218
+ key={plan + (scene ?? String(street !== null))}
219
+ scene={scene}
199
220
  street={street}
200
221
  plan={plan}
201
222
  {...rest}
@@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
2
2
  import type { PluginTheme } from "@getpaseo/plugin";
3
3
  import { useRpc } from "@getpaseo/plugin/client";
4
4
  import { useToast } from "@getpaseo/plugin/client/ui";
5
- import { notesWriteRpc, worldRpc } from "../../shared/contracts.js";
5
+ import { homeDepartureRpc, notesWriteRpc, worldRpc } from "../../shared/contracts.js";
6
6
  import type { OfficeModel } from "../../shared/model.js";
7
7
  import { isWordsLanguage, type SceneLanguage } from "../../shared/scene-language.js";
8
8
  import { failureText } from "../action-button.js";
@@ -12,6 +12,8 @@ import { sharedWorldLoader } from "./world-loader.js";
12
12
 
13
13
  /** What the scene's callbacks and its start read: always the last render's. */
14
14
  export interface WorldLatest {
15
+ scene?: WorldStartOptions["scene"];
16
+ night?: boolean | undefined;
15
17
  street?: { kit: string | null } | null;
16
18
  model: OfficeModel;
17
19
  theme: PluginTheme;
@@ -21,11 +23,16 @@ export interface WorldLatest {
21
23
  onSelectBoard(roomId: string): void;
22
24
  onOpenMachine(): void;
23
25
  onOpenResources: (() => void) | undefined;
24
- onOpenSession: ((agentId: string) => void) | undefined;
26
+ onOpenAgentWorkspace: ((agentId: string) => void) | undefined;
25
27
  onOpenLibrary(): void;
26
28
  onOpenNotes(): void;
27
29
  onOpenIncidents(): void;
30
+ /** The pantry's duty board: the duty board's editor. */
31
+ onOpenDuties?(): void;
32
+ /** A figure acted out a pretend duty: the host records it done by that agent. */
33
+ onDutyActed?(id: string, agentId: string): void;
28
34
  onBell(): void | Promise<void>;
35
+ onWentHome?: WorldStartOptions["onWentHome"];
29
36
  onLife?: WorldStartOptions["onLife"];
30
37
  onTenure?: WorldStartOptions["onTenure"];
31
38
  onSound(on: boolean): void;
@@ -41,6 +48,7 @@ export function worldStartOptions(
41
48
  latest: { readonly current: WorldLatest },
42
49
  extras: {
43
50
  focus(): void;
51
+ onToggleFullscreen?: () => void;
44
52
  brand: WorldBrand;
45
53
  plan: WorldPlan;
46
54
  photo?: false;
@@ -51,9 +59,11 @@ export function worldStartOptions(
51
59
  const { focus } = extras;
52
60
  const { colors } = latest.current.theme;
53
61
  return {
62
+ ...(latest.current.scene ? { scene: latest.current.scene } : {}),
54
63
  ...(latest.current.street ? { street: latest.current.street } : {}),
55
64
  plan: extras.plan,
56
- dark: isDarkTheme(colors),
65
+ ...(extras.onToggleFullscreen ? { onToggleFullscreen: extras.onToggleFullscreen } : {}),
66
+ dark: latest.current.night ?? isDarkTheme(colors),
57
67
  colors,
58
68
  brand: extras.brand,
59
69
  ...(isWordsLanguage(extras.language) && extras.words !== undefined
@@ -92,16 +102,16 @@ export function worldStartOptions(
92
102
  latest.current.onOpenResources?.();
93
103
  },
94
104
  }),
95
- // Given only where the office can open a session (the agent card's "Open session"): otherwise
96
- // a person under E is chosen, as a click does. The keyboard goes with the session.
97
- ...(latest.current.onOpenSession === undefined
105
+ // Give the workspace the keyboard when the walker interacts with a person.
106
+ ...(latest.current.onOpenAgentWorkspace === undefined
98
107
  ? {}
99
108
  : {
100
109
  onOpen: (agentId: string) => {
101
110
  focus();
102
- latest.current.onOpenSession?.(agentId);
111
+ latest.current.onOpenAgentWorkspace?.(agentId);
103
112
  },
104
113
  }),
114
+ onWentHome: (id, idleSince) => latest.current.onWentHome?.(id, idleSince),
105
115
  onLife: (kind, vars) => latest.current.onLife?.(kind, vars),
106
116
  onTenure: (op) => latest.current.onTenure?.(op),
107
117
  onBell: () => void latest.current.onBell(),
@@ -114,6 +124,12 @@ export function worldStartOptions(
114
124
  focus();
115
125
  latest.current.onOpenIncidents();
116
126
  },
127
+ onDuties: () => {
128
+ focus();
129
+ latest.current.onOpenDuties?.();
130
+ },
131
+ // (nothing of Paseo's opens: the keyboard stays in the office)
132
+ onDutyDone: (id, agentId) => latest.current.onDutyActed?.(id, agentId),
117
133
  onProblem: (message) => latest.current.onProblem(message),
118
134
  };
119
135
  }
@@ -153,6 +169,19 @@ export function useWorldScript(
153
169
  return loadState.status === "ready" ? loadState.script : null;
154
170
  }
155
171
 
172
+ export function useHomeDeparture() {
173
+ const archive = useRpc(homeDepartureRpc);
174
+ const toast = useToast();
175
+ return useCallback(
176
+ (agentId: string, idleSince: string) => {
177
+ void archive({ agentId, idleSince }).catch((error) =>
178
+ toast.error(failureText("Archive the departed session", error)),
179
+ );
180
+ },
181
+ [archive, toast],
182
+ );
183
+ }
184
+
156
185
  /**
157
186
  * A click on the bell has the stand-up notes written. Whether a writer started is not waited for:
158
187
  * the Stand-up card's line says what the writer does.
@@ -1,4 +1,6 @@
1
- import { useEffect, useId, useRef, useState } from "react";
1
+ import { useSceneBrand } from "../office-brand-context.js";
2
+ import { RegisterWorkspaceDock } from "./workspace-dock.js";
3
+ import { useContext, useEffect, useId, useRef, useState } from "react";
2
4
  import { Text, View } from "react-native";
3
5
  import type { PluginTheme } from "@getpaseo/plugin";
4
6
  import type { WeatherScene, IncidentsState, Machine } from "../../shared/contracts.js";
@@ -12,12 +14,14 @@ import { useLife } from "./use-life.js";
12
14
  import { useStreetStart } from "./use-street-kit.js";
13
15
  import { useSceneWords } from "./use-scene-words.js";
14
16
  import { useWorldFeed } from "./use-world-feed.js";
15
- import type { WorldApi } from "./world-api.js";
16
- import { readBrand } from "../web-env.web.js";
17
+ import type { WorldApi, WorldStartOptions } from "./world-api.js";
18
+
17
19
  import { focusApp, openWorldFrame } from "./world-frame.web.js";
18
20
  import { WorldLoading } from "./world-loading.js";
21
+ import type { GroupPhotoCapture } from "../use-group-photo.js";
19
22
  import { messageOf } from "./world-loader.js";
20
23
  import {
24
+ useHomeDeparture,
21
25
  useStandupBell,
22
26
  useWorldScript,
23
27
  worldStartOptions,
@@ -25,7 +29,11 @@ import {
25
29
  } from "./world-view-shared.js";
26
30
 
27
31
  export interface WorldViewProps {
32
+ onPhotoReady?: ((capture: GroupPhotoCapture | null) => void) | undefined;
33
+ scene?: WorldStartOptions["scene"];
34
+ night?: boolean | undefined;
28
35
  streetOn?: boolean | null;
36
+ fullscreen?: { active: boolean; toggle(): void };
29
37
  model: OfficeModel;
30
38
  theme: PluginTheme;
31
39
  styles: OfficeStyles;
@@ -56,11 +64,9 @@ export interface WorldViewProps {
56
64
  */
57
65
  onOpenResources: (() => void) | undefined;
58
66
  /**
59
- * E by a person while walking in: the agent card's "Open session". The surface always supplies
60
- * it, and it opens the session in the office's column, as the card does. Read when the office
61
- * starts.
67
+ * Walk-in interaction opens the agent’s workspace over the floor. Read at scene start.
62
68
  */
63
- onOpenSession: ((agentId: string) => void) | undefined;
69
+ onOpenAgentWorkspace: ((agentId: string) => void) | undefined;
64
70
  /** A tap on the library: its chip or the bookshelf. */
65
71
  onOpenLibrary(): void;
66
72
  /** A tap on the label over the meeting room's screen. */
@@ -72,6 +78,10 @@ export interface WorldViewProps {
72
78
  incidents: IncidentsState | undefined;
73
79
  /** A tap on the incidents' banner. */
74
80
  onOpenIncidents(): void;
81
+ /** A tap on the pantry's duty board: the duty board's editor. */
82
+ onOpenDuties?: () => void;
83
+ /** A figure acted out a pretend duty: the host records it done by that agent. */
84
+ onDutyActed?: (id: string, agentId: string) => void;
75
85
  /** The script could not load, the office could not start, or the WebGL context was lost. */
76
86
  onProblem(message: string): void;
77
87
  /**
@@ -96,9 +106,13 @@ type WorldSceneProps = Omit<WorldViewProps, "plan"> & {
96
106
  */
97
107
  function WorldScene({
98
108
  model,
109
+ fullscreen,
110
+ onPhotoReady,
99
111
  theme,
100
112
  styles,
101
113
  plan,
114
+ scene,
115
+ night,
102
116
  street,
103
117
  focusRoomId,
104
118
  focusRequest,
@@ -108,20 +122,26 @@ function WorldScene({
108
122
  machine,
109
123
  onOpenMachine,
110
124
  onOpenResources,
111
- onOpenSession,
125
+ onOpenAgentWorkspace,
112
126
  onOpenLibrary,
113
127
  onOpenNotes,
114
128
  meeting,
115
129
  weather,
116
130
  incidents,
117
131
  onOpenIncidents,
132
+ onOpenDuties,
133
+ onDutyActed,
118
134
  onProblem,
119
135
  sound,
120
136
  }: WorldSceneProps) {
137
+ const registerDock = useContext(RegisterWorkspaceDock);
121
138
  const containerId = useId();
139
+ const onToggleFullscreen = fullscreen?.toggle;
122
140
  const onBell = useStandupBell();
141
+ const onWentHome = useHomeDeparture();
123
142
  const { life, say: onLife, tell: onTenure } = useLife();
124
143
  const words = useSceneWords();
144
+ const brand = useSceneBrand();
125
145
  const [sized, setSized] = useState(false);
126
146
  const [api, setApi] = useState<WorldApi | null>(null);
127
147
  // What the frame's callbacks and its start read: always the last render's.
@@ -134,13 +154,18 @@ function WorldScene({
134
154
  onSelectBoard,
135
155
  onOpenMachine,
136
156
  onOpenResources,
137
- onOpenSession,
157
+ onOpenAgentWorkspace,
138
158
  onOpenLibrary,
139
159
  onOpenNotes,
140
160
  onOpenIncidents,
161
+ onOpenDuties,
162
+ onDutyActed,
141
163
  onBell,
142
164
  onLife,
165
+ onWentHome,
143
166
  onTenure,
167
+ scene,
168
+ night,
144
169
  street,
145
170
  onSound: sound.set,
146
171
  onProblem,
@@ -155,13 +180,18 @@ function WorldScene({
155
180
  onSelectBoard,
156
181
  onOpenMachine,
157
182
  onOpenResources,
158
- onOpenSession,
183
+ onOpenAgentWorkspace,
159
184
  onOpenLibrary,
160
185
  onOpenNotes,
161
186
  onOpenIncidents,
187
+ onOpenDuties,
188
+ onDutyActed,
162
189
  onBell,
163
190
  onLife,
191
+ onWentHome,
164
192
  onTenure,
193
+ scene,
194
+ night,
165
195
  street,
166
196
  onSound: sound.set,
167
197
  onProblem,
@@ -175,13 +205,18 @@ function WorldScene({
175
205
  onSelectBoard,
176
206
  onOpenMachine,
177
207
  onOpenResources,
178
- onOpenSession,
208
+ onOpenAgentWorkspace,
179
209
  onOpenLibrary,
180
210
  onOpenNotes,
181
211
  onOpenIncidents,
212
+ onOpenDuties,
213
+ onDutyActed,
182
214
  onBell,
183
215
  onLife,
216
+ onWentHome,
184
217
  onTenure,
218
+ scene,
219
+ night,
185
220
  street,
186
221
  sound.set,
187
222
  onProblem,
@@ -202,19 +237,19 @@ function WorldScene({
202
237
 
203
238
  const script = useWorldScript(sized, onProblem);
204
239
  useEffect(() => {
205
- if (words.status !== "ready" || script === null || !sized) return undefined;
240
+ if (!brand || words.status !== "ready" || script === null || !sized) return undefined;
206
241
  const container = document.getElementById(containerId);
207
242
  if (container === null) return undefined;
208
243
  let live = true;
209
244
  const frame = openWorldFrame({ container, script, title: "Office in 3D" });
210
- function start(scene: WorldApi): void {
245
+ function start(world: WorldApi): void {
211
246
  if (!live) return;
212
247
  try {
213
- scene.start(
248
+ world.start(
214
249
  worldStartOptions(latest, {
215
250
  focus: focusApp,
216
- // Read when the office starts: a page's brand does not change while the page lives.
217
- brand: worldBrand(readBrand()),
251
+ onToggleFullscreen,
252
+ brand: worldBrand(brand),
218
253
  language: words.language,
219
254
  words: words.words,
220
255
  plan,
@@ -224,7 +259,12 @@ function WorldScene({
224
259
  latest.current.onProblem(messageOf(error));
225
260
  return;
226
261
  }
227
- setApi(scene);
262
+ registerDock?.(
263
+ container
264
+ ?.querySelector("iframe")
265
+ ?.contentDocument?.querySelector<HTMLButtonElement>("#btn-workspace") ?? null,
266
+ );
267
+ setApi(world);
228
268
  }
229
269
  frame.api.then(start, (error: unknown) => {
230
270
  if (live) latest.current.onProblem(messageOf(error));
@@ -232,9 +272,32 @@ function WorldScene({
232
272
  return () => {
233
273
  live = false;
234
274
  setApi(null);
275
+ registerDock?.(null);
235
276
  frame.dispose();
236
277
  };
237
- }, [script, sized, containerId, plan, words.status, words.language, words.words]);
278
+ }, [
279
+ registerDock,
280
+ script,
281
+ sized,
282
+ containerId,
283
+ brand,
284
+ plan,
285
+ words.status,
286
+ words.language,
287
+ words.words,
288
+ onToggleFullscreen,
289
+ ]);
290
+
291
+ useEffect(() => {
292
+ if (!api?.captureGroupPhoto || !onPhotoReady) return undefined;
293
+ onPhotoReady(() => api.captureGroupPhoto?.() ?? null);
294
+ return () => onPhotoReady(null);
295
+ }, [api, onPhotoReady]);
296
+
297
+ const fullscreenActive = fullscreen?.active ?? false;
298
+ useEffect(() => {
299
+ api?.setFullscreen?.(fullscreenActive);
300
+ }, [api, fullscreenActive]);
238
301
 
239
302
  const { note: feedNote } = useWorldFeed(api, {
240
303
  model,
@@ -248,6 +311,7 @@ function WorldScene({
248
311
  weather,
249
312
  incidents,
250
313
  streetNote: street?.kit === null,
314
+ night,
251
315
  sound: sound.on,
252
316
  plan,
253
317
  });
@@ -269,8 +333,16 @@ function WorldScene({
269
333
  * The office in 3D, on the host's plan. A scene page starts once, so each plan is a scene of its
270
334
  * own: a changed plan takes the frame out and opens a new one.
271
335
  */
272
- export function WorldView({ plan, streetOn = false, ...rest }: WorldViewProps) {
273
- const { street, loading } = useStreetStart(streetOn);
336
+ export function WorldView({ plan, streetOn = false, scene, ...rest }: WorldViewProps) {
337
+ const { street, loading } = useStreetStart(scene ? scene === "city" : streetOn);
274
338
  if (loading || plan === null) return <WorldLoading styles={rest.styles} />;
275
- return <WorldScene key={plan + String(street !== null)} street={street} plan={plan} {...rest} />;
339
+ return (
340
+ <WorldScene
341
+ key={plan + (scene ?? String(street !== null))}
342
+ scene={scene}
343
+ street={street}
344
+ plan={plan}
345
+ {...rest}
346
+ />
347
+ );
276
348
  }