@hanzo/app 0.3.95 → 0.3.97
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/Board.js +1 -1
- package/dist/Chat.js +48 -11
- package/dist/PreferencesDialog.js +5 -2
- package/dist/Shell.d.ts +10 -0
- package/dist/Shell.js +63 -22
- package/dist/Sidebar.js +1 -1
- package/dist/about.d.ts +12 -0
- package/dist/about.js +44 -0
- package/dist/bots/Bots.js +16 -1
- package/dist/bots/Roster.d.ts +4 -1
- package/dist/bots/Roster.js +61 -20
- package/dist/bots/face.js +3 -1
- package/dist/bots/grid.d.ts +36 -0
- package/dist/bots/grid.js +91 -0
- package/dist/bots/ink.d.ts +1 -1
- package/dist/bots/ink.js +1 -1
- package/dist/bots/kit.d.ts +8 -4
- package/dist/bots/kit.js +2 -1
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +2 -2
- package/dist/lastpage.d.ts +9 -0
- package/dist/lastpage.js +15 -0
- package/dist/lib/durable.d.ts +1 -1
- package/dist/lib/durable.js +1 -1
- package/dist/lib/todo.d.ts +1 -1
- package/dist/lib/todo.js +5 -5
- package/dist/seek.d.ts +6 -1
- package/dist/seek.js +13 -0
- package/package.json +1 -1
package/dist/Board.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
9
9
|
// engine, and asks why their cards are not replayable. Tasks keeps the word it
|
|
10
10
|
// earned; this is the Board.
|
|
11
11
|
//
|
|
12
|
-
// A CARD IS A FORGE ISSUE. `/v1/
|
|
12
|
+
// A CARD IS A FORGE ISSUE. `/v1/task` says so itself — "the column is a LABEL on
|
|
13
13
|
// the forge, so the board and the forge web UI are the same object seen twice:
|
|
14
14
|
// relabelling in either moves the card in both" — so this surface keeps no work
|
|
15
15
|
// of its own. Everything drawn here is a row somebody could also have moved from
|
package/dist/Chat.js
CHANGED
|
@@ -41,7 +41,9 @@ import { conversation, drop, hold, landed, localOf, spend, take, usePane, useWor
|
|
|
41
41
|
import { Face, brief as castBrief, join, roleOf, castTurn, roster as rosterLine, rosterOf, speakers, speaksOf, voiceOf } from "./cast.js";
|
|
42
42
|
import { cleanForSpeech, speakAgent } from "./speech.js";
|
|
43
43
|
import { AgentMaker, HOUSE, useAgentShelf, useCrew } from "./crew.js";
|
|
44
|
-
import { called } from "./team.js";
|
|
44
|
+
import { TEAM, called } from "./team.js";
|
|
45
|
+
import { ABOUT, about } from "./about.js";
|
|
46
|
+
import { written as lastPage } from "./lastpage.js";
|
|
45
47
|
import { Box, Button, Dialog, DialogContent, DialogTitle, Input, Text, Tooltip, TooltipContent, TooltipTrigger, View, VisuallyHidden, XStack, YStack, toast } from "@hanzo/ui";
|
|
46
48
|
import { useMedia } from "@hanzo/gui";
|
|
47
49
|
import { given, tidy } from "./lib/title.js";
|
|
@@ -58,7 +60,7 @@ import { useHydrated } from "./lib/hydrated.js";
|
|
|
58
60
|
import { base, served } from "./lib/ai.js";
|
|
59
61
|
import { onServed } from "./lib/served.js";
|
|
60
62
|
import { refused as worded, speech, useDictation, useTalk, useVoice } from "@hanzo/voice";
|
|
61
|
-
import { CalendarClock, Check, Code2, Copy, Download, FileText, Ghost, GitBranch, Image as ImageMark, KanbanSquare, Library as LibraryMark, PanelRight, Paperclip, Pencil, RefreshCw, ShieldCheck, Sparkles, Upload, X } from "lucide-react";
|
|
63
|
+
import { CalendarClock, Check, Code2, Copy, Download, FileText, Ghost, GitBranch, Globe, Image as ImageMark, KanbanSquare, Library as LibraryMark, PanelRight, Paperclip, Pencil, RefreshCw, ShieldCheck, Sparkles, Upload, X } from "lucide-react";
|
|
62
64
|
import { branched } from "./lib/branch.js";
|
|
63
65
|
import { openModelPicker } from "./lib/model-picker.js";
|
|
64
66
|
import { open as openBoardCard, home as boardHome } from "./lib/todo.js";
|
|
@@ -264,10 +266,17 @@ const CAST = "cast";
|
|
|
264
266
|
const ROUTERS = new Set(["enso", "enso-auto", "hanzo/enso", "auto"]);
|
|
265
267
|
/** The id of the turn drawn in the thread when a turn is refused. */
|
|
266
268
|
const FAILED = "failed";
|
|
267
|
-
/**
|
|
269
|
+
/**
|
|
270
|
+
* The turns with the conversation's system turns first: the cast's, when it has
|
|
271
|
+
* one, then what the app is (about.ts) — its agents, where a page it writes
|
|
272
|
+
* shows, and to ask before a build nobody described. Neither is ever recorded:
|
|
273
|
+
* a kept thread holds what was said (@hanzo/ai `useChat` records the question
|
|
274
|
+
* and its answer), so a conversation reopened is seated afresh.
|
|
275
|
+
*/
|
|
268
276
|
function seated(turns, turn) {
|
|
269
|
-
const rest = turns.filter((one) => one.id !== CAST);
|
|
270
|
-
|
|
277
|
+
const rest = turns.filter((one) => one.id !== CAST && one.id !== ABOUT);
|
|
278
|
+
const app = { id: ABOUT, role: "system", content: about(brand(), TEAM) };
|
|
279
|
+
return turn ? [{ id: CAST, role: "system", content: turn }, app, ...rest] : [app, ...rest];
|
|
271
280
|
}
|
|
272
281
|
/** An answer that came back with nothing in it. */
|
|
273
282
|
const blank = (one) => one.role === "assistant" && !String(one.content ?? "").trim() && !one.tool_calls?.length;
|
|
@@ -333,7 +342,7 @@ function plainTurnText(m) {
|
|
|
333
342
|
return "";
|
|
334
343
|
}
|
|
335
344
|
/** Quiet monochrome hover/focus-reveal actions under every completed assistant response. */
|
|
336
|
-
function AssistantTurnActions({ text, latest = false, canRegenerate, onRegenerate, onBranch, onOpen, onOpenInDev, onCreateBoardCard, onSchedule, }) {
|
|
345
|
+
function AssistantTurnActions({ text, latest = false, canRegenerate, onRegenerate, onBranch, onOpen, preview = false, onOpenInDev, onCreateBoardCard, onSchedule, }) {
|
|
337
346
|
const { t } = useI18n();
|
|
338
347
|
const [copied, setCopied] = useState(false);
|
|
339
348
|
useEffect(() => {
|
|
@@ -367,7 +376,17 @@ function AssistantTurnActions({ text, latest = false, canRegenerate, onRegenerat
|
|
|
367
376
|
setCopied(true);
|
|
368
377
|
toast.success(t("Copied to clipboard"));
|
|
369
378
|
}, () => toast.error(t("Could not copy")));
|
|
370
|
-
}, ...actionButton, bg: copied ? "$hover" : "transparent", borderColor: copied ? "var(--border-strong)" : "transparent", children: _jsxs(XStack, { items: "center", gap: "$1", children: [copied ? (_jsx(Check, { size: 13, color: "var(--state-success)", "aria-hidden": true })) : (_jsx(Copy, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true })), copied ? (_jsx(Text, { fontSize: "$1", color: "$ink", children: t("Copied") })) : null] }) }), canRegenerate && onRegenerate ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Regenerate") }), "data-slot": "assistant-turn-regenerate", "aria-label": t("Regenerate response"), onClick: onRegenerate, ...actionButton, children: _jsx(RefreshCw, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onBranch ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Branch") }), "data-slot": "assistant-turn-branch", "aria-label": t("Branch into a new chat"), onClick: onBranch, ...actionButton, children: _jsx(GitBranch, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onOpenInDev ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Open in Dev") }), "data-slot": "assistant-turn-dev", "aria-label": t("Open in Dev"), onClick: onOpenInDev, ...actionButton, children: _jsx(Code2, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onCreateBoardCard ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Create Board card") }), "data-slot": "assistant-turn-board", "aria-label": t("Create Board card"), onClick: onCreateBoardCard, ...actionButton, children: _jsx(KanbanSquare, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onSchedule ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Schedule task") }), "data-slot": "assistant-turn-schedule", "aria-label": t("Schedule task"), onClick: onSchedule, ...actionButton, children: _jsx(CalendarClock, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onOpen ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Open in side panel") }), "data-slot": "assistant-turn-open", "aria-label": t("Open in side panel"), onClick: onOpen, ...actionButton, children: _jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(PanelRight, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t("Open") })] }) })) : null] }));
|
|
379
|
+
}, ...actionButton, bg: copied ? "$hover" : "transparent", borderColor: copied ? "var(--border-strong)" : "transparent", children: _jsxs(XStack, { items: "center", gap: "$1", children: [copied ? (_jsx(Check, { size: 13, color: "var(--state-success)", "aria-hidden": true })) : (_jsx(Copy, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true })), copied ? (_jsx(Text, { fontSize: "$1", color: "$ink", children: t("Copied") })) : null] }) }), canRegenerate && onRegenerate ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Regenerate") }), "data-slot": "assistant-turn-regenerate", "aria-label": t("Regenerate response"), onClick: onRegenerate, ...actionButton, children: _jsx(RefreshCw, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onBranch ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Branch") }), "data-slot": "assistant-turn-branch", "aria-label": t("Branch into a new chat"), onClick: onBranch, ...actionButton, children: _jsx(GitBranch, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onOpenInDev ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Open in Dev") }), "data-slot": "assistant-turn-dev", "aria-label": t("Open in Dev"), onClick: onOpenInDev, ...actionButton, children: _jsx(Code2, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onCreateBoardCard ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Create Board card") }), "data-slot": "assistant-turn-board", "aria-label": t("Create Board card"), onClick: onCreateBoardCard, ...actionButton, children: _jsx(KanbanSquare, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onSchedule ? (_jsx(Box, { render: _jsx("button", { type: "button", title: t("Schedule task") }), "data-slot": "assistant-turn-schedule", "aria-label": t("Schedule task"), onClick: onSchedule, ...actionButton, children: _jsx(CalendarClock, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null, onOpen ? (_jsx(Box, { render: _jsx("button", { type: "button", title: preview ? t("Preview") : t("Open in side panel") }), "data-slot": "assistant-turn-open", "data-preview": preview ? "" : undefined, "aria-label": preview ? t("Preview") : t("Open in side panel"), onClick: onOpen, ...actionButton, children: _jsxs(XStack, { items: "center", gap: "$1", children: [preview ? (_jsx(Globe, { size: 13, color: "var(--foreground)", "aria-hidden": true })) : (_jsx(PanelRight, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true })), _jsx(Text, { fontSize: "$1", color: preview ? "$ink" : "$soft", fontWeight: preview ? "600" : undefined, children: preview ? t("Preview") : t("Open") })] }) })) : null] }));
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* THE PREVIEW, BY NAME, just above the message box on a phone: one labelled
|
|
383
|
+
* press to the page the conversation last wrote. A fence's own file name
|
|
384
|
+
* (`html index.html`) follows the word; a bare language (`html block`) does not.
|
|
385
|
+
*/
|
|
386
|
+
function PreviewButton({ name, onOpen }) {
|
|
387
|
+
const { t } = useI18n();
|
|
388
|
+
const file = name.includes(".") ? name : "";
|
|
389
|
+
return (_jsxs(XStack, { render: "button", "data-slot": "composer-preview", "aria-label": file ? t("Preview {name}", { name: file }) : t("Preview"), self: "flex-start", maxW: "100%", items: "center", gap: "$1.5", px: "$3", minH: 44, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "var(--surface-card)", cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, onClick: onOpen, children: [_jsx(Globe, { size: 14, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t("Preview") }), file ? (_jsx(Text, { fontSize: "$2", color: "$soft", numberOfLines: 1, shrink: 1, minW: 0, children: file })) : null] }));
|
|
371
390
|
}
|
|
372
391
|
/**
|
|
373
392
|
* How long a turn may stream without a word before it is stopped and said to
|
|
@@ -647,7 +666,11 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
647
666
|
const agentShelf = useAgentShelf();
|
|
648
667
|
// The opening greets the person by the first word of their display name, capitalised ("Good to see you, Z. What’s next?").
|
|
649
668
|
// A username is a handle, not a name: without a display name the greeting has none.
|
|
650
|
-
|
|
669
|
+
// The name is the stored token's, the one every request carries, and it follows
|
|
670
|
+
// that token: kept only while `anonymous` held still, it went on greeting
|
|
671
|
+
// whoever the token named when the pane mounted (hanzo-inc/app issue 441).
|
|
672
|
+
const signedAs = anonymous ? null : bearer();
|
|
673
|
+
const firstName = useMemo(() => (signedAs ? given(named()?.display ?? "") : ""), [signedAs]);
|
|
651
674
|
// Private / forgetful mode: an ephemeral conversation kept in memory only, never saved to server history.
|
|
652
675
|
const [forgetful, setForgetful] = useState(false);
|
|
653
676
|
// Up to three things worth doing next, from the person's own activity (@hanzo/build).
|
|
@@ -1514,6 +1537,11 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1514
1537
|
const a = lead(artifacts(text));
|
|
1515
1538
|
return a ? () => see(a) : undefined;
|
|
1516
1539
|
};
|
|
1540
|
+
/** Whether what `opener` opens is a page or a picture: its button is the Preview. */
|
|
1541
|
+
const previews = (text) => {
|
|
1542
|
+
const a = lead(artifacts(text));
|
|
1543
|
+
return Boolean(a && renders(a));
|
|
1544
|
+
};
|
|
1517
1545
|
const threadActions = useThreadActions();
|
|
1518
1546
|
const [customTitle, setCustomTitle] = useState("");
|
|
1519
1547
|
const [editingTitle, setEditingTitle] = useState(false);
|
|
@@ -1616,6 +1644,9 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
1616
1644
|
// brief in the transcript as though somebody had typed it, and would make a
|
|
1617
1645
|
// conversation nobody has spoken in look like one already under way.
|
|
1618
1646
|
const said = useMemo(() => chat.messages.filter((m) => m.role !== "system"), [chat.messages]);
|
|
1647
|
+
// THE PAGE THE CONVERSATION LAST WROTE, for the Preview above the message box
|
|
1648
|
+
// on a phone (`PreviewButton`). Read once the answer has ended, not per token.
|
|
1649
|
+
const page = useMemo(() => (chat.streaming ? null : lastPage(said)), [said, chat.streaming]);
|
|
1619
1650
|
const currentThread = useMemo(() => {
|
|
1620
1651
|
const firstText = said[0]?.content;
|
|
1621
1652
|
const initialText = typeof firstText === "string" ? firstText : Array.isArray(firstText) ? firstText[0]?.text : "";
|
|
@@ -2046,6 +2077,12 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2046
2077
|
}, [media.md]);
|
|
2047
2078
|
const inTopChrome = Boolean(media.md && titlebarSlot);
|
|
2048
2079
|
const showAccessMode = devMode || carry.on.length > 0 || cast.length > 0 || chatPrefs.approvalMode === "manual";
|
|
2080
|
+
// ON A PHONE THE PREVIEW IS NAMED where the message box is. The panel is a
|
|
2081
|
+
// sheet there, shut until something opens it; the header that holds its
|
|
2082
|
+
// toggle on a laptop is not drawn, and an answer's own Preview scrolls away
|
|
2083
|
+
// with it. So while the sheet is shut, the page the conversation last wrote
|
|
2084
|
+
// stands one labelled press away (hanzo-inc/app issue 443).
|
|
2085
|
+
const previewing = !wide && !panel ? page : null;
|
|
2049
2086
|
const composer = {
|
|
2050
2087
|
value: draft,
|
|
2051
2088
|
onChange: setDraft,
|
|
@@ -2087,7 +2124,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2087
2124
|
},
|
|
2088
2125
|
// WHAT GOES WITH THE MESSAGE, above the frame and at its width: the
|
|
2089
2126
|
// pause and its ways past, wallet recovery, one chip a file, and talk mode's words.
|
|
2090
|
-
head: files.length || turnedAway || prepWrong || preparing || talk.open || talk.refusal || banner || simulatedResetAt || walletRecovery ? (_jsxs(_Fragment, { children: [walletRecovery ? (_jsxs(XStack, { role: "alert", "data-slot": "wallet-recovery-strip", items: "center", justify: "space-between", gap: "$2.5", flexWrap: "wrap", px: "$3", py: "$2", rounded: "$4", bg: "var(--surface-card)", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsxs(YStack, { gap: "$0.5", flex: 1, minW: 180, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t("Out of credits — your prompt was kept in the composer") }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t("Add credits to continue with this model, or switch to another model.") })] }), _jsxs(XStack, { items: "center", gap: "$1.5", flexWrap: "wrap", children: [_jsx(Button, { size: "xs", rounded: 999, "$max-sm": { minH: 44 }, onPress: () => requestUpgrade(), children: t("Add credits") }), _jsx(Button, { size: "xs", variant: "outline", rounded: 999, borderColor: "var(--border-strong)", "$max-sm": { minH: 44 }, onPress: switchModelFromRecovery, children: t("Switch model") }), _jsx(Box, { render: _jsx("button", { type: "button", title: t("Dismiss") }), "aria-label": t("Dismiss"), onClick: () => setWalletRecovery(null), display: "flex", items: "center", justify: "center", width: 28, height: 28, rounded: 999, cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minW: 44, minH: 44 }, children: _jsx(X, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }) })] })] })) : null, (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
|
|
2127
|
+
head: previewing || files.length || turnedAway || prepWrong || preparing || talk.open || talk.refusal || banner || simulatedResetAt || walletRecovery ? (_jsxs(_Fragment, { children: [previewing ? _jsx(PreviewButton, { name: previewing.name, onOpen: () => see(previewing) }) : null, walletRecovery ? (_jsxs(XStack, { role: "alert", "data-slot": "wallet-recovery-strip", items: "center", justify: "space-between", gap: "$2.5", flexWrap: "wrap", px: "$3", py: "$2", rounded: "$4", bg: "var(--surface-card)", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsxs(YStack, { gap: "$0.5", flex: 1, minW: 180, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t("Out of credits — your prompt was kept in the composer") }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t("Add credits to continue with this model, or switch to another model.") })] }), _jsxs(XStack, { items: "center", gap: "$1.5", flexWrap: "wrap", children: [_jsx(Button, { size: "xs", rounded: 999, "$max-sm": { minH: 44 }, onPress: () => requestUpgrade(), children: t("Add credits") }), _jsx(Button, { size: "xs", variant: "outline", rounded: 999, borderColor: "var(--border-strong)", "$max-sm": { minH: 44 }, onPress: switchModelFromRecovery, children: t("Switch model") }), _jsx(Box, { render: _jsx("button", { type: "button", title: t("Dismiss") }), "aria-label": t("Dismiss"), onClick: () => setWalletRecovery(null), display: "flex", items: "center", justify: "center", width: 28, height: 28, rounded: 999, cursor: "pointer", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, "$max-sm": { minW: 44, minH: 44 }, children: _jsx(X, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }) })] })] })) : null, (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
|
|
2091
2128
|
? worded(talk.refusal)
|
|
2092
2129
|
: talk.reply
|
|
2093
2130
|
? `Hanzo: ${talk.reply}`
|
|
@@ -2369,11 +2406,11 @@ function Thread({ placeholder = message(), initial, anonymous = false, settled =
|
|
|
2369
2406
|
const silent = cast.length > 1 && !(chat.streaming && at === shown.length - 1)
|
|
2370
2407
|
? addressed(words(q?.content), cast).filter((name) => !parts.some((part) => part.who?.toLowerCase() === name.toLowerCase()))
|
|
2371
2408
|
: [];
|
|
2372
|
-
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.5", 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 && !isStreamingThisTurn ? (_jsx(AssistantTurnActions, { text: part.text, latest: isLatestAssistant, canRegenerate: !chat.streaming && !anonBusy, onRegenerate: () => redoTurn(turn.id, { mode: "retry" }), onBranch: anonymous || forgetful ? undefined : () => branchTurn(turn.id), onOpen: opener(part.text), onOpenInDev: () => openInDev({ prompt: part.text }), onCreateBoardCard: anonymous ? undefined : () => createBoardCardFromTurn(part.text), onSchedule: anonymous ? undefined : () => setPlan(part.text) })) : 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)] }));
|
|
2409
|
+
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.5", 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 && !isStreamingThisTurn ? (_jsx(AssistantTurnActions, { text: part.text, latest: isLatestAssistant, canRegenerate: !chat.streaming && !anonBusy, onRegenerate: () => redoTurn(turn.id, { mode: "retry" }), onBranch: anonymous || forgetful ? undefined : () => branchTurn(turn.id), onOpen: opener(part.text), preview: previews(part.text), onOpenInDev: () => openInDev({ prompt: part.text }), onCreateBoardCard: anonymous ? undefined : () => createBoardCardFromTurn(part.text), onSchedule: anonymous ? undefined : () => setPlan(part.text) })) : 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)] }));
|
|
2373
2410
|
}
|
|
2374
2411
|
const ms = turn.durationMs;
|
|
2375
2412
|
const worked = turn.role === "assistant" && typeof ms === "number" && ms >= 1000 ? ms : 0;
|
|
2376
|
-
return (_jsxs(YStack, { gap: "$2", "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 && !isStreamingThisTurn ? (_jsx(AssistantTurnActions, { text: said, latest: isLatestAssistant, canRegenerate: !chat.streaming && !anonBusy, onRegenerate: () => redoTurn(turn.id, { mode: "retry" }), onBranch: anonymous || forgetful ? undefined : () => branchTurn(turn.id), onOpen: opener(said), onOpenInDev: () => openInDev({ prompt: said }), onCreateBoardCard: anonymous ? undefined : () => createBoardCardFromTurn(said), onSchedule: anonymous ? undefined : () => setPlan(said) })) : null, turn.role === "assistant" && said ? byline(turn.id) : null] }));
|
|
2413
|
+
return (_jsxs(YStack, { gap: "$2", "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 && !isStreamingThisTurn ? (_jsx(AssistantTurnActions, { text: said, latest: isLatestAssistant, canRegenerate: !chat.streaming && !anonBusy, onRegenerate: () => redoTurn(turn.id, { mode: "retry" }), onBranch: anonymous || forgetful ? undefined : () => branchTurn(turn.id), onOpen: opener(said), preview: previews(said), onOpenInDev: () => openInDev({ prompt: said }), onCreateBoardCard: anonymous ? undefined : () => createBoardCardFromTurn(said), onSchedule: anonymous ? undefined : () => setPlan(said) })) : null, turn.role === "assistant" && said ? byline(turn.id) : null] }));
|
|
2377
2414
|
},
|
|
2378
2415
|
// The page's ONE heading, and it belongs to the empty transcript rather
|
|
2379
2416
|
// than to a signed-out branch — the branch is gone, and the heading went
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
4
|
import { useI18n } from '@hanzo/i18n/react';
|
|
5
|
-
import { Dialog, DialogContent, DialogTitle,
|
|
5
|
+
import { Dialog, DialogContent, DialogTitle, Text, XStack, YStack } from '@hanzo/ui';
|
|
6
6
|
import { Search, X } from 'lucide-react';
|
|
7
7
|
import { FIRST, SettingsList } from './Settings.js';
|
|
8
8
|
import { SettingsPane } from './SettingsPane.js';
|
|
@@ -21,5 +21,8 @@ export function PreferencesDialog({ open, onOpenChange, initialSection = FIRST,
|
|
|
21
21
|
}
|
|
22
22
|
setActive(row.id);
|
|
23
23
|
};
|
|
24
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "preferences-dialog", width: "94vw", maxW: 980, height: "84vh", maxH: 760, p: 0, gap: 0, rounded: 14, overflow: "hidden", bg: "var(--pane-fill, var(--card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--
|
|
24
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "preferences-dialog", width: "94vw", maxW: 980, height: "84vh", maxH: 760, p: 0, gap: 0, rounded: 14, overflow: "hidden", bg: "var(--pane-fill, var(--card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", children: [_jsx(DialogTitle, { display: "none", children: t('Settings') }), _jsxs(XStack, { flex: 1, minH: 0, minW: 0, width: "100%", overflow: "hidden", "$max-md": { flexDirection: 'column' }, children: [_jsxs(YStack, { width: 256, shrink: 0, height: "100%", minW: 0, bg: "var(--side-fill, var(--background))", borderRightWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", "$max-md": { width: '100%', height: 'auto', maxH: '42%', borderRightWidth: 0, borderBottomWidth: 1 }, children: [_jsx(XStack, { px: 12, pt: 12, pb: 8, shrink: 0, children: _jsxs(XStack, { "data-slot": "settings-search", flex: 1, height: 32, px: 10, gap: 8, items: "center", rounded: 8, bg: "var(--surface-card-quiet, var(--card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", children: [_jsx(XStack, { "data-slot": "settings-search-icon", width: 14, height: 14, shrink: 0, items: "center", justify: "center", pointerEvents: "none", "aria-hidden": true, children: _jsx(Search, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true }) }), _jsx(Text, { "data-slot": "settings-search-input", render: _jsx("input", { type: "search", value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
|
|
25
|
+
if (e.key === 'Escape')
|
|
26
|
+
setFilter('');
|
|
27
|
+
}, placeholder: t('Search settings'), "aria-label": t('Search settings') }), flex: 1, minW: 0, width: "100%", height: "100%", p: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", fontSize: 13, color: "var(--foreground)" }), filter ? (_jsx(XStack, { render: "button", type: 'button', "aria-label": t('Clear search'), onClick: () => setFilter(''), width: 18, height: 18, shrink: 0, rounded: 999, items: "center", justify: "center", bg: "transparent", borderWidth: 0, cursor: "pointer", hoverStyle: { bg: 'var(--secondary)' }, children: _jsx(X, { size: 11, color: "var(--muted-foreground)", "aria-hidden": true }) })) : null] }) }), _jsx(YStack, { flex: 1, minH: 0, px: 8, pb: 12, overflowY: "auto", overflowX: "hidden", children: _jsx(SettingsList, { active: active, filter: filter, onPick: pick, onBack: () => onOpenChange(false) }) })] }), _jsxs(YStack, { flex: 1, minW: 0, minH: 0, height: "100%", bg: "var(--pane-fill, var(--card))", position: "relative", children: [_jsx(XStack, { position: "absolute", t: 12, r: 14, z: 5, children: _jsx(XStack, { render: "button", type: 'button', "aria-label": t('Close'), onClick: () => onOpenChange(false), width: 32, height: 32, rounded: 999, items: "center", justify: "center", bg: "var(--surface-card-quiet, var(--card))", borderWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", cursor: "pointer", hoverStyle: { bg: 'var(--secondary)' }, children: _jsx(X, { size: 15, color: "var(--foreground)", "aria-hidden": true }) }) }), _jsx(SettingsPane, { id: active })] })] })] }) }));
|
|
25
28
|
}
|
package/dist/Shell.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export declare function Shell({ mode, front, children, }: {
|
|
|
26
26
|
front?: boolean;
|
|
27
27
|
children: ReactNode;
|
|
28
28
|
}): import("react").JSX.Element;
|
|
29
|
+
/** The shell's sidebar: its default width, px (unified with ground.ts SIDE). */
|
|
30
|
+
export declare const SIDEBAR_WIDTH = 256;
|
|
29
31
|
/** Whether the pane is drawn in the app's frame (`Split framed`), where what
|
|
30
32
|
* floats on the frame's ground is cut as a pane. */
|
|
31
33
|
export declare const Framed: import("react").Context<boolean>;
|
|
@@ -60,3 +62,11 @@ export declare function Split({ children, swap, framed, bare, }: {
|
|
|
60
62
|
framed?: boolean;
|
|
61
63
|
bare?: boolean;
|
|
62
64
|
}): import("react").JSX.Element;
|
|
65
|
+
/** What a place holds, for the list column. */
|
|
66
|
+
export declare function ShellIndex({ mode, owner, filter, onPick, navigate, }: {
|
|
67
|
+
mode: Mode;
|
|
68
|
+
owner: string;
|
|
69
|
+
filter: string;
|
|
70
|
+
onPick?: () => void;
|
|
71
|
+
navigate?: (route: string) => void;
|
|
72
|
+
}): import("react").JSX.Element;
|
package/dist/Shell.js
CHANGED
|
@@ -55,7 +55,7 @@ import { parseModels } from "@hanzo/ui/models/catalog";
|
|
|
55
55
|
import { mark } from "./lib/mark.js";
|
|
56
56
|
import { useOpen } from "./open.js";
|
|
57
57
|
import { useSpan } from "./span.js";
|
|
58
|
-
import { pane, RAIL } from "./ground.js";
|
|
58
|
+
import { pane, RAIL, SIDE } from "./ground.js";
|
|
59
59
|
import { useFree } from "./Upgrade.js";
|
|
60
60
|
import { payUrl } from "./lib/pay.js";
|
|
61
61
|
import { rememberSettingsReturn, useDevMode } from "./lib/dev-mode.js";
|
|
@@ -84,7 +84,7 @@ import { Face } from "./cast.js";
|
|
|
84
84
|
import { useStarred, titleOf } from "./stars.js";
|
|
85
85
|
import { channelName } from "./network.js";
|
|
86
86
|
import { useChannels, teamKey, channelHref } from "./channels.js";
|
|
87
|
-
import { apex, app, away, chat, CHAT as TALK, dev, ENTRY, leaves, WORKSPACE } from "./lib/host.js";
|
|
87
|
+
import { apex, app, away, chat, CHAT as TALK, dev, ENTRY, FLOW, leaves, WORKSPACE } from "./lib/host.js";
|
|
88
88
|
import { netKey } from "./conversations.js";
|
|
89
89
|
import { FIRST, SettingsList, } from "./Settings.js";
|
|
90
90
|
import { Search } from "./Search.js";
|
|
@@ -962,8 +962,8 @@ const FLOOR = 200;
|
|
|
962
962
|
const CEIL = 420;
|
|
963
963
|
/** Per-reader, per-browser. A width that resets is a width you set every load. */
|
|
964
964
|
const SPAN = "hanzo.app.column";
|
|
965
|
-
/** The shell's sidebar: its default width, px. */
|
|
966
|
-
const SIDEBAR_WIDTH =
|
|
965
|
+
/** The shell's sidebar: its default width, px (unified with ground.ts SIDE). */
|
|
966
|
+
export const SIDEBAR_WIDTH = SIDE;
|
|
967
967
|
/**
|
|
968
968
|
* Where an app's own column goes, when it has one.
|
|
969
969
|
*
|
|
@@ -1029,10 +1029,11 @@ export function Split({ children, swap, framed = false, bare = false, }) {
|
|
|
1029
1029
|
: { ...pane(), overflow: "hidden" }
|
|
1030
1030
|
: {
|
|
1031
1031
|
...sheet(0),
|
|
1032
|
+
backgroundColor: "var(--pane-fill, var(--card))",
|
|
1032
1033
|
// The edge the pane shares with the column before it: the left, or the right in a right-to-left language.
|
|
1033
1034
|
borderInlineStartWidth: 1,
|
|
1034
1035
|
borderInlineStartStyle: "solid",
|
|
1035
|
-
borderColor: "var(--edge, var(--border))",
|
|
1036
|
+
borderColor: "var(--pane-edge, var(--edge, var(--border)))",
|
|
1036
1037
|
}), ref: split.main, width: "100%", height: "100%", minW: 0, minH: 0, children: [swap ?? (_jsx(Framed.Provider, { value: framed, children: _jsx(SideProvider, { value: split.side, children: _jsx(Slot.Provider, { value: slot, children: children }) }) })), !aside && !swap ? (_jsx(YStack, { "data-slot": "side-pull", "aria-hidden": true, ...{ title: t("Drag to open split browser") }, position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: 10, z: 10, items: "center", justify: "center", cursor: "col-resize", display: "none", $lg: { display: "flex" }, ...{ touchAction: "none" }, onDoubleClick: () => showAside("tasks"), onPointerDown: (e) => {
|
|
1037
1038
|
if (e.button !== 0)
|
|
1038
1039
|
return;
|
|
@@ -1121,15 +1122,15 @@ function ShellProfileHover({ name, email, avatar, orgId, signedIn, onSettings, o
|
|
|
1121
1122
|
}
|
|
1122
1123
|
function Rail({ mode, places, team, open, hiddenOnDesktop = false, navigate, onMore, avatarSlot, }) {
|
|
1123
1124
|
const { t } = useI18n();
|
|
1124
|
-
return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t("Places"), ...sheet(0), gridArea: "rail", minH: 0, borderInlineEndWidth: 1, borderInlineEndStyle: "solid", borderColor: "var(--edge, var(--white-
|
|
1125
|
+
return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t("Places"), ...sheet(0), bg: "var(--side-fill, var(--background))", gridArea: "rail", minH: 0, borderInlineEndWidth: 1, borderInlineEndStyle: "solid", borderColor: "var(--pane-edge, var(--edge, var(--white-08)))", $md: hiddenOnDesktop ? { display: "none" } : undefined, "$max-md": {
|
|
1125
1126
|
flexDirection: "row",
|
|
1126
1127
|
items: "center",
|
|
1127
1128
|
borderInlineEndWidth: 0,
|
|
1128
1129
|
borderTopWidth: 1,
|
|
1129
|
-
borderTopColor: "var(--
|
|
1130
|
+
borderTopColor: "var(--pane-edge, var(--white-08))",
|
|
1130
1131
|
},
|
|
1131
1132
|
// Clear of the home indicator on a phone; zero on a flat screen.
|
|
1132
|
-
pb: HOME_INDICATOR, children: [_jsx(YStack, { "$max-md": { display: "none" }, borderBottomWidth: 1, borderColor: "var(--edge, var(--white-
|
|
1133
|
+
pb: HOME_INDICATOR, children: [_jsx(YStack, { "$max-md": { display: "none" }, borderBottomWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", mx: "$2", children: _jsx(Tiles, {}) }), _jsxs(YStack, { "data-slot": "places", ...bare, items: "center", gap: "$0.5", flex: 1, minW: 0, minH: 0, overflowY: "auto", overflowX: "hidden", pt: "$2", $md: open ? { display: "none" } : undefined, "$max-md": {
|
|
1133
1134
|
display: "grid",
|
|
1134
1135
|
gridAutoFlow: "column",
|
|
1135
1136
|
gridAutoColumns: "minmax(0, 1fr)",
|
|
@@ -1159,15 +1160,51 @@ function App({ filter, onPick, navigate, }) {
|
|
|
1159
1160
|
onPick?.();
|
|
1160
1161
|
} }), _jsx(SidebarFolder, { name: t("Projects"), open: filter ? true : undefined, children: _jsx(Projects, { filter: filter, onPick: open }) }), _jsx(Chats, { filter: filter, onPick: onPick })] }));
|
|
1161
1162
|
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Dev's column: start a thread, projects first, then threads. Keeps Dev
|
|
1165
|
+
* composable on the canonical shell without falling through to generic Chats.
|
|
1166
|
+
*/
|
|
1167
|
+
function DevIndex({ filter, onPick, navigate, }) {
|
|
1168
|
+
const { t } = useI18n();
|
|
1169
|
+
const { empty } = useOpen();
|
|
1170
|
+
const openProject = (slug) => {
|
|
1171
|
+
navigate?.(dev(slug));
|
|
1172
|
+
onPick?.();
|
|
1173
|
+
};
|
|
1174
|
+
return (_jsxs(YStack, { "data-slot": "dev-index", children: [_jsx(SidebarNewChat, { label: t("New thread"), onPress: () => {
|
|
1175
|
+
empty();
|
|
1176
|
+
navigate?.(dev(""));
|
|
1177
|
+
onPick?.();
|
|
1178
|
+
} }), _jsx(YStack, { "data-slot": "dev-projects", children: _jsx(SidebarFolder, { name: t("Projects"), defaultOpen: true, open: filter ? true : undefined, children: _jsx(Projects, { filter: filter, onPick: openProject }) }) }), _jsx(YStack, { "data-slot": "dev-threads", children: _jsx(SidebarFolder, { name: t("Threads"), defaultOpen: true, open: filter ? true : undefined, children: _jsx(Chats, { filter: filter, onPick: onPick }) }) })] }));
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Bots' column: the agents roster with a subtle `/flow` Workflows entry below
|
|
1182
|
+
* a monochrome hairline divider.
|
|
1183
|
+
*/
|
|
1184
|
+
function BotsIndex({ owner, filter, onPick, navigate, }) {
|
|
1185
|
+
const { t } = useI18n();
|
|
1186
|
+
const showWorkflows = matches(t("Workflows"), filter) || matches("flow", filter);
|
|
1187
|
+
return (_jsxs(YStack, { "data-slot": "bots-index", children: [_jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate }), showWorkflows ? (_jsx(YStack, { "data-slot": "bots-workflows", pt: "$2", mt: "$2", borderTopWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", children: _jsx(SidebarSection, { label: t("Automation"), children: _jsx(SidebarItem, { "data-slot": "bots-workflows-link", icon: _jsx(Workflow, { size: 15, "aria-hidden": true }), onPress: () => {
|
|
1188
|
+
if (navigate)
|
|
1189
|
+
navigate(FLOW);
|
|
1190
|
+
else if (typeof window !== "undefined")
|
|
1191
|
+
window.location.assign(FLOW);
|
|
1192
|
+
onPick?.();
|
|
1193
|
+
}, children: t("Workflows") }) }) })) : null] }));
|
|
1194
|
+
}
|
|
1162
1195
|
/** What a place holds, for the list column. */
|
|
1163
|
-
function
|
|
1196
|
+
export function ShellIndex({ mode, owner, filter, onPick, navigate, }) {
|
|
1164
1197
|
const { t } = useI18n();
|
|
1165
1198
|
const channels = (_jsxs(_Fragment, { children: [_jsx(Channels, { onPick: onPick, navigate: navigate }), _jsx(Team, { filter: filter, onPick: onPick, navigate: navigate })] }));
|
|
1166
1199
|
if (mode === "chat")
|
|
1167
1200
|
return _jsx(App, { filter: filter, onPick: onPick, navigate: navigate });
|
|
1201
|
+
if (mode === "dev")
|
|
1202
|
+
return _jsx(DevIndex, { filter: filter, onPick: onPick, navigate: navigate });
|
|
1168
1203
|
if (mode === "home")
|
|
1169
1204
|
return (_jsxs(_Fragment, { children: [_jsx(Chats, { filter: filter, onPick: onPick }), channels, _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate }), _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate })] }));
|
|
1170
|
-
if (mode === "bots"
|
|
1205
|
+
if (mode === "bots")
|
|
1206
|
+
return _jsx(BotsIndex, { owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
1207
|
+
if (mode === "agents")
|
|
1171
1208
|
return _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
1172
1209
|
if (mode === "contacts")
|
|
1173
1210
|
return _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
@@ -1175,11 +1212,6 @@ function Index({ mode, owner, filter, onPick, navigate, }) {
|
|
|
1175
1212
|
return channels;
|
|
1176
1213
|
if (mode === "tasks")
|
|
1177
1214
|
return _jsx(Projects, { filter: filter, onPick: onPick });
|
|
1178
|
-
if (mode === "dev")
|
|
1179
|
-
return (_jsx(Projects, { filter: filter, onPick: (slug) => {
|
|
1180
|
-
navigate?.(dev(slug));
|
|
1181
|
-
onPick?.();
|
|
1182
|
-
} }));
|
|
1183
1215
|
if (mode === "drive")
|
|
1184
1216
|
return (_jsx(SidebarSection, { label: t("Storage"), children: _jsx(Note, { children: t("Browse cloud buckets, project files, and local folders in Drive.") }) }));
|
|
1185
1217
|
if (mode === "cal")
|
|
@@ -1252,10 +1284,19 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1252
1284
|
const tiers = useTiers();
|
|
1253
1285
|
const [hidden] = useHidden();
|
|
1254
1286
|
const shown = asked || peeking;
|
|
1255
|
-
const toggle = () => {
|
|
1287
|
+
const toggle = useCallback(() => {
|
|
1256
1288
|
setPeeking(false);
|
|
1257
|
-
setAsked((open) =>
|
|
1258
|
-
|
|
1289
|
+
setAsked((open) => {
|
|
1290
|
+
const next = !open;
|
|
1291
|
+
try {
|
|
1292
|
+
localStorage.setItem("hanzo:sidebar:open", String(next));
|
|
1293
|
+
}
|
|
1294
|
+
catch {
|
|
1295
|
+
// No storage still toggles the sidebar in memory.
|
|
1296
|
+
}
|
|
1297
|
+
return next;
|
|
1298
|
+
});
|
|
1299
|
+
}, []);
|
|
1259
1300
|
const dismiss = () => {
|
|
1260
1301
|
setPeeking(false);
|
|
1261
1302
|
if (typeof window !== "undefined" && window.innerWidth < 1024)
|
|
@@ -1415,7 +1456,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1415
1456
|
const list = (_jsxs(Sidebar, { ref: side.ref, ...side.props, $md: { width: "var(--span)" }, "$max-md": { width: "100%", maxW: 280 }, ...sheet(0),
|
|
1416
1457
|
// The kit draws the sidebar's edge on its right, a physical side, so the edge is
|
|
1417
1458
|
// traded here: the left in a right-to-left language, where the sidebar stands at the right.
|
|
1418
|
-
bg: "var(--side-fill, var(--
|
|
1459
|
+
bg: "var(--side-fill, var(--background))", rounded: "var(--pane-round)", borderWidth: 1, borderColor: "var(--pane-edge, var(--edge, var(--white-08)))", overflowX: "hidden", position: "relative", children: [_jsx(Gutter
|
|
1419
1460
|
// The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
|
|
1420
1461
|
, {
|
|
1421
1462
|
// The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
|
|
@@ -1427,14 +1468,14 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1427
1468
|
}, "aria-label": t("{brandName} home", { brandName: brand() }), title: t("Home") }), "data-slot": "home", display: "flex", items: "center", justify: "center", width: 28, height: 28, $touchable: { width: 44, height: 44, minW: 44, minH: 44 }, color: "inherit", children: _jsx(HanzoMark, { size: 18 }) }), settled && isAuthenticated ? (_jsx(XStack, { shrink: 1, minW: 0, children: _jsx(TopOrgSelector, {}) })) : null] }), _jsx(YStack, { "data-slot": "places-list", px: "$2", pt: "$2", pb: "$2", gap: 1, "$max-md": { display: "none" }, children: places.filter((place) => matches(t(place.label), filter)).map((place) => (_jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, bg: place.id === mode ? "$raised" : "transparent", hoverStyle: { bg: place.id === mode ? "$raised" : "$hover" }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: place.id === mode ? 1 : 0.78, children: _jsx(place.icon, { size: 16, "aria-hidden": true }) }), active: place.id === mode, onPress: () => {
|
|
1428
1469
|
navigate?.(place.route);
|
|
1429
1470
|
onPick?.();
|
|
1430
|
-
}, children: t(place.label) }, place.id))) }), more.length ? (_jsx(YStack, { "data-slot": "setup-list", px: "$2", pb: "$2", children: _jsx(SidebarSection, { label: t("Setup"), mt: "$1", children: more.map((tool) => (_jsx(SidebarItem, { gap: "$2.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: 0.78, children: _jsx(tool.icon, { size: 15, "aria-hidden": true }) }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, minW: 0, height: 30, $touchable: { minH: 44 }, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true }), _jsx(Text, { render: _jsx("input", { value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
|
|
1471
|
+
}, children: t(place.label) }, place.id))) }), more.length ? (_jsx(YStack, { "data-slot": "setup-list", px: "$2", pb: "$2", children: _jsx(SidebarSection, { label: t("Setup"), mt: "$1", children: more.map((tool) => (_jsx(SidebarItem, { gap: "$2.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: 0.78, children: _jsx(tool.icon, { size: 15, "aria-hidden": true }) }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, minW: 0, height: 30, $touchable: { minH: 44 }, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsx(XStack, { shrink: 0, items: "center", justify: "center", pointerEvents: "none", "aria-hidden": true, children: _jsx(SearchIcon, { size: 13, "aria-hidden": true }) }), _jsx(Text, { render: _jsx("input", { value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
|
|
1431
1472
|
if (e.key === "Escape")
|
|
1432
1473
|
setFilter("");
|
|
1433
1474
|
},
|
|
1434
1475
|
// FILTER, not Search. Two controls that both said Search did two
|
|
1435
1476
|
// different things: this one narrows the list beside you, and the
|
|
1436
1477
|
// bar above opens the palette that finds anything anywhere.
|
|
1437
|
-
placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(
|
|
1478
|
+
placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(ShellIndex, { mode: mode, owner: owner, filter: filter, onPick: onPick, navigate: navigate })) : null, devMode && products.length ? (_jsx(SidebarFolder, { name: t("Cloud & Platform"), open: filter ? true : undefined, children: products.map((prod) => (_jsx(SidebarItem, { icon: _jsx(prod.icon, { size: 13, "aria-hidden": true }), onPress: () => window.open(prod.href, "_blank", "noopener"), children: t(prod.label) }, prod.id))) })) : null] }) }) })), settled && onApex ? _jsx(Leave, { href: signedIn ? ENTRY : WORKSPACE, children: t("Workspace") }) : null, settled ? (signedIn ? (_jsxs(_Fragment, { children: [free ? (_jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(Sparkles, { size: 15, "aria-hidden": true, color: "var(--foreground)" }), onPress: () => {
|
|
1438
1479
|
window.location.assign(payUrl("/cart", { returnUrl: window.location.href }));
|
|
1439
1480
|
dismiss();
|
|
1440
1481
|
}, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite teammates") }), _jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
|
|
@@ -1512,7 +1553,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1512
1553
|
gridTemplateColumns: "minmax(0, 1fr)",
|
|
1513
1554
|
gridTemplateRows: `${SHELL_BAR}px minmax(0, 1fr) ${TABS_HEIGHT}`,
|
|
1514
1555
|
gridTemplateAreas: '"bar" "pane" "rail"',
|
|
1515
|
-
}, position: "relative", width: "100%", flex: 1, minH: 0, overflow: "hidden", bg: "
|
|
1556
|
+
}, position: "relative", width: "100%", flex: 1, minH: 0, overflow: "hidden", bg: "var(--pane-floor, var(--background))", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, hiddenOnDesktop: !showDesktopRail, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onMore: () => setFinding(true), avatarSlot: settled && signedIn ? (_jsx(ShellProfileHover, { name: who.person.name || who.person.email || t("You"), email: who.person.email, avatar: who.person.avatar, orgId: owner || scoped() || "", signedIn: signedIn, onSettings: () => {
|
|
1516
1557
|
setAsked(true);
|
|
1517
1558
|
showSettings(FIRST);
|
|
1518
1559
|
}, onSignOut: () => void logout(), children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "rail-profile", "aria-label": t("Account: {name}", { name: who.person.name || who.person.email || t("You") }), onClick: () => {
|
package/dist/Sidebar.js
CHANGED
|
@@ -605,7 +605,7 @@ export function Sidebar({ pins, host, mode, thread, go, onShut, onSeek, onBack,
|
|
|
605
605
|
const primaryNewLabel = mode === 'dev' ? t('New run') : mode === 'design' ? t('New design') : mode === 'studio' ? t('New creation') : mode === 'flow' ? t('New flow') : t('New chat');
|
|
606
606
|
const showPrimaryNew = !at && (mode === 'chat' || (!anon && (mode === 'dev' || mode === 'design' || mode === 'studio' || mode === 'flow')));
|
|
607
607
|
const showRecents = !(mode === 'hosted' || mode === 'beta' || mode === 'tabs' || mode === 'studio' || mode === 'flow' || anon || at);
|
|
608
|
-
return (_jsx(TooltipProvider, { delay: 120, children: _jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : `var(--span, ${WIDTH}px)`, maxW: drawer ? undefined : `var(--span, ${WIDTH}px)`, bg: drawer ? undefined : 'var(--side-fill, var(--
|
|
608
|
+
return (_jsx(TooltipProvider, { delay: 120, children: _jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : `var(--span, ${WIDTH}px)`, maxW: drawer ? undefined : `var(--span, ${WIDTH}px)`, bg: drawer ? undefined : 'var(--side-fill, var(--background))', rounded: drawer ? undefined : 'var(--pane-round)', borderWidth: drawer ? 0 : 1, borderColor: "var(--pane-edge, var(--edge, var(--white-08)))", children: [_jsxs(Base, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: 8, pt: drawer ? 'var(--pane-gap)' : 4, pb: drawer ? 0 : '$2', gap: "$0", "$platform-web": anon && !drawer ? { overflow: 'visible' } : undefined, children: [at ? (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: 2, paddingInlineStart: 0, paddingInlineEnd: 0, height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", "data-tauri-drag-region": "false", onPress: onBack, ...SUB_HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...SUB_HEAD, children: _jsx(Search, { size: 15, "aria-hidden": true }) })), drawer || !onShut ? null : (_jsx(SidebarIconButton, { label: t('Fold sidebar to icons'), "data-slot": "sidebar-fold", "data-tauri-drag-region": "false", onPress: onShut, ...SUB_HEAD, children: _jsx(PanelLeftClose, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }))] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: 2, paddingInlineStart: 8, paddingInlineEnd: 2, height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", gap: 4, children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", numberOfLines: 1, children: brand() }) }), drawer || anon ? null : _jsx(Activity, { host: host }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...(drawer
|
|
609
609
|
? {
|
|
610
610
|
width: 40,
|
|
611
611
|
height: 40,
|
package/dist/about.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Member } from './team.js';
|
|
2
|
+
/** The id the turn is held under in the thread, beside the cast's. */
|
|
3
|
+
export declare const ABOUT = "about";
|
|
4
|
+
/**
|
|
5
|
+
* The turn, for a product named `brand` whose agent team is `team`.
|
|
6
|
+
*
|
|
7
|
+
* The control it names, Preview, is the one Chat draws: the label on an
|
|
8
|
+
* answer's own button where the answer wrote a page, and on a phone, where the
|
|
9
|
+
* panel is a sheet, the button just above the message box (Chat.tsx
|
|
10
|
+
* `PreviewButton`).
|
|
11
|
+
*/
|
|
12
|
+
export declare function about(brand: string, team: readonly Member[]): string;
|
package/dist/about.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// What Chat tells the model about the place it is answering in.
|
|
2
|
+
//
|
|
3
|
+
// A model knows itself (zen's family.md names it and its maker) and nothing of
|
|
4
|
+
// the app around the conversation. Asked "tell me about the Dev, Des, Vi agents
|
|
5
|
+
// below the chat bar", Enso answered that it could not see any Hanzo interface
|
|
6
|
+
// and refused the whole question (hanzo-inc/app issue 441); asked for a landing page
|
|
7
|
+
// it built a Hanzo AI showcase nobody had described (issue 442); and having written
|
|
8
|
+
// the page it sent the person to "the Output panel", a name no control on a
|
|
9
|
+
// phone carries (issue 443). Each answer was the model filling a gap with a guess.
|
|
10
|
+
//
|
|
11
|
+
// So Chat seats this beside the conversation as a system turn of its own, after
|
|
12
|
+
// the cast's (Chat.tsx `seated`): the agents as @hanzo/personas publishes them,
|
|
13
|
+
// where a page it writes shows and what that place is called, and to ask before
|
|
14
|
+
// a build nobody has described. English, because the model reads it, and pure,
|
|
15
|
+
// so the tests read exactly what the wire carries.
|
|
16
|
+
/** The id the turn is held under in the thread, beside the cast's. */
|
|
17
|
+
export const ABOUT = 'about';
|
|
18
|
+
/** One member as a line: `Dev (Development): code, engineering, software systems`. */
|
|
19
|
+
const line = (one) => `- ${one.name} (${one.role}): ${one.owns}`;
|
|
20
|
+
/**
|
|
21
|
+
* The turn, for a product named `brand` whose agent team is `team`.
|
|
22
|
+
*
|
|
23
|
+
* The control it names, Preview, is the one Chat draws: the label on an
|
|
24
|
+
* answer's own button where the answer wrote a page, and on a phone, where the
|
|
25
|
+
* panel is a sheet, the button just above the message box (Chat.tsx
|
|
26
|
+
* `PreviewButton`).
|
|
27
|
+
*/
|
|
28
|
+
export function about(brand, team) {
|
|
29
|
+
const leads = team.filter((one) => one.lead);
|
|
30
|
+
const bots = team.filter((one) => !one.lead);
|
|
31
|
+
return [
|
|
32
|
+
`You are answering in ${brand} Chat. You cannot see the screen, but you know the app: when the person asks about ${brand}, its agents or this app, answer from what follows, in plain words, and never say you have no access to it.`,
|
|
33
|
+
'',
|
|
34
|
+
`AGENTS. ${brand}'s agents are AI teammates, each with its own role, voice and tools. They are offered with the message box (its + menu › Agents, and as faces beside it). Picking one brings it into this conversation, where it answers in its own voice, and several can be in one conversation. These lead the team and answer when asked:`,
|
|
35
|
+
...leads.map(line),
|
|
36
|
+
'These can also run on their own around the clock, woken by a schedule or a trigger:',
|
|
37
|
+
...bots.map(line),
|
|
38
|
+
`An organization adds the ones it wants, or makes its own, under + › Agents › Manage agents. For hands-on work, Dev also has its own section of ${brand}, where it works in a codebase.`,
|
|
39
|
+
'',
|
|
40
|
+
'PREVIEW. A page or picture you write in a fenced code block (```html or ```svg) opens beside the conversation as soon as your answer ends; on a phone it opens over the conversation. Call that place "the Preview": your answer gets a Preview button that reopens it, and on a phone a Preview button also stands just above the message box. Never send the person to a panel, tab or button by any other name. Say a page is ready only after you have written it in full.',
|
|
41
|
+
'',
|
|
42
|
+
'BEFORE A BIG BUILD. When asked to build something large (a site, a landing page, an app, a long document) and the request does not say what it is for, who it is for, or what it should contain, do not invent those. Ask one or two short questions first, or say in a sentence what you would build and ask whether to go ahead. A small or fully described request you just do.',
|
|
43
|
+
].join('\n');
|
|
44
|
+
}
|
package/dist/bots/Bots.js
CHANGED
|
@@ -12,9 +12,13 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
12
12
|
import { useIam } from '@hanzo/iam/react';
|
|
13
13
|
import { useI18n } from '@hanzo/i18n/react';
|
|
14
14
|
import { XStack, YStack } from '@hanzo/gui';
|
|
15
|
+
import { Gutter } from '@hanzo/build';
|
|
15
16
|
import { ENSO, useAi } from '../lib/ai.js';
|
|
17
|
+
import { SIDE } from '../ground.js';
|
|
16
18
|
import { useKept } from '../kept.js';
|
|
19
|
+
import { useSpan } from '../span.js';
|
|
17
20
|
import { say } from '../failure.js';
|
|
21
|
+
import { ROSTER_WIDTH_MAX, ROSTER_WIDTH_MIN } from './grid.js';
|
|
18
22
|
import { Roster } from './Roster.js';
|
|
19
23
|
import { Thread } from './Thread.js';
|
|
20
24
|
import { GroupPanel, GroupThread, MakeGroupDialog } from './Groups.js';
|
|
@@ -80,6 +84,11 @@ export function Bots({ foot = true, bot: held, onBot, } = {}) {
|
|
|
80
84
|
const [over, setOver] = useState(false);
|
|
81
85
|
const wide = useWide('(min-width: 768px)');
|
|
82
86
|
const laptop = useWide('(min-width: 1280px)');
|
|
87
|
+
const rosterSpan = useSpan('hanzo.bots.roster.width', SIDE, ROSTER_WIDTH_MIN, ROSTER_WIDTH_MAX);
|
|
88
|
+
const [rosterWidth, setRosterWidth] = useState(SIDE);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
setRosterWidth(rosterSpan.span);
|
|
91
|
+
}, [rosterSpan.span]);
|
|
83
92
|
useEffect(() => {
|
|
84
93
|
if (hosted)
|
|
85
94
|
return;
|
|
@@ -324,7 +333,13 @@ export function Bots({ foot = true, bot: held, onBot, } = {}) {
|
|
|
324
333
|
const panel = activeGroup ? (_jsx(GroupPanel, { group: activeGroup, groups: groups, bots: bots ?? [], onClose: close, onEdit: () => setEditingGroup(activeGroup), onDelete: removeGroup, onPickBot: pick }, `grp:${activeGroup.name}`)) : bot ? (_jsx(Panel, { bot: bot, groups: groups, runs: runs ?? [], kept: kept[bot.name] ?? '', onClose: close, onSchedule: schedule, onDelete: remove, onBotChanged: read, onPickGroup: pick, focus: over && !laptop }, bot.name)) : null;
|
|
325
334
|
const shown = laptop ? side : over;
|
|
326
335
|
const hasSelection = Boolean(bot || activeGroup);
|
|
327
|
-
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [
|
|
336
|
+
return (_jsxs(XStack, { "data-parity-key": "bots.window", width: "100%", height: "100%", overflow: "hidden", bg: FLOOR, position: "relative", children: [_jsxs(YStack, { ref: rosterSpan.ref, "data-parity-key": "bots.roster", position: "relative", width: rosterWidth, shrink: 0, height: "100%", bg: FLOOR, borderRightWidth: 1, borderColor: LINE, "$max-md": { width: '100%', borderRightWidth: 0, display: hasSelection ? 'none' : 'flex' }, children: [_jsx(Roster, { bots: bots, groups: groups, last: last, open: openRef, unread: unread, me: foot ? user : null, width: rosterWidth, onPick: pick, onMake: () => setMaking(true), onMakeGroup: () => setMakingGroup(true), disabled: !live }), wide ? (_jsx(Gutter, { side: "left", span: rosterWidth, floor: ROSTER_WIDTH_MIN, ceil: ROSTER_WIDTH_MAX, reset: SIDE, onSpan: (n) => {
|
|
337
|
+
rosterSpan.move(n);
|
|
338
|
+
setRosterWidth(n);
|
|
339
|
+
}, onKeep: (n) => {
|
|
340
|
+
rosterSpan.keep(n);
|
|
341
|
+
setRosterWidth(n);
|
|
342
|
+
}, label: t('Resize bots sidebar') })) : null] }), _jsx(YStack, { "data-parity-key": "bots.center", flex: 1, minW: 0, height: "100%", bg: GROUND, "$max-md": { display: hasSelection ? 'flex' : 'none' }, children: activeGroup ? (_jsx(GroupThread, { group: activeGroup, bots: bots ?? [], side: shown, onSide: () => (laptop ? setSide(!side) : setOver(!over)), onBack: back, onEdit: () => setEditingGroup(activeGroup), onPickBot: pick }, activeGroup.name)) : (_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: 312, minW: 300, 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": activeGroup?.name || bot?.name, position: "absolute", t: 0, r: 0, b: 0, width: 312, minW: 300, "$max-sm": { minW: 0 }, maxW: "100%", z: 10, bg: GROUND, borderLeftWidth: 1, borderColor: LINE, boxShadow: "var(--shadow-floating)", children: panel })) : null, making ? _jsx(Make, { groups: groups, onDone: made, onCancel: () => setMaking(false) }) : null, makingGroup || editingGroup ? (_jsx(MakeGroupDialog, { bots: bots ?? [], groups: groups, initial: editingGroup, onDone: savedGroup, onCancel: () => {
|
|
328
343
|
setMakingGroup(false);
|
|
329
344
|
setEditingGroup(null);
|
|
330
345
|
} })) : null] }));
|
package/dist/bots/Roster.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type { Agent, AgentRun } from '@hanzo/ai';
|
|
2
2
|
import { type BotGroup } from './api.js';
|
|
3
|
-
export declare function Roster({ bots, groups, last, open, unread, me, onPick, onMake, onMakeGroup, disabled, }: {
|
|
3
|
+
export declare function Roster({ bots, groups, last, open, unread, me, width, onPick, onMake, onMakeGroup, onWorkflows, disabled, }: {
|
|
4
4
|
bots: Agent[] | null;
|
|
5
5
|
groups?: readonly BotGroup[];
|
|
6
6
|
last: ReadonlyMap<string, AgentRun>;
|
|
7
7
|
open: string | null;
|
|
8
8
|
unread: string | null;
|
|
9
9
|
me: unknown;
|
|
10
|
+
/** Live sidebar width in px, driving the 1 → 2 → 3 column Pinned Bots grid. */
|
|
11
|
+
width?: number;
|
|
10
12
|
onPick: (name: string) => void;
|
|
11
13
|
onMake: () => void;
|
|
12
14
|
onMakeGroup?: () => void;
|
|
15
|
+
onWorkflows?: () => void;
|
|
13
16
|
disabled: boolean;
|
|
14
17
|
}): import("react").JSX.Element;
|