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
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import { Pressable, Text, View } from "react-native";
|
|
3
|
+
import { defineSettings } from "@getpaseo/plugin";
|
|
4
|
+
import { useSettings } from "@getpaseo/plugin/client";
|
|
5
|
+
import { ScrollView, TextInput } from "@getpaseo/plugin/client/ui";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
import { chatT } from "../shared/chat-words.js";
|
|
8
|
+
import { CHAT_TEXT_MAX } from "../shared/contracts.js";
|
|
9
|
+
import { ActionButton } from "./action-button.js";
|
|
10
|
+
import { ChatIcon } from "./chat-chrome.js";
|
|
11
|
+
import type { OfficeStyles } from "./styles.js";
|
|
12
|
+
|
|
13
|
+
const Message = z.object({
|
|
14
|
+
label: z.string().trim().min(1).max(24),
|
|
15
|
+
prompt: z.string().trim().min(1).max(CHAT_TEXT_MAX),
|
|
16
|
+
});
|
|
17
|
+
type Quick = z.output<typeof Message>;
|
|
18
|
+
const defaults = ["test", "commit", "deploy", "today", "errors"].map((k) => ({
|
|
19
|
+
label: chatT("chat.quick." + k),
|
|
20
|
+
prompt: chatT("chat.quick." + k + "Prompt"),
|
|
21
|
+
}));
|
|
22
|
+
export const quickSettings = defineSettings({
|
|
23
|
+
id: "office-quick-messages",
|
|
24
|
+
scope: "device",
|
|
25
|
+
version: 1,
|
|
26
|
+
schema: z.object({ list: z.array(Message).max(12).default(defaults) }),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
function QuickRow({
|
|
30
|
+
item,
|
|
31
|
+
onUse,
|
|
32
|
+
onEdit,
|
|
33
|
+
styles,
|
|
34
|
+
}: {
|
|
35
|
+
item: Quick;
|
|
36
|
+
onUse(s: string): void;
|
|
37
|
+
onEdit(item: Quick): void;
|
|
38
|
+
styles: OfficeStyles;
|
|
39
|
+
}) {
|
|
40
|
+
const use = useCallback(() => onUse(item.prompt), [onUse, item]);
|
|
41
|
+
const edit = useCallback(() => onEdit(item), [onEdit, item]);
|
|
42
|
+
return (
|
|
43
|
+
<View style={styles.messenger.quickRow}>
|
|
44
|
+
<Pressable
|
|
45
|
+
accessibilityRole="button"
|
|
46
|
+
accessibilityLabel={item.label}
|
|
47
|
+
onPress={use}
|
|
48
|
+
style={styles.rowBody}
|
|
49
|
+
>
|
|
50
|
+
<Text style={styles.chatName}>{item.label}</Text>
|
|
51
|
+
<Text style={styles.chatMeta} numberOfLines={1}>
|
|
52
|
+
{item.prompt}
|
|
53
|
+
</Text>
|
|
54
|
+
</Pressable>
|
|
55
|
+
<ChatIcon name="Pencil" label={`Edit ${item.label}`} styles={styles} onPress={edit} />
|
|
56
|
+
</View>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** This document belongs to the current device, separately from its view and theme preferences. */
|
|
61
|
+
export function QuickMessages({
|
|
62
|
+
text,
|
|
63
|
+
onUse,
|
|
64
|
+
styles,
|
|
65
|
+
}: {
|
|
66
|
+
text: string;
|
|
67
|
+
onUse(prompt: string): void;
|
|
68
|
+
styles: OfficeStyles;
|
|
69
|
+
}) {
|
|
70
|
+
const settings = useSettings(quickSettings);
|
|
71
|
+
const ready = settings.status === "ready" ? settings : null;
|
|
72
|
+
const [editing, setEditing] = useState<Quick | "new" | null>(null);
|
|
73
|
+
const [label, setLabel] = useState(""),
|
|
74
|
+
[prompt, setPrompt] = useState("");
|
|
75
|
+
const [removeConfirm, setRemoveConfirm] = useState(false);
|
|
76
|
+
const cancel = useCallback(() => {
|
|
77
|
+
setEditing(null);
|
|
78
|
+
setRemoveConfirm(false);
|
|
79
|
+
}, []);
|
|
80
|
+
const edit = useCallback((item: Quick) => {
|
|
81
|
+
setEditing(item);
|
|
82
|
+
setLabel(item.label);
|
|
83
|
+
setPrompt(item.prompt);
|
|
84
|
+
setRemoveConfirm(false);
|
|
85
|
+
}, []);
|
|
86
|
+
const create = useCallback(() => {
|
|
87
|
+
setEditing("new");
|
|
88
|
+
setLabel(text.trim().slice(0, 24));
|
|
89
|
+
setPrompt(text.trim());
|
|
90
|
+
setRemoveConfirm(false);
|
|
91
|
+
}, [text]);
|
|
92
|
+
const keep = useCallback(
|
|
93
|
+
async (remove: boolean) => {
|
|
94
|
+
if (!ready || !editing) return;
|
|
95
|
+
const items = ready.values.list;
|
|
96
|
+
const replacement = { label: label.trim(), prompt: prompt.trim() };
|
|
97
|
+
// A new revision can arrive while the editor is open. Locate the original by content.
|
|
98
|
+
const index =
|
|
99
|
+
editing === "new"
|
|
100
|
+
? -1
|
|
101
|
+
: items.findIndex(
|
|
102
|
+
(item) => item.prompt === editing.prompt && item.label === editing.label,
|
|
103
|
+
);
|
|
104
|
+
if (editing !== "new" && index === -1)
|
|
105
|
+
throw new Error("This quick message changed. Reopen it to edit.");
|
|
106
|
+
const next = [...items];
|
|
107
|
+
if (!remove && next.some((item, i) => i !== index && item.label === replacement.label))
|
|
108
|
+
throw new Error("Choose a different quick message name.");
|
|
109
|
+
if (remove) next.splice(index, 1);
|
|
110
|
+
else if (index === -1) next.push(replacement);
|
|
111
|
+
else next[index] = replacement;
|
|
112
|
+
if (!(await ready.save({ list: next }, ready.revision))) {
|
|
113
|
+
await ready.reload();
|
|
114
|
+
throw new Error("The quick messages changed or could not be saved. Try again.");
|
|
115
|
+
}
|
|
116
|
+
cancel();
|
|
117
|
+
},
|
|
118
|
+
[ready, editing, label, prompt, cancel],
|
|
119
|
+
);
|
|
120
|
+
const save = useCallback(() => keep(false), [keep]);
|
|
121
|
+
const remove = useCallback(async () => {
|
|
122
|
+
if (removeConfirm) await keep(true);
|
|
123
|
+
else setRemoveConfirm(true);
|
|
124
|
+
}, [removeConfirm, keep]);
|
|
125
|
+
if (!ready)
|
|
126
|
+
return (
|
|
127
|
+
<Text style={styles.chatMeta}>
|
|
128
|
+
{settings.status === "loading"
|
|
129
|
+
? "Loading quick messages…"
|
|
130
|
+
: "Quick messages could not be loaded on this device."}
|
|
131
|
+
</Text>
|
|
132
|
+
);
|
|
133
|
+
if (editing)
|
|
134
|
+
return (
|
|
135
|
+
<ScrollView
|
|
136
|
+
style={styles.messenger.pollScroll}
|
|
137
|
+
contentContainerStyle={styles.sheetField}
|
|
138
|
+
keyboardShouldPersistTaps="handled"
|
|
139
|
+
>
|
|
140
|
+
<TextInput
|
|
141
|
+
accessibilityLabel="Quick message name"
|
|
142
|
+
placeholder="Name"
|
|
143
|
+
style={styles.fieldInput}
|
|
144
|
+
maxLength={24}
|
|
145
|
+
value={label}
|
|
146
|
+
onChangeText={setLabel}
|
|
147
|
+
/>
|
|
148
|
+
<TextInput
|
|
149
|
+
accessibilityLabel="Saved message"
|
|
150
|
+
placeholder="Message"
|
|
151
|
+
style={styles.fieldInput}
|
|
152
|
+
multiline
|
|
153
|
+
maxLength={CHAT_TEXT_MAX}
|
|
154
|
+
value={prompt}
|
|
155
|
+
onChangeText={setPrompt}
|
|
156
|
+
/>
|
|
157
|
+
<View style={styles.actions}>
|
|
158
|
+
<ActionButton
|
|
159
|
+
label="Save"
|
|
160
|
+
pendingLabel="Saving…"
|
|
161
|
+
onPress={save}
|
|
162
|
+
disabled={!label.trim() || !prompt.trim()}
|
|
163
|
+
primary
|
|
164
|
+
styles={styles}
|
|
165
|
+
/>
|
|
166
|
+
<ActionButton label="Cancel" pendingLabel="Cancel" onPress={cancel} styles={styles} />
|
|
167
|
+
{editing !== "new" && (
|
|
168
|
+
<ActionButton
|
|
169
|
+
label={removeConfirm ? "Confirm delete" : "Delete"}
|
|
170
|
+
pendingLabel="Deleting…"
|
|
171
|
+
onPress={remove}
|
|
172
|
+
styles={styles}
|
|
173
|
+
/>
|
|
174
|
+
)}
|
|
175
|
+
</View>
|
|
176
|
+
</ScrollView>
|
|
177
|
+
);
|
|
178
|
+
return (
|
|
179
|
+
<ScrollView style={styles.messenger.pollScroll} keyboardShouldPersistTaps="handled">
|
|
180
|
+
<ActionButton
|
|
181
|
+
label="Add quick message"
|
|
182
|
+
pendingLabel="Add quick message"
|
|
183
|
+
styles={styles}
|
|
184
|
+
onPress={create}
|
|
185
|
+
disabled={ready.values.list.length >= 12}
|
|
186
|
+
/>
|
|
187
|
+
{ready.values.list.map((item) => (
|
|
188
|
+
<QuickRow
|
|
189
|
+
item={item}
|
|
190
|
+
key={item.label + "\n" + item.prompt}
|
|
191
|
+
onUse={onUse}
|
|
192
|
+
onEdit={edit}
|
|
193
|
+
styles={styles}
|
|
194
|
+
/>
|
|
195
|
+
))}
|
|
196
|
+
</ScrollView>
|
|
197
|
+
);
|
|
198
|
+
}
|
package/client/chat-text.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AVATARS, shirtColor, type Appearance } from "../shared/appearance.js";
|
|
1
2
|
import { CHAT_TEXT_MAX, type ChatMessage } from "../shared/contracts.js";
|
|
2
3
|
import { agentTitle, type OfficeModel } from "../shared/model.js";
|
|
3
4
|
import { REACTIONS } from "../shared/upstream/chat-engine.js";
|
|
@@ -29,9 +30,12 @@ const MENTION_QUERY_MAX = 40;
|
|
|
29
30
|
const MENTION_OPTIONS_MAX = 8;
|
|
30
31
|
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
31
32
|
|
|
32
|
-
/**
|
|
33
|
+
/** Older photos may have no picture. The office also skips unsupported engine cards. */
|
|
33
34
|
export function shows(message: ChatMessage): boolean {
|
|
34
|
-
return
|
|
35
|
+
return (
|
|
36
|
+
SHOWN_KINDS.has(message.kind) ||
|
|
37
|
+
(message.kind === "photo" && Boolean(message.photo || message.recalled))
|
|
38
|
+
);
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
export function isYours(message: ChatMessage): boolean {
|
|
@@ -123,14 +127,28 @@ function initialsOf(name: string): string {
|
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
/** Null for a system line and for yours. An agent's colour is its shirt on the floor. */
|
|
126
|
-
export function avatarOf(
|
|
130
|
+
export function avatarOf(
|
|
131
|
+
message: ChatMessage,
|
|
132
|
+
appearance?: Appearance,
|
|
133
|
+
): { initials: string; color: string } | null {
|
|
127
134
|
if (message.kind === "sys" || message.from === undefined || isYours(message)) return null;
|
|
128
135
|
const name = message.name ?? message.from;
|
|
129
|
-
|
|
136
|
+
return memberAvatar(message.from, name, appearance);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export function memberAvatar(
|
|
140
|
+
id: string,
|
|
141
|
+
name: string,
|
|
142
|
+
appearance?: Appearance,
|
|
143
|
+
): { initials: string; color: string } {
|
|
144
|
+
if (id === DIRECTOR) {
|
|
130
145
|
return { initials: [...name].slice(0, 1).join("").toUpperCase(), color: DIRECTOR_COLOR };
|
|
131
146
|
}
|
|
132
|
-
const shirt = SHIRTS[lookOf(
|
|
133
|
-
return {
|
|
147
|
+
const shirt = SHIRTS[lookOf(id).shirt] ?? SHIRTS[0];
|
|
148
|
+
return {
|
|
149
|
+
initials: appearance?.avatar ? AVATARS[appearance.avatar] : initialsOf(name),
|
|
150
|
+
color: shirtColor(appearance) ?? shirt.shirt,
|
|
151
|
+
};
|
|
134
152
|
}
|
|
135
153
|
|
|
136
154
|
export function pollRows(
|
|
@@ -181,6 +199,7 @@ export function mentionAt(text: string): Mention | null {
|
|
|
181
199
|
}
|
|
182
200
|
|
|
183
201
|
export interface MentionOption {
|
|
202
|
+
appearance?: Appearance;
|
|
184
203
|
id: string;
|
|
185
204
|
name: string;
|
|
186
205
|
room: string;
|
package/client/column-sheet.tsx
CHANGED
|
@@ -1,15 +1,73 @@
|
|
|
1
|
-
import { useCallback, useEffect, type ReactNode } from "react";
|
|
1
|
+
import { useCallback, useEffect, useMemo, type ReactNode } from "react";
|
|
2
2
|
import { KeyboardAvoidingView, Pressable, Text, View } from "react-native";
|
|
3
|
-
import { Icon } from "@getpaseo/plugin/client/ui";
|
|
3
|
+
import { Icon, Modal } from "@getpaseo/plugin/client/ui";
|
|
4
|
+
import type { OfficeAgent } from "../shared/contracts.js";
|
|
5
|
+
import { statusLine } from "./session-text.js";
|
|
6
|
+
import { SessionHeading } from "./session-panel-detail.js";
|
|
4
7
|
import { COLUMN_TABS, type ColumnTab, type ColumnView } from "./column-model.js";
|
|
5
8
|
import { ColumnTabs, type ColumnBadges, type ColumnSession } from "./office-column.js";
|
|
6
9
|
import type { OfficeStyles } from "./styles.js";
|
|
7
10
|
|
|
11
|
+
const dialogContent = { padding: 0, gap: 0 };
|
|
12
|
+
|
|
13
|
+
/** Paseo sizes the dialog body to its visible snap point and registers its text inputs with the keyboard. */
|
|
14
|
+
export function ColumnDialog({
|
|
15
|
+
view,
|
|
16
|
+
sessionTitle,
|
|
17
|
+
identity,
|
|
18
|
+
color,
|
|
19
|
+
onBack,
|
|
20
|
+
onDismiss,
|
|
21
|
+
styles,
|
|
22
|
+
children,
|
|
23
|
+
}: {
|
|
24
|
+
view: ColumnView;
|
|
25
|
+
sessionTitle: string | null;
|
|
26
|
+
identity: { agent: OfficeAgent | null; room: string | null } | null;
|
|
27
|
+
color: string;
|
|
28
|
+
onBack(): void;
|
|
29
|
+
onDismiss(): void;
|
|
30
|
+
styles: OfficeStyles;
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
}) {
|
|
33
|
+
const session = view.kind === "session";
|
|
34
|
+
let title = sessionTitle ?? "Session";
|
|
35
|
+
if (view.kind === "tab") {
|
|
36
|
+
title =
|
|
37
|
+
view.tab === "chat" ? "Team chat" : COLUMN_TABS.find((item) => item.tab === view.tab)!.label;
|
|
38
|
+
} else if (identity?.agent) {
|
|
39
|
+
title = `${title} · ${statusLine(identity.agent, identity.room)}`;
|
|
40
|
+
}
|
|
41
|
+
const back = useMemo(
|
|
42
|
+
() =>
|
|
43
|
+
session ? (
|
|
44
|
+
<Pressable
|
|
45
|
+
accessibilityRole="button"
|
|
46
|
+
accessibilityLabel="Back to Sessions"
|
|
47
|
+
onPress={onBack}
|
|
48
|
+
style={styles.segment}
|
|
49
|
+
>
|
|
50
|
+
<Icon name="ArrowLeft" size={20} color={color} />
|
|
51
|
+
</Pressable>
|
|
52
|
+
) : undefined,
|
|
53
|
+
[session, onBack, styles.segment, color],
|
|
54
|
+
);
|
|
55
|
+
return (
|
|
56
|
+
<Modal open title={title} icon={back} onOpenChange={onDismiss}>
|
|
57
|
+
<Modal.Content scrollable={false} contentContainerStyle={dialogContent}>
|
|
58
|
+
{children}
|
|
59
|
+
</Modal.Content>
|
|
60
|
+
</Modal>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
8
64
|
export interface ColumnSheetProps {
|
|
9
65
|
/** What the sheet shows; null while it is closed. */
|
|
10
66
|
open: ColumnView | null;
|
|
11
67
|
/** The open session's title, while the sheet shows a session. */
|
|
12
68
|
sessionTitle: string | null;
|
|
69
|
+
sessionAgent?: OfficeAgent | null;
|
|
70
|
+
sessionRoom?: string | null;
|
|
13
71
|
/** The theme's foreground, which an icon-only control's glyph rests at. */
|
|
14
72
|
color: string;
|
|
15
73
|
iconSize: number;
|
|
@@ -34,6 +92,8 @@ export interface ColumnSheetProps {
|
|
|
34
92
|
export function ColumnSheet({
|
|
35
93
|
open,
|
|
36
94
|
sessionTitle,
|
|
95
|
+
sessionAgent,
|
|
96
|
+
sessionRoom,
|
|
37
97
|
color,
|
|
38
98
|
iconSize,
|
|
39
99
|
platform,
|
|
@@ -53,6 +113,7 @@ export function ColumnSheet({
|
|
|
53
113
|
}, [platform, open, onClose]);
|
|
54
114
|
if (open === null) return null;
|
|
55
115
|
const session = open.kind === "session";
|
|
116
|
+
const chat = open.kind === "tab" && open.tab === "chat";
|
|
56
117
|
const title = session
|
|
57
118
|
? (sessionTitle ?? "Session")
|
|
58
119
|
: (COLUMN_TABS.find((each) => each.tab === open.tab)?.label ?? "");
|
|
@@ -64,33 +125,42 @@ export function ColumnSheet({
|
|
|
64
125
|
onPress={onClose}
|
|
65
126
|
style={styles.sheetScrim}
|
|
66
127
|
/>
|
|
67
|
-
<View
|
|
68
|
-
|
|
69
|
-
|
|
128
|
+
<View
|
|
129
|
+
testID="office-column-sheet"
|
|
130
|
+
style={session || chat ? styles.sessionSheet : styles.columnSheet}
|
|
131
|
+
>
|
|
132
|
+
{!chat && (
|
|
133
|
+
<View style={styles.columnSheetHead}>
|
|
134
|
+
{session ? (
|
|
135
|
+
<Pressable
|
|
136
|
+
accessibilityRole="button"
|
|
137
|
+
accessibilityLabel="Back to Sessions"
|
|
138
|
+
onPress={onBack}
|
|
139
|
+
style={styles.segment}
|
|
140
|
+
>
|
|
141
|
+
<Icon name="ArrowLeft" size={iconSize} color={color} />
|
|
142
|
+
</Pressable>
|
|
143
|
+
) : null}
|
|
144
|
+
{sessionAgent ? (
|
|
145
|
+
<SessionHeading agent={sessionAgent} room={sessionRoom ?? null} styles={styles} />
|
|
146
|
+
) : (
|
|
147
|
+
<Text accessibilityRole="header" numberOfLines={1} style={styles.columnSheetTitle}>
|
|
148
|
+
{title}
|
|
149
|
+
</Text>
|
|
150
|
+
)}
|
|
70
151
|
<Pressable
|
|
71
152
|
accessibilityRole="button"
|
|
72
|
-
accessibilityLabel=
|
|
73
|
-
onPress={
|
|
153
|
+
accessibilityLabel={session ? `Close ${title}` : "Close"}
|
|
154
|
+
onPress={session ? onCloseSession : onClose}
|
|
74
155
|
style={styles.segment}
|
|
75
156
|
>
|
|
76
|
-
<Icon name="
|
|
157
|
+
<Icon name="X" size={iconSize} color={color} />
|
|
77
158
|
</Pressable>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</Text>
|
|
82
|
-
<Pressable
|
|
83
|
-
accessibilityRole="button"
|
|
84
|
-
accessibilityLabel={session ? `Close ${title}` : "Close"}
|
|
85
|
-
onPress={session ? onCloseSession : onClose}
|
|
86
|
-
style={styles.segment}
|
|
87
|
-
>
|
|
88
|
-
<Icon name="X" size={iconSize} color={color} />
|
|
89
|
-
</Pressable>
|
|
90
|
-
</View>
|
|
91
|
-
{/* The Chat box sits at the sheet's bottom: on iOS the keyboard would cover it. */}
|
|
159
|
+
</View>
|
|
160
|
+
)}
|
|
161
|
+
{/* Team chat adjusts the whole office so the sheet and its composer move together. */}
|
|
92
162
|
<KeyboardAvoidingView
|
|
93
|
-
behavior={platform === "ios" ? "padding" : undefined}
|
|
163
|
+
behavior={!chat && platform === "ios" ? "padding" : undefined}
|
|
94
164
|
style={styles.columnBody}
|
|
95
165
|
>
|
|
96
166
|
{children}
|
|
@@ -6,9 +6,9 @@ import type { AgentTimelineItem } from "@getpaseo/protocol/agent-types";
|
|
|
6
6
|
* line per tool call, and anything that went wrong.
|
|
7
7
|
*/
|
|
8
8
|
export type ConversationRow =
|
|
9
|
-
| { kind: "you"; key: string; text: string }
|
|
9
|
+
| { kind: "you"; key: string; text: string; imageUrls?: string[] }
|
|
10
10
|
| { kind: "agent"; key: string; text: string }
|
|
11
|
-
| { kind: "tool"; key: string; text: string }
|
|
11
|
+
| { kind: "tool"; key: string; text: string; outcome?: "failed" | "canceled" }
|
|
12
12
|
| { kind: "notice"; key: string; text: string; tone: "muted" | "danger" };
|
|
13
13
|
|
|
14
14
|
/** One timeline entry as the hook keeps it: the item and the sequence number it arrived with. */
|
|
@@ -59,16 +59,30 @@ export function toolLine(item: ToolCall): string {
|
|
|
59
59
|
return line.length > TOOL_LINE_MAX ? `${line.slice(0, TOOL_LINE_MAX - 1).trimEnd()}…` : line;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
function toolRow(key: string, item: ToolCall): Extract<ConversationRow, { kind: "tool" }> {
|
|
63
|
+
const row = { kind: "tool" as const, key, text: toolLine(item) };
|
|
64
|
+
return item.status === "failed" || item.status === "canceled"
|
|
65
|
+
? { ...row, outcome: item.status }
|
|
66
|
+
: row;
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
function rowFor(entry: TimelineEntry): ConversationRow | null {
|
|
63
70
|
const { item } = entry;
|
|
64
71
|
const key = String(entry.seq);
|
|
65
72
|
switch (item.type) {
|
|
66
|
-
case "user_message":
|
|
73
|
+
case "user_message": {
|
|
74
|
+
// Newer hosts include replayable file URLs. Older SDKs expose only the text.
|
|
75
|
+
const urls = "imageUrls" in item && Array.isArray(item.imageUrls) ? item.imageUrls : [];
|
|
76
|
+
const imageUrls = urls.filter(
|
|
77
|
+
(url): url is string => typeof url === "string" && /^file:\/\/[^<>\s]+$/i.test(url),
|
|
78
|
+
);
|
|
79
|
+
if (imageUrls.length) return { kind: "you", key, text: item.text, imageUrls };
|
|
67
80
|
return item.text.trim() ? { kind: "you", key, text: item.text } : null;
|
|
81
|
+
}
|
|
68
82
|
case "assistant_message":
|
|
69
83
|
return item.text.trim() ? { kind: "agent", key, text: item.text } : null;
|
|
70
84
|
case "tool_call":
|
|
71
|
-
return
|
|
85
|
+
return toolRow(key, item);
|
|
72
86
|
case "error":
|
|
73
87
|
return item.message.trim()
|
|
74
88
|
? { kind: "notice", key, text: item.message, tone: "danger" }
|
|
@@ -130,7 +144,7 @@ export function conversationRows(entries: readonly TimelineEntry[]): Conversatio
|
|
|
130
144
|
if (known && item.type === "tool_call" && sameTurn(entry.turnId, known.turnId)) {
|
|
131
145
|
const merged = mergedCall(known.item, item);
|
|
132
146
|
calls.set(item.callId, { index: known.index, item: merged, turnId: known.turnId });
|
|
133
|
-
rows[known.index] =
|
|
147
|
+
rows[known.index] = toolRow(rows[known.index].key, merged);
|
|
134
148
|
open = false;
|
|
135
149
|
continue;
|
|
136
150
|
}
|