@hanzo/app 0.3.68 → 0.3.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Account.js CHANGED
@@ -129,7 +129,7 @@ function usePlan(org, enabled) {
129
129
  /** The person's picture, or their initials. */
130
130
  export function Face({ host, size = 28 }) {
131
131
  const p = host.person;
132
- return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: "$raised", overflow: "hidden", shrink: 0, borderWidth: 1, borderColor: "$borderColor", children: p?.avatar ? (_jsx("img", { src: p.avatar, alt: "", width: size, height: size })) : (_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", children: initials(p?.name || p?.email || '') })) }));
132
+ return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: p?.avatar ? '$raised' : 'var(--shell-avatar-bg, var(--art-ember))', overflow: "hidden", shrink: 0, borderWidth: p?.avatar ? 1 : 0, borderColor: "$borderColor", children: p?.avatar ? (_jsx("img", { src: p.avatar, alt: "", width: size, height: size })) : (_jsx(SizableText, { fontSize: Math.max(10, Math.round(size * 0.39)), lineHeight: size, fontWeight: "600", color: "var(--pure-white)", children: initials(p?.name || p?.email || '') })) }));
133
133
  }
134
134
  /** A row's face: its icon in a 20px well, its words, and what trails them. */
135
135
  function Line({ icon, children, sub, trail }) {
package/dist/App.js CHANGED
@@ -65,7 +65,7 @@ import { ArrowLeft, ArrowRight, Clapperboard, RefreshCw, Sparkles, Workflow } fr
65
65
  import { AiProvider } from '@hanzo/ai/react';
66
66
  import { XStack, YStack } from '@hanzo/gui';
67
67
  import { Button, Text } from '@hanzo/ui';
68
- import { Builder, HostProvider, PrefsProvider, route, tabs } from '@hanzo/build';
68
+ import { Builder, HostProvider, MARKS, PrefsProvider, route, tabs } from '@hanzo/build';
69
69
  import * as studioPkg from '@hanzo/studio';
70
70
  import { nav as places } from '@hanzo/studio';
71
71
  import { useAi } from './lib/ai.js';
@@ -112,8 +112,8 @@ const Hosted = lazy(() => import('./Hosted.js').then((m) => ({ default: m.Hosted
112
112
  const Betas = lazy(() => import('./Betas.js').then((m) => ({ default: m.BetasPane })));
113
113
  /** `/` is Chat on a new conversation. */
114
114
  const HOME = { mode: 'chat', thread: null };
115
- /** The bar's height, px: the reference window's title bar. */
116
- const BAR = 40;
115
+ /** The bar's height, px: the reference window's 38px top chrome bar. */
116
+ const BAR = 38;
117
117
  /** Where each mode was last, so the rail goes back to it. */
118
118
  const last = { chat: '', dev: '', studio: '', design: '', flow: '', tabs: '' };
119
119
  /** Whether a key press is the reader typing, where the app's keys are the field's. */
@@ -332,9 +332,16 @@ function Window({ bar, betas }) {
332
332
  shut();
333
333
  setFinding(true);
334
334
  };
335
- return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsx(UsageProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...(bar ? floor : null), flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [bar ? (_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", gap: 2, pl: (bar.inset ?? 0) + 6, pr: "$2", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, ...bar.drag, children: [_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) }), _jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 18, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(XStack, { flex: 1, self: "stretch", ...bar.drag }), bar.controls !== undefined ? (bar.controls) : !bar.inset ? (_jsx(WindowControls, {})) : null] })) : null, _jsxs(XStack, { ref: drawer.pane, "data-app": mode, "data-slot": "frame", ...(bar ? null : floor), ...drawer.slide, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
335
+ return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsx(UsageProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...(bar ? floor : null), flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", bg: "var(--shell-bar-bg, var(--secondary))", borderBottomWidth: 1, borderColor: "var(--shell-bar-border, var(--border))", "$max-md": bar ? undefined : { display: 'none' }, onMouseDown: bar ? dragWindow : undefined, onDoubleClick: bar ? toggleWindowMaximize : undefined, ...(bar?.drag ?? null), children: [_jsxs(XStack, { "data-slot": "title-bar-start", height: "100%", items: "center", gap: 2, pl: (bar?.inset ?? 0) + 8, pr: 8, shrink: 0, width: closed ? 44 : 'calc(44px + var(--app-sidebar-span, 240px))', borderRightWidth: closed ? 0 : 1, borderColor: "var(--shell-bar-border, var(--border))", ...(bar?.drag ?? null), children: [_jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) })] }), _jsxs(XStack, { id: "hanzo-titlebar-slot", "data-slot": "title-bar-main", flex: 1, minW: 0, self: "stretch", items: "center", justify: "space-between", pl: 14, pr: 10, gap: 6, ...(bar?.drag ?? null), children: [_jsxs(XStack, { "data-slot": "titlebar-fallback", flex: 1, minW: 0, items: "center", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: mode === 'chat' ? '' : mode === 'dev' ? 'Dev' : mode === 'studio' ? 'Studio' : mode === 'design' ? 'Design' : mode === 'flow' ? 'Flow' : mode === 'tabs' ? 'Tabs' : '' }), _jsx(XStack, { items: "center", gap: 2, "data-tauri-drag-region": "false", children: _jsx(Mark, { label: mode === 'dev' ? t('New run') : t('New chat'), "data-slot": "titlebar-new", onPress: () => {
336
+ if (mode === 'dev')
337
+ host.go('');
338
+ else {
339
+ empty();
340
+ move(talk());
341
+ }
342
+ }, children: mode === 'dev' ? _jsx(MARKS.dev.make, { size: 15, "aria-hidden": true }) : _jsx(MARKS.chat.make, { size: 15, "aria-hidden": true }) }) })] }), bar ? (bar.controls !== undefined ? (bar.controls) : !bar.inset ? (_jsx(WindowControls, {})) : null) : null] })] }), _jsxs(XStack, { ref: drawer.pane, "data-app": mode, "data-slot": "frame", ...(bar ? null : floor), ...drawer.slide, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
336
343
  // The gap above the pane is the gap at its end and foot; a window's own bar above it is that gap.
337
- pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsxs(YStack, { height: "100%", position: "relative", "$max-md": { display: 'none' }, children: [_jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, toggle: bar ? undefined : flip, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), closed ? (_jsx(YStack, { "data-slot": "sidebar-reopen-edge", position: "absolute", t: 0, b: 0, r: -4, width: 8, z: 20, cursor: "ew-resize", onDoubleClick: () => setClosed(false), onMouseDown: (down) => {
344
+ pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsxs(YStack, { height: "100%", position: "relative", "$max-md": { display: 'none' }, children: [_jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), closed ? (_jsx(YStack, { "data-slot": "sidebar-reopen-edge", position: "absolute", t: 0, b: 0, r: -4, width: 8, z: 20, cursor: "ew-resize", onDoubleClick: () => setClosed(false), onMouseDown: (down) => {
338
345
  const e = down;
339
346
  const startX = e.clientX ?? 0;
340
347
  const onMove = (mv) => {
package/dist/Chat.js CHANGED
@@ -28,12 +28,13 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
28
28
  // belongs in the thread where the reader can see it, not in a caption that
29
29
  // pre-emptively refuses on the gateway's behalf.
30
30
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
31
+ import { createPortal } from "react-dom";
31
32
  import { english, isolate, phrase } from "@hanzo/i18n";
32
33
  import { useI18n } from "@hanzo/i18n/react";
33
34
  import { billed, detail, familyOf, ours, planRequired, plainly, refused } from "./failure.js";
34
35
  import { Prose } from "./Prose.js";
35
36
  import { useAgent, useAi, useChat, } from "@hanzo/ai/react";
36
- import { Chat as ChatSurface, EFFORTS, Failure, MEASURE, Parts, useFamilies, words } from "@hanzo/ui/chat";
37
+ import { Chat as ChatSurface, EFFORTS, Failure, Parts, Tune, useFamilies, words } from "@hanzo/ui/chat";
37
38
  import { carriedIn, carrying, compose, partsOf, said as told, weigh } from "./lib/attach.js";
38
39
  import { download, dropped, fileOf, pct, readable, refOf, retrieve } from "./lib/files.js";
39
40
  import { conversation, drop, hold, landed, localOf, spend, take, usePane, useWorkFile } from "./pane.js";
@@ -57,13 +58,13 @@ import { useHydrated } from "./lib/hydrated.js";
57
58
  import { base, served } from "./lib/ai.js";
58
59
  import { onServed } from "./lib/served.js";
59
60
  import { refused as worded, speech, useDictation, useTalk, useVoice } from "@hanzo/voice";
60
- import { Check, FileText, Ghost, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
61
+ import { Check, ChevronDown, CircleAlert, Copy, FileText, Ghost, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, SquarePlus, X } from "lucide-react";
61
62
  import { ENSO } from "./lib/ai.js";
62
63
  import { openThread, empty as emptyOpen, useOpen } from "./open.js";
63
64
  import { Side } from "./Shell.js";
64
- import { SEED, look, useSections, useSites } from "./RightPane.js";
65
+ import { ContextCard, SEED, look, useSections, useSites } from "./RightPane.js";
65
66
  import { Share } from "./Share.js";
66
- import { ConversationMenu, useThreadActions, useThreadList } from "./thread.js";
67
+ import { ConversationMenu, ThreadMore, useThreadActions, useThreadList } from "./thread.js";
67
68
  import { Schedule } from "./Schedule.js";
68
69
  import { keepFile, useAttach, useKeep } from "./keep.js";
69
70
  import { useKept } from "./kept.js";
@@ -76,7 +77,6 @@ import { first } from './lib/first.js';
76
77
  import { BAD } from "./lib/mix.js";
77
78
  import { brand } from './where.js';
78
79
  import { BAND, HEAD, inPane, INSET, TOUCH_HEAD } from './ground.js';
79
- import { UsageControl } from './Usage.js';
80
80
  import { shared, useChatPreferences } from './lib/chatPreferences.js';
81
81
  import { handleHint } from './hint.js';
82
82
  // NO REASONING PANEL HERE. Every assistant turn opened a "Thinking" disclosure
@@ -106,6 +106,26 @@ import { handleHint } from './hint.js';
106
106
  * since.
107
107
  */
108
108
  const MAX_ANON_TURNS = 3;
109
+ function extractWritingTurn(text) {
110
+ const trimmed = text.trim();
111
+ if (!trimmed)
112
+ return null;
113
+ const fenced = trimmed.match(/^```(?:writing|markdown|md|text)\s*\n([\s\S]*?)\n```\s*$/i);
114
+ if (fenced)
115
+ return fenced[1]?.trim() || null;
116
+ if (!trimmed.includes("```") && trimmed.includes("\n\n"))
117
+ return trimmed;
118
+ return null;
119
+ }
120
+ function WritingCard({ text, label, copyLabel, copiedLabel, }) {
121
+ const [copied, setCopied] = useState(false);
122
+ return (_jsxs(YStack, { "data-slot": "writing-card", width: "100%", rounded: 14, borderWidth: 1, borderColor: "var(--writing-border, var(--border-strong))", overflow: "hidden", children: [_jsxs(XStack, { "data-slot": "writing-head", height: 36, px: 16, items: "center", justify: "space-between", bg: "var(--writing-head-bg, var(--surface-3))", borderBottomWidth: 1, borderColor: "var(--writing-divider, var(--border))", children: [_jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "500", color: "var(--shell-section-fg, var(--muted-foreground))", children: label }), _jsx(Box, { render: "button", "data-slot": "writing-copy", "aria-label": copied ? copiedLabel : copyLabel, title: copied ? copiedLabel : copyLabel, width: 26, height: 26, rounded: 6, items: "center", justify: "center", cursor: "pointer", hoverStyle: { bg: "$hover" }, onClick: () => {
123
+ void navigator.clipboard?.writeText(text).then(() => {
124
+ setCopied(true);
125
+ setTimeout(() => setCopied(false), 1600);
126
+ });
127
+ }, children: copied ? (_jsx(Check, { size: 14, color: "var(--foreground)", "aria-hidden": true })) : (_jsx(Copy, { size: 14, color: "var(--shell-section-fg, var(--muted-foreground))", "aria-hidden": true })) })] }), _jsx(YStack, { px: 18, py: 16, bg: "var(--writing-body-bg, var(--surface-2))", children: _jsx(Prose, { text: text }) })] }));
128
+ }
109
129
  function synthesizeAnonReply(prompt) {
110
130
  const q = prompt.trim();
111
131
  const lower = q.toLowerCase();
@@ -1791,6 +1811,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1791
1811
  }
1792
1812
  }, [initial, open, anonymous, settled, sendAnon]);
1793
1813
  const families = useFamilies(mind, (id) => setAsk({ model: nameOf(id, listed) }));
1814
+ const [titlebarSlot, setTitlebarSlot] = useState(null);
1815
+ useEffect(() => {
1816
+ if (typeof document === "undefined")
1817
+ return;
1818
+ setTitlebarSlot(document.getElementById("hanzo-titlebar-slot"));
1819
+ }, [media.md]);
1820
+ const inTopChrome = Boolean(media.md && titlebarSlot);
1794
1821
  const composer = {
1795
1822
  value: draft,
1796
1823
  onChange: setDraft,
@@ -1799,15 +1826,28 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1799
1826
  busy: chat.streaming || anonBusy,
1800
1827
  // Files alone are a message: what is held goes with an empty draft too.
1801
1828
  ready: Boolean(draft.trim() || files.length),
1802
- // `label` keeps the accessible name constant; the placeholder is the composer's own
1803
- // (the defaults @hanzo/ui and @hanzo/build each call ASK), said here so both are the reader's.
1829
+ // `label` keeps the accessible name constant; the placeholder matches the desktop workspace prompt.
1804
1830
  label: t("Ask anything"),
1805
- placeholder: t("Type / for skills"),
1831
+ placeholder: t("Work with {brand}", { brand: brand() }),
1806
1832
  // At the thread's measure.
1807
1833
  column: true,
1808
1834
  // Private: the frame drops its ground and dashes its edge (@hanzo/ui ≥ 8.29.40); the
1809
1835
  // toggled ghost in the head and this frame are the whole of what says it.
1810
1836
  forgetful,
1837
+ children: anonymous ? undefined : (_jsxs(XStack, { flex: 1, minW: 0, items: "center", justify: "space-between", gap: 6, children: [_jsxs(XStack, { render: "button", "data-slot": "composer-access-mode", "data-mode": chatPrefs.approvalMode === "manual" ? "manual" : "auto", "aria-label": chatPrefs.approvalMode === "manual" ? t("Manual approval") : t("Full access"), items: "center", gap: 5, height: 28, px: 6, rounded: 8, cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => {
1838
+ const next = chatPrefs.approvalMode === "manual" ? "auto" : "manual";
1839
+ setChatPrefs({ approvalMode: next });
1840
+ carry.mode.set(next);
1841
+ }, children: [_jsx(CircleAlert, { size: 14, strokeWidth: 1.9, color: chatPrefs.approvalMode === "manual" ? "var(--shell-section-fg, var(--muted-foreground))" : "var(--composer-full-access, var(--art-ember))", "aria-hidden": true }), _jsx(Text, { fontSize: 12.5, lineHeight: 16, fontWeight: "500", color: chatPrefs.approvalMode === "manual" ? "var(--shell-section-fg, var(--muted-foreground))" : "var(--composer-full-access, var(--art-ember))", numberOfLines: 1, children: chatPrefs.approvalMode === "manual" ? t("Manual approval") : t("Full access") })] }), _jsxs(XStack, { items: "center", gap: 2, shrink: 0, children: [_jsx(Tune, { mind: { ...mind, models: filteredListed }, effort: {
1842
+ value: chatPrefs.effort || "auto",
1843
+ set: (eff) => {
1844
+ setChatPrefs({ effort: eff });
1845
+ const next = shared(eff);
1846
+ if (next)
1847
+ mind.pace(next);
1848
+ },
1849
+ items: EFFORTS,
1850
+ }, mode: null, limits: limits, onUpgrade: (id) => setAsk({ model: nameOf(id, listed) }) }), _jsx(ChevronDown, { size: 12, color: "var(--shell-section-fg, var(--muted-foreground))", "aria-hidden": true })] })] })),
1811
1851
  // A file or an image pasted into the field is held like a picked one;
1812
1852
  // words paste as words.
1813
1853
  field: {
@@ -1891,35 +1931,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1891
1931
  ],
1892
1932
  slash: carry.skills,
1893
1933
  at: carry.plugins,
1894
- // The mode is Auto or Manual approval, the one Settings keeps; the person
1895
- // turns the pill on in Settings → Appearance, and it is off until they do.
1896
- mode: anonymous
1897
- ? null
1898
- : {
1899
- ...carry.mode,
1900
- set: (m) => {
1901
- const approval = m === "manual" ? "manual" : "auto";
1902
- setChatPrefs({ approvalMode: approval });
1903
- carry.mode.set(approval);
1904
- },
1905
- },
1906
- // The model, only where the person turned the model selector on; the effort, always.
1907
- // The picker lists what the person has turned on: third-party models (paid from the balance) unless they turned them off.
1908
- mind: anonymous ? null : { ...mind, models: filteredListed },
1909
- effort: {
1910
- value: chatPrefs.effort || "auto",
1911
- set: (eff) => {
1912
- setChatPrefs({ effort: eff });
1913
- const next = shared(eff);
1914
- if (next)
1915
- mind.pace(next);
1916
- },
1917
- items: EFFORTS,
1918
- },
1919
- // Chat keeps to the effort alone until the person asks for more: the family chips, the mode, the model.
1934
+ // Inline controls live inside the composer's bottom strip (`children` above), so the outer foot stays empty.
1935
+ mode: null,
1936
+ mind: null,
1937
+ effort: undefined,
1920
1938
  chips: anonymous ? undefined : families,
1921
1939
  defaults: { chips: false, mode: false, model: false },
1922
- status: anonymous ? null : _jsx(UsageControl, { read: planUsage, context: { model, window: rowOf(model)?.context_window, messages: chat.messages, draft, tools: !anonymous && carry.gear.gear.research && house(rowOf(model)?.family) ? WEB : undefined } }),
1940
+ status: null,
1923
1941
  limits,
1924
1942
  onUpgrade: (id) => setAsk({ model: nameOf(id, listed) }),
1925
1943
  voice,
@@ -1971,7 +1989,31 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1971
1989
  }, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
1972
1990
  if (!open)
1973
1991
  setPlan(null);
1974
- }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, _jsxs(XStack, { "data-slot": "conversation-head", group: true,
1992
+ }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, inTopChrome && titlebarSlot
1993
+ ? createPortal(_jsxs(XStack, { "data-slot": "chat-titlebar-portal", flex: 1, minW: 0, items: "center", justify: "space-between", gap: 8, children: [_jsx(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, "data-tauri-drag-region": "false", children: editingTitle && shownTitle ? (_jsx(Input, { "data-slot": "conversation-title-input", "aria-label": t("Chat title"), value: titleDraft, autoFocus: true, maxLength: 200, size: "sm", minW: 160, maxW: 360, onChangeText: setTitleDraft, onBlur: commitTitle, onKeyDown: (e) => {
1994
+ e.stopPropagation?.();
1995
+ if (e.key === "Enter") {
1996
+ e.preventDefault?.();
1997
+ commitTitle();
1998
+ }
1999
+ else if (e.key === "Escape") {
2000
+ e.preventDefault?.();
2001
+ setEditingTitle(false);
2002
+ }
2003
+ } })) : shownTitle ? (_jsx(XStack, { render: "button", "data-slot": "conversation-title", "aria-label": shownTitle, items: "center", gap: "$1.5", px: "$1.5", py: "$0.5", rounded: "$2", minW: 0, shrink: 1, cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => {
2004
+ setTitleDraft(shownTitle);
2005
+ setEditingTitle(true);
2006
+ }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: shownTitle }) })) : null }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 2, shrink: 0, children: [anonymous ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 9999, px: "$3", "data-slot": "header-login", onPress: () => {
2007
+ if (typeof window !== "undefined")
2008
+ window.location.assign("/login?next=%2Fchat");
2009
+ }, children: t("Log in") }), _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
2010
+ if (typeof window !== "undefined")
2011
+ window.location.assign("/signup?next=%2Fchat");
2012
+ }, children: t("Sign up for free") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: currentThread }) }) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 15, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }), _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }), _jsx(XStack, { render: "button", "data-slot": "titlebar-new-chat", "aria-label": t("New chat"), ...{ title: t("New chat") }, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", opacity: 0.78, hoverStyle: { bg: "$hover", opacity: 1 }, onPress: () => {
2013
+ emptyOpen();
2014
+ go("/chat");
2015
+ }, children: _jsx(SquarePlus, { size: 15, strokeWidth: 1.75, "aria-hidden": true }) })] })] }), titlebarSlot)
2016
+ : null, inTopChrome && !cast.length ? null : (_jsxs(XStack, { "data-slot": "conversation-head", group: true,
1975
2017
  // On the rail's line from a tablet up; a phone's own bar is BAND.
1976
2018
  height: BAND, $md: { height: inPane(HEAD) }, $touchable: { height: inPane(TOUCH_HEAD) }, display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", items: "center", gap: "$3", paddingInlineStart: INSET - 8,
1977
2019
  // The last mark's centre INSET from the pane's end edge, as the rail's first is from the
@@ -1998,7 +2040,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1998
2040
  }, children: t("Sign up for free") }) }), _jsx(XStack, { display: "flex", $sm: { display: "none" }, children: _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup-compact", onPress: () => {
1999
2041
  if (typeof window !== "undefined")
2000
2042
  window.location.assign("/signup?next=%2Fchat");
2001
- }, children: t("Sign up") }) })] })) : free && (sidebarClosed || !media.md) ? (_jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t("Upgrade plan"), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t("Upgrade plan") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, {}) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) })] })] }), wide && aside !== null ? (_jsx(Side, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null, _jsx(XStack, { flex: 1, minH: 0, minW: 0, children: _jsx(YStack, { "data-slot": "talk", flex: 1, minH: 0, minW: 0, children: _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
2043
+ }, children: t("Sign up") }) })] })) : free && (sidebarClosed || !media.md) ? (_jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t("Upgrade plan"), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t("Upgrade plan") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, {}) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), inTopChrome ? null : (_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) }))] })] })), !panel && !anonymous ? (_jsx(Box, { "data-slot": "context-card-dock", display: "none", $xl: { display: "flex" }, position: "absolute", t: 12, r: 16, z: 4, children: _jsx(ContextCard, { at: at, sections: sections, onCreate: create, onOpenPanel: () => setPanel(true) }) })) : null, wide && aside !== null ? (_jsx(Side, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null, _jsx(XStack, { flex: 1, minH: 0, minW: 0, children: _jsx(YStack, { "data-slot": "talk", flex: 1, minH: 0, minW: 0, children: _jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
2002
2044
  // WHILE NOTHING HAS BEEN SAID, from a tablet up, the opening and the
2003
2045
  // composer are one pair centred in the pane (`center`: rows `1fr auto auto
2004
2046
  // 1fr`), so the heading reads close above the field and nothing stands at
@@ -2062,7 +2104,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
2062
2104
  : [];
2063
2105
  return (_jsxs(YStack, { gap: "$3", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: [parts.map((part, i) => (_jsxs(YStack, { gap: "$1", children: [part.who ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Face, { src: faces[part.who]?.avatar, emoji: faces[part.who]?.emoji, name: part.who, size: 20 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: part.who })] })) : null, _jsx(Prose, { text: part.text }), part.text ? (_jsx(Reply, { text: part.text, title: shownTitle, listen: listen(part.who ?? withWhom ?? undefined), onOpen: opener(part.text), onRedo: (act) => redoTurn(turn.id, act), onBranch: () => branchTurn(turn.id) })) : null] }, i))), silent.length ? (_jsx(Text, { fontSize: "$2", color: "$soft", children: t("No answer from {names} in this reply.", { names: join(silent, t) }) })) : null, byline(turn.id)] }));
2064
2106
  }
