@hanzo/app 0.3.93 → 0.3.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/Account.d.ts +9 -3
  2. package/dist/Account.js +142 -141
  3. package/dist/App.js +71 -37
  4. package/dist/Bar.js +1 -1
  5. package/dist/Betas.d.ts +1 -1
  6. package/dist/Betas.js +16 -22
  7. package/dist/Board.js +113 -47
  8. package/dist/CalScheduler.d.ts +1 -0
  9. package/dist/CalScheduler.js +223 -57
  10. package/dist/Chat.js +432 -153
  11. package/dist/Contacts.js +35 -31
  12. package/dist/ContextMenu.js +126 -42
  13. package/dist/Directory.js +1 -1
  14. package/dist/Drawer.js +1 -1
  15. package/dist/Drive.js +351 -119
  16. package/dist/Gate.js +156 -13
  17. package/dist/Home.js +31 -53
  18. package/dist/Inbox.js +29 -15
  19. package/dist/InlineRename.d.ts +6 -0
  20. package/dist/InlineRename.js +41 -0
  21. package/dist/Learning.js +132 -13
  22. package/dist/Market.js +13 -9
  23. package/dist/Meet.d.ts +5 -0
  24. package/dist/Meet.js +75 -51
  25. package/dist/MoreMenu.d.ts +19 -0
  26. package/dist/MoreMenu.js +33 -0
  27. package/dist/NeedMoreUsage.js +2 -2
  28. package/dist/OrgSwitcher.js +6 -2
  29. package/dist/Rail.d.ts +73 -7
  30. package/dist/Rail.js +372 -111
  31. package/dist/Recents.js +77 -24
  32. package/dist/RightPane.js +2 -2
  33. package/dist/Search.d.ts +13 -1
  34. package/dist/Search.js +366 -50
  35. package/dist/Setup.js +34 -5
  36. package/dist/Shared.js +12 -12
  37. package/dist/Shell.js +210 -151
  38. package/dist/Sidebar.d.ts +14 -3
  39. package/dist/Sidebar.js +411 -129
  40. package/dist/SkipLink.d.ts +8 -0
  41. package/dist/SkipLink.js +11 -0
  42. package/dist/Start.js +51 -52
  43. package/dist/Terminals.js +159 -11
  44. package/dist/ToBottom.js +1 -1
  45. package/dist/Upgrade.d.ts +8 -3
  46. package/dist/Upgrade.js +194 -103
  47. package/dist/Usage.d.ts +1 -1
  48. package/dist/Usage.js +186 -82
  49. package/dist/WalletPill.js +8 -2
  50. package/dist/Work.js +162 -53
  51. package/dist/archive.d.ts +8 -0
  52. package/dist/archive.js +16 -0
  53. package/dist/bots/Bots.js +1 -1
  54. package/dist/bots/ComputerDialog.js +53 -26
  55. package/dist/bots/ConnectorsDialog.js +34 -15
  56. package/dist/bots/Make.js +5 -1
  57. package/dist/bots/Panel.js +37 -31
  58. package/dist/bots/Roster.js +18 -13
  59. package/dist/bots/Thread.js +54 -27
  60. package/dist/bots/face.js +6 -2
  61. package/dist/bots/kit.d.ts +1 -0
  62. package/dist/bots/kit.js +1 -1
  63. package/dist/bots/refusal.d.ts +13 -4
  64. package/dist/bots/refusal.js +62 -8
  65. package/dist/chord.d.ts +13 -0
  66. package/dist/chord.js +30 -1
  67. package/dist/crew.js +47 -4
  68. package/dist/ground.d.ts +1 -1
  69. package/dist/ground.js +1 -1
  70. package/dist/help.d.ts +7 -3
  71. package/dist/help.js +19 -14
  72. package/dist/keys.d.ts +28 -0
  73. package/dist/keys.js +58 -0
  74. package/dist/lib/arrival.d.ts +5 -0
  75. package/dist/lib/arrival.js +10 -0
  76. package/dist/lib/betas.d.ts +2 -0
  77. package/dist/lib/betas.js +10 -0
  78. package/dist/lib/branch.d.ts +11 -0
  79. package/dist/lib/branch.js +11 -0
  80. package/dist/lib/chatPreferences.d.ts +1 -1
  81. package/dist/lib/chatPreferences.js +1 -1
  82. package/dist/lib/dev-mode.d.ts +18 -0
  83. package/dist/lib/dev-mode.js +102 -0
  84. package/dist/lib/info-hint.d.ts +7 -0
  85. package/dist/lib/info-hint.js +8 -0
  86. package/dist/lib/model-picker.d.ts +2 -0
  87. package/dist/lib/model-picker.js +12 -0
  88. package/dist/lib/owners.d.ts +5 -0
  89. package/dist/lib/owners.js +15 -0
  90. package/dist/lib/pay.d.ts +2 -0
  91. package/dist/lib/pay.js +4 -0
  92. package/dist/lib/todo.d.ts +6 -0
  93. package/dist/lib/todo.js +37 -25
  94. package/dist/look.js +39 -8
  95. package/dist/rail-open.d.ts +9 -0
  96. package/dist/rail-open.js +34 -0
  97. package/dist/renaming.d.ts +10 -0
  98. package/dist/renaming.js +25 -0
  99. package/dist/thread.d.ts +2 -1
  100. package/dist/thread.js +85 -44
  101. package/package.json +11 -11
