@hanzo/app 0.3.81 → 0.3.83

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/App.js CHANGED
@@ -348,7 +348,7 @@ function Window({ bar, betas }) {
348
348
  };
349
349
  window.addEventListener('mousemove', onMove);
350
350
  window.addEventListener('mouseup', onUp);
351
- } })) : null] }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage",
351
+ } })) : null] }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar, made: maker }) })), _jsxs(YStack, { "data-slot": "stage",
352
352
  // A column: the phone's bar, then the panes taking the rest. Not a grid of `auto` and
353
353
  // `1fr` rows: from md the bar is display none, which leaves the grid, so the panes were
354
354
  // placed in the `auto` row and stood their content's height, and Dev's pane, which
@@ -360,7 +360,7 @@ function Window({ bar, betas }) {
360
360
  if (typeof window !== 'undefined') {
361
361
  window.dispatchEvent(new CustomEvent('hanzo:anon-settings', { detail: { open: false } }));
362
362
  }
363
- } }) })) : mode === 'chat' ? (_jsx(Split, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'design' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : mode === 'flow' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Workflow, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Flow" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'flow')?.line ?? 'Visual workflows and multi-agent pipelines.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'flow'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(FlowStudio, { host: maker }) }) })) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Clapperboard, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Studio" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'studio')?.line ?? 'Director Studio for AI film, video, and creative production.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'studio'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(DirectorStudio, { host: maker }) }) })) })) : at.mode === 'hosted' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsxs(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), position: "relative", flex: 1, minW: 0, minH: 0, children: [!plans && !run && !inPlace && closed && free && host.person !== null ? (_jsx(XStack, { position: "absolute", t: 8, r: 12, z: 5, items: "center", "$max-md": { display: 'none' }, children: _jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t('Upgrade plan'), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, onPress: () => window.location.assign(payUrl('/cart', { org: currentOrg(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t('Upgrade plan') })] }) })) : null, plans ? null : _jsx(Builder, { host: host, rail: false })] })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsxs(XStack, { flex: 1, minH: 0, children: [_jsx(YStack, { "data-slot": "drawer-rail", shrink: 0, pt: "calc(var(--pane-gap) + 8px)", $touchable: { pt: 'calc(var(--pane-gap) + 4px)' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar }) })] }) })), finding ? _jsx(Search, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null, _jsx(AppContextMenu, { host: host, mode: mode, closed: closed, onToggleSidebar: flip, onSeek: seek, onNewChat: () => {
363
+ } }) })) : mode === 'chat' ? (_jsx(Split, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'design' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : mode === 'flow' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Workflow, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Flow" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'flow')?.line ?? 'Visual workflows and multi-agent pipelines.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'flow'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(FlowStudio, { host: maker }) }) })) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: blockedBeta ? (_jsx(YStack, { "data-slot": "hosted-request", flex: 1, minH: 0, items: "center", justify: "center", p: "$6", children: _jsxs(YStack, { width: "100%", maxW: 440, gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$3", children: [_jsx(XStack, { width: 44, height: 44, rounded: "$4", bg: "$hover", items: "center", justify: "center", shrink: 0, children: _jsx(Clapperboard, { size: 22, "aria-hidden": true }) }), _jsxs(YStack, { gap: 2, minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$6", fontWeight: "600", color: "$ink", children: "Studio" }), _jsx(Text, { fontSize: "$1", color: "$quiet", px: "$2", py: 2, rounded: "$2", bg: "$hover", children: t('Beta') })] }), _jsx(Text, { fontSize: "$3", color: "$quiet", children: BETAS.find((b) => b.id === 'studio')?.line ?? 'Director Studio for AI film, video, and creative production.' })] })] }), _jsxs(XStack, { items: "center", gap: "$2", pt: "$1", children: [_jsx(Ask, { beta: BETAS.find((b) => b.id === 'studio'), go: move }), _jsx(Button, { variant: "ghost", size: "sm", onPress: () => move('/beta'), children: t('All betas') })] })] }) })) : (_jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(DirectorStudio, { host: maker }) }) })) })) : at.mode === 'hosted' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsxs(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), position: "relative", flex: 1, minW: 0, minH: 0, children: [!plans && !run && !inPlace && closed && free && host.person !== null ? (_jsx(XStack, { position: "absolute", t: 8, r: 12, z: 5, items: "center", "$max-md": { display: 'none' }, children: _jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t('Upgrade plan'), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, onPress: () => window.location.assign(payUrl('/cart', { org: currentOrg(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t('Upgrade plan') })] }) })) : null, plans ? null : _jsx(Builder, { host: host, rail: false })] })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsxs(XStack, { flex: 1, minH: 0, children: [_jsx(YStack, { "data-slot": "drawer-rail", shrink: 0, pt: "calc(var(--pane-gap) + 8px)", $touchable: { pt: 'calc(var(--pane-gap) + 4px)' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Sidebar, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar, made: maker }) })] }) })), finding ? _jsx(Search, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null, _jsx(AppContextMenu, { host: host, mode: mode, closed: closed, onToggleSidebar: flip, onSeek: seek, onNewChat: () => {
364
364
  empty();
365
365
  move(talk());
366
366
  }, go: move })] }) }) }) }) }));
package/dist/Chat.js CHANGED
@@ -69,6 +69,7 @@ import { Schedule } from "./Schedule.js";
69
69
  import { keepFile, useAttach, useKeep } from "./keep.js";
70
70
  import { useKept } from "./kept.js";
71
71
  import { dragWindow, toggleWindowMaximize } from "./WindowControls.js";
72
+ import { WalletPill } from "./WalletPill.js";
72
73
  import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, renders, Reply, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMind, useSuggestions, taken, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
73
74
  import { checkoutUrl, payUrl, topUp } from './lib/pay.js';
74
75
  import { Upgrade, useFree } from './Upgrade.js';
@@ -768,7 +769,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
768
769
  // only once the reader is turned away: a reply answered from a free model, or
769
770
  // a refusal.
770
771
  const held = paidPlan(limits);
771
- const pause = notice && (notice.fallback || notice.refused) ? notice : null;
772
+ const alreadyEnso = model === ENSO || model.startsWith("enso") || rowOf(model)?.family === "enso";
773
+ const redundantEnso = Boolean(notice &&
774
+ ((alreadyEnso && notice.reason === "paid_plan_required") ||
775
+ (!notice.refused &&
776
+ !spends(notice.reason) &&
777
+ (alreadyEnso || notice.reason === "paid_plan_required" || notice.fallback?.startsWith("enso")))));
778
+ const pause = notice && (notice.fallback || notice.refused) && !redundantEnso ? notice : null;
772
779
  // EVERY MODEL IS CHOSEN, never asked for: one the plan does not cover still
773
780
  // picks, and the gateway answers it with the policy's refusal or from Enso,
774
781
  // which the pane then shows. A turn the gateway refuses `plan_required`
@@ -1356,9 +1363,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1356
1363
  // answer that just stopped, once the conversation it belongs to has an id.
1357
1364
  const [finished, setFinished] = useState(null);
1358
1365
  useKeep(ai, !anonymous && !forgetful, kept ?? open, finished, artifacts);
1359
- // WHAT AN ANSWER MAKES OPENS BESIDE IT. With the panel open, a page or a
1360
- // picture an answer just finished writing is opened as a tab; with it shut,
1361
- // the answer's own Open does it.
1366
+ // WHAT AN ANSWER MAKES OPENS BESIDE IT. A page or a picture an answer just
1367
+ // finished writing is opened as a tab in the side panel.
1362
1368
  const writing = useRef(false);
