@hanzo/app 0.3.94 → 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.
Files changed (99) hide show
  1. package/dist/Account.d.ts +9 -3
  2. package/dist/Account.js +142 -141
  3. package/dist/App.js +71 -37
  4. package/dist/Bar.js +1 -1
  5. package/dist/Betas.d.ts +1 -1
  6. package/dist/Betas.js +16 -22
  7. package/dist/Board.js +113 -47
  8. package/dist/CalScheduler.d.ts +1 -0
  9. package/dist/CalScheduler.js +223 -57
  10. package/dist/Chat.js +432 -153
  11. package/dist/Contacts.js +35 -31
  12. package/dist/ContextMenu.js +126 -42
  13. package/dist/Directory.js +1 -1
  14. package/dist/Drawer.js +1 -1
  15. package/dist/Drive.js +351 -119
  16. package/dist/Gate.js +156 -13
  17. package/dist/Home.js +31 -53
  18. package/dist/Inbox.js +29 -15
  19. package/dist/InlineRename.d.ts +6 -0
  20. package/dist/InlineRename.js +41 -0
  21. package/dist/Learning.js +132 -13
  22. package/dist/Market.js +13 -9
  23. package/dist/Meet.d.ts +5 -0
  24. package/dist/Meet.js +75 -51
  25. package/dist/MoreMenu.d.ts +19 -0
  26. package/dist/MoreMenu.js +33 -0
  27. package/dist/NeedMoreUsage.js +2 -2
  28. package/dist/OrgSwitcher.js +6 -2
  29. package/dist/Rail.d.ts +73 -7
  30. package/dist/Rail.js +372 -111
  31. package/dist/Recents.js +77 -24
  32. package/dist/RightPane.js +2 -2
  33. package/dist/Search.d.ts +13 -1
  34. package/dist/Search.js +366 -50
  35. package/dist/Setup.js +34 -5
  36. package/dist/Shared.js +12 -12
  37. package/dist/Shell.js +210 -151
  38. package/dist/Sidebar.d.ts +14 -3
  39. package/dist/Sidebar.js +411 -129
  40. package/dist/SkipLink.d.ts +8 -0
  41. package/dist/SkipLink.js +11 -0
  42. package/dist/Start.js +51 -52
  43. package/dist/Terminals.js +159 -11
  44. package/dist/ToBottom.js +1 -1
  45. package/dist/Upgrade.d.ts +8 -3
  46. package/dist/Upgrade.js +194 -103
  47. package/dist/Usage.d.ts +1 -1
  48. package/dist/Usage.js +186 -82
  49. package/dist/WalletPill.js +8 -2
  50. package/dist/Work.js +162 -53
  51. package/dist/archive.d.ts +8 -0
  52. package/dist/archive.js +16 -0
  53. package/dist/bots/Bots.js +1 -1
  54. package/dist/bots/ComputerDialog.js +53 -26
  55. package/dist/bots/ConnectorsDialog.js +34 -15
  56. package/dist/bots/Make.js +5 -1
  57. package/dist/bots/Panel.js +37 -31
  58. package/dist/bots/Roster.js +18 -13
  59. package/dist/bots/Thread.js +54 -27
  60. package/dist/bots/face.js +6 -2
  61. package/dist/bots/kit.d.ts +1 -0
  62. package/dist/bots/kit.js +1 -1
  63. package/dist/chord.d.ts +13 -0
  64. package/dist/chord.js +30 -1
  65. package/dist/crew.js +47 -4
  66. package/dist/ground.d.ts +1 -1
  67. package/dist/ground.js +1 -1
  68. package/dist/help.d.ts +7 -3
  69. package/dist/help.js +19 -14
  70. package/dist/keys.d.ts +28 -0
  71. package/dist/keys.js +58 -0
  72. package/dist/lib/arrival.d.ts +5 -0
  73. package/dist/lib/arrival.js +10 -0
  74. package/dist/lib/betas.d.ts +2 -0
  75. package/dist/lib/betas.js +10 -0
  76. package/dist/lib/branch.d.ts +11 -0
  77. package/dist/lib/branch.js +11 -0
  78. package/dist/lib/chatPreferences.d.ts +1 -1
  79. package/dist/lib/chatPreferences.js +1 -1
  80. package/dist/lib/dev-mode.d.ts +18 -0
  81. package/dist/lib/dev-mode.js +102 -0
  82. package/dist/lib/info-hint.d.ts +7 -0
  83. package/dist/lib/info-hint.js +8 -0
  84. package/dist/lib/model-picker.d.ts +2 -0
  85. package/dist/lib/model-picker.js +12 -0
  86. package/dist/lib/owners.d.ts +5 -0
  87. package/dist/lib/owners.js +15 -0
  88. package/dist/lib/pay.d.ts +2 -0
  89. package/dist/lib/pay.js +4 -0
  90. package/dist/lib/todo.d.ts +6 -0
  91. package/dist/lib/todo.js +37 -25
  92. package/dist/look.js +39 -8
  93. package/dist/rail-open.d.ts +9 -0
  94. package/dist/rail-open.js +34 -0
  95. package/dist/renaming.d.ts +10 -0
  96. package/dist/renaming.js +25 -0
  97. package/dist/thread.d.ts +2 -1
  98. package/dist/thread.js +85 -44
  99. package/package.json +11 -11