2065
- return (_jsxs(YStack, { gap: "$1", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: [_jsx(Prose, { text: said }), turn.role === "assistant" && said ? (_jsx(Reply, { text: said, title: shownTitle, listen: listen(withWhom ?? undefined), onOpen: opener(said), onRedo: (act) => redoTurn(turn.id, act), onBranch: () => branchTurn(turn.id) })) : null, turn.role === "assistant" && said ? byline(turn.id) : null] }));
2107
+ const writingBody = turn.role === "assistant" && said ? extractWritingTurn(said) : null;
2108
+ return (_jsxs(YStack, { gap: "$1.5", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: [writingBody ? (_jsx(WritingCard, { text: writingBody, label: t("Writing"), copyLabel: t("Copy"), copiedLabel: t("Copied") })) : (_jsx(Prose, { text: said })), turn.role === "assistant" && said ? (_jsx(Reply, { text: writingBody ?? said, title: shownTitle, listen: listen(withWhom ?? undefined), onOpen: opener(said), onRedo: (act) => redoTurn(turn.id, act), onBranch: () => branchTurn(turn.id) })) : null, turn.role === "assistant" && said ? byline(turn.id) : null] }));
2066
2109
  },
2067
2110
  // The page's ONE heading, and it belongs to the empty transcript rather
