paseo-office 0.2.0 → 0.2.1
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/OVERVIEW.md +27 -0
- package/README.md +65 -134
- package/client/action-button.tsx +4 -1
- package/client/activity-panel.tsx +6 -4
- package/client/agent-appearance.tsx +257 -0
- package/client/agent-card.tsx +2 -1
- package/client/agent-picker-text.ts +23 -4
- package/client/agent-picker.tsx +5 -8
- package/client/board-sheet.tsx +48 -16
- package/client/board-text.ts +12 -2
- package/client/brand.ts +1 -0
- package/client/chat-chrome.tsx +318 -0
- package/client/chat-compose-tools.tsx +314 -0
- package/client/chat-dictation.tsx +133 -0
- package/client/chat-more.tsx +119 -0
- package/client/chat-panel.tsx +401 -146
- package/client/chat-quick.tsx +198 -0
- package/client/chat-text.ts +25 -6
- package/client/column-sheet.tsx +93 -23
- package/client/conversation-model.ts +19 -5
- package/client/duty-sheet.tsx +321 -0
- package/client/duty-text.ts +20 -0
- package/client/fullscreen-header.tsx +28 -13
- package/client/fullscreen-theme.ts +38 -0
- package/client/host-details.tsx +269 -0
- package/client/host-styles.ts +129 -0
- package/client/host-switches.tsx +197 -73
- package/client/incidents-card.tsx +2 -1
- package/client/janitor-card.tsx +1 -1
- package/client/library-card.tsx +2 -1
- package/client/list-text.ts +8 -6
- package/client/lobby-board.tsx +73 -53
- package/client/machine-card.tsx +225 -85
- package/client/messenger-styles.ts +216 -0
- package/client/new-agent-form.tsx +153 -61
- package/client/new-agent-model.ts +2 -0
- package/client/notes-card.tsx +111 -83
- package/client/notes-days.tsx +1 -1
- package/client/office-brand-context.ts +44 -0
- package/client/office-column.tsx +2 -1
- package/client/office-keyboard.ts +79 -0
- package/client/office-link.ts +7 -1
- package/client/office-mark.tsx +29 -0
- package/client/office-modal.tsx +440 -0
- package/client/office-settings.tsx +75 -30
- package/client/office-state.ts +12 -2
- package/client/office-surface.tsx +591 -81
- package/client/pixel/actors.ts +2 -1
- package/client/pixel/art.ts +33 -19
- package/client/pixel/pixel-office.tsx +2 -2
- package/client/prompt-coach.tsx +152 -0
- package/client/qa-card.tsx +2 -1
- package/client/review-card.tsx +2 -1
- package/client/room-board.tsx +26 -2
- package/client/scene-picker.tsx +158 -0
- package/client/scene-previews.ts +10 -0
- package/client/session-pane.tsx +25 -5
- package/client/session-panel-detail.tsx +238 -0
- package/client/session-panel.tsx +222 -137
- package/client/session-styles.ts +224 -1
- package/client/session-transcript.tsx +243 -0
- package/client/sessions-panel.tsx +181 -22
- package/client/sessions-text.ts +18 -0
- package/client/settings-sections.tsx +126 -0
- package/client/sidebar-launcher.ts +29 -0
- package/client/ssh-hosts.tsx +331 -0
- package/client/ssh-metrics.ts +76 -0
- package/client/standup-card.tsx +2 -1
- package/client/structure-view.tsx +20 -3
- package/client/styles.ts +170 -62
- package/client/team-chat-preview.tsx +96 -0
- package/client/transcript-styles.ts +90 -0
- package/client/use-device-switch.ts +21 -12
- package/client/use-duty-actions.ts +43 -0
- package/client/use-group-photo.ts +48 -0
- package/client/use-new-agent.ts +4 -0
- package/client/use-street.ts +8 -0
- package/client/workspace-office-tools.tsx +102 -0
- package/client/workspace-overlay-route.web.ts +47 -0
- package/client/workspace-overlay.tsx +195 -0
- package/client/world/adapter.ts +37 -2
- package/client/world/escape.ts +58 -0
- package/client/world/use-world-feed.ts +6 -2
- package/client/world/workspace-dock.ts +6 -0
- package/client/world/world-api.ts +45 -4
- package/client/world/world-bridge-page.ts +14 -3
- package/client/world/world-bridge.ts +50 -5
- package/client/world/world-frame.web.ts +8 -0
- package/client/world/world-view-native.tsx +31 -10
- package/client/world/world-view-shared.ts +36 -7
- package/client/world/world-view.tsx +93 -21
- package/docs/office.md +148 -58
- package/index.client.tsx +13 -6
- package/index.server.ts +125 -9
- package/package.json +2 -1
- package/server/activity.ts +42 -19
- package/server/agent-tools.ts +11 -5
- package/server/board-service.ts +381 -10
- package/server/brand-logo.ts +34 -0
- package/server/chat-group.ts +83 -0
- package/server/chat-service.ts +406 -62
- package/server/chat-store.ts +1 -4
- package/server/directory.ts +22 -7
- package/server/duty-service.ts +230 -0
- package/server/group-photo.ts +39 -0
- package/server/home-departure.ts +47 -0
- package/server/hub.ts +43 -1
- package/server/live-ports.ts +114 -18
- package/server/lobby-pickup.ts +170 -0
- package/server/machine/details.ts +91 -0
- package/server/mention-queue.ts +14 -0
- package/server/office.ts +110 -6
- package/server/paths.ts +9 -0
- package/server/ssh/LICENSE.paseo +211 -0
- package/server/ssh/client.ts +401 -0
- package/server/ssh/discovery.ts +230 -0
- package/server/ssh/installed.ts +104 -0
- package/server/ssh/monitor.ts +104 -0
- package/server/ssh/pid-files.ts +194 -0
- package/server/ssh/read.ts +136 -0
- package/server/subagent-names.ts +4 -0
- package/server/words.generated.ts +1 -1
- package/server/world.generated.ts +1 -1
- package/shared/appearance.ts +43 -0
- package/shared/branding.ts +53 -0
- package/shared/chat-words.ts +2 -2
- package/shared/contracts.ts +135 -4
- package/shared/duties.ts +100 -0
- package/shared/host-details.ts +25 -0
- package/shared/lobby-assignment.ts +34 -0
- package/shared/model.ts +9 -1
- package/shared/names.ts +2 -0
- package/shared/settings.ts +14 -3
- package/shared/ssh.ts +34 -0
- package/shared/upstream/README.md +1 -3
- package/shared/upstream/chat-engine.d.ts +4 -0
- package/shared/upstream/prompt-coach.d.ts +6 -0
- package/shared/upstream/prompt-coach.js +178 -0
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { Appearance } from "../../shared/appearance.js";
|
|
2
|
+
import type { OfficeScene } from "../../shared/settings.js";
|
|
1
3
|
import type { WordsLanguage } from "../../shared/scene-language.js";
|
|
2
|
-
import type { LifeEvent } from "../../shared/contracts.js";
|
|
4
|
+
import type { DutyChore, LifeEvent } from "../../shared/contracts.js";
|
|
3
5
|
import type { PluginTheme } from "@getpaseo/plugin";
|
|
4
6
|
|
|
5
7
|
/**
|
|
@@ -12,6 +14,8 @@ export type WorldWeather = import("../../shared/contracts.js").WeatherScene;
|
|
|
12
14
|
|
|
13
15
|
/** A person in the office, in the shape the vendored scene reads. */
|
|
14
16
|
export interface WorldSession {
|
|
17
|
+
appearance?: Appearance;
|
|
18
|
+
shirt?: string;
|
|
15
19
|
id: string;
|
|
16
20
|
name: string;
|
|
17
21
|
title: string;
|
|
@@ -30,6 +34,8 @@ export interface WorldSession {
|
|
|
30
34
|
* it works, waits or is stopped on an error.
|
|
31
35
|
*/
|
|
32
36
|
doneAt?: number;
|
|
37
|
+
/** Host revision for an idle session eligible for archive when its worker gets home. */
|
|
38
|
+
idleSince?: string;
|
|
33
39
|
/** A red name tag: the agent ended in an error. */
|
|
34
40
|
stuck: boolean;
|
|
35
41
|
/**
|
|
@@ -91,6 +97,25 @@ export interface WorldBoardRow {
|
|
|
91
97
|
state: "doing" | "wait" | "done";
|
|
92
98
|
}
|
|
93
99
|
|
|
100
|
+
/**
|
|
101
|
+
* A duty of the day's duty board, as the pantry's board shows it. Never its instructions: only
|
|
102
|
+
* its name, who has it and its state.
|
|
103
|
+
*/
|
|
104
|
+
export interface WorldDuty {
|
|
105
|
+
/** The duty's post: a pretend duty acted out is reported by it (`onDutyDone`). */
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
/** The chore it is acted out as; null: its figure walks to the board and back. */
|
|
109
|
+
chore: DutyChore | null;
|
|
110
|
+
/** No agent is asked: the scene picks a free figure to act it out, and reports it done. */
|
|
111
|
+
pretend: boolean;
|
|
112
|
+
/** Who has it: the agent and its name cut short; null while open, or when ticked by hand. */
|
|
113
|
+
holder: { id: string; name: string } | null;
|
|
114
|
+
state: "open" | "claimed" | "done";
|
|
115
|
+
/** Not done on its day: still on the board. */
|
|
116
|
+
owed: boolean;
|
|
117
|
+
}
|
|
118
|
+
|
|
94
119
|
/** Something an agent left listening, as the scene draws it: a small server box. */
|
|
95
120
|
export interface WorldDevServer {
|
|
96
121
|
/** Whose it is. Not alive: forgotten, so the box stands in the server room with a red light. */
|
|
@@ -121,6 +146,7 @@ export type WorldColors = PluginTheme["colors"];
|
|
|
121
146
|
|
|
122
147
|
/** What the lobby's sign and the reception's plaque show. */
|
|
123
148
|
export interface WorldBrand {
|
|
149
|
+
color?: string;
|
|
124
150
|
name: string;
|
|
125
151
|
/** The logo's address in full; null draws the scene's own mark. */
|
|
126
152
|
logoUrl: string | null;
|
|
@@ -131,11 +157,13 @@ export type WorldTenureProject = WorldTenure["projects"][number];
|
|
|
131
157
|
export type WorldLiftService = LifeEvent["lift"];
|
|
132
158
|
|
|
133
159
|
export interface WorldStartOptions {
|
|
160
|
+
onWentHome?(agentId: string, idleSince: string): void;
|
|
134
161
|
/** Something the office's people would say in the team chat: a kind of moment and a few words. */
|
|
135
162
|
onLife?(kind: string, vars: Record<string, string>): void;
|
|
136
163
|
/** The tenure list's two writes: a farewell was held, an intern was made permanent. */
|
|
137
164
|
onTenure?(op: { op: "farewell" | "official"; name: string }): void;
|
|
138
165
|
|
|
166
|
+
scene?: OfficeScene;
|
|
139
167
|
street?: { kit: string | null };
|
|
140
168
|
language?: WordsLanguage;
|
|
141
169
|
words?: string;
|
|
@@ -169,13 +197,15 @@ export interface WorldStartOptions {
|
|
|
169
197
|
/** The label over the meeting room's screen was chosen. Absent: the scene shows no label. */
|
|
170
198
|
onNotes?(): void;
|
|
171
199
|
/**
|
|
172
|
-
*
|
|
173
|
-
* and it opens the session in the office's column, as the card's "Open session" does. Absent
|
|
174
|
-
* only in a caller with no session to open; the scene then chooses the person, as a click does.
|
|
200
|
+
* Walk-in requests the person's workspace. Without a workspace handler the scene selects the person.
|
|
175
201
|
*/
|
|
176
202
|
onOpen?(agentId: string): void;
|
|
177
203
|
/** The incidents' banner was chosen. */
|
|
178
204
|
onIncidents?(): void;
|
|
205
|
+
/** The pantry's duty board was chosen. Absent: a click says the day's duties in a note. */
|
|
206
|
+
onDuties?(): void;
|
|
207
|
+
/** A figure acted out a pretend duty (`WorldDuty.id`): the host records it done by that agent. */
|
|
208
|
+
onDutyDone?(id: string, agentId: string): void;
|
|
179
209
|
/** A short line the office says once. */
|
|
180
210
|
onToast?(text: string): void;
|
|
181
211
|
/**
|
|
@@ -183,11 +213,15 @@ export interface WorldStartOptions {
|
|
|
183
213
|
* answers with `setSound`; the scene has already applied it, since audio starts only inside a press.
|
|
184
214
|
*/
|
|
185
215
|
onSound?(on: boolean): void;
|
|
216
|
+
/** Fullscreen belongs to the surface containing the floor and both sidebars. */
|
|
217
|
+
onToggleFullscreen?(): void;
|
|
186
218
|
/** False hides Photo mode: a WebView cannot keep a download. Absent: Photo mode is offered. */
|
|
187
219
|
photo?: boolean;
|
|
188
220
|
}
|
|
189
221
|
|
|
190
222
|
export interface WorldApi {
|
|
223
|
+
/** A small JPEG of the current floor, where this renderer supports capture. */
|
|
224
|
+
captureGroupPhoto?(): string | null;
|
|
191
225
|
version: number;
|
|
192
226
|
start(options: WorldStartOptions): void;
|
|
193
227
|
/** Gives the graphics context back; the page is thrown away after it. */
|
|
@@ -198,6 +232,12 @@ export interface WorldApi {
|
|
|
198
232
|
select(agentId: string | null): void;
|
|
199
233
|
focusProject(project: string): void;
|
|
200
234
|
setBoardRows(rows: readonly WorldBoardRow[]): void;
|
|
235
|
+
/**
|
|
236
|
+
* The day's duties for the pantry's board. Once given, the scene no longer keeps a rota of its
|
|
237
|
+
* own. Null while the host has sent no duty list (an older host, or before it is read): the
|
|
238
|
+
* scene keeps upstream's rota. Absent on a page built from before the duty board.
|
|
239
|
+
*/
|
|
240
|
+
setDuties?(duties: readonly WorldDuty[] | null): void;
|
|
201
241
|
/**
|
|
202
242
|
* The host's readings. With null the server room is furniture: no chip, no hand, no tap, and
|
|
203
243
|
* the wall screen shows no memory.
|
|
@@ -232,6 +272,7 @@ export interface WorldApi {
|
|
|
232
272
|
* from before sounds.
|
|
233
273
|
*/
|
|
234
274
|
setSound?(on: boolean): void;
|
|
275
|
+
setFullscreen?(active: boolean): void;
|
|
235
276
|
}
|
|
236
277
|
|
|
237
278
|
/** The version of the contract above; the page says which it speaks. */
|
|
@@ -7,8 +7,8 @@ import { WORLD_API_VERSION } from "./world-api.js";
|
|
|
7
7
|
* `start` become stand-ins that post `{ callback, args }`. A scene that throws, or one that is not
|
|
8
8
|
* the contract's version, posts `{ problem }`, which the office shows as any other failure.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Older scene bundles decide whether to show Full screen from the WebView document.
|
|
11
|
+
* Keep it off there as well as omitting the web surface's fullscreen callback.
|
|
12
12
|
*/
|
|
13
13
|
export function bridgePageScript(scene: string): string {
|
|
14
14
|
return `(function () {
|
|
@@ -28,6 +28,7 @@ export function bridgePageScript(scene: string): string {
|
|
|
28
28
|
});
|
|
29
29
|
return options;
|
|
30
30
|
}
|
|
31
|
+
var reportPhoto;
|
|
31
32
|
frame.onMessage = function (text) {
|
|
32
33
|
var message;
|
|
33
34
|
try { message = JSON.parse(text); } catch (e) { return; }
|
|
@@ -35,7 +36,17 @@ export function bridgePageScript(scene: string): string {
|
|
|
35
36
|
if (!message || !world || typeof world[message.call] !== "function") return;
|
|
36
37
|
var args = message.args || [];
|
|
37
38
|
if (message.call === "start" && args[0]) args[0] = standIns(args[0]);
|
|
38
|
-
|
|
39
|
+
if (message.call === "captureGroupPhoto" && reportPhoto) {
|
|
40
|
+
try { reportPhoto(args[0], world.captureGroupPhoto()); } catch (error) { reportPhoto(args[0], null); }
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
world[message.call].apply(world, args);
|
|
45
|
+
if (message.call === "start" && args[0].onCaptureReady && typeof world.captureGroupPhoto === "function") {
|
|
46
|
+
reportPhoto = args[0].onCaptured;
|
|
47
|
+
args[0].onCaptureReady();
|
|
48
|
+
}
|
|
49
|
+
} catch (error) { problem(error); }
|
|
39
50
|
};
|
|
40
51
|
try {
|
|
41
52
|
${scene}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GroupPhotoCapture } from "../use-group-photo.js";
|
|
1
2
|
import { WORLD_API_VERSION, type WorldApi, type WorldStartOptions } from "./world-api.js";
|
|
2
3
|
|
|
3
4
|
/** From the plugin to the page: a call of `PaseoOfficeWorld`. */
|
|
@@ -35,17 +36,20 @@ function parseReply(text: string): BridgeReply | null {
|
|
|
35
36
|
function brandForPage(brand: WorldStartOptions["brand"]): WorldStartOptions["brand"] {
|
|
36
37
|
if (brand === undefined) return undefined;
|
|
37
38
|
return {
|
|
38
|
-
|
|
39
|
+
...brand,
|
|
39
40
|
logoUrl: brand.logoUrl?.startsWith("data:") ? brand.logoUrl : null,
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
45
|
* The scene's API over messages. Each call becomes `{ call, args }` for `post`; the page answers
|
|
45
|
-
* with `{ callback, args }` for a callback `start` was given, or `{ problem }`.
|
|
46
|
-
*
|
|
46
|
+
* with `{ callback, args }` for a callback `start` was given, or `{ problem }`. A photo request waits
|
|
47
|
+
* for its matching JPEG or the capture timeout.
|
|
47
48
|
*/
|
|
48
|
-
export function createWorldBridge(
|
|
49
|
+
export function createWorldBridge(
|
|
50
|
+
post: (text: string) => void,
|
|
51
|
+
onPhotoReady?: (capture: GroupPhotoCapture | null) => void,
|
|
52
|
+
): WorldBridge {
|
|
49
53
|
const handlers = new Map<string, Handler>();
|
|
50
54
|
const send = (message: BridgeCall) => post(JSON.stringify(message));
|
|
51
55
|
const sender =
|
|
@@ -53,6 +57,33 @@ export function createWorldBridge(post: (text: string) => void): WorldBridge {
|
|
|
53
57
|
(...args: unknown[]) =>
|
|
54
58
|
send({ call, args });
|
|
55
59
|
|
|
60
|
+
let pendingPhoto: {
|
|
61
|
+
id: number;
|
|
62
|
+
timer: ReturnType<typeof setTimeout>;
|
|
63
|
+
resolve(data: string | null): void;
|
|
64
|
+
} | null = null;
|
|
65
|
+
let photoId = 0;
|
|
66
|
+
const finishPhoto = (data: string | null) => {
|
|
67
|
+
if (!pendingPhoto) return;
|
|
68
|
+
clearTimeout(pendingPhoto.timer);
|
|
69
|
+
const { resolve } = pendingPhoto;
|
|
70
|
+
pendingPhoto = null;
|
|
71
|
+
resolve(data);
|
|
72
|
+
};
|
|
73
|
+
const capture = (): Promise<string | null> => {
|
|
74
|
+
finishPhoto(null);
|
|
75
|
+
const id = ++photoId;
|
|
76
|
+
return new Promise((resolve) => {
|
|
77
|
+
const timer = setTimeout(() => finishPhoto(null), 10_000);
|
|
78
|
+
pendingPhoto = { id, resolve, timer };
|
|
79
|
+
try {
|
|
80
|
+
send({ call: "captureGroupPhoto", args: [id] });
|
|
81
|
+
} catch {
|
|
82
|
+
finishPhoto(null);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
|
|
56
87
|
const api: WorldApi = {
|
|
57
88
|
version: WORLD_API_VERSION,
|
|
58
89
|
start(options) {
|
|
@@ -67,19 +98,33 @@ export function createWorldBridge(post: (text: string) => void): WorldBridge {
|
|
|
67
98
|
data[key] = value;
|
|
68
99
|
}
|
|
69
100
|
}
|
|
101
|
+
if (onPhotoReady) {
|
|
102
|
+
handlers.set("onCaptureReady", () => onPhotoReady(capture));
|
|
103
|
+
handlers.set("onCaptured", (id, photo) => {
|
|
104
|
+
if (pendingPhoto && id === pendingPhoto.id)
|
|
105
|
+
finishPhoto(typeof photo === "string" ? photo : null);
|
|
106
|
+
});
|
|
107
|
+
callbacks.push("onCaptureReady", "onCaptured");
|
|
108
|
+
}
|
|
70
109
|
const brand = brandForPage(options.brand);
|
|
71
110
|
send({
|
|
72
111
|
call: "start",
|
|
73
112
|
args: [{ ...data, ...(brand === undefined ? {} : { brand }), callbacks }],
|
|
74
113
|
});
|
|
75
114
|
},
|
|
76
|
-
stop
|
|
115
|
+
stop() {
|
|
116
|
+
handlers.clear();
|
|
117
|
+
finishPhoto(null);
|
|
118
|
+
onPhotoReady?.(null);
|
|
119
|
+
send({ call: "stop", args: [] });
|
|
120
|
+
},
|
|
77
121
|
setTheme: sender("setTheme"),
|
|
78
122
|
setSessions: sender("setSessions"),
|
|
79
123
|
event: sender("event"),
|
|
80
124
|
select: sender("select"),
|
|
81
125
|
focusProject: sender("focusProject"),
|
|
82
126
|
setBoardRows: sender("setBoardRows"),
|
|
127
|
+
setDuties: sender("setDuties"),
|
|
83
128
|
photoRelease: sender("photoRelease"),
|
|
84
129
|
setClaudeVersion: sender("setClaudeVersion"),
|
|
85
130
|
setTenure: sender("setTenure"),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { leaveFullscreenAfter, sceneUsesEscape } from "./escape.js";
|
|
1
2
|
import { isWorldApi, type WorldApi } from "./world-api.js";
|
|
2
3
|
|
|
3
4
|
// Web only. world-view.tsx calls this from an effect, and the surface renders that view only in
|
|
@@ -86,6 +87,13 @@ export function openWorldFrame({ container, script, title }: WorldFrameInput): W
|
|
|
86
87
|
if (doc.body.classList.contains("is-fp")) return;
|
|
87
88
|
if (doc.activeElement === null || doc.activeElement === doc.body) focusApp();
|
|
88
89
|
});
|
|
90
|
+
// The office holds Escape while fullscreen (escape.ts): a press the scene has no use
|
|
91
|
+
// for leaves fullscreen. Read in the capture phase, before the scene ends what it was for.
|
|
92
|
+
doc.addEventListener(
|
|
93
|
+
"keydown",
|
|
94
|
+
(event) => leaveFullscreenAfter(event, sceneUsesEscape(doc), document),
|
|
95
|
+
true,
|
|
96
|
+
);
|
|
89
97
|
loaded = world;
|
|
90
98
|
resolve(world);
|
|
91
99
|
},
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
//
|
|
96
|
-
|
|
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.
|
|
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.
|