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,6 +1,8 @@
1
- import { useCallback, useMemo, useState } from "react";
2
- import { Text, View } from "react-native";
3
- import { ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
1
+ import type { Appearance } from "../shared/appearance.js";
2
+ import { AppearanceFields } from "./agent-appearance.js";
3
+ import { useCallback, useMemo, useState, type ReactNode } from "react";
4
+ import { Pressable, Text, View } from "react-native";
5
+ import { Icon, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
4
6
  import { Pill } from "./activity-panel.js";
5
7
  import { ActionButton } from "./action-button.js";
6
8
  import { Row as ChoiceRow } from "./agent-picker.js";
@@ -121,26 +123,109 @@ interface ReadyBodyProps {
121
123
  styles: OfficeStyles;
122
124
  }
123
125
 
126
+ function OptionGroup({
127
+ label,
128
+ value,
129
+ compact,
130
+ open,
131
+ toggle,
132
+ styles,
133
+ children,
134
+ }: {
135
+ label: string;
136
+ value?: string;
137
+ compact: boolean;
138
+ open: boolean;
139
+ toggle(): void;
140
+ styles: OfficeStyles;
141
+ children: ReactNode;
142
+ }) {
143
+ return (
144
+ <View style={styles.sheetField}>
145
+ <Text style={styles.sheetLabel}>{label}</Text>
146
+ {compact && (
147
+ <Pressable
148
+ accessibilityRole="button"
149
+ aria-expanded={open}
150
+ accessibilityLabel={`Choose ${label.toLowerCase()}`}
151
+ onPress={toggle}
152
+ style={styles.newAgentSelector}
153
+ >
154
+ <Text numberOfLines={1} style={styles.sidebarButtonText}>
155
+ {value ?? `Select ${label.toLowerCase()}`}
156
+ </Text>
157
+ <Icon name={open ? "ChevronUp" : "ChevronDown"} size={16} color={styles.iconColor} />
158
+ </Pressable>
159
+ )}
160
+ {(!compact || open) && (
161
+ <View role="group" aria-label={label} style={styles.panelChips}>
162
+ {children}
163
+ </View>
164
+ )}
165
+ </View>
166
+ );
167
+ }
168
+
124
169
  function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps) {
125
170
  const { create, chooseProvider } = agent;
171
+ const customize = useCallback((appearance: Appearance) => change({ appearance }), [change]);
126
172
  const chooseWorkspace = useCallback((workspaceId: string) => change({ workspaceId }), [change]);
127
- const chooseModel = useCallback((model: string) => change({ model }), [change]);
173
+ const [menu, setMenu] = useState<"provider" | "model" | null>(null);
174
+ const toggleProvider = useCallback(
175
+ () => setMenu((current) => (current === "provider" ? null : "provider")),
176
+ [],
177
+ );
178
+ const toggleModel = useCallback(
179
+ () => setMenu((current) => (current === "model" ? null : "model")),
180
+ [],
181
+ );
182
+ const selectProvider = useCallback(
183
+ (provider: string) => {
184
+ chooseProvider(provider);
185
+ setMenu(null);
186
+ },
187
+ [chooseProvider],
188
+ );
189
+ const chooseModel = useCallback(
190
+ (model: string) => {
191
+ change({ model });
192
+ setMenu(null);
193
+ },
194
+ [change],
195
+ );
128
196
  const setPrompt = useCallback((prompt: string) => change({ prompt }), [change]);
129
197
  const submit = useCallback(async () => onCreated(await create()), [create, onCreated]);
130
198
  const problem = newAgentProblem(choice, agent.starting);
131
199
  const waiting = agent.starting.some((entry) => entry.id === choice.provider);
132
- const models = agent.providers.find((entry) => entry.id === choice.provider)?.models ?? [];
200
+ const provider = agent.providers.find((entry) => entry.id === choice.provider);
201
+ const models = provider?.models ?? [];
133
202
  return (
134
203
  <>
135
- <Workspaces
136
- workspaces={agent.workspaces}
137
- value={choice.workspaceId}
138
- onChoose={chooseWorkspace}
139
- styles={styles}
140
- />
141
- <View style={styles.sheetField}>
142
- <Text style={styles.sheetLabel}>Provider</Text>
143
- <View role="group" aria-label="Provider" style={styles.panelChips}>
204
+ <ScrollView
205
+ style={styles.columnBody}
206
+ contentContainerStyle={styles.newAgentForm}
207
+ nestedScrollEnabled
208
+ >
209
+ <AppearanceFields
210
+ draft={choice.appearance}
211
+ change={customize}
212
+ collapsible
213
+ styles={styles}
214
+ />
215
+ <Workspaces
216
+ workspaces={agent.workspaces}
217
+ value={choice.workspaceId}
218
+ onChoose={chooseWorkspace}
219
+ styles={styles}
220
+ />
221
+ <OptionGroup
222
+ label="Provider"
223
+ value={provider?.label ?? choice.provider ?? undefined}
224
+ compact={agent.providers.length + agent.starting.length > 3}
225
+ open={menu === "provider"}
226
+ toggle={toggleProvider}
227
+ styles={styles}
228
+ >
144
229
  {agent.providers.map((entry) => (
145
230
  <Pill<string>
146
231
  key={entry.id}
@@ -149,7 +234,7 @@ function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps)
149
234
  disabled={entry.models.length === 0}
150
235
  on={entry.id === choice.provider}
151
236
  toggle={false}
152
- onPress={chooseProvider}
237
+ onPress={selectProvider}
153
238
  styles={styles}
154
239
  />
155
240
  ))}
@@ -161,15 +246,19 @@ function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps)
161
246
  disabled
162
247
  on={entry.id === choice.provider}
163
248
  toggle={false}
164
- onPress={chooseProvider}
249
+ onPress={selectProvider}
165
250
  styles={styles}
166
251
  />
167
252
  ))}
