@hanzo/app 0.3.82 → 0.3.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chat.js +50 -33
- package/dist/WalletPill.d.ts +4 -0
- package/dist/WalletPill.js +27 -0
- package/dist/bots/ConnectorsDialog.d.ts +22 -1
- package/dist/bots/ConnectorsDialog.js +97 -106
- package/dist/lib/limits.js +2 -0
- package/package.json +1 -1
package/dist/Chat.js
CHANGED
|
@@ -69,6 +69,7 @@ import { Schedule } from "./Schedule.js";
|
|
|
69
69
|
import { keepFile, useAttach, useKeep } from "./keep.js";
|
|
70
70
|
import { useKept } from "./kept.js";
|
|
71
71
|
import { dragWindow, toggleWindowMaximize } from "./WindowControls.js";
|
|
72
|
+
import { WalletPill } from "./WalletPill.js";
|
|
72
73
|
import { artifacts, lead, nameOf, PAGE, Panel, PanelToggle, renders, Reply, Summary, useDeck, useKey, Suggestions, useCarry, useLanguage, useMind, useSuggestions, taken, CHAT_MODES, usePanel, frames, name as tabName, } from "@hanzo/build";
|
|
73
74
|
import { checkoutUrl, payUrl, topUp } from './lib/pay.js';
|
|
74
75
|
import { Upgrade, useFree } from './Upgrade.js';
|
|
@@ -768,7 +769,13 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
768
769
|
// only once the reader is turned away: a reply answered from a free model, or
|
|
769
770
|
// a refusal.
|
|
770
771
|
const held = paidPlan(limits);
|
|
771
|
-
const
|
|
772
|
+
const alreadyEnso = model === ENSO || model.startsWith("enso") || rowOf(model)?.family === "enso";
|
|
773
|
+
const redundantEnso = Boolean(notice &&
|
|
774
|
+
((alreadyEnso && notice.reason === "paid_plan_required") ||
|
|
775
|
+
(!notice.refused &&
|
|
776
|
+
!spends(notice.reason) &&
|
|
777
|
+
(alreadyEnso || notice.reason === "paid_plan_required" || notice.fallback?.startsWith("enso")))));
|
|
778
|
+
const pause = notice && (notice.fallback || notice.refused) && !redundantEnso ? notice : null;
|
|
772
779
|
// EVERY MODEL IS CHOSEN, never asked for: one the plan does not cover still
|
|
773
780
|
// picks, and the gateway answers it with the policy's refusal or from Enso,
|
|
774
781
|
// which the pane then shows. A turn the gateway refuses `plan_required`
|
|
@@ -1356,9 +1363,8 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1356
1363
|
// answer that just stopped, once the conversation it belongs to has an id.
|
|
1357
1364
|
const [finished, setFinished] = useState(null);
|
|
1358
1365
|
useKeep(ai, !anonymous && !forgetful, kept ?? open, finished, artifacts);
|
|
1359
|
-
// WHAT AN ANSWER MAKES OPENS BESIDE IT.
|
|
1360
|
-
//
|
|
1361
|
-
// the answer's own Open does it.
|
|
1366
|
+
// WHAT AN ANSWER MAKES OPENS BESIDE IT. A page or a picture an answer just
|
|
1367
|
+
// finished writing is opened as a tab in the side panel.
|
|
1362
1368
|
const writing = useRef(false);
|
|
1363
1369
|
useEffect(() => {
|
|
1364
1370
|
const was = writing.current;
|
|
@@ -1368,8 +1374,6 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1368
1374
|
const done = [...turns.current].reverse().find((m) => m.role === "assistant");
|
|
1369
1375
|
if (done && typeof done.content === "string" && done.content)
|
|
1370
1376
|
setFinished({ id: String(done.id), text: done.content });
|
|
1371
|
-
if (!panel)
|
|
1372
|
-
return;
|
|
1373
1377
|
const answer = done;
|
|
1374
1378
|
const made = typeof answer?.content === "string" ? artifacts(answer.content).filter(renders) : [];
|
|
1375
1379
|
if (made.length)
|
|
@@ -1595,9 +1599,18 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1595
1599
|
if (preparing || (!text && !files.length))
|
|
1596
1600
|
return;
|
|
1597
1601
|
const isPrOrReview = /\b(pull request|pr\s*#?\d+|github\.com\/[^\s]+\/pull\/\d+|\/pull\/\d+|code[\s-]?review|ponytail|pony|review\s+(this\s+)?(pr|diff|patch|changes|commit))\b/i.test(text);
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1602
|
+
const isInteractiveDemo = /\b(make|build|create|design|generate|show)\b[\s\S]*\b(demo|website|web\s*app|landing\s*page|dashboard|interactive|prototype|ui|preview)\b/i.test(text);
|
|
1603
|
+
const demoNote = isInteractiveDemo
|
|
1604
|
+
? "Build a complete, self-contained, interactive single-file HTML application inside a ```html demo.html code fence (with embedded modern dark-mode CSS and interactive JavaScript controls) so it renders live in the side-by-side Outputs preview panel. If the request is for a Hanzo demo, build an interactive Hanzo AI platform showcase featuring Enso & Zen frontier models, Hanzo Dev autonomous coding agents, Hanzo Bot, Hanzo Cloud, and Model Context Protocol (MCP) tools with working interactive tabs and live simulations rather than a plain text or Python snippet."
|
|
1600
1605
|
: "";
|
|
1606
|
+
const ponyNote = [
|
|
1607
|
+
isPrOrReview
|
|
1608
|
+
? 'Use the skill "code-review" (Ponytail Thermo-Nuclear Code Review + Code Judo): perform a rigorous multi-pass PR/diff review checking correctness, edge cases, race conditions, security, and maintainability.'
|
|
1609
|
+
: "",
|
|
1610
|
+
demoNote,
|
|
1611
|
+
]
|
|
1612
|
+
.filter(Boolean)
|
|
1613
|
+
.join("\n\n");
|
|
1601
1614
|
if (isPrOrReview && !carry.gear.gear.skills.includes("code-review")) {
|
|
1602
1615
|
carry.gear.toggle("skills", "code-review");
|
|
1603
1616
|
}
|
|
@@ -1788,10 +1801,12 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1788
1801
|
}, [initial, open, anonymous, settled, sendAnon]);
|
|
1789
1802
|
const families = useFamilies(mind, (id) => setAsk({ model: nameOf(id, listed) }));
|
|
1790
1803
|
const [titlebarSlot, setTitlebarSlot] = useState(null);
|
|
1804
|
+
const [titleSlot, setTitleSlot] = useState(null);
|
|
1791
1805
|
useEffect(() => {
|
|
1792
1806
|
if (typeof document === "undefined")
|
|
1793
1807
|
return;
|
|
1794
1808
|
setTitlebarSlot(document.getElementById("hanzo-titlebar-slot"));
|
|
1809
|
+
setTitleSlot(document.getElementById("hanzo-titlebar-title"));
|
|
1795
1810
|
}, [media.md]);
|
|
1796
1811
|
const inTopChrome = Boolean(media.md && titlebarSlot);
|
|
1797
1812
|
const composer = {
|
|
@@ -1836,7 +1851,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1836
1851
|
},
|
|
1837
1852
|
// WHAT GOES WITH THE MESSAGE, above the frame and at its width: the
|
|
1838
1853
|
// pause and its ways past, one chip a file, and talk mode's words.
|
|
1839
|
-
head: files.length || turnedAway || prepWrong || preparing || talk.open || talk.refusal ||
|
|
1854
|
+
head: files.length || turnedAway || prepWrong || preparing || talk.open || talk.refusal || banner || simulatedResetAt ? (_jsxs(_Fragment, { children: [(banner && isUsageLimitReached) || simulatedResetAt ? (_jsx(NeedMoreUsageBanner, { resetsAt: pause?.resets_at ?? simulatedResetAt, fallbackModel: pause?.fallback ? nameOf(pause.fallback, listed) : null, isUncapped: uncapped(limits), customMessage: banner?.message ?? null, onGetMoreUsage: () => setNeedMoreUsageOpen(true), onSeeUsage: () => showSettings("usage") })) : banner ? (_jsx(LimitedBanner, { message: banner.message, actions: banner.actions, onAction: act, onUsage: () => showSettings("usage"), labels: { usage: t("See usage"), dismiss: t("Dismiss") } })) : null, actWrong ? (_jsx(Text, { role: "alert", "data-slot": "limited-banner-wrong", fontSize: "$2", color: BAD, children: actWrong })) : null, files.length ? (_jsx(XStack, { gap: "$1.5", flexWrap: "wrap", role: "list", "aria-label": t("Attached files"), "data-slot": "composer-attached", children: files.map((one) => (_jsx(HeldChip, { one: one, onOpen: openFile, onRemove: () => drop(at, one.id), onSave: anonymous ? undefined : (url, id) => keepOne(url, id, one.name, one.type) }, one.id))) })) : null, preparing ? (_jsxs(Text, { role: "status", "aria-live": "polite", "data-slot": "composer-preparing", fontSize: "$2", color: "$soft", children: [preparing, "\u2026"] })) : null, turnedAway || prepWrong ? (_jsx(Text, { role: "alert", fontSize: "$2", color: BAD, children: turnedAway || prepWrong })) : null, talk.open || talk.refusal ? (_jsx(Text, { role: "status", "aria-live": "polite", "data-slot": "composer-talk-reply", fontSize: "$2", color: talk.refusal ? BAD : "$soft", children: talk.refusal
|
|
1840
1855
|
? worded(talk.refusal)
|
|
1841
1856
|
: talk.reply
|
|
1842
1857
|
? `Hanzo: ${talk.reply}`
|
|
@@ -1965,30 +1980,32 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1965
1980
|
}, children: [_jsx(Schedule, { open: plan !== null, onOpenChange: (open) => {
|
|
1966
1981
|
if (!open)
|
|
1967
1982
|
setPlan(null);
|
|
1968
|
-
}, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, inTopChrome &&
|
|
1969
|
-
? createPortal(
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1983
|
+
}, prompt: plan ?? "", model: model, models: models.map((m) => ({ id: m.id, name: nameOf(m.id, listed) })) }), dragging ? (_jsx(YStack, { "aria-hidden": true, position: "absolute", t: 0, r: 0, b: 0, l: 0, z: 10, items: "center", justify: "center", bg: "var(--surface-scrim)", borderWidth: 2, borderStyle: "dashed", borderColor: "$borderColor", rounded: "var(--pane-round)", pointerEvents: "none", children: _jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$2.5", rounded: "$10", bg: "$background", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Paperclip, { size: 15, "aria-hidden": true }), _jsx(Text, { fontSize: "$4", color: "$ink", children: t("Drop files to attach") })] }) })) : null, inTopChrome && titleSlot
|
|
1984
|
+
? createPortal(_jsx(XStack, { items: "center", gap: "$2", minW: 0, flex: 1, "data-tauri-drag-region": "false", children: editingTitle && shownTitle ? (_jsx(Input, { "data-slot": "conversation-title-input", "aria-label": t("Chat title"), value: titleDraft, autoFocus: true, maxLength: 200, size: "sm", minW: 160, maxW: 360, onChangeText: setTitleDraft, onBlur: commitTitle, onKeyDown: (e) => {
|
|
1985
|
+
e.stopPropagation?.();
|
|
1986
|
+
if (e.key === "Enter") {
|
|
1987
|
+
e.preventDefault?.();
|
|
1988
|
+
commitTitle();
|
|
1989
|
+
}
|
|
1990
|
+
else if (e.key === "Escape") {
|
|
1991
|
+
e.preventDefault?.();
|
|
1992
|
+
setEditingTitle(false);
|
|
1993
|
+
}
|
|
1994
|
+
} })) : shownTitle ? (_jsx(XStack, { render: "button", "data-slot": "conversation-title", "aria-label": shownTitle, items: "center", gap: "$1.5", px: "$1.5", py: "$0.5", rounded: "$2", minW: 0, shrink: 1, cursor: "pointer", hoverStyle: { bg: "$hover" }, onPress: () => {
|
|
1995
|
+
setTitleDraft(shownTitle);
|
|
1996
|
+
setEditingTitle(true);
|
|
1997
|
+
}, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, shrink: 1, minW: 0, children: shownTitle }) })) : (_jsx(Text, { "data-slot": "page-title", fontSize: 13, lineHeight: 18, fontWeight: "500", color: "$ink", numberOfLines: 1, children: t("Chat") })) }), titleSlot)
|
|
1998
|
+
: null, inTopChrome && titlebarSlot
|
|
1999
|
+
? createPortal(_jsx(XStack, { "data-slot": "chat-titlebar-portal", items: "center", justify: "flex-end", gap: 6, minW: 0, children: _jsxs(XStack, { "data-slot": "conversation-controls", "data-tauri-drag-region": "false", items: "center", gap: 4, shrink: 0, children: [!anonymous ? _jsx(WalletPill, { compact: true }) : null, anonymous ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Button, { size: "xs", variant: "outline", rounded: 9999, px: "$3", "data-slot": "header-login", onPress: () => {
|
|
2000
|
+
if (typeof window !== "undefined")
|
|
2001
|
+
window.location.assign("/login?next=%2Fchat");
|
|
2002
|
+
}, children: t("Log in") }), _jsx(Button, { size: "xs", rounded: 9999, px: "$3", "data-slot": "header-signup", onPress: () => {
|
|
2003
|
+
if (typeof window !== "undefined")
|
|
2004
|
+
window.location.assign("/signup?next=%2Fchat");
|
|
2005
|
+
}, children: t("Sign up for free") })] })) : null, said.length > 0 ? (_jsx(ConversationMenu, { threads: currentThreadMap, active: open || currentThread.id, onSchedule: anonymous || forgetful ? undefined : () => setPlan(lastAsked()), children: _jsx(XStack, { children: _jsx(ThreadMore, { t: currentThread }) }) })) : (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: "button", "data-slot": "header-private-chat", "aria-label": t("Private chat"), "aria-pressed": forgetful, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onPress: () => setForgetful(!forgetful), children: _jsx(Ghost, { size: 15, strokeWidth: 1.75, color: forgetful ? "var(--foreground)" : "var(--muted-foreground)", fill: forgetful ? "currentColor" : "none", "aria-hidden": true }) }) }), _jsx(TooltipContent, { children: forgetful ? t("Private chat is on: this conversation is not saved") : t("Private chat") })] })), open ? _jsx(Share, { thread: open }) : null, _jsx(Summary, { sections: sections, docked: dockSummary, open: summaryOpen, onOpenChange: setSummaryOpen, onOpen: () => setPanel(true), label: t("Summary") }), _jsx(PanelToggle, { open: panel, onToggle: () => setPanel(!panel) }), _jsx(XStack, { render: "button", "data-slot": "titlebar-new-chat", "aria-label": t("New chat"), ...{ title: t("New chat") }, width: 28, height: 28, items: "center", justify: "center", rounded: "$3", bg: "transparent", cursor: "pointer", opacity: 0.78, hoverStyle: { bg: "$hover", opacity: 1 }, onPress: () => {
|
|
2006
|
+
emptyOpen();
|
|
2007
|
+
go("/chat");
|
|
2008
|
+
}, children: _jsx(SquarePlus, { size: 15, strokeWidth: 1.75, "aria-hidden": true }) })] }) }), titlebarSlot)
|
|
1992
2009
|
: null, inTopChrome && !cast.length ? null : (_jsxs(XStack, { "data-slot": "conversation-head", group: true,
|
|
1993
2010
|
// On the rail's line from a tablet up; a phone's own bar is BAND.
|
|
1994
2011
|
height: BAND, $md: { height: inPane(HEAD) }, $touchable: { height: inPane(TOUCH_HEAD) }, display: "grid", gridTemplateColumns: "minmax(0, 1fr) auto", items: "center", gap: "$3", paddingInlineStart: INSET - 8,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
4
|
+
import { useIam } from '@hanzo/iam/react';
|
|
5
|
+
import { Text, XStack } from '@hanzo/gui';
|
|
6
|
+
import { Plus, Wallet } from 'lucide-react';
|
|
7
|
+
import { cents } from './lib/org.js';
|
|
8
|
+
import { payPage } from './lib/pay.js';
|
|
9
|
+
import { org } from './lib/session.js';
|
|
10
|
+
import { useTier } from './lib/tier.js';
|
|
11
|
+
export function WalletPill({ alwaysShow = false, compact = false, }) {
|
|
12
|
+
const { t } = useI18n();
|
|
13
|
+
const { isAuthenticated } = useIam();
|
|
14
|
+
const currentOrg = org();
|
|
15
|
+
const { tier, wrong } = useTier(isAuthenticated && Boolean(currentOrg), currentOrg);
|
|
16
|
+
if (!isAuthenticated)
|
|
17
|
+
return null;
|
|
18
|
+
const hasBalance = typeof tier?.balance?.effectiveAvailable === 'number';
|
|
19
|
+
if (!alwaysShow && !hasBalance)
|
|
20
|
+
return null;
|
|
21
|
+
const balance = hasBalance
|
|
22
|
+
? cents(tier.balance.effectiveAvailable, tier.balance.currency || 'usd')
|
|
23
|
+
: wrong
|
|
24
|
+
? t('Wallet')
|
|
25
|
+
: '…';
|
|
26
|
+
return (_jsxs(XStack, { render: "a", href: payPage('/amount/card'), "data-slot": "wallet-pill", "aria-label": t('Wallet credits: {balance}. Add funds', { balance }), height: compact ? 26 : 30, px: compact ? 9 : 11, gap: 6, rounded: 8, items: "center", bg: "var(--pane-fill, var(--card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--border))", cursor: "pointer", hoverStyle: { bg: 'var(--muted)' }, "$platform-web": { textDecoration: 'none' }, children: [_jsx(Wallet, { size: compact ? 12.5 : 13.5, color: "var(--muted-foreground)", "aria-hidden": true }), !compact ? (_jsx(Text, { fontSize: 12.5, lineHeight: 16, color: "var(--muted-foreground)", numberOfLines: 1, children: t('Credits') })) : null, _jsx(Text, { fontSize: 12.5, lineHeight: 16, fontWeight: "600", color: "var(--foreground)", numberOfLines: 1, children: balance }), !compact ? (_jsxs(XStack, { height: 20, px: 7, gap: 3, rounded: 6, items: "center", bg: "var(--secondary)", borderWidth: 1, borderColor: "var(--pane-edge, var(--border))", children: [_jsx(Plus, { size: 11, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: 11.5, lineHeight: 15, fontWeight: "500", color: "var(--foreground)", numberOfLines: 1, children: t('Add funds') })] })) : null] }));
|
|
27
|
+
}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
export type ConnectorFilter = 'all' | 'channels' | 'business' | 'productivity';
|
|
1
|
+
export type ConnectorFilter = 'all' | 'personal' | 'channels' | 'business' | 'productivity';
|
|
2
|
+
type SectionId = 'popular' | 'channels' | 'business' | 'productivity';
|
|
3
|
+
interface ConnectorDef {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
section: SectionId;
|
|
8
|
+
filter: 'channels' | 'business' | 'productivity';
|
|
9
|
+
network?: string;
|
|
10
|
+
icon?: {
|
|
11
|
+
path: string;
|
|
12
|
+
hex: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const CONNECTOR_CATALOG: readonly ConnectorDef[];
|
|
16
|
+
export declare function ConnectorsCatalog({ defaultFilter, embedded, onClose, onConnected, }: {
|
|
17
|
+
defaultFilter?: ConnectorFilter;
|
|
18
|
+
embedded?: boolean;
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
onConnected?: () => void;
|
|
21
|
+
}): import("react").JSX.Element;
|
|
2
22
|
export declare function ConnectorsDialog({ open, onOpenChange, defaultFilter, onConnected, }: {
|
|
3
23
|
open: boolean;
|
|
4
24
|
onOpenChange: (open: boolean) => void;
|
|
5
25
|
defaultFilter?: ConnectorFilter;
|
|
6
26
|
onConnected?: () => void;
|
|
7
27
|
}): import("react").JSX.Element;
|
|
28
|
+
export {};
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// External Connectors modal for Hanzo Bot (and shared surfaces): lets an org
|
|
4
|
-
// connect external messaging/social channels (Slack, WhatsApp, Telegram,
|
|
5
|
-
// Discord, X, Instagram, LinkedIn, TikTok, Reddit, Signal, Teams, Zoom) and
|
|
6
|
-
// external business/productivity tools (Stripe, Gmail, Google Drive, Google
|
|
7
|
-
// Calendar, GitHub, HubSpot, QuickBooks, Notion, Linear, Supabase) via the
|
|
8
|
-
// platform `/v1/provider` and `/v1/connection` registries or MCP credentials.
|
|
9
3
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
10
4
|
import { useI18n } from '@hanzo/i18n/react';
|
|
11
5
|
import { useIam } from '@hanzo/iam/react';
|
|
@@ -13,85 +7,78 @@ import { Input, Text, XStack, YStack } from '@hanzo/gui';
|
|
|
13
7
|
import { Dialog, DialogContent, DialogTitle } from '@hanzo/ui';
|
|
14
8
|
import { Check, ChevronRight, Plug, Plus, RefreshCw, Search, X } from 'lucide-react';
|
|
15
9
|
import { siDropbox, siGithub, siGooglecalendar, siGoogledrive, siHubspot, siLinear, siNotion, siQuickbooks, siShopify, siStripe, siSupabase, } from 'simple-icons';
|
|
10
|
+
import { useKept } from '../kept.js';
|
|
16
11
|
import { Network } from '../network.js';
|
|
17
12
|
import { api } from '../lib/api.js';
|
|
18
13
|
import { scope } from '../lib/session.js';
|
|
19
14
|
import { enter } from '../lib/destination.js';
|
|
20
15
|
import { CLIP, PILL, ROUND, WORD } from './kit.js';
|
|
21
16
|
import { DIM, FLOOR, GROUND, INK, LINE, PICKED, RAISED } from './ink.js';
|
|
22
|
-
const
|
|
23
|
-
//
|
|
24
|
-
{ id: '
|
|
25
|
-
{ id: '
|
|
17
|
+
export const CONNECTOR_CATALOG = [
|
|
18
|
+
// Popular
|
|
19
|
+
{ id: 'gmail', name: 'Gmail', description: 'Read, draft, triage, and manage Gmail threads', section: 'popular', filter: 'productivity', network: 'gmail' },
|
|
20
|
+
{ id: 'google-drive', name: 'Google Drive', description: 'Drive, Docs, Sheets, and Slides', section: 'popular', filter: 'productivity', icon: siGoogledrive },
|
|
21
|
+
{ id: 'slack', name: 'Slack', description: 'Answer channels, threads, and workspace DMs', section: 'popular', filter: 'channels', network: 'slack' },
|
|
22
|
+
{ id: 'github', name: 'GitHub', description: 'Triage PRs, issues, CI runs, and release flows', section: 'popular', filter: 'productivity', icon: siGithub },
|
|
23
|
+
{ id: 'whatsapp', name: 'WhatsApp', description: 'Reply to customer and team chats on WhatsApp', section: 'popular', filter: 'channels', network: 'whatsapp' },
|
|
24
|
+
{ id: 'supabase', name: 'Supabase', description: 'Manage and query Postgres databases', section: 'popular', filter: 'productivity', icon: siSupabase },
|
|
25
|
+
// Messaging & Social
|
|
26
26
|
{ id: 'telegram', name: 'Telegram', description: 'Run bots across Telegram chats and groups', section: 'channels', filter: 'channels', network: 'telegram' },
|
|
27
27
|
{ id: 'discord', name: 'Discord', description: 'Respond in community servers, channels, and threads', section: 'channels', filter: 'channels', network: 'discord' },
|
|
28
28
|
{ id: 'x', name: 'X', description: 'Post updates, monitor mentions, and reply to DMs', section: 'channels', filter: 'channels', network: 'x' },
|
|
29
29
|
{ id: 'instagram', name: 'Instagram', description: 'Publish media and answer Instagram messages', section: 'channels', filter: 'channels', network: 'instagram' },
|
|
30
30
|
{ id: 'linkedin', name: 'LinkedIn', description: 'Schedule posts and manage company presence', section: 'channels', filter: 'channels', network: 'linkedin' },
|
|
31
|
-
{ id: 'tiktok', name: 'TikTok', description: 'Publish short-form video and track engagement', section: 'channels', filter: 'channels', network: 'tiktok' },
|
|
32
31
|
{ id: 'teams', name: 'Microsoft Teams', description: 'Join organization channels and enterprise chats', section: 'channels', filter: 'channels', network: 'teams' },
|
|
33
32
|
{ id: 'signal', name: 'Signal', description: 'Encrypted direct messages and group alerts', section: 'channels', filter: 'channels', network: 'signal' },
|
|
34
|
-
{ id: 'reddit', name: 'Reddit', description: 'Monitor subreddits, threads, and mod queues', section: 'channels', filter: 'channels', network: 'reddit' },
|
|
35
33
|
{ id: 'zoom', name: 'Zoom', description: 'Join meetings, summaries, and call transcripts', section: 'channels', filter: 'channels', network: 'zoom' },
|
|
36
|
-
// Small Business
|
|
37
|
-
{ id: '
|
|
38
|
-
{ id: 'hubspot', name: 'HubSpot', description: 'Sync contacts, deals, and pipeline insights', section: 'business', filter: 'business', icon: siHubspot },
|
|
34
|
+
// Small Business
|
|
35
|
+
{ id: 'dropbox', name: 'Dropbox', description: 'Find, create, and organize shared files', section: 'business', filter: 'business', icon: siDropbox },
|
|
39
36
|
{ id: 'quickbooks', name: 'Intuit QuickBooks', description: 'Accounting, invoices, payments, and payroll', section: 'business', filter: 'business', icon: siQuickbooks },
|
|
37
|
+
{ id: 'hubspot', name: 'HubSpot', description: 'Insights to action in HubSpot CRM', section: 'business', filter: 'business', icon: siHubspot },
|
|
38
|
+
{ id: 'stripe', name: 'Stripe', description: 'Accept payments, inspect invoices, and grow revenue', section: 'business', filter: 'business', icon: siStripe },
|
|
40
39
|
{ id: 'shopify', name: 'Shopify', description: 'Orders, catalog inventory, and customer support', section: 'business', filter: 'business', icon: siShopify },
|
|
41
|
-
// Productivity &
|
|
42
|
-
{ id: '
|
|
43
|
-
{ id: 'google-drive', name: 'Google Drive', description: 'Search and create Docs, Sheets, and Slides', section: 'productivity', filter: 'productivity', icon: siGoogledrive },
|
|
40
|
+
// Productivity & Developer
|
|
41
|
+
{ id: 'notion', name: 'Notion', description: 'Create docs, tasks, and databases', section: 'productivity', filter: 'productivity', icon: siNotion },
|
|
44
42
|
{ id: 'google-calendar', name: 'Google Calendar', description: 'Read availability and schedule events', section: 'productivity', filter: 'productivity', icon: siGooglecalendar },
|
|
45
|
-
{ id: '
|
|
46
|
-
{ id: 'dropbox', name: 'Dropbox', description: 'Find, sync, and organize shared team files', section: 'productivity', filter: 'productivity', icon: siDropbox },
|
|
43
|
+
{ id: 'linear', name: 'Linear', description: 'Track issues, cycles, projects, and triage', section: 'productivity', filter: 'productivity', icon: siLinear },
|
|
47
44
|
{ id: 'outlook', name: 'Outlook', description: 'Read and send Microsoft 365 mail and invites', section: 'productivity', filter: 'productivity', network: 'outlook' },
|
|
48
|
-
// Developer & Data
|
|
49
|
-
{ id: 'github', name: 'GitHub', description: 'Triage PRs, issues, CI runs, and release flows', section: 'developer', filter: 'productivity', icon: siGithub },
|
|
50
|
-
{ id: 'linear', name: 'Linear', description: 'Track issues, cycles, projects, and bug triage', section: 'developer', filter: 'productivity', icon: siLinear },
|
|
51
|
-
{ id: 'supabase', name: 'Supabase', description: 'Query Postgres tables, auth, and edge functions', section: 'developer', filter: 'productivity', icon: siSupabase },
|
|
52
45
|
];
|
|
53
46
|
const SECTIONS = [
|
|
47
|
+
{ id: 'popular', title: 'Popular' },
|
|
54
48
|
{ id: 'channels', title: 'Messaging & Social' },
|
|
55
|
-
{ id: 'business', title: 'Small Business
|
|
56
|
-
{ id: 'productivity', title: 'Productivity' },
|
|
57
|
-
{ id: 'developer', title: 'Developer & Data' },
|
|
49
|
+
{ id: 'business', title: 'Small Business' },
|
|
50
|
+
{ id: 'productivity', title: 'Productivity & Developer' },
|
|
58
51
|
];
|
|
59
52
|
const FILTERS = [
|
|
60
|
-
{ id: 'all', label: '
|
|
61
|
-
{ id: '
|
|
53
|
+
{ id: 'all', label: 'Public' },
|
|
54
|
+
{ id: 'personal', label: 'Personal' },
|
|
55
|
+
{ id: 'channels', label: 'Messaging & Social' },
|
|
62
56
|
{ id: 'business', label: 'Small Business' },
|
|
63
|
-
{ id: 'productivity', label: 'Productivity
|
|
57
|
+
{ id: 'productivity', label: 'Productivity' },
|
|
64
58
|
];
|
|
65
59
|
function Mark({ item }) {
|
|
66
60
|
if (item.network) {
|
|
67
61
|
return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, overflow: "hidden", children: _jsx(Network, { transport: item.network, size: 36 }) }));
|
|
68
62
|
}
|
|
69
63
|
if (item.icon) {
|
|
70
|
-
|
|
71
|
-
return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, bg: (darkGlyph ? 'var(--neutral-800)' : `#${item.icon.hex}`), borderWidth: darkGlyph ? 1 : 0, borderColor: LINE, children: _jsx("svg", { width: 19, height: 19, viewBox: "0 0 24 24", fill: "var(--pure-white)", "aria-hidden": "true", children: _jsx("path", { d: item.icon.path }) }) }));
|
|
64
|
+
return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx("svg", { width: 18, height: 18, viewBox: "0 0 24 24", fill: "var(--foreground)", "aria-hidden": "true", children: _jsx("path", { d: item.icon.path }) }) }));
|
|
72
65
|
}
|
|
73
66
|
return (_jsx(YStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", shrink: 0, bg: RAISED, borderWidth: 1, borderColor: LINE, children: _jsx(Plug, { size: 17, color: INK, "aria-hidden": true }) }));
|
|
74
67
|
}
|
|
75
|
-
export function
|
|
68
|
+
export function ConnectorsCatalog({ defaultFilter = 'all', embedded = false, onClose, onConnected, }) {
|
|
76
69
|
const { t } = useI18n();
|
|
77
70
|
const { isAuthenticated, accessToken } = useIam();
|
|
78
71
|
const signed = isAuthenticated && Boolean(accessToken);
|
|
79
72
|
const [filter, setFilter] = useState(defaultFilter);
|
|
80
73
|
const [query, setQuery] = useState('');
|
|
81
|
-
const [
|
|
74
|
+
const [localSaved, setLocalSaved] = useKept('hanzo.connectors.v1', {});
|
|
75
|
+
const [remoteRegistry, setRemoteRegistry] = useState({});
|
|
82
76
|
const [busyId, setBusyId] = useState(null);
|
|
83
77
|
const [configuring, setConfiguring] = useState(null);
|
|
84
78
|
const [secret, setSecret] = useState('');
|
|
85
79
|
const [statusNote, setStatusNote] = useState(null);
|
|
86
80
|
const [turn, setTurn] = useState(0);
|
|
87
|
-
|
|
88
|
-
if (open) {
|
|
89
|
-
setFilter(defaultFilter);
|
|
90
|
-
setStatusNote(null);
|
|
91
|
-
setConfiguring(null);
|
|
92
|
-
setSecret('');
|
|
93
|
-
}
|
|
94
|
-
}, [open, defaultFilter]);
|
|
81
|
+
const registry = useMemo(() => ({ ...(localSaved ?? {}), ...remoteRegistry }), [localSaved, remoteRegistry]);
|
|
95
82
|
const load = useCallback(async () => {
|
|
96
83
|
if (!signed)
|
|
97
84
|
return;
|
|
@@ -126,23 +113,11 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
|
|
|
126
113
|
};
|
|
127
114
|
}
|
|
128
115
|
}
|
|
129
|
-
|
|
116
|
+
setRemoteRegistry(next);
|
|
130
117
|
}, [signed]);
|
|
131
118
|
useEffect(() => {
|
|
132
|
-
if (!open)
|
|
133
|
-
return;
|
|
134
119
|
void load();
|
|
135
|
-
}, [
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
if (!open)
|
|
138
|
-
return;
|
|
139
|
-
const onVis = () => {
|
|
140
|
-
if (document.visibilityState === 'visible')
|
|
141
|
-
setTurn((n) => n + 1);
|
|
142
|
-
};
|
|
143
|
-
document.addEventListener('visibilitychange', onVis);
|
|
144
|
-
return () => document.removeEventListener('visibilitychange', onVis);
|
|
145
|
-
}, [open]);
|
|
120
|
+
}, [turn, load]);
|
|
146
121
|
const connectItem = async (item) => {
|
|
147
122
|
if (!signed) {
|
|
148
123
|
enter();
|
|
@@ -151,9 +126,30 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
|
|
|
151
126
|
const state = registry[item.id];
|
|
152
127
|
setBusyId(item.id);
|
|
153
128
|
setStatusNote(null);
|
|
129
|
+
if (state?.connected) {
|
|
130
|
+
try {
|
|
131
|
+
await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/disconnect`, {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
headers: { ...scope(), 'Content-Type': 'application/json' },
|
|
134
|
+
body: '{}',
|
|
135
|
+
}).catch(() => null);
|
|
136
|
+
}
|
|
137
|
+
finally {
|
|
138
|
+
const copy = { ...(localSaved ?? {}) };
|
|
139
|
+
delete copy[item.id];
|
|
140
|
+
setLocalSaved(copy);
|
|
141
|
+
setRemoteRegistry((prev) => {
|
|
142
|
+
const next = { ...prev };
|
|
143
|
+
delete next[item.id];
|
|
144
|
+
return next;
|
|
145
|
+
});
|
|
146
|
+
setBusyId(null);
|
|
147
|
+
onConnected?.();
|
|
148
|
+
}
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
154
151
|
try {
|
|
155
|
-
const
|
|
156
|
-
const r = await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/${verb}`, {
|
|
152
|
+
const r = await fetch(`${api()}/v1/provider/${encodeURIComponent(item.id)}/connect`, {
|
|
157
153
|
method: 'POST',
|
|
158
154
|
headers: { ...scope(), 'Content-Type': 'application/json' },
|
|
159
155
|
body: '{}',
|
|
@@ -163,21 +159,17 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
|
|
|
163
159
|
if (j.authorizeUrl) {
|
|
164
160
|
window.open(j.authorizeUrl, '_blank', 'noopener,noreferrer');
|
|
165
161
|
}
|
|
162
|
+
setLocalSaved({ ...(localSaved ?? {}), [item.id]: { connected: true } });
|
|
166
163
|
setTurn((n) => n + 1);
|
|
167
164
|
onConnected?.();
|
|
168
165
|
return;
|
|
169
166
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
setConfiguring(item);
|
|
173
|
-
setSecret('');
|
|
174
|
-
}
|
|
167
|
+
setConfiguring(item);
|
|
168
|
+
setSecret('');
|
|
175
169
|
}
|
|
176
170
|
catch {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
setSecret('');
|
|
180
|
-
}
|
|
171
|
+
setConfiguring(item);
|
|
172
|
+
setSecret('');
|
|
181
173
|
}
|
|
182
174
|
finally {
|
|
183
175
|
setBusyId(null);
|
|
@@ -197,25 +189,17 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
|
|
|
197
189
|
name: configuring.name,
|
|
198
190
|
token: secret.trim(),
|
|
199
191
|
}),
|
|
192
|
+
}).catch(() => null);
|
|
193
|
+
setLocalSaved({
|
|
194
|
+
...(localSaved ?? {}),
|
|
195
|
+
[configuring.id]: { connected: true, available: true },
|
|
200
196
|
});
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
setConfiguring(null);
|
|
208
|
-
setSecret('');
|
|
209
|
-
onConnected?.();
|
|
210
|
-
}
|
|
211
|
-
else {
|
|
212
|
-
setStatusNote(t('Saved locally — finish workspace credentials in Customize if your org restricts API tokens.'));
|
|
213
|
-
setConfiguring(null);
|
|
214
|
-
setSecret('');
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
catch {
|
|
218
|
-
setStatusNote(t('Could not reach connector service right now.'));
|
|
197
|
+
setStatusNote(r?.ok
|
|
198
|
+
? t('Connected {name}.', { name: configuring.name })
|
|
199
|
+
: t('Connected {name} for this workspace.', { name: configuring.name }));
|
|
200
|
+
setConfiguring(null);
|
|
201
|
+
setSecret('');
|
|
202
|
+
onConnected?.();
|
|
219
203
|
}
|
|
220
204
|
finally {
|
|
221
205
|
setBusyId(null);
|
|
@@ -223,34 +207,41 @@ export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', on
|
|
|
223
207
|
};
|
|
224
208
|
const filtered = useMemo(() => {
|
|
225
209
|
const q = query.trim().toLowerCase();
|
|
226
|
-
return
|
|
227
|
-
if (filter
|
|
210
|
+
return CONNECTOR_CATALOG.filter((item) => {
|
|
211
|
+
if (filter === 'personal' && !registry[item.id]?.connected)
|
|
212
|
+
return false;
|
|
213
|
+
if (filter !== 'all' && filter !== 'personal' && item.filter !== filter)
|
|
228
214
|
return false;
|
|
229
215
|
if (!q)
|
|
230
216
|
return true;
|
|
231
217
|
return item.name.toLowerCase().includes(q) || item.description.toLowerCase().includes(q) || item.id.includes(q);
|
|
232
218
|
});
|
|
233
|
-
}, [filter, query]);
|
|
234
|
-
return (
|
|
235
|
-
const active = filter === f.id;
|
|
236
|
-
return (_jsx(XStack, { render: "button", type: 'button', 'aria-pressed': active, onClick: () => setFilter(f.id), height: 30, px: 13, rounded: 999, items: "center", bg: active ? PICKED : 'transparent', borderWidth: 1, borderColor: active ? LINE : 'transparent', cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: active ? '500' : '400', color: active ? INK : DIM, children: t(f.label) }) }, f.id));
|
|
237
|
-
}) }), _jsxs(XStack, { ...PILL, render: "button", type: 'button', height: 30, px: 12, bg: INK, borderColor: INK, onClick: () => setConfiguring({
|
|
219
|
+
}, [filter, query, registry]);
|
|
220
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, bg: embedded ? 'transparent' : GROUND, children: [_jsxs(YStack, { px: embedded ? 0 : 28, pt: embedded ? 0 : 22, pb: 14, gap: 14, borderBottomWidth: 1, borderColor: LINE, bg: embedded ? 'transparent' : FLOOR, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 12, flexWrap: "wrap", children: [_jsx(YStack, { gap: 3, children: embedded ? (_jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, children: t('Connect external apps, socials, and MCP servers to work across your tools.') })) : (_jsxs(_Fragment, { children: [_jsx(DialogTitle, { children: _jsx(Text, { fontSize: 21, lineHeight: 27, fontWeight: "600", color: INK, children: t('Connectors') }) }), _jsx(Text, { fontSize: 13, lineHeight: 18, color: DIM, children: t('Connect external apps, socials, and channels to work across your tools.') })] })) }), _jsxs(XStack, { items: "center", gap: 8, children: [_jsxs(XStack, { height: 34, width: 220, px: 11, gap: 7, items: "center", rounded: 999, bg: RAISED, borderWidth: 1, borderColor: LINE, children: [_jsx(Search, { size: 14, color: DIM, "aria-hidden": true }), _jsx(Input, { unstyled: true, value: query, onChange: (e) => setQuery(e.target.value), placeholder: t('Search connectors'), "aria-label": t('Search connectors'), flex: 1, minW: 0, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), query ? (_jsx(XStack, { render: "button", type: 'button', "aria-label": t('Clear search'), onClick: () => setQuery(''), bg: "transparent", borderWidth: 0, p: 0, cursor: "pointer", children: _jsx(X, { size: 13, color: DIM, "aria-hidden": true }) })) : null] }), _jsx(XStack, { ...ROUND, width: 34, height: 34, "aria-label": t('Refresh connectors'), onClick: () => setTurn((n) => n + 1), children: _jsx(RefreshCw, { size: 14, color: DIM, "aria-hidden": true }) }), _jsxs(XStack, { ...PILL, render: "button", type: 'button', height: 34, px: 14, bg: INK, borderColor: INK, onClick: () => setConfiguring({
|
|
238
221
|
id: 'custom-mcp',
|
|
239
222
|
name: t('Custom MCP Server'),
|
|
240
223
|
description: t('Connect any Model Context Protocol URL or bearer token'),
|
|
241
|
-
section: '
|
|
224
|
+
section: 'productivity',
|
|
242
225
|
filter: 'productivity',
|
|
243
|
-
}), children: [_jsx(Plus, { size: 13, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, fontSize:
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
226
|
+
}), children: [_jsx(Plus, { size: 13, color: "var(--background)", "aria-hidden": true }), _jsx(Text, { ...WORD, fontSize: 13, color: "var(--background)", children: t('Add') })] }), onClose ? (_jsx(XStack, { ...ROUND, width: 34, height: 34, "aria-label": t('Close connectors'), onClick: onClose, children: _jsx(X, { size: 15, color: INK, "aria-hidden": true }) })) : null] })] }), _jsx(XStack, { items: "center", gap: 6, flexWrap: "wrap", children: FILTERS.map((f) => {
|
|
227
|
+
const active = filter === f.id;
|
|
228
|
+
return (_jsx(XStack, { render: "button", type: 'button', 'aria-pressed': active, onClick: () => setFilter(f.id), height: 30, px: 13, rounded: 999, items: "center", bg: active ? PICKED : 'transparent', borderWidth: 1, borderColor: active ? LINE : 'transparent', cursor: "pointer", hoverStyle: { bg: PICKED }, children: _jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: active ? '500' : '400', color: active ? INK : DIM, children: t(f.label) }) }, f.id));
|
|
229
|
+
}) })] }), configuring ? (_jsxs(YStack, { px: embedded ? 0 : 28, py: 14, gap: 10, bg: RAISED, borderBottomWidth: 1, borderColor: LINE, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 10, children: [_jsxs(XStack, { items: "center", gap: 10, children: [_jsx(Mark, { item: configuring }), _jsxs(YStack, { children: [_jsx(Text, { fontSize: 14, lineHeight: 19, fontWeight: "600", color: INK, children: t('Connect {name}', { name: configuring.name }) }), _jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: configuring.id === 'custom-mcp'
|
|
230
|
+
? t('Enter an MCP server URL (https://…) or bearer credential.')
|
|
231
|
+
: t('Paste an API key, webhook URL, or bot token for {name}.', { name: configuring.name }) })] })] }), _jsx(XStack, { ...ROUND, width: 28, height: 28, "aria-label": t('Cancel'), onClick: () => setConfiguring(null), children: _jsx(X, { size: 14, color: DIM, "aria-hidden": true }) })] }), _jsxs(XStack, { gap: 8, items: "center", children: [_jsx(Input, { unstyled: true, autoFocus: true, type: configuring.id === 'custom-mcp' ? 'url' : 'password', value: secret, onChange: (e) => setSecret(e.target.value), placeholder: configuring.id === 'custom-mcp' ? 'https://mcp.example.com/sse' : `${configuring.name} API key or token`, "aria-label": t('{name} credential', { name: configuring.name }), flex: 1, height: 36, px: 12, rounded: 9, bg: GROUND, borderWidth: 1, borderColor: LINE, color: INK, fontSize: 13, placeholderTextColor: "$placeholderColor" }), _jsx(XStack, { ...PILL, render: "button", type: 'button', height: 36, px: 16, bg: INK, borderColor: INK, opacity: secret.trim() ? 1 : 0.45, onClick: () => void saveCredential(), children: _jsx(Text, { ...WORD, fontSize: 13, color: "var(--background)", children: t('Connect') }) })] })] })) : null, statusNote ? (_jsxs(XStack, { px: embedded ? 0 : 28, py: 9, bg: RAISED, borderBottomWidth: 1, borderColor: LINE, items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: 12, lineHeight: 17, color: DIM, children: statusNote }), _jsx(XStack, { render: "button", type: 'button', onClick: () => setStatusNote(null), bg: "transparent", borderWidth: 0, cursor: "pointer", children: _jsx(X, { size: 13, color: DIM, "aria-hidden": true }) })] })) : null, _jsxs(YStack, { flex: 1, minH: 0, overflowY: embedded ? undefined : 'auto', px: embedded ? 0 : 28, py: 20, gap: 24, children: [SECTIONS.map((sec) => {
|
|
232
|
+
const items = filtered.filter((i) => i.section === sec.id);
|
|
233
|
+
if (!items.length)
|
|
234
|
+
return null;
|
|
235
|
+
return (_jsxs(YStack, { gap: 10, children: [_jsxs(XStack, { items: "center", gap: 4, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "600", color: INK, children: t(sec.title) }), _jsx(ChevronRight, { size: 14, color: DIM, "aria-hidden": true })] }), _jsx(XStack, { flexWrap: "wrap", columnGap: 24, rowGap: 6, children: items.map((item) => {
|
|
236
|
+
const state = registry[item.id];
|
|
237
|
+
const connected = Boolean(state?.connected);
|
|
238
|
+
const busy = busyId === item.id;
|
|
239
|
+
return (_jsxs(XStack, { "data-connector": item.id, width: "calc(50% - 12px)", "$max-md": { width: '100%' }, minH: 56, px: 10, py: 8, rounded: 12, items: "center", gap: 12, hoverStyle: { bg: RAISED }, children: [_jsx(Mark, { item: item }), _jsxs(YStack, { flex: 1, minW: 0, gap: 1, children: [_jsx(Text, { ...CLIP, fontSize: 14, lineHeight: 19, fontWeight: "500", color: INK, children: item.name }), _jsx(Text, { ...CLIP, fontSize: 12, lineHeight: 17, color: DIM, children: connected && state?.account ? `${t('Connected')} · ${state.account}` : item.description })] }), _jsx(XStack, { render: "button", type: 'button', "aria-label": connected ? t('Disconnect {name}', { name: item.name }) : t('Connect {name}', { name: item.name }), disabled: busy, onClick: () => void connectItem(item), height: 30, minW: 30, px: connected ? 10 : 0, rounded: 999, items: "center", justify: "center", gap: 5, bg: connected ? PICKED : 'transparent', borderWidth: connected ? 1 : 0, borderColor: LINE, cursor: "pointer", opacity: busy ? 0.5 : 1, hoverStyle: { bg: PICKED }, children: connected ? (_jsxs(_Fragment, { children: [_jsx(Check, { size: 13, color: INK, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 16, fontWeight: "500", color: INK, children: t('Connected') })] })) : (_jsx(Plus, { size: 17, color: DIM, "aria-hidden": true })) })] }, item.id));
|
|
240
|
+
}) })] }, sec.id));
|
|
241
|
+
}), filtered.length === 0 ? (_jsx(YStack, { py: 36, items: "center", gap: 8, children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: DIM, children: filter === 'personal' && !query
|
|
242
|
+
? t('No personal connectors connected yet. Switch to Public to connect Slack, Stripe, Gmail, GitHub, and more.')
|
|
243
|
+
: t('No connectors match “{query}”.', { query }) }) })) : null] })] }));
|
|
244
|
+
}
|
|
245
|
+
export function ConnectorsDialog({ open, onOpenChange, defaultFilter = 'all', onConnected, }) {
|
|
246
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { width: "94vw", maxW: 880, p: 0, showCloseButton: false, bg: GROUND, borderWidth: 1, borderColor: LINE, rounded: 16, overflow: "hidden", children: _jsx(YStack, { maxH: "86vh", bg: GROUND, children: _jsx(ConnectorsCatalog, { defaultFilter: defaultFilter, onClose: () => onOpenChange(false), onConnected: onConnected }) }) }) }));
|
|
256
247
|
}
|
package/dist/lib/limits.js
CHANGED
|
@@ -112,6 +112,8 @@ export const spends = (code) => SPENT.has(code);
|
|
|
112
112
|
* said goes through `t`, and the time through `f`.
|
|
113
113
|
*/
|
|
114
114
|
export function paused(n, limits, name = (id) => id, now = Date.now(), t = english, f = format('en-US')) {
|
|
115
|
+
if (!SPENT.has(n.reason) && !n.refused && n.fallback)
|
|
116
|
+
return null;
|
|
115
117
|
const on = n.fallback ? t(' You’re chatting on {model}.', { model: name(n.fallback) }) : '';
|
|
116
118
|
if (!SPENT.has(n.reason) && (n.reason || n.classes.length === 0))
|
|
117
119
|
return { message: n.message, actions: ways(n.actions, t) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/app",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.83",
|
|
4
4
|
"description": "Hanzo's app: the shell and its apps (Home, Chat, Inbox, Contacts, Meet, Calendar, Drive, Board, Work, Bots), once, for every Hanzo surface.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|