1363
1369
  useEffect(() => {
1364
1370
  const was = writing.current;
@@ -1368,8 +1374,6 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1368
1374
  const done = [...turns.current].reverse().find((m) => m.role === "assistant");
1369
1375
  if (done && typeof done.content === "string" && done.content)
1370
1376
  setFinished({ id: String(done.id), text: done.content });
1371
- if (!panel)
1372
- return;
1373
1377
  const answer = done;
1374
1378
  const made = typeof answer?.content === "string" ? artifacts(answer.content).filter(renders) : [];
1375
1379
  if (made.length)
@@ -1595,9 +1599,18 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1595
1599
  if (preparing || (!text && !files.length))
1596
1600
  return;
1597
1601
  const isPrOrReview = /\b(pull request|pr\s*#?\d+|github\.com\/[^\s]+\/pull\/\d+|\/pull\/\d+|code[\s-]?review|ponytail|pony|review\s+(this\s+)?(pr|diff|patch|changes|commit))\b/i.test(text);
1598
- const ponyNote = isPrOrReview
1599
- ? 'Use the skill "code-review" (Ponytail Thermo-Nuclear Code Review + Code Judo): perform a rigorous multi-pass PR/diff review checking correctness, edge cases, race conditions, security, and maintainability.'
1602
+ const isInteractiveDemo = /\b(make|build|create|design|generate|show)\b[\s\S]*\b(demo|website|web\s*app|landing\s*page|dashboard|interactive|prototype|ui|preview)\b/i.test(text);
1603
+ const demoNote = isInteractiveDemo
1604
+ ? "Build a complete, self-contained, interactive single-file HTML application inside a ```html demo.html code fence (with embedded modern dark-mode CSS and interactive JavaScript controls) so it renders live in the side-by-side Outputs preview panel. If the request is for a Hanzo demo, build an interactive Hanzo AI platform showcase featuring Enso & Zen frontier models, Hanzo Dev autonomous coding agents, Hanzo Bot, Hanzo Cloud, and Model Context Protocol (MCP) tools with working interactive tabs and live simulations rather than a plain text or Python snippet."
1600
1605
  : "";
1606
+ const ponyNote = [
1607
+ isPrOrReview
1608
+ ? 'Use the skill "code-review" (Ponytail Thermo-Nuclear Code Review + Code Judo): perform a rigorous multi-pass PR/diff review checking correctness, edge cases, race conditions, security, and maintainability.'
1609
+ : "",
1610
+ demoNote,
1611
+ ]
1612
+ .filter(Boolean)
1613
+ .join("\n\n");
1601
1614
  if (isPrOrReview && !carry.gear.gear.skills.includes("code-review")) {
1602
1615
  carry.gear.toggle("skills", "code-review");
1603
1616
  }
@@ -1788,10 +1801,12 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1788
1801
  }, [initial, open, anonymous, settled, sendAnon]);
1789
1802
  const families = useFamilies(mind, (id) => setAsk({ model: nameOf(id, listed) }));
1790
1803
  const [titlebarSlot, setTitlebarSlot] = useState(null);
1804
+ const [titleSlot, setTitleSlot] = useState(null);
1791
1805
  useEffect(() => {
1792
1806
  if (typeof document === "undefined")
1793
1807
  return;
1794
1808
  setTitlebarSlot(document.getElementById("hanzo-titlebar-slot"));
1809
+ setTitleSlot(document.getElementById("hanzo-titlebar-title"));
1795
1810
  }, [media.md]);
1796
1811
  const inTopChrome = Boolean(media.md && titlebarSlot);
1797
1812
  const composer = {
@@ -1836,7 +1851,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1836
1851
  },
1837
1852
  // WHAT GOES WITH THE MESSAGE, above the frame and at its width: the
1838
1853
  // pause and its ways past, one chip a file, and talk mode's words.
1839
- head: files.length || turnedAway || prepWrong || preparing || talk.open || talk.refusal || pause || simulatedResetAt ? (_jsxs(_Fragment, { children: [(banner && isUsageLimitReached) || simulatedResetAt ? (_jsx(NeedMoreUsageBanner, { resetsAt: pause?.resets_at ?? simulatedResetAt, fallbackModel: pause?.fallback ? nameOf(pause.fallback, listed) : null, isUncapped: uncapped(limits), customMessage: banner?.message ?? null, onGetMoreUsage: () => setNeedMoreUsageOpen(true), onSeeUsage: () => showSettings("usage") })) : banner ? (_jsx(LimitedBanner, { message: banner.message, actions: banner.actions, onAction: act, onUsage: () => showSettings("usage"), labels: { usage: t("See usage"), dismiss: t("Dismiss") } })) : null, actWrong ? (_jsx(Text, { role: "alert", "data-slot": "limited-banner-wrong", fontSize: "$2", color: BAD, children: actWrong })) : null, files.length ? (_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", role: "list", "aria-label": t("Attached files"), "data-slot": "composer-attached", children: files.map((one) => (_jsx(HeldChip, { one: one, onOpen: openFile, onRemove: () => drop(at, one.id), onSave: anonymous ? undefined : (url, id) => keepOne(url, id, one.name, one.type) }, one.id))) })) : null, preparing ? (_jsxs(Text, { role: "status", "aria-live": "polite", "data-slot": "composer-preparing", fontSize: "$2", color: "$soft", children: [preparing, "\u2026"] })) : null, turnedAway || prepWrong ? (_jsx(Text, { role: "alert", fontSize: "$2", color: BAD, children: turnedAway || prepWrong })) : null, talk.open || talk.refusal ? (_jsx(Text, { role: "status", "aria-live": "polite", "data-slot": "composer-talk-reply", fontSize: "$2", color: talk.refusal ? BAD : "$soft", children: talk.refusal
1854
+ head: files.length || turnedAway || prepWrong || preparing || talk.open || talk.refusal || banner || simulatedResetAt ? (_jsxs(_Fragment, { children: [(banner && isUsageLimitReached) || simulatedResetAt ? (_jsx(NeedMoreUsageBanner, { resetsAt: pause?.resets_at ?? simulatedResetAt, fallbackModel: pause?.fallback ? nameOf(pause.fallback, listed) : null, isUncapped: uncapped(limits), customMessage: banner?.message ?? null, onGetMoreUsage: () => setNeedMoreUsageOpen(true), onSeeUsage: () => showSettings("usage") })) : banner ? (_jsx(LimitedBanner, { message: banner.message, actions: banner.actions, onAction: act, onUsage: () => showSettings("usage"), labels: { usage: t("See usage"), dismiss: t("Dismiss") } })) : null, actWrong ? (_jsx(Text, { role: "alert", "data-slot": "limited-banner-wrong", fontSize: "$2", color: BAD, children: actWrong })) : null, files.length ? (_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", role: "list", "aria-label": t("Attached files"), "data-slot": "composer-attached", children: files.map((one) => (_jsx(HeldChip, { one: one, onOpen: openFile, onRemove: () => drop(at, one.id), onSave: anonymous ? undefined : (url, id) => keepOne(url, id, one.name, one.type) }, one.id))) })) : null, preparing ? (_jsxs(Text, { role: "status", "aria-live": "polite", "data-slot": "composer-preparing", fontSize: "$2", color: "$soft", children: [preparing, "\u2026"] })) : null, turnedAway || prepWrong ? (_jsx(Text, { role: "alert", fontSize: "$2", color: BAD, children: turnedAway || prepWrong })) : null, talk.open || talk.refusal ? (_jsx(Text, { role: "status", "aria-live": "polite", "data-slot": "composer-talk-reply", fontSize: "$2", color: talk.refusal ? BAD : "$soft", children: talk.refusal
1840
1855
  ? worded(talk.refusal)
1841
1856
  : talk.reply
1842
1857
  ? `Hanzo: ${talk.reply}`
@@ -1965,30 +1980,32 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
1965
1980
  }, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
1966
1981
  if (!open)
1967
1982
  setPlan(null);
1968
- }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, inTopChrome && titlebarSlot
1969
- ? createPortal(_jsxs(XStack, { "data-slot": "chat-titlebar-portal", flex: 1, minW: 0, items: "center", justify: "space-between", gap: 8, children: [_jsx(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, "data-tauri-drag-region": "false", children: editingTitle && shownTitle ? (_jsx(Input, { "data-slot": "conversation-title-input", "aria-label": t("Chat title"), value: titleDraft, autoFocus: true, maxLength: 200, size: "sm", minW: 160, maxW: 360, onChangeText: setTitleDraft, onBlur: commitTitle, onKeyDown: (e) => {
1970
- e.stopPropagation?.();
1971
- if (e.key === "Enter") {
1972
- e.preventDefault?.();
1973
- commitTitle();
1974
- }
1975
- else if (e.key === "Escape") {
1976
- e.preventDefault?.();
1977
- setEditingTitle(false);
1978
- }
1979
- } })) : shownTitle ? (_jsx(XStack, { render: "button", "data-slot": "conversation-title", "aria-label": shownTitle, items: "center", gap: "$1.5", px: "$1.5", py: "$0.5", rounded: "$2", minW: 0, shrink: 1, cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => {
1980
- setTitleDraft(shownTitle);
1981
- setEditingTitle(true);
1982
- }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: shownTitle }) })) : null }), _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 2, shrink: 0, children: [anonymous ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 9999, px: "$3", "data-slot": "header-login", onPress: () => {
1983
- if (typeof window !== "undefined")
1984
- window.location.assign("/login?next=%2Fchat");
1985
- }, children: t("Log in") }), _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
1986
- if (typeof window !== "undefined")
1987
- window.location.assign("/signup?next=%2Fchat");
1988
- }, children: t("Sign up for free") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: currentThread }) }) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 15, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(Summary, { sections: sections, docked: dockSummary, open: summaryOpen, onOpenChange: setSummaryOpen, onOpen: () => setPanel(true), label: t("Summary") }), _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }), _jsx(XStack, { render: "button", "data-slot": "titlebar-new-chat", "aria-label": t("New chat"), ...{ title: t("New chat") }, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", opacity: 0.78, hoverStyle: { bg: "$hover", opacity: 1 }, onPress: () => {
1989
- emptyOpen();
1990
- go("/chat");
1991
- }, children: _jsx(SquarePlus, { size: 15, strokeWidth: 1.75, "aria-hidden": true }) })] })] }), titlebarSlot)
1983
+ }, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, inTopChrome && titleSlot
1984
+ ? createPortal(_jsx(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, "data-tauri-drag-region": "false", children: editingTitle && shownTitle ? (_jsx(Input, { "data-slot": "conversation-title-input", "aria-label": t("Chat title"), value: titleDraft, autoFocus: true, maxLength: 200, size: "sm", minW: 160, maxW: 360, onChangeText: setTitleDraft, onBlur: commitTitle, onKeyDown: (e) => {
1985
+ e.stopPropagation?.();
1986
+ if (e.key === "Enter") {
1987
+ e.preventDefault?.();
1988
+ commitTitle();
1989
+ }
1990
+ else if (e.key === "Escape") {
1991
+ e.preventDefault?.();
1992
+ setEditingTitle(false);
1993
+ }
1994
+ } })) : shownTitle ? (_jsx(XStack, { render: "button", "data-slot": "conversation-title", "aria-label": shownTitle, items: "center", gap: "$1.5", px: "$1.5", py: "$0.5", rounded: "$2", minW: 0, shrink: 1, cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => {
1995
+ setTitleDraft(shownTitle);
1996
+ setEditingTitle(true);
1997
+ }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: shownTitle }) })) : (_jsx(Text, { "data-slot": "page-title", fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: t("Chat") })) }), titleSlot)
1998
+ : null, inTopChrome && titlebarSlot
1999
+ ? createPortal(_jsx(XStack, { "data-slot": "chat-titlebar-portal", items: "center", justify: "flex-end", gap: 6, minW: 0, children: _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [!anonymous ? _jsx(WalletPill, { compact: true }) : null, anonymous ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 9999, px: "$3", "data-slot": "header-login", onPress: () => {
2000
+ if (typeof window !== "undefined")
2001
+ window.location.assign("/login?next=%2Fchat");
2002
+ }, children: t("Log in") }), _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
2003
+ if (typeof window !== "undefined")
2004
+ window.location.assign("/signup?next=%2Fchat");
2005
+ }, children: t("Sign up for free") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: currentThread }) }) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 15, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(Summary, { sections: sections, docked: dockSummary, open: summaryOpen, onOpenChange: setSummaryOpen, onOpen: () => setPanel(true), label: t("Summary") }), _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }), _jsx(XStack, { render: "button", "data-slot": "titlebar-new-chat", "aria-label": t("New chat"), ...{ title: t("New chat") }, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", opacity: 0.78, hoverStyle: { bg: "$hover", opacity: 1 }, onPress: () => {
2006
+ emptyOpen();
2007
+ go("/chat");
2008
+ }, children: _jsx(SquarePlus, { size: 15, strokeWidth: 1.75, "aria-hidden": true }) })] }) }), titlebarSlot)
1992
2009
  : null, inTopChrome && !cast.length ? null : (_jsxs(XStack, { "data-slot": "conversation-head", group: true,
1993
2010
  // On the rail's line from a tablet up; a phone's own bar is BAND.
1994
2011
  height: BAND, $md: { height: inPane(HEAD) }, $touchable: { height: inPane(TOUCH_HEAD) }, display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", items: "center", gap: "$3", paddingInlineStart: INSET - 8,
package/dist/Recents.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { type Host } from '@hanzo/build';
2
2
  import { type Mode, type Recent } from './recent.js';
3
3
  export declare function Recents({ host, mode, thread, onOpen, onNew, }: {
4
+ /** The mode's host: Design's is the one Studio is mounted with (App.tsx `maker`), whose path is Studio's. */
4
5
  host: Host;
5
6
  mode: Mode;
6
7
  /** The Chat conversation the pane holds, or null. */
package/dist/Recents.js CHANGED
@@ -2,7 +2,8 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // The reader's Recents in the column's mode, and only that mode's: Chat lists its
4
4
  // conversations (`/v1/agents/chat/conversations`, `useThreadList`), Dev its
5
- // coding runs (`/v1/agent/sessions?kind=coding`, @hanzo/build `useSessions`). Each
5
+ // coding runs (`/v1/agent/sessions?kind=coding`, @hanzo/build `useSessions`),
6
+ // Design what Studio keeps of its conversations (@hanzo/studio `useRecent`). Each
6
7
  // mode reads its own store. The menu beside the heading narrows, groups and sorts
7
8
  // the list; the choice is kept per mode in this browser. Chat's rows share one
8
9
  // menu (thread.tsx `ConversationMenu`): pinned ones list first, under Pinned,
@@ -12,15 +13,22 @@ import { useEffect, useId, useMemo, useRef, useState } from 'react';
12
13
  import { ScrollView, SizableText, XStack, YStack } from '@hanzo/gui';
13
14
  import { CheckSquare, ChevronDown, ChevronRight, GitPullRequest, ListFilter } from 'lucide-react';
14
15
  import { DOTS, route, useSessions } from '@hanzo/build';
16
+ import * as studio from '@hanzo/studio';
15
17
  import { DropdownMenu } from '@hanzo/ui';
16
18
  import { SidebarItem, StatusDot } from '@hanzo/ui/chat';
17
19
  import { useKept } from './kept.js';
18
20
  import { app } from './lib/host.js';
19
21
  import { site } from './where.js';
20
- import { ago, arrange, chats, hasUnreadUpdate, MENUS, PINNED, PLAIN, runs, SINCE, UNFILED, UNTITLED, UNTITLED_RUN, viewOf } from './recent.js';
22
+ import { ago, arrange, chats, designs, hasUnreadUpdate, MENUS, PINNED, PLAIN, runs, SINCE, UNFILED, UNTITLED, UNTITLED_RUN, viewOf } from './recent.js';
21
23
  import { ConversationMenu, ThreadRow, useThreadList } from './thread.js';
22
- /** The menu's items: each section a heading and its options (recent.ts's phrases, drawn through `t`), the one in force checked. */
23
- function items(mode, view, set, t) {
24
+ /**
25
+ * Studio's own read of Design's conversations (@hanzo/studio `useRecent`, from
26
+ * 0.1.11): this browser's store, shared with Studio's panes. An older Studio has
27
+ * none, and Design then lists nothing here, never Chat's.
28
+ */
29
+ const useMade = studio.useRecent;
30
+ /** The menu's items: each section a heading and its options (recent.ts's phrases, drawn through `t`), the one in force checked; Select multiple where the rows carry a menu. */
31
+ function items(mode, view, set, t, select) {
24
32
  const m = MENUS[mode];
25
33
  const section = (key, label, options) => options.length
26
34
  ? [
@@ -36,6 +44,8 @@ function items(mode, view, set, t) {
36
44
  : [];
37
45
  const parts = [section('status', t('Status'), m.status), section('since', t('Last activity'), SINCE), section('group', t('Group by'), m.group), section('sort', t('Sort by'), m.sort)].filter((p) => p.length);
38
46
  const base = parts.flatMap((p, i) => (i ? [{ type: 'separator', key: `sep-${i}` }, ...p] : p));
47
+ if (!select)
48
+ return base;
39
49
  return [
40
50
  ...base,
41
51
  { type: 'separator', key: 'sep-select' },
@@ -53,7 +63,20 @@ const Note = ({ children }) => (_jsx(SizableText, { size: "$1", color: "$soft",
53
63
  export function Recents({ host, mode, thread, onOpen, onNew, }) {
54
64
  const [kept, keep] = useKept(`hanzo.recents.${mode}`, PLAIN);
55
65
  const view = viewOf(mode, kept);
56
- return mode === 'chat' ? (_jsx(Chats, { thread: thread, view: view, keep: keep, onOpen: onOpen, onNew: onNew })) : (_jsx(Runs, { host: host, view: view, keep: keep, onOpen: onOpen }));
66
+ if (mode === 'chat')
67
+ return _jsx(Chats, { thread: thread, view: view, keep: keep, onOpen: onOpen, onNew: onNew });
68
+ if (mode === 'design')
69
+ return useMade ? _jsx(Designs, { host: host, view: view, keep: keep }) : _jsx(YStack, { flex: 1, minH: 0 });
70
+ return _jsx(Runs, { host: host, view: view, keep: keep, onOpen: onOpen });
71
+ }
72
+ /** Design's Recents: Studio's conversations, each opened in Design at its own address (@hanzo/studio `path`). */
73
+ function Designs({ host, view, keep }) {
74
+ const { rows: made, error } = useMade(host);
75
+ const rows = useMemo(() => designs(made), [made]);
76
+ const failed = useMemo(() => (error ? new Error(error) : null), [error]);
77
+ const at = studio.route(host.path);
78
+ const held = at.kind === 'chat' ? at.id : null;
79
+ return (_jsx(List, { mode: "design", rows: rows, view: view, keep: keep, open: (r) => r.id === held, reading: false, error: failed, onOpen: (r) => host.go(studio.path({ kind: 'chat', id: r.id })) }));
57
80
  }
58
81
  /** Chat's Recents: the conversation store alone, the archived ones when the view asks for them. */
59
82
  function Chats({ thread, view, keep, onOpen, onNew, }) {
@@ -201,7 +224,9 @@ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, h
201
224
  const isUnread = Boolean(r.kind === 'chat' && !open(r) && unreadIds?.has(r.id));
202
225
  const age = ago(r.at, new Date(), t);
203
226
  const when = age ? (_jsx(SizableText, { "data-slot": "row-age", fontSize: 12, lineHeight: 16, color: "var(--muted-foreground)", children: age })) : null;
204
- const rowAside = r.kind === 'dev' ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, r.pr ? _jsx(GitPullRequest, { size: 13, color: "var(--state-success)", "aria-hidden": true }) : null, _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : isUnread || when ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, isUnread ? (_jsx(XStack, { "data-slot": "thread-unread-dot", width: 6, height: 6, rounded: 999, bg: "var(--foreground)", "aria-hidden": true })) : null] })) : undefined;
227
+ // A Design conversation's dot is there while it works or when it failed; at rest it wears its age alone.
228
+ const settled = r.kind === 'design' && r.status === 'done';
229
+ const rowAside = r.kind === 'design' ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, settled ? null : _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : r.kind === 'dev' ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, r.pr ? _jsx(GitPullRequest, { size: 13, color: "var(--state-success)", "aria-hidden": true }) : null, _jsx(StatusDot, { status: DOTS[r.status] ?? 'idle' })] })) : isUnread || when ? (_jsxs(XStack, { items: "center", gap: "$1.5", children: [when, isUnread ? (_jsx(XStack, { "data-slot": "thread-unread-dot", width: 6, height: 6, rounded: 999, bg: "var(--foreground)", "aria-hidden": true })) : null] })) : undefined;
205
230
  const item = (_jsx(SidebarItem, { "data-kind": r.kind, active: open(r), rounded: 8, minH: 29, paddingInlineStart: "$2", paddingInlineEnd: one || rowAside ? 52 : '$2',
206
231
  // A thumb's 44 on a touch screen; a conversation's ⋯ is a thumb wide there and always there: the title stops short of it.
207
232
  $touchable: one ? { minH: 44, paddingInlineEnd: 52 } : { minH: 44 }, onKeyDown: (e) => {
@@ -215,15 +240,15 @@ function List({ mode, rows, view, keep, open, reading, error, onOpen, threads, h
215
240
  return (_jsxs(YStack, { role: "listitem", position: "relative", children: [item, rowAside ? (_jsx(XStack, { position: "absolute", insetInlineEnd: "$2.5", t: 0, b: 0, items: "center", pointerEvents: "none", children: rowAside })) : null] }, r.id));
216
241
  };
217
242
  // The view menu stands at the end of the Recents heading: the target's own, quiet until the pointer is near.
218
- const menu = (_jsx(DropdownMenu, { minWidth: 200, trigger: _jsx(XStack, { render: "button", "aria-label": t('Recents view'), width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: narrowed ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, bg: narrowed ? '$hover' : 'transparent', children: _jsx(ListFilter, { size: 14, "aria-hidden": true }) }), items: items(mode, view, keep, t) }));
243
+ const menu = (_jsx(DropdownMenu, { minWidth: 200, trigger: _jsx(XStack, { render: "button", "aria-label": t('Recents view'), width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: narrowed ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, bg: narrowed ? '$hover' : 'transparent', children: _jsx(ListFilter, { size: 14, "aria-hidden": true }) }), items: items(mode, view, keep, t, Boolean(threads)) }));
219
244
  /** A section's heading: quiet 11.5px label, the Recents one carrying the count and the menu. */
220
- const heading = (title, id, lead = false) => (_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 26, paddingInlineStart: "$2", paddingInlineEnd: "$1", mt: "$2.5", shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { id: id, fontSize: 11.5, lineHeight: 16, fontWeight: "500", color: "var(--muted-foreground)", children: title }), lead && running ? (_jsx(XStack, { "aria-label": t('{n} running', { n: running }), minW: 18, height: 18, px: "$1.5", rounded: 999, items: "center", justify: "center", bg: "$edge", borderWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", "aria-hidden": true, "data-i18n-ltr": true, children: String(running) }) })) : null] }), _jsxs(XStack, { items: "center", gap: 2, children: [lead && rows.length > 0 ? (_jsx(XStack, { render: "button", "aria-label": t('Select multiple'), ...{ title: t('Select multiple') }, width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, onPress: () => {
245
+ const heading = (title, id, lead = false) => (_jsxs(XStack, { group: true, items: "center", justify: "space-between", height: 26, paddingInlineStart: "$2", paddingInlineEnd: "$1", mt: "$2.5", shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(SizableText, { id: id, fontSize: 11.5, lineHeight: 16, fontWeight: "500", color: "var(--muted-foreground)", children: title }), lead && running ? (_jsx(XStack, { "aria-label": t('{n} running', { n: running }), minW: 18, height: 18, px: "$1.5", rounded: 999, items: "center", justify: "center", bg: "$edge", borderWidth: 1, borderColor: "$borderColor", children: _jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", "aria-hidden": true, "data-i18n-ltr": true, children: String(running) }) })) : null] }), _jsxs(XStack, { items: "center", gap: 2, children: [lead && threads && rows.length > 0 ? (_jsx(XStack, { render: "button", "aria-label": t('Select multiple'), ...{ title: t('Select multiple') }, width: 26, height: 26, rounded: "$2", items: "center", justify: "center", cursor: "pointer", opacity: 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, $touchable: { opacity: 1 }, hoverStyle: { bg: '$hover' }, onPress: () => {
221
246
  if (typeof window !== 'undefined')
222
247
  window.dispatchEvent(new CustomEvent('hanzo:recents-select'));
223
248
  }, children: _jsx(CheckSquare, { size: 13, "aria-hidden": true }) })) : null, lead ? menu : null] })] }));
224
249
  const loose = groups.filter((g) => g.title !== PINNED);
225
250
  const pinned = groups.find((g) => g.title === PINNED);
226
- const note = reading ? (_jsx(Note, { children: t(mode === 'chat' ? 'Reading your chats…' : 'Reading your runs…') })) : error ? null : view.status === 'archived' ? (_jsx(Note, { children: t('No archived chats.') })) : narrowed ? (_jsx(Note, { children: t('Nothing in this view.') })) : (_jsx(Note, { children: t(mode === 'chat' ? 'No chats yet.' : 'No runs yet.') }));
251
+ const note = reading ? (_jsx(Note, { children: t(mode === 'chat' ? 'Reading your chats…' : 'Reading your runs…') })) : error ? null : view.status === 'archived' ? (_jsx(Note, { children: t('No archived chats.') })) : narrowed ? (_jsx(Note, { children: t('Nothing in this view.') })) : (_jsx(Note, { children: t(mode === 'chat' ? 'No chats yet.' : mode === 'design' ? 'Nothing made yet.' : 'No runs yet.') }));
227
252
  // Each list of conversations holds its own menu (thread.tsx): the view menu
228
253
  // in the Recents heading between them is a menu of its own, never inside one.
229
254
  const menus = (rows, primary = true) => threads ? (_jsx(ConversationMenu, { threads: threads, active: held, onGone: onNew, customActions: customActions, hrefOf: hrefOf, primary: primary, children: _jsx(YStack, { children: rows }) })) : (rows);
package/dist/Sidebar.d.ts CHANGED
@@ -7,7 +7,7 @@ export declare function dispatchTabsAction(detail: {
7
7
  id?: string;
8
8
  machine?: string;
9
9
  }): void;
10
- export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer, rail, foot, places, }: {
10
+ export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer, rail, foot, places, made, }: {
11
11
  host: Host;
12
12
  mode: Place['mode'];
13
13
  /** The Chat conversation the pane holds, or null. */
@@ -32,6 +32,8 @@ export declare function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack
32
32
  label: string;
33
33
  links: RailLink[];
34
34
  }[];
35
+ /** The host Design is mounted with (App.tsx `maker`): where its conversations are read and opened. */
36
+ made?: Host;
35
37
  }): import("react").JSX.Element;
36
38
  export declare function AnonSettingsPane({ host, onClose, }: {
37
39
  host: Host;
package/dist/Sidebar.js CHANGED
@@ -2,7 +2,9 @@
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  // The app's sidebar, beside the rail on the window's floor (App.tsx): the
4
4
  // mode's name with the bell and the search at its end, New, Dev's places in
5
- // Dev, the reader's Recents (Pinned first), and the first-run cards. Which
5
+ // Dev, the reader's Recents (Pinned first) for Chat, Dev and Design (Design's
6
+ // own, through the host Studio is mounted with; Studio and Flow keep none to
7
+ // list), and the first-run cards. Which
6
8
  // product it lists is the rail's to say; the account is at the rail's foot, or
7
9
  // on a phone at the foot of its menu (Drawer.tsx), where this column is the menu.
8
10
  //
@@ -253,7 +255,7 @@ function Activity({ host }) {
253
255
  ];
254
256
  return (_jsx(DropdownMenu, { minWidth: 280, trigger: _jsx(XStack, { render: "button", "aria-label": t('Activity'), ...{ title: t('Activity') }, ...HEAD, items: "center", justify: "center", cursor: "pointer", opacity: 0.7, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: _jsx(Bell, { size: 15, "aria-hidden": true }) }), items: items }));
255
257
  }
256
- export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer = false, rail, foot, places, }) {
258
+ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer = false, rail, foot, places, made, }) {
257
259
  const { t, dir } = useI18n();
258
260
  const anon = host.person === null;
259
261
  const free = useFree(Boolean(host.token?.())) || anon;
@@ -385,7 +387,9 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
385
387
  if (typeof window !== 'undefined') {
386
388
  window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
387
389
  }
388
- }), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
390
+ }), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' || mode === 'studio' || mode === 'flow' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : mode === 'design' ? (
391
+ // Design's own conversations, read and opened through the host Studio is mounted with.
392
+ made ? _jsx(Recents, { host: made, mode: "design", thread: null, onOpen: open, onNew: create }) : _jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
389
393
  if (typeof window !== 'undefined')
390
394
  window.location.assign('/login?next=%2Fchat');
391
395
  }, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