package/dist/Shell.js CHANGED
@@ -17,23 +17,24 @@ import { createContext, lazy, Suspense, useCallback, useContext, useEffect, useM
17
17
  import { createPortal } from "react-dom";
18
18
  import { phrase } from "@hanzo/i18n";
19
19
  import { useI18n } from "@hanzo/i18n/react";
20
- import { MessageSquare, Code2, Inbox, Bot, ListChecks, HardDrive, Settings2, UserPlus, PanelLeftClose, SearchIcon, Hash, AtSign, Lock, Workflow, Plus, ArrowLeft, ArrowRight, Send, Minus, Blocks, Star, FolderOpen, Activity, BookOpen, SquareTerminal, Share2, PanelLeft, PanelRight, Users, Globe, Cpu, Boxes, Wallet, Video, Calendar, LayoutGrid, ArrowUpLeft, Sparkles, } from "lucide-react";
20
+ import { MessageSquare, Code2, Inbox, Bot, ListChecks, HardDrive, Settings, UserPlus, SearchIcon, Hash, AtSign, Lock, Workflow, Plus, ArrowLeft, ArrowRight, Send, Minus, Blocks, Star, FolderOpen, Activity, BookOpen, Share2, PanelLeft, PanelRight, Users, Globe, Cpu, Boxes, Wallet, Video, Calendar, LayoutGrid, ArrowUpLeft, Building2, ChevronDown, LogOut, Sparkles, } from "lucide-react";
21
21
  import { AiProvider, useAgents, useInbox, useModels, usePeople, } from "@hanzo/ai/react";
22
22
  import { PINNED } from "./recent.js";
23
23
  import { ConversationMenu, ThreadRow, useThreadList } from "./thread.js";
24
24
  import { useKept } from "./kept.js";
25
- import { Box, Shortcut, XStack, YStack, Text } from "@hanzo/ui";
25
+ import { Badge, Box, Button, DropdownMenu, HoverCard, HoverCardContent, HoverCardTrigger, Progress, Shortcut, Switch, Text, toast, View, XStack, YStack, } from "@hanzo/ui";
26
26
  // THE PAPER LADDER. `sheet(n)` is a fill AND the light on it, published as a
27
27
  // pair by @hanzo/design, so a surface asks for a HEIGHT instead of composing a
28
28
  // shadow — which is the only way three panels on one screen end up lit from one
29
29
  // direction. `scrim` is the dim under anything that lifts off the page.
30
30
  import { scrim, sheet } from "@hanzo/ui/glass";
31
31
  import { Sidebar, SidebarIconButton, SidebarNewChat, SidebarScroll, SidebarSection, SidebarItem, SidebarFolder, } from "@hanzo/ui/chat";
32
- import { OrgProjectSwitcher, useIam, useOrganizations, } from "@hanzo/iam/react";
32
+ import { useIam, useOrganizations, } from "@hanzo/iam/react";
33
33
  import { Gutter, SideProvider, useSplit } from "@hanzo/build";
34
+ import { label as planLabel } from "@hanzo/build/plan";
34
35
  import { restoreActiveMod } from "@hanzo/mod";
35
36
  import { HanzoMark, } from "@hanzogui/shell";
36
- import { BUSINESS_APPS, BusinessHeader } from "@hanzo/ui/product";
37
+ import { BUSINESS_APPS } from "@hanzo/ui/product";
37
38
  import { useAccounts } from "./lib/accounts.js";
38
39
  import { useHydrated } from "./lib/hydrated.js";
39
40
  import { useHostname } from "./lib/hostname.js";
@@ -54,9 +55,13 @@ import { parseModels } from "@hanzo/ui/models/catalog";
54
55
  import { mark } from "./lib/mark.js";
55
56
  import { useOpen } from "./open.js";
56
57
  import { useSpan } from "./span.js";
57
- import { BAR, pane, RAIL } from "./ground.js";
58
+ import { pane, RAIL } from "./ground.js";
58
59
  import { useFree } from "./Upgrade.js";
59
60
  import { payUrl } from "./lib/pay.js";
61
+ import { rememberSettingsReturn, useDevMode } from "./lib/dev-mode.js";
62
+ import { useLimits } from "./lib/limits.js";
63
+ import { cents } from "./lib/org.js";
64
+ import { useTier } from "./lib/tier.js";
60
65
  /** The new-agent row's fields: an outlined box in the shell's own ink. */
61
66
  const FIELD = {
62
67
  bg: "transparent",
@@ -84,12 +89,13 @@ import { netKey } from "./conversations.js";
84
89
  import { FIRST, SettingsList, } from "./Settings.js";
85
90
  import { Search } from "./Search.js";
86
91
  import { tidy } from "./lib/title.js";
87
- import { summons } from "./seek.js";
92
+ import { MAIN, SkipLink } from "./SkipLink.js";
93
+ import { useSidebar } from "./rail-open.js";
94
+ import { useGlobalKeys } from "./keys.js";
95
+ import { useDevHost } from "./dev.js";
88
96
  import { called } from "./team.js";
89
97
  import { checkoutUrl } from './lib/pay.js';
90
98
  import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowControls.js';
91
- /** Tabs: the terminals, at their own host. */
92
- const TABS = "https://tabs.hanzo.ai/app";
93
99
  /** Where a plan is chosen. `lib/plans` owns the address; this is the door. */
94
100
  const BILLING = checkoutUrl();
95
101
  /**
@@ -123,11 +129,13 @@ const TAP = { minWidth: 44, minHeight: 44 };
123
129
  * element that also carries the border makes the target visible, which is how
124
130
  * the sign-in button came to stand half again as tall as the field beside it. */
125
131
  const CONTROL = 28;
132
+ /** The workspace shell's top bar height, px: accommodates 44px touch targets without clipping. */
133
+ const SHELL_BAR = 48;
126
134
  import { getStoredPeople, getStoredAgents, getCustomThreads, createDirectChat, } from "./contacts-store.js";
127
135
  import { bare } from './lib/bare.js';
128
136
  import { BAD } from './lib/mix.js';
129
- import { brand, site, where, wordmark } from './where.js';
130
- import { Tiles } from './OrgSwitcher.js';
137
+ import { brand, site, where } from './where.js';
138
+ import { Tiles, TopOrgSelector } from './OrgSwitcher.js';
131
139
  /** The pane while a settings row is open, loaded when one is: none of it is an app's first screen. */
132
140
  const SettingsPane = lazy(() => import('./SettingsPane.js').then((m) => ({ default: m.SettingsPane })));
133
141
  /**
@@ -218,7 +226,7 @@ const PLACES = [
218
226
  {
219
227
  id: "contacts",
220
228
  route: "/contacts",
221
- title: phrase("People & Agents"),
229
+ title: phrase("People & agents"),
222
230
  label: phrase("Contacts"),
223
231
  icon: Users,
224
232
  },
@@ -447,7 +455,7 @@ function Chats({ filter = "", onPick, }) {
447
455
  }, []);
448
456
  const { isAuthenticated, user } = useIam();
449
457
  const { user: account } = useAccount();
450
- const { accounts: browserAccounts, current: currentBrowserAccount, switchTo: switchToAccount, add: addAccount } = useAccounts();
458
+ const { current: currentBrowserAccount } = useAccounts();
451
459
  const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
452
460
  const free = useFree(signedIn);
453
461
  const mergedThreads = useMemo(() => {
@@ -669,7 +677,7 @@ function Team({ filter = "", onPick, navigate, }) {
669
677
  const { channels, wrong } = useChannels();
670
678
  const { isAuthenticated, user } = useIam();
671
679
  const { user: account } = useAccount();
672
- const { accounts: browserAccounts, current: currentBrowserAccount, switchTo: switchToAccount, add: addAccount } = useAccounts();
680
+ const { current: currentBrowserAccount } = useAccounts();
673
681
  const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
674
682
  const free = useFree(signedIn);
675
683
  const [starred] = useStarred();
@@ -696,15 +704,15 @@ function Team({ filter = "", onPick, navigate, }) {
696
704
  openChannel(teamKey(one));
697
705
  navigate?.(channelHref(teamKey(one)));
698
706
  onPick?.();
699
- }, children: one.name }, one.id))) })) : null, publicChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Public Channels"), defaultOpen: true, children: publicChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Globe, { size: 13, "aria-hidden": true }), onPress: () => {
707
+ }, children: one.name }, one.id))) })) : null, publicChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Public channels"), defaultOpen: true, children: publicChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Globe, { size: 13, "aria-hidden": true }), onPress: () => {
700
708
  openChannel(teamKey(one));
701
709
  navigate?.(channelHref(teamKey(one)));
702
710
  onPick?.();
703
- }, children: one.name }, one.id))) })) : null, orgChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Org Channels"), defaultOpen: true, children: orgChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Hash, { size: 13, "aria-hidden": true }), onPress: () => {
711
+ }, children: one.name }, one.id))) })) : null, orgChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Org channels"), defaultOpen: true, children: orgChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Hash, { size: 13, "aria-hidden": true }), onPress: () => {
704
712
  openChannel(teamKey(one));
705
713
  navigate?.(channelHref(teamKey(one)));
706
714
  onPick?.();
707
- }, children: one.name }, one.id))) })) : null, privateChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Private Channels"), defaultOpen: true, children: privateChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Lock, { size: 13, "aria-hidden": true }), onPress: () => {
715
+ }, children: one.name }, one.id))) })) : null, privateChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Private channels"), defaultOpen: true, children: privateChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Lock, { size: 13, "aria-hidden": true }), onPress: () => {
708
716
  openChannel(teamKey(one));
709
717
  navigate?.(channelHref(teamKey(one)));
710
718
  onPick?.();
@@ -885,15 +893,15 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
885
893
  setBusy(false);
886
894
  }
887
895
  };
888
- return (_jsxs(YStack, { children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$3", py: "$1", rounded: "$2", hoverStyle: { bg: "$hover" }, children: [_jsx(Box, { render: "button", onClick: () => navigate?.(show === "agents" ? "/bots" : "/contacts"), flex: 1, minW: 0, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$2", color: "$quiet", numberOfLines: 1, children: t(show === "agents" ? "Agents" : "People") }), folk.length + shown.length > 0 ? (_jsx(Text, { fontSize: "$1", color: "$soft", "data-i18n-ltr": "", children: folk.length + shown.length })) : null] }) }), _jsx(Box, { render: "button", onClick: (e) => {
896
+ return (_jsxs(YStack, { children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$3", py: "$1", rounded: "$2", hoverStyle: { bg: "$hover" }, children: [_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => navigate?.(show === "agents" ? "/bots" : "/contacts"), flex: 1, minW: 0, minH: 28, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, borderWidth: 0, bg: "transparent", cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$soft", numberOfLines: 1, children: t(show === "agents" ? "Agents" : "People") }), folk.length + shown.length > 0 ? (_jsx(Text, { fontSize: "$1", color: "$hint", fontVariant: ["tabular-nums"], "data-i18n-ltr": "", children: folk.length + shown.length })) : null] }) }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: (e) => {
889
897
  e.stopPropagation();
890
898
  setSortMode((m) => (m === "alpha" ? "recent" : "alpha"));
891
- }, title: t(sortMode === "alpha" ? "Sorting A-Z (Click for Recent)" : "Sorting Recent (Click for A-Z)"), px: "$1.5", py: "$0.5", rounded: "$1", bg: "$raised", hoverStyle: { opacity: 0.8 }, display: "flex", items: "center", justify: "center", $touchable: { minH: 40, minW: 40 }, children: _jsx(Text, { fontSize: 12, fontWeight: "600", color: "$soft", children: t(sortMode === "alpha" ? "A-Z" : "Recent") }) }), show === "agents" ? (_jsx(Box, { render: "button", onClick: () => {
899
+ }, title: t(sortMode === "alpha" ? "Sorting A-Z (Click for Recent)" : "Sorting Recent (Click for A-Z)"), px: "$1.5", py: "$0.5", rounded: "$1", borderWidth: 0, bg: "$raised", cursor: "pointer", hoverStyle: { opacity: 0.8 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, display: "flex", items: "center", justify: "center", $touchable: { minH: 44, minW: 44 }, "$max-sm": { minH: 44, minW: 44 }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$soft", children: t(sortMode === "alpha" ? "A-Z" : "Recent") }) }), show === "agents" ? (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => {
892
900
  if (busy)
893
901
  return;
894
902
  setOpen(true);
895
903
  setMaking((v) => !v);
896
- }, "aria-disabled": busy, "aria-expanded": making, "aria-label": t("New agent"), p: "$1", rounded: "$2", hoverStyle: { bg: "$raised" }, children: _jsx(Plus, { size: 14, "aria-hidden": true }) })) : null] }), open && making ? (_jsxs(YStack, { paddingInlineStart: "$4", paddingInlineEnd: "$3", py: "$2", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { render: "button", onClick: () => picking.current?.click(), "aria-label": t("Pick a picture"), rounded: 9999, children: _jsx(Face, { src: avatar, emoji: emoji, name: name || "?", size: 32, person: true }) }), _jsx("input", { ref: picking, type: "file", hidden: true, accept: "image/png,image/jpeg,image/gif,image/webp", onChange: (e) => {
904
+ }, "aria-disabled": busy, "aria-expanded": making, "aria-label": t("New agent"), p: "$1", rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", display: "flex", items: "center", justify: "center", $touchable: { minH: 44, minW: 44 }, "$max-sm": { minH: 44, minW: 44 }, hoverStyle: { bg: "$raised" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(Plus, { size: 14, "aria-hidden": true }) })) : null] }), open && making ? (_jsxs(YStack, { paddingInlineStart: "$4", paddingInlineEnd: "$3", py: "$2", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => picking.current?.click(), "aria-label": t("Pick a picture"), rounded: 9999, borderWidth: 0, bg: "transparent", cursor: "pointer", $touchable: { minW: 44, minH: 44 }, "$max-sm": { minW: 44, minH: 44 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(Face, { src: avatar, emoji: emoji, name: name || "?", size: 32, person: true }) }), _jsx("input", { ref: picking, type: "file", hidden: true, accept: "image/png,image/jpeg,image/gif,image/webp", onChange: (e) => {
897
905
  void pick(e.target.files?.[0]);
898
906
  e.target.value = "";
899
907
  } }), _jsx(Text, { render: _jsx("input", { value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
@@ -905,10 +913,10 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
905
913
  setEmoji(e.target.value);
906
914
  if (e.target.value)
907
915
  setAvatar("");
908
- }, placeholder: "\uD83D\uDE42", "aria-label": t("Emoji") }), ...FIELD, width: 44, text: "center", px: 4 }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(ModelPicker, { models: listed, scope: "chat", value: model, onChange: setModel, size: "sm", placeholder: t("Choose a model"), name: t("Model") }) }), _jsx(Box, { render: "button", onClick: () => {
916
+ }, placeholder: "\uD83D\uDE42", "aria-label": t("Emoji") }), ...FIELD, width: 44, text: "center", px: 4 }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(ModelPicker, { models: listed, scope: "chat", value: model, onChange: setModel, size: "sm", placeholder: t("Choose a model"), name: t("Model") }) }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => {
909
917
  if (!busy)
910
918
  void add();
911
- }, "aria-disabled": busy || !name.trim(), opacity: busy || !name.trim() ? 0.5 : 1, px: "$2.5", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$raised" }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t(busy ? "Adding" : "Add") }) })] }), wrong ? (_jsx(Text, { fontSize: "$1", color: BAD, numberOfLines: 2, children: wrong })) : null] })) : null, open ? (_jsxs(YStack, { paddingInlineStart: "$4", gap: "$0.5", children: [broke ? (_jsx(Note, { children: say(broke, t("this org's roster"), "read", t) })) : waiting && empty ? (_jsx(Note, { children: t("Reading the roster.") })) : empty ? (_jsx(Note, { children: t(show === "agents" ? "No agents yet. Add one with +." : "No one here yet. Invite a teammate.") })) : null, folk.map((person) => {
919
+ }, "aria-disabled": busy || !name.trim(), opacity: busy || !name.trim() ? 0.5 : 1, px: "$2.5", py: "$1.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, rounded: "$2", borderWidth: 1, borderColor: "$borderColor", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$raised" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t(busy ? "Adding" : "Add") }) })] }), wrong ? (_jsx(Text, { fontSize: "$1", color: BAD, numberOfLines: 2, children: wrong })) : null] })) : null, open ? (_jsxs(YStack, { paddingInlineStart: "$4", gap: "$0.5", children: [broke ? (_jsx(Note, { children: say(broke, t("this org's roster"), "read", t) })) : waiting && empty ? (_jsx(Note, { children: t("Reading the roster.") })) : empty ? (_jsx(Note, { children: t(show === "agents" ? "No agents yet. Add one with +." : "No one here yet. Invite a teammate.") })) : null, folk.map((person) => {
912
920
  const called = person.displayName || person.name;
913
921
  return (_jsx(SidebarItem, { icon: _jsx(Face, { name: called, src: person.avatar, size: 20, person: true }), onPress: () => {
914
922
  const threadId = createDirectChat({
@@ -932,7 +940,7 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
932
940
  withAgents([called(agent.name)]);
933
941
  navigate?.("/chat");
934
942
  onPick?.();
935
- }, children: called(agent.name) }) }), _jsx(Box, { render: "button", onClick: () => {
943
+ }, children: called(agent.name) }) }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => {
936
944
  if (busy)
937
945
  return;
938
946
  if (arming === agent.id)
@@ -941,7 +949,7 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
941
949
  setArming(agent.id);
942
950
  }, "aria-label": arming === agent.id
943
951
  ? t("Remove {name}", { name: called(agent.name) })
944
- : t("Remove {name}?", { name: called(agent.name) }), p: "$1", rounded: "$2", opacity: arming === agent.id ? 1 : 0.45, hoverStyle: { opacity: 1, bg: "$raised" }, children: arming === agent.id ? (_jsx(Text, { fontSize: "$1", color: BAD, children: t("Remove") })) : (_jsx(Minus, { size: 13, "aria-hidden": true })) })] }, agent.id))), _jsx(SidebarItem, { icon: _jsx(Blocks, { size: 13, "aria-hidden": true }), onPress: () => {
952
+ : t("Remove {name}?", { name: called(agent.name) }), p: "$1", $touchable: { minW: 44, minH: 44 }, "$max-sm": { minW: 44, minH: 44 }, rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", opacity: arming === agent.id ? 1 : 0.45, hoverStyle: { opacity: 1, bg: "$raised" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: arming === agent.id ? (_jsx(Text, { fontSize: "$1", color: BAD, children: t("Remove") })) : (_jsx(Minus, { size: 13, "aria-hidden": true })) })] }, agent.id))), _jsx(SidebarItem, { icon: _jsx(Blocks, { size: 13, "aria-hidden": true }), onPress: () => {
945
953
  setArming(null);
946
954
  onPick?.();
947
955
  navigate?.("/contacts");
@@ -951,9 +959,9 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
951
959
  const TABS_HEIGHT = "calc(56px + env(safe-area-inset-bottom))";
952
960
  /** The sidebar's width, px: the floor a drag holds, the ceiling, and the default a double-click returns to. */
953
961
  const FLOOR = 200;
954
- const CEIL = 480;
962
+ const CEIL = 420;
955
963
  /** Per-reader, per-browser. A width that resets is a width you set every load. */
956
- const SPAN = "hanzo.sidebar.span";
964
+ const SPAN = "hanzo.app.column";
957
965
  /** The shell's sidebar: its default width, px. */
958
966
  const SIDEBAR_WIDTH = 280;
959
967
  /**
@@ -1015,7 +1023,7 @@ export function Split({ children, swap, framed = false, bare = false, }) {
1015
1023
  if (!aside)
1016
1024
  setSlot(null);
1017
1025
  }, [aside]);
1018
- return (_jsxs(_Fragment, { children: [_jsxs(YStack, { render: "main", "data-slot": "pane", gridArea: "pane", position: "relative", ...(framed
1026
+ return (_jsxs(_Fragment, { children: [_jsxs(YStack, { ...MAIN, "data-slot": "pane", gridArea: "pane", position: "relative", ...(framed
1019
1027
  ? bare
1020
1028
  ? null
1021
1029
  : { ...pane(), overflow: "hidden" }
@@ -1024,8 +1032,8 @@ export function Split({ children, swap, framed = false, bare = false, }) {
1024
1032
  // The edge the pane shares with the column before it: the left, or the right in a right-to-left language.
1025
1033
  borderInlineStartWidth: 1,
1026
1034
  borderInlineStartStyle: "solid",
1027
- borderColor: "var(--edge, var(--white-06))",
1028
- }), ref: split.main, width: "100%", height: "100%", minW: 0, minH: 0, children: [swap ?? (_jsx(Framed.Provider, { value: framed, children: _jsx(SideProvider, { value: split.side, children: _jsx(Slot.Provider, { value: slot, children: children }) }) })), !aside && !swap ? (_jsx(YStack, { "data-slot": "side-pull", "aria-label": t("Pull to open tabs"), ...{ title: t("Drag to open split browser") }, position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: 10, z: 10, items: "center", justify: "center", cursor: "col-resize", display: "none", $lg: { display: "flex" }, ...{ touchAction: "none" }, onDoubleClick: () => showAside("tasks"), onPointerDown: (e) => {
1035
+ borderColor: "var(--edge, var(--border))",
1036
+ }), ref: split.main, width: "100%", height: "100%", minW: 0, minH: 0, children: [swap ?? (_jsx(Framed.Provider, { value: framed, children: _jsx(SideProvider, { value: split.side, children: _jsx(Slot.Provider, { value: slot, children: children }) }) })), !aside && !swap ? (_jsx(YStack, { "data-slot": "side-pull", "aria-hidden": true, ...{ title: t("Drag to open split browser") }, position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: 10, z: 10, items: "center", justify: "center", cursor: "col-resize", display: "none", $lg: { display: "flex" }, ...{ touchAction: "none" }, onDoubleClick: () => showAside("tasks"), onPointerDown: (e) => {
1029
1037
  if (e.button !== 0)
1030
1038
  return;
1031
1039
  e.preventDefault();
@@ -1081,9 +1089,39 @@ function Leave({ href, children }) {
1081
1089
  window.location.assign(href);
1082
1090
  }, children: children }));
1083
1091
  }
1084
- function Rail({ mode, places, team, open, navigate, onSettings, onMore, }) {
1092
+ function ShellProfileHover({ name, email, avatar, orgId, signedIn, onSettings, onSignOut, children, }) {
1085
1093
  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": {
1094
+ const [devMode, setDevMode] = useDevMode();
1095
+ const { limits } = useLimits(signedIn, orgId || null);
1096
+ const { tier } = useTier(signedIn && Boolean(orgId), orgId || null);
1097
+ const planInfo = limits?.plan
1098
+ ? planLabel(limits.plan)
1099
+ : tier?.plan
1100
+ ? planLabel(tier.plan)
1101
+ : null;
1102
+ const planName = planInfo
1103
+ ? `${planInfo.name}${planInfo.tag ? ` ${planInfo.tag}` : ""}`
1104
+ : tier?.tier?.displayName || t("Free");
1105
+ const classEntries = limits ? Object.values(limits.classes).filter(Boolean) : [];
1106
+ const highestUsage = classEntries.length
1107
+ ? Math.round(Math.max(0, ...classEntries.flatMap((c) => (c ? [c.percent, ...(c.window ? [c.window.percent] : [])] : []))))
1108
+ : null;
1109
+ const hasCredits = typeof tier?.balance?.effectiveAvailable === "number";
1110
+ const creditsLabel = hasCredits
1111
+ ? cents(tier.balance.effectiveAvailable, tier.balance.currency || "usd")
1112
+ : null;
1113
+ return (_jsxs(HoverCard, { openDelay: 120, closeDelay: 150, children: [_jsx(HoverCardTrigger, { asChild: true, children: children }), _jsx(HoverCardContent, { side: "top", align: "start", sideOffset: 8, width: 264, p: "$3.5", rounded: "$5", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", z: "var(--z-popover)", children: _jsxs(YStack, { gap: "$3", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, children: [_jsx(Face, { src: avatar, name: name || "You", size: 32, person: true }), _jsxs(YStack, { flex: 1, minW: 0, gap: 1, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: name || t("You") }), email && email !== name ? (_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$hint", numberOfLines: 1, children: email })) : null] }), _jsx(Badge, { variant: "secondary", size: "sm", children: planName })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsxs(XStack, { justify: "space-between", items: "baseline", gap: "$2", children: [_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$aside", children: t("Plan usage") }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$ink", fontVariant: ["tabular-nums"], children: highestUsage !== null ? `${highestUsage}%` : t("Included") })] }), _jsx(Progress, { value: Math.min(100, highestUsage ?? 0), height: 4, indicatorColor: (highestUsage ?? 0) >= 90
1114
+ ? "var(--state-error)"
1115
+ : "var(--state-success)", "aria-label": t("Plan usage") }), creditsLabel ? (_jsxs(XStack, { justify: "space-between", items: "center", pt: "$0.5", children: [_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$aside", children: t("Extra credits") }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "600", color: "$ink", fontVariant: ["tabular-nums"], children: creditsLabel })] })) : null] }), _jsx(View, { height: 1, bg: "$edge" }), _jsxs(XStack, { justify: "space-between", items: "center", gap: "$2", children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$ink", children: t("Developer mode") }), _jsx(Switch, { checked: devMode, onCheckedChange: setDevMode, size: "sm", "aria-label": t("Developer mode") })] }), _jsxs(XStack, { gap: "$2", children: [_jsx(Button, { type: "button", size: "xs", variant: "outline", borderColor: "var(--border-strong)", flex: 1, onClick: () => {
1116
+ rememberSettingsReturn();
1117
+ onSettings();
1118
+ }, children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "500", color: "$ink", children: t("Settings") }) }), _jsxs(Button, { type: "button", size: "xs", flex: 1, onClick: () => {
1119
+ window.location.assign(payUrl("/cart", { returnUrl: window.location.href }));
1120
+ }, children: [_jsx(Sparkles, { size: 12, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "600", color: "var(--primary-foreground)", children: t("Upgrade") })] })] }), onSignOut ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: onSignOut, items: "center", gap: "$2", px: "$2", py: "$1.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, rounded: "$3", borderWidth: 0, cursor: "pointer", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(LogOut, { size: 13, color: "var(--state-error)", "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "500", color: "var(--state-error)", children: t("Sign out") })] })) : null] }) })] }));
1121
+ }
1122
+ function Rail({ mode, places, team, open, hiddenOnDesktop = false, navigate, onMore, avatarSlot, }) {
1123
+ const { t } = useI18n();
1124
+ 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))", $md: hiddenOnDesktop ? { display: "none" } : undefined, "$max-md": {
1087
1125
  flexDirection: "row",
1088
1126
  items: "center",
1089
1127
  borderInlineEndWidth: 0,
@@ -1091,16 +1129,18 @@ function Rail({ mode, places, team, open, navigate, onSettings, onMore, }) {
1091
1129
  borderTopColor: "var(--border)",
1092
1130
  },
1093
1131
  // Clear of the home indicator on a phone; zero on a flat screen.
1094
- pb: HOME_INDICATOR, children: [_jsx(YStack, { "$max-md": { display: "none" }, borderBottomWidth: 1, borderColor: "var(--edge, var(--white-06))", mx: "$2", children: _jsx(Tiles, {}) }), _jsxs(YStack, { "data-slot": "places", ...bare, items: "center", gap: "$0.5", flex: 1, minW: 0, minH: 0, overflowY: "auto", pt: "$2", $md: open ? { display: "none" } : undefined, "$max-md": {
1132
+ pb: HOME_INDICATOR, children: [_jsx(YStack, { "$max-md": { display: "none" }, borderBottomWidth: 1, borderColor: "var(--edge, var(--white-06))", mx: "$2", children: _jsx(Tiles, {}) }), _jsxs(YStack, { "data-slot": "places", ...bare, items: "center", gap: "$0.5", flex: 1, minW: 0, minH: 0, overflowY: "auto", overflowX: "hidden", pt: "$2", $md: open ? { display: "none" } : undefined, "$max-md": {
1095
1133
  display: "grid",
1096
1134
  gridAutoFlow: "column",
1097
1135
  gridAutoColumns: "minmax(0, 1fr)",
1098
1136
  justifyItems: "stretch",
1099
1137
  overflow: "hidden",
1138
+ pt: 0,
1139
+ px: "$1",
1100
1140
  }, children: [places.map((place, i) => {
1101
1141
  const here = place.id === mode;
1102
- return (_jsxs(Box, { render: "button", onClick: () => navigate?.(place.route), "aria-label": t(place.label), "aria-current": here ? "page" : undefined, title: place.name ?? (place.title ? t(place.title) : t(place.label)), display: "flex", "$max-md": { display: i < 4 ? "flex" : "none", width: "auto", minW: 0 }, flexDirection: "column", width: 40, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, bg: here ? "$edge" : undefined, hoverStyle: { bg: here ? "$edge" : "$hover" }, children: [_jsx(place.icon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: here ? "$ink" : "$quiet", numberOfLines: 1, children: t(place.label) })] }, place.id));
1103
- }), team ? (_jsx(XStack, { "$max-md": { display: places.length < 4 ? "flex" : "none", width: "auto", minW: 0 }, children: _jsx(Text, { render: _jsx("a", { href: team, "aria-label": t("Workspace"), title: "Hanzo Team" }), display: "flex", width: RAIL, color: "inherit", children: _jsxs(Box, { display: "flex", flex: 1, flexDirection: "column", minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(LayoutGrid, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: "$quiet", numberOfLines: 1, children: t("Workspace") })] }) }) })) : null, _jsxs(Box, { "data-slot": "more", render: "button", onClick: onMore, "aria-label": t("More places"), title: t("More"), display: "none", "$max-md": { display: "flex", width: "auto", minW: 0 }, flexDirection: "column", width: RAIL, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(SearchIcon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: "$quiet", children: t("More") })] })] }), _jsx(YStack, { items: "center", pb: "$2", $md: open ? { display: "none" } : undefined, children: _jsxs(Box, { render: "button", onClick: onSettings, "aria-label": t("Settings"), title: t("Settings"), display: "flex", flexDirection: "column", width: RAIL, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(Settings2, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: "$quiet", children: t("Settings") })] }) })] }));
1142
+ return (_jsxs(Box, { render: _jsx("button", { type: "button" }), onClick: () => navigate?.(place.route), "aria-label": t(place.label), "aria-current": here ? "page" : undefined, title: place.name ?? (place.title ? t(place.title) : t(place.label)), display: "flex", "$max-md": { display: i < 4 ? "flex" : "none", width: "auto", minW: 0 }, flexDirection: "column", width: 40, minH: 44, py: "$1", rounded: "$2", borderWidth: 0, items: "center", justify: "center", gap: 2, cursor: "pointer", bg: here ? "$raised" : "transparent", hoverStyle: { bg: here ? "$raised" : "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(place.icon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 14, fontWeight: here ? "500" : "400", color: here ? "$ink" : "$quiet", numberOfLines: 1, children: t(place.label) })] }, place.id));
1143
+ }), team ? (_jsx(XStack, { "$max-md": { display: places.length < 4 ? "flex" : "none", width: "auto", minW: 0 }, children: _jsx(Text, { render: _jsx("a", { href: team, "aria-label": t("Workspace"), title: "Hanzo Team" }), display: "flex", width: RAIL, color: "inherit", children: _jsxs(Box, { display: "flex", flex: 1, flexDirection: "column", minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(LayoutGrid, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 14, color: "$quiet", numberOfLines: 1, children: t("Workspace") })] }) }) })) : null, _jsxs(Box, { "data-slot": "more", render: _jsx("button", { type: "button" }), onClick: onMore, "aria-label": t("More places"), title: t("More"), display: "none", "$max-md": { display: "flex", width: "auto", minW: 0 }, flexDirection: "column", width: RAIL, minH: 44, py: "$1", rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(SearchIcon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 14, color: "$quiet", children: t("More") })] })] }), avatarSlot ? (_jsx(YStack, { items: "center", pb: "$2", "$max-md": { display: "none" }, $md: open ? { display: "none" } : undefined, children: avatarSlot })) : null] }));
1104
1144
  }
1105
1145
  /**
1106
1146
  * Chat's column: start a chat, the projects, then every conversation. The app
@@ -1114,19 +1154,20 @@ function App({ filter, onPick, navigate, }) {
1114
1154
  navigate?.(dev(slug));
1115
1155
  onPick?.();
1116
1156
  };
1117
- return (_jsxs(_Fragment, { children: [_jsx(SidebarNewChat, { label: t("New chat"), onPress: () => {
1157
+ return (_jsxs(_Fragment, { children: [_jsx(SidebarNewChat, { label: t("New chat"), gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, onPress: () => {
1118
1158
  empty();
1119
1159
  onPick?.();
1120
1160
  } }), _jsx(SidebarFolder, { name: t("Projects"), open: filter ? true : undefined, children: _jsx(Projects, { filter: filter, onPick: open }) }), _jsx(Chats, { filter: filter, onPick: onPick })] }));
1121
1161
  }
1122
1162
  /** What a place holds, for the list column. */
1123
1163
  function Index({ mode, owner, filter, onPick, navigate, }) {
1164
+ const { t } = useI18n();
1124
1165
  const channels = (_jsxs(_Fragment, { children: [_jsx(Channels, { onPick: onPick, navigate: navigate }), _jsx(Team, { filter: filter, onPick: onPick, navigate: navigate })] }));
1125
1166
  if (mode === "chat")
1126
1167
  return _jsx(App, { filter: filter, onPick: onPick, navigate: navigate });
1127
1168
  if (mode === "home")
1128
1169
  return (_jsxs(_Fragment, { children: [_jsx(Chats, { filter: filter, onPick: onPick }), channels, _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate }), _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate })] }));
