@hanzo/app 0.3.85 → 0.3.87
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/dist/App.js +2 -2
- package/dist/Recents.js +1 -1
- package/dist/bots/Bots.d.ts +0 -4
- package/dist/bots/Bots.js +99 -67
- package/dist/bots/ComputerDialog.d.ts +9 -0
- package/dist/bots/ComputerDialog.js +175 -0
- package/dist/bots/ConnectorsDialog.d.ts +2 -0
- package/dist/bots/ConnectorsDialog.js +188 -82
- package/dist/bots/Groups.d.ts +26 -0
- package/dist/bots/Groups.js +284 -0
- package/dist/bots/Make.d.ts +3 -1
- package/dist/bots/Make.js +28 -13
- package/dist/bots/Panel.d.ts +5 -1
- package/dist/bots/Panel.js +172 -43
- package/dist/bots/Roster.d.ts +4 -1
- package/dist/bots/Roster.js +30 -13
- package/dist/bots/api.d.ts +169 -8
- package/dist/bots/api.js +157 -7
- package/dist/bots/grid.d.ts +8 -1
- package/dist/bots/grid.js +58 -8
- package/package.json +1 -1
package/dist/bots/Panel.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The open bot's right inspector panel:
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// The open bot's right inspector panel:
|
|
4
|
+
// - Avatar, Primary Bot ("hanzo" · Layer 0) status, [Activity | Library] segmented tabs
|
|
5
|
+
// - Hierarchy & Layer role card (Primary Bot promotion, Bot Group assignment, Layer 0..3)
|
|
6
|
+
// - Slack Sync & Channel Routing card (one-click Add to Slack, Sync Channels, default @hanzo responder, #channel bindings)
|
|
7
|
+
// - Upcoming routines & connected networks
|
|
8
|
+
// - Connectors launcher
|
|
9
|
+
// - Dedicated Desktop Sandbox Computer card opening ComputerDialog (live GUI + Terminal + Computer Use)
|
|
10
|
+
// - Voice chat preferences
|
|
6
11
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
12
|
import { useI18n } from '@hanzo/i18n/react';
|
|
8
13
|
import { Text, XStack, YStack } from '@hanzo/gui';
|
|
9
14
|
import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Switch, } from '@hanzo/ui';
|
|
10
|
-
import { ChevronDown, ChevronRight, Clock, FileText, Image as ImageIcon, Plus, X } from 'lucide-react';
|
|
15
|
+
import { ChevronDown, ChevronRight, Clock, ExternalLink, FileText, Image as ImageIcon, Layers, Plus, RefreshCw, Star, X, } from 'lucide-react';
|
|
11
16
|
import { useKept } from '../kept.js';
|
|
12
17
|
import { useAi } from '../lib/ai.js';
|
|
13
18
|
import { say } from '../failure.js';
|
|
14
19
|
import { Network, of } from '../network.js';
|
|
15
20
|
import { called } from '../team.js';
|
|
21
|
+
import { ComputerDialog } from './ComputerDialog.js';
|
|
16
22
|
import { ConnectorsDialog } from './ConnectorsDialog.js';
|
|
17
23
|
import { Face } from './face.js';
|
|
18
|
-
import { ALWAYS, answering, disk,
|
|
24
|
+
import { ALWAYS, PRIMARY_BOT, answering, disk, setAnswering, setPrimaryBot, slackAuthorizeUrl, slackChannels, slackStatus, slackSyncChannels, toGroupRef, updateBotMeta, } from './api.js';
|
|
19
25
|
import { CARD, CLIP, LABEL, PILL, ROUND, WORD } from './kit.js';
|
|
20
|
-
import { DIM, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
26
|
+
import { DIM, GROUND, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
21
27
|
import { partsOf } from './said.js';
|
|
22
28
|
import { cron as words } from './time.js';
|
|
23
29
|
const VOICES = ['Liora', 'Aria', 'Sol', 'Koe', 'Nova', 'Echo'];
|
|
24
30
|
const SPEEDS = ['0.9x', '1x', '1.25x', '1.5x', '2x'];
|
|
25
31
|
const LANGUAGES = ['Auto-detect', 'English', 'Spanish', 'French', 'German', 'Japanese', 'Chinese'];
|
|
26
|
-
/** One row of a card: a mark, two lines, and whatever acts on it. */
|
|
27
32
|
function Row({ mark, title, line, children, last, }) {
|
|
28
33
|
return (_jsxs(XStack, { minH: 52, px: 13, py: 9, gap: 11, items: "center", borderBottomWidth: last ? 0 : 1, borderColor: LINE, children: [mark, _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: title }), line ? (_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: DIM, children: line })) : null] }), children] }));
|
|
29
34
|
}
|
|
@@ -33,45 +38,55 @@ function VoiceRow({ label, value, options, onSelect, last, }) {
|
|
|
33
38
|
function ComputerScreen({ awake }) {
|
|
34
39
|
return (_jsx(YStack, { "aria-hidden": true, width: 56, height: 36, rounded: 9, shrink: 0, items: "center", justify: "center", position: "relative", overflow: "hidden", bg: PICKED, borderWidth: 1, borderColor: LINE, children: awake ? (_jsx(YStack, { width: 10, height: 10, rounded: 999, bg: "var(--state-online)" })) : (_jsxs(_Fragment, { children: [_jsx(Text, { position: "absolute", t: 2, r: 6, fontSize: 9, lineHeight: 10, fontWeight: "600", color: DIM, children: "z" }), _jsxs("svg", { width: "20", height: "18", viewBox: "0 0 20 18", fill: "none", "aria-hidden": "true", children: [_jsx("path", { d: "M10 16.2C10 16.2 2.5 11.4 2.5 6.3C2.5 3.8 4.4 2 6.7 2C8.1 2 9.3 2.7 10 3.8C10.7 2.7 11.9 2 13.3 2C15.6 2 17.5 3.8 17.5 6.3C17.5 11.4 10 16.2 10 16.2Z", fill: "currentColor", opacity: "0.34" }), _jsx("circle", { cx: "8.1", cy: "7.9", r: "0.9", fill: "var(--pane-fill, var(--card))" }), _jsx("circle", { cx: "11.9", cy: "7.9", r: "0.9", fill: "var(--pane-fill, var(--card))" })] })] })) }));
|
|
35
40
|
}
|
|
36
|
-
|
|
37
|
-
function state(box, t) {
|
|
41
|
+
function stateLabel(box, t) {
|
|
38
42
|
if (!box)
|
|
39
|
-
return t('Asleep');
|
|
43
|
+
return t('Asleep · click for Desktop GUI');
|
|
40
44
|
if (box.status === 'running')
|
|
41
|
-
return t('Awake');
|
|
45
|
+
return t('Awake · Desktop GUI & Shell');
|
|
42
46
|
if (box.status === 'pending')
|
|
43
|
-
return t('Waking');
|
|
44
|
-
return box.error || t('
|
|
47
|
+
return t('Waking desktop…');
|
|
48
|
+
return box.error || t('Parked · click to wake');
|
|
45
49
|
}
|
|
46
50
|
const best = (boxes) => boxes.find((b) => b.status === 'running') ?? boxes.find((b) => b.status === 'pending') ?? boxes[0] ?? null;
|
|
47
51
|
const POLL = 5000;
|
|
48
|
-
export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, focus = false, }) {
|
|
52
|
+
export function Panel({ bot, groups = [], runs = [], onClose, kept, onSchedule, onDelete, onBotChanged, onPickGroup, focus = false, }) {
|
|
49
53
|
const { t, locale } = useI18n();
|
|
50
54
|
const { client } = useAi();
|
|
55
|
+
const ext = bot;
|
|
56
|
+
const isPrimary = Boolean(ext.isPrimary || bot.name.toLowerCase() === PRIMARY_BOT);
|
|
57
|
+
const currentLayer = isPrimary ? 0 : (ext.layer ?? 1);
|
|
51
58
|
const [tab, setTab] = useState('activity');
|
|
52
59
|
const [instructions, setInstructions] = useState('');
|
|
53
60
|
const [answers, setAnswers] = useState([]);
|
|
54
61
|
const [box, setBox] = useState(null);
|
|
55
|
-
const [
|
|
56
|
-
const [busy, setBusy] = useState(false);
|
|
62
|
+
const [computerOpen, setComputerOpen] = useState(false);
|
|
57
63
|
const [saving, setSaving] = useState(false);
|
|
58
64
|
const [wrong, setWrong] = useState(null);
|
|
59
65
|
const [deleting, setDeleting] = useState(false);
|
|
60
66
|
const [connectorsOpen, setConnectorsOpen] = useState(false);
|
|
67
|
+
// Slack workspace + channel routing state
|
|
68
|
+
const [slackConn, setSlackConn] = useState({ connected: false });
|
|
69
|
+
const [slackDefault, setSlackDefault] = useState(PRIMARY_BOT);
|
|
70
|
+
const [slackChans, setSlackChans] = useState([]);
|
|
71
|
+
const [slackBound, setSlackBound] = useState({});
|
|
72
|
+
const [slackBusy, setSlackBusy] = useState(false);
|
|
73
|
+
const [slackNote, setSlackNote] = useState(null);
|
|
61
74
|
const [voiceName, setVoiceName] = useKept('hanzo.bots.voice.name', 'Liora');
|
|
62
75
|
const [voiceSpeed, setVoiceSpeed] = useKept('hanzo.bots.voice.speed', '1x');
|
|
63
76
|
const [voiceLang, setVoiceLang] = useKept('hanzo.bots.voice.lang', 'Auto-detect');
|
|
64
77
|
const displayName = called(bot.name);
|
|
65
78
|
const cron = bot.schedule || kept;
|
|
66
79
|
const activeSchedule = bot.executionMode === ALWAYS && Boolean(bot.schedule);
|
|
80
|
+
const assignedGroup = useMemo(() => groups.find((g) => g.id === ext.groupId || g.name === ext.groupId || g.members.includes(bot.name)) ?? null, [groups, ext.groupId, bot.name]);
|
|
67
81
|
const survey = useCallback(async (signal) => {
|
|
68
82
|
if (!client)
|
|
69
83
|
return;
|
|
70
84
|
const opts = signal ? { signal } : undefined;
|
|
71
|
-
const [detail, nets, boxes] = await Promise.allSettled([
|
|
85
|
+
const [detail, nets, boxes, slk] = await Promise.allSettled([
|
|
72
86
|
client.agents.get(bot.name, opts),
|
|
73
87
|
client.transports.list(opts),
|
|
74
88
|
client.sandboxes.list({ project: disk(bot.name) }, opts),
|
|
89
|
+
slackStatus(signal),
|
|
75
90
|
]);
|
|
76
91
|
if (signal?.aborted)
|
|
77
92
|
return;
|
|
@@ -79,7 +94,22 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
79
94
|
setInstructions(detail.value.instructions ?? '');
|
|
80
95
|
if (boxes.status === 'fulfilled') {
|
|
81
96
|
setBox(best(boxes.value));
|
|
82
|
-
|
|
97
|
+
}
|
|
98
|
+
if (slk.status === 'fulfilled') {
|
|
99
|
+
setSlackConn(slk.value);
|
|
100
|
+
if (slk.value.connected) {
|
|
101
|
+
const [ans, chs] = await Promise.all([
|
|
102
|
+
answering(client, 'slack', signal).catch(() => null),
|
|
103
|
+
slackChannels(signal),
|
|
104
|
+
]);
|
|
105
|
+
if (!signal?.aborted) {
|
|
106
|
+
if (ans) {
|
|
107
|
+
setSlackDefault(ans.default || PRIMARY_BOT);
|
|
108
|
+
setSlackBound(ans.channels || {});
|
|
109
|
+
}
|
|
110
|
+
setSlackChans(chs);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
83
113
|
}
|
|
84
114
|
if (nets.status === 'fulfilled') {
|
|
85
115
|
const connected = nets.value.filter((n) => n.connected);
|
|
@@ -89,7 +119,7 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
89
119
|
setAnswers(connected
|
|
90
120
|
.filter((_, i) => {
|
|
91
121
|
const r = bound[i];
|
|
92
|
-
return r.status === 'fulfilled' && r.value.default === bot.name;
|
|
122
|
+
return r.status === 'fulfilled' && (r.value.default || PRIMARY_BOT) === bot.name;
|
|
93
123
|
})
|
|
94
124
|
.map((n) => n.id));
|
|
95
125
|
}
|
|
@@ -114,35 +144,122 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
114
144
|
stop.abort();
|
|
115
145
|
};
|
|
116
146
|
}, [client, box?.status, bot.name]);
|
|
117
|
-
const
|
|
118
|
-
if (!client ||
|
|
147
|
+
const promotePrimary = async () => {
|
|
148
|
+
if (!client || saving)
|
|
119
149
|
return;
|
|
120
|
-
|
|
150
|
+
setSaving(true);
|
|
121
151
|
setWrong(null);
|
|
122
|
-
const win = box?.status === 'running' ? window.open('', '_blank') : null;
|
|
123
152
|
try {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
153
|
+
await setPrimaryBot(client, bot.name);
|
|
154
|
+
await onBotChanged?.();
|
|
155
|
+
await survey();
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
setWrong(say(e, displayName, 'save', t));
|
|
159
|
+
}
|
|
160
|
+
finally {
|
|
161
|
+
setSaving(false);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const assignLayer = async (lv) => {
|
|
165
|
+
if (!client || saving)
|
|
166
|
+
return;
|
|
167
|
+
setSaving(true);
|
|
168
|
+
setWrong(null);
|
|
169
|
+
try {
|
|
170
|
+
await updateBotMeta(client, bot.name, { layer: lv });
|
|
171
|
+
await onBotChanged?.();
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
setWrong(say(e, displayName, 'save', t));
|
|
175
|
+
}
|
|
176
|
+
finally {
|
|
177
|
+
setSaving(false);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const assignGroup = async (groupId) => {
|
|
181
|
+
if (!client || saving)
|
|
182
|
+
return;
|
|
183
|
+
setSaving(true);
|
|
184
|
+
setWrong(null);
|
|
185
|
+
try {
|
|
186
|
+
await updateBotMeta(client, bot.name, { groupId });
|
|
187
|
+
await onBotChanged?.();
|
|
188
|
+
}
|
|
189
|
+
catch (e) {
|
|
190
|
+
setWrong(say(e, displayName, 'save', t));
|
|
191
|
+
}
|
|
192
|
+
finally {
|
|
193
|
+
setSaving(false);
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
const connectSlack = async () => {
|
|
197
|
+
setSlackBusy(true);
|
|
198
|
+
setSlackNote(null);
|
|
199
|
+
try {
|
|
200
|
+
const url = await slackAuthorizeUrl();
|
|
201
|
+
if (url) {
|
|
202
|
+
window.open(url, '_blank', 'noopener,noreferrer');
|
|
203
|
+
setSlackNote(t('Approve Slack in the opened tab — channels sync automatically when connected.'));
|
|
134
204
|
}
|
|
135
|
-
else
|
|
136
|
-
|
|
137
|
-
await survey();
|
|
205
|
+
else {
|
|
206
|
+
setConnectorsOpen(true);
|
|
138
207
|
}
|
|
139
208
|
}
|
|
209
|
+
catch {
|
|
210
|
+
setConnectorsOpen(true);
|
|
211
|
+
}
|
|
212
|
+
finally {
|
|
213
|
+
setSlackBusy(false);
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
const syncSlack = async () => {
|
|
217
|
+
setSlackBusy(true);
|
|
218
|
+
setSlackNote(null);
|
|
219
|
+
try {
|
|
220
|
+
const res = await slackSyncChannels();
|
|
221
|
+
setSlackNote(res.ok
|
|
222
|
+
? res.joined !== undefined
|
|
223
|
+
? t('Synced @hanzo into {n} Slack channels.', { n: res.joined })
|
|
224
|
+
: t('Synced @hanzo into workspace Slack channels.')
|
|
225
|
+
: t('Could not sync channels — ensure Slack is connected by an org admin.'));
|
|
226
|
+
await survey();
|
|
227
|
+
}
|
|
228
|
+
finally {
|
|
229
|
+
setSlackBusy(false);
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
const toggleSlackDefault = async (on) => {
|
|
233
|
+
if (!client || slackBusy)
|
|
234
|
+
return;
|
|
235
|
+
setSlackBusy(true);
|
|
236
|
+
try {
|
|
237
|
+
const target = on ? bot.name : PRIMARY_BOT;
|
|
238
|
+
const ans = await setAnswering(client, { transport: 'slack', default: target });
|
|
239
|
+
setSlackDefault(ans.default || PRIMARY_BOT);
|
|
240
|
+
await survey();
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
setWrong(say(e, t('Slack responder'), 'save', t));
|
|
244
|
+
}
|
|
245
|
+
finally {
|
|
246
|
+
setSlackBusy(false);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
const toggleSlackChannel = async (channelId) => {
|
|
250
|
+
if (!client || slackBusy)
|
|
251
|
+
return;
|
|
252
|
+
setSlackBusy(true);
|
|
253
|
+
try {
|
|
254
|
+
const boundToMe = slackBound[channelId] === bot.name;
|
|
255
|
+
const ans = await setAnswering(client, boundToMe ? { transport: 'slack', unbind: [channelId] } : { transport: 'slack', channels: { [channelId]: bot.name } });
|
|
256
|
+
setSlackBound(ans.channels || {});
|
|
257
|
+
}
|
|
140
258
|
catch (e) {
|
|
141
|
-
|
|
142
|
-
setWrong(say(e, t('{name}’s computer', { name: displayName }), 'save', t));
|
|
259
|
+
setWrong(say(e, t('Slack channel routing'), 'save', t));
|
|
143
260
|
}
|
|
144
261
|
finally {
|
|
145
|
-
|
|
262
|
+
setSlackBusy(false);
|
|
146
263
|
}
|
|
147
264
|
};
|
|
148
265
|
const routine = cron ? bot.description || instructions.split('\n')[0].trim() || displayName : '';
|
|
@@ -171,19 +288,31 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
171
288
|
}
|
|
172
289
|
return items.reverse();
|
|
173
290
|
}, [runs, t]);
|
|
174
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": displayName, render: "aside", children: [_jsx(XStack, { height: 46, shrink: 0, px: 12, items: "center", justify: "flex-end", children: _jsx(XStack, { ...ROUND, "aria-label": t('Close'), onClick: onClose, autoFocus: focus, children: _jsx(X, { size: 16, color: INK, "aria-hidden": true }) }) }), _jsxs(YStack, { items: "center", gap:
|
|
291
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": displayName, render: "aside", children: [_jsx(XStack, { height: 46, shrink: 0, px: 12, items: "center", justify: "flex-end", children: _jsx(XStack, { ...ROUND, "aria-label": t('Close'), onClick: onClose, autoFocus: focus, children: _jsx(X, { size: 16, color: INK, "aria-hidden": true }) }) }), _jsxs(YStack, { items: "center", gap: 8, pt: 2, pb: 18, px: 14, children: [_jsx(Face, { bot: bot, size: 68, starred: isPrimary }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 18, lineHeight: 23, fontWeight: "600", color: INK, children: displayName }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: isPrimary ? t('Primary Bot · Layer 0 (Directs all bots)') : t('Layer {lv} Bot', { lv: currentLayer }) }), _jsx(XStack, { "data-parity-key": "bots.panel.tabs", role: "tablist", p: 3, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, gap: 2, children: ['activity', 'library'].map((id) => {
|
|
175
292
|
const selected = tab === id;
|
|
176
293
|
return (_jsx(XStack, { render: "button", type: 'button', role: 'tab', 'aria-selected': selected, onClick: () => setTab(id), height: 28, px: 14, rounded: 999, items: "center", justify: "center", bg: selected ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: selected ? '500' : '400', color: selected ? INK : DIM, children: id === 'activity' ? t('Activity') : t('Library') }) }, id));
|
|
177
|
-
}) })] }), tab === 'activity' ? (_jsxs(YStack, { px: 15, pb: 24, gap:
|
|
294
|
+
}) })] }), tab === 'activity' ? (_jsxs(YStack, { px: 15, pb: 24, gap: 18, children: [_jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.hierarchy", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Hierarchy & Coordination') }), _jsxs(YStack, { ...CARD, children: [_jsx(Row, { mark: isPrimary ? _jsx(Star, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Layers, { size: 16, color: DIM, "aria-hidden": true }), title: isPrimary ? t('Primary Bot (Max 1)') : t('Subordinate Bot'), line: isPrimary
|
|
295
|
+
? t('Directs worker bots & layered Bot Groups')
|
|
296
|
+
: t('Directed by Primary Bot ({primary})', { primary: PRIMARY_BOT }), last: isPrimary && groups.length === 0, children: !isPrimary ? (_jsx(XStack, { render: "button", type: 'button', disabled: saving, onClick: () => void promotePrimary(), height: 26, px: 9, rounded: 999, items: "center", bg: GROUND, borderWidth: 1, borderColor: LINE, cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "500", color: INK, children: t('Make Primary') }) })) : null }), !isPrimary ? (_jsx(VoiceRow, { label: t('Layer'), value: `Layer ${currentLayer}`, options: ['Layer 1', 'Layer 2', 'Layer 3'], onSelect: (opt) => void assignLayer(Number(opt.replace('Layer ', '')) || 1), last: groups.length === 0 })) : null, groups.length > 0 ? (_jsxs(XStack, { minH: 44, px: 14, items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 14, lineHeight: 19, color: INK, children: t('Group') }), _jsxs(XStack, { items: "center", gap: 6, children: [assignedGroup && onPickGroup ? (_jsx(XStack, { render: "button", type: 'button', onClick: () => onPickGroup(toGroupRef(assignedGroup.name)), px: 8, py: 3, rounded: 999, bg: PICKED, borderWidth: 1, borderColor: LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 11, lineHeight: 15, color: INK, children: t('Open') }) })) : null, _jsxs(DropdownMenu, { placement: "bottom-end", offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', items: "center", gap: 5, px: 6, py: 4, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, color: INK, children: assignedGroup ? assignedGroup.name : t('None') }), _jsx(ChevronDown, { size: 14, color: DIM, "aria-hidden": true })] }) }), _jsxs(DropdownMenuContent, { minW: 170, children: [_jsx(DropdownMenuItem, { onSelect: () => void assignGroup(''), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('None') }) }), groups.map((g) => (_jsx(DropdownMenuItem, { onSelect: () => void assignGroup(g.id), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: `${g.name} (L${g.layer || 1})` }) }, g.id)))] })] })] })] })) : null] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.slack", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Slack Agent Sync') }), slackConn.connected ? (_jsxs(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void syncSlack(), items: "center", gap: 4, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(RefreshCw, { size: 11, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: t('Sync channels') })] })) : null] }), _jsxs(YStack, { ...CARD, children: [_jsx(Row, { mark: _jsx(Network, { transport: "slack", size: 20 }), title: slackConn.connected ? (slackConn.account ? `Slack · ${slackConn.account}` : t('Slack Connected')) : t('Add @hanzo to Slack'), line: slackConn.connected
|
|
297
|
+
? slackDefault === bot.name
|
|
298
|
+
? t('Answers @hanzo in Slack by default')
|
|
299
|
+
: t('Default responder: {def}', { def: slackDefault })
|
|
300
|
+
: t('Sync channels, threads, and DMs like @hanzo'), last: !slackConn.connected, children: slackConn.connected ? (_jsx(Switch, { "aria-label": t('Answer @hanzo in Slack with {name}', { name: displayName }), checked: slackDefault === bot.name, disabled: slackBusy, onCheckedChange: (on) => void toggleSlackDefault(on) })) : (_jsxs(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void connectSlack(), height: 28, px: 10, rounded: 999, items: "center", gap: 5, bg: INK, borderWidth: 1, borderColor: INK, cursor: "pointer", children: [_jsx(ExternalLink, { size: 11, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "500", color: "var(--background)", children: t('Add to Slack') })] })) }), slackConn.connected && slackChans.length > 0 ? (_jsxs(YStack, { px: 13, py: 9, gap: 6, children: [_jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: t('Bind channels directly to {name}:', { name: displayName }) }), _jsx(XStack, { flexWrap: "wrap", gap: 5, children: slackChans.slice(0, 8).map((ch) => {
|
|
301
|
+
const mine = slackBound[ch.id] === bot.name;
|
|
302
|
+
return (_jsx(XStack, { render: "button", type: 'button', disabled: slackBusy, onClick: () => void toggleSlackChannel(ch.id), height: 24, px: 8, rounded: 999, items: "center", bg: mine ? INK : GROUND, borderWidth: 1, borderColor: mine ? INK : LINE, cursor: "pointer", children: _jsx(Text, { fontSize: 11, lineHeight: 15, color: mine ? 'var(--background)' : INK, children: `#${ch.name}` }) }, ch.id));
|
|
303
|
+
}) })] })) : null] }), slackNote ? (_jsx(Text, { fontSize: 11, lineHeight: 16, color: DIM, px: 4, children: slackNote })) : null] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Desktop Computer') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setComputerOpen(true), "aria-label": t('Open {name}’s desktop computer', { name: displayName }), minH: 60, px: 13, py: 10, items: "center", gap: 12, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t("Bot's computer") }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: stateLabel(box, t) })] }), _jsx(ComputerScreen, { awake: box?.status === 'running' })] })] }), cron || answers.length ? (_jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.upcoming", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Upcoming') }), cron ? (_jsx(YStack, { ...CARD, children: _jsx(Row, { mark: _jsx(Clock, { size: 16, color: DIM, "aria-hidden": true }), title: routine, line: scheduleLine, last: true, children: _jsx(Switch, { "aria-label": t('Run {name} on its schedule', { name: displayName }), checked: activeSchedule, disabled: saving, onCheckedChange: (on) => {
|
|
178
304
|
setWrong(null);
|
|
179
305
|
setSaving(true);
|
|
180
306
|
onSchedule(on, cron === 'paused' ? '0 9 * * *' : cron)
|
|
181
307
|
.catch((e) => setWrong(say(e, t('{name}’s schedule', { name: displayName }), 'save', t)))
|
|
182
308
|
.finally(() => setSaving(false));
|
|
183
|
-
} }) }) })) : null, answers.length ? (_jsx(YStack, { ...CARD, "data-parity-key": "bots.panel.networks", children: answers.map((id, i) => (_jsx(Row, { mark: _jsx(Network, { transport: id, size: 18 }), title: of(id).name, line: t('Connected'), last: i === answers.length - 1, children: _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) }, id))) })) : null] })) : null, _jsxs(YStack, { gap:
|
|
309
|
+
} }) }) })) : null, answers.length ? (_jsx(YStack, { ...CARD, "data-parity-key": "bots.panel.networks", children: answers.map((id, i) => (_jsx(Row, { mark: _jsx(Network, { transport: id, size: 18 }), title: of(id).name, line: t('Connected'), last: i === answers.length - 1, children: _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) }, id))) })) : null] })) : null, _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.connectors", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Connectors') }), _jsxs(XStack, { render: "button", type: 'button', onClick: () => setConnectorsOpen(true), items: "center", gap: 3, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Plus, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: t('Add') })] })] }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setConnectorsOpen(true), minH: 50, px: 13, py: 9, items: "center", justify: "space-between", gap: 10, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: answers.length ? t('{n} channels connected', { n: answers.length }) : t('Connect Slack, GitHub, Linear, Stripe…') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: t('External apps, socials & MCP tools') })] }), _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true })] })] }), _jsxs(YStack, { gap: 8, "data-parity-key": "bots.panel.voice", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Voice chat') }), _jsxs(YStack, { ...CARD, children: [_jsx(VoiceRow, { label: t('Voice'), value: voiceName, options: VOICES, onSelect: setVoiceName }), _jsx(VoiceRow, { label: t('Speed'), value: voiceSpeed, options: SPEEDS, onSelect: setVoiceSpeed }), _jsx(VoiceRow, { label: t('Language'), value: voiceLang, options: LANGUAGES, onSelect: setVoiceLang, last: true })] })] }), wrong ? (_jsx(Text, { render: "p", role: "alert", px: 8, m: 0, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, !isPrimary ? (_jsx(XStack, { px: 8, pt: 4, children: _jsx(Text, { render: "button", type: 'button', onClick: () => setDeleting(true), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", fontSize: 13, lineHeight: 18, color: DIM, hoverStyle: { color: INK }, children: t('Delete {name}', { name: displayName }) }) })) : null] })) : (_jsx(YStack, { px: 15, pb: 24, gap: 12, "data-parity-key": "bots.panel.library", children: libraryItems.length ? (_jsx(YStack, { ...CARD, children: libraryItems.map((item, i) => (_jsx(Row, { mark: item.kind === 'doc' ? _jsx(FileText, { size: 16, color: DIM, "aria-hidden": true }) : _jsx(ImageIcon, { size: 16, color: DIM, "aria-hidden": true }), title: item.label, line: item.sub, last: i === libraryItems.length - 1, children: item.href ? _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) : null }, item.key))) })) : (_jsx(YStack, { ...CARD, px: 14, py: 16, items: "center", children: _jsx(Text, { fontSize: 13, lineHeight: 19, color: DIM, text: "center", children: t('Files, documents, and images shared with {name} appear here.', { name: displayName }) }) })) })), _jsx(Dialog, { open: deleting, onOpenChange: setDeleting, children: _jsxs(DialogContent, { maxW: 440, rounded: 20, gap: 14, children: [_jsx(DialogTitle, { children: t('Delete {name}?', { name: displayName }) }), _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: t('{name} and every message it was sent are deleted for good.', { name: displayName }) }), _jsxs(XStack, { gap: 8, justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => setDeleting(false), children: t('Cancel') }), _jsx(XStack, { ...PILL, height: 34, bg: INK, borderColor: INK, hoverStyle: { bg: INK, opacity: 0.9 }, onClick: () => {
|
|
184
310
|
if (!deleting)
|
|
185
311
|
return;
|
|
186
312
|
setDeleting(false);
|
|
187
313
|
onDelete().catch((e) => setWrong(say(e, displayName, 'save', t)));
|
|
188
|
-
}, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) }), _jsx(
|
|
314
|
+
}, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) }), _jsx(ComputerDialog, { open: computerOpen, onOpenChange: setComputerOpen, bot: ext, box: box, onUpdated: async () => {
|
|
315
|
+
await survey();
|
|
316
|
+
await onBotChanged?.();
|
|
317
|
+
} }), _jsx(ConnectorsDialog, { open: connectorsOpen, onOpenChange: setConnectorsOpen, defaultFilter: "all", onConnected: () => void survey() })] }));
|
|
189
318
|
}
|
package/dist/bots/Roster.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { Agent, AgentRun } from '@hanzo/ai';
|
|
2
|
-
|
|
2
|
+
import { type BotGroup } from './api.js';
|
|
3
|
+
export declare function Roster({ bots, groups, last, open, unread, me, onPick, onMake, onMakeGroup, disabled, }: {
|
|
3
4
|
bots: Agent[] | null;
|
|
5
|
+
groups?: readonly BotGroup[];
|
|
4
6
|
last: ReadonlyMap<string, AgentRun>;
|
|
5
7
|
open: string | null;
|
|
6
8
|
unread: string | null;
|
|
7
9
|
me: unknown;
|
|
8
10
|
onPick: (name: string) => void;
|
|
9
11
|
onMake: () => void;
|
|
12
|
+
onMakeGroup?: () => void;
|
|
10
13
|
disabled: boolean;
|
|
11
14
|
}): import("react").JSX.Element;
|
package/dist/bots/Roster.js
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The roster: search and
|
|
4
|
-
//
|
|
5
|
-
// the
|
|
3
|
+
// The roster: search, + Group, and + New bot at the top; Primary Bot ("hanzo")
|
|
4
|
+
// leading the 3x4 grid of faces; layered Bot Groups (Layer 1, Layer 2+) with
|
|
5
|
+
// policy badges; the remaining bots as rows with their last word; and the reader
|
|
6
|
+
// + Connectors + Preferences at the foot.
|
|
6
7
|
import { useEffect, useMemo, useState } from 'react';
|
|
7
8
|
import { useI18n } from '@hanzo/i18n/react';
|
|
8
9
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
9
10
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@hanzo/ui';
|
|
10
|
-
import { Grid2x2Plus, Plus, Search, SlidersHorizontal, X } from 'lucide-react';
|
|
11
|
+
import { Grid2x2Plus, Layers, Plus, Search, SlidersHorizontal, Users, X } from 'lucide-react';
|
|
11
12
|
import { useSignOut } from '../lib/signout.js';
|
|
12
13
|
import { PreferencesDialog } from '../PreferencesDialog.js';
|
|
13
|
-
import { called
|
|
14
|
+
import { called } from '../team.js';
|
|
14
15
|
import { ConnectorsDialog } from './ConnectorsDialog.js';
|
|
15
16
|
import { Face } from './face.js';
|
|
17
|
+
import { PRIMARY_BOT, toGroupRef } from './api.js';
|
|
16
18
|
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
17
19
|
import { DIM, FLOOR, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
18
|
-
import { lastWord, split } from './grid.js';
|
|
19
|
-
export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled, }) {
|
|
20
|
+
import { isStarredBot, lastWord, policyBadge, sortGroupsByLayer, split } from './grid.js';
|
|
21
|
+
export function Roster({ bots, groups = [], last, open, unread, me, onPick, onMake, onMakeGroup, disabled, }) {
|
|
20
22
|
const { t } = useI18n();
|
|
21
23
|
const [seeking, setSeeking] = useState(false);
|
|
22
24
|
const [query, setQuery] = useState('');
|
|
@@ -29,15 +31,30 @@ export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled,
|
|
|
29
31
|
(b.description ?? '').toLowerCase().includes(q))
|
|
30
32
|
: all;
|
|
31
33
|
}, [bots, query]);
|
|
34
|
+
const shownGroups = useMemo(() => {
|
|
35
|
+
const sorted = sortGroupsByLayer(groups);
|
|
36
|
+
const q = query.trim().toLowerCase();
|
|
37
|
+
if (!q)
|
|
38
|
+
return sorted;
|
|
39
|
+
return sorted.filter((g) => g.name.toLowerCase().includes(q) ||
|
|
40
|
+
(g.description ?? '').toLowerCase().includes(q) ||
|
|
41
|
+
policyBadge(g.policy).toLowerCase().includes(q));
|
|
42
|
+
}, [groups, query]);
|
|
32
43
|
const { grid, rows } = useMemo(() => split(shown, last), [shown, last]);
|
|
33
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height: 46, shrink: 0, px: 12, items: "center", justify: "
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height: 46, shrink: 0, px: 12, items: "center", justify: "space-between", gap: 8, children: [_jsx(XStack, { items: "center", gap: 6, pl: 2, children: _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "600", color: DIM, children: t('hanzo.bot') }) }), _jsxs(XStack, { items: "center", gap: 6, children: [_jsx(XStack, { ...ROUND, "aria-label": t(seeking ? 'Close search' : 'Search bots'), "aria-pressed": seeking, onClick: () => {
|
|
45
|
+
setSeeking(!seeking);
|
|
46
|
+
setQuery('');
|
|
47
|
+
}, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), onMakeGroup ? (_jsx(XStack, { ...ROUND, "aria-label": t('New bot group'), onClick: onMakeGroup, disabled: disabled, opacity: disabled ? 0.5 : 1, children: _jsx(Users, { size: 15, color: INK, "aria-hidden": true }) })) : null, _jsx(XStack, { ...ROUND, "aria-label": t('New bot'), onClick: onMake, disabled: disabled, opacity: disabled ? 0.5 : 1, children: _jsx(Plus, { size: 18, color: INK, "aria-hidden": true }) })] })] }), seeking ? (_jsx(XStack, { px: 10, pb: 8, shrink: 0, children: _jsx(Input, { unstyled: true, autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search bots & groups'), "aria-label": t('Search bots'), width: "100%", height: 34, px: 12, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 14, placeholderTextColor: "$placeholderColor" }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: [unread ? (_jsx(Text, { render: "p", px: 16, py: 8, fontSize: 13, lineHeight: 18, color: DIM, children: unread })) : null, bots && bots.length === 0 && !unread && !disabled ? (_jsxs(YStack, { display: "none", "$max-md": { display: 'flex' }, items: "center", gap: 16, pt: 140, px: 20, children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null, grid.length ? (_jsx(XStack, { "data-parity-key": "bots.grid", role: "group", "aria-label": t('Bots'), flexWrap: "wrap", px: 9, pt: 4, columnGap: 3, rowGap: 10, "$max-md": { px: 12, columnGap: 0, justify: 'space-between' }, children: grid.map((b) => {
|
|
48
|
+
const ext = b;
|
|
37
49
|
const here = b.name === open;
|
|
50
|
+
const isPrimary = Boolean(ext.isPrimary || b.name.toLowerCase() === PRIMARY_BOT);
|
|
38
51
|
const label = called(b.name);
|
|
39
|
-
return (_jsxs(YStack, { render: "button", type: 'button', "data-parity-key": "bots.tile", "data-name": b.name, "aria-current": here, "aria-label": label, onClick: () => onPick(b.name), width: 78, height:
|
|
40
|
-
}) })) : null,
|
|
52
|
+
return (_jsxs(YStack, { render: "button", type: 'button', "data-parity-key": "bots.tile", "data-name": b.name, "data-primary": isPrimary ? 'true' : undefined, "aria-current": here, "aria-label": isPrimary ? `${label} (${t('Primary Bot')})` : label, onClick: () => onPick(b.name), width: 78, height: 92, rounded: 11, items: "center", pt: 5, gap: 4, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, "$max-md": { width: '33%' }, children: [_jsx(Face, { bot: b, size: 54, starred: isStarredBot(b) }), _jsx(Text, { ...CLIP, maxW: 72, fontSize: 13, lineHeight: 16, fontWeight: here || isPrimary ? '600' : '400', color: INK, children: label }), isPrimary ? (_jsx(Text, { fontSize: 10, lineHeight: 11, color: DIM, children: t('Primary') })) : null] }, b.id || b.name));
|
|
53
|
+
}) })) : null, shownGroups.length > 0 || (onMakeGroup && !disabled) ? (_jsxs(YStack, { "data-parity-key": "bots.groups", role: "group", "aria-label": t('Bot groups'), pt: 14, pb: 6, children: [_jsxs(XStack, { px: 16, pb: 6, items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: 5, children: [_jsx(Layers, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "600", color: DIM, children: t('GROUPS & LAYERS') })] }), onMakeGroup && !disabled ? (_jsxs(XStack, { render: "button", type: 'button', onClick: onMakeGroup, items: "center", gap: 3, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Plus, { size: 11, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, color: DIM, children: t('Group') })] })) : null] }), shownGroups.length === 0 && onMakeGroup && !disabled ? (_jsxs(XStack, { render: "button", type: 'button', onClick: onMakeGroup, mx: 10, px: 11, py: 8, rounded: 10, items: "center", gap: 9, bg: RAISED, borderWidth: 1, borderColor: LINE, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Users, { size: 15, color: DIM, "aria-hidden": true }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 16, fontWeight: "500", color: INK, children: t('Create a Bot Group') }), _jsx(Text, { ...CLIP, fontSize: 11, lineHeight: 15, color: DIM, children: t('Leader, Lux Quasar, or Majority layers') })] })] })) : null, shownGroups.map((g) => {
|
|
54
|
+
const ref = toGroupRef(g.name);
|
|
55
|
+
const here = open === ref;
|
|
56
|
+
return (_jsxs(XStack, { render: "button", type: 'button', "data-parity-key": "bots.group.row", "data-group": g.name, "aria-current": here, onClick: () => onPick(ref), height: 52, mx: 6, px: 12, gap: 10, items: "center", rounded: 10, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsx(YStack, { width: 34, height: 34, rounded: 10, shrink: 0, items: "center", justify: "center", bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(Users, { size: 15, color: INK, "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsxs(XStack, { items: "center", gap: 6, maxW: "100%", children: [_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, fontWeight: "500", color: INK, children: g.name }), _jsx(Text, { fontSize: 10, lineHeight: 14, color: DIM, children: `L${g.layer || 1}` })] }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 11, lineHeight: 15, color: DIM, children: `${policyBadge(g.policy)} · ${g.members.length} bots` })] })] }, g.id || g.name));
|
|
57
|
+
})] })) : null, rows.length ? (_jsx(YStack, { "data-parity-key": "bots.rows", role: "group", "aria-label": t('More bots'), pt: 10, pb: 22, children: rows.map((b) => {
|
|
41
58
|
const here = b.name === open;
|
|
42
59
|
const label = called(b.name);
|
|
43
60
|
const word = lastWord(last.get(b.name)) || b.description || '';
|