168
- </View>
169
- </View>
170
- <View style={styles.sheetField}>
171
- <Text style={styles.sheetLabel}>Model</Text>
172
- <View role="group" aria-label="Model" style={styles.panelChips}>
253
+ </OptionGroup>
254
+ <OptionGroup
255
+ label="Model"
256
+ value={models.find((entry) => entry.id === choice.model)?.label}
257
+ compact={models.length > 3}
258
+ open={menu === "model"}
259
+ toggle={toggleModel}
260
+ styles={styles}
261
+ >
173
262
  {models.map((entry) => (
174
263
  <Pill<string>
175
264
  key={entry.id}
@@ -181,38 +270,40 @@ function ReadyBody({ agent, choice, change, onCreated, styles }: ReadyBodyProps)
181
270
  styles={styles}
182
271
  />
183
272
  ))}
273
+ </OptionGroup>
274
+ <View style={styles.sheetField}>
275
+ <Text style={styles.sheetLabel}>First prompt</Text>
276
+ <TextInput
277
+ accessibilityLabel="First prompt"
278
+ placeholder="What should the agent do?"
279
+ placeholderTextColor={styles.placeholderColor}
280
+ value={choice.prompt}
281
+ onChangeText={setPrompt}
282
+ multiline
283
+ style={styles.input}
284
+ />
184
285
  </View>
