@hanzo/app 0.2.44 → 0.2.46

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/Chat.js CHANGED
@@ -42,7 +42,7 @@ import { Face, brief as roomBrief, join, roleOf, roomTurn, roster as rosterLine,
42
42
  import { cleanForSpeech, speakAgent } from "./speech.js";
43
43
  import { AgentMaker, HOUSE, useAgentShelf, useCrew } from "./crew.js";
44
44
  import { called } from "./team.js";
45
- import { Anchor, Box, Button, Text, View, XStack, YStack } from "@hanzo/ui";
45
+ import { Anchor, Box, Button, Switch, Text, View, XStack, YStack } from "@hanzo/ui";
46
46
  import { useMedia } from "@hanzo/gui";
47
47
  import { given, tidy } from "./lib/title.js";
48
48
  import { useIam, useIamToken } from "@hanzo/iam/react";
@@ -57,7 +57,7 @@ import { useHydrated } from "./lib/hydrated.js";
57
57
  import { base, served } from "./lib/ai.js";
58
58
  import { onServed } from "./lib/served.js";
59
59
  import { refused as worded, speech, useDictation, useTalk, useVoice } from "@hanzo/voice";
60
- import { Check, Clock, FileText, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
60
+ import { Check, Clock, FileText, Ghost, Image as ImageMark, Library as LibraryMark, Paperclip, Sparkles, X } from "lucide-react";
61
61
  import { FREE, ENSO } from "./lib/ai.js";
62
62
  import { openThread, useOpen } from "./open.js";
63
63
  import { Beside, Framed } from "./Shell.js";
@@ -540,6 +540,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
540
540
  // The opening greets the person by the first word of their display name, capitalised ("What’s up, Z?").
541
541
  // A username is a handle, not a name: without a display name the greeting has none.
542
542
  const firstName = useMemo(() => (anonymous ? "" : given(named()?.display ?? "")), [anonymous]);
543
+ // Private / forgetful mode: an ephemeral conversation kept in memory only, never saved to server history.
544
+ const [forgetful, setForgetful] = useState(false);
543
545
  // Up to three things worth doing next, from the person's own activity (@hanzo/build).
544
546
  const hints = useSuggestions(target);
545
547
  // THE HEADER'S ⋯ IS THE ROW'S MENU (thread.tsx): rename, pin, share, its
@@ -738,7 +740,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
738
740
  // — the Recent they opened — so a reply lands in it rather than beside it.
739
741
  const chat = useChat({
740
742
  model,
741
- keep: !anonymous,
743
+ keep: !anonymous && !forgetful,
742
744
  // THE PILL THAT WAS CUT READ A SETTING NOTHING SET, and that was the right
743
745
  // reason to cut it. This is the other half: `params` is forwarded to the
744
746
  // completion, so the effort chosen on the bar rides the request. An
@@ -1109,7 +1111,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1109
1111
  // WHAT AN ANSWER MAKES IS KEPT IN THE LIBRARY as it finishes (keep.ts): the
1110
1112
  // answer that just stopped, once the conversation it belongs to has an id.
1111
1113
  const [finished, setFinished] = useState(null);
1112
- useKeep(ai, !anonymous, kept ?? open, finished, artifacts);
1114
+ useKeep(ai, !anonymous && !forgetful, kept ?? open, finished, artifacts);
1113
1115
  // WHAT AN ANSWER MAKES OPENS BESIDE IT. With the panel open, a page or a
1114
1116
  // picture an answer just finished writing is opened as a tab; with it shut,
1115
1117
  // the answer's own Open does it.
@@ -1136,6 +1138,23 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1136
1138
  // brief in the transcript as though somebody had typed it, and would make a
1137
1139
  // room nobody has spoken in look like a conversation already under way.
1138
1140
  const said = useMemo(() => chat.messages.filter((m) => m.role !== "system"), [chat.messages]);
1141
+ const currentThread = useMemo(() => {
1142
+ const firstText = said[0]?.content;
1143
+ const initialText = typeof firstText === "string" ? firstText : Array.isArray(firstText) ? firstText[0]?.text : "";
1144
+ return mine ?? {
1145
+ id: open || "active-chat",
1146
+ title: tidy(initialText || t("New chat")),
1147
+ created: Date.now(),
1148
+ updated: Date.now(),
1149
+ room: room.length ? room : [],
1150
+ };
1151
+ }, [mine, open, said, t, room]);
1152
+ const currentThreadMap = useMemo(() => {
1153
+ const map = new Map(alone);
1154
+ if (!map.has(currentThread.id))
1155
+ map.set(currentThread.id, currentThread);
1156
+ return map;
1157
+ }, [alone, currentThread]);
1139
1158
  // THE LIKENESS, WHERE ONE WAS DRAWN FOR THIS CHARACTER. `cast.tsx` is the one
1140
1159
  // table of who looks like what, and it says a name it does not hold "is not a
1141
1160
  // problem" — that name wears initials, never another character's face.
@@ -1461,7 +1480,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1461
1480
  onLanguage: speakIn,
1462
1481
  talk,
1463
1482
  // While nothing has been said: what is worth doing next.
1464
- starters: said.length === 0 && !anonymous ? _jsx(Suggestions, { rows: hints.rows, onAct: hint, onDismiss: hints.dismiss }) : undefined,
1483
+ starters: said.length === 0
1484
+ ? forgetful
1485
+ ? (_jsxs(XStack, { items: "center", justify: "center", gap: "$2", py: "$2", px: "$3", rounded: "$3", bg: "var(--white-05)", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Ghost, { size: 14, strokeWidth: 1.75, color: "var(--primary)" }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t("Private chat is active. Messages are temporary and won't be saved.") })] }))
1486
+ : !anonymous
1487
+ ? _jsx(Suggestions, { rows: hints.rows, onAct: hint, onDismiss: hints.dismiss })
1488
+ : undefined
1489
+ : undefined,
1465
1490
  };