@@ -0,0 +1,4 @@
1
+ export declare function WalletPill({ alwaysShow, compact, }: {
2
+ alwaysShow?: boolean;
3
+ compact?: boolean;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useI18n } from '@hanzo/i18n/react';
4
+ import { useIam } from '@hanzo/iam/react';
5
+ import { Text, XStack } from '@hanzo/gui';
6
+ import { Plus, Wallet } from 'lucide-react';
7
+ import { cents } from './lib/org.js';
8
+ import { payPage } from './lib/pay.js';
9
+ import { org } from './lib/session.js';
10
+ import { useTier } from './lib/tier.js';
11
+ export function WalletPill({ alwaysShow = false, compact = false, }) {
12
+ const { t } = useI18n();
13
+ const { isAuthenticated } = useIam();
14
+ const currentOrg = org();
15
+ const { tier, wrong } = useTier(isAuthenticated && Boolean(currentOrg), currentOrg);
16
+ if (!isAuthenticated)
17
+ return null;
18
+ const hasBalance = typeof tier?.balance?.effectiveAvailable === 'number';
19
+ if (!alwaysShow && !hasBalance)
20
+ return null;
21
+ const balance = hasBalance
22
+ ? cents(tier.balance.effectiveAvailable, tier.balance.currency || 'usd')
23
+ : wrong
24
+ ? t('Wallet')
25
+ : '…';
26
+ return (_jsxs(XStack, { render: "a", href: payPage('/amount/card'), "data-slot": "wallet-pill", "aria-label": t('Wallet credits: {balance}. Add funds', { balance }), height: compact ? 26 : 30, px: compact ? 9 : 11, gap: 6, rounded: 8, items: "center", bg: "var(--pane-fill, var(--card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--border))", cursor: "pointer", hoverStyle: { bg: 'var(--muted)' }, "$platform-web": { textDecoration: 'none' }, children: [_jsx(Wallet, { size: compact ? 12.5 : 13.5, color: "var(--muted-foreground)", "aria-hidden": true }), !compact ? (_jsx(Text, { fontSize: 12.5, lineHeight: 16, color: "var(--muted-foreground)", numberOfLines: 1, children: t('Credits') })) : null, _jsx(Text, { fontSize: 12.5, lineHeight: 16, fontWeight: "600", color: "var(--foreground)", numberOfLines: 1, children: balance }), !compact ? (_jsxs(XStack, { height: 20, px: 7, gap: 3, rounded: 6, items: "center", bg: "var(--secondary)", borderWidth: 1, borderColor: "var(--pane-edge, var(--border))", children: [_jsx(Plus, { size: 11, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 11.5, lineHeight: 15, fontWeight: "500", color: "var(--foreground)", numberOfLines: 1, children: t('Add funds') })] })) : null] }));
27
+ }
@@ -1,7 +1,28 @@
1
- export type ConnectorFilter = 'all' | 'channels' | 'business' | 'productivity';
1
+ export type ConnectorFilter = 'all' | 'personal' | 'channels' | 'business' | 'productivity';
2
+ type SectionId = 'popular' | 'channels' | 'business' | 'productivity';
3
+ interface ConnectorDef {
4
+ id: string;
5
+ name: string;
6
+ description: string;
7
+ section: SectionId;
8
+ filter: 'channels' | 'business' | 'productivity';
9
+ network?: string;
10
+ icon?: {
11
+ path: string;
12
+ hex: string;
13
+ };
14
+ }
15
+ export declare const CONNECTOR_CATALOG: readonly ConnectorDef[];
16
+ export declare function ConnectorsCatalog({ defaultFilter, embedded, onClose, onConnected, }: {
17
+ defaultFilter?: ConnectorFilter;
18
+ embedded?: boolean;
19
+ onClose?: () => void;
20
+ onConnected?: () => void;
21
+ }): import("react").JSX.Element;
2
22
  export declare function ConnectorsDialog({ open, onOpenChange, defaultFilter, onConnected, }: {
3
23
  open: boolean;
4
24
  onOpenChange: (open: boolean) => void;
5
25
  defaultFilter?: ConnectorFilter;
6
26
  onConnected?: () => void;
7
27
  }): import("react").JSX.Element;
28
+ export {};
@@ -1,11 +1,5 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- // External Connectors modal for Hanzo Bot (and shared surfaces): lets an org
4
- // connect external messaging/social channels (Slack, WhatsApp, Telegram,
5
- // Discord, X, Instagram, LinkedIn, TikTok, Reddit, Signal, Teams, Zoom) and
6
- // external business/productivity tools (Stripe, Gmail, Google Drive, Google
7
- // Calendar, GitHub, HubSpot, QuickBooks, Notion, Linear, Supabase) via the
8
- // platform `/v1/provider` and `/v1/connection` registries or MCP credentials.
9
3
  import { useCallback, useEffect, useMemo, useState } from 'react';
10
4
  import { useI18n } from '@hanzo/i18n/react';
11
5
  import { useIam } from '@hanzo/iam/react';
@@ -13,85 +7,78 @@ import { Input, Text, XStack, YStack } from '@hanzo/gui';
13
7
  import { Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
14
8
  import { Check, ChevronRight, Plug, Plus, RefreshCw, Search, X } from 'lucide-react';
15
9
  import { siDropbox, siGithub, siGooglecalendar, siGoogledrive, siHubspot, siLinear, siNotion, siQuickbooks, siShopify, siStripe, siSupabase, } from 'simple-icons';
10
+ import { useKept } from '../kept.js';
16
11
  import { Network } from '../network.js';
17
12
  import { api } from '../lib/api.js';
18
13
  import { scope } from '../lib/session.js';
19
14
  import { enter } from '../lib/destination.js';
20
15
  import { CLIP, PILL, ROUND, WORD } from './kit.js';
21
16
  import { DIM, FLOOR, GROUND, INK, LINE, PICKED, RAISED } from './ink.js';
22
- const CATALOG = [
23
- // Messaging & Social Channels
24
- { id: 'slack', name: 'Slack', description: 'Answer channels, threads, and workspace DMs', section: 'channels', filter: 'channels', network: 'slack' },
25
- { id: 'whatsapp', name: 'WhatsApp', description: 'Reply to customer and team chats on WhatsApp', section: 'channels', filter: 'channels', network: 'whatsapp' },
17
+ export const CONNECTOR_CATALOG = [
18
+ // Popular
19
+ { id: 'gmail', name: 'Gmail', description: 'Read, draft, triage, and manage Gmail threads', section: 'popular', filter: 'productivity', network: 'gmail' },
20
+ { id: 'google-drive', name: 'Google Drive', description: 'Drive, Docs, Sheets, and Slides', section: 'popular', filter: 'productivity', icon: siGoogledrive },
21
+ { id: 'slack', name: 'Slack', description: 'Answer channels, threads, and workspace DMs', section: 'popular', filter: 'channels', network: 'slack' },
22
+ { id: 'github', name: 'GitHub', description: 'Triage PRs, issues, CI runs, and release flows', section: 'popular', filter: 'productivity', icon: siGithub },
23
+ { id: 'whatsapp', name: 'WhatsApp', description: 'Reply to customer and team chats on WhatsApp', section: 'popular', filter: 'channels', network: 'whatsapp' },
24
+ { id: 'supabase', name: 'Supabase', description: 'Manage and query Postgres databases', section: 'popular', filter: 'productivity', icon: siSupabase },
25
+ // Messaging & Social
26
26
  { id: 'telegram', name: 'Telegram', description: 'Run bots across Telegram chats and groups', section: 'channels', filter: 'channels', network: 'telegram' },
27
27
  { id: 'discord', name: 'Discord', description: 'Respond in community servers, channels, and threads', section: 'channels', filter: 'channels', network: 'discord' },
28
28
  { id: 'x', name: 'X', description: 'Post updates, monitor mentions, and reply to DMs', section: 'channels', filter: 'channels', network: 'x' },
29
29
  { id: 'instagram', name: 'Instagram', description: 'Publish media and answer Instagram messages', section: 'channels', filter: 'channels', network: 'instagram' },
30
30
  { id: 'linkedin', name: 'LinkedIn', description: 'Schedule posts and manage company presence', section: 'channels', filter: 'channels', network: 'linkedin' },
31
- { id: 'tiktok', name: 'TikTok', description: 'Publish short-form video and track engagement', section: 'channels', filter: 'channels', network: 'tiktok' },
32
31
  { id: 'teams', name: 'Microsoft Teams', description: 'Join organization channels and enterprise chats', section: 'channels', filter: 'channels', network: 'teams' },
33
32
  { id: 'signal', name: 'Signal', description: 'Encrypted direct messages and group alerts', section: 'channels', filter: 'channels', network: 'signal' },
34
- { id: 'reddit', name: 'Reddit', description: 'Monitor subreddits, threads, and mod queues', section: 'channels', filter: 'channels', network: 'reddit' },
35
33
  { id: 'zoom', name: 'Zoom', description: 'Join meetings, summaries, and call transcripts', section: 'channels', filter: 'channels', network: 'zoom' },
36
- // Small Business & Revenue
37
- { id: 'stripe', name: 'Stripe', description: 'Accept payments, inspect invoices, and grow revenue', section: 'business', filter: 'business', icon: siStripe },
38
- { id: 'hubspot', name: 'HubSpot', description: 'Sync contacts, deals, and pipeline insights', section: 'business', filter: 'business', icon: siHubspot },
34
+ // Small Business
35
+ { id: 'dropbox', name: 'Dropbox', description: 'Find, create, and organize shared files', section: 'business', filter: 'business', icon: siDropbox },
39
36
  { id: 'quickbooks', name: 'Intuit QuickBooks', description: 'Accounting, invoices, payments, and payroll', section: 'business', filter: 'business', icon: siQuickbooks },
37
+ { id: 'hubspot', name: 'HubSpot', description: 'Insights to action in HubSpot CRM', section: 'business', filter: 'business', icon: siHubspot },
38
+ { id: 'stripe', name: 'Stripe', description: 'Accept payments, inspect invoices, and grow revenue', section: 'business', filter: 'business', icon: siStripe },
40
39
  { id: 'shopify', name: 'Shopify', description: 'Orders, catalog inventory, and customer support', section: 'business', filter: 'business', icon: siShopify },
41
- // Productivity & Cloud
42
- { id: 'gmail', name: 'Gmail', description: 'Read, draft, triage, and manage Gmail threads', section: 'productivity', filter: 'productivity', network: 'gmail' },
43
- { id: 'google-drive', name: 'Google Drive', description: 'Search and create Docs, Sheets, and Slides', section: 'productivity', filter: 'productivity', icon: siGoogledrive },
40
+ // Productivity & Developer
41
+ { id: 'notion', name: 'Notion', description: 'Create docs, tasks, and databases', section: 'productivity', filter: 'productivity', icon: siNotion },
44
42
  { id: 'google-calendar', name: 'Google Calendar', description: 'Read availability and schedule events', section: 'productivity', filter: 'productivity', icon: siGooglecalendar },
45
- { id: 'notion', name: 'Notion', description: 'Create docs, wiki pages, tasks, and databases', section: 'productivity', filter: 'productivity', icon: siNotion },
46
- { id: 'dropbox', name: 'Dropbox', description: 'Find, sync, and organize shared team files', section: 'productivity', filter: 'productivity', icon: siDropbox },
43
+ { id: 'linear', name: 'Linear', description: 'Track issues, cycles, projects, and triage', section: 'productivity', filter: 'productivity', icon: siLinear },
47
44
  { id: 'outlook', name: 'Outlook', description: 'Read and send Microsoft 365 mail and invites', section: 'productivity', filter: 'productivity', network: 'outlook' },
48
- // Developer & Data
49
- { id: 'github', name: 'GitHub', description: 'Triage PRs, issues, CI runs, and release flows', section: 'developer', filter: 'productivity', icon: siGithub },
50
- { id: 'linear', name: 'Linear', description: 'Track issues, cycles, projects, and bug triage', section: 'developer', filter: 'productivity', icon: siLinear },
51
- { id: 'supabase', name: 'Supabase', description: 'Query Postgres tables, auth, and edge functions', section: 'developer', filter: 'productivity', icon: siSupabase },
52
45
  ];
53
46
  const SECTIONS = [
47
+ { id: 'popular', title: 'Popular' },
54
48
  { id: 'channels', title: 'Messaging & Social' },
55
- { id: 'business', title: 'Small Business & Revenue' },
56
- { id: 'productivity', title: 'Productivity' },
57
- { id: 'developer', title: 'Developer & Data' },
49
+ { id: 'business', title: 'Small Business' },
50
+ { id: 'productivity', title: 'Productivity & Developer' },
58
51
  ];
59
52
  const FILTERS = [
60
- { id: 'all', label: 'All' },
61
- { id: 'channels', label: 'Channels & Social' },
53
+ { id: 'all', label: 'Public' },
54
+ { id: 'personal', label: 'Personal' },
55
+ { id: 'channels', label: 'Messaging & Social' },
62
56
  { id: 'business', label: 'Small Business' },
63
- { id: 'productivity', label: 'Productivity & Dev' },
57
+ { id: 'productivity', label: 'Productivity' },
64
58
  ];
65
59
  function Mark({ item }) {
66
60
  if (item.network) {
67
61
  return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, overflow: "hidden", children: _jsx(Network, { transport: item.network, size: 36 }) }));
68
62
  }
69
63
  if (item.icon) {
70
- const darkGlyph = item.id === 'notion' || item.id === 'github' || item.id === 'linear';
71
- return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, bg: (darkGlyph ? 'var(--neutral-800)' : `#${item.icon.hex}`), borderWidth: darkGlyph ? 1 : 0, borderColor: LINE, children: _jsx("svg", { width: 19, height: 19, viewBox: "0 0 24 24", fill: "var(--pure-white)", "aria-hidden": "true", children: _jsx("path", { d: item.icon.path }) }) }));
64
+ return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx("svg", { width: 18, height: 18, viewBox: "0 0 24 24", fill: "var(--foreground)", "aria-hidden": "true", children: _jsx("path", { d: item.icon.path }) }) }));
72
65
  }
