@hanzo/app 0.3.94 → 0.3.96

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 (110) 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 +114 -48
  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/PreferencesDialog.js +5 -2
  30. package/dist/Rail.d.ts +73 -7
  31. package/dist/Rail.js +372 -111
  32. package/dist/Recents.js +77 -24
  33. package/dist/RightPane.js +2 -2
  34. package/dist/Search.d.ts +13 -1
  35. package/dist/Search.js +366 -50
  36. package/dist/Setup.js +34 -5
  37. package/dist/Shared.js +12 -12
  38. package/dist/Shell.d.ts +10 -0
  39. package/dist/Shell.js +258 -158
  40. package/dist/Sidebar.d.ts +14 -3
  41. package/dist/Sidebar.js +411 -129
  42. package/dist/SkipLink.d.ts +8 -0
  43. package/dist/SkipLink.js +11 -0
  44. package/dist/Start.js +51 -52
  45. package/dist/Terminals.js +159 -11
  46. package/dist/ToBottom.js +1 -1
  47. package/dist/Upgrade.d.ts +8 -3
  48. package/dist/Upgrade.js +194 -103
  49. package/dist/Usage.d.ts +1 -1
  50. package/dist/Usage.js +186 -82
  51. package/dist/WalletPill.js +8 -2
  52. package/dist/Work.js +162 -53
  53. package/dist/archive.d.ts +8 -0
  54. package/dist/archive.js +16 -0
  55. package/dist/bots/Bots.js +16 -1
  56. package/dist/bots/ComputerDialog.js +53 -26
  57. package/dist/bots/ConnectorsDialog.js +34 -15
  58. package/dist/bots/Make.js +5 -1
  59. package/dist/bots/Panel.js +37 -31
  60. package/dist/bots/Roster.d.ts +4 -1
  61. package/dist/bots/Roster.js +71 -25
  62. package/dist/bots/Thread.js +54 -27
  63. package/dist/bots/face.js +9 -3
  64. package/dist/bots/grid.d.ts +36 -0
  65. package/dist/bots/grid.js +91 -0
  66. package/dist/bots/ink.d.ts +1 -1
  67. package/dist/bots/ink.js +1 -1
  68. package/dist/bots/kit.d.ts +9 -4
  69. package/dist/bots/kit.js +3 -2
  70. package/dist/chord.d.ts +13 -0
  71. package/dist/chord.js +30 -1
  72. package/dist/crew.js +47 -4
  73. package/dist/ground.d.ts +2 -2
  74. package/dist/ground.js +3 -3
  75. package/dist/help.d.ts +7 -3
  76. package/dist/help.js +19 -14
  77. package/dist/keys.d.ts +28 -0
  78. package/dist/keys.js +58 -0
  79. package/dist/lib/arrival.d.ts +5 -0
  80. package/dist/lib/arrival.js +10 -0
  81. package/dist/lib/betas.d.ts +2 -0
  82. package/dist/lib/betas.js +10 -0
  83. package/dist/lib/branch.d.ts +11 -0
  84. package/dist/lib/branch.js +11 -0
  85. package/dist/lib/chatPreferences.d.ts +1 -1
  86. package/dist/lib/chatPreferences.js +1 -1
  87. package/dist/lib/dev-mode.d.ts +18 -0
  88. package/dist/lib/dev-mode.js +102 -0
  89. package/dist/lib/durable.d.ts +1 -1
  90. package/dist/lib/durable.js +1 -1
  91. package/dist/lib/info-hint.d.ts +7 -0
  92. package/dist/lib/info-hint.js +8 -0
  93. package/dist/lib/model-picker.d.ts +2 -0
  94. package/dist/lib/model-picker.js +12 -0
  95. package/dist/lib/owners.d.ts +5 -0
  96. package/dist/lib/owners.js +15 -0
  97. package/dist/lib/pay.d.ts +2 -0
  98. package/dist/lib/pay.js +4 -0
  99. package/dist/lib/todo.d.ts +7 -1
  100. package/dist/lib/todo.js +41 -29
  101. package/dist/look.js +39 -8
  102. package/dist/rail-open.d.ts +9 -0
  103. package/dist/rail-open.js +34 -0
  104. package/dist/renaming.d.ts +10 -0
  105. package/dist/renaming.js +25 -0
  106. package/dist/seek.d.ts +6 -1
  107. package/dist/seek.js +13 -0
  108. package/dist/thread.d.ts +2 -1
  109. package/dist/thread.js +85 -44
  110. 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,9 +32,15 @@ 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
