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.
- package/OVERVIEW.md +27 -0
- package/README.md +65 -134
- package/client/action-button.tsx +4 -1
- package/client/activity-panel.tsx +6 -4
- package/client/agent-appearance.tsx +257 -0
- package/client/agent-card.tsx +2 -1
- package/client/agent-picker-text.ts +23 -4
- package/client/agent-picker.tsx +5 -8
- package/client/board-sheet.tsx +48 -16
- package/client/board-text.ts +12 -2
- package/client/brand.ts +1 -0
- package/client/chat-chrome.tsx +318 -0
- package/client/chat-compose-tools.tsx +314 -0
- package/client/chat-dictation.tsx +133 -0
- package/client/chat-more.tsx +119 -0
- package/client/chat-panel.tsx +401 -146
- package/client/chat-quick.tsx +198 -0
- package/client/chat-text.ts +25 -6
- package/client/column-sheet.tsx +93 -23
- package/client/conversation-model.ts +19 -5
- package/client/duty-sheet.tsx +321 -0
- package/client/duty-text.ts +20 -0
- package/client/fullscreen-header.tsx +28 -13
- package/client/fullscreen-theme.ts +38 -0
- package/client/host-details.tsx +269 -0
- package/client/host-styles.ts +129 -0
- package/client/host-switches.tsx +212 -83
- package/client/incidents-card.tsx +2 -1
- package/client/janitor-card.tsx +1 -1
- package/client/library-card.tsx +2 -1
- package/client/list-text.ts +8 -6
- package/client/lobby-board.tsx +73 -53
- package/client/machine-card.tsx +225 -85
- package/client/messenger-styles.ts +216 -0
- package/client/new-agent-form.tsx +153 -61
- package/client/new-agent-model.ts +2 -0
- package/client/notes-card.tsx +111 -83
- package/client/notes-days.tsx +1 -1
- package/client/office-brand-context.ts +44 -0
- package/client/office-column.tsx +2 -1
- package/client/office-keyboard.ts +79 -0
- package/client/office-link.ts +7 -1
- package/client/office-mark.tsx +29 -0
- package/client/office-modal.tsx +440 -0
- package/client/office-settings.tsx +75 -30
- package/client/office-state.ts +12 -2
- package/client/office-surface.tsx +591 -81
- package/client/pixel/actors.ts +2 -1
- package/client/pixel/art.ts +33 -19
- package/client/pixel/pixel-office.tsx +2 -2
- package/client/prompt-coach.tsx +152 -0
- package/client/qa-card.tsx +2 -1
- package/client/review-card.tsx +2 -1
- package/client/room-board.tsx +26 -2
- package/client/scene-picker.tsx +158 -0
- package/client/scene-previews.ts +10 -0
- package/client/session-pane.tsx +25 -5
- package/client/session-panel-detail.tsx +238 -0
- package/client/session-panel.tsx +222 -137
- package/client/session-styles.ts +224 -1
- package/client/session-transcript.tsx +243 -0
- package/client/sessions-panel.tsx +181 -22
- package/client/sessions-text.ts +18 -0
- package/client/settings-sections.tsx +126 -0
- package/client/sidebar-launcher.ts +29 -0
- package/client/ssh-hosts.tsx +331 -0
- package/client/ssh-metrics.ts +76 -0
- package/client/standup-card.tsx +2 -1
- package/client/structure-view.tsx +20 -3
- package/client/styles.ts +170 -62
- package/client/team-chat-preview.tsx +96 -0
- package/client/tracker-connections.tsx +252 -0
- package/client/transcript-styles.ts +90 -0
- package/client/use-device-switch.ts +21 -12
- package/client/use-duty-actions.ts +43 -0
- package/client/use-group-photo.ts +48 -0
- package/client/use-new-agent.ts +4 -0
- package/client/use-street.ts +8 -0
- package/client/workspace-office-tools.tsx +102 -0
- package/client/workspace-overlay-route.web.ts +47 -0
- package/client/workspace-overlay.tsx +195 -0
- package/client/world/adapter.ts +37 -2
- package/client/world/escape.ts +58 -0
- package/client/world/use-world-feed.ts +6 -2
- package/client/world/workspace-dock.ts +6 -0
- package/client/world/world-api.ts +45 -4
- package/client/world/world-bridge-page.ts +14 -3
- package/client/world/world-bridge.ts +50 -5
- package/client/world/world-frame.web.ts +8 -0
- package/client/world/world-view-native.tsx +31 -10
- package/client/world/world-view-shared.ts +36 -7
- package/client/world/world-view.tsx +93 -21
- package/docs/office.md +165 -64
- package/index.client.tsx +13 -6
- package/index.server.ts +232 -16
- package/package.json +2 -1
- package/server/activity.ts +42 -19
- package/server/agent-tools.ts +11 -5
- package/server/board-service.ts +381 -10
- package/server/brand-logo.ts +34 -0
- package/server/chat-group.ts +83 -0
- package/server/chat-service.ts +406 -62
- package/server/chat-store.ts +1 -4
- package/server/directory.ts +22 -7
- package/server/duty-service.ts +230 -0
- package/server/group-photo.ts +39 -0
- package/server/home-departure.ts +47 -0
- package/server/hub.ts +43 -1
- package/server/incidents-jira.ts +19 -7
- package/server/incidents-schedule.ts +10 -10
- package/server/incidents-sentry.ts +34 -8
- package/server/live-ports.ts +114 -18
- package/server/lobby-pickup.ts +170 -0
- package/server/machine/details.ts +91 -0
- package/server/mention-queue.ts +14 -0
- package/server/office.ts +110 -6
- package/server/paths.ts +14 -0
- package/server/ssh/LICENSE.paseo +211 -0
- package/server/ssh/client.ts +401 -0
- package/server/ssh/discovery.ts +230 -0
- package/server/ssh/installed.ts +104 -0
- package/server/ssh/monitor.ts +104 -0
- package/server/ssh/pid-files.ts +194 -0
- package/server/ssh/read.ts +136 -0
- package/server/subagent-names.ts +4 -0
- package/server/tracker-credentials.ts +141 -0
- package/server/words.generated.ts +1 -1
- package/server/world.generated.ts +1 -1
- package/shared/appearance.ts +43 -0
- package/shared/branding.ts +53 -0
- package/shared/chat-words.ts +2 -2
- package/shared/contracts.ts +199 -5
- package/shared/duties.ts +100 -0
- package/shared/host-details.ts +25 -0
- package/shared/lobby-assignment.ts +34 -0
- package/shared/model.ts +9 -1
- package/shared/names.ts +2 -0
- package/shared/settings.ts +14 -3
- package/shared/ssh.ts +34 -0
- package/shared/upstream/README.md +1 -3
- package/shared/upstream/chat-engine.d.ts +4 -0
- package/shared/upstream/prompt-coach.d.ts +6 -0
- package/shared/upstream/prompt-coach.js +178 -0
package/client/session-panel.tsx
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
useCallback,
|
|
4
|
-
useMemo,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
type ReactNode,
|
|
8
|
-
type SetStateAction,
|
|
9
|
-
} from "react";
|
|
1
|
+
import { AppearanceEditor } from "./agent-appearance.js";
|
|
2
|
+
import { useCallback, useMemo, useRef, useState, type ReactNode, type SetStateAction } from "react";
|
|
10
3
|
import {
|
|
11
4
|
Text,
|
|
12
5
|
View,
|
|
6
|
+
type LayoutChangeEvent,
|
|
13
7
|
type NativeSyntheticEvent,
|
|
14
8
|
type TextInputKeyPressEventData,
|
|
15
9
|
} from "react-native";
|
|
@@ -20,22 +14,27 @@ import { agentTitle, answerableInOffice } from "../shared/model.js";
|
|
|
20
14
|
import { ActionButton, failureText } from "./action-button.js";
|
|
21
15
|
import { textAfterSend } from "./agent-card.js";
|
|
22
16
|
import { enterSends } from "./chat-text.js";
|
|
23
|
-
import type { ConversationRow } from "./conversation-model.js";
|
|
24
17
|
import { useFollowEnd } from "./follow-end.js";
|
|
25
18
|
import { hasTouchScreen, readPointer } from "./office-surface.js";
|
|
26
19
|
import { PermissionActions } from "./permission-actions.js";
|
|
20
|
+
import {
|
|
21
|
+
SessionButton,
|
|
22
|
+
SessionDetailTabs,
|
|
23
|
+
SessionHeading,
|
|
24
|
+
SessionMetadata,
|
|
25
|
+
SubagentRow,
|
|
26
|
+
type SessionDetailTab,
|
|
27
|
+
} from "./session-panel-detail.js";
|
|
27
28
|
import {
|
|
28
29
|
ANSWER_IN_WORKSPACE,
|
|
29
30
|
CANNOT_ANSWER_HERE,
|
|
30
31
|
EARLIER_FAILED,
|
|
31
32
|
LOADING,
|
|
32
|
-
NOTHING_SAID,
|
|
33
33
|
SENDING_DENIES,
|
|
34
34
|
UNLISTED_LINE,
|
|
35
35
|
composerPlaceholder,
|
|
36
|
-
rowLabel,
|
|
37
|
-
statusLine,
|
|
38
36
|
} from "./session-text.js";
|
|
37
|
+
import { SessionTranscript } from "./session-transcript.js";
|
|
39
38
|
import type { OfficeStyles } from "./styles.js";
|
|
40
39
|
import type { AgentActions } from "./use-agent-actions.js";
|
|
41
40
|
import { useConversation, type Conversation } from "./use-conversation.js";
|
|
@@ -61,95 +60,110 @@ export interface SessionPanelProps {
|
|
|
61
60
|
/** Leaves the office for the agent's workspace; absent where the host cannot. */
|
|
62
61
|
onOpenWorkspace: (() => void) | undefined;
|
|
63
62
|
onClose(): void;
|
|
63
|
+
/** The workspace dialog already provides a close control. */
|
|
64
|
+
hideClose?: boolean;
|
|
65
|
+
inSheet?: boolean;
|
|
66
|
+
subagents?: readonly OfficeAgent[];
|
|
67
|
+
onOpenSubagent?(id: string): void;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
type KeyPress = NativeSyntheticEvent<
|
|
67
71
|
TextInputKeyPressEventData & { shiftKey?: boolean; isComposing?: boolean }
|
|
68
72
|
>;
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
agent
|
|
72
|
-
room
|
|
73
|
-
onOpenWorkspace
|
|
74
|
-
onClose
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<Text style={styles.chatMeta}>{statusLine(agent, room)}</Text>
|
|
89
|
-
</>
|
|
90
|
-
)}
|
|
91
|
-
<View style={styles.actions}>
|
|
92
|
-
{onOpenWorkspace ? (
|
|
93
|
-
<ActionButton
|
|
94
|
-
label="Open in workspace"
|
|
95
|
-
pendingLabel="Opening..."
|
|
96
|
-
onPress={onOpenWorkspace}
|
|
97
|
-
styles={styles}
|
|
98
|
-
/>
|
|
99
|
-
) : null}
|
|
100
|
-
<ActionButton label="Close" pendingLabel="Closing..." onPress={onClose} styles={styles} />
|
|
101
|
-
</View>
|
|
102
|
-
</View>
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
interface RowProps {
|
|
107
|
-
row: ConversationRow;
|
|
108
|
-
name: string;
|
|
109
|
-
styles: OfficeStyles;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** The rows are new objects each time the list is read, so a row is compared by what it shows. */
|
|
113
|
-
function sameRow(before: RowProps, after: RowProps): boolean {
|
|
114
|
-
const [a, b] = [before.row, after.row];
|
|
115
|
-
return (
|
|
116
|
-
before.name === after.name &&
|
|
117
|
-
before.styles === after.styles &&
|
|
118
|
-
a.kind === b.kind &&
|
|
119
|
-
a.key === b.key &&
|
|
120
|
-
a.text === b.text &&
|
|
121
|
-
(a.kind !== "notice" || (b.kind === "notice" && a.tone === b.tone))
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/** One line of the conversation; a streamed piece redraws only the row it changed. */
|
|
126
|
-
const Row = memo(function Row({ row, name, styles }: RowProps) {
|
|
127
|
-
const label = rowLabel(row, name);
|
|
128
|
-
if (row.kind === "tool") {
|
|
74
|
+
function Header({
|
|
75
|
+
agent,
|
|
76
|
+
room,
|
|
77
|
+
onOpenWorkspace,
|
|
78
|
+
onClose,
|
|
79
|
+
hideClose,
|
|
80
|
+
inSheet,
|
|
81
|
+
styles,
|
|
82
|
+
}: Pick<
|
|
83
|
+
SessionPanelProps,
|
|
84
|
+
"agent" | "room" | "onOpenWorkspace" | "onClose" | "hideClose" | "inSheet" | "styles"
|
|
85
|
+
>) {
|
|
86
|
+
const [expanded, setExpanded] = useState(false);
|
|
87
|
+
const toggle = useCallback(() => setExpanded((value) => !value), []);
|
|
88
|
+
const [editing, setEditing] = useState(false);
|
|
89
|
+
const edit = useCallback(() => setEditing(true), []);
|
|
90
|
+
const closeEditor = useCallback(() => setEditing(false), []);
|
|
91
|
+
if (inSheet) {
|
|
129
92
|
return (
|
|
130
|
-
<
|
|
131
|
-
{
|
|
132
|
-
|
|
93
|
+
<View style={styles.sessions.sheetTools}>
|
|
94
|
+
{!agent && <Text style={styles.muted}>{UNLISTED_LINE}</Text>}
|
|
95
|
+
<View style={styles.sessions.sheetActionRow}>
|
|
96
|
+
{onOpenWorkspace && (
|
|
97
|
+
<SessionButton
|
|
98
|
+
label="Open in workspace"
|
|
99
|
+
icon="PanelsTopLeft"
|
|
100
|
+
caption="button"
|
|
101
|
+
onPress={onOpenWorkspace}
|
|
102
|
+
styles={styles}
|
|
103
|
+
/>
|
|
104
|
+
)}
|
|
105
|
+
{agent && (
|
|
106
|
+
<SessionButton
|
|
107
|
+
label="Session details"
|
|
108
|
+
icon={expanded ? "ChevronUp" : "ChevronDown"}
|
|
109
|
+
expanded={expanded}
|
|
110
|
+
caption="plain"
|
|
111
|
+
onPress={toggle}
|
|
112
|
+
styles={styles}
|
|
113
|
+
/>
|
|
114
|
+
)}
|
|
115
|
+
</View>
|
|
116
|
+
{expanded && agent && (
|
|
117
|
+
<View style={styles.sessions.sheetDetails}>
|
|
118
|
+
<SessionMetadata agent={agent} styles={styles} />
|
|
119
|
+
<SessionButton
|
|
120
|
+
label="Customize agent"
|
|
121
|
+
icon="Pencil"
|
|
122
|
+
caption="plain"
|
|
123
|
+
onPress={edit}
|
|
124
|
+
styles={styles}
|
|
125
|
+
/>
|
|
126
|
+
</View>
|
|
127
|
+
)}
|
|
128
|
+
{agent && editing && (
|
|
129
|
+
<AppearanceEditor key={agent.id} agent={agent} styles={styles} close={closeEditor} />
|
|
130
|
+
)}
|
|
131
|
+
</View>
|
|
133
132
|
);
|
|
134
133
|
}
|
|
135
|
-
const danger = row.kind === "notice" && row.tone === "danger";
|
|
136
|
-
let words = styles.chatText;
|
|
137
|
-
if (row.kind === "notice") words = danger ? styles.bannerText : styles.chatMeta;
|
|
138
134
|
return (
|
|
139
|
-
<View
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
135
|
+
<View style={styles.sessions.deskHead}>
|
|
136
|
+
<View style={styles.sessions.identityRow}>
|
|
137
|
+
{agent === null ? (
|
|
138
|
+
<View style={styles.columnBody}>
|
|
139
|
+
<Text style={styles.muted}>{UNLISTED_LINE}</Text>
|
|
140
|
+
</View>
|
|
141
|
+
) : (
|
|
142
|
+
<View style={styles.sessions.identity}>
|
|
143
|
+
<SessionHeading agent={agent} room={room} styles={styles} />
|
|
144
|
+
<SessionMetadata agent={agent} styles={styles} />
|
|
145
|
+
</View>
|
|
146
|
+
)}
|
|
147
|
+
{agent && (
|
|
148
|
+
<SessionButton label="Customize agent" icon="Pencil" onPress={edit} styles={styles} />
|
|
149
|
+
)}
|
|
150
|
+
{agent && editing && (
|
|
151
|
+
<AppearanceEditor key={agent.id} agent={agent} styles={styles} close={closeEditor} />
|
|
152
|
+
)}
|
|
153
|
+
{!hideClose && <SessionButton label="Close" icon="X" onPress={onClose} styles={styles} />}
|
|
154
|
+
</View>
|
|
155
|
+
{onOpenWorkspace && (
|
|
156
|
+
<SessionButton
|
|
157
|
+
label="Open in workspace"
|
|
158
|
+
icon="ArrowUpRight"
|
|
159
|
+
caption="plain"
|
|
160
|
+
onPress={onOpenWorkspace}
|
|
161
|
+
styles={styles}
|
|
162
|
+
/>
|
|
163
|
+
)}
|
|
150
164
|
</View>
|
|
151
165
|
);
|
|
152
|
-
}
|
|
166
|
+
}
|
|
153
167
|
|
|
154
168
|
function Alert({ text, styles }: { text: string; styles: OfficeStyles }) {
|
|
155
169
|
return (
|
|
@@ -162,13 +176,15 @@ function Alert({ text, styles }: { text: string; styles: OfficeStyles }) {
|
|
|
162
176
|
}
|
|
163
177
|
|
|
164
178
|
interface RowsProps {
|
|
179
|
+
appearance?: OfficeAgent["appearance"];
|
|
165
180
|
conversation: Conversation;
|
|
181
|
+
steps: boolean;
|
|
166
182
|
name: string;
|
|
167
183
|
styles: OfficeStyles;
|
|
168
184
|
}
|
|
169
185
|
|
|
170
186
|
/** What the list holds: its state while it has none, else Show earlier and the rows. */
|
|
171
|
-
function Rows({ conversation, name, styles }: RowsProps): ReactNode {
|
|
187
|
+
function Rows({ conversation, steps, name, appearance, styles }: RowsProps): ReactNode {
|
|
172
188
|
const { status, rows } = conversation;
|
|
173
189
|
if (status === "loading") return <Text style={styles.muted}>{LOADING}</Text>;
|
|
174
190
|
if (status === "error") {
|
|
@@ -198,10 +214,13 @@ function Rows({ conversation, name, styles }: RowsProps): ReactNode {
|
|
|
198
214
|
/>
|
|
199
215
|
</View>
|
|
200
216
|
) : null}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
217
|
+
<SessionTranscript
|
|
218
|
+
appearance={appearance}
|
|
219
|
+
rows={rows}
|
|
220
|
+
steps={steps}
|
|
221
|
+
name={name}
|
|
222
|
+
styles={styles}
|
|
223
|
+
/>
|
|
205
224
|
</>
|
|
206
225
|
);
|
|
207
226
|
}
|
|
@@ -247,18 +266,36 @@ interface ComposerProps {
|
|
|
247
266
|
actions: AgentActions;
|
|
248
267
|
touchScreen: boolean;
|
|
249
268
|
styles: OfficeStyles;
|
|
269
|
+
focused: boolean;
|
|
270
|
+
setFocused(value: boolean): void;
|
|
250
271
|
}
|
|
251
272
|
|
|
252
|
-
function Composer({
|
|
273
|
+
function Composer({
|
|
274
|
+
agent,
|
|
275
|
+
draft,
|
|
276
|
+
actions,
|
|
277
|
+
touchScreen,
|
|
278
|
+
styles,
|
|
279
|
+
focused,
|
|
280
|
+
setFocused,
|
|
281
|
+
}: ComposerProps) {
|
|
253
282
|
const { text, setText } = draft;
|
|
254
283
|
const [error, setError] = useState<string | null>(null);
|
|
255
284
|
// Enter and the Send button can both fire before the first send returns.
|
|
256
285
|
const sending = useRef(false);
|
|
286
|
+
const [pending, setPending] = useState(false);
|
|
287
|
+
const focus = useCallback(() => setFocused(true), [setFocused]);
|
|
288
|
+
const blur = useCallback(() => setFocused(false), [setFocused]);
|
|
289
|
+
const shell = useMemo(
|
|
290
|
+
() => [styles.sessions.replyShell, focused && styles.sessions.replyFocused],
|
|
291
|
+
[styles, focused],
|
|
292
|
+
);
|
|
257
293
|
const agentId = agent.id;
|
|
258
294
|
const send = useCallback(async () => {
|
|
259
295
|
const sent = text.trim();
|
|
260
296
|
if (sent === "" || sending.current) return;
|
|
261
297
|
sending.current = true;
|
|
298
|
+
setPending(true);
|
|
262
299
|
try {
|
|
263
300
|
// A reply to a working agent joins its turn: a plain send makes the daemon interrupt it.
|
|
264
301
|
await actions.send(agentId, sent, { activeTurnBehavior: "steer" });
|
|
@@ -268,6 +305,7 @@ function Composer({ agent, draft, actions, touchScreen, styles }: ComposerProps)
|
|
|
268
305
|
setError(failureText("Send", failure));
|
|
269
306
|
}
|
|
270
307
|
sending.current = false;
|
|
308
|
+
setPending(false);
|
|
271
309
|
}, [text, setText, actions, agentId]);
|
|
272
310
|
const stop = useCallback(() => actions.cancel?.(agentId), [actions, agentId]);
|
|
273
311
|
const onKeyPress = useCallback(
|
|
@@ -281,37 +319,39 @@ function Composer({ agent, draft, actions, touchScreen, styles }: ComposerProps)
|
|
|
281
319
|
[touchScreen, send],
|
|
282
320
|
);
|
|
283
321
|
return (
|
|
284
|
-
<View style={styles.
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
pendingLabel="Sending..."
|
|
322
|
+
<View style={styles.sessions.deskComposer}>
|
|
323
|
+
<View style={shell}>
|
|
324
|
+
<TextInput
|
|
325
|
+
accessibilityLabel="Message"
|
|
326
|
+
placeholder={composerPlaceholder(agent)}
|
|
327
|
+
placeholderTextColor={styles.placeholderColor}
|
|
328
|
+
value={text}
|
|
329
|
+
onChangeText={setText}
|
|
330
|
+
onKeyPress={onKeyPress}
|
|
331
|
+
onFocus={focus}
|
|
332
|
+
onBlur={blur}
|
|
333
|
+
multiline
|
|
334
|
+
numberOfLines={Math.min(4, text.split("\n", 4).length)}
|
|
335
|
+
style={styles.sessions.replyInput}
|
|
336
|
+
/>
|
|
337
|
+
{agent.status === "running" && actions.cancel !== null && (
|
|
338
|
+
<ActionButton label="Stop" pendingLabel="Stopping..." onPress={stop} styles={styles} />
|
|
339
|
+
)}
|
|
340
|
+
<SessionButton
|
|
341
|
+
label={pending ? "Sending..." : "Send"}
|
|
342
|
+
icon={pending ? "Ellipsis" : "ArrowUp"}
|
|
306
343
|
onPress={send}
|
|
307
|
-
disabled={text.trim() === ""}
|
|
344
|
+
disabled={text.trim() === "" || pending}
|
|
308
345
|
primary
|
|
309
346
|
styles={styles}
|
|
310
347
|
/>
|
|
311
|
-
{agent.status === "running" && actions.cancel !== null ? (
|
|
312
|
-
<ActionButton label="Stop" pendingLabel="Stopping..." onPress={stop} styles={styles} />
|
|
313
|
-
) : null}
|
|
314
348
|
</View>
|
|
349
|
+
{agent.permissions.length > 0 && <Text style={styles.composerWarning}>{SENDING_DENIES}</Text>}
|
|
350
|
+
{error !== null && (
|
|
351
|
+
<Text accessibilityRole="alert" style={styles.actionError}>
|
|
352
|
+
{error}
|
|
353
|
+
</Text>
|
|
354
|
+
)}
|
|
315
355
|
</View>
|
|
316
356
|
);
|
|
317
357
|
}
|
|
@@ -327,23 +367,53 @@ export function SessionPanel({
|
|
|
327
367
|
layout,
|
|
328
368
|
onOpenWorkspace,
|
|
329
369
|
onClose,
|
|
370
|
+
hideClose,
|
|
371
|
+
inSheet,
|
|
372
|
+
subagents,
|
|
373
|
+
onOpenSubagent,
|
|
330
374
|
}: SessionPanelProps) {
|
|
331
375
|
const conversation = useConversation(agentId);
|
|
376
|
+
const [tab, setTab] = useState<SessionDetailTab>("chat");
|
|
332
377
|
const { scroller, onScroll, followEnd } = useFollowEnd();
|
|
333
378
|
const touchScreen = useMemo(
|
|
334
379
|
() => hasTouchScreen(layout.platform, layout.platform === "web" ? readPointer() : null),
|
|
335
380
|
[layout.platform],
|
|
336
381
|
);
|
|
382
|
+
const nativeDialog = inSheet && layout.platform !== "web";
|
|
383
|
+
const [focused, setFocused] = useState(false);
|
|
384
|
+
const [short, setShort] = useState(false);
|
|
385
|
+
const measureBody = useCallback((event: LayoutChangeEvent) => {
|
|
386
|
+
// Keep room for the transcript and a four-line draft on a short keyboard-open sheet.
|
|
387
|
+
setShort(event.nativeEvent.layout.height < 280);
|
|
388
|
+
}, []);
|
|
337
389
|
const name = agent === null ? `Agent ${agentId.slice(0, 8)}` : agentTitle(agent);
|
|
390
|
+
const requests = agent && (
|
|
391
|
+
<Asks
|
|
392
|
+
agent={agent}
|
|
393
|
+
actions={actions}
|
|
394
|
+
canOpenWorkspace={onOpenWorkspace !== undefined}
|
|
395
|
+
styles={styles}
|
|
396
|
+
/>
|
|
397
|
+
);
|
|
338
398
|
return (
|
|
339
|
-
<View style={styles.screen}>
|
|
340
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
399
|
+
<View style={styles.screen} onLayout={nativeDialog ? measureBody : undefined}>
|
|
400
|
+
<View style={short && focused ? styles.hidden : undefined}>
|
|
401
|
+
<Header
|
|
402
|
+
agent={agent}
|
|
403
|
+
room={room}
|
|
404
|
+
onOpenWorkspace={onOpenWorkspace}
|
|
405
|
+
onClose={onClose}
|
|
406
|
+
hideClose={hideClose}
|
|
407
|
+
inSheet={inSheet}
|
|
408
|
+
styles={styles}
|
|
409
|
+
/>
|
|
410
|
+
<SessionDetailTabs
|
|
411
|
+
tab={tab}
|
|
412
|
+
setTab={setTab}
|
|
413
|
+
childCount={onOpenSubagent ? subagents?.length : undefined}
|
|
414
|
+
styles={styles}
|
|
415
|
+
/>
|
|
416
|
+
</View>
|
|
347
417
|
<ScrollView
|
|
348
418
|
ref={scroller}
|
|
349
419
|
contentContainerStyle={styles.sessionList}
|
|
@@ -353,17 +423,32 @@ export function SessionPanel({
|
|
|
353
423
|
scrollEventThrottle={16}
|
|
354
424
|
keyboardShouldPersistTaps="handled"
|
|
355
425
|
>
|
|
356
|
-
|
|
426
|
+
{tab === "subagents" && subagents && onOpenSubagent ? (
|
|
427
|
+
<>
|
|
428
|
+
{subagents.length === 0 && (
|
|
429
|
+
<Text style={styles.muted}>No subagents in this session.</Text>
|
|
430
|
+
)}
|
|
431
|
+
{subagents.map((child) => (
|
|
432
|
+
<SubagentRow key={child.id} agent={child} onOpen={onOpenSubagent} styles={styles} />
|
|
433
|
+
))}
|
|
434
|
+
</>
|
|
435
|
+
) : (
|
|
436
|
+
<Rows
|
|
437
|
+
appearance={agent?.appearance}
|
|
438
|
+
conversation={conversation}
|
|
439
|
+
steps={tab === "steps"}
|
|
440
|
+
name={name}
|
|
441
|
+
styles={styles}
|
|
442
|
+
/>
|
|
443
|
+
)}
|
|
444
|
+
{nativeDialog && requests}
|
|
357
445
|
</ScrollView>
|
|
358
446
|
{agent === null ? null : (
|
|
359
447
|
<>
|
|
360
|
-
|
|
361
|
-
agent={agent}
|
|
362
|
-
actions={actions}
|
|
363
|
-
canOpenWorkspace={onOpenWorkspace !== undefined}
|
|
364
|
-
styles={styles}
|
|
365
|
-
/>
|
|
448
|
+
{!nativeDialog && requests}
|
|
366
449
|
<Composer
|
|
450
|
+
focused={focused}
|
|
451
|
+
setFocused={setFocused}
|
|
367
452
|
agent={agent}
|
|
368
453
|
draft={draft}
|
|
369
454
|
actions={actions}
|