2068
2111
  // than to a signed-out branch — the branch is gone, and the heading went
@@ -2072,7 +2115,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
2072
2115
  empty: heading === null ? undefined : (_jsxs(YStack, { "data-slot": "opening", items: "center", justify: "flex-end", width: "100%", height: "100%", pt: "$6", pb: "$2", children: [cast.length > 1 ? (_jsx(XStack, { items: "center", justify: "center", mb: "$4", children: cast.map((name, i) => (_jsx(Box, { marginInlineStart: i ? -16 : 0, rounded: 40, borderWidth: 2, borderColor: "$background", z: cast.length - i, children: _jsx(Face, { src: faces[name]?.avatar, emoji: faces[name]?.emoji, name: name, size: 72 }) }, name))) })) : portrait ? (_jsx(Box, { width: 160, height: 160, rounded: 24, overflow: "hidden", borderWidth: 2, borderColor: "var(--white-15)", boxShadow: "0 10px 24px color-mix(in srgb, var(--pure-black) 70%, transparent)", mb: "$4", bg: "var(--neutral-900)", children: _jsx(View, { render: _jsx("img", { src: portrait, alt: withWhom }), width: "100%", height: "100%", objectFit: "cover" }) })) : null, cast.length === 1 && !portrait ? (_jsx(Box, { mb: "$3", children: _jsx(Face, { emoji: mate?.emoji ?? persona?.emoji, name: withWhom, size: 72 }) })) : null, _jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "700", color: "$ink", text: "center", mb: "$1", children: join(cast, t) || heading || (firstName ? t("What’s up, {name}?", { name: firstName }) : t("What’s up?")) }), cast.length === 1 && (mate?.description ?? persona?.description) ? (_jsx(Text, { fontSize: "$3", color: "$soft", text: "center", maxW: 500, mb: "$4", lineHeight: "$4", children: mate?.description ?? persona?.description })) : null] })),
2073
2116
  // The transcript reads at the same measure. `Thread` defaults to 768
2074
2117
  // itself; handing it the column here is what lets Width reach it.