1466
1491
  return (_jsxs(YStack, { flex: 1, minH: 0, width: "100%", position: "relative", "data-slot": "chat-room",
1467
1492
  // A LINK IN AN ANSWER OPENS IN A TAB beside the conversation when the tab
@@ -1505,7 +1530,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
1505
1530
  }, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
1506
1531
  if (!open)
1507
1532
  setPlan(null);
1508
- }, 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", height: BAND, items: "center", justify: "space-between", gap: "$3", paddingInlineStart: "$4", paddingInlineEnd: "$2", shrink: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, "$max-md": !mine && !room.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : null, room.length ? (_jsx(XStack, { role: "list", "aria-label": t("Agents in this chat"), items: "center", gap: "$1.5", minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: "none" }, children: room.map((name) => (_jsxs(XStack, { role: "listitem", items: "center", gap: "$1.5", paddingInlineStart: "$1", paddingInlineEnd: "$0.5", py: "$0.5", rounded: 999, borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Face, { src: faces[name]?.avatar ?? (name === withWhom ? portrait : undefined), emoji: faces[name]?.emoji ?? (name === withWhom ? persona?.emoji : undefined), name: name, size: 22 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$color", numberOfLines: 1, display: "none", $sm: { display: "flex" }, children: name }), _jsx(Box, { render: "button", onClick: () => openAgent(name), "aria-label": t("Remove {name} from this chat", { name }), title: t("Remove {name}", { name }), width: 24, height: 24, rounded: 999, items: "center", justify: "center", hoverStyle: { bg: "$hover" }, children: _jsx(X, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }) })] }, name))) })) : null] }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [free ? (_jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-upgrade", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), "aria-label": t("Upgrade plan"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade plan") })] })) : null, open ? _jsx(Share, { thread: open }) : null, mine ? (_jsx(ConversationMenu, { threads: alone, active: open, onSchedule: anonymous ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: mine }) }) })) : 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(Beside, { 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(ChatSurface, { ...chat, messages: shown, send: guarded,
1533
+ }, 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", height: BAND, items: "center", justify: "space-between", gap: "$3", paddingInlineStart: "$4", paddingInlineEnd: "$2", shrink: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, "$max-md": !mine && !room.length ? { display: 'none' } : undefined, children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [mine ? (_jsx(Text, { fontSize: 15, lineHeight: 20, color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: tidy(mine.title) })) : null, room.length ? (_jsx(XStack, { role: "list", "aria-label": t("Agents in this chat"), items: "center", gap: "$1.5", minW: 0, overflowX: "auto", "$platform-web": { scrollbarWidth: "none" }, children: room.map((name) => (_jsxs(XStack, { role: "listitem", items: "center", gap: "$1.5", paddingInlineStart: "$1", paddingInlineEnd: "$0.5", py: "$0.5", rounded: 999, borderWidth: 1, borderColor: "$borderColor", shrink: 0, children: [_jsx(Face, { src: faces[name]?.avatar ?? (name === withWhom ? portrait : undefined), emoji: faces[name]?.emoji ?? (name === withWhom ? persona?.emoji : undefined), name: name, size: 22 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$color", numberOfLines: 1, display: "none", $sm: { display: "flex" }, children: name }), _jsx(Box, { render: "button", onClick: () => openAgent(name), "aria-label": t("Remove {name} from this chat", { name }), title: t("Remove {name}", { name }), width: 24, height: 24, rounded: 999, items: "center", justify: "center", hoverStyle: { bg: "$hover" }, children: _jsx(X, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }) })] }, name))) })) : null] }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [free ? (_jsxs(Button, { size: "xs", variant: "outline", "data-slot": "header-upgrade", gap: "$1.5", px: "$2.5", py: "$1", rounded: "$4", cursor: "pointer", hoverStyle: { bg: 'var(--white-10)' }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), "aria-label": t("Upgrade plan"), children: [_jsx(Sparkles, { size: 13, color: "var(--primary)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade plan") })] })) : null, open ? _jsx(Share, { thread: open }) : 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(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat mode"), "aria-pressed": forgetful, ...{ title: forgetful ? t("Private chat enabled: messages will not be saved") : t("Private chat: forgetful mode") }, items: "center", gap: "$1.5", px: "$2", py: "$1", height: 28, rounded: "$3", cursor: "pointer", borderWidth: 1, borderColor: forgetful ? 'var(--primary)' : '$borderColor', bg: forgetful ? 'var(--primary-10, var(--white-10))' : 'transparent', hoverStyle: { bg: forgetful ? 'var(--primary-15, var(--white-15))' : '$hover' }, onPress: () => setForgetful(!forgetful), children: [_jsx(Ghost, { size: 13, strokeWidth: 1.75, color: forgetful ? 'var(--primary)' : 'var(--soft, var(--muted-foreground))', "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: forgetful ? '600' : '500', color: forgetful ? 'var(--primary)' : '$soft', children: t("Private") }), _jsx(Switch, { size: "sm", checked: forgetful, pointerEvents: "none" })] })), _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(Beside, { 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(ChatSurface, { ...chat, messages: shown, send: guarded,
1509
1534
  // THE COMPOSER IS FIXED TO THE FOOT, on a laptop and on a phone, empty or
1510
1535
  // not: while nothing has been said the opening (the heading) stands at the
1511
1536
  // foot of the height above it; once a turn exists the transcript scrolls
package/dist/Meet.js CHANGED
@@ -310,7 +310,7 @@ export function Meet() {
310
310
  }, children: "Copy Summary" })] })] })) : null] })) : (_jsxs(XStack, { flex: 1, overflow: "hidden", "$max-lg": { flexDirection: 'column', overflowY: 'auto', overflowX: 'hidden' }, children: [_jsxs(YStack, { flex: 1, minW: 0, p: 32, gap: 24, overflowY: "auto", "$max-lg": { p: 16, flexBasis: 'auto', shrink: 0, overflowY: 'visible', overflowX: 'hidden' }, children: [_jsxs(YStack, { gap: 6, children: [_jsx(Text, { fontSize: "$8", fontWeight: "800", color: "$ink", letterSpacing: -0.5, children: "Secure, High-Definition Video Calls" }), _jsxs(Text, { fontSize: "$3", color: "$soft", children: ["Powered by native Hanzo Meet (", _jsx(Text, { render: _jsx("a", { href: "https://meet.hanzo.ai", target: "_blank", rel: "noopener noreferrer" }), color: "$ink", textDecorationLine: "underline", children: "meet.hanzo.ai" }), "). Connect with team members, clients, and autonomous AI agents."] })] }), _jsxs(XStack, { gap: 12, flexWrap: "wrap", children: [_jsxs(Button, { variant: "primary", size: "lg", onClick: startInstantMeeting, children: [_jsx(Plus, { size: 16 }), "Start Instant Meeting"] }), _jsxs(XStack, { items: "center", gap: 6, bg: "$panel", borderWidth: 1, borderColor: "var(--border-control)", rounded: 8, px: 4, height: 42, children: [_jsx(Text, { render: _jsx("input", { type: "text", value: roomInput, onChange: (e) => setRoomInput(e.target.value), onKeyDown: (e) => e.key === 'Enter' && joinCustomMeeting(), placeholder: "Enter meeting code or link", "aria-label": "Meeting code or link" }), bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "$ink", fontSize: "$2", width: 220, px: 8 }), _jsx(Button, { variant: "primary", size: "sm", disabled: !roomInput.trim(), onClick: joinCustomMeeting, children: "Join" })] }), _jsxs(Button, { size: "lg", variant: showAgentPicker ? 'secondary' : 'default', "aria-expanded": showAgentPicker, onClick: () => setShowAgentPicker(!showAgentPicker), children: [_jsx(UserPlus, { size: 14 }), `Invite Agents (${invitedAgents.length})`] })] }), showAgentPicker ? (_jsxs(YStack, { bg: "$panel", borderWidth: 1, borderColor: "var(--border-control)", rounded: 12, p: 16, maxW: 560, children: [_jsxs(XStack, { items: "center", justify: "space-between", mb: 12, children: [_jsx(Text, { fontSize: "$2", fontWeight: "700", color: "$ink", children: "Select AI Agents to Attend Meetings" }), _jsx(Text, { fontSize: "$1", color: "$soft", children: "Each agent joins the call with voice synthesis & pair programming" })] }), _jsx(View, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(220px, 1fr))", gap: 8, children: AVAILABLE_MEETING_AGENTS.map((agent) => {
311
311
  const isInvited = invitedAgents.includes(agent.name);
312
312
  return (_jsxs(XStack, { onClick: () => toggleAgentInvite(agent.name), items: "center", gap: 10, px: 10, py: 8, rounded: 8, bg: isInvited ? '$raised' : '$hover', borderWidth: 1, borderColor: isInvited ? 'var(--border-selected)' : '$borderColor', cursor: "pointer", transition: "quickest", children: [_jsx(Face, { name: agent.name, size: 32 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: agent.name }), _jsxs(Text, { fontSize: 10, color: "$faint", numberOfLines: 1, children: [agent.role, " \u00B7 Voice: ", agent.voice] })] }), _jsx(View, { width: 16, height: 16, rounded: 4, borderWidth: isInvited ? 0 : 1, borderColor: "var(--border-selected)", bg: isInvited ? 'var(--foreground)' : 'transparent', items: "center", justify: "center", children: isInvited ? _jsx(Check, { size: 11, strokeWidth: 3, color: "var(--background)" }) : null })] }, agent.id));
313
- }) })] })) : null, _jsxs(YStack, { bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: 12, overflow: "hidden", maxW: 560, children: [_jsxs(XStack, { height: 280, bg: "$sunken", position: "relative", items: "center", justify: "center", children: [cameraOn ? (_jsx(View, { render: _jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true }), width: "100%", height: "100%", objectFit: "cover" })) : (_jsxs(YStack, { items: "center", gap: 8, children: [_jsx(XStack, { width: 64, height: 64, rounded: 9999, bg: "$raised", items: "center", justify: "center", children: _jsx(VideoOff, { size: 28, color: "var(--muted-foreground)" }) }), _jsx(Text, { fontSize: "$2", color: "$soft", children: "Camera is off" })] })), _jsxs(XStack, { position: "absolute", b: 16, maxW: "calc(100% - 24px)", items: "center", justify: "center", flexWrap: "wrap", gap: 8, bg: "var(--surface-overlay)", backdropFilter: "blur(8px)", px: 12, py: 6, rounded: 24, borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Button, { size: "icon", rounded: 9999, variant: cameraOn ? 'default' : 'destructive', "aria-label": cameraOn ? 'Turn Camera Off' : 'Turn Camera On', title: cameraOn ? 'Turn Camera Off' : 'Turn Camera On', onClick: () => setCameraOn(!cameraOn), children: cameraOn ? _jsx(Video, { size: 16 }) : _jsx(VideoOff, { size: 16 }) }), _jsx(Button, { size: "icon", rounded: 9999, variant: micOn ? 'default' : 'destructive', "aria-label": micOn ? 'Mute Mic' : 'Unmute Mic', title: micOn ? 'Mute Mic' : 'Unmute Mic', onClick: () => setMicOn(!micOn), children: micOn ? _jsx(Mic, { size: 16 }) : _jsx(MicOff, { size: 16 }) }), _jsx(Button, { size: "sm", rounded: 9999, variant: audioTesting ? 'secondary' : 'default', title: "Test Agent Voice & Audio Output", onClick: testAudioSpeaker, children: audioTesting ? (_jsxs(_Fragment, { children: [_jsx(AudioWave, { active: true, color: "var(--state-success)" }), "Testing Audio\u2026"] })) : (_jsxs(_Fragment, { children: [_jsx(Volume2, { size: 13 }), "Test Audio"] })) }), _jsxs(Button, { size: "sm", rounded: 9999, variant: botAssisting ? 'secondary' : 'default', "aria-pressed": botAssisting, onClick: () => setBotAssisting(!botAssisting), children: [_jsx(Bot, { size: 13 }), botAssisting ? 'AI Bot Co-pilot ON' : 'AI Bot OFF'] })] })] }), _jsxs(XStack, { p: 12, items: "center", justify: "space-between", bg: "$panel", children: [_jsxs(Text, { fontSize: "$1", color: "$soft", children: ["Readiness: Camera ", cameraOn ? 'Active' : 'Muted', " \u00B7 Mic ", micOn ? 'Active' : 'Muted', " \u00B7 Audio ", audioTesting ? 'Testing' : 'Ready'] }), _jsx(Text, { fontSize: "$1", color: "$quiet", fontWeight: "600", children: "HD 1080p Ready" })] })] })] }), _jsxs(YStack, { grow: 1, shrink: 1, flexBasis: 380, minW: 0, maxW: "100%", bg: "$panel", borderLeftWidth: 1, borderLeftColor: "$borderColor", p: 16, gap: 14, overflowY: "auto", "$max-lg": {
313
+ }) })] })) : null, _jsxs(YStack, { bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: 12, overflow: "hidden", maxW: 560, children: [_jsxs(XStack, { height: 280, bg: "$sunken", position: "relative", items: "center", justify: "center", children: [cameraOn ? (_jsx(View, { render: _jsx("video", { ref: videoRef, autoPlay: true, playsInline: true, muted: true }), width: "100%", height: "100%", objectFit: "cover" })) : (_jsxs(YStack, { items: "center", gap: 8, children: [_jsx(XStack, { width: 64, height: 64, rounded: 9999, bg: "$raised", items: "center", justify: "center", children: _jsx(VideoOff, { size: 28, color: "var(--muted-foreground)" }) }), _jsx(Text, { fontSize: "$2", color: "$soft", children: "Camera is off" })] })), _jsxs(XStack, { position: "absolute", b: 16, maxW: "calc(100% - 24px)", items: "center", justify: "center", flexWrap: "wrap", gap: 8, bg: "var(--surface-overlay)", backdropFilter: "blur(8px)", px: 12, py: 6, rounded: 24, borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Button, { size: "icon", rounded: 9999, variant: cameraOn ? 'default' : 'destructive', "aria-label": cameraOn ? 'Turn Camera Off' : 'Turn Camera On', title: cameraOn ? 'Turn Camera Off' : 'Turn Camera On', onClick: () => setCameraOn(!cameraOn), children: cameraOn ? _jsx(Video, { size: 16 }) : _jsx(VideoOff, { size: 16 }) }), _jsx(Button, { size: "icon", rounded: 9999, variant: micOn ? 'default' : 'destructive', "aria-label": micOn ? 'Mute Mic' : 'Unmute Mic', title: micOn ? 'Mute Mic' : 'Unmute Mic', onClick: () => setMicOn(!micOn), children: micOn ? _jsx(Mic, { size: 14, strokeWidth: 1.75 }) : _jsx(MicOff, { size: 14, strokeWidth: 1.75 }) }), _jsx(Button, { size: "sm", rounded: 9999, variant: audioTesting ? 'secondary' : 'default', title: "Test Agent Voice & Audio Output", onClick: testAudioSpeaker, children: audioTesting ? (_jsxs(_Fragment, { children: [_jsx(AudioWave, { active: true, color: "var(--state-success)" }), "Testing Audio\u2026"] })) : (_jsxs(_Fragment, { children: [_jsx(Volume2, { size: 12, strokeWidth: 1.75 }), "Test Audio"] })) }), _jsxs(Button, { size: "sm", rounded: 9999, variant: botAssisting ? 'secondary' : 'default', "aria-pressed": botAssisting, onClick: () => setBotAssisting(!botAssisting), children: [_jsx(Bot, { size: 13 }), botAssisting ? 'AI Bot Co-pilot ON' : 'AI Bot OFF'] })] })] }), _jsxs(XStack, { p: 12, items: "center", justify: "space-between", bg: "$panel", children: [_jsxs(Text, { fontSize: "$1", color: "$soft", children: ["Readiness: Camera ", cameraOn ? 'Active' : 'Muted', " \u00B7 Mic ", micOn ? 'Active' : 'Muted', " \u00B7 Audio ", audioTesting ? 'Testing' : 'Ready'] }), _jsx(Text, { fontSize: "$1", color: "$quiet", fontWeight: "600", children: "HD 1080p Ready" })] })] })] }), _jsxs(YStack, { grow: 1, shrink: 1, flexBasis: 380, minW: 0, maxW: "100%", bg: "$panel", borderLeftWidth: 1, borderLeftColor: "$borderColor", p: 16, gap: 14, overflowY: "auto", "$max-lg": {
314
314
  shrink: 0,
315
315
  flexBasis: 'auto',
316
316
  borderLeftWidth: 0,
@@ -26,6 +26,7 @@ import { showSettings } from './open.js';
26
26
  import { Look } from './look.js';
27
27
  import { ProviderMark } from './ProviderMark.js';
28
28
  import { bearer, org, pick } from './lib/session.js';
29
+ import { usePref } from './pref.js';
29
30
  import { Experimental } from './experimental.js';
30
31
  import { site } from './where.js';
31
32
  import { named, ROWS } from './Settings.js';
@@ -142,40 +143,16 @@ function Account() {
142
143
  /** Real Web3 Wallet Connect & Payout Address for collecting referral & compute rewards. */
143
144
  function WalletPayouts() {
144
145
  const { t } = useI18n();
145
- const [address, setAddress] = useState(() => {
146
- try {
147
- return typeof window !== 'undefined' ? (window.localStorage.getItem('hanzo.wallet.address') ?? '') : '';
148
- }
149
- catch {
150
- return '';
151
- }
152
- });
146
+ const [address, setAddress] = usePref('rewards_payout_wallet', '');
147
+ const [, setProvider] = usePref('rewards_payout_provider', '');
153
148
  const [busy, setBusy] = useState(false);
154
149
  const [saved, setSaved] = useState(false);
155
150
  const [error, setError] = useState('');
156
151
  const persist = async (addr, provider) => {
157
152
  const clean = addr.trim();
153
+ // The account holds the address (PATCH /v1/pref), so it is the same on every machine.
158
154
  setAddress(clean);
159
- try {
160
- if (clean)
161
- window.localStorage.setItem('hanzo.wallet.address', clean);
162
- else
163
- window.localStorage.removeItem('hanzo.wallet.address');
164
- }
165
- catch { }
166
- const tok = bearer();
167
- if (tok && clean) {
168
- await fetch(`${api()}/v1/preferences`, {
169
- method: 'PUT',
170
- headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${tok}` },
171
- body: JSON.stringify({
172
- preferences: {
173
- rewards_payout_wallet: clean,
174
- rewards_payout_provider: provider,
175
- },
176
- }),
177
- }).catch(() => { });
178
- }
155
+ setProvider(clean ? provider : '');
179
156
  setSaved(true);
180
157
  setTimeout(() => setSaved(false), 2400);
181
158
  };
package/dist/Setup.js CHANGED
@@ -24,6 +24,7 @@ import { ProviderMark } from './ProviderMark.js';
24
24
  import { useBetas } from './Betas.js';
25
25
  import { useRooms } from './host.js';
26
26
  import { useKept } from './kept.js';
27
+ import { usePref } from './pref.js';
27
28
  import { api } from './lib/api.js';
28
29
  import { app } from './lib/host.js';
29
30
  import { scope } from './lib/session.js';
@@ -48,11 +49,11 @@ export function Setup({ go } = {}) {
48
49
  const { isAuthenticated, accessToken } = useIam();
49
50
  const { open: opens } = useBetas();
50
51
  const pathed = useRooms().path !== null;
51
- const [later, setLater] = useKept(LATER_KEY, false);
52
- const [step, setStep] = useKept(STEP_KEY, 1);
53
- const [githubDone, setGithubDone] = useKept(GITHUB_KEY, false);
54
- const [slackDone, setSlackDone] = useKept(SLACK_KEY, false);
55
- const [pluginDone, setPluginDone] = useKept(PLUGIN_KEY, false);
52
+ const [later, setLater, known] = usePref(LATER_KEY, false);
53
+ const [step, setStep] = usePref(STEP_KEY, 1);
54
+ const [githubDone, setGithubDone] = usePref(GITHUB_KEY, false);
55
+ const [slackDone, setSlackDone] = usePref(SLACK_KEY, false);
56
+ const [pluginDone, setPluginDone] = usePref(PLUGIN_KEY, false);
56
57
  const [googleDone, setGoogleDone] = useKept(GOOGLE_KEY, false);
57
58
  const [googleAccounts, setGoogleAccounts] = useKept(GOOGLE_ACCOUNTS_KEY, []);
58
59
  const [busy, setBusy] = useState(null);
@@ -198,7 +199,8 @@ export function Setup({ go } = {}) {
198
199
  const totalDone = (githubDone ? 1 : 0) + (slackDone ? 1 : 0) + (pluginDone ? 1 : 0);
199
200
  const allDone = totalDone === 3;
200
201
  const activeStep = step === 1 || step === 2 || step === 3 ? step : 1;
201
- if (later && !modalOpen)
202
+ // Dismissed on another machine is dismissed here: the account answers before the card draws.
203
+ if (!known || (later && !modalOpen))
202
204
  return null;
203
205
  const openOAuthPopup = (authorizeUrl, provider, label, onDone) => {
204
206
  const popup = window.open(authorizeUrl, `hanzo-oauth-${provider}`, 'width=600,height=700');
package/dist/Top.js CHANGED
@@ -25,31 +25,31 @@ import { ToggleGroup, ToggleGroupItem } from '@hanzo/ui';
25
25
  import { BAND, pane } from './ground.js';
26
26
  import { empty } from './open.js';
27
27
  import { talk } from './lib/host.js';
28
- /** A button, px: a thumb's 44. */
29
- const ROUND = 44;
28
+ /** A button, px: compact and refined. */
29
+ const ROUND = 34;
30
30
  /** The bar's line under the device's top inset, px: the pill's height. */
31
- const LINE = 48;
32
- /** A segment, px: the pill's 150px inside its rim, less the group's 4px gap, halved. */
33
- const SEGMENT = 73;
31
+ const LINE = 34;
32
+ /** A segment, px: compact switcher button. */
33
+ const SEGMENT = 56;
34
34
  /** The glass the three are cut from. */
35
35
  const GLASS = {
36
36
  ...pane(),
37
37
  borderColor: 'var(--border-strong)',
38
38
  borderRadius: 9999,
39
- boxShadow: 'inset 0 1px 1px 0 var(--white-15), var(--shadow-sheet-1)',
39
+ boxShadow: 'var(--shadow-sheet-1)',
40
40
  backdropFilter: 'blur(24px) saturate(190%) contrast(102%)',
41
41
  };
42
42
  /** A round glass button named for what it does (`label`, already in the reader's language). */
43
43
  function Round({ label, onPress, opacity, pointerEvents, children, ...rest }) {
44
44
  return (_jsx(XStack, { render: "button", "aria-label": label, onPress: onPress, ...GLASS, width: ROUND, height: ROUND, items: "center", justify: "center", shrink: 0, cursor: "pointer", opacity: opacity, pointerEvents: pointerEvents, pressStyle: { bg: '$raised', scale: 0.96 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, ...rest, children: children }));
45
45
  }
46
- /** The drawer's mark: two strokes, the lower one shorter and flush with the start, 19×11 as the reference draws it. */
46
+ /** The drawer's mark: two strokes, the lower one shorter and flush with the start, 15×9. */
47
47
  function Lines() {
48
- return (_jsx("svg", { width: 19, height: 11, viewBox: "0 0 19 11", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", "aria-hidden": true, "data-i18n-mirror": true, children: _jsx("path", { d: "M1 1h17M1 10h10.7" }) }));
48
+ return (_jsx("svg", { width: 15, height: 9, viewBox: "0 0 19 11", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", "aria-hidden": true, "data-i18n-mirror": true, children: _jsx("path", { d: "M1 1h17M1 10h10.7" }) }));
49
49
  }
50
50
  /** One side of the pill. */
51
51
  function Side({ value, children }) {
52
- return (_jsx(ToggleGroupItem, { value: value, size: "lg", width: SEGMENT, rounded: 9999, bg: "transparent", borderColor: "transparent", hoverStyle: { bg: '$hover' }, activeStyle: { bg: '$raised', borderColor: 'transparent' }, children: _jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$ink", numberOfLines: 1, children: children }) }));
52
+ return (_jsx(ToggleGroupItem, { value: value, size: "sm", width: SEGMENT, height: 26, rounded: 9999, bg: "transparent", borderColor: "transparent", hoverStyle: { bg: '$hover' }, activeStyle: { bg: '$raised', borderColor: 'transparent' }, children: _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: children }) }));
53
53
  }
54
54
  export function Top({ host, mode, places, open = false, go, onMenu, onChat, onDev, }) {
55
55
  const { t } = useI18n();
@@ -63,5 +63,5 @@ export function Top({ host, mode, places, open = false, go, onMenu, onChat, onDe
63
63
  },
64
64
  }
65
65
  : { label: made?.label ?? t('New'), onPress: made?.onPress };
66
- return (_jsxs(XStack, { "data-slot": "app-bar", height: `calc(${BAND}px + var(--safe-top) + var(--pane-gap))`, pt: "calc(var(--safe-top) + var(--pane-gap))", px: "$4.5", items: "center", justify: "space-between", shrink: 0, $md: { display: 'none' }, children: [_jsx(Round, { label: t('Open sidebar'), "data-slot": "bar-menu", onPress: onMenu, pointerEvents: open ? 'none' : 'auto', children: _jsx(Lines, {}) }), _jsx(XStack, { "data-slot": "bar-mode", ...GLASS, height: LINE, p: "$1", items: "center", children: _jsxs(ToggleGroup, { type: "single", "aria-label": t('App'), value: mode === 'chat' || mode === 'dev' ? mode : '', disableDeactivation: true, onValueChange: (v) => (v === 'chat' ? onChat() : v === 'dev' ? onDev() : undefined), children: [_jsx(Side, { value: "chat", children: t('Chat') }), _jsx(Side, { value: "dev", children: "Dev" })] }) }), fresh.onPress ? (_jsx(Round, { label: fresh.label, "data-slot": "bar-new", onPress: fresh.onPress, children: _jsx(SquarePen, { size: 20, "aria-hidden": true }) })) : (_jsx(XStack, { width: 44, height: 44, "aria-hidden": true }))] }));
66
+ return (_jsxs(XStack, { "data-slot": "app-bar", height: `calc(${BAND}px + var(--safe-top) + var(--pane-gap))`, pt: "calc(var(--safe-top) + var(--pane-gap))", px: "$4.5", items: "center", justify: "space-between", shrink: 0, $md: { display: 'none' }, children: [_jsx(Round, { label: t('Open sidebar'), "data-slot": "bar-menu", onPress: onMenu, pointerEvents: open ? 'none' : 'auto', children: _jsx(Lines, {}) }), _jsx(XStack, { "data-slot": "bar-mode", ...GLASS, height: LINE, p: "$1", items: "center", children: _jsxs(ToggleGroup, { type: "single", "aria-label": t('App'), value: mode === 'chat' || mode === 'dev' ? mode : '', disableDeactivation: true, onValueChange: (v) => (v === 'chat' ? onChat() : v === 'dev' ? onDev() : undefined), children: [_jsx(Side, { value: "chat", children: t('Chat') }), _jsx(Side, { value: "dev", children: "Dev" })] }) }), fresh.onPress ? (_jsx(Round, { label: fresh.label, "data-slot": "bar-new", onPress: fresh.onPress, children: _jsx(SquarePen, { size: 16, strokeWidth: 1.75, "aria-hidden": true }) })) : (_jsx(XStack, { width: ROUND, height: ROUND, "aria-hidden": true }))] }));
67
67
  }
package/dist/pref.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A value kept on the signed-in person's account, so it follows them to every
3
+ * machine and every Hanzo surface: GET /v1/pref reads their preference document,
4
+ * PATCH /v1/pref merges one key into it (shallow: a key sent is replaced whole,
5
+ * the rest are left as they are).
6
+ *
7
+ * Signed in, the account is the truth: a key the document holds wins, and a key
8
+ * it does not hold is `initial`, never what this browser kept for whoever used
9
+ * it before. This browser's copy only paints the first frame and stands in while
10
+ * signed out. `ready` is false until the document has answered, so a surface that
11
+ * would flash (a card the person already dismissed) can wait for it.
12
+ */
13
+ export declare function usePref<T>(key: string, initial: T): [T, (v: T) => void, boolean];
14
+ /** One key written to the account; a signed-out page keeps it in this browser only. */
15
+ export declare function send(patch: Record<string, unknown>): void;
package/dist/pref.js ADDED
@@ -0,0 +1,96 @@
1
+ 'use client';
2
+ import { useEffect, useState } from 'react';
3
+ import { api } from './lib/api.js';
4
+ import { scope } from './lib/session.js';
5
+ /**
6
+ * A value kept on the signed-in person's account, so it follows them to every
7
+ * machine and every Hanzo surface: GET /v1/pref reads their preference document,
8
+ * PATCH /v1/pref merges one key into it (shallow: a key sent is replaced whole,
9
+ * the rest are left as they are).
10
+ *
11
+ * Signed in, the account is the truth: a key the document holds wins, and a key
12
+ * it does not hold is `initial`, never what this browser kept for whoever used
13
+ * it before. This browser's copy only paints the first frame and stands in while
14
+ * signed out. `ready` is false until the document has answered, so a surface that
15
+ * would flash (a card the person already dismissed) can wait for it.
16
+ */
17
+ export function usePref(key, initial) {
18
+ const signed = Boolean(scope().Authorization);
19
+ const [value, setValue] = useState(() => local(key, initial));
20
+ const [ready, setReady] = useState(!signed);
21
+ useEffect(() => {
22
+ if (!signed)
23
+ return;
24
+ let live = true;
25
+ void held().then((doc) => {
26
+ if (!live)
27
+ return;
28
+ if (doc) {
29
+ const next = key in doc ? doc[key] : initial;
30
+ setValue(next);
31
+ keep(key, next);
32
+ }
33
+ setReady(true);
34
+ });
35
+ return () => {
36
+ live = false;
37
+ };
38
+ // `initial` is a literal at every call site.
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ }, [key, signed]);
41
+ const set = (v) => {
42
+ setValue(v);
43
+ keep(key, v);
44
+ send({ [key]: v });
45
+ };
46
+ return [value, set, ready];
47
+ }
48
+ /** The document, read once per page and per credential, and shared by every key. */
49
+ let read = null;
50
+ function held() {
51
+ const auth = scope();
52
+ if (!auth.Authorization)
53
+ return Promise.resolve(null);
54
+ if (read?.auth !== auth.Authorization) {
55
+ read = {
56
+ auth: auth.Authorization,
57
+ doc: fetch(`${api()}/v1/pref`, { headers: auth })
58
+ .then((r) => (r.ok ? r.json() : null))
59
+ .then((body) => (body && body.prefs && typeof body.prefs === 'object' ? body.prefs : body ? {} : null))
60
+ .catch(() => null),
61
+ };
62
+ }
63
+ return read.doc;
64
+ }
65
+ /** One key written to the account; a signed-out page keeps it in this browser only. */
66
+ export function send(patch) {
67
+ const auth = scope();
68
+ if (!auth.Authorization)
69
+ return;
70
+ if (read?.auth === auth.Authorization) {
71
+ const was = read.doc;
72
+ read = { auth: auth.Authorization, doc: was.then((doc) => ({ ...(doc ?? {}), ...patch })) };
73
+ }
74
+ void fetch(`${api()}/v1/pref`, {
75
+ method: 'PATCH',
76
+ headers: { ...auth, 'Content-Type': 'application/json' },
77
+ body: JSON.stringify(patch),
78
+ }).catch(() => { });
79
+ }
80
+ function local(key, initial) {
81
+ try {
82
+ const raw = localStorage.getItem(key);
83
+ return raw === null ? initial : JSON.parse(raw);
84
+ }
85
+ catch {
86
+ return initial;
87
+ }
88
+ }
89
+ function keep(key, v) {
90
+ try {
91
+ localStorage.setItem(key, JSON.stringify(v));
92
+ }
93
+ catch {
94
+ /* the account still holds it */
95
+ }
96
+ }
package/dist/speech.js CHANGED
@@ -221,5 +221,5 @@ export function SpeakButton({ text, agentName, compact = false, }) {
221
221
  // speaks. The word for speaking is the one status here, so it alone takes
222
222
  // the success ink (GOOD holds 4.5:1 on either theme); the icons follow the
223
223
  // label through currentColor.
224
- return (_jsx(Button, { variant: speaking ? 'secondary' : 'ghost', size: compact ? 'icon-sm' : 'sm', color: speaking ? GOOD : '$soft', onClick: () => toggle(text, agentName), "aria-label": (speaking ? t('Stop speaking') : listen) + stood, "aria-pressed": speaking, "data-refusal": refusal ? refusal.service : undefined, title: (speaking ? t('Stop speaking') : listenIn) + stood, children: speaking ? (_jsxs(_Fragment, { children: [_jsx(AudioWave, { active: true, color: GOOD }), !compact && t('Speaking…'), _jsx(Square, { size: 10, fill: "currentColor" })] })) : (_jsxs(_Fragment, { children: [_jsx(Volume2, { size: 13 }), !compact && t('Listen')] })) }));
224
+ return (_jsx(Button, { variant: speaking ? 'secondary' : 'ghost', size: compact ? 'icon-sm' : 'sm', color: speaking ? GOOD : '$soft', onClick: () => toggle(text, agentName), "aria-label": (speaking ? t('Stop speaking') : listen) + stood, "aria-pressed": speaking, "data-refusal": refusal ? refusal.service : undefined, title: (speaking ? t('Stop speaking') : listenIn) + stood, children: speaking ? (_jsxs(_Fragment, { children: [_jsx(AudioWave, { active: true, color: GOOD }), !compact && t('Speaking…'), _jsx(Square, { size: 9, fill: "currentColor" })] })) : (_jsxs(_Fragment, { children: [_jsx(Volume2, { size: 12, strokeWidth: 1.75 }), !compact && t('Listen')] })) }));
225
225
  }
package/dist/thread.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
2
  import type { Thread } from '@hanzo/ai';
3
+ export type { Thread };
3
4
  export interface ThreadList {
4
5
  threads: Thread[];
5
6
  loading: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.2.44",
3
+ "version": "0.2.46",
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",