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
@@ -30,7 +30,7 @@ export interface SessionContext extends SessionPaneContext {
30
30
  /** What a pane takes from the surface, the same for every session; never the office model. */
31
31
  export interface SessionPaneContext {
32
32
  actions: AgentActions;
33
- navigation: PluginSurfaceProps["navigation"];
33
+ showWorkspace?(agentId: string): void;
34
34
  closeSession(agentId: string): void;
35
35
  }
36
36
 
@@ -46,8 +46,16 @@ export function sessionOf(
46
46
  };
47
47
  }
48
48
 
49
+ export function sessionChildren(model: OfficeModel, agentId: string): OfficeAgent[] {
50
+ return [...model.agents.values()].filter((agent) => agent.parentAgentId === agentId);
51
+ }
52
+
49
53
  export interface SessionPaneProps {
50
54
  agentId: string;
55
+ hideClose?: boolean;
56
+ inSheet?: boolean;
57
+ subagents?: readonly OfficeAgent[];
58
+ onOpenSubagent?(id: string): void;
51
59
  /** The agent as the office lists it; null when it does not. */
52
60
  agent: OfficeAgent | null;
53
61
  room: string | null;
@@ -67,11 +75,15 @@ function samePane(before: SessionPaneProps, after: SessionPaneProps): boolean {
67
75
  return (
68
76
  before.agentId === after.agentId &&
69
77
  before.room === after.room &&
78
+ before.inSheet === after.inSheet &&
79
+ before.hideClose === after.hideClose &&
70
80
  before.reply === after.reply &&
71
81
  before.setReply === after.setReply &&
72
82
  before.context.actions === after.context.actions &&
73
- before.context.navigation === after.context.navigation &&
83
+ before.context.showWorkspace === after.context.showWorkspace &&
74
84
  before.context.closeSession === after.context.closeSession &&
85
+ before.onOpenSubagent === after.onOpenSubagent &&
86
+ JSON.stringify(before.subagents) === JSON.stringify(after.subagents) &&
75
87
  before.styles === after.styles &&
76
88
  before.layout === after.layout &&
77
89
  JSON.stringify(before.agent) === JSON.stringify(after.agent)
@@ -81,6 +93,10 @@ function samePane(before: SessionPaneProps, after: SessionPaneProps): boolean {
81
93
  /** One open session as the column or the sheet shows it. */
82
94
  export const SessionPane = memo(function SessionPane({
83
95
  agentId,
96
+ hideClose,
97
+ inSheet,
98
+ subagents,
99
+ onOpenSubagent,
84
100
  agent,
85
101
  room,
86
102
  reply,
@@ -89,14 +105,14 @@ export const SessionPane = memo(function SessionPane({
89
105
  styles,
90
106
  layout,
91
107
  }: SessionPaneProps) {
92
- const { actions, navigation, closeSession } = context;
108
+ const { actions, showWorkspace, closeSession } = context;
93
109
  const draft = useMemo(
94
110
  () => ({ text: reply, setText: (next: SetStateAction<string>) => setReply(agentId, next) }),
95
111
  [reply, setReply, agentId],
96
112
  );
97
113
  const onOpenWorkspace = useMemo(
98
- () => (navigation ? () => navigation.openAgent({ agentId }) : undefined),
99
- [navigation, agentId],
114
+ () => (showWorkspace ? () => showWorkspace(agentId) : undefined),
115
+ [showWorkspace, agentId],
100
116
  );
101
117
  const onClose = useCallback(() => closeSession(agentId), [closeSession, agentId]);
102
118
  return (
@@ -105,11 +121,15 @@ export const SessionPane = memo(function SessionPane({
105
121
  agent={agent}
106
122
  agentId={agentId}
107
123
  room={room}
124
+ subagents={subagents}
125
+ onOpenSubagent={onOpenSubagent}
108
126
  draft={draft}
109
127
  actions={actions}
110
128
  styles={styles}
111
129
  layout={layout}
112
130
  onOpenWorkspace={onOpenWorkspace}
131
+ hideClose={hideClose}
132
+ inSheet={inSheet}
113
133
  onClose={onClose}
114
134
  />
115
135
  );
@@ -0,0 +1,238 @@
1
+ import { AVATARS, shirtColor } from "../shared/appearance.js";
2
+ import { useCallback, useMemo } from "react";
3
+ import { Pressable, Text, View, type PressableStateCallbackType } from "react-native";
4
+ import { Icon } from "@getpaseo/plugin/client/ui";
5
+ import type { OfficeAgent } from "../shared/contracts.js";
6
+ import { agentTask, agentTitle, dotTone } from "../shared/model.js";
7
+ import { stateLabel } from "./agent-card.js";
8
+ import { contextLine, contextPercent } from "./context-text.js";
9
+ import { costText } from "./list-text.js";
10
+ import { avatarInitials } from "./sessions-text.js";
11
+ import { statusLine } from "./session-text.js";
12
+ import type { OfficeStyles } from "./styles.js";
13
+
14
+ export function SessionHeading({
15
+ agent,
16
+ room,
17
+ styles,
18
+ }: {
19
+ agent: OfficeAgent;
20
+ room: string | null;
21
+ styles: OfficeStyles;
22
+ }) {
23
+ const name = agentTitle(agent);
24
+ const borderColor = shirtColor(agent.appearance);
25
+ const avatarStyle = useMemo(
26
+ () => [styles.sessions.identityAvatar, borderColor && { borderColor, borderWidth: 2 }],
27
+ [styles.sessions.identityAvatar, borderColor],
28
+ );
29
+ return (
30
+ <View style={styles.sessions.identityLead}>
31
+ <View style={avatarStyle} aria-hidden>
32
+ <Text style={styles.sessions.initials}>
33
+ {agent.appearance?.avatar ? AVATARS[agent.appearance.avatar] : avatarInitials(name)}
34
+ </Text>
35
+ <View style={styles.sessions.badge}>
36
+ <View style={styles.dot[dotTone(agent)]} />
37
+ </View>
38
+ </View>
39
+ <View style={styles.sessions.identityText}>
40
+ <Text accessibilityRole="header" style={styles.sessions.identityName} numberOfLines={2}>
41
+ {name}
42
+ </Text>
43
+ <Text numberOfLines={2} style={styles.chatMeta}>
44
+ {statusLine(agent, room)}
45
+ </Text>
46
+ </View>
47
+ </View>
48
+ );
49
+ }
50
+
51
+ export function SessionMetadata({ agent, styles }: { agent: OfficeAgent; styles: OfficeStyles }) {
52
+ const context = contextPercent(agent);
53
+ const cost = agent.costUsd === 0 ? "$0.00" : costText(agent.costUsd);
54
+ const fill = useMemo(
55
+ () => [styles.sessions.contextGauge, { width: `${context ?? 0}%` as const }],
56
+ [context, styles],
57
+ );
58
+ return (
59
+ <View style={styles.sessions.metadata}>
60
+ <View style={styles.sessions.metaChip}>
61
+ <Text style={styles.sessions.caption}>{agent.model ? "Model" : "Provider"}</Text>
62
+ <Text style={styles.sessions.metaValue} numberOfLines={2} selectable>
63
+ {agent.model || agent.provider}
64
+ </Text>
65
+ </View>
66
+ {context !== null && (
67
+ <View
68
+ style={styles.sessions.metaChip}
69
+ accessible
70
+ accessibilityLabel={contextLine(agent) ?? undefined}
71
+ >
72
+ <Text style={styles.sessions.caption}>Context</Text>
73
+ <View style={styles.sessions.contextTrack} aria-hidden>
74
+ <View style={fill} />
75
+ </View>
76
+ <Text style={styles.sessions.metaValue}>{context}%</Text>
77
+ </View>
78
+ )}
79
+ {cost !== null && (
80
+ <View style={styles.sessions.metaChip}>
81
+ <Text style={styles.sessions.caption}>Cost</Text>
82
+ <Text style={styles.sessions.metaValue}>{cost}</Text>
83
+ </View>
84
+ )}
85
+ </View>
86
+ );
87
+ }
88
+
89
+ export function SessionButton({
90
+ icon,
91
+ label,
92
+ onPress,
93
+ styles,
94
+ primary = false,
95
+ caption,
96
+ expanded,
97
+ disabled = false,
98
+ }: {
99
+ icon: string;
100
+ label: string;
101
+ onPress(): void;
102
+ styles: OfficeStyles;
103
+ primary?: boolean;
104
+ caption?: "plain" | "button";
105
+ expanded?: boolean;
106
+ disabled?: boolean;
107
+ }) {
108
+ const buttonStyle = useCallback(
109
+ ({ pressed }: PressableStateCallbackType) => {
110
+ const palette = styles.sessions;
111
+ if (caption === "button") return pressed ? palette.workspacePressed : palette.workspaceButton;
112
+ if (caption) return palette.deskLink;
113
+ if (!primary) return pressed ? palette.deskActionPressed : palette.deskAction;
114
+ if (disabled) return palette.sendDisabled;
115
+ return pressed ? palette.sendPressed : palette.send;
116
+ },
117
+ [primary, disabled, caption, styles],
118
+ );
119
+ const color = primary && !disabled ? String(styles.buttonPrimaryText.color) : styles.iconColor;
120
+ return (
121
+ <Pressable
122
+ accessibilityRole="button"
123
+ accessibilityLabel={label}
124
+ aria-expanded={expanded}
125
+ disabled={disabled}
126
+ onPress={onPress}
127
+ style={buttonStyle}
128
+ >
129
+ <Icon name={icon} size={caption ? 15 : 18} color={color} />
130
+ {caption && <Text style={styles.sessions.deskLinkLabel}>{label}</Text>}
131
+ </Pressable>
132
+ );
133
+ }
134
+
135
+ export type SessionDetailTab = "chat" | "steps" | "subagents";
136
+ const detailTabs = [
137
+ { id: "chat", label: "Chat", icon: "MessageCircle" },
138
+ { id: "steps", label: "Steps", icon: "ListChecks" },
139
+ { id: "subagents", label: "Subagents", icon: "UsersRound" },
140
+ ] as const;
141
+
142
+ export function SessionDetailTabs({
143
+ tab,
144
+ setTab,
145
+ childCount,
146
+ styles,
147
+ }: {
148
+ tab: SessionDetailTab;
149
+ setTab(tab: SessionDetailTab): void;
150
+ childCount?: number;
151
+ styles: OfficeStyles;
152
+ }) {
153
+ return (
154
+ <View style={styles.sessions.detailTabs} role="group" aria-label="Session details">
155
+ {detailTabs.map((item) =>
156
+ item.id === "subagents" && childCount === undefined ? null : (
157
+ <DetailTab
158
+ key={item.id}
159
+ item={item}
160
+ selected={tab === item.id}
161
+ onSelect={setTab}
162
+ count={item.id === "subagents" ? childCount : undefined}
163
+ styles={styles}
164
+ />
165
+ ),
166
+ )}
167
+ </View>
168
+ );
169
+ }
170
+
171
+ function DetailTab({
172
+ item,
173
+ selected,
174
+ onSelect,
175
+ count,
176
+ styles,
177
+ }: {
178
+ item: (typeof detailTabs)[number];
179
+ selected: boolean;
180
+ onSelect(tab: SessionDetailTab): void;
181
+ count?: number;
182
+ styles: OfficeStyles;
183
+ }) {
184
+ const press = useCallback(() => onSelect(item.id), [item.id, onSelect]);
185
+ const tabStyle = useMemo(
186
+ () => [styles.sessions.detailTab, selected && styles.sessions.detailTabActive],
187
+ [styles, selected],
188
+ );
189
+ const label = selected ? styles.sessions.detailLabelActive : styles.sessions.detailLabel;
190
+ return (
191
+ <Pressable
192
+ accessibilityRole="button"
193
+ accessibilityLabel={`Session ${item.id}`}
194
+ aria-pressed={selected}
195
+ onPress={press}
196
+ style={tabStyle}
197
+ >
198
+ <Icon name={item.icon} size={14} color={String(label.color)} />
199
+ <Text numberOfLines={1} style={label}>
200
+ {item.label}
201
+ {count ? ` · ${count}` : ""}
202
+ </Text>
203
+ </Pressable>
204
+ );
205
+ }
206
+
207
+ export function SubagentRow({
208
+ agent,
209
+ onOpen,
210
+ styles,
211
+ }: {
212
+ agent: OfficeAgent;
213
+ onOpen(id: string): void;
214
+ styles: OfficeStyles;
215
+ }) {
216
+ const title = agentTitle(agent);
217
+ const task = agentTask(agent);
218
+ const state = stateLabel(agent);
219
+ const open = useCallback(() => onOpen(agent.id), [agent.id, onOpen]);
220
+ return (
221
+ <Pressable
222
+ accessibilityRole="button"
223
+ accessibilityLabel={`Open ${title}, ${state}`}
224
+ onPress={open}
225
+ style={styles.sessions.row}
226
+ >
227
+ <View style={styles.dot[dotTone(agent)]} />
228
+ <View style={styles.columnBody}>
229
+ <Text numberOfLines={1} style={styles.sessions.name}>
230
+ {title}
231
+ </Text>
232
+ <Text numberOfLines={2} style={styles.chatMeta}>
233
+ {task ? `${state} · ${task}` : state}
234
+ </Text>
235
+ </View>
236
+ </Pressable>
237
+ );
238
+ }