2075
- column: { maxW: MEASURE }, composer: composer }) }) }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Dialog, { open: anonPluginsOpen, onOpenChange: setAnonPluginsOpen, children: _jsxs(DialogContent, { maxW: 480, width: "100%", gap: "$3", "data-slot": "anon-plugins-dialog", children: [_jsx(DialogTitle, { children: t("Plugins & Skills") }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t("Enable plugins and skills for this conversation, or type / and @ in the composer.") }), _jsxs(YStack, { maxH: 320, overflow: "scroll", gap: "$1.5", children: [carry.plugins.rows.map((p) => (_jsxs(XStack, { render: "button", onPress: () => carry.plugins.pick(p.id), items: "center", justify: "space-between", p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: p.on ? "$ink" : "$borderColor", bg: p.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, flex: 1, children: [p.icon, _jsxs(YStack, { minW: 0, flex: 1, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: p.label }), p.note ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: p.note })) : null] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: p.on ? "$ink" : "$soft", children: p.on ? t("On") : t("Plugin") })] }, `plugin:${p.id}`))), carry.skills.rows.slice(0, 24).map((s) => (_jsxs(XStack, { render: "button", onPress: () => carry.skills.pick(s.id), items: "center", justify: "space-between", p: "$2", rounded: "$3", borderWidth: 1, borderColor: s.on ? "$ink" : "$borderColor", bg: s.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [s.icon, _jsxs(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: ["/", s.label] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: s.on ? "$ink" : "$soft", children: s.on ? t("On") : t("Skill") })] }, `skill:${s.id}`)))] })] }) }), _jsx(Dialog, { open: anonGateOpen, onOpenChange: setAnonGateOpen, children: _jsxs(DialogContent, { maxW: 480, rounded: "$6", gap: "$3.5", children: [_jsx(DialogTitle, { children: t("Sign in to continue chatting") }), _jsx(Text, { fontSize: "$3", color: "$soft", lineHeight: "$4", children: t("Sign in or create a free Hanzo account to save this conversation and continue chatting.") }), _jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsx(Button, { variant: "primary", size: "lg", width: "100%", onPress: () => window.location.assign("/signup?next=%2Fchat"), children: t("Create Free Account") }), _jsx(Button, { variant: "outline", size: "default", width: "100%", onPress: () => enter(LOGIN), children: t("Sign In") })] }), _jsxs(YStack, { gap: "$2", pt: "$2.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$1", fontFamily: "$mono", color: "$soft", children: t("NEED MORE CAPACITY? UPGRADE ANYTIME") }), _jsx(XStack, { gap: "$2", flexWrap: "wrap", children: [
2118
+ column: { maxW: "var(--chat-column-measure, 640px)" }, composer: composer }) }) }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Dialog, { open: anonPluginsOpen, onOpenChange: setAnonPluginsOpen, children: _jsxs(DialogContent, { maxW: 480, width: "100%", gap: "$3", "data-slot": "anon-plugins-dialog", children: [_jsx(DialogTitle, { children: t("Plugins & Skills") }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t("Enable plugins and skills for this conversation, or type / and @ in the composer.") }), _jsxs(YStack, { maxH: 320, overflow: "scroll", gap: "$1.5", children: [carry.plugins.rows.map((p) => (_jsxs(XStack, { render: "button", onPress: () => carry.plugins.pick(p.id), items: "center", justify: "space-between", p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: p.on ? "$ink" : "$borderColor", bg: p.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, flex: 1, children: [p.icon, _jsxs(YStack, { minW: 0, flex: 1, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: p.label }), p.note ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: p.note })) : null] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: p.on ? "$ink" : "$soft", children: p.on ? t("On") : t("Plugin") })] }, `plugin:${p.id}`))), carry.skills.rows.slice(0, 24).map((s) => (_jsxs(XStack, { render: "button", onPress: () => carry.skills.pick(s.id), items: "center", justify: "space-between", p: "$2", rounded: "$3", borderWidth: 1, borderColor: s.on ? "$ink" : "$borderColor", bg: s.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [s.icon, _jsxs(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: ["/", s.label] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: s.on ? "$ink" : "$soft", children: s.on ? t("On") : t("Skill") })] }, `skill:${s.id}`)))] })] }) }), _jsx(Dialog, { open: anonGateOpen, onOpenChange: setAnonGateOpen, children: _jsxs(DialogContent, { maxW: 480, rounded: "$6", gap: "$3.5", children: [_jsx(DialogTitle, { children: t("Sign in to continue chatting") }), _jsx(Text, { fontSize: "$3", color: "$soft", lineHeight: "$4", children: t("Sign in or create a free Hanzo account to save this conversation and continue chatting.") }), _jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsx(Button, { variant: "primary", size: "lg", width: "100%", onPress: () => window.location.assign("/signup?next=%2Fchat"), children: t("Create Free Account") }), _jsx(Button, { variant: "outline", size: "default", width: "100%", onPress: () => enter(LOGIN), children: t("Sign In") })] }), _jsxs(YStack, { gap: "$2", pt: "$2.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$1", fontFamily: "$mono", color: "$soft", children: t("NEED MORE CAPACITY? UPGRADE ANYTIME") }), _jsx(XStack, { gap: "$2", flexWrap: "wrap", children: [
2076
2119
  ["Go", "Pro"],
2077
2120
  ["Dev", "Max"],
2078
2121
  ].flat().map((label) => (_jsx(XStack, { render: "button", onPress: () => {
@@ -0,0 +1,39 @@
1
+ import type { Thread } from '@hanzo/ai';
2
+ import { type Recent } from './recent.js';
3
+ export interface ProjectFolder {
4
+ id: string;
5
+ name: string;
6
+ }
7
+ export interface StoredChatProjects {
8
+ folders: ProjectFolder[];
9
+ open: Record<string, boolean>;
10
+ assigned: Record<string, string>;
11
+ }
12
+ export declare const EMPTY_CHAT_PROJECTS: StoredChatProjects;
13
+ export declare function normalizeProjectSlug(raw: string): string;
14
+ export declare function readStoredChatProjects(raw: unknown): StoredChatProjects;
15
+ export declare function mergeProjectFolders(remote: ProjectFolder[], local: ProjectFolder[]): ProjectFolder[];
16
+ export declare function groupThreadsByProject(rows: Recent[], folders: ProjectFolder[], assigned: Record<string, string>): {
17
+ byFolder: Map<string, Recent[]>;
18
+ filedIds: Set<string>;
19
+ };
20
+ export declare function hasUnreadUpdate(rowId: string, updatedAt: string | number | undefined, activeId: string | null, seenAt: Record<string, number>): boolean;
21
+ export declare function useChatProjects(rows: Recent[]): {
22
+ folders: ProjectFolder[];
23
+ openMap: Record<string, boolean>;
24
+ byFolder: Map<string, Recent[]>;
25
+ filedIds: Set<string>;
26
+ toggleFolder: (id: string) => void;
27
+ createFolder: (name: string) => void;
28
+ };
29
+ export declare function ProjectsTree({ folders, openMap, byFolder, threads, activeId, onToggle, onCreate, onOpen, onNew, }: {
30
+ folders: ProjectFolder[];
31
+ openMap: Record<string, boolean>;
32
+ byFolder: Map<string, Recent[]>;
33
+ threads: Map<string, Thread>;
34
+ activeId: string | null;
35
+ onToggle: (id: string) => void;
36
+ onCreate: (name: string) => void;
37
+ onOpen: (row: Recent) => void;
38
+ onNew: () => void;
39
+ }): import("react").JSX.Element;
@@ -0,0 +1,179 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useMemo, useState } from 'react';
4
+ import { useI18n } from '@hanzo/i18n/react';
5
+ import { SizableText, XStack, YStack } from '@hanzo/gui';
6
+ import { Folder, FolderOpen, Plus } from 'lucide-react';
7
+ import { Button, Dialog, DialogContent, DialogTitle, Input } from '@hanzo/ui';
8
+ import { SidebarItem } from '@hanzo/ui/chat';
9
+ import { useKept } from './kept.js';
10
+ import { api } from './lib/api.js';
11
+ import { list } from './lib/list.js';
12
+ import { scope } from './lib/session.js';
13
+ import { UNTITLED } from './recent.js';
14
+ import { ConversationMenu, ThreadRow } from './thread.js';
15
+ export const EMPTY_CHAT_PROJECTS = {
16
+ folders: [],
17
+ open: {},
18
+ assigned: {},
19
+ };
20
+ export function normalizeProjectSlug(raw) {
21
+ return raw
22
+ .trim()
23
+ .toLowerCase()
24
+ .replace(/^[^/]+\//, '')
25
+ .replace(/[^a-z0-9._-]+/g, '-')
26
+ .replace(/^-+|-+$/g, '');
27
+ }
28
+ export function readStoredChatProjects(raw) {
29
+ if (!raw || typeof raw !== 'object')
30
+ return EMPTY_CHAT_PROJECTS;
31
+ const obj = raw;
32
+ const folders = Array.isArray(obj.folders)
33
+ ? obj.folders.filter((f) => Boolean(f && typeof f === 'object' && typeof f.id === 'string' && f.id && typeof f.name === 'string' && f.name.trim()))
34
+ : [];
35
+ const open = obj.open && typeof obj.open === 'object' ? obj.open : {};
36
+ const assigned = obj.assigned && typeof obj.assigned === 'object' ? obj.assigned : {};
37
+ return { folders, open, assigned };
38
+ }
39
+ export function mergeProjectFolders(remote, local) {
40
+ const seen = new Set();
41
+ const out = [];
42
+ for (const item of [...local, ...remote]) {
43
+ const key = normalizeProjectSlug(item.id || item.name);
44
+ if (!key || seen.has(key))
45
+ continue;
46
+ seen.add(key);
47
+ out.push({ id: key, name: item.name.trim() });
48
+ }
49
+ return out;
50
+ }
51
+ export function groupThreadsByProject(rows, folders, assigned) {
52
+ const byFolder = new Map();
53
+ const byKey = new Map();
54
+ for (const folder of folders) {
55
+ byFolder.set(folder.id, []);
56
+ byKey.set(normalizeProjectSlug(folder.id), folder.id);
57
+ byKey.set(normalizeProjectSlug(folder.name), folder.id);
58
+ }
59
+ const filedIds = new Set();
60
+ for (const row of rows) {
61
+ const explicit = assigned[row.id] ? normalizeProjectSlug(assigned[row.id]) : '';
62
+ const implicit = row.project ? normalizeProjectSlug(row.project) : '';
63
+ const target = (explicit && byKey.get(explicit)) || (implicit && byKey.get(implicit)) || null;
64
+ if (!target)
65
+ continue;
66
+ byFolder.get(target)?.push(row);
67
+ filedIds.add(row.id);
68
+ }
69
+ return { byFolder, filedIds };
70
+ }
71
+ export function hasUnreadUpdate(rowId, updatedAt, activeId, seenAt) {
72
+ if (!updatedAt || rowId === activeId)
73
+ return false;
74
+ const stamp = typeof updatedAt === 'number' ? updatedAt : Date.parse(updatedAt);
75
+ if (!Number.isFinite(stamp) || stamp <= 0)
76
+ return false;
77
+ const seen = seenAt[rowId];
78
+ return typeof seen === 'number' && stamp > seen;
79
+ }
80
+ function useRemoteProjectFolders() {
81
+ const [remote, setRemote] = useState([]);
82
+ useEffect(() => {
83
+ const stop = new AbortController();
84
+ const headers = scope();
85
+ Promise.all([
86
+ fetch(`${api()}/v1/git/repos`, { headers, signal: stop.signal })
87
+ .then((r) => (r.ok ? r.json() : null))
88
+ .catch(() => null),
89
+ fetch(`${api()}/v1/project`, { headers, signal: stop.signal })
90
+ .then((r) => (r.ok ? r.json() : null))
91
+ .catch(() => null),
92
+ ]).then(([reposBody, projectsBody]) => {
93
+ if (stop.signal.aborted)
94
+ return;
95
+ const repoRows = list(Array.isArray(reposBody) ? reposBody : reposBody?.data ?? reposBody?.repos);
96
+ const projRows = list(Array.isArray(projectsBody) ? projectsBody : projectsBody?.data ?? projectsBody?.projects);
97
+ const collected = [];
98
+ for (const r of [...repoRows, ...projRows]) {
99
+ const name = (r?.name || r?.slug || '').trim();
100
+ const id = normalizeProjectSlug(r?.slug || name);
101
+ if (id && name)
102
+ collected.push({ id, name });
103
+ }
104
+ setRemote(collected);
105
+ });
106
+ return () => stop.abort();
107
+ }, []);
108
+ return remote;
109
+ }
110
+ export function useChatProjects(rows) {
111
+ const [raw, save] = useKept('hanzo.chat.projects.v1', EMPTY_CHAT_PROJECTS);
112
+ const stored = useMemo(() => readStoredChatProjects(raw), [raw]);
113
+ const remote = useRemoteProjectFolders();
114
+ const folders = useMemo(() => mergeProjectFolders(remote, stored.folders), [remote, stored.folders]);
115
+ const grouped = useMemo(() => groupThreadsByProject(rows, folders, stored.assigned), [rows, folders, stored.assigned]);
116
+ const toggleFolder = (id) => {
117
+ save({
118
+ ...stored,
119
+ open: { ...stored.open, [id]: !stored.open[id] },
120
+ });
121
+ };
122
+ const createFolder = (name) => {
123
+ const trimmed = name.trim();
124
+ const id = normalizeProjectSlug(trimmed);
125
+ if (!id || !trimmed)
126
+ return;
127
+ const exists = stored.folders.some((f) => normalizeProjectSlug(f.id) === id);
128
+ save({
129
+ ...stored,
130
+ folders: exists ? stored.folders : [...stored.folders, { id, name: trimmed }],
131
+ open: { ...stored.open, [id]: true },
132
+ });
133
+ };
134
+ return {
135
+ folders,
136
+ openMap: stored.open,
137
+ byFolder: grouped.byFolder,
138
+ filedIds: grouped.filedIds,
139
+ toggleFolder,
140
+ createFolder,
141
+ };
142
+ }
143
+ export function ProjectsTree({ folders, openMap, byFolder, threads, activeId, onToggle, onCreate, onOpen, onNew, }) {
144
+ const { t } = useI18n();
145
+ const [creating, setCreating] = useState(false);
146
+ const [draft, setDraft] = useState('');
147
+ const submit = () => {
148
+ const next = draft.trim();
149
+ if (!next)
150
+ return;
151
+ onCreate(next);
152
+ setDraft('');
153
+ setCreating(false);
154
+ };
155
+ return (_jsxs(YStack, { "data-slot": "chat-projects", gap: 1, pt: "$2", children: [_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 26, paddingInlineStart: "$2", paddingInlineEnd: "$1", shrink: 0, children: [_jsx(SizableText, { fontSize: 11.5, lineHeight: 16, fontWeight: "500", color: "var(--shell-section-fg, var(--muted-foreground))", children: t('Projects') }), _jsx(XStack, { render: "button", "data-slot": "chat-project-add", "aria-label": t('New project'), ...{ title: t('New project') }, width: 22, height: 22, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: folders.length === 0 ? 0.72 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover', opacity: 1 }, onPress: () => setCreating(true), children: _jsx(Plus, { size: 13, color: "var(--shell-section-fg, var(--muted-foreground))", "aria-hidden": true }) })] }), folders.length > 0 ? (_jsx(ConversationMenu, { threads: threads, active: activeId, onGone: onNew, primary: false, children: _jsx(YStack, { role: "list", "aria-label": t('Projects'), gap: 1, children: folders.map((folder) => {
156
+ const expanded = Boolean(openMap[folder.id]);
157
+ const children = byFolder.get(folder.id) ?? [];
158
+ return (_jsxs(YStack, { role: "listitem", gap: 1, children: [_jsx(SidebarItem, { "data-slot": "project-folder", "data-project-id": folder.id, "aria-expanded": expanded, rounded: 8, minH: 28, py: 0, px: "$2", $touchable: { minH: 40 }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: expanded ? (_jsx(FolderOpen, { size: 15, strokeWidth: 1.75, color: "var(--shell-icon-fg, var(--muted-foreground))", "aria-hidden": true })) : (_jsx(Folder, { size: 15, strokeWidth: 1.75, color: "var(--shell-icon-fg, var(--muted-foreground))", "aria-hidden": true })) }), onPress: () => onToggle(folder.id), onKeyDown: (e) => {
159
+ if (e.key !== 'Enter' && e.key !== ' ')
160
+ return;
161
+ e.preventDefault?.();
162
+ onToggle(folder.id);
163
+ }, children: _jsx(SizableText, { fontSize: 13, lineHeight: 18, color: "var(--shell-row-fg, var(--foreground))", numberOfLines: 1, display: "block", children: folder.name }) }), expanded ? (children.length > 0 ? (_jsx(YStack, { role: "list", "aria-label": folder.name, gap: 1, children: children.map((child) => {
164
+ const threadObj = threads.get(child.id);
165
+ const isOpen = child.id === activeId;
166
+ const labelText = child.title === UNTITLED ? t(UNTITLED) : child.title;
167
+ const item = (_jsx(SidebarItem, { "data-slot": "project-thread", active: isOpen, rounded: 8, minH: 27, py: 0, paddingInlineStart: 28, paddingInlineEnd: "$6", $touchable: { minH: 40, paddingInlineEnd: 48 }, onPress: () => onOpen(child), onKeyDown: (e) => {
168
+ if (e.key !== 'Enter' && e.key !== ' ')
169
+ return;
170
+ e.preventDefault?.();
171
+ onOpen(child);
172
+ }, children: _jsx(SizableText, { fontSize: 13, lineHeight: 18, color: isOpen ? 'var(--shell-row-active-fg, var(--text-primary))' : 'var(--shell-subrow-fg, var(--text-secondary))', numberOfLines: 1, display: "block", children: labelText }) }));
173
+ return threadObj ? (_jsx(ThreadRow, { t: threadObj, active: isOpen, children: item }, child.id)) : (_jsx(YStack, { role: "listitem", children: item }, child.id));
174
+ }) })) : (_jsx(XStack, { height: 25, items: "center", paddingInlineStart: 28, paddingInlineEnd: "$2", "data-slot": "project-empty", children: _jsx(SizableText, { fontSize: 12.5, lineHeight: 17, color: "var(--shell-muted-fg, var(--text-tertiary))", numberOfLines: 1, children: t('No chats') }) }))) : null] }, folder.id));
175
+ }) }) })) : null, _jsx(Dialog, { open: creating, onOpenChange: setCreating, children: _jsxs(DialogContent, { maxW: 400, rounded: "$6", gap: "$3", children: [_jsx(DialogTitle, { children: t('New project') }), _jsx(Input, { autoFocus: true, value: draft, onChangeText: setDraft, placeholder: t('Project name'), "aria-label": t('Project name'), maxLength: 64, onKeyDown: (e) => {
176
+ if (e.key === 'Enter' && !e.nativeEvent?.isComposing && e.keyCode !== 229)
177
+ submit();
178
+ } }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => setCreating(false), children: t('Cancel') }), _jsx(Button, { size: "sm", rounded: 999, disabled: !draft.trim(), onPress: submit, children: t('Create') })] })] }) })] }));
179
+ }
package/dist/Rail.d.ts CHANGED
@@ -3,8 +3,8 @@ import { type Host } from '@hanzo/build';
3
3
  import { type Place } from './lib/host.js';
4
4
  /** The rail's width, px. */
5
5
  export declare const RAIL: number;
6
- /** A mark, px: a 36px square on a 44px pitch. */
7
- export declare const MARK = 36;
6
+ /** A mark, px: a 32px rounded square on a 44px rail. */
7
+ export declare const MARK = 32;
8
8
  /** The places the rail holds beside the products, by the builder address each opens. */
9
9
  export declare const RAISED: {
10
10
  readonly library: '-/artifacts';
package/dist/Rail.js CHANGED
@@ -51,8 +51,8 @@ import { HEAD, INSET, TOUCH_HEAD } from './ground.js';
51
51
  import { app, hosted, WORKSPACE } from './lib/host.js';
52
52
  /** The rail's width, px. */
53
53
  export const RAIL = 2 * INSET;
54
- /** A mark, px: a 36px square on a 44px pitch. */
55
- export const MARK = 36;
54
+ /** A mark, px: a 32px rounded square on a 44px rail. */
55
+ export const MARK = 32;
56
56
  /** A mark on a touch screen, px: a thumb's 44. */
57
57
  const TOUCH = 44;
58
58
  /** The places the rail holds beside the products, by the builder address each opens. */
@@ -72,7 +72,7 @@ export function raised(at) {
72
72
  }
73
73
  /** One mark: an icon button named for where it goes (`label`, already in the reader's language), its name its tooltip, lit where the reader is. */
74
74
  export function Mark({ label, on = false, onPress, children, ...rest }) {
75
- return (_jsx(XStack, { render: "button", "aria-label": label, ...{ title: label }, "aria-current": on ? 'page' : undefined, onPress: onPress, width: MARK, height: MARK, rounded: "$4", items: "center", justify: "center", shrink: 0, cursor: "pointer", opacity: on ? 1 : 0.62, bg: on ? '$edge' : 'transparent', hoverStyle: { bg: on ? '$edge' : '$hover', opacity: 1 }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' },
75
+ return (_jsx(XStack, { render: "button", "aria-label": label, ...{ title: label }, "aria-current": on ? 'page' : undefined, onPress: onPress, width: MARK, height: MARK, rounded: 8, items: "center", justify: "center", shrink: 0, cursor: "pointer", opacity: on ? 1 : 0.68, bg: on ? 'var(--shell-rail-active, var(--secondary-hover))' : 'transparent', hoverStyle: { bg: on ? 'var(--shell-rail-active, var(--secondary-hover))' : '$hover', opacity: 1 }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' },
76
76
  // A thumb's 44px on a touch screen.
77
77
  $touchable: { width: TOUCH, height: TOUCH }, ...rest, children: children }));
78
78
  }
@@ -126,12 +126,12 @@ export function Rail({ host, mode, at, open, toggle, inside = null, rows = false
126
126
  const betasDialog = _jsx(BetasDialog, { open: betas, onOpenChange: setBetas, go: reach });
127
127
  if (rows)
128
128
  return (_jsxs(YStack, { "data-slot": "places", render: "nav", "aria-label": t('Products'), pt: "$2", shrink: 0, children: [_jsxs(YStack, { role: "list", gap: 2, children: [anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "place-design", icon: _jsx(MARKS.design.icon, { size: 16, "aria-hidden": true }) }) })), !anon && opened('studio') ? (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "place-studio", icon: _jsx(MARKS.studio.icon, { size: 16, "aria-hidden": true }) }) })) : null, anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "place-tabs", icon: _jsx(MARKS.tabs.icon, { size: 16, "aria-hidden": true }) }) })), apps.map((a) => (_jsx(YStack, { role: "listitem", children: _jsx(Row, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `place-app-${a.id}`, icon: _jsx(a.icon, { size: 16, "aria-hidden": true }) }) }, a.id))), anon ? null : (_jsx(YStack, { role: "listitem", children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 220, trigger: _jsx(Row, { label: t('More'), "data-slot": "place-more", "aria-haspopup": "menu", icon: _jsx(Ellipsis, { size: 16, "aria-hidden": true }) }), items: rest }) }))] }), betasDialog] }));
