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.
Files changed (138) 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 +197 -73
  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/transcript-styles.ts +90 -0
  73. package/client/use-device-switch.ts +21 -12
  74. package/client/use-duty-actions.ts +43 -0
  75. package/client/use-group-photo.ts +48 -0
  76. package/client/use-new-agent.ts +4 -0
  77. package/client/use-street.ts +8 -0
  78. package/client/workspace-office-tools.tsx +102 -0
  79. package/client/workspace-overlay-route.web.ts +47 -0
  80. package/client/workspace-overlay.tsx +195 -0
  81. package/client/world/adapter.ts +37 -2
  82. package/client/world/escape.ts +58 -0
  83. package/client/world/use-world-feed.ts +6 -2
  84. package/client/world/workspace-dock.ts +6 -0
  85. package/client/world/world-api.ts +45 -4
  86. package/client/world/world-bridge-page.ts +14 -3
  87. package/client/world/world-bridge.ts +50 -5
  88. package/client/world/world-frame.web.ts +8 -0
  89. package/client/world/world-view-native.tsx +31 -10
  90. package/client/world/world-view-shared.ts +36 -7
  91. package/client/world/world-view.tsx +93 -21
  92. package/docs/office.md +148 -58
  93. package/index.client.tsx +13 -6
  94. package/index.server.ts +125 -9
  95. package/package.json +2 -1
  96. package/server/activity.ts +42 -19
  97. package/server/agent-tools.ts +11 -5
  98. package/server/board-service.ts +381 -10
  99. package/server/brand-logo.ts +34 -0
  100. package/server/chat-group.ts +83 -0
  101. package/server/chat-service.ts +406 -62
  102. package/server/chat-store.ts +1 -4
  103. package/server/directory.ts +22 -7
  104. package/server/duty-service.ts +230 -0
  105. package/server/group-photo.ts +39 -0
  106. package/server/home-departure.ts +47 -0
  107. package/server/hub.ts +43 -1
  108. package/server/live-ports.ts +114 -18
  109. package/server/lobby-pickup.ts +170 -0
  110. package/server/machine/details.ts +91 -0
  111. package/server/mention-queue.ts +14 -0
  112. package/server/office.ts +110 -6
  113. package/server/paths.ts +9 -0
  114. package/server/ssh/LICENSE.paseo +211 -0
  115. package/server/ssh/client.ts +401 -0
  116. package/server/ssh/discovery.ts +230 -0
  117. package/server/ssh/installed.ts +104 -0
  118. package/server/ssh/monitor.ts +104 -0
  119. package/server/ssh/pid-files.ts +194 -0
  120. package/server/ssh/read.ts +136 -0
  121. package/server/subagent-names.ts +4 -0
  122. package/server/words.generated.ts +1 -1
  123. package/server/world.generated.ts +1 -1
  124. package/shared/appearance.ts +43 -0
  125. package/shared/branding.ts +53 -0
  126. package/shared/chat-words.ts +2 -2
  127. package/shared/contracts.ts +135 -4
  128. package/shared/duties.ts +100 -0
  129. package/shared/host-details.ts +25 -0
  130. package/shared/lobby-assignment.ts +34 -0
  131. package/shared/model.ts +9 -1
  132. package/shared/names.ts +2 -0
  133. package/shared/settings.ts +14 -3
  134. package/shared/ssh.ts +34 -0
  135. package/shared/upstream/README.md +1 -3
  136. package/shared/upstream/chat-engine.d.ts +4 -0
  137. package/shared/upstream/prompt-coach.d.ts +6 -0
  138. package/shared/upstream/prompt-coach.js +178 -0
@@ -1,7 +1,10 @@
1
- import { useCallback, useMemo } from "react";
1
+ import { useCallback, useMemo, useState } from "react";
2
2
  import { Text, View, type ViewStyle } from "react-native";
3
- import { Modal } from "@getpaseo/plugin/client/ui";
4
- import type { Machine, MachineAgent } from "../shared/contracts.js";
3
+ import { OfficeModal as Modal } from "./office-modal.js";
4
+ import { Icon } from "@getpaseo/plugin/client/ui";
5
+ import type { Machine, MachineAgent, OfficeWorkspace } from "../shared/contracts.js";
6
+ import { HostViews, NO_SSH, type SshDiscovery } from "./ssh-hosts.js";
7
+ import { LocalHostDetails } from "./host-details.js";
5
8
  import { ActionButton } from "./action-button.js";
6
9
  import {
7
10
  agentLine,
@@ -18,74 +21,180 @@ import type { OfficeStyles } from "./styles.js";
18
21
 
19
22
  interface MeterProps {
20
23
  label: string;
21
- value: string;
22
- /** 0 to 100; null draws the track alone. */
24
+ icon: string;
25
+ detail?: string;
23
26
  percent: number | null;
24
27
  tone: HostTone;
25
28
  styles: OfficeStyles;
26
29
  }
27
30
 
28
- function Meter({ label, value, percent, tone, styles }: MeterProps) {
31
+ function Meter({ label, icon, detail, percent, tone, styles }: MeterProps) {
32
+ const host = styles.host;
33
+ const value = percent === null ? (detail ?? "Not read yet") : `${percent}%`;
34
+ const description = detail && percent !== null ? `${detail} (${value})` : value;
29
35
  const fill = useMemo(
30
- (): ViewStyle[] => [styles.machineFill[tone], { width: `${percent ?? 0}%` }],
31
- [styles, tone, percent],
36
+ (): ViewStyle => ({
37
+ height: "100%",
38
+ borderRadius: 3,
39
+ width: `${Math.min(100, Math.max(0, percent ?? 0))}%`,
40
+ backgroundColor:
41
+ tone === "muted" && label === "Memory"
42
+ ? host.memoryFill.backgroundColor
43
+ : styles.machineFill[tone].backgroundColor,
44
+ }),
45
+ [percent, tone, label, host, styles],
32
46
  );
33
47
  return (
34
48
  <View
35
49
  accessible
36
- accessibilityLabel={`${label}: ${value}`}
50
+ accessibilityLabel={`${label}: ${description}`}
37
51
  accessibilityRole="text"
38
- style={styles.machineMeter}
52
+ style={host.meter}
39
53
  >
40
- <Text style={styles.sheetLabel}>{label}</Text>
41
- <Text style={styles.machineValue}>{value}</Text>
42
- <View style={styles.machineTrack}>
43
- <View style={styles.machineTrackBase} />
44
- {percent === null ? null : <View style={fill} />}
54
+ <View style={host.metricHead}>
55
+ <Icon name={icon} size={16} color={host.label.color} />
56
+ <Text style={host.label}>{label}</Text>
45
57
  </View>
58
+ <View style={host.reading}>
59
+ <Text style={host.percent}>
60
+ {percent ?? "—"}
61
+ {percent !== null && <Text style={host.unit}>%</Text>}
62
+ </Text>
63
+ {(detail || percent === null) && <Text style={host.note}>{detail ?? value}</Text>}
64
+ </View>
65
+ <View style={host.track}>{percent !== null && <View style={fill} />}</View>
46
66
  </View>
47
67
  );
48
68
  }
49
69
 
70
+ interface RowAction {
71
+ label: string;
72
+ pendingLabel: string;
73
+ primary: boolean;
74
+ }
75
+
50
76
  interface AgentRowProps {
51
77
  agent: MachineAgent;
52
- /** The reading's own time. */
53
78
  now: number;
54
- /** The button under the row; null for a row nothing can be done about. */
55
- action: { label: string; pendingLabel: string; primary: boolean } | null;
79
+ action: RowAction | null;
80
+ actionColumn: boolean;
81
+ divided: boolean;
82
+ totalBytes: number;
56
83
  cleanUp(agentIds: readonly string[]): Promise<void>;
57
84
  styles: OfficeStyles;
58
85
  }
59
86
 
60
- function AgentRow({ agent, now, action, cleanUp, styles }: AgentRowProps) {
87
+ const STATUS_TONE = {
88
+ idle: "idle",
89
+ running: "running",
90
+ initializing: "starting",
91
+ closed: "idle",
92
+ error: "danger",
93
+ } as const;
94
+
95
+ function AgentRow({
96
+ agent,
97
+ now,
98
+ action,
99
+ actionColumn,
100
+ divided,
101
+ totalBytes,
102
+ cleanUp,
103
+ styles,
104
+ }: AgentRowProps) {
105
+ const host = styles.host;
61
106
  const press = useCallback(() => cleanUp([agent.agentId]), [cleanUp, agent.agentId]);
107
+ const rowStyle = useMemo(() => [host.row, divided && host.divider], [host, divided]);
108
+ const dotStyle = useMemo(
109
+ () => [styles.dot[STATUS_TONE[agent.status]], host.status],
110
+ [styles, agent.status, host],
111
+ );
112
+ const shareStyle = useMemo(
113
+ (): ViewStyle => ({
114
+ height: "100%",
115
+ borderRadius: 2,
116
+ backgroundColor: host.memoryFill.backgroundColor,
117
+ width: `${totalBytes > 0 ? (agent.rssBytes / totalBytes) * 100 : 0}%`,
118
+ }),
119
+ [host, agent.rssBytes, totalBytes],
120
+ );
62
121
  return (
63
- <View style={styles.machineRow}>
64
- <View accessible accessibilityLabel={agentRowLabel(agent, now)} accessibilityRole="text">
65
- <View style={styles.machineRowHead}>
66
- <Text style={styles.machineRowTitle} numberOfLines={1}>
122
+ <View style={rowStyle}>
123
+ <View
124
+ accessible
125
+ accessibilityLabel={agentRowLabel(agent, now)}
126
+ accessibilityRole="text"
127
+ style={host.info}
128
+ >
129
+ <View style={dotStyle} />
130
+ <View style={host.identity}>
131
+ <Text style={host.name} numberOfLines={1}>
67
132
  {machineTitle(agent)}
68
133
  </Text>
69
- <Text style={styles.machineValue}>{formatBytes(agent.rssBytes)}</Text>
134
+ <Text style={host.note}>{agentLine(agent, now)}</Text>
135
+ </View>
136
+ <View style={host.usage}>
137
+ <Text style={host.bytes}>{formatBytes(agent.rssBytes)}</Text>
138
+ <View style={host.share}>
139
+ <View style={shareStyle} />
140
+ </View>
70
141
  </View>
71
- <Text style={styles.rowMeta}>{agentLine(agent, now)}</Text>
72
142
  </View>
73
143
  {action ? (
74
- <View style={styles.actions}>
75
- <ActionButton
76
- label={action.label}
77
- pendingLabel={action.pendingLabel}
78
- onPress={press}
144
+ <View style={host.action}>
145
+ <ActionButton {...action} onPress={press} styles={styles} />
146
+ </View>
147
+ ) : (
148
+ actionColumn && <View style={host.emptyAction} />
149
+ )}
150
+ </View>
151
+ );
152
+ }
153
+
154
+ interface AgentGroupProps {
155
+ title: string;
156
+ agents: readonly MachineAgent[];
157
+ now: number;
158
+ actionFor(agent: MachineAgent): RowAction | null;
159
+ cleanUp: AgentRowProps["cleanUp"];
160
+ styles: OfficeStyles;
161
+ empty?: string;
162
+ }
163
+
164
+ function AgentGroup({ title, agents, now, actionFor, cleanUp, styles, empty }: AgentGroupProps) {
165
+ const host = styles.host;
166
+ const totalBytes = agents.reduce((sum, agent) => sum + agent.rssBytes, 0);
167
+ const actionColumn = agents.some((agent) => actionFor(agent) !== null);
168
+ return (
169
+ <View style={host.group}>
170
+ <View style={host.groupHead}>
171
+ <Text accessibilityRole="header" style={host.title}>
172
+ {title}
173
+ </Text>
174
+ {agents.length > 0 && <Text style={host.note}>{formatBytes(totalBytes)} total</Text>}
175
+ </View>
176
+ <View style={host.list}>
177
+ {agents.length === 0 && <Text style={host.empty}>{empty}</Text>}
178
+ {agents.map((agent, index) => (
179
+ <AgentRow
180
+ key={agent.agentId}
181
+ agent={agent}
182
+ now={now}
183
+ divided={index > 0}
184
+ actionColumn={actionColumn}
185
+ totalBytes={totalBytes}
186
+ action={actionFor(agent)}
187
+ cleanUp={cleanUp}
79
188
  styles={styles}
80
- primary={action.primary}
81
189
  />
82
- </View>
83
- ) : null}
190
+ ))}
191
+ </View>
84
192
  </View>
85
193
  );
86
194
  }
87
195
 
88
196
  interface MachineBodyProps {
197
+ workspaces?: readonly OfficeWorkspace[];
89
198
  machine: Machine;
90
199
  cleanUp(agentIds: readonly string[]): Promise<void>;
91
200
  styles: OfficeStyles;
@@ -95,9 +204,13 @@ interface MachineBodyProps {
95
204
  // something, the one for all of them when several did.
96
205
  const CLEAN_ONLY = { label: "Clean up", pendingLabel: "Cleaning up...", primary: true };
97
206
  const CLEAN_ONE = { label: "Clean up", pendingLabel: "Cleaning up...", primary: false };
98
- const CLOSE = { label: "Close", pendingLabel: "Closing...", primary: false };
207
+ const CLOSE = { label: "Close runtime", pendingLabel: "Closing...", primary: false };
99
208
 
100
- function MachineBody({ machine, cleanUp, styles }: MachineBodyProps) {
209
+ const NO_WORKSPACES: readonly OfficeWorkspace[] = [];
210
+
211
+ function MachineBody({ machine, cleanUp, styles, workspaces = NO_WORKSPACES }: MachineBodyProps) {
212
+ const [expanded, setExpanded] = useState(false);
213
+ const toggle = useCallback(() => setExpanded((value) => !value), []);
101
214
  const now = Date.parse(machine.readAt);
102
215
  const left = useMemo(() => machine.agents.filter((agent) => agent.forgotten), [machine.agents]);
103
216
  const others = useMemo(
@@ -116,39 +229,47 @@ function MachineBody({ machine, cleanUp, styles }: MachineBodyProps) {
116
229
  );
117
230
  const percent = memoryPercent(machine);
118
231
  const rowAction = cleanable.length === 1 ? CLEAN_ONLY : CLEAN_ONE;
232
+ const forLeft = useCallback(
233
+ (agent: MachineAgent) => (cleanable.includes(agent) ? rowAction : null),
234
+ [cleanable, rowAction],
235
+ );
236
+ const forOther = useCallback(
237
+ (agent: MachineAgent) => (canClose && agent.status === "idle" ? CLOSE : null),
238
+ [canClose],
239
+ );
119
240
  return (
120
- <View style={styles.sheet}>
121
- <View style={styles.machineMeters}>
241
+ <View style={styles.host.body}>
242
+ <View style={styles.host.meters}>
122
243
  <Meter
244
+ icon="MemoryStick"
123
245
  label="Memory"
124
- value={percent === null ? memoryText(machine) : `${memoryText(machine)} (${percent}%)`}
246
+ detail={memoryText(machine)}
125
247
  percent={percent}
126
248
  tone={memoryTone(percent)}
127
249
  styles={styles}
128
250
  />
129
- <Meter
130
- label="CPU"
131
- value={machine.cpuPercent === null ? "Not read yet" : `${machine.cpuPercent}%`}
132
- percent={machine.cpuPercent}
133
- tone="muted"
251
+ <Meter icon="Cpu" label="CPU" percent={machine.cpuPercent} tone="muted" styles={styles} />
252
+ </View>
253
+ <View style={styles.host.groupHead}>
254
+ <Text style={styles.host.note}>Read at {readAtText(machine.readAt)}</Text>
255
+ <ActionButton
256
+ label={expanded ? "Hide details" : "Details"}
257
+ pendingLabel="Details"
258
+ onPress={toggle}
134
259
  styles={styles}
135
260
  />
136
261
  </View>
262
+ {expanded && <LocalHostDetails machine={machine} workspaces={workspaces} styles={styles} />}
137
263
  {left.length > 0 ? (
138
- <View style={styles.machineGroup}>
139
- <Text accessibilityRole="header" style={styles.sheetLabel}>
140
- Left running
141
- </Text>
142
- {left.map((agent) => (
143
- <AgentRow
144
- key={agent.agentId}
145
- agent={agent}
146
- now={now}
147
- action={cleanable.includes(agent) ? rowAction : null}
148
- cleanUp={cleanUp}
149
- styles={styles}
150
- />
151
- ))}
264
+ <View style={styles.host.group}>
265
+ <AgentGroup
266
+ title="Left running"
267
+ agents={left}
268
+ now={now}
269
+ actionFor={forLeft}
270
+ cleanUp={cleanUp}
271
+ styles={styles}
272
+ />
152
273
  <Text style={styles.rowMeta}>
153
274
  {canClose
154
275
  ? "Cleaning up closes an idle agent, which its next prompt resumes, and stops what a closed agent left behind."
@@ -165,37 +286,28 @@ function MachineBody({ machine, cleanUp, styles }: MachineBodyProps) {
165
286
  ) : null}
166
287
  </View>
167
288
  ) : null}
168
- <View style={styles.machineGroup}>
169
- <Text accessibilityRole="header" style={styles.sheetLabel}>
170
- Memory by agent
171
- </Text>
172
- {others.length === 0 ? (
173
- <Text style={styles.muted}>
174
- {left.length === 0
175
- ? "No agent holds a process on this host."
176
- : "No other agent holds a process on this host."}
177
- </Text>
178
- ) : (
179
- others.map((agent) => (
180
- <AgentRow
181
- key={agent.agentId}
182
- agent={agent}
183
- now={now}
184
- action={canClose && agent.status === "idle" ? CLOSE : null}
185
- cleanUp={cleanUp}
186
- styles={styles}
187
- />
188
- ))
189
- )}
190
- </View>
191
- <Text style={styles.rowMeta}>Read at {readAtText(machine.readAt)}</Text>
289
+ <AgentGroup
290
+ title="Memory by agent"
291
+ agents={others}
292
+ now={now}
293
+ actionFor={forOther}
294
+ cleanUp={cleanUp}
295
+ styles={styles}
296
+ empty={
297
+ left.length === 0
298
+ ? "No agent holds a process on this host."
299
+ : "No other agent holds a process on this host."
300
+ }
301
+ />
192
302
  </View>
193
303
  );
194
304
  }
195
305
 
196
306
  export interface MachineCardProps {
197
- /** Null closes the card: the host has no reading (any more). */
307
+ workspaces?: readonly OfficeWorkspace[];
308
+ /** Empty on hosts without local readings. */
198
309
  machine: Machine | null;
310
+ ssh?: SshDiscovery;
199
311
  open: boolean;
200
312
  cleanUp(agentIds: readonly string[]): Promise<void>;
201
313
  styles: OfficeStyles;
@@ -203,17 +315,45 @@ export interface MachineCardProps {
203
315
  }
204
316
 
205
317
  /** The host: its memory, what each agent holds of it, and what was left running. */
206
- export function MachineCard({ machine, open, cleanUp, styles, onClose }: MachineCardProps) {
318
+ export function MachineCard({
319
+ machine,
320
+ ssh = NO_SSH,
321
+ workspaces,
322
+ open,
323
+ cleanUp,
324
+ styles,
325
+ onClose,
326
+ }: MachineCardProps) {
207
327
  const change = useCallback(
208
328
  (next: boolean) => {
209
329
  if (!next) onClose();
210
330
  },
211
331
  [onClose],
212
332
  );
333
+ const icon = useMemo(
334
+ () => <Icon name="Server" size={18} color={styles.host.label.color} />,
335
+ [styles],
336
+ );
337
+ const visible = open && (machine !== null || ssh.servers.length > 0);
213
338
  return (
214
- <Modal title="Host" open={open && machine !== null} onOpenChange={change}>
339
+ <Modal icon={icon} title="Host" open={visible} onOpenChange={change}>
215
340
  <Modal.Content>
216
- {machine ? <MachineBody machine={machine} cleanUp={cleanUp} styles={styles} /> : null}
341
+ {visible && (
342
+ <HostViews discovery={ssh} hasLocal={machine !== null} styles={styles}>
343
+ {machine ? (
344
+ <MachineBody
345
+ workspaces={workspaces}
346
+ machine={machine}
347
+ cleanUp={cleanUp}
348
+ styles={styles}
349
+ />
350
+ ) : (
351
+ <Text style={styles.host.note}>
352
+ Local resource readings are unavailable on this host.
353
+ </Text>
354
+ )}
355
+ </HostViews>
356
+ )}
217
357
  </Modal.Content>
218
358
  </Modal>
219
359
  );
@@ -0,0 +1,216 @@
1
+ import type { PluginTheme } from "@getpaseo/plugin";
2
+ import type { TextStyle, ViewStyle } from "react-native";
3
+
4
+ // The upstream floating messenger has its own light palette on both office themes.
5
+ export function messengerTheme(theme: PluginTheme): PluginTheme {
6
+ return {
7
+ ...theme,
8
+ colors: {
9
+ ...theme.colors,
10
+ surface0: "#ebecf0",
11
+ surface1: "#ffffff",
12
+ surface2: "#e5f1ff",
13
+ border: "#cdd5e0",
14
+ foreground: "#102647",
15
+ foregroundMuted: "#526279",
16
+ accent: "#075dd5",
17
+ accentForeground: "#ffffff",
18
+ statusDanger: "#b52d3d",
19
+ },
20
+ };
21
+ }
22
+
23
+ export function messengerStyles({ colors }: PluginTheme, compact: boolean, touch: boolean) {
24
+ const control = touch ? 44 : 36;
25
+ const tools: ViewStyle = {
26
+ position: "absolute",
27
+ bottom: -8,
28
+ right: 0,
29
+ flexDirection: "row",
30
+ gap: 3,
31
+ backgroundColor: colors.surface1,
32
+ borderRadius: 16,
33
+ zIndex: 1,
34
+ };
35
+ const floorAnchor: ViewStyle = {
36
+ position: "absolute",
37
+ top: 8,
38
+ bottom: 12,
39
+ right: 12,
40
+ left: 12,
41
+ alignItems: "flex-end",
42
+ zIndex: 6,
43
+ };
44
+ return {
45
+ floorAnchor,
46
+ compactAnchor: { ...floorAnchor, top: 6, bottom: 6, right: 6, left: 6 },
47
+ tools,
48
+ photo: { width: 210, maxWidth: "100%", aspectRatio: 4 / 3, borderRadius: 8 },
49
+ morePanel: {
50
+ padding: 6,
51
+ borderWidth: 1,
52
+ borderColor: colors.border,
53
+ borderRadius: 8,
54
+ backgroundColor: colors.surface1,
55
+ },
56
+ sectionTitle: { flex: 1, color: colors.foreground, fontWeight: "700", fontSize: 14 },
57
+ quickRow: {
58
+ flexDirection: "row",
59
+ alignItems: "center",
60
+ gap: 6,
61
+ paddingHorizontal: 6,
62
+ minHeight: control,
63
+ },
64
+ memberList: {
65
+ flexGrow: 0,
66
+ maxHeight: 210,
67
+ backgroundColor: colors.surface1,
68
+ borderBottomWidth: 1,
69
+ borderColor: colors.border,
70
+ },
71
+ pollScroll: { maxHeight: 230 },
72
+ preview: {
73
+ flexDirection: "row",
74
+ alignItems: "center",
75
+ borderWidth: 1,
76
+ borderColor: colors.border,
77
+ borderRadius: 8,
78
+ padding: 3,
79
+ },
80
+ toolbar: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 4 },
81
+ pin: {
82
+ flexDirection: "row",
83
+ alignItems: "center",
84
+ gap: 8,
85
+ minHeight: control,
86
+ paddingHorizontal: 12,
87
+ backgroundColor: colors.surface1,
88
+ borderColor: colors.border,
89
+ borderBottomWidth: 1,
90
+ },
91
+ toolsHidden: { ...tools, opacity: 0, pointerEvents: "none" },
92
+ chosenName: { flexShrink: 1, color: colors.foreground, fontSize: 12, fontWeight: "600" },
93
+ floating: {
94
+ flex: 1,
95
+ width: "100%",
96
+ maxWidth: compact ? undefined : 460,
97
+ borderRadius: 14,
98
+ borderWidth: 1,
99
+ borderColor: colors.border,
100
+ backgroundColor: colors.surface0,
101
+ overflow: "hidden",
102
+ boxShadow: "0 12px 40px rgba(8, 16, 32, .28)",
103
+ },
104
+ header: {
105
+ flexDirection: "row",
106
+ alignItems: "center",
107
+ gap: 8,
108
+ minHeight: 64,
109
+ paddingHorizontal: 12,
110
+ backgroundColor: colors.surface1,
111
+ borderBottomWidth: 1,
112
+ borderColor: colors.border,
113
+ },
114
+ title: { color: colors.foreground, fontSize: 16, lineHeight: 21, fontWeight: "700" },
115
+ subtitle: { color: colors.foregroundMuted, fontSize: 12, lineHeight: 16 },
116
+ group: {
117
+ flexDirection: "row",
118
+ flexWrap: "wrap",
119
+ width: 39,
120
+ height: 39,
121
+ alignContent: "center",
122
+ gap: 2,
123
+ },
124
+ memberAvatar: {
125
+ width: 18,
126
+ height: 18,
127
+ alignItems: "center",
128
+ justifyContent: "center",
129
+ borderRadius: 9,
130
+ },
131
+ memberInitial: { fontWeight: "700", fontSize: 9, color: "#fff" },
132
+ icon: {
133
+ minWidth: control,
134
+ minHeight: control,
135
+ alignItems: "center",
136
+ justifyContent: "center",
137
+ overflow: "hidden",
138
+ borderRadius: 8,
139
+ },
140
+ searchRow: {
141
+ paddingHorizontal: 12,
142
+ paddingVertical: 8,
143
+ borderBottomWidth: 1,
144
+ borderColor: colors.border,
145
+ backgroundColor: colors.surface1,
146
+ },
147
+ unread: { flexDirection: "row", alignItems: "center", gap: 8, paddingVertical: 6 },
148
+ unreadRule: { flex: 1, height: 1, backgroundColor: colors.statusDanger, opacity: 0.4 },
149
+ unreadText: { color: colors.statusDanger, fontSize: 12, fontWeight: "600" },
150
+ conversationBody: { flex: 1, minHeight: 0 },
151
+ composeOptions: { flexGrow: 0, flexShrink: 1 },
152
+ composeOptionsBody: { gap: 6 },
153
+ composer: {
154
+ flexShrink: 0,
155
+ maxHeight: compact ? "85%" : undefined,
156
+ paddingVertical: 8,
157
+ paddingHorizontal: 12,
158
+ gap: 6,
159
+ borderTopWidth: 1,
160
+ borderColor: colors.border,
161
+ backgroundColor: colors.surface1,
162
+ },
163
+ composerRow: { flexDirection: "row", alignItems: "center", gap: 6, minWidth: 0 },
164
+ field: {
165
+ flex: 1,
166
+ fontSize: touch ? 16 : 14,
167
+ minHeight: control,
168
+ maxHeight: 100,
169
+ paddingVertical: 8,
170
+ paddingHorizontal: 8,
171
+ color: colors.foreground,
172
+ },
173
+ to: {
174
+ minHeight: control,
175
+ maxWidth: "100%",
176
+ paddingHorizontal: 8,
177
+ flexDirection: "row",
178
+ gap: 5,
179
+ alignItems: "center",
180
+ alignSelf: "flex-start",
181
+ borderRadius: 6,
182
+ },
183
+ send: {
184
+ minWidth: control,
185
+ minHeight: control,
186
+ alignItems: "center",
187
+ justifyContent: "center",
188
+ borderRadius: 9,
189
+ backgroundColor: colors.accent,
190
+ },
191
+ sendOff: {
192
+ minWidth: control,
193
+ minHeight: control,
194
+ alignItems: "center",
195
+ justifyContent: "center",
196
+ borderRadius: 9,
197
+ backgroundColor: colors.surface2,
198
+ },
199
+ picker: {
200
+ maxHeight: 200,
201
+ backgroundColor: colors.surface1,
202
+ borderColor: colors.border,
203
+ borderWidth: 1,
204
+ borderRadius: 8,
205
+ },
206
+ choice: {
207
+ flexDirection: "row",
208
+ gap: 8,
209
+ alignItems: "center",
210
+ paddingHorizontal: 10,
211
+ minHeight: control,
212
+ paddingVertical: 6,
213
+ },
214
+ empty: { textAlign: "center", color: colors.foregroundMuted, padding: 12 },
215
+ } satisfies Record<string, ViewStyle | TextStyle>;
216
+ }