@hanzo/app 0.3.95 → 0.3.97
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/Board.js +1 -1
- package/dist/Chat.js +48 -11
- package/dist/PreferencesDialog.js +5 -2
- package/dist/Shell.d.ts +10 -0
- package/dist/Shell.js +63 -22
- package/dist/Sidebar.js +1 -1
- package/dist/about.d.ts +12 -0
- package/dist/about.js +44 -0
- package/dist/bots/Bots.js +16 -1
- package/dist/bots/Roster.d.ts +4 -1
- package/dist/bots/Roster.js +61 -20
- package/dist/bots/face.js +3 -1
- package/dist/bots/grid.d.ts +36 -0
- package/dist/bots/grid.js +91 -0
- package/dist/bots/ink.d.ts +1 -1
- package/dist/bots/ink.js +1 -1
- package/dist/bots/kit.d.ts +8 -4
- package/dist/bots/kit.js +2 -1
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +2 -2
- package/dist/lastpage.d.ts +9 -0
- package/dist/lastpage.js +15 -0
- package/dist/lib/durable.d.ts +1 -1
- package/dist/lib/durable.js +1 -1
- package/dist/lib/todo.d.ts +1 -1
- package/dist/lib/todo.js +5 -5
- package/dist/seek.d.ts +6 -1
- package/dist/seek.js +13 -0
- package/package.json +1 -1
package/dist/bots/Roster.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The roster: search, + Group, and + New bot at the top;
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
3
|
+
// The roster: search, density/column menu, + Group, and + New bot at the top;
|
|
4
|
+
// Pinned Bots in a 1→2→3 column resizable grid with 4 avatar sizes (xs/sm/md/lg);
|
|
5
|
+
// a monochrome hairline divider; layered Bot Groups (GROUPS & LAYERS); unpinned
|
|
6
|
+
// bots in single-column rows; a subtle /flow Workflows entry; and the reader +
|
|
7
|
+
// Connectors + Preferences at the foot.
|
|
8
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
9
|
import { useI18n } from '@hanzo/i18n/react';
|
|
9
10
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
10
11
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@hanzo/ui';
|
|
11
|
-
import { ArrowLeft, Grid2x2Plus, Layers, Plus, Search, SlidersHorizontal, Users, X } from 'lucide-react';
|
|
12
|
+
import { ArrowLeft, Check, Grid2x2Plus, Layers, LayoutGrid, Pin, PinOff, Plus, Search, SlidersHorizontal, Users, Workflow, X, } from 'lucide-react';
|
|
13
|
+
import { useKept } from '../kept.js';
|
|
14
|
+
import { FLOW } from '../lib/host.js';
|
|
12
15
|
import { useSignOut } from '../lib/signout.js';
|
|
13
16
|
import { PreferencesDialog } from '../PreferencesDialog.js';
|
|
14
17
|
import { called } from '../team.js';
|
|
@@ -17,11 +20,25 @@ import { Face } from './face.js';
|
|
|
17
20
|
import { PRIMARY_BOT, toGroupRef } from './api.js';
|
|
18
21
|
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
19
22
|
import { DIM, FLOOR, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
20
|
-
import { isStarredBot, lastWord, policyBadge, sortGroupsByLayer,
|
|
21
|
-
|
|
23
|
+
import { avatarSizePx, BOT_AVATAR_PX, BOT_ICON_SIZES, defaultPinnedNames, isBotIconSize, isStarredBot, lastWord, partitionPinned, policyBadge, resolveColumns, ROSTER_WIDTH_DEFAULT, sortGroupsByLayer, togglePinnedBot, } from './grid.js';
|
|
24
|
+
const SIZE_LABELS = {
|
|
25
|
+
xs: 'XS',
|
|
26
|
+
sm: 'SM',
|
|
27
|
+
md: 'MD',
|
|
28
|
+
lg: 'LG',
|
|
29
|
+
};
|
|
30
|
+
const COL_OPTIONS = ['auto', 1, 2, 3];
|
|
31
|
+
export function Roster({ bots, groups = [], last, open, unread, me, width = ROSTER_WIDTH_DEFAULT, onPick, onMake, onMakeGroup, onWorkflows, disabled, }) {
|
|
22
32
|
const { t } = useI18n();
|
|
23
33
|
const [seeking, setSeeking] = useState(false);
|
|
24
34
|
const [query, setQuery] = useState('');
|
|
35
|
+
const [storedSize, setIconSize] = useKept('hanzo.bots.roster.iconSize', 'md');
|
|
36
|
+
const [storedCols, setColPref] = useKept('hanzo.bots.roster.cols', 'auto');
|
|
37
|
+
const [pinnedNames, setPinnedNames] = useKept('hanzo.bots.roster.pinned', null);
|
|
38
|
+
const iconSize = isBotIconSize(storedSize) ? storedSize : 'md';
|
|
39
|
+
const colPref = storedCols === 'auto' || storedCols === 1 || storedCols === 2 || storedCols === 3 ? storedCols : 'auto';
|
|
40
|
+
const cols = resolveColumns(width, colPref);
|
|
41
|
+
const avatarPx = avatarSizePx(iconSize);
|
|
25
42
|
const shown = useMemo(() => {
|
|
26
43
|
const q = query.trim().toLowerCase();
|
|
27
44
|
const all = bots ?? [];
|
|
@@ -40,8 +57,28 @@ export function Roster({ bots, groups = [], last, open, unread, me, onPick, onMa
|
|
|
40
57
|
(g.description ?? '').toLowerCase().includes(q) ||
|
|
41
58
|
policyBadge(g.policy).toLowerCase().includes(q));
|
|
42
59
|
}, [groups, query]);
|
|
43
|
-
const {
|
|
44
|
-
|
|
60
|
+
const { pinned, unpinned } = useMemo(() => partitionPinned(shown, last, pinnedNames), [shown, last, pinnedNames]);
|
|
61
|
+
const togglePin = useCallback((name) => {
|
|
62
|
+
const base = pinnedNames ?? defaultPinnedNames(bots ?? []);
|
|
63
|
+
setPinnedNames(togglePinnedBot(base, name));
|
|
64
|
+
}, [bots, pinnedNames, setPinnedNames]);
|
|
65
|
+
const openWorkflows = () => {
|
|
66
|
+
if (onWorkflows) {
|
|
67
|
+
onWorkflows();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (typeof window !== 'undefined')
|
|
71
|
+
window.location.assign(FLOW);
|
|
72
|
+
};
|
|
73
|
+
const showWorkflows = !query.trim() || 'workflows'.includes(query.trim().toLowerCase()) || 'flow'.includes(query.trim().toLowerCase());
|
|
74
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", minH: 46, "$max-sm": { minH: 52, px: 10 }, shrink: 0, px: 12, items: "center", justify: "space-between", gap: 8, children: [_jsx(XStack, { items: "center", gap: 6, pl: 2, minW: 0, children: me ? (_jsxs(XStack, { render: _jsx("a", { href: "/chat", "aria-label": t('Back to chat') }), items: "center", gap: 6, px: 6, py: 4, ml: -4, rounded: 8, transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minH: 44 }, "$platform-web": { textDecoration: 'none' }, children: [_jsx(ArrowLeft, { size: 14, color: DIM, "aria-hidden": true }), _jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, fontWeight: "600", color: INK, children: t('hanzo.bot') })] })) : (_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, fontWeight: "600", color: DIM, children: t('hanzo.bot') })) }), _jsxs(XStack, { items: "center", gap: 6, shrink: 0, children: [_jsxs(DropdownMenu, { placement: "bottom-end", offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { ...ROUND, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, "data-slot": "bots-density-trigger", "aria-label": t('Sidebar layout'), children: _jsx(LayoutGrid, { size: 14, color: INK, "aria-hidden": true }) }) }), _jsxs(DropdownMenuContent, { minW: 196, "aria-label": t('Sidebar layout'), children: [_jsx(DropdownMenuLabel, { children: _jsx(Text, { fontSize: 11, color: DIM, fontWeight: "600", children: t('Avatar size') }) }), BOT_ICON_SIZES.map((sz) => {
|
|
75
|
+
const active = iconSize === sz;
|
|
76
|
+
return (_jsx(DropdownMenuItem, { "data-slot": `bots-size-${sz}`, onSelect: () => setIconSize(sz), children: _jsxs(XStack, { flex: 1, items: "center", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: 13, color: INK, fontWeight: active ? '600' : '400', children: `${SIZE_LABELS[sz]} · ${BOT_AVATAR_PX[sz]}px` }), active ? _jsx(Check, { size: 13, color: INK, "aria-hidden": true }) : null] }) }, sz));
|
|
77
|
+
}), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuLabel, { children: _jsx(Text, { fontSize: 11, color: DIM, fontWeight: "600", children: t('Pinned columns') }) }), COL_OPTIONS.map((opt) => {
|
|
78
|
+
const active = colPref === opt;
|
|
79
|
+
const label = opt === 'auto' ? t('Auto (1–3)') : opt === 1 ? t('1 column') : t('{n} columns', { n: opt });
|
|
80
|
+
return (_jsx(DropdownMenuItem, { "data-slot": `bots-cols-${opt}`, onSelect: () => setColPref(opt), children: _jsxs(XStack, { flex: 1, items: "center", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: 13, color: INK, fontWeight: active ? '600' : '400', children: label }), active ? _jsx(Check, { size: 13, color: INK, "aria-hidden": true }) : null] }) }, String(opt)));
|
|
81
|
+
})] })] }), _jsx(XStack, { ...ROUND, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, "aria-label": t(seeking ? 'Close search' : 'Search bots'), "aria-pressed": seeking, onClick: () => {
|
|
45
82
|
setSeeking(!seeking);
|
|
46
83
|
setQuery('');
|
|
47
84
|
}, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), onMakeGroup ? (_jsx(XStack, { ...ROUND, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, "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, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, "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), onKeyDown: (e) => {
|
|
@@ -49,22 +86,26 @@ export function Roster({ bots, groups = [], last, open, unread, me, onPick, onMa
|
|
|
49
86
|
setSeeking(false);
|
|
50
87
|
setQuery('');
|
|
51
88
|
}
|
|
52
|
-
}, placeholder: t('Search bots & groups'), "aria-label": t('Search bots'), width: "100%", height: 34, "$max-sm": { minH: 44 }, px: 12, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: "var(--border-strong)", focusStyle: { borderColor: 'var(--ring)' }, 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' }, flex: 1, items: "center", justify: "center", gap: 18, pt: 24, pb: 64, px: 20, children: [_jsxs(YStack, { items: "center", gap: 6, maxW: 320, children: [_jsx(Text, { render: "h2", m: 0, fontSize: 21, lineHeight: 26, fontWeight: "600", letterSpacing: -0.42, color: INK, text: "center", children: t('Make your first bot') }), _jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, text: "center", children: t('Give it instructions and tools, then message it right here.') })] }), _jsx(XStack, { ...PILL, bg: INK, borderColor: INK, minH: 38, "$max-sm": { minH: 44, px: 18 }, hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, onClick: onMake, children: _jsx(Text, { ...WORD, fontWeight: "600", color: "var(--background)", children: t('New bot') }) })] })) : null,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
89
|
+
}, placeholder: t('Search bots & groups'), "aria-label": t('Search bots'), width: "100%", height: 34, "$max-sm": { minH: 44 }, px: 12, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: "var(--border-strong)", focusStyle: { borderColor: 'var(--ring)' }, 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' }, flex: 1, items: "center", justify: "center", gap: 18, pt: 24, pb: 64, px: 20, children: [_jsxs(YStack, { items: "center", gap: 6, maxW: 320, children: [_jsx(Text, { render: "h2", m: 0, fontSize: 21, lineHeight: 26, fontWeight: "600", letterSpacing: -0.42, color: INK, text: "center", children: t('Make your first bot') }), _jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, text: "center", children: t('Give it instructions and tools, then message it right here.') })] }), _jsx(XStack, { ...PILL, bg: INK, borderColor: INK, minH: 38, "$max-sm": { minH: 44, px: 18 }, hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, onClick: onMake, children: _jsx(Text, { ...WORD, fontWeight: "600", color: "var(--background)", children: t('New bot') }) })] })) : null, pinned.length ? (_jsxs(YStack, { "data-slot": "bots-pinned", "data-cols": cols, "data-icon-size": iconSize, "data-avatar-px": avatarPx, pt: 2, pb: 10, children: [_jsxs(XStack, { px: 14, pb: 6, items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: 5, children: [_jsx(Pin, { size: 11, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 15, fontWeight: "600", color: DIM, children: t('PINNED') })] }), _jsx(Text, { fontSize: 10, lineHeight: 14, color: DIM, children: `${SIZE_LABELS[iconSize]} · ${cols}c` })] }), _jsx(YStack, { "data-parity-key": "bots.grid", role: "group", "aria-label": t('Pinned bots'), display: "grid", gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`, "$max-md": colPref === 'auto' ? { gridTemplateColumns: 'repeat(3, minmax(0, 1fr))' } : undefined, px: 8, gap: cols === 1 ? 4 : 6, minW: 0, children: pinned.map((b) => {
|
|
90
|
+
const ext = b;
|
|
91
|
+
const here = b.name === open;
|
|
92
|
+
const isPrimary = Boolean(ext.isPrimary || b.name.toLowerCase() === PRIMARY_BOT);
|
|
93
|
+
const label = called(b.name);
|
|
94
|
+
const nameFont = iconSize === 'xs' ? 11 : iconSize === 'sm' ? 12 : 13;
|
|
95
|
+
if (cols === 1) {
|
|
96
|
+
return (_jsxs(XStack, { "data-parity-key": "bots.tile", "data-name": b.name, "data-primary": isPrimary ? 'true' : undefined, items: "center", gap: 8, px: 8, py: iconSize === 'xs' ? 5 : 6, rounded: 10, bg: here ? PICKED : 'transparent', borderWidth: 1, borderColor: here ? 'var(--border-strong)' : 'transparent', transition: "quickest", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-current": here, "aria-label": isPrimary ? `${label} (${t('Primary bot')})` : label, onClick: () => onPick(b.name), flex: 1, minW: 0, items: "center", gap: 8, p: 0, bg: "transparent", borderWidth: 0, cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Face, { bot: b, size: avatarPx, starred: isStarredBot(b) }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, maxW: "100%", fontSize: nameFont, lineHeight: 16, fontWeight: here || isPrimary ? '600' : '500', color: INK, children: label }), isPrimary ? (_jsx(Text, { fontSize: 11, lineHeight: 13, color: DIM, children: t('Primary') })) : null] })] }), _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "bots-unpin", "aria-label": t('Unpin {name}', { name: label }), onClick: () => togglePin(b.name), width: 22, height: 22, shrink: 0, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", opacity: 0.55, transition: "quickest", hoverStyle: { opacity: 1, bg: PICKED }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(PinOff, { size: 11, color: DIM, "aria-hidden": true }) })] }, b.id || b.name));
|
|
97
|
+
}
|
|
98
|
+
return (_jsxs(YStack, { position: "relative", "data-parity-key": "bots.tile", "data-name": b.name, "data-primary": isPrimary ? 'true' : undefined, rounded: 11, bg: here ? PICKED : 'transparent', borderWidth: 1, borderColor: here ? 'var(--border-strong)' : 'transparent', transition: "quickest", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, children: [_jsxs(YStack, { render: _jsx("button", { type: "button" }), "aria-current": here, "aria-label": isPrimary ? `${label} (${t('Primary bot')})` : label, onClick: () => onPick(b.name), width: "100%", minW: 0, rounded: 10, items: "center", pt: iconSize === 'xs' ? 6 : 8, pb: iconSize === 'xs' ? 5 : 7, px: 4, gap: iconSize === 'xs' ? 3 : 5, bg: "transparent", borderWidth: 0, cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Face, { bot: b, size: avatarPx, starred: isStarredBot(b) }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: nameFont, lineHeight: 16, fontWeight: here || isPrimary ? '600' : '400', color: INK, children: label }), isPrimary ? (_jsx(Text, { fontSize: 11, lineHeight: 13, color: DIM, children: t('Primary') })) : null] }), _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "bots-unpin", "aria-label": t('Unpin {name}', { name: label }), onClick: () => togglePin(b.name), position: "absolute", t: 3, r: 3, width: 18, height: 18, rounded: 5, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", opacity: 0.45, transition: "quickest", hoverStyle: { opacity: 1, bg: PICKED }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(PinOff, { size: 10, color: DIM, "aria-hidden": true }) })] }, b.id || b.name));
|
|
99
|
+
}) })] })) : null, pinned.length ? (_jsx(YStack, { "data-slot": "bots-divider", mx: 10, borderTopWidth: 1, borderColor: LINE })) : null, query.trim() && shown.length === 0 && shownGroups.length === 0 ? (_jsx(YStack, { px: 16, py: 32, items: "center", gap: 6, children: _jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, text: "center", children: t('No bots match “{query}”.', { query: query.trim() }) }) })) : null, shownGroups.length > 0 || (!query.trim() && onMakeGroup && !disabled) ? (_jsxs(YStack, { "data-parity-key": "bots.groups", role: "group", "aria-label": t('Bot groups'), mt: pinned.length ? 10 : 4, pt: pinned.length ? 8 : 6, pb: 6, gap: 4, children: [_jsxs(XStack, { px: 16, pb: 4, items: "center", justify: "space-between", children: [_jsxs(XStack, { items: "center", gap: 6, children: [_jsx(Layers, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "600", color: DIM, children: t('Groups & layers') })] }), onMakeGroup && !disabled ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: onMakeGroup, items: "center", gap: 4, px: 7, py: 3, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minH: 44, px: 10 }, children: [_jsx(Plus, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: t('Group') })] })) : null] }), shownGroups.length === 0 && onMakeGroup && !disabled ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: onMakeGroup, mx: 10, px: 12, py: 9, "$max-sm": { minH: 48 }, rounded: 10, items: "center", gap: 10, bg: RAISED, borderWidth: 1, borderColor: LINE, cursor: "pointer", transition: "quickest", hoverStyle: { bg: PICKED, borderColor: 'var(--border-strong)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Users, { size: 15, color: DIM, "aria-hidden": true }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", gap: 2, children: [_jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 17, fontWeight: "500", color: INK, children: t('Create a bot group') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 16, color: DIM, children: t('Leader, Lux Quasar, or majority layers') })] })] })) : null, shownGroups.map((g) => {
|
|
59
100
|
const ref = toGroupRef(g.name);
|
|
60
101
|
const here = open === ref;
|
|
61
102
|
return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-parity-key": "bots.group.row", "data-group": g.name, "aria-current": here, onClick: () => onPick(ref), minH: 54, mx: 6, px: 12, py: 8, gap: 10, items: "center", rounded: 10, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", transition: "quickest", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, 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", gap: 2, 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: 11, lineHeight: 15, color: DIM, shrink: 0, children: `L${g.layer || 1}` })] }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 12, lineHeight: 16, color: DIM, children: `${policyBadge(g.policy)} · ${g.members.length} bots` })] })] }, g.id || g.name));
|
|
62
|
-
})] })) : null,
|
|
103
|
+
})] })) : null, unpinned.length ? (_jsxs(YStack, { "data-slot": "bots-unpinned", "data-parity-key": "bots.rows", role: "group", "aria-label": t('All bots'), mt: 10, pt: 12, pb: 12, borderTopWidth: pinned.length || shownGroups.length || (onMakeGroup && !disabled) ? 1 : 0, borderColor: LINE, gap: 4, children: [_jsx(XStack, { px: 16, pb: 4, items: "center", children: _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "600", color: DIM, children: t('BOTS') }) }), unpinned.map((b) => {
|
|
63
104
|
const here = b.name === open;
|
|
64
105
|
const label = called(b.name);
|
|
65
106
|
const word = lastWord(last.get(b.name)) || b.description || '';
|
|
66
|
-
return (_jsxs(XStack, {
|
|
67
|
-
})] })) : null] }),
|
|
107
|
+
return (_jsxs(XStack, { "data-parity-key": "bots.row", "data-name": b.name, minH: 56, mx: 6, px: 10, py: 8, gap: 8, items: "center", rounded: 10, bg: here ? PICKED : 'transparent', transition: "quickest", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-current": here, onClick: () => onPick(b.name), flex: 1, minW: 0, gap: 10, items: "center", p: 0, bg: "transparent", borderWidth: 0, cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Face, { bot: b, size: 36 }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", gap: 2, children: [_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: label }), word ? (_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 12, lineHeight: 17, color: DIM, children: word })) : null] })] }), _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "bots-pin", "aria-label": t('Pin {name}', { name: label }), onClick: () => togglePin(b.name), width: 24, height: 24, shrink: 0, rounded: 6, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", opacity: 0.5, transition: "quickest", hoverStyle: { opacity: 1, bg: PICKED }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(Pin, { size: 12, color: DIM, "aria-hidden": true }) })] }, b.id || b.name));
|
|
108
|
+
})] })) : null, showWorkflows ? (_jsxs(YStack, { "data-slot": "bots-workflows", pt: 6, pb: 14, children: [_jsx(YStack, { mx: 10, mb: 8, borderTopWidth: 1, borderColor: LINE }), _jsxs(XStack, { render: "button", type: 'button', "data-slot": "bots-workflows-link", "aria-label": t('Workflows'), onClick: openWorkflows, height: 38, $touchable: { minH: 44 }, mx: 6, px: 12, gap: 10, minW: 0, items: "center", rounded: 10, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--rail-hover, var(--muted))' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsx(Workflow, { size: 15, color: DIM, "aria-hidden": true }), _jsx(Text, { ...CLIP, flex: 1, text: "left", fontSize: 13, lineHeight: 18, fontWeight: "500", color: INK, children: t('Workflows') }), _jsx(Text, { fontSize: 11, lineHeight: 14, color: DIM, children: FLOW })] })] })) : null] }), unpinned.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 })] }));
|
|
68
109
|
}
|
|
69
110
|
/** You, at the foot: your account, external Connectors, and unified Hanzo Preferences. */
|
|
70
111
|
function Foot({ me }) {
|
package/dist/bots/face.js
CHANGED
|
@@ -40,5 +40,7 @@ export function Face({ bot, size = 36, person = false, starred = false, }) {
|
|
|
40
40
|
const disc = src ? (_jsx(YStack, { render: "img", src, alt: '', onError: () => setFailed(true), "aria-hidden": true, ...round, objectFit: "cover" })) : (_jsx(YStack, { "aria-hidden": true, ...round, items: "center", justify: "center", bg: "var(--raised)", borderWidth: 1, borderColor: "var(--border)", userSelect: 'none', children: _jsx(Text, { color: INK, fontSize: glyph, lineHeight: glyph, fontWeight: "600", children: bot.emoji || initials }) }));
|
|
41
41
|
if (!starred)
|
|
42
42
|
return disc;
|
|
43
|
-
|
|
43
|
+
const badge = Math.max(12, Math.min(20, Math.round(size * 0.36)));
|
|
44
|
+
const star = Math.max(7, Math.round(badge * 0.52));
|
|
45
|
+
return (_jsxs(YStack, { position: "relative", width: size, height: size, shrink: 0, children: [disc, _jsx(YStack, { "aria-hidden": true, position: "absolute", r: -1, b: -1, width: badge, height: badge, rounded: 9999, items: "center", justify: "center", bg: "var(--warning, var(--chrome-dot-yellow))", borderWidth: size <= 28 ? 1.5 : 2, borderColor: FLOOR, children: _jsx(Star, { size: star, color: "var(--pure-white, var(--foreground))", fill: "currentColor", strokeWidth: 2 }) })] }));
|
|
44
46
|
}
|
package/dist/bots/grid.d.ts
CHANGED
|
@@ -2,6 +2,28 @@ import type { Agent, AgentRun } from '@hanzo/ai';
|
|
|
2
2
|
import type { BotGroup, GroupPolicy } from './api.js';
|
|
3
3
|
/** How many bots the grid holds before the rest become rows. */
|
|
4
4
|
export declare const GRID = 12;
|
|
5
|
+
/** Sidebar column count for the Pinned Bots grid (1 → 2 → 3). */
|
|
6
|
+
export type RosterColumns = 1 | 2 | 3;
|
|
7
|
+
/** User column preference: responsive width-driven (`auto`) or an explicit 1–3 column lock. */
|
|
8
|
+
export type RosterColumnPref = 'auto' | RosterColumns;
|
|
9
|
+
/** Default, minimum, and maximum widths (px) for the drag-resizable Bots sidebar. */
|
|
10
|
+
export declare const ROSTER_WIDTH_DEFAULT = 256;
|
|
11
|
+
export declare const ROSTER_WIDTH_MIN = 180;
|
|
12
|
+
export declare const ROSTER_WIDTH_MAX = 400;
|
|
13
|
+
/** Width breakpoints (px): <= 220 = 1 col, 221–295 = 2 cols, >= 296 = 3 cols. */
|
|
14
|
+
export declare const ROSTER_COL_2_MIN = 221;
|
|
15
|
+
export declare const ROSTER_COL_3_MIN = 296;
|
|
16
|
+
/** Maps a sidebar width (px) to 1, 2, or 3 pinned-bot grid columns. */
|
|
17
|
+
export declare function columnsForWidth(width: number): RosterColumns;
|
|
18
|
+
/** Resolves effective column count from sidebar width and optional explicit column preference. */
|
|
19
|
+
export declare function resolveColumns(width: number, pref?: RosterColumnPref): RosterColumns;
|
|
20
|
+
/** Four user-selectable avatar density sizes for the Pinned Bots sidebar. */
|
|
21
|
+
export type BotIconSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
22
|
+
export declare const BOT_ICON_SIZES: readonly BotIconSize[];
|
|
23
|
+
export declare const BOT_AVATAR_PX: Record<BotIconSize, number>;
|
|
24
|
+
export declare function isBotIconSize(value: unknown): value is BotIconSize;
|
|
25
|
+
/** Pixel diameter for a bot avatar at the chosen density step. */
|
|
26
|
+
export declare function avatarSizePx(size: BotIconSize): number;
|
|
5
27
|
/** Whether a bot wears the Primary / Lead star badge in the roster grid. */
|
|
6
28
|
export declare function isStarredBot(bot: Agent): boolean;
|
|
7
29
|
/** What a row says under a bot's name: its newest run's last word. */
|
|
@@ -11,6 +33,20 @@ export declare function split(bots: readonly Agent[], last: ReadonlyMap<string,
|
|
|
11
33
|
grid: Agent[];
|
|
12
34
|
rows: Agent[];
|
|
13
35
|
};
|
|
36
|
+
/** Default pinned bot names (lowercase) before the user customizes their pinned grid. */
|
|
37
|
+
export declare function defaultPinnedNames(bots: readonly Agent[]): string[];
|
|
38
|
+
/** Toggles a bot's membership in the pinned list (case-insensitive by name). */
|
|
39
|
+
export declare function togglePinnedBot(current: readonly string[], name: string): string[];
|
|
40
|
+
/**
|
|
41
|
+
* Partitions real bots into top Pinned Bots (`pinned`) and normal vertical rows (`unpinned`).
|
|
42
|
+
* When `pinnedNames` is `null`, falls back to the default `split()` grid/rows ordering.
|
|
43
|
+
* When `pinnedNames` is an explicit list, pinned bots stay above the hairline in pin/primary order
|
|
44
|
+
* and all remaining bots appear below sorted by latest activity, then rank/creation order.
|
|
45
|
+
*/
|
|
46
|
+
export declare function partitionPinned(bots: readonly Agent[], last: ReadonlyMap<string, AgentRun>, pinnedNames: readonly string[] | null): {
|
|
47
|
+
pinned: Agent[];
|
|
48
|
+
unpinned: Agent[];
|
|
49
|
+
};
|
|
14
50
|
/** Orders Bot Groups by layer ascending (`Layer 1`, `Layer 2`, ...), then alphabetically. */
|
|
15
51
|
export declare function sortGroupsByLayer(groups: readonly BotGroup[]): BotGroup[];
|
|
16
52
|
/** Compact human-readable badge for a group's consensus or leadership policy. */
|
package/dist/bots/grid.js
CHANGED
|
@@ -6,6 +6,39 @@ import { PRIMARY_BOT } from './api.js';
|
|
|
6
6
|
import { instant } from './time.js';
|
|
7
7
|
/** How many bots the grid holds before the rest become rows. */
|
|
8
8
|
export const GRID = 12;
|
|
9
|
+
/** Default, minimum, and maximum widths (px) for the drag-resizable Bots sidebar. */
|
|
10
|
+
export const ROSTER_WIDTH_DEFAULT = 256;
|
|
11
|
+
export const ROSTER_WIDTH_MIN = 180;
|
|
12
|
+
export const ROSTER_WIDTH_MAX = 400;
|
|
13
|
+
/** Width breakpoints (px): <= 220 = 1 col, 221–295 = 2 cols, >= 296 = 3 cols. */
|
|
14
|
+
export const ROSTER_COL_2_MIN = 221;
|
|
15
|
+
export const ROSTER_COL_3_MIN = 296;
|
|
16
|
+
/** Maps a sidebar width (px) to 1, 2, or 3 pinned-bot grid columns. */
|
|
17
|
+
export function columnsForWidth(width) {
|
|
18
|
+
if (width >= ROSTER_COL_3_MIN)
|
|
19
|
+
return 3;
|
|
20
|
+
if (width >= ROSTER_COL_2_MIN)
|
|
21
|
+
return 2;
|
|
22
|
+
return 1;
|
|
23
|
+
}
|
|
24
|
+
/** Resolves effective column count from sidebar width and optional explicit column preference. */
|
|
25
|
+
export function resolveColumns(width, pref = 'auto') {
|
|
26
|
+
return pref === 'auto' ? columnsForWidth(width) : pref;
|
|
27
|
+
}
|
|
28
|
+
export const BOT_ICON_SIZES = ['xs', 'sm', 'md', 'lg'];
|
|
29
|
+
export const BOT_AVATAR_PX = {
|
|
30
|
+
xs: 24,
|
|
31
|
+
sm: 32,
|
|
32
|
+
md: 44,
|
|
33
|
+
lg: 56,
|
|
34
|
+
};
|
|
35
|
+
export function isBotIconSize(value) {
|
|
36
|
+
return value === 'xs' || value === 'sm' || value === 'md' || value === 'lg';
|
|
37
|
+
}
|
|
38
|
+
/** Pixel diameter for a bot avatar at the chosen density step. */
|
|
39
|
+
export function avatarSizePx(size) {
|
|
40
|
+
return BOT_AVATAR_PX[size];
|
|
41
|
+
}
|
|
9
42
|
const LEAD_ORDER = new Map(['vi', 'opera', 'mana', 'dev', 'des', 'fin', 'huma', 'mark', 'sal', 'sci', 'su', 'cyber'].map((id, i) => [id, i]));
|
|
10
43
|
function rankOf(bot) {
|
|
11
44
|
const ext = bot;
|
|
@@ -48,6 +81,64 @@ export function split(bots, last) {
|
|
|
48
81
|
.sort((a, b) => (instant(last.get(b.name)?.createdAt) ?? 0) - (instant(last.get(a.name)?.createdAt) ?? 0));
|
|
49
82
|
return { grid, rows };
|
|
50
83
|
}
|
|
84
|
+
/** Default pinned bot names (lowercase) before the user customizes their pinned grid. */
|
|
85
|
+
export function defaultPinnedNames(bots) {
|
|
86
|
+
return split(bots, new Map()).grid.map((b) => b.name.toLowerCase());
|
|
87
|
+
}
|
|
88
|
+
/** Toggles a bot's membership in the pinned list (case-insensitive by name). */
|
|
89
|
+
export function togglePinnedBot(current, name) {
|
|
90
|
+
const key = name.trim().toLowerCase();
|
|
91
|
+
if (!key)
|
|
92
|
+
return [...current];
|
|
93
|
+
const normalized = current.map((n) => n.trim().toLowerCase()).filter(Boolean);
|
|
94
|
+
if (normalized.includes(key)) {
|
|
95
|
+
return normalized.filter((n) => n !== key);
|
|
96
|
+
}
|
|
97
|
+
return [...normalized, key];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Partitions real bots into top Pinned Bots (`pinned`) and normal vertical rows (`unpinned`).
|
|
101
|
+
* When `pinnedNames` is `null`, falls back to the default `split()` grid/rows ordering.
|
|
102
|
+
* When `pinnedNames` is an explicit list, pinned bots stay above the hairline in pin/primary order
|
|
103
|
+
* and all remaining bots appear below sorted by latest activity, then rank/creation order.
|
|
104
|
+
*/
|
|
105
|
+
export function partitionPinned(bots, last, pinnedNames) {
|
|
106
|
+
if (pinnedNames === null) {
|
|
107
|
+
const { grid, rows } = split(bots, last);
|
|
108
|
+
return { pinned: grid, unpinned: rows };
|
|
109
|
+
}
|
|
110
|
+
const order = new Map();
|
|
111
|
+
pinnedNames.forEach((n, idx) => {
|
|
112
|
+
const key = n.trim().toLowerCase();
|
|
113
|
+
if (key && !order.has(key))
|
|
114
|
+
order.set(key, idx);
|
|
115
|
+
});
|
|
116
|
+
const pinned = [];
|
|
117
|
+
const unpinned = [];
|
|
118
|
+
for (const bot of bots) {
|
|
119
|
+
if (order.has(bot.name.toLowerCase()))
|
|
120
|
+
pinned.push(bot);
|
|
121
|
+
else
|
|
122
|
+
unpinned.push(bot);
|
|
123
|
+
}
|
|
124
|
+
pinned.sort((a, b) => {
|
|
125
|
+
const oa = order.get(a.name.toLowerCase()) ?? Number.MAX_SAFE_INTEGER;
|
|
126
|
+
const ob = order.get(b.name.toLowerCase()) ?? Number.MAX_SAFE_INTEGER;
|
|
127
|
+
if (oa !== ob)
|
|
128
|
+
return oa - ob;
|
|
129
|
+
return rankOf(a) - rankOf(b);
|
|
130
|
+
});
|
|
131
|
+
unpinned.sort((a, b) => {
|
|
132
|
+
const dt = (instant(last.get(b.name)?.createdAt) ?? 0) - (instant(last.get(a.name)?.createdAt) ?? 0);
|
|
133
|
+
if (dt !== 0)
|
|
134
|
+
return dt;
|
|
135
|
+
const dr = rankOf(a) - rankOf(b);
|
|
136
|
+
if (dr !== 0)
|
|
137
|
+
return dr;
|
|
138
|
+
return (instant(a.createdAt) ?? 0) - (instant(b.createdAt) ?? 0);
|
|
139
|
+
});
|
|
140
|
+
return { pinned, unpinned };
|
|
141
|
+
}
|
|
51
142
|
/** Orders Bot Groups by layer ascending (`Layer 1`, `Layer 2`, ...), then alphabetically. */
|
|
52
143
|
export function sortGroupsByLayer(groups) {
|
|
53
144
|
return [...groups].sort((a, b) => {
|
package/dist/bots/ink.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ export declare const MINE = "color-mix(in oklab, var(--foreground) 17%, var(--pa
|
|
|
11
11
|
export declare const INK = "var(--foreground)";
|
|
12
12
|
export declare const DIM = "var(--text-secondary, var(--muted-foreground))";
|
|
13
13
|
export declare const FAINT = "$faint";
|
|
14
|
-
export declare const LINE = "var(--pane-edge, var(--
|
|
14
|
+
export declare const LINE = "var(--pane-edge, var(--white-08))";
|
|
15
15
|
/** The composer's edge, the one control drawn a step louder. */
|
|
16
16
|
export declare const EDGE = "var(--border-strong)";
|
package/dist/bots/ink.js
CHANGED
|
@@ -15,6 +15,6 @@ export const MINE = 'color-mix(in oklab, var(--foreground) 17%, var(--pane-fill,
|
|
|
15
15
|
export const INK = 'var(--foreground)';
|
|
16
16
|
export const DIM = 'var(--text-secondary, var(--muted-foreground))';
|
|
17
17
|
export const FAINT = '$faint';
|
|
18
|
-
export const LINE = 'var(--pane-edge, var(--
|
|
18
|
+
export const LINE = 'var(--pane-edge, var(--white-08))';
|
|
19
19
|
/** The composer's edge, the one control drawn a step louder. */
|
|
20
20
|
export const EDGE = 'var(--border-strong)';
|
package/dist/bots/kit.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
/** A round icon control, 34px: the roster's search and new, Share, Preferences, Close. */
|
|
1
|
+
/** A round icon control, 34px on desktop and 44px under touch pointers: the roster's search and new, Share, Preferences, Close. */
|
|
2
2
|
export declare const ROUND: {
|
|
3
3
|
readonly render: 'button';
|
|
4
4
|
readonly type: 'button';
|
|
5
5
|
readonly width: 34;
|
|
6
6
|
readonly height: 34;
|
|
7
|
+
readonly $touchable: {
|
|
8
|
+
readonly minW: 44;
|
|
9
|
+
readonly minH: 44;
|
|
10
|
+
};
|
|
7
11
|
readonly shrink: 0;
|
|
8
12
|
readonly rounded: 999;
|
|
9
13
|
readonly bg: "var(--surface-card-emphasis)";
|
|
10
14
|
readonly borderWidth: 1;
|
|
11
|
-
readonly borderColor: "var(--pane-edge, var(--
|
|
15
|
+
readonly borderColor: "var(--pane-edge, var(--white-08))";
|
|
12
16
|
readonly items: 'center';
|
|
13
17
|
readonly justify: 'center';
|
|
14
18
|
readonly cursor: 'pointer';
|
|
@@ -34,7 +38,7 @@ export declare const PILL: {
|
|
|
34
38
|
readonly rounded: 999;
|
|
35
39
|
readonly bg: "var(--surface-card-emphasis)";
|
|
36
40
|
readonly borderWidth: 1;
|
|
37
|
-
readonly borderColor: "var(--pane-edge, var(--
|
|
41
|
+
readonly borderColor: "var(--pane-edge, var(--white-08))";
|
|
38
42
|
readonly cursor: 'pointer';
|
|
39
43
|
readonly shrink: 0;
|
|
40
44
|
readonly hoverStyle: {
|
|
@@ -67,7 +71,7 @@ export declare const LABEL: {
|
|
|
67
71
|
export declare const CARD: {
|
|
68
72
|
readonly bg: "var(--surface-card-emphasis)";
|
|
69
73
|
readonly borderWidth: 1;
|
|
70
|
-
readonly borderColor: "var(--pane-edge, var(--
|
|
74
|
+
readonly borderColor: "var(--pane-edge, var(--white-08))";
|
|
71
75
|
readonly rounded: 14;
|
|
72
76
|
};
|
|
73
77
|
/** One line, cut with an ellipsis where it runs out of space. */
|
package/dist/bots/kit.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// The controls the Bots app is drawn from, as gui props, stated once and spread
|
|
2
2
|
// where they are drawn.
|
|
3
3
|
import { DIM, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
4
|
-
/** A round icon control, 34px: the roster's search and new, Share, Preferences, Close. */
|
|
4
|
+
/** A round icon control, 34px on desktop and 44px under touch pointers: the roster's search and new, Share, Preferences, Close. */
|
|
5
5
|
export const ROUND = {
|
|
6
6
|
render: 'button',
|
|
7
7
|
type: 'button',
|
|
8
8
|
width: 34,
|
|
9
9
|
height: 34,
|
|
10
|
+
$touchable: { minW: 44, minH: 44 },
|
|
10
11
|
shrink: 0,
|
|
11
12
|
rounded: 999,
|
|
12
13
|
bg: RAISED,
|
package/dist/ground.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export declare const pane: (fill?: string) => {
|
|
|
17
17
|
readonly borderRadius: 'var(--pane-round)';
|
|
18
18
|
readonly borderWidth: 1;
|
|
19
19
|
readonly borderStyle: 'solid';
|
|
20
|
-
readonly borderColor: 'var(--pane-edge, var(--
|
|
20
|
+
readonly borderColor: 'var(--pane-edge, var(--white-08))';
|
|
21
21
|
readonly backdropFilter: 'var(--pane-blur)';
|
|
22
22
|
};
|
|
23
23
|
/**
|
package/dist/ground.js
CHANGED
|
@@ -12,12 +12,12 @@
|
|
|
12
12
|
* `!important`: a Dev run's pane steps aside for the two panes inside it by
|
|
13
13
|
* slot (@hanzo/build's `run-split`), and an important shadow would stay behind.
|
|
14
14
|
*/
|
|
15
|
-
export const pane = (fill = 'var(--pane-fill)') => ({
|
|
15
|
+
export const pane = (fill = 'var(--pane-fill, var(--card))') => ({
|
|
16
16
|
backgroundColor: fill,
|
|
17
17
|
borderRadius: 'var(--pane-round)',
|
|
18
18
|
borderWidth: 1,
|
|
19
19
|
borderStyle: 'solid',
|
|
20
|
-
borderColor: 'var(--pane-edge, var(--
|
|
20
|
+
borderColor: 'var(--pane-edge, var(--white-08))',
|
|
21
21
|
backdropFilter: 'var(--pane-blur)',
|
|
22
22
|
});
|
|
23
23
|
/**
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Artifact } from '@hanzo/build';
|
|
2
|
+
/** One turn as the thread holds it: who said it, and what. */
|
|
3
|
+
interface Turn {
|
|
4
|
+
role: string;
|
|
5
|
+
content?: unknown;
|
|
6
|
+
}
|
|
7
|
+
/** The last page or picture an answer in `turns` wrote, or null: what the Preview opens. */
|
|
8
|
+
export declare function written(turns: readonly Turn[]): Artifact | null;
|
|
9
|
+
export {};
|
package/dist/lastpage.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// The page a conversation last wrote: what Chat's Preview opens (Chat.tsx
|
|
2
|
+
// `PreviewButton`, and `see`). Pure, so the tests read it without a pane.
|
|
3
|
+
import { artifacts, renders } from '@hanzo/build';
|
|
4
|
+
/** The last page or picture an answer in `turns` wrote, or null: what the Preview opens. */
|
|
5
|
+
export function written(turns) {
|
|
6
|
+
for (let i = turns.length - 1; i >= 0; i--) {
|
|
7
|
+
const one = turns[i];
|
|
8
|
+
if (one.role !== 'assistant' || typeof one.content !== 'string')
|
|
9
|
+
continue;
|
|
10
|
+
const page = [...artifacts(one.content)].reverse().find(renders);
|
|
11
|
+
if (page)
|
|
12
|
+
return page;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
package/dist/lib/durable.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hanzo Tasks — the durable execution engine — as the board reaches it.
|
|
3
3
|
*
|
|
4
|
-
* TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/
|
|
4
|
+
* TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/task` holds what
|
|
5
5
|
* should be done and who holds it; `/v1/tasks` runs work that survives a crash,
|
|
6
6
|
* event-sourced and replayable. They are not two spellings of one thing: a card
|
|
7
7
|
* is dragged between columns and a run is replayed, and neither verb makes sense
|
package/dist/lib/durable.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hanzo Tasks — the durable execution engine — as the board reaches it.
|
|
3
3
|
*
|
|
4
|
-
* TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/
|
|
4
|
+
* TWO SUBSYSTEMS, ONE SEAM, and the seam is the point. `/v1/task` holds what
|
|
5
5
|
* should be done and who holds it; `/v1/tasks` runs work that survives a crash,
|
|
6
6
|
* event-sourced and replayable. They are not two spellings of one thing: a card
|
|
7
7
|
* is dragged between columns and a run is replayed, and neither verb makes sense
|
package/dist/lib/todo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The board's store: `/v1/
|
|
2
|
+
* The board's store: `/v1/task` with resilient local cache fallback.
|
|
3
3
|
*
|
|
4
4
|
* A card IS a forge issue — the platform's own words: "the column is a LABEL on
|
|
5
5
|
* the forge, so the board and the forge web UI are the same object seen twice:
|
package/dist/lib/todo.js
CHANGED
|
@@ -145,7 +145,7 @@ export async function board(client, params = {}, signal) {
|
|
|
145
145
|
if (params.scheduled !== undefined)
|
|
146
146
|
query.scheduled = String(params.scheduled);
|
|
147
147
|
const out = await client.http.json({
|
|
148
|
-
path: '/v1/
|
|
148
|
+
path: '/v1/task/board',
|
|
149
149
|
query,
|
|
150
150
|
signal,
|
|
151
151
|
});
|
|
@@ -178,7 +178,7 @@ async function served(client, signal, map = new Map()) {
|
|
|
178
178
|
const [todoPs, devPs] = await Promise.all([
|
|
179
179
|
client.http
|
|
180
180
|
.json({
|
|
181
|
-
path: '/v1/
|
|
181
|
+
path: '/v1/task/projects',
|
|
182
182
|
signal,
|
|
183
183
|
})
|
|
184
184
|
.catch(() => null),
|
|
@@ -248,7 +248,7 @@ export async function open(client, key, card, signal) {
|
|
|
248
248
|
try {
|
|
249
249
|
const created = await client.http.json({
|
|
250
250
|
method: 'POST',
|
|
251
|
-
path: `/v1/
|
|
251
|
+
path: `/v1/task/projects/${encodeURIComponent(key)}/issues`,
|
|
252
252
|
body: card,
|
|
253
253
|
signal,
|
|
254
254
|
});
|
|
@@ -288,7 +288,7 @@ export async function edit(client, key, num, patch, signal) {
|
|
|
288
288
|
try {
|
|
289
289
|
const serverUpdated = await client.http.json({
|
|
290
290
|
method: 'PATCH',
|
|
291
|
-
path: `/v1/
|
|
291
|
+
path: `/v1/task/projects/${encodeURIComponent(key)}/issues/${num}`,
|
|
292
292
|
body: patch,
|
|
293
293
|
signal,
|
|
294
294
|
});
|
|
@@ -306,7 +306,7 @@ export async function claim(client, key, num, signal) {
|
|
|
306
306
|
try {
|
|
307
307
|
return await client.http.json({
|
|
308
308
|
method: 'POST',
|
|
309
|
-
path: `/v1/
|
|
309
|
+
path: `/v1/task/projects/${encodeURIComponent(key)}/issues/${num}/claim`,
|
|
310
310
|
body: {},
|
|
311
311
|
signal,
|
|
312
312
|
});
|
package/dist/seek.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Press } from './chord.js';
|
|
2
2
|
/** A row the palette can list. */
|
|
3
3
|
export interface Hit {
|
|
4
4
|
id: string;
|
|
@@ -40,3 +40,8 @@ export declare function find<T extends Hit>(query: string, recent: T[], idle: Gr
|
|
|
40
40
|
* unless something on the page already answered it (Dev's composer opens its own commands and claims it).
|
|
41
41
|
*/
|
|
42
42
|
export declare const summons: (e: Press) => boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Whether a key press toggles the sidebar: ⌘B or Ctrl+B, once a press,
|
|
45
|
+
* ignored while typing in an input, textarea, select, or contenteditable target.
|
|
46
|
+
*/
|
|
47
|
+
export declare const togglesSidebar: (e: Press) => boolean;
|
package/dist/seek.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// in what order, under which heading, and which key press opens it. No React,
|
|
3
3
|
// so a spec reads them as they are.
|
|
4
4
|
import { phrase } from '@hanzo/i18n';
|
|
5
|
+
import { typing } from './chord.js';
|
|
5
6
|
/** The most rows one group shows for a query. */
|
|
6
7
|
export const CAP = 5;
|
|
7
8
|
/** The rows Recent lists on an empty field. */
|
|
@@ -81,3 +82,15 @@ export function find(query, recent, idle, all) {
|
|
|
81
82
|
* unless something on the page already answered it (Dev's composer opens its own commands and claims it).
|
|
82
83
|
*/
|
|
83
84
|
export const summons = (e) => !e.defaultPrevented && (e.metaKey || e.ctrlKey) && !e.altKey && !e.shiftKey && !e.repeat && !e.isComposing && (e.key ?? '').toLowerCase() === 'k';
|
|
85
|
+
/**
|
|
86
|
+
* Whether a key press toggles the sidebar: ⌘B or Ctrl+B, once a press,
|
|
87
|
+
* ignored while typing in an input, textarea, select, or contenteditable target.
|
|
88
|
+
*/
|
|
89
|
+
export const togglesSidebar = (e) => !e.defaultPrevented &&
|
|
90
|
+
(e.metaKey || e.ctrlKey) &&
|
|
91
|
+
!e.altKey &&
|
|
92
|
+
!e.shiftKey &&
|
|
93
|
+
!e.repeat &&
|
|
94
|
+
!e.isComposing &&
|
|
95
|
+
(e.key ?? '').toLowerCase() === 'b' &&
|
|
96
|
+
!typing(e.target);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.97",
|
|
4
4
|
"description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|