@hanzo/app 0.3.93 → 0.3.95
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/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +113 -47
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.js +210 -151
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.js +18 -13
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +6 -2
- package/dist/bots/kit.d.ts +1 -0
- package/dist/bots/kit.js +1 -1
- package/dist/bots/refusal.d.ts +13 -4
- package/dist/bots/refusal.js +62 -8
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +6 -0
- package/dist/lib/todo.js +37 -25
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/bots/Thread.js
CHANGED
|
@@ -11,24 +11,38 @@ import { Text, XStack, YStack } from '@hanzo/gui';
|
|
|
11
11
|
import { Caret } from '@hanzo/ui/chat';
|
|
12
12
|
import { Composer, Control, Field } from '@hanzo/composer';
|
|
13
13
|
import { speech, useDictation, useVoice, Voice } from '@hanzo/voice';
|
|
14
|
-
|
|
14
|
+
/** Strip gui-injected `onPress` before forwarding props to `@hanzo/voice`'s native HTML `<button>`. */
|
|
15
|
+
function VoiceSlot({ onPress: _onPress, ...props }) {
|
|
16
|
+
return _jsx(Voice, { ...props });
|
|
17
|
+
}
|
|
18
|
+
import { ArrowDown, ArrowLeft, ArrowUp, AudioLines, Check, Copy, Gauge, Mic, Plus, Share, X } from 'lucide-react';
|
|
15
19
|
import { base } from '../lib/ai.js';
|
|
16
20
|
import { Prose } from '../Prose.js';
|
|
17
21
|
import { called } from '../team.js';
|
|
18
22
|
import { Face } from './face.js';
|
|
19
23
|
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
20
|
-
import { DIM, EDGE, GROUND, INK, LINE, MINE, RAISED } from './ink.js';
|
|
24
|
+
import { DIM, EDGE, GROUND, INK, LINE, MINE, PICKED, RAISED } from './ink.js';
|
|
21
25
|
import { instant } from './time.js';
|
|
22
26
|
import { lines, partsOf } from './said.js';
|
|
23
27
|
import { compose, fits, MAX, texty } from './carry.js';
|
|
24
28
|
import { PARAM } from './api.js';
|
|
25
29
|
function DocBadge({ ext }) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
return (_jsxs(YStack, { "aria-hidden": true, width: 44, height: 46, shrink: 0, rounded: 9, overflow: "hidden", bg: GROUND, borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsxs(YStack, { flex: 1, px: 7, pt: 6, gap: 4, justify: "center", children: [_jsxs(XStack, { gap: 3, children: [_jsx(YStack, { width: 9, height: 9, rounded: 2, bg: "var(--muted-foreground)", opacity: 0.4 }), _jsxs(YStack, { flex: 1, gap: 3, justify: "center", children: [_jsx(YStack, { height: 3, rounded: 2, bg: "var(--muted-foreground)", opacity: 0.4 }), _jsx(YStack, { height: 3, width: "75%", rounded: 2, bg: "var(--muted-foreground)", opacity: 0.3 })] })] }), _jsx(YStack, { height: 3, rounded: 2, bg: "var(--muted-foreground)", opacity: 0.34 })] }), _jsx(YStack, { height: 16, bg: PICKED, items: "center", justify: "center", px: 2, children: _jsx(Text, { fontFamily: "$mono", fontSize: 11, lineHeight: 13, fontWeight: "600", color: INK, numberOfLines: 1, children: (ext || 'file').slice(0, 4).toLowerCase() }) })] }));
|
|
31
|
+
}
|
|
32
|
+
function CopyMessageButton({ text }) {
|
|
33
|
+
const { t } = useI18n();
|
|
34
|
+
const [copied, setCopied] = useState(false);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!copied)
|
|
37
|
+
return;
|
|
38
|
+
const id = window.setTimeout(() => setCopied(false), 1600);
|
|
39
|
+
return () => window.clearTimeout(id);
|
|
40
|
+
}, [copied]);
|
|
41
|
+
if (!text.trim())
|
|
42
|
+
return null;
|
|
43
|
+
return (_jsx(XStack, { opacity: copied ? 1 : 0, "$group-hover": { opacity: 1 }, focusWithinStyle: { opacity: 1 }, $touchable: { opacity: 1 }, "$max-sm": { opacity: 1 }, transition: "quickest", pt: 2, children: _jsx(XStack, { render: _jsx("button", { type: "button", title: copied ? t('Copied') : t('Copy') }), "aria-label": copied ? t('Copied') : t('Copy message'), onClick: () => {
|
|
44
|
+
void navigator.clipboard?.writeText(text).then(() => setCopied(true), () => { });
|
|
45
|
+
}, items: "center", justify: "center", gap: 4, height: 26, minW: 26, px: 6, rounded: 6, bg: copied ? RAISED : 'transparent', borderWidth: 1, borderColor: copied ? 'var(--border-strong)' : 'transparent', cursor: "pointer", transition: "quickest", hoverStyle: { bg: RAISED, borderColor: 'var(--border-strong)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minW: 44, minH: 44 }, children: copied ? (_jsxs(_Fragment, { children: [_jsx(Check, { size: 12, color: "var(--state-success)", "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 14, color: INK, children: t('Copied') })] })) : (_jsx(Copy, { size: 12, color: DIM, "aria-hidden": true })) }) }));
|
|
32
46
|
}
|
|
33
47
|
/** "It resets in 3 days." from the instant a refusal lifts, in the reader's calendar days. */
|
|
34
48
|
function lifts(iso, now, t) {
|
|
@@ -48,6 +62,8 @@ export function Thread({ bot, bots, runs, pending, notice, wrong, side, live, lo
|
|
|
48
62
|
const [shared, setShared] = useState(null);
|
|
49
63
|
const [file, setFile] = useState(null);
|
|
50
64
|
const [note, setNote] = useState(null);
|
|
65
|
+
const [scrolledUp, setScrolledUp] = useState(false);
|
|
66
|
+
const scrollRef = useRef(null);
|
|
51
67
|
const foot = useRef(null);
|
|
52
68
|
const pick = useRef(null);
|
|
53
69
|
const { token } = useIamToken();
|
|
@@ -118,41 +134,52 @@ export function Thread({ bot, bots, runs, pending, notice, wrong, side, live, lo
|
|
|
118
134
|
});
|
|
119
135
|
};
|
|
120
136
|
const hasDraft = Boolean(draft.trim() || file);
|
|
121
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.bar", position: "absolute", t: 0, l: 0, r: 0, z: 4, height: 46, px: 14, items: "center", gap: 8, pointerEvents: "none", "$platform-web": {
|
|
137
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.bar", position: "absolute", t: 0, l: 0, r: 0, z: 4, height: 46, "$max-md": { height: 54, px: 10 }, px: 14, items: "center", gap: 8, pointerEvents: "none", "$platform-web": {
|
|
122
138
|
backgroundImage: `linear-gradient(to bottom, ${GROUND} 18%, color-mix(in srgb, ${GROUND} 68%, transparent) 64%, transparent)`,
|
|
123
|
-
}, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", children: _jsx(XStack, { ...ROUND, pointerEvents: "auto", "aria-label": t('All bots'), onClick: onBack, display: "none", "$max-md": { display: 'flex' }, children: _jsx(ArrowLeft, { size: 16, color: INK, "aria-hidden": true, "data-i18n-mirror": true }) }) }), bot ? (_jsxs(XStack, { ...PILL, pointerEvents: "auto", "data-parity-key": "bots.pill", "aria-label": t('{name}’s details', { name: displayName }), "aria-expanded": side, onClick: onSide, height: 36, pl: 6, pr: 13, maxW: "60%", bg: RAISED, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: [_jsx(Face, { bot: bot, size: 24 }), _jsx(Text, { ...WORD, ...CLIP, children: displayName })] })) : null, _jsx(XStack, { flex: 1, minW: 0, items: "center", justify: "flex-end", children: bot ? (_jsx(XStack, { ...ROUND, pointerEvents: "auto", "data-parity-key": "bots.share", "aria-label": shared ?? t('Share'), onClick: share, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: shared ? _jsx(Check, { size: 15, color:
|
|
139
|
+
}, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", children: _jsx(XStack, { ...ROUND, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, pointerEvents: "auto", "aria-label": t('All bots'), onClick: onBack, display: "none", "$max-md": { display: 'flex' }, children: _jsx(ArrowLeft, { size: 16, color: INK, "aria-hidden": true, "data-i18n-mirror": true }) }) }), bot ? (_jsxs(XStack, { ...PILL, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, pointerEvents: "auto", "data-parity-key": "bots.pill", "aria-label": t('{name}’s details', { name: displayName }), "aria-expanded": side, onClick: onSide, height: 36, "$max-sm": { minH: 44 }, pl: 6, pr: 13, maxW: "60%", bg: RAISED, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: [_jsx(Face, { bot: bot, size: 24 }), _jsx(Text, { ...WORD, ...CLIP, children: displayName })] })) : null, _jsx(XStack, { flex: 1, minW: 0, items: "center", justify: "flex-end", children: bot ? (_jsx(XStack, { ...ROUND, borderColor: "var(--border-strong)", focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { width: 44, height: 44 }, pointerEvents: "auto", "data-parity-key": "bots.share", "aria-label": shared ?? t('Share'), onClick: share, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: shared ? _jsx(Check, { size: 15, color: "var(--state-success)", "aria-hidden": true }) : _jsx(Share, { size: 15, color: INK, "aria-hidden": true }) })) : null })] }), !bot ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", gap: 20, px: 24, pt: 24, pb: 64, children: live && loaded && bots.length === 0 ? (_jsxs(_Fragment, { children: [_jsxs(YStack, { items: "center", gap: 6, maxW: 380, children: [_jsx(Text, { render: "h1", 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, px: 18, hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, "$max-sm": { minH: 44 }, onClick: onMake, children: _jsx(Text, { ...WORD, fontWeight: "600", color: "var(--background)", children: t('New bot') }) })] })) : null })) : (_jsx(YStack, { ref: scrollRef, "data-parity-key": "bots.thread", flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", onScroll: (e) => {
|
|
140
|
+
const el = e.currentTarget ?? scrollRef.current;
|
|
141
|
+
if (!el)
|
|
142
|
+
return;
|
|
143
|
+
const dist = el.scrollHeight - el.clientHeight - el.scrollTop;
|
|
144
|
+
setScrolledUp(dist > 120);
|
|
145
|
+
}, children: _jsxs(YStack, { width: "100%", maxW: 760, mx: "auto", px: 18, pt: 58, pb: 18, "$max-md": { px: 12, pt: 64 }, children: [said.map((line, i) => {
|
|
124
146
|
const prev = said[i - 1];
|
|
125
|
-
const gap = !prev ? 0 : line.kind === prev.kind && (line.kind === 'mine' || line.kind === 'theirs') ? 6 :
|
|
147
|
+
const gap = !prev ? 0 : line.kind === prev.kind && (line.kind === 'mine' || line.kind === 'theirs') ? 6 : 18;
|
|
126
148
|
if (line.kind === 'stamp')
|
|
127
|
-
return (_jsx(Text, { self: "center", mt: i ?
|
|
149
|
+
return (_jsx(Text, { self: "center", mt: i ? 24 : 4, mb: 8, fontSize: 12, lineHeight: 17, color: DIM, children: line.text }, line.key));
|
|
128
150
|
if (line.kind === 'from')
|
|
129
151
|
return (_jsxs(XStack, { self: "center", mt: gap, items: "center", gap: 6, children: [_jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: t('Message from') }), _jsx(Face, { bot: line.bot, size: 16 }), _jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: called(line.bot.name) })] }, line.key));
|
|
130
152
|
if (line.kind === 'mine')
|
|
131
|
-
return (_jsx(YStack, { self: "flex-end", items: "flex-end", maxW: "76%", mt: gap, children: _jsx(Text, { "data-parity-key": "bots.mine", render: "div", px: 14, py: 8, rounded: 18, fontSize: 15, lineHeight: 22, color: INK, whiteSpace: "pre-wrap", "$platform-web": { overflowWrap: 'anywhere', backgroundColor: MINE }, children: line.text }) }, line.key));
|
|
153
|
+
return (_jsx(YStack, { group: true, self: "flex-end", items: "flex-end", maxW: "76%", "$max-md": { maxW: '86%' }, mt: gap, children: _jsx(Text, { "data-parity-key": "bots.mine", render: "div", px: 14, py: 8, rounded: 18, fontSize: 15, lineHeight: 22, color: INK, whiteSpace: "pre-wrap", "$platform-web": { overflowWrap: 'anywhere', backgroundColor: MINE }, children: line.text }) }, line.key));
|
|
132
154
|
if (line.kind === 'thinking')
|
|
133
155
|
return (_jsx(XStack, { "data-parity-key": "bots.thinking", role: "status", "aria-label": t('{name} is working', { name: displayName }), self: "flex-start", mt: gap, px: 14, height: 38, items: "center", rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(Caret, {}) }, line.key));
|
|
134
156
|
if (line.kind === 'theirs' && line.failed)
|
|
135
|
-
return (_jsx(YStack, { "data-parity-key": "bots.theirs", self: "flex-start", maxW: 680, mt: gap, px: 15, py: 11, rounded: 18, bg: RAISED, borderWidth: 1, borderColor: LINE, "$max-md": { maxW: '92%' }, children: _jsx(Text, { fontSize: 15, lineHeight: 22, color:
|
|
157
|
+
return (_jsx(YStack, { "data-parity-key": "bots.theirs", self: "flex-start", maxW: 680, mt: gap, px: 15, py: 11, rounded: 18, bg: RAISED, borderWidth: 1, borderColor: LINE, "$max-md": { maxW: '92%' }, children: _jsx(Text, { fontSize: 15, lineHeight: 22, color: "var(--state-error)", children: line.text }) }, line.key));
|
|
136
158
|
const parts = partsOf(line.text);
|
|
137
|
-
return (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}), wrong ? (_jsx(Text, { render: "p", self: "center", mt: 12, fontSize: 13, lineHeight: 18, color:
|
|
159
|
+
return (_jsxs(YStack, { group: true, "data-parity-key": line.kind === 'other' ? 'bots.other' : 'bots.theirs', self: "flex-start", items: "flex-start", gap: 8, maxW: "100%", mt: gap, children: [parts.map((part, idx) => {
|
|
160
|
+
if (part.kind === 'doc') {
|
|
161
|
+
const inner = (_jsxs(XStack, { px: 12, py: 10, gap: 12, items: "center", rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, hoverStyle: { borderColor: 'var(--border-strong)' }, maxW: 290, children: [_jsx(DocBadge, { ext: part.ext }), _jsxs(YStack, { flex: 1, minW: 0, gap: 2, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: part.name }), part.size ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: part.size })) : null] })] }));
|
|
162
|
+
return part.href ? (_jsx(YStack, { render: "a", href: part.href, target: '_blank', rel: 'noopener noreferrer', "$platform-web": { textDecoration: 'none' }, children: inner }, idx)) : (_jsx(YStack, { children: inner }, idx));
|
|
163
|
+
}
|
|
164
|
+
if (part.kind === 'image') {
|
|
165
|
+
return (_jsx(YStack, { width: 172, rounded: 14, overflow: "hidden", bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(YStack, { render: "img", src: part.src, alt: part.alt, width: "100%", height: "auto", display: "block" }) }, idx));
|
|
166
|
+
}
|
|
167
|
+
return (_jsx(YStack, { maxW: 680, px: 15, py: 11, rounded: 18, bg: RAISED, borderWidth: 1, borderColor: LINE, "$max-md": { maxW: '92%' }, children: _jsx(Prose, { text: part.text }) }, idx));
|
|
168
|
+
}), _jsx(CopyMessageButton, { text: line.text })] }, line.key));
|
|
169
|
+
}), wrong ? (_jsx(Text, { render: "p", role: "alert", self: "center", mt: 12, fontSize: 13, lineHeight: 18, color: "var(--state-error)", children: wrong })) : null, _jsx("div", { ref: foot })] }) })), bot && scrolledUp ? (_jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-label": t('Scroll to bottom'), "data-slot": "bots-to-bottom", onClick: () => {
|
|
170
|
+
foot.current?.scrollIntoView({
|
|
171
|
+
block: 'end',
|
|
172
|
+
behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth',
|
|
173
|
+
});
|
|
174
|
+
}, position: "absolute", b: 72, l: "50%", ml: -18, width: 36, height: 36, "$max-sm": { width: 44, height: 44, ml: -22 }, rounded: 999, items: "center", justify: "center", cursor: "pointer", bg: RAISED, borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-lg)", transition: "quickest", hoverStyle: { bg: PICKED }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, z: 5, children: _jsx(ArrowDown, { size: 16, color: INK, "aria-hidden": true }) })) : null, bot ? (_jsxs(YStack, { width: "100%", maxW: 760, mx: "auto", minW: 0, px: 16, pb: 14, gap: 10, shrink: 0, "$max-md": { px: 10, pb: 10 }, children: [notice ? (_jsxs(YStack, { "data-parity-key": "bots.notice", role: "alert", bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 16, pt: 13, pb: 12, px: 14, gap: 12, children: [_jsxs(XStack, { items: "flex-start", gap: 10, children: [_jsx(YStack, { pt: 2, children: _jsx(Gauge, { size: 16, color: DIM, "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, gap: 4, children: [_jsx(Text, { fontSize: 14, lineHeight: 20, fontWeight: "500", color: INK, children: notice.message }), lifts(notice.resets, now, t) ? (_jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, children: lifts(notice.resets, now, t) })) : null] }), _jsx(XStack, { ...ROUND, width: 28, height: 28, bg: "transparent", borderWidth: 0, "aria-label": t('Dismiss'), onClick: onDismiss, children: _jsx(X, { size: 14, color: DIM, "aria-hidden": true }) })] }), notice.actions.some(navigable) ? (_jsx(XStack, { justify: "flex-end", gap: 8, flexWrap: "wrap", children: notice.actions.filter(navigable).map((a, i, all) => (_jsx(XStack, { ...PILL, render: "a", href: a.url, height: 34, bg: i === all.length - 1 ? INK : RAISED, borderColor: i === all.length - 1 ? INK : LINE, "$platform-web": { textDecoration: 'none' }, children: _jsx(Text, { ...WORD, color: i === all.length - 1 ? 'var(--background)' : INK, children: a.label }) }, `${a.kind}-${a.label}`))) })) : null] })) : null, file ? (_jsxs(XStack, { self: "flex-start", items: "center", gap: 6, height: 30, pl: 12, pr: 4, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsx(Text, { ...CLIP, maxW: 260, fontSize: 13, lineHeight: 18, color: INK, children: file.name }), _jsx(XStack, { ...ROUND, width: 24, height: 24, bg: "transparent", borderWidth: 0, "aria-label": t('Remove {name}', { name: file.name }), onClick: () => setFile(null), children: _jsx(X, { size: 12, color: DIM, "aria-hidden": true }) })] })) : null, note ? (_jsx(Text, { role: "alert", fontSize: 13, lineHeight: 18, color: "var(--state-error)", px: 8, children: note })) : null, _jsx(Composer, { render: "form", onSubmit: (e) => {
|
|
148
175
|
e.preventDefault();
|
|
149
176
|
submit();
|
|
150
|
-
}, control: 32, width: "100%", children: _jsxs(XStack, { "data-parity-key": "bots.composer",
|
|
177
|
+
}, control: 32, width: "100%", minW: 0, children: _jsxs(XStack, { "data-parity-key": "bots.composer", minH: 46, "$max-sm": { minH: 48, pl: 6, pr: 6, gap: 4 }, pl: 7, pr: 7, gap: 6, items: "center", rounded: 999, bg: RAISED, borderWidth: 1, borderColor: EDGE, focusWithinStyle: { borderColor: 'var(--ring)' }, children: [_jsx(Control, { type: "button", "aria-label": t('Add a text file'), onClick: () => pick.current?.click(), disabled: !live, children: _jsx(Plus, { size: 16 }) }), _jsx(Field, { value: draft, onChangeText: setDraft, onKeyDown: (e) => {
|
|
151
178
|
if (e.key === 'Enter' && !e.shiftKey && !e.nativeEvent?.isComposing) {
|
|
152
179
|
e.preventDefault();
|
|
153
180
|
submit();
|
|
154
181
|
}
|
|
155
|
-
}, placeholder: t('Message {name}', { name: displayName }), "aria-label": t('Message {name}', { name: displayName }), disabled: !live, fontSize: 15, px: 4 }), _jsx(Control, { asChild: true, children: _jsx(
|
|
182
|
+
}, placeholder: t('Message {name}', { name: displayName }), "aria-label": t('Message {name}', { name: displayName }), disabled: !live, fontSize: 15, px: 4, flex: 1, minW: 0 }), _jsx(Control, { asChild: true, children: _jsx(VoiceSlot, { voice: voice, disabled: !live, children: (state) => _jsx(Mic, { size: 15, fill: state === 'idle' ? 'none' : 'currentColor' }) }) }), hasDraft ? (_jsx(Control, { type: "submit", "aria-label": t('Send'), fill: true, disabled: !live || Boolean(pending), children: _jsx(ArrowUp, { size: 15, strokeWidth: 2.5 }) })) : (_jsx(Voice, { voice: voice, disabled: !live, children: () => (_jsx(XStack, { width: 32, height: 32, rounded: 999, items: "center", justify: "center", bg: INK, opacity: live ? 1 : 0.45, children: _jsx(AudioLines, { size: 15, color: "var(--background)", strokeWidth: 2.2, "aria-hidden": true }) })) }))] }) }), _jsx("input", { ref: pick, type: "file", hidden: true, accept: "text/*,.md,.txt,.csv,.json,.yaml,.yml,.tsv,.log", onChange: (e) => {
|
|
156
183
|
const picked = e.target.files?.[0];
|
|
157
184
|
e.target.value = '';
|
|
158
185
|
if (picked)
|
package/dist/bots/face.js
CHANGED
|
@@ -32,8 +32,12 @@ export function Face({ bot, size = 36, person = false, starred = false, }) {
|
|
|
32
32
|
}, [candidate]);
|
|
33
33
|
const src = failed ? undefined : candidate;
|
|
34
34
|
const label = person ? (bot.name || '') : called(bot.name || '');
|
|
35
|
-
const
|
|
36
|
-
const
|
|
35
|
+
const words = label.trim().split(/\s+/).filter(Boolean);
|
|
36
|
+
const initials = person && words.length >= 2
|
|
37
|
+
? `${words[0].charAt(0)}${words[words.length - 1].charAt(0)}`.toUpperCase()
|
|
38
|
+
: (label || '?').trim().charAt(0).toUpperCase();
|
|
39
|
+
const glyph = Math.round(size * (bot.emoji ? 0.5 : person && initials.length > 1 ? 0.36 : 0.42));
|
|
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 }) }));
|
|
37
41
|
if (!starred)
|
|
38
42
|
return disc;
|
|
39
43
|
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: 20, height: 20, rounded: 9999, items: "center", justify: "center", bg: "var(--warning, var(--chrome-dot-yellow))", borderWidth: 2, borderColor: FLOOR, children: _jsx(Star, { size: 10, color: "var(--pure-white, var(--foreground))", fill: "currentColor", strokeWidth: 2 }) })] }));
|
package/dist/bots/kit.d.ts
CHANGED
package/dist/bots/kit.js
CHANGED
|
@@ -44,4 +44,4 @@ export const LABEL = { render: 'h3', fontSize: 13, lineHeight: 18, fontWeight: '
|
|
|
44
44
|
/** A card in the panel. */
|
|
45
45
|
export const CARD = { bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 14 };
|
|
46
46
|
/** One line, cut with an ellipsis where it runs out of space. */
|
|
47
|
-
export const CLIP = { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' };
|
|
47
|
+
export const CLIP = { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', maxW: '100%' };
|
package/dist/bots/refusal.d.ts
CHANGED
|
@@ -11,10 +11,19 @@ export declare function nextWeek(now: number): string;
|
|
|
11
11
|
/** When a cap's period after `now` begins: calendar-aligned in UTC, as the platform counts it. */
|
|
12
12
|
export declare function nextPeriod(now: number, period?: string): string;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* the
|
|
17
|
-
*
|
|
14
|
+
* Where a reader adds credit: pay's amount step, for this browser's
|
|
15
|
+
* organization, coming back to this page — the address every other Add credits
|
|
16
|
+
* in the app opens (lib/limits.ts), and never the console page the platform
|
|
17
|
+
* names. Read at the moment of the refusal, since the organization moves with
|
|
18
|
+
* the switcher.
|
|
19
|
+
*/
|
|
20
|
+
export declare function topup(t?: Say): LimitAction;
|
|
21
|
+
/**
|
|
22
|
+
* A refusal about money, as a notice: no money (an empty balance, no plan and
|
|
23
|
+
* no credit, a spent Free allowance) in the app's words with pay's Add credits,
|
|
24
|
+
* the gateway's billing envelope (its message, when it lifts, its ways past,
|
|
25
|
+
* any top-up among them sent to pay), or the bot's own weekly budget spent.
|
|
26
|
+
* Any other failure is not a notice.
|
|
18
27
|
*/
|
|
19
28
|
export declare function refusal(e: unknown, name: string, now: number, t?: Say, period?: string): Notice | null;
|
|
20
29
|
/**
|
package/dist/bots/refusal.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// A refusal about money, read from what the platform answered.
|
|
2
2
|
import { english } from '@hanzo/i18n';
|
|
3
3
|
import { billed, ours, say } from '../failure.js';
|
|
4
|
+
import { payUrl } from '../lib/pay.js';
|
|
5
|
+
import { org } from '../lib/session.js';
|
|
4
6
|
/** The agents route's code for a bot whose own period cap is spent (apps/agents budget.go). */
|
|
5
7
|
const BUDGET = 'budget_exceeded';
|
|
6
8
|
/** Monday 00:00 UTC after `now`: a weekly cap's period is the calendar week in UTC. */
|
|
@@ -20,20 +22,70 @@ export function nextPeriod(now, period = 'week') {
|
|
|
20
22
|
return nextWeek(now);
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* The refusals money clears (cloud sdk/errmap.go `funded`): no balance, no
|
|
26
|
+
* subscription with no credit, and a spent Free-plan allowance. The platform
|
|
27
|
+
* says each with its console's credits page in the sentence and as
|
|
28
|
+
* `billingUrl`; a reader is told in the app's own words instead, with the one
|
|
29
|
+
* way past it, adding credit.
|
|
30
|
+
*/
|
|
31
|
+
const EMPTY = new Set(['insufficient_balance', 'payment_required']);
|
|
32
|
+
const SPENT = 'allowance_spent';
|
|
33
|
+
/**
|
|
34
|
+
* Where a reader adds credit: pay's amount step, for this browser's
|
|
35
|
+
* organization, coming back to this page — the address every other Add credits
|
|
36
|
+
* in the app opens (lib/limits.ts), and never the console page the platform
|
|
37
|
+
* names. Read at the moment of the refusal, since the organization moves with
|
|
38
|
+
* the switcher.
|
|
39
|
+
*/
|
|
40
|
+
export function topup(t = english) {
|
|
41
|
+
const here = typeof window === 'undefined' ? undefined : window.location.href;
|
|
42
|
+
return { kind: 'topup', label: t('Add credits'), url: payUrl('/amount/card', { org: org(), returnUrl: here }) };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Hanzo's console, as a reader reaches it: platform.hanzo.ai. The platform
|
|
46
|
+
* names console.hanzo.ai in the pages its refusals send a person to, in the
|
|
47
|
+
* sentence and as `billingUrl`; both are read with the host a reader knows.
|
|
48
|
+
*/
|
|
49
|
+
const platform = (s) => s.replace(/https:\/\/console\.hanzo\.ai(?=[/?#\s.,;)]|$)/g, 'https://platform.hanzo.ai');
|
|
50
|
+
/** What an out-of-money refusal says, and its way past, or null for any other code. */
|
|
51
|
+
function broke(code, reason, resets, t) {
|
|
52
|
+
// An unresolved 402 is billing that could not be checked, not money missing: its cure is a retry.
|
|
53
|
+
if (typeof code !== 'string' || reason === 'unresolved')
|
|
54
|
+
return null;
|
|
55
|
+
if (EMPTY.has(code))
|
|
56
|
+
return { message: t('Your balance is empty.'), resets: null, actions: [topup(t)] };
|
|
57
|
+
if (code === SPENT)
|
|
58
|
+
return { message: t('Usage reached.'), resets, actions: [topup(t)] };
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A refusal about money, as a notice: no money (an empty balance, no plan and
|
|
63
|
+
* no credit, a spent Free allowance) in the app's words with pay's Add credits,
|
|
64
|
+
* the gateway's billing envelope (its message, when it lifts, its ways past,
|
|
65
|
+
* any top-up among them sent to pay), or the bot's own weekly budget spent.
|
|
66
|
+
* Any other failure is not a notice.
|
|
27
67
|
*/
|
|
28
68
|
export function refusal(e, name, now, t = english, period = 'week') {
|
|
29
69
|
const no = billed(e);
|
|
70
|
+
// The gateway's envelope keeps its own words and ways, save an empty balance
|
|
71
|
+
// (whose sentence names the console) and a top-up, which is pay's.
|
|
30
72
|
if (no)
|
|
31
|
-
return
|
|
73
|
+
return EMPTY.has(no.code)
|
|
74
|
+
? broke(no.code, undefined, no.resets_at, t)
|
|
75
|
+
: {
|
|
76
|
+
message: no.message ? platform(no.message) : say(e, t('your message to {name}', { name }), 'save', t),
|
|
77
|
+
resets: no.resets_at,
|
|
78
|
+
actions: no.actions.map((a) => (a.kind === 'topup' ? { ...a, url: topup(t).url } : a)),
|
|
79
|
+
};
|
|
32
80
|
const status = e?.status;
|
|
33
81
|
if (status !== 402 && status !== 429)
|
|
34
82
|
return null;
|
|
35
83
|
const raw = e?.body;
|
|
36
84
|
const body = raw && typeof raw.error === 'object' && raw.error ? raw.error : raw ?? {};
|
|
85
|
+
const resets = typeof body.resets_at === 'string' ? body.resets_at : null;
|
|
86
|
+
const money = broke(body.code, body.reason, resets, t);
|
|
87
|
+
if (money)
|
|
88
|
+
return money;
|
|
37
89
|
if (body.code === BUDGET) {
|
|
38
90
|
const spent = period === 'day'
|
|
39
91
|
? t('{name} has spent today’s budget.', { name })
|
|
@@ -42,11 +94,13 @@ export function refusal(e, name, now, t = english, period = 'week') {
|
|
|
42
94
|
: t('{name} has spent this week’s budget.', { name });
|
|
43
95
|
return { message: spent, resets: nextPeriod(now, period), actions: [] };
|
|
44
96
|
}
|
|
97
|
+
// Any other refusal is the platform's own words, and the console page it names
|
|
98
|
+
// (a spend cap's budgets) is offered as what it is, never as Add credits.
|
|
45
99
|
const url = ours(body.billingUrl);
|
|
46
100
|
return {
|
|
47
|
-
message: typeof body.message === 'string' && body.message ? body.message : say(e, t('your message to {name}', { name }), 'save', t),
|
|
48
|
-
resets
|
|
49
|
-
actions: url ? [{ kind: '
|
|
101
|
+
message: typeof body.message === 'string' && body.message ? platform(body.message) : say(e, t('your message to {name}', { name }), 'save', t),
|
|
102
|
+
resets,
|
|
103
|
+
actions: url ? [{ kind: 'upgrade', label: body.code === 'spend_cap_exceeded' ? t('Raise the spend cap') : t('Open billing'), url: platform(url) }] : [],
|
|
50
104
|
};
|
|
51
105
|
}
|
|
52
106
|
/**
|
package/dist/chord.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type Act = 'rename' | 'pin';
|
|
2
|
+
/** Workspace-wide keyboard commands handled outside inputs and dialogs. */
|
|
3
|
+
export type GlobalAct = 'new-chat' | 'toggle-sidebar' | 'toggle-theme' | 'toggle-dev-mode';
|
|
2
4
|
/** The part of a keydown this reads. */
|
|
3
5
|
export interface Press {
|
|
4
6
|
key?: string;
|
|
@@ -15,8 +17,19 @@ export interface Press {
|
|
|
15
17
|
}
|
|
16
18
|
/** Whether a key pressed on `target` is typing: a field, a picker, or text that edits itself. */
|
|
17
19
|
export declare function typing(target: EventTarget | null): boolean;
|
|
20
|
+
/** Whether `target` sits inside a modal dialog that owns its own shortcuts. */
|
|
21
|
+
export declare const inDialog: (target: EventTarget | null) => boolean;
|
|
18
22
|
/** What a keydown asks of a conversation, or null when it asks nothing of one. */
|
|
19
23
|
export declare function chord(e: Press): Act | null;
|
|
24
|
+
/**
|
|
25
|
+
* Non-browser-conflicting global workspace shortcuts, never firing while typing
|
|
26
|
+
* or inside a dialog:
|
|
27
|
+
* - ⌘⇧O / Ctrl+Shift+O: New chat
|
|
28
|
+
* - ⌘B / Ctrl+B: Toggle sidebar
|
|
29
|
+
* - ⌘⇧L / Ctrl+Shift+L: Toggle light / dark theme
|
|
30
|
+
* - ⌘⇧D / Ctrl+Shift+D: Toggle Developer mode
|
|
31
|
+
*/
|
|
32
|
+
export declare function globalAction(e: Press): GlobalAct | null;
|
|
20
33
|
/** A chord as a menu prints it: ⌃⌥R on a Mac, Ctrl+Alt+R elsewhere. */
|
|
21
34
|
export declare function said(act: Act, mac: boolean): string;
|
|
22
35
|
/** A chord as `aria-keyshortcuts` says it, the same on every platform. */
|
package/dist/chord.js
CHANGED
|
@@ -32,16 +32,45 @@ function letter(e) {
|
|
|
32
32
|
const place = /^Key([A-Z])$/.exec(e.code ?? '');
|
|
33
33
|
return place ? place[1].toLowerCase() : null;
|
|
34
34
|
}
|
|
35
|
+
/** Whether `target` sits inside a modal dialog that owns its own shortcuts. */
|
|
36
|
+
export const inDialog = (target) => within(target, '[role="dialog"],[role="alertdialog"]');
|
|
35
37
|
/** What a keydown asks of a conversation, or null when it asks nothing of one. */
|
|
36
38
|
export function chord(e) {
|
|
37
39
|
if (!e.ctrlKey || !e.altKey || e.metaKey || e.shiftKey || e.repeat || e.isComposing)
|
|
38
40
|
return null;
|
|
39
41
|
const l = letter(e);
|
|
40
42
|
const act = l ? LETTERS[l] : undefined;
|
|
41
|
-
if (!act || typing(e.target) ||
|
|
43
|
+
if (!act || typing(e.target) || inDialog(e.target))
|
|
42
44
|
return null;
|
|
43
45
|
return act;
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Non-browser-conflicting global workspace shortcuts, never firing while typing
|
|
49
|
+
* or inside a dialog:
|
|
50
|
+
* - ⌘⇧O / Ctrl+Shift+O: New chat
|
|
51
|
+
* - ⌘B / Ctrl+B: Toggle sidebar
|
|
52
|
+
* - ⌘⇧L / Ctrl+Shift+L: Toggle light / dark theme
|
|
53
|
+
* - ⌘⇧D / Ctrl+Shift+D: Toggle Developer mode
|
|
54
|
+
*/
|
|
55
|
+
export function globalAction(e) {
|
|
56
|
+
if (e.repeat || e.isComposing || e.defaultPrevented || e.altKey)
|
|
57
|
+
return null;
|
|
58
|
+
const mod = e.metaKey || e.ctrlKey;
|
|
59
|
+
if (!mod || typing(e.target) || inDialog(e.target))
|
|
60
|
+
return null;
|
|
61
|
+
const l = letter(e);
|
|
62
|
+
if (!l)
|
|
63
|
+
return null;
|
|
64
|
+
if (!e.shiftKey && l === 'b')
|
|
65
|
+
return 'toggle-sidebar';
|
|
66
|
+
if (e.shiftKey && l === 'o')
|
|
67
|
+
return 'new-chat';
|
|
68
|
+
if (e.shiftKey && l === 'l')
|
|
69
|
+
return 'toggle-theme';
|
|
70
|
+
if (e.shiftKey && l === 'd')
|
|
71
|
+
return 'toggle-dev-mode';
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
45
74
|
/** A chord as a menu prints it: ⌃⌥R on a Mac, Ctrl+Alt+R elsewhere. */
|
|
46
75
|
export function said(act, mac) {
|
|
47
76
|
const key = act === 'rename' ? 'R' : 'P';
|
package/dist/crew.js
CHANGED
|
@@ -21,7 +21,7 @@ import { phrase, pieces } from '@hanzo/i18n';
|
|
|
21
21
|
import { useI18n } from '@hanzo/i18n/react';
|
|
22
22
|
import { Fragment, useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
23
23
|
import { useHost } from './host.js';
|
|
24
|
-
import { ArrowLeft, Camera, Check, Plus, Sparkles, Upload, Users } from 'lucide-react';
|
|
24
|
+
import { ArrowLeft, Camera, Check, ChevronDown, Plus, Sparkles, Upload, Users } from 'lucide-react';
|
|
25
25
|
import { generateImages } from '@hanzo/ai';
|
|
26
26
|
import { useAgents, useModels } from '@hanzo/ai/react';
|
|
27
27
|
import { Box, Button, Input, Text, Textarea, View, XStack, YStack } from '@hanzo/ui';
|
|
@@ -42,7 +42,7 @@ const FIELD = {
|
|
|
42
42
|
width: '100%',
|
|
43
43
|
bg: 'transparent',
|
|
44
44
|
borderWidth: 1,
|
|
45
|
-
borderColor: 'var(--border)',
|
|
45
|
+
borderColor: 'var(--border-strong)',
|
|
46
46
|
rounded: 'var(--radius-md)',
|
|
47
47
|
px: 10,
|
|
48
48
|
py: 8,
|
|
@@ -50,6 +50,49 @@ const FIELD = {
|
|
|
50
50
|
color: 'inherit',
|
|
51
51
|
fontSize: '$2',
|
|
52
52
|
};
|
|
53
|
+
function CrewSelect({ id, ariaLabel, ariaDescribedBy, value, options, onChange, compact = false, }) {
|
|
54
|
+
const { t } = useI18n();
|
|
55
|
+
const [open, setOpen] = useState(false);
|
|
56
|
+
const [query, setQuery] = useState('');
|
|
57
|
+
const wrapRef = useRef(null);
|
|
58
|
+
const btnRef = useRef(null);
|
|
59
|
+
const selected = options.find((o) => o.value === value) ?? options[0];
|
|
60
|
+
const showSearch = options.length > 7;
|
|
61
|
+
const filtered = query.trim()
|
|
62
|
+
? options.filter((o) => o.label.toLowerCase().includes(query.trim().toLowerCase()) || o.value.toLowerCase().includes(query.trim().toLowerCase()))
|
|
63
|
+
: options;
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (!open) {
|
|
66
|
+
setQuery('');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const onDown = (e) => {
|
|
70
|
+
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
71
|
+
setOpen(false);
|
|
72
|
+
};
|
|
73
|
+
const onKey = (e) => {
|
|
74
|
+
if (e.key === 'Escape') {
|
|
75
|
+
e.stopPropagation();
|
|
76
|
+
setOpen(false);
|
|
77
|
+
btnRef.current?.focus();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
document.addEventListener('mousedown', onDown);
|
|
81
|
+
window.addEventListener('keydown', onKey, true);
|
|
82
|
+
return () => {
|
|
83
|
+
document.removeEventListener('mousedown', onDown);
|
|
84
|
+
window.removeEventListener('keydown', onKey, true);
|
|
85
|
+
};
|
|
86
|
+
}, [open]);
|
|
87
|
+
return (_jsxs(Box, { ref: wrapRef, position: "relative", width: compact ? 'auto' : '100%', minW: compact ? 110 : 0, children: [_jsxs(XStack, { render: _jsx("button", { ref: btnRef, id: id, type: "button", role: "combobox", "aria-expanded": open, "aria-haspopup": "listbox", "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy }), width: "100%", minH: 36, "$max-sm": { minH: 44 }, px: "$3", py: "$1.5", gap: "$2", items: "center", justify: "space-between", rounded: "$3", bg: "$background", borderWidth: 1, borderColor: "var(--border-strong)", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)', outlineOffset: 2 }, cursor: "pointer", onClick: () => setOpen((v) => !v), children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, grow: 1, shrink: 1, minW: 0, text: "start", children: selected ? selected.label : value }), _jsx(ChevronDown, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true })] }), open ? (_jsxs(YStack, { role: 'listbox', "aria-label": ariaLabel, position: "absolute", t: "100%", l: 0, mt: 4, minW: compact ? 160 : '100%', maxW: "calc(100vw - 32px)", p: "$1.5", gap: 2, rounded: "$4", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-floating)", z: "var(--z-popover, 40)", children: [showSearch ? (_jsx(Box, { mb: "$1", children: _jsx(Input, { value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Filter options…'), "aria-label": t('Filter options') }) })) : null, _jsx(YStack, { maxH: 220, overflowY: "auto", gap: 2, children: filtered.map((opt) => {
|
|
88
|
+
const active = opt.value === value;
|
|
89
|
+
return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), role: "option", "aria-selected": active, width: "100%", minH: 34, "$max-sm": { minH: 44 }, px: "$2.5", py: "$1.5", gap: "$2", items: "center", justify: "space-between", rounded: "$3", borderWidth: 0, bg: active ? '$raised' : 'transparent', hoverStyle: { bg: active ? '$raised' : '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)', outlineOffset: -2 }, cursor: "pointer", onClick: () => {
|
|
90
|
+
onChange(opt.value);
|
|
91
|
+
setOpen(false);
|
|
92
|
+
btnRef.current?.focus();
|
|
93
|
+
}, children: [_jsx(Text, { fontSize: "$2", fontWeight: active ? '500' : '400', color: "$ink", numberOfLines: 1, grow: 1, shrink: 1, text: "start", children: opt.label }), active ? _jsx(Check, { size: 14, color: "var(--foreground)", "aria-hidden": true }) : null] }, opt.value));
|
|
94
|
+
}) })] })) : null] }));
|
|
95
|
+
}
|
|
53
96
|
/** The camera's veil over a face already chosen. */
|
|
54
97
|
const VEIL = mix('var(--pure-black)', 55, 'srgb');
|
|
55
98
|
/** Fired on `window` when the sheet below makes an agent. */
|
|
@@ -451,11 +494,11 @@ export function Hire({ onClose, onMade, start = false }) {
|
|
|
451
494
|
}, "aria-describedby": "hire-picture-wrong" }) })] }), _jsx(Said, { id: "hire-picture-wrong", text: shown('picture') })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(Text, { render: "label", htmlFor: "hire-name", fontSize: "$2", fontWeight: "600", children: t('Name') }), _jsx(Input, { id: "hire-name", value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
|
|
452
495
|
if (e.key === 'Enter')
|
|
453
496
|
void make();
|
|
454
|
-
}, placeholder: t('Michael'), autoFocus: true, "aria-required": "true", "aria-invalid": Boolean(nameWrong || shown('name')), "aria-describedby": "hire-name-wrong" }), _jsx(Said, { id: "hire-name-wrong", text: nameWrong ?? shown('name') })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(Text, { render: "label", htmlFor: "hire-model", fontSize: "$2", fontWeight: "600", children: t('Model') }),
|
|
497
|
+
}, placeholder: t('Michael'), autoFocus: true, "aria-required": "true", "aria-invalid": Boolean(nameWrong || shown('name')), "aria-describedby": "hire-name-wrong" }), _jsx(Said, { id: "hire-name-wrong", text: nameWrong ?? shown('name') })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(Text, { render: "label", htmlFor: "hire-model", fontSize: "$2", fontWeight: "600", children: t('Model') }), _jsx(CrewSelect, { id: "hire-model", ariaLabel: t('Model'), ariaDescribedBy: "hire-model-wrong", value: model, onChange: setModel, options: [{ value: 'enso', label: 'enso' }, ...models.map((one) => ({ value: one.id, label: one.id }))] }), _jsx(Said, { id: "hire-model-wrong", text: shown('model') })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(Text, { render: "label", htmlFor: "hire-does", fontSize: "$2", fontWeight: "600", children: t('What it does {optional}', {
|
|
455
498
|
optional: (_jsx(Text, { fontWeight: "400", color: "var(--soft, var(--muted-foreground))", children: t('— optional') })),
|
|
456
499
|
}) }), _jsx(Textarea, { id: "hire-does", value: does, onChangeText: setDoes, placeholder: t('The work it takes and the voice it answers in'), rows: 3, "aria-describedby": "hire-does-wrong" }), _jsx(Said, { id: "hire-does-wrong", text: shown('does') })] }), _jsxs(View, { render: _jsx("fieldset", { "aria-describedby": "hire-budget-wrong" }), display: "block", borderWidth: 0, p: 0, m: 0, children: [_jsx(Text, { render: "legend", display: "block", fontSize: "$2", fontWeight: "600", mb: 6, children: t('Spending limit') }), _jsxs(YStack, { gap: "$2", children: [_jsx(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: _jsx(Sentence, { source: UP_TO, fields: {
|
|
457
500
|
amount: (_jsx(Box, { width: 84, children: _jsx(Input, { "aria-label": t('Spending limit in dollars'), inputMode: "decimal", value: cap, onChange: (e) => setCap(e.target.value), "aria-invalid": !capOk }) })),
|
|
458
|
-
period: (_jsx(
|
|
501
|
+
period: (_jsx(CrewSelect, { compact: true, ariaLabel: t('Spending limit period'), value: period, onChange: (next) => setPeriod(next), options: PERIODS.map(([val, words]) => ({ value: val, label: t(words) })) })),
|
|
459
502
|
} }) }), _jsx(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: _jsx(Sentence, { source: AT_MOST, fields: {
|
|
460
503
|
amount: (_jsx(Box, { width: 84, children: _jsx(Input, { "aria-label": t('Most one task may spend, in dollars'), inputMode: "decimal", value: task, onChange: (e) => setTask(e.target.value), "aria-invalid": !taskOk }) })),
|
|
461
504
|
} }) })] }), _jsx(Box, { mt: "$1.5", children: _jsx(Said, { id: "hire-budget-wrong", text: budgetWrong ?? shown('budget') }) })] }), _jsx(Said, { id: "hire-form-wrong", text: shown('form') }), _jsxs(XStack, { justify: "flex-end", gap: "$2", children: [_jsx(Button, { size: "sm", variant: "ghost", onClick: onClose, children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: busy !== null || !ready, onClick: () => void make(), children: t(busy === 'make' ? 'Creating…' : 'Create') })] })] }))] }) }));
|
package/dist/ground.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export declare const RAIL: number;
|
|
|
48
48
|
/** The top bar's height, px, on every shell. */
|
|
49
49
|
export declare const BAR = 38;
|
|
50
50
|
/** The sidebar's width before the reader pulls its edge, px. */
|
|
51
|
-
export declare const SIDE =
|
|
51
|
+
export declare const SIDE = 256;
|
|
52
52
|
/**
|
|
53
53
|
* A row INSIDE a pane shares the height of the row it lines up with.
|
|
54
54
|
*/
|
package/dist/ground.js
CHANGED
|
@@ -48,7 +48,7 @@ export const RAIL = 2 * INSET;
|
|
|
48
48
|
/** The top bar's height, px, on every shell. */
|
|
49
49
|
export const BAR = 38;
|
|
50
50
|
/** The sidebar's width before the reader pulls its edge, px. */
|
|
51
|
-
export const SIDE =
|
|
51
|
+
export const SIDE = 256;
|
|
52
52
|
/**
|
|
53
53
|
* A row INSIDE a pane shares the height of the row it lines up with.
|
|
54
54
|
*/
|
package/dist/help.d.ts
CHANGED
|
@@ -12,17 +12,21 @@ export interface Page {
|
|
|
12
12
|
export declare const pages: () => Page[];
|
|
13
13
|
/** The agreements under the Help menu's rule. */
|
|
14
14
|
export declare const legal: () => Page[];
|
|
15
|
+
/** Logical grouping for the keyboard shortcuts sheet. */
|
|
16
|
+
export type KeyGroup = 'Navigation' | 'Workspace' | 'Chat' | 'Window';
|
|
15
17
|
/** One of the app's keys: what it does (authored English, drawn through `t`), and how a Mac and every other platform spell it. */
|
|
16
18
|
export interface Key {
|
|
17
19
|
does: string;
|
|
18
20
|
mac: string;
|
|
19
21
|
pc: string;
|
|
22
|
+
group?: KeyGroup;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
22
25
|
* Every key the app answers, in the order a reader looks for them. Each is
|
|
23
|
-
* handled where it acts: App.tsx (⌘K,
|
|
24
|
-
* Account.tsx (⌘/), @hanzo/build's panel (⌘.),
|
|
25
|
-
* (the conversation's chords, spelled by
|
|
26
|
+
* handled where it acts: keys.ts, mounted by App.tsx and Shell.tsx (⌘K, ⌘⇧O, ⌘B, ⌘⇧L, ⌘⇧D, ⌘,), App.tsx (
|
|
27
|
+
* in a window, Back and Forward), Account.tsx (⌘/), @hanzo/build's panel (⌘.),
|
|
28
|
+
* the composer (Enter, ⌘U), chord.ts (the conversation's chords, spelled by
|
|
29
|
+
* `said` so the two cannot drift).
|
|
26
30
|
*/
|
|
27
31
|
export declare const KEYS: Key[];
|
|
28
32
|
/** The part of a keydown `asked` reads. */
|
package/dist/help.js
CHANGED
|
@@ -26,22 +26,27 @@ export const legal = () => [
|
|
|
26
26
|
];
|
|
27
27
|
/**
|
|
28
28
|
* Every key the app answers, in the order a reader looks for them. Each is
|
|
29
|
-
* handled where it acts: App.tsx (⌘K,
|
|
30
|
-
* Account.tsx (⌘/), @hanzo/build's panel (⌘.),
|
|
31
|
-
* (the conversation's chords, spelled by
|
|
29
|
+
* handled where it acts: keys.ts, mounted by App.tsx and Shell.tsx (⌘K, ⌘⇧O, ⌘B, ⌘⇧L, ⌘⇧D, ⌘,), App.tsx (
|
|
30
|
+
* in a window, Back and Forward), Account.tsx (⌘/), @hanzo/build's panel (⌘.),
|
|
31
|
+
* the composer (Enter, ⌘U), chord.ts (the conversation's chords, spelled by
|
|
32
|
+
* `said` so the two cannot drift).
|
|
32
33
|
*/
|
|
33
34
|
export const KEYS = [
|
|
34
|
-
{ does: phrase('Search chats'), mac: '⌘K', pc: 'Ctrl+K' },
|
|
35
|
-
{ does: phrase('
|
|
36
|
-
{ does: phrase('
|
|
37
|
-
{ does: phrase('
|
|
38
|
-
{ does: phrase('
|
|
39
|
-
{ does: phrase('
|
|
40
|
-
{ does: phrase('
|
|
41
|
-
{ does: phrase('
|
|
42
|
-
{ does: phrase('
|
|
43
|
-
{ does: phrase('
|
|
44
|
-
{ does: phrase('
|
|
35
|
+
{ does: phrase('Search chats'), mac: '⌘K', pc: 'Ctrl+K', group: 'Navigation' },
|
|
36
|
+
{ does: phrase('New chat'), mac: '⌘⇧O', pc: 'Ctrl+Shift+O', group: 'Navigation' },
|
|
37
|
+
{ does: phrase('Settings'), mac: '⌘,', pc: 'Ctrl+,', group: 'Navigation' },
|
|
38
|
+
{ does: phrase('Keyboard shortcuts'), mac: '⌘/', pc: 'Ctrl+/', group: 'Navigation' },
|
|
39
|
+
{ does: phrase('Toggle sidebar'), mac: '⌘B', pc: 'Ctrl+B', group: 'Workspace' },
|
|
40
|
+
{ does: phrase('Side panel'), mac: '⌘.', pc: 'Ctrl+.', group: 'Workspace' },
|
|
41
|
+
{ does: phrase('Toggle theme'), mac: '⌘⇧L', pc: 'Ctrl+Shift+L', group: 'Workspace' },
|
|
42
|
+
{ does: phrase('Toggle Developer mode'), mac: '⌘⇧D', pc: 'Ctrl+Shift+D', group: 'Workspace' },
|
|
43
|
+
{ does: phrase('Attach files'), mac: '⌘U', pc: 'Ctrl+U', group: 'Chat' },
|
|
44
|
+
{ does: phrase('Send'), mac: 'Enter', pc: 'Enter', group: 'Chat' },
|
|
45
|
+
{ does: phrase('New line'), mac: '⇧Enter', pc: 'Shift+Enter', group: 'Chat' },
|
|
46
|
+
{ does: phrase('Rename chat'), mac: said('rename', true), pc: said('rename', false), group: 'Chat' },
|
|
47
|
+
{ does: phrase('Pin or unpin chat'), mac: said('pin', true), pc: said('pin', false), group: 'Chat' },
|
|
48
|
+
{ does: phrase('Back'), mac: '⌘[', pc: 'Alt+←', group: 'Window' },
|
|
49
|
+
{ does: phrase('Forward'), mac: '⌘]', pc: 'Alt+→', group: 'Window' },
|
|
45
50
|
];
|
|
46
51
|
/** Whether a keydown asks for the keyboard shortcuts: ⌘/ or Ctrl+/, once a press. */
|
|
47
52
|
export const asked = (e) => (e.metaKey || e.ctrlKey) && !e.altKey && !e.repeat && e.key === '/';
|