185
- </View>
186
- <View style={styles.sheetField}>
187
- <Text style={styles.sheetLabel}>First prompt</Text>
188
- <TextInput
189
- accessibilityLabel="First prompt"
190
- placeholder="What should the agent do?"
191
- placeholderTextColor={styles.placeholderColor}
192
- value={choice.prompt}
193
- onChangeText={setPrompt}
194
- multiline
195
- style={styles.input}
196
- />
197
- </View>
198
- {problem === null ? null : <Text style={styles.muted}>{problem}</Text>}
199
- <View style={styles.actions}>
200
- <ActionButton
201
- label="Create"
202
- pendingLabel="Creating..."
203
- onPress={submit}
204
- disabled={problem !== null}
205
- primary
206
- styles={styles}
207
- />
208
- {waiting ? (
286
+ </ScrollView>
287
+ <View style={styles.newAgentFooter}>
288
+ {problem === null ? null : <Text style={styles.muted}>{problem}</Text>}
289
+ <View style={styles.actions}>
209
290
  <ActionButton
210
- label="Try again"
211
- pendingLabel="Trying..."
212
- onPress={agent.retry}
291
+ label="Create"
292
+ pendingLabel="Creating..."
293
+ onPress={submit}
294
+ disabled={problem !== null}
295
+ primary
213
296
  styles={styles}
214
297
  />
215
- ) : null}
298
+ {waiting ? (
299
+ <ActionButton
300
+ label="Try again"
301
+ pendingLabel="Trying..."
302
+ onPress={agent.retry}
303
+ styles={styles}
304
+ />
305
+ ) : null}
306
+ </View>
216
307
  </View>
217
308
  </>
218
309
  );
@@ -244,18 +335,19 @@ export function NewAgentForm({ choice, change, onBack, onCreated, styles }: NewA
244
335
  const agent = useNewAgent({ choice, change });
245
336
  return (
246
337
  <View style={styles.screen}>
247
- <ScrollView contentContainerStyle={styles.newAgentForm}>
248
- <View style={styles.actions}>
249
- <ActionButton label="Back" pendingLabel="Back" onPress={onBack} styles={styles} />
250
- </View>
251
- <FormBody
252
- agent={agent}
253
- choice={choice}
254
- change={change}
255
- onCreated={onCreated}
256
- styles={styles}
257
- />
258
- </ScrollView>
338
+ <View style={styles.newAgentHeader}>
339
+ <Text accessibilityRole="header" style={styles.panelHeading}>
340
+ New agent
341
+ </Text>
342
+ <ActionButton label="Back" pendingLabel="Back" onPress={onBack} styles={styles} />
343
+ </View>
344
+ <FormBody
345
+ agent={agent}
346
+ choice={choice}
347
+ change={change}
348
+ onCreated={onCreated}
349
+ styles={styles}
350
+ />
259
351
  </View>
260
352
  );
261
353
  }
@@ -1,3 +1,4 @@
1
+ import type { Appearance } from "../shared/appearance.js";
1
2
  import type { AgentModelDefinition, ProviderSnapshotEntry } from "@getpaseo/protocol/agent-types";
2
3
  import type { PluginPaseoApi } from "@getpaseo/plugin/client";
3
4
 
@@ -5,6 +6,7 @@ import type { PluginPaseoApi } from "@getpaseo/plugin/client";
5
6
  type PaseoWorkspace = Awaited<ReturnType<PluginPaseoApi["workspaces"]["list"]>>["entries"][number];
6
7
 
7
8
  export interface NewAgentChoice {
9
+ appearance?: Appearance;
8
10
  workspaceId: string | null;
9
11
  provider: string | null;
10
12
  model: string | null;
@@ -1,12 +1,7 @@
1
- import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
- import {
3
- Pressable,
4
- Text,
5
- View,
6
- type LayoutChangeEvent,
7
- type ScrollView as NativeScrollView,
8
- } from "react-native";
9
- import { Markdown, Modal, ScrollView } from "@getpaseo/plugin/client/ui";
1
+ import { useCallback, useEffect, useMemo, useState } from "react";
2
+ import { Pressable, Text, View, type ViewStyle } from "react-native";
3
+ import { Icon, Markdown, ScrollView } from "@getpaseo/plugin/client/ui";
4
+ import { OfficeModal as Modal } from "./office-modal.js";
10
5
  import type { z } from "zod";
11
6
  import type { NotesState, notesReadRpc } from "../shared/contracts.js";
12
7
  import { ActionButton, failureText } from "./action-button.js";
@@ -74,25 +69,39 @@ function MonthBar({ month, onAsk, styles }: MonthBarProps) {
74
69
  if (next !== null) onAsk(next);
75
70
  }, [next, onAsk]);