1129
- if (mode === "bots")
1170
+ if (mode === "bots" || mode === "agents")
1130
1171
  return _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
1131
1172
  if (mode === "contacts")
1132
1173
  return _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
@@ -1134,6 +1175,17 @@ function Index({ mode, owner, filter, onPick, navigate, }) {
1134
1175
  return channels;
1135
1176
  if (mode === "tasks")
1136
1177
  return _jsx(Projects, { filter: filter, onPick: onPick });
1178
+ if (mode === "dev")
1179
+ return (_jsx(Projects, { filter: filter, onPick: (slug) => {
1180
+ navigate?.(dev(slug));
1181
+ onPick?.();
1182
+ } }));
1183
+ if (mode === "drive")
1184
+ return (_jsx(SidebarSection, { label: t("Storage"), children: _jsx(Note, { children: t("Browse cloud buckets, project files, and local folders in Drive.") }) }));
1185
+ if (mode === "cal")
1186
+ return (_jsx(SidebarSection, { label: t("Schedule"), children: _jsx(Note, { children: t("Upcoming events and team availability appear in Calendar.") }) }));
1187
+ if (mode === "meet")
1188
+ return (_jsxs(_Fragment, { children: [_jsx(SidebarSection, { label: t("Rooms"), children: _jsx(Note, { children: t("Start or join an instant video room in Meet.") }) }), _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate })] }));
1137
1189
  return _jsx(Chats, { filter: filter, onPick: onPick });