73
66
  return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(Plug, { size: 17, color: INK, "aria-hidden": true }) }));
74
67
  }
75
- export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', onConnected, }) {
68
+ export function ConnectorsCatalog({ defaultFilter = 'all', embedded = false, onClose, onConnected, }) {
76
69
  const { t } = useI18n();
77
70
  const { isAuthenticated, accessToken } = useIam();
78
71
  const signed = isAuthenticated && Boolean(accessToken);
79
72
  const [filter, setFilter] = useState(defaultFilter);
80
73
  const [query, setQuery] = useState('');
81
- const [registry, setRegistry] = useState({});
74
+ const [localSaved, setLocalSaved] = useKept('hanzo.connectors.v1', {});
75
+ const [remoteRegistry, setRemoteRegistry] = useState({});
82
76
  const [busyId, setBusyId] = useState(null);
83
77
  const [configuring, setConfiguring] = useState(null);
84
78
  const [secret, setSecret] = useState('');
85
79
  const [statusNote, setStatusNote] = useState(null);
86
80
  const [turn, setTurn] = useState(0);
87
- useEffect(() => {
88
- if (open) {
89
- setFilter(defaultFilter);
90
- setStatusNote(null);
91
- setConfiguring(null);
92
- setSecret('');
93
- }
94
- }, [open, defaultFilter]);
81
+ const registry = useMemo(() => ({ ...(localSaved ?? {}), ...remoteRegistry }), [localSaved, remoteRegistry]);
95
82
  const load = useCallback(async () => {
96
83
  if (!signed)
97
84
  return;
@@ -126,23 +113,11 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
126
113
  };
127
114
  }
128
115
  }