76
71
  return (
77
- <View style={styles.sheetActions}>
78
- <Text accessibilityRole="header" style={styles.standupHeading}>
72
+ <View style={styles.notesMonthBar}>
73
+ <Text accessibilityRole="header" style={styles.panelHeading}>
79
74
  {monthTitle(month.month)}
80
75
  </Text>
81
76
  <View style={styles.actions}>
82
- <ActionButton
83
- label="Previous month"
84
- pendingLabel="Previous month"
77
+ <Pressable
78
+ accessibilityRole="button"
79
+ accessibilityLabel="Previous month"
80
+ disabled={!previous}
81
+ aria-disabled={!previous}
85
82
  onPress={showPrevious}
86
- disabled={previous === null}
87
- styles={styles}
88
- />
89
- <ActionButton
90
- label="Next month"
91
- pendingLabel="Next month"
83
+ style={styles.sidebarButton}
84
+ >
85
+ <Icon
86
+ name="ChevronLeft"
87
+ size={18}
88
+ color={previous ? styles.iconColor : styles.placeholderColor}
89
+ />
90
+ </Pressable>
91
+ <Pressable
92
+ accessibilityRole="button"
93
+ accessibilityLabel="Next month"
94
+ disabled={!next}
95
+ aria-disabled={!next}
92
96
  onPress={showNext}
93
- disabled={next === null}
94
- styles={styles}
95
- />
97
+ style={styles.sidebarButton}
98
+ >
99
+ <Icon
100
+ name="ChevronRight"
101
+ size={18}
102
+ color={next ? styles.iconColor : styles.placeholderColor}
103
+ />
104
+ </Pressable>
96
105
  </View>
97
106
  </View>
98
107
  );
@@ -132,75 +141,94 @@ function Piece({ piece, onJump, styles }: PieceProps) {
132
141
  );
133
142
  }
134
143
 
