@hanzo/app 0.3.75 → 0.3.77
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 +1 -1
- package/dist/Chat.js +81 -79
- package/dist/Prose.js +4 -4
- package/dist/RightPane.d.ts +10 -0
- package/dist/RightPane.js +41 -3
- package/dist/bots/Bots.js +1 -1
- package/dist/bots/ConnectorsDialog.d.ts +7 -0
- package/dist/bots/ConnectorsDialog.js +256 -0
- package/dist/bots/Panel.js +6 -4
- package/dist/bots/Roster.js +7 -6
- package/dist/bots/Thread.js +8 -10
- package/dist/bots/ink.d.ts +1 -1
- package/dist/bots/ink.js +1 -1
- package/dist/bots/kit.d.ts +1 -1
- package/dist/ground.d.ts +6 -3
- package/dist/ground.js +6 -3
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -330,7 +330,7 @@ function Window({ bar, betas }) {
|
|
|
330
330
|
shut();
|
|
331
331
|
setFinding(true);
|
|
332
332
|
};
|
|
333
|
-
return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsx(UsageProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...floor, flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", "$max-md": bar ? undefined : { display: 'none' }, onMouseDown: bar ? dragWindow : undefined, onDoubleClick: bar ? toggleWindowMaximize : undefined, ...(bar?.drag ?? null), children: [_jsxs(XStack, { "data-slot": "title-bar-start", height: "100%", items: "center", gap: 2, pl: (bar?.inset ?? 0) +
|
|
333
|
+
return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(HostProvider, { host: host, children: _jsx(PrefsProvider, { children: _jsx(UsageProvider, { children: _jsxs(YStack, { ref: windowRef, "data-slot": "window", ...floor, flex: 1, minW: 0, height: bar ? '100%' : '100dvh', overflow: "hidden", rounded: bar ? '$3' : undefined, "$max-md": { position: 'fixed', t: TOP, l: 0, r: 0, height: HEIGHT, ...{ overflow: 'clip' } }, children: [_jsxs(XStack, { "data-slot": "title-bar", height: BAR, shrink: 0, items: "center", "$max-md": bar ? undefined : { display: 'none' }, onMouseDown: bar ? dragWindow : undefined, onDoubleClick: bar ? toggleWindowMaximize : undefined, ...(bar?.drag ?? null), children: [_jsxs(XStack, { "data-slot": "title-bar-start", height: "100%", items: "center", gap: 2, pl: (bar?.inset ?? 0) + 4, pr: 6, shrink: 0, width: closed ? RAIL : `calc(${RAIL}px + var(--app-sidebar-span, ${SIDE}px))`, ...(bar?.drag ?? null), children: [_jsx(XStack, { $md: { display: 'none' }, children: _jsx(Toggle, { open: drawer.state === 'open', onPress: drawer.open, label: t('Open sidebar') }) }), _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Toggle, { open: !closed, onPress: flip }) }), _jsx(Mark, { label: t('Back'), "data-slot": "back", onPress: () => router.back(), children: _jsx(ArrowLeft, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Mark, { label: t('Forward'), "data-slot": "forward", onPress: () => router.forward(), children: _jsx(ArrowRight, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) })] }), _jsxs(XStack, { id: "hanzo-titlebar-slot", "data-slot": "title-bar-main", flex: 1, minW: 0, self: "stretch", items: "center", justify: "space-between", pl: 14, pr: 10, gap: 6, ...(bar?.drag ?? null), children: [_jsx(XStack, { "data-slot": "titlebar-fallback", flex: 1, minW: 0, items: "center", justify: "space-between", gap: 8, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: mode === 'chat' ? '' : mode === 'dev' ? 'Dev' : mode === 'studio' ? 'Studio' : mode === 'design' ? 'Design' : mode === 'flow' ? 'Flow' : mode === 'tabs' ? 'Tabs' : '' }) }), bar ? (bar.controls !== undefined ? (bar.controls) : !bar.inset ? (_jsx(WindowControls, {})) : null) : null] })] }), _jsxs(XStack, { ref: drawer.pane, "data-app": mode, "data-slot": "frame", bg: "transparent", ...drawer.slide, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
|
|
334
334
|
// The gap above the pane is the gap at its end and foot; a window's own bar above it is that gap.
|
|
335
335
|
pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsxs(YStack, { height: "100%", position: "relative", "$max-md": { display: 'none' }, children: [_jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, onChat: toChat, onDev: toDev, onDesign: toDesign, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }), closed ? (_jsx(YStack, { "data-slot": "sidebar-reopen-edge", position: "absolute", t: 0, b: 0, r: -4, width: 8, z: 20, cursor: "ew-resize", onDoubleClick: () => setClosed(false), onMouseDown: (down) => {
|
|
336
336
|
const e = down;
|
package/dist/Chat.js
CHANGED
|
@@ -62,7 +62,7 @@ import { Check, ChevronDown, CircleAlert, FileText, Ghost, Image as ImageMark, L
|
|
|
62
62
|
import { ENSO } from "./lib/ai.js";
|
|
63
63
|
import { openThread, empty as emptyOpen, useOpen } from "./open.js";
|
|
64
64
|
import { Side } from "./Shell.js";
|
|
65
|
-
import { SEED, look, useSections, useSites } from "./RightPane.js";
|
|
65
|
+
import { OutputsCard, SEED, look, useSections, useSites } from "./RightPane.js";
|
|
66
66
|
import { Share } from "./Share.js";
|
|
67
67
|
import { ConversationMenu, ThreadMore, useThreadActions, useThreadList } from "./thread.js";
|
|
68
68
|
import { Schedule } from "./Schedule.js";
|
|
@@ -602,6 +602,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
602
602
|
const talkRef = useCallback((el) => setTalkBox(el instanceof HTMLElement ? el : null), []);
|
|
603
603
|
const wide = media.lg;
|
|
604
604
|
const [panel, setPanel] = usePanel(`chat:${at}`, false, wide);
|
|
605
|
+
const [summaryOpen, setSummaryOpen] = useState(false);
|
|
606
|
+
const dockSummary = Boolean(wide && aside === null);
|
|
605
607
|
const deck = useDeck(`chat:${at}`, SEED);
|
|
606
608
|
// The org's sites, which an empty tab suggests.
|
|
607
609
|
const sites = useSites();
|
|
@@ -1983,7 +1985,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1983
1985
|
}, children: t("Log in") }), _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
|
|
1984
1986
|
if (typeof window !== "undefined")
|
|
1985
1987
|
window.location.assign("/signup?next=%2Fchat");
|
|
1986
|
-
}, children: t("Sign up for free") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: currentThread }) }) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 15, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }), _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }), _jsx(XStack, { render: "button", "data-slot": "titlebar-new-chat", "aria-label": t("New chat"), ...{ title: t("New chat") }, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", opacity: 0.78, hoverStyle: { bg: "$hover", opacity: 1 }, onPress: () => {
|
|
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: () => {
|
|
1987
1989
|
emptyOpen();
|
|
1988
1990
|
go("/chat");
|
|
1989
1991
|
}, children: _jsx(SquarePlus, { size: 15, strokeWidth: 1.75, "aria-hidden": true }) })] })] }), titlebarSlot)
|
|
@@ -2014,83 +2016,83 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2014
2016
|
}, children: t("Sign up for free") }) }), _jsx(XStack, { display: "flex", $sm: { display: "none" }, children: _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup-compact", onPress: () => {
|
|
2015
2017
|
if (typeof window !== "undefined")
|
|
2016
2018
|
window.location.assign("/signup?next=%2Fchat");
|
|
2017
|
-
}, children: t("Sign up") }) })] })) : free && (sidebarClosed || !media.md) ? (_jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t("Upgrade plan"), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t("Upgrade plan") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, {}) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, onOpen: () => setPanel(true), label: t("Summary") }) }), inTopChrome ? null : (_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) }))] })] })), wide && aside !== null ? (_jsx(Side, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null,
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2019
|
+
}, children: t("Sign up") }) })] })) : free && (sidebarClosed || !media.md) ? (_jsxs(XStack, { render: "button", "data-slot": "header-upgrade", "aria-label": t("Upgrade plan"), items: "center", gap: "$1.5", px: "$2", py: "$1", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => window.location.assign(payUrl('/cart', { org: org(), returnUrl: window.location.href })), children: [_jsx(Sparkles, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 15, lineHeight: 20, fontWeight: "500", color: "$soft", numberOfLines: 1, children: t("Upgrade plan") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, {}) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 32, height: 32, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 16, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(Summary, { sections: sections, docked: dockSummary, open: summaryOpen, onOpenChange: setSummaryOpen, onOpen: () => setPanel(true), label: t("Summary") }) }), inTopChrome ? null : (_jsx(XStack, { "$max-md": { display: 'none' }, children: _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }) }))] })] })), wide && aside !== null ? (_jsx(Side, { children: _jsx(Panel, { side: deck, kinds: NONE, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) })) : null, !wide && panel ? _jsx(Panel, { side: deck, kinds: NONE, sheet: true, onHide: () => setPanel(false), label: t("Tabs"), ...browsing }) : null, _jsxs(XStack, { flex: 1, minH: 0, minW: 0, children: [_jsxs(YStack, { ref: talkRef, "data-slot": "talk", flex: 1, minH: 0, minW: 0, position: "relative", children: [_jsx(ChatSurface, { ...chat, messages: shown, send: guarded,
|
|
2020
|
+
// WHILE NOTHING HAS BEEN SAID, from a tablet up, the opening and the
|
|
2021
|
+
// composer are one pair centred in the pane (`center`: rows `1fr auto auto
|
|
2022
|
+
// 1fr`), so the heading reads close above the field and nothing stands at
|
|
2023
|
+
// the window's foot (owner, 2026-10-30). A phone keeps the composer at the
|
|
2024
|
+
// foot, over the keyboard, from the first moment; once a turn exists every
|
|
2025
|
+
// width does, and the transcript scrolls under it.
|
|
2026
|
+
center: media.md,
|
|
2027
|
+
// AS IT WAS WRITTEN. The package renders a turn's words plainly and
|
|
2028
|
+
// says so — it ships no markdown pipeline because the plugin set is the
|
|
2029
|
+
// surface's to choose — so an answer arrived here reading "```ts" with
|
|
2030
|
+
// the backticks on screen. `Prose` is the site's one renderer, reading
|
|
2031
|
+
// with the same `marked` the legal pages parse with and drawing every
|
|
2032
|
+
// token in gui elements, and the shared view draws through it too.
|
|
2033
|
+
body: (turn) => {
|
|
2034
|
+
if (String(turn.id).startsWith(`${FAILED}:`)) {
|
|
2035
|
+
const question = shown.find((one) => one.id === String(turn.id).slice(FAILED.length + 1));
|
|
2036
|
+
return question ? failure(question) : null;
|
|
2037
|
+
}
|
|
2038
|
+
// A QUESTION THAT CARRIED PICTURES draws them beside its words.
|
|
2039
|
+
if (turn.role === "user" && Array.isArray(turn.content)) {
|
|
2040
|
+
const parts = partsOf(turn.content);
|
|
2041
|
+
return (_jsx(YStack, { gap: "$1", children: _jsx(Parts, { parts: parts, prose: (text) => _jsx(Prose, { text: text }) }) }));
|
|
2042
|
+
}
|
|
2043
|
+
const said = typeof turn.content === "string" ? turn.content : "";
|
|
2044
|
+
// A QUESTION THAT CARRIED FILES draws its words and the files' chips;
|
|
2045
|
+
// the passages it handed the model are the model's to read, not ours.
|
|
2046
|
+
if (turn.role === "user" && said) {
|
|
2047
|
+
const read = told(said);
|
|
2048
|
+
if (read.carried)
|
|
2049
|
+
return (_jsx(YStack, { gap: "$1", children: _jsx(Carried, { text: read.text, attached: read.carried.attached, reused: read.carried.reused, onOpen: openFile, onSave: anonymous ? undefined : (url, id, f) => keepOne(url, id, f.name, f.type) }) }));
|
|
2050
|
+
}
|
|
2051
|
+
// WHILE THE ANSWER HAS NO WORDS YET: who is answering (the agents the
|
|
2052
|
+
// question addresses, or the whole cast when it names nobody), and the
|
|
2053
|
+
// model's reasoning as it streams (`reasoning` on the turn), dimmed and
|
|
2054
|
+
// cut to its last lines.
|
|
2055
|
+
const thought = turn.role === "assistant" && !said && chat.streaming ? (turn.reasoning ?? "").trim() : "";
|
|
2056
|
+
if (turn.role === "assistant" && !said && chat.streaming && (cast.length || thought)) {
|
|
2057
|
+
const q = [...shown].reverse().find((one) => one.role === "user");
|
|
2058
|
+
const whom = cast.length ? addressed(words(q?.content), cast) : [];
|
|
2059
|
+
return (_jsxs(YStack, { gap: "$1", "data-slot": "thinking", children: [_jsx(Text, { fontSize: "$2", color: "$soft", children: whom.length
|
|
2060
|
+
? whom.length > 1
|
|
2061
|
+
? thought
|
|
2062
|
+
? t("{names} are thinking…", { names: join(whom, t) })
|
|
2063
|
+
: t("{names} are answering…", { names: join(whom, t) })
|
|
2064
|
+
: thought
|
|
2065
|
+
? t("{names} is thinking…", { names: join(whom, t) })
|
|
2066
|
+
: t("{names} is answering…", { names: join(whom, t) })
|
|
2067
|
+
: t("Thinking…") }), thought ? (_jsx(Text, { fontSize: "$2", color: "$soft", opacity: 0.72, "data-slot": "thought", children: thought.length > THOUGHT ? `…${thought.slice(-THOUGHT).replace(/^\S*\s/, "")}` : thought })) : null] }));
|
|
2068
|
+
}
|
|
2069
|
+
// A CAST'S ANSWER IS SEVERAL PEOPLE'S. Each opens a line with their
|
|
2070
|
+
// name, as the brief asks, so each is drawn under their own face and
|
|
2071
|
+
// read in their own voice. A reply that names nobody is drawn whole.
|
|
2072
|
+
const parts = turn.role === "assistant" ? speakers(said, known) : null;
|
|
2073
|
+
if (parts && parts.some((part) => part.who)) {
|
|
2074
|
+
// Asked and silent: an agent the question addressed who has no part
|
|
2075
|
+
// in this reply.
|
|
2076
|
+
const at = shown.findIndex((one) => one.id === turn.id);
|
|
2077
|
+
const q = shown.slice(0, at).reverse().find((one) => one.role === "user");
|
|
2078
|
+
const silent = cast.length > 1 && !(chat.streaming && at === shown.length - 1)
|
|
2079
|
+
? addressed(words(q?.content), cast).filter((name) => !parts.some((part) => part.who?.toLowerCase() === name.toLowerCase()))
|
|
2080
|
+
: [];
|
|
2081
|
+
return (_jsxs(YStack, { gap: "$3", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: [parts.map((part, i) => (_jsxs(YStack, { gap: "$1", children: [part.who ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Face, { src: faces[part.who]?.avatar, emoji: faces[part.who]?.emoji, name: part.who, size: 20 }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: part.who })] })) : null, _jsx(Prose, { text: part.text }), part.text ? (_jsx(Reply, { text: part.text, title: shownTitle, listen: listen(part.who ?? withWhom ?? undefined), onOpen: opener(part.text), onRedo: (act) => redoTurn(turn.id, act), onBranch: () => branchTurn(turn.id) })) : null] }, i))), silent.length ? (_jsx(Text, { fontSize: "$2", color: "$soft", children: t("No answer from {names} in this reply.", { names: join(silent, t) }) })) : null, byline(turn.id)] }));
|
|
2082
|
+
}
|
|
2083
|
+
const ms = turn.durationMs;
|
|
2084
|
+
const worked = turn.role === "assistant" && typeof ms === "number" && ms >= 1000 ? ms : 0;
|
|
2085
|
+
return (_jsxs(YStack, { gap: "$1.5", "data-turn-id": String(turn.id), "data-turn-role": turn.role, children: [worked ? (_jsx(Text, { "data-slot": "worked-for", fontSize: "$2", color: "$soft", children: t("Worked for {n}s", { n: Math.round(worked / 1000) }) })) : null, _jsx(Prose, { text: said }), turn.role === "assistant" && said ? (_jsx(Reply, { text: said, title: shownTitle, listen: listen(withWhom ?? undefined), onOpen: opener(said), onRedo: (act) => redoTurn(turn.id, act), onBranch: () => branchTurn(turn.id) })) : null, turn.role === "assistant" && said ? byline(turn.id) : null] }));
|
|
2086
|
+
},
|
|
2087
|
+
// The page's ONE heading, and it belongs to the empty transcript rather
|
|
2088
|
+
// than to a signed-out branch — the branch is gone, and the heading went
|
|
2089
|
+
// with it when it did. `Ask` passes its own, because the page embedding
|
|
2090
|
+
// it already has an `<h1>` and a second is the defect that took the
|
|
2091
|
+
// landings off /chat and /dev.
|
|
2092
|
+
empty: heading === null ? undefined : (_jsxs(YStack, { "data-slot": "opening", items: "center", justify: "flex-end", width: "100%", height: "100%", pt: "$6", pb: "$2", children: [cast.length > 1 ? (_jsx(XStack, { items: "center", justify: "center", mb: "$4", children: cast.map((name, i) => (_jsx(Box, { marginInlineStart: i ? -16 : 0, rounded: 40, borderWidth: 2, borderColor: "$background", z: cast.length - i, children: _jsx(Face, { src: faces[name]?.avatar, emoji: faces[name]?.emoji, name: name, size: 72 }) }, name))) })) : portrait ? (_jsx(Box, { width: 160, height: 160, rounded: 24, overflow: "hidden", borderWidth: 2, borderColor: "var(--white-15)", boxShadow: "0 10px 24px color-mix(in srgb, var(--pure-black) 70%, transparent)", mb: "$4", bg: "var(--neutral-900)", children: _jsx(View, { render: _jsx("img", { src: portrait, alt: withWhom }), width: "100%", height: "100%", objectFit: "cover" }) })) : null, cast.length === 1 && !portrait ? (_jsx(Box, { mb: "$3", children: _jsx(Face, { emoji: mate?.emoji ?? persona?.emoji, name: withWhom, size: 72 }) })) : null, cast.length === 0 && !portrait ? (_jsx(Box, { mb: "$3", "data-slot": "opening-mark", children: _jsx(ProviderMark, { org: "hanzo", size: 44, ink: true }) })) : null, _jsx(Text, { render: "h1", fontSize: "$7", lineHeight: "$7", fontWeight: "700", color: "$ink", text: "center", mb: "$1", children: join(cast, t) || heading || (firstName ? t("Good to see you, {name}. What’s next?", { name: firstName }) : t("What’s next?")) }), cast.length === 1 && (mate?.description ?? persona?.description) ? (_jsx(Text, { fontSize: "$3", color: "$soft", text: "center", maxW: 500, mb: "$4", lineHeight: "$4", children: mate?.description ?? persona?.description })) : null] })),
|
|
2093
|
+
// The transcript reads at the same measure as Composer (`--container-prose`, 48rem),
|
|
2094
|
+
// so user bubbles, assistant output cards, and the composer share exact left/right edges.
|
|
2095
|
+
column: { maxW: "var(--container-prose, 48rem)" }, composer: composer }), _jsx(ToBottom, { within: talkBox })] }), dockSummary && summaryOpen ? (_jsx(OutputsCard, { sections: sections, label: t("Summary"), onOpen: () => setPanel(true), onClose: () => setSummaryOpen(false) })) : null] }), _jsx(AgentMaker, {}), carry.dialog, _jsx(Dialog, { open: anonPluginsOpen, onOpenChange: setAnonPluginsOpen, children: _jsxs(DialogContent, { maxW: 480, width: "100%", gap: "$3", "data-slot": "anon-plugins-dialog", children: [_jsx(DialogTitle, { children: t("Plugins & Skills") }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t("Enable plugins and skills for this conversation, or type / and @ in the composer.") }), _jsxs(YStack, { maxH: 320, overflow: "scroll", gap: "$1.5", children: [carry.plugins.rows.map((p) => (_jsxs(XStack, { render: "button", onPress: () => carry.plugins.pick(p.id), items: "center", justify: "space-between", p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: p.on ? "$ink" : "$borderColor", bg: p.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, flex: 1, children: [p.icon, _jsxs(YStack, { minW: 0, flex: 1, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: p.label }), p.note ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: p.note })) : null] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: p.on ? "$ink" : "$soft", children: p.on ? t("On") : t("Plugin") })] }, `plugin:${p.id}`))), carry.skills.rows.slice(0, 24).map((s) => (_jsxs(XStack, { render: "button", onPress: () => carry.skills.pick(s.id), items: "center", justify: "space-between", p: "$2", rounded: "$3", borderWidth: 1, borderColor: s.on ? "$ink" : "$borderColor", bg: s.on ? "$hover" : "transparent", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: [_jsxs(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, children: [s.icon, _jsxs(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: ["/", s.label] })] }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: s.on ? "$ink" : "$soft", children: s.on ? t("On") : t("Skill") })] }, `skill:${s.id}`)))] })] }) }), _jsx(Dialog, { open: anonGateOpen, onOpenChange: setAnonGateOpen, children: _jsxs(DialogContent, { maxW: 480, rounded: "$6", gap: "$3.5", children: [_jsx(DialogTitle, { children: t("Sign in to continue chatting") }), _jsx(Text, { fontSize: "$3", color: "$soft", lineHeight: "$4", children: t("Sign in or create a free Hanzo account to save this conversation and continue chatting.") }), _jsxs(YStack, { gap: "$2", pt: "$1", children: [_jsx(Button, { variant: "primary", size: "lg", width: "100%", onPress: () => window.location.assign("/signup?next=%2Fchat"), children: t("Create Free Account") }), _jsx(Button, { variant: "outline", size: "default", width: "100%", onPress: () => enter(LOGIN), children: t("Sign In") })] }), _jsxs(YStack, { gap: "$2", pt: "$2.5", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$1", fontFamily: "$mono", color: "$soft", children: t("NEED MORE CAPACITY? UPGRADE ANYTIME") }), _jsx(XStack, { gap: "$2", flexWrap: "wrap", children: [
|
|
2094
2096
|
["Go", "Pro"],
|
|
2095
2097
|
["Dev", "Max"],
|
|
2096
2098
|
].flat().map((label) => (_jsx(XStack, { render: "button", onPress: () => {
|
package/dist/Prose.js
CHANGED
|
@@ -4,9 +4,9 @@ import { Anchor, Text, View, XStack, YStack } from '@hanzo/gui';
|
|
|
4
4
|
import { Code } from '@hanzo/ui/chat';
|
|
5
5
|
import { destination, read } from './lib/prose.js';
|
|
6
6
|
const INK = 'var(--foreground)';
|
|
7
|
-
const QUIET = 'var(--muted-foreground)';
|
|
8
|
-
const EDGE = 'var(--border)';
|
|
9
|
-
const GROUND = 'var(--secondary)';
|
|
7
|
+
const QUIET = 'var(--text-secondary, var(--muted-foreground))';
|
|
8
|
+
const EDGE = 'var(--pane-edge, var(--border))';
|
|
9
|
+
const GROUND = 'var(--surface-card-emphasis, var(--secondary))';
|
|
10
10
|
/**
|
|
11
11
|
* The reading type, px: a 16px body on a 24px line, and a heading's size and
|
|
12
12
|
* line by depth, as the reference conversation sets them — the body a reader
|
|
@@ -98,7 +98,7 @@ function blocks(tokens, tone) {
|
|
|
98
98
|
// its language, a copy control, and a body that scrolls SIDEWAYS on its
|
|
99
99
|
// own, because wrapping code changes what it says.
|
|
100
100
|
case 'code':
|
|
101
|
-
return (_jsx(Code, { language: t.lang || 'text', value: t.text, children: t.text }, i));
|
|
101
|
+
return (_jsx(Code, { language: t.lang || 'text', value: t.text, rounded: 12, borderColor: EDGE, bg: "var(--side-fill, var(--card))", children: t.text }, i));
|
|
102
102
|
case 'blockquote':
|
|
103
103
|
return (_jsx(YStack, { render: "blockquote", m: 0, pl: "$3", gap: "$2", borderWidth: 0, borderLeftWidth: 2, borderStyle: "solid", borderColor: EDGE, children: blocks(t.tokens, QUIET) }, i));
|
|
104
104
|
case 'hr':
|
package/dist/RightPane.d.ts
CHANGED
|
@@ -44,6 +44,16 @@ export declare function useSections({ at, said, held, deck, onCreate }: {
|
|
|
44
44
|
deck: Deck;
|
|
45
45
|
onCreate: () => void;
|
|
46
46
|
}): Section[];
|
|
47
|
+
/**
|
|
48
|
+
* Docked inner rounded Outputs / Sources card aligned at the top-right inside
|
|
49
|
+
* the inner Chat pane (`main[data-slot="pane"]`).
|
|
50
|
+
*/
|
|
51
|
+
export declare function OutputsCard({ sections, label, onOpen, onClose, }: {
|
|
52
|
+
sections: Section[];
|
|
53
|
+
label: string;
|
|
54
|
+
onOpen?: () => void;
|
|
55
|
+
onClose?: () => void;
|
|
56
|
+
}): import("react").JSX.Element;
|
|
47
57
|
/**
|
|
48
58
|
* The organization's sites, as an empty tab suggests them: `GET /v1/project`,
|
|
49
59
|
* every row with a live address. Read once a conversation; nothing on a refusal.
|
package/dist/RightPane.js
CHANGED
|
@@ -19,7 +19,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
19
19
|
import { useEffect, useMemo, useState } from 'react';
|
|
20
20
|
import { useI18n } from '@hanzo/i18n/react';
|
|
21
21
|
import { FileCode, Globe, Image as ImageMark, Paperclip, Plus } from 'lucide-react';
|
|
22
|
-
import { Box, DropdownMenu, DropdownMenuContent, DropdownMenuCheckboxItem, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Text, } from '@hanzo/ui';
|
|
22
|
+
import { Box, DropdownMenu, DropdownMenuContent, DropdownMenuCheckboxItem, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, Text, XStack, YStack, } from '@hanzo/ui';
|
|
23
23
|
import { useAi } from '@hanzo/ai/react';
|
|
24
24
|
import { artifacts, name as titleOf, PAGE } from '@hanzo/build';
|
|
25
25
|
import { said as told } from './lib/attach.js';
|
|
@@ -216,12 +216,50 @@ export function useSections({ at, said, held, deck, onCreate }) {
|
|
|
216
216
|
const m = { id: call.id, name: call.name, kind: 'file', body: [call.asked, call.got ?? ''].filter(Boolean).join('\n\n'), mime: 'text/plain' };
|
|
217
217
|
return { ...row(m), title: call.name === 'web_search' || call.name === 'search' ? t('Web search') : call.name, icon: _jsx(Globe, { size: 15, "aria-hidden": true }), detail: call.asked };
|
|
218
218
|
});
|
|
219
|
+
const sourceRows = [...asked, ...took.map(row)];
|
|
219
220
|
return [
|
|
220
|
-
{
|
|
221
|
-
|
|
221
|
+
{
|
|
222
|
+
id: 'outputs',
|
|
223
|
+
title: t('Outputs'),
|
|
224
|
+
action: (_jsx(Box, { render: "button", "aria-label": t('Create a file or site'), onPress: onCreate, p: "$1", rounded: "$2", cursor: "pointer", hoverStyle: { bg: '$hover' }, children: _jsx(Plus, { size: 16, "aria-hidden": true }) })),
|
|
225
|
+
lead: { title: t('Create a file or site'), run: onCreate },
|
|
226
|
+
entries: made.map(row),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
id: 'sources',
|
|
230
|
+
title: t('Sources'),
|
|
231
|
+
action: _jsx(Add, { at: at }),
|
|
232
|
+
lead: sourceRows.length ? undefined : { title: t('Attach files or connect apps'), run: () => take(at, { api: ai, org: org() }) },
|
|
233
|
+
entries: sourceRows,
|
|
234
|
+
},
|
|
222
235
|
];
|
|
223
236
|
}, [at, made, took, done, deck, ai, onCreate, t]);
|
|
224
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Docked inner rounded Outputs / Sources card aligned at the top-right inside
|
|
240
|
+
* the inner Chat pane (`main[data-slot="pane"]`).
|
|
241
|
+
*/
|
|
242
|
+
export function OutputsCard({ sections, label, onOpen, onClose, }) {
|
|
243
|
+
useEffect(() => {
|
|
244
|
+
if (!onClose)
|
|
245
|
+
return;
|
|
246
|
+
const onKeyDown = (e) => {
|
|
247
|
+
if (e.key !== 'Escape' || e.defaultPrevented)
|
|
248
|
+
return;
|
|
249
|
+
if (document.querySelector('[data-slot="dropdown-menu-content"], [role="menu"]'))
|
|
250
|
+
return;
|
|
251
|
+
onClose();
|
|
252
|
+
};
|
|
253
|
+
window.addEventListener('keydown', onKeyDown);
|
|
254
|
+
return () => window.removeEventListener('keydown', onKeyDown);
|
|
255
|
+
}, [onClose]);
|
|
256
|
+
return (_jsx(YStack, { "data-slot": "summary", role: "complementary", "aria-label": label, width: 268, shrink: 0, self: "flex-start", mt: 12, marginInlineEnd: 12, rounded: 12, borderWidth: 1, borderColor: "var(--pane-edge, var(--border))", bg: "var(--side-fill, var(--card))", overflow: "hidden", children: sections.map((s, i) => (_jsxs(YStack, { px: 12, py: 10, gap: 2, borderTopWidth: i ? 1 : 0, borderColor: "var(--pane-edge, var(--border))", children: [_jsxs(XStack, { items: "center", justify: "space-between", minH: 26, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: s.title }), s.action] }), s.lead ? (_jsx(XStack, { render: "button", onPress: s.lead.run, items: "center", minH: 28, px: 6, mx: -6, rounded: "$2", cursor: "pointer", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$2", color: "var(--text-secondary, var(--muted-foreground))", numberOfLines: 1, children: s.lead.title }) })) : null, s.entries.map((e) => (_jsxs(XStack, { render: "button", onPress: e.open
|
|
257
|
+
? () => {
|
|
258
|
+
onOpen?.();
|
|
259
|
+
e.open?.();
|
|
260
|
+
}
|
|
261
|
+
: undefined, items: "center", gap: "$2", minH: 30, px: 6, mx: -6, rounded: "$2", cursor: e.open ? 'pointer' : undefined, hoverStyle: e.open ? { bg: '$hover' } : undefined, children: [e.icon ? (_jsx(XStack, { width: 16, justify: "center", shrink: 0, "$platform-web": { color: 'var(--text-secondary, var(--muted-foreground))' }, children: e.icon })) : null, _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, children: e.title })] }, e.id)))] }, s.id))) }));
|
|
262
|
+
}
|
|
225
263
|
/**
|
|
226
264
|
* The organization's sites, as an empty tab suggests them: `GET /v1/project`,
|
|
227
265
|
* every row with a live address. Read once a conversation; nothing on a refusal.
|
package/dist/bots/Bots.js
CHANGED
|
@@ -295,5 +295,5 @@ export function Bots({ foot = true, bot: held, onBot, } = {}) {
|
|
|
295
295
|
};
|
|
296
296
|
const panel = bot ? (_jsx(Panel, { bot: bot, runs: runs ?? [], kept: kept[bot.name] ?? '', onClose: close, onSchedule: schedule, onDelete: remove, focus: over && !laptop }, bot.name)) : null;
|
|
297
297
|
const shown = laptop ? side : over;
|
|
298
|
-
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [_jsx(YStack, { "data-parity-key": "bots.roster", width:
|
|
298
|
+
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [_jsx(YStack, { "data-parity-key": "bots.roster", width: 260, shrink: 0, height: "100%", bg: FLOOR, borderRightWidth: 1, borderColor: LINE, "$max-md": { width: '100%', borderRightWidth: 0, display: bot ? 'none' : 'flex' }, children: _jsx(Roster, { bots: bots, last: last, open: open, unread: unread, me: foot ? user : null, onPick: pick, onMake: () => setMaking(true), disabled: !live }) }), _jsx(YStack, { "data-parity-key": "bots.center", flex: 1, minW: 0, height: "100%", bg: GROUND, "$max-md": { display: bot ? 'flex' : 'none' }, children: _jsx(Thread, { bot: bot, bots: bots ?? [], runs: runs, pending: pending, notice: notice, wrong: wrong, side: shown, live: live, loaded: bots !== null, onSend: send, onDismiss: () => setNotice(null), onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onMake: () => setMaking(true) }) }), laptop && side && panel ? (_jsx(YStack, { "data-parity-key": "bots.panel", width: 296, shrink: 0, height: "100%", bg: GROUND, borderLeftWidth: 1, borderColor: LINE, "$max-xl": { display: 'none' }, children: panel })) : null, over && panel && !laptop ? (_jsx(YStack, { "data-parity-key": "bots.panel.over", role: "dialog", "aria-modal": true, "aria-label": bot?.name, position: "absolute", t: 0, r: 0, b: 0, width: 296, maxW: "100%", z: 10, bg: GROUND, borderLeftWidth: 1, borderColor: LINE, boxShadow: "var(--shadow-floating)", children: panel })) : null, making ? _jsx(Make, { onDone: made, onCancel: () => setMaking(false) }) : null] }));
|
|
299
299
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ConnectorFilter = 'all' | 'channels' | 'business' | 'productivity';
|
|
2
|
+
export declare function ConnectorsDialog({ open, onOpenChange, defaultFilter, onConnected, }: {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onOpenChange: (open: boolean) => void;
|
|
5
|
+
defaultFilter?: ConnectorFilter;
|
|
6
|
+
onConnected?: () => void;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
'use client';
|
|
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
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
10
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
11
|
+
import { useIam } from '@hanzo/iam/react';
|
|
12
|
+
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
13
|
+
import { Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
|
|
14
|
+
import { Check, ChevronRight, Plug, Plus, RefreshCw, Search, X } from 'lucide-react';
|
|
15
|
+
import { siDropbox, siGithub, siGooglecalendar, siGoogledrive, siHubspot, siLinear, siNotion, siQuickbooks, siShopify, siStripe, siSupabase, } from 'simple-icons';
|
|
16
|
+
import { Network } from '../network.js';
|
|
17
|
+
import { api } from '../lib/api.js';
|
|
18
|
+
import { scope } from '../lib/session.js';
|
|
19
|
+
import { enter } from '../lib/destination.js';
|
|
20
|
+
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
21
|
+
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' },
|
|
26
|
+
{ id: 'telegram', name: 'Telegram', description: 'Run bots across Telegram chats and groups', section: 'channels', filter: 'channels', network: 'telegram' },
|
|
27
|
+
{ id: 'discord', name: 'Discord', description: 'Respond in community servers, channels, and threads', section: 'channels', filter: 'channels', network: 'discord' },
|
|
28
|
+
{ id: 'x', name: 'X', description: 'Post updates, monitor mentions, and reply to DMs', section: 'channels', filter: 'channels', network: 'x' },
|
|
29
|
+
{ id: 'instagram', name: 'Instagram', description: 'Publish media and answer Instagram messages', section: 'channels', filter: 'channels', network: 'instagram' },
|
|
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
|
+
{ id: 'teams', name: 'Microsoft Teams', description: 'Join organization channels and enterprise chats', section: 'channels', filter: 'channels', network: 'teams' },
|
|
33
|
+
{ 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
|
+
{ 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 },
|
|
39
|
+
{ id: 'quickbooks', name: 'Intuit QuickBooks', description: 'Accounting, invoices, payments, and payroll', section: 'business', filter: 'business', icon: siQuickbooks },
|
|
40
|
+
{ 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 },
|
|
44
|
+
{ 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 },
|
|
47
|
+
{ 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
|
+
];
|
|
53
|
+
const SECTIONS = [
|
|
54
|
+
{ id: 'channels', title: 'Messaging & Social' },
|
|
55
|
+
{ id: 'business', title: 'Small Business & Revenue' },
|
|
56
|
+
{ id: 'productivity', title: 'Productivity' },
|
|
57
|
+
{ id: 'developer', title: 'Developer & Data' },
|
|
58
|
+
];
|
|
59
|
+
const FILTERS = [
|
|
60
|
+
{ id: 'all', label: 'All' },
|
|
61
|
+
{ id: 'channels', label: 'Channels & Social' },
|
|
62
|
+
{ id: 'business', label: 'Small Business' },
|
|
63
|
+
{ id: 'productivity', label: 'Productivity & Dev' },
|
|
64
|
+
];
|
|
65
|
+
function Mark({ item }) {
|
|
66
|
+
if (item.network) {
|
|
67
|
+
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
|
+
}
|
|
69
|
+
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 }) }) }));
|
|
72
|
+
}
|
|
73
|
+
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
|
+
}
|
|
75
|
+
export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', onConnected, }) {
|
|
76
|
+
const { t } = useI18n();
|
|
77
|
+
const { isAuthenticated, accessToken } = useIam();
|
|
78
|
+
const signed = isAuthenticated && Boolean(accessToken);
|
|
79
|
+
const [filter, setFilter] = useState(defaultFilter);
|
|
80
|
+
const [query, setQuery] = useState('');
|
|
81
|
+
const [registry, setRegistry] = useState({});
|
|
82
|
+
const [busyId, setBusyId] = useState(null);
|
|
83
|
+
const [configuring, setConfiguring] = useState(null);
|
|
84
|
+
const [secret, setSecret] = useState('');
|
|
85
|
+
const [statusNote, setStatusNote] = useState(null);
|
|
86
|
+
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]);
|
|
95
|
+
const load = useCallback(async () => {
|
|
96
|
+
if (!signed)
|
|
97
|
+
return;
|
|
98
|
+
const headers = scope();
|
|
99
|
+
const next = {};
|
|
100
|
+
const [provRes, connRes] = await Promise.allSettled([
|
|
101
|
+
fetch(`${api()}/v1/provider`, { headers }).then((r) => (r.ok ? r.json() : null)),
|
|
102
|
+
fetch(`${api()}/v1/connection`, { headers }).then((r) => (r.ok ? r.json() : null)),
|
|
103
|
+
]);
|
|
104
|
+
if (provRes.status === 'fulfilled' && provRes.value?.providers) {
|
|
105
|
+
for (const p of provRes.value.providers) {
|
|
106
|
+
const id = String(p.id ?? '').toLowerCase();
|
|
107
|
+
if (!id)
|
|
108
|
+
continue;
|
|
109
|
+
const link = (p.connection ?? {});
|
|
110
|
+
next[id] = {
|
|
111
|
+
connected: Boolean(p.connected),
|
|
112
|
+
available: Boolean(p.available),
|
|
113
|
+
account: String(link.account ?? link.label ?? ''),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (connRes.status === 'fulfilled' && connRes.value?.connectors) {
|
|
118
|
+
for (const c of connRes.value.connectors) {
|
|
119
|
+
const id = String(c.provider ?? c.id ?? '').toLowerCase();
|
|
120
|
+
if (!id)
|
|
121
|
+
continue;
|
|
122
|
+
next[id] = {
|
|
123
|
+
connected: true,
|
|
124
|
+
available: next[id]?.available ?? true,
|
|
125
|
+
account: String(c.account ?? c.name ?? next[id]?.account ?? ''),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
setRegistry(next);
|
|
130
|
+
}, [signed]);
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
if (!open)
|
|
133
|
+
return;
|
|
134
|
+
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]);
|
|
146
|
+
const connectItem = async (item) => {
|
|
147
|
+
if (!signed) {
|
|
148
|
+
enter();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const state = registry[item.id];
|
|
152
|
+
setBusyId(item.id);
|
|
153
|
+
setStatusNote(null);
|
|
154
|
+
try {
|
|
155
|
+
const verb = state?.connected ? 'disconnect' : 'connect';
|
|
156
|
+
const r = await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/${verb}`, {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
headers: { ...scope(), 'Content-Type': 'application/json' },
|
|
159
|
+
body: '{}',
|
|
160
|
+
});
|
|
161
|
+
if (r.ok) {
|
|
162
|
+
const j = (await r.json());
|
|
163
|
+
if (j.authorizeUrl) {
|
|
164
|
+
window.open(j.authorizeUrl, '_blank', 'noopener,noreferrer');
|
|
165
|
+
}
|
|
166
|
+
setTurn((n) => n + 1);
|
|
167
|
+
onConnected?.();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
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
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
if (!state?.connected) {
|
|
178
|
+
setConfiguring(item);
|
|
179
|
+
setSecret('');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
setBusyId(null);
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
const saveCredential = async () => {
|
|
187
|
+
if (!configuring || !secret.trim())
|
|
188
|
+
return;
|
|
189
|
+
setBusyId(configuring.id);
|
|
190
|
+
setStatusNote(null);
|
|
191
|
+
try {
|
|
192
|
+
const r = await fetch(`${api()}/v1/connection`, {
|
|
193
|
+
method: 'POST',
|
|
194
|
+
headers: { ...scope(), 'Content-Type': 'application/json' },
|
|
195
|
+
body: JSON.stringify({
|
|
196
|
+
provider: configuring.id,
|
|
197
|
+
name: configuring.name,
|
|
198
|
+
token: secret.trim(),
|
|
199
|
+
}),
|
|
200
|
+
});
|
|
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.'));
|
|
219
|
+
}
|
|
220
|
+
finally {
|
|
221
|
+
setBusyId(null);
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const filtered = useMemo(() => {
|
|
225
|
+
const q = query.trim().toLowerCase();
|
|
226
|
+
return CATALOG.filter((item) => {
|
|
227
|
+
if (filter !== 'all' && item.filter !== filter)
|
|
228
|
+
return false;
|
|
229
|
+
if (!q)
|
|
230
|
+
return true;
|
|
231
|
+
return item.name.toLowerCase().includes(q) || item.description.toLowerCase().includes(q) || item.id.includes(q);
|
|
232
|
+
});
|
|
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({
|
|
238
|
+
id: 'custom-mcp',
|
|
239
|
+
name: t('Custom MCP Server'),
|
|
240
|
+
description: t('Connect any Model Context Protocol URL or bearer token'),
|
|
241
|
+
section: 'developer',
|
|
242
|
+
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] })] }) }) }));
|
|
256
|
+
}
|
package/dist/bots/Panel.js
CHANGED
|
@@ -7,12 +7,13 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
|
7
7
|
import { useI18n } from '@hanzo/i18n/react';
|
|
8
8
|
import { Text, XStack, YStack } from '@hanzo/gui';
|
|
9
9
|
import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, Switch, } from '@hanzo/ui';
|
|
10
|
-
import { ChevronDown, ChevronRight, Clock, FileText, Image as ImageIcon, X } from 'lucide-react';
|
|
10
|
+
import { ChevronDown, ChevronRight, Clock, FileText, Image as ImageIcon, Plus, X } from 'lucide-react';
|
|
11
11
|
import { useKept } from '../kept.js';
|
|
12
12
|
import { useAi } from '../lib/ai.js';
|
|
13
13
|
import { say } from '../failure.js';
|
|
14
14
|
import { Network, of } from '../network.js';
|
|
15
15
|
import { called } from '../team.js';
|
|
16
|
+
import { ConnectorsDialog } from './ConnectorsDialog.js';
|
|
16
17
|
import { Face } from './face.js';
|
|
17
18
|
import { ALWAYS, answering, disk, grant } from './api.js';
|
|
18
19
|
import { CARD, CLIP, LABEL, PILL, ROUND, WORD } from './kit.js';
|
|
@@ -56,6 +57,7 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
56
57
|
const [saving, setSaving] = useState(false);
|
|
57
58
|
const [wrong, setWrong] = useState(null);
|
|
58
59
|
const [deleting, setDeleting] = useState(false);
|
|
60
|
+
const [connectorsOpen, setConnectorsOpen] = useState(false);
|
|
59
61
|
const [voiceName, setVoiceName] = useKept('hanzo.bots.voice.name', 'Liora');
|
|
60
62
|
const [voiceSpeed, setVoiceSpeed] = useKept('hanzo.bots.voice.speed', '1x');
|
|
61
63
|
const [voiceLang, setVoiceLang] = useKept('hanzo.bots.voice.lang', 'Auto-detect');
|
|
@@ -169,7 +171,7 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
169
171
|
}
|
|
170
172
|
return items.reverse();
|
|
171
173
|
}, [runs, t]);
|
|
172
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": displayName, render: "aside", children: [_jsx(XStack, { height:
|
|
174
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", "aria-label": displayName, render: "aside", children: [_jsx(XStack, { height: 46, shrink: 0, px: 12, items: "center", justify: "flex-end", children: _jsx(XStack, { ...ROUND, "aria-label": t('Close'), onClick: onClose, autoFocus: focus, children: _jsx(X, { size: 16, color: INK, "aria-hidden": true }) }) }), _jsxs(YStack, { items: "center", gap: 12, pt: 2, pb: 18, px: 14, children: [_jsx(Face, { bot: bot, size: 68 }), _jsx(Text, { ...CLIP, maxW: "100%", fontSize: 18, lineHeight: 23, fontWeight: "600", color: INK, children: displayName }), _jsx(XStack, { "data-parity-key": "bots.panel.tabs", role: "tablist", p: 3, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, gap: 2, children: ['activity', 'library'].map((id) => {
|
|
173
175
|
const selected = tab === id;
|
|
174
176
|
return (_jsx(XStack, { render: "button", type: 'button', role: 'tab', 'aria-selected': selected, onClick: () => setTab(id), height: 28, px: 14, rounded: 999, items: "center", justify: "center", bg: selected ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: selected ? '500' : '400', color: selected ? INK : DIM, children: id === 'activity' ? t('Activity') : t('Library') }) }, id));
|
|
175
177
|
}) })] }), tab === 'activity' ? (_jsxs(YStack, { px: 15, pb: 24, gap: 20, children: [cron || answers.length ? (_jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.upcoming", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Upcoming') }), cron ? (_jsx(YStack, { ...CARD, children: _jsx(Row, { mark: _jsx(Clock, { size: 16, color: DIM, "aria-hidden": true }), title: routine, line: scheduleLine, last: true, children: _jsx(Switch, { "aria-label": t('Run {name} on its schedule', { name: displayName }), checked: activeSchedule, disabled: saving, onCheckedChange: (on) => {
|
|
@@ -178,10 +180,10 @@ export function Panel({ bot, runs = [], onClose, kept, onSchedule, onDelete, foc
|
|
|
178
180
|
onSchedule(on, cron === 'paused' ? '0 9 * * *' : cron)
|
|
179
181
|
.catch((e) => setWrong(say(e, t('{name}’s schedule', { name: displayName }), 'save', t)))
|
|
180
182
|
.finally(() => setSaving(false));
|
|
181
|
-
} }) }) })) : null, answers.length ? (_jsx(YStack, { ...CARD, "data-parity-key": "bots.panel.networks", children: answers.map((id, i) => (_jsx(Row, { mark: _jsx(Network, { transport: id, size: 18 }), title: of(id).name, line: t('Connected'), last: i === answers.length - 1, children: _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) }, id))) })) : null] })) : null, boxed ? (_jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Computer') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: computer, disabled: busy || box?.status === 'pending', "aria-label": t(box?.status === 'running' ? 'Open {name}’s computer' : 'Wake {name}’s computer', { name: displayName }), minH: 60, px: 13, py: 10, items: "center", gap: 12, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t("Bot's computer") }), _jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: DIM, children: busy ? t('Waking') : state(box, t) })] }), _jsx(ComputerScreen, { awake: box?.status === 'running' })] })] })) : null, _jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.voice", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Voice chat') }), _jsxs(YStack, { ...CARD, children: [_jsx(VoiceRow, { label: t('Voice'), value: voiceName, options: VOICES, onSelect: setVoiceName }), _jsx(VoiceRow, { label: t('Speed'), value: voiceSpeed, options: SPEEDS, onSelect: setVoiceSpeed }), _jsx(VoiceRow, { label: t('Language'), value: voiceLang, options: LANGUAGES, onSelect: setVoiceLang, last: true })] })] }), wrong ? (_jsx(Text, { render: "p", role: "alert", px: 8, m: 0, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx(XStack, { px: 8, pt: 4, children: _jsx(Text, { render: "button", type: 'button', onClick: () => setDeleting(true), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", fontSize: 13, lineHeight: 18, color: DIM, hoverStyle: { color: INK }, children: t('Delete {name}', { name: displayName }) }) })] })) : (_jsx(YStack, { px: 15, pb: 24, gap: 12, "data-parity-key": "bots.panel.library", children: libraryItems.length ? (_jsx(YStack, { ...CARD, children: libraryItems.map((item, i) => (_jsx(Row, { mark: item.kind === 'doc' ? _jsx(FileText, { size: 16, color: DIM, "aria-hidden": true }) : _jsx(ImageIcon, { size: 16, color: DIM, "aria-hidden": true }), title: item.label, line: item.sub, last: i === libraryItems.length - 1, children: item.href ? _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) : null }, item.key))) })) : (_jsx(YStack, { ...CARD, px: 14, py: 16, items: "center", children: _jsx(Text, { fontSize: 13, lineHeight: 19, color: DIM, text: "center", children: t('Files, documents, and images shared with {name} appear here.', { name: displayName }) }) })) })), _jsx(Dialog, { open: deleting, onOpenChange: setDeleting, children: _jsxs(DialogContent, { maxW: 440, rounded: 20, gap: 14, children: [_jsx(DialogTitle, { children: t('Delete {name}?', { name: displayName }) }), _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: t('{name} and every message it was sent are deleted for good.', { name: displayName }) }), _jsxs(XStack, { gap: 8, justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => setDeleting(false), children: t('Cancel') }), _jsx(XStack, { ...PILL, height: 34, bg: INK, borderColor: INK, hoverStyle: { bg: INK, opacity: 0.9 }, onClick: () => {
|
|
183
|
+
} }) }) })) : null, answers.length ? (_jsx(YStack, { ...CARD, "data-parity-key": "bots.panel.networks", children: answers.map((id, i) => (_jsx(Row, { mark: _jsx(Network, { transport: id, size: 18 }), title: of(id).name, line: t('Connected'), last: i === answers.length - 1, children: _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) }, id))) })) : null] })) : null, _jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.connectors", children: [_jsxs(XStack, { items: "center", justify: "space-between", px: 4, children: [_jsx(Text, { ...LABEL, children: t('Connectors') }), _jsxs(XStack, { render: "button", type: 'button', onClick: () => setConnectorsOpen(true), items: "center", gap: 3, px: 6, py: 2, rounded: 6, bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsx(Plus, { size: 12, color: DIM, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, color: DIM, children: t('Add') })] })] }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: () => setConnectorsOpen(true), minH: 50, px: 13, py: 9, items: "center", justify: "space-between", gap: 10, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: answers.length ? t('{n} channels connected', { n: answers.length }) : t('Connect Slack, WhatsApp, Stripe…') }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: t('External apps, socials & MCP tools') })] }), _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true })] })] }), boxed ? (_jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.computer", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Computer') }), _jsxs(XStack, { ...CARD, render: "button", type: 'button', onClick: computer, disabled: busy || box?.status === 'pending', "aria-label": t(box?.status === 'running' ? 'Open {name}’s computer' : 'Wake {name}’s computer', { name: displayName }), minH: 60, px: 13, py: 10, items: "center", gap: 12, cursor: "pointer", hoverStyle: { bg: PICKED }, children: [_jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, color: INK, children: t("Bot's computer") }), _jsx(Text, { ...CLIP, fontSize: 13, lineHeight: 18, color: DIM, children: busy ? t('Waking') : state(box, t) })] }), _jsx(ComputerScreen, { awake: box?.status === 'running' })] })] })) : null, _jsxs(YStack, { gap: 10, "data-parity-key": "bots.panel.voice", children: [_jsx(Text, { ...LABEL, px: 4, children: t('Voice chat') }), _jsxs(YStack, { ...CARD, children: [_jsx(VoiceRow, { label: t('Voice'), value: voiceName, options: VOICES, onSelect: setVoiceName }), _jsx(VoiceRow, { label: t('Speed'), value: voiceSpeed, options: SPEEDS, onSelect: setVoiceSpeed }), _jsx(VoiceRow, { label: t('Language'), value: voiceLang, options: LANGUAGES, onSelect: setVoiceLang, last: true })] })] }), wrong ? (_jsx(Text, { render: "p", role: "alert", px: 8, m: 0, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx(XStack, { px: 8, pt: 4, children: _jsx(Text, { render: "button", type: 'button', onClick: () => setDeleting(true), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", fontSize: 13, lineHeight: 18, color: DIM, hoverStyle: { color: INK }, children: t('Delete {name}', { name: displayName }) }) })] })) : (_jsx(YStack, { px: 15, pb: 24, gap: 12, "data-parity-key": "bots.panel.library", children: libraryItems.length ? (_jsx(YStack, { ...CARD, children: libraryItems.map((item, i) => (_jsx(Row, { mark: item.kind === 'doc' ? _jsx(FileText, { size: 16, color: DIM, "aria-hidden": true }) : _jsx(ImageIcon, { size: 16, color: DIM, "aria-hidden": true }), title: item.label, line: item.sub, last: i === libraryItems.length - 1, children: item.href ? _jsx(ChevronRight, { size: 15, color: DIM, "aria-hidden": true }) : null }, item.key))) })) : (_jsx(YStack, { ...CARD, px: 14, py: 16, items: "center", children: _jsx(Text, { fontSize: 13, lineHeight: 19, color: DIM, text: "center", children: t('Files, documents, and images shared with {name} appear here.', { name: displayName }) }) })) })), _jsx(Dialog, { open: deleting, onOpenChange: setDeleting, children: _jsxs(DialogContent, { maxW: 440, rounded: 20, gap: 14, children: [_jsx(DialogTitle, { children: t('Delete {name}?', { name: displayName }) }), _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: t('{name} and every message it was sent are deleted for good.', { name: displayName }) }), _jsxs(XStack, { gap: 8, justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => setDeleting(false), children: t('Cancel') }), _jsx(XStack, { ...PILL, height: 34, bg: INK, borderColor: INK, hoverStyle: { bg: INK, opacity: 0.9 }, onClick: () => {
|
|
182
184
|
if (!deleting)
|
|
183
185
|
return;
|
|
184
186
|
setDeleting(false);
|
|
185
187
|
onDelete().catch((e) => setWrong(say(e, displayName, 'save', t)));
|
|
186
|
-
}, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) })] }));
|
|
188
|
+
}, children: _jsx(Text, { ...WORD, color: "var(--background)", children: t('Delete') }) })] })] }) }), _jsx(ConnectorsDialog, { open: connectorsOpen, onOpenChange: setConnectorsOpen, defaultFilter: "channels", onConnected: () => void survey() })] }));
|
|
187
189
|
}
|
package/dist/bots/Roster.js
CHANGED
|
@@ -7,11 +7,11 @@ import { useEffect, useMemo, useState } from 'react';
|
|
|
7
7
|
import { useI18n } from '@hanzo/i18n/react';
|
|
8
8
|
import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
9
9
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@hanzo/ui';
|
|
10
|
-
import { BUSINESS_APPS } from '@hanzo/ui/product';
|
|
11
10
|
import { Grid2x2Plus, Plus, Search, SlidersHorizontal, X } from 'lucide-react';
|
|
12
11
|
import { useSignOut } from '../lib/signout.js';
|
|
13
12
|
import { PreferencesDialog } from '../PreferencesDialog.js';
|
|
14
13
|
import { called, member } from '../team.js';
|
|
14
|
+
import { ConnectorsDialog } from './ConnectorsDialog.js';
|
|
15
15
|
import { Face } from './face.js';
|
|
16
16
|
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
17
17
|
import { DIM, FLOOR, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
@@ -30,13 +30,13 @@ export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled,
|
|
|
30
30
|
: all;
|
|
31
31
|
}, [bots, query]);
|
|
32
32
|
const { grid, rows } = useMemo(() => split(shown, last), [shown, last]);
|
|
33
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height:
|
|
33
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.roster.bar", height: 46, shrink: 0, px: 12, items: "center", justify: "flex-end", gap: 8, children: [_jsx(XStack, { ...ROUND, "aria-label": t(seeking ? 'Close search' : 'Search bots'), "aria-pressed": seeking, onClick: () => {
|
|
34
34
|
setSeeking(!seeking);
|
|
35
35
|
setQuery('');
|
|
36
|
-
}, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), _jsx(XStack, { ...ROUND, "aria-label": t('New bot'), onClick: onMake, disabled: disabled, opacity: disabled ? 0.5 : 1, children: _jsx(Plus, { size: 18, color: INK, "aria-hidden": true }) })] }), seeking ? (_jsx(XStack, { px:
|
|
36
|
+
}, children: seeking ? _jsx(X, { size: 16, color: INK, "aria-hidden": true }) : _jsx(Search, { size: 16, color: INK, "aria-hidden": true }) }), _jsx(XStack, { ...ROUND, "aria-label": t('New bot'), onClick: onMake, disabled: disabled, opacity: disabled ? 0.5 : 1, children: _jsx(Plus, { size: 18, color: INK, "aria-hidden": true }) })] }), seeking ? (_jsx(XStack, { px: 10, pb: 8, shrink: 0, children: _jsx(Input, { unstyled: true, autoFocus: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search'), "aria-label": t('Search bots'), width: "100%", height: 34, px: 12, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 14, placeholderTextColor: "$placeholderColor" }) })) : null, _jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: [unread ? (_jsx(Text, { render: "p", px: 16, py: 8, fontSize: 13, lineHeight: 18, color: DIM, children: unread })) : null, bots && bots.length === 0 && !unread && !disabled ? (_jsxs(YStack, { display: "none", "$max-md": { display: 'flex' }, items: "center", gap: 16, pt: 140, px: 20, children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null, grid.length ? (_jsx(XStack, { "data-parity-key": "bots.grid", role: "group", "aria-label": t('Bots'), flexWrap: "wrap", px: 9, pt: 4, columnGap: 3, rowGap: 10, "$max-md": { px: 12, columnGap: 0, justify: 'space-between' }, children: grid.map((b) => {
|
|
37
37
|
const here = b.name === open;
|
|
38
38
|
const label = called(b.name);
|
|
39
|
-
return (_jsxs(YStack, { render: "button", type: 'button', "data-parity-key": "bots.tile", "data-name": b.name, "aria-current": here, "aria-label": label, onClick: () => onPick(b.name), width:
|
|
39
|
+
return (_jsxs(YStack, { render: "button", type: 'button', "data-parity-key": "bots.tile", "data-name": b.name, "aria-current": here, "aria-label": label, onClick: () => onPick(b.name), width: 78, height: 88, rounded: 11, items: "center", pt: 5, gap: 5, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, "$max-md": { width: '33%' }, children: [_jsx(Face, { bot: b, size: 56, starred: member(b.name)?.seat === 1 }), _jsx(Text, { ...CLIP, maxW: 72, fontSize: 13, lineHeight: 17, fontWeight: here ? '500' : '400', color: INK, children: label })] }, b.id || b.name));
|
|
40
40
|
}) })) : null, rows.length ? (_jsx(YStack, { "data-parity-key": "bots.rows", role: "group", "aria-label": t('More bots'), pt: 16, pb: 22, children: rows.map((b) => {
|
|
41
41
|
const here = b.name === open;
|
|
42
42
|
const label = called(b.name);
|
|
@@ -44,11 +44,12 @@ export function Roster({ bots, last, open, unread, me, onPick, onMake, disabled,
|
|
|
44
44
|
return (_jsxs(XStack, { render: "button", type: 'button', "data-parity-key": "bots.row", "data-name": b.name, "aria-current": here, onClick: () => onPick(b.name), height: 56, mx: 6, px: 12, gap: 10, items: "center", rounded: 10, bg: here ? PICKED : 'transparent', borderWidth: 0, cursor: "pointer", hoverStyle: { bg: here ? PICKED : 'var(--rail-hover, var(--muted))' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsx(Face, { bot: b, size: 36 }), _jsxs(YStack, { flex: 1, minW: 0, items: "flex-start", children: [_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: label }), word ? (_jsx(Text, { ...CLIP, maxW: "100%", fontSize: 13, lineHeight: 18, color: DIM, children: word })) : null] })] }, b.id || b.name));
|
|
45
45
|
}) })) : null] }), rows.length ? (_jsx(YStack, { "aria-hidden": true, pointerEvents: "none", position: "absolute", l: 0, r: 0, b: 0, height: 28, "$platform-web": { backgroundImage: `linear-gradient(to bottom, transparent, ${FLOOR})` } })) : null] }), _jsx(Foot, { me: me })] }));
|
|
46
46
|
}
|
|
47
|
-
/** You, at the foot: your account,
|
|
47
|
+
/** You, at the foot: your account, external Connectors, and unified Hanzo Preferences. */
|
|
48
48
|
function Foot({ me }) {
|
|
49
49
|
const { t } = useI18n();
|
|
50
50
|
const leave = useSignOut();
|
|
51
51
|
const [prefsOpen, setPrefsOpen] = useState(false);
|
|
52
|
+
const [connectorsOpen, setConnectorsOpen] = useState(false);
|
|
52
53
|
const name = me?.displayName || me?.name || '';
|
|
53
54
|
useEffect(() => {
|
|
54
55
|
if (!me)
|
|
@@ -64,5 +65,5 @@ function Foot({ me }) {
|
|
|
64
65
|
}, [me]);
|
|
65
66
|
if (!me)
|
|
66
67
|
return null;
|
|
67
|
-
return (_jsxs(_Fragment, { children: [_jsxs(XStack, { "data-parity-key": "bots.me", height:
|
|
68
|
+
return (_jsxs(_Fragment, { children: [_jsxs(XStack, { "data-parity-key": "bots.me", height: 52, shrink: 0, px: 12, items: "center", gap: 6, borderTopWidth: 1, borderColor: LINE, children: [_jsxs(DropdownMenu, { placement: "top-start", offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { render: "button", type: 'button', "aria-label": t('Account: {name}', { name }), flex: 1, minW: 0, items: "center", gap: 9, bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: [_jsx(Face, { bot: { name, avatar: me.avatar }, size: 30, person: true }), _jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: name })] }) }), _jsxs(DropdownMenuContent, { minW: 240, "aria-label": t('Account'), children: [_jsx(DropdownMenuLabel, { children: _jsxs(YStack, { minW: 0, gap: 2, children: [_jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: name }), me.email ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, children: me.email })) : null] }) }), _jsx(DropdownMenuSeparator, {}), _jsx(DropdownMenuItem, { onSelect: () => setConnectorsOpen(true), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Connectors') }) }), _jsx(DropdownMenuItem, { onSelect: () => setPrefsOpen(true), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Preferences') }) }), _jsx(DropdownMenuItem, { onSelect: () => void leave(), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Log out') }) })] })] }), _jsx(XStack, { ...ROUND, "aria-label": t('Connectors'), onClick: () => setConnectorsOpen(true), children: _jsx(Grid2x2Plus, { size: 16, color: INK, "aria-hidden": true }) }), _jsx(XStack, { ...ROUND, "aria-label": t('Preferences'), onClick: () => setPrefsOpen(true), children: _jsx(SlidersHorizontal, { size: 15, color: INK, "aria-hidden": true }) })] }), _jsx(ConnectorsDialog, { open: connectorsOpen, onOpenChange: setConnectorsOpen }), _jsx(PreferencesDialog, { open: prefsOpen, onOpenChange: setPrefsOpen })] }));
|
|
68
69
|
}
|
package/dist/bots/Thread.js
CHANGED
|
@@ -22,8 +22,6 @@ import { instant } from './time.js';
|
|
|
22
22
|
import { lines, partsOf } from './said.js';
|
|
23
23
|
import { compose, fits, MAX, texty } from './carry.js';
|
|
24
24
|
import { PARAM } from './api.js';
|
|
25
|
-
/** The widest a conversation reads, as the desktop app draws it. */
|
|
26
|
-
const MEASURE = 900;
|
|
27
25
|
function DocBadge({ ext }) {
|
|
28
26
|
const accent = ext === 'pdf'
|
|
29
27
|
? 'var(--destructive)'
|
|
@@ -120,21 +118,21 @@ export function Thread({ bot, bots, runs, pending, notice, wrong, side, live, lo
|
|
|
120
118
|
});
|
|
121
119
|
};
|
|
122
120
|
const hasDraft = Boolean(draft.trim() || file);
|
|
123
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.bar", position: "absolute", t: 0, l: 0, r: 0, z: 4, height:
|
|
121
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { "data-parity-key": "bots.bar", position: "absolute", t: 0, l: 0, r: 0, z: 4, height: 46, px: 14, items: "center", gap: 8, pointerEvents: "none", "$platform-web": {
|
|
124
122
|
backgroundImage: `linear-gradient(to bottom, ${GROUND} 18%, color-mix(in srgb, ${GROUND} 68%, transparent) 64%, transparent)`,
|
|
125
|
-
}, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", children: _jsx(XStack, { ...ROUND, pointerEvents: "auto", "aria-label": t('All bots'), onClick: onBack, display: "none", "$max-md": { display: 'flex' }, children: _jsx(ArrowLeft, { size: 16, color: INK, "aria-hidden": true, "data-i18n-mirror": true }) }) }), bot ? (_jsxs(XStack, { ...PILL, pointerEvents: "auto", "data-parity-key": "bots.pill", "aria-label": t('{name}’s details', { name: displayName }), "aria-expanded": side, onClick: onSide, height: 36, pl: 6, pr: 13, maxW: "60%", bg: RAISED, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: [_jsx(Face, { bot: bot, size: 24 }), _jsx(Text, { ...WORD, ...CLIP, children: displayName })] })) : null, _jsx(XStack, { flex: 1, minW: 0, items: "center", justify: "flex-end", children: bot ? (_jsx(XStack, { ...ROUND, pointerEvents: "auto", "data-parity-key": "bots.share", "aria-label": shared ?? t('Share'), onClick: share, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: shared ? _jsx(Check, { size: 15, color: INK, "aria-hidden": true }) : _jsx(Share, { size: 15, color: INK, "aria-hidden": true }) })) : null })] }), !bot ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", gap: 16, px: 24, children: live && loaded && bots.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null })) : (_jsx(YStack, { "data-parity-key": "bots.thread", flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: _jsxs(YStack, { width: "100%",
|
|
123
|
+
}, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", children: _jsx(XStack, { ...ROUND, pointerEvents: "auto", "aria-label": t('All bots'), onClick: onBack, display: "none", "$max-md": { display: 'flex' }, children: _jsx(ArrowLeft, { size: 16, color: INK, "aria-hidden": true, "data-i18n-mirror": true }) }) }), bot ? (_jsxs(XStack, { ...PILL, pointerEvents: "auto", "data-parity-key": "bots.pill", "aria-label": t('{name}’s details', { name: displayName }), "aria-expanded": side, onClick: onSide, height: 36, pl: 6, pr: 13, maxW: "60%", bg: RAISED, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: [_jsx(Face, { bot: bot, size: 24 }), _jsx(Text, { ...WORD, ...CLIP, children: displayName })] })) : null, _jsx(XStack, { flex: 1, minW: 0, items: "center", justify: "flex-end", children: bot ? (_jsx(XStack, { ...ROUND, pointerEvents: "auto", "data-parity-key": "bots.share", "aria-label": shared ?? t('Share'), onClick: share, "$platform-web": { backdropFilter: 'blur(16px)', WebkitBackdropFilter: 'blur(16px)' }, children: shared ? _jsx(Check, { size: 15, color: INK, "aria-hidden": true }) : _jsx(Share, { size: 15, color: INK, "aria-hidden": true }) })) : null })] }), !bot ? (_jsx(YStack, { flex: 1, items: "center", justify: "center", gap: 16, px: 24, children: live && loaded && bots.length === 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { render: "h1", m: 0, fontSize: 22, lineHeight: 28, fontWeight: "500", color: INK, children: t('Make your first bot') }), _jsx(XStack, { ...PILL, onClick: onMake, children: _jsx(Text, { ...WORD, children: t('New bot') }) })] })) : null })) : (_jsx(YStack, { "data-parity-key": "bots.thread", flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: _jsxs(YStack, { width: "100%", px: 18, pt: 52, pb: 14, "$max-md": { px: 12 }, children: [said.map((line, i) => {
|
|
126
124
|
const prev = said[i - 1];
|
|
127
|
-
const gap = !prev ? 0 : line.kind === prev.kind && (line.kind === 'mine' || line.kind === 'theirs') ? 6 :
|
|
125
|
+
const gap = !prev ? 0 : line.kind === prev.kind && (line.kind === 'mine' || line.kind === 'theirs') ? 6 : 14;
|
|
128
126
|
if (line.kind === 'stamp')
|
|
129
|
-
return (_jsx(Text, { self: "center", mt: i ?
|
|
127
|
+
return (_jsx(Text, { self: "center", mt: i ? 18 : 4, mb: 4, fontSize: 12, lineHeight: 17, color: DIM, children: line.text }, line.key));
|
|
130
128
|
if (line.kind === 'from')
|
|
131
129
|
return (_jsxs(XStack, { self: "center", mt: gap, items: "center", gap: 6, children: [_jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: t('Message from') }), _jsx(Face, { bot: line.bot, size: 16 }), _jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: called(line.bot.name) })] }, line.key));
|
|
132
130
|
if (line.kind === 'mine')
|
|
133
|
-
return (_jsx(YStack, { self: "flex-end", items: "flex-end", maxW: "
|
|
131
|
+
return (_jsx(YStack, { self: "flex-end", items: "flex-end", maxW: "76%", mt: gap, children: _jsx(Text, { "data-parity-key": "bots.mine", render: "div", px: 14, py: 8, rounded: 18, fontSize: 15, lineHeight: 22, color: INK, whiteSpace: "pre-wrap", "$platform-web": { overflowWrap: 'anywhere', backgroundColor: MINE }, children: line.text }) }, line.key));
|
|
134
132
|
if (line.kind === 'thinking')
|
|
135
133
|
return (_jsx(XStack, { "data-parity-key": "bots.thinking", role: "status", "aria-label": t('{name} is working', { name: displayName }), self: "flex-start", mt: gap, px: 14, height: 38, items: "center", rounded: 16, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(Caret, {}) }, line.key));
|
|
136
134
|
if (line.kind === 'theirs' && line.failed)
|
|
137
|
-
return (_jsx(YStack, { "data-parity-key": "bots.theirs", self: "flex-start", maxW:
|
|
135
|
+
return (_jsx(YStack, { "data-parity-key": "bots.theirs", self: "flex-start", maxW: 680, mt: gap, px: 15, py: 11, rounded: 18, bg: RAISED, borderWidth: 1, borderColor: LINE, "$max-md": { maxW: '92%' }, children: _jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: line.text }) }, line.key));
|
|
138
136
|
const parts = partsOf(line.text);
|
|
139
137
|
return (_jsx(YStack, { "data-parity-key": line.kind === 'other' ? 'bots.other' : 'bots.theirs', self: "flex-start", items: "flex-start", gap: 10, maxW: "100%", mt: gap, children: parts.map((part, idx) => {
|
|
140
138
|
if (part.kind === 'doc') {
|
|
@@ -144,9 +142,9 @@ export function Thread({ bot, bots, runs, pending, notice, wrong, side, live, lo
|
|
|
144
142
|
if (part.kind === 'image') {
|
|
145
143
|
return (_jsx(YStack, { width: 172, rounded: 14, overflow: "hidden", bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(YStack, { render: "img", src: part.src, alt: part.alt, width: "100%", height: "auto", display: "block" }) }, idx));
|
|
146
144
|
}
|
|
147
|
-
return (_jsx(YStack, { maxW:
|
|
145
|
+
return (_jsx(YStack, { maxW: 680, px: 15, py: 11, rounded: 18, bg: RAISED, borderWidth: 1, borderColor: LINE, "$max-md": { maxW: '92%' }, children: _jsx(Prose, { text: part.text }) }, idx));
|
|
148
146
|
}) }, line.key));
|
|
149
|
-
}), wrong ? (_jsx(Text, { render: "p", self: "center", mt: 12, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx("div", { ref: foot })] }) })), bot ? (_jsxs(YStack, { width: "100%",
|
|
147
|
+
}), wrong ? (_jsx(Text, { render: "p", self: "center", mt: 12, fontSize: 13, lineHeight: 18, color: DIM, children: wrong })) : null, _jsx("div", { ref: foot })] }) })), bot ? (_jsxs(YStack, { width: "100%", px: 16, pb: 12, gap: 8, shrink: 0, "$max-md": { px: 8, pb: 8 }, children: [notice ? (_jsxs(YStack, { "data-parity-key": "bots.notice", role: "alert", bg: RAISED, borderWidth: 1, borderColor: LINE, rounded: 16, pt: 12, pb: 10, px: 14, gap: 10, children: [_jsxs(XStack, { items: "flex-start", gap: 10, children: [_jsx(YStack, { pt: 3, children: _jsx(Gauge, { size: 16, color: DIM, "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: 15, lineHeight: 22, color: INK, children: notice.message }), lifts(notice.resets, now, t) ? (_jsx(Text, { fontSize: 15, lineHeight: 22, color: DIM, children: lifts(notice.resets, now, t) })) : null] }), _jsx(XStack, { ...ROUND, width: 28, height: 28, bg: "transparent", borderWidth: 0, "aria-label": t('Dismiss'), onClick: onDismiss, children: _jsx(X, { size: 14, color: DIM, "aria-hidden": true }) })] }), notice.actions.some(navigable) ? (_jsx(XStack, { justify: "flex-end", gap: 8, flexWrap: "wrap", children: notice.actions.filter(navigable).map((a, i, all) => (_jsx(XStack, { ...PILL, render: "a", href: a.url, height: 34, bg: i === all.length - 1 ? INK : RAISED, borderColor: i === all.length - 1 ? INK : LINE, "$platform-web": { textDecoration: 'none' }, children: _jsx(Text, { ...WORD, color: i === all.length - 1 ? 'var(--background)' : INK, children: a.label }) }, `${a.kind}-${a.label}`))) })) : null] })) : null, file ? (_jsxs(XStack, { self: "flex-start", items: "center", gap: 6, height: 30, pl: 12, pr: 4, rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsx(Text, { ...CLIP, maxW: 260, fontSize: 13, lineHeight: 18, color: INK, children: file.name }), _jsx(XStack, { ...ROUND, width: 24, height: 24, bg: "transparent", borderWidth: 0, "aria-label": t('Remove {name}', { name: file.name }), onClick: () => setFile(null), children: _jsx(X, { size: 12, color: DIM, "aria-hidden": true }) })] })) : null, note ? (_jsx(Text, { role: "alert", fontSize: 13, lineHeight: 18, color: DIM, px: 8, children: note })) : null, _jsx(Composer, { render: "form", onSubmit: (e) => {
|
|
150
148
|
e.preventDefault();
|
|
151
149
|
submit();
|
|
152
150
|
}, control: 32, width: "100%", children: _jsxs(XStack, { "data-parity-key": "bots.composer", height: 46, pl: 7, pr: 7, gap: 6, items: "center", rounded: 999, bg: RAISED, borderWidth: 1, borderColor: EDGE, focusWithinStyle: { borderColor: 'var(--ring)' }, children: [_jsx(Control, { type: "button", "aria-label": t('Add a text file'), onClick: () => pick.current?.click(), disabled: !live, children: _jsx(Plus, { size: 16 }) }), _jsx(Field, { value: draft, onChangeText: setDraft, onKeyDown: (e) => {
|
package/dist/bots/ink.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const PICKED = "var(--secondary)";
|
|
|
9
9
|
/** Your own message: lighter than a bot's, in either theme. */
|
|
10
10
|
export declare const MINE = "color-mix(in oklab, var(--foreground) 17%, var(--pane-fill, var(--card)))";
|
|
11
11
|
export declare const INK = "var(--foreground)";
|
|
12
|
-
export declare const DIM = "var(--muted-foreground)";
|
|
12
|
+
export declare const DIM = "var(--text-secondary, var(--muted-foreground))";
|
|
13
13
|
export declare const FAINT = "$faint";
|
|
14
14
|
export declare const LINE = "var(--pane-edge, var(--border))";
|
|
15
15
|
/** The composer's edge, the one control drawn a step louder. */
|
package/dist/bots/ink.js
CHANGED
|
@@ -13,7 +13,7 @@ export const PICKED = 'var(--secondary)';
|
|
|
13
13
|
/** Your own message: lighter than a bot's, in either theme. */
|
|
14
14
|
export const MINE = 'color-mix(in oklab, var(--foreground) 17%, var(--pane-fill, var(--card)))';
|
|
15
15
|
export const INK = 'var(--foreground)';
|
|
16
|
-
export const DIM = 'var(--muted-foreground)';
|
|
16
|
+
export const DIM = 'var(--text-secondary, var(--muted-foreground))';
|
|
17
17
|
export const FAINT = '$faint';
|
|
18
18
|
export const LINE = 'var(--pane-edge, var(--border))';
|
|
19
19
|
/** The composer's edge, the one control drawn a step louder. */
|
package/dist/bots/kit.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export declare const LABEL: {
|
|
|
60
60
|
readonly fontSize: 13;
|
|
61
61
|
readonly lineHeight: 18;
|
|
62
62
|
readonly fontWeight: '400';
|
|
63
|
-
readonly color: "var(--muted-foreground)";
|
|
63
|
+
readonly color: "var(--text-secondary, var(--muted-foreground))";
|
|
64
64
|
readonly m: 0;
|
|
65
65
|
};
|
|
66
66
|
/** A card in the panel. */
|
package/dist/ground.d.ts
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
export declare const pane: (fill?: string) => {
|
|
16
16
|
readonly backgroundColor: string;
|
|
17
17
|
readonly borderRadius: 'var(--pane-round)';
|
|
18
|
+
readonly borderWidth: 1;
|
|
19
|
+
readonly borderStyle: 'solid';
|
|
20
|
+
readonly borderColor: 'var(--pane-edge, var(--border))';
|
|
18
21
|
readonly backdropFilter: 'var(--pane-blur)';
|
|
19
22
|
};
|
|
20
23
|
/**
|
|
@@ -37,13 +40,13 @@ export declare const TOUCH_HEAD = 44;
|
|
|
37
40
|
* mark from the pane's end edge, so the two top corners mirror each other
|
|
38
41
|
* (owner, 2026-10-30: "top left / top right").
|
|
39
42
|
*/
|
|
40
|
-
export declare const INSET =
|
|
43
|
+
export declare const INSET = 24;
|
|
41
44
|
/** The rail's width, px: two insets. */
|
|
42
45
|
export declare const RAIL: number;
|
|
43
46
|
/** The top bar's height, px, on every shell. */
|
|
44
|
-
export declare const BAR =
|
|
47
|
+
export declare const BAR = 38;
|
|
45
48
|
/** The sidebar's width before the reader pulls its edge, px. */
|
|
46
|
-
export declare const SIDE =
|
|
49
|
+
export declare const SIDE = 248;
|
|
47
50
|
/**
|
|
48
51
|
* A row INSIDE a pane shares the height of the row it lines up with.
|
|
49
52
|
*/
|
package/dist/ground.js
CHANGED
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
export const pane = (fill = 'var(--pane-fill)') => ({
|
|
16
16
|
backgroundColor: fill,
|
|
17
17
|
borderRadius: 'var(--pane-round)',
|
|
18
|
+
borderWidth: 1,
|
|
19
|
+
borderStyle: 'solid',
|
|
20
|
+
borderColor: 'var(--pane-edge, var(--border))',
|
|
18
21
|
backdropFilter: 'var(--pane-blur)',
|
|
19
22
|
});
|
|
20
23
|
/**
|
|
@@ -37,13 +40,13 @@ export const TOUCH_HEAD = 44;
|
|
|
37
40
|
* mark from the pane's end edge, so the two top corners mirror each other
|
|
38
41
|
* (owner, 2026-10-30: "top left / top right").
|
|
39
42
|
*/
|
|
40
|
-
export const INSET =
|
|
43
|
+
export const INSET = 24;
|
|
41
44
|
/** The rail's width, px: two insets. */
|
|
42
45
|
export const RAIL = 2 * INSET;
|
|
43
46
|
/** The top bar's height, px, on every shell. */
|
|
44
|
-
export const BAR =
|
|
47
|
+
export const BAR = 38;
|
|
45
48
|
/** The sidebar's width before the reader pulls its edge, px. */
|
|
46
|
-
export const SIDE =
|
|
49
|
+
export const SIDE = 248;
|
|
47
50
|
/**
|
|
48
51
|
* A row INSIDE a pane shares the height of the row it lines up with.
|
|
49
52
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.77",
|
|
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",
|