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,9 @@
1
+ import { useOfficeBrand } from "./office-brand-context.js";
2
+ import { OfficeMark } from "./office-mark.js";
1
3
  import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
2
4
  import { Text, View } from "react-native";
3
5
  import { useSettings, type SettingsState } from "@getpaseo/plugin/client";
6
+ import { SettingsSections, settingsLayout } from "./settings-sections.js";
4
7
  import { SettingField } from "./setting-field.js";
5
8
  import { WeatherFields, type WeatherSetting } from "./weather-settings.js";
6
9
  import type { IncidentsState, WakeState } from "../shared/contracts.js";
@@ -10,6 +13,7 @@ import { wakeSummary } from "./board-text.js";
10
13
  import { FLOOR_PLAN_LABEL, FloorPlanRow } from "./floor-plan-row.js";
11
14
  import { LabeledSwitch } from "./labeled-switch.js";
12
15
  import { NOTES_DAYS_LABEL, NotesDays } from "./notes-days.js";
16
+ import { JiraConnection, SentryConnection } from "./tracker-connections.js";
13
17
  import type { OfficeStyles } from "./styles.js";
14
18
  import type { BoardActions } from "./use-board-actions.js";
15
19
 
@@ -17,6 +21,10 @@ type HostSettings = SettingsState<typeof officeHostSettings.schema>;
17
21
  export type HostValues = Extract<HostSettings, { status: "ready" }>["values"];
18
22
  /** A host setting, as its control is labelled. */
19
23
  type HostSetting =
24
+ | "Office name"
25
+ | "Logo URL"
26
+ | "Brand color"
27
+ | "Archive idle sessions"
20
28
  | "Agent tools"
21
29
  | "Notes folder"
22
30
  | "Time zone"
@@ -29,11 +37,13 @@ type HostSetting =
29
37
  | WeatherSetting;
30
38
 
31
39
  /** What the incidents fields need to know from the host: never a token's value. */
32
- type TrackerState = Pick<IncidentsState, "jiraReady" | "sentryReady" | "scheduleError">;
40
+ type TrackerState = Pick<
41
+ IncidentsState,
42
+ "jiraReady" | "sentryReady" | "scheduleError" | "connections"
43
+ >;
33
44
 
34
- const JIRA_UNSET =
35
- "ATLASSIAN_BASE_URL, ATLASSIAN_EMAIL or ATLASSIAN_API_TOKEN is not set on this host";
36
- const SENTRY_UNSET = "SENTRY_AUTH_TOKEN is not set on this host";
45
+ const JIRA_UNSET = "No Jira connection on this host: save one above";
46
+ const SENTRY_UNSET = "No Sentry token on this host: save one above";
37
47
 
38
48
  /** The line under a tracker's field: `missing` while the field is set, nothing while it is empty. */