129
- return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1,
129
+ return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t('Products'), width: RAIL, flex: 1, bg: "var(--shell-rail-bg, var(--secondary))", borderRightWidth: 1, borderColor: "var(--shell-rail-border, var(--border))",
130
130
  // As tall as the window and no taller: its marks scroll inside it (below), never the page.
131
131
  minH: 0,
132
132
  // The first mark stands at the pane's top edge, one head row high (HEAD), and the last at its foot by the
133
133
  // same inset, so the account mirrors the sidebar's toggle across the rail.
134
- pt: (HEAD - MARK) / 2, pb: (HEAD - MARK) / 2, gap: 4, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2, pb: (TOUCH_HEAD - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [_jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MARKS.chat.icon, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(MARKS.dev.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "rail-design", children: _jsx(MARKS.design.icon, { size: 18, "aria-hidden": true }) })), !anon && opened('studio') ? (_jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(MARKS.studio.icon, { size: 18, "aria-hidden": true }) })) : null, anon ? null : (_jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(MARKS.tabs.icon, { size: 18, "aria-hidden": true }) })), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(MARKS.library.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(MARKS.scheduled.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(MARKS.customize.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) })), betasDialog, !anon && rest.length ? (_jsx(DropdownMenu
134
+ pt: (HEAD - MARK) / 2 + 2, pb: 10, gap: 3, shrink: 0, items: "center", $touchable: { pt: (TOUCH_HEAD - TOUCH) / 2, pb: (TOUCH_HEAD - TOUCH) / 2 }, children: [toggle ? (_jsx(YStack, { children: _jsx(Toggle, { open: open, onPress: toggle }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", items: "center", gap: 4, width: "100%", "$platform-web": { scrollbarWidth: 'none' }, children: [_jsx(Mark, { label: t('Chat'), on: mode === 'chat', onPress: onChat, "data-slot": "rail-chat", children: _jsx(MARKS.chat.icon, { size: 18, "aria-hidden": true }) }), _jsx(Mark, { label: "Dev", on: mode === 'dev' && !here, onPress: onDev, "data-slot": "rail-dev", children: _jsx(MARKS.dev.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: "Design", on: mode === 'design', onPress: onDesign, "data-slot": "rail-design", children: _jsx(MARKS.design.icon, { size: 18, "aria-hidden": true }) })), !anon && opened('studio') ? (_jsx(Mark, { label: "Studio", on: mode === 'studio', onPress: onStudio, "data-slot": "rail-studio", children: _jsx(MARKS.studio.icon, { size: 18, "aria-hidden": true }) })) : null, anon ? null : (_jsx(Mark, { label: "Tabs", on: mode === 'tabs', onPress: onTabs, "data-slot": "rail-tabs", children: _jsx(MARKS.tabs.icon, { size: 18, "aria-hidden": true }) })), apps.map((a) => (_jsx(Mark, { label: a.name, on: inside === a.id, onPress: () => go(hosted(a.id)), "data-slot": `rail-app-${a.id}`, children: _jsx(a.icon, { size: 18, "aria-hidden": true }) }, a.id))), _jsx(Mark, { label: t('Library'), on: here === 'library', onPress: to(RAISED.library), "data-slot": "rail-library", children: _jsx(MARKS.library.icon, { size: 18, "aria-hidden": true }) }), anon ? null : (_jsx(Mark, { label: t('Scheduled tasks'), on: here === 'scheduled', onPress: to(RAISED.scheduled), "data-slot": "rail-scheduled", children: _jsx(MARKS.scheduled.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Customize'), on: here === 'customize', onPress: to(RAISED.customize), "data-slot": "rail-customize", children: _jsx(MARKS.customize.icon, { size: 18, "aria-hidden": true }) })), anon ? null : (_jsx(Mark, { label: t('Betas'), on: mode === 'beta', onPress: () => go('/beta'), "data-slot": "rail-betas", children: _jsx(FlaskConical, { size: 18, "aria-hidden": true }) })), betasDialog, !anon && rest.length ? (_jsx(DropdownMenu
135
135
  // Toward the content: right of the rail, left of it right to left.
136
136
  , {
137
137
  // Toward the content: right of the rail, left of it right to left.
package/dist/Recents.js CHANGED
@@ -18,6 +18,7 @@ import { useKept } from './kept.js';
18
18
  import { app } from './lib/host.js';
19
19
  import { site } from './where.js';
20
20
  import { arrange, chats, MENUS, PINNED, PLAIN, runs, SINCE, UNFILED, UNTITLED, UNTITLED_RUN, viewOf } from './recent.js';
21
+ import { hasUnreadUpdate, ProjectsTree, useChatProjects } from './ProjectsTree.js';
21
22
  import { ConversationMenu, ThreadRow, useThreadList } from './thread.js';
22
23
  /** The menu's items: each section a heading and its options (recent.ts's phrases, drawn through `t`), the one in force checked. */
23
24
  function items(mode, view, set, t) {
@@ -60,7 +61,48 @@ function Chats({ thread, view, keep, onOpen, onNew, }) {
60
61
  const store = useThreadList(view.status === 'archived', thread);
61
62
  const rows = useMemo(() => chats(store.threads), [store.threads]);
62
63
  const byId = useMemo(() => new Map(store.threads.map((t) => [t.id, t])), [store.threads]);
63
- return (_jsx(List, { mode: "chat", rows: rows, view: view, keep: keep, open: (r) => r.id === thread, reading: store.loading && !store.threads.length, error: store.error, onOpen: onOpen, threads: byId, held: thread, onNew: onNew }));
64
+ const projects = useChatProjects(rows);
65
+ const [seenAt, setSeenAt] = useKept('hanzo.chat.seen.v1', {});
66
+ const seenRef = useRef(seenAt);
67
+ seenRef.current = seenAt;
68
+ useEffect(() => {
69
+ if (!store.threads.length)
70
+ return;
71
+ const now = Date.now();
72
+ const current = seenRef.current ?? {};
73
+ let changed = false;
74
+ const next = { ...current };
75
+ for (const item of store.threads) {
76
+ if (item.id === thread) {
77
+ const ts = item.updatedAt ? Date.parse(item.updatedAt) : now;
78
+ const target = Number.isFinite(ts) ? Math.max(now, ts) : now;
79
+ if ((next[item.id] ?? 0) < target) {
80
+ next[item.id] = target;
81
+ changed = true;
82
+ }
83
+ }
84
+ else if (next[item.id] === undefined) {
85
+ const ts = item.updatedAt ? Date.parse(item.updatedAt) : now;
86
+ next[item.id] = Number.isFinite(ts) ? ts : now;
87
+ changed = true;
88
+ }
89
+ }
90
+ if (changed) {
91
+ seenRef.current = next;
92
+ setSeenAt(next);
93
+ }
94
+ }, [store.threads, thread, setSeenAt]);
95
+ const unreadIds = useMemo(() => {
96
+ const out = new Set();
97
+ for (const item of store.threads) {
98
+ if (item.unread || hasUnreadUpdate(item.id, item.updatedAt, thread, seenAt ?? {})) {
99
+ out.add(item.id);
100
+ }
101
+ }
102
+ return out;
103
+ }, [store.threads, thread, seenAt]);
104
+ const unfiledRows = useMemo(() => (view.status === 'archived' ? rows : rows.filter((r) => r.pinned || !projects.filedIds.has(r.id))), [rows, projects.filedIds, view.status]);
105
+ return (_jsx(List, { mode: "chat", rows: unfiledRows, view: view, keep: keep, open: (r) => r.id === thread, reading: store.loading && !store.threads.length, error: store.error, onOpen: onOpen, threads: byId, held: thread, onNew: onNew, unreadIds: unreadIds, projectsNode: view.status === 'archived' ? null : (_jsx(ProjectsTree, { folders: projects.folders, openMap: projects.openMap, byFolder: projects.byFolder, threads: byId, activeId: thread, onToggle: projects.toggleFolder, onCreate: projects.createFolder, onOpen: onOpen, onNew: onNew })) }));
64
106
  }
65
107
  /** Dev's Recents: the org's coding runs alone. */
66
108
  function Runs({ host, view, keep, onOpen }) {
@@ -144,7 +186,7 @@ function Runs({ host, view, keep, onOpen }) {
144
186
  }), [host]);
145
187
  return (_jsx(List, { mode: "dev", rows: rows, view: view, keep: keep, open: (row) => row.id === run, reading: store.loading && !store.value.length, error: store.error, onOpen: onOpen, threads: byId, held: run, onNew: () => host.go(''), customActions: devActions, hrefOf: (id) => new URL(site(app(id)), window.location.href).href }));
146
188
  }
147
- function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, held = null, onNew, customActions, hrefOf, }) {
189
+ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, held = null, onNew, customActions, hrefOf, unreadIds, projectsNode, }) {
148
190
  const { t } = useI18n();
149
191
  const label = useId();
150
192
  const [collapsedGroups, setCollapsedGroups] = useState({});
@@ -159,23 +201,24 @@ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, h
159
201
  // shows on hover and focus, a run's state is a dot at its end.
160
202
  const row = (r) => {
161
203
  const one = threads?.get(r.id);
162
- const devAside = r.kind === 'dev' ? (_jsxs(XStack, { items: "center", gap: "$1", children: [r.pr ? _jsx(GitPullRequest, { size: 13, color: "var(--state-success)", "aria-hidden": true }) : null, _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : undefined;
163
- const item = (_jsx(SidebarItem, { "data-kind": r.kind, active: open(r), rounded: "$4", minH: 31, paddingInlineStart: "$2", paddingInlineEnd: one || r.kind === 'dev' ? '$7' : '$2',
204
+ const isUnread = Boolean(r.kind === 'chat' && !open(r) && unreadIds?.has(r.id));
205
+ const rowAside = r.kind === 'dev' ? (_jsxs(XStack, { items: "center", gap: "$1", children: [r.pr ? _jsx(GitPullRequest, { size: 13, color: "var(--state-success)", "aria-hidden": true }) : null, _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : isUnread ? (_jsx(XStack, { "data-slot": "thread-unread-dot", width: 6, height: 6, rounded: 999, bg: "var(--shell-unread-dot, var(--art-tide))", "aria-hidden": true })) : undefined;
206
+ const item = (_jsx(SidebarItem, { "data-kind": r.kind, active: open(r), rounded: 8, minH: 29, paddingInlineStart: "$2", paddingInlineEnd: one || r.kind === 'dev' ? '$6' : '$2',
164
207
  // A thumb's 44 on a touch screen; a conversation's ⋯ is a thumb wide there and always there: the title stops short of it.
165
208
  $touchable: one ? { minH: 44, paddingInlineEnd: 52 } : { minH: 44 }, onKeyDown: (e) => {
166
209
  if (e.key !== 'Enter' && e.key !== ' ')
167
210
  return;
168
211
  e.preventDefault?.();
169
212
  onOpen(r);
170
- }, onPress: () => onOpen(r), children: _jsx(SizableText, { size: "$3", color: open(r) ? '$ink' : '$quiet', numberOfLines: 1, display: "block", children: named(r.title) }) }));
213
+ }, onPress: () => onOpen(r), children: _jsx(SizableText, { fontSize: 13, lineHeight: 18, color: open(r) ? 'var(--shell-row-active-fg, var(--text-primary))' : 'var(--shell-row-fg, var(--foreground))', numberOfLines: 1, display: "block", children: named(r.title) }) }));
171
214
  if (one)
172
- return (_jsx(ThreadRow, { t: one, active: open(r), aside: devAside, children: item }, r.id));
173
- return (_jsxs(YStack, { role: "listitem", position: "relative", children: [item, r.kind === 'dev' ? (_jsx(XStack, { position: "absolute", insetInlineEnd: "$2.5", t: 0, b: 0, items: "center", pointerEvents: "none", children: devAside })) : null] }, r.id));
215
+ return (_jsx(ThreadRow, { t: one, active: open(r), aside: rowAside, children: item }, r.id));
216
+ return (_jsxs(YStack, { role: "listitem", position: "relative", children: [item, rowAside ? (_jsx(XStack, { position: "absolute", insetInlineEnd: "$2.5", t: 0, b: 0, items: "center", pointerEvents: "none", children: rowAside })) : null] }, r.id));
174
217
  };
175
218
  // The view menu stands at the end of the Recents heading: the target's own, quiet until the pointer is near.
176
219
  const menu = (_jsx(DropdownMenu, { minWidth: 200, trigger: _jsx(XStack, { render: "button", "aria-label": t('Recents view'), width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: narrowed ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, bg: narrowed ? '$hover' : 'transparent', children: _jsx(ListFilter, { size: 14, "aria-hidden": true }) }), items: items(mode, view, keep, t) }));
177
- /** A section's heading: the reference's quiet 14px label, the Recents one carrying the count and the menu. */
178
- const heading = (title, id, lead = false) => (_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 31, paddingInlineStart: "$2", paddingInlineEnd: "$1", mt: "$3", shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { id: id, size: "$3", color: "$soft", children: title }), lead && running ? (_jsx(XStack, { "aria-label": t('{n} running', { n: running }), minW: 18, height: 18, px: "$1.5", rounded: 999, items: "center", justify: "center", bg: "$edge", borderWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", "aria-hidden": true, "data-i18n-ltr": true, children: String(running) }) })) : null] }), _jsxs(XStack, { items: "center", gap: 2, children: [lead && rows.length > 0 ? (_jsx(XStack, { render: "button", "aria-label": t('Select multiple'), ...{ title: t('Select multiple') }, width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, onPress: () => {
220
+ /** A section's heading: quiet 11.5px label, the Recents one carrying the count and the menu. */
221
+ const heading = (title, id, lead = false) => (_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 26, paddingInlineStart: "$2", paddingInlineEnd: "$1", mt: "$2.5", shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { id: id, fontSize: 11.5, lineHeight: 16, fontWeight: "500", color: "var(--shell-section-fg, var(--muted-foreground))", children: title }), lead && running ? (_jsx(XStack, { "aria-label": t('{n} running', { n: running }), minW: 18, height: 18, px: "$1.5", rounded: 999, items: "center", justify: "center", bg: "$edge", borderWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", "aria-hidden": true, "data-i18n-ltr": true, children: String(running) }) })) : null] }), _jsxs(XStack, { items: "center", gap: 2, children: [lead && rows.length > 0 ? (_jsx(XStack, { render: "button", "aria-label": t('Select multiple'), ...{ title: t('Select multiple') }, width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, onPress: () => {
179
222
  if (typeof window !== 'undefined')
180
223
  window.dispatchEvent(new CustomEvent('hanzo:recents-select'));
181
224
  }, children: _jsx(CheckSquare, { size: 13, "aria-hidden": true }) })) : null, lead ? menu : null] })] }));
@@ -196,5 +239,5 @@ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, h
196
239
  : pinned
197
240
  ? null
198
241
  : note;
199
- return (_jsx(YStack, { "data-slot": "recents", flex: 1, minH: 0, children: _jsxs(ScrollView, { flex: 1, showsVerticalScrollIndicator: false, ...{ overscrollBehavior: 'contain' }, children: [error ? _jsx(Note, { children: error.message }) : null, _jsxs(YStack, { role: "list", "aria-labelledby": label, gap: 1, children: [pinned ? (_jsxs(YStack, { role: "listitem", gap: 1, children: [heading(t(PINNED)), menus(_jsx(YStack, { role: "list", "aria-label": t(PINNED), gap: 1, children: pinned.rows.map(row) }), !loose.length)] })) : null, _jsxs(YStack, { role: "listitem", gap: 1, children: [heading(t('Recents'), label, true), menus(rest, true)] })] })] }) }));
242
+ return (_jsx(YStack, { "data-slot": "recents", flex: 1, minH: 0, children: _jsxs(ScrollView, { flex: 1, showsVerticalScrollIndicator: false, ...{ overscrollBehavior: 'contain' }, children: [error ? _jsx(Note, { children: error.message }) : null, projectsNode, _jsxs(YStack, { role: "list", "aria-labelledby": label, gap: 1, children: [pinned ? (_jsxs(YStack, { role: "listitem", gap: 1, children: [heading(t(PINNED)), menus(_jsx(YStack, { role: "list", "aria-label": t(PINNED), gap: 1, children: pinned.rows.map(row) }), !loose.length)] })) : null, _jsxs(YStack, { role: "listitem", gap: 1, children: [heading(t('Recents'), label, true), menus(rest, true)] })] })] }) }));
200
243
  }
@@ -52,3 +52,13 @@ export declare function useSites(): {
52
52
  title: string;
53
53
  url: string;
54
54
  }[];
55
+ /**
56
+ * Contextual top-right card showing Outputs and Sources when the full side
57
+ * panel is closed, matching the reference desktop layout.
58
+ */
59
+ export declare function ContextCard({ at, sections, onCreate, onOpenPanel, }: {
60
+ at: string;
61
+ sections: Section[];
62
+ onCreate: () => void;
63
+ onOpenPanel: () => void;
64
+ }): import("react").JSX.Element;
package/dist/RightPane.js CHANGED
@@ -19,7 +19,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
19
19
  import { useEffect, useMemo, useState } from 'react';
20
20
  import { useI18n } from '@hanzo/i18n/react';
21
21
  import { FileCode, Globe, Image as ImageMark, Paperclip, Plus } from 'lucide-react';
22
- import { Box, DropdownMenu, DropdownMenuContent, DropdownMenuCheckboxItem, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Text, } from '@hanzo/ui';
22
+ import { Box, DropdownMenu, DropdownMenuContent, DropdownMenuCheckboxItem, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Text, XStack, YStack, } from '@hanzo/ui';
23
23
  import { useAi } from '@hanzo/ai/react';
24
24
  import { artifacts, name as titleOf, PAGE } from '@hanzo/build';
25
25
  import { said as told } from './lib/attach.js';
@@ -245,3 +245,20 @@ export function useSites() {
245
245
  }, [site]);
246
246
  return rows;
247
247
  }
248
+ /**
249
+ * Contextual top-right card showing Outputs and Sources when the full side
250
+ * panel is closed, matching the reference desktop layout.
251
+ */
252
+ export function ContextCard({ at, sections, onCreate, onOpenPanel, }) {
253
+ const { t } = useI18n();
254
+ const ai = useAi();
255
+ const outputsSection = sections.find((s) => s.id === 'outputs');
256
+ const sourcesSection = sections.find((s) => s.id === 'sources');
257
+ return (_jsxs(YStack, { "data-slot": "context-card", width: 220, rounded: 12, bg: "var(--shell-card-bg, var(--surface-3))", borderWidth: 1, borderColor: "var(--shell-card-border, var(--border-strong))", overflow: "hidden", children: [_jsxs(YStack, { px: 14, py: 11, gap: 5, children: [_jsxs(XStack, { items: "center", justify: "space-between", minH: 20, children: [_jsx(Text, { fontSize: 12.5, lineHeight: 16, fontWeight: "600", color: "var(--shell-card-title, var(--text-primary))", children: t('Outputs') }), _jsx(Box, { render: "button", "aria-label": t('Create a file or site'), onClick: onCreate, p: "$1", rounded: "$2", cursor: "pointer", hoverStyle: { bg: '$hover' }, children: _jsx(Plus, { size: 15, color: "var(--shell-section-fg, var(--muted-foreground))", "aria-hidden": true }) })] }), outputsSection && outputsSection.entries.length > 0 ? (_jsx(YStack, { gap: 3, children: outputsSection.entries.slice(0, 4).map((entry) => (_jsxs(XStack, { render: "button", items: "center", gap: 6, py: 2, px: 4, mx: -4, rounded: 6, cursor: "pointer", hoverStyle: { bg: '$hover' }, onPress: () => {
258
+ entry.open();
259
+ onOpenPanel();
260
+ }, children: [entry.icon, _jsx(Text, { fontSize: 12.5, lineHeight: 17, color: "$ink", numberOfLines: 1, flex: 1, children: entry.title })] }, entry.id))) })) : (_jsx(Box, { render: "button", onClick: onCreate, cursor: "pointer", self: "flex-start", children: _jsx(Text, { fontSize: 12.5, lineHeight: 17, color: "var(--shell-section-fg, var(--muted-foreground))", children: t('Create a file or site') }) }))] }), _jsx(Box, { height: 1, width: "100%", bg: "var(--shell-card-border, var(--border-strong))" }), _jsxs(YStack, { px: 14, py: 11, gap: 5, children: [_jsxs(XStack, { items: "center", justify: "space-between", minH: 20, children: [_jsx(Text, { fontSize: 12.5, lineHeight: 16, fontWeight: "600", color: "var(--shell-card-title, var(--text-primary))", children: t('Sources') }), _jsx(Add, { at: at })] }), sourcesSection && sourcesSection.entries.length > 0 ? (_jsx(YStack, { gap: 3, children: sourcesSection.entries.slice(0, 4).map((entry) => (_jsxs(XStack, { render: "button", items: "center", gap: 6, py: 2, px: 4, mx: -4, rounded: 6, cursor: "pointer", hoverStyle: { bg: '$hover' }, onPress: () => {
261
+ entry.open();
262
+ onOpenPanel();
263
+ }, children: [entry.icon, _jsx(Text, { fontSize: 12.5, lineHeight: 17, color: "$ink", numberOfLines: 1, flex: 1, children: entry.title })] }, entry.id))) })) : (_jsx(Box, { render: "button", onClick: () => take(at, { api: ai, org: org() }), cursor: "pointer", self: "flex-start", children: _jsx(Text, { fontSize: 12.5, lineHeight: 17, color: "var(--shell-section-fg, var(--muted-foreground))", children: t('Attach files or connect apps') }) }))] })] }));
264
+ }
package/dist/Shell.js CHANGED
@@ -955,7 +955,7 @@ const CEIL = 480;
955
955
  /** Per-reader, per-browser. A width that resets is a width you set every load. */
956
956
  const SPAN = "hanzo.sidebar.span";
957
957
  /** The shell's sidebar: its default width, px. */
958
- const SIDEBAR_WIDTH = 244;
958
+ const SIDEBAR_WIDTH = 240;
959
959
  /**
960
960
  * Where an app's own column goes, when it has one.
961
961
  *
@@ -1083,7 +1083,7 @@ function Leave({ href, children }) {
1083
1083
  }
1084
1084
  function Rail({ mode, places, team, open, navigate, onSettings, onMore, }) {
1085
1085
  const { t } = useI18n();
1086
- return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t("Places"), ...sheet(0), gridArea: "rail", minH: 0, borderInlineEndWidth: 1, borderInlineEndStyle: "solid", borderColor: "var(--edge, var(--white-06))", "$max-md": {
1086
+ return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t("Places"), ...sheet(0), gridArea: "rail", minH: 0, bg: "var(--shell-rail-bg, var(--secondary))", borderInlineEndWidth: 1, borderInlineEndStyle: "solid", borderColor: "var(--shell-rail-border, var(--border))", "$max-md": {
1087
1087
  flexDirection: "row",
1088
1088
  items: "center",
1089
1089
  borderInlineEndWidth: 0,
@@ -1373,7 +1373,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
1373
1373
  },
1374
1374
  signOut: () => void logout(),
1375
1375
  };
1376
- const list = (_jsxs(Sidebar, { ref: side.ref, ...side.props, $md: { width: "var(--span)" }, "$max-md": { width: "100%", maxW: 280 }, ...sheet(0), ...(dir === "rtl" ? { borderRightWidth: 0, borderLeftWidth: 1 } : { borderRightWidth: 1 }), borderColor: "var(--edge, var(--white-06))", position: "relative", children: [_jsx(Gutter
1376
+ const list = (_jsxs(Sidebar, { ref: side.ref, ...side.props, $md: { width: "var(--span)" }, "$max-md": { width: "100%", maxW: 280 }, ...sheet(0), ...(dir === "rtl" ? { borderRightWidth: 0, borderLeftWidth: 1 } : { borderRightWidth: 1 }), bg: "var(--shell-sidebar-bg, var(--surface-2))", borderColor: "var(--shell-sidebar-border, var(--border))", position: "relative", children: [_jsx(Gutter
1377
1377
  // The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
1378
1378
  , {
1379
1379
  // The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
@@ -1399,11 +1399,11 @@ function Frame({ mode, children, navigate, back, forward, }) {
1399
1399
  navigate?.(site("/referral"));
1400
1400
  dismiss();
1401
1401
  }, children: t("Share Hanzo") }), _jsx(XStack, { items: "center", justify: "flex-end", gap: "$1", px: "$1.5", py: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: _jsx(Box, { render: "button", onClick: toggle, "aria-label": t("Collapse sidebar"), p: "$2", rounded: "$2", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: _jsx(PanelLeftClose, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }) })] })) : null) : null] }));
1402
- return (_jsxs(YStack, { "data-slot": "workspace", "data-hydrated": settled ? "true" : undefined, "data-sidebar": asked ? "open" : "shut", display: "grid", gridTemplateColumns: "64px auto minmax(0, 1fr) auto", gridTemplateRows: "56px minmax(0, 1fr)", gridTemplateAreas: '"bar bar bar bar" "rail list pane side"', "$max-md": {
1402
+ return (_jsxs(YStack, { "data-slot": "workspace", "data-hydrated": settled ? "true" : undefined, "data-sidebar": asked ? "open" : "shut", display: "grid", gridTemplateColumns: "44px auto minmax(0, 1fr) auto", gridTemplateRows: "38px minmax(0, 1fr)", gridTemplateAreas: '"bar bar bar bar" "rail list pane side"', "$max-md": {
1403
1403
  gridTemplateColumns: "minmax(0, 1fr)",
1404
- gridTemplateRows: `56px minmax(0, 1fr) ${TABS_HEIGHT}`,
1404
+ gridTemplateRows: `44px minmax(0, 1fr) ${TABS_HEIGHT}`,
1405
1405
  gridTemplateAreas: '"bar" "pane" "rail"',
1406
- }, position: "relative", width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onSettings: () => showSettings(FIRST), onMore: () => setFinding(true) }), _jsx(Box, { gridArea: "bar", "data-slot": "bar", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, shrink: 0, children: _jsx(BusinessHeader, { appId: onApex ? (mode === "dev" ? "dev" : "chat") : "team", appTitle: onApex ? (mode === "dev" ? "Hanzo Dev" : "Hanzo Chat") : "Hanzo Team", apps: BUSINESS_APPS, brandMark: _jsx(HanzoMark, { size: 18 }), onSelectApp: (item) => {
1406
+ }, position: "relative", width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onSettings: () => showSettings(FIRST), onMore: () => setFinding(true) }), _jsx(Box, { gridArea: "bar", "data-slot": "bar", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, shrink: 0, bg: "var(--shell-bar-bg, var(--secondary))", borderBottomWidth: 1, borderColor: "var(--shell-bar-border, var(--border))", children: _jsx(BusinessHeader, { appId: onApex ? (mode === "dev" ? "dev" : "chat") : "team", appTitle: onApex ? (mode === "dev" ? "Hanzo Dev" : "Hanzo Chat") : "Hanzo Team", apps: BUSINESS_APPS, brandMark: _jsx(HanzoMark, { size: 18 }), onSelectApp: (item) => {
1407
1407
  if (typeof window === "undefined")
1408
1408
  return;
1409
1409
  try {
@@ -1466,7 +1466,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
1466
1466
  void switchToAccount(found);
1467
1467
  else
1468
1468
  void addAccount();
1469
- }, onAddAccount: () => void addAccount(), onSettings: () => showSettings(FIRST), onSignOut: () => void logout(), leftSlot: _jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t(shown ? "Close sidebar" : "Open sidebar"), onPress: toggle, onMouseEnter: () => setPeeking(true), children: _jsx(PanelLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), back || forward ? (_jsxs(XStack, { display: "none", $md: { display: "flex" }, items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t("Back"), onPress: () => back?.(), children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), _jsx(SidebarIconButton, { ...TAP, label: t("Forward"), onPress: () => forward?.(), children: _jsx(ArrowRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })) : null] }), rightSlot: _jsxs(XStack, { shrink: 0, minW: 0, justify: "flex-end", items: "center", gap: "$2", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: "button", onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", cursor: "pointer", children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$hover" }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: "button", onClick: () => window.location.assign(payUrl("/cart", { returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--primary)" }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] }) })) : null, _jsxs(XStack, { display: "none", $lg: { display: "flex" }, items: "center", gap: "$1", children: [_jsx(SidebarIconButton, { ...TAP, label: t(aside === "roster" ? "Hide directory & roster" : "Show directory & roster"), onPress: () => showAside(aside === "roster" ? null : "roster"), children: _jsx(Users, { size: 16, "aria-hidden": true }) }), _jsx(SidebarIconButton, { ...TAP, label: t(aside === "tasks" ? "Close side panel" : "Open side panel"), onPress: () => showAside(aside === "tasks" ? null : "tasks"), children: _jsx(PanelRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] }), _jsx(WindowControls, {})] }), children: _jsx(YStack, { width: 420, maxW: "100%", position: "relative", children: _jsxs(Box, { render: "button", onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", items: "center", "$max-md": { justify: "center" }, gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$hover" }, children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", "$max-md": { display: "none" }, children: t("Search {workspace}", { workspace }) }), _jsx(Shortcut, { keys: ["Mod", "K"], marginInlineStart: "auto", "data-i18n-ltr": "", "$max-md": { display: "none" } })] }) }) }) }), shown ? (_jsx(Box, { render: "button", "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, "data-slot": "scrim", position: "absolute", t: 56, r: 0, b: TABS_HEIGHT, l: 0, z: "var(--z-scrim)", $md: { display: "none" } })) : null, shown ? (_jsx(XStack, { "data-slot": "list", gridArea: "list", position: asked ? "relative" : "absolute", ...(asked ? {} : { top: 56, bottom: 0, insetInlineStart: 64 }), "$max-md": { position: "fixed", t: 56, r: 0, b: TABS_HEIGHT, l: 0, width: "100%" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
1469
+ }, onAddAccount: () => void addAccount(), onSettings: () => showSettings(FIRST), onSignOut: () => void logout(), leftSlot: _jsxs(XStack, { items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t(shown ? "Close sidebar" : "Open sidebar"), onPress: toggle, onMouseEnter: () => setPeeking(true), children: _jsx(PanelLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), back || forward ? (_jsxs(XStack, { display: "none", $md: { display: "flex" }, items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t("Back"), onPress: () => back?.(), children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), _jsx(SidebarIconButton, { ...TAP, label: t("Forward"), onPress: () => forward?.(), children: _jsx(ArrowRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })) : null] }), rightSlot: _jsxs(XStack, { shrink: 0, minW: 0, justify: "flex-end", items: "center", gap: "$2", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: "button", onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", cursor: "pointer", children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$hover" }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: "button", onClick: () => window.location.assign(payUrl("/cart", { returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--primary)" }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] }) })) : null, _jsxs(XStack, { display: "none", $lg: { display: "flex" }, items: "center", gap: "$1", children: [_jsx(SidebarIconButton, { ...TAP, label: t(aside === "roster" ? "Hide directory & roster" : "Show directory & roster"), onPress: () => showAside(aside === "roster" ? null : "roster"), children: _jsx(Users, { size: 16, "aria-hidden": true }) }), _jsx(SidebarIconButton, { ...TAP, label: t(aside === "tasks" ? "Close side panel" : "Open side panel"), onPress: () => showAside(aside === "tasks" ? null : "tasks"), children: _jsx(PanelRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] }), _jsx(WindowControls, {})] }), children: _jsx(YStack, { width: 420, maxW: "100%", position: "relative", children: _jsxs(Box, { render: "button", onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", items: "center", "$max-md": { justify: "center" }, gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$hover" }, children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", "$max-md": { display: "none" }, children: t("Search {workspace}", { workspace }) }), _jsx(Shortcut, { keys: ["Mod", "K"], marginInlineStart: "auto", "data-i18n-ltr": "", "$max-md": { display: "none" } })] }) }) }) }), shown ? (_jsx(Box, { render: "button", "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, "data-slot": "scrim", position: "absolute", t: 38, r: 0, b: TABS_HEIGHT, l: 0, z: "var(--z-scrim)", $md: { display: "none" } })) : null, shown ? (_jsx(XStack, { "data-slot": "list", gridArea: "list", position: asked ? "relative" : "absolute", ...(asked ? {} : { top: 38, bottom: 0, insetInlineStart: 44 }), "$max-md": { position: "fixed", t: 44, r: 0, b: TABS_HEIGHT, l: 0, width: "100%" }, z: "var(--z-drawer)", bg: "var(--shell-sidebar-bg, var(--surface-2))", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
1470
1470
  if (!asked)
1471
1471
  setPeeking(false);
1472
1472
  }, children: list })) : null, _jsx(Split, { swap: settingsPane ? _jsx(Suspense, { fallback: null, children: _jsx(SettingsPane, { id: settingsPane }) }) : undefined, children: children }), finding ? (_jsx(Search, { actions: doors, onClose: found,
package/dist/Sidebar.js CHANGED
@@ -68,16 +68,16 @@ const keys = (press) => ({
68
68
  press();
69
69
  },
70
70
  });
71
- /** A row of the sidebar: a pill on a 36px pitch matching the rail's mark height, a thumb's 44 on a touch screen, lit where the reader is. */
72
- const ROW = { rounded: '$4', minH: MARK, py: 0, px: '$2', $touchable: { minH: 44 } };
73
- /** A sidebar link row hugs its icon and label rather than stretching across the full column width. */
74
- const COMPACT_ROW = { ...ROW, self: 'flex-start', '$platform-web': { width: 'fit-content', maxWidth: '100%' } };
71
+ /** A row of the sidebar: a full-width 29px pill, 44px on a touch screen, lit where the reader is. */
72
+ const ROW = { rounded: 8, minH: 29, py: 0, px: '$2', width: '100%', $touchable: { minH: 44 } };
73
+ /** A sidebar link row spans the column width so hover and active pills align with Recents. */
74
+ const COMPACT_ROW = ROW;
75
75
  /** The run activity behind the bell: the runs that moved last, newest first. */
76
76
  const RECENT = 6;
77
77
  /** What a place that takes the sidebar is called at its head. */
78
78
  const TITLE = { library: phrase('Library'), scheduled: phrase('Scheduled tasks'), customize: phrase('Customize') };
79
- /** A header mark: a 16px glyph in a 32px target, a thumb's 44 on a touch screen. */
80
- const HEAD = { width: 32, height: 32, rounded: '$3', $touchable: { width: 44, height: 44 } };
79
+ /** A header mark: a 15px glyph in a 28px target, a thumb's 44 on a touch screen. */
80
+ const HEAD = { width: 28, height: 28, rounded: '$3', $touchable: { width: 44, height: 44 } };
81
81
  export function dispatchTabsAction(detail) {
82
82
  if (typeof window === 'undefined')
83
83
  return;
@@ -251,7 +251,7 @@ function Activity({ host }) {
251
251
  }))
252
252
  : [{ key: 'none', label: t('Nothing new'), disabled: true, onSelect: () => { } }]),
253
253
  ];
254
- return (_jsx(DropdownMenu, { minWidth: 280, trigger: _jsx(XStack, { render: "button", "aria-label": t('Activity'), ...{ title: t('Activity') }, ...HEAD, items: "center", justify: "center", cursor: "pointer", opacity: 0.7, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(Bell, { size: 16, "aria-hidden": true }) }), items: items }));
254
+ return (_jsx(DropdownMenu, { minWidth: 280, trigger: _jsx(XStack, { render: "button", "aria-label": t('Activity'), ...{ title: t('Activity') }, ...HEAD, items: "center", justify: "center", cursor: "pointer", opacity: 0.7, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(Bell, { size: 15, "aria-hidden": true }) }), items: items }));
255
255
  }