@@ -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
- import { ArrowLeft, ArrowUp, AudioLines, Check, Gauge, Mic, Plus, Share, X } from 'lucide-react';
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
- const accent = ext === 'pdf'
27
- ? 'var(--destructive)'
28
- : ext === 'ppt' || ext === 'pptx'
29
- ? 'var(--warning, var(--chrome-dot-yellow))'
30
- : 'var(--info, var(--muted-foreground))';
31
- return (_jsxs(YStack, { "aria-hidden": true, width: 40, height: 44, shrink: 0, rounded: 9, overflow: "hidden", bg: "var(--secondary)", borderWidth: 1, borderColor: LINE, children: [_jsxs(YStack, { flex: 1, px: 7, pt: 7, 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: 12, bg: accent })] }));
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: INK, "aria-hidden": true }) : _jsx(Share, { size: 15, color: INK, "aria-hidden": true }) })) : null })] }), !bot ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", gap: 16, px: 24, children: live && loaded && bots.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null })) : (_jsx(YStack, { "data-parity-key": "bots.thread", flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: _jsxs(YStack, { width: "100%", px: 18, pt: 52, pb: 14, "$max-md": { px: 12 }, children: [said.map((line, i) => {
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 : 14;
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 ? 18 : 4, mb: 4, fontSize: 12, lineHeight: 17, color: DIM, children: line.text }, line.key));
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: DIM, children: line.text }) }, line.key));
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 (_jsx(YStack, { "data-parity-key": line.kind === 'other' ? 'bots.other' : 'bots.theirs', self: "flex-start", items: "flex-start", gap: 10, maxW: "100%", mt: gap, children: parts.map((part, idx) => {
138
- if (part.kind === 'doc') {
139
- const inner = (_jsxs(XStack, { px: 12, py: 10, gap: 12, items: "center", rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, maxW: 290, children: [_jsx(DocBadge, { ext: part.ext }), _jsxs(YStack, { flex: 1, minW: 0, 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] })] }));
140
- 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));
141
- }
142
- if (part.kind === 'image') {
143
- 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));
144
- }
145
- 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));
146
- }) }, line.key));
147
- }), wrong ? (_jsx(Text, { render: "p", self: "center", mt: 12, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx("div", { ref: foot })] }) })), bot ? (_jsxs(YStack, { width: "100%", px: 16, pb: 12, gap: 8, shrink: 0, "$max-md": { px: 8, pb: 8 }, children: [notice ? (_jsxs(YStack, { "data-parity-key": "bots.notice", role: "alert", bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 16, pt: 12, pb: 10, px: 14, gap: 10, children: [_jsxs(XStack, { items: "flex-start", gap: 10, children: [_jsx(YStack, { pt: 3, children: _jsx(Gauge, { size: 16, color: DIM, "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: 15, lineHeight: 22, color: INK, children: notice.message }), lifts(notice.resets, now, t) ? (_jsx(Text, { fontSize: 15, lineHeight: 22, 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: DIM, px: 8, children: note })) : null, _jsx(Composer, { render: "form", onSubmit: (e) => {
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", height: 46, 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) => {
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(Voice, { 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) => {
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 glyph = Math.round(size * (bot.emoji ? 0.5 : 0.42));
36
- 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: person ? 'var(--info, var(--secondary))' : 'var(--secondary)', userSelect: 'none', children: _jsx(Text, { color: person ? 'var(--pure-white, var(--foreground))' : INK, fontSize: glyph, lineHeight: glyph, fontWeight: "600", children: bot.emoji || (label || '?').trim().charAt(0).toUpperCase() }) }));
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 }) })] }));
@@ -75,4 +75,5 @@ export declare const CLIP: {
75
75
  readonly whiteSpace: 'nowrap';
76
76
  readonly overflow: 'hidden';
77
77
  readonly textOverflow: 'ellipsis';
78
+ readonly maxW: '100%';
78
79
  };
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/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) || within(e.target, '[role="dialog"],[role="alertdialog"]'))
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') }), _jsxs(Text, { render: _jsx("select", { id: "hire-model", value: model, onChange: (e) => setModel(e.target.value), "aria-describedby": "hire-model-wrong" }), ...FIELD, children: [_jsx("option", { value: "enso", children: "enso" }), models.map((one) => (_jsx("option", { value: one.id, children: one.id }, 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}', {
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(Text, { render: _jsx("select", { "aria-label": t('Spending limit period'), value: period, onChange: (e) => setPeriod(e.target.value) }), ...FIELD, width: "auto", children: PERIODS.map(([value, words]) => (_jsx("option", { value: value, children: t(words) }, value))) })),
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 = 248;
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 = 248;
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, ⌘, and, in a window, Back and Forward),
24
- * Account.tsx (⌘/), @hanzo/build's panel (⌘.), the composer (Enter, ⌘U), chord.ts
25
- * (the conversation's chords, spelled by `said` so the two cannot drift).
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, ⌘, and, in a window, Back and Forward),
30
- * Account.tsx (⌘/), @hanzo/build's panel (⌘.), the composer (Enter, ⌘U), chord.ts
31
- * (the conversation's chords, spelled by `said` so the two cannot drift).
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('Settings'), mac: '⌘,', pc: 'Ctrl+,' },
36
- { does: phrase('Keyboard shortcuts'), mac: '⌘/', pc: 'Ctrl+/' },
37
- { does: phrase('Side panel'), mac: '⌘.', pc: 'Ctrl+.' },
38
- { does: phrase('Attach files'), mac: '⌘U', pc: 'Ctrl+U' },
39
- { does: phrase('Send'), mac: 'Enter', pc: 'Enter' },
40
- { does: phrase('New line'), mac: '⇧Enter', pc: 'Shift+Enter' },
41
- { does: phrase('Rename chat'), mac: said('rename', true), pc: said('rename', false) },
42
- { does: phrase('Pin or unpin chat'), mac: said('pin', true), pc: said('pin', false) },
43
- { does: phrase('Back'), mac: '⌘[', pc: 'Alt+←' },
44
- { does: phrase('Forward'), mac: '⌘]', pc: 'Alt+→' },
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 === '/';
package/dist/keys.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { type Press } from './chord.js';
2
+ /** What the workspace's global keys do, said by the surface that draws the workspace. */
3
+ export interface Keys {
4
+ /** ⌘K: the palette, open or shut. */
5
+ find(): void;
6
+ /** ⌘⇧O: a new chat. */
7
+ newChat(): void;
8
+ /** ⌘B: the sidebar, open or shut. */
9
+ sidebar(): void;
10
+ /** ⌘,: Settings (or the sign-in prompt for a stranger). */
11
+ settings(): void;
12
+ /** ⌘⇧L: the theme, kept on the account (`Host.chooseTheme`). */
13
+ chooseTheme?(next: 'light' | 'dark'): void;
14
+ /** One line of confirmation after a theme or Developer mode switch. */
15
+ say?(message: string): void;
16
+ }
17
+ /** The part of a keydown the global keys read. */
18
+ export type Stroke = Press & {
19
+ preventDefault(): void;
20
+ };
21
+ /**
22
+ * THE ONE KEY HANDLER. App and Shell both mount this and nothing else listens
23
+ * for these keys, so a key means the same on every surface and a theme chosen
24
+ * with ⌘⇧L is saved to the account the way the menu's choice is.
25
+ */
26
+ export declare function handle(e: Stroke, on: Keys, t: (s: string) => string): boolean;
27
+ /** Listen for the global keys while mounted. */
28
+ export declare function useGlobalKeys(on: Keys): void;
package/dist/keys.js ADDED
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+ import { useEffect, useRef } from 'react';
3
+ import { useI18n } from '@hanzo/i18n/react';
4
+ import { globalAction, inDialog, typing } from './chord.js';
5
+ import { getDevMode, setDevMode } from './lib/dev-mode.js';
6
+ import { summons } from './seek.js';
7
+ /**
8
+ * THE ONE KEY HANDLER. App and Shell both mount this and nothing else listens
9
+ * for these keys, so a key means the same on every surface and a theme chosen
10
+ * with ⌘⇧L is saved to the account the way the menu's choice is.
11
+ */
12
+ export function handle(e, on, t) {
13
+ // A press something already answered, or one that is still composing a character, is not a command.
14
+ if (e.defaultPrevented || e.isComposing)
15
+ return false;
16
+ if (summons(e)) {
17
+ e.preventDefault();
18
+ on.find();
19
+ return true;
20
+ }
21
+ const act = globalAction(e);
22
+ if (act) {
23
+ e.preventDefault();
24
+ if (act === 'new-chat')
25
+ on.newChat();
26
+ else if (act === 'toggle-sidebar')
27
+ on.sidebar();
28
+ else if (act === 'toggle-theme') {
29
+ const cls = typeof document !== 'undefined' ? document.documentElement.classList : null;
30
+ const next = cls && (cls.contains('light') || cls.contains('t_light')) ? 'dark' : 'light';
31
+ on.chooseTheme?.(next);
32
+ on.say?.(next === 'light' ? t('Switched to light theme') : t('Switched to dark theme'));
33
+ }
34
+ else {
35
+ const next = !getDevMode();
36
+ setDevMode(next);
37
+ on.say?.(next ? t('Developer mode enabled') : t('Developer mode disabled'));
38
+ }
39
+ return true;
40
+ }
41
+ if ((e.metaKey || e.ctrlKey) && !e.shiftKey && !e.altKey && e.key === ',' && !typing(e.target) && !inDialog(e.target)) {
42
+ e.preventDefault();
43
+ on.settings();
44
+ return true;
45
+ }
46
+ return false;
47
+ }
48
+ /** Listen for the global keys while mounted. */
49
+ export function useGlobalKeys(on) {
50
+ const { t } = useI18n();
51
+ const latest = useRef(on);
52
+ latest.current = on;
53
+ useEffect(() => {
54
+ const key = (e) => void handle(e, latest.current, t);
55
+ window.addEventListener('keydown', key);
56
+ return () => window.removeEventListener('keydown', key);
57
+ }, [t]);
58
+ }
@@ -0,0 +1,5 @@
1
+ /** Landing in the Drive happens once: the first bucket opens on arrival, and never again after the reader has gone back to the root list. */
2
+ export declare function arrival(done: boolean, bucket: string | null, first: string | null): {
3
+ done: boolean;
4
+ open: string | null;
5
+ };
@@ -0,0 +1,10 @@
1
+ /** Landing in the Drive happens once: the first bucket opens on arrival, and never again after the reader has gone back to the root list. */
2
+ export function arrival(done, bucket, first) {
3
+ if (done)
4
+ return { done, open: null };
5
+ if (bucket)
6
+ return { done: true, open: null };
7
+ if (first)
8
+ return { done: true, open: first };
9
+ return { done: false, open: null };
10
+ }
@@ -21,6 +21,8 @@
21
21
  */
22
22
  export declare const GROUPS: readonly ['Business', 'Data', 'Agents', 'Build & run', 'Security', 'Creative', 'Models'];
23
23
  export type Group = (typeof GROUPS)[number];
24
+ /** A group's heading as the list draws it: authored English, drawn through `t`. */
25
+ export declare const HEADING: Record<Group, string>;
24
26
  /**
25
27
  * How an app draws inside the Hanzo app, at /apps/<id>: its own live host in a
26
28
  * frame (`href`, with `?embed=1`), so a deploy of the standalone app reaches
package/dist/lib/betas.js CHANGED
@@ -23,6 +23,16 @@ import { phrase } from '@hanzo/i18n';
23
23
  import { CHANGED } from './optin.js';
24
24
  import { home, named, orgs, superAdmin } from './session.js';
25
25
  export const GROUPS = ['Business', 'Data', 'Agents', 'Build & run', 'Security', 'Creative', 'Models'];
26
+ /** A group's heading as the list draws it: authored English, drawn through `t`. */
27
+ export const HEADING = {
28
+ Business: phrase('Business'),
29
+ Data: phrase('Data'),
30
+ Agents: phrase('Agents'),
31
+ 'Build & run': phrase('Build & run'),
32
+ Security: phrase('Security'),
33
+ Creative: phrase('Creative'),
34
+ Models: phrase('Models'),
35
+ };
26
36
  /** The developer platform, where a module in beta opens at its own address for anyone who has it. */
27
37
  const PLATFORM = 'https://platform.hanzo.ai';
28
38
  export const BETAS = [