39
49
  function unsetLine(value: string | null, missing: string | null): string | null {
@@ -70,6 +80,7 @@ export interface HostSwitchesProps {
70
80
  incidents: TrackerState | undefined;
71
81
  /** The device's own switch: last in the row, so on a phone it wraps to the line above the view. */
72
82
  weather?: import("../shared/contracts.js").WeatherState | undefined;
83
+ language?: ReactNode;
73
84
  children?: ReactNode;
74
85
  }
75
86
 
@@ -87,6 +98,7 @@ export function HostSwitches({
87
98
  scheduleError,
88
99
  incidents,
89
100
  weather,
101
+ language,
90
102
  children,
91
103
  }: HostSwitchesProps) {
92
104
  const settings = useSettings(officeHostSettings);
@@ -175,82 +187,113 @@ export function HostSwitches({
175
187
  wakeProblem,
176
188
  settings.status === "error" ? failureText("Read the office settings", settings.error) : null,
177
189
  saveProblem("Agent tools"),
178
- deviceProblem,
179
190
  ].filter((problem): problem is string => problem !== null);
180
191
  return (
181
- <>
182
- <View style={styles.headerControls}>
183
- <LabeledSwitch
184
- label="Wake agents"
185
- note={summary}
186
- value={wantedWakes ?? wakesOn}
187
- onChange={toggleWakes}
188
- styles={styles}
189
- />
190
- <LabeledSwitch
191
- label="Agent tools"
192
- value={wantedTools ?? stored?.agentTools ?? null}
193
- onChange={toggleTools}
194
- styles={styles}
195
- />
196
- {children}
197
- </View>
198
- <View style={styles.headerFields}>
199
- <FloorPlanRow
200
- value={storedPlan(stored)}
201
- onSave={savePlan}
202
- problem={saveProblem(FLOOR_PLAN_LABEL)}
203
- styles={styles}
204
- />
205
- </View>
206
- <View style={styles.headerFields}>
207
- <SettingField
208
- label="Notes folder"
209
- hint="Where the stand-up notes are written. Empty turns them off."
210
- value={stored?.notesFolder ?? null}
211
- onSave={saveFolder}
212
- problem={saveProblem("Notes folder")}
213
- styles={styles}
214
- />
215
- <SettingField
216
- label="Time zone"
217
- hint="For the 8:00 run. Empty uses this host's."
218
- value={stored?.notesTimeZone ?? null}
219
- onSave={saveTimeZone}
220
- problem={timeZoneProblem}
221
- styles={styles}
222
- />
223
- <NotesDays
224
- value={stored?.notesDays ?? null}
225
- onSave={saveDays}
226
- problem={saveProblem(NOTES_DAYS_LABEL)}
227
- styles={styles}
228
- />
229
- </View>
230
- <TrackerFields
231
- values={stored}
232
- incidents={incidents}
233
- change={change}
234
- saveProblem={saveProblem}
235
- styles={styles}
236
- />
237
- <WeatherFields
238
- values={stored}
239
- weather={weather}
240
- change={change}
241
- saveProblem={saveProblem}
242
- styles={styles}
243
- />
244
- {problems.length > 0 ? (
245
- <View style={styles.headerProblems}>
246
- {problems.map((problem) => (
247
- <Text key={problem} accessibilityRole="alert" style={styles.actionError}>
248
- {problem}
192
+ <SettingsSections
193
+ styles={styles}
194
+ appearance={
195
+ <>
196
+ {children}
197
+ <BrandFields values={stored} change={change} saveProblem={saveProblem} styles={styles} />
198
+ <View style={styles.headerFields}>
199
+ <FloorPlanRow
200
+ value={storedPlan(stored)}
201
+ onSave={savePlan}
202
+ problem={saveProblem(FLOOR_PLAN_LABEL)}
203
+ styles={styles}
204
+ />
205
+ </View>
206
+ <View style={styles.headerFields}>{language}</View>
207
+ {deviceProblem && (
208
+ <Text accessibilityRole="alert" style={styles.actionError}>
209
+ {deviceProblem}
249
210
  </Text>
250
- ))}
251
- </View>
252
- ) : null}
253
- </>
211
+ )}
212
+ </>
213
+ }
214
+ automation={
215
+ <>
216
+ <View style={settingsLayout.block}>
217
+ <Text style={styles.sheetLabel}>Agents</Text>
218
+ <View style={settingsLayout.strip}>
219
+ <LabeledSwitch
220
+ label="Wake agents"
221
+ note={summary}
222
+ value={wantedWakes ?? wakesOn}
223
+ onChange={toggleWakes}
224
+ styles={styles}
225
+ />
226
+ <LabeledSwitch
227
+ label="Agent tools"
228
+ value={wantedTools ?? stored?.agentTools ?? null}
229
+ onChange={toggleTools}
230
+ styles={styles}
231
+ />
232
+ </View>
233
+ </View>
234
+ <ArchiveSetting
235
+ values={stored}
236
+ change={change}
237
+ saveProblem={saveProblem}
238
+ styles={styles}
239
+ />
240
+ <Text style={styles.sheetLabel}>Stand-up schedule</Text>
241
+ <View style={styles.headerFields}>
242
+ <SettingField
243
+ label="Notes folder"
244
+ hint="Where the stand-up notes are written. Empty turns them off."
245
+ value={stored?.notesFolder ?? null}
246
+ onSave={saveFolder}
247
+ problem={saveProblem("Notes folder")}
248
+ styles={styles}
249
+ />
250
+ <SettingField
251
+ label="Time zone"
252
+ hint="For the 8:00 run. Empty uses this host's."
253
+ value={stored?.notesTimeZone ?? null}
254
+ onSave={saveTimeZone}
255
+ problem={timeZoneProblem}
256
+ styles={styles}
257
+ />
258
+ <NotesDays
259
+ value={stored?.notesDays ?? null}
260
+ onSave={saveDays}
261
+ problem={saveProblem(NOTES_DAYS_LABEL)}
262
+ styles={styles}
263
+ />
264
+ </View>
265
+ {problems.length > 0 ? (
266
+ <View style={styles.headerProblems}>
267
+ {problems.map((problem) => (
268
+ <Text key={problem} accessibilityRole="alert" style={styles.actionError}>
269
+ {problem}
270
+ </Text>
271
+ ))}
272
+ </View>
273
+ ) : null}
274
+ </>
275
+ }
276
+ services={
277
+ <>
278
+ <Text style={styles.sheetLabel}>Issue trackers</Text>
279
+ <TrackerFields
280
+ values={stored}
281
+ incidents={incidents}
282
+ change={change}
283
+ saveProblem={saveProblem}
284
+ styles={styles}
285
+ />
286
+ <Text style={styles.sheetLabel}>Weather service</Text>
287
+ <WeatherFields
288
+ values={stored}
289
+ weather={weather}
290
+ change={change}
291
+ saveProblem={saveProblem}
292
+ styles={styles}
293
+ />
294
+ </>
295
+ }
296
+ />
254
297
  );
255
298
  }
256
299
 
@@ -273,7 +316,7 @@ interface TrackerFieldsProps {
273
316
 
274
317
  /**
275
318
  * The trackers the incidents check reads, and its schedule's failure under them. A field set
276
- * while the host lacks the tracker's variables names them; the token itself never reaches here.
319
+ * while the host has no sign-in for the tracker says so; the token itself never comes back here.
277
320
  */
278
321
  function TrackerFields({ values, incidents, change, saveProblem, styles }: TrackerFieldsProps) {
279
322
  const saveJiraProjects = useCallback(
@@ -301,7 +344,7 @@ function TrackerFields({ values, incidents, change, saveProblem, styles }: Track
301
344
  // Not known until the host has said: no line before then.
302
345
  const jiraMissing = incidents?.jiraReady === false ? JIRA_UNSET : null;
303
346
  const sentryMissing = incidents?.sentryReady === false ? SENTRY_UNSET : null;
304
- // A refused save comes first; while the host refuses nothing, the variables it lacks.
347
+ // A refused save comes first; while the host refuses nothing, the sign-in it lacks.
305
348
  const jiraProblem = saveProblem("Jira projects") ?? unsetLine(jiraProjects, jiraMissing);
306
349
  const sentryOrgProblem =
307
350
  saveProblem("Sentry organisation") ?? unsetLine(sentryOrg, sentryMissing);
@@ -312,17 +355,19 @@ function TrackerFields({ values, incidents, change, saveProblem, styles }: Track
312
355
  return (
313
356
  <>
314
357
  <View style={styles.headerFields}>
358
+ <JiraConnection connection={incidents?.connections?.jira} styles={styles} />
315
359
  <SettingField
316
360
  label="Jira projects"
317
- hint="Project keys, comma separated. Needs ATLASSIAN_BASE_URL, ATLASSIAN_EMAIL and ATLASSIAN_API_TOKEN on the host."
361
+ hint="Project keys, comma separated. New bugs in them ring the incident alarm."
318
362
  value={jiraProjects}
319
363
  onSave={saveJiraProjects}
320
364
  problem={jiraProblem}
321
365
  styles={styles}
322
366
  />
367
+ <SentryConnection connection={incidents?.connections?.sentry} styles={styles} />
323
368
  <SettingField
324
369
  label="Sentry organisation"
325
- hint="The organisation's slug. Needs SENTRY_AUTH_TOKEN on the host."
370
+ hint="The organisation's slug."
326
371
  value={sentryOrg}
327
372
  onSave={saveSentryOrg}
328
373
  problem={sentryOrgProblem}
@@ -330,7 +375,7 @@ function TrackerFields({ values, incidents, change, saveProblem, styles }: Track
330
375
  />
331
376
  <SettingField
332
377
  label="Sentry projects"
333
- hint="Project slugs, comma separated. Needs SENTRY_AUTH_TOKEN on the host."
378
+ hint="Project slugs, comma separated."
334
379
  value={sentryProjects}
335
380
  onSave={saveSentryProjects}
336
381
  problem={sentryProjectsProblem}
@@ -338,7 +383,7 @@ function TrackerFields({ values, incidents, change, saveProblem, styles }: Track
338
383
  />
339
384
  <SettingField
340
385
  label="Sentry address"
341
- hint="Where SENTRY_AUTH_TOKEN is sent. https, or http on the host itself."
386
+ hint="Where the Sentry token is sent. https, or http on the host itself."
342
387
  value={sentryUrl}
343
388
  onSave={saveSentryUrl}
344
389
  problem={sentryUrlProblem}
@@ -355,3 +400,87 @@ function TrackerFields({ values, incidents, change, saveProblem, styles }: Track
355
400
  </>
356
401
  );
357
402
  }
403
+
404
+ function ArchiveSetting({
405
+ values: stored,
406
+ change,
407
+ saveProblem,
408
+ styles,
409
+ }: Omit<TrackerFieldsProps, "incidents">) {
410
+ const toggle = useCallback(
411
+ (next: boolean) => void change("Archive idle sessions", { archiveOnDeparture: next }),
412
+ [change],
413
+ );
414
+ const problem = saveProblem("Archive idle sessions");
415
+ return (
416
+ <View style={settingsLayout.block}>
417
+ {stored && (
418
+ <LabeledSwitch
419
+ label="Archive idle sessions"
420
+ value={stored.archiveOnDeparture}
421
+ onChange={toggle}
422
+ styles={styles}
423
+ />
424
+ )}
425
+ <Text style={styles.fieldHint}>
426
+ Off by default. When a worker goes home for the night or after evening drinks, an open 3D
427
+ floor can archive its idle session on this host. Sessions awaiting approval or a working
428
+ subagent stay active. Archived sessions leave the active list and keep their history.
429
+ </Text>
430
+ {problem && (
431
+ <Text accessibilityRole="alert" style={styles.actionError}>
432
+ {problem}
433
+ </Text>
434
+ )}
435
+ </View>
436
+ );
437
+ }
438
+
439
+ function BrandFields({
440
+ values: stored,
441
+ change,
442
+ saveProblem,
443
+ styles,
444
+ }: Omit<TrackerFieldsProps, "incidents">) {
445
+ const brand = useOfficeBrand();
446
+ const saveName = useCallback((v: string) => change("Office name", { brandName: v }), [change]);
447
+ const saveLogo = useCallback((v: string) => change("Logo URL", { brandLogoUrl: v }), [change]);
448
+ const saveColor = useCallback((v: string) => change("Brand color", { brandColor: v }), [change]);
449
+ return (
450
+ <View style={settingsLayout.block}>
451
+ <Text style={styles.sheetLabel}>Branding</Text>
452
+ <View style={settingsLayout.strip}>
453
+ <OfficeMark brand={brand} fallbackColor={styles.brandIcon.color} />
454
+ <Text numberOfLines={1} style={styles.brandText}>
455
+ {brand.name ?? "Office 3D"}
456
+ </Text>
457
+ </View>
458
+ <View style={styles.headerFields}>
459
+ <SettingField
460
+ label="Office name"
461
+ value={stored ? (stored.brandName ?? "") : null}
462
+ hint="Display name. Leave blank to use the host default."
463
+ onSave={saveName}
464
+ problem={saveProblem("Office name")}
465
+ styles={styles}
466
+ />
467
+ <SettingField
468
+ label="Brand color"
469
+ value={stored ? (stored.brandColor ?? "") : null}
470
+ hint="Hex color for the office mark, such as #e8865f."
471
+ onSave={saveColor}
472
+ problem={saveProblem("Brand color")}
473
+ styles={styles}
474
+ />
475
+ <SettingField
476
+ label="Logo URL"
477
+ value={stored ? (stored.brandLogoUrl ?? "") : null}
478
+ hint="HTTPS image URL. Allow cross-origin images for the 3D sign."
479
+ onSave={saveLogo}
480
+ problem={saveProblem("Logo URL")}
481
+ styles={styles}
482
+ />
483
+ </View>
484
+ </View>
485
+ );
486
+ }
@@ -1,6 +1,7 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { Text, View } from "react-native";
3
- import { ExternalLink, Modal } from "@getpaseo/plugin/client/ui";
3
+ import { ExternalLink } from "@getpaseo/plugin/client/ui";
4
+ import { OfficeModal as Modal } from "./office-modal.js";
4
5
  import type { IncidentsState } from "../shared/contracts.js";
5
6
  import { ActionButton, failureText } from "./action-button.js";
6
7
  import { incidentProblems, incidentRows, type IncidentRow } from "./incidents-text.js";
@@ -1,6 +1,6 @@
1
1
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
2
2
  import { Text, View, type ViewStyle } from "react-native";
3
- import { Modal } from "@getpaseo/plugin/client/ui";
3
+ import { OfficeModal as Modal } from "./office-modal.js";
4
4
  import { ActionButton, failureText } from "./action-button.js";
5
5
  import { contextTone, inShownOrder, janitorRowLabel, type JanitorRow } from "./context-text.js";
6
6
  import type { OfficeStyles } from "./styles.js";
@@ -1,6 +1,7 @@
1
1
  import { Fragment, useCallback, useEffect, useRef, useState } from "react";
2
2
  import { Text, View } from "react-native";
3
- import { Modal, ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
3
+ import { ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
4
+ import { OfficeModal as Modal } from "./office-modal.js";
4
5
  import type { SkillInfo, SkillsResult } from "../shared/contracts.js";
5
6
  import { ActionButton, failureText } from "./action-button.js";
6
7
  import { textAfterSend } from "./agent-card.js";
@@ -136,22 +136,24 @@ function clockText(promptedAt: string | undefined, now: number): string | null {
136
136
  }
137
137
 
138
138
  /** How long ago a resting agent's last change was: "now", "5m ago", "2h ago", "3d ago". */
139
- function agoText(idleSince: string | undefined, now: number): string | null {
139
+ function agoText(idleSince: string | undefined, now: number, waiting = false): string | null {
140
140
  const since = idleSince === undefined ? Number.NaN : Date.parse(idleSince);
141
141
  if (!Number.isFinite(since)) return null;
142
142
  const ms = Math.max(0, now - since);
143
- if (ms < MINUTE) return "now";
144
- if (ms < HOUR) return `${Math.floor(ms / MINUTE)}m ago`;
145
- if (ms < DAY) return `${Math.floor(ms / HOUR)}h ago`;
146
- return `${Math.floor(ms / DAY)}d ago`;
143
+ if (ms < MINUTE) return waiting ? "Waiting <1m" : "now";
144
+ let duration = `${Math.floor(ms / DAY)}d`;
145
+ if (ms < HOUR) duration = `${Math.floor(ms / MINUTE)}m`;
146
+ else if (ms < DAY) duration = `${Math.floor(ms / HOUR)}h`;
147
+ return waiting ? `Waiting ${duration}` : `${duration} ago`;
147
148
  }
148
149
 
149
150
  /**
150
151
  * The row's time: the turn's clock while it runs, how long it has rested while it is idle. An
151
- * agent that needs you, is starting or has stopped on an error shows none.
152
+ * agent with a permission request uses its attention timestamp when the host provides one.
152
153
  */
153
154
  export function timeText(row: OfficeRow, now: number): string | null {
154
155
  const { agent } = row;
156
+ if (agent.permissions.length) return agoText(agent.permissionSince, now, true);
155
157
  if (attentionReason(agent) !== null) return null;
156
158
  if (agent.status === "running") return clockText(agent.promptedAt, now);
157
159
  if (agent.status === "idle") return agoText(agent.idleSince, now);
@@ -92,39 +92,48 @@ function TodoRow({ post, name, actions, styles }: TodoRowProps) {
92
92
  const keep = useCallback(() => setAsking(false), []);
93
93
  const remove = useCallback(() => actions.remove(post.id), [actions, post.id]);
94
94
  return (
95
- <View style={styles.boardPost}>
96
- <Pressable
97
- id={id}
98
- accessibilityRole="checkbox"
99
- accessibilityLabel={meta === null ? post.text : `${post.text}, ${meta}`}
100
- aria-checked={done}
101
- disabled={pending}
102
- onPress={toggle}
103
- style={pending ? styles.todoRowDisabled : styles.todoRow}
104
- >
105
- <Icon name={done ? "SquareCheck" : "Square"} size={20} color={styles.iconColor} />
106
- <View style={styles.rowBody}>
107
- <Text style={done ? styles.todoTextDone : styles.postText}>{post.text}</Text>
108
- {meta === null ? null : <Text style={styles.postMeta}>{meta}</Text>}
109
- </View>
110
- </Pressable>
95
+ <View style={styles.lobbyTask}>
96
+ <View style={styles.lobbyTaskLine}>
97
+ <Pressable
98
+ id={id}
99
+ accessibilityRole="checkbox"
100
+ accessibilityLabel={meta === null ? post.text : `${post.text}, ${meta}`}
101
+ aria-checked={done}
102
+ disabled={pending}
103
+ onPress={toggle}
104
+ style={pending ? styles.todoRowDisabled : styles.todoRow}
105
+ >
106
+ <Icon name={done ? "SquareCheck" : "Square"} size={20} color={styles.iconColor} />
107
+ <View style={styles.rowBody}>
108
+ <Text style={done ? styles.todoTextDone : styles.postText}>{post.text}</Text>
109
+ {meta === null ? null : <Text style={styles.postMeta}>{meta}</Text>}
110
+ </View>
111
+ </Pressable>
112
+ <Pressable
113
+ accessibilityRole="button"
114
+ accessibilityLabel={`Delete task: ${post.text}`}
115
+ aria-expanded={asking}
116
+ onPress={ask}
117
+ style={styles.lobbyDelete}
118
+ >
119
+ <Icon name="Trash2" size={16} color={styles.iconColor} />
120
+ </Pressable>
121
+ </View>
111
122
  {failure === null ? null : (
112
123
  <Text accessibilityRole="alert" style={styles.actionError}>
113
124
  {failure}
114
125
  </Text>
115
126
  )}
116
127
  {asking ? (
117
- <DeleteQuestion
118
- question="Delete this post?"
119
- onDelete={remove}
120
- onKeep={keep}
121
- styles={styles}
122
- />
123
- ) : (
124
- <View style={styles.actions}>
125
- <ActionButton label="Delete" pendingLabel="Deleting..." onPress={ask} styles={styles} />
128
+ <View style={styles.lobbyConfirm}>
129
+ <DeleteQuestion
130
+ question="Delete this post?"
131
+ onDelete={remove}
132
+ onKeep={keep}
133
+ styles={styles}
134
+ />
126
135
  </View>
127
- )}
136
+ ) : null}
128
137
  </View>
129
138
  );
130
139
  }
@@ -153,7 +162,9 @@ function TodoHeading({ board, done, actions, styles }: TodoHeadingProps) {
153
162
  if (asking && done === 0) setAsking(false);
154
163
  return (
155
164
  <View style={styles.boardTitleRow}>
156
- <Text style={styles.sheetLabel}>To-do</Text>
165
+ <Text accessibilityRole="header" style={styles.lobbyHeading}>
166
+ To-do
167
+ </Text>
157
168
  {asking ? (
158
169
  <View style={styles.sheetActions}>
159
170
  <DeleteQuestion
@@ -164,13 +175,15 @@ function TodoHeading({ board, done, actions, styles }: TodoHeadingProps) {
164
175
  />
165
176
  </View>
166
177
  ) : (
167
- <ActionButton
168
- label="Clear finished"
169
- pendingLabel="Clearing..."
178
+ <Pressable
179
+ accessibilityRole="button"
180
+ accessibilityLabel="Clear finished"
170
181
  onPress={ask}
171
182
  disabled={done === 0}
172
- styles={styles}
173
- />
183
+ style={styles.lobbyDelete}
184
+ >
185
+ <Text style={styles.lobbyDeleteText}>Clear finished</Text>
186
+ </Pressable>
174
187
  )}
175
188
  </View>
176
189
  );
@@ -204,13 +217,15 @@ interface TaskGroupProps {
204
217
  function TaskGroup({ group, name, styles }: TaskGroupProps) {
205
218
  const lines = useMemo(() => stepLines(group.steps), [group.steps]);
206
219
  return (
207
- <View style={styles.post}>
208
- <Text style={styles.postMeta}>{name(group.agentId)}</Text>
209
- {lines.map((line) => (
210
- <Text key={line.key} style={styles.postText} numberOfLines={1}>
211
- {line.text}
212
- </Text>
213
- ))}
220
+ <View style={styles.lobbyTask}>
221
+ <View style={styles.post}>
222
+ <Text style={styles.rowTitle}>{name(group.agentId)}</Text>
223
+ {lines.map((line) => (
224
+ <Text key={line.key} style={styles.postText}>
225
+ {line.text}
226
+ </Text>
227
+ ))}
228
+ </View>
214
229
  </View>
215
230
  );
216
231
  }
@@ -281,7 +296,7 @@ export function LobbyBody({
281
296
  }
282
297
  return (
283
298
  <View style={styles.sheet}>
284
- <View style={styles.sheetField}>
299
+ <View style={styles.lobbyForm}>
285
300
  <View style={styles.boardTitleRow}>
286
301
  <View style={styles.rowBody}>
287
302
  <TextInput
@@ -313,16 +328,17 @@ export function LobbyBody({
313
328
  {failure}
314
329
  </Text>
315
330
  )}
331
+ <WakeField
332
+ id={fieldId}
333
+ roomId={room.id}
334
+ to={to}
335
+ rooms={rooms}
336
+ wakesPaused={wakesPaused}
337
+ onOpen={open}
338
+ styles={styles}
339
+ />
316
340
  </View>
317
- <WakeField
318
- id={fieldId}
319
- to={to}
320
- rooms={rooms}
321
- wakesPaused={wakesPaused}
322
- onOpen={open}
323
- styles={styles}
324
- />
325
- <View style={styles.boardPosts}>
341
+ <View style={styles.lobbySection}>
326
342
  <TodoHeading board={room.id} done={done} actions={actions} styles={styles} />
327
343
  {room.todos.length === 0 ? <Text style={styles.muted}>No to-dos</Text> : null}
328
344
  {room.todos.map((post) => (
@@ -330,8 +346,10 @@ export function LobbyBody({
330
346
  ))}
331
347
  </View>
332
348
  {notes.length > 0 ? (
333
- <View style={styles.boardPosts}>
334
- <Text style={styles.sheetLabel}>Notes</Text>
349
+ <View style={styles.lobbySection}>
350
+ <Text accessibilityRole="header" style={styles.lobbyHeading}>
351
+ Notes
352
+ </Text>
335
353
  {notes.map((post) => (
336
354
  <PostWithActions
337
355
  key={post.id}
@@ -343,8 +361,10 @@ export function LobbyBody({
343
361
  ))}
344
362
  </View>
345
363
  ) : null}
346
- <View style={styles.boardPosts}>
347
- <Text style={styles.sheetLabel}>Agent tasks</Text>
364
+ <View style={styles.lobbySection}>
365
+ <Text accessibilityRole="header" style={styles.lobbyHeading}>
366
+ Agent tasks
367
+ </Text>
348
368
  {agentTasks.length === 0 ? <Text style={styles.muted}>No agent tasks</Text> : null}
349
369
  {agentTasks.map((group) => (
350
370
  <TaskGroup key={group.agentId} group={group} name={name} styles={styles} />