256
256
  export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer = false, rail, foot, places, }) {
257
257
  const { t, dir } = useI18n();
@@ -350,13 +350,13 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
350
350
  empty();
351
351
  go(talk());
352
352
  };
353
- return (_jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : `var(--span, ${WIDTH}px)`, maxW: drawer ? undefined : `var(--span, ${WIDTH}px)`, children: [_jsxs(Base, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: "$2", pt: drawer ? 'var(--pane-gap)' : 0,
353
+ return (_jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : `var(--span, ${WIDTH}px)`, maxW: drawer ? undefined : `var(--span, ${WIDTH}px)`, bg: "var(--shell-sidebar-bg, var(--surface-2))", borderRightWidth: drawer ? 0 : 1, borderColor: "var(--shell-sidebar-border, var(--border))", children: [_jsxs(Base, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: 8, pt: drawer ? 'var(--pane-gap)' : 2,
354
354
  // In the drawer the menu's own foot padding is the gap; its foot row stands on it.
355
355
  pb: drawer ? 0 : '$2', gap: "$0", "$platform-web": anon && !drawer ? { overflow: 'visible' } : undefined, children: [at ? (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: 2, paddingInlineEnd: 2,
356
356
  // The phone's drawer lines up with its bar (BAND); beside the rail, with the rail's first mark (ground.ts HEAD).
357
- height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", "data-tauri-drag-region": "false", onPress: onBack, ...HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: 18, lineHeight: 24, fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) })] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: "$1", paddingInlineStart: 4, paddingInlineEnd: 2,
357
+ height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", "data-tauri-drag-region": "false", onPress: onBack, ...HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: 15, lineHeight: 20, fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) })] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: 2, paddingInlineStart: 8, paddingInlineEnd: 2,
358
358
  // The phone's drawer lines up with its bar (BAND); beside the rail, with the rail's first mark (ground.ts HEAD).
359
- height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(Text, { flex: 1, minW: 0, fontSize: 24, lineHeight: 28, fontWeight: "700", color: "$ink", numberOfLines: 1, children: wordmark(mode) }), drawer || anon ? null : _jsx(Activity, { host: host }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...(drawer
359
+ height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsxs(XStack, { flex: 1, minW: 0, items: "center", gap: 4, children: [_jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "600", color: "$ink", numberOfLines: 1, children: wordmark(mode) }), _jsx(ChevronDown, { size: 13, strokeWidth: 2, color: "var(--shell-section-fg, var(--muted-foreground))", "aria-hidden": true })] }), drawer || anon ? null : _jsx(Activity, { host: host }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...(drawer
360
360
  ? {
361
361
  width: 40,
362
362
  height: 40,
@@ -365,7 +365,7 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
365
365
  borderColor: 'var(--border-strong)',
366
366
  bg: 'var(--pane-fill)',
367
367
  }
368
- : HEAD), children: _jsx(Search, { size: drawer ? 18 : 16, "aria-hidden": true }) }))] })), mode === 'chat' ? (_jsxs(YStack, { role: "list", gap: 2, shrink: 0, pt: drawer ? 0 : 4, children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-new", ...COMPACT_ROW, active: !thread && !anonSettingsOpen && !anonThreadTitle, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(MARKS.chat.make, { size: 16, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('New chat') }) }) }), anon ? (_jsxs(_Fragment, { children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-images", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(ImageMark, { size: 16, "aria-hidden": true }) }), onPress: () => {
368
+ : { width: 28, height: 28, rounded: '$3', $touchable: { width: 44, height: 44 } }), children: _jsx(Search, { size: drawer ? 18 : 15, "aria-hidden": true }) }))] })), mode === 'chat' ? (_jsxs(YStack, { role: "list", gap: 2, shrink: 0, pt: drawer ? 0 : 2, children: [_jsx(YStack, { role: "listitem", width: "100%", children: _jsx(SidebarItem, { "data-slot": "app-new", ...COMPACT_ROW, active: !thread && !anonSettingsOpen && !anonThreadTitle, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: _jsx(MARKS.chat.make, { size: 15, "aria-hidden": true }) }), onPress: create, ...keys(create), children: _jsx(Text, { fontSize: 13, lineHeight: 18, color: "$ink", children: t('New chat') }) }) }), anon ? (_jsxs(_Fragment, { children: [_jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-images", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(ImageMark, { size: 16, "aria-hidden": true }) }), onPress: () => {
369
369
  create();
370
370
  if (typeof window !== 'undefined') {
371
371
  window.dispatchEvent(new CustomEvent('hanzo:anon-prompt', { detail: { text: t('Create an image of ') } }));
@@ -385,7 +385,7 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
385
385
  if (typeof window !== 'undefined') {
386
386
  window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
387
387
  }
388
- }), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", self: "flex-start", maxW: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 16, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$3", color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
388
+ }), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: 13, lineHeight: 18, color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
389
389
  if (typeof window !== 'undefined')
390
390
  window.location.assign('/login?next=%2Fchat');
391
391
  }, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
@@ -4,7 +4,7 @@ export type ApprovalMode = 'auto' | 'manual';
4
4
  export declare const DEFAULT_EFFORT: Effort;
5
5
  export interface ChatPreferences {
6
6
  allowThirdPartyModels: boolean;
7
- /** The person turned third-party models on or off themselves; until then they are on. */
7
+ /** The person turned third-party models on or off themselves; until then they stay off. */
8
8
  thirdPartyChosen?: boolean;
9
9
  effort: Effort;
10
10
  approvalMode: ApprovalMode;
@@ -2,7 +2,7 @@
2
2
  * What Chat does, kept in this browser. What the composer DRAWS (the key that
3
3
  * sends, the chips, the model selector, the mode) is not here: it is one setting
4
4
  * for every composer (@hanzo/appearance `composing`, Settings → Appearance).
5
- * - allowThirdPartyModels: whether 3rd-party models (OpenAI, Anthropic, etc.) are listed. They are paid from the pre-paid balance on any plan, so they are on until the person turns them off (`thirdPartyChosen` says they did)
5
+ * - allowThirdPartyModels: whether 3rd-party models (OpenAI, Anthropic, etc.) are listed. Off by default so Enso and Zen lead; paid from the pre-paid balance on any plan once enabled (`thirdPartyChosen` records explicit choice)
6
6
  * - approvalMode: whether tools/actions run automatically ('auto') or ask for confirmation first ('manual') (default: 'auto')
7
7
  * - effort: the reasoning effort a message asks for (default: auto, the router decides)
8
8
  * - showLanguage: dictation listens in the person's own language rather than Auto
@@ -16,7 +16,7 @@ const AUTONOMY_KEY = 'hanzo.agent.autonomy';
16
16
  const EVENT_NAME = 'hanzo:chat:preferences';
17
17
  const EFFORT_SCHEMA_VERSION = 4;
18
18
  const DEFAULT_PREFERENCES = {
19
- allowThirdPartyModels: true,
19
+ allowThirdPartyModels: false,
20
20
  effort: DEFAULT_EFFORT,
21
21
  approvalMode: 'auto',
22
22
  showLanguage: false,
@@ -51,7 +51,9 @@ export function getChatPreferences() {
51
51
  const parsed = JSON.parse(raw);
52
52
  const migratedEffort = parsed.effortVersion === EFFORT_SCHEMA_VERSION ? validEffort(parsed.effort) : DEFAULT_EFFORT;
53
53
  return {
54
- allowThirdPartyModels: parsed.thirdPartyChosen ? Boolean(parsed.allowThirdPartyModels) : true,
54
+ allowThirdPartyModels: parsed.thirdPartyChosen
55
+ ? Boolean(parsed.allowThirdPartyModels)
56
+ : parsed.allowThirdPartyModels === true,
55
57
  ...(parsed.thirdPartyChosen ? { thirdPartyChosen: true } : {}),
56
58
  effort: migratedEffort,
57
59
  approvalMode: validApprovalMode(parsed.approvalMode, autonomy),
package/dist/span.js CHANGED
@@ -33,6 +33,7 @@ export function useSpan(store, initial, floor, ceil) {
33
33
  }, [store, floor, ceil]);
34
34
  useLayoutEffect(() => {
35
35
  el.current?.style.setProperty('--span', `${span}px`);
36
+ el.current?.closest?.('[data-slot="window"]')?.style.setProperty('--app-sidebar-span', `${span}px`);
36
37
  }, [span]);
37
38
  // Typed loosely because a gui stack hands its host element through a ref
38
39
  // typed for native too; on the web it is the element.
@@ -40,12 +41,15 @@ export function useSpan(store, initial, floor, ceil) {
40
41
  const next = node instanceof HTMLElement ? node : null;
41
42
  el.current = next;
42
43
  next?.style.setProperty('--span', `${span}px`);
44
+ next?.closest?.('[data-slot="window"]')?.style.setProperty('--app-sidebar-span', `${span}px`);
43
45
  }, [span]);
44
46
  const move = useCallback((n) => {
45
47
  el.current?.style.setProperty('--span', `${n}px`);
48
+ el.current?.closest?.('[data-slot="window"]')?.style.setProperty('--app-sidebar-span', `${n}px`);
46
49
  }, []);
47
50
  const keep = useCallback((n) => {
48
51
  el.current?.style.setProperty('--span', `${n}px`);
52
+ el.current?.closest?.('[data-slot="window"]')?.style.setProperty('--app-sidebar-span', `${n}px`);
49
53
  setSpan(n);
50
54
  try {
51
55
  localStorage.setItem(store, String(n));
package/dist/thread.js CHANGED
@@ -745,7 +745,7 @@ export function ThreadMore({ t: thread }) {
745
745
  const isOpen = menus.open === thread.id;
746
746
  // gui types these handlers by React Native's event; on the web they carry the DOM's.
747
747
  const aim = (e) => menus.aim(thread, e.currentTarget);
748
- return (_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": t('Conversation options'), ...{ title: t('More') }, "data-slot": "conversation-options", width: 32, height: 32, rounded: "$3", items: "center", justify: "center", cursor: "pointer", bg: isOpen ? '$hover' : 'transparent', opacity: isOpen || focused || hovered ? 1 : 0, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor', opacity: 1 },
748
+ return (_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "aria-label": t('Conversation options'), ...{ title: t('More') }, "data-slot": "conversation-options", width: 28, height: 28, rounded: "$3", items: "center", justify: "center", cursor: "pointer", bg: isOpen ? '$hover' : 'transparent', opacity: isOpen || focused || hovered ? 1 : 0.72, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor', opacity: 1 },
749
749
  // Before gui's own press handler, which opens the menu and stops there.
750
750
  onPointerDownCapture: aim, onKeyDownCapture: aim, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), onFocus: () => setFocused(true), onBlur: () => setFocused(false), children: _jsx(MoreHorizontal, { size: 16, "aria-hidden": true }) }) }));
751
751
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.68",
3
+ "version": "0.3.70",
4
4
  "description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "@hanzo/ai": ">=0.7.0",
53
53
  "@hanzo/appearance": ">=0.2.13",
54
- "@hanzo/build": ">=0.2.120",
54
+ "@hanzo/build": ">=0.2.123",
55
55
  "@hanzo/composer": ">=0.2.0",
56
56
  "@hanzo/design": ">=0.5.39",
57
57
  "@hanzo/event": ">=0.3.56",
@@ -72,7 +72,7 @@
72
72
  "devDependencies": {
73
73
  "@hanzo/ai": "0.7.0",
74
74
  "@hanzo/appearance": "0.2.14",
75
- "@hanzo/build": "0.2.120",
75
+ "@hanzo/build": "0.2.123",
76
76
  "@hanzo/composer": "0.2.0",
77
77
  "@hanzo/design": "0.5.39",
78
78
  "@hanzo/event": "0.3.56",