129
- setRegistry(next);
116
+ setRemoteRegistry(next);
130
117
  }, [signed]);
131
118
  useEffect(() => {
132
- if (!open)
133
- return;
134
119
  void load();
135
- }, [open, turn, load]);
136
- useEffect(() => {
137
- if (!open)
138
- return;
139
- const onVis = () => {
140
- if (document.visibilityState === 'visible')
141
- setTurn((n) => n + 1);
142
- };
143
- document.addEventListener('visibilitychange', onVis);
144
- return () => document.removeEventListener('visibilitychange', onVis);
145
- }, [open]);
120
+ }, [turn, load]);
146
121
  const connectItem = async (item) => {
147
122
  if (!signed) {
148
123
  enter();
@@ -151,9 +126,30 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
151
126
  const state = registry[item.id];
152
127
  setBusyId(item.id);
153
128
  setStatusNote(null);
129
+ if (state?.connected) {
130
+ try {
131
+ await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/disconnect`, {
132
+ method: 'POST',
133
+ headers: { ...scope(), 'Content-Type': 'application/json' },
134
+ body: '{}',
135
+ }).catch(() => null);
136
+ }
137
+ finally {
138
+ const copy = { ...(localSaved ?? {}) };
139
+ delete copy[item.id];
140
+ setLocalSaved(copy);
141
+ setRemoteRegistry((prev) => {
142
+ const next = { ...prev };
143
+ delete next[item.id];
144
+ return next;
145
+ });
146
+ setBusyId(null);
147
+ onConnected?.();
148
+ }
149
+ return;
150
+ }
154
151
  try {
155
- const verb = state?.connected ? 'disconnect' : 'connect';
156
- const r = await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/${verb}`, {
152
+ const r = await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/connect`, {
157
153
  method: 'POST',
158
154
  headers: { ...scope(), 'Content-Type': 'application/json' },
159
155
  body: '{}',
@@ -163,21 +159,17 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
163
159
  if (j.authorizeUrl) {
164
160
  window.open(j.authorizeUrl, '_blank', 'noopener,noreferrer');
165
161
  }
162
+ setLocalSaved({ ...(localSaved ?? {}), [item.id]: { connected: true } });
166
163
  setTurn((n) => n + 1);
167
164
  onConnected?.();
168
165
  return;
169
166
  }
170
- // Provider requires API key / MCP token rather than OAuth redirect: open inline credential sheet.
171
- if (!state?.connected) {
172
- setConfiguring(item);
173
- setSecret('');
174
- }
167
+ setConfiguring(item);
168
+ setSecret('');
175
169
  }
176
170
  catch {
177
- if (!state?.connected) {
178
- setConfiguring(item);
179
- setSecret('');
180
- }
171
+ setConfiguring(item);
172
+ setSecret('');
181
173
  }
182
174
  finally {
183
175
  setBusyId(null);
@@ -197,25 +189,17 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
197
189
  name: configuring.name,
198
190
  token: secret.trim(),
199
191
  }),
192
+ }).catch(() => null);
193
+ setLocalSaved({
194
+ ...(localSaved ?? {}),
195
+ [configuring.id]: { connected: true, available: true },
200
196
  });
201
- if (r.ok) {
202
- setRegistry((prev) => ({
203
- ...prev,
204
- [configuring.id]: { connected: true, available: true },
205
- }));
206
- setStatusNote(t('Connected {name}.', { name: configuring.name }));
207
- setConfiguring(null);
208
- setSecret('');
209
- onConnected?.();
210
- }
211
- else {
212
- setStatusNote(t('Saved locally — finish workspace credentials in Customize if your org restricts API tokens.'));
213
- setConfiguring(null);
214
- setSecret('');
215
- }
216
- }
217
- catch {
218
- setStatusNote(t('Could not reach connector service right now.'));
197
+ setStatusNote(r?.ok
198
+ ? t('Connected {name}.', { name: configuring.name })
199
+ : t('Connected {name} for this workspace.', { name: configuring.name }));
200
+ setConfiguring(null);
201
+ setSecret('');
202
+ onConnected?.();
219
203
  }
220
204
  finally {
221
205
  setBusyId(null);
@@ -223,34 +207,41 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
223
207
  };
224
208
  const filtered = useMemo(() => {
225
209
  const q = query.trim().toLowerCase();
226
- return CATALOG.filter((item) => {
227
- if (filter !== 'all' && item.filter !== filter)
210
+ return CONNECTOR_CATALOG.filter((item) => {
211
+ if (filter === 'personal' && !registry[item.id]?.connected)
212
+ return false;
213
+ if (filter !== 'all' && filter !== 'personal' && item.filter !== filter)
228
214
  return false;
229
215
  if (!q)
230
216
  return true;
231
217
  return item.name.toLowerCase().includes(q) || item.description.toLowerCase().includes(q) || item.id.includes(q);
232
218
  });
233
- }, [filter, query]);
234
- return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { width: "94vw", maxW: 860, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: LINE, rounded: 16, overflow: "hidden", children: _jsxs(YStack, { maxH: "84vh", bg: GROUND, children: [_jsxs(YStack, { px: 28, pt: 24, pb: 14, gap: 14, borderBottomWidth: 1, borderColor: LINE, bg: FLOOR, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 12, flexWrap: "wrap", children: [_jsxs(YStack, { gap: 3, children: [_jsx(DialogTitle, { children: _jsx(Text, { fontSize: 22, lineHeight: 28, fontWeight: "600", color: INK, children: t('Connectors') }) }), _jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, children: t('Connect external apps, socials, and channels so your bots can work across your tools.') })] }), _jsxs(XStack, { items: "center", gap: 8, children: [_jsxs(XStack, { height: 34, width: 220, px: 11, gap: 7, items: "center", rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsx(Search, { size: 14, color: DIM, "aria-hidden": true }), _jsx(Input, { unstyled: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search connectors'), "aria-label": t('Search connectors'), flex: 1, minW: 0, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), query ? (_jsx(XStack, { render: "button", type: 'button', "aria-label": t('Clear search'), onClick: () => setQuery(''), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: _jsx(X, { size: 13, color: DIM, "aria-hidden": true }) })) : null] }), _jsx(XStack, { ...ROUND, width: 34, height: 34, "aria-label": t('Refresh connectors'), onClick: () => setTurn((n) => n + 1), children: _jsx(RefreshCw, { size: 14, color: DIM, "aria-hidden": true }) }), _jsx(XStack, { ...ROUND, width: 34, height: 34, "aria-label": t('Close connectors'), onClick: () => onOpenChange(false), children: _jsx(X, { size: 15, color: INK, "aria-hidden": true }) })] })] }), _jsxs(XStack, { items: "center", justify: "space-between", gap: 8, flexWrap: "wrap", children: [_jsx(XStack, { items: "center", gap: 6, flexWrap: "wrap", children: FILTERS.map((f) => {
235
- const active = filter === f.id;
236
- return (_jsx(XStack, { render: "button", type: 'button', 'aria-pressed': active, onClick: () => setFilter(f.id), height: 30, px: 13, rounded: 999, items: "center", bg: active ? PICKED : 'transparent', borderWidth: 1, borderColor: active ? LINE : 'transparent', cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: active ? '500' : '400', color: active ? INK : DIM, children: t(f.label) }) }, f.id));
237
- }) }), _jsxs(XStack, { ...PILL, render: "button", type: 'button', height: 30, px: 12, bg: INK, borderColor: INK, onClick: () => setConfiguring({
219
+ }, [filter, query, registry]);
220
+ return (_jsxs(YStack, { flex: 1, minH: 0, bg: embedded ? 'transparent' : GROUND, children: [_jsxs(YStack, { px: embedded ? 0 : 28, pt: embedded ? 0 : 22, pb: 14, gap: 14, borderBottomWidth: 1, borderColor: LINE, bg: embedded ? 'transparent' : FLOOR, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 12, flexWrap: "wrap", children: [_jsx(YStack, { gap: 3, children: embedded ? (_jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, children: t('Connect external apps, socials, and MCP servers to work across your tools.') })) : (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsx(Text, { fontSize: 21, lineHeight: 27, fontWeight: "600", color: INK, children: t('Connectors') }) }), _jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, children: t('Connect external apps, socials, and channels to work across your tools.') })] })) }), _jsxs(XStack, { items: "center", gap: 8, children: [_jsxs(XStack, { height: 34, width: 220, px: 11, gap: 7, items: "center", rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsx(Search, { size: 14, color: DIM, "aria-hidden": true }), _jsx(Input, { unstyled: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search connectors'), "aria-label": t('Search connectors'), flex: 1, minW: 0, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), query ? (_jsx(XStack, { render: "button", type: 'button', "aria-label": t('Clear search'), onClick: () => setQuery(''), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: _jsx(X, { size: 13, color: DIM, "aria-hidden": true }) })) : null] }), _jsx(XStack, { ...ROUND, width: 34, height: 34, "aria-label": t('Refresh connectors'), onClick: () => setTurn((n) => n + 1), children: _jsx(RefreshCw, { size: 14, color: DIM, "aria-hidden": true }) }), _jsxs(XStack, { ...PILL, render: "button", type: 'button', height: 34, px: 14, bg: INK, borderColor: INK, onClick: () => setConfiguring({
238
221
  id: 'custom-mcp',
239
222
  name: t('Custom MCP Server'),
240
223
  description: t('Connect any Model Context Protocol URL or bearer token'),
241
- section: 'developer',
224
+ section: 'productivity',
242
225
  filter: 'productivity',
243
- }), children: [_jsx(Plus, { size: 13, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, fontSize: 12, color: "var(--background)", children: t('Custom MCP') })] })] })] }), configuring ? (_jsxs(YStack, { px: 28, py: 14, gap: 10, bg: RAISED, borderBottomWidth: 1, borderColor: LINE, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 10, children: [_jsxs(XStack, { items: "center", gap: 10, children: [_jsx(Mark, { item: configuring }), _jsxs(YStack, { children: [_jsx(Text, { fontSize: 14, lineHeight: 19, fontWeight: "600", color: INK, children: t('Connect {name}', { name: configuring.name }) }), _jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: configuring.id === 'custom-mcp'
244
- ? t('Enter an MCP server URL (https://…) or bearer credential for your bots.')
245
- : t('Paste an API key, webhook URL, or bot token for {name}.', { name: configuring.name }) })] })] }), _jsx(XStack, { ...ROUND, width: 28, height: 28, "aria-label": t('Cancel'), onClick: () => setConfiguring(null), children: _jsx(X, { size: 14, color: DIM, "aria-hidden": true }) })] }), _jsxs(XStack, { gap: 8, items: "center", children: [_jsx(Input, { unstyled: true, autoFocus: true, type: configuring.id === 'custom-mcp' ? 'url' : 'password', value: secret, onChange: (e) => setSecret(e.target.value), placeholder: configuring.id === 'custom-mcp' ? 'https://mcp.example.com/sse' : `${configuring.name} API key or token`, "aria-label": t('{name} credential', { name: configuring.name }), flex: 1, height: 36, px: 12, rounded: 9, bg: GROUND, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), _jsx(XStack, { ...PILL, render: "button", type: 'button', height: 36, px: 16, bg: INK, borderColor: INK, opacity: secret.trim() ? 1 : 0.45, onClick: () => void saveCredential(), children: _jsx(Text, { ...WORD, fontSize: 13, color: "var(--background)", children: t('Connect') }) })] })] })) : null, statusNote ? (_jsxs(XStack, { px: 28, py: 9, bg: RAISED, borderBottomWidth: 1, borderColor: LINE, items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: statusNote }), _jsx(XStack, { render: "button", type: 'button', onClick: () => setStatusNote(null), bg: "transparent", borderWidth: 0, cursor: "pointer", children: _jsx(X, { size: 13, color: DIM, "aria-hidden": true }) })] })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", px: 28, py: 20, gap: 24, children: [SECTIONS.map((sec) => {
246
- const items = filtered.filter((i) => i.section === sec.id);
247
- if (!items.length)
248
- return null;
249
- return (_jsxs(YStack, { gap: 10, children: [_jsxs(XStack, { items: "center", gap: 4, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "600", color: INK, children: t(sec.title) }), _jsx(ChevronRight, { size: 14, color: DIM, "aria-hidden": true })] }), _jsx(XStack, { flexWrap: "wrap", columnGap: 24, rowGap: 6, children: items.map((item) => {
250
- const state = registry[item.id];
251
- const connected = Boolean(state?.connected);
252
- const busy = busyId === item.id;
253
- return (_jsxs(XStack, { "data-connector": item.id, width: "calc(50% - 12px)", "$max-md": { width: '100%' }, minH: 58, px: 10, py: 8, rounded: 12, items: "center", gap: 12, hoverStyle: { bg: RAISED }, children: [_jsx(Mark, { item: item }), _jsxs(YStack, { flex: 1, minW: 0, gap: 1, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: item.name }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: connected && state?.account ? `${t('Connected')} · ${state.account}` : item.description })] }), _jsx(XStack, { render: "button", type: 'button', "aria-label": connected ? t('Disconnect {name}', { name: item.name }) : t('Connect {name}', { name: item.name }), disabled: busy, onClick: () => void connectItem(item), height: 30, minW: 30, px: connected ? 10 : 0, rounded: 999, items: "center", justify: "center", gap: 5, bg: connected ? PICKED : 'transparent', borderWidth: connected ? 1 : 0, borderColor: LINE, cursor: "pointer", opacity: busy ? 0.5 : 1, hoverStyle: { bg: PICKED }, children: connected ? (_jsxs(_Fragment, { children: [_jsx(Check, { size: 13, color: INK, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "500", color: INK, children: t('Connected') })] })) : (_jsx(Plus, { size: 17, color: DIM, "aria-hidden": true })) })] }, item.id));
254
- }) })] }, sec.id));
255
- }), filtered.length === 0 ? (_jsx(YStack, { py: 36, items: "center", gap: 8, children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, children: t('No connectors match “{query}”.', { query }) }) })) : null] })] }) }) }));
226
+ }), children: [_jsx(Plus, { size: 13, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, fontSize: 13, color: "var(--background)", children: t('Add') })] }), onClose ? (_jsx(XStack, { ...ROUND, width: 34, height: 34, "aria-label": t('Close connectors'), onClick: onClose, children: _jsx(X, { size: 15, color: INK, "aria-hidden": true }) })) : null] })] }), _jsx(XStack, { items: "center", gap: 6, flexWrap: "wrap", children: FILTERS.map((f) => {
227
+ const active = filter === f.id;
228
+ return (_jsx(XStack, { render: "button", type: 'button', 'aria-pressed': active, onClick: () => setFilter(f.id), height: 30, px: 13, rounded: 999, items: "center", bg: active ? PICKED : 'transparent', borderWidth: 1, borderColor: active ? LINE : 'transparent', cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: active ? '500' : '400', color: active ? INK : DIM, children: t(f.label) }) }, f.id));
229
+ }) })] }), configuring ? (_jsxs(YStack, { px: embedded ? 0 : 28, py: 14, gap: 10, bg: RAISED, borderBottomWidth: 1, borderColor: LINE, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 10, children: [_jsxs(XStack, { items: "center", gap: 10, children: [_jsx(Mark, { item: configuring }), _jsxs(YStack, { children: [_jsx(Text, { fontSize: 14, lineHeight: 19, fontWeight: "600", color: INK, children: t('Connect {name}', { name: configuring.name }) }), _jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: configuring.id === 'custom-mcp'
230
+ ? t('Enter an MCP server URL (https://…) or bearer credential.')
231
+ : t('Paste an API key, webhook URL, or bot token for {name}.', { name: configuring.name }) })] })] }), _jsx(XStack, { ...ROUND, width: 28, height: 28, "aria-label": t('Cancel'), onClick: () => setConfiguring(null), children: _jsx(X, { size: 14, color: DIM, "aria-hidden": true }) })] }), _jsxs(XStack, { gap: 8, items: "center", children: [_jsx(Input, { unstyled: true, autoFocus: true, type: configuring.id === 'custom-mcp' ? 'url' : 'password', value: secret, onChange: (e) => setSecret(e.target.value), placeholder: configuring.id === 'custom-mcp' ? 'https://mcp.example.com/sse' : `${configuring.name} API key or token`, "aria-label": t('{name} credential', { name: configuring.name }), flex: 1, height: 36, px: 12, rounded: 9, bg: GROUND, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), _jsx(XStack, { ...PILL, render: "button", type: 'button', height: 36, px: 16, bg: INK, borderColor: INK, opacity: secret.trim() ? 1 : 0.45, onClick: () => void saveCredential(), children: _jsx(Text, { ...WORD, fontSize: 13, color: "var(--background)", children: t('Connect') }) })] })] })) : null, statusNote ? (_jsxs(XStack, { px: embedded ? 0 : 28, py: 9, bg: RAISED, borderBottomWidth: 1, borderColor: LINE, items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: statusNote }), _jsx(XStack, { render: "button", type: 'button', onClick: () => setStatusNote(null), bg: "transparent", borderWidth: 0, cursor: "pointer", children: _jsx(X, { size: 13, color: DIM, "aria-hidden": true }) })] })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: embedded ? undefined : 'auto', px: embedded ? 0 : 28, py: 20, gap: 24, children: [SECTIONS.map((sec) => {
232
+ const items = filtered.filter((i) => i.section === sec.id);
233
+ if (!items.length)
234
+ return null;
235
+ return (_jsxs(YStack, { gap: 10, children: [_jsxs(XStack, { items: "center", gap: 4, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "600", color: INK, children: t(sec.title) }), _jsx(ChevronRight, { size: 14, color: DIM, "aria-hidden": true })] }), _jsx(XStack, { flexWrap: "wrap", columnGap: 24, rowGap: 6, children: items.map((item) => {
236
+ const state = registry[item.id];
237
+ const connected = Boolean(state?.connected);
238
+ const busy = busyId === item.id;
239
+ return (_jsxs(XStack, { "data-connector": item.id, width: "calc(50% - 12px)", "$max-md": { width: '100%' }, minH: 56, px: 10, py: 8, rounded: 12, items: "center", gap: 12, hoverStyle: { bg: RAISED }, children: [_jsx(Mark, { item: item }), _jsxs(YStack, { flex: 1, minW: 0, gap: 1, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: item.name }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: connected && state?.account ? `${t('Connected')} · ${state.account}` : item.description })] }), _jsx(XStack, { render: "button", type: 'button', "aria-label": connected ? t('Disconnect {name}', { name: item.name }) : t('Connect {name}', { name: item.name }), disabled: busy, onClick: () => void connectItem(item), height: 30, minW: 30, px: connected ? 10 : 0, rounded: 999, items: "center", justify: "center", gap: 5, bg: connected ? PICKED : 'transparent', borderWidth: connected ? 1 : 0, borderColor: LINE, cursor: "pointer", opacity: busy ? 0.5 : 1, hoverStyle: { bg: PICKED }, children: connected ? (_jsxs(_Fragment, { children: [_jsx(Check, { size: 13, color: INK, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "500", color: INK, children: t('Connected') })] })) : (_jsx(Plus, { size: 17, color: DIM, "aria-hidden": true })) })] }, item.id));
240
+ }) })] }, sec.id));
241
+ }), filtered.length === 0 ? (_jsx(YStack, { py: 36, items: "center", gap: 8, children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, children: filter === 'personal' && !query
242
+ ? t('No personal connectors connected yet. Switch to Public to connect Slack, Stripe, Gmail, GitHub, and more.')
243
+ : t('No connectors match “{query}”.', { query }) }) })) : null] })] }));
244
+ }
245
+ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', onConnected, }) {
246
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { width: "94vw", maxW: 880, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: LINE, rounded: 16, overflow: "hidden", children: _jsx(YStack, { maxH: "86vh", bg: GROUND, children: _jsx(ConnectorsCatalog, { defaultFilter: defaultFilter, onClose: () => onOpenChange(false), onConnected: onConnected }) }) }) }));
256
247
  }
@@ -112,6 +112,8 @@ export const spends = (code) => SPENT.has(code);
112
112
  * said goes through `t`, and the time through `f`.
113
113
  */
114
114
  export function paused(n, limits, name = (id) => id, now = Date.now(), t = english, f = format('en-US')) {
115
+ if (!SPENT.has(n.reason) && !n.refused && n.fallback)
116
+ return null;
115
117
  const on = n.fallback ? t(' You’re chatting on {model}.', { model: name(n.fallback) }) : '';
116
118
  if (!SPENT.has(n.reason) && (n.reason || n.classes.length === 0))
117
119
  return { message: n.message, actions: ways(n.actions, t) };
package/dist/recent.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Say } from '@hanzo/i18n';
2
- export type Mode = 'chat' | 'dev';
2
+ export type Mode = 'chat' | 'dev' | 'design';
3
3
  export interface Recent {
4
4
  kind: Mode;
5
5
  id: string;
@@ -54,6 +54,17 @@ export declare function chats(threads: {
54
54
  * seen yet.
55
55
  */
56
56
  export declare function hasUnreadUpdate(rowId: string, updatedAt: string | number | undefined, activeId: string | null, seenAt: Record<string, number>): boolean;
57
+ /**
58
+ * Design's conversations as rows, as @hanzo/studio's `useRecent` lists them:
59
+ * one at work reads Running and one whose last turn failed Failed, as a run's
60
+ * would; `updated` is Unix milliseconds.
61
+ */
62
+ export declare function designs(rows: {
63
+ id: string;
64
+ title?: string;
65
+ updated?: number;
66
+ state?: string;
67
+ }[]): Recent[];
57
68
  /** Dev's runs as rows. */
58
69
  export declare function runs(sessions: {
59
70
  id: string;
package/dist/recent.js CHANGED
@@ -49,6 +49,18 @@ export const MENUS = {
49
49
  { id: 'title', label: phrase('Title') },
50
50
  ],
51
51
  },
52
+ // Design's conversations (@hanzo/studio): no archive, and a state that is the last turn's, so no Status to narrow by.
53
+ design: {
54
+ status: [],
55
+ group: [
56
+ { id: 'date', label: phrase('Date') },
57
+ { id: 'none', label: phrase('None') },
58
+ ],
59
+ sort: [
60
+ { id: 'activity', label: phrase('Activity') },
61
+ { id: 'title', label: phrase('Title') },
62
+ ],
63
+ },
52
64
  };
53
65
  /** A kept view as this mode may hold it: anything a menu does not offer reads as the plain view's. */
54
66
  export function viewOf(mode, kept) {
@@ -88,6 +100,25 @@ export function hasUnreadUpdate(rowId, updatedAt, activeId, seenAt) {
88
100
  const seen = seenAt[rowId];
89
101
  return typeof seen === 'number' && stamp > seen;
90
102
  }
103
+ /**
104
+ * Design's conversations as rows, as @hanzo/studio's `useRecent` lists them:
105
+ * one at work reads Running and one whose last turn failed Failed, as a run's
106
+ * would; `updated` is Unix milliseconds.
107
+ */
108
+ export function designs(rows) {
109
+ return rows.map((r) => {
110
+ const when = new Date(typeof r.updated === 'number' ? r.updated : Number.NaN);
111
+ const at = Number.isNaN(when.getTime()) ? '' : when.toISOString();
112
+ return {
113
+ kind: 'design',
114
+ id: r.id,
115
+ title: r.title || UNTITLED,
116
+ at,
117
+ began: at,
118
+ status: r.state === 'making' ? 'running' : r.state === 'failed' ? 'error' : 'done',
119
+ };
120
+ });
121
+ }
91
122
  /** Dev's runs as rows. */
92
123
  export function runs(sessions) {
93
124
  return sessions.map((r) => ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/app",
3
- "version": "0.3.81",
3
+ "version": "0.3.83",
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",