- 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 }) })] }));
43
+ const badge = Math.max(12, Math.min(20, Math.round(size * 0.36)));
44
+ const star = Math.max(7, Math.round(badge * 0.52));
45
+ return (_jsxs(YStack, { position: "relative", width: size, height: size, shrink: 0, children: [disc, _jsx(YStack, { "aria-hidden": true, position: "absolute", r: -1, b: -1, width: badge, height: badge, rounded: 9999, items: "center", justify: "center", bg: "var(--warning, var(--chrome-dot-yellow))", borderWidth: size <= 28 ? 1.5 : 2, borderColor: FLOOR, children: _jsx(Star, { size: star, color: "var(--pure-white, var(--foreground))", fill: "currentColor", strokeWidth: 2 }) })] }));
40
46
  }
@@ -2,6 +2,28 @@ import type { Agent, AgentRun } from '@hanzo/ai';
2
2
  import type { BotGroup, GroupPolicy } from './api.js';
3
3
  /** How many bots the grid holds before the rest become rows. */
4
4
  export declare const GRID = 12;
5
+ /** Sidebar column count for the Pinned Bots grid (1 → 2 → 3). */
6
+ export type RosterColumns = 1 | 2 | 3;
7
+ /** User column preference: responsive width-driven (`auto`) or an explicit 1–3 column lock. */
8
+ export type RosterColumnPref = 'auto' | RosterColumns;
9
+ /** Default, minimum, and maximum widths (px) for the drag-resizable Bots sidebar. */
10
+ export declare const ROSTER_WIDTH_DEFAULT = 256;
11
+ export declare const ROSTER_WIDTH_MIN = 180;
12
+ export declare const ROSTER_WIDTH_MAX = 400;
13
+ /** Width breakpoints (px): <= 220 = 1 col, 221–295 = 2 cols, >= 296 = 3 cols. */
14
+ export declare const ROSTER_COL_2_MIN = 221;
15
+ export declare const ROSTER_COL_3_MIN = 296;
16
+ /** Maps a sidebar width (px) to 1, 2, or 3 pinned-bot grid columns. */
17
+ export declare function columnsForWidth(width: number): RosterColumns;
18
+ /** Resolves effective column count from sidebar width and optional explicit column preference. */
19
+ export declare function resolveColumns(width: number, pref?: RosterColumnPref): RosterColumns;
20
+ /** Four user-selectable avatar density sizes for the Pinned Bots sidebar. */
21
+ export type BotIconSize = 'xs' | 'sm' | 'md' | 'lg';
22
+ export declare const BOT_ICON_SIZES: readonly BotIconSize[];
23
+ export declare const BOT_AVATAR_PX: Record<BotIconSize, number>;
24
+ export declare function isBotIconSize(value: unknown): value is BotIconSize;
25
+ /** Pixel diameter for a bot avatar at the chosen density step. */
26
+ export declare function avatarSizePx(size: BotIconSize): number;
5
27
  /** Whether a bot wears the Primary / Lead star badge in the roster grid. */
6
28
  export declare function isStarredBot(bot: Agent): boolean;
7
29
  /** What a row says under a bot's name: its newest run's last word. */
@@ -11,6 +33,20 @@ export declare function split(bots: readonly Agent[], last: ReadonlyMap<string,
11
33
  grid: Agent[];
12
34
  rows: Agent[];
13
35
  };