135
- interface SectionProps {
136
- section: NotesSection;
137
- index: number;
138
- onPlaced(index: number, y: number): void;
139
- onJump(anchor: string): void;
140
- styles: OfficeStyles;
141
- }
142
-
143
- /** An entry, or the text before the first: Markdown, and its links to other entries. */
144
- function Section({ section, index, onPlaced, onJump, styles }: SectionProps) {
145
- const placed = useCallback(
146
- (event: LayoutChangeEvent) => onPlaced(index, event.nativeEvent.layout.y),
147
- [index, onPlaced],
148
- );
144
+ function sectionTitle(section: NotesSection) {
145
+ const first = section.pieces[0];
149
146
  return (
150
- <View onLayout={placed}>
151
- {section.pieces.map((piece, at) => (
152
- // A section's pieces are its text in order and never move, so their place is their key.
153
- // oxlint-disable-next-line react/no-array-index-key
154
- <Piece key={at} piece={piece} onJump={onJump} styles={styles} />
155
- ))}
156
- </View>
147
+ (first?.kind === "markdown" && first.text.match(/^## ([^\n]+)/)?.[1]?.trim()) || "Overview"
157
148
  );
158
149
  }
159
150
 
160
- interface NotesTextProps {
161
- /** The read the text came from: each read is brought to its newest entry once. */
162
- load: NotesMonth;
163
- text: string;
151
+ function EntryTab({
152
+ section,
153
+ selected,
154
+ onSelect,
155
+ styles,
156
+ }: {
157
+ section: NotesSection;
158
+ selected: boolean;
159
+ onSelect(section: NotesSection): void;
164
160
  styles: OfficeStyles;
161
+ }) {
162
+ const title = sectionTitle(section);
163
+ const select = useCallback(() => onSelect(section), [section, onSelect]);
164
+ const state = useMemo(() => ({ selected }), [selected]);
165
+ return (
166
+ <Pressable
167
+ accessibilityRole="tab"
168
+ accessibilityLabel={title}
169
+ accessibilityState={state}
170
+ aria-selected={selected}
171
+ onPress={select}
172
+ style={selected ? styles.sidebarButtonActive : styles.workspaceAction}
173
+ >
174
+ <Text style={styles.sidebarButtonText}>
175
+ {title.replace(/^(\d{1,2}) ([A-Za-z]{3})[a-z]* \d{4}$/, "$1 $2")}
176
+ </Text>
177
+ </Pressable>
178
+ );
165
179
  }
166
180
 
167
- /** The month's file as Markdown, scrolled to its newest entry; a Contents link scrolls to its entry. */
168
- function NotesText({ load, text, styles }: NotesTextProps) {
181
+ const strip: ViewStyle = { flexGrow: 0, flexShrink: 0 };
182
+ function NotesText({ text, styles }: { text: string; styles: OfficeStyles }) {
169
183
  const sections = useMemo(() => splitSections(text), [text]);
170
- const scroller = useRef<NativeScrollView>(null);
171
- // Where each entry starts in the scroller, by its anchor, as last laid out.
172
- const tops = useRef(new Map<string, number>());
173
- // Once per read: a later layout leaves the reader where they scrolled.
174
- const scrolledFor = useRef<NotesMonth | null>(null);
175
- const placed = useCallback(
176
- (index: number, y: number) => {
177
- const anchor = sections[index]?.anchor ?? null;
178
- if (anchor !== null) tops.current.set(anchor, y);
179
- if (index !== sections.length - 1 || scrolledFor.current === load) return;
180
- scrolledFor.current = load;
181
- scroller.current?.scrollTo({ y, animated: false });
182
- },
183
- [sections, load],
184
+ // Undefined follows the newest entry when the writer finishes. A chosen entry stays selected.
185
+ const [choice, setChoice] = useState<number>();
186
+ const current = sections[choice ?? sections.length - 1] ?? sections[sections.length - 1];
187
+ const select = useCallback(
188
+ (section: NotesSection) => setChoice(sections.indexOf(section)),
189
+ [sections],
190
+ );
191
+ const jump = useCallback(
192
+ (anchor: string) => setChoice(sections.findIndex((section) => section.anchor === anchor)),
193
+ [sections],
184
194
  );
185
- const jump = useCallback((anchor: string) => {
186
- const y = tops.current.get(anchor);
187
- if (y !== undefined) scroller.current?.scrollTo({ y, animated: true });
188
- }, []);
195
+ if (!current) return null;
189
196
  return (
190
- <ScrollView ref={scroller} style={styles.notesScroll}>
191
- {sections.map((section, index) => (
192
- <Section
193
- // The sections are the text in order and never move, so their place is their key.
194
- // oxlint-disable-next-line react/no-array-index-key
195
- key={index}
196
- section={section}
197
- index={index}
198
- onPlaced={placed}
199
- onJump={jump}
200
- styles={styles}
201
- />
202
- ))}
203
- </ScrollView>
197
+ <>
198
+ {sections.length > 1 && (
199
+ <ScrollView
200
+ horizontal
201
+ style={strip}
202
+ contentContainerStyle={styles.notesDateStrip}
203
+ accessibilityLabel="Note entries"
204
+ accessibilityRole="tablist"
205
+ showsHorizontalScrollIndicator
206
+ >
207
+ {Array.from({ length: sections.length }, (_, offset) => {
208
+ const index = sections.length - 1 - offset;
209
+ const section = sections[index]!;
210
+ return (
211
+ <EntryTab
212
+ key={`${index}-${section.anchor ?? "intro"}`}
213
+ section={section}
214
+ selected={section === current}
215
+ onSelect={select}
216
+ styles={styles}
217
+ />
218
+ );
219
+ })}
220
+ </ScrollView>
221
+ )}
222
+ <ScrollView key={current.anchor ?? "preamble"} style={styles.notesScroll}>
223
+ <View style={styles.notesPaper}>
224
+ {current.pieces.map((piece, index) => (
225
+ // A section's Markdown and link runs keep their order.
226
+ // oxlint-disable-next-line react/no-array-index-key
227
+ <Piece key={index} piece={piece} onJump={jump} styles={styles} />
228
+ ))}
229
+ </View>
230
+ </ScrollView>
231
+ </>
204
232
  );
205
233
  }
206
234
 
@@ -229,7 +257,7 @@ function NotesBody({ shown, styles }: NotesBodyProps) {
229
257
  if (month.text === null) {
230
258
  return <Text style={styles.muted}>No notes for {monthTitle(month.month)}.</Text>;
231
259
  }
232
- return <NotesText key={month.month} load={month} text={month.text} styles={styles} />;
260
+ return <NotesText key={month.month} text={month.text} styles={styles} />;
233
261
  }
234
262
 
235
263
  export interface NotesCardProps {
@@ -8,7 +8,7 @@ export const NOTES_DAYS_LABEL = "Stand-up days";
8
8
  const HINT = "The days of the 8:00 run.";
9
9
  const NO_DAY_HINT = "No day chosen: nothing runs at 8:00. The bell still starts the notes.";
10
10
  /** By weekday number, 0 for Sunday: each button's name; its pill shows the first three letters. */
11
- const DAY_NAMES = [
11
+ export const DAY_NAMES = [
12
12
  "Sunday",
13
13
  "Monday",
14
14
  "Tuesday",
@@ -0,0 +1,44 @@
1
+ import { useRpc } from "@getpaseo/plugin/client";
2
+ import { worldLogoRpc } from "../shared/contracts.js";
3
+ import { createContext, useContext, useEffect, useMemo, useState } from "react";
4
+ import type { Branding } from "../shared/branding.js";
5
+ import { readBrand } from "./web-env.web.js";
6
+
7
+ export const OfficeBrandContext = createContext<Branding | undefined>(undefined);
8
+
9
+ export function useOfficeBrand() {
10
+ const brand = useContext(OfficeBrandContext);
11
+ const name = brand?.name;
12
+ const logoUrl = brand?.logoUrl;
13
+ const color = brand?.color;
14
+ return useMemo(() => {
15
+ const page = readBrand();
16
+ return { name: name ?? page?.name ?? null, logoUrl: logoUrl ?? page?.logoUrl ?? null, color };
17
+ }, [name, logoUrl, color]);
18
+ }
19
+
20
+ /** The web and native scene both receive the same origin-clean logo texture. */
21
+ export function useSceneBrand() {
22
+ const brand = useOfficeBrand();
23
+ const configured = useContext(OfficeBrandContext)?.logoUrl;
24
+ const fetchLogo = useRpc(worldLogoRpc);
25
+ const [logo, setLogo] = useState<{ url: string; data: string | null } | null>(null);
26
+ useEffect(() => {
27
+ if (!configured) return;
28
+ let mounted = true;
29
+ const finish = (data: string | null) => {
30
+ if (mounted) setLogo({ url: configured, data });
31
+ };
32
+ void fetchLogo({}).then(
33
+ (reply) => finish(reply?.url === configured ? reply.data : null),
34
+ () => finish(null),
35
+ );
36
+ return () => {
37
+ mounted = false;
38
+ };
39
+ }, [configured, fetchLogo]);
40
+ return useMemo(() => {
41
+ if (!configured) return brand;
42
+ return logo?.url === configured ? { ...brand, logoUrl: logo.data } : null;
43
+ }, [brand, configured, logo]);
44
+ }
@@ -222,7 +222,8 @@ export function ColumnTabs({
222
222
  style={vertical ? styles.columnTabsVertical : styles.columnTabs}
223
223
  >
224
224
  {COLUMN_TABS.map((each) => {
225
- if (hideSessions && each.tab === "sessions") return null;
225
+ // In the desktop fullscreen layout Sessions has its own rail and Team chat its own toolbar button.
226
+ if (hideSessions && (each.tab === "sessions" || each.tab === "chat")) return null;
226
227
  let count: string | null = null;
227
228
  let countNote = "new";
228
229
  if (each.tab === "attention") count = badges.attention;
@@ -0,0 +1,79 @@
1
+ import { useCallback, useEffect, useMemo, useRef, useState, type RefObject } from "react";
2
+ import { Keyboard, type KeyboardEvent, type View } from "react-native";
3
+
4
+ /** Reserve only the part of the Office surface that the host still draws behind the keyboard. */
5
+ export function useChatKeyboard(
6
+ root: RefObject<View | null>,
7
+ platform: "web" | "ios" | "android",
8
+ active: boolean,
9
+ ) {
10
+ const [inset, setInset] = useState(0);
11
+ const [visible, setVisible] = useState(false);
12
+ const onLayout = useRef<() => void>(() => {});
13
+ const measureKeyboard = useCallback(() => onLayout.current(), []);
14
+
15
+ useEffect(() => {
16
+ setInset(0);
17
+ setVisible(false);
18
+ if (!active) return;
19
+ if (platform === "web") {
20
+ const viewport = window.visualViewport;
21
+ if (!viewport) return;
22
+ const measure = () => {
23
+ const box = (root.current as unknown as HTMLElement | null)?.getBoundingClientRect();
24
+ setVisible(viewport.height + viewport.offsetTop < window.innerHeight - 80);
25
+ if (box) setInset(Math.max(0, box.bottom - viewport.offsetTop - viewport.height));
26
+ };
27
+ onLayout.current = measure;
28
+ viewport.addEventListener("resize", measure);
29
+ viewport.addEventListener("scroll", measure);
30
+ measure();
31
+ return () => {
32
+ onLayout.current = () => {};
33
+ viewport.removeEventListener("resize", measure);
34
+ viewport.removeEventListener("scroll", measure);
35
+ };
36
+ }
37
+
38
+ let top = Keyboard.metrics()?.screenY;
39
+ let revision = 0;
40
+ const measure = () => {
41
+ const current = ++revision;
42
+ const keyboardTop = top;
43
+ setVisible(keyboardTop !== undefined);
44
+ if (keyboardTop === undefined) {
45
+ setInset(0);
46
+ return;
47
+ }
48
+ root.current?.measureInWindow((_x, y, _width, height) => {
49
+ if (current === revision) setInset(Math.max(0, y + height - keyboardTop));
50
+ });
51
+ };
52
+ const shown = (event: KeyboardEvent) => {
53
+ top = event.endCoordinates.screenY;
54
+ measure();
55
+ };
56
+ const hidden = () => {
57
+ top = undefined;
58
+ measure();
59
+ };
60
+ const show = Keyboard.addListener(
61
+ platform === "ios" ? "keyboardWillChangeFrame" : "keyboardDidShow",
62
+ shown,
63
+ );
64
+ const hide = Keyboard.addListener(
65
+ platform === "ios" ? "keyboardWillHide" : "keyboardDidHide",
66
+ hidden,
67
+ );
68
+ onLayout.current = measure;
69
+ measure();
70
+ return () => {
71
+ revision++;
72
+ onLayout.current = () => {};
73
+ show.remove();
74
+ hide.remove();
75
+ };
76
+ }, [active, platform, root]);
77
+ const spaceStyle = useMemo(() => ({ height: active ? inset : 0 }), [active, inset]);
78
+ return { spaceStyle, measureKeyboard, visible: active && visible };
79
+ }