1138
1190
  }
1139
1191
  function Frame({ mode, children, navigate, back, forward, }) {
@@ -1165,17 +1217,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
1165
1217
  * the server sent "Close sidebar" and the client drew "Open sidebar" — and a
1166
1218
  * regenerated tree came back with the rail at zero width.
1167
1219
  */
1168
- const [asked, setAsked] = useState(true);
1169
- useEffect(() => {
1170
- let kept = null;
1171
- try {
1172
- kept = localStorage.getItem("hanzo:sidebar:open");
1173
- }
1174
- catch {
1175
- // No store is the width of the window, which is a state and not a failure.
1176
- }
1177
- setAsked(kept !== null ? kept === "true" : window.innerWidth >= 768);
1178
- }, []);
1220
+ const [asked, setAsked, setAway] = useSidebar();
1179
1221
  const [peeking, setPeeking] = useState(false);
1180
1222
  /**
1181
1223
  * How wide the reader keeps the sidebar.
@@ -1216,21 +1258,26 @@ function Frame({ mode, children, navigate, back, forward, }) {
1216
1258
  };
1217
1259
  const dismiss = () => {
1218
1260
  setPeeking(false);
1219
- if (typeof window !== "undefined" && window.innerWidth < 1024) {
1220
- setAsked(false);
1221
- }
1261
+ if (typeof window !== "undefined" && window.innerWidth < 1024)
1262
+ setAway();
1222
1263
  };
1223
1264
  const onPick = typeof window !== "undefined" && window.innerWidth < 1024 ? dismiss : undefined;
1224
- useEffect(() => {
1225
- const shortcut = (event) => {
1226
- if (summons(event)) {
1227
- event.preventDefault();
1228
- setFinding((open) => !open);
1229
- }
1230
- };
1231
- window.addEventListener("keydown", shortcut);
1232
- return () => window.removeEventListener("keydown", shortcut);
1233
- }, []);
1265
+ const { empty: emptyChat } = useOpen();
1266
+ const dev = useDevHost();
1267
+ useGlobalKeys({
1268
+ find: () => setFinding((open) => !open),
1269
+ newChat: () => {
1270
+ emptyChat();
1271
+ navigate?.(chat());
1272
+ },
1273
+ sidebar: toggle,
1274
+ settings: () => {
1275
+ rememberSettingsReturn();
1276
+ showSettings(FIRST);
1277
+ },
1278
+ chooseTheme: dev.chooseTheme,
1279
+ say: (message) => toast.success(message),
1280
+ });
1234
1281
  /**
1235
1282
  * THE SURFACES THAT ARE NOT APPS, said once.
1236
1283
  *
@@ -1245,6 +1292,8 @@ function Frame({ mode, children, navigate, back, forward, }) {
1245
1292
  * two ways to reach one place, and the two would answer differently the day
1246
1293
  * one of them learned to close the sheet behind it.
1247
1294
  */
1295
+ const [devMode] = useDevMode();
1296
+ const showDesktopRail = !asked;
1248
1297
  const tools = useMemo(() => [
1249
1298
  // CUSTOMIZE is the one home of what an agent brings to a run — skills,
1250
1299
  // connectors, plugins, agents — in Dev (@hanzo/build). One row leads
@@ -1258,16 +1307,6 @@ function Frame({ mode, children, navigate, back, forward, }) {
1258
1307
  dismiss();
1259
1308
  },
1260
1309
  },
1261
- // TERMINALS ARE TABS, and Tabs is its own product at its own host —
1262
- // hanzo.app's row pointed there too. A new tab for the reason that row
1263
- // used one: a reader who follows it inside this one loses the project
1264
- // they were building to reach a shell.
1265
- {
1266
- id: "terminals",
1267
- label: t("Terminals"),
1268
- icon: SquareTerminal,
1269
- go: () => window.open(TABS, "_blank", "noopener"),
1270
- },
1271
1310
  {
1272
1311
  id: "usage",
1273
1312
  label: t("Usage"),
@@ -1286,7 +1325,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
1286
1325
  {
1287
1326
  id: "settings",
1288
1327
  label: t("Settings"),
1289
- icon: Settings2,
1328
+ icon: Settings,
1290
1329
  go: () => showSettings(FIRST),
1291
1330
  },
1292
1331
  ], [navigate, dismiss, showSettings, t]);
@@ -1356,7 +1395,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
1356
1395
  // ship "Sign in" baked into HTML a signed-in reader then sees flash.
1357
1396
  const settled = hydrated && !isLoading;
1358
1397
  const { user: account } = useAccount();
1359
- const { accounts: browserAccounts, current: currentBrowserAccount, switchTo: switchToAccount, add: addAccount } = useAccounts();
1398
+ const { current: currentBrowserAccount } = useAccounts();
1360
1399
  const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
1361
1400
  const free = useFree(signedIn);
1362
1401
  const logout = useSignOut();
@@ -1376,103 +1415,123 @@ function Frame({ mode, children, navigate, back, forward, }) {
1376
1415
  const list = (_jsxs(Sidebar, { ref: side.ref, ...side.props, $md: { width: "var(--span)" }, "$max-md": { width: "100%", maxW: 280 }, ...sheet(0),
1377
1416
  // The kit draws the sidebar's edge on its right, a physical side, so the edge is
1378
1417
  // traded here: the left in a right-to-left language, where the sidebar stands at the right.
1379
- bg: "var(--side-fill, var(--sheet-2))", rounded: "var(--pane-round)", borderWidth: 1, borderColor: "var(--pane-edge, var(--edge, var(--white-06)))", position: "relative", children: [_jsx(Gutter
1418
+ bg: "var(--side-fill, var(--sheet-2))", rounded: "var(--pane-round)", borderWidth: 1, borderColor: "var(--pane-edge, var(--edge, var(--white-06)))", overflowX: "hidden", position: "relative", children: [_jsx(Gutter
1380
1419
  // The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
1381
1420
  , {
1382
1421
  // The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
1383
- side: dir === "rtl" ? "right" : "left", span: side.span, floor: FLOOR, ceil: CEIL, reset: SIDEBAR_WIDTH, onSpan: side.move, onKeep: side.keep, onShut: () => setAsked(false), label: t("Resize sidebar") }), _jsx(XStack, { "data-slot": "mode-name", items: "center", px: "$2", pt: "$2", minW: 0, children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", numberOfLines: 1, children: wordmark(mode === "dev" ? "dev" : "chat") }) }), _jsxs(XStack, { "data-slot": "workspace-switcher", items: "center", gap: "$2", px: "$2", pt: "$1", pb: "$1", minW: 0, children: [_jsx(Text, { render: _jsx("a", { href: "/", onClick: (e) => {
1422
+ side: dir === "rtl" ? "right" : "left", span: side.span, floor: FLOOR, ceil: CEIL, reset: SIDEBAR_WIDTH, onSpan: side.move, onKeep: side.keep, onShut: () => setAsked(false), label: t("Resize sidebar") }), _jsxs(XStack, { "data-slot": "workspace-switcher", items: "center", gap: "$2", px: "$2", pt: "$2", pb: "$1", minW: 0, display: "none", "$max-md": { display: "flex" }, children: [_jsx(Text, { render: _jsx("a", { href: "/", onClick: (e) => {
1384
1423
  if (!navigate || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0)
1385
1424
  return;
1386
1425
  e.preventDefault();
1387
1426
  navigate("/");
1388
- }, "aria-label": t("{brandName} home", { brandName: brand() }), title: t("Home") }), "data-slot": "home", display: "flex", items: "center", justify: "center", width: 28, height: 28, $touchable: { width: 40, height: 40 }, color: "inherit", children: _jsx(HanzoMark, { size: 18 }) }), settled && isAuthenticated ? (_jsx(XStack, { shrink: 1, minW: 0, children: _jsx(OrgProjectSwitcher, { ...orgState, alwaysShow: true }) })) : null] }), _jsx(YStack, { "data-slot": "places-list", px: "$2", pb: "$2", "$max-md": { display: "none" }, children: places.filter((place) => matches(t(place.label), filter)).map((place) => (_jsx(SidebarItem, { icon: _jsx(place.icon, { size: 16, "aria-hidden": true }), active: place.id === mode, onPress: () => {
1427
+ }, "aria-label": t("{brandName} home", { brandName: brand() }), title: t("Home") }), "data-slot": "home", display: "flex", items: "center", justify: "center", width: 28, height: 28, $touchable: { width: 44, height: 44, minW: 44, minH: 44 }, color: "inherit", children: _jsx(HanzoMark, { size: 18 }) }), settled && isAuthenticated ? (_jsx(XStack, { shrink: 1, minW: 0, children: _jsx(TopOrgSelector, {}) })) : null] }), _jsx(YStack, { "data-slot": "places-list", px: "$2", pt: "$2", pb: "$2", gap: 1, "$max-md": { display: "none" }, children: places.filter((place) => matches(t(place.label), filter)).map((place) => (_jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, bg: place.id === mode ? "$raised" : "transparent", hoverStyle: { bg: place.id === mode ? "$raised" : "$hover" }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: place.id === mode ? 1 : 0.78, children: _jsx(place.icon, { size: 16, "aria-hidden": true }) }), active: place.id === mode, onPress: () => {
1389
1428
  navigate?.(place.route);
1390
1429
  onPick?.();
1391
- }, children: t(place.label) }, place.id))) }), more.length ? (_jsx(YStack, { "data-slot": "setup-list", px: "$2", pb: "$2", children: _jsx(SidebarSection, { label: t("Setup"), children: more.map((tool) => (_jsx(SidebarItem, { icon: _jsx(tool.icon, { size: 16, "aria-hidden": true }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, height: 30, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true }), _jsx(Text, { render: _jsx("input", { value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
1430
+ }, children: t(place.label) }, place.id))) }), more.length ? (_jsx(YStack, { "data-slot": "setup-list", px: "$2", pb: "$2", children: _jsx(SidebarSection, { label: t("Setup"), mt: "$1", children: more.map((tool) => (_jsx(SidebarItem, { gap: "$2.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: 0.78, children: _jsx(tool.icon, { size: 15, "aria-hidden": true }) }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, minW: 0, height: 30, $touchable: { minH: 44 }, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true }), _jsx(Text, { render: _jsx("input", { value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
1392
1431
  if (e.key === "Escape")
1393
1432
  setFilter("");
1394
1433
  },
1395
1434
  // FILTER, not Search. Two controls that both said Search did two
1396
1435
  // different things: this one narrows the list beside you, and the
1397
1436
  // bar above opens the palette that finds anything anywhere.
1398
- placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(Index, { mode: mode, owner: owner, filter: filter, onPick: onPick, navigate: navigate })) : null, products.length ? (_jsx(SidebarFolder, { name: t("Cloud & Platform"), open: filter ? true : undefined, children: products.map((prod) => (_jsx(SidebarItem, { icon: _jsx(prod.icon, { size: 13, "aria-hidden": true }), onPress: () => window.open(prod.href, "_blank", "noopener"), children: t(prod.label) }, prod.id))) })) : null] }) }) })), settled && onApex ? _jsx(Leave, { href: signedIn ? ENTRY : WORKSPACE, children: t("Workspace") }) : null, settled ? (signedIn ? (_jsxs(_Fragment, { children: [free ? (_jsx(SidebarItem, { icon: _jsx(Sparkles, { size: 15, "aria-hidden": true, color: "var(--primary)" }), onPress: () => {
1437
+ placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(Index, { mode: mode, owner: owner, filter: filter, onPick: onPick, navigate: navigate })) : null, devMode && products.length ? (_jsx(SidebarFolder, { name: t("Cloud & Platform"), open: filter ? true : undefined, children: products.map((prod) => (_jsx(SidebarItem, { icon: _jsx(prod.icon, { size: 13, "aria-hidden": true }), onPress: () => window.open(prod.href, "_blank", "noopener"), children: t(prod.label) }, prod.id))) })) : null] }) }) })), settled && onApex ? _jsx(Leave, { href: signedIn ? ENTRY : WORKSPACE, children: t("Workspace") }) : null, settled ? (signedIn ? (_jsxs(_Fragment, { children: [free ? (_jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(Sparkles, { size: 15, "aria-hidden": true, color: "var(--foreground)" }), onPress: () => {
1399
1438
  window.location.assign(payUrl("/cart", { returnUrl: window.location.href }));
1400
1439
  dismiss();
1401
- }, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite Teammates") }), _jsx(SidebarItem, { icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
1440
+ }, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite teammates") }), _jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
1402
1441
  navigate?.(site("/referral"));
1403
1442
  dismiss();
1404
- }, 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] }));
1405
- return (_jsxs(YStack, { "data-slot": "workspace", "data-hydrated": settled ? "true" : undefined, "data-sidebar": asked ? "open" : "shut", display: "grid", gridTemplateColumns: `${RAIL}px auto minmax(0, 1fr) auto`, gridTemplateRows: `${BAR}px minmax(0, 1fr)`, gridTemplateAreas: '"bar bar bar bar" "rail list pane side"', "$max-md": {
1406
- gridTemplateColumns: "minmax(0, 1fr)",
1407
- gridTemplateRows: `${BAR}px minmax(0, 1fr) ${TABS_HEIGHT}`,
1408
- gridTemplateAreas: '"bar" "pane" "rail"',
1409
- }, 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) => {
1410
- if (typeof window === "undefined")
1411
- return;
1412
- try {
1413
- const target = new URL(item.href, window.location.origin);
1414
- if (target.origin === window.location.origin) {
1415
- navigate?.(target.pathname + target.search);
1416
- return;
1417
- }
1418
- const activeOrg = currentOrgId || scoped() || "";
1419
- if (activeOrg)
1420
- target.searchParams.set("org", activeOrg);
1421
- const sub = currentBrowserAccount?.sub || user?.sub || user?.id || "";
1422
- const isConsoleSibling = target.hostname.startsWith("crm.") ||
1423
- target.hostname.startsWith("console.") ||
1424
- target.hostname.startsWith("platform.") ||
1425
- target.hostname.startsWith("marketing.") ||
1426
- target.hostname.startsWith("ads.") ||
1427
- target.hostname.startsWith("social.");
1428
- if (isConsoleSibling && sub) {
1429
- const fresh = new URL("/auth/fresh", target.origin);
1430
- fresh.searchParams.set("next", target.pathname + target.search);
1431
- fresh.searchParams.set("who", sub);
1432
- window.location.assign(fresh.toString());
1433
- return;
1434
- }
1435
- window.location.assign(target.toString());
1436
- }
1437
- catch {
1438
- window.location.assign(item.href);
1439
- }
1440
- }, currentOrg: {
1441
- name: currentOrgId || scoped() || "hanzo",
1442
- displayName: workspace,
1443
- }, orgs: (orgState.organizations ?? []).map((o) => ({
1444
- name: o.name,
1445
- displayName: o.displayName || o.name,
1446
- })), onSelectOrg: (orgName) => {
1447
- choose(orgName);
1448
- window.location.reload();
1449
- }, user: settled && signedIn
1450
- ? {
1451
- sub: currentBrowserAccount?.sub ||
1452
- user?.sub ||
1453
- user?.id ||
1454
- who.person.email ||
1455
- "me",
1456
- name: who.person.name || who.person.email || "You",
1457
- email: who.person.email,
1458
- avatar: who.person.avatar,
1459
- }
1460
- : null, accounts: browserAccounts.map((a) => ({
1461
- sub: a.sub,
1462
- owner: a.owner || "hanzo",
1463
- name: a.displayName || a.name || a.email,
1464
- email: a.email,
1465
- avatar: a.avatar,
1466
- })), onSwitchAccount: (acct) => {
1467
- const found = browserAccounts.find((a) => a.sub === acct.sub);
1468
- if (found)
1469
- void switchToAccount(found);
1470
- else
1471
- void addAccount();
1472
- }, 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: BAR, 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: BAR, bottom: 0, insetInlineStart: RAIL }), "$max-md": { position: "fixed", t: BAR, r: 0, b: TABS_HEIGHT, l: 0, width: "100%" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
1473
- if (!asked)
1474
- setPeeking(false);
1475
- }, 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,
1476
- // A chat opens in this workspace's Chat, the palette having picked it; the rest is the app's.
1477
- go: (to) => navigate?.(to.startsWith(TALK) ? chat() : site(to)) })) : null] }));
1443
+ }, children: t("Share Hanzo") }), _jsx(XStack, { items: "center", justify: "space-between", gap: "$2", px: "$2", py: "$2", borderTopWidth: 1, borderColor: "$edge", children: _jsx(ShellProfileHover, { name: who.person.name || who.person.email || t("You"), email: who.person.email, avatar: who.person.avatar, orgId: owner || scoped() || "", signedIn: signedIn, onSettings: () => showSettings(FIRST), onSignOut: () => void logout(), children: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "shell-profile", "aria-label": t("Account: {name}", { name: who.person.name || who.person.email || t("You") }), onClick: () => {
1444
+ rememberSettingsReturn();
1445
+ showSettings(FIRST);
1446
+ }, items: "center", gap: "$2.5", flex: 1, minW: 0, minH: 40, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, px: "$1.5", py: "$1", rounded: "$3", borderWidth: 0, bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, cursor: "pointer", children: [_jsx(Face, { src: who.person.avatar, name: who.person.name || who.person.email || "You", size: 26, person: true }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, flex: 1, minW: 0, text: "start", children: who.person.name || who.person.email || t("You") })] }) }) })] })) : null) : null] }));
1447
+ const activeAppId = onApex ? (mode === "dev" ? "dev" : "chat") : "team";
1448
+ const activeAppTitle = onApex ? (mode === "dev" ? "Hanzo Dev" : "Hanzo Chat") : "Hanzo Team";
1449
+ const launchBusinessApp = (item) => {
1450
+ if (typeof window === "undefined")
1451
+ return;
1452
+ try {
1453
+ const target = new URL(item.href, window.location.origin);
1454
+ if (target.origin === window.location.origin) {
1455
+ navigate?.(target.pathname + target.search);
1456
+ return;
1457
+ }
1458
+ const activeOrg = currentOrgId || scoped() || "";
1459
+ if (activeOrg)
1460
+ target.searchParams.set("org", activeOrg);
1461
+ const sub = currentBrowserAccount?.sub ||
1462
+ user?.sub ||
1463
+ user?.id ||
1464
+ "";
1465
+ const isConsoleSibling = target.hostname.startsWith("crm.") ||
1466
+ target.hostname.startsWith("console.") ||
1467
+ target.hostname.startsWith("platform.") ||
1468
+ target.hostname.startsWith("marketing.") ||
1469
+ target.hostname.startsWith("ads.") ||
1470
+ target.hostname.startsWith("social.");
1471
+ if (isConsoleSibling && sub) {
1472
+ const fresh = new URL("/auth/fresh", target.origin);
1473
+ fresh.searchParams.set("next", target.pathname + target.search);
1474
+ fresh.searchParams.set("who", sub);
1475
+ window.location.assign(fresh.toString());
1476
+ return;
1477
+ }
1478
+ window.location.assign(target.toString());
1479
+ }
1480
+ catch {
1481
+ window.location.assign(item.href);
1482
+ }
1483
+ };
1484
+ const appMenuItems = [
1485
+ { type: "label", key: "suite", label: t("Hanzo apps") },
1486
+ ...BUSINESS_APPS.map((item) => ({
1487
+ key: item.id,
1488
+ label: item.label,
1489
+ description: item.description,
1490
+ selected: item.id === activeAppId,
1491
+ onSelect: () => launchBusinessApp(item),
1492
+ })),
1493
+ ];
1494
+ const orgList = orgState.organizations && orgState.organizations.length > 0
1495
+ ? orgState.organizations
1496
+ : [{ name: currentOrgId || scoped() || "hanzo", displayName: workspace }];
1497
+ const orgMenuItems = [
1498
+ { type: "label", key: "orgs", label: t("Switch organization") },
1499
+ ...orgList.map((o) => ({
1500
+ key: o.name,
1501
+ label: o.displayName || o.name,
1502
+ selected: o.name === (currentOrgId || scoped() || "hanzo"),
1503
+ onSelect: () => {
1504
+ if (o.name === (currentOrgId || scoped()))
1505
+ return;
1506
+ choose(o.name);
1507
+ window.location.reload();
1508
+ },
1509
+ })),
1510
+ ];
1511
+ return (_jsxs(YStack, { width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", position: "relative", children: [_jsx(SkipLink, {}), _jsxs(YStack, { "data-slot": "workspace", "data-hydrated": settled ? "true" : undefined, "data-sidebar": asked ? "open" : "shut", display: "grid", gridTemplateColumns: showDesktopRail ? `${RAIL}px auto minmax(0, 1fr) auto` : "0px auto minmax(0, 1fr) auto", gridTemplateRows: `${SHELL_BAR}px minmax(0, 1fr)`, gridTemplateAreas: '"bar bar bar bar" "rail list pane side"', "$max-md": {
1512
+ gridTemplateColumns: "minmax(0, 1fr)",
1513
+ gridTemplateRows: `${SHELL_BAR}px minmax(0, 1fr) ${TABS_HEIGHT}`,
1514
+ gridTemplateAreas: '"bar" "pane" "rail"',
1515
+ }, position: "relative", width: "100%", flex: 1, minH: 0, overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, hiddenOnDesktop: !showDesktopRail, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onMore: () => setFinding(true), avatarSlot: settled && signedIn ? (_jsx(ShellProfileHover, { name: who.person.name || who.person.email || t("You"), email: who.person.email, avatar: who.person.avatar, orgId: owner || scoped() || "", signedIn: signedIn, onSettings: () => {
1516
+ setAsked(true);
1517
+ showSettings(FIRST);
1518
+ }, onSignOut: () => void logout(), children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "rail-profile", "aria-label": t("Account: {name}", { name: who.person.name || who.person.email || t("You") }), onClick: () => {
1519
+ rememberSettingsReturn();
1520
+ setAsked(true);
1521
+ showSettings(FIRST);
1522
+ }, width: 40, height: 40, $touchable: { minW: 44, minH: 44 }, "$max-sm": { minW: 44, minH: 44 }, rounded: "$10", borderWidth: 0, bg: "transparent", items: "center", justify: "center", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, cursor: "pointer", children: _jsx(Face, { src: who.person.avatar, name: who.person.name || who.person.email || "You", size: 28, person: true }) }) })) : null }), _jsxs(XStack, { render: "header", gridArea: "bar", "data-slot": "bar", "data-testid": "hanzo-business-header", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, height: SHELL_BAR, px: "$2.5", gap: "$2", items: "center", justify: "space-between", borderBottomWidth: 1, borderColor: "$borderColor", bg: "$background", shrink: 0, minW: 0, overflow: "hidden", children: [_jsxs(XStack, { items: "center", gap: "$1", minW: 0, shrink: 1, 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, _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 280, items: appMenuItems, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-testid": "business-app-switcher-trigger", "aria-label": t("{app} — switch application", { app: activeAppTitle }), items: "center", justify: "center", gap: "$1", px: "$2", minH: 32, $touchable: { minH: 44, minW: 44 }, "$max-sm": { minH: 44, minW: 44 }, rounded: "$3", borderWidth: 0, cursor: "pointer", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, shrink: 0, children: [_jsx(HanzoMark, { size: 18 }), _jsx(ChevronDown, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true })] }) }), settled && signedIn ? (_jsx(XStack, { display: "none", $sm: { display: "flex" }, minW: 0, shrink: 1, children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 240, items: orgMenuItems, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-testid": "business-org-subtitle-trigger", "aria-label": t("Organization: {workspace}", { workspace }), items: "center", gap: "$1.5", px: "$2", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, maxW: 200, minW: 0, rounded: "$3", borderWidth: 0, cursor: "pointer", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(Building2, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, flex: 1, minW: 0, children: workspace }), _jsx(ChevronDown, { size: 12, color: "var(--muted-foreground)", "aria-hidden": true })] }) }) })) : null] }), _jsx(YStack, { flex: 1, minW: 0, maxW: 420, items: "center", justify: "center", px: "$1", children: _jsxs(Box, { render: _jsx("button", { type: "button" }), onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", "aria-label": t("Search {workspace}", { workspace }), items: "center", gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, cursor: "pointer", "$max-md": {
1523
+ width: 44,
1524
+ minW: 44,
1525
+ minH: 44,
1526
+ height: 44,
1527
+ px: 0,
1528
+ justify: "center",
1529
+ borderWidth: 0,
1530
+ rounded: "$3",
1531
+ }, children: [_jsx(SearchIcon, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, "$max-md": { display: "none" }, children: t("Search {workspace}", { workspace }) }), _jsx(Shortcut, { keys: ["Mod", "K"], marginInlineStart: "auto", "data-i18n-ltr": "", "$max-md": { display: "none" } })] }) }), _jsxs(XStack, { shrink: 0, minW: 0, justify: "flex-end", items: "center", gap: "$1.5", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: _jsx("button", { type: "button" }), onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", borderWidth: 0, bg: "transparent", cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", hoverStyle: { bg: "$hover" }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: _jsx("button", { type: "button" }), onClick: () => window.location.assign(payUrl("/cart", { returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", borderWidth: 0, bg: "transparent", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--foreground)" }), _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, {})] })] }), shown ? (_jsx(Box, { render: _jsx("button", { type: "button" }), "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, borderWidth: 0, "data-slot": "scrim", position: "absolute", t: SHELL_BAR, 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: SHELL_BAR, bottom: 0, insetInlineStart: RAIL }), "$max-md": { position: "fixed", t: SHELL_BAR, b: TABS_HEIGHT, insetInlineStart: 0, width: 280, maxW: "85vw" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
1532
+ if (!asked)
1533
+ setPeeking(false);
1534
+ }, 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,
1535
+ // A chat opens in this workspace's Chat, the palette having picked it; the rest is the app's.
1536
+ go: (to) => navigate?.(to.startsWith(TALK) ? chat() : site(to)) })) : null] })] }));
1478
1537
  }