36
+ /** Default pinned bot names (lowercase) before the user customizes their pinned grid. */
37
+ export declare function defaultPinnedNames(bots: readonly Agent[]): string[];
38
+ /** Toggles a bot's membership in the pinned list (case-insensitive by name). */
39
+ export declare function togglePinnedBot(current: readonly string[], name: string): string[];
40
+ /**
41
+ * Partitions real bots into top Pinned Bots (`pinned`) and normal vertical rows (`unpinned`).
42
+ * When `pinnedNames` is `null`, falls back to the default `split()` grid/rows ordering.
43
+ * When `pinnedNames` is an explicit list, pinned bots stay above the hairline in pin/primary order
44
+ * and all remaining bots appear below sorted by latest activity, then rank/creation order.
45
+ */
46
+ export declare function partitionPinned(bots: readonly Agent[], last: ReadonlyMap<string, AgentRun>, pinnedNames: readonly string[] | null): {
47
+ pinned: Agent[];
48
+ unpinned: Agent[];
49
+ };
14
50
  /** Orders Bot Groups by layer ascending (`Layer 1`, `Layer 2`, ...), then alphabetically. */
15
51
  export declare function sortGroupsByLayer(groups: readonly BotGroup[]): BotGroup[];
16
52
  /** Compact human-readable badge for a group's consensus or leadership policy. */
package/dist/bots/grid.js CHANGED
@@ -6,6 +6,39 @@ import { PRIMARY_BOT } from './api.js';
6
6
  import { instant } from './time.js';
7
7
  /** How many bots the grid holds before the rest become rows. */
8
8
  export const GRID = 12;
9
+ /** Default, minimum, and maximum widths (px) for the drag-resizable Bots sidebar. */
10
+ export const ROSTER_WIDTH_DEFAULT = 256;
11
+ export const ROSTER_WIDTH_MIN = 180;
12
+ export const ROSTER_WIDTH_MAX = 400;
13
+ /** Width breakpoints (px): <= 220 = 1 col, 221–295 = 2 cols, >= 296 = 3 cols. */
14
+ export const ROSTER_COL_2_MIN = 221;
15
+ export const ROSTER_COL_3_MIN = 296;
16
+ /** Maps a sidebar width (px) to 1, 2, or 3 pinned-bot grid columns. */
17
+ export function columnsForWidth(width) {
18
+ if (width >= ROSTER_COL_3_MIN)
19
+ return 3;
20
+ if (width >= ROSTER_COL_2_MIN)
21
+ return 2;
22
+ return 1;
23
+ }
24
+ /** Resolves effective column count from sidebar width and optional explicit column preference. */
25
+ export function resolveColumns(width, pref = 'auto') {
26
+ return pref === 'auto' ? columnsForWidth(width) : pref;
27
+ }
28
+ export const BOT_ICON_SIZES = ['xs', 'sm', 'md', 'lg'];
29
+ export const BOT_AVATAR_PX = {
30
+ xs: 24,
31
+ sm: 32,
32
+ md: 44,
33
+ lg: 56,
34
+ };
35
+ export function isBotIconSize(value) {
36
+ return value === 'xs' || value === 'sm' || value === 'md' || value === 'lg';
37
+ }
38
+ /** Pixel diameter for a bot avatar at the chosen density step. */
39
+ export function avatarSizePx(size) {
40
+ return BOT_AVATAR_PX[size];
41
+ }
9
42
  const LEAD_ORDER = new Map(['vi', 'opera', 'mana', 'dev', 'des', 'fin', 'huma', 'mark', 'sal', 'sci', 'su', 'cyber'].map((id, i) => [id, i]));
