@hanzo/app 0.3.72 → 0.3.74
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/assets/memoji/art.svg +4 -4
- package/assets/memoji/cyber.svg +2 -2
- package/assets/memoji/des.svg +4 -4
- package/assets/memoji/doc.svg +2 -2
- package/assets/memoji/edu.svg +2 -2
- package/assets/memoji/huma.svg +2 -2
- package/assets/memoji/lang.svg +2 -2
- package/assets/memoji/mana.svg +2 -2
- package/assets/memoji/mu.svg +2 -2
- package/assets/memoji/opera.svg +2 -2
- package/assets/memoji/vi.svg +2 -2
- package/assets/memoji/vid.svg +2 -2
- package/dist/App.js +17 -25
- package/dist/Chat.js +89 -93
- package/dist/PreferencesDialog.d.ts +5 -0
- package/dist/PreferencesDialog.js +25 -0
- package/dist/Rail.d.ts +2 -3
- package/dist/Rail.js +5 -6
- package/dist/Recents.js +5 -3
- package/dist/Shell.js +14 -16
- package/dist/Sidebar.js +9 -9
- package/dist/ToBottom.d.ts +3 -0
- package/dist/ToBottom.js +61 -0
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/Panel.d.ts +3 -4
- package/dist/bots/Panel.js +74 -36
- package/dist/bots/Roster.js +40 -22
- package/dist/bots/Thread.d.ts +0 -1
- package/dist/bots/Thread.js +45 -30
- package/dist/bots/face.d.ts +3 -1
- package/dist/bots/face.js +12 -8
- package/dist/bots/grid.d.ts +1 -1
- package/dist/bots/grid.js +17 -2
- package/dist/bots/ink.d.ts +6 -6
- package/dist/bots/ink.js +8 -16
- package/dist/bots/kit.d.ts +13 -12
- package/dist/bots/kit.js +33 -11
- package/dist/bots/said.d.ts +16 -0
- package/dist/bots/said.js +63 -0
- package/dist/ground.d.ts +7 -3
- package/dist/ground.js +7 -3
- package/package.json +1 -1
package/dist/Sidebar.js
CHANGED
|
@@ -29,7 +29,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
29
29
|
import { locales, phrase } from '@hanzo/i18n';
|
|
30
30
|
import { useI18n } from '@hanzo/i18n/react';
|
|
31
31
|
import { Text, XStack, YStack } from '@hanzo/gui';
|
|
32
|
-
import { ArrowLeft, ArrowRight, Bell, ChevronDown, ChevronUp, Cloud, Globe, Image as ImageMark, Monitor, Puzzle, Search, Sparkles } from 'lucide-react';
|
|
32
|
+
import { ArrowLeft, ArrowRight, Bell, ChevronDown, ChevronUp, Cloud, Globe, Image as ImageMark, Monitor, Puzzle, Search, Settings, Sparkles } from 'lucide-react';
|
|
33
33
|
import { DOTS, Gutter, library, MARKS, NEW, own, tabs, useLanguage, useScheduled, useSessions } from '@hanzo/build';
|
|
34
34
|
import { tidy } from './lib/title.js';
|
|
35
35
|
import { Button, DropdownMenu, Switch } from '@hanzo/ui';
|
|
@@ -38,10 +38,10 @@ import { useEffect, useId, useMemo, useState } from 'react';
|
|
|
38
38
|
import { Made } from './Account.js';
|
|
39
39
|
import { useBetas } from './Betas.js';
|
|
40
40
|
import { Recents } from './Recents.js';
|
|
41
|
-
import { raised } from './Rail.js';
|
|
41
|
+
import { MARK, raised } from './Rail.js';
|
|
42
42
|
import { Setup } from './Setup.js';
|
|
43
43
|
import { ago, UNTITLED_RUN } from './recent.js';
|
|
44
|
-
import { empty } from './open.js';
|
|
44
|
+
import { empty, showSettings } from './open.js';
|
|
45
45
|
import { useSpan } from './span.js';
|
|
46
46
|
import { useFree } from './Upgrade.js';
|
|
47
47
|
import { hosted, talk } from './lib/host.js';
|
|
@@ -68,8 +68,8 @@ const keys = (press) => ({
|
|
|
68
68
|
press();
|
|
69
69
|
},
|
|
70
70
|
});
|
|
71
|
-
/** A row of the sidebar: a full-width
|
|
72
|
-
const ROW = { rounded:
|
|
71
|
+
/** A row of the sidebar: a full-width 40px pill, 44px on a touch screen, lit where the reader is. */
|
|
72
|
+
const ROW = { rounded: 12, minH: 40, py: 0, px: '$3', width: '100%', $touchable: { minH: 44 } };
|
|
73
73
|
/** A sidebar link row spans the column width so hover and active pills align with Recents. */
|
|
74
74
|
const COMPACT_ROW = ROW;
|
|
75
75
|
/** The run activity behind the bell: the runs that moved last, newest first. */
|
|
@@ -350,13 +350,13 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
350
350
|
empty();
|
|
351
351
|
go(talk());
|
|
352
352
|
};
|
|
353
|
-
return (_jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative",
|
|
353
|
+
return (_jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : `var(--span, ${WIDTH}px)`, maxW: drawer ? undefined : `var(--span, ${WIDTH}px)`, bg: drawer ? undefined : "var(--side-fill, var(--sheet-2))", rounded: drawer ? undefined : "var(--pane-round)", borderWidth: drawer ? 0 : 1, borderColor: "var(--pane-edge, var(--edge, var(--white-06)))", children: [_jsxs(Base, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: 8, pt: drawer ? 'var(--pane-gap)' : 4,
|
|
354
354
|
// In the drawer the menu's own foot padding is the gap; its foot row stands on it.
|
|
355
|
-
pb: drawer ? 0 :
|
|
355
|
+
pb: drawer ? 0 : '$2', gap: "$0", "$platform-web": anon && !drawer ? { overflow: 'visible' } : undefined, children: [at ? (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: 2, paddingInlineEnd: 2,
|
|
356
356
|
// The phone's drawer lines up with its bar (BAND); beside the rail, with the rail's first mark (ground.ts HEAD).
|
|
357
357
|
height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", "data-tauri-drag-region": "false", onPress: onBack, ...HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: 15, lineHeight: 20, fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) })] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: 2, paddingInlineStart: 8, paddingInlineEnd: 2,
|
|
358
358
|
// The phone's drawer lines up with its bar (BAND); beside the rail, with the rail's first mark (ground.ts HEAD).
|
|
359
|
-
height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", gap: 4, children: _jsx(Text, { fontSize:
|
|
359
|
+
height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", gap: 4, children: _jsx(Text, { fontSize: 17, lineHeight: 24, fontWeight: "600", color: "$ink", numberOfLines: 1, children: wordmark(mode) }) }), drawer || anon ? null : _jsx(Activity, { host: host }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...(drawer
|
|
360
360
|
? {
|
|
361
361
|
width: 40,
|
|
362
362
|
height: 40,
|
|
@@ -391,7 +391,7 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
391
391
|
}, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
|
|
392
392
|
if (typeof window !== 'undefined')
|
|
393
393
|
window.location.assign('/signup?next=%2Fchat');
|
|
394
|
-
}, children: t('Sign up') })] })] }) })) : at || mode === 'beta' || mode === 'hosted' ? null : (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, minW: 0, maxW: "100%", children: [_jsx(Made, {}), _jsx(Setup, { go: go })] })), !anon && free && (drawer || (mode !== 'beta' && mode !== 'hosted')) ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$2", children: _jsx(YStack, { role: "listitem", minH:
|
|
394
|
+
}, children: t('Sign up') })] })] }) })) : at || mode === 'beta' || mode === 'hosted' ? null : (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, minW: 0, maxW: "100%", children: [_jsx(Made, {}), _jsx(Setup, { go: go })] })), !anon && free && (drawer || (mode !== 'beta' && mode !== 'hosted')) ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$2", children: _jsx(YStack, { role: "listitem", minH: MARK, justify: "center", children: _jsx(SidebarItem, { ...ROW, "data-slot": "column-upgrade", icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(Sparkles, { size: 16, "aria-hidden": true, color: "var(--primary)" }) }), onPress: () => window.location.assign(payUrl('/cart', { returnUrl: window.location.href })), ...keys(() => window.location.assign(payUrl('/cart', { returnUrl: window.location.href }))), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Upgrade plan') }) }) }) })) : null, !anon && !drawer && !at && mode !== 'beta' && mode !== 'hosted' ? (_jsx(YStack, { role: "list", gap: 2, shrink: 0, pt: "$1", children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, "data-slot": "column-settings", bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: _jsx(Settings, { size: 15, "aria-hidden": true }) }), onPress: () => showSettings('general'), ...keys(() => showSettings('general')), children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: "$ink", children: t('Settings') }) }) }) })) : null, _jsx(UpdatePill, {}), foot] }), drawer ? null : (_jsx(Gutter, { side: dir === 'rtl' ? 'right' : 'left', span: span.span, floor: FLOOR, ceil: CEIL, reset: WIDTH, onSpan: span.move, onKeep: span.keep, onShut: onShut, label: t('Resize sidebar') }))] }));
|
|
395
395
|
}
|
|
396
396
|
function UpdatePill() {
|
|
397
397
|
const { t } = useI18n();
|
package/dist/ToBottom.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
// A round button that floats above the composer while the thread is not at its
|
|
4
|
+
// end, and takes the reader there. The thread's scroller is @hanzo/ui/chat's
|
|
5
|
+
// (`data-slot="thread"`), so this watches that element rather than owning one:
|
|
6
|
+
// it listens to its scroll and to its content growing, and measures the composer
|
|
7
|
+
// to stand just above it.
|
|
8
|
+
import { useEffect, useState } from 'react';
|
|
9
|
+
import { ArrowDown } from 'lucide-react';
|
|
10
|
+
import { XStack } from '@hanzo/gui';
|
|
11
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
12
|
+
/** How far from the end still counts as the end, px. */
|
|
13
|
+
const NEAR = 120;
|
|
14
|
+
export function ToBottom({ within }) {
|
|
15
|
+
const { t } = useI18n();
|
|
16
|
+
const [lift, setLift] = useState(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
const box = within;
|
|
19
|
+
if (!box)
|
|
20
|
+
return;
|
|
21
|
+
let thread = null;
|
|
22
|
+
const measure = () => {
|
|
23
|
+
thread = box.querySelector('[data-slot="thread"]');
|
|
24
|
+
if (!thread)
|
|
25
|
+
return setLift(null);
|
|
26
|
+
const far = thread.scrollHeight - thread.clientHeight - thread.scrollTop > NEAR;
|
|
27
|
+
const composer = box.querySelector('[data-slot="composer"]');
|
|
28
|
+
const room = box.getBoundingClientRect();
|
|
29
|
+
const foot = composer ? room.bottom - composer.getBoundingClientRect().top + 12 : 16;
|
|
30
|
+
setLift(far ? foot : null);
|
|
31
|
+
};
|
|
32
|
+
// One measure a frame, however many scrolls, token commits or resizes ask for it.
|
|
33
|
+
let frame = 0;
|
|
34
|
+
const soon = () => {
|
|
35
|
+
if (!frame)
|
|
36
|
+
frame = requestAnimationFrame(() => ((frame = 0), measure()));
|
|
37
|
+
};
|
|
38
|
+
const seen = new MutationObserver(soon);
|
|
39
|
+
seen.observe(box, { childList: true, subtree: true });
|
|
40
|
+
const sized = new ResizeObserver(soon);
|
|
41
|
+
sized.observe(box);
|
|
42
|
+
box.querySelectorAll('[data-slot="thread"], [data-slot="composer"]').forEach((el) => sized.observe(el));
|
|
43
|
+
box.addEventListener('scroll', soon, { capture: true, passive: true });
|
|
44
|
+
window.addEventListener('resize', soon);
|
|
45
|
+
measure();
|
|
46
|
+
return () => {
|
|
47
|
+
cancelAnimationFrame(frame);
|
|
48
|
+
seen.disconnect();
|
|
49
|
+
sized.disconnect();
|
|
50
|
+
box.removeEventListener('scroll', soon, { capture: true });
|
|
51
|
+
window.removeEventListener('resize', soon);
|
|
52
|
+
setLift(null);
|
|
53
|
+
};
|
|
54
|
+
}, [within]);
|
|
55
|
+
if (lift === null)
|
|
56
|
+
return null;
|
|
57
|
+
return (_jsx(XStack, { render: "button", "aria-label": t('Scroll to bottom'), "data-slot": "to-bottom", onPress: () => {
|
|
58
|
+
const thread = within?.querySelector('[data-slot="thread"]');
|
|
59
|
+
thread?.scrollTo({ top: thread.scrollHeight, behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' });
|
|
60
|
+
}, position: "absolute", b: lift, l: "50%", ml: -18, width: 36, height: 36, rounded: 999, items: "center", justify: "center", cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, bg: "$raised", borderWidth: 1, borderColor: "$borderColor", z: 5, children: _jsx(ArrowDown, { size: 16, "aria-hidden": true }) }));
|
|
61
|
+
}
|
package/dist/bots/Bots.js
CHANGED
|
@@ -293,7 +293,7 @@ export function Bots({ foot = true, bot: held, onBot, } = {}) {
|
|
|
293
293
|
setSide(false);
|
|
294
294
|
setOver(false);
|
|
295
295
|
};
|
|
296
|
-
const panel = bot ? (_jsx(Panel, { bot: bot, kept: kept[bot.name] ?? '', onClose: close, onSchedule: schedule, onDelete: remove, focus: over && !laptop }, bot.name)) : null;
|
|
296
|
+
const panel = bot ? (_jsx(Panel, { bot: bot, runs: runs ?? [], kept: kept[bot.name] ?? '', onClose: close, onSchedule: schedule, onDelete: remove, focus: over && !laptop }, bot.name)) : null;
|
|
297
297
|
const shown = laptop ? side : over;
|
|
298
298
|
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [_jsx(YStack, { "data-parity-key": "bots.roster", width: 279, shrink: 0, height: "100%", bg: FLOOR, borderRightWidth: 1, borderColor: LINE, "$max-md": { width: '100%', borderRightWidth: 0, display: bot ? 'none' : 'flex' }, children: _jsx(Roster, { bots: bots, last: last, open: open, unread: unread, me: foot ? user : null, onPick: pick, onMake: () => setMaking(true), disabled: !live }) }), _jsx(YStack, { "data-parity-key": "bots.center", flex: 1, minW: 0, height: "100%", bg: GROUND, "$max-md": { display: bot ? 'flex' : 'none' }, children: _jsx(Thread, { bot: bot, bots: bots ?? [], runs: runs, pending: pending, notice: notice, wrong: wrong, side: shown, live: live, loaded: bots !== null, onSend: send, onDismiss: () => setNotice(null), onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onMake: () => setMaking(true) }) }), laptop && side && panel ? (_jsx(YStack, { "data-parity-key": "bots.panel", width: 319, shrink: 0, height: "100%", bg: GROUND, borderLeftWidth: 1, borderColor: LINE, "$max-xl": { display: 'none' }, children: panel })) : null, over && panel && !laptop ? (_jsx(YStack, { "data-parity-key": "bots.panel.over", role: "dialog", "aria-modal": true, "aria-label": bot?.name, position: "absolute", t: 0, r: 0, b: 0, width: 319, maxW: "100%", z: 10, bg: GROUND, borderLeftWidth: 1, borderColor: LINE, boxShadow: "var(--shadow-floating)", children: panel })) : null, making ? _jsx(Make, { onDone: made, onCancel: () => setMaking(false) }) : null] }));
|
|
299
299
|
}
|
package/dist/bots/Panel.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { Agent } from '@hanzo/ai';
|
|
2
|
-
export declare function Panel({ bot, onClose, kept, onSchedule, onDelete, focus, }: {
|
|
1
|
+
import type { Agent, AgentRun } from '@hanzo/ai';
|
|
2
|
+
export declare function Panel({ bot, runs, onClose, kept, onSchedule, onDelete, focus, }: {
|
|
3
3
|
bot: Agent;
|
|
4
|
-
|
|
4
|
+
runs?: readonly AgentRun[];
|
|
5
5
|
kept: string;
|
|
6
6
|
onClose: () => void;
|
|
7
7
|
onSchedule: (on: boolean, cron: string) => Promise<void>;
|
|
8
8
|
onDelete: () => Promise<void>;
|
|
9
|
-
/** Over the thread: the close control takes the focus, so Escape and Tab start here. */
|
|
10
9
|
focus?: boolean;
|
|
11
10
|
}): import("react").JSX.Element;
|
package/dist/bots/Panel.js
CHANGED
|
@@ -1,24 +1,36 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// The open bot's right inspector panel: avatar, name, [Activity | Library]
|
|
4
|
+
// segmented control, Upcoming routines & connected networks, Bot's computer
|
|
5
|
+
// status monitor, and Voice chat preferences.
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
7
|
import { useI18n } from '@hanzo/i18n/react';
|
|
8
8
|
import { Text, XStack, YStack } from '@hanzo/gui';
|
|
9
|
-
import { Button, Dialog, DialogContent, DialogTitle, Switch } from '@hanzo/ui';
|
|
10
|
-
import { Clock, X } from 'lucide-react';
|
|
9
|
+
import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Switch, } from '@hanzo/ui';
|
|
10
|
+
import { ChevronDown, ChevronRight, Clock, FileText, Image as ImageIcon, X } from 'lucide-react';
|
|
11
|
+
import { useKept } from '../kept.js';
|
|
11
12
|
import { useAi } from '../lib/ai.js';
|
|
12
13
|
import { say } from '../failure.js';
|
|
13
14
|
import { Network, of } from '../network.js';
|
|
15
|
+
import { called } from '../team.js';
|
|
14
16
|
import { Face } from './face.js';
|
|
15
17
|
import { ALWAYS, answering, disk, grant } from './api.js';
|
|
16
18
|
import { CARD, CLIP, LABEL, PILL, ROUND, WORD } from './kit.js';
|
|
17
|
-
import { DIM, INK, LINE } from './ink.js';
|
|
19
|
+
import { DIM, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
20
|
+
import { partsOf } from './said.js';
|
|
18
21
|
import { cron as words } from './time.js';
|
|
22
|
+
const VOICES = ['Liora', 'Aria', 'Sol', 'Koe', 'Nova', 'Echo'];
|
|
23
|
+
const SPEEDS = ['0.9x', '1x', '1.25x', '1.5x', '2x'];
|
|
24
|
+
const LANGUAGES = ['Auto-detect', 'English', 'Spanish', 'French', 'German', 'Japanese', 'Chinese'];
|
|
19
25
|
/** One row of a card: a mark, two lines, and whatever acts on it. */
|
|
20
|
-
function Row({ mark, title, line, children, last }) {
|
|
21
|
-
return (_jsxs(XStack, { minH:
|
|
26
|
+
function Row({ mark, title, line, children, last, }) {
|
|
27
|
+
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] }));
|
|
28
|
+
}
|
|
29
|
+
function VoiceRow({ label, value, options, onSelect, last, }) {
|
|
30
|
+
return (_jsxs(XStack, { minH: 44, px: 14, items: "center", justify: "space-between", borderBottomWidth: last ? 0 : 1, borderColor: LINE, children: [_jsx(Text, { fontSize: 14, lineHeight: 19, color: INK, children: label }), _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: 14, lineHeight: 19, color: INK, children: value }), _jsx(ChevronDown, { size: 14, color: DIM, "aria-hidden": true })] }) }), _jsx(DropdownMenuContent, { minW: 160, "aria-label": label, children: options.map((opt) => (_jsx(DropdownMenuItem, { onSelect: () => onSelect(opt), children: _jsx(Text, { fontSize: "$3", color: "$ink", fontWeight: opt === value ? '600' : '400', children: opt }) }, opt))) })] })] }));
|
|
31
|
+
}
|
|
32
|
+
function ComputerScreen({ awake }) {
|
|
33
|
+
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))" })] })] })) }));
|
|
22
34
|
}
|
|
23
35
|
/** A computer's state as a person reads it. No lease is a computer asleep. */
|
|
24
36
|
function state(box, t) {
|
|
@@ -30,13 +42,12 @@ function state(box, t) {
|
|
|
30
42
|
return t('Waking');
|
|
31
43
|
return box.error || t('Stopped');
|
|
32
44
|
}
|
|
33
|
-
/** The computer to draw: a running one first, then one waking, then any. */
|
|
34
45
|
const best = (boxes) => boxes.find((b) => b.status === 'running') ?? boxes.find((b) => b.status === 'pending') ?? boxes[0] ?? null;
|
|
35
|
-
/** How often a waking computer is asked whether it is awake. */
|
|
36
46
|
const POLL = 5000;
|
|
37
|
-
export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false, }) {
|
|
47
|
+
export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, focus = false, }) {
|
|
38
48
|
const { t, locale } = useI18n();
|
|
39
49
|
const { client } = useAi();
|
|
50
|
+
const [tab, setTab] = useState('activity');
|
|
40
51
|
const [instructions, setInstructions] = useState('');
|
|
41
52
|
const [answers, setAnswers] = useState([]);
|
|
42
53
|
const [box, setBox] = useState(null);
|
|
@@ -45,9 +56,12 @@ export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false,
|
|
|
45
56
|
const [saving, setSaving] = useState(false);
|
|
46
57
|
const [wrong, setWrong] = useState(null);
|
|
47
58
|
const [deleting, setDeleting] = useState(false);
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
const [voiceName, setVoiceName] = useKept('hanzo.bots.voice.name', 'Liora');
|
|
60
|
+
const [voiceSpeed, setVoiceSpeed] = useKept('hanzo.bots.voice.speed', '1x');
|
|
61
|
+
const [voiceLang, setVoiceLang] = useKept('hanzo.bots.voice.lang', 'Auto-detect');
|
|
62
|
+
const displayName = called(bot.name);
|
|
50
63
|
const cron = bot.schedule || kept;
|
|
64
|
+
const activeSchedule = bot.executionMode === ALWAYS && Boolean(bot.schedule);
|
|
51
65
|
const survey = useCallback(async (signal) => {
|
|
52
66
|
if (!client)
|
|
53
67
|
return;
|
|
@@ -70,10 +84,12 @@ export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false,
|
|
|
70
84
|
const bound = await Promise.allSettled(connected.map((n) => answering(client, n.id, signal)));
|
|
71
85
|
if (signal?.aborted)
|
|
72
86
|
return;
|
|
73
|
-
setAnswers(connected
|
|
87
|
+
setAnswers(connected
|
|
88
|
+
.filter((_, i) => {
|
|
74
89
|
const r = bound[i];
|
|
75
90
|
return r.status === 'fulfilled' && r.value.default === bot.name;
|
|
76
|
-
})
|
|
91
|
+
})
|
|
92
|
+
.map((n) => n.id));
|
|
77
93
|
}
|
|
78
94
|
}, [client, bot.name]);
|
|
79
95
|
useEffect(() => {
|
|
@@ -81,7 +97,6 @@ export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false,
|
|
|
81
97
|
void survey(stop.signal);
|
|
82
98
|
return () => stop.abort();
|
|
83
99
|
}, [survey]);
|
|
84
|
-
// A waking computer is asked again until it is awake or says why it is not.
|
|
85
100
|
useEffect(() => {
|
|
86
101
|
if (!client || box?.status !== 'pending')
|
|
87
102
|
return;
|
|
@@ -97,28 +112,23 @@ export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false,
|
|
|
97
112
|
stop.abort();
|
|
98
113
|
};
|
|
99
114
|
}, [client, box?.status, bot.name]);
|
|
100
|
-
/**
|
|
101
|
-
* Asleep, a press wakes it; awake, a press opens its screen in a new tab. The
|
|
102
|
-
* tab is opened inside the press, before the grant answers, because a browser
|
|
103
|
-
* allows a new window only from the press itself.
|
|
104
|
-
*/
|
|
105
115
|
const computer = async () => {
|
|
106
116
|
if (!client || busy)
|
|
107
117
|
return;
|
|
108
118
|
setBusy(true);
|
|
109
119
|
setWrong(null);
|
|
110
|
-
const
|
|
120
|
+
const win = box?.status === 'running' ? window.open('', '_blank') : null;
|
|
111
121
|
try {
|
|
112
122
|
if (box?.status === 'running') {
|
|
113
123
|
const g = await grant(client, box.id, box.class === 'desktop' ? 'screen' : 'terminal');
|
|
114
|
-
if (!
|
|
124
|
+
if (!win)
|
|
115
125
|
return setWrong(t('The browser kept the new tab from opening.'));
|
|
116
126
|
if (!g.url?.startsWith('https://')) {
|
|
117
|
-
|
|
127
|
+
win.close();
|
|
118
128
|
return setWrong(t('The platform opened no window onto it.'));
|
|
119
129
|
}
|
|
120
|
-
|
|
121
|
-
|
|
130
|
+
win.opener = null;
|
|
131
|
+
win.location.href = g.url;
|
|
122
132
|
}
|
|
123
133
|
else if (!box || box.status === 'error') {
|
|
124
134
|
await client.sandboxes.lease({ class: 'desktop', project: disk(bot.name) });
|
|
@@ -126,24 +136,52 @@ export function Panel({ bot, onClose, kept, onSchedule, onDelete, focus = false,
|
|
|
126
136
|
}
|
|
127
137
|
}
|
|
128
138
|
catch (e) {
|
|
129
|
-
|
|
130
|
-
setWrong(say(e, t('{name}’s computer', { name:
|
|
139
|
+
win?.close();
|
|
140
|
+
setWrong(say(e, t('{name}’s computer', { name: displayName }), 'save', t));
|
|
131
141
|
}
|
|
132
142
|
finally {
|
|
133
143
|
setBusy(false);
|
|
134
144
|
}
|
|
135
145
|
};
|
|
136
|
-
const routine = cron ? instructions.split('\n')[0].trim() ||
|
|
137
|
-
|
|
146
|
+
const routine = cron ? bot.description || instructions.split('\n')[0].trim() || displayName : '';
|
|
147
|
+
const scheduleLine = cron
|
|
148
|
+
? activeSchedule
|
|
149
|
+
? words(cron, locale, t)
|
|
150
|
+
: cron === 'paused'
|
|
151
|
+
? t('Paused')
|
|
152
|
+
: `${t('Paused')} · ${words(cron, locale, t)}`
|
|
153
|
+
: '';
|
|
154
|
+
const libraryItems = useMemo(() => {
|
|
155
|
+
const items = [];
|
|
156
|
+
for (const r of runs) {
|
|
157
|
+
for (const blob of [r.input, r.output]) {
|
|
158
|
+
if (!blob)
|
|
159
|
+
continue;
|
|
160
|
+
for (const [idx, part] of partsOf(blob).entries()) {
|
|
161
|
+
if (part.kind === 'doc') {
|
|
162
|
+
items.push({ key: `${r.id}-${idx}-${part.name}`, kind: 'doc', label: part.name, sub: part.size, href: part.href });
|
|
163
|
+
}
|
|
164
|
+
else if (part.kind === 'image') {
|
|
165
|
+
items.push({ key: `${r.id}-${idx}-img`, kind: 'image', label: part.alt || t('Preview image'), href: part.src });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return items.reverse();
|
|
171
|
+
}, [runs, t]);
|
|
172
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": displayName, render: "aside", children: [_jsx(XStack, { height: 58, shrink: 0, px: 14, 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: 14, pt: 4, pb: 22, px: 16, children: [_jsx(Face, { bot: bot, size: 72 }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 19, lineHeight: 24, fontWeight: "600", color: INK, children: displayName }), _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) => {
|
|
173
|
+
const selected = tab === id;
|
|
174
|
+
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));
|
|
175
|
+
}) })] }), tab === 'activity' ? (_jsxs(YStack, { px: 15, pb: 24, gap: 20, children: [cron || answers.length ? (_jsxs(YStack, { gap: 10, "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) => {
|
|
138
176
|
setWrong(null);
|
|
139
177
|
setSaving(true);
|
|
140
|
-
onSchedule(on, cron)
|
|
141
|
-
.catch((e) => setWrong(say(e, t('{name}’s schedule', { name:
|
|
178
|
+
onSchedule(on, cron === 'paused' ? '0 9 * * *' : cron)
|
|
179
|
+
.catch((e) => setWrong(say(e, t('{name}’s schedule', { name: displayName }), 'save', t)))
|
|
142
180
|
.finally(() => setSaving(false));
|
|
143
|
-
} }) }) })
|
|
181
|
+
} }) }) })) : 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, boxed ? (_jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Computer') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: computer, disabled: busy || box?.status === 'pending', "aria-label": t(box?.status === 'running' ? 'Open {name}’s computer' : 'Wake {name}’s 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: 13, lineHeight: 18, color: DIM, children: busy ? t('Waking') : state(box, t) })] }), _jsx(ComputerScreen, { awake: box?.status === 'running' })] })] })) : null, _jsxs(YStack, { gap: 10, "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, _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 }) }) })] })) : (_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: () => {
|
|
144
182
|
if (!deleting)
|
|
145
183
|
return;
|
|
146
184
|
setDeleting(false);
|
|
147
|
-
onDelete().catch((e) => setWrong(say(e,
|
|
185
|
+
onDelete().catch((e) => setWrong(say(e, displayName, 'save', t)));
|
|
148
186
|
}, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) })] }));
|
|
149
187
|
}
|
package/dist/bots/Roster.js
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The roster: search and new at the top, the bots as a grid of faces, the
|
|
4
|
-
// as rows with the last thing each said, and the reader
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
// a face does not move once you know where it is. A bot past the twelfth is a
|
|
8
|
-
// row, newest conversation first, which is where a bot you are busy with is.
|
|
9
|
-
import { useMemo, useState } from 'react';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// The roster: search and new at the top, the bots as a 3x4 grid of faces, the
|
|
4
|
+
// rest as rows with the last thing each said, and the reader + Preferences at
|
|
5
|
+
// the foot.
|
|
6
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
10
7
|
import { useI18n } from '@hanzo/i18n/react';
|
|
11
8
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
12
9
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@hanzo/ui';
|
|
13
10
|
import { BUSINESS_APPS } from '@hanzo/ui/product';
|
|
14
|
-
import {
|
|
11
|
+
import { Grid2x2Plus, Plus, Search, SlidersHorizontal, X } from 'lucide-react';
|
|
15
12
|
import { useSignOut } from '../lib/signout.js';
|
|
13
|
+
import { PreferencesDialog } from '../PreferencesDialog.js';
|
|
14
|
+
import { called, member } from '../team.js';
|
|
16
15
|
import { Face } from './face.js';
|
|
17
16
|
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
18
|
-
import { DIM, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
17
|
+
import { DIM, FLOOR, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
19
18
|
import { lastWord, split } from './grid.js';
|
|
20
19
|
export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled, }) {
|
|
21
20
|
const { t } = useI18n();
|
|
@@ -24,27 +23,46 @@ export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled,
|
|
|
24
23
|
const shown = useMemo(() => {
|
|
25
24
|
const q = query.trim().toLowerCase();
|
|
26
25
|
const all = bots ?? [];
|
|
27
|
-
return q
|
|
26
|
+
return q
|
|
27
|
+
? all.filter((b) => b.name.toLowerCase().includes(q) ||
|
|
28
|
+
called(b.name).toLowerCase().includes(q) ||
|
|
29
|
+
(b.description ?? '').toLowerCase().includes(q))
|
|
30
|
+
: all;
|
|
28
31
|
}, [bots, query]);
|
|
29
32
|
const { grid, rows } = useMemo(() => split(shown, last), [shown, last]);
|
|
30
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height: 58, shrink: 0, px: 16, items: "center", justify: "flex-end", gap:
|
|
33
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height: 58, shrink: 0, px: 16, items: "center", justify: "flex-end", gap: 10, children: [_jsx(XStack, { ...ROUND, "aria-label": t(seeking ? 'Close search' : 'Search bots'), "aria-pressed": seeking, onClick: () => {
|
|
31
34
|
setSeeking(!seeking);
|
|
32
35
|
setQuery('');
|
|
33
|
-
}, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), _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: 12, pb: 10, shrink: 0, children: _jsx(Input, { unstyled: true, autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search'), "aria-label": t('Search bots'), width: "100%", height: 36, px: 14, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
}, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), _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: 12, pb: 10, shrink: 0, children: _jsx(Input, { unstyled: true, autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search'), "aria-label": t('Search bots'), width: "100%", height: 36, px: 14, 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: 18, py: 10, 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: 160, px: 24, 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: 11, pt: 6, columnGap: 3, rowGap: 12, "$max-md": { px: 12, columnGap: 0, justify: 'space-between' }, children: grid.map((b) => {
|
|
37
|
+
const here = b.name === open;
|
|
38
|
+
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: 83, height: 92, rounded: 12, items: "center", pt: 6, gap: 6, 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: 60, starred: member(b.name)?.seat === 1 }), _jsx(Text, { ...CLIP, maxW: 77, fontSize: 13, lineHeight: 17, fontWeight: here ? '500' : '400', color: INK, children: label })] }, b.id || b.name));
|
|
40
|
+
}) })) : null, rows.length ? (_jsx(YStack, { "data-parity-key": "bots.rows", role: "group", "aria-label": t('More bots'), pt: 16, pb: 22, children: rows.map((b) => {
|
|
41
|
+
const here = b.name === open;
|
|
42
|
+
const label = called(b.name);
|
|
43
|
+
const word = lastWord(last.get(b.name)) || b.description || '';
|
|
44
|
+
return (_jsxs(XStack, { render: "button", type: 'button', "data-parity-key": "bots.row", "data-name": b.name, "aria-current": here, onClick: () => onPick(b.name), height: 56, 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(Face, { bot: b, size: 36 }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: label }), word ? (_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 13, lineHeight: 18, color: DIM, children: word })) : null] })] }, b.id || b.name));
|
|
45
|
+
}) })) : null] }), rows.length ? (_jsx(YStack, { "aria-hidden": true, pointerEvents: "none", position: "absolute", l: 0, r: 0, b: 0, height: 28, "$platform-web": { backgroundImage: `linear-gradient(to bottom, transparent, ${FLOOR})` } })) : null] }), _jsx(Foot, { me: me })] }));
|
|
41
46
|
}
|
|
42
|
-
/** You, at the foot: your account,
|
|
47
|
+
/** You, at the foot: your account, Hanzo apps, and unified Hanzo Preferences. */
|
|
43
48
|
function Foot({ me }) {
|
|
44
49
|
const { t } = useI18n();
|
|
45
50
|
const leave = useSignOut();
|
|
51
|
+
const [prefsOpen, setPrefsOpen] = useState(false);
|
|
46
52
|
const name = me?.displayName || me?.name || '';
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!me)
|
|
55
|
+
return;
|
|
56
|
+
const onKey = (e) => {
|
|
57
|
+
if ((e.metaKey || e.ctrlKey) && e.key === ',') {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
setPrefsOpen(true);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
window.addEventListener('keydown', onKey);
|
|
63
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
64
|
+
}, [me]);
|
|
47
65
|
if (!me)
|
|
48
66
|
return null;
|
|
49
|
-
return (_jsxs(XStack, { "data-parity-key": "bots.me", height:
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsxs(XStack, { "data-parity-key": "bots.me", height: 64, shrink: 0, px: 14, items: "center", gap: 8, children: [_jsxs(DropdownMenu, { placement: "top-start", offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', "aria-label": t('Account: {name}', { name }), flex: 1, minW: 0, items: "center", gap: 10, bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: [_jsx(Face, { bot: { name, avatar: me.avatar }, size: 34, person: true }), _jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: name })] }) }), _jsxs(DropdownMenuContent, { minW: 240, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: name }), me.email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: me.email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => setPrefsOpen(true), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Preferences') }) }), _jsx(DropdownMenuItem, { onSelect: () => void leave(), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Log out') }) })] })] }), _jsxs(DropdownMenu, { placement: "top-end", offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { ...ROUND, "aria-label": t('Hanzo apps'), children: _jsx(Grid2x2Plus, { size: 16, color: INK, "aria-hidden": true }) }) }), _jsx(DropdownMenuContent, { minW: 240, maxH: 420, "aria-label": t('Hanzo apps'), children: BUSINESS_APPS.map((app) => (_jsx(DropdownMenuItem, { onSelect: () => window.location.assign(app.href), children: _jsxs(YStack, { minW: 0, children: [_jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: app.productTitle }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: app.description })] }) }, app.id))) })] }), _jsx(XStack, { ...ROUND, "aria-label": t('Preferences'), onClick: () => setPrefsOpen(true), children: _jsx(SlidersHorizontal, { size: 15, color: INK, "aria-hidden": true }) })] }), _jsx(PreferencesDialog, { open: prefsOpen, onOpenChange: setPrefsOpen })] }));
|
|
50
68
|
}
|
package/dist/bots/Thread.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export declare function Thread({ bot, bots, runs, pending, notice, wrong, side,
|
|
|
10
10
|
wrong: string | null;
|
|
11
11
|
side: boolean;
|
|
12
12
|
live: boolean;
|
|
13
|
-
/** The roster has answered, so an empty one is an empty org and not a slow one. */
|
|
14
13
|
loaded: boolean;
|
|
15
14
|
onSend: (input: string) => Promise<boolean>;
|
|
16
15
|
onDismiss: () => void;
|