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
@@ -0,0 +1,269 @@
1
+ import { useCallback, useEffect, useMemo, useState } from "react";
2
+ import { Text, View } from "react-native";
3
+ import { useRpc } from "@getpaseo/plugin/client";
4
+ import type { Machine, OfficeWorkspace } from "../shared/contracts.js";
5
+ import { hostDetailsRpc, type HostDetails } from "../shared/host-details.js";
6
+ import { formatBytes, machineTitle, readAtText } from "../shared/machine-text.js";
7
+ import { ActionButton } from "./action-button.js";
8
+ import type { OfficeStyles } from "./styles.js";
9
+
10
+ interface Row {
11
+ id?: string;
12
+ label: string;
13
+ value: string;
14
+ note?: string;
15
+ }
16
+
17
+ function Section({
18
+ title,
19
+ rows,
20
+ empty,
21
+ styles,
22
+ }: {
23
+ title: string;
24
+ rows: Row[];
25
+ empty: string;
26
+ styles: OfficeStyles;
27
+ }) {
28
+ const host = styles.host;
29
+ return (
30
+ <View style={host.group}>
31
+ <Text style={host.title}>{title}</Text>
32
+ <View style={host.list}>
33
+ {rows.length ? (
34
+ rows.map((item, index) => (
35
+ <View
36
+ key={item.id ?? item.label}
37
+ style={index > 0 ? host.detailRowDivided : host.detailRow}
38
+ >
39
+ <View style={host.identity}>
40
+ <Text style={host.name}>{item.label}</Text>
41
+ {item.note && <Text style={host.note}>{item.note}</Text>}
42
+ </View>
43
+ <Text style={host.bytes}>{item.value}</Text>
44
+ </View>
45
+ ))
46
+ ) : (
47
+ <Text style={host.empty}>{empty}</Text>
48
+ )}
49
+ </View>
50
+ </View>
51
+ );
52
+ }
53
+
54
+ function TrendBar({ value, styles }: { value: number | null; styles: OfficeStyles }) {
55
+ const bar = useMemo(
56
+ () => [
57
+ styles.host.historyBar,
58
+ { height: value === null ? 1 : Math.max(2, value * 0.32), opacity: value === null ? 0.2 : 1 },
59
+ ],
60
+ [styles.host.historyBar, value],
61
+ );
62
+ return <View style={bar} />;
63
+ }
64
+
65
+ function Trend({
66
+ details,
67
+ metric,
68
+ styles,
69
+ }: {
70
+ details: HostDetails;
71
+ metric: "cpu" | "ram";
72
+ styles: OfficeStyles;
73
+ }) {
74
+ const buckets = Array.from({ length: 30 }, (_, minute) => ({
75
+ at: details.readAt - (29 - minute) * 60000,
76
+ value: null as number | null,
77
+ }));
78
+ for (const point of details.history) {
79
+ const bucket = 29 - Math.floor((details.readAt - point.at) / 60000);
80
+ if (bucket >= 0 && bucket < 30 && point[metric] !== null) buckets[bucket].value = point[metric];
81
+ }
82
+ const values = buckets.map((b) => b.value).filter((v) => v !== null);
83
+ const title = metric === "cpu" ? "CPU" : "RAM";
84
+ const range = values.length
85
+ ? `${Math.min(...values)}–${Math.max(...values)}%`
86
+ : "Awaiting readings";
87
+ return (
88
+ <View
89
+ accessible
90
+ accessibilityLabel={`${title}: ${range} in the last 30 minutes`}
91
+ style={styles.host.group}
92
+ >
93
+ <View style={styles.host.groupHead}>
94
+ <Text style={styles.host.label}>{title}</Text>
95
+ <Text style={styles.host.note}>{range}</Text>
96
+ </View>
97
+ <View style={styles.host.historyPlot}>
98
+ {buckets.map(({ at, value }) => (
99
+ <TrendBar key={at} value={value} styles={styles} />
100
+ ))}
101
+ </View>
102
+ </View>
103
+ );
104
+ }
105
+
106
+ function SystemReadings({ details, styles }: { details: HostDetails; styles: OfficeStyles }) {
107
+ const { swap, disk } = details;
108
+ const rows = useMemo<Row[]>(
109
+ () => [
110
+ {
111
+ label: "System swap",
112
+ value: swap ? formatBytes(swap.used) : "Unavailable",
113
+ note: swap ? `${formatBytes(swap.total)} configured` : undefined,
114
+ },
115
+ {
116
+ label: "Home filesystem",
117
+ value: disk ? `${formatBytes(disk.available)} free` : "Unavailable",
118
+ note: disk ? `${formatBytes(disk.total)} total` : undefined,
119
+ },
120
+ {
121
+ label: "System load",
122
+ value: details.load.map((v) => v.toFixed(1)).join(" / "),
123
+ note: `1, 5 and 15 min · ${details.cores} CPUs available to Paseo`,
124
+ },
125
+ ],
126
+ [swap, disk, details.cores, details.load],
127
+ );
128
+ const apps = useMemo(
129
+ () =>
130
+ details.apps.map((app) => ({
131
+ label: app.name,
132
+ value: formatBytes(app.bytes),
133
+ note: `${app.count} process${app.count === 1 ? "" : "es"} · resident memory`,
134
+ })),
135
+ [details.apps],
136
+ );
137
+ return (
138
+ <>
139
+ <Section title={details.hostname} rows={rows} empty="" styles={styles} />
140
+ <View style={styles.host.meter}>
141
+ <Text style={styles.host.title}>Last 30 minutes</Text>
142
+ <Trend details={details} metric="ram" styles={styles} />
143
+ <Trend details={details} metric="cpu" styles={styles} />
144
+ </View>
145
+ <Section
146
+ title="Top processes by memory"
147
+ rows={apps}
148
+ empty="No process readings available."
149
+ styles={styles}
150
+ />
151
+ </>
152
+ );
153
+ }
154
+
155
+ export function LocalHostDetails({
156
+ machine,
157
+ workspaces,
158
+ styles,
159
+ }: {
160
+ machine: Machine;
161
+ workspaces: readonly OfficeWorkspace[];
162
+ styles: OfficeStyles;
163
+ }) {
164
+ const read = useRpc(hostDetailsRpc);
165
+ const [details, setDetails] = useState<HostDetails | null>(null);
166
+ const [error, setError] = useState("");
167
+ const [revision, setRevision] = useState(0);
168
+ const [loading, setLoading] = useState(true);
169
+ const refresh = useCallback(() => setRevision((n) => n + 1), []);
170
+ useEffect(() => {
171
+ let current = true;
172
+ setLoading(true);
173
+ setError("");
174
+ async function load() {
175
+ try {
176
+ const value = await read({});
177
+ if (current) setDetails(value);
178
+ } catch {
179
+ if (current) setError("Host details could not be read. Try refreshing.");
180
+ } finally {
181
+ if (current) setLoading(false);
182
+ }
183
+ }
184
+ void load();
185
+ return () => {
186
+ current = false;
187
+ };
188
+ }, [read, revision]);
189
+ const services = useMemo(() => {
190
+ const ports = machine.agents
191
+ .filter((a) => a.ports.length)
192
+ .map((a) => ({
193
+ id: "agent-" + a.agentId,
194
+ label: machineTitle(a),
195
+ value: a.ports.join(", "),
196
+ note: a.forgotten ? "Left running" : "Listening TCP ports",
197
+ }));
198
+ const scripts = workspaces.flatMap((w) =>
199
+ (w.scripts ?? [])
200
+ .filter((s) => s.running)
201
+ .map((s) => ({
202
+ id: JSON.stringify([w.id, s.kind, s.name]),
203
+ label: s.name,
204
+ value: s.port ? `Port ${s.port}` : "Running",
205
+ note: w.name,
206
+ })),
207
+ );
208
+ return [...scripts, ...ports];
209
+ }, [machine.agents, workspaces]);
210
+ const changed = useMemo(
211
+ () =>
212
+ workspaces
213
+ .filter((w) => w.changes && (w.changes.additions || w.changes.deletions))
214
+ .map((w) => ({
215
+ id: w.id,
216
+ label: w.name,
217
+ value: `+${w.changes!.additions} / −${w.changes!.deletions}`,
218
+ note: w.branch,
219
+ })),
220
+ [workspaces],
221
+ );
222
+ const caches = useMemo(
223
+ () => (details?.caches ?? []).map((c) => ({ label: c.name, value: formatBytes(c.bytes) })),
224
+ [details],
225
+ );
226
+ const asOf = details
227
+ ? `Details read at ${readAtText(new Date(details.readAt).toISOString())}`
228
+ : "Host details";
229
+ return (
230
+ <View style={styles.host.body}>
231
+ <View style={styles.host.groupHead}>
232
+ <Text style={styles.host.note}>{loading ? "Reading host details…" : asOf}</Text>
233
+ <ActionButton
234
+ label="Refresh"
235
+ pendingLabel="Refreshing…"
236
+ disabled={loading}
237
+ onPress={refresh}
238
+ styles={styles}
239
+ />
240
+ </View>
241
+ {error && (
242
+ <Text accessibilityRole="alert" style={styles.actionError}>
243
+ {error}
244
+ </Text>
245
+ )}
246
+ {details && <SystemReadings details={details} styles={styles} />}
247
+ <Section
248
+ title="Running services and listeners"
249
+ rows={services}
250
+ empty="No workspace services or agent listeners reported."
251
+ styles={styles}
252
+ />
253
+ <Section
254
+ title="Workspaces with changes"
255
+ rows={changed}
256
+ empty="No workspace changes reported."
257
+ styles={styles}
258
+ />
259
+ {details && (
260
+ <Section
261
+ title="Disk caches"
262
+ rows={caches}
263
+ empty="No readable npm or pip cache was measured."
264
+ styles={styles}
265
+ />
266
+ )}
267
+ </View>
268
+ );
269
+ }
@@ -0,0 +1,129 @@
1
+ import { StyleSheet } from "react-native";
2
+ import type { PluginTheme } from "@getpaseo/plugin";
3
+
4
+ /** The Host card uses the same type and surface colors as the Office rails. */
5
+ export function hostStyles(colors: PluginTheme["colors"], compact: boolean, touch: boolean) {
6
+ const actionWidth = touch ? 156 : 138;
7
+ const detailRow = { flexDirection: "row", alignItems: "center", gap: 12, padding: 12 } as const;
8
+ return StyleSheet.create({
9
+ body: { gap: 20 },
10
+ tabs: { flexDirection: "row", flexWrap: "wrap", alignItems: "center", gap: 4 },
11
+ remoteCard: {
12
+ gap: 9,
13
+ padding: compact ? 12 : 14,
14
+ borderWidth: 1,
15
+ borderColor: colors.border,
16
+ borderRadius: 12,
17
+ backgroundColor: colors.surface1,
18
+ },
19
+ remoteHeading: { flexDirection: "row", alignItems: "center", gap: 8 },
20
+ remoteName: { flex: 1, minWidth: 0, color: colors.foreground, fontSize: 14, fontWeight: "700" },
21
+ remoteMeter: { flexGrow: 1, flexBasis: 110, minWidth: 0, gap: 3 },
22
+ details: { borderTopWidth: 1, borderTopColor: colors.border, paddingTop: 9, gap: 4 },
23
+ detailsButton: {
24
+ alignSelf: "flex-end",
25
+ flexDirection: "row",
26
+ alignItems: "center",
27
+ gap: 3,
28
+ minHeight: touch ? 44 : 28,
29
+ paddingHorizontal: 6,
30
+ },
31
+ ok: { color: colors.foregroundMuted },
32
+ healthy: { color: colors.statusSuccess },
33
+ warning: { color: colors.statusWarning },
34
+ critical: { color: colors.statusDanger },
35
+ meters: { flexDirection: "row", flexWrap: "wrap", gap: 10 },
36
+ meter: {
37
+ flexGrow: 1,
38
+ flexBasis: 134,
39
+ minWidth: 0,
40
+ padding: compact ? 12 : 16,
41
+ gap: 10,
42
+ borderRadius: 12,
43
+ borderWidth: 1,
44
+ borderColor: colors.border,
45
+ backgroundColor: colors.surface1,
46
+ },
47
+ metricHead: { flexDirection: "row", alignItems: "center", gap: 7 },
48
+ label: { fontSize: 13, lineHeight: 18, fontWeight: "600", color: colors.foregroundMuted },
49
+ reading: {
50
+ flexGrow: 1,
51
+ flexDirection: "row",
52
+ flexWrap: "wrap",
53
+ alignContent: "flex-start",
54
+ alignItems: "baseline",
55
+ columnGap: 8,
56
+ rowGap: 0,
57
+ },
58
+ percent: {
59
+ fontSize: compact ? 27 : 32,
60
+ lineHeight: compact ? 33 : 38,
61
+ fontWeight: "700",
62
+ letterSpacing: -1,
63
+ color: colors.foreground,
64
+ fontVariant: ["tabular-nums"],
65
+ },
66
+ unit: { fontSize: 16, letterSpacing: 0, color: colors.foregroundMuted },
67
+ note: { fontSize: 12, lineHeight: 17, color: colors.foregroundMuted },
68
+ track: { height: 5, borderRadius: 3, overflow: "hidden", backgroundColor: colors.surface2 },
69
+ memoryFill: { backgroundColor: colors.accent },
70
+ group: { gap: 8 },
71
+ groupHead: {
72
+ flexDirection: "row",
73
+ alignItems: "baseline",
74
+ justifyContent: "space-between",
75
+ flexWrap: "wrap",
76
+ gap: 8,
77
+ },
78
+ title: { fontSize: 15, lineHeight: 20, fontWeight: "700", color: colors.foreground },
79
+ list: {
80
+ borderWidth: 1,
81
+ borderColor: colors.border,
82
+ borderRadius: 12,
83
+ backgroundColor: colors.surface1,
84
+ },
85
+ row: {
86
+ flexDirection: compact ? "column" : "row",
87
+ alignItems: compact ? "stretch" : "center",
88
+ paddingHorizontal: compact ? 12 : 14,
89
+ paddingVertical: compact ? 12 : 10,
90
+ gap: compact ? 8 : 14,
91
+ },
92
+ divider: { borderTopWidth: 1, borderTopColor: colors.border },
93
+ info: {
94
+ flexDirection: "row",
95
+ alignItems: "center",
96
+ gap: 10,
97
+ flexGrow: 1,
98
+ flexShrink: 1,
99
+ minWidth: 0,
100
+ },
101
+ identity: { flex: 1, minWidth: 0, gap: 2 },
102
+ status: { alignSelf: "flex-start", width: 7, height: 7, marginTop: 7, borderRadius: 4 },
103
+ name: { fontSize: 14, lineHeight: 20, fontWeight: "600", color: colors.foreground },
104
+ usage: { width: compact ? 64 : 78, alignItems: "flex-end", gap: 5 },
105
+ bytes: {
106
+ color: colors.foreground,
107
+ fontVariant: ["tabular-nums"],
108
+ fontSize: 14,
109
+ fontWeight: "600",
110
+ },
111
+ share: {
112
+ width: "100%",
113
+ height: 3,
114
+ borderRadius: 2,
115
+ overflow: "hidden",
116
+ backgroundColor: colors.surface2,
117
+ },
118
+ action: compact
119
+ ? { alignSelf: "flex-start", marginLeft: 17, maxWidth: "95%" }
120
+ : { width: actionWidth },
121
+ emptyAction: compact ? { display: "none" } : { width: actionWidth },
122
+ detailRow,
123
+ detailRowDivided: { ...detailRow, borderTopColor: colors.border, borderTopWidth: 1 },
124
+ historyPlot: { height: 32, flexDirection: "row", alignItems: "flex-end", gap: 2 },
125
+ historyBar: { flex: 1, borderRadius: 2, backgroundColor: colors.accent },
126
+ footer: { flexDirection: "row", alignItems: "center", gap: 6 },
127
+ empty: { padding: 14, fontSize: 13, color: colors.foregroundMuted },
128
+ });
129
+ }