10
43
  function rankOf(bot) {
11
44
  const ext = bot;
@@ -48,6 +81,64 @@ export function split(bots, last) {
48
81
  .sort((a, b) => (instant(last.get(b.name)?.createdAt) ?? 0) - (instant(last.get(a.name)?.createdAt) ?? 0));
49
82
  return { grid, rows };
50
83
  }
84
+ /** Default pinned bot names (lowercase) before the user customizes their pinned grid. */
85
+ export function defaultPinnedNames(bots) {
86
+ return split(bots, new Map()).grid.map((b) => b.name.toLowerCase());
87
+ }
88
+ /** Toggles a bot's membership in the pinned list (case-insensitive by name). */
89
+ export function togglePinnedBot(current, name) {
90
+ const key = name.trim().toLowerCase();
91
+ if (!key)
92
+ return [...current];
93
+ const normalized = current.map((n) => n.trim().toLowerCase()).filter(Boolean);
94
+ if (normalized.includes(key)) {
95
+ return normalized.filter((n) => n !== key);
96
+ }
97
+ return [...normalized, key];
98
+ }
99
+ /**
100
+ * Partitions real bots into top Pinned Bots (`pinned`) and normal vertical rows (`unpinned`).
101
+ * When `pinnedNames` is `null`, falls back to the default `split()` grid/rows ordering.
102
+ * When `pinnedNames` is an explicit list, pinned bots stay above the hairline in pin/primary order
103
+ * and all remaining bots appear below sorted by latest activity, then rank/creation order.
104
+ */
105
+ export function partitionPinned(bots, last, pinnedNames) {
106
+ if (pinnedNames === null) {
107
+ const { grid, rows } = split(bots, last);
108
+ return { pinned: grid, unpinned: rows };
109
+ }
110
+ const order = new Map();
111
+ pinnedNames.forEach((n, idx) => {
112
+ const key = n.trim().toLowerCase();
113
+ if (key && !order.has(key))
114
+ order.set(key, idx);
115
+ });
116
+ const pinned = [];
117
+ const unpinned = [];
118
+ for (const bot of bots) {
119
+ if (order.has(bot.name.toLowerCase()))
120
+ pinned.push(bot);
121
+ else
122
+ unpinned.push(bot);
123
+ }
124
+ pinned.sort((a, b) => {
125
+ const oa = order.get(a.name.toLowerCase()) ?? Number.MAX_SAFE_INTEGER;
126
+ const ob = order.get(b.name.toLowerCase()) ?? Number.MAX_SAFE_INTEGER;
127
+ if (oa !== ob)
128
+ return oa - ob;
129
+ return rankOf(a) - rankOf(b);
130
+ });
131
+ unpinned.sort((a, b) => {
132
+ const dt = (instant(last.get(b.name)?.createdAt) ?? 0) - (instant(last.get(a.name)?.createdAt) ?? 0);
133
+ if (dt !== 0)
134
+ return dt;
135
+ const dr = rankOf(a) - rankOf(b);
136
+ if (dr !== 0)
137
+ return dr;
138
+ return (instant(a.createdAt) ?? 0) - (instant(b.createdAt) ?? 0);
139
+ });
140
+ return { pinned, unpinned };
141
+ }
51
142
  /** Orders Bot Groups by layer ascending (`Layer 1`, `Layer 2`, ...), then alphabetically. */
52
143
  export function sortGroupsByLayer(groups) {
53
144
  return [...groups].sort((a, b) => {
@@ -11,6 +11,6 @@ export declare const MINE = "color-mix(in oklab, var(--foreground) 17%, var(--pa
11
11
  export declare const INK = "var(--foreground)";
12
12
  export declare const DIM = "var(--text-secondary, var(--muted-foreground))";
13
13
  export declare const FAINT = "$faint";
14
- export declare const LINE = "var(--pane-edge, var(--border))";
14
+ export declare const LINE = "var(--pane-edge, var(--white-08))";
15
15
  /** The composer's edge, the one control drawn a step louder. */
16
16
  export declare const EDGE = "var(--border-strong)";
package/dist/bots/ink.js CHANGED
@@ -15,6 +15,6 @@ export const MINE = 'color-mix(in oklab, var(--foreground) 17%, var(--pane-fill,
15
15
  export const INK = 'var(--foreground)';
16
16
  export const DIM = 'var(--text-secondary, var(--muted-foreground))';
17
17
  export const FAINT = '$faint';
18
- export const LINE = 'var(--pane-edge, var(--border))';
18
+ export const LINE = 'var(--pane-edge, var(--white-08))';
19
19
  /** The composer's edge, the one control drawn a step louder. */
20
20
  export const EDGE = 'var(--border-strong)';
@@ -1,14 +1,18 @@
1
- /** A round icon control, 34px: the roster's search and new, Share, Preferences, Close. */
1
+ /** A round icon control, 34px on desktop and 44px under touch pointers: the roster's search and new, Share, Preferences, Close. */
2
2
  export declare const ROUND: {
3
3
  readonly render: 'button';
4
4
  readonly type: 'button';
5
5
  readonly width: 34;
6
6
  readonly height: 34;
7
+ readonly $touchable: {
8
+ readonly minW: 44;
9
+ readonly minH: 44;
10
+ };
7
11
  readonly shrink: 0;
8
12
  readonly rounded: 999;
9
13
  readonly bg: "var(--surface-card-emphasis)";
10
14
  readonly borderWidth: 1;
11
- readonly borderColor: "var(--pane-edge, var(--border))";
15
+ readonly borderColor: "var(--pane-edge, var(--white-08))";
12
16
  readonly items: 'center';
13
17
  readonly justify: 'center';
14
18
  readonly cursor: 'pointer';
@@ -34,7 +38,7 @@ export declare const PILL: {
34
38
  readonly rounded: 999;
35
39
  readonly bg: "var(--surface-card-emphasis)";
36
40
  readonly borderWidth: 1;
37
- readonly borderColor: "var(--pane-edge, var(--border))";
41
+ readonly borderColor: "var(--pane-edge, var(--white-08))";
38
42
  readonly cursor: 'pointer';
39
43
  readonly shrink: 0;
40
44
  readonly hoverStyle: {
@@ -67,7 +71,7 @@ export declare const LABEL: {
67
71
  export declare const CARD: {
68
72
  readonly bg: "var(--surface-card-emphasis)";
69
73
  readonly borderWidth: 1;
70
- readonly borderColor: "var(--pane-edge, var(--border))";
74
+ readonly borderColor: "var(--pane-edge, var(--white-08))";
71
75
  readonly rounded: 14;
72
76
  };
73
77
  /** One line, cut with an ellipsis where it runs out of space. */
@@ -75,4 +79,5 @@ export declare const CLIP: {
75
79
  readonly whiteSpace: 'nowrap';
76
80
  readonly overflow: 'hidden';
77
81
  readonly textOverflow: 'ellipsis';
82
+ readonly maxW: '100%';
78
83
  };
package/dist/bots/kit.js CHANGED
@@ -1,12 +1,13 @@
1
1
  // The controls the Bots app is drawn from, as gui props, stated once and spread
2
2
  // where they are drawn.
3
3
  import { DIM, INK, LINE, PICKED, RAISED } from './ink.js';
4
- /** A round icon control, 34px: the roster's search and new, Share, Preferences, Close. */
4
+ /** A round icon control, 34px on desktop and 44px under touch pointers: the roster's search and new, Share, Preferences, Close. */
5
5
  export const ROUND = {
6
6
  render: 'button',
7
7
  type: 'button',
8
8
  width: 34,
9
9
  height: 34,
10
+ $touchable: { minW: 44, minH: 44 },
10
11
  shrink: 0,
11
12
  rounded: 999,
12
13
  bg: RAISED,
@@ -44,4 +45,4 @@ export const LABEL = { render: 'h3', fontSize: 13, lineHeight: 18, fontWeight: '
44
45
  /** A card in the panel. */
45
46
  export const CARD = { bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 14 };
46
47
  /** One line, cut with an ellipsis where it runs out of space. */
47
- export const CLIP = { whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' };
48
+ 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
@@ -17,7 +17,7 @@ export declare const pane: (fill?: string) => {
17
17
  readonly borderRadius: 'var(--pane-round)';
18
18
  readonly borderWidth: 1;
19
19
  readonly borderStyle: 'solid';
20
- readonly borderColor: 'var(--pane-edge, var(--border))';
20
+ readonly borderColor: 'var(--pane-edge, var(--white-08))';
21
21
  readonly backdropFilter: 'var(--pane-blur)';
22
22
  };
23
23
